diff --git a/.github/ISSUE_TEMPLATE/3-help.md b/.github/ISSUE_TEMPLATE/3-help.md deleted file mode 100644 index f1a1acdfc70ba0..00000000000000 --- a/.github/ISSUE_TEMPLATE/3-help.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: "⁉️ Need help with Node.js?" -about: Please file an issue in our help repo. - ---- - -If you have a question about Node.js that is not a bug report or feature -request, please post it in https://github.com/nodejs/help! - -Questions posted to this repository will be closed. diff --git a/.github/ISSUE_TEMPLATE/4-nodejs-org.md b/.github/ISSUE_TEMPLATE/4-nodejs-org.md deleted file mode 100644 index 917e560a50c08e..00000000000000 --- a/.github/ISSUE_TEMPLATE/4-nodejs-org.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: "\U0001F310 Found a problem with nodejs.org?" -about: Please file an issue in the Node.js website repo. - ---- - -If you have a question, suggestion or issue regarding our website, -please post it in https://github.com/nodejs/nodejs.org! - -Issues with the Node.js API documentation should be posted here. All other -issues regarding the website will be closed. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000000..d319d377249b8b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: ⁉️ Need help with Node.js? + url: https://github.com/nodejs/help + about: Please file an issue in our help repo. + - name: 🌐 Found a problem with nodejs.org? + url: https://github.com/nodejs/nodejs.org/issues/new/choose + about: Please file an issue in the Node.js website repo. diff --git a/.mailmap b/.mailmap index 127e1782b394a2..e140392b723514 100644 --- a/.mailmap +++ b/.mailmap @@ -270,7 +270,10 @@ Miguel Angel Asencio Hurtado maasencioh Mike Kaufman Minqi Pan P.S.V.R -Minwoo Jung JungMinu +Minuk Park +Minwoo Jung JungMinu +Minwoo Jung +Minwoo Jung Miroslav Bajtoš Mitar Milutinovic Myles Borins @@ -336,6 +339,7 @@ Santiago Gimeno Sarah Meyer sarahmeyer Sartrey Lee sartrey Saúl Ibarra Corretgé +Shobhit Chittora Scott Blomquist Segu Riluvan Sergey Kryzhanovsky @@ -382,6 +386,7 @@ Takahiro ANDO Tarun Batra Tarun Ted Young Teppei Sato +Theotime Poisseau Thomas Hunter II Thomas Lee Thomas Reggi diff --git a/.travis.yml b/.travis.yml index 93456573438b1c..50f14e23a948e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,3 +91,15 @@ jobs: - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST}; fi + + - name: "Find syntax errors in our Python dependencies" + language: python + python: 3.8 + install: + - mv .flake8 disabled.flake8 # take the blinders off of flake8 + - python3.8 -m pip install --upgrade pip + - python3.8 -m pip install flake8 + script: + - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + allow_failures: # TODO (cclauss): remove this when dependencies are clean + - name: "Find syntax errors in our Python dependencies" diff --git a/AUTHORS b/AUTHORS index 908ef597485387..a3d620f2f9c392 100644 --- a/AUTHORS +++ b/AUTHORS @@ -773,7 +773,7 @@ Minqi Pan Jacob Edelman Mike Atkins hackerjs <4141095@qq.com> -Minwoo Jung +Minwoo Jung Marcin Cieślak Anne-Gaelle Colom Oleksandr Chekhovskyi @@ -2653,7 +2653,6 @@ Furqan Shaikh Roy Sommer James Bunton Kevin Smith -Minwoo Jung H1Gdev Julian Alimin Lakshmi Swetha Gopireddy @@ -2847,5 +2846,25 @@ Levhita claudiahdz Geoffrey Booth Javier Ledezma +Marian Rusnak <4215517+marian-r@users.noreply.github.com> +Jenia +Anton Gerasimov +rickyes +Simon A. Eugster +TATSUNO Yasuhiro +Robert Jensen +dokugo +Jakob Krigovsky +Sergei Osipov +themez +Maria Paktiti +Unlocked <10186337+TheUnlocked@users.noreply.github.com> +Huachao Mao +Lucas Pardue +Nicolas Thumann <46975855+n-thumann@users.noreply.github.com> +akitsu-sanae +Minuk Park +Jim Schlight +Theotime Poisseau # Generated by tools/update-authors.js diff --git a/BUILDING.md b/BUILDING.md index 7fed3f9bdd084d..c4d348ae41b7e5 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -280,6 +280,11 @@ $ ./configure $ make -j4 ``` +If you run into a `No module named 'distutils.spawn'` error when executing +`./configure`, please try `python3 -m pip install --upgrade setuptools` or +`sudo apt install python3-distutils -y`. +For more information, see https://github.com/nodejs/node/issues/30189. + The `-j4` option will cause `make` to run 4 simultaneous compilation jobs which may reduce build time. For more information, see the [GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html). diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b915cbff0649f..4552688be24ac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,8 @@ release. -12.13.0
+12.13.1
+12.13.0
12.12.0
12.11.1
12.11.0
diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 43bd683e800287..0315a2dbb83001 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -341,6 +341,9 @@ 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. +Avoid Runtime Deprecations when an alias or a stub/no-op will suffice. An alias +or stub will have lower maintenance costs for end users and Node.js core. + All deprecations receive a unique and immutable identifier. Documentation, warnings, and errors use the identifier when referring to the deprecation. The documentation for the deprecation identifier must always remain in the API diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 30a2ec99fa087b..8808405b2c6553 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -206,8 +206,8 @@ Use explicit comparisons to `nullptr` when testing pointers, i.e. ### Ownership and Smart Pointers -* [R.20]: Use `std::unique_ptr` or `std::shared_ptr` to represent ownership -* [R.21]: Prefer `unique_ptr` over `shared_ptr` unless you need to share +* [R.20][]: Use `std::unique_ptr` or `std::shared_ptr` to represent ownership +* [R.21][]: Prefer `unique_ptr` over `shared_ptr` unless you need to share ownership Use `std::unique_ptr` to make ownership transfer explicit. For example: @@ -286,8 +286,8 @@ data[0] = 12345; Further reading: -* [ES.48]: Avoid casts -* [ES.49]: If you must use a cast, use a named cast +* [ES.48][]: Avoid casts +* [ES.49][]: If you must use a cast, use a named cast ### Using `auto` diff --git a/Makefile b/Makefile index 0a5177d1c3e7d6..356fcf40487e93 100644 --- a/Makefile +++ b/Makefile @@ -347,24 +347,6 @@ test-valgrind: all test-check-deopts: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential -benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node: \ - benchmark/napi/function_call/napi_binding.c \ - benchmark/napi/function_call/binding.cc \ - benchmark/napi/function_call/binding.gyp | all - $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ - --python="$(PYTHON)" \ - --directory="$(shell pwd)/benchmark/napi/function_call" \ - --nodedir="$(shell pwd)" - -benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node: \ - benchmark/napi/function_args/napi_binding.c \ - benchmark/napi/function_args/binding.cc \ - benchmark/napi/function_args/binding.gyp | all - $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ - --python="$(PYTHON)" \ - --directory="$(shell pwd)/benchmark/napi/function_args" \ - --nodedir="$(shell pwd)" - DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.js doc/api/addons.md ifeq ($(OSTYPE),aix) @@ -470,6 +452,17 @@ test/node-api/.buildstamp: $(ADDONS_PREREQS) \ # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp +BENCHMARK_NAPI_BINDING_GYPS := $(wildcard benchmark/napi/*/binding.gyp) + +BENCHMARK_NAPI_BINDING_SOURCES := \ + $(wildcard benchmark/napi/*/*.c) \ + $(wildcard benchmark/napi/*/*.cc) \ + $(wildcard benchmark/napi/*/*.h) + +benchmark/napi/.buildstamp: $(ADDONS_PREREQS) \ + $(BENCHMARK_NAPI_BINDING_GYPS) $(BENCHMARK_NAPI_BINDING_SOURCES) + @$(call run_build_addons,"$$PWD/benchmark/napi",$@) + .PHONY: clear-stalled clear-stalled: @echo "Clean up any leftover processes but don't error if found." @@ -599,11 +592,10 @@ test-hash-seed: all $(NODE) test/pummel/test-hash-seed.js .PHONY: test-doc -test-doc: doc-only ## Builds, lints, and verifies the docs. +test-doc: doc-only lint ## Builds, lints, and verifies the docs. @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ echo "Skipping test-doc (no crypto)"; \ else \ - $(MAKE) lint; \ $(PYTHON) tools/test.py $(PARALLEL_ARGS) doctool; \ fi @@ -1163,13 +1155,12 @@ bench: bench-addons-build # Build required addons for benchmark before running it. .PHONY: bench-addons-build -bench-addons-build: benchmark/napi/function_call/build/$(BUILDTYPE)/binding.node \ - benchmark/napi/function_args/build/$(BUILDTYPE)/binding.node +bench-addons-build: | $(NODE_EXE) benchmark/napi/.buildstamp .PHONY: bench-addons-clean bench-addons-clean: - $(RM) -r benchmark/napi/function_call/build - $(RM) -r benchmark/napi/function_args/build + $(RM) -r benchmark/napi/*/build + $(RM) benchmark/napi/.buildstamp .PHONY: lint-md-rollup lint-md-rollup: diff --git a/README.md b/README.md index 8bc15d76e1d10c..aa5ca6d6595170 100644 --- a/README.md +++ b/README.md @@ -338,26 +338,22 @@ For information about the governance of the Node.js project, see **Jan Krems** <jan.krems@gmail.com> (he/him) * [joaocgreis](https://github.com/joaocgreis) - **João Reis** <reis@janeasystems.com> -* [joshgav](https://github.com/joshgav) - -**Josh Gavant** <josh.gavant@outlook.com> * [joyeecheung](https://github.com/joyeecheung) - **Joyee Cheung** <joyeec9h3@gmail.com> (she/her) * [julianduque](https://github.com/julianduque) - **Julian Duque** <julianduquej@gmail.com> (he/him) * [JungMinu](https://github.com/JungMinu) - -**Minwoo Jung** <minwoo@nodesource.com> (he/him) +**Minwoo Jung** <nodecorelab@gmail.com> (he/him) * [kfarnung](https://github.com/kfarnung) - **Kyle Farnung** <kfarnung@microsoft.com> (he/him) -* [kunalspathak](https://github.com/kunalspathak) - -**Kunal Pathak** <kunal.pathak@microsoft.com> * [lance](https://github.com/lance) - **Lance Ball** <lball@redhat.com> (he/him) +* [legendecas](https://github.com/legendecas) - +**Chengzhong Wu** <legendecas@gmail.com> (he/him) * [Leko](https://github.com/Leko) - **Shingo Inoue** <leko.noor@gmail.com> (he/him) * [lpinca](https://github.com/lpinca) - **Luigi Pinca** <luigipinca@gmail.com> (he/him) -* [lucamaraschi](https://github.com/lucamaraschi) - -**Luca Maraschi** <luca.maraschi@gmail.com> (he/him) * [lundibundi](https://github.com/lundibundi) - **Denys Otrishko** <shishugi@gmail.com> (he/him) * [maclover7](https://github.com/maclover7) - @@ -430,8 +426,6 @@ For information about the governance of the Node.js project, see **Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> (he/him) * [thekemkid](https://github.com/thekemkid) - **Glen Keane** <glenkeane.94@gmail.com> (he/him) -* [thlorenz](https://github.com/thlorenz) - -**Thorsten Lorenz** <thlorenz@gmx.de> * [TimothyGu](https://github.com/TimothyGu) - **Tiancheng "Timothy" Gu** <timothygu99@gmail.com> (he/him) * [tniessen](https://github.com/tniessen) - @@ -479,6 +473,12 @@ For information about the governance of the Node.js project, see **Isaac Z. Schlueter** <i@izs.me> * [jhamhader](https://github.com/jhamhader) - **Yuval Brik** <yuval@brik.org.il> +* [joshgav](https://github.com/joshgav) - +**Josh Gavant** <josh.gavant@outlook.com> +* [kunalspathak](https://github.com/kunalspathak) - +**Kunal Pathak** <kunal.pathak@microsoft.com> +* [lucamaraschi](https://github.com/lucamaraschi) - +**Luca Maraschi** <luca.maraschi@gmail.com> (he/him) * [lxe](https://github.com/lxe) - **Aleksey Smolenchuk** <lxe@lxe.co> * [matthewloring](https://github.com/matthewloring) - @@ -515,6 +515,8 @@ For information about the governance of the Node.js project, see **Stefan Budeanu** <stefan@budeanu.com> * [tellnes](https://github.com/tellnes) - **Christian Tellnes** <christian@tellnes.no> +* [thlorenz](https://github.com/thlorenz) - +**Thorsten Lorenz** <thlorenz@gmx.de> * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** <m.j.tunnicliffe@gmail.com> * [vsemozhetbyt](https://github.com/vsemozhetbyt) - diff --git a/benchmark/README.md b/benchmark/README.md index 1e82614dbbff90..45256670fdd2aa 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -74,7 +74,7 @@ The common.js module is used by benchmarks for consistency across repeated tasks. It has a number of helpful functions and properties to help with writing benchmarks. -### createBenchmark(fn, configs[, options]) +### createBenchmark(fn, configs\[, options\]) See [the guide on writing benchmarks](../doc/guides/writing-and-running-benchmarks.md#basics-of-a-benchmark). diff --git a/benchmark/fs/bench-opendir.js b/benchmark/fs/bench-opendir.js new file mode 100644 index 00000000000000..419c3a231a850b --- /dev/null +++ b/benchmark/fs/bench-opendir.js @@ -0,0 +1,51 @@ +'use strict'; + +const common = require('../common'); +const fs = require('fs'); +const path = require('path'); + +const bench = common.createBenchmark(main, { + n: [100], + dir: [ 'lib', 'test/parallel'], + mode: [ 'async', 'sync', 'callback' ] +}); + +async function main({ n, dir, mode }) { + const fullPath = path.resolve(__dirname, '../../', dir); + + bench.start(); + + let counter = 0; + for (let i = 0; i < n; i++) { + if (mode === 'async') { + // eslint-disable-next-line no-unused-vars + for await (const entry of await fs.promises.opendir(fullPath)) + counter++; + } else if (mode === 'callback') { + const dir = await fs.promises.opendir(fullPath); + await new Promise((resolve, reject) => { + function read() { + dir.read((err, entry) => { + if (err) { + reject(err); + } else if (entry === null) { + resolve(dir.close()); + } else { + counter++; + read(); + } + }); + } + + read(); + }); + } else { + const dir = fs.opendirSync(fullPath); + while (dir.readSync() !== null) + counter++; + dir.closeSync(); + } + } + + bench.end(counter); +} diff --git a/benchmark/napi/ref/.gitignore b/benchmark/napi/ref/.gitignore new file mode 100644 index 00000000000000..567609b1234a9b --- /dev/null +++ b/benchmark/napi/ref/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/benchmark/napi/ref/addon.c b/benchmark/napi/ref/addon.c new file mode 100644 index 00000000000000..3fb8de603d3ced --- /dev/null +++ b/benchmark/napi/ref/addon.c @@ -0,0 +1,82 @@ +#include +#define NAPI_EXPERIMENTAL +#include + +#define NAPI_CALL(env, call) \ + do { \ + napi_status status = (call); \ + if (status != napi_ok) { \ + napi_throw_error((env), NULL, #call " failed"); \ + return NULL; \ + } \ + } while (0) + +static napi_value +GetCount(napi_env env, napi_callback_info info) { + napi_value result; + size_t* count; + + NAPI_CALL(env, napi_get_instance_data(env, (void**)&count)); + NAPI_CALL(env, napi_create_uint32(env, *count, &result)); + + return result; +} + +static napi_value +SetCount(napi_env env, napi_callback_info info) { + size_t* count; + + NAPI_CALL(env, napi_get_instance_data(env, (void**)&count)); + + // Set the count to zero irrespective of what is passed into the setter. + *count = 0; + + return NULL; +} + +static void +IncrementCounter(napi_env env, void* data, void* hint) { + size_t* count = data; + (*count) = (*count) + 1; +} + +static napi_value +NewWeak(napi_env env, napi_callback_info info) { + napi_value result; + void* instance_data; + + NAPI_CALL(env, napi_create_object(env, &result)); + NAPI_CALL(env, napi_get_instance_data(env, &instance_data)); + NAPI_CALL(env, napi_add_finalizer(env, + result, + instance_data, + IncrementCounter, + NULL, + NULL)); + + return result; +} + +static void +FreeCount(napi_env env, void* data, void* hint) { + free(data); +} + +/* napi_value */ +NAPI_MODULE_INIT(/* napi_env env, napi_value exports */) { + napi_property_descriptor props[] = { + { "count", NULL, NULL, GetCount, SetCount, NULL, napi_enumerable, NULL }, + { "newWeak", NULL, NewWeak, NULL, NULL, NULL, napi_enumerable, NULL } + }; + + size_t* count = malloc(sizeof(*count)); + *count = 0; + + NAPI_CALL(env, napi_define_properties(env, + exports, + sizeof(props) / sizeof(*props), + props)); + NAPI_CALL(env, napi_set_instance_data(env, count, FreeCount, NULL)); + + return exports; +} diff --git a/benchmark/napi/ref/binding.gyp b/benchmark/napi/ref/binding.gyp new file mode 100644 index 00000000000000..d641e99efd77cf --- /dev/null +++ b/benchmark/napi/ref/binding.gyp @@ -0,0 +1,10 @@ +{ + 'targets': [ + { + 'target_name': 'addon', + 'sources': [ + 'addon.c' + ] + } + ] +} diff --git a/benchmark/napi/ref/index.js b/benchmark/napi/ref/index.js new file mode 100644 index 00000000000000..3a5e1988275eaa --- /dev/null +++ b/benchmark/napi/ref/index.js @@ -0,0 +1,17 @@ +'use strict'; +const common = require('../../common'); +const addon = require(`./build/${common.buildType}/addon`); +const bench = common.createBenchmark(main, { n: [1e7] }); + +function callNewWeak() { + addon.newWeak(); +} + +function main({ n }) { + addon.count = 0; + bench.start(); + while (addon.count < n) { + callNewWeak(); + } + bench.end(n); +} diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js index c4e1da3f6f0c8b..f19e30b5450785 100644 --- a/benchmark/net/net-pipe.js +++ b/benchmark/net/net-pipe.js @@ -49,7 +49,7 @@ function main({ dur, len, type }) { setTimeout(() => { // Multiply by 2 since we're sending it first one way - // then then back again. + // then back again. const bytes = writer.received * 2; const gbits = (bytes * 8) / (1024 * 1024 * 1024); bench.end(gbits); diff --git a/benchmark/net/tcp-raw-pipe.js b/benchmark/net/tcp-raw-pipe.js index 89db42dc4f3e72..4420cc2e6dcc17 100644 --- a/benchmark/net/tcp-raw-pipe.js +++ b/benchmark/net/tcp-raw-pipe.js @@ -106,7 +106,7 @@ function main({ dur, len, type }) { setTimeout(() => { // Multiply by 2 since we're sending it first one way - // then then back again. + // then back again. bench.end(2 * (bytes * 8) / (1024 * 1024 * 1024)); process.exit(0); }, dur * 1000); diff --git a/benchmark/vm/create-context.js b/benchmark/vm/create-context.js new file mode 100644 index 00000000000000..d74cafe6a0a7b0 --- /dev/null +++ b/benchmark/vm/create-context.js @@ -0,0 +1,24 @@ +'use strict'; + +const common = require('../common.js'); + +const bench = common.createBenchmark(main, { + n: [100] +}); + +const vm = require('vm'); + +const ctxFn = new vm.Script(` + var b = Math.random(); + var c = a + b; +`); + +function main({ n }) { + bench.start(); + let context; + for (let i = 0; i < n; i++) { + context = vm.createContext({ a: 'a' }); + } + bench.end(n); + ctxFn.runInContext(context); +} diff --git a/common.gypi b/common.gypi index 6501f78796fd17..b86e5e05d7df9a 100644 --- a/common.gypi +++ b/common.gypi @@ -38,7 +38,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.12', + 'v8_embedder_string': '-node.16', ##### V8 defaults for Node.js ##### diff --git a/configure.py b/configure.py index 473bbfeb294b34..20cce214dbb113 100755 --- a/configure.py +++ b/configure.py @@ -11,7 +11,10 @@ import shlex import subprocess import shutil +import io + from distutils.spawn import find_executable as which +from distutils.version import StrictVersion # If not run from node/, cd to node/. os.chdir(os.path.dirname(__file__) or '.') @@ -294,23 +297,23 @@ shared_optgroup.add_option('--shared-cares', action='store_true', - dest='shared_libcares', + dest='shared_cares', help='link to a shared cares DLL instead of static linking') shared_optgroup.add_option('--shared-cares-includes', action='store', - dest='shared_libcares_includes', + dest='shared_cares_includes', help='directory containing cares header files') shared_optgroup.add_option('--shared-cares-libname', action='store', - dest='shared_libcares_libname', + dest='shared_cares_libname', default='cares', help='alternative lib name to link to [default: %default]') shared_optgroup.add_option('--shared-cares-libpath', action='store', - dest='shared_libcares_libpath', + dest='shared_cares_libpath', help='a directory to search for the shared cares DLL') parser.add_option_group(shared_optgroup) @@ -701,7 +704,7 @@ def get_version_helper(cc, regexp): if match: return match.group(2) else: - return '0' + return '0.0' def get_nasm_version(asm): try: @@ -712,7 +715,7 @@ def get_nasm_version(asm): warn('''No acceptable ASM compiler found! Please make sure you have installed NASM from https://www.nasm.us and refer BUILDING.md.''') - return '0' + return '0.0' match = re.match(r"NASM version ([2-9]\.[0-9][0-9]+)", to_utf8(proc.communicate()[0])) @@ -720,7 +723,7 @@ def get_nasm_version(asm): if match: return match.group(1) else: - return '0' + return '0.0' def get_llvm_version(cc): return get_version_helper( @@ -753,7 +756,7 @@ def get_gas_version(cc): return match.group(1) else: warn('Could not recognize `gas`: ' + gas_ret) - return '0' + return '0.0' # Note: Apple clang self-reports as clang 4.2.0 and gcc 4.2.1. It passes # the version check more by accident than anything else but a more rigorous @@ -764,7 +767,7 @@ def check_compiler(o): if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'): nasm_version = get_nasm_version('nasm') o['variables']['nasm_version'] = nasm_version - if nasm_version == 0: + if nasm_version == '0.0': o['variables']['openssl_no_asm'] = 1 return @@ -772,7 +775,8 @@ def check_compiler(o): if not ok: warn('failed to autodetect C++ compiler version (CXX=%s)' % CXX) elif clang_version < (8, 0, 0) if is_clang else gcc_version < (6, 3, 0): - warn('C++ compiler too old, need g++ 6.3.0 or clang++ 8.0.0 (CXX=%s)' % CXX) + warn('C++ compiler (CXX=%s, %s) too old, need g++ 6.3.0 or clang++ 8.0.0' % + (CXX, ".".join(map(str, clang_version if is_clang else gcc_version)))) ok, is_clang, clang_version, gcc_version = try_check_compiler(CC, 'c') if not ok: @@ -781,9 +785,10 @@ def check_compiler(o): # clang 3.2 is a little white lie because any clang version will probably # do for the C bits. However, we might as well encourage people to upgrade # to a version that is not completely ancient. - warn('C compiler too old, need gcc 4.2 or clang 3.2 (CC=%s)' % CC) + warn('C compiler (CC=%s, %s) too old, need gcc 4.2 or clang 3.2' % + (CC, ".".join(map(str, gcc_version)))) - o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else 0 + o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else '0.0' # Need xcode_version or gas_version when openssl asm files are compiled. if options.without_ssl or options.openssl_no_asm or options.shared_openssl: @@ -1132,12 +1137,13 @@ def configure_napi(output): version = getnapibuildversion.get_napi_version() output['variables']['napi_build_version'] = version -def configure_library(lib, output): +def configure_library(lib, output, pkgname=None): shared_lib = 'shared_' + lib output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) if getattr(options, shared_lib): - (pkg_libs, pkg_cflags, pkg_libpath, pkg_modversion) = pkg_config(lib) + (pkg_libs, pkg_cflags, pkg_libpath, pkg_modversion) = ( + pkg_config(pkgname or lib)) if options.__dict__[shared_lib + '_includes']: output['include_dirs'] += [options.__dict__[shared_lib + '_includes']] @@ -1229,10 +1235,10 @@ def without_ssl_error(option): # supported asm compiler for AVX2. See https://github.com/openssl/openssl/ # blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69 openssl110_asm_supported = \ - ('gas_version' in variables and float(variables['gas_version']) >= 2.23) or \ - ('xcode_version' in variables and float(variables['xcode_version']) >= 5.0) or \ - ('llvm_version' in variables and float(variables['llvm_version']) >= 3.3) or \ - ('nasm_version' in variables and float(variables['nasm_version']) >= 2.10) + ('gas_version' in variables and StrictVersion(variables['gas_version']) >= StrictVersion('2.23')) or \ + ('xcode_version' in variables and StrictVersion(variables['xcode_version']) >= StrictVersion('5.0')) or \ + ('llvm_version' in variables and StrictVersion(variables['llvm_version']) >= StrictVersion('3.3')) or \ + ('nasm_version' in variables and StrictVersion(variables['nasm_version']) >= StrictVersion('2.10')) if is_x86 and not openssl110_asm_supported: error('''Did not find a new enough assembler, install one or build with @@ -1496,10 +1502,11 @@ def write_config(data, name): icu_ver_major = None matchVerExp = r'^\s*#define\s+U_ICU_VERSION_SHORT\s+"([^"]*)".*' match_version = re.compile(matchVerExp) - for line in open(uvernum_h).readlines(): - m = match_version.match(line) - if m: - icu_ver_major = m.group(1) + with io.open(uvernum_h, encoding='utf8') as in_file: + for line in in_file: + m = match_version.match(line) + if m: + icu_ver_major = str(m.group(1)) if not icu_ver_major: error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h) elif int(icu_ver_major) < icu_versions['minimum_icu']: @@ -1615,11 +1622,8 @@ def make_bin_override(): configure_library('zlib', output) configure_library('http_parser', output) configure_library('libuv', output) -configure_library('libcares', output) -configure_library('nghttp2', output) -# stay backwards compatible with shared cares builds -output['variables']['node_shared_cares'] = \ - output['variables'].pop('node_shared_libcares') +configure_library('cares', output, pkgname='libcares') +configure_library('nghttp2', output, pkgname='libnghttp2') configure_v8(output) configure_openssl(output) configure_intl(output) diff --git a/deps/icu-small/source/data/in/icudt64l.dat b/deps/icu-small/source/data/in/icudt64l.dat index 2ff9d277c58be3..de81e4c01361aa 100644 Binary files a/deps/icu-small/source/data/in/icudt64l.dat and b/deps/icu-small/source/data/in/icudt64l.dat differ diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index be910e716ee04f..14356c0d919b5a 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -662,3 +662,4 @@ Ben Blank Christian Clauss Nikita Lebedev Henrik Gemal +Philip Harrison diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 4fbcb82690a901..ea7bfdb3a98437 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,37 @@ +## 6.12.1 (2019-10-29) + +### BUG FIXES + +* [`6508e833d`](https://github.com/npm/cli/commit/6508e833df35a3caeb2b496f120ce67feff306b6) + [#269](https://github.com/npm/cli/pull/269) + add node v13 as a supported version + ([@ljharb](https://github.com/ljharb)) +* [`b6588a8f7`](https://github.com/npm/cli/commit/b6588a8f74fb8b1ad103060b73c4fd5174b1d1f6) + [#265](https://github.com/npm/cli/pull/265) + Fix regression in lockfile repair for sub-deps + ([@feelepxyz](https://github.com/feelepxyz)) +* [`d5dfe57a1`](https://github.com/npm/cli/commit/d5dfe57a1d810fe7fd64edefc976633ee3a4da53) + [#266](https://github.com/npm/cli/pull/266) + resolve circular dependency in pack.js + ([@addaleax](https://github.com/addaleax)) + +### DEPENDENCIES + +* [`73678bb59`](https://github.com/npm/cli/commit/73678bb590a8633c3bdbf72e08f1279f9e17fd28) + `chownr@1.1.3` +* [`4b76926e2`](https://github.com/npm/cli/commit/4b76926e2058ef30ab1d5e2541bb96d847653417) + `graceful-fs@4.2.3` +* [`c691f36a9`](https://github.com/npm/cli/commit/c691f36a9c108b6267859fe61e4a38228b190c17) + `libcipm@4.0.7` +* [`5e1a14975`](https://github.com/npm/cli/commit/5e1a14975311bfdc43df8e1eb317ae5690ee580c) + `npm-packlist@1.4.6` +* [`c194482d6`](https://github.com/npm/cli/commit/c194482d65ee81a5a0a6281c7a9f984462286c56) + `npm-registry-fetch@4.0.2` +* [`bc6a8e0ec`](https://github.com/npm/cli/commit/bc6a8e0ec966281e49b1dc66f9c641ea661ab7a6) + `tar@4.4.1` +* [`4dcca3cbb`](https://github.com/npm/cli/commit/4dcca3cbb161da1f261095d9cdd26e1fbb536a8d) + `uuid@3.3.3` + ## 6.12.0 (2019-10-08): Now `npm ci` runs prepare scripts for git dependencies, and respects the diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index 776b7663d003ea..9b281c8e5fa4e1 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -118,5 +118,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-access.html b/deps/npm/html/doc/cli/npm-access.html index 67e1c1376eff6a..33411d29397238 100644 --- a/deps/npm/html/doc/cli/npm-access.html +++ b/deps/npm/html/doc/cli/npm-access.html @@ -93,5 +93,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-adduser.html b/deps/npm/html/doc/cli/npm-adduser.html index e181047ff9476c..2b29655abe1ab7 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -78,5 +78,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-audit.html b/deps/npm/html/doc/cli/npm-audit.html index 1c429cdd6156e6..a7064a719653c5 100644 --- a/deps/npm/html/doc/cli/npm-audit.html +++ b/deps/npm/html/doc/cli/npm-audit.html @@ -94,4 +94,4 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-bin.html b/deps/npm/html/doc/cli/npm-bin.html index ce3888762e19a5..f0af59c8b4cf2b 100644 --- a/deps/npm/html/doc/cli/npm-bin.html +++ b/deps/npm/html/doc/cli/npm-bin.html @@ -34,5 +34,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-bugs.html b/deps/npm/html/doc/cli/npm-bugs.html index 6393bbd10ab363..3988ff3c5bb007 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -54,5 +54,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-build.html b/deps/npm/html/doc/cli/npm-build.html index 8f8d063d96fb2d..7b86bb7f8ee4c6 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -38,5 +38,5 @@

DESCRIPTION

       - + diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index cd19d7f22dffbe..818e407bac7d4f 100644 --- a/deps/npm/html/doc/cli/npm-bundle.html +++ b/deps/npm/html/doc/cli/npm-bundle.html @@ -31,5 +31,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-cache.html b/deps/npm/html/doc/cli/npm-cache.html index c92bc4b3f9ae8f..132f9c3b1c4e5f 100644 --- a/deps/npm/html/doc/cli/npm-cache.html +++ b/deps/npm/html/doc/cli/npm-cache.html @@ -88,5 +88,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-ci.html b/deps/npm/html/doc/cli/npm-ci.html index db98b5b87d64e3..c308ab4fa0bd99 100644 --- a/deps/npm/html/doc/cli/npm-ci.html +++ b/deps/npm/html/doc/cli/npm-ci.html @@ -58,4 +58,4 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-completion.html b/deps/npm/html/doc/cli/npm-completion.html index 012db785be7c60..48622a8953f9e9 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -42,5 +42,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index 37628606038250..ff165a76f85774 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -62,5 +62,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index 77d540f4dac506..63ace676816cc2 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -58,5 +58,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index 67f1f4f13f002e..06d0bc8f23c36e 100644 --- a/deps/npm/html/doc/cli/npm-deprecate.html +++ b/deps/npm/html/doc/cli/npm-deprecate.html @@ -38,5 +38,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-dist-tag.html b/deps/npm/html/doc/cli/npm-dist-tag.html index 2cc82f9e172d71..26bf3d484c4b02 100644 --- a/deps/npm/html/doc/cli/npm-dist-tag.html +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -86,5 +86,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-docs.html b/deps/npm/html/doc/cli/npm-docs.html index a1f563c7eadb82..0d54bbd09cfc66 100644 --- a/deps/npm/html/doc/cli/npm-docs.html +++ b/deps/npm/html/doc/cli/npm-docs.html @@ -55,5 +55,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-doctor.html b/deps/npm/html/doc/cli/npm-doctor.html index 8933be43478ed6..e4ac987571a047 100644 --- a/deps/npm/html/doc/cli/npm-doctor.html +++ b/deps/npm/html/doc/cli/npm-doctor.html @@ -102,4 +102,4 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-edit.html b/deps/npm/html/doc/cli/npm-edit.html index 29947456779b80..33a25fc4a36ac3 100644 --- a/deps/npm/html/doc/cli/npm-edit.html +++ b/deps/npm/html/doc/cli/npm-edit.html @@ -50,5 +50,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-explore.html b/deps/npm/html/doc/cli/npm-explore.html index 148effd01ff2f0..05fc585cc213b0 100644 --- a/deps/npm/html/doc/cli/npm-explore.html +++ b/deps/npm/html/doc/cli/npm-explore.html @@ -47,5 +47,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-help-search.html b/deps/npm/html/doc/cli/npm-help-search.html index 787e364cae101b..9cc8f42db2b168 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -44,5 +44,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index f1adbc13d8d0f0..c8788374f1d488 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -49,5 +49,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-hook.html b/deps/npm/html/doc/cli/npm-hook.html index 33fcb28e77973e..a5b352c54eb156 100644 --- a/deps/npm/html/doc/cli/npm-hook.html +++ b/deps/npm/html/doc/cli/npm-hook.html @@ -52,4 +52,4 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index 0657eb1d22e7a3..cac14079dc63ef 100644 --- a/deps/npm/html/doc/cli/npm-init.html +++ b/deps/npm/html/doc/cli/npm-init.html @@ -61,5 +61,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-install-ci-test.html b/deps/npm/html/doc/cli/npm-install-ci-test.html index 24f395056aca72..802112b8d7dc3f 100644 --- a/deps/npm/html/doc/cli/npm-install-ci-test.html +++ b/deps/npm/html/doc/cli/npm-install-ci-test.html @@ -32,4 +32,4 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-install-test.html b/deps/npm/html/doc/cli/npm-install-test.html index 59cde254366ae2..be69c6106a5728 100644 --- a/deps/npm/html/doc/cli/npm-install-test.html +++ b/deps/npm/html/doc/cli/npm-install-test.html @@ -41,5 +41,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index c81dd92e687abe..9e40f4c11dddb7 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -370,5 +370,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-link.html b/deps/npm/html/doc/cli/npm-link.html index 4c2508e51929f6..c2b7d651bd8fca 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -71,5 +71,5 @@

SYNOPSIS

       - + diff --git a/deps/npm/html/doc/cli/npm-logout.html b/deps/npm/html/doc/cli/npm-logout.html index 0d90f54c87d8df..717d4da3cb4c93 100644 --- a/deps/npm/html/doc/cli/npm-logout.html +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -49,5 +49,5 @@

scope

       - + diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index bc842c0bbe3f52..f1e6a2088d8960 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -20,7 +20,7 @@

SYNOPSIS

limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

-
npm@6.12.0 /path/to/npm
+
npm@6.12.1 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5

It will print out extraneous, missing, and invalid packages.

If a project specifies git urls for dependencies these are shown @@ -108,5 +108,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-org.html b/deps/npm/html/doc/cli/npm-org.html index 7775a222bab7bb..6fff7d60f75420 100644 --- a/deps/npm/html/doc/cli/npm-org.html +++ b/deps/npm/html/doc/cli/npm-org.html @@ -40,4 +40,4 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index d2487d90455d83..be64b518103bbb 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -116,5 +116,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index 53e7be761ad3a4..fd96ae327cfb2e 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -53,5 +53,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-pack.html b/deps/npm/html/doc/cli/npm-pack.html index d9df5fa9438deb..f2d8cd398d8dda 100644 --- a/deps/npm/html/doc/cli/npm-pack.html +++ b/deps/npm/html/doc/cli/npm-pack.html @@ -42,5 +42,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-ping.html b/deps/npm/html/doc/cli/npm-ping.html index 6a6a353ca22655..ffc7d03c148bbb 100644 --- a/deps/npm/html/doc/cli/npm-ping.html +++ b/deps/npm/html/doc/cli/npm-ping.html @@ -33,5 +33,5 @@

SYNOPSIS

       - + diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index c36527ff0ba19a..e3a0f338d19679 100644 --- a/deps/npm/html/doc/cli/npm-prefix.html +++ b/deps/npm/html/doc/cli/npm-prefix.html @@ -38,5 +38,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-profile.html b/deps/npm/html/doc/cli/npm-profile.html index fd325640596365..b28bf5ecac2192 100644 --- a/deps/npm/html/doc/cli/npm-profile.html +++ b/deps/npm/html/doc/cli/npm-profile.html @@ -88,4 +88,4 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-prune.html b/deps/npm/html/doc/cli/npm-prune.html index ac6bf9bab308b6..9b2822437f43b7 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -47,5 +47,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index 46f835a09ef0aa..5a569d95eeaf0c 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -87,5 +87,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 260cca67c01e7d..77e1e37e3bd195 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -34,5 +34,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index d993739be0b8ed..1665e27197260f 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -40,5 +40,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-restart.html b/deps/npm/html/doc/cli/npm-restart.html index b84f7197753d11..e827f2064da9e4 100644 --- a/deps/npm/html/doc/cli/npm-restart.html +++ b/deps/npm/html/doc/cli/npm-restart.html @@ -52,5 +52,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-root.html b/deps/npm/html/doc/cli/npm-root.html index d683c5318869ec..f029e96a5951a7 100644 --- a/deps/npm/html/doc/cli/npm-root.html +++ b/deps/npm/html/doc/cli/npm-root.html @@ -34,5 +34,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-run-script.html b/deps/npm/html/doc/cli/npm-run-script.html index ab25a4c17eea71..51d2be8fec8338 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -79,5 +79,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index 86637309251a9d..01d0686d39f5eb 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -108,5 +108,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index d177b849642581..9a077cf1860493 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -40,5 +40,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-star.html b/deps/npm/html/doc/cli/npm-star.html index 3e3b27d71d9d70..a11093566a1ba5 100644 --- a/deps/npm/html/doc/cli/npm-star.html +++ b/deps/npm/html/doc/cli/npm-star.html @@ -35,5 +35,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-stars.html b/deps/npm/html/doc/cli/npm-stars.html index 09e88b9700187c..fdbb1a4af99edb 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -35,5 +35,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index e60e9c69aa100a..42be90129e9d40 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -38,5 +38,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index 0006eb9be7c251..f5802ed026c13b 100644 --- a/deps/npm/html/doc/cli/npm-stop.html +++ b/deps/npm/html/doc/cli/npm-stop.html @@ -33,5 +33,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-team.html b/deps/npm/html/doc/cli/npm-team.html index f6da4d052a6f77..922707968e3f0b 100644 --- a/deps/npm/html/doc/cli/npm-team.html +++ b/deps/npm/html/doc/cli/npm-team.html @@ -69,5 +69,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index 72a37681d1c883..35bcbf8ecc096c 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -35,5 +35,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-token.html b/deps/npm/html/doc/cli/npm-token.html index 841d0e066095c4..33c0dee0b628f0 100644 --- a/deps/npm/html/doc/cli/npm-token.html +++ b/deps/npm/html/doc/cli/npm-token.html @@ -81,4 +81,4 @@

SYNOPSIS

       - + diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index e1dd2d2d25b238..e403783daef612 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -60,5 +60,5 @@

SYNOPSIS

       - + diff --git a/deps/npm/html/doc/cli/npm-unpublish.html b/deps/npm/html/doc/cli/npm-unpublish.html index b718e1453c47b0..5dcb1cdd43f816 100644 --- a/deps/npm/html/doc/cli/npm-unpublish.html +++ b/deps/npm/html/doc/cli/npm-unpublish.html @@ -52,5 +52,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-update.html b/deps/npm/html/doc/cli/npm-update.html index 9fec4ebb6b8065..3902de03fc43ad 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -100,5 +100,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index 1638f412321ee3..20fa06c4ce8443 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -116,5 +116,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index d73b3061619044..814e813b98b7ce 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -75,5 +75,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index 2be9a8cb2dc90e..d986eeef56bddc 100644 --- a/deps/npm/html/doc/cli/npm-whoami.html +++ b/deps/npm/html/doc/cli/npm-whoami.html @@ -32,5 +32,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm.html b/deps/npm/html/doc/cli/npm.html index 42898c0686eeb9..74a27382b39b2b 100644 --- a/deps/npm/html/doc/cli/npm.html +++ b/deps/npm/html/doc/cli/npm.html @@ -12,7 +12,7 @@

npm

javascript package manager

SYNOPSIS

npm <command> [args]

VERSION

-

6.12.0

+

6.12.1

DESCRIPTION

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -130,7 +130,7 @@

AUTHOR

Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

+i@izs.me

SEE ALSO

  • npm-help(1)
  • @@ -154,5 +154,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-folders.html b/deps/npm/html/doc/files/npm-folders.html index 8abb7d2259e7a9..e3ea5410587717 100644 --- a/deps/npm/html/doc/files/npm-folders.html +++ b/deps/npm/html/doc/files/npm-folders.html @@ -179,5 +179,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-global.html b/deps/npm/html/doc/files/npm-global.html index 8abb7d2259e7a9..e3ea5410587717 100644 --- a/deps/npm/html/doc/files/npm-global.html +++ b/deps/npm/html/doc/files/npm-global.html @@ -179,5 +179,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-json.html b/deps/npm/html/doc/files/npm-json.html index 7ae2e9355740e4..be7a98ea58e76a 100644 --- a/deps/npm/html/doc/files/npm-json.html +++ b/deps/npm/html/doc/files/npm-json.html @@ -581,5 +581,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-package-locks.html b/deps/npm/html/doc/files/npm-package-locks.html index 022bbd2686bf0f..221c759b60dce4 100644 --- a/deps/npm/html/doc/files/npm-package-locks.html +++ b/deps/npm/html/doc/files/npm-package-locks.html @@ -154,4 +154,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-shrinkwrap.json.html b/deps/npm/html/doc/files/npm-shrinkwrap.json.html index d7f257548bd884..5a1f5a271e0b41 100644 --- a/deps/npm/html/doc/files/npm-shrinkwrap.json.html +++ b/deps/npm/html/doc/files/npm-shrinkwrap.json.html @@ -42,4 +42,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npmrc.html b/deps/npm/html/doc/files/npmrc.html index f58e65d4e9af78..b428127f3ec57a 100644 --- a/deps/npm/html/doc/files/npmrc.html +++ b/deps/npm/html/doc/files/npmrc.html @@ -82,5 +82,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/package-lock.json.html b/deps/npm/html/doc/files/package-lock.json.html index 3aeae7e446ca1b..7756498b2c8506 100644 --- a/deps/npm/html/doc/files/package-lock.json.html +++ b/deps/npm/html/doc/files/package-lock.json.html @@ -130,4 +130,4 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/package.json.html b/deps/npm/html/doc/files/package.json.html index 7ae2e9355740e4..be7a98ea58e76a 100644 --- a/deps/npm/html/doc/files/package.json.html +++ b/deps/npm/html/doc/files/package.json.html @@ -581,5 +581,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 4c413cd1e078f0..39cc94c700cd85 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -182,5 +182,5 @@

    semver(7)

           - + diff --git a/deps/npm/html/doc/misc/npm-coding-style.html b/deps/npm/html/doc/misc/npm-coding-style.html index 40c02c8192b6ae..c23d44552928f8 100644 --- a/deps/npm/html/doc/misc/npm-coding-style.html +++ b/deps/npm/html/doc/misc/npm-coding-style.html @@ -145,5 +145,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-config.html b/deps/npm/html/doc/misc/npm-config.html index 399fd9c1f5f7ec..1be6e95422587b 100644 --- a/deps/npm/html/doc/misc/npm-config.html +++ b/deps/npm/html/doc/misc/npm-config.html @@ -1084,5 +1084,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-developers.html b/deps/npm/html/doc/misc/npm-developers.html index 5f32f8b218b4c1..f03694b88c6467 100644 --- a/deps/npm/html/doc/misc/npm-developers.html +++ b/deps/npm/html/doc/misc/npm-developers.html @@ -198,5 +198,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-disputes.html b/deps/npm/html/doc/misc/npm-disputes.html index 08647377fc291b..c8bbce384308ea 100644 --- a/deps/npm/html/doc/misc/npm-disputes.html +++ b/deps/npm/html/doc/misc/npm-disputes.html @@ -20,7 +20,7 @@

    npm-disputes

    Handling Module

    TL;DR

    1. Get the author email with npm owner ls <pkgname>
    2. -
    3. Email the author, CC support@npmjs.com
    4. +
    5. Email the author, CC support@npmjs.com
    6. After a few weeks, if there's no resolution, we'll sort it out.

    Don't squat on package names. Publish code or move out of the way.

    @@ -58,13 +58,13 @@

    DESCRIPTION

  • Alice emails Yusuf, explaining the situation as respectfully as possible, and what she would like to do with the module name. She adds the npm support -staff support@npmjs.com to the CC list of the email. Mention in the email +staff support@npmjs.com to the CC list of the email. Mention in the email that Yusuf can run npm owner add alice foo to add Alice as an owner of the foo package.

  • After a reasonable amount of time, if Yusuf has not responded, or if Yusuf and Alice can't come to any sort of resolution, email support -support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least +support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least 4 weeks.)

  • @@ -101,12 +101,12 @@

    EXCEPTIONS

    Code of Conduct such as hateful language, pornographic content, or harassment. -

    If you see bad behavior like this, please report it to abuse@npmjs.com right +

    If you see bad behavior like this, please report it to abuse@npmjs.com right away. You are never expected to resolve abusive behavior on your own. We are here to help.

    TRADEMARKS

    If you think another npm publisher is infringing your trademark, such as by -using a confusingly similar package name, email abuse@npmjs.com with a link to +using a confusingly similar package name, email abuse@npmjs.com with a link to the package or user account on https://www.npmjs.com/. Attach a copy of your trademark registration certificate.

    If we see that the package's publisher is intentionally misleading others by @@ -139,5 +139,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-index.html b/deps/npm/html/doc/misc/npm-index.html index be282196bae5cd..ee9bf45888c5f2 100644 --- a/deps/npm/html/doc/misc/npm-index.html +++ b/deps/npm/html/doc/misc/npm-index.html @@ -182,5 +182,5 @@

    semver(7)

           - + diff --git a/deps/npm/html/doc/misc/npm-orgs.html b/deps/npm/html/doc/misc/npm-orgs.html index 9da553db072528..854df8e73c7365 100644 --- a/deps/npm/html/doc/misc/npm-orgs.html +++ b/deps/npm/html/doc/misc/npm-orgs.html @@ -77,5 +77,5 @@

    Team Admins create teams

           - + diff --git a/deps/npm/html/doc/misc/npm-registry.html b/deps/npm/html/doc/misc/npm-registry.html index 65f6cbac852411..d0e5ab9ae1cc17 100644 --- a/deps/npm/html/doc/misc/npm-registry.html +++ b/deps/npm/html/doc/misc/npm-registry.html @@ -96,5 +96,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-scope.html b/deps/npm/html/doc/misc/npm-scope.html index 8f8b6d156f7416..3566a27ea9f1f0 100644 --- a/deps/npm/html/doc/misc/npm-scope.html +++ b/deps/npm/html/doc/misc/npm-scope.html @@ -93,5 +93,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-scripts.html b/deps/npm/html/doc/misc/npm-scripts.html index cec986d66c022e..3cee61320bbaa0 100644 --- a/deps/npm/html/doc/misc/npm-scripts.html +++ b/deps/npm/html/doc/misc/npm-scripts.html @@ -234,5 +234,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/removing-npm.html b/deps/npm/html/doc/misc/removing-npm.html index 6a8cc53917ac80..b5fcfbc7dcf024 100644 --- a/deps/npm/html/doc/misc/removing-npm.html +++ b/deps/npm/html/doc/misc/removing-npm.html @@ -52,5 +52,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/semver.html b/deps/npm/html/doc/misc/semver.html index 8a3e8085fa6138..b419e9bf6953bc 100644 --- a/deps/npm/html/doc/misc/semver.html +++ b/deps/npm/html/doc/misc/semver.html @@ -373,5 +373,5 @@

    Coercion

           - + diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js index b0b71ef6b1323b..1ec4f9ba6dcfd7 100644 --- a/deps/npm/lib/install/inflate-shrinkwrap.js +++ b/deps/npm/lib/install/inflate-shrinkwrap.js @@ -141,6 +141,7 @@ function isGit (sw) { } function makeFakeChild (name, topPath, tree, sw, requested) { + const isDirectory = requested.type === 'directory' const from = sw.from || requested.raw const pkg = { name: name, @@ -167,16 +168,16 @@ function makeFakeChild (name, topPath, tree, sw, requested) { } const child = createChild({ package: pkg, - loaded: true, + loaded: isDirectory, parent: tree, children: [], fromShrinkwrap: requested, fakeChild: sw, fromBundle: sw.bundled ? tree.fromBundle || tree : null, path: childPath(tree.path, pkg), - realpath: requested.type === 'directory' ? requested.fetchSpec : childPath(tree.realpath, pkg), + realpath: isDirectory ? requested.fetchSpec : childPath(tree.realpath, pkg), location: (tree.location === '/' ? '' : tree.location + '/') + pkg.name, - isLink: requested.type === 'directory', + isLink: isDirectory, isInLink: tree.isLink || tree.isInLink, swRequires: sw.requires }) diff --git a/deps/npm/lib/pack.js b/deps/npm/lib/pack.js index 78e5bfd174d7b7..8189cb6cedc0b7 100644 --- a/deps/npm/lib/pack.js +++ b/deps/npm/lib/pack.js @@ -4,6 +4,9 @@ // Packs the specified package into a .tgz file, which can then // be installed. +// Set this early to avoid issues with circular dependencies. +module.exports = pack + const BB = require('bluebird') const byteSize = require('byte-size') @@ -37,7 +40,6 @@ pack.usage = 'npm pack [[<@scope>/]...] [--dry-run]' // if it can be installed, it can be packed. pack.completion = install.completion -module.exports = pack function pack (args, silent, cb) { const cwd = process.cwd() if (typeof cb !== 'function') { diff --git a/deps/npm/lib/utils/unsupported.js b/deps/npm/lib/utils/unsupported.js index 20cee157ee4038..aaae8c44266534 100644 --- a/deps/npm/lib/utils/unsupported.js +++ b/deps/npm/lib/utils/unsupported.js @@ -6,7 +6,8 @@ var supportedNode = [ {ver: '9', min: '9.0.0'}, {ver: '10', min: '10.0.0'}, {ver: '11', min: '11.0.0'}, - {ver: '12', min: '12.0.0'} + {ver: '12', min: '12.0.0'}, + {ver: '13', min: '13.0.0'} ] var knownBroken = '<6.0.0' diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index a4bb668444efd4..9baeecc886dc4e 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@6.12.0 /path/to/npm +npm@6.12.1 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index a74e30fdab65b3..8d198b4a2d1256 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -10,7 +10,7 @@ npm [args] .RE .SH VERSION .P -6.12.0 +6.12.1 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/node_modules/chownr/chownr.js b/deps/npm/node_modules/chownr/chownr.js index b056912ee15831..9f04393b7f498a 100644 --- a/deps/npm/node_modules/chownr/chownr.js +++ b/deps/npm/node_modules/chownr/chownr.js @@ -35,7 +35,7 @@ const handleEISDirSync = fs.chownSync(path, uid, gid) } } - : fs[LCHOWNSYNC] + : (path, uid, gid) => fs[LCHOWNSYNC](path, uid, gid) // fs.readdir could only accept an options object as of node v6 const nodeVersion = process.version diff --git a/deps/npm/node_modules/chownr/package.json b/deps/npm/node_modules/chownr/package.json index f7b9c81c84ca34..cc48dc912cd7ec 100644 --- a/deps/npm/node_modules/chownr/package.json +++ b/deps/npm/node_modules/chownr/package.json @@ -1,30 +1,32 @@ { - "_from": "chownr@1.1.2", - "_id": "chownr@1.1.2", + "_from": "chownr@1.1.3", + "_id": "chownr@1.1.3", "_inBundle": false, - "_integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==", + "_integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", "_location": "/chownr", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "chownr@1.1.2", + "raw": "chownr@1.1.3", "name": "chownr", "escapedName": "chownr", - "rawSpec": "1.1.2", + "rawSpec": "1.1.3", "saveSpec": null, - "fetchSpec": "1.1.2" + "fetchSpec": "1.1.3" }, "_requiredBy": [ "#USER", "/", "/cacache", + "/gentle-fs", + "/pacote", "/tar" ], - "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", - "_shasum": "a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6", - "_spec": "chownr@1.1.2", - "_where": "/Users/isaacs/dev/npm/cli", + "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", + "_shasum": "42d837d5239688d55f303003a508230fa6727142", + "_spec": "chownr@1.1.3", + "_where": "/Users/mperrotte/npminc/cli", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -53,10 +55,10 @@ "url": "git://github.com/isaacs/chownr.git" }, "scripts": { - "postpublish": "git push origin --all; git push origin --tags", + "postpublish": "git push origin --follow-tags", "postversion": "npm publish", "preversion": "npm test", "test": "tap test/*.js --cov" }, - "version": "1.1.2" + "version": "1.1.3" } diff --git a/deps/npm/node_modules/fs-minipass/node_modules/minipass/index.js b/deps/npm/node_modules/fs-minipass/node_modules/minipass/index.js index cab9009f2befb6..c072352d448a97 100644 --- a/deps/npm/node_modules/fs-minipass/node_modules/minipass/index.js +++ b/deps/npm/node_modules/fs-minipass/node_modules/minipass/index.js @@ -43,6 +43,14 @@ const isEndish = ev => ev === 'finish' || ev === 'prefinish' +const isArrayBuffer = b => b instanceof ArrayBuffer || + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0 + +const isArrayBufferView = b => !B.isBuffer(b) && ArrayBuffer.isView(b) + module.exports = class Minipass extends EE { constructor (options) { super() @@ -114,8 +122,19 @@ module.exports = class Minipass extends EE { if (!encoding) encoding = 'utf8' - if (typeof chunk !== 'string' && !B.isBuffer(chunk) && !this[OBJECTMODE]) - this.objectMode = true + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything else switches us into object mode + if (!this[OBJECTMODE] && !B.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) + chunk = B.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) + else if (isArrayBuffer(chunk)) + chunk = B.from(chunk) + else if (typeof chunk !== 'string') + // use the setter so we throw if we have encoding set + this.objectMode = true + } // this ensures at this point that the chunk is a buffer or string // don't buffer it up or send it to the decoder diff --git a/deps/npm/node_modules/fs-minipass/node_modules/minipass/package.json b/deps/npm/node_modules/fs-minipass/node_modules/minipass/package.json index f2b601937c4c42..416e231c9c6a21 100644 --- a/deps/npm/node_modules/fs-minipass/node_modules/minipass/package.json +++ b/deps/npm/node_modules/fs-minipass/node_modules/minipass/package.json @@ -1,8 +1,8 @@ { "_from": "minipass@^2.6.0", - "_id": "minipass@2.8.6", + "_id": "minipass@2.9.0", "_inBundle": false, - "_integrity": "sha512-lFG7d6g3+/UaFDCOtqPiKAC9zngWWsQZl1g5q6gaONqrjq61SX2xFqXMleQiFVyDpYwa018E9hmlAFY22PCb+A==", + "_integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", "_location": "/fs-minipass/minipass", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/fs-minipass" ], - "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.8.6.tgz", - "_shasum": "620d889ace26356391d010ecb9458749df9b6db5", + "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "_shasum": "e713762e7d3e32fed803115cf93e04bca9fcc9a6", "_spec": "minipass@^2.6.0", "_where": "/Users/mperrotte/npminc/cli/node_modules/fs-minipass", "author": { @@ -39,7 +39,7 @@ "description": "minimal implementation of a PassThrough stream", "devDependencies": { "end-of-stream": "^1.4.0", - "tap": "^14.6.4", + "tap": "^14.6.5", "through2": "^2.0.3" }, "files": [ @@ -66,5 +66,5 @@ "tap": { "check-coverage": true }, - "version": "2.8.6" + "version": "2.9.0" } diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js index 3e1a9eb4432f36..8c75ee259e0911 100644 --- a/deps/npm/node_modules/graceful-fs/graceful-fs.js +++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js @@ -234,22 +234,24 @@ function patch (fs) { }) // legacy names + var FileReadStream = ReadStream Object.defineProperty(fs, 'FileReadStream', { get: function () { - return ReadStream + return FileReadStream }, set: function (val) { - ReadStream = val + FileReadStream = val }, enumerable: true, configurable: true }) + var FileWriteStream = WriteStream Object.defineProperty(fs, 'FileWriteStream', { get: function () { - return WriteStream + return FileWriteStream }, set: function (val) { - WriteStream = val + FileWriteStream = val }, enumerable: true, configurable: true diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json index e5dff90aea7ce5..788876e3220739 100644 --- a/deps/npm/node_modules/graceful-fs/package.json +++ b/deps/npm/node_modules/graceful-fs/package.json @@ -1,19 +1,19 @@ { - "_from": "graceful-fs@4.2.2", - "_id": "graceful-fs@4.2.2", + "_from": "graceful-fs@4.2.3", + "_id": "graceful-fs@4.2.3", "_inBundle": false, - "_integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==", + "_integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", "_location": "/graceful-fs", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "graceful-fs@4.2.2", + "raw": "graceful-fs@4.2.3", "name": "graceful-fs", "escapedName": "graceful-fs", - "rawSpec": "4.2.2", + "rawSpec": "4.2.3", "saveSpec": null, - "fetchSpec": "4.2.2" + "fetchSpec": "4.2.3" }, "_requiredBy": [ "#USER", @@ -41,10 +41,10 @@ "/test-exclude/load-json-file", "/write-file-atomic" ], - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", - "_shasum": "6f0952605d0140c1cfdb138ed005775b92d67b02", - "_spec": "graceful-fs@4.2.2", - "_where": "/Users/isaacs/dev/npm/cli", + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "_shasum": "4a12ff1b60376ef09862c2093edd908328be8423", + "_spec": "graceful-fs@4.2.3", + "_where": "/Users/mperrotte/npminc/cli", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" }, @@ -98,5 +98,5 @@ "preversion": "npm test", "test": "node test.js | tap -" }, - "version": "4.2.2" + "version": "4.2.3" } diff --git a/deps/npm/node_modules/ignore-walk/README.md b/deps/npm/node_modules/ignore-walk/README.md index 66b69e894b2dd1..278f61017f5e7d 100644 --- a/deps/npm/node_modules/ignore-walk/README.md +++ b/deps/npm/node_modules/ignore-walk/README.md @@ -1,7 +1,7 @@ # ignore-walk [![Build -Status](https://travis-ci.org/isaacs/ignore-walk.svg?branch=master)](https://travis-ci.org/isaacs/ignore-walk) +Status](https://travis-ci.org/npm/ignore-walk.svg?branch=master)](https://travis-ci.org/npm/ignore-walk) Nested/recursive `.gitignore`/`.npmignore` parsing and filtering. diff --git a/deps/npm/node_modules/ignore-walk/index.js b/deps/npm/node_modules/ignore-walk/index.js index abfd9ece57fd4a..eec6851804a996 100644 --- a/deps/npm/node_modules/ignore-walk/index.js +++ b/deps/npm/node_modules/ignore-walk/index.js @@ -17,7 +17,7 @@ class Walker extends EE { this.includeEmpty = !!opts.includeEmpty this.root = this.parent ? this.parent.root : this.path this.follow = !!opts.follow - this.result = this.parent ? this.parent.result : [] + this.result = this.parent ? this.parent.result : new Set() this.entries = null this.sawError = false } @@ -31,8 +31,12 @@ class Walker extends EE { if (!(this.sawError && ev === 'error')) { if (ev === 'error') this.sawError = true - else if (ev === 'done' && !this.parent) - data = data.sort(this.sort) + else if (ev === 'done' && !this.parent) { + data = Array.from(data) + .map(e => /^@/.test(e) ? `./${e}` : e).sort(this.sort) + this.result = data + } + if (ev === 'error' && this.parent) ret = this.parent.emit('error', data) else @@ -57,7 +61,7 @@ class Walker extends EE { this.entries = entries if (entries.length === 0) { if (this.includeEmpty) - this.result.push(this.path.substr(this.root.length + 1)) + this.result.add(this.path.substr(this.root.length + 1)) this.emit('done', this.result) } else { const hasIg = this.entries.some(e => @@ -145,7 +149,7 @@ class Walker extends EE { const abs = this.path + '/' + entry if (!st.isDirectory()) { if (file) - this.result.push(abs.substr(this.root.length + 1)) + this.result.add(abs.substr(this.root.length + 1)) then() } else { // is a directory diff --git a/deps/npm/node_modules/ignore-walk/package.json b/deps/npm/node_modules/ignore-walk/package.json index cc041a55e4757d..882c1398b07d64 100644 --- a/deps/npm/node_modules/ignore-walk/package.json +++ b/deps/npm/node_modules/ignore-walk/package.json @@ -1,8 +1,8 @@ { "_from": "ignore-walk@^3.0.1", - "_id": "ignore-walk@3.0.1", + "_id": "ignore-walk@3.0.3", "_inBundle": false, - "_integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", + "_integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", "_location": "/ignore-walk", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/npm-packlist" ], - "_resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", - "_shasum": "a83e62e7d272ac0e3b551aaa82831a19b69f82f8", + "_resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "_shasum": "017e2447184bfeade7c238e4aefdd1e8f95b1e37", "_spec": "ignore-walk@^3.0.1", - "_where": "/Users/rebecca/code/npm/node_modules/npm-packlist", + "_where": "/Users/mperrotte/npminc/cli/node_modules/npm-packlist", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -40,7 +40,7 @@ "mkdirp": "^0.5.1", "mutate-fs": "^1.1.0", "rimraf": "^2.6.1", - "tap": "^10.7.2" + "tap": "^14.6.9" }, "files": [ "index.js" @@ -65,7 +65,10 @@ "postpublish": "git push origin --all; git push origin --tags", "postversion": "npm publish", "preversion": "npm test", - "test": "tap test/*.js --100" + "test": "tap" }, - "version": "3.0.1" + "tap": { + "jobs": 1 + }, + "version": "3.0.3" } diff --git a/deps/npm/node_modules/libcipm/CHANGELOG.md b/deps/npm/node_modules/libcipm/CHANGELOG.md index de37a13c2d78c5..80411f300698c4 100644 --- a/deps/npm/node_modules/libcipm/CHANGELOG.md +++ b/deps/npm/node_modules/libcipm/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [4.0.7](https://github.com/npm/libcipm/compare/v4.0.4...v4.0.7) (2019-10-09) + + +### Bug Fixes + +* delete node_modules contents but keep the dir itself ([f668181](https://github.com/npm/libcipm/commit/f668181)), closes [#3](https://github.com/npm/libcipm/issues/3) + ## [4.0.4](https://github.com/npm/libcipm/compare/v4.0.3...v4.0.4) (2019-09-24) diff --git a/deps/npm/node_modules/libcipm/index.js b/deps/npm/node_modules/libcipm/index.js index 50f338c602679a..42d05e1f8931c3 100644 --- a/deps/npm/node_modules/libcipm/index.js +++ b/deps/npm/node_modules/libcipm/index.js @@ -137,7 +137,7 @@ class Installer { ) return BB.join( this.checkLock(), - stat && rimraf(path.join(this.prefix, 'node_modules')) + stat && rimraf(path.join(this.prefix, 'node_modules/*')) ) }).then(() => { // This needs to happen -after- we've done checkLock() diff --git a/deps/npm/node_modules/libcipm/package.json b/deps/npm/node_modules/libcipm/package.json index 7aa96e97574c09..1411b409500048 100644 --- a/deps/npm/node_modules/libcipm/package.json +++ b/deps/npm/node_modules/libcipm/package.json @@ -1,27 +1,27 @@ { - "_from": "libcipm@4.0.4", - "_id": "libcipm@4.0.4", + "_from": "libcipm@4.0.7", + "_id": "libcipm@4.0.7", "_inBundle": false, - "_integrity": "sha512-S2hmT4tYXTpq1H98K+gm/fujDcgQKqPz0QwkmtKrGklAo7U0DI9ZYmQq/EahF3sqw33Quv9gMHJGeodqyX23kg==", + "_integrity": "sha512-fTq33otU3PNXxxCTCYCYe7V96o59v/o7bvtspmbORXpgFk+wcWrGf5x6tBgui5gCed/45/wtPomBsZBYm5KbIw==", "_location": "/libcipm", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "libcipm@4.0.4", + "raw": "libcipm@4.0.7", "name": "libcipm", "escapedName": "libcipm", - "rawSpec": "4.0.4", + "rawSpec": "4.0.7", "saveSpec": null, - "fetchSpec": "4.0.4" + "fetchSpec": "4.0.7" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/libcipm/-/libcipm-4.0.4.tgz", - "_shasum": "6d28fd0f31e61963f8ec7125e9247349181f6cf4", - "_spec": "libcipm@4.0.4", + "_resolved": "https://registry.npmjs.org/libcipm/-/libcipm-4.0.7.tgz", + "_shasum": "76cd675c98bdaae64db88b782b01b804b6d02c8a", + "_spec": "libcipm@4.0.7", "_where": "/Users/mperrotte/npminc/cli", "author": { "name": "Kat Marchán", @@ -96,5 +96,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "4.0.4" + "version": "4.0.7" } diff --git a/deps/npm/node_modules/minipass/README.md b/deps/npm/node_modules/minipass/README.md deleted file mode 100644 index 7a83c59ffd709f..00000000000000 --- a/deps/npm/node_modules/minipass/README.md +++ /dev/null @@ -1,124 +0,0 @@ -# minipass - -A _very_ minimal implementation of a [PassThrough -stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) - -[It's very -fast](https://docs.google.com/spreadsheets/d/1oObKSrVwLX_7Ut4Z6g3fZW-AX1j1-k6w-cDsrkaSbHM/edit#gid=0) -for objects, strings, and buffers. - -Supports pipe()ing (including multi-pipe() and backpressure -transmission), buffering data until either a `data` event handler or -`pipe()` is added (so you don't lose the first chunk), and most other -cases where PassThrough is a good idea. - -There is a `read()` method, but it's much more efficient to consume -data from this stream via `'data'` events or by calling `pipe()` into -some other stream. Calling `read()` requires the buffer to be -flattened in some cases, which requires copying memory. - -There is also no `unpipe()` method. Once you start piping, there is -no stopping it! - -If you set `objectMode: true` in the options, then whatever is written -will be emitted. Otherwise, it'll do a minimal amount of Buffer -copying to ensure proper Streams semantics when `read(n)` is called. - -This is not a `through` or `through2` stream. It doesn't transform -the data, it just passes it right through. If you want to transform -the data, extend the class, and override the `write()` method. Once -you're done transforming the data however you want, call -`super.write()` with the transform output. - -For an example of a stream that extends MiniPass to provide transform -capabilities, check out [minizlib](http://npm.im/minizlib). - -## USAGE - -```js -const MiniPass = require('minipass') -const mp = new MiniPass(options) // optional: { encoding } -mp.write('foo') -mp.pipe(someOtherStream) -mp.end('bar') -``` - -### collecting - -```js -mp.collect().then(all => { - // all is an array of all the data emitted - // encoding is supported in this case, so - // so the result will be a collection of strings if - // an encoding is specified, or buffers/objects if not. - // - // In an async function, you may do - // const data = await stream.collect() -}) -``` - -### iteration - -You can iterate over streams synchronously or asynchronously in -platforms that support it. - -Synchronous iteration will end when the currently available data is -consumed, even if the `end` event has not been reached. In string and -buffer mode, the data is concatenated, so unless multiple writes are -occurring in the same tick as the `read()`, sync iteration loops will -generally only have a single iteration. - -To consume chunks in this way exactly as they have been written, with -no flattening, create the stream with the `{ objectMode: true }` -option. - -```js -const mp = new Minipass({ objectMode: true }) -mp.write('a') -mp.write('b') -for (let letter of mp) { - console.log(letter) // a, b -} -mp.write('c') -mp.write('d') -for (let letter of mp) { - console.log(letter) // c, d -} -mp.write('e') -mp.end() -for (let letter of mp) { - console.log(letter) // e -} -for (let letter of mp) { - console.log(letter) // nothing -} -``` - -Asynchronous iteration will continue until the end event is reached, -consuming all of the data. - -```js -const mp = new Minipass({ encoding: 'utf8' }) - -// some source of some data -let i = 5 -const inter = setInterval(() => { - if (i --> 0) - mp.write(Buffer.from('foo\n', 'utf8')) - else { - mp.end() - clearInterval(inter) - } -}, 100) - -// consume the data with asynchronous iteration -async function consume () { - for await (let chunk of mp) { - console.log(chunk) - } - return 'ok' -} - -consume().then(res => console.log(res)) -// logs `foo\n` 5 times, and then `ok` -``` diff --git a/deps/npm/node_modules/minipass/node_modules/yallist/README.md b/deps/npm/node_modules/minipass/node_modules/yallist/README.md deleted file mode 100644 index f5861018696688..00000000000000 --- a/deps/npm/node_modules/minipass/node_modules/yallist/README.md +++ /dev/null @@ -1,204 +0,0 @@ -# yallist - -Yet Another Linked List - -There are many doubly-linked list implementations like it, but this -one is mine. - -For when an array would be too big, and a Map can't be iterated in -reverse order. - - -[![Build Status](https://travis-ci.org/isaacs/yallist.svg?branch=master)](https://travis-ci.org/isaacs/yallist) [![Coverage Status](https://coveralls.io/repos/isaacs/yallist/badge.svg?service=github)](https://coveralls.io/github/isaacs/yallist) - -## basic usage - -```javascript -var yallist = require('yallist') -var myList = yallist.create([1, 2, 3]) -myList.push('foo') -myList.unshift('bar') -// of course pop() and shift() are there, too -console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo'] -myList.forEach(function (k) { - // walk the list head to tail -}) -myList.forEachReverse(function (k, index, list) { - // walk the list tail to head -}) -var myDoubledList = myList.map(function (k) { - return k + k -}) -// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo'] -// mapReverse is also a thing -var myDoubledListReverse = myList.mapReverse(function (k) { - return k + k -}) // ['foofoo', 6, 4, 2, 'barbar'] - -var reduced = myList.reduce(function (set, entry) { - set += entry - return set -}, 'start') -console.log(reduced) // 'startfoo123bar' -``` - -## api - -The whole API is considered "public". - -Functions with the same name as an Array method work more or less the -same way. - -There's reverse versions of most things because that's the point. - -### Yallist - -Default export, the class that holds and manages a list. - -Call it with either a forEach-able (like an array) or a set of -arguments, to initialize the list. - -The Array-ish methods all act like you'd expect. No magic length, -though, so if you change that it won't automatically prune or add -empty spots. - -### Yallist.create(..) - -Alias for Yallist function. Some people like factories. - -#### yallist.head - -The first node in the list - -#### yallist.tail - -The last node in the list - -#### yallist.length - -The number of nodes in the list. (Change this at your peril. It is -not magic like Array length.) - -#### yallist.toArray() - -Convert the list to an array. - -#### yallist.forEach(fn, [thisp]) - -Call a function on each item in the list. - -#### yallist.forEachReverse(fn, [thisp]) - -Call a function on each item in the list, in reverse order. - -#### yallist.get(n) - -Get the data at position `n` in the list. If you use this a lot, -probably better off just using an Array. - -#### yallist.getReverse(n) - -Get the data at position `n`, counting from the tail. - -#### yallist.map(fn, thisp) - -Create a new Yallist with the result of calling the function on each -item. - -#### yallist.mapReverse(fn, thisp) - -Same as `map`, but in reverse. - -#### yallist.pop() - -Get the data from the list tail, and remove the tail from the list. - -#### yallist.push(item, ...) - -Insert one or more items to the tail of the list. - -#### yallist.reduce(fn, initialValue) - -Like Array.reduce. - -#### yallist.reduceReverse - -Like Array.reduce, but in reverse. - -#### yallist.reverse - -Reverse the list in place. - -#### yallist.shift() - -Get the data from the list head, and remove the head from the list. - -#### yallist.slice([from], [to]) - -Just like Array.slice, but returns a new Yallist. - -#### yallist.sliceReverse([from], [to]) - -Just like yallist.slice, but the result is returned in reverse. - -#### yallist.toArray() - -Create an array representation of the list. - -#### yallist.toArrayReverse() - -Create a reversed array representation of the list. - -#### yallist.unshift(item, ...) - -Insert one or more items to the head of the list. - -#### yallist.unshiftNode(node) - -Move a Node object to the front of the list. (That is, pull it out of -wherever it lives, and make it the new head.) - -If the node belongs to a different list, then that list will remove it -first. - -#### yallist.pushNode(node) - -Move a Node object to the end of the list. (That is, pull it out of -wherever it lives, and make it the new tail.) - -If the node belongs to a list already, then that list will remove it -first. - -#### yallist.removeNode(node) - -Remove a node from the list, preserving referential integrity of head -and tail and other nodes. - -Will throw an error if you try to have a list remove a node that -doesn't belong to it. - -### Yallist.Node - -The class that holds the data and is actually the list. - -Call with `var n = new Node(value, previousNode, nextNode)` - -Note that if you do direct operations on Nodes themselves, it's very -easy to get into weird states where the list is broken. Be careful :) - -#### node.next - -The next node in the list. - -#### node.prev - -The previous node in the list. - -#### node.value - -The data the node contains. - -#### node.list - -The list to which this node belongs. (Null if it does not belong to -any list.) diff --git a/deps/npm/node_modules/minipass/node_modules/yallist/iterator.js b/deps/npm/node_modules/minipass/node_modules/yallist/iterator.js deleted file mode 100644 index 9149b364889d1e..00000000000000 --- a/deps/npm/node_modules/minipass/node_modules/yallist/iterator.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -var Yallist = require('./yallist.js') - -Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } -} diff --git a/deps/npm/node_modules/minipass/node_modules/yallist/package.json b/deps/npm/node_modules/minipass/node_modules/yallist/package.json deleted file mode 100644 index d7b5f46b9ac0e0..00000000000000 --- a/deps/npm/node_modules/minipass/node_modules/yallist/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "_from": "yallist@^3.0.0", - "_id": "yallist@3.0.2", - "_inBundle": false, - "_integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=", - "_location": "/minipass/yallist", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "yallist@^3.0.0", - "name": "yallist", - "escapedName": "yallist", - "rawSpec": "^3.0.0", - "saveSpec": null, - "fetchSpec": "^3.0.0" - }, - "_requiredBy": [ - "/minipass" - ], - "_resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", - "_shasum": "8452b4bb7e83c7c188d8041c1a837c773d6d8bb9", - "_spec": "yallist@^3.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/minipass", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/yallist/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Yet Another Linked List", - "devDependencies": { - "tap": "^10.3.0" - }, - "directories": { - "test": "test" - }, - "files": [ - "yallist.js", - "iterator.js" - ], - "homepage": "https://github.com/isaacs/yallist#readme", - "license": "ISC", - "main": "yallist.js", - "name": "yallist", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/yallist.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100" - }, - "version": "3.0.2" -} diff --git a/deps/npm/node_modules/minipass/node_modules/yallist/yallist.js b/deps/npm/node_modules/minipass/node_modules/yallist/yallist.js deleted file mode 100644 index 4805bc69fa760e..00000000000000 --- a/deps/npm/node_modules/minipass/node_modules/yallist/yallist.js +++ /dev/null @@ -1,376 +0,0 @@ -'use strict' -module.exports = Yallist - -Yallist.Node = Node -Yallist.create = Yallist - -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } - - self.tail = null - self.head = null - self.length = 0 - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } - } - - return self -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') - } - - var next = node.next - var prev = node.prev - - if (next) { - next.prev = prev - } - - if (prev) { - prev.next = next - } - - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } - - node.list.length-- - node.next = null - node.prev = null - node.list = null -} - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node - } - - this.head = node - if (!this.tail) { - this.tail = node - } - this.length++ -} - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } - - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } - - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } - - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next - } -} - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res -} - -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } - - return acc -} - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } - - return acc -} - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next - } - return arr -} - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev - } - return arr -} - -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next - } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} - -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} - -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} - -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) - } - - this.list = list - this.value = value - - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null - } - - if (next) { - next.prev = this - this.next = next - } else { - this.next = null - } -} - -try { - // add if support or Symbol.iterator is present - require('./iterator.js') -} catch (er) {} diff --git a/deps/npm/node_modules/minizlib/README.md b/deps/npm/node_modules/minizlib/README.md index 2b585545efe14b..4097b85225542f 100644 --- a/deps/npm/node_modules/minizlib/README.md +++ b/deps/npm/node_modules/minizlib/README.md @@ -1,44 +1,53 @@ # minizlib -A tiny fast zlib stream built on [minipass](http://npm.im/minipass) -and Node.js's zlib binding. +A fast zlib stream built on [minipass](http://npm.im/minipass) and +Node.js's zlib binding. This module was created to serve the needs of -[node-tar](http://npm.im/tar) v2. If your needs are different, then -it may not be for you. +[node-tar](http://npm.im/tar) and +[minipass-fetch](http://npm.im/minipass-fetch). + +Brotli is supported in versions of node with a Brotli binding. ## How does this differ from the streams in `require('zlib')`? First, there are no convenience methods to compress or decompress a buffer. If you want those, use the built-in `zlib` module. This is -only streams. +only streams. That being said, Minipass streams to make it fairly easy to +use as one-liners: `new zlib.Deflate().end(data).read()` will return the +deflate compressed result. This module compresses and decompresses the data as fast as you feed it in. It is synchronous, and runs on the main process thread. Zlib -operations can be high CPU, but they're very fast, and doing it this -way means much less bookkeeping and artificial deferral. +and Brotli operations can be high CPU, but they're very fast, and doing it +this way means much less bookkeeping and artificial deferral. Node's built in zlib streams are built on top of `stream.Transform`. They do the maximally safe thing with respect to consistent asynchrony, buffering, and backpressure. -This module _does_ support backpressure, and will buffer output chunks -that are not consumed, but is less of a mediator between the input and -output. There is no high or low watermarks, no state objects, and so -artificial async deferrals. It will not protect you from Zalgo. - -If you write, data will be emitted right away. If you write -everything synchronously in one tick, and you are listening to the -`data` event to consume it, then it'll all be emitted right away in -that same tick. If you want data to be emitted in the next tick, then -write it in the next tick. - -It is thus the responsibility of the reader and writer to manage their -own consumption and process execution flow. - -The goal is to compress and decompress as fast as possible, even for -files that are too large to store all in one buffer. - -The API is very similar to the built-in zlib module. There are -classes that you instantiate with `new` and they are streams that can -be piped together. +See [Minipass](http://npm.im/minipass) for more on the differences between +Node.js core streams and Minipass streams, and the convenience methods +provided by that class. + +## Classes + +- Deflate +- Inflate +- Gzip +- Gunzip +- DeflateRaw +- InflateRaw +- Unzip +- BrotliCompress (Node v10 and higher) +- BrotliDecompress (Node v10 and higher) + +## USAGE + +```js +const zlib = require('minizlib') +const input = sourceOfCompressedData() +const decode = new zlib.BrotliDecompress() +const output = whereToWriteTheDecodedData() +input.pipe(decode).pipe(output) +``` diff --git a/deps/npm/node_modules/minizlib/constants.js b/deps/npm/node_modules/minizlib/constants.js index 4edffde86f8528..641ebc73129bf7 100644 --- a/deps/npm/node_modules/minizlib/constants.js +++ b/deps/npm/node_modules/minizlib/constants.js @@ -1,4 +1,11 @@ -module.exports = Object.freeze({ +// Update with any zlib constants that are added or changed in the future. +// Node v6 didn't export this, so we just hard code the version and rely +// on all the other hard-coded values from zlib v4736. When node v6 +// support drops, we can just export the realZlibConstants object. +const realZlibConstants = require('zlib').constants || + /* istanbul ignore next */ { ZLIB_VERNUM: 4736 } + +module.exports = Object.freeze(Object.assign(Object.create(null), { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, @@ -23,7 +30,6 @@ module.exports = Object.freeze({ Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, - ZLIB_VERNUM: 4736, DEFLATE: 1, INFLATE: 2, GZIP: 3, @@ -31,6 +37,8 @@ module.exports = Object.freeze({ DEFLATERAW: 5, INFLATERAW: 6, UNZIP: 7, + BROTLI_DECODE: 8, + BROTLI_ENCODE: 9, Z_MIN_WINDOWBITS: 8, Z_MAX_WINDOWBITS: 15, Z_DEFAULT_WINDOWBITS: 15, @@ -42,5 +50,66 @@ module.exports = Object.freeze({ Z_DEFAULT_MEMLEVEL: 8, Z_MIN_LEVEL: -1, Z_MAX_LEVEL: 9, - Z_DEFAULT_LEVEL: -1 -}) + Z_DEFAULT_LEVEL: -1, + BROTLI_OPERATION_PROCESS: 0, + BROTLI_OPERATION_FLUSH: 1, + BROTLI_OPERATION_FINISH: 2, + BROTLI_OPERATION_EMIT_METADATA: 3, + BROTLI_MODE_GENERIC: 0, + BROTLI_MODE_TEXT: 1, + BROTLI_MODE_FONT: 2, + BROTLI_DEFAULT_MODE: 0, + BROTLI_MIN_QUALITY: 0, + BROTLI_MAX_QUALITY: 11, + BROTLI_DEFAULT_QUALITY: 11, + BROTLI_MIN_WINDOW_BITS: 10, + BROTLI_MAX_WINDOW_BITS: 24, + BROTLI_LARGE_MAX_WINDOW_BITS: 30, + BROTLI_DEFAULT_WINDOW: 22, + BROTLI_MIN_INPUT_BLOCK_BITS: 16, + BROTLI_MAX_INPUT_BLOCK_BITS: 24, + BROTLI_PARAM_MODE: 0, + BROTLI_PARAM_QUALITY: 1, + BROTLI_PARAM_LGWIN: 2, + BROTLI_PARAM_LGBLOCK: 3, + BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, + BROTLI_PARAM_SIZE_HINT: 5, + BROTLI_PARAM_LARGE_WINDOW: 6, + BROTLI_PARAM_NPOSTFIX: 7, + BROTLI_PARAM_NDIRECT: 8, + BROTLI_DECODER_RESULT_ERROR: 0, + BROTLI_DECODER_RESULT_SUCCESS: 1, + BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, + BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, + BROTLI_DECODER_NO_ERROR: 0, + BROTLI_DECODER_SUCCESS: 1, + BROTLI_DECODER_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, + BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, + BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, + BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, + BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, + BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, + BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, + BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, + BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, + BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, + BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, + BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, + BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, + BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, + BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, + BROTLI_DECODER_ERROR_UNREACHABLE: -31, +}, realZlibConstants)) diff --git a/deps/npm/node_modules/minizlib/index.js b/deps/npm/node_modules/minizlib/index.js index 1385dc2363c02b..295047b9c1447d 100644 --- a/deps/npm/node_modules/minizlib/index.js +++ b/deps/npm/node_modules/minizlib/index.js @@ -5,15 +5,21 @@ const Buffer = require('buffer').Buffer const realZlib = require('zlib') const constants = exports.constants = require('./constants.js') -const MiniPass = require('minipass') +const Minipass = require('minipass') const OriginalBufferConcat = Buffer.concat class ZlibError extends Error { - constructor (msg, errno) { - super('zlib: ' + msg) - this.errno = errno - this.code = codes.get(errno) + constructor (err) { + super('zlib: ' + err.message) + this.code = err.code + this.errno = err.errno + /* istanbul ignore if */ + if (!this.code) + this.code = 'ZLIB_ERROR' + + this.message = 'zlib: ' + err.message + Error.captureStackTrace(this, this.constructor) } get name () { @@ -21,128 +27,51 @@ class ZlibError extends Error { } } -// translation table for return codes. -const codes = new Map([ - [constants.Z_OK, 'Z_OK'], - [constants.Z_STREAM_END, 'Z_STREAM_END'], - [constants.Z_NEED_DICT, 'Z_NEED_DICT'], - [constants.Z_ERRNO, 'Z_ERRNO'], - [constants.Z_STREAM_ERROR, 'Z_STREAM_ERROR'], - [constants.Z_DATA_ERROR, 'Z_DATA_ERROR'], - [constants.Z_MEM_ERROR, 'Z_MEM_ERROR'], - [constants.Z_BUF_ERROR, 'Z_BUF_ERROR'], - [constants.Z_VERSION_ERROR, 'Z_VERSION_ERROR'] -]) - -const validFlushFlags = new Set([ - constants.Z_NO_FLUSH, - constants.Z_PARTIAL_FLUSH, - constants.Z_SYNC_FLUSH, - constants.Z_FULL_FLUSH, - constants.Z_FINISH, - constants.Z_BLOCK -]) - -const strategies = new Set([ - constants.Z_FILTERED, - constants.Z_HUFFMAN_ONLY, - constants.Z_RLE, - constants.Z_FIXED, - constants.Z_DEFAULT_STRATEGY -]) - // the Zlib class they all inherit from // This thing manages the queue of requests, and returns // true or false if there is anything in the queue when // you call the .write() method. const _opts = Symbol('opts') const _flushFlag = Symbol('flushFlag') -const _finishFlush = Symbol('finishFlush') +const _finishFlushFlag = Symbol('finishFlushFlag') +const _fullFlushFlag = Symbol('fullFlushFlag') const _handle = Symbol('handle') const _onError = Symbol('onError') const _sawError = Symbol('sawError') const _level = Symbol('level') const _strategy = Symbol('strategy') const _ended = Symbol('ended') +const _defaultFullFlush = Symbol('_defaultFullFlush') -class Zlib extends MiniPass { +class ZlibBase extends Minipass { constructor (opts, mode) { + if (!opts || typeof opts !== 'object') + throw new TypeError('invalid options for ZlibBase constructor') + super(opts) this[_ended] = false - this[_opts] = opts = opts || {} - if (opts.flush && !validFlushFlags.has(opts.flush)) { - throw new TypeError('Invalid flush flag: ' + opts.flush) - } - if (opts.finishFlush && !validFlushFlags.has(opts.finishFlush)) { - throw new TypeError('Invalid flush flag: ' + opts.finishFlush) - } - - this[_flushFlag] = opts.flush || constants.Z_NO_FLUSH - this[_finishFlush] = typeof opts.finishFlush !== 'undefined' ? - opts.finishFlush : constants.Z_FINISH - - if (opts.chunkSize) { - if (opts.chunkSize < constants.Z_MIN_CHUNK) { - throw new RangeError('Invalid chunk size: ' + opts.chunkSize) - } - } - - if (opts.windowBits) { - if (opts.windowBits < constants.Z_MIN_WINDOWBITS || - opts.windowBits > constants.Z_MAX_WINDOWBITS) { - throw new RangeError('Invalid windowBits: ' + opts.windowBits) - } - } - - if (opts.level) { - if (opts.level < constants.Z_MIN_LEVEL || - opts.level > constants.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + opts.level) - } - } + this[_opts] = opts - if (opts.memLevel) { - if (opts.memLevel < constants.Z_MIN_MEMLEVEL || - opts.memLevel > constants.Z_MAX_MEMLEVEL) { - throw new RangeError('Invalid memLevel: ' + opts.memLevel) - } - } - - if (opts.strategy && !(strategies.has(opts.strategy))) - throw new TypeError('Invalid strategy: ' + opts.strategy) - - if (opts.dictionary) { - if (!(opts.dictionary instanceof Buffer)) { - throw new TypeError('Invalid dictionary: it should be a Buffer instance') - } + this[_flushFlag] = opts.flush + this[_finishFlushFlag] = opts.finishFlush + // this will throw if any options are invalid for the class selected + try { + this[_handle] = new realZlib[mode](opts) + } catch (er) { + // make sure that all errors get decorated properly + throw new ZlibError(er) } - this[_handle] = new realZlib[mode](opts) - this[_onError] = (err) => { this[_sawError] = true // there is no way to cleanly recover. // continuing only obscures problems. this.close() - - const error = new ZlibError(err.message, err.errno) - this.emit('error', error) + this.emit('error', err) } - this[_handle].on('error', this[_onError]) - const level = typeof opts.level === 'number' ? opts.level - : constants.Z_DEFAULT_COMPRESSION - - var strategy = typeof opts.strategy === 'number' ? opts.strategy - : constants.Z_DEFAULT_STRATEGY - - // API changed in node v9 - /* istanbul ignore next */ - - this[_level] = level - this[_strategy] = strategy - - this.once('end', this.close) + this[_handle].on('error', er => this[_onError](new ZlibError(er))) + this.once('end', () => this.close) } close () { @@ -153,47 +82,6 @@ class Zlib extends MiniPass { } } - params (level, strategy) { - if (this[_sawError]) - return - - if (!this[_handle]) - throw new Error('cannot switch params when binding is closed') - - // no way to test this without also not supporting params at all - /* istanbul ignore if */ - if (!this[_handle].params) - throw new Error('not supported in this implementation') - - if (level < constants.Z_MIN_LEVEL || - level > constants.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + level) - } - - if (!(strategies.has(strategy))) - throw new TypeError('Invalid strategy: ' + strategy) - - if (this[_level] !== level || this[_strategy] !== strategy) { - this.flush(constants.Z_SYNC_FLUSH) - assert(this[_handle], 'zlib binding closed') - // .params() calls .flush(), but the latter is always async in the - // core zlib. We override .flush() temporarily to intercept that and - // flush synchronously. - const origFlush = this[_handle].flush - this[_handle].flush = (flushFlag, cb) => { - this[_handle].flush = origFlush - this.flush(flushFlag) - cb() - } - this[_handle].params(level, strategy) - /* istanbul ignore else */ - if (this[_handle]) { - this[_level] = level - this[_strategy] = strategy - } - } - } - reset () { if (!this[_sawError]) { assert(this[_handle], 'zlib binding closed') @@ -201,23 +89,19 @@ class Zlib extends MiniPass { } } - flush (kind) { - if (kind === undefined) - kind = constants.Z_FULL_FLUSH - + flush (flushFlag) { if (this.ended) return - const flushFlag = this[_flushFlag] - this[_flushFlag] = kind - this.write(Buffer.alloc(0)) - this[_flushFlag] = flushFlag + if (typeof flushFlag !== 'number') + flushFlag = this[_fullFlushFlag] + this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag })) } end (chunk, encoding, cb) { if (chunk) this.write(chunk, encoding) - this.flush(this[_finishFlush]) + this.flush(this[_finishFlushFlag]) this[_ended] = true return super.end(null, null, cb) } @@ -251,11 +135,17 @@ class Zlib extends MiniPass { Buffer.concat = (args) => args let result try { - result = this[_handle]._processChunk(chunk, this[_flushFlag]) + const flushFlag = typeof chunk[_flushFlag] === 'number' + ? chunk[_flushFlag] : this[_flushFlag] + result = this[_handle]._processChunk(chunk, flushFlag) + // if we don't throw, reset it back how it was + Buffer.concat = OriginalBufferConcat } catch (err) { - this[_onError](err) - } finally { + // or if we do, put Buffer.concat() back before we emit error + // Error events call into user code, which may call Buffer.concat() Buffer.concat = OriginalBufferConcat + this[_onError](new ZlibError(err)) + } finally { if (this[_handle]) { // Core zlib resets `_handle` to null after attempting to close the // native handle. Our no-op handler prevented actual closure, but we @@ -289,6 +179,56 @@ class Zlib extends MiniPass { } } +class Zlib extends ZlibBase { + constructor (opts, mode) { + opts = opts || {} + + opts.flush = opts.flush || constants.Z_NO_FLUSH + opts.finishFlush = opts.finishFlush || constants.Z_FINISH + super(opts, mode) + + this[_fullFlushFlag] = constants.Z_FULL_FLUSH + this[_level] = opts.level + this[_strategy] = opts.strategy + } + + params (level, strategy) { + if (this[_sawError]) + return + + if (!this[_handle]) + throw new Error('cannot switch params when binding is closed') + + // no way to test this without also not supporting params at all + /* istanbul ignore if */ + if (!this[_handle].params) + throw new Error('not supported in this implementation') + + if (this[_level] !== level || this[_strategy] !== strategy) { + this.flush(constants.Z_SYNC_FLUSH) + assert(this[_handle], 'zlib binding closed') + // .params() calls .flush(), but the latter is always async in the + // core zlib. We override .flush() temporarily to intercept that and + // flush synchronously. + const origFlush = this[_handle].flush + this[_handle].flush = (flushFlag, cb) => { + this.flush(flushFlag) + cb() + } + try { + this[_handle].params(level, strategy) + } finally { + this[_handle].flush = origFlush + } + /* istanbul ignore else */ + if (this[_handle]) { + this[_level] = level + this[_strategy] = strategy + } + } + } +} + // minimal 2-byte header class Deflate extends Zlib { constructor (opts) { @@ -335,6 +275,31 @@ class Unzip extends Zlib { } } +class Brotli extends ZlibBase { + constructor (opts, mode) { + opts = opts || {} + + opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS + opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH + + super(opts, mode) + + this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH + } +} + +class BrotliCompress extends Brotli { + constructor (opts) { + super(opts, 'BrotliCompress') + } +} + +class BrotliDecompress extends Brotli { + constructor (opts) { + super(opts, 'BrotliDecompress') + } +} + exports.Deflate = Deflate exports.Inflate = Inflate exports.Gzip = Gzip @@ -342,3 +307,14 @@ exports.Gunzip = Gunzip exports.DeflateRaw = DeflateRaw exports.InflateRaw = InflateRaw exports.Unzip = Unzip +/* istanbul ignore else */ +if (typeof realZlib.BrotliCompress === 'function') { + exports.BrotliCompress = BrotliCompress + exports.BrotliDecompress = BrotliDecompress +} else { + exports.BrotliCompress = exports.BrotliDecompress = class { + constructor () { + throw new Error('Brotli is not supported in this version of Node.js') + } + } +} diff --git a/deps/npm/node_modules/minipass/node_modules/yallist/LICENSE b/deps/npm/node_modules/minizlib/node_modules/minipass/LICENSE similarity index 93% rename from deps/npm/node_modules/minipass/node_modules/yallist/LICENSE rename to deps/npm/node_modules/minizlib/node_modules/minipass/LICENSE index 19129e315fe593..20a47625409237 100644 --- a/deps/npm/node_modules/minipass/node_modules/yallist/LICENSE +++ b/deps/npm/node_modules/minizlib/node_modules/minipass/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +Copyright (c) npm, Inc. and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/deps/npm/node_modules/minizlib/node_modules/minipass/README.md b/deps/npm/node_modules/minizlib/node_modules/minipass/README.md new file mode 100644 index 00000000000000..c989beea0e6d97 --- /dev/null +++ b/deps/npm/node_modules/minizlib/node_modules/minipass/README.md @@ -0,0 +1,606 @@ +# minipass + +A _very_ minimal implementation of a [PassThrough +stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) + +[It's very +fast](https://docs.google.com/spreadsheets/d/1oObKSrVwLX_7Ut4Z6g3fZW-AX1j1-k6w-cDsrkaSbHM/edit#gid=0) +for objects, strings, and buffers. + +Supports pipe()ing (including multi-pipe() and backpressure +transmission), buffering data until either a `data` event handler or +`pipe()` is added (so you don't lose the first chunk), and most other +cases where PassThrough is a good idea. + +There is a `read()` method, but it's much more efficient to consume +data from this stream via `'data'` events or by calling `pipe()` into +some other stream. Calling `read()` requires the buffer to be +flattened in some cases, which requires copying memory. + +There is also no `unpipe()` method. Once you start piping, there is +no stopping it! + +If you set `objectMode: true` in the options, then whatever is written +will be emitted. Otherwise, it'll do a minimal amount of Buffer +copying to ensure proper Streams semantics when `read(n)` is called. + +`objectMode` can also be set by doing `stream.objectMode = true`, or by +writing any non-string/non-buffer data. `objectMode` cannot be set to +false once it is set. + +This is not a `through` or `through2` stream. It doesn't transform +the data, it just passes it right through. If you want to transform +the data, extend the class, and override the `write()` method. Once +you're done transforming the data however you want, call +`super.write()` with the transform output. + +For some examples of streams that extend Minipass in various ways, check +out: + +- [minizlib](http://npm.im/minizlib) +- [fs-minipass](http://npm.im/fs-minipass) +- [tar](http://npm.im/tar) +- [minipass-collect](http://npm.im/minipass-collect) +- [minipass-flush](http://npm.im/minipass-flush) +- [minipass-pipeline](http://npm.im/minipass-pipeline) +- [tap](http://npm.im/tap) +- [tap-parser](http://npm.im/tap) +- [treport](http://npm.im/tap) + +## Differences from Node.js Streams + +There are several things that make Minipass streams different from (and in +some ways superior to) Node.js core streams. + +Please read these caveats if you are familiar with noode-core streams and +intend to use Minipass streams in your programs. + +### Timing + +Minipass streams are designed to support synchronous use-cases. Thus, data +is emitted as soon as it is available, always. It is buffered until read, +but no longer. Another way to look at it is that Minipass streams are +exactly as synchronous as the logic that writes into them. + +This can be surprising if your code relies on `PassThrough.write()` always +providing data on the next tick rather than the current one, or being able +to call `resume()` and not have the entire buffer disappear immediately. + +However, without this synchronicity guarantee, there would be no way for +Minipass to achieve the speeds it does, or support the synchronous use +cases that it does. Simply put, waiting takes time. + +This non-deferring approach makes Minipass streams much easier to reason +about, especially in the context of Promises and other flow-control +mechanisms. + +### No High/Low Water Marks + +Node.js core streams will optimistically fill up a buffer, returning `true` +on all writes until the limit is hit, even if the data has nowhere to go. +Then, they will not attempt to draw more data in until the buffer size dips +below a minimum value. + +Minipass streams are much simpler. The `write()` method will return `true` +if the data has somewhere to go (which is to say, given the timing +guarantees, that the data is already there by the time `write()` returns). + +If the data has nowhere to go, then `write()` returns false, and the data +sits in a buffer, to be drained out immediately as soon as anyone consumes +it. + +### Hazards of Buffering (or: Why Minipass Is So Fast) + +Since data written to a Minipass stream is immediately written all the way +through the pipeline, and `write()` always returns true/false based on +whether the data was fully flushed, backpressure is communicated +immediately to the upstream caller. This minimizes buffering. + +Consider this case: + +```js +const {PassThrough} = require('stream') +const p1 = new PassThrough({ highWaterMark: 1024 }) +const p2 = new PassThrough({ highWaterMark: 1024 }) +const p3 = new PassThrough({ highWaterMark: 1024 }) +const p4 = new PassThrough({ highWaterMark: 1024 }) + +p1.pipe(p2).pipe(p3).pipe(p4) +p4.on('data', () => console.log('made it through')) + +// this returns false and buffers, then writes to p2 on next tick (1) +// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2) +// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3) +// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain' +// on next tick (4) +// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and +// 'drain' on next tick (5) +// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6) +// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next +// tick (7) + +p1.write(Buffer.alloc(2048)) // returns false +``` + +Along the way, the data was buffered and deferred at each stage, and +multiple event deferrals happened, for an unblocked pipeline where it was +perfectly safe to write all the way through! + +Furthermore, setting a `highWaterMark` of `1024` might lead someone reading +the code to think an advisory maximum of 1KiB is being set for the +pipeline. However, the actual advisory buffering level is the _sum_ of +`highWaterMark` values, since each one has its own bucket. + +Consider the Minipass case: + +```js +const m1 = new Minipass() +const m2 = new Minipass() +const m3 = new Minipass() +const m4 = new Minipass() + +m1.pipe(m2).pipe(m3).pipe(m4) +m4.on('data', () => console.log('made it through')) + +// m1 is flowing, so it writes the data to m2 immediately +// m2 is flowing, so it writes the data to m3 immediately +// m3 is flowing, so it writes the data to m4 immediately +// m4 is flowing, so it fires the 'data' event immediately, returns true +// m4's write returned true, so m3 is still flowing, returns true +// m3's write returned true, so m2 is still flowing, returns true +// m2's write returned true, so m1 is still flowing, returns true +// No event deferrals or buffering along the way! + +m1.write(Buffer.alloc(2048)) // returns true +``` + +It is extremely unlikely that you _don't_ want to buffer any data written, +or _ever_ buffer data that can be flushed all the way through. Neither +node-core streams nor Minipass ever fail to buffer written data, but +node-core streams do a lot of unnecessary buffering and pausing. + +As always, the faster implementation is the one that does less stuff and +waits less time to do it. + +### Immediately emit `end` for empty streams (when not paused) + +If a stream is not paused, and `end()` is called before writing any data +into it, then it will emit `end` immediately. + +If you have logic that occurs on the `end` event which you don't want to +potentially happen immediately (for example, closing file descriptors, +moving on to the next entry in an archive parse stream, etc.) then be sure +to call `stream.pause()` on creation, and then `stream.resume()` once you +are ready to respond to the `end` event. + +### Emit `end` When Asked + +One hazard of immediately emitting `'end'` is that you may not yet have had +a chance to add a listener. In order to avoid this hazard, Minipass +streams safely re-emit the `'end'` event if a new listener is added after +`'end'` has been emitted. + +Ie, if you do `stream.on('end', someFunction)`, and the stream has already +emitted `end`, then it will call the handler right away. (You can think of +this somewhat like attaching a new `.then(fn)` to a previously-resolved +Promise.) + +To prevent calling handlers multiple times who would not expect multiple +ends to occur, all listeners are removed from the `'end'` event whenever it +is emitted. + +### Impact of "immediate flow" on Tee-streams + +A "tee stream" is a stream piping to multiple destinations: + +```js +const tee = new Minipass() +t.pipe(dest1) +t.pipe(dest2) +t.write('foo') // goes to both destinations +``` + +Since Minipass streams _immediately_ process any pending data through the +pipeline when a new pipe destination is added, this can have surprising +effects, especially when a stream comes in from some other function and may +or may not have data in its buffer. + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone +src.pipe(dest2) // gets nothing! +``` + +The solution is to create a dedicated tee-stream junction that pipes to +both locations, and then pipe to _that_ instead. + +```js +// Safe example: tee to both places +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.pipe(dest1) +tee.pipe(dest2) +stream.pipe(tee) // tee gets 'foo', pipes to both locations +``` + +The same caveat applies to `on('data')` event listeners. The first one +added will _immediately_ receive all of the data, leaving nothing for the +second: + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.on('data', handler1) // receives 'foo' right away +src.on('data', handler2) // nothing to see here! +``` + +Using a dedicated tee-stream can be used in this case as well: + +```js +// Safe example: tee to both data handlers +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.on('data', handler1) +tee.on('data', handler2) +src.pipe(tee) +``` + +## USAGE + +It's a stream! Use it like a stream and it'll most likely do what you want. + +```js +const Minipass = require('minipass') +const mp = new Minipass(options) // optional: { encoding, objectMode } +mp.write('foo') +mp.pipe(someOtherStream) +mp.end('bar') +``` + +### OPTIONS + +* `encoding` How would you like the data coming _out_ of the stream to be + encoded? Accepts any values that can be passed to `Buffer.toString()`. +* `objectMode` Emit data exactly as it comes in. This will be flipped on + by default if you write() something other than a string or Buffer at any + point. Setting `objectMode: true` will prevent setting any encoding + value. + +### API + +Implements the user-facing portions of Node.js's `Readable` and `Writable` +streams. + +### Methods + +* `write(chunk, [encoding], [callback])` - Put data in. (Note that, in the + base Minipass class, the same data will come out.) Returns `false` if + the stream will buffer the next write, or true if it's still in + "flowing" mode. +* `end([chunk, [encoding]], [callback])` - Signal that you have no more + data to write. This will queue an `end` event to be fired when all the + data has been consumed. +* `setEncoding(encoding)` - Set the encoding for data coming of the + stream. This can only be done once. +* `pause()` - No more data for a while, please. This also prevents `end` + from being emitted for empty streams until the stream is resumed. +* `resume()` - Resume the stream. If there's data in the buffer, it is + all discarded. Any buffered events are immediately emitted. +* `pipe(dest)` - Send all output to the stream provided. There is no way + to unpipe. When data is emitted, it is immediately written to any and + all pipe destinations. +* `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are EventEmitters. + Some events are given special treatment, however. (See below under + "events".) +* `promise()` - Returns a Promise that resolves when the stream emits + `end`, or rejects if the stream emits `error`. +* `collect()` - Return a Promise that resolves on `end` with an array + containing each chunk of data that was emitted, or rejects if the + stream emits `error`. Note that this consumes the stream data. +* `concat()` - Same as `collect()`, but concatenates the data into a + single Buffer object. Will reject the returned promise if the stream is + in objectMode, or if it goes into objectMode by the end of the data. +* `read(n)` - Consume `n` bytes of data out of the buffer. If `n` is not + provided, then consume all of it. If `n` bytes are not available, then + it returns null. **Note** consuming streams in this way is less + efficient, and can lead to unnecessary Buffer copying. +* `destroy([er])` - Destroy the stream. If an error is provided, then an + `'error'` event is emitted. If the stream has a `close()` method, and + has not emitted a `'close'` event yet, then `stream.close()` will be + called. Any Promises returned by `.promise()`, `.collect()` or + `.concat()` will be rejected. After being destroyed, writing to the + stream will emit an error. No more data will be emitted if the stream is + destroyed, even if it was previously buffered. + +### Properties + +* `bufferLength` Read-only. Total number of bytes buffered, or in the case + of objectMode, the total number of objects. +* `encoding` The encoding that has been set. (Setting this is equivalent + to calling `setEncoding(enc)` and has the same prohibition against + setting multiple times.) +* `flowing` Read-only. Boolean indicating whether a chunk written to the + stream will be immediately emitted. +* `emittedEnd` Read-only. Boolean indicating whether the end-ish events + (ie, `end`, `prefinish`, `finish`) have been emitted. Note that + listening on any end-ish event will immediateyl re-emit it if it has + already been emitted. +* `writable` Whether the stream is writable. Default `true`. Set to + `false` when `end()` +* `readable` Whether the stream is readable. Default `true`. +* `buffer` A [yallist](http://npm.im/yallist) linked list of chunks written + to the stream that have not yet been emitted. (It's probably a bad idea + to mess with this.) +* `pipes` A [yallist](http://npm.im/yallist) linked list of streams that + this stream is piping into. (It's probably a bad idea to mess with + this.) +* `destroyed` A getter that indicates whether the stream was destroyed. +* `paused` True if the stream has been explicitly paused, otherwise false. +* `objectMode` Indicates whether the stream is in `objectMode`. Once set + to `true`, it cannot be set to `false`. + +### Events + +* `data` Emitted when there's data to read. Argument is the data to read. + This is never emitted while not flowing. If a listener is attached, that + will resume the stream. +* `end` Emitted when there's no more data to read. This will be emitted + immediately for empty streams when `end()` is called. If a listener is + attached, and `end` was already emitted, then it will be emitted again. + All listeners are removed when `end` is emitted. +* `prefinish` An end-ish event that follows the same logic as `end` and is + emitted in the same conditions where `end` is emitted. Emitted after + `'end'`. +* `finish` An end-ish event that follows the same logic as `end` and is + emitted in the same conditions where `end` is emitted. Emitted after + `'prefinish'`. +* `close` An indication that an underlying resource has been released. + Minipass does not emit this event, but will defer it until after `end` + has been emitted, since it throws off some stream libraries otherwise. +* `drain` Emitted when the internal buffer empties, and it is again + suitable to `write()` into the stream. +* `readable` Emitted when data is buffered and ready to be read by a + consumer. +* `resume` Emitted when stream changes state from buffering to flowing + mode. (Ie, when `resume` is called, `pipe` is called, or a `data` event + listener is added.) + +### Static Methods + +* `Minipass.isStream(stream)` Returns `true` if the argument is a stream, + and false otherwise. To be considered a stream, the object must be + either an instance of Minipass, or an EventEmitter that has either a + `pipe()` method, or both `write()` and `end()` methods. (Pretty much any + stream in node-land will return `true` for this.) + +## EXAMPLES + +Here are some examples of things you can do with Minipass streams. + +### simple "are you done yet" promise + +```js +mp.promise().then(() => { + // stream is finished +}, er => { + // stream emitted an error +}) +``` + +### collecting + +```js +mp.collect().then(all => { + // all is an array of all the data emitted + // encoding is supported in this case, so + // so the result will be a collection of strings if + // an encoding is specified, or buffers/objects if not. + // + // In an async function, you may do + // const data = await stream.collect() +}) +``` + +### collecting into a single blob + +This is a bit slower because it concatenates the data into one chunk for +you, but if you're going to do it yourself anyway, it's convenient this +way: + +```js +mp.concat().then(onebigchunk => { + // onebigchunk is a string if the stream + // had an encoding set, or a buffer otherwise. +}) +``` + +### iteration + +You can iterate over streams synchronously or asynchronously in +platforms that support it. + +Synchronous iteration will end when the currently available data is +consumed, even if the `end` event has not been reached. In string and +buffer mode, the data is concatenated, so unless multiple writes are +occurring in the same tick as the `read()`, sync iteration loops will +generally only have a single iteration. + +To consume chunks in this way exactly as they have been written, with +no flattening, create the stream with the `{ objectMode: true }` +option. + +```js +const mp = new Minipass({ objectMode: true }) +mp.write('a') +mp.write('b') +for (let letter of mp) { + console.log(letter) // a, b +} +mp.write('c') +mp.write('d') +for (let letter of mp) { + console.log(letter) // c, d +} +mp.write('e') +mp.end() +for (let letter of mp) { + console.log(letter) // e +} +for (let letter of mp) { + console.log(letter) // nothing +} +``` + +Asynchronous iteration will continue until the end event is reached, +consuming all of the data. + +```js +const mp = new Minipass({ encoding: 'utf8' }) + +// some source of some data +let i = 5 +const inter = setInterval(() => { + if (i --> 0) + mp.write(Buffer.from('foo\n', 'utf8')) + else { + mp.end() + clearInterval(inter) + } +}, 100) + +// consume the data with asynchronous iteration +async function consume () { + for await (let chunk of mp) { + console.log(chunk) + } + return 'ok' +} + +consume().then(res => console.log(res)) +// logs `foo\n` 5 times, and then `ok` +``` + +### subclass that `console.log()`s everything written into it + +```js +class Logger extends Minipass { + write (chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end (chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } +} + +someSource.pipe(new Logger()).pipe(someDest) +``` + +### same thing, but using an inline anonymous class + +```js +// js classes are fun +someSource + .pipe(new (class extends Minipass { + emit (ev, ...data) { + // let's also log events, because debugging some weird thing + console.log('EMIT', ev) + return super.emit(ev, ...data) + } + write (chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end (chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } + })) + .pipe(someDest) +``` + +### subclass that defers 'end' for some reason + +```js +class SlowEnd extends Minipass { + emit (ev, ...args) { + if (ev === 'end') { + console.log('going to end, hold on a sec') + setTimeout(() => { + console.log('ok, ready to end now') + super.emit('end', ...args) + }, 100) + } else { + return super.emit(ev, ...args) + } + } +} +``` + +### transform that creates newline-delimited JSON + +```js +class NDJSONEncode extends Minipass { + write (obj, cb) { + try { + // JSON.stringify can throw, emit an error on that + return super.write(JSON.stringify(obj) + '\n', 'utf8', cb) + } catch (er) { + this.emit('error', er) + } + } + end (obj, cb) { + if (typeof obj === 'function') { + cb = obj + obj = undefined + } + if (obj !== undefined) { + this.write(obj) + } + return super.end(cb) + } +} +``` + +### transform that parses newline-delimited JSON + +```js +class NDJSONDecode extends Minipass { + constructor (options) { + // always be in object mode, as far as Minipass is concerned + super({ objectMode: true }) + this._jsonBuffer = '' + } + write (chunk, encoding, cb) { + if (typeof chunk === 'string' && + typeof encoding === 'string' && + encoding !== 'utf8') { + chunk = Buffer.from(chunk, encoding).toString() + } else if (Buffer.isBuffer(chunk)) + chunk = chunk.toString() + } + if (typeof encoding === 'function') { + cb = encoding + } + const jsonData = (this._jsonBuffer + chunk).split('\n') + this._jsonBuffer = jsonData.pop() + for (let i = 0; i < jsonData.length; i++) { + let parsed + try { + super.write(parsed) + } catch (er) { + this.emit('error', er) + continue + } + } + if (cb) + cb() + } +} +``` diff --git a/deps/npm/node_modules/minipass/index.js b/deps/npm/node_modules/minizlib/node_modules/minipass/index.js similarity index 59% rename from deps/npm/node_modules/minipass/index.js rename to deps/npm/node_modules/minizlib/node_modules/minipass/index.js index ae2dd906403e42..c072352d448a97 100644 --- a/deps/npm/node_modules/minipass/index.js +++ b/deps/npm/node_modules/minizlib/node_modules/minipass/index.js @@ -1,41 +1,62 @@ 'use strict' const EE = require('events') const Yallist = require('yallist') +const SD = require('string_decoder').StringDecoder + const EOF = Symbol('EOF') const MAYBE_EMIT_END = Symbol('maybeEmitEnd') const EMITTED_END = Symbol('emittedEnd') +const EMITTING_END = Symbol('emittingEnd') const CLOSED = Symbol('closed') const READ = Symbol('read') const FLUSH = Symbol('flush') -const doIter = process.env._MP_NO_ITERATOR_SYMBOLS_ !== '1' -const ASYNCITERATOR = doIter && Symbol.asyncIterator || Symbol('asyncIterator not implemented') -const ITERATOR = doIter && Symbol.iterator || Symbol('iterator not implemented') const FLUSHCHUNK = Symbol('flushChunk') -const SD = require('string_decoder').StringDecoder const ENCODING = Symbol('encoding') const DECODER = Symbol('decoder') const FLOWING = Symbol('flowing') +const PAUSED = Symbol('paused') const RESUME = Symbol('resume') const BUFFERLENGTH = Symbol('bufferLength') const BUFFERPUSH = Symbol('bufferPush') const BUFFERSHIFT = Symbol('bufferShift') const OBJECTMODE = Symbol('objectMode') -const SILENT_END = Symbol('silentEnd') +const DESTROYED = Symbol('destroyed') + +// TODO remove when Node v8 support drops +const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' +const ASYNCITERATOR = doIter && Symbol.asyncIterator + || Symbol('asyncIterator not implemented') +const ITERATOR = doIter && Symbol.iterator + || Symbol('iterator not implemented') // Buffer in node 4.x < 4.5.0 doesn't have working Buffer.from // or Buffer.alloc, and Buffer in node 10 deprecated the ctor. // .M, this is fine .\^/M.. -let B = Buffer -/* istanbul ignore next */ -if (!B.alloc) { - B = require('safe-buffer').Buffer -} - -module.exports = class MiniPass extends EE { +const B = Buffer.alloc ? Buffer + : /* istanbul ignore next */ require('safe-buffer').Buffer + +// events that mean 'the stream is over' +// these are treated specially, and re-emitted +// if they are listened for after emitting. +const isEndish = ev => + ev === 'end' || + ev === 'finish' || + ev === 'prefinish' + +const isArrayBuffer = b => b instanceof ArrayBuffer || + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0 + +const isArrayBufferView = b => !B.isBuffer(b) && ArrayBuffer.isView(b) + +module.exports = class Minipass extends EE { constructor (options) { super() - this[SILENT_END] = false this[FLOWING] = false + // whether we're explicitly paused + this[PAUSED] = false this.pipes = new Yallist() this.buffer = new Yallist() this[OBJECTMODE] = options && options.objectMode || false @@ -48,10 +69,12 @@ module.exports = class MiniPass extends EE { this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null this[EOF] = false this[EMITTED_END] = false + this[EMITTING_END] = false this[CLOSED] = false this.writable = true this.readable = true this[BUFFERLENGTH] = 0 + this[DESTROYED] = false } get bufferLength () { return this[BUFFERLENGTH] } @@ -78,16 +101,52 @@ module.exports = class MiniPass extends EE { this.encoding = enc } + get objectMode () { return this[OBJECTMODE] } + set objectMode (ॐ ) { this[OBJECTMODE] = this[OBJECTMODE] || !!ॐ } + write (chunk, encoding, cb) { if (this[EOF]) throw new Error('write after end') + if (this[DESTROYED]) { + this.emit('error', Object.assign( + new Error('Cannot call write after a stream was destroyed'), + { code: 'ERR_STREAM_DESTROYED' } + )) + return true + } + if (typeof encoding === 'function') cb = encoding, encoding = 'utf8' if (!encoding) encoding = 'utf8' + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything else switches us into object mode + if (!this[OBJECTMODE] && !B.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) + chunk = B.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) + else if (isArrayBuffer(chunk)) + chunk = B.from(chunk) + else if (typeof chunk !== 'string') + // use the setter so we throw if we have encoding set + this.objectMode = true + } + + // this ensures at this point that the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!this.objectMode && !chunk.length) { + const ret = this.flowing + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') + if (cb) + cb() + return ret + } + // fast-path writing strings of same encoding to a stream with // an empty buffer, skipping the buffer/decoder dance if (typeof chunk === 'string' && !this[OBJECTMODE] && @@ -104,13 +163,17 @@ module.exports = class MiniPass extends EE { ? (this.emit('data', chunk), this.flowing) : (this[BUFFERPUSH](chunk), false) } finally { - this.emit('readable') + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') if (cb) cb() } } read (n) { + if (this[DESTROYED]) + return null + try { if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) return null @@ -163,12 +226,22 @@ module.exports = class MiniPass extends EE { this.once('end', cb) this[EOF] = true this.writable = false - if (this.flowing) + + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this.flowing || !this[PAUSED]) this[MAYBE_EMIT_END]() + return this } // don't let the internal resume be overwritten [RESUME] () { + if (this[DESTROYED]) + return + + this[PAUSED] = false this[FLOWING] = true this.emit('resume') if (this.buffer.length) @@ -185,12 +258,21 @@ module.exports = class MiniPass extends EE { pause () { this[FLOWING] = false + this[PAUSED] = true + } + + get destroyed () { + return this[DESTROYED] } get flowing () { return this[FLOWING] } + get paused () { + return this[PAUSED] + } + [BUFFERPUSH] (chunk) { if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1 @@ -221,13 +303,24 @@ module.exports = class MiniPass extends EE { } pipe (dest, opts) { + if (this[DESTROYED]) + return + + const ended = this[EMITTED_END] + opts = opts || {} if (dest === process.stdout || dest === process.stderr) - (opts = opts || {}).end = false + opts.end = false + else + opts.end = opts.end !== false + const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() } this.pipes.push(p) dest.on('drain', p.ondrain) this[RESUME]() + // piping an ended stream ends immediately + if (ended && p.opts.end) + p.dest.end() return dest } @@ -241,9 +334,9 @@ module.exports = class MiniPass extends EE { } finally { if (ev === 'data' && !this.pipes.length && !this.flowing) this[RESUME]() - else if (ev === 'end' && this[SILENT_END] && this[EMITTED_END]) { - this[SILENT_END] = false - super.emit('end') + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev) + this.removeAllListeners(ev) } } } @@ -253,23 +346,34 @@ module.exports = class MiniPass extends EE { } [MAYBE_EMIT_END] () { - if (!this[EMITTED_END] && this.buffer.length === 0 && this[EOF]) { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this.buffer.length === 0 && + this[EOF]) { + this[EMITTING_END] = true this.emit('end') this.emit('prefinish') this.emit('finish') if (this[CLOSED]) this.emit('close') + this[EMITTING_END] = false } } emit (ev, data) { - if (ev === 'data') { + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) + return + else if (ev === 'data') { if (!data) return if (this.pipes.length) - this.pipes.forEach(p => p.dest.write(data) || this.pause()) + this.pipes.forEach(p => + p.dest.write(data) === false && this.pause()) } else if (ev === 'end') { + // only actual end gets this treatment if (this[EMITTED_END] === true) return @@ -286,16 +390,17 @@ module.exports = class MiniPass extends EE { this.pipes.forEach(p => { p.dest.removeListener('drain', p.ondrain) - if (!p.opts || p.opts.end !== false) + if (p.opts.end) p.dest.end() }) } else if (ev === 'close') { this[CLOSED] = true // don't emit close before 'end' and 'finish' - if (!this[EMITTED_END]) + if (!this[EMITTED_END] && !this[DESTROYED]) return } + // TODO: replace with a spread operator when Node v4 support drops const args = new Array(arguments.length) args[0] = ev args[1] = data @@ -306,23 +411,42 @@ module.exports = class MiniPass extends EE { } try { - const ret = super.emit.apply(this, args) - if (ev === 'end' && ret === false) - this[SILENT_END] = true - return ret + return super.emit.apply(this, args) } finally { - if (ev !== 'end') + if (!isEndish(ev)) this[MAYBE_EMIT_END]() + else + this.removeAllListeners(ev) } } // const all = await stream.collect() collect () { + const buf = [] + buf.dataLength = 0 + this.on('data', c => { + buf.push(c) + buf.dataLength += c.length + }) + return this.promise().then(() => buf) + } + + // const data = await stream.concat() + concat () { + return this[OBJECTMODE] + ? Promise.reject(new Error('cannot concat in objectMode')) + : this.collect().then(buf => + this[OBJECTMODE] + ? Promise.reject(new Error('cannot concat in objectMode')) + : this[ENCODING] ? buf.join('') : B.concat(buf, buf.dataLength)) + } + + // stream.promise().then(() => done, er => emitted error) + promise () { return new Promise((resolve, reject) => { - const buf = [] - this.on('data', c => buf.push(c)) - this.on('end', () => resolve(buf)) - this.on('error', reject) + this.on(DESTROYED, () => reject(new Error('stream destroyed'))) + this.on('end', () => resolve()) + this.on('error', er => reject(er)) }) } @@ -354,13 +478,14 @@ module.exports = class MiniPass extends EE { this.removeListener('data', ondata) resolve({ done: true }) } + const ondestroy = () => onerr(new Error('stream destroyed')) return new Promise((res, rej) => { reject = rej resolve = res + this.once(DESTROYED, ondestroy) this.once('error', onerr) this.once('end', onend) this.once('data', ondata) - this.resume() }) } @@ -376,4 +501,37 @@ module.exports = class MiniPass extends EE { } return { next } } + + destroy (er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er) + else + this.emit(DESTROYED) + return this + } + + this[DESTROYED] = true + + // throw away all buffered data, it's never coming out + this.buffer = new Yallist() + this[BUFFERLENGTH] = 0 + + if (typeof this.close === 'function' && !this[CLOSED]) + this.close() + + if (er) + this.emit('error', er) + else // if no error to emit, still reject pending promises + this.emit(DESTROYED) + + return this + } + + static isStream (s) { + return !!s && (s instanceof Minipass || s instanceof EE && ( + typeof s.pipe === 'function' || // readable + (typeof s.write === 'function' && typeof s.end === 'function') // writable + )) + } } diff --git a/deps/npm/node_modules/minipass/package.json b/deps/npm/node_modules/minizlib/node_modules/minipass/package.json similarity index 62% rename from deps/npm/node_modules/minipass/package.json rename to deps/npm/node_modules/minizlib/node_modules/minipass/package.json index 0654e5f597df60..57284172b071f2 100644 --- a/deps/npm/node_modules/minipass/package.json +++ b/deps/npm/node_modules/minizlib/node_modules/minipass/package.json @@ -1,32 +1,27 @@ { - "_from": "minipass@^2.3.3", - "_id": "minipass@2.3.3", + "_from": "minipass@^2.9.0", + "_id": "minipass@2.9.0", "_inBundle": false, - "_integrity": "sha512-/jAn9/tEX4gnpyRATxgHEOV6xbcyxgT7iUnxo9Y3+OB0zX00TgKIv/2FZCf5brBbICcwbLqVv2ImjvWWrQMSYw==", - "_location": "/minipass", + "_integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "_location": "/minizlib/minipass", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "minipass@^2.3.3", + "raw": "minipass@^2.9.0", "name": "minipass", "escapedName": "minipass", - "rawSpec": "^2.3.3", + "rawSpec": "^2.9.0", "saveSpec": null, - "fetchSpec": "^2.3.3" + "fetchSpec": "^2.9.0" }, "_requiredBy": [ - "/fs-minipass", - "/minizlib", - "/pacote", - "/tap", - "/tap-parser", - "/tar" + "/minizlib" ], - "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.3.tgz", - "_shasum": "a7dcc8b7b833f5d368759cce544dccb55f50f233", - "_spec": "minipass@^2.3.3", - "_where": "/Users/rebecca/code/npm/node_modules/pacote", + "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "_shasum": "e713762e7d3e32fed803115cf93e04bca9fcc9a6", + "_spec": "minipass@^2.9.0", + "_where": "/Users/mperrotte/npminc/cli/node_modules/minizlib", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -44,7 +39,7 @@ "description": "minimal implementation of a PassThrough stream", "devDependencies": { "end-of-stream": "^1.4.0", - "tap": "^12.0.1", + "tap": "^14.6.5", "through2": "^2.0.3" }, "files": [ @@ -63,10 +58,13 @@ "url": "git+https://github.com/isaacs/minipass.git" }, "scripts": { - "postpublish": "git push origin --all; git push origin --tags", + "postpublish": "git push origin --follow-tags", "postversion": "npm publish", "preversion": "npm test", - "test": "tap test/*.js --100" + "test": "tap" }, - "version": "2.3.3" + "tap": { + "check-coverage": true + }, + "version": "2.9.0" } diff --git a/deps/npm/node_modules/minizlib/package.json b/deps/npm/node_modules/minizlib/package.json index fbf08b3df98c13..1284b8c6c48316 100644 --- a/deps/npm/node_modules/minizlib/package.json +++ b/deps/npm/node_modules/minizlib/package.json @@ -1,10 +1,13 @@ { "_from": "minizlib@^1.2.1", - "_id": "minizlib@1.2.2", + "_id": "minizlib@1.3.3", "_inBundle": false, - "_integrity": "sha512-hR3At21uSrsjjDTWrbu0IMLTpnkpv8IIMFDFaoz43Tmu4LkmAXfH44vNNzpTnf+OAQQCHrb91y/wc2J4x5XgSQ==", + "_integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", "_location": "/minizlib", - "_phantomChildren": {}, + "_phantomChildren": { + "safe-buffer": "5.1.2", + "yallist": "3.0.3" + }, "_requested": { "type": "range", "registry": true, @@ -18,8 +21,8 @@ "_requiredBy": [ "/tar" ], - "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.2.tgz", - "_shasum": "6f0ccc82fa53e1bf2ff145f220d2da9fa6e3a166", + "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "_shasum": "2290de96818a34c29551c8a8d301216bd65a861d", "_spec": "minizlib@^1.2.1", "_where": "/Users/mperrotte/npminc/cli/node_modules/tar", "author": { @@ -32,7 +35,7 @@ }, "bundleDependencies": false, "dependencies": { - "minipass": "^2.2.1" + "minipass": "^2.9.0" }, "deprecated": false, "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", @@ -67,5 +70,5 @@ "preversion": "npm test", "test": "tap test/*.js --100 -J" }, - "version": "1.2.2" + "version": "1.3.3" } diff --git a/deps/npm/node_modules/npm-packlist/index.js b/deps/npm/node_modules/npm-packlist/index.js index 8bfd257794f9e0..dd7706a4aee2a5 100644 --- a/deps/npm/node_modules/npm-packlist/index.js +++ b/deps/npm/node_modules/npm-packlist/index.js @@ -51,6 +51,9 @@ const defaultRules = [ 'core.+([0-9])', ] +// There may be others, but :?|<> are handled by node-tar +const nameIsBadForWindows = file => /\*/.test(file) + // a decorator that applies our custom rules to an ignore walker const npmWalker = Class => class Walker extends Class { constructor (opt) { @@ -170,6 +173,7 @@ const npmWalker = Class => class Walker extends Class { pkg.browser ? '!' + pkg.browser : '', pkg.main ? '!' + pkg.main : '', '!package.json', + '!npm-shrinkwrap.json', '!@(readme|copying|license|licence|notice|changes|changelog|history){,.*[^~$]}' ] if (pkg.bin) @@ -190,6 +194,16 @@ const npmWalker = Class => class Walker extends Class { then() } + // override parent stat function to completely skip any filenames + // that will break windows entirely. + // XXX(isaacs) Next major version should make this an error instead. + stat (entry, file, dir, then) { + if (nameIsBadForWindows(entry)) + then() + else + super.stat(entry, file, dir, then) + } + // override parent onstat function to nix all symlinks onstat (st, entry, file, dir, then) { if (st.isSymbolicLink()) diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json index d72eef9cae7392..a8fabfa7f12405 100644 --- a/deps/npm/node_modules/npm-packlist/package.json +++ b/deps/npm/node_modules/npm-packlist/package.json @@ -1,29 +1,29 @@ { - "_from": "npm-packlist@^1.4.3", - "_id": "npm-packlist@1.4.4", + "_from": "npm-packlist@1.4.6", + "_id": "npm-packlist@1.4.6", "_inBundle": false, - "_integrity": "sha512-zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw==", + "_integrity": "sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg==", "_location": "/npm-packlist", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "npm-packlist@^1.4.3", + "raw": "npm-packlist@1.4.6", "name": "npm-packlist", "escapedName": "npm-packlist", - "rawSpec": "^1.4.3", + "rawSpec": "1.4.6", "saveSpec": null, - "fetchSpec": "^1.4.3" + "fetchSpec": "1.4.6" }, "_requiredBy": [ "#USER", "/", "/pacote" ], - "_resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.4.tgz", - "_shasum": "866224233850ac534b63d1a6e76050092b5d2f44", - "_spec": "npm-packlist@^1.4.3", - "_where": "/Users/isaacs/dev/npm/cli", + "_resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.6.tgz", + "_shasum": "53ba3ed11f8523079f1457376dd379ee4ea42ff4", + "_spec": "npm-packlist@1.4.6", + "_where": "/Users/mperrotte/npminc/cli", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -42,7 +42,7 @@ "devDependencies": { "mkdirp": "^0.5.1", "rimraf": "^2.6.1", - "tap": "^14.2.1" + "tap": "^14.6.9" }, "directories": { "test": "test" @@ -65,5 +65,8 @@ "snap": "tap", "test": "tap" }, - "version": "1.4.4" + "tap": { + "jobs": 1 + }, + "version": "1.4.6" } diff --git a/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md b/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md index fc6ba4f7e3fec5..8eee50a4790a3c 100644 --- a/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md +++ b/deps/npm/node_modules/npm-registry-fetch/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [4.0.2](https://github.com/npm/registry-fetch/compare/v4.0.0...v4.0.2) (2019-10-04) + + +### Bug Fixes + +* Add null check on body on 401 errors ([e3a0186](https://github.com/npm/registry-fetch/commit/e3a0186)), closes [#9](https://github.com/npm/registry-fetch/issues/9) +* **deps:** Add explicit dependency on safe-buffer ([8eae5f0](https://github.com/npm/registry-fetch/commit/8eae5f0)), closes [npm/libnpmaccess#2](https://github.com/npm/libnpmaccess/issues/2) [#3](https://github.com/npm/registry-fetch/issues/3) + + + # [4.0.0](https://github.com/npm/registry-fetch/compare/v3.9.1...v4.0.0) (2019-07-15) diff --git a/deps/npm/node_modules/npm-registry-fetch/check-response.js b/deps/npm/node_modules/npm-registry-fetch/check-response.js index bfde699edcfbd6..14058239ba3f5d 100644 --- a/deps/npm/node_modules/npm-registry-fetch/check-response.js +++ b/deps/npm/node_modules/npm-registry-fetch/check-response.js @@ -95,7 +95,7 @@ function checkErrors (method, res, startTime, opts) { method, res, parsed, opts.spec ) } - } else if (res.status === 401 && /one-time pass/.test(body.toString('utf8'))) { + } else if (res.status === 401 && body != null && /one-time pass/.test(body.toString('utf8'))) { // Heuristic for malformed OTP responses that don't include the www-authenticate header. throw new errors.HttpErrorAuthOTP( method, res, parsed, opts.spec diff --git a/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/LICENSE b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/LICENSE new file mode 100644 index 00000000000000..0c068ceecbd48f --- /dev/null +++ b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/README.md b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/README.md new file mode 100644 index 00000000000000..356e3519302cfa --- /dev/null +++ b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/README.md @@ -0,0 +1,586 @@ +# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/safe-buffer +[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg +[npm-url]: https://npmjs.org/package/safe-buffer +[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg +[downloads-url]: https://npmjs.org/package/safe-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Safer Node.js Buffer API + +**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, +`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** + +**Uses the built-in implementation when available.** + +## install + +``` +npm install safe-buffer +``` + +[Get supported safe-buffer with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-safe-buffer?utm_source=npm-safe-buffer&utm_medium=referral&utm_campaign=readme) + +## usage + +The goal of this package is to provide a safe replacement for the node.js `Buffer`. + +It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to +the top of your node.js modules: + +```js +var Buffer = require('safe-buffer').Buffer + +// Existing buffer code will continue to work without issues: + +new Buffer('hey', 'utf8') +new Buffer([1, 2, 3], 'utf8') +new Buffer(obj) +new Buffer(16) // create an uninitialized buffer (potentially unsafe) + +// But you can use these new explicit APIs to make clear what you want: + +Buffer.from('hey', 'utf8') // convert from many types to a Buffer +Buffer.alloc(16) // create a zero-filled buffer (safe) +Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) +``` + +## api + +### Class Method: Buffer.from(array) + + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) + + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created `Buffer` will share the same allocated memory as the +TypedArray. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) + + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) + + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the character encoding. +If not provided, `encoding` defaults to `'utf8'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) + + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. A zero-length Buffer will be created if a `size` less than or equal to +0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.allocUnsafeSlow(size) + + +* `size` {Number} + +Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The +`size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, +allocations under 4KB are, by default, sliced from a single pre-allocated +`Buffer`. This allows applications to avoid the garbage collection overhead of +creating many individually allocated Buffers. This approach improves both +performance and memory usage by eliminating the need to track and cleanup as +many `Persistent` objects. + +However, in the case where a developer may need to retain a small chunk of +memory from a pool for an indeterminate amount of time, it may be appropriate +to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then +copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + const data = socket.read(); + // allocate for retained data + const sb = Buffer.allocUnsafeSlow(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* +a developer has observed undue memory retention in their applications. + +A `TypeError` will be thrown if `size` is not a number. + +### All the Rest + +The rest of the `Buffer` API is exactly the same as in node.js. +[See the docs](https://nodejs.org/api/buffer.html). + + +## Related links + +- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) +- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) + +## Why is `Buffer` unsafe? + +Today, the node.js `Buffer` constructor is overloaded to handle many different argument +types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), +`ArrayBuffer`, and also `Number`. + +The API is optimized for convenience: you can throw any type at it, and it will try to do +what you want. + +Because the Buffer constructor is so powerful, you often see code like this: + +```js +// Convert UTF-8 strings to hex +function toHex (str) { + return new Buffer(str).toString('hex') +} +``` + +***But what happens if `toHex` is called with a `Number` argument?*** + +### Remote Memory Disclosure + +If an attacker can make your program call the `Buffer` constructor with a `Number` +argument, then they can make it allocate uninitialized memory from the node.js process. +This could potentially disclose TLS private keys, user data, or database passwords. + +When the `Buffer` constructor is passed a `Number` argument, it returns an +**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like +this, you **MUST** overwrite the contents before returning it to the user. + +From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): + +> `new Buffer(size)` +> +> - `size` Number +> +> The underlying memory for `Buffer` instances created in this way is not initialized. +> **The contents of a newly created `Buffer` are unknown and could contain sensitive +> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. + +(Emphasis our own.) + +Whenever the programmer intended to create an uninitialized `Buffer` you often see code +like this: + +```js +var buf = new Buffer(16) + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### Would this ever be a problem in real code? + +Yes. It's surprisingly common to forget to check the type of your variables in a +dynamically-typed language like JavaScript. + +Usually the consequences of assuming the wrong type is that your program crashes with an +uncaught exception. But the failure mode for forgetting to check the type of arguments to +the `Buffer` constructor is more catastrophic. + +Here's an example of a vulnerable service that takes a JSON payload and converts it to +hex: + +```js +// Take a JSON payload {str: "some string"} and convert it to hex +var server = http.createServer(function (req, res) { + var data = '' + req.setEncoding('utf8') + req.on('data', function (chunk) { + data += chunk + }) + req.on('end', function () { + var body = JSON.parse(data) + res.end(new Buffer(body.str).toString('hex')) + }) +}) + +server.listen(8080) +``` + +In this example, an http client just has to send: + +```json +{ + "str": 1000 +} +``` + +and it will get back 1,000 bytes of uninitialized memory from the server. + +This is a very serious bug. It's similar in severity to the +[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process +memory by remote attackers. + + +### Which real-world packages were vulnerable? + +#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) + +[Mathias Buus](https://github.com/mafintosh) and I +([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, +[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow +anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get +them to reveal 20 bytes at a time of uninitialized memory from the node.js process. + +Here's +[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) +that fixed it. We released a new fixed version, created a +[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all +vulnerable versions on npm so users will get a warning to upgrade to a newer version. + +#### [`ws`](https://www.npmjs.com/package/ws) + +That got us wondering if there were other vulnerable packages. Sure enough, within a short +period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the +most popular WebSocket implementation in node.js. + +If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as +expected, then uninitialized server memory would be disclosed to the remote peer. + +These were the vulnerable methods: + +```js +socket.send(number) +socket.ping(number) +socket.pong(number) +``` + +Here's a vulnerable socket server with some echo functionality: + +```js +server.on('connection', function (socket) { + socket.on('message', function (message) { + message = JSON.parse(message) + if (message.type === 'echo') { + socket.send(message.data) // send back the user's message + } + }) +}) +``` + +`socket.send(number)` called on the server, will disclose server memory. + +Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue +was fixed, with a more detailed explanation. Props to +[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the +[Node Security Project disclosure](https://nodesecurity.io/advisories/67). + + +### What's the solution? + +It's important that node.js offers a fast way to get memory otherwise performance-critical +applications would needlessly get a lot slower. + +But we need a better way to *signal our intent* as programmers. **When we want +uninitialized memory, we should request it explicitly.** + +Sensitive functionality should not be packed into a developer-friendly API that loosely +accepts many different types. This type of API encourages the lazy practice of passing +variables in without checking the type very carefully. + +#### A new API: `Buffer.allocUnsafe(number)` + +The functionality of creating buffers with uninitialized memory should be part of another +API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that +frequently gets user input of all sorts of different types passed into it. + +```js +var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### How do we fix node.js core? + +We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as +`semver-major`) which defends against one case: + +```js +var str = 16 +new Buffer(str, 'utf8') +``` + +In this situation, it's implied that the programmer intended the first argument to be a +string, since they passed an encoding as a second argument. Today, node.js will allocate +uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not +what the programmer intended. + +But this is only a partial solution, since if the programmer does `new Buffer(variable)` +(without an `encoding` parameter) there's no way to know what they intended. If `variable` +is sometimes a number, then uninitialized memory will sometimes be returned. + +### What's the real long-term fix? + +We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when +we need uninitialized memory. But that would break 1000s of packages. + +~~We believe the best solution is to:~~ + +~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ + +~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ + +#### Update + +We now support adding three new APIs: + +- `Buffer.from(value)` - convert from any type to a buffer +- `Buffer.alloc(size)` - create a zero-filled buffer +- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size + +This solves the core problem that affected `ws` and `bittorrent-dht` which is +`Buffer(variable)` getting tricked into taking a number argument. + +This way, existing code continues working and the impact on the npm ecosystem will be +minimal. Over time, npm maintainers can migrate performance-critical code to use +`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. + + +### Conclusion + +We think there's a serious design issue with the `Buffer` API as it exists today. It +promotes insecure software by putting high-risk functionality into a convenient API +with friendly "developer ergonomics". + +This wasn't merely a theoretical exercise because we found the issue in some of the +most popular npm packages. + +Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of +`buffer`. + +```js +var Buffer = require('safe-buffer').Buffer +``` + +Eventually, we hope that node.js core can switch to this new, safer behavior. We believe +the impact on the ecosystem would be minimal since it's not a breaking change. +Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while +older, insecure packages would magically become safe from this attack vector. + + +## links + +- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) +- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) +- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) + + +## credit + +The original issues in `bittorrent-dht` +([disclosure](https://nodesecurity.io/advisories/68)) and +`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by +[Mathias Buus](https://github.com/mafintosh) and +[Feross Aboukhadijeh](http://feross.org/). + +Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues +and for his work running the [Node Security Project](https://nodesecurity.io/). + +Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and +auditing the code. + + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/index.d.ts b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/index.d.ts new file mode 100644 index 00000000000000..e9fed809a5ab51 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/index.d.ts @@ -0,0 +1,187 @@ +declare module "safe-buffer" { + export class Buffer { + length: number + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): { type: 'Buffer', data: any[] }; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + swap16(): Buffer; + swap32(): Buffer; + swap64(): Buffer; + writeUInt8(value: number, offset: number, noAssert?: boolean): number; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeInt8(value: number, offset: number, noAssert?: boolean): number; + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; + fill(value: any, offset?: number, end?: number): this; + indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; + + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ + constructor (str: string, encoding?: string); + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ + constructor (size: number); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: Uint8Array); + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}. + * + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + */ + constructor (arrayBuffer: ArrayBuffer); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: any[]); + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + constructor (buffer: Buffer); + prototype: Buffer; + /** + * Allocates a new Buffer using an {array} of octets. + * + * @param array + */ + static from(array: any[]): Buffer; + /** + * When passed a reference to the .buffer property of a TypedArray instance, + * the newly created Buffer will share the same allocated memory as the TypedArray. + * The optional {byteOffset} and {length} arguments specify a memory range + * within the {arrayBuffer} that will be shared by the Buffer. + * + * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() + * @param byteOffset + * @param length + */ + static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; + /** + * Copies the passed {buffer} data onto a new Buffer instance. + * + * @param buffer + */ + static from(buffer: Buffer): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + * + * @param str + */ + static from(str: string, encoding?: string): Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ + static isBuffer(obj: any): obj is Buffer; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + static isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ + static byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ + static concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + static compare(buf1: Buffer, buf2: Buffer): number; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @param fill if specified, buffer will be initialized by calling buf.fill(fill). + * If parameter is omitted, buffer will be filled with zeros. + * @param encoding encoding used for call to buf.fill while initalizing + */ + static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafe(size: number): Buffer; + /** + * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafeSlow(size: number): Buffer; + } +} \ No newline at end of file diff --git a/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/index.js b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/index.js new file mode 100644 index 00000000000000..054c8d30ddafb4 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/index.js @@ -0,0 +1,64 @@ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} diff --git a/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/package.json b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/package.json new file mode 100644 index 00000000000000..576c453b23322b --- /dev/null +++ b/deps/npm/node_modules/npm-registry-fetch/node_modules/safe-buffer/package.json @@ -0,0 +1,62 @@ +{ + "_from": "safe-buffer@^5.2.0", + "_id": "safe-buffer@5.2.0", + "_inBundle": false, + "_integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", + "_location": "/npm-registry-fetch/safe-buffer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "safe-buffer@^5.2.0", + "name": "safe-buffer", + "escapedName": "safe-buffer", + "rawSpec": "^5.2.0", + "saveSpec": null, + "fetchSpec": "^5.2.0" + }, + "_requiredBy": [ + "/npm-registry-fetch" + ], + "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "_shasum": "b74daec49b1148f88c64b68d49b1e815c1f2f519", + "_spec": "safe-buffer@^5.2.0", + "_where": "/Users/mperrotte/npminc/cli/node_modules/npm-registry-fetch", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Safer Node.js Buffer API", + "devDependencies": { + "standard": "*", + "tape": "^4.0.0" + }, + "homepage": "https://github.com/feross/safe-buffer", + "keywords": [ + "buffer", + "buffer allocate", + "node security", + "safe", + "safe-buffer", + "security", + "uninitialized" + ], + "license": "MIT", + "main": "index.js", + "name": "safe-buffer", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "types": "index.d.ts", + "version": "5.2.0" +} diff --git a/deps/npm/node_modules/npm-registry-fetch/package.json b/deps/npm/node_modules/npm-registry-fetch/package.json index 10671d568b5710..78e3100daa47f9 100644 --- a/deps/npm/node_modules/npm-registry-fetch/package.json +++ b/deps/npm/node_modules/npm-registry-fetch/package.json @@ -1,19 +1,19 @@ { - "_from": "npm-registry-fetch@4.0.0", - "_id": "npm-registry-fetch@4.0.0", + "_from": "npm-registry-fetch@4.0.2", + "_id": "npm-registry-fetch@4.0.2", "_inBundle": false, - "_integrity": "sha512-Jllq35Jag8dtv0M17ue74XtdQTyqKzuAYGiX9mAjOhkmNjib3bBUgK6mUY61+AHnXeSRobQkpY3/xIOS/omptw==", + "_integrity": "sha512-Z0IFtPEozNdeZRPh3aHHxdG+ZRpzcbQaJLthsm3VhNf6DScicTFRHZzK82u8RsJUsUHkX+QH/zcB/5pmd20H4A==", "_location": "/npm-registry-fetch", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "npm-registry-fetch@4.0.0", + "raw": "npm-registry-fetch@4.0.2", "name": "npm-registry-fetch", "escapedName": "npm-registry-fetch", - "rawSpec": "4.0.0", + "rawSpec": "4.0.2", "saveSpec": null, - "fetchSpec": "4.0.0" + "fetchSpec": "4.0.2" }, "_requiredBy": [ "#USER", @@ -28,10 +28,10 @@ "/npm-profile", "/pacote" ], - "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.0.tgz", - "_shasum": "5ef75845b605855c7964472542c25da172af8677", - "_spec": "npm-registry-fetch@4.0.0", - "_where": "/Users/isaacs/dev/npm/cli", + "_resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.2.tgz", + "_shasum": "2b1434f93ccbe6b6385f8e45f45db93e16921d7a", + "_spec": "npm-registry-fetch@4.0.2", + "_where": "/Users/mperrotte/npminc/cli", "author": { "name": "Kat Marchán", "email": "kzm@sykosomatic.org" @@ -54,7 +54,8 @@ "figgy-pudding": "^3.4.1", "lru-cache": "^5.1.1", "make-fetch-happen": "^5.0.0", - "npm-package-arg": "^6.1.0" + "npm-package-arg": "^6.1.0", + "safe-buffer": "^5.2.0" }, "deprecated": false, "description": "Fetch-based http client for use with npm registry APIs", @@ -98,5 +99,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "4.0.0" + "version": "4.0.2" } diff --git a/deps/npm/node_modules/tar/lib/write-entry.js b/deps/npm/node_modules/tar/lib/write-entry.js index 63f749488c55fd..0c019006f3b670 100644 --- a/deps/npm/node_modules/tar/lib/write-entry.js +++ b/deps/npm/node_modules/tar/lib/write-entry.js @@ -231,7 +231,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass { er.path = this.absolute er.syscall = 'read' er.code = 'EOF' - this[CLOSE](fd) + this[CLOSE](fd, _ => _) return this.emit('error', er) } @@ -240,7 +240,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass { er.path = this.absolute er.syscall = 'read' er.code = 'EOF' - this[CLOSE](fd) + this[CLOSE](fd, _ => _) return this.emit('error', er) } diff --git a/deps/npm/node_modules/tar/node_modules/minipass/index.js b/deps/npm/node_modules/tar/node_modules/minipass/index.js index cab9009f2befb6..c072352d448a97 100644 --- a/deps/npm/node_modules/tar/node_modules/minipass/index.js +++ b/deps/npm/node_modules/tar/node_modules/minipass/index.js @@ -43,6 +43,14 @@ const isEndish = ev => ev === 'finish' || ev === 'prefinish' +const isArrayBuffer = b => b instanceof ArrayBuffer || + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0 + +const isArrayBufferView = b => !B.isBuffer(b) && ArrayBuffer.isView(b) + module.exports = class Minipass extends EE { constructor (options) { super() @@ -114,8 +122,19 @@ module.exports = class Minipass extends EE { if (!encoding) encoding = 'utf8' - if (typeof chunk !== 'string' && !B.isBuffer(chunk) && !this[OBJECTMODE]) - this.objectMode = true + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything else switches us into object mode + if (!this[OBJECTMODE] && !B.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) + chunk = B.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) + else if (isArrayBuffer(chunk)) + chunk = B.from(chunk) + else if (typeof chunk !== 'string') + // use the setter so we throw if we have encoding set + this.objectMode = true + } // this ensures at this point that the chunk is a buffer or string // don't buffer it up or send it to the decoder diff --git a/deps/npm/node_modules/tar/node_modules/minipass/package.json b/deps/npm/node_modules/tar/node_modules/minipass/package.json index 5c782f120d18f8..aeb390253c4ee1 100644 --- a/deps/npm/node_modules/tar/node_modules/minipass/package.json +++ b/deps/npm/node_modules/tar/node_modules/minipass/package.json @@ -1,8 +1,8 @@ { "_from": "minipass@^2.8.6", - "_id": "minipass@2.8.6", + "_id": "minipass@2.9.0", "_inBundle": false, - "_integrity": "sha512-lFG7d6g3+/UaFDCOtqPiKAC9zngWWsQZl1g5q6gaONqrjq61SX2xFqXMleQiFVyDpYwa018E9hmlAFY22PCb+A==", + "_integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", "_location": "/tar/minipass", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/tar" ], - "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.8.6.tgz", - "_shasum": "620d889ace26356391d010ecb9458749df9b6db5", + "_resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "_shasum": "e713762e7d3e32fed803115cf93e04bca9fcc9a6", "_spec": "minipass@^2.8.6", "_where": "/Users/mperrotte/npminc/cli/node_modules/tar", "author": { @@ -39,7 +39,7 @@ "description": "minimal implementation of a PassThrough stream", "devDependencies": { "end-of-stream": "^1.4.0", - "tap": "^14.6.4", + "tap": "^14.6.5", "through2": "^2.0.3" }, "files": [ @@ -66,5 +66,5 @@ "tap": { "check-coverage": true }, - "version": "2.8.6" + "version": "2.9.0" } diff --git a/deps/npm/node_modules/tar/package.json b/deps/npm/node_modules/tar/package.json index 9a4a511239899d..b12db0f3ef5eca 100644 --- a/deps/npm/node_modules/tar/package.json +++ b/deps/npm/node_modules/tar/package.json @@ -1,8 +1,8 @@ { - "_from": "tar@4.4.12", - "_id": "tar@4.4.12", + "_from": "tar@4.4.13", + "_id": "tar@4.4.13", "_inBundle": false, - "_integrity": "sha512-4GwpJwdSjIHlUrWd/1yJrl63UqcqjJyVglgIwn4gcG+Lrp9TXpZ1ZRrGLIRBNqLTUvz6yoPJrX4B/MISxY/Ukg==", + "_integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", "_location": "/tar", "_phantomChildren": { "safe-buffer": "5.1.2", @@ -11,12 +11,12 @@ "_requested": { "type": "version", "registry": true, - "raw": "tar@4.4.12", + "raw": "tar@4.4.13", "name": "tar", "escapedName": "tar", - "rawSpec": "4.4.12", + "rawSpec": "4.4.13", "saveSpec": null, - "fetchSpec": "4.4.12" + "fetchSpec": "4.4.13" }, "_requiredBy": [ "#USER", @@ -24,9 +24,9 @@ "/node-gyp", "/pacote" ], - "_resolved": "https://registry.npmjs.org/tar/-/tar-4.4.12.tgz", - "_shasum": "6a1275a870a782f92828e24d28fa6aa253193af7", - "_spec": "tar@4.4.12", + "_resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", + "_shasum": "43b364bc52888d555298637b10d60790254ab525", + "_spec": "tar@4.4.13", "_where": "/Users/mperrotte/npminc/cli", "author": { "name": "Isaac Z. Schlueter", @@ -84,5 +84,5 @@ "coverage-map": "map.js", "check-coverage": true }, - "version": "4.4.12" + "version": "4.4.13" } diff --git a/deps/npm/node_modules/uuid/.eslintrc.json b/deps/npm/node_modules/uuid/.eslintrc.json deleted file mode 100644 index 734a8e14c7ac12..00000000000000 --- a/deps/npm/node_modules/uuid/.eslintrc.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "root": true, - "env": { - "browser": true, - "commonjs": true, - "node": true, - "mocha": true - }, - "extends": ["eslint:recommended"], - "rules": { - "array-bracket-spacing": ["warn", "never"], - "arrow-body-style": ["warn", "as-needed"], - "arrow-parens": ["warn", "as-needed"], - "arrow-spacing": "warn", - "brace-style": ["warn", "1tbs"], - "camelcase": "warn", - "comma-spacing": ["warn", {"after": true}], - "dot-notation": "warn", - "eqeqeq": ["warn", "smart"], - "indent": ["warn", 2, { - "SwitchCase": 1, - "FunctionDeclaration": {"parameters": 1}, - "MemberExpression": 1, - "CallExpression": {"arguments": 1} - }], - "key-spacing": ["warn", {"beforeColon": false, "afterColon": true, "mode": "minimum"}], - "keyword-spacing": "warn", - "no-console": "off", - "no-empty": "off", - "no-multi-spaces": "warn", - "no-redeclare": "off", - "no-restricted-globals": ["warn", "Promise"], - "no-trailing-spaces": "warn", - "no-undef": "error", - "no-unused-vars": ["warn", {"args": "none"}], - "one-var": ["warn", "never"], - "padded-blocks": ["warn", "never"], - "object-curly-spacing": ["warn", "never"], - "quotes": ["warn", "single"], - "react/prop-types": "off", - "react/jsx-no-bind": "off", - "semi": ["warn", "always"], - "space-before-blocks": ["warn", "always"], - "space-before-function-paren": ["warn", "never"], - "space-in-parens": ["warn", "never"] - } -} diff --git a/deps/npm/node_modules/uuid/CHANGELOG.md b/deps/npm/node_modules/uuid/CHANGELOG.md index f29d3991e0f6c1..1ff6978076ec86 100644 --- a/deps/npm/node_modules/uuid/CHANGELOG.md +++ b/deps/npm/node_modules/uuid/CHANGELOG.md @@ -1,7 +1,9 @@ -# Change Log +# Changelog All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [3.3.3](https://github.com/kelektiv/node-uuid/compare/v3.3.2...v3.3.3) (2019-08-19) + ## [3.3.2](https://github.com/kelektiv/node-uuid/compare/v3.3.1...v3.3.2) (2018-06-28) diff --git a/deps/npm/node_modules/uuid/README.md b/deps/npm/node_modules/uuid/README.md index 9cbe1ac1848eb1..6fc3708b4b5303 100644 --- a/deps/npm/node_modules/uuid/README.md +++ b/deps/npm/node_modules/uuid/README.md @@ -28,7 +28,7 @@ Version 1 (timestamp): ```javascript const uuidv1 = require('uuid/v1'); -uuidv1(); // ⇨ '45745c60-7b1a-11e8-9c9c-2d42b21b1a3e' +uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d' ``` @@ -56,7 +56,7 @@ Version 4 (random): ```javascript const uuidv4 = require('uuid/v4'); -uuidv4(); // ⇨ '10ba038e-48da-487b-96e8-8d3b99b6d18a' +uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed' ``` @@ -147,7 +147,7 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID. Returns `buffer`, if specified, otherwise the string form of the UUID -Note: The id is generated guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) +Note: The default [node id](https://tools.ietf.org/html/rfc4122#section-4.1.6) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process. Example: Generate string UUID with fully-specified options @@ -167,8 +167,8 @@ Example: In-place generation of two binary IDs ```javascript // Generate two ids in an array const arr = new Array(); -uuidv1(null, arr, 0); // ⇨ [ 69, 117, 109, 208, 123, 26, 17, 232, 146, 52, 45, 66, 178, 27, 26, 62 ] -uuidv1(null, arr, 16); // ⇨ [ 69, 117, 109, 208, 123, 26, 17, 232, 146, 52, 45, 66, 178, 27, 26, 62, 69, 117, 109, 209, 123, 26, 17, 232, 146, 52, 45, 66, 178, 27, 26, 62 ] +uuidv1(null, arr, 0); // ⇨ [ 44, 94, 164, 192, 64, 103, 17, 233, 146, 52, 155, 29, 235, 77, 59, 125 ] +uuidv1(null, arr, 16); // ⇨ [ 44, 94, 164, 192, 64, 103, 17, 233, 146, 52, 155, 29, 235, 77, 59, 125, 44, 94, 164, 193, 64, 103, 17, 233, 146, 52, 155, 29, 235, 77, 59, 125 ] ``` @@ -237,8 +237,8 @@ Example: Generate two IDs in a single buffer ```javascript const buffer = new Array(); -uuidv4(null, buffer, 0); // ⇨ [ 54, 122, 218, 70, 45, 70, 65, 24, 171, 53, 95, 130, 83, 195, 242, 45 ] -uuidv4(null, buffer, 16); // ⇨ [ 54, 122, 218, 70, 45, 70, 65, 24, 171, 53, 95, 130, 83, 195, 242, 45, 108, 204, 255, 103, 171, 86, 76, 94, 178, 225, 188, 236, 150, 20, 151, 87 ] +uuidv4(null, buffer, 0); // ⇨ [ 155, 29, 235, 77, 59, 125, 75, 173, 155, 221, 43, 13, 123, 61, 203, 109 ] +uuidv4(null, buffer, 16); // ⇨ [ 155, 29, 235, 77, 59, 125, 75, 173, 155, 221, 43, 13, 123, 61, 203, 109, 27, 157, 107, 205, 187, 253, 75, 45, 155, 93, 171, 141, 251, 189, 75, 237 ] ``` diff --git a/deps/npm/node_modules/uuid/README_js.md b/deps/npm/node_modules/uuid/README_js.md deleted file mode 100644 index f34453be407b77..00000000000000 --- a/deps/npm/node_modules/uuid/README_js.md +++ /dev/null @@ -1,280 +0,0 @@ -```javascript --hide -runmd.onRequire = path => path.replace(/^uuid/, './'); -``` - -# uuid [![Build Status](https://secure.travis-ci.org/kelektiv/node-uuid.svg?branch=master)](http://travis-ci.org/kelektiv/node-uuid) # - -Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. - -Features: - -* Support for version 1, 3, 4 and 5 UUIDs -* Cross-platform -* Uses cryptographically-strong random number APIs (when available) -* Zero-dependency, small footprint (... but not [this small](https://gist.github.com/982883)) - -[**Deprecation warning**: The use of `require('uuid')` is deprecated and will not be -supported after version 3.x of this module. Instead, use `require('uuid/[v1|v3|v4|v5]')` as shown in the examples below.] - -## Quickstart - CommonJS (Recommended) - -```shell -npm install uuid -``` - -Then generate your uuid version of choice ... - -Version 1 (timestamp): - -```javascript --run v1 -const uuidv1 = require('uuid/v1'); -uuidv1(); // RESULT -``` - -Version 3 (namespace): - -```javascript --run v3 -const uuidv3 = require('uuid/v3'); - -// ... using predefined DNS namespace (for domain names) -uuidv3('hello.example.com', uuidv3.DNS); // RESULT - -// ... using predefined URL namespace (for, well, URLs) -uuidv3('http://example.com/hello', uuidv3.URL); // RESULT - -// ... using a custom namespace -// -// Note: Custom namespaces should be a UUID string specific to your application! -// E.g. the one here was generated using this modules `uuid` CLI. -const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341'; -uuidv3('Hello, World!', MY_NAMESPACE); // RESULT -``` - -Version 4 (random): - -```javascript --run v4 -const uuidv4 = require('uuid/v4'); -uuidv4(); // RESULT -``` - -Version 5 (namespace): - -```javascript --run v5 -const uuidv5 = require('uuid/v5'); - -// ... using predefined DNS namespace (for domain names) -uuidv5('hello.example.com', uuidv5.DNS); // RESULT - -// ... using predefined URL namespace (for, well, URLs) -uuidv5('http://example.com/hello', uuidv5.URL); // RESULT - -// ... using a custom namespace -// -// Note: Custom namespaces should be a UUID string specific to your application! -// E.g. the one here was generated using this modules `uuid` CLI. -const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341'; -uuidv5('Hello, World!', MY_NAMESPACE); // RESULT -``` - -## Quickstart - Browser-ready Versions - -Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in). - -For version 1 uuids: - -```html - - -``` - -For version 3 uuids: - -```html - - -``` - -For version 4 uuids: - -```html - - -``` - -For version 5 uuids: - -```html - - -``` - -## API - -### Version 1 - -```javascript -const uuidv1 = require('uuid/v1'); - -// Incantations -uuidv1(); -uuidv1(options); -uuidv1(options, buffer, offset); -``` - -Generate and return a RFC4122 v1 (timestamp-based) UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - - * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1. - * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used. - * `msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used. - * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2. - -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Note: The id is generated guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) - -Example: Generate string UUID with fully-specified options - -```javascript --run v1 -const v1options = { - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date('2011-11-01').getTime(), - nsecs: 5678 -}; -uuidv1(v1options); // RESULT -``` - -Example: In-place generation of two binary IDs - -```javascript --run v1 -// Generate two ids in an array -const arr = new Array(); -uuidv1(null, arr, 0); // RESULT -uuidv1(null, arr, 16); // RESULT -``` - -### Version 3 - -```javascript -const uuidv3 = require('uuid/v3'); - -// Incantations -uuidv3(name, namespace); -uuidv3(name, namespace, buffer); -uuidv3(name, namespace, buffer, offset); -``` - -Generate and return a RFC4122 v3 UUID. - -* `name` - (String | Array[]) "name" to create UUID with -* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0 - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Example: - -```javascript --run v3 -uuidv3('hello world', MY_NAMESPACE); // RESULT -``` - -### Version 4 - -```javascript -const uuidv4 = require('uuid/v4') - -// Incantations -uuidv4(); -uuidv4(options); -uuidv4(options, buffer, offset); -``` - -Generate and return a RFC4122 v4 UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values - * `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255) -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Example: Generate string UUID with predefined `random` values - -```javascript --run v4 -const v4options = { - random: [ - 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, - 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 - ] -}; -uuidv4(v4options); // RESULT -``` - -Example: Generate two IDs in a single buffer - -```javascript --run v4 -const buffer = new Array(); -uuidv4(null, buffer, 0); // RESULT -uuidv4(null, buffer, 16); // RESULT -``` - -### Version 5 - -```javascript -const uuidv5 = require('uuid/v5'); - -// Incantations -uuidv5(name, namespace); -uuidv5(name, namespace, buffer); -uuidv5(name, namespace, buffer, offset); -``` - -Generate and return a RFC4122 v5 UUID. - -* `name` - (String | Array[]) "name" to create UUID with -* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0 - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Example: - -```javascript --run v5 -uuidv5('hello world', MY_NAMESPACE); // RESULT -``` - -## Command Line - -UUIDs can be generated from the command line with the `uuid` command. - -```shell -$ uuid -ddeb27fb-d9a0-4624-be4d-4615062daed4 - -$ uuid v1 -02d37060-d446-11e7-a9fa-7bdae751ebe1 -``` - -Type `uuid --help` for usage details - -## Testing - -```shell -npm test -``` diff --git a/deps/npm/node_modules/uuid/package.json b/deps/npm/node_modules/uuid/package.json index 81ea5a2682f685..2ffe04e3d7ea5e 100644 --- a/deps/npm/node_modules/uuid/package.json +++ b/deps/npm/node_modules/uuid/package.json @@ -1,29 +1,30 @@ { - "_from": "uuid@3.3.2", - "_id": "uuid@3.3.2", + "_from": "uuid@3.3.3", + "_id": "uuid@3.3.3", "_inBundle": false, - "_integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "_integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==", "_location": "/uuid", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "uuid@3.3.2", + "raw": "uuid@3.3.3", "name": "uuid", "escapedName": "uuid", - "rawSpec": "3.3.2", + "rawSpec": "3.3.3", "saveSpec": null, - "fetchSpec": "3.3.2" + "fetchSpec": "3.3.3" }, "_requiredBy": [ "#USER", "/", + "/nyc", "/request" ], - "_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "_shasum": "1b4af4955eb3077c501c23872fc6513811587131", - "_spec": "uuid@3.3.2", - "_where": "/Users/zkat/Documents/code/work/npm", + "_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "_shasum": "4568f0216e78760ee1dbf3a4d2cf53e224112866", + "_spec": "uuid@3.3.3", + "_where": "/Users/mperrotte/npminc/cli", "bin": { "uuid": "./bin/uuid" }, @@ -66,13 +67,13 @@ "deprecated": false, "description": "RFC4122 (v1, v4, and v5) UUIDs", "devDependencies": { - "@commitlint/cli": "7.0.0", - "@commitlint/config-conventional": "7.0.1", - "eslint": "4.19.1", - "husky": "0.14.3", - "mocha": "5.2.0", - "runmd": "1.0.1", - "standard-version": "4.4.0" + "@commitlint/cli": "8.1.0", + "@commitlint/config-conventional": "8.1.0", + "eslint": "6.2.0", + "husky": "3.0.4", + "mocha": "6.2.0", + "runmd": "1.2.1", + "standard-version": "7.0.0" }, "homepage": "https://github.com/kelektiv/node-uuid#readme", "keywords": [ @@ -87,11 +88,11 @@ "url": "git+https://github.com/kelektiv/node-uuid.git" }, "scripts": { - "commitmsg": "commitlint -E GIT_PARAMS", + "commitmsg": "commitlint -E HUSKY_GIT_PARAMS", "md": "runmd --watch --output=README.md README_js.md", "prepare": "runmd --output=README.md README_js.md", "release": "standard-version", "test": "mocha test/test.js" }, - "version": "3.3.2" + "version": "3.3.3" } diff --git a/deps/npm/package.json b/deps/npm/package.json index 9e24f77f4b3c5b..d051bfca9ba65b 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "6.12.0", + "version": "6.12.1", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -44,7 +44,7 @@ "byte-size": "^5.0.1", "cacache": "^12.0.3", "call-limit": "^1.1.1", - "chownr": "^1.1.2", + "chownr": "^1.1.3", "ci-info": "^2.0.0", "cli-columns": "^3.1.2", "cli-table3": "^0.5.1", @@ -61,7 +61,7 @@ "fs-write-stream-atomic": "~1.0.10", "gentle-fs": "^2.2.1", "glob": "^7.1.4", - "graceful-fs": "^4.2.2", + "graceful-fs": "^4.2.3", "has-unicode": "~2.0.1", "hosted-git-info": "^2.8.5", "iferr": "^1.0.2", @@ -73,7 +73,7 @@ "is-cidr": "^3.0.0", "json-parse-better-errors": "^1.0.2", "lazy-property": "~1.0.0", - "libcipm": "^4.0.4", + "libcipm": "^4.0.7", "libnpm": "^3.0.1", "libnpmaccess": "^3.0.2", "libnpmhook": "^5.0.3", @@ -101,10 +101,10 @@ "npm-install-checks": "^3.0.2", "npm-lifecycle": "^3.1.4", "npm-package-arg": "^6.1.1", - "npm-packlist": "^1.4.4", + "npm-packlist": "^1.4.6", "npm-pick-manifest": "^3.0.2", "npm-profile": "^4.0.2", - "npm-registry-fetch": "^4.0.0", + "npm-registry-fetch": "^4.0.2", "npm-user-validate": "~1.0.0", "npmlog": "~4.1.2", "once": "~1.4.0", @@ -134,7 +134,7 @@ "sorted-union-stream": "~2.1.3", "ssri": "^6.0.1", "stringify-package": "^1.0.1", - "tar": "^4.4.12", + "tar": "^4.4.13", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "uid-number": "0.0.6", @@ -142,7 +142,7 @@ "unique-filename": "^1.1.1", "unpipe": "~1.0.0", "update-notifier": "^2.5.0", - "uuid": "^3.3.2", + "uuid": "^3.3.3", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "~3.0.0", "which": "^1.3.1", diff --git a/deps/npm/test/fixtures/config/userconfig-with-gc b/deps/npm/test/fixtures/config/userconfig-with-gc index cf774bb883d966..a3a837eb78dd47 100644 --- a/deps/npm/test/fixtures/config/userconfig-with-gc +++ b/deps/npm/test/fixtures/config/userconfig-with-gc @@ -1,4 +1,4 @@ -globalconfig = /Users/isaacs/dev/npm/cli/test/fixtures/config/globalconfig +globalconfig = /Users/mperrotte/npminc/cli/test/fixtures/config/globalconfig email = i@izs.me env-thing = ${random_env_var} init.author.name = Isaac Z. Schlueter diff --git a/deps/npm/test/tap/install-test-cli-with-broken-package-lock.js b/deps/npm/test/tap/install-test-cli-with-broken-package-lock.js new file mode 100644 index 00000000000000..3c1a56131bad46 --- /dev/null +++ b/deps/npm/test/tap/install-test-cli-with-broken-package-lock.js @@ -0,0 +1,118 @@ +var fs = require('graceful-fs') +var path = require('path') + +var mkdirp = require('mkdirp') +var osenv = require('osenv') +var rimraf = require('rimraf') +var test = require('tap').test + +var common = require('../common-tap.js') + +var pkg = common.pkg + +var EXEC_OPTS = { cwd: pkg } + +var json = { + name: 'install-test-cli-with-broken-package-lock', + description: 'fixture', + version: '0.0.0', + dependencies: { + optimist: '0.6.0' + } +} + +var brokenLockfile = { + name: 'install-test-cli-with-broken-package-lock', + version: '0.0.0', + lockfileVersion: 1, + requires: true, + dependencies: { + optimist: { + version: '0.6.0', + resolved: 'https://registry.npmjs.org/optimist/-/optimist-0.6.0.tgz', + integrity: 'sha1-aUJIJvNAX3nxQub8PZrljU27kgA=', + requires: { + minimist: '~0.0.1', + wordwrap: '~0.0.2' + } + }, + wordwrap: { + version: '0.0.3', + resolved: 'https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz', + integrity: 'sha1-o9XabNXAvAAI03I0u68b7WMFkQc=' + } + } +} + +var expected = { + name: 'install-test-cli-with-broken-package-lock', + version: '0.0.0', + lockfileVersion: 1, + requires: true, + dependencies: { + minimist: { + version: '0.0.10', + resolved: 'https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz', + integrity: 'sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=' + }, + optimist: { + version: '0.6.0', + resolved: 'https://registry.npmjs.org/optimist/-/optimist-0.6.0.tgz', + integrity: 'sha1-aUJIJvNAX3nxQub8PZrljU27kgA=', + requires: { + minimist: '~0.0.1', + wordwrap: '~0.0.2' + } + }, + wordwrap: { + version: '0.0.3', + resolved: 'https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz', + integrity: 'sha1-o9XabNXAvAAI03I0u68b7WMFkQc=' + } + } +} + +test('setup', function (t) { + setup() + t.end() +}) + +test('\'npm install-test\' should repair package-lock.json', function (t) { + common.npm(['install-test'], EXEC_OPTS, function (err, code, stderr, stdout) { + if (err) throw err + t.comment(stdout.trim()) + t.comment(stderr.trim()) + t.is(code, 0, 'npm install did not raise error code') + var lockfile = JSON.parse(fs.readFileSync(path.join(pkg, 'package-lock.json'))) + t.same( + lockfile, + expected, + 'package-lock.json should be repaired' + ) + t.end() + }) +}) + +test('cleanup', function (t) { + cleanup() + t.end() +}) + +function setup () { + cleanup() + mkdirp.sync(pkg) + fs.writeFileSync( + path.join(pkg, 'package.json'), + JSON.stringify(json, null, 2) + ) + fs.writeFileSync( + path.join(pkg, 'package-lock.json'), + JSON.stringify(brokenLockfile, null, 2) + ) + process.chdir(pkg) +} + +function cleanup () { + process.chdir(osenv.tmpdir()) + rimraf.sync(pkg) +} diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp index 60f6ee03a7a9e4..4609d83baabac1 100644 --- a/deps/openssl/openssl.gyp +++ b/deps/openssl/openssl.gyp @@ -1,8 +1,8 @@ { 'variables': { - 'gas_version%': 0, - 'llvm_version%': 0, - 'nasm_version%': 0, + 'gas_version%': '0.0', + 'llvm_version%': '0.0', + 'nasm_version%': '0.0', }, 'targets': [ { @@ -21,7 +21,8 @@ }, 'target_arch=="arm64" and OS=="win"', { # VC-WIN64-ARM inherits from VC-noCE-common that has no asms. 'includes': ['./openssl_no_asm.gypi'], - }, 'gas_version >= "2.26" or nasm_version >= "2.11.8"', { + }, 'gas_version and v(gas_version) >= v("2.26") or ' + 'nasm_version and v(nasm_version) >= v("2.11.8")', { # Require AVX512IFMA supported. See # https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html # Currently crypto/poly1305/asm/poly1305-x86_64.pl requires AVX512IFMA. diff --git a/deps/openssl/openssl.gypi b/deps/openssl/openssl.gypi index d6d2589083bbce..af08a33c9c445b 100644 --- a/deps/openssl/openssl.gypi +++ b/deps/openssl/openssl.gypi @@ -1036,7 +1036,9 @@ # 'conditions': [ ['(OS=="win" and MSVS_VERSION>="2012") or ' - 'llvm_version>="3.3" or xcode_version>="5.0" or gas_version>="2.23"', { + 'llvm_version and v(llvm_version) >= v("3.3") or ' + 'gas_version and v(gas_version) >= v("2.23") or ' + 'xcode_version and v(xcode_version) >= v("5.0")', { 'openssl_sources_x64_win_masm': [ '<@(openssl_sources_asm_latest_x64_win_masm)', '<@(openssl_sources_common_x64_win_masm)', diff --git a/deps/openssl/openssl_common.gypi b/deps/openssl/openssl_common.gypi index c4b95c20aea5d4..67640a6325eb52 100644 --- a/deps/openssl/openssl_common.gypi +++ b/deps/openssl/openssl_common.gypi @@ -64,7 +64,7 @@ 'TERMIOS', ], 'conditions': [ - [ 'llvm_version==0', { + [ 'llvm_version=="0.0"', { 'cflags': ['-Wno-old-style-declaration',], }], ], diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 8c3d342d33e6f8..408cfd6541a339 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -403,3 +403,11 @@ Vladimir Karnushin MaYuming Eneas U de Queiroz Daniel Hahler +Yang Yu +David Carlier +Calvin Hill +Isabella Muerte <63051+slurps-mad-rips@users.noreply.github.com> +Ouyang Yadong +ZYSzys +Carl Lei +Stefan Bender diff --git a/deps/uv/CMakeLists.txt b/deps/uv/CMakeLists.txt index 6f18f3397d0129..7da5e688166c04 100644 --- a/deps/uv/CMakeLists.txt +++ b/deps/uv/CMakeLists.txt @@ -1,6 +1,15 @@ # TODO: determine CMAKE_SYSTEM_NAME on OS/390. Currently assumes "OS/390". -cmake_minimum_required(VERSION 2.8.12) -project(libuv) +cmake_minimum_required(VERSION 3.4) +project(libuv LANGUAGES C) + +include(CMakePackageConfigHelpers) +include(CMakeDependentOption) +include(GNUInstallDirs) +include(CTest) + +cmake_dependent_option(LIBUV_BUILD_TESTS + "Build the unit tests when BUILD_TESTING is enabled and we are the root project" ON + "BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF) if(MSVC) list(APPEND uv_cflags /W4) @@ -14,6 +23,7 @@ set(uv_sources src/fs-poll.c src/idna.c src/inet.c + src/random.c src/strscpy.c src/threadpool.c src/timer.c @@ -72,7 +82,6 @@ set(uv_test_sources test/test-idna.c test/test-ip4-addr.c test/test-ip6-addr.c - test/test-ip6-addr.c test/test-ipc-heavy-traffic-deadlock-bug.c test/test-ipc-send-recv.c test/test-ipc.c @@ -108,6 +117,7 @@ set(uv_test_sources test/test-process-title-threadsafe.c test/test-process-title.c test/test-queue-foreach-delete.c + test/test-random.c test/test-ref.c test/test-run-nowait.c test/test-run-once.c @@ -236,6 +246,7 @@ else() src/unix/pipe.c src/unix/poll.c src/unix/process.c + src/unix/random-devurandom.c src/unix/signal.c src/unix/stream.c src/unix/tcp.c @@ -284,6 +295,14 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD") list(APPEND uv_sources src/unix/bsd-ifaddrs.c src/unix/kqueue.c) endif() +if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + list(APPEND uv_sources src/unix/random-getrandom.c) +endif() + +if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + list(APPEND uv_sources src/unix/random-getentropy.c) +endif() + if(APPLE) list(APPEND uv_defines _DARWIN_UNLIMITED_SELECT=1 _DARWIN_USE_64_BIT_INODE=1) list(APPEND uv_sources @@ -300,6 +319,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") src/unix/linux-inotify.c src/unix/linux-syscalls.c src/unix/procfs-exepath.c + src/unix/random-getrandom.c + src/unix/random-sysctl.c src/unix/sysinfo-loadavg.c) endif() @@ -356,11 +377,7 @@ target_compile_options(uv_a PRIVATE ${uv_cflags}) target_include_directories(uv_a PUBLIC include PRIVATE src) target_link_libraries(uv_a ${uv_libraries}) -option(libuv_buildtests "Build the unit tests when BUILD_TESTING is enabled." ON) - -include(CTest) -if(BUILD_TESTING AND libuv_buildtests) - enable_testing() +if(LIBUV_BUILD_TESTS) add_executable(uv_run_tests ${uv_test_sources}) target_compile_definitions(uv_run_tests PRIVATE ${uv_defines} USING_UV_SHARED=1) @@ -380,7 +397,6 @@ endif() if(UNIX) # Now for some gibbering horrors from beyond the stars... - include(GNUInstallDirs) foreach(x ${uv_libraries}) set(LIBS "${LIBS} -l${x}") endforeach(x) @@ -402,3 +418,11 @@ if(UNIX) install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() + +if(WIN32) + install(DIRECTORY include/ DESTINATION include) + install(FILES LICENSE DESTINATION .) + install(TARGETS uv uv_a + RUNTIME DESTINATION lib/$ + ARCHIVE DESTINATION lib/$) +endif() diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 093579de8e4985..cd4451ae69c0c1 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,83 @@ +2019.10.20, Version 1.33.1 (Stable), 07ad32138f4d2285ba2226b5e20462b27b091a59 + +Changes since version 1.33.0: + +* linux: fix arm64 SYS__sysctl build breakage (Ben Noordhuis) + + +2019.10.17, Version 1.33.0 (Stable), e56e42e9310e4437e1886dbd6771792c14c0a5f3 + +Changes since version 1.32.0: + +* Revert "linux: drop code path for epoll_pwait-less kernels" (Yang Yu) + +* build: fix build error with __ANDROID_API__ < 21 (Yang Yu) + +* win: fix reading hidden env vars (Anna Henningsen) + +* unix,win: add uv_random() (Ben Noordhuis) + +* win: simplify mkdtemp (Saúl Ibarra Corretgé) + +* docs: fix literal-includes in User Guide (Nhan Khong) + +* win, tty: fix problem of receiving unexpected SIGWINCH (erw7) + +* unix: fix {Net,Open}BSD build (David Carlier) + +* win,mingw: Fix undefined MCAST_* constants (Crunkle) + +* build: Add link for test/fixtures/lorem_ipsum.txt (Andrew Paprocki) + +* fs: use statvfs in uv__fs_statfs() for Haiku (Calvin Hill) + +* fsevents: stop using fsevents to watch files (Jameson Nash) + +* fsevents: regression in watching / (Jameson Nash) + +* build,cmake: don't try to detect a C++ compiler (Isabella Muerte) + +* build: fix build warning on cygwin (MaYuming) + +* unix: set sin_len and sin6_len (Ouyang Yadong) + +* test: fix order of operations in test (cjihrig) + +* doc: improve uv_fs_readdir() cleanup docs (cjihrig) + +* build: remove duplicated test in build files (ZYSzys) + +* android: enable getentropy on Android >= 28 (David Carlier) + +* android: fix build (David Carlier) + +* darwin: speed up uv_set_process_title() (Ben Noordhuis) + +* darwin: assume pthread_setname_np() is available (Ben Noordhuis) + +* unix,udp: ensure addr is non-null (Jameson Nash) + +* win,tty: add uv_tty_{get,set}_vterm_state (erw7) + +* win: fix uv_statfs_t leak in uv_fs_statfs() (Ryan Liptak) + +* build: install files on windows via cmake (Carl Lei) + +* darwin,test: include AvailabilityMacros.h (Saúl Ibarra Corretgé) + +* darwin,test: update loop time after sleeping (Saúl Ibarra Corretgé) + +* doc: remove old FreeBSD 9 related note (Saúl Ibarra Corretgé) + +* doc: improve uv_{send,recv}_buffer_size() docs (Ryan Liptak) + +* build: move -Wno-long-long check to configure time (Ben Noordhuis) + +* unix: update uv_fs_copyfile() fallback logic (Stefan Bender) + +* win: cast setsockopt struct to const char* (Shelley Vohr) + + 2019.09.10, Version 1.32.0 (Stable), 697bea87b3a0b0e9b4e5ff86b39d1dedb70ee46d Changes since version 1.31.0: diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index 099b0efb084343..ce4ca274b217ee 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -35,6 +35,7 @@ libuv_la_SOURCES = src/fs-poll.c \ src/idna.h \ src/inet.c \ src/queue.h \ + src/random.c \ src/strscpy.c \ src/strscpy.h \ src/threadpool.c \ @@ -105,6 +106,7 @@ libuv_la_SOURCES += src/unix/async.c \ src/unix/pipe.c \ src/unix/poll.c \ src/unix/process.c \ + src/unix/random-devurandom.c \ src/unix/signal.c \ src/unix/spinlock.h \ src/unix/stream.c \ @@ -138,11 +140,7 @@ EXTRA_DIST = test/fixtures/empty_file \ TESTS = test/run-tests check_PROGRAMS = test/run-tests -if OS390 test_run_tests_CFLAGS = -else -test_run_tests_CFLAGS = -Wno-long-long -endif if SUNOS # Can't be turned into a CC_CHECK_CFLAGS in configure.ac, it makes compilers @@ -240,6 +238,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \ test/test-process-title.c \ test/test-process-title-threadsafe.c \ test/test-queue-foreach-delete.c \ + test/test-random.c \ test/test-ref.c \ test/test-run-nowait.c \ test/test-run-once.c \ @@ -414,7 +413,8 @@ libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ src/unix/darwin-proctitle.c \ src/unix/fsevents.c \ src/unix/kqueue.c \ - src/unix/proctitle.c + src/unix/proctitle.c \ + src/unix/random-getentropy.c test_run_tests_LDFLAGS += -lutil endif @@ -434,7 +434,8 @@ libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ src/unix/bsd-proctitle.c \ src/unix/freebsd.c \ src/unix/kqueue.c \ - src/unix/posix-hrtime.c + src/unix/posix-hrtime.c \ + src/unix/random-getrandom.c test_run_tests_LDFLAGS += -lutil endif @@ -465,6 +466,8 @@ libuv_la_SOURCES += src/unix/linux-core.c \ src/unix/linux-syscalls.h \ src/unix/procfs-exepath.c \ src/unix/proctitle.c \ + src/unix/random-getrandom.c \ + src/unix/random-sysctl.c \ src/unix/sysinfo-loadavg.c test_run_tests_LDFLAGS += -lutil endif @@ -498,7 +501,8 @@ libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ src/unix/bsd-proctitle.c \ src/unix/kqueue.c \ src/unix/openbsd.c \ - src/unix/posix-hrtime.c + src/unix/posix-hrtime.c \ + src/unix/random-getentropy.c test_run_tests_LDFLAGS += -lutil endif diff --git a/deps/uv/SUPPORTED_PLATFORMS.md b/deps/uv/SUPPORTED_PLATFORMS.md index 077191086ce524..29e4844ff323d3 100644 --- a/deps/uv/SUPPORTED_PLATFORMS.md +++ b/deps/uv/SUPPORTED_PLATFORMS.md @@ -5,7 +5,7 @@ | GNU/Linux | Tier 1 | Linux >= 2.6.32 with glibc >= 2.12 | | | macOS | Tier 1 | macOS >= 10.7 | | | Windows | Tier 1 | >= Windows 7 | MSVC 2008 and later are supported | -| FreeBSD | Tier 1 | >= 9 (see note) | | +| FreeBSD | Tier 1 | >= 10 | | | AIX | Tier 2 | >= 6 | Maintainers: @libuv/aix | | z/OS | Tier 2 | >= V2R2 | Maintainers: @libuv/zos | | Linux with musl | Tier 2 | musl >= 1.0 | | @@ -16,11 +16,6 @@ | SunOS | Tier 3 | Solaris 121 and later | | | Other | Tier 3 | N/A | | -#### Note on FreeBSD 9 - -While FreeBSD is supported as Tier 1, FreeBSD 9 will get Tier 2 support until -it reaches end of life, in December 2016. - ## Support types * **Tier 1**: Officially supported and tested with CI. Any contributed patch diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index b503e538298dd9..07ad0cde81a656 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.32.0], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.33.1], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) @@ -32,6 +32,7 @@ CC_CHECK_CFLAGS_APPEND([-g]) CC_CHECK_CFLAGS_APPEND([-std=gnu89]) CC_CHECK_CFLAGS_APPEND([-Wall]) CC_CHECK_CFLAGS_APPEND([-Wextra]) +CC_CHECK_CFLAGS_APPEND([-Wno-long-long]) CC_CHECK_CFLAGS_APPEND([-Wno-unused-parameter]) CC_CHECK_CFLAGS_APPEND([-Wstrict-prototypes]) # AM_PROG_AR is not available in automake v0.11 but it's essential in v0.12. @@ -80,4 +81,5 @@ AC_CHECK_HEADERS([sys/ahafs_evProds.h]) AC_CONFIG_FILES([Makefile libuv.pc]) AC_CONFIG_LINKS([test/fixtures/empty_file:test/fixtures/empty_file]) AC_CONFIG_LINKS([test/fixtures/load_error.node:test/fixtures/load_error.node]) +AC_CONFIG_LINKS([test/fixtures/lorem_ipsum.txt:test/fixtures/lorem_ipsum.txt]) AC_OUTPUT diff --git a/deps/uv/docs/src/fs.rst b/deps/uv/docs/src/fs.rst index aabe49b3f3a981..dc16ff08e65a93 100644 --- a/deps/uv/docs/src/fs.rst +++ b/deps/uv/docs/src/fs.rst @@ -295,7 +295,8 @@ API .. note:: On success this function allocates memory that must be freed using - `uv_fs_req_cleanup()`. + `uv_fs_req_cleanup()`. `uv_fs_req_cleanup()` must be called before + closing the directory with `uv_fs_closedir()`. .. c:function:: int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags, uv_fs_cb cb) .. c:function:: int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) @@ -358,10 +359,13 @@ API is to overwrite the destination if it exists. - `UV_FS_COPYFILE_FICLONE`: If present, `uv_fs_copyfile()` will attempt to create a copy-on-write reflink. If the underlying platform does not - support copy-on-write, then a fallback copy mechanism is used. + support copy-on-write, or an error occurs while attempting to use + copy-on-write, a fallback copy mechanism based on + :c:func:`uv_fs_sendfile()` is used. - `UV_FS_COPYFILE_FICLONE_FORCE`: If present, `uv_fs_copyfile()` will attempt to create a copy-on-write reflink. If the underlying platform does - not support copy-on-write, then an error is returned. + not support copy-on-write, or an error occurs while attempting to use + copy-on-write, then an error is returned. .. warning:: If the destination path is created, but an error occurs while copying @@ -374,6 +378,10 @@ API .. versionchanged:: 1.20.0 `UV_FS_COPYFILE_FICLONE` and `UV_FS_COPYFILE_FICLONE_FORCE` are supported. + .. versionchanged:: 1.33.0 If an error occurs while using + `UV_FS_COPYFILE_FICLONE_FORCE`, that error is returned. Previously, + all errors were mapped to `UV_ENOTSUP`. + .. c:function:: int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd, int64_t in_offset, size_t length, uv_fs_cb cb) Limited equivalent to :man:`sendfile(2)`. diff --git a/deps/uv/docs/src/handle.rst b/deps/uv/docs/src/handle.rst index 0a25bfa8b27dd1..943c51d94ba6c4 100644 --- a/deps/uv/docs/src/handle.rst +++ b/deps/uv/docs/src/handle.rst @@ -190,8 +190,11 @@ just for some handle types. Gets or sets the size of the send buffer that the operating system uses for the socket. - If `*value` == 0, it will return the current send buffer size, - otherwise it will use `*value` to set the new send buffer size. + If `*value` == 0, then it will set `*value` to the current send buffer size. + If `*value` > 0 then it will use `*value` to set the new send buffer size. + + On success, zero is returned. On error, a negative result is + returned. This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP handles on Windows. @@ -204,8 +207,11 @@ just for some handle types. Gets or sets the size of the receive buffer that the operating system uses for the socket. - If `*value` == 0, it will return the current receive buffer size, - otherwise it will use `*value` to set the new receive buffer size. + If `*value` == 0, then it will set `*value` to the current receive buffer size. + If `*value` > 0 then it will use `*value` to set the new receive buffer size. + + On success, zero is returned. On error, a negative result is + returned. This function works for TCP, pipe and UDP handles on Unix and for TCP and UDP handles on Windows. diff --git a/deps/uv/docs/src/misc.rst b/deps/uv/docs/src/misc.rst index 3ecfce486c4da2..8e167e3ec4ec1d 100644 --- a/deps/uv/docs/src/misc.rst +++ b/deps/uv/docs/src/misc.rst @@ -46,6 +46,12 @@ Data types Replacement function for :man:`free(3)`. See :c:func:`uv_replace_allocator`. +.. c:type:: void (*uv_random_cb)(uv_random_t* req, int status, void* buf, size_t buflen) + + Callback passed to :c:func:`uv_random`. `status` is non-zero in case of + error. The `buf` pointer is the same pointer that was passed to + :c:func:`uv_random`. + .. c:type:: uv_file Cross platform representation of a file handle. @@ -191,6 +197,9 @@ Data types char* value; } uv_env_item_t; +.. c:type:: uv_random_t + + Random data request type. API --- @@ -648,3 +657,39 @@ API argument to `gettimeofday()` is not supported, as it is considered obsolete. .. versionadded:: 1.28.0 + +.. c:function:: int uv_random(uv_loop_t* loop, uv_random_t* req, void* buf, size_t buflen, unsigned int flags, uv_random_cb cb) + + Fill `buf` with exactly `buflen` cryptographically strong random bytes + acquired from the system CSPRNG. `flags` is reserved for future extension + and must currently be 0. + + Short reads are not possible. When less than `buflen` random bytes are + available, a non-zero error value is returned or passed to the callback. + + The synchronous version may block indefinitely when not enough entropy + is available. The asynchronous version may not ever finish when the system + is low on entropy. + + Sources of entropy: + + - Windows: `RtlGenRandom _`. + - Linux, Android: :man:`getrandom(2)` if available, or :man:`urandom(4)` + after reading from `/dev/random` once, or the `KERN_RANDOM` + :man:`sysctl(2)`. + - FreeBSD: `getrandom(2) _`, + or `/dev/urandom` after reading from `/dev/random` once. + - macOS, OpenBSD: `getentropy(2) _` + if available, or `/dev/urandom` after reading from `/dev/random` once. + - AIX: `/dev/random`. + - IBM i: `/dev/urandom`. + - Other UNIX: `/dev/urandom` after reading from `/dev/random` once. + + :returns: 0 on success, or an error code < 0 on failure. The contents of + `buf` is undefined after an error. + + .. note:: + When using the synchronous version, both `loop` and `req` parameters + are not used and can be set to `NULL`. + + .. versionadded:: 1.33.0 diff --git a/deps/uv/docs/src/tty.rst b/deps/uv/docs/src/tty.rst index 9889a0a0b6465b..ad379dab0dd001 100644 --- a/deps/uv/docs/src/tty.rst +++ b/deps/uv/docs/src/tty.rst @@ -33,6 +33,23 @@ Data types UV_TTY_MODE_IO } uv_tty_mode_t; +.. c:type:: uv_tty_vtermstate_t + Console virtual terminal mode type: + + :: + + typedef enum { + /* + * The console supports handling of virtual terminal sequences + * (Windows10 new console, ConEmu) + */ + UV_TTY_SUPPORTED, + /* The console cannot process virtual terminal sequences. (Legacy + * console) + */ + UV_TTY_UNSUPPORTED + } uv_tty_vtermstate_t + Public members @@ -98,3 +115,25 @@ API Gets the current Window size. On success it returns 0. .. seealso:: The :c:type:`uv_stream_t` API functions also apply. + +.. c:function:: void uv_tty_set_vterm_state(uv_tty_vtermstate_t state) + + Controls whether console virtual terminal sequences are processed by libuv + or console. + Useful in particular for enabling ConEmu support of ANSI X3.64 and Xterm + 256 colors. Otherwise Windows10 consoles are usually detected automatically. + + This function is only meaningful on Windows systems. On Unix it is silently + ignored. + + .. versionadded:: 1.33.0 + +.. c:function:: int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state) + + Get the current state of whether console virtual terminal sequences are + handled by libuv or the console. + + This function is not implemented on Unix, where it returns ``UV_ENOTSUP``. + + .. versionadded:: 1.33.0 + diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index ee45bcaefce1d3..0e8132e4384be0 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -177,6 +177,7 @@ extern "C" { XX(WORK, work) \ XX(GETADDRINFO, getaddrinfo) \ XX(GETNAMEINFO, getnameinfo) \ + XX(RANDOM, random) \ typedef enum { #define XX(code, _) UV_ ## code = UV__ ## code, @@ -234,6 +235,7 @@ typedef struct uv_connect_s uv_connect_t; typedef struct uv_udp_send_s uv_udp_send_t; typedef struct uv_fs_s uv_fs_t; typedef struct uv_work_s uv_work_t; +typedef struct uv_random_s uv_random_t; /* None of the above. */ typedef struct uv_env_item_s uv_env_item_t; @@ -330,6 +332,10 @@ typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, int status, const char* hostname, const char* service); +typedef void (*uv_random_cb)(uv_random_t* req, + int status, + void* buf, + size_t buflen); typedef struct { long tv_sec; @@ -700,10 +706,25 @@ typedef enum { UV_TTY_MODE_IO } uv_tty_mode_t; +typedef enum { + /* + * The console supports handling of virtual terminal sequences + * (Windows10 new console, ConEmu) + */ + UV_TTY_SUPPORTED, + /* The console cannot process the virtual terminal sequence. (Legacy + * console) + */ + UV_TTY_UNSUPPORTED +} uv_tty_vtermstate_t; + + UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable); UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode); UV_EXTERN int uv_tty_reset_mode(void); UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); +UV_EXTERN void uv_tty_set_vterm_state(uv_tty_vtermstate_t state); +UV_EXTERN int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state); #ifdef __cplusplus extern "C++" { @@ -1574,6 +1595,26 @@ UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size); UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); + +struct uv_random_s { + UV_REQ_FIELDS + /* read-only */ + uv_loop_t* loop; + /* private */ + int status; + void* buf; + size_t buflen; + uv_random_cb cb; + struct uv__work work_req; +}; + +UV_EXTERN int uv_random(uv_loop_t* loop, + uv_random_t* req, + void *buf, + size_t buflen, + unsigned flags, /* For future extension; must be 0. */ + uv_random_cb cb); + #if defined(IF_NAMESIZE) # define UV_IF_NAMESIZE (IF_NAMESIZE + 1) #elif defined(IFNAMSIZ) diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h index 928647b8200502..ca94be6dd4fba6 100644 --- a/deps/uv/include/uv/version.h +++ b/deps/uv/include/uv/version.h @@ -31,8 +31,8 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 32 -#define UV_VERSION_PATCH 0 +#define UV_VERSION_MINOR 33 +#define UV_VERSION_PATCH 1 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/src/random.c b/deps/uv/src/random.c new file mode 100644 index 00000000000000..8c4fe32013dc9a --- /dev/null +++ b/deps/uv/src/random.c @@ -0,0 +1,121 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "uv-common.h" + +#ifdef _WIN32 +# include "win/internal.h" +#else +# include "unix/internal.h" +#endif + +static int uv__random(void* buf, size_t buflen) { + int rc; + +#if defined(__PASE__) + rc = uv__random_readpath("/dev/urandom", buf, buflen); +#elif defined(_AIX) + rc = uv__random_readpath("/dev/random", buf, buflen); +#elif defined(__APPLE__) || defined(__OpenBSD__) || \ + (defined(__ANDROID_API__) && __ANDROID_API__ >= 28) + rc = uv__random_getentropy(buf, buflen); + if (rc == UV_ENOSYS) + rc = uv__random_devurandom(buf, buflen); +#elif defined(__FreeBSD__) || defined(__linux__) + rc = uv__random_getrandom(buf, buflen); + if (rc == UV_ENOSYS) + rc = uv__random_devurandom(buf, buflen); +# if defined(__linux__) + switch (rc) { + case UV_EACCES: + case UV_EIO: + case UV_ELOOP: + case UV_EMFILE: + case UV_ENFILE: + case UV_ENOENT: + case UV_EPERM: + rc = uv__random_sysctl(buf, buflen); + break; + } +# endif +#elif defined(_WIN32) + uv__once_init(); + rc = uv__random_rtlgenrandom(buf, buflen); +#else + rc = uv__random_devurandom(buf, buflen); +#endif + + return rc; +} + + +static void uv__random_work(struct uv__work* w) { + uv_random_t* req; + + req = container_of(w, uv_random_t, work_req); + req->status = uv__random(req->buf, req->buflen); +} + + +static void uv__random_done(struct uv__work* w, int status) { + uv_random_t* req; + + req = container_of(w, uv_random_t, work_req); + uv__req_unregister(req->loop, req); + + if (status == 0) + status = req->status; + + req->cb(req, status, req->buf, req->buflen); +} + + +int uv_random(uv_loop_t* loop, + uv_random_t* req, + void *buf, + size_t buflen, + unsigned flags, + uv_random_cb cb) { + if (buflen > 0x7FFFFFFFu) + return UV_E2BIG; + + if (flags != 0) + return UV_EINVAL; + + if (cb == NULL) + return uv__random(buf, buflen); + + uv__req_init(loop, req, UV_RANDOM); + req->loop = loop; + req->status = 0; + req->cb = cb; + req->buf = buf; + req->buflen = buflen; + + uv__work_submit(loop, + &req->work_req, + UV__WORK_CPU, + uv__random_work, + uv__random_done); + + return 0; +} diff --git a/deps/uv/src/threadpool.c b/deps/uv/src/threadpool.c index 7aa575508fa8c4..a8f433f0510800 100644 --- a/deps/uv/src/threadpool.c +++ b/deps/uv/src/threadpool.c @@ -372,6 +372,10 @@ int uv_cancel(uv_req_t* req) { loop = ((uv_getnameinfo_t*) req)->loop; wreq = &((uv_getnameinfo_t*) req)->work_req; break; + case UV_RANDOM: + loop = ((uv_random_t*) req)->loop; + wreq = &((uv_random_t*) req)->work_req; + break; case UV_WORK: loop = ((uv_work_t*) req)->loop; wreq = &((uv_work_t*) req)->work_req; diff --git a/deps/uv/src/unix/android-ifaddrs.c b/deps/uv/src/unix/android-ifaddrs.c index 99fb25a43b4279..7d48c6af57ca46 100644 --- a/deps/uv/src/unix/android-ifaddrs.c +++ b/deps/uv/src/unix/android-ifaddrs.c @@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include typedef struct NetlinkList { @@ -475,6 +476,7 @@ static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); l_addedNetmask = 1; } + break; case IFA_BROADCAST: l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize)); break; diff --git a/deps/uv/src/unix/bsd-ifaddrs.c b/deps/uv/src/unix/bsd-ifaddrs.c index 0d7bbe662a5c53..a3385af17c889f 100644 --- a/deps/uv/src/unix/bsd-ifaddrs.c +++ b/deps/uv/src/unix/bsd-ifaddrs.c @@ -69,7 +69,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { struct ifaddrs* addrs; struct ifaddrs* ent; uv_interface_address_t* address; +#if !(defined(__CYGWIN__) || defined(__MSYS__)) int i; +#endif *count = 0; *addresses = NULL; diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index 366c43c2ab0843..ffce948c957403 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c @@ -66,7 +66,8 @@ extern char** environ; #if defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || \ - defined(__NetBSD__) + defined(__NetBSD__) || \ + defined(__OpenBSD__) # include # include # include @@ -76,7 +77,8 @@ extern char** environ; # if defined(__NetBSD__) # define uv__accept4(a, b, c, d) paccept((a), (b), (c), NULL, (d)) # endif -# if (defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__) +# if (defined(__FreeBSD__) && __FreeBSD__ >= 10) || \ + defined(__NetBSD__) || defined(__OpenBSD__) # define UV__SOCK_NONBLOCK SOCK_NONBLOCK # define UV__SOCK_CLOEXEC SOCK_CLOEXEC # endif diff --git a/deps/uv/src/unix/darwin-proctitle.c b/deps/uv/src/unix/darwin-proctitle.c index dabde2239ccab3..eced23c2da7ccf 100644 --- a/deps/uv/src/unix/darwin-proctitle.c +++ b/deps/uv/src/unix/darwin-proctitle.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -33,61 +34,52 @@ # include #endif +#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) -static int uv__pthread_setname_np(const char* name) { - int (*dynamic_pthread_setname_np)(const char* name); - char namebuf[64]; /* MAXTHREADNAMESIZE */ - int err; - - /* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */ - *(void **)(&dynamic_pthread_setname_np) = - dlsym(RTLD_DEFAULT, "pthread_setname_np"); - - if (dynamic_pthread_setname_np == NULL) - return UV_ENOSYS; - - strncpy(namebuf, name, sizeof(namebuf) - 1); - namebuf[sizeof(namebuf) - 1] = '\0'; - err = dynamic_pthread_setname_np(namebuf); - if (err) - return UV__ERR(err); +#if !TARGET_OS_IPHONE +static CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, + const char*, + CFStringEncoding); +static CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); +static void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); +static void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); +static CFTypeRef (*pLSGetCurrentApplicationASN)(void); +static OSStatus (*pLSSetApplicationInformationItem)(int, + CFTypeRef, + CFStringRef, + CFStringRef, + CFDictionaryRef*); +static void* application_services_handle; +static void* core_foundation_handle; +static CFBundleRef launch_services_bundle; +static CFStringRef* display_name_key; +static CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); +static CFBundleRef (*pCFBundleGetMainBundle)(void); +static CFBundleRef hi_services_bundle; +static CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); +static void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, + void*); + + +UV_DESTRUCTOR(static void uv__set_process_title_platform_fini(void)) { + if (core_foundation_handle != NULL) { + dlclose(core_foundation_handle); + core_foundation_handle = NULL; + } - return 0; + if (application_services_handle != NULL) { + dlclose(application_services_handle); + application_services_handle = NULL; + } } +#endif /* !TARGET_OS_IPHONE */ -int uv__set_process_title(const char* title) { -#if TARGET_OS_IPHONE - return uv__pthread_setname_np(title); -#else - CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, - const char*, - CFStringEncoding); - CFBundleRef (*pCFBundleGetBundleWithIdentifier)(CFStringRef); - void *(*pCFBundleGetDataPointerForName)(CFBundleRef, CFStringRef); - void *(*pCFBundleGetFunctionPointerForName)(CFBundleRef, CFStringRef); - CFTypeRef (*pLSGetCurrentApplicationASN)(void); - OSStatus (*pLSSetApplicationInformationItem)(int, - CFTypeRef, - CFStringRef, - CFStringRef, - CFDictionaryRef*); - void* application_services_handle; - void* core_foundation_handle; - CFBundleRef launch_services_bundle; - CFStringRef* display_name_key; - CFDictionaryRef (*pCFBundleGetInfoDictionary)(CFBundleRef); - CFBundleRef (*pCFBundleGetMainBundle)(void); - CFBundleRef hi_services_bundle; +void uv__set_process_title_platform_init(void) { +#if !TARGET_OS_IPHONE OSStatus (*pSetApplicationIsDaemon)(int); - CFDictionaryRef (*pLSApplicationCheckIn)(int, CFDictionaryRef); - void (*pLSSetApplicationLaunchServicesServerConnectionStatus)(uint64_t, - void*); - CFTypeRef asn; - int err; - err = UV_ENOENT; application_services_handle = dlopen("/System/Library/Frameworks/" "ApplicationServices.framework/" "Versions/A/ApplicationServices", @@ -116,8 +108,6 @@ int uv__set_process_title(const char* title) { goto out; } -#define S(s) pCFStringCreateWithCString(NULL, (s), kCFStringEncodingUTF8) - launch_services_bundle = pCFBundleGetBundleWithIdentifier(S("com.apple.LaunchServices")); @@ -148,13 +138,14 @@ int uv__set_process_title(const char* title) { "CFBundleGetInfoDictionary"); *(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle, "CFBundleGetMainBundle"); + if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL) goto out; /* Black 10.9 magic, to remove (Not responding) mark in Activity Monitor */ hi_services_bundle = pCFBundleGetBundleWithIdentifier(S("com.apple.HIServices")); - err = UV_ENOENT; + if (hi_services_bundle == NULL) goto out; @@ -168,42 +159,38 @@ int uv__set_process_title(const char* title) { pCFBundleGetFunctionPointerForName( launch_services_bundle, S("_LSSetApplicationLaunchServicesServerConnectionStatus")); + if (pSetApplicationIsDaemon == NULL || pLSApplicationCheckIn == NULL || pLSSetApplicationLaunchServicesServerConnectionStatus == NULL) { goto out; } - if (pSetApplicationIsDaemon(1) != noErr) - goto out; + /* Prevent crash when LaunchServices cannot be connected to. */ + pSetApplicationIsDaemon(1); + return; - pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); +out: + uv__set_process_title_platform_fini(); +#endif /* !TARGET_OS_IPHONE */ +} - /* Check into process manager?! */ - pLSApplicationCheckIn(-2, - pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); - asn = pLSGetCurrentApplicationASN(); +void uv__set_process_title(const char* title) { + char namebuf[64 /* MAXTHREADNAMESIZE */]; - err = UV_EINVAL; - if (pLSSetApplicationInformationItem(-2, /* Magic value. */ - asn, - *display_name_key, - S(title), - NULL) != noErr) { - goto out; +#if !TARGET_OS_IPHONE + if (core_foundation_handle != NULL) { + CFTypeRef asn; + pLSSetApplicationLaunchServicesServerConnectionStatus(0, NULL); + pLSApplicationCheckIn(/* Magic value */ -2, + pCFBundleGetInfoDictionary(pCFBundleGetMainBundle())); + asn = pLSGetCurrentApplicationASN(); + pLSSetApplicationInformationItem(/* Magic value */ -2, asn, + *display_name_key, S(title), NULL); } - - uv__pthread_setname_np(title); /* Don't care if it fails. */ - err = 0; - -out: - if (core_foundation_handle != NULL) - dlclose(core_foundation_handle); - - if (application_services_handle != NULL) - dlclose(application_services_handle); - - return err; #endif /* !TARGET_OS_IPHONE */ + + uv__strscpy(namebuf, title, sizeof(namebuf)); + pthread_setname_np(namebuf); } diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index fd3dd4c287e9ba..b37cfbbc7a04ee 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -78,7 +78,7 @@ defined(__NetBSD__) # include # include -#elif defined(__sun) || defined(__MVS__) +#elif defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__) # include #else # include @@ -216,7 +216,11 @@ static ssize_t uv__fs_futime(uv_fs_t* req) { ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000; ts[1].tv_sec = req->mtime; ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000; +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 + return utimensat(req->file, NULL, ts, 0); +#else return futimens(req->file, ts); +#endif #elif defined(__APPLE__) \ || defined(__DragonFly__) \ || defined(__FreeBSD__) \ @@ -528,7 +532,7 @@ static int uv__fs_closedir(uv_fs_t* req) { static int uv__fs_statfs(uv_fs_t* req) { uv_statfs_t* stat_fs; -#if defined(__sun) || defined(__MVS__) +#if defined(__sun) || defined(__MVS__) || defined(__NetBSD__) || defined(__HAIKU__) struct statvfs buf; if (0 != statvfs(req->path, &buf)) @@ -545,7 +549,7 @@ static int uv__fs_statfs(uv_fs_t* req) { return -1; } -#if defined(__sun) || defined(__MVS__) +#if defined(__sun) || defined(__MVS__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) stat_fs->f_type = 0; /* f_type is not supported. */ #else stat_fs->f_type = buf.f_type; @@ -1051,18 +1055,14 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { #ifdef FICLONE if (req->flags & UV_FS_COPYFILE_FICLONE || req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { - if (ioctl(dstfd, FICLONE, srcfd) == -1) { - /* If an error occurred that the sendfile fallback also won't handle, or - this is a force clone then exit. Otherwise, fall through to try using - sendfile(). */ - if (errno != ENOTTY && errno != EOPNOTSUPP && errno != EXDEV) { - err = UV__ERR(errno); - goto out; - } else if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { - err = UV_ENOTSUP; - goto out; - } - } else { + if (ioctl(dstfd, FICLONE, srcfd) == 0) { + /* ioctl() with FICLONE succeeded. */ + goto out; + } + /* If an error occurred and force was set, return the error to the caller; + * fall back to sendfile() when force was not set. */ + if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) { + err = UV__ERR(errno); goto out; } } diff --git a/deps/uv/src/unix/fsevents.c b/deps/uv/src/unix/fsevents.c index ddacda31fef87e..deeaa63d4730de 100644 --- a/deps/uv/src/unix/fsevents.c +++ b/deps/uv/src/unix/fsevents.c @@ -263,10 +263,12 @@ static void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef, if (len < handle->realpath_len) continue; + /* Make sure that realpath actually named a directory, + * (unless watching root, which alone keeps a trailing slash on the realpath) + * or that we matched the whole string */ if (handle->realpath_len != len && + handle->realpath_len > 1 && path[handle->realpath_len] != '/') - /* Make sure that realpath actually named a directory, - * or that we matched the whole string */ continue; if (memcmp(path, handle->realpath, handle->realpath_len) != 0) diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h index 260616474ec151..47f220000dcd73 100644 --- a/deps/uv/src/unix/internal.h +++ b/deps/uv/src/unix/internal.h @@ -270,6 +270,12 @@ uv_handle_type uv__handle_type(int fd); FILE* uv__open_file(const char* path); int uv__getpwuid_r(uv_passwd_t* pwd); +/* random */ +int uv__random_devurandom(void* buf, size_t buflen); +int uv__random_getrandom(void* buf, size_t buflen); +int uv__random_getentropy(void* buf, size_t buflen); +int uv__random_readpath(const char* path, void* buf, size_t buflen); +int uv__random_sysctl(void* buf, size_t buflen); #if defined(__APPLE__) int uv___stream_fd(const uv_stream_t* handle); diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c index c04e7a485cf992..ad09f4031318ca 100644 --- a/deps/uv/src/unix/kqueue.c +++ b/deps/uv/src/unix/kqueue.c @@ -454,10 +454,26 @@ int uv_fs_event_start(uv_fs_event_t* handle, const char* path, unsigned int flags) { int fd; +#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 + struct stat statbuf; +#endif if (uv__is_active(handle)) return UV_EINVAL; + handle->cb = cb; + handle->path = uv__strdup(path); + if (handle->path == NULL) + return UV_ENOMEM; + + /* TODO open asynchronously - but how do we report back errors? */ + fd = open(handle->path, O_RDONLY); + if (fd == -1) { + uv__free(handle->path); + handle->path = NULL; + return UV__ERR(errno); + } + #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 /* Nullify field to perform checks later */ handle->cf_cb = NULL; @@ -465,14 +481,17 @@ int uv_fs_event_start(uv_fs_event_t* handle, handle->realpath_len = 0; handle->cf_flags = flags; + if (fstat(fd, &statbuf)) + goto fallback; + /* FSEvents works only with directories */ + if (!(statbuf.st_mode & S_IFDIR)) + goto fallback; + if (!uv__has_forked_with_cfrunloop) { int r; - /* The fallback fd is not used */ + /* The fallback fd is no longer needed */ + uv__close_nocheckstdio(fd); handle->event_watcher.fd = -1; - handle->path = uv__strdup(path); - if (handle->path == NULL) - return UV_ENOMEM; - handle->cb = cb; r = uv__fsevents_init(handle); if (r == 0) { uv__handle_start(handle); @@ -482,20 +501,9 @@ int uv_fs_event_start(uv_fs_event_t* handle, } return r; } +fallback: #endif /* #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */ - /* TODO open asynchronously - but how do we report back errors? */ - fd = open(path, O_RDONLY); - if (fd == -1) - return UV__ERR(errno); - - handle->path = uv__strdup(path); - if (handle->path == NULL) { - uv__close_nocheckstdio(fd); - return UV_ENOMEM; - } - - handle->cb = cb; uv__handle_start(handle); uv__io_init(&handle->event_watcher, uv__fs_event, fd); uv__io_start(handle->loop, &handle->event_watcher, POLLIN); @@ -514,7 +522,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) { uv__handle_stop(handle); #if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - if (!uv__has_forked_with_cfrunloop) + if (!uv__has_forked_with_cfrunloop && handle->cf_cb != NULL) r = uv__fsevents_close(handle); #endif diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 433e201fe19dbf..a155a374e76c2d 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -90,7 +90,12 @@ int uv__platform_loop_init(uv_loop_t* loop) { * a.k.a. Lollipop. Since EPOLL_CLOEXEC is an alias for O_CLOEXEC on all * architectures, we just use that instead. */ +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 + fd = -1; + errno = ENOSYS; +#else fd = epoll_create1(O_CLOEXEC); +#endif /* epoll_create1() can fail either because it's not implemented (old kernel) * or because it doesn't understand the O_CLOEXEC flag. @@ -203,6 +208,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { * that being the largest value I have seen in the wild (and only once.) */ static const int max_safe_timeout = 1789569; + static int no_epoll_pwait; + static int no_epoll_wait; struct epoll_event events[1024]; struct epoll_event* pe; struct epoll_event e; @@ -210,7 +217,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { QUEUE* q; uv__io_t* w; sigset_t sigset; - sigset_t* psigset; + uint64_t sigmask; uint64_t base; int have_signals; int nevents; @@ -262,11 +269,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { w->events = w->pevents; } - psigset = NULL; + sigmask = 0; if (loop->flags & UV_LOOP_BLOCK_SIGPROF) { sigemptyset(&sigset); sigaddset(&sigset, SIGPROF); - psigset = &sigset; + sigmask |= 1 << (SIGPROF - 1); } assert(timeout >= -1); @@ -281,11 +288,35 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { if (sizeof(int32_t) == sizeof(long) && timeout >= max_safe_timeout) timeout = max_safe_timeout; - nfds = epoll_pwait(loop->backend_fd, - events, - ARRAY_SIZE(events), - timeout, - psigset); + if (sigmask != 0 && no_epoll_pwait != 0) + if (pthread_sigmask(SIG_BLOCK, &sigset, NULL)) + abort(); + + if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) { +#if defined(__ANDROID_API__) && __ANDROID_API__ < 21 + nfds = -1; + errno = ENOSYS; +#else + nfds = epoll_pwait(loop->backend_fd, + events, + ARRAY_SIZE(events), + timeout, + &sigset); +#endif + if (nfds == -1 && errno == ENOSYS) + no_epoll_pwait = 1; + } else { + nfds = epoll_wait(loop->backend_fd, + events, + ARRAY_SIZE(events), + timeout); + if (nfds == -1 && errno == ENOSYS) + no_epoll_wait = 1; + } + + if (sigmask != 0 && no_epoll_pwait != 0) + if (pthread_sigmask(SIG_UNBLOCK, &sigset, NULL)) + abort(); /* Update loop->time unconditionally. It's tempting to skip the update when * timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the @@ -306,6 +337,12 @@ void uv__io_poll(uv_loop_t* loop, int timeout) { } if (nfds == -1) { + if (errno == ENOSYS) { + /* epoll_wait() or epoll_pwait() failed, try the other system call. */ + assert(no_epoll_wait == 0 || no_epoll_pwait == 0); + continue; + } + if (errno != EINTR) abort(); diff --git a/deps/uv/src/unix/linux-syscalls.c b/deps/uv/src/unix/linux-syscalls.c index 5637cf98a7b338..950387860f04cc 100644 --- a/deps/uv/src/unix/linux-syscalls.c +++ b/deps/uv/src/unix/linux-syscalls.c @@ -203,6 +203,22 @@ # endif #endif /* __NR_statx */ +#ifndef __NR_getrandom +# if defined(__x86_64__) +# define __NR_getrandom 318 +# elif defined(__i386__) +# define __NR_getrandom 355 +# elif defined(__aarch64__) +# define __NR_getrandom 384 +# elif defined(__arm__) +# define __NR_getrandom (UV_SYSCALL_BASE + 384) +# elif defined(__ppc__) +# define __NR_getrandom 359 +# elif defined(__s390__) +# define __NR_getrandom 349 +# endif +#endif /* __NR_getrandom */ + int uv__accept4(int fd, struct sockaddr* addr, socklen_t* addrlen, int flags) { #if defined(__i386__) unsigned long args[4]; @@ -367,3 +383,12 @@ int uv__statx(int dirfd, return errno = ENOSYS, -1; #endif } + + +ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags) { +#if defined(__NR_getrandom) + return syscall(__NR_getrandom, buf, buflen, flags); +#else + return errno = ENOSYS, -1; +#endif +} diff --git a/deps/uv/src/unix/linux-syscalls.h b/deps/uv/src/unix/linux-syscalls.h index 7e58bfa2189692..b7729b82aea9ba 100644 --- a/deps/uv/src/unix/linux-syscalls.h +++ b/deps/uv/src/unix/linux-syscalls.h @@ -148,5 +148,6 @@ int uv__statx(int dirfd, int flags, unsigned int mask, struct uv__statx* statxbuf); +ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags); #endif /* UV_LINUX_SYSCALL_H_ */ diff --git a/deps/uv/src/unix/openbsd.c b/deps/uv/src/unix/openbsd.c index 1f5228dc13fd7a..199a34658a7948 100644 --- a/deps/uv/src/unix/openbsd.c +++ b/deps/uv/src/unix/openbsd.c @@ -186,7 +186,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { int numcpus = 1; int which[] = {CTL_HW,HW_MODEL,0}; size_t size; - int i; + int i, j; uv_cpu_info_t* cpu_info; size = sizeof(model); diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c index 834766863220fe..cdf24fa9763cb1 100644 --- a/deps/uv/src/unix/pipe.c +++ b/deps/uv/src/unix/pipe.c @@ -261,7 +261,7 @@ static int uv__pipe_getsockpeername(const uv_pipe_t* handle, addrlen = strlen(sa.sun_path); - if (addrlen >= *size) { + if ((size_t)addrlen >= *size) { *size = addrlen + 1; return UV_ENOBUFS; } diff --git a/deps/uv/src/unix/proctitle.c b/deps/uv/src/unix/proctitle.c index 1a8c7a7090e8a6..a5ce2030c55be8 100644 --- a/deps/uv/src/unix/proctitle.c +++ b/deps/uv/src/unix/proctitle.c @@ -24,6 +24,7 @@ #include #include +extern void uv__set_process_title_platform_init(void); extern void uv__set_process_title(const char* title); static uv_mutex_t process_title_mutex; @@ -38,6 +39,9 @@ static struct { static void init_process_title_mutex_once(void) { uv_mutex_init(&process_title_mutex); +#ifdef __APPLE__ + uv__set_process_title_platform_init(); +#endif } diff --git a/deps/uv/src/unix/random-devurandom.c b/deps/uv/src/unix/random-devurandom.c new file mode 100644 index 00000000000000..bfc40d20f88cb7 --- /dev/null +++ b/deps/uv/src/unix/random-devurandom.c @@ -0,0 +1,93 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include + +static uv_once_t once = UV_ONCE_INIT; +static int status; + + +int uv__random_readpath(const char* path, void* buf, size_t buflen) { + struct stat s; + size_t pos; + ssize_t n; + int fd; + + fd = uv__open_cloexec(path, O_RDONLY); + + if (fd == -1) + return UV__ERR(errno); + + if (fstat(fd, &s)) { + uv__close(fd); + return UV__ERR(errno); + } + + if (!S_ISCHR(s.st_mode)) { + uv__close(fd); + return UV_EIO; + } + + for (pos = 0; pos != buflen; pos += n) { + do + n = read(fd, (char*) buf + pos, buflen - pos); + while (n == -1 && errno == EINTR); + + if (n == -1) { + uv__close(fd); + return UV__ERR(errno); + } + + if (n == 0) { + uv__close(fd); + return UV_EIO; + } + } + + uv__close(fd); + return 0; +} + + +static void uv__random_devurandom_init(void) { + char c; + + /* Linux's and NetBSD's random(4) man page suggests applications should read + * at least once from /dev/random before switching to /dev/urandom in order + * to seed the system RNG. Reads from /dev/random can of course block + * indefinitely until entropy is available but that's the point. + */ + status = uv__random_readpath("/dev/random", &c, 1); +} + + +int uv__random_devurandom(void* buf, size_t buflen) { + uv_once(&once, uv__random_devurandom_init); + + if (status != 0) + return status; + + return uv__random_readpath("/dev/urandom", buf, buflen); +} diff --git a/deps/uv/src/unix/random-getentropy.c b/deps/uv/src/unix/random-getentropy.c new file mode 100644 index 00000000000000..c45d9fd4a2b7c0 --- /dev/null +++ b/deps/uv/src/unix/random-getentropy.c @@ -0,0 +1,57 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include + +typedef int (*uv__getentropy_cb)(void *, size_t); + +static uv__getentropy_cb uv__getentropy; +static uv_once_t once = UV_ONCE_INIT; + + +static void uv__random_getentropy_init(void) { + uv__getentropy = (uv__getentropy_cb) dlsym(RTLD_DEFAULT, "getentropy"); +} + + +int uv__random_getentropy(void* buf, size_t buflen) { + size_t pos; + size_t stride; + + uv_once(&once, uv__random_getentropy_init); + + if (uv__getentropy == NULL) + return UV_ENOSYS; + + /* getentropy() returns an error for requests > 256 bytes. */ + for (pos = 0, stride = 256; pos + stride < buflen; pos += stride) + if (uv__getentropy((char *) buf + pos, stride)) + return UV__ERR(errno); + + if (uv__getentropy((char *) buf + pos, buflen - pos)) + return UV__ERR(errno); + + return 0; +} diff --git a/deps/uv/src/unix/random-getrandom.c b/deps/uv/src/unix/random-getrandom.c new file mode 100644 index 00000000000000..bcc94089bcb64e --- /dev/null +++ b/deps/uv/src/unix/random-getrandom.c @@ -0,0 +1,88 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#ifdef __linux__ + +#include "linux-syscalls.h" + +#define uv__random_getrandom_init() 0 + +#else /* !__linux__ */ + +#include +#include + +typedef ssize_t (*uv__getrandom_cb)(void *, size_t, unsigned); + +static uv__getrandom_cb uv__getrandom; +static uv_once_t once = UV_ONCE_INIT; + +static void uv__random_getrandom_init_once(void) { + uv__getrandom = (uv__getrandom_cb) dlsym(RTLD_DEFAULT, "getrandom"); +} + +static int uv__random_getrandom_init(void) { + uv_once(&once, uv__random_getrandom_init_once); + + if (uv__getrandom == NULL) + return UV_ENOSYS; + + return 0; +} + +#endif /* !__linux__ */ + +int uv__random_getrandom(void* buf, size_t buflen) { + ssize_t n; + size_t pos; + int rc; + + rc = uv__random_getrandom_init(); + if (rc != 0) + return rc; + + for (pos = 0; pos != buflen; pos += n) { + do { + n = buflen - pos; + + /* Most getrandom() implementations promise that reads <= 256 bytes + * will always succeed and won't be interrupted by signals. + * It's therefore useful to split it up in smaller reads because + * one big read may, in theory, continuously fail with EINTR. + */ + if (n > 256) + n = 256; + + n = uv__getrandom((char *) buf + pos, n, 0); + } while (n == -1 && errno == EINTR); + + if (n == -1) + return UV__ERR(errno); + + if (n == 0) + return UV_EIO; + } + + return 0; +} diff --git a/deps/uv/src/unix/random-sysctl.c b/deps/uv/src/unix/random-sysctl.c new file mode 100644 index 00000000000000..fb182ded09296b --- /dev/null +++ b/deps/uv/src/unix/random-sysctl.c @@ -0,0 +1,100 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include +#include + +#include +#include + + +struct uv__sysctl_args { + int* name; + int nlen; + void* oldval; + size_t* oldlenp; + void* newval; + size_t newlen; + unsigned long unused[4]; +}; + + +/* TODO(bnoordhuis) Use {CTL_KERN, KERN_ARND} on FreeBSD (and NetBSD?) */ +int uv__random_sysctl(void* buf, size_t buflen) { + static int name[] = {1 /*CTL_KERN*/, 40 /*KERN_RANDOM*/, 6 /*RANDOM_UUID*/}; + struct uv__sysctl_args args; + char uuid[16]; + char* p; + char* pe; + size_t n; + + p = buf; + pe = p + buflen; + + while (p < pe) { + memset(&args, 0, sizeof(args)); + + args.name = name; + args.nlen = ARRAY_SIZE(name); + args.oldval = uuid; + args.oldlenp = &n; + n = sizeof(uuid); + + /* Emits a deprecation warning with some kernels but that seems like + * an okay trade-off for the fallback of the fallback: this function is + * only called when neither getrandom(2) nor /dev/urandom are available. + * Fails with ENOSYS on kernels configured without CONFIG_SYSCTL_SYSCALL. + * At least arm64 never had a _sysctl system call and therefore doesn't + * have a SYS__sysctl define either. + */ +#ifdef SYS__sysctl + if (syscall(SYS__sysctl, &args) == -1) + return UV__ERR(errno); +#else + { + (void) &args; + return UV_ENOSYS; + } +#endif + + if (n != sizeof(uuid)) + return UV_EIO; /* Can't happen. */ + + /* uuid[] is now a type 4 UUID. Bytes 6 and 8 (counting from zero) contain + * 4 and 5 bits of entropy, respectively. For ease of use, we skip those + * and only use 14 of the 16 bytes. + */ + uuid[6] = uuid[14]; + uuid[8] = uuid[15]; + + n = pe - p; + if (n > 14) + n = 14; + + memcpy(p, uuid, n); + p += n; + } + + return 0; +} diff --git a/deps/uv/src/unix/tty.c b/deps/uv/src/unix/tty.c index 74d3d75d7615d9..e7c520f77402bc 100644 --- a/deps/uv/src/unix/tty.c +++ b/deps/uv/src/unix/tty.c @@ -365,3 +365,10 @@ int uv_tty_reset_mode(void) { return err; } + +void uv_tty_set_vterm_state(uv_tty_vtermstate_t state) { +} + +int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state) { + return UV_ENOTSUP; +} diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c index dba8eff8382edd..98215f7e1d212b 100644 --- a/deps/uv/src/unix/udp.c +++ b/deps/uv/src/unix/udp.c @@ -165,9 +165,6 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { */ count = 32; - memset(&h, 0, sizeof(h)); - h.msg_name = &peer; - do { buf = uv_buf_init(NULL, 0); handle->alloc_cb((uv_handle_t*) handle, 64 * 1024, &buf); @@ -177,6 +174,9 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { } assert(buf.base != NULL); + memset(&h, 0, sizeof(h)); + memset(&peer, 0, sizeof(peer)); + h.msg_name = &peer; h.msg_namelen = sizeof(peer); h.msg_iov = (void*) &buf; h.msg_iovlen = 1; @@ -193,17 +193,11 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { handle->recv_cb(handle, UV__ERR(errno), &buf, NULL, 0); } else { - const struct sockaddr *addr; - if (h.msg_namelen == 0) - addr = NULL; - else - addr = (const struct sockaddr*) &peer; - flags = 0; if (h.msg_flags & MSG_TRUNC) flags |= UV_UDP_PARTIAL; - handle->recv_cb(handle, nread, &buf, addr, flags); + handle->recv_cb(handle, nread, &buf, (const struct sockaddr*) &peer, flags); } } /* recv_cb callback may decide to pause or close the handle */ @@ -659,6 +653,7 @@ static int uv__udp_set_membership6(uv_udp_t* handle, } +#if !defined(__OpenBSD__) && !defined(__NetBSD__) static int uv__udp_set_source_membership4(uv_udp_t* handle, const struct sockaddr_in* multicast_addr, const char* interface_addr, @@ -749,6 +744,7 @@ static int uv__udp_set_source_membership6(uv_udp_t* handle, return 0; } +#endif int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { @@ -846,6 +842,7 @@ int uv_udp_set_source_membership(uv_udp_t* handle, const char* interface_addr, const char* source_addr, uv_membership membership) { +#if !defined(__OpenBSD__) && !defined(__NetBSD__) int err; struct sockaddr_storage mcast_addr; struct sockaddr_in* mcast_addr4; @@ -873,7 +870,7 @@ int uv_udp_set_source_membership(uv_udp_t* handle, src_addr6, membership); } - + err = uv_ip4_addr(source_addr, 0, src_addr4); if (err) return err; @@ -882,6 +879,9 @@ int uv_udp_set_source_membership(uv_udp_t* handle, interface_addr, src_addr4, membership); +#else + return UV_ENOSYS; +#endif } diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c index 70db53ab04dacf..cec4ac6281b91b 100644 --- a/deps/uv/src/uv-common.c +++ b/deps/uv/src/uv-common.c @@ -211,6 +211,9 @@ int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr) { memset(addr, 0, sizeof(*addr)); addr->sin_family = AF_INET; addr->sin_port = htons(port); +#ifdef SIN6_LEN + addr->sin_len = sizeof(*addr); +#endif return uv_inet_pton(AF_INET, ip, &(addr->sin_addr.s_addr)); } diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 5dccca77999dbd..3ab486080cdfa7 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -36,8 +36,6 @@ #include "handle-inl.h" #include "fs-fd-hash-inl.h" -#include - #define UV_FS_FREE_PATHS 0x0002 #define UV_FS_FREE_PTR 0x0008 @@ -1207,9 +1205,7 @@ void fs__mkdtemp(uv_fs_t* req) { WCHAR *cp, *ep; unsigned int tries, i; size_t len; - HCRYPTPROV h_crypt_prov; uint64_t v; - BOOL released; len = wcslen(req->file.pathw); ep = req->file.pathw + len; @@ -1218,16 +1214,10 @@ void fs__mkdtemp(uv_fs_t* req) { return; } - if (!CryptAcquireContext(&h_crypt_prov, NULL, NULL, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT)) { - SET_REQ_WIN32_ERROR(req, GetLastError()); - return; - } - tries = TMP_MAX; do { - if (!CryptGenRandom(h_crypt_prov, sizeof(v), (BYTE*) &v)) { - SET_REQ_WIN32_ERROR(req, GetLastError()); + if (uv__random_rtlgenrandom((void *)&v, sizeof(v)) < 0) { + SET_REQ_UV_ERROR(req, UV_EIO, ERROR_IO_DEVICE); break; } @@ -1248,8 +1238,6 @@ void fs__mkdtemp(uv_fs_t* req) { } } while (--tries); - released = CryptReleaseContext(h_crypt_prov, 0); - assert(released); if (tries == 0) { SET_REQ_RESULT(req, -1); } @@ -2587,6 +2575,7 @@ static void fs__statfs(uv_fs_t* req) { stat_fs->f_files = 0; stat_fs->f_ffree = 0; req->ptr = stat_fs; + req->flags |= UV_FS_FREE_PTR; SET_REQ_RESULT(req, 0); } diff --git a/deps/uv/src/win/internal.h b/deps/uv/src/win/internal.h index 70ddaa533244e2..058ddb8edc6d10 100644 --- a/deps/uv/src/win/internal.h +++ b/deps/uv/src/win/internal.h @@ -280,6 +280,8 @@ int uv__getsockpeername(const uv_handle_t* handle, int* namelen, int delayed_error); +int uv__random_rtlgenrandom(void* buf, size_t buflen); + /* * Process stdio handles. diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c index 81e48136a3b9ef..fd34c623d8c543 100644 --- a/deps/uv/src/win/tcp.c +++ b/deps/uv/src/win/tcp.c @@ -556,7 +556,7 @@ int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb) { if (handle->flags & UV_HANDLE_SHUTTING) return UV_EINVAL; - if (0 != setsockopt(handle->socket, SOL_SOCKET, SO_LINGER, &l, sizeof(l))) + if (0 != setsockopt(handle->socket, SOL_SOCKET, SO_LINGER, (const char*)&l, sizeof(l))) return uv_translate_sys_error(WSAGetLastError()); uv_close((uv_handle_t*) handle, close_cb); diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c index 8f84bcd0e45544..5d5b92d0d2d6bd 100644 --- a/deps/uv/src/win/tty.c +++ b/deps/uv/src/win/tty.c @@ -149,13 +149,9 @@ static char uv_tty_default_fg_bright = 0; static char uv_tty_default_bg_bright = 0; static char uv_tty_default_inverse = 0; -typedef enum { - UV_SUPPORTED, - UV_UNCHECKED, - UV_UNSUPPORTED -} uv_vtermstate_t; /* Determine whether or not ANSI support is enabled. */ -static uv_vtermstate_t uv__vterm_state = UV_UNCHECKED; +static BOOL uv__need_check_vterm_state = TRUE; +static uv_tty_vtermstate_t uv__vterm_state = UV_TTY_UNSUPPORTED; static void uv__determine_vterm_state(HANDLE handle); void uv_console_init(void) { @@ -169,10 +165,15 @@ void uv_console_init(void) { 0, 0); if (uv__tty_console_handle != INVALID_HANDLE_VALUE) { + CONSOLE_SCREEN_BUFFER_INFO sb_info; QueueUserWorkItem(uv__tty_console_resize_message_loop_thread, NULL, WT_EXECUTELONGFUNCTION); uv_mutex_init(&uv__tty_console_resize_mutex); + if (GetConsoleScreenBufferInfo(uv__tty_console_handle, &sb_info)) { + uv__tty_console_width = sb_info.dwSize.X; + uv__tty_console_height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1; + } } } @@ -218,7 +219,7 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int unused) { * between all uv_tty_t handles. */ uv_sem_wait(&uv_tty_output_lock); - if (uv__vterm_state == UV_UNCHECKED) + if (uv__need_check_vterm_state) uv__determine_vterm_state(handle); /* Remember the original console text attributes. */ @@ -1670,7 +1671,7 @@ static int uv_tty_write_bufs(uv_tty_t* handle, uv_buf_t buf = bufs[i]; unsigned int j; - if (uv__vterm_state == UV_SUPPORTED && buf.len > 0) { + if (uv__vterm_state == UV_TTY_SUPPORTED && buf.len > 0) { utf16_buf_used = MultiByteToWideChar(CP_UTF8, 0, buf.base, @@ -2275,32 +2276,24 @@ int uv_tty_reset_mode(void) { static void uv__determine_vterm_state(HANDLE handle) { DWORD dwMode = 0; + uv__need_check_vterm_state = FALSE; if (!GetConsoleMode(handle, &dwMode)) { - uv__vterm_state = UV_UNSUPPORTED; return; } dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; if (!SetConsoleMode(handle, dwMode)) { - uv__vterm_state = UV_UNSUPPORTED; return; } - uv__vterm_state = UV_SUPPORTED; + uv__vterm_state = UV_TTY_SUPPORTED; } static DWORD WINAPI uv__tty_console_resize_message_loop_thread(void* param) { - CONSOLE_SCREEN_BUFFER_INFO sb_info; NTSTATUS status; ULONG_PTR conhost_pid; MSG msg; - if (!GetConsoleScreenBufferInfo(uv__tty_console_handle, &sb_info)) - return 0; - - uv__tty_console_width = sb_info.dwSize.X; - uv__tty_console_height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1; - if (pSetWinEventHook == NULL || pNtQueryInformationProcess == NULL) return 0; @@ -2375,6 +2368,7 @@ static void uv__tty_console_signal_resize(void) { height = sb_info.srWindow.Bottom - sb_info.srWindow.Top + 1; uv_mutex_lock(&uv__tty_console_resize_mutex); + assert(uv__tty_console_width != -1 && uv__tty_console_height != -1); if (width != uv__tty_console_width || height != uv__tty_console_height) { uv__tty_console_width = width; uv__tty_console_height = height; @@ -2384,3 +2378,17 @@ static void uv__tty_console_signal_resize(void) { uv_mutex_unlock(&uv__tty_console_resize_mutex); } } + +void uv_tty_set_vterm_state(uv_tty_vtermstate_t state) { + uv_sem_wait(&uv_tty_output_lock); + uv__need_check_vterm_state = FALSE; + uv__vterm_state = state; + uv_sem_post(&uv_tty_output_lock); +} + +int uv_tty_get_vterm_state(uv_tty_vtermstate_t* state) { + uv_sem_wait(&uv_tty_output_lock); + *state = uv__vterm_state; + uv_sem_post(&uv_tty_output_lock); + return 0; +} diff --git a/deps/uv/src/win/udp.c b/deps/uv/src/win/udp.c index 39fc34d3bfcd94..3daa55f62db063 100644 --- a/deps/uv/src/win/udp.c +++ b/deps/uv/src/win/udp.c @@ -856,7 +856,7 @@ int uv_udp_set_source_membership(uv_udp_t* handle, src_addr6, membership); } - + err = uv_ip4_addr(source_addr, 0, src_addr4); if (err) return err; diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c index 8849d041bf0283..4bbeb3154123dd 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -1417,7 +1417,9 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) { if (uv__convert_utf16_to_utf8(penv, -1, &buf) != 0) goto fail; - ptr = strchr(buf, '='); + /* Using buf + 1 here because we know that `buf` has length at least 1, + * and some special environment variables on Windows start with a = sign. */ + ptr = strchr(buf + 1, '='); if (ptr == NULL) { uv__free(buf); goto do_continue; @@ -1858,3 +1860,16 @@ int uv_gettimeofday(uv_timeval64_t* tv) { tv->tv_usec = (int32_t) (((ularge.QuadPart - epoch) % 10000000L) / 10); return 0; } + +int uv__random_rtlgenrandom(void* buf, size_t buflen) { + if (pRtlGenRandom == NULL) + return UV_ENOSYS; + + if (buflen == 0) + return 0; + + if (pRtlGenRandom(buf, buflen) == FALSE) + return UV_EIO; + + return 0; +} diff --git a/deps/uv/src/win/winapi.c b/deps/uv/src/win/winapi.c index 19e4377faf5599..85a9de8a2295ec 100644 --- a/deps/uv/src/win/winapi.c +++ b/deps/uv/src/win/winapi.c @@ -36,6 +36,9 @@ sNtQueryDirectoryFile pNtQueryDirectoryFile; sNtQuerySystemInformation pNtQuerySystemInformation; sNtQueryInformationProcess pNtQueryInformationProcess; +/* Advapi32 function pointers */ +sRtlGenRandom pRtlGenRandom; + /* Kernel32 function pointers */ sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; @@ -51,6 +54,7 @@ void uv_winapi_init(void) { HMODULE powrprof_module; HMODULE user32_module; HMODULE kernel32_module; + HMODULE advapi32_module; ntdll_module = GetModuleHandleA("ntdll.dll"); if (ntdll_module == NULL) { @@ -135,4 +139,11 @@ void uv_winapi_init(void) { GetProcAddress(user32_module, "SetWinEventHook"); } + advapi32_module = GetModuleHandleA("advapi32.dll"); + if (advapi32_module == NULL) { + uv_fatal_error(GetLastError(), "GetModuleHandleA"); + } + + pRtlGenRandom = + (sRtlGenRandom) GetProcAddress(advapi32_module, "SystemFunction036"); } diff --git a/deps/uv/src/win/winapi.h b/deps/uv/src/win/winapi.h index 322a212dd73c19..fcc70652a9aedb 100644 --- a/deps/uv/src/win/winapi.h +++ b/deps/uv/src/win/winapi.h @@ -4589,6 +4589,11 @@ typedef NTSTATUS (NTAPI *sNtQueryInformationProcess) ULONG Length, PULONG ReturnLength); +/* + * Advapi32 headers + */ +typedef BOOLEAN (WINAPI *sRtlGenRandom)(PVOID Buffer, ULONG BufferLength); + /* * Kernel32 headers */ @@ -4731,6 +4736,9 @@ extern sNtQueryDirectoryFile pNtQueryDirectoryFile; extern sNtQuerySystemInformation pNtQuerySystemInformation; extern sNtQueryInformationProcess pNtQueryInformationProcess; +/* Advapi32 function pointers */ +extern sRtlGenRandom pRtlGenRandom; + /* Kernel32 function pointers */ extern sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx; diff --git a/deps/uv/src/win/winsock.h b/deps/uv/src/win/winsock.h index 7ecb755bfb061b..2af958870a7de6 100644 --- a/deps/uv/src/win/winsock.h +++ b/deps/uv/src/win/winsock.h @@ -54,6 +54,14 @@ # define SIO_BASE_HANDLE 0x48000022 #endif +#ifndef MCAST_JOIN_SOURCE_GROUP +# define MCAST_JOIN_SOURCE_GROUP 45 +#endif + +#ifndef MCAST_LEAVE_SOURCE_GROUP +# define MCAST_LEAVE_SOURCE_GROUP 46 +#endif + /* * TDI defines that are only in the DDK. * We only need receive flags so far. diff --git a/deps/uv/test/test-env-vars.c b/deps/uv/test/test-env-vars.c index 3814699356db55..3c9de95b102a07 100644 --- a/deps/uv/test/test-env-vars.c +++ b/deps/uv/test/test-env-vars.c @@ -30,7 +30,7 @@ TEST_IMPL(env_vars) { const char* name2 = "UV_TEST_FOO2"; char buf[BUF_SIZE]; size_t size; - int i, r, envcount, found; + int i, r, envcount, found, found_win_special; uv_env_item_t* envitems; /* Reject invalid inputs when setting an environment variable */ @@ -108,6 +108,7 @@ TEST_IMPL(env_vars) { ASSERT(envcount > 0); found = 0; + found_win_special = 0; for (i = 0; i < envcount; i++) { /* printf("Env: %s = %s\n", envitems[i].name, envitems[i].value); */ @@ -117,10 +118,15 @@ TEST_IMPL(env_vars) { } else if (strcmp(envitems[i].name, name2) == 0) { found++; ASSERT(strlen(envitems[i].value) == 0); + } else if (envitems[i].name[0] == '=') { + found_win_special++; } } ASSERT(found == 2); +#ifdef _WIN32 + ASSERT(found_win_special > 0); +#endif uv_os_free_environ(envitems, envcount); diff --git a/deps/uv/test/test-fs-copyfile.c b/deps/uv/test/test-fs-copyfile.c index def3d967e74f5b..c3e698e5852cba 100644 --- a/deps/uv/test/test-fs-copyfile.c +++ b/deps/uv/test/test-fs-copyfile.c @@ -188,7 +188,7 @@ TEST_IMPL(fs_copyfile) { unlink(dst); r = uv_fs_copyfile(NULL, &req, fixture, dst, UV_FS_COPYFILE_FICLONE_FORCE, NULL); - ASSERT(r == 0 || r == UV_ENOSYS || r == UV_ENOTSUP); + ASSERT(r <= 0); if (r == 0) handle_result(&req); diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c index ea34bd63a70625..e694d258ea9306 100644 --- a/deps/uv/test/test-fs-event.c +++ b/deps/uv/test/test-fs-event.c @@ -25,6 +25,10 @@ #include #include +#if defined(__APPLE__) && !TARGET_OS_IPHONE +# include +#endif + #ifndef HAVE_KQUEUE # if defined(__APPLE__) || \ defined(__DragonFly__) || \ @@ -47,6 +51,7 @@ static const char file_prefix[] = "fsevent-"; static const int fs_event_file_count = 16; #if defined(__APPLE__) || defined(_WIN32) static const char file_prefix_in_subdir[] = "subdir"; +static int fs_multievent_cb_called; #endif static uv_timer_t timer; static int timer_cb_called; @@ -280,7 +285,7 @@ static void fs_event_cb_dir_multi_file_in_subdir(uv_fs_event_t* handle, if (filename && strcmp(filename, file_prefix_in_subdir) == 0) return; #endif - fs_event_cb_called++; + fs_multievent_cb_called++; ASSERT(handle == &fs_event); ASSERT(status == 0); ASSERT(events == UV_CHANGE || events == UV_RENAME); @@ -298,7 +303,7 @@ static void fs_event_cb_dir_multi_file_in_subdir(uv_fs_event_t* handle, if (fs_event_created + fs_event_removed == fs_event_file_count) { /* Once we've processed all create events, delete all files */ ASSERT(0 == uv_timer_start(&timer, fs_event_unlink_files_in_subdir, 1, 0)); - } else if (fs_event_cb_called == 2 * fs_event_file_count) { + } else if (fs_multievent_cb_called == 2 * fs_event_file_count) { /* Once we've processed all create and delete events, stop watching */ uv_close((uv_handle_t*) &timer, close_cb); uv_close((uv_handle_t*) handle, close_cb); @@ -393,6 +398,21 @@ static void timer_cb_watch_twice(uv_timer_t* handle) { uv_close((uv_handle_t*) handle, NULL); } +static void fs_event_cb_close(uv_fs_event_t* handle, + const char* filename, + int events, + int status) { + ASSERT(status == 0); + + ASSERT(fs_event_cb_called < 3); + ++fs_event_cb_called; + + if (fs_event_cb_called == 3) { + uv_close((uv_handle_t*) handle, close_cb); + } +} + + TEST_IMPL(fs_event_watch_dir) { #if defined(NO_FS_EVENTS) RETURN_SKIP(NO_FS_EVENTS); @@ -434,10 +454,12 @@ TEST_IMPL(fs_event_watch_dir) { return 0; } + TEST_IMPL(fs_event_watch_dir_recursive) { #if defined(__APPLE__) || defined(_WIN32) uv_loop_t* loop; int r; + uv_fs_event_t fs_event_root; /* Setup */ loop = uv_default_loop(); @@ -451,17 +473,37 @@ TEST_IMPL(fs_event_watch_dir_recursive) { r = uv_fs_event_init(loop, &fs_event); ASSERT(r == 0); - r = uv_fs_event_start(&fs_event, fs_event_cb_dir_multi_file_in_subdir, "watch_dir", UV_FS_EVENT_RECURSIVE); + r = uv_fs_event_start(&fs_event, + fs_event_cb_dir_multi_file_in_subdir, + "watch_dir", + UV_FS_EVENT_RECURSIVE); ASSERT(r == 0); r = uv_timer_init(loop, &timer); ASSERT(r == 0); r = uv_timer_start(&timer, fs_event_create_files_in_subdir, 100, 0); ASSERT(r == 0); +#ifndef _WIN32 + /* Also try to watch the root directory. + * This will be noisier, so we're just checking for any couple events to happen. */ + r = uv_fs_event_init(loop, &fs_event_root); + ASSERT(r == 0); + r = uv_fs_event_start(&fs_event_root, + fs_event_cb_close, + "/", + UV_FS_EVENT_RECURSIVE); + ASSERT(r == 0); +#else + fs_event_cb_called += 3; + close_cb_called += 1; + (void)fs_event_root; +#endif + uv_run(loop, UV_RUN_DEFAULT); - ASSERT(fs_event_cb_called == fs_event_created + fs_event_removed); - ASSERT(close_cb_called == 2); + ASSERT(fs_multievent_cb_called == fs_event_created + fs_event_removed); + ASSERT(fs_event_cb_called == 3); + ASSERT(close_cb_called == 3); /* Cleanup */ fs_event_unlink_files_in_subdir(NULL); @@ -596,6 +638,7 @@ TEST_IMPL(fs_event_watch_file_exact_path) { * versions. Give a long delay here to let the system settle before running * the test. */ uv_sleep(1100); + uv_update_time(loop); #endif r = uv_fs_event_init(loop, &fs_event); @@ -656,6 +699,13 @@ TEST_IMPL(fs_event_watch_file_current_dir) { /* Setup */ remove("watch_file"); create_file("watch_file"); +#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_12) + /* Empirically, kevent seems to (sometimes) report the preceeding + * create_file events prior to macOS 10.11.6 in the subsequent fs_event_start + * So let the system settle before running the test. */ + uv_sleep(1100); + uv_update_time(loop); +#endif r = uv_fs_event_init(loop, &fs_event); ASSERT(r == 0); @@ -864,18 +914,6 @@ TEST_IMPL(fs_event_close_with_pending_event) { return 0; } -static void fs_event_cb_close(uv_fs_event_t* handle, const char* filename, - int events, int status) { - ASSERT(status == 0); - - ASSERT(fs_event_cb_called < 3); - ++fs_event_cb_called; - - if (fs_event_cb_called == 3) { - uv_close((uv_handle_t*) handle, close_cb); - } -} - TEST_IMPL(fs_event_close_in_callback) { #if defined(NO_FS_EVENTS) RETURN_SKIP(NO_FS_EVENTS); diff --git a/deps/uv/test/test-fs-readdir.c b/deps/uv/test/test-fs-readdir.c index a767f1fb885dcd..5efc853cc67f0f 100644 --- a/deps/uv/test/test-fs-readdir.c +++ b/deps/uv/test/test-fs-readdir.c @@ -62,12 +62,12 @@ static void empty_readdir_cb(uv_fs_t* req) { ASSERT(req->fs_type == UV_FS_READDIR); ASSERT(req->result == 0); dir = req->ptr; + uv_fs_req_cleanup(req); r = uv_fs_closedir(uv_default_loop(), &closedir_req, dir, empty_closedir_cb); ASSERT(r == 0); - uv_fs_req_cleanup(req); } static void empty_opendir_cb(uv_fs_t* req) { diff --git a/deps/uv/test/test-ip4-addr.c b/deps/uv/test/test-ip4-addr.c index c72f36a694455d..dfefb0f914a6ef 100644 --- a/deps/uv/test/test-ip4-addr.c +++ b/deps/uv/test/test-ip4-addr.c @@ -42,6 +42,10 @@ TEST_IMPL(ip4_addr) { ASSERT(UV_EINVAL == uv_ip4_addr("2555.0.0.0", TEST_PORT, &addr)); ASSERT(UV_EINVAL == uv_ip4_addr("255", TEST_PORT, &addr)); +#ifdef SIN6_LEN + ASSERT(addr.sin_len == sizeof(addr)); +#endif + /* for broken address family */ ASSERT(UV_EAFNOSUPPORT == uv_inet_pton(42, "127.0.0.1", &addr.sin_addr.s_addr)); diff --git a/deps/uv/test/test-ip6-addr.c b/deps/uv/test/test-ip6-addr.c index bbf33a4854ed23..39d570659daafe 100644 --- a/deps/uv/test/test-ip6-addr.c +++ b/deps/uv/test/test-ip6-addr.c @@ -160,3 +160,12 @@ TEST_IMPL(ip6_pton) { #undef GOOD_ADDR_LIST #undef BAD_ADDR_LIST + +#ifdef SIN6_LEN +TEST_IMPL(ip6_sin6_len) { + struct sockaddr_in6 s; + ASSERT(uv_ip6_addr("::", 0, &s) < 0); + ASSERT(s.sin6_len == sizeof(s)); + return 0; +} +#endif diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index b6066f27276dc6..ad94c52d0c5866 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -395,6 +395,7 @@ TEST_DECLARE (threadpool_queue_work_einval) TEST_DECLARE (threadpool_multiple_event_loops) TEST_DECLARE (threadpool_cancel_getaddrinfo) TEST_DECLARE (threadpool_cancel_getnameinfo) +TEST_DECLARE (threadpool_cancel_random) TEST_DECLARE (threadpool_cancel_work) TEST_DECLARE (threadpool_cancel_fs) TEST_DECLARE (threadpool_cancel_single) @@ -464,6 +465,9 @@ HELPER_DECLARE (pipe_echo_server) TEST_DECLARE (queue_foreach_delete) +TEST_DECLARE (random_async) +TEST_DECLARE (random_sync) + TEST_DECLARE (handle_type_name) TEST_DECLARE (req_type_name) TEST_DECLARE (getters_setters) @@ -1000,6 +1004,7 @@ TASK_LIST_START TEST_ENTRY_CUSTOM (threadpool_multiple_event_loops, 0, 0, 60000) TEST_ENTRY (threadpool_cancel_getaddrinfo) TEST_ENTRY (threadpool_cancel_getnameinfo) + TEST_ENTRY (threadpool_cancel_random) TEST_ENTRY (threadpool_cancel_work) TEST_ENTRY (threadpool_cancel_fs) TEST_ENTRY (threadpool_cancel_single) @@ -1018,6 +1023,9 @@ TASK_LIST_START TEST_ENTRY (queue_foreach_delete) + TEST_ENTRY (random_async) + TEST_ENTRY (random_sync) + TEST_ENTRY (handle_type_name) TEST_ENTRY (req_type_name) TEST_ENTRY (getters_setters) diff --git a/deps/uv/test/test-process-title-threadsafe.c b/deps/uv/test/test-process-title-threadsafe.c index 5b30f17f44d529..19098eda0c4019 100644 --- a/deps/uv/test/test-process-title-threadsafe.c +++ b/deps/uv/test/test-process-title-threadsafe.c @@ -25,11 +25,7 @@ #include -#ifdef __APPLE__ -# define NUM_ITERATIONS 10 -#else -# define NUM_ITERATIONS 50 -#endif +#define NUM_ITERATIONS 50 static const char* titles[] = { "8L2NY0Kdj0XyNFZnmUZigIOfcWjyNr0SkMmUhKw99VLUsZFrvCQQC3XIRfNR8pjyMjXObllled", diff --git a/deps/uv/test/test-random.c b/deps/uv/test/test-random.c new file mode 100644 index 00000000000000..2e3ce4424d29eb --- /dev/null +++ b/deps/uv/test/test-random.c @@ -0,0 +1,94 @@ +/* Copyright libuv contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "task.h" + +#include + +static char scratch[256]; +static int random_cb_called; + + +static void random_cb(uv_random_t* req, int status, void* buf, size_t buflen) { + char zero[sizeof(scratch)]; + + memset(zero, 0, sizeof(zero)); + + ASSERT(0 == status); + ASSERT(buf == (void*) scratch); + + if (random_cb_called == 0) { + ASSERT(buflen == 0); + ASSERT(0 == memcmp(scratch, zero, sizeof(zero))); + } else { + ASSERT(buflen == sizeof(scratch)); + /* Buy a lottery ticket if you manage to trip this assertion. */ + ASSERT(0 != memcmp(scratch, zero, sizeof(zero))); + } + + random_cb_called++; +} + + +TEST_IMPL(random_async) { + uv_random_t req; + uv_loop_t* loop; + + loop = uv_default_loop(); + ASSERT(UV_EINVAL == uv_random(loop, &req, scratch, sizeof(scratch), -1, + random_cb)); + ASSERT(UV_E2BIG == uv_random(loop, &req, scratch, -1, -1, random_cb)); + + ASSERT(0 == uv_random(loop, &req, scratch, 0, 0, random_cb)); + ASSERT(0 == random_cb_called); + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(1 == random_cb_called); + + ASSERT(0 == uv_random(loop, &req, scratch, sizeof(scratch), 0, random_cb)); + ASSERT(1 == random_cb_called); + + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(2 == random_cb_called); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + +TEST_IMPL(random_sync) { + char zero[256]; + char buf[256]; + + ASSERT(UV_EINVAL == uv_random(NULL, NULL, buf, sizeof(buf), -1, NULL)); + ASSERT(UV_E2BIG == uv_random(NULL, NULL, buf, -1, -1, NULL)); + + memset(buf, 0, sizeof(buf)); + ASSERT(0 == uv_random(NULL, NULL, buf, sizeof(buf), 0, NULL)); + + /* Buy a lottery ticket if you manage to trip this assertion. */ + memset(zero, 0, sizeof(zero)); + ASSERT(0 != memcmp(buf, zero, sizeof(zero))); + + MAKE_VALGRIND_HAPPY(); + return 0; +} diff --git a/deps/uv/test/test-threadpool-cancel.c b/deps/uv/test/test-threadpool-cancel.c index dd13d8ae4bf1fa..be252c6f723451 100644 --- a/deps/uv/test/test-threadpool-cancel.c +++ b/deps/uv/test/test-threadpool-cancel.c @@ -37,6 +37,11 @@ struct cancel_info { uv_timer_t timer_handle; }; +struct random_info { + uv_random_t random_req; + char buf[1]; +}; + static unsigned fs_cb_called; static unsigned done_cb_called; static unsigned done2_cb_called; @@ -143,6 +148,19 @@ static void nop_done_cb(uv_work_t* req, int status) { } +static void nop_random_cb(uv_random_t* req, int status, void* buf, size_t len) { + struct random_info* ri; + + ri = container_of(req, struct random_info, random_req); + + ASSERT(status == UV_ECANCELED); + ASSERT(buf == (void*) ri->buf); + ASSERT(len == sizeof(ri->buf)); + + done_cb_called++; +} + + TEST_IMPL(threadpool_cancel_getaddrinfo) { uv_getaddrinfo_t reqs[4]; struct cancel_info ci; @@ -212,6 +230,29 @@ TEST_IMPL(threadpool_cancel_getnameinfo) { } +TEST_IMPL(threadpool_cancel_random) { + struct random_info req; + uv_loop_t* loop; + + saturate_threadpool(); + loop = uv_default_loop(); + ASSERT(0 == uv_random(loop, + &req.random_req, + &req.buf, + sizeof(req.buf), + 0, + nop_random_cb)); + ASSERT(0 == uv_cancel((uv_req_t*) &req)); + ASSERT(0 == done_cb_called); + unblock_threadpool(); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + ASSERT(1 == done_cb_called); + + MAKE_VALGRIND_HAPPY(); + return 0; +} + + TEST_IMPL(threadpool_cancel_work) { struct cancel_info ci; uv_work_t reqs[16]; diff --git a/deps/uv/test/test-udp-multicast-join.c b/deps/uv/test/test-udp-multicast-join.c index 9ee80e44e7c24a..6bac072db09631 100644 --- a/deps/uv/test/test-udp-multicast-join.c +++ b/deps/uv/test/test-udp-multicast-join.c @@ -74,7 +74,7 @@ static void sv_send_cb(uv_udp_send_t* req, int status) { static int do_send(uv_udp_send_t* send_req) { uv_buf_t buf; struct sockaddr_in addr; - + buf = uv_buf_init("PING", 4); ASSERT(0 == uv_ip4_addr(MULTICAST_ADDR, TEST_PORT, &addr)); diff --git a/deps/uv/test/test-udp-multicast-join6.c b/deps/uv/test/test-udp-multicast-join6.c index edcd371b2c22c0..5de27a7fb292db 100644 --- a/deps/uv/test/test-udp-multicast-join6.c +++ b/deps/uv/test/test-udp-multicast-join6.c @@ -86,7 +86,7 @@ static void sv_send_cb(uv_udp_send_t* req, int status) { static int do_send(uv_udp_send_t* send_req) { uv_buf_t buf; struct sockaddr_in6 addr; - + buf = uv_buf_init("PING", 4); ASSERT(0 == uv_ip6_addr(MULTICAST_ADDR, TEST_PORT, &addr)); @@ -195,7 +195,7 @@ TEST_IMPL(udp_multicast_join6) { r = uv_udp_recv_start(&server, alloc_cb, cl_recv_cb); ASSERT(r == 0); - + r = do_send(&req); ASSERT(r == 0); diff --git a/deps/uv/test/test.gyp b/deps/uv/test/test.gyp index 60792ad6ebbb57..73ff42c56e431c 100644 --- a/deps/uv/test/test.gyp +++ b/deps/uv/test/test.gyp @@ -52,6 +52,7 @@ 'test-hrtime.c', 'test-idle.c', 'test-idna.c', + 'test-ip4-addr.c', 'test-ip6-addr.c', 'test-ipc-heavy-traffic-deadlock-bug.c', 'test-ipc-send-recv.c', @@ -90,6 +91,7 @@ 'test-process-title.c', 'test-process-title-threadsafe.c', 'test-queue-foreach-delete.c', + 'test-random.c', 'test-ref.c', 'test-run-nowait.c', 'test-run-once.c', @@ -158,8 +160,6 @@ 'test-udp-multicast-join6.c', 'test-dlerror.c', 'test-udp-multicast-ttl.c', - 'test-ip4-addr.c', - 'test-ip6-addr.c', 'test-udp-multicast-interface.c', 'test-udp-multicast-interface6.c', 'test-udp-try-send.c', diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 75a6d9781995ae..051bdc937c9fd3 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -75,6 +75,7 @@ 'src/idna.h', 'src/inet.c', 'src/queue.h', + 'src/random.c', 'src/strscpy.c', 'src/strscpy.h', 'src/threadpool.c', @@ -167,6 +168,7 @@ 'src/unix/pipe.c', 'src/unix/poll.c', 'src/unix/process.c', + 'src/unix/random-devurandom.c', 'src/unix/signal.c', 'src/unix/spinlock.h', 'src/unix/stream.c', @@ -226,7 +228,8 @@ 'sources': [ 'src/unix/darwin.c', 'src/unix/fsevents.c', - 'src/unix/darwin-proctitle.c' + 'src/unix/darwin-proctitle.c', + 'src/unix/random-getentropy.c', ], 'defines': [ '_DARWIN_USE_64_BIT_INODE=1', @@ -241,6 +244,8 @@ 'src/unix/linux-syscalls.c', 'src/unix/linux-syscalls.h', 'src/unix/procfs-exepath.c', + 'src/unix/random-getrandom.c', + 'src/unix/random-sysctl.c', 'src/unix/sysinfo-loadavg.c', ], 'link_settings': { @@ -320,8 +325,14 @@ [ 'OS=="freebsd" or OS=="dragonflybsd"', { 'sources': [ 'src/unix/freebsd.c' ], }], + [ 'OS=="freebsd"', { + 'sources': [ 'src/unix/random-getrandom.c' ], + }], [ 'OS=="openbsd"', { - 'sources': [ 'src/unix/openbsd.c' ], + 'sources': [ + 'src/unix/openbsd.c', + 'src/unix/random-getentropy.c', + ], }], [ 'OS=="netbsd"', { 'link_settings': { diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index a18aeeda8711f2..ca5d9ce5d26cd7 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -1281,6 +1281,7 @@ void Context::SetEmbedderData(int index, v8::Local value) { void* Context::SlowGetAlignedPointerFromEmbedderData(int index) { const char* location = "v8::Context::GetAlignedPointerFromEmbedderData()"; + HandleScope handle_scope(GetIsolate()); i::Handle data = EmbedderDataFor(this, index, false, location); if (data.is_null()) return nullptr; diff --git a/deps/v8/src/builtins/proxy-get-prototype-of.tq b/deps/v8/src/builtins/proxy-get-prototype-of.tq index 2418eaf4230cb3..5dc185dc177523 100644 --- a/deps/v8/src/builtins/proxy-get-prototype-of.tq +++ b/deps/v8/src/builtins/proxy-get-prototype-of.tq @@ -33,7 +33,7 @@ namespace proxy { // 8. If Type(handlerProto) is neither Object nor Null, throw a TypeError // exception. - if (!Is(handlerProto)) { + if (!Is(handlerProto) && handlerProto != Null) { goto ThrowProxyGetPrototypeOfInvalid; } diff --git a/deps/v8/src/regexp/regexp-ast.h b/deps/v8/src/regexp/regexp-ast.h index aab67cad154126..3de29512ea12b0 100644 --- a/deps/v8/src/regexp/regexp-ast.h +++ b/deps/v8/src/regexp/regexp-ast.h @@ -477,7 +477,7 @@ class RegExpCapture final : public RegExpTree { int max_match() override { return body_->max_match(); } RegExpTree* body() { return body_; } void set_body(RegExpTree* body) { body_ = body; } - int index() { return index_; } + int index() const { return index_; } const ZoneVector* name() const { return name_; } void set_name(const ZoneVector* name) { name_ = name; } static int StartRegister(int index) { return index * 2; } diff --git a/deps/v8/src/regexp/regexp-parser.cc b/deps/v8/src/regexp/regexp-parser.cc index 3647680969a9d9..72da355b7cf9ed 100644 --- a/deps/v8/src/regexp/regexp-parser.cc +++ b/deps/v8/src/regexp/regexp-parser.cc @@ -984,18 +984,39 @@ RegExpCapture* RegExpParser::GetCapture(int index) { return captures_->at(index - 1); } +namespace { + +struct RegExpCaptureIndexLess { + bool operator()(const RegExpCapture* lhs, const RegExpCapture* rhs) const { + DCHECK_NOT_NULL(lhs); + DCHECK_NOT_NULL(rhs); + return lhs->index() < rhs->index(); + } +}; + +} // namespace + Handle RegExpParser::CreateCaptureNameMap() { if (named_captures_ == nullptr || named_captures_->empty()) { return Handle(); } + // Named captures are sorted by name (because the set is used to ensure + // name uniqueness). But the capture name map must to be sorted by index. + + ZoneVector sorted_named_captures( + named_captures_->begin(), named_captures_->end(), zone()); + std::sort(sorted_named_captures.begin(), sorted_named_captures.end(), + RegExpCaptureIndexLess{}); + DCHECK_EQ(sorted_named_captures.size(), named_captures_->size()); + Factory* factory = isolate()->factory(); - int len = static_cast(named_captures_->size()) * 2; + int len = static_cast(sorted_named_captures.size()) * 2; Handle array = factory->NewFixedArray(len); int i = 0; - for (const auto& capture : *named_captures_) { + for (const auto& capture : sorted_named_captures) { Vector capture_name(capture->name()->data(), capture->name()->size()); // CSA code in ConstructNewResultFromMatchInfo requires these strings to be diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 213b795edacad3..814f7dc28886d3 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -2955,8 +2955,11 @@ THREADED_TEST(SetAlignedPointerInInternalFields) { obj->SetAlignedPointerInInternalFields(2, indices, values); CcTest::CollectAllGarbage(); - CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0)); - CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1)); + { + v8::SealHandleScope no_handle_leak(isolate); + CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0)); + CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1)); + } indices[0] = 1; indices[1] = 0; @@ -3009,6 +3012,7 @@ THREADED_TEST(EmbedderDataAlignedPointers) { } CcTest::CollectAllGarbage(); for (int i = 0; i < 100; i++) { + v8::SealHandleScope no_handle_leak(env->GetIsolate()); CHECK_EQ(AlignedTestPointer(i), env->GetAlignedPointerFromEmbedderData(i)); } } diff --git a/deps/v8/test/mjsunit/harmony/regexp-named-captures.js b/deps/v8/test/mjsunit/harmony/regexp-named-captures.js index e1fa60dca42737..f58bcd9d44c22a 100644 --- a/deps/v8/test/mjsunit/harmony/regexp-named-captures.js +++ b/deps/v8/test/mjsunit/harmony/regexp-named-captures.js @@ -419,6 +419,15 @@ function toSlowMode(re) { assertEquals("cd", "abcd".replace(re, "$<$1>")); } +// Named captures are ordered by capture index on the groups object. +// https://crbug.com/v8/9822 + +{ + const r = /(?.+)\s(?.+)/; + const s = 'example string'; + assertArrayEquals(["BKey", "AKey"], Object.keys(r.exec(s).groups)); +} + // Tests for 'groups' semantics on the regexp result object. // https://crbug.com/v8/7192 diff --git a/deps/v8/test/mjsunit/regress/regress-9781.js b/deps/v8/test/mjsunit/regress/regress-9781.js new file mode 100644 index 00000000000000..6d3e3162d39c27 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-9781.js @@ -0,0 +1,11 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var proto = Object.getPrototypeOf(new Proxy(Object.create(null), { + getPrototypeOf(target) { + return Reflect.getPrototypeOf(target); + } +} )); + +assertEquals(proto, null); diff --git a/deps/v8/tools/gen-postmortem-metadata.py b/deps/v8/tools/gen-postmortem-metadata.py index b5aba23220bac8..7d159cb84679d5 100644 --- a/deps/v8/tools/gen-postmortem-metadata.py +++ b/deps/v8/tools/gen-postmortem-metadata.py @@ -49,6 +49,7 @@ # for py2/py3 compatibility from __future__ import print_function +import io import re import sys @@ -380,7 +381,7 @@ def load_objects(): def load_objects_from_file(objfilename, checktypes): - objfile = open(objfilename, 'r'); + objfile = io.open(objfilename, 'r', encoding='utf-8'); in_insttype = False; typestr = ''; @@ -575,7 +576,7 @@ def load_fields(): def load_fields_from_file(filename): - inlfile = open(filename, 'r'); + inlfile = io.open(filename, 'r', encoding='utf-8'); # # Each class's fields and the corresponding offsets are described in the diff --git a/doc/api/addons.md b/doc/api/addons.md index ca99e5e35d95cf..cf2798c3a43637 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -11,8 +11,7 @@ provide an interface between JavaScript running in Node.js and C/C++ libraries. There are three options for implementing Addons: N-API, nan, or direct use of internal V8, libuv and Node.js libraries. Unless you need direct access to functionality which is not exposed by N-API, use N-API. -Refer to the section [C/C++ Addons - N-API](n-api.html) -for more information on N-API. +Refer to [C/C++ Addons with N-API](n-api.html) for more information on N-API. When not using N-API, implementing Addons is complicated, involving knowledge of several components and APIs: @@ -35,16 +34,14 @@ involving knowledge of several components and APIs: off-loading work via libuv to non-blocking system operations, worker threads or a custom use of libuv's threads. -* Internal Node.js libraries. Node.js itself exports a number of C++ APIs - that Addons can use — the most important of which is the - `node::ObjectWrap` class. +* Internal Node.js libraries. Node.js itself exports C++ APIs that Addons can + use, the most important of which is the `node::ObjectWrap` class. -* Node.js includes a number of other statically linked libraries including - OpenSSL. These other libraries are located in the `deps/` directory in the - Node.js source tree. Only the libuv, OpenSSL, V8 and zlib symbols are - purposefully re-exported by Node.js and may be used to various extents by - Addons. - See [Linking to Node.js' own dependencies][] for additional information. +* Node.js includes other statically linked libraries including OpenSSL. These + other libraries are located in the `deps/` directory in the Node.js source + tree. Only the libuv, OpenSSL, V8 and zlib symbols are purposefully + re-exported by Node.js and may be used to various extents by Addons. See + [Linking to Node.js' own dependencies][] for additional information. All of the following examples are available for [download][] and may be used as the starting-point for an Addon. @@ -332,12 +329,12 @@ try { ### Linking to Node.js' own dependencies -Node.js uses a number of statically linked libraries such as V8, libuv and -OpenSSL. All Addons are required to link to V8 and may link to any of the -other dependencies as well. Typically, this is as simple as including -the appropriate `#include <...>` statements (e.g. `#include `) and -`node-gyp` will locate the appropriate headers automatically. However, there -are a few caveats to be aware of: +Node.js uses statically linked libraries such as V8, libuv and OpenSSL. All +Addons are required to link to V8 and may link to any of the other dependencies +as well. Typically, this is as simple as including the appropriate +`#include <...>` statements (e.g. `#include `) and `node-gyp` will locate +the appropriate headers automatically. However, there are a few caveats to be +aware of: * When `node-gyp` runs, it will detect the specific release version of Node.js and download either the full source tarball or just the headers. If the full @@ -367,13 +364,12 @@ and load it instead. ## Native Abstractions for Node.js Each of the examples illustrated in this document make direct use of the -Node.js and V8 APIs for implementing Addons. It is important to understand -that the V8 API can, and has, changed dramatically from one V8 release to the -next (and one major Node.js release to the next). With each change, Addons may -need to be updated and recompiled in order to continue functioning. The Node.js -release schedule is designed to minimize the frequency and impact of such -changes but there is little that Node.js can do currently to ensure stability -of the V8 APIs. +Node.js and V8 APIs for implementing Addons. The V8 API can, and has, changed +dramatically from one V8 release to the next (and one major Node.js release to +the next). With each change, Addons may need to be updated and recompiled in +order to continue functioning. The Node.js release schedule is designed to +minimize the frequency and impact of such changes but there is little that +Node.js can do currently to ensure stability of the V8 APIs. The [Native Abstractions for Node.js][] (or `nan`) provide a set of tools that Addon developers are recommended to use to keep compatibility between past and @@ -435,8 +431,8 @@ NAPI_MODULE(NODE_GYP_MODULE_NAME, init) } // namespace demo ``` -The functions available and how to use them are documented in the -section titled [C/C++ Addons - N-API](n-api.html). +The functions available and how to use them are documented in +[C/C++ Addons with N-API](n-api.html). ## Addon examples diff --git a/doc/api/buffer.md b/doc/api/buffer.md index b1fa5167d0de53..e46e7f0994cff3 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -182,28 +182,28 @@ console.log(Buffer.from('fhqwhgads', 'utf16le')); The character encodings currently supported by Node.js include: -* `'ascii'` - For 7-bit ASCII data only. This encoding is fast and will strip +* `'ascii'`: For 7-bit ASCII data only. This encoding is fast and will strip the high bit if set. -* `'utf8'` - Multibyte encoded Unicode characters. Many web pages and other +* `'utf8'`: Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8. -* `'utf16le'` - 2 or 4 bytes, little-endian encoded Unicode characters. +* `'utf16le'`: 2 or 4 bytes, little-endian encoded Unicode characters. Surrogate pairs (U+10000 to U+10FFFF) are supported. -* `'ucs2'` - Alias of `'utf16le'`. +* `'ucs2'`: Alias of `'utf16le'`. -* `'base64'` - Base64 encoding. When creating a `Buffer` from a string, +* `'base64'`: Base64 encoding. When creating a `Buffer` from a string, this encoding will also correctly accept "URL and Filename Safe Alphabet" as specified in [RFC 4648, Section 5][]. -* `'latin1'` - A way of encoding the `Buffer` into a one-byte encoded string +* `'latin1'`: A way of encoding the `Buffer` into a one-byte encoded string (as defined by the IANA in [RFC 1345][], page 63, to be the Latin-1 supplement block and C0/C1 control codes). -* `'binary'` - Alias for `'latin1'`. +* `'binary'`: Alias for `'latin1'`. -* `'hex'` - Encode each byte as two hexadecimal characters. +* `'hex'`: Encode each byte as two hexadecimal characters. Modern Web browsers follow the [WHATWG Encoding Standard][] which aliases both `'latin1'` and `'ISO-8859-1'` to `'win-1252'`. This means that while doing @@ -1003,8 +1003,8 @@ The index operator `[index]` can be used to get and set the octet at position range is between `0x00` and `0xFF` (hex) or `0` and `255` (decimal). This operator is inherited from `Uint8Array`, so its behavior on out-of-bounds -access is the same as `UInt8Array` - that is, getting returns `undefined` and -setting does nothing. +access is the same as `UInt8Array`. In other words, getting returns `undefined` +and setting does nothing. ```js // Copy an ASCII string into a `Buffer` one byte at a time. diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 9f153175a1cc52..24dd6269f16674 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -361,7 +361,7 @@ 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 +Keep in mind that spawned Node.js child processes are independent of the parent with exception of the IPC communication channel that is established between the two. Each process has its own memory, with their own V8 instances. Because of the additional resource allocations @@ -599,21 +599,21 @@ equal to `['pipe', 'pipe', 'pipe']`. For convenience, `options.stdio` may be one of the following strings: -* `'pipe'` - equivalent to `['pipe', 'pipe', 'pipe']` (the default) -* `'ignore'` - equivalent to `['ignore', 'ignore', 'ignore']` -* `'inherit'` - equivalent to `['inherit', 'inherit', 'inherit']` or `[0, 1, 2]` +* `'pipe'`: equivalent to `['pipe', 'pipe', 'pipe']` (the default) +* `'ignore'`: equivalent to `['ignore', 'ignore', 'ignore']` +* `'inherit'`: equivalent to `['inherit', 'inherit', 'inherit']` or `[0, 1, 2]` Otherwise, the value of `options.stdio` is an array where each index corresponds to an fd in the child. The fds 0, 1, and 2 correspond to stdin, stdout, and stderr, respectively. Additional fds can be specified to create additional pipes between the parent and child. The value is one of the following: -1. `'pipe'` - Create a pipe between the child process and the parent process. +1. `'pipe'`: Create a pipe between the child process and the parent process. The parent end of the pipe is exposed to the parent as a property on the `child_process` object as [`subprocess.stdio[fd]`][`subprocess.stdio`]. Pipes - created for fds 0 - 2 are also available as [`subprocess.stdin`][], + created for fds 0, 1, and 2 are also available as [`subprocess.stdin`][], [`subprocess.stdout`][] and [`subprocess.stderr`][], respectively. -2. `'ipc'` - Create an IPC channel for passing messages/file descriptors +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 @@ -624,25 +624,25 @@ pipes between the parent and child. The value is one of the following: 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 is not supported. -3. `'ignore'` - Instructs Node.js to ignore the fd in the child. While Node.js - will always open fds 0 - 2 for the processes it spawns, setting the fd to - `'ignore'` will cause Node.js to open `/dev/null` and attach it to the +3. `'ignore'`: Instructs Node.js to ignore the fd in the child. While Node.js + will always open fds 0, 1, and 2 for the processes it spawns, setting the fd + to `'ignore'` will cause Node.js to open `/dev/null` and attach it to the child's fd. -4. `'inherit'` - Pass through the corresponding stdio stream to/from the +4. `'inherit'`: Pass through the corresponding stdio stream to/from the parent process. In the first three positions, this is equivalent to `process.stdin`, `process.stdout`, and `process.stderr`, respectively. In any other position, equivalent to `'ignore'`. -5. {Stream} object - Share a readable or writable stream that refers to a tty, +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. 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 +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. Passing sockets is not supported on Windows. -7. `null`, `undefined` - Use default value. For stdio fds 0, 1, and 2 (in other +7. `null`, `undefined`: Use default value. For stdio fds 0, 1, and 2 (in other words, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the default is `'ignore'`. @@ -955,7 +955,7 @@ The `'error'` event is emitted whenever: 3. Sending a message to the child process failed. The `'exit'` event may or may not fire after an error has occurred. When -listening to both the `'exit'` and `'error'` events, it is important to guard +listening to both the `'exit'` and `'error'` events, guard against accidentally invoking handler functions multiple times. See also [`subprocess.kill()`][] and [`subprocess.send()`][]. diff --git a/doc/api/cli.md b/doc/api/cli.md index 600137150a2c30..f9eb87e2b7081c 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -39,7 +39,7 @@ For example, `--pending-deprecation` is equivalent to `--pending_deprecation`. added: v8.0.0 --> -Alias for stdin, analogous to the use of - in other command line utilities, +Alias for stdin. Analogous to the use of `-` in other command line utilities, meaning that the script will be read from stdin, and the rest of the options are passed to that script. @@ -144,6 +144,9 @@ added: v12.12.0 Enable experimental Source Map V3 support for stack traces. +Currently, overriding `Error.prepareStackTrace` is ignored when the +`--enable-source-maps` flag is set. + ### `--es-module-specifier-resolution=mode` Enables a signal handler that causes the Node.js process to write a heap dump -when the specified signal is received. +when the specified signal is received. `signal` must be a valid signal name. +Disabled by default. ```console $ node --heapsnapshot-signal=SIGUSR2 index.js & @@ -307,9 +311,6 @@ added: v12.4.0 Specify the file name of the heap profile generated by `--heap-prof`. -Generates a heap snapshot each time the process receives the specified signal. -`signal` must be a valid signal name. Disabled by default. - ### `--http-parser=library` + @@ -3204,7 +3204,6 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
    Constant
    ### OpenSSL Engine Constants - diff --git a/doc/api/debugger.md b/doc/api/debugger.md index 318b44de61df79..823574f1bc1b69 100644 --- a/doc/api/debugger.md +++ b/doc/api/debugger.md @@ -104,21 +104,21 @@ To begin watching an expression, type `watch('my_expression')`. The command ### Stepping -* `cont`, `c` - Continue execution -* `next`, `n` - Step next -* `step`, `s` - Step in -* `out`, `o` - Step out -* `pause` - Pause running code (like pause button in Developer Tools) +* `cont`, `c`: Continue execution +* `next`, `n`: Step next +* `step`, `s`: Step in +* `out`, `o`: Step out +* `pause`: Pause running code (like pause button in Developer Tools) ### Breakpoints -* `setBreakpoint()`, `sb()` - Set breakpoint on current line -* `setBreakpoint(line)`, `sb(line)` - Set breakpoint on specific line -* `setBreakpoint('fn()')`, `sb(...)` - Set breakpoint on a first statement in +* `setBreakpoint()`, `sb()`: Set breakpoint on current line +* `setBreakpoint(line)`, `sb(line)`: Set breakpoint on specific line +* `setBreakpoint('fn()')`, `sb(...)`: Set breakpoint on a first statement in functions body -* `setBreakpoint('script.js', 1)`, `sb(...)` - Set breakpoint on first line of +* `setBreakpoint('script.js', 1)`, `sb(...)`: Set breakpoint on first line of `script.js` -* `clearBreakpoint('script.js', 1)`, `cb(...)` - Clear breakpoint in `script.js` +* `clearBreakpoint('script.js', 1)`, `cb(...)`: Clear breakpoint in `script.js` on line 1 It is also possible to set a breakpoint in a file (module) that @@ -147,26 +147,26 @@ debug> ### Information -* `backtrace`, `bt` - Print backtrace of current execution frame -* `list(5)` - List scripts source code with 5 line context (5 lines before and +* `backtrace`, `bt`: Print backtrace of current execution frame +* `list(5)`: List scripts source code with 5 line context (5 lines before and after) -* `watch(expr)` - Add expression to watch list -* `unwatch(expr)` - Remove expression from watch list -* `watchers` - List all watchers and their values (automatically listed on each +* `watch(expr)`: Add expression to watch list +* `unwatch(expr)`: Remove expression from watch list +* `watchers`: List all watchers and their values (automatically listed on each breakpoint) -* `repl` - Open debugger's repl for evaluation in debugging script's context -* `exec expr` - Execute an expression in debugging script's context +* `repl`: Open debugger's repl for evaluation in debugging script's context +* `exec expr`: Execute an expression in debugging script's context ### Execution control -* `run` - Run script (automatically runs on debugger's start) -* `restart` - Restart script -* `kill` - Kill script +* `run`: Run script (automatically runs on debugger's start) +* `restart`: Restart script +* `kill`: Kill script ### Various -* `scripts` - List all loaded scripts -* `version` - Display V8's version +* `scripts`: List all loaded scripts +* `version`: Display V8's version ## Advanced Usage diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 2db1ec9c77a05e..78d9d06ef5b2ea 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -141,17 +141,17 @@ API usability issues that can lead to accidental security issues. As an alternative, use one of the following methods of constructing `Buffer` objects: -* [`Buffer.alloc(size[, fill[, encoding]])`][alloc] - Create a `Buffer` with +* [`Buffer.alloc(size[, fill[, encoding]])`][alloc]: Create a `Buffer` with *initialized* memory. -* [`Buffer.allocUnsafe(size)`][alloc_unsafe_size] - Create a `Buffer` with +* [`Buffer.allocUnsafe(size)`][alloc_unsafe_size]: Create a `Buffer` with *uninitialized* memory. -* [`Buffer.allocUnsafeSlow(size)`][] - Create a `Buffer` with *uninitialized* +* [`Buffer.allocUnsafeSlow(size)`][]: Create a `Buffer` with *uninitialized* memory. -* [`Buffer.from(array)`][] - Create a `Buffer` with a copy of `array` +* [`Buffer.from(array)`][]: Create a `Buffer` with a copy of `array` * [`Buffer.from(arrayBuffer[, byteOffset[, length]])`][from_arraybuffer] - Create a `Buffer` that wraps the given `arrayBuffer`. -* [`Buffer.from(buffer)`][] - Create a `Buffer` that copies `buffer`. -* [`Buffer.from(string[, encoding])`][from_string_encoding] - Create a `Buffer` +* [`Buffer.from(buffer)`][]: Create a `Buffer` that copies `buffer`. +* [`Buffer.from(string[, encoding])`][from_string_encoding]: Create a `Buffer` that copies `string`. Without `--pending-deprecation`, runtime warnings occur only for code not in diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 9efd14c89e00d7..041bc01c4131ca 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -433,7 +433,7 @@ client.send([buf1, buf2], 41234, (err) => { ``` Sending multiple buffers might be faster or slower depending on the -application and operating system. It is important to run benchmarks to +application and operating system. Run benchmarks to determine the optimal strategy on a case-by-case basis. Generally speaking, however, sending multiple buffers is faster. @@ -589,8 +589,7 @@ packet is allowed to travel through, specifically for multicast traffic. Each router or gateway that forwards a packet decrements the TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. -The argument passed to `socket.setMulticastTTL()` is a number of hops -between 0 and 255. The default on most systems is `1` but can vary. +The `ttl` argument may be between 0 and 255. The default on most systems is `1`. ### socket.setRecvBufferSize(size) -* `type` {string} - Either `'udp4'` or `'udp6'`. -* `callback` {Function} - Attached as a listener to `'message'` events. +* `type` {string} Either `'udp4'` or `'udp6'`. +* `callback` {Function} Attached as a listener to `'message'` events. * Returns: {dgram.Socket} Creates a `dgram.Socket` object of the specified `type`. diff --git a/doc/api/esm.md b/doc/api/esm.md index e585ae4db63646..2fe6ffc2a9f050 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -286,7 +286,7 @@ throw when an attempt is made to import them: ```js import submodule from 'es-module-package/private-module.js'; -// Throws - Module not found +// Throws ERR_MODULE_NOT_FOUND ``` > Note: this is not a strong encapsulation as any private modules can still be diff --git a/doc/api/events.md b/doc/api/events.md index 5eeab1856b7cee..ec6f608609073f 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -43,7 +43,7 @@ myEmitter.emit('event'); ## Passing arguments and `this` to listeners The `eventEmitter.emit()` method allows an arbitrary set of arguments to be -passed to the listener functions. It is important to keep in mind that when +passed to the listener functions. Keep in mind that when an ordinary listener function is called, the standard `this` keyword is intentionally set to reference the `EventEmitter` instance to which the listener is attached. @@ -77,8 +77,8 @@ myEmitter.emit('event', 'a', 'b'); ## Asynchronous vs. Synchronous The `EventEmitter` calls all listeners synchronously in the order in which -they were registered. This is important to ensure the proper sequencing of -events and to avoid race conditions or logic errors. When appropriate, +they were registered. This ensures the proper sequencing of +events and helps avoid race conditions and logic errors. When appropriate, listener functions can switch to an asynchronous mode of operation using the `setImmediate()` or `process.nextTick()` methods: diff --git a/doc/api/fs.md b/doc/api/fs.md index 9de4e95c48a175..78b7b3af2f8d36 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -291,7 +291,8 @@ added: v12.12.0 A class representing a directory stream. -Created by [`fs.opendir()`][], [`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. +Created by [`fs.opendir()`][], [`fs.opendirSync()`][], or +[`fsPromises.opendir()`][]. ```js const fs = require('fs'); @@ -305,16 +306,6 @@ async function print(path) { print('./').catch(console.error); ``` -### dir.path - - -* {string} - -The read-only path of this directory as was provided to [`fs.opendir()`][], -[`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. - ### dir.close() + +* {string} + +The read-only path of this directory as was provided to [`fs.opendir()`][], +[`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. + ### dir.read() -A representation of a directory entry, as returned by reading from an [`fs.Dir`][]. +A representation of a directory entry, as returned by reading from an +[`fs.Dir`][]. Additionally, when [`fs.readdir()`][] or [`fs.readdirSync()`][] is called with the `withFileTypes` option set to `true`, the resulting array is filled with @@ -972,15 +982,15 @@ representation. The times in the stat object have the following semantics: -* `atime` "Access Time" - Time when file data last accessed. Changed +* `atime` "Access Time": Time when file data last accessed. Changed by the mknod(2), utimes(2), and read(2) system calls. -* `mtime` "Modified Time" - Time when file data last modified. +* `mtime` "Modified Time": Time when file data last modified. Changed by the mknod(2), utimes(2), and write(2) system calls. -* `ctime` "Change Time" - Time when file status was last changed +* `ctime` "Change Time": Time when file status was last changed (inode data modification). Changed by the chmod(2), chown(2), link(2), mknod(2), rename(2), unlink(2), utimes(2), read(2), and write(2) system calls. -* `birthtime` "Birth Time" - Time of file creation. Set once when the +* `birthtime` "Birth Time": Time of file creation. Set once when the file is created. On filesystems where birthtime is not available, this field may instead hold either the `ctime` or `1970-01-01T00:00Z` (ie, Unix epoch timestamp `0`). This value may be greater @@ -1561,12 +1571,12 @@ of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). -* `fs.constants.COPYFILE_EXCL` - The copy operation will fail if `dest` already +* `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already exists. -* `fs.constants.COPYFILE_FICLONE` - The copy operation will attempt to create a +* `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then a fallback copy mechanism is used. -* `fs.constants.COPYFILE_FICLONE_FORCE` - The copy operation will attempt to +* `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then the operation will fail. @@ -1609,12 +1619,12 @@ of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). -* `fs.constants.COPYFILE_EXCL` - The copy operation will fail if `dest` already +* `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already exists. -* `fs.constants.COPYFILE_FICLONE` - The copy operation will attempt to create a +* `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then a fallback copy mechanism is used. -* `fs.constants.COPYFILE_FICLONE_FORCE` - The copy operation will attempt to +* `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to create a copy-on-write reflink. If the platform does not support copy-on-write, then the operation will fail. @@ -2612,33 +2622,6 @@ a colon, Node.js will open a file system stream, as described by Functions based on `fs.open()` exhibit this behavior as well: `fs.writeFile()`, `fs.readFile()`, etc. -## fs.openSync(path\[, flags, mode\]) - - -* `path` {string|Buffer|URL} -* `flags` {string|number} **Default:** `'r'`. - See [support of file system `flags`][]. -* `mode` {integer} **Default:** `0o666` -* Returns: {number} - -Returns an integer representing the file descriptor. - -For detailed information, see the documentation of the asynchronous version of -this API: [`fs.open()`][]. - ## fs.opendir(path\[, options\], callback) + +* `path` {string|Buffer|URL} +* `flags` {string|number} **Default:** `'r'`. + See [support of file system `flags`][]. +* `mode` {integer} **Default:** `0o666` +* Returns: {number} + +Returns an integer representing the file descriptor. + +For detailed information, see the documentation of the asynchronous version of +this API: [`fs.open()`][]. + ## fs.read(fd, buffer, offset, length, position, callback) @@ -5361,31 +5371,31 @@ The following constants are meant for use with the [`fs.Stats`][] object's ## File System Flags The following flags are available wherever the `flag` option takes a -string: +string. -* `'a'` - Open file for appending. +* `'a'`: Open file for appending. The file is created if it does not exist. -* `'ax'` - Like `'a'` but fails if the path exists. +* `'ax'`: Like `'a'` but fails if the path exists. -* `'a+'` - Open file for reading and appending. +* `'a+'`: Open file for reading and appending. The file is created if it does not exist. -* `'ax+'` - Like `'a+'` but fails if the path exists. +* `'ax+'`: Like `'a+'` but fails if the path exists. -* `'as'` - Open file for appending in synchronous mode. +* `'as'`: Open file for appending in synchronous mode. The file is created if it does not exist. -* `'as+'` - Open file for reading and appending in synchronous mode. +* `'as+'`: Open file for reading and appending in synchronous mode. The file is created if it does not exist. -* `'r'` - Open file for reading. +* `'r'`: Open file for reading. An exception occurs if the file does not exist. -* `'r+'` - Open file for reading and writing. +* `'r+'`: Open file for reading and writing. An exception occurs if the file does not exist. -* `'rs+'` - Open file for reading and writing in synchronous mode. Instructs +* `'rs+'`: Open file for reading and writing in synchronous mode. Instructs the operating system to bypass the local file system cache. This is primarily useful for opening files on NFS mounts as it allows @@ -5396,15 +5406,15 @@ string: blocking call. If synchronous operation is desired, something like `fs.openSync()` should be used. -* `'w'` - Open file for writing. +* `'w'`: Open file for writing. The file is created (if it does not exist) or truncated (if it exists). -* `'wx'` - Like `'w'` but fails if the path exists. +* `'wx'`: Like `'w'` but fails if the path exists. -* `'w+'` - Open file for reading and writing. +* `'w+'`: Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists). -* `'wx+'` - Like `'w+'` but fails if the path exists. +* `'wx+'`: Like `'w+'` but fails if the path exists. `flag` can also be a number as documented by open(2); commonly used constants are available from `fs.constants`. On Windows, flags are translated to @@ -5424,7 +5434,7 @@ Modifying a file rather than replacing it may require a flags mode of `'r+'` rather than the default mode `'w'`. The behavior of some flags are platform-specific. As such, opening a directory -on macOS and Linux with the `'a+'` flag - see example below - will return an +on macOS and Linux with the `'a+'` flag, as in the example below, will return an error. In contrast, on Windows and FreeBSD, a file descriptor or a `FileHandle` will be returned. @@ -5451,6 +5461,7 @@ the file contents. [`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding [`Buffer`]: buffer.html#buffer_buffer [`FSEvents`]: https://developer.apple.com/documentation/coreservices/file_system_events +[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER [`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw [`ReadStream`]: #fs_class_fs_readstream [`URL`]: url.html#url_the_whatwg_url_api @@ -5497,7 +5508,6 @@ the file contents. [`net.Socket`]: net.html#net_class_net_socket [`stat()`]: fs.html#fs_fs_stat_path_options_callback [`util.promisify()`]: util.html#util_util_promisify_original -[bigints]: https://tc39.github.io/proposal-bigint [Caveats]: #fs_caveats [Common System Errors]: errors.html#errors_common_system_errors [FS Constants]: #fs_fs_constants_1 @@ -5507,7 +5517,7 @@ the file contents. [MSDN-Rel-Path]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#fully-qualified-vs-relative-paths [MSDN-Using-Streams]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams [Naming Files, Paths, and Namespaces]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file +[bigints]: https://tc39.github.io/proposal-bigint [chcp]: https://ss64.com/nt/chcp.html [inode]: https://en.wikipedia.org/wiki/Inode [support of file system `flags`]: #fs_file_system_flags -[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER diff --git a/doc/api/globals.md b/doc/api/globals.md index a794cfb1961781..8b112c467d0acb 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -13,9 +13,9 @@ to be global but are not. They exist only in the scope of modules, see the * [`module`][] * [`require()`][] -The objects listed here are specific to Node.js. There are a number of -[built-in objects][] that are part of the JavaScript language itself, which are -also globally accessible. +The objects listed here are specific to Node.js. There are [built-in objects][] +that are part of the JavaScript language itself, which are also globally +accessible. ## Class: Buffer The semantics of Node.js's `require()` function were designed to be general -enough to support a number of reasonable directory structures. Package manager -programs such as `dpkg`, `rpm`, and `npm` will hopefully find it possible to -build native packages from Node.js modules without modification. +enough to support reasonable directory structures. Package manager programs +such as `dpkg`, `rpm`, and `npm` will hopefully find it possible to build +native packages from Node.js modules without modification. Below we give a suggested directory structure that could work: @@ -103,13 +103,13 @@ resolves symlinks), and then looks for their dependencies in the `node_modules` folders as described [here](#modules_loading_from_node_modules_folders), this situation is very simple to resolve with the following architecture: -* `/usr/lib/node/foo/1.2.3/` - Contents of the `foo` package, version 1.2.3. -* `/usr/lib/node/bar/4.3.2/` - Contents of the `bar` package that `foo` - depends on. -* `/usr/lib/node/foo/1.2.3/node_modules/bar` - Symbolic link to +* `/usr/lib/node/foo/1.2.3/`: Contents of the `foo` package, version 1.2.3. +* `/usr/lib/node/bar/4.3.2/`: Contents of the `bar` package that `foo` depends + on. +* `/usr/lib/node/foo/1.2.3/node_modules/bar`: Symbolic link to `/usr/lib/node/bar/4.3.2/`. -* `/usr/lib/node/bar/4.3.2/node_modules/*` - Symbolic links to the packages - that `bar` depends on. +* `/usr/lib/node/bar/4.3.2/node_modules/*`: Symbolic links to the packages that + `bar` depends on. Thus, even if a cycle is encountered, or if there are dependency conflicts, every module will be able to get a version of its dependency @@ -159,6 +159,7 @@ require(X) from module at path Y 3. If X begins with './' or '/' or '../' a. LOAD_AS_FILE(Y + X) b. LOAD_AS_DIRECTORY(Y + X) + c. THROW "not found" 4. LOAD_NODE_MODULES(X, dirname(Y)) 5. THROW "not found" diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 74e341c2e59139..afd3b3344d36f9 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -14,11 +14,10 @@ changes in the underlying JavaScript engine and allow modules compiled for one major version to run on later major versions of Node.js without recompilation. The [ABI Stability][] guide provides a more in-depth explanation. -Addons are built/packaged with the same approach/tools -outlined in the section titled [C++ Addons](addons.html). -The only difference is the set of APIs that are used by the native code. -Instead of using the V8 or [Native Abstractions for Node.js][] APIs, -the functions available in the N-API are used. +Addons are built/packaged with the same approach/tools outlined in the section +titled [C++ Addons][]. The only difference is the set of APIs that are used by +the native code. Instead of using the V8 or [Native Abstractions for Node.js][] +APIs, the functions available in the N-API are used. APIs exposed by N-API are generally used to create and manipulate JavaScript values. Concepts and operations generally map to ideas specified @@ -76,8 +75,7 @@ if (status != napi_ok) { The end result is that the addon only uses the exported C APIs. As a result, it still gets the benefits of the ABI stability provided by the C API. -When using `node-addon-api` instead of the C APIs, start with the API -[docs](https://github.com/nodejs/node-addon-api#api-documentation) +When using `node-addon-api` instead of the C APIs, start with the API [docs][] for `node-addon-api`. ## Implications of ABI Stability @@ -118,11 +116,95 @@ must make use exclusively of N-API by restricting itself to using and by checking, for all external libraries that it uses, that the external library makes ABI stability guarantees similar to N-API. +## Building + +Unlike modules written in JavaScript, developing and deploying Node.js +native addons using N-API requires an additional set of tools. Besides the +basic tools required to develop for Node.js, the native addon developer +requires a toolchain that can compile C and C++ code into a binary. In +addition, depending upon how the native addon is deployed, the *user* of +the native addon will also need to have a C/C++ toolchain installed. + +For Linux developers, the necessary C/C++ toolchain packages are readily +available. [GCC][] is widely used in the Node.js community to build and +test across a variety of plarforms. For many developers, the [LLVM][] +compiler infrastructure is also a good choice. + +For Mac developers, [Xcode][] offers all the required compiler tools. +However, it is not necessary to install the entire Xcode IDE. The following +command installs the necessary toolchain: + +```bash +xcode-select --install +``` + +For Windows developers, [Visual Studio][] offers all the required compiler +tools. However, it is not necessary to install the entire Visual Studio +IDE. The following command installs the necessary toolchain: + +```bash +npm install --global --production windows-build-tools +``` + +The sections below describe the additional tools available for developing +and deploying Node.js native addons. + +### Build tools + +Both the tools listed here require that *users* of the native +addon have a C/C++ toolchain installed in order to successfully install +the native addon. + +#### node-gyp + +[node-gyp][] is a build system based on Google's [GYP][] tool and comes +bundled with npm. GYP, and therefore node-gyp, requires that Python be +installed. + +Historically, node-gyp has been the tool of choice for building native +addons. It has widespread adoption and documentation. However, some +developers have run into limitations in node-gyp. + +#### CMake.js + +[CMake.js][] is an alternative build system based on [CMake][]. + +CMake.js is a good choice for projects that already use CMake or for +developers affected by limitations in node-gyp. + +### Uploading precompiled binaries + +The three tools listed here permit native addon developers and maintainers +to create and upload binaries to public or private servers. These tools are +typically integrated with CI/CD build systems like [Travis CI][] and +[AppVeyor][] to build and upload binaries for a variety of platforms and +architectures. These binaries are then available for download by users who +do not need to have a C/C++ toolchain installed. + +#### node-pre-gyp + +[node-pre-gyp][] is a tool based on node-gyp that adds the ability to +upload binaries to a server of the developer's choice. node-pre-gyp has +particularly good support for uploading binaries to Amazon S3. + +#### prebuild + +[prebuild][] is a tool that supports builds using either node-gyp or +CMake.js. Unlike node-pre-gyp which supports a variety of servers, prebuild +uploads binaries only to [GitHub releases][]. prebuild is a good choice for +GitHub projects using CMake.js. + +#### prebuildify + +[prebuildify][] is tool based on node-gyp. The advantage of prebuildify is +that the built binaries are bundled with the native module when it's +uploaded to npm. The binaries are downloaded from npm and are immediately +available to the module user when the native module is installed. + ## Usage -In order to use the N-API functions, include the file -[`node_api.h`](https://github.com/nodejs/node/blob/master/src/node_api.h) -which is located in the src directory in the node development tree: +In order to use the N-API functions, include the file [`node_api.h`][] which is +located in the src directory in the node development tree: ```C #include @@ -726,11 +808,11 @@ When an exception is pending one of two approaches can be employed. The first approach is to do any appropriate cleanup and then return so that execution will return to JavaScript. As part of the transition back to -JavaScript the exception will be thrown at the point in the JavaScript +JavaScript, the exception will be thrown at the point in the JavaScript code where the native method was invoked. The behavior of most N-API calls is unspecified while an exception is pending, and many will simply return -`napi_pending_exception`, so it is important to do as little as possible -and then return to JavaScript where the exception can be handled. +`napi_pending_exception`, so do as little as possible and then return to +JavaScript where the exception can be handled. The second approach is to try to handle the exception. There will be cases where the native code can catch the exception, take the appropriate action, @@ -1662,9 +1744,8 @@ Returns `napi_ok` if the API succeeded. This API returns an N-API value corresponding to a JavaScript `Array` type. The `Array`'s length property is set to the passed-in length parameter. However, the underlying buffer is not guaranteed to be pre-allocated by the VM -when the array is created - that behavior is left to the underlying VM -implementation. -If the buffer must be a contiguous block of memory that can be +when the array is created. That behavior is left to the underlying VM +implementation. If the buffer must be a contiguous block of memory that can be directly read and/or written via C, consider using [`napi_create_external_arraybuffer`][]. @@ -2385,18 +2466,18 @@ napi_status napi_get_typedarray_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] typedarray`: `napi_value` representing the `TypedArray` whose -properties to query. + properties to query. * `[out] type`: Scalar datatype of the elements within the `TypedArray`. * `[out] length`: The number of elements in the `TypedArray`. * `[out] data`: The data buffer underlying the `TypedArray` adjusted by -the `byte_offset` value so that it points to the first element in the -`TypedArray`. + the `byte_offset` value so that it points to the first element in the + `TypedArray`. * `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`. * `[out] byte_offset`: The byte offset within the underlying native array -at which the first element of the arrays is located. The value for the data -parameter has already been adjusted so that data points to the first element -in the array. Therefore, the first byte of the native array would be at -data - `byte_offset`. + at which the first element of the arrays is located. The value for the data + parameter has already been adjusted so that data points to the first element + in the array. Therefore, the first byte of the native array would be at + `data - byte_offset`. Returns `napi_ok` if the API succeeded. @@ -2847,7 +2928,7 @@ Returns `napi_ok` if the API succeeded. This API returns the Undefined object. -## Working with JavaScript Values - Abstract Operations +## Working with JavaScript Values and Abstract Operations N-API exposes a set of APIs to perform some abstract operations on JavaScript values. Some of these operations are documented under [Section 7][] @@ -3310,17 +3391,15 @@ attributes listed in [Section 6.1.7.1][] of the [ECMAScript Language Specification][]. They can be one or more of the following bitflags: -* `napi_default` - Used to indicate that no explicit attributes are set on the -given property. By default, a property is read only, not enumerable and not -configurable. -* `napi_writable` - Used to indicate that a given property is writable. -* `napi_enumerable` - Used to indicate that a given property is enumerable. -* `napi_configurable` - Used to indicate that a given property is configurable, -as defined in [Section 6.1.7.1][] of the [ECMAScript Language Specification][]. -* `napi_static` - Used to indicate that the property will be defined as -a static property on a class as opposed to an instance property, which is the -default. This is used only by [`napi_define_class`][]. It is ignored by -`napi_define_properties`. +* `napi_default`: No explicit attributes are set on the property. By default, a + property is read only, not enumerable and not configurable. +* `napi_writable`: The property is writable. +* `napi_enumerable`: The property is enumerable. +* `napi_configurable`: The property is configurable as defined in + [Section 6.1.7.1][] of the [ECMAScript Language Specification][]. +* `napi_static`: The property will be defined as a static property on a class as + opposed to an instance property, which is the default. This is used only by + [`napi_define_class`][]. It is ignored by `napi_define_properties`. #### napi_property_descriptor @@ -4239,8 +4318,7 @@ required in order to enable correct disposal of the reference. Addon modules often need to leverage async helpers from libuv as part of their implementation. This allows them to schedule work to be executed asynchronously so that their methods can return in advance of the work being completed. This -is important in order to allow them to avoid blocking overall execution -of the Node.js application. +allows them to avoid blocking overall execution of the Node.js application. N-API provides an ABI-stable interface for these supporting functions which covers the most common asynchronous use cases. @@ -4631,8 +4709,6 @@ that points to its own memory allocated by a native module). Registering externally allocated memory will trigger global garbage collections more often than it would otherwise. - - ## Promises N-API provides facilities for creating `Promise` objects as described in @@ -4776,7 +4852,7 @@ napi_status napi_is_promise(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] promise`: The promise to examine * `[out] is_promise`: Flag indicating whether `promise` is a native promise -object - that is, a promise object created by the underlying engine. + object (that is, a promise object created by the underlying engine). ## Script execution @@ -4820,8 +4896,6 @@ NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[out] loop`: The current libuv loop instance. - - ## Asynchronous Thread-safe Function Calls JavaScript functions can normally only be called from a native addon's main @@ -4847,9 +4921,9 @@ Upon creation of a `napi_threadsafe_function` a `napi_finalize` callback can be provided. This callback will be invoked on the main thread when the thread-safe function is about to be destroyed. It receives the context and the finalize data given during construction, and provides an opportunity for cleaning up after the -threads e.g. by calling `uv_thread_join()`. **It is important that, aside from -the main loop thread, there be no threads left using the thread-safe function -after the finalize callback completes.** +threads e.g. by calling `uv_thread_join()`. **Aside from the main loop thread, +no threads should be using the thread-safe function after the finalize callback +completes.** The `context` given during the call to `napi_create_threadsafe_function()` can be retrieved from any thread with a call to @@ -4894,13 +4968,13 @@ existing thread will stop making use of the thread-safe function. the object has called `napi_release_threadsafe_function()` or has received a return status of `napi_closing` in response to a call to `napi_call_threadsafe_function`. The queue is emptied before the -`napi_threadsafe_function` is destroyed. It is important that -`napi_release_threadsafe_function()` be the last API call made in conjunction -with a given `napi_threadsafe_function`, because after the call completes, there -is no guarantee that the `napi_threadsafe_function` is still allocated. For the -same reason it is also important that no more use be made of a thread-safe -function after receiving a return value of `napi_closing` in response to a call -to `napi_call_threadsafe_function`. Data associated with the +`napi_threadsafe_function` is destroyed. `napi_release_threadsafe_function()` +should be the last API call made in conjunction with a given +`napi_threadsafe_function`, because after the call completes, there is no +guarantee that the `napi_threadsafe_function` is still allocated. For the same +reason, do not make use of a thread-safe function +after receiving a return value of `napi_closing` in response to a call to +`napi_call_threadsafe_function`. Data associated with the `napi_threadsafe_function` can be freed in its `napi_finalize` callback which was passed to `napi_create_threadsafe_function()`. @@ -5116,42 +5190,50 @@ idempotent. This API may only be called from the main thread. [ABI Stability]: https://nodejs.org/en/docs/guides/abi-stability/ +[AppVeyor]: https://www.appveyor.com +[C++ Addons]: addons.html +[CMake.js]: https://github.com/cmake-js/cmake-js +[CMake]: https://cmake.org [ECMAScript Language Specification]: https://tc39.github.io/ecma262/ [Error Handling]: #n_api_error_handling +[GCC]: https://gcc.gnu.org +[GYP]: https://gyp.gsrc.io +[GitHub releases]: https://help.github.com/en/github/administering-a-repository/about-releases +[LLVM]: https://llvm.org [Native Abstractions for Node.js]: https://github.com/nodejs/nan [Object Lifetime Management]: #n_api_object_lifetime_management [Object Wrap]: #n_api_object_wrap -[Section 6]: https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values -[Section 6.1]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types -[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type -[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type -[Section 6.1.7]: https://tc39.github.io/ecma262/#sec-object-type -[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2 -[Section 7]: https://tc39.github.io/ecma262/#sec-abstract-operations -[Section 7.1.2]: https://tc39.github.io/ecma262/#sec-toboolean -[Section 7.1.3]: https://tc39.github.io/ecma262/#sec-tonumber -[Section 7.1.13]: https://tc39.github.io/ecma262/#sec-toobject -[Section 7.2.2]: https://tc39.github.io/ecma262/#sec-isarray -[Section 7.2.14]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison -[Section 8.7]: https://tc39.es/ecma262/#sec-agents -[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc -[Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator [Section 12.10.4]: https://tc39.github.io/ecma262/#sec-instanceofoperator +[Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator [Section 19.2]: https://tc39.github.io/ecma262/#sec-function-objects [Section 19.4]: https://tc39.github.io/ecma262/#sec-symbol-objects [Section 20.3]: https://tc39.github.io/ecma262/#sec-date-objects -[Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects [Section 22.1.4.1]: https://tc39.github.io/ecma262/#sec-properties-of-array-instances-length +[Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects [Section 22.2]: https://tc39.github.io/ecma262/#sec-typedarray-objects [Section 24.1]: https://tc39.github.io/ecma262/#sec-arraybuffer-objects [Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects [Section 25.4]: https://tc39.github.io/ecma262/#sec-promise-objects -[`Number.MIN_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.min_safe_integer -[`Number.MAX_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.max_safe_integer -[Working with JavaScript Functions]: #n_api_working_with_javascript_functions +[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type +[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type +[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2 +[Section 6.1.7]: https://tc39.github.io/ecma262/#sec-object-type +[Section 6.1]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types +[Section 6]: https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values +[Section 7.1.13]: https://tc39.github.io/ecma262/#sec-toobject +[Section 7.1.2]: https://tc39.github.io/ecma262/#sec-toboolean +[Section 7.1.3]: https://tc39.github.io/ecma262/#sec-tonumber +[Section 7.2.14]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison +[Section 7.2.2]: https://tc39.github.io/ecma262/#sec-isarray +[Section 7]: https://tc39.github.io/ecma262/#sec-abstract-operations +[Section 8.7]: https://tc39.es/ecma262/#sec-agents +[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc +[Travis CI]: https://travis-ci.org +[Visual Studio]: https://visualstudio.microsoft.com [Working with JavaScript Properties]: #n_api_working_with_javascript_properties -[Working with JavaScript Values - Abstract Operations]: #n_api_working_with_javascript_values_abstract_operations -[Working with JavaScript Values]: #n_api_working_with_javascript_values +[Xcode]: https://developer.apple.com/xcode/ +[`Number.MAX_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.max_safe_integer +[`Number.MIN_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.min_safe_integer [`init` hooks]: async_hooks.html#async_hooks_init_asyncid_type_triggerasyncid_resource [`napi_add_finalizer`]: #n_api_napi_add_finalizer [`napi_async_init`]: #n_api_napi_async_init @@ -5167,8 +5249,6 @@ This API may only be called from the main thread. [`napi_create_type_error`]: #n_api_napi_create_type_error [`napi_define_class`]: #n_api_napi_define_class [`napi_delete_async_work`]: #n_api_napi_delete_async_work -[`napi_delete_element`]: #n_api_napi_delete_element -[`napi_delete_property`]: #n_api_napi_delete_property [`napi_delete_reference`]: #n_api_napi_delete_reference [`napi_escape_handle`]: #n_api_napi_escape_handle [`napi_get_and_clear_last_exception`]: #n_api_napi_get_and_clear_last_exception @@ -5178,7 +5258,6 @@ This API may only be called from the main thread. [`napi_get_property`]: #n_api_napi_get_property [`napi_get_reference_value`]: #n_api_napi_get_reference_value [`napi_get_value_external`]: #n_api_napi_get_value_external -[`napi_has_own_property`]: #n_api_napi_has_own_property [`napi_has_property`]: #n_api_napi_has_property [`napi_is_error`]: #n_api_napi_is_error [`napi_is_exception_pending`]: #n_api_napi_is_exception_pending @@ -5198,10 +5277,16 @@ This API may only be called from the main thread. [`napi_throw`]: #n_api_napi_throw [`napi_unwrap`]: #n_api_napi_unwrap [`napi_wrap`]: #n_api_napi_wrap +[`node_api.h`]: https://github.com/nodejs/node/blob/master/src/node_api.h [`process.release`]: process.html#process_process_release [`uv_ref`]: http://docs.libuv.org/en/v1.x/handle.html#c.uv_ref [`uv_unref`]: http://docs.libuv.org/en/v1.x/handle.html#c.uv_unref [async_hooks `type`]: async_hooks.html#async_hooks_type [context-aware addons]: addons.html#addons_context_aware_addons +[docs]: https://github.com/nodejs/node-addon-api#api-documentation [node-addon-api]: https://github.com/nodejs/node-addon-api +[node-gyp]: https://github.com/nodejs/node-gyp +[node-pre-gyp]: https://github.com/mapbox/node-pre-gyp +[prebuild]: https://github.com/prebuild/prebuild +[prebuildify]: https://github.com/prebuild/prebuildify [worker threads]: https://nodejs.org/api/worker_threads.html diff --git a/doc/api/net.md b/doc/api/net.md index cd1b4f904ed05a..419bc8677fabd8 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -26,13 +26,13 @@ sockets on other operating systems. [`socket.connect()`][] take a `path` parameter to identify IPC endpoints. On Unix, the local domain is also known as the Unix domain. The path is a -filesystem pathname. It gets truncated to `sizeof(sockaddr_un.sun_path) - 1`, -which varies on different operating system between 91 and 107 bytes. -The typical values are 107 on Linux and 103 on macOS. The path is -subject to the same naming conventions and permissions checks as would be done -on file creation. If the Unix domain socket (that is visible as a file system -path) is created and used in conjunction with one of Node.js' API abstractions -such as [`net.createServer()`][], it will be unlinked as part of +filesystem pathname. It gets truncated to a length of +`sizeof(sockaddr_un.sun_path) - 1`, which varies 91 and 107 bytes depending on +the operating system. The typical values are 107 on Linux and 103 on macOS. The +path is subject to the same naming conventions and permissions checks as would +be done on file creation. If the Unix domain socket (that is visible as a file +system path) is created and used in conjunction with one of Node.js' API +abstractions such as [`net.createServer()`][], it will be unlinked as part of [`server.close()`][]. On the other hand, if it is created and used outside of these abstractions, the user will need to manually remove it. The same applies when the path was created by a Node.js API but the program crashes abruptly. @@ -550,7 +550,7 @@ added: v0.3.8 `net.Socket` has the property that `socket.write()` always works. This is to help users get up and running quickly. The computer cannot always keep up -with the amount of data that is written to a socket - the network connection +with the amount of data that is written to a socket. The network connection simply might be too slow. Node.js will internally queue up the data written to a socket and send it out over the wire when it is possible. (Internally it is polling on the socket's file descriptor for being writable). @@ -648,13 +648,13 @@ For [IPC][] connections, available `options` are: For both types, available `options` include: -* `onread` {Object} - If specified, incoming data is stored in a single `buffer` +* `onread` {Object} If specified, incoming data is stored in a single `buffer` and passed to the supplied `callback` when data arrives on the socket. Note: this will cause the streaming functionality to not provide any data, however events like `'error'`, `'end'`, and `'close'` will still be emitted as normal and methods like `pause()` and `resume()` will also behave as expected. - * `buffer` {Buffer|Uint8Array|Function} - Either a reusable chunk of memory to + * `buffer` {Buffer|Uint8Array|Function} Either a reusable chunk of memory to use for storing incoming data or a function that returns such. * `callback` {Function} This function is called for every chunk of incoming data. Two arguments are passed to it: the number of bytes written to @@ -943,7 +943,7 @@ buffer. Returns `false` if all or part of the data was queued in user memory. [`'drain'`][] will be emitted when the buffer is again free. The optional `callback` parameter will be executed when the data is finally -written out - this may not be immediately. +written out, which may not be immediately. See `Writable` stream [`write()`][stream_writable_write] method for more information. diff --git a/doc/api/os.md b/doc/api/os.md index 6f22098f985332..b7eccda6786897 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -4,8 +4,8 @@ > Stability: 2 - Stable -The `os` module provides a number of operating system-related utility methods. -It can be accessed using: +The `os` module provides operating system-related utility methods and +properties. It can be accessed using: ```js const os = require('os'); @@ -18,7 +18,7 @@ added: v0.7.8 * {string} -A string constant defining the operating system-specific end-of-line marker: +The operating system-specific end-of-line marker. * `\n` on POSIX * `\r\n` on Windows @@ -30,13 +30,11 @@ added: v0.5.0 * Returns: {string} -The `os.arch()` method returns a string identifying the operating system CPU -architecture for which the Node.js binary was compiled. - -The current possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`, +Returns the operating system CPU architecture for which the Node.js binary was +compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`. -Equivalent to [`process.arch`][]. +The return value is equivalent to [`process.arch`][]. ## os.constants -The following signal constants are exported by `os.constants.signals`: +The following signal constants are exported by `os.constants.signals`.
    @@ -640,7 +568,7 @@ The following signal constants are exported by `os.constants.signals`: ### Error Constants -The following error constants are exported by `os.constants.errno`: +The following error constants are exported by `os.constants.errno`. #### POSIX Error Constants @@ -672,7 +600,7 @@ The following error constants are exported by `os.constants.errno`: - @@ -903,8 +831,8 @@ The following error constants are exported by `os.constants.errno`: - @@ -976,7 +904,7 @@ The following error constants are exported by `os.constants.errno`: #### Windows Specific Error Constants -The following error codes are specific to the Windows operating system: +The following error codes are specific to the Windows operating system.
    EAGAINIndicates that there is currently no data available and to try the + Indicates that there is no data available and to try the operation again later.
    EOPNOTSUPPIndicates that an operation is not supported on the socket. Note that - while ENOTSUP and EOPNOTSUPP have the same value + Indicates that an operation is not supported on the socket. Although + ENOTSUP and EOPNOTSUPP have the same value on Linux, according to POSIX.1 these error values should be distinct.)
    @@ -1262,7 +1190,7 @@ added: v10.10.0 --> The following process scheduling constants are exported by -`os.constants.priority`: +`os.constants.priority`.
    diff --git a/doc/api/policy.md b/doc/api/policy.md index f6e7e8285018ee..bf4cc214552eff 100644 --- a/doc/api/policy.md +++ b/doc/api/policy.md @@ -56,10 +56,11 @@ It is possible to change the error behavior to one of a few possibilities by defining an "onerror" field in a policy manifest. The following values are available to change the behavior: -* `"exit"` - will exit the process immediately. +* `"exit"`: will exit the process immediately. No cleanup code will be allowed to run. -* `"log"` - will log the error at the site of the failure. -* `"throw"` (default) - will throw a JS error at the site of the failure. +* `"log"`: will log the error at the site of the failure. +* `"throw"`: will throw a JS error at the site of the failure. This is the + default. ```json { diff --git a/doc/api/process.md b/doc/api/process.md index 1234d908512c92..79c423f752cd60 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -271,8 +271,8 @@ process will exit with a non-zero exit code and the stack trace will be printed. This is to avoid infinite recursion. Attempting to resume normally after an uncaught exception can be similar to -pulling out of the power cord when upgrading a computer — nine out of ten -times nothing happens - but the 10th time, the system becomes corrupted. +pulling out the power cord when upgrading a computer. Nine out of ten +times, nothing happens. But the tenth time, the system becomes corrupted. The correct use of `'uncaughtException'` is to perform synchronous cleanup of allocated resources (e.g. file descriptors, handles, etc) before shutting @@ -551,11 +551,9 @@ added: v0.5.0 * {string} -The `process.arch` property returns a string identifying the operating system -CPU architecture for which the Node.js binary was compiled. - -The current possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`, -`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`. +The operating system CPU architecture for which the Node.js binary was compiled. +Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, +`'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`. ```js console.log(`This processor architecture is ${process.arch}`); @@ -1942,7 +1940,11 @@ added: v0.5.9 * `message` {Object} * `sendHandle` {net.Server|net.Socket} -* `options` {Object} +* `options` {Object} used to parameterize the sending of certain types of + handles.`options` supports the following properties: + * `keepOpen` {boolean} A value that can be used when passing instances of + `net.Socket`. When `true`, the socket is kept open in the sending process. + **Default:** `false`. * `callback` {Function} * Returns: {boolean} @@ -2382,40 +2384,40 @@ Node.js will normally exit with a `0` status code when no more async operations are pending. The following status codes are used in other cases: -* `1` **Uncaught Fatal Exception** - There was an uncaught exception, +* `1` **Uncaught Fatal Exception**: There was an uncaught exception, and it was not handled by a domain or an [`'uncaughtException'`][] event handler. -* `2` - Unused (reserved by Bash for builtin misuse) -* `3` **Internal JavaScript Parse Error** - The JavaScript source code +* `2`: Unused (reserved by Bash for builtin misuse) +* `3` **Internal JavaScript Parse Error**: The JavaScript source code internal in Node.js's bootstrapping process caused a parse error. This is extremely rare, and generally can only happen during development of Node.js itself. -* `4` **Internal JavaScript Evaluation Failure** - The JavaScript +* `4` **Internal JavaScript Evaluation Failure**: The JavaScript source code internal in Node.js's bootstrapping process failed to return a function value when evaluated. This is extremely rare, and generally can only happen during development of Node.js itself. -* `5` **Fatal Error** - There was a fatal unrecoverable error in V8. +* `5` **Fatal Error**: There was a fatal unrecoverable error in V8. Typically a message will be printed to stderr with the prefix `FATAL ERROR`. -* `6` **Non-function Internal Exception Handler** - There was an +* `6` **Non-function Internal Exception Handler**: There was an uncaught exception, but the internal fatal exception handler function was somehow set to a non-function, and could not be called. -* `7` **Internal Exception Handler Run-Time Failure** - There was an +* `7` **Internal Exception Handler Run-Time Failure**: There was an uncaught exception, and the internal fatal exception handler function itself threw an error while attempting to handle it. This can happen, for example, if an [`'uncaughtException'`][] or `domain.on('error')` handler throws an error. -* `8` - Unused. In previous versions of Node.js, exit code 8 sometimes +* `8`: Unused. In previous versions of Node.js, exit code 8 sometimes indicated an uncaught exception. -* `9` - **Invalid Argument** - Either an unknown option was specified, +* `9` **Invalid Argument**: Either an unknown option was specified, or an option requiring a value was provided without a value. -* `10` **Internal JavaScript Run-Time Failure** - The JavaScript +* `10` **Internal JavaScript Run-Time Failure**: The JavaScript source code internal in Node.js's bootstrapping process threw an error when the bootstrapping function was called. This is extremely rare, and generally can only happen during development of Node.js itself. -* `12` **Invalid Debug Argument** - The `--inspect` and/or `--inspect-brk` +* `12` **Invalid Debug Argument**: The `--inspect` and/or `--inspect-brk` options were set, but the port number chosen was invalid or unavailable. -* `>128` **Signal Exits** - If Node.js receives a fatal signal such as +* `>128` **Signal Exits**: If Node.js receives a fatal signal such as `SIGKILL` or `SIGHUP`, then its exit code will be `128` plus the value of the signal code. This is a standard POSIX practice, since exit codes are defined to be 7-bit integers, and signal exits set diff --git a/doc/api/readline.md b/doc/api/readline.md index 642272e401e17c..ceda170bc2bf5d 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -360,9 +360,9 @@ changes: * `stream` {stream.Writable} * `dir` {number} - * `-1` - to the left from cursor - * `1` - to the right from cursor - * `0` - the entire line + * `-1`: to the left from cursor + * `1`: to the right from cursor + * `0`: the entire line * `callback` {Function} Invoked once the operation completes. * Returns: {boolean} `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; diff --git a/doc/api/repl.md b/doc/api/repl.md index 81620e0e9b47fd..cd7edb59ddf0a1 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -29,18 +29,18 @@ customizable evaluation functions. The following special commands are supported by all REPL instances: -* `.break` - When in the process of inputting a multi-line expression, entering +* `.break`: When in the process of inputting a multi-line expression, entering the `.break` command (or pressing the `-C` key combination) will abort further input or processing of that expression. -* `.clear` - Resets the REPL `context` to an empty object and clears any +* `.clear`: Resets the REPL `context` to an empty object and clears any multi-line expression currently being input. -* `.exit` - Close the I/O stream, causing the REPL to exit. -* `.help` - Show this list of special commands. -* `.save` - Save the current REPL session to a file: +* `.exit`: Close the I/O stream, causing the REPL to exit. +* `.help`: Show this list of special commands. +* `.save`: Save the current REPL session to a file: `> .save ./file/to/save.js` -* `.load` - Load a file into the current REPL session. +* `.load`: Load a file into the current REPL session. `> .load ./file/to/load.js` -* `.editor` - Enter editor mode (`-D` to finish, `-C` to cancel). +* `.editor`: Enter editor mode (`-D` to finish, `-C` to cancel). ```console > .editor @@ -58,11 +58,11 @@ welcome('Node.js User'); The following key combinations in the REPL have these special effects: -* `-C` - When pressed once, has the same effect as the `.break` command. +* `-C`: When pressed once, has the same effect as the `.break` command. When pressed twice on a blank line, has the same effect as the `.exit` command. -* `-D` - Has the same effect as the `.exit` command. -* `` - When pressed on a blank line, displays global and local (scope) +* `-D`: Has the same effect as the `.exit` command. +* ``: When pressed on a blank line, displays global and local (scope) variables. When pressed while entering other input, displays relevant autocompletion options. @@ -557,12 +557,12 @@ changes: * `replMode` {symbol} A flag that specifies whether the default evaluator executes all JavaScript commands in strict mode or default (sloppy) mode. Acceptable values are: - * `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is + * `repl.REPL_MODE_SLOPPY` to evaluate expressions in sloppy mode. + * `repl.REPL_MODE_STRICT` to evaluate expressions in strict mode. This is equivalent to prefacing every repl statement with `'use strict'`. - * `breakEvalOnSigint` - Stop evaluating the current piece of code when - `SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together - with a custom `eval` function. **Default:** `false`. + * `breakEvalOnSigint` {boolean} Stop evaluating the current piece of code when + `SIGINT` is received, such as when `Ctrl+C` is pressed. This cannot be used + together with a custom `eval` function. **Default:** `false`. * Returns: {repl.REPLServer} The `repl.start()` method creates and starts a [`repl.REPLServer`][] instance. @@ -601,16 +601,16 @@ undefined Various behaviors of the Node.js REPL can be customized using the following environment variables: -* `NODE_REPL_HISTORY` - When a valid path is given, persistent REPL history +* `NODE_REPL_HISTORY`: When a valid path is given, persistent REPL history will be saved to the specified file rather than `.node_repl_history` in the user's home directory. Setting this value to `''` (an empty string) will disable persistent REPL history. Whitespace will be trimmed from the value. On Windows platforms environment variables with empty values are invalid so set this variable to one or more spaces to disable persistent REPL history. -* `NODE_REPL_HISTORY_SIZE` - Controls how many lines of history will be +* `NODE_REPL_HISTORY_SIZE`: Controls how many lines of history will be persisted if history is available. Must be a positive number. **Default:** `1000`. -* `NODE_REPL_MODE` - May be either `'sloppy'` or `'strict'`. **Default:** +* `NODE_REPL_MODE`: May be either `'sloppy'` or `'strict'`. **Default:** `'sloppy'`, which will allow non-strict mode code to be run. ### Persistent History diff --git a/doc/api/report.md b/doc/api/report.md index 8819d2802b4373..984f6c6f403b70 100644 --- a/doc/api/report.md +++ b/doc/api/report.md @@ -446,11 +446,11 @@ the name of a file into which the report is written. process.report.writeReport('./foo.json'); ``` -This function takes an optional additional argument `err` - an `Error` object -that will be used as the context for the JavaScript stack printed in the report. -When using report to handle errors in a callback or an exception handler, this -allows the report to include the location of the original error as well -as where it was handled. +This function takes an optional additional argument `err` which is an `Error` +object that will be used as the context for the JavaScript stack printed in the +report. When using report to handle errors in a callback or an exception +handler, this allows the report to include the location of the original error as +well as where it was handled. ```js try { @@ -484,8 +484,9 @@ console.log(typeof report === 'object'); // true console.log(JSON.stringify(report, null, 2)); ``` -This function takes an optional additional argument `err` - an `Error` object -that will be used as the context for the JavaScript stack printed in the report. +This function takes an optional additional argument `err`, which is an `Error` +object that will be used as the context for the JavaScript stack printed in the +report. ```js const report = process.report.getReport(new Error('custom error')); diff --git a/doc/api/stream.md b/doc/api/stream.md index 52c6b821e17df3..25dd8616c10c1c 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -33,13 +33,13 @@ second section explains how to create new types of streams. There are four fundamental stream types within Node.js: -* [`Writable`][] - streams to which data can be written (for example, +* [`Writable`][]: streams to which data can be written (for example, [`fs.createWriteStream()`][]). -* [`Readable`][] - streams from which data can be read (for example, +* [`Readable`][]: streams from which data can be read (for example, [`fs.createReadStream()`][]). -* [`Duplex`][] - streams that are both `Readable` and `Writable` (for example, +* [`Duplex`][]: streams that are both `Readable` and `Writable` (for example, [`net.Socket`][]). -* [`Transform`][] - `Duplex` streams that can modify or transform the data as it +* [`Transform`][]: `Duplex` streams that can modify or transform the data as it is written and read (for example, [`zlib.createDeflate()`][]). Additionally, this module includes the utility functions @@ -100,7 +100,7 @@ maintaining an appropriate and efficient flow of data. For example, [`net.Socket`][] instances are [`Duplex`][] streams whose `Readable` side allows consumption of data received *from* the socket and whose `Writable` side allows writing data *to* the socket. Because data may be written to the socket at a -faster or slower rate than data is received, it is important for each side to +faster or slower rate than data is received, each side should operate (and buffer) independently of the other. ## API for Stream Consumers @@ -1284,8 +1284,10 @@ changes: * `encoding` {string} Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. -Passing `chunk` as `null` signals the end of the stream (EOF), after which no -more data can be written. +Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the +same as `readable.push(null)`, after which no more data can be written. The EOF +signal is put at the end of the buffer and any buffered data will still be +flushed. The `readable.unshift()` method pushes a chunk of data back into the internal buffer. This is useful in certain situations where a stream is being consumed by @@ -1528,7 +1530,7 @@ If this is unwanted behavior then the returned cleanup function needs to be invoked in the callback: ```js -const cleanup = finished(...streams, (err) => { +const cleanup = finished(rs, (err) => { cleanup(); // ... }); @@ -1652,11 +1654,11 @@ class MyWritable extends Writable { } ``` -When extending streams, it is important to keep in mind what options the user +When extending streams, keep in mind what options the user can and should provide before forwarding these to the base constructor. For -example, if the implementation makes assumptions in regard to e.g. the -`autoDestroy` and `emitClose` options, it becomes important to not allow the -user to override these. It is therefore recommended to be explicit about what +example, if the implementation makes assumptions in regard to the +`autoDestroy` and `emitClose` options, do not allow the +user to override these. Be explicit about what options are forwarded instead of implicitly forwarding all options. The new stream class must then implement one or more specific methods, depending @@ -2501,7 +2503,7 @@ user programs. [`stream.write()`][stream-write]. * `encoding` {string} If the chunk is a string, then this is the encoding type. If chunk is a buffer, then this is the special - value - `'buffer'`, ignore it in this case. + value `'buffer'`. Ignore it in that case. * `callback` {Function} A callback function (optionally with an error argument and data) to be called after the supplied `chunk` has been processed. @@ -2602,8 +2604,8 @@ readable.on('data', (chunk) => { #### Piping to Writable Streams from Async Iterators -In the scenario of writing to a writable stream from an async iterator, -it is important to ensure the correct handling of backpressure and errors. +In the scenario of writing to a writable stream from an async iterator, ensure +the correct handling of backpressure and errors. ```js const { once } = require('events'); diff --git a/doc/api/tls.md b/doc/api/tls.md index c2e169af3257f8..3fd8e8cb494de7 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -83,8 +83,8 @@ all sessions). Methods implementing this technique are called "ephemeral". Currently two methods are commonly used to achieve Perfect Forward Secrecy (note the character "E" appended to the traditional abbreviations): -* [DHE][] - An ephemeral version of the Diffie Hellman key-agreement protocol. -* [ECDHE][] - An ephemeral version of the Elliptic Curve Diffie Hellman +* [DHE][]: An ephemeral version of the Diffie Hellman key-agreement protocol. +* [ECDHE][]: An ephemeral version of the Elliptic Curve Diffie Hellman key-agreement protocol. Ephemeral methods may have some performance drawbacks, because key generation @@ -114,8 +114,8 @@ TLSv1.3, because all TLSv1.3 cipher suites use ECDHE. ALPN (Application-Layer Protocol Negotiation Extension) and SNI (Server Name Indication) are TLS handshake extensions: -* ALPN - Allows the use of one TLS server for multiple protocols (HTTP, HTTP/2) -* SNI - Allows the use of one TLS server for multiple hostnames with different +* ALPN: Allows the use of one TLS server for multiple protocols (HTTP, HTTP/2) +* SNI: Allows the use of one TLS server for multiple hostnames with different SSL certificates. ### Client-initiated renegotiation attack mitigation @@ -1677,7 +1677,7 @@ added: v11.4.0 [`tls.createSecureContext()`][]. It can be assigned any of the supported TLS protocol versions, `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.3'`, unless changed using CLI options. Using - `--tls-max-v1.2` sets the default to `'TLSv1.2`'. Using `--tls-max-v1.3` sets + `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. @@ -1688,7 +1688,7 @@ added: v11.4.0 * {string} The default value of the `minVersion` option of [`tls.createSecureContext()`][]. It can be assigned any of the supported TLS - protocol versions, `'TLSv1.3'`, `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. + protocol versions, `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. **Default:** `'TLSv1.2'`, unless changed using CLI options. Using `--tls-min-v1.0` sets the default to `'TLSv1'`. Using `--tls-min-v1.1` sets the default to `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to diff --git a/doc/api/tracing.md b/doc/api/tracing.md index 999c7d723012b0..596f624be54246 100644 --- a/doc/api/tracing.md +++ b/doc/api/tracing.md @@ -13,26 +13,26 @@ accepts a list of comma-separated category names. The available categories are: -* `node` - An empty placeholder. -* `node.async_hooks` - Enables capture of detailed [`async_hooks`][] trace data. +* `node`: An empty placeholder. +* `node.async_hooks`: Enables capture of detailed [`async_hooks`][] trace data. The [`async_hooks`][] events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. -* `node.bootstrap` - Enables capture of Node.js bootstrap milestones. -* `node.console` - Enables capture of `console.time()` and `console.count()` +* `node.bootstrap`: Enables capture of Node.js bootstrap milestones. +* `node.console`: Enables capture of `console.time()` and `console.count()` output. -* `node.dns.native` - Enables capture of trace data for DNS queries. -* `node.environment` - Enables capture of Node.js Environment milestones. -* `node.fs.sync` - Enables capture of trace data for file system sync methods. -* `node.perf` - Enables capture of [Performance API][] measurements. - * `node.perf.usertiming` - Enables capture of only Performance API User Timing +* `node.dns.native`: Enables capture of trace data for DNS queries. +* `node.environment`: Enables capture of Node.js Environment milestones. +* `node.fs.sync`: Enables capture of trace data for file system sync methods. +* `node.perf`: Enables capture of [Performance API][] measurements. + * `node.perf.usertiming`: Enables capture of only Performance API User Timing measures and marks. - * `node.perf.timerify` - Enables capture of only Performance API timerify + * `node.perf.timerify`: Enables capture of only Performance API timerify measurements. -* `node.promises.rejections` - Enables capture of trace data tracking the number +* `node.promises.rejections`: Enables capture of trace data tracking the number of unhandled Promise rejections and handled-after-rejections. -* `node.vm.script` - Enables capture of trace data for the `vm` module's +* `node.vm.script`: Enables capture of trace data for the `vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. -* `v8` - The [V8][] events are GC, compiling, and execution related. +* `v8`: The [V8][] events are GC, compiling, and execution related. By default the `node`, `node.async_hooks`, and `v8` categories are enabled. diff --git a/doc/api/tty.md b/doc/api/tty.md index 2f8e1de587ce8e..186a236b57f814 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -65,7 +65,7 @@ added: v0.7.7 raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw` property will be set to the resulting mode. -* Returns: {this} - the read stream instance. +* Returns: {this} The read stream instance. Allows configuration of `tty.ReadStream` so that it operates as a raw device. @@ -112,9 +112,9 @@ changes: --> * `dir` {number} - * `-1` - to the left from cursor - * `1` - to the right from cursor - * `0` - the entire line + * `-1`: to the left from cursor + * `1`: to the right from cursor + * `0`: the entire line * `callback` {Function} Invoked once the operation completes. * Returns: {boolean} `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional diff --git a/doc/api/util.md b/doc/api/util.md index adee5c4a7fe6a6..6435709bd84331 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -225,27 +225,27 @@ as a `printf`-like format string which can contain zero or more format specifiers. Each specifier is replaced with the converted value from the corresponding argument. Supported specifiers are: -* `%s` - `String` will be used to convert all values except `BigInt`, `Object` +* `%s`: `String` will be used to convert all values except `BigInt`, `Object` and `-0`. `BigInt` values will be represented with an `n` and Objects that have no user defined `toString` function are inspected using `util.inspect()` with options `{ depth: 0, colors: false, compact: 3 }`. -* `%d` - `Number` will be used to convert all values except `BigInt` and +* `%d`: `Number` will be used to convert all values except `BigInt` and `Symbol`. -* `%i` - `parseInt(value, 10)` is used for all values except `BigInt` and +* `%i`: `parseInt(value, 10)` is used for all values except `BigInt` and `Symbol`. -* `%f` - `parseFloat(value)` is used for all values expect `Symbol`. -* `%j` - JSON. Replaced with the string `'[Circular]'` if the argument contains +* `%f`: `parseFloat(value)` is used for all values expect `Symbol`. +* `%j`: JSON. Replaced with the string `'[Circular]'` if the argument contains circular references. -* `%o` - `Object`. A string representation of an object with generic JavaScript +* `%o`: `Object`. A string representation of an object with generic JavaScript object formatting. Similar to `util.inspect()` with options `{ showHidden: true, showProxy: true }`. This will show the full object including non-enumerable properties and proxies. -* `%O` - `Object`. A string representation of an object with generic JavaScript +* `%O`: `Object`. A string representation of an object with generic JavaScript object formatting. Similar to `util.inspect()` without options. This will show the full object not including non-enumerable properties and proxies. -* `%c` - `CSS`. This specifier is currently ignored, and will skip any CSS +* `%c`: `CSS`. This specifier is currently ignored, and will skip any CSS passed in. -* `%%` - single percent sign (`'%'`). This does not consume an argument. +* `%%`: single percent sign (`'%'`). This does not consume an argument. * Returns: {string} The formatted string If a specifier does not have a corresponding argument, it is not replaced: @@ -662,18 +662,18 @@ via the `util.inspect.styles` and `util.inspect.colors` properties. The default styles and associated colors are: -* `bigint` - `yellow` -* `boolean` - `yellow` -* `date` - `magenta` -* `module` - `underline` -* `name` - (no styling) -* `null` - `bold` -* `number` - `yellow` -* `regexp` - `red` -* `special` - `cyan` (e.g., `Proxies`) -* `string` - `green` -* `symbol` - `green` -* `undefined` - `grey` +* `bigint`: `yellow` +* `boolean`: `yellow` +* `date`: `magenta` +* `module`: `underline` +* `name`: (no styling) +* `null`: `bold` +* `number`: `yellow` +* `regexp`: `red` +* `special`: `cyan` (e.g., `Proxies`) +* `string`: `green` +* `symbol`: `green` +* `undefined`: `grey` The predefined color codes are: `white`, `grey`, `black`, `blue`, `cyan`, `green`, `magenta`, `red` and `yellow`. There are also `bold`, `italic`, @@ -1107,11 +1107,10 @@ The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`. added: v10.0.0 --> -`util.types` provides a number of type checks for different kinds of built-in -objects. Unlike `instanceof` or `Object.prototype.toString.call(value)`, -these checks do not inspect properties of the object that are accessible from -JavaScript (like their prototype), and usually have the overhead of -calling into C++. +`util.types` provides type checks for different kinds of built-in objects. +Unlike `instanceof` or `Object.prototype.toString.call(value)`, these checks do +not inspect properties of the object that are accessible from JavaScript (like +their prototype), and usually have the overhead of calling into C++. The result generally does not make any guarantees about what kinds of properties or behavior a value exposes in JavaScript. They are primarily diff --git a/doc/changelogs/CHANGELOG_V12.md b/doc/changelogs/CHANGELOG_V12.md index 26127a05755160..9d9b50c0738362 100644 --- a/doc/changelogs/CHANGELOG_V12.md +++ b/doc/changelogs/CHANGELOG_V12.md @@ -10,6 +10,7 @@
    +12.13.1
    12.13.0
    @@ -48,6 +49,119 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2019-11-19, Version 12.13.1 'Erbium' (LTS), @targos + +### Notable changes + +* Experimental support for building Node.js with Python 3 is improved. +* ICU time zone data is updated to version 2019c. This fixes the date offset + in Brazil. + +### Commits + +* [[`56be32d22d`](https://github.com/nodejs/node/commit/56be32d22d)] - **async_hooks**: only emit `after` for AsyncResource if stack not empty (Anna Henningsen) [#30087](https://github.com/nodejs/node/pull/30087) +* [[`e16e3d5b90`](https://github.com/nodejs/node/commit/e16e3d5b90)] - **benchmark**: remove double word "then" in comments (Nick Schonning) [#29823](https://github.com/nodejs/node/pull/29823) +* [[`dcdb96c7bb`](https://github.com/nodejs/node/commit/dcdb96c7bb)] - **benchmark**: add benchmark for vm.createContext (Joyee Cheung) [#29845](https://github.com/nodejs/node/pull/29845) +* [[`680e9cc7e1`](https://github.com/nodejs/node/commit/680e9cc7e1)] - **buffer**: improve performance caused by primordials (Jizu Sun) [#30235](https://github.com/nodejs/node/pull/30235) +* [[`bcd2238b3e`](https://github.com/nodejs/node/commit/bcd2238b3e)] - **build**: add workaround for WSL (gengjiawen) [#30221](https://github.com/nodejs/node/pull/30221) +* [[`c5d312f821`](https://github.com/nodejs/node/commit/c5d312f821)] - **build**: find Python syntax errors in dependencies (Christian Clauss) [#30143](https://github.com/nodejs/node/pull/30143) +* [[`468f203809`](https://github.com/nodejs/node/commit/468f203809)] - **build**: fix pkg-config search for libnghttp2 (Ben Noordhuis) [#30145](https://github.com/nodejs/node/pull/30145) +* [[`0415dd7cb3`](https://github.com/nodejs/node/commit/0415dd7cb3)] - **build**: python3 support for configure (Rod Vagg) [#30047](https://github.com/nodejs/node/pull/30047) +* [[`032c23d360`](https://github.com/nodejs/node/commit/032c23d360)] - **build**: make linter failures fail `test-doc` target (Richard Lau) [#30012](https://github.com/nodejs/node/pull/30012) +* [[`a86648c8d2`](https://github.com/nodejs/node/commit/a86648c8d2)] - **build**: log the found compiler version if too old (Richard Lau) [#30028](https://github.com/nodejs/node/pull/30028) +* [[`02f6e5cc40`](https://github.com/nodejs/node/commit/02f6e5cc40)] - **build**: fix version checks in configure.py (Michaël Zasso) [#29965](https://github.com/nodejs/node/pull/29965) +* [[`a1adce1b4f`](https://github.com/nodejs/node/commit/a1adce1b4f)] - **build**: build benchmark addons like test addons (Richard Lau) [#29995](https://github.com/nodejs/node/pull/29995) +* [[`735ec1bf96`](https://github.com/nodejs/node/commit/735ec1bf96)] - **build**: fix version checks in gyp files (Ben Noordhuis) [#29931](https://github.com/nodejs/node/pull/29931) +* [[`8da83e8c24`](https://github.com/nodejs/node/commit/8da83e8c24)] - **build**: always use strings for compiler version in gyp files (Michaël Zasso) [#29897](https://github.com/nodejs/node/pull/29897) +* [[`b7bdfd346c`](https://github.com/nodejs/node/commit/b7bdfd346c)] - **crypto**: guard with OPENSSL\_NO\_GOST (Shelley Vohr) [#30050](https://github.com/nodejs/node/pull/30050) +* [[`e175d0beb6`](https://github.com/nodejs/node/commit/e175d0beb6)] - **crypto**: reject public keys properly (Tobias Nießen) [#29913](https://github.com/nodejs/node/pull/29913) +* [[`b1529c6bc2`](https://github.com/nodejs/node/commit/b1529c6bc2)] - **deps**: V8: cherry-pick a7dffcd767be (Christian Clauss) [#30218](https://github.com/nodejs/node/pull/30218) +* [[`6bc7a6db0e`](https://github.com/nodejs/node/commit/6bc7a6db0e)] - **deps**: V8: cherry-pick e5dbc95 (Gabriel Schulhof) [#30130](https://github.com/nodejs/node/pull/30130) +* [[`b88314f735`](https://github.com/nodejs/node/commit/b88314f735)] - **deps**: update npm to 6.12.1 (Michael Perrotte) [#30164](https://github.com/nodejs/node/pull/30164) +* [[`ce49a412ef`](https://github.com/nodejs/node/commit/ce49a412ef)] - **deps**: V8: cherry-pick c721203 (Michaël Zasso) [#30065](https://github.com/nodejs/node/pull/30065) +* [[`d2756fd14d`](https://github.com/nodejs/node/commit/d2756fd14d)] - **deps**: V8: cherry-pick ed40ab1 (Michaël Zasso) [#30064](https://github.com/nodejs/node/pull/30064) +* [[`58c585e3ed`](https://github.com/nodejs/node/commit/58c585e3ed)] - **deps**: npm: patch support for 13.x (Jordan Harband) [#30079](https://github.com/nodejs/node/pull/30079) +* [[`2764567f90`](https://github.com/nodejs/node/commit/2764567f90)] - **deps**: upgrade to libuv 1.33.1 (Colin Ihrig) [#29996](https://github.com/nodejs/node/pull/29996) +* [[`33bd1281fc`](https://github.com/nodejs/node/commit/33bd1281fc)] - **doc**: add missing hash for header link (Nick Schonning) [#30188](https://github.com/nodejs/node/pull/30188) +* [[`b159b91798`](https://github.com/nodejs/node/commit/b159b91798)] - **doc**: linkify `.setupMaster()` in cluster doc (Trivikram Kamat) [#30204](https://github.com/nodejs/node/pull/30204) +* [[`9c4a9e7337`](https://github.com/nodejs/node/commit/9c4a9e7337)] - **doc**: explain http2 aborted event callback (dev-313) [#30179](https://github.com/nodejs/node/pull/30179) +* [[`d7bfc6c987`](https://github.com/nodejs/node/commit/d7bfc6c987)] - **doc**: linkify `.fork()` in cluster documentation (Anna Henningsen) [#30163](https://github.com/nodejs/node/pull/30163) +* [[`a71f210206`](https://github.com/nodejs/node/commit/a71f210206)] - **doc**: update AUTHORS list (Michaël Zasso) [#30142](https://github.com/nodejs/node/pull/30142) +* [[`7b5047454b`](https://github.com/nodejs/node/commit/7b5047454b)] - **doc**: improve doc Http2Session:Timeout (dev-313) [#30161](https://github.com/nodejs/node/pull/30161) +* [[`0efe9a0c97`](https://github.com/nodejs/node/commit/0efe9a0c97)] - **doc**: move inactive Collaborators to emeriti (Rich Trott) [#30177](https://github.com/nodejs/node/pull/30177) +* [[`98d31da342`](https://github.com/nodejs/node/commit/98d31da342)] - **doc**: add options description for send APIs (dev-313) [#29868](https://github.com/nodejs/node/pull/29868) +* [[`d0f5bc1aa7`](https://github.com/nodejs/node/commit/d0f5bc1aa7)] - **doc**: fix an error in resolution algorithm steps (Alex Zherdev) [#29940](https://github.com/nodejs/node/pull/29940) +* [[`28db99932a`](https://github.com/nodejs/node/commit/28db99932a)] - **doc**: remove incorrect and outdated example (Tobias Nießen) [#30138](https://github.com/nodejs/node/pull/30138) +* [[`c2108d4919`](https://github.com/nodejs/node/commit/c2108d4919)] - **doc**: adjust code sample for stream.finished (Cotton Hou) [#29983](https://github.com/nodejs/node/pull/29983) +* [[`2ac76e3055`](https://github.com/nodejs/node/commit/2ac76e3055)] - **doc**: remove "it is important to" phrasing (Rich Trott) [#30108](https://github.com/nodejs/node/pull/30108) +* [[`ec992878e8`](https://github.com/nodejs/node/commit/ec992878e8)] - **doc**: revise os.md (Rich Trott) [#30102](https://github.com/nodejs/node/pull/30102) +* [[`a56e78c8c8`](https://github.com/nodejs/node/commit/a56e78c8c8)] - **doc**: delete "a number of" things in the docs (Rich Trott) [#30103](https://github.com/nodejs/node/pull/30103) +* [[`ee954d5570`](https://github.com/nodejs/node/commit/ee954d5570)] - **doc**: remove dashes (Rich Trott) [#30101](https://github.com/nodejs/node/pull/30101) +* [[`c4c8e01af1`](https://github.com/nodejs/node/commit/c4c8e01af1)] - **doc**: add legendecas to collaborators (legendecas) [#30115](https://github.com/nodejs/node/pull/30115) +* [[`22e10fd15a`](https://github.com/nodejs/node/commit/22e10fd15a)] - **doc**: --enable-source-maps and prepareStackTrace are incompatible (Benjamin Coe) [#30046](https://github.com/nodejs/node/pull/30046) +* [[`870c320f31`](https://github.com/nodejs/node/commit/870c320f31)] - **doc**: join parts of disrupt section in cli.md (vsemozhetbyt) [#30038](https://github.com/nodejs/node/pull/30038) +* [[`8df5bdbd66`](https://github.com/nodejs/node/commit/8df5bdbd66)] - **doc**: update collaborator email address (Minwoo Jung) [#30007](https://github.com/nodejs/node/pull/30007) +* [[`d9b5508fc8`](https://github.com/nodejs/node/commit/d9b5508fc8)] - **doc**: fix tls version typo (akitsu-sanae) [#29984](https://github.com/nodejs/node/pull/29984) +* [[`5616f22839`](https://github.com/nodejs/node/commit/5616f22839)] - **doc**: clarify readable.unshift null/EOF (Robert Nagy) [#29950](https://github.com/nodejs/node/pull/29950) +* [[`b57fe3b370`](https://github.com/nodejs/node/commit/b57fe3b370)] - **doc**: remove unused Markdown reference links (Nick Schonning) [#29961](https://github.com/nodejs/node/pull/29961) +* [[`12f24542b8`](https://github.com/nodejs/node/commit/12f24542b8)] - **doc**: re-enable passing remark-lint rule (Nick Schonning) [#29961](https://github.com/nodejs/node/pull/29961) +* [[`c0cbfae0e3`](https://github.com/nodejs/node/commit/c0cbfae0e3)] - **doc**: add server header into the discarded list of http message.headers (Huachao Mao) [#29962](https://github.com/nodejs/node/pull/29962) +* [[`a23b5cbf61`](https://github.com/nodejs/node/commit/a23b5cbf61)] - **doc**: prepare miscellaneous docs for new markdown lint rules (Rich Trott) [#29963](https://github.com/nodejs/node/pull/29963) +* [[`c66bc20bbf`](https://github.com/nodejs/node/commit/c66bc20bbf)] - **doc**: fix some recent nits in fs.md (vsemozhetbyt) [#29906](https://github.com/nodejs/node/pull/29906) +* [[`1fefd7fddc`](https://github.com/nodejs/node/commit/1fefd7fddc)] - **doc**: fs dir modifications may not be reflected by dir.read (Anna Henningsen) [#29893](https://github.com/nodejs/node/pull/29893) +* [[`66c6818473`](https://github.com/nodejs/node/commit/66c6818473)] - **doc,meta**: prefer aliases and stubs over Runtime Deprecations (Rich Trott) [#30153](https://github.com/nodejs/node/pull/30153) +* [[`5ade490505`](https://github.com/nodejs/node/commit/5ade490505)] - **doc,meta**: reduce npm PR wait period to one week (Rich Trott) [#29922](https://github.com/nodejs/node/pull/29922) +* [[`0ec63ee27a`](https://github.com/nodejs/node/commit/0ec63ee27a)] - **doc,n-api**: sort bottom-of-the-page references (Gabriel Schulhof) [#30124](https://github.com/nodejs/node/pull/30124) +* [[`8a333a4519`](https://github.com/nodejs/node/commit/8a333a4519)] - **domain**: do not import util for a simple type check (Ruben Bridgewater) [#29825](https://github.com/nodejs/node/pull/29825) +* [[`94ac44f3fc`](https://github.com/nodejs/node/commit/94ac44f3fc)] - **esm**: modify resolution order for specifier flag (Myles Borins) [#29974](https://github.com/nodejs/node/pull/29974) +* [[`216e200fa9`](https://github.com/nodejs/node/commit/216e200fa9)] - **fs**: buffer dir entries in opendir() (Anna Henningsen) [#29893](https://github.com/nodejs/node/pull/29893) +* [[`5959023b76`](https://github.com/nodejs/node/commit/5959023b76)] - **http2**: fix file close error condition at respondWithFd (Anna Henningsen) [#29884](https://github.com/nodejs/node/pull/29884) +* [[`4277066afd`](https://github.com/nodejs/node/commit/4277066afd)] - **inspector**: turn platform tasks that outlive Agent into no-ops (Anna Henningsen) [#30031](https://github.com/nodejs/node/pull/30031) +* [[`b0837fead3`](https://github.com/nodejs/node/commit/b0837fead3)] - **meta**: use contact\_links instead of issue templates (Michaël Zasso) [#30172](https://github.com/nodejs/node/pull/30172) +* [[`2695f822bc`](https://github.com/nodejs/node/commit/2695f822bc)] - **module**: warn on require of .js inside type: module (Guy Bedford) [#29909](https://github.com/nodejs/node/pull/29909) +* [[`ee3c3ad0f5`](https://github.com/nodejs/node/commit/ee3c3ad0f5)] - **n-api,doc**: add info about building n-api addons (Jim Schlight) [#30032](https://github.com/nodejs/node/pull/30032) +* [[`da58301054`](https://github.com/nodejs/node/commit/da58301054)] - **net**: treat ENOTCONN at shutdown as success (Anna Henningsen) [#29912](https://github.com/nodejs/node/pull/29912) +* [[`62bc80c906`](https://github.com/nodejs/node/commit/62bc80c906)] - **process**: add lineLength to source-map-cache (Benjamin Coe) [#29863](https://github.com/nodejs/node/pull/29863) +* [[`ab03c29587`](https://github.com/nodejs/node/commit/ab03c29587)] - **src**: isolate-\>Dispose() order consistency (Shelley Vohr) [#30181](https://github.com/nodejs/node/pull/30181) +* [[`c52b292adf`](https://github.com/nodejs/node/commit/c52b292adf)] - **src**: change env.h includes for forward declarations (Alexandre Ferrando) [#30133](https://github.com/nodejs/node/pull/30133) +* [[`b215b1665a`](https://github.com/nodejs/node/commit/b215b1665a)] - **src**: split up InitializeContext (Shelley Vohr) [#30067](https://github.com/nodejs/node/pull/30067) +* [[`d586070388`](https://github.com/nodejs/node/commit/d586070388)] - **src**: allow inspector without v8 platform (Shelley Vohr) [#30049](https://github.com/nodejs/node/pull/30049) +* [[`f6655b41fa`](https://github.com/nodejs/node/commit/f6655b41fa)] - **src**: remove unnecessary std::endl usage (Daniel Bevenius) [#30003](https://github.com/nodejs/node/pull/30003) +* [[`abfac9640e`](https://github.com/nodejs/node/commit/abfac9640e)] - **src**: make implementing CancelPendingDelayedTasks for platform optional (Anna Henningsen) [#30034](https://github.com/nodejs/node/pull/30034) +* [[`693bf73b06`](https://github.com/nodejs/node/commit/693bf73b06)] - **src**: expose ListNode\::prev\_ on postmortem metadata (legendecas) [#30027](https://github.com/nodejs/node/pull/30027) +* [[`4b57088c25`](https://github.com/nodejs/node/commit/4b57088c25)] - **src**: fewer uses of NODE\_USE\_V8\_PLATFORM (Shelley Vohr) [#30029](https://github.com/nodejs/node/pull/30029) +* [[`6269a3c92a`](https://github.com/nodejs/node/commit/6269a3c92a)] - **src**: remove unused iomanip include (Daniel Bevenius) [#30004](https://github.com/nodejs/node/pull/30004) +* [[`aa0aacbba9`](https://github.com/nodejs/node/commit/aa0aacbba9)] - **src**: initialize openssl only once (Sam Roberts) [#29999](https://github.com/nodejs/node/pull/29999) +* [[`45c5ad7922`](https://github.com/nodejs/node/commit/45c5ad7922)] - **src**: refine maps parsing for large pages (Gabriel Schulhof) [#29973](https://github.com/nodejs/node/pull/29973) +* [[`aac2476346`](https://github.com/nodejs/node/commit/aac2476346)] - **src**: render N-API weak callbacks as cleanup hooks (Gabriel Schulhof) [#28428](https://github.com/nodejs/node/pull/28428) +* [[`f3115c4d62`](https://github.com/nodejs/node/commit/f3115c4d62)] - **src**: fix largepages regression (Gabriel Schulhof) [#29914](https://github.com/nodejs/node/pull/29914) +* [[`ddbf150edb`](https://github.com/nodejs/node/commit/ddbf150edb)] - **src**: remove unused using declarations in worker.cc (Daniel Bevenius) [#29883](https://github.com/nodejs/node/pull/29883) +* [[`8a31136a95`](https://github.com/nodejs/node/commit/8a31136a95)] - **stream**: extract Readable.from in its own file (Matteo Collina) [#30140](https://github.com/nodejs/node/pull/30140) +* [[`21a43bd2fd`](https://github.com/nodejs/node/commit/21a43bd2fd)] - **stream**: simplify uint8ArrayToBuffer helper (Luigi Pinca) [#30041](https://github.com/nodejs/node/pull/30041) +* [[`ae390393b6`](https://github.com/nodejs/node/commit/ae390393b6)] - **stream**: remove dead code (Luigi Pinca) [#30041](https://github.com/nodejs/node/pull/30041) +* [[`56e986aa23`](https://github.com/nodejs/node/commit/56e986aa23)] - **test**: do not run release-npm test without crypto (Michaël Zasso) [#30265](https://github.com/nodejs/node/pull/30265) +* [[`d96e8b662e`](https://github.com/nodejs/node/commit/d96e8b662e)] - **test**: use arrow functions for callbacks (Minuk Park) [#30069](https://github.com/nodejs/node/pull/30069) +* [[`00dab3495d`](https://github.com/nodejs/node/commit/00dab3495d)] - **test**: verify npm compatibility with releases (Michaël Zasso) [#30082](https://github.com/nodejs/node/pull/30082) +* [[`ecf6ae89f4`](https://github.com/nodejs/node/commit/ecf6ae89f4)] - **test**: expand Worker test for non-shared ArrayBuffer (Anna Henningsen) [#30044](https://github.com/nodejs/node/pull/30044) +* [[`2ebd1a0d3f`](https://github.com/nodejs/node/commit/2ebd1a0d3f)] - **test**: fix test runner for Python 3 on Windows (Michaël Zasso) [#30023](https://github.com/nodejs/node/pull/30023) +* [[`9fed62f7cb`](https://github.com/nodejs/node/commit/9fed62f7cb)] - **test**: remove common.skipIfInspectorEnabled() (Rich Trott) [#29993](https://github.com/nodejs/node/pull/29993) +* [[`3e39909022`](https://github.com/nodejs/node/commit/3e39909022)] - **test**: add cb error test for fs.close() (Matteo Rossi) [#29970](https://github.com/nodejs/node/pull/29970) +* [[`b93c8a77a3`](https://github.com/nodejs/node/commit/b93c8a77a3)] - **test**: fix flaky doctool and test (Rich Trott) [#29979](https://github.com/nodejs/node/pull/29979) +* [[`aec8e77ae1`](https://github.com/nodejs/node/commit/aec8e77ae1)] - **test**: fix fs benchmark test (Rich Trott) [#29967](https://github.com/nodejs/node/pull/29967) +* [[`b9fd18f9fb`](https://github.com/nodejs/node/commit/b9fd18f9fb)] - **tools**: pull xcode\_emulation.py from node-gyp (Christian Clauss) [#30272](https://github.com/nodejs/node/pull/30272) +* [[`2810f1aec3`](https://github.com/nodejs/node/commit/2810f1aec3)] - **tools**: update tzdata to 2019c (Myles Borins) [#30478](https://github.com/nodejs/node/pull/30478) +* [[`41d1f166bc`](https://github.com/nodejs/node/commit/41d1f166bc)] - **tools**: fix Python 3 deprecation warning in test.py (Loris Zinsou) [#30208](https://github.com/nodejs/node/pull/30208) +* [[`b6546736a0`](https://github.com/nodejs/node/commit/b6546736a0)] - **tools**: fix Python 3 syntax error in mac\_tool.py (Christian Clauss) [#30146](https://github.com/nodejs/node/pull/30146) +* [[`87cb6b2418`](https://github.com/nodejs/node/commit/87cb6b2418)] - **tools**: use print() function in buildbot\_run.py (Christian Clauss) [#30148](https://github.com/nodejs/node/pull/30148) +* [[`309c395aba`](https://github.com/nodejs/node/commit/309c395aba)] - **tools**: undefined name opts -\> args in gyptest.py (Christian Clauss) [#30144](https://github.com/nodejs/node/pull/30144) +* [[`df0fbf2e46`](https://github.com/nodejs/node/commit/df0fbf2e46)] - **tools**: git rm -r tools/v8\_gypfiles/broken (Christian Clauss) [#30149](https://github.com/nodejs/node/pull/30149) +* [[`375f349760`](https://github.com/nodejs/node/commit/375f349760)] - **tools**: update ESLint to 6.6.0 (Colin Ihrig) [#30123](https://github.com/nodejs/node/pull/30123) +* [[`0b6fb3d1db`](https://github.com/nodejs/node/commit/0b6fb3d1db)] - **tools**: doc: improve async workflow of generate.js (Theotime Poisseau) [#30106](https://github.com/nodejs/node/pull/30106) +* [[`8d030131a4`](https://github.com/nodejs/node/commit/8d030131a4)] - **tools**: fix test runner in presence of NODE\_REPL\_EXTERNAL\_MODULE (Gus Caplan) [#29956](https://github.com/nodejs/node/pull/29956) +* [[`59033f618a`](https://github.com/nodejs/node/commit/59033f618a)] - **tools**: fix GYP MSVS solution generator for Python 3 (Michaël Zasso) [#29897](https://github.com/nodejs/node/pull/29897) +* [[`41430bea3c`](https://github.com/nodejs/node/commit/41430bea3c)] - **tools**: port Python 3 compat patches from node-gyp to gyp (Michaël Zasso) [#29897](https://github.com/nodejs/node/pull/29897) + ## 2019-10-21, Version 12.13.0 'Erbium' (LTS), @targos diff --git a/doc/guides/cve_management_process.md b/doc/guides/cve_management_process.md index 059d15f1f91f9e..1b87215ac722f2 100644 --- a/doc/guides/cve_management_process.md +++ b/doc/guides/cve_management_process.md @@ -82,7 +82,7 @@ after we get HackerOne up and running). * Review the request. * If a CVE is appropriate then assign the CVE as outline in the section titled - [CVE Management process for Node.js vulnerabilities](cve-management-process-for-nodejs-vulnerabilities) + [CVE Management process for Node.js vulnerabilities](#cve-management-process-for-nodejs-vulnerabilities) and return the CVE number to the requester (along with the request to keep it confidential until the vulnerability is announced) * If a CVE is not appropriate then respond to the requester diff --git a/doc/guides/maintaining-npm.md b/doc/guides/maintaining-npm.md index 9e953ed0271931..3be5528ad1907e 100644 --- a/doc/guides/maintaining-npm.md +++ b/doc/guides/maintaining-npm.md @@ -4,7 +4,7 @@ New pull requests should be opened when a "next" version of npm has been released. Once the "next" version has been promoted to "latest" the PR should be updated as necessary. -Two weeks after the "latest" release has been promoted it can land on master +One week after the "latest" release has been promoted, it can land on master assuming no major regressions are found. There are no additional constraints for Semver-Major releases. diff --git a/doc/releases.md b/doc/releases.md index 949672dba5873d..6e642fd5ed8d33 100644 --- a/doc/releases.md +++ b/doc/releases.md @@ -540,7 +540,7 @@ formatting passes the lint rules on `master`. ### 13. Promote and Sign the Release Builds -**It is important that the same individual who signed the release tag be the one +**The same individual who signed the release tag must be the one to promote the builds as the SHASUMS256.txt file needs to be signed with the same GPG key!** diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index d3198c7545f1d8..73b4c06c07d42e 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -47,6 +47,7 @@ const { // Lazy loaded to improve the startup performance. let StringDecoder; let createReadableStreamAsyncIterator; +let from; Object.setPrototypeOf(Readable.prototype, Stream.prototype); Object.setPrototypeOf(Readable, Stream); @@ -1194,40 +1195,8 @@ function endReadableNT(state, stream) { } Readable.from = function(iterable, opts) { - let iterator; - if (iterable && iterable[Symbol.asyncIterator]) - iterator = iterable[Symbol.asyncIterator](); - else if (iterable && iterable[Symbol.iterator]) - iterator = iterable[Symbol.iterator](); - else - throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); - - const readable = new Readable({ - objectMode: true, - ...opts - }); - // Reading boolean to protect against _read - // being called before last iteration completion. - let reading = false; - readable._read = function() { - if (!reading) { - reading = true; - next(); - } - }; - async function next() { - try { - const { value, done } = await iterator.next(); - if (done) { - readable.push(null); - } else if (readable.push(await value)) { - next(); - } else { - reading = false; - } - } catch (err) { - readable.destroy(err); - } + if (from === undefined) { + from = require('internal/streams/from'); } - return readable; + return from(Readable, iterable, opts); }; diff --git a/lib/_tls_common.js b/lib/_tls_common.js index 6cd93036c273a0..ef67d23ac85f3f 100644 --- a/lib/_tls_common.js +++ b/lib/_tls_common.js @@ -100,8 +100,7 @@ exports.createSecureContext = function createSecureContext(options) { var i; var val; - // NOTE: It's important to add CA before the cert to be able to load - // cert's issuer in C++ code. + // Add CA before the cert to be able to load cert's issuer in C++ code. const { ca } = options; if (ca) { if (Array.isArray(ca)) { @@ -132,7 +131,7 @@ exports.createSecureContext = function createSecureContext(options) { } } - // NOTE: It is important to set the key after the cert. + // Set the key after the cert. // `ssl_set_pkey` returns `0` when the key does not match the cert, but // `ssl_set_cert` returns `1` and nullifies the key in the SSL structure // which leads to the crash later on. diff --git a/lib/async_hooks.js b/lib/async_hooks.js index 0c177055364e41..c18a902c2ace84 100644 --- a/lib/async_hooks.js +++ b/lib/async_hooks.js @@ -17,6 +17,7 @@ const { executionAsyncId, triggerAsyncId, // Private API + hasAsyncIdStack, getHookArrays, enableHooks, disableHooks, @@ -172,7 +173,8 @@ class AsyncResource { return fn(...args); return Reflect.apply(fn, thisArg, args); } finally { - emitAfter(asyncId); + if (hasAsyncIdStack()) + emitAfter(asyncId); } } diff --git a/lib/buffer.js b/lib/buffer.js index ce2d7c63b5b911..ab30db67010107 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -21,7 +21,19 @@ 'use strict'; -const { Math, Object } = primordials; +const { + Object: { + defineProperties: ObjectDefineProperties, + defineProperty: ObjectDefineProperty, + setPrototypeOf: ObjectSetPrototypeOf, + create: ObjectCreate + }, + Math: { + floor: MathFloor, + trunc: MathTrunc, + min: MathMin + } +} = primordials; const { byteLengthUtf8, @@ -89,7 +101,7 @@ FastBuffer.prototype.constructor = Buffer; Buffer.prototype = FastBuffer.prototype; addBufferPrototypeMethods(Buffer.prototype); -const constants = Object.defineProperties({}, { +const constants = ObjectDefineProperties({}, { MAX_LENGTH: { value: kMaxLength, writable: false, @@ -111,7 +123,7 @@ let poolSize, poolOffset, allocPool; // do not own the ArrayBuffer allocator. Zero fill is always on in that case. const zeroFill = bindingZeroFill || [0]; -const encodingsMap = Object.create(null); +const encodingsMap = ObjectCreate(null); for (let i = 0; i < encodings.length; ++i) encodingsMap[encodings[i]] = i; @@ -168,7 +180,7 @@ function toInteger(n, defaultVal) { if (!Number.isNaN(n) && n >= Number.MIN_SAFE_INTEGER && n <= Number.MAX_SAFE_INTEGER) { - return ((n % 1) === 0 ? n : Math.floor(n)); + return ((n % 1) === 0 ? n : MathFloor(n)); } return defaultVal; } @@ -253,7 +265,7 @@ function Buffer(arg, encodingOrOffset, length) { return Buffer.from(arg, encodingOrOffset, length); } -Object.defineProperty(Buffer, Symbol.species, { +ObjectDefineProperty(Buffer, Symbol.species, { enumerable: false, configurable: true, get() { return FastBuffer; } @@ -311,7 +323,7 @@ const of = (...items) => { }; Buffer.of = of; -Object.setPrototypeOf(Buffer, Uint8Array); +ObjectSetPrototypeOf(Buffer, Uint8Array); // The 'assertSize' method will remove itself from the callstack when an error // occurs. This is done simply to keep the internal details of the @@ -364,8 +376,8 @@ function SlowBuffer(length) { return createUnsafeBuffer(length); } -Object.setPrototypeOf(SlowBuffer.prototype, Uint8Array.prototype); -Object.setPrototypeOf(SlowBuffer, Uint8Array); +ObjectSetPrototypeOf(SlowBuffer.prototype, Uint8Array.prototype); +ObjectSetPrototypeOf(SlowBuffer, Uint8Array); function allocate(size) { if (size <= 0) { @@ -712,7 +724,7 @@ function byteLength(string, encoding) { Buffer.byteLength = byteLength; // For backwards compatibility. -Object.defineProperty(Buffer.prototype, 'parent', { +ObjectDefineProperty(Buffer.prototype, 'parent', { enumerable: true, get() { if (!(this instanceof Buffer)) @@ -720,7 +732,7 @@ Object.defineProperty(Buffer.prototype, 'parent', { return this.buffer; } }); -Object.defineProperty(Buffer.prototype, 'offset', { +ObjectDefineProperty(Buffer.prototype, 'offset', { enumerable: true, get() { if (!(this instanceof Buffer)) @@ -789,7 +801,7 @@ let INSPECT_MAX_BYTES = 50; // Override how buffers are presented by util.inspect(). Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) { const max = INSPECT_MAX_BYTES; - const actualMax = Math.min(max, this.length); + const actualMax = MathMin(max, this.length); const remaining = this.length - max; let str = this.hexSlice(0, actualMax).replace(/(.{2})/g, '$1 ').trim(); if (remaining > 0) @@ -802,7 +814,7 @@ Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) { extras = true; obj[key] = this[key]; return obj; - }, Object.create(null)); + }, ObjectCreate(null)); if (extras) { if (this.length !== 0) str += ', '; @@ -1042,7 +1054,7 @@ Buffer.prototype.toJSON = function toJSON() { function adjustOffset(offset, length) { // Use Math.trunc() to convert offset to an integer value that can be larger // than an Int32. Hence, don't use offset | 0 or similar techniques. - offset = Math.trunc(offset); + offset = MathTrunc(offset); if (offset === 0) { return 0; } @@ -1163,7 +1175,7 @@ module.exports = { kStringMaxLength }; -Object.defineProperties(module.exports, { +ObjectDefineProperties(module.exports, { constants: { configurable: false, enumerable: true, diff --git a/lib/domain.js b/lib/domain.js index 1eeda06f0100dd..b980f8452c2113 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -28,7 +28,6 @@ const { Object, Reflect } = primordials; -const util = require('util'); const EventEmitter = require('events'); const { ERR_DOMAIN_CALLBACK_NOT_AVAILABLE, @@ -207,7 +206,7 @@ Domain.prototype.members = undefined; Domain.prototype._errorHandler = function(er) { var caught = false; - if (!util.isPrimitive(er)) { + if ((typeof er === 'object' && er !== null) || typeof er === 'function') { Object.defineProperty(er, 'domain', { configurable: true, enumerable: false, diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index f9593101561416..c7e9e9433aa8d4 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -25,7 +25,7 @@ function prepareMainThreadExecution(expandArgv1 = false) { // prepareStackTrace method, replacing the default in errors.js. if (getOptionValue('--enable-source-maps')) { const { prepareStackTrace } = - require('internal/source_map/source_map_cache'); + require('internal/source_map/prepare_stack_trace'); const { setPrepareStackTraceCallback } = internalBinding('errors'); setPrepareStackTraceCallback(prepareStackTrace); } diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js index fb17ba36ced0e3..250147d7529439 100644 --- a/lib/internal/crypto/keys.js +++ b/lib/internal/crypto/keys.js @@ -270,7 +270,10 @@ function prepareAsymmetricKey(key, ctx) { ...(ctx !== kCreatePrivate ? ['KeyObject'] : [])], key); } - return { data, ...parseKeyEncoding(key, undefined) }; + + const isPublic = + (ctx === kConsumePrivate || ctx === kCreatePrivate) ? false : undefined; + return { data, ...parseKeyEncoding(key, undefined, isPublic) }; } else { throw new ERR_INVALID_ARG_TYPE( 'key', diff --git a/lib/internal/fs/dir.js b/lib/internal/fs/dir.js index 175c632fc79948..fedd7ff8eddb2b 100644 --- a/lib/internal/fs/dir.js +++ b/lib/internal/fs/dir.js @@ -24,8 +24,10 @@ const { const kDirHandle = Symbol('kDirHandle'); const kDirPath = Symbol('kDirPath'); +const kDirBufferedEntries = Symbol('kDirBufferedEntries'); const kDirClosed = Symbol('kDirClosed'); const kDirOptions = Symbol('kDirOptions'); +const kDirReadImpl = Symbol('kDirReadImpl'); const kDirReadPromisified = Symbol('kDirReadPromisified'); const kDirClosePromisified = Symbol('kDirClosePromisified'); @@ -33,6 +35,7 @@ class Dir { constructor(handle, path, options) { if (handle == null) throw new ERR_MISSING_ARGS('handle'); this[kDirHandle] = handle; + this[kDirBufferedEntries] = []; this[kDirPath] = path; this[kDirClosed] = false; @@ -40,7 +43,8 @@ class Dir { encoding: 'utf8' }); - this[kDirReadPromisified] = internalUtil.promisify(this.read).bind(this); + this[kDirReadPromisified] = + internalUtil.promisify(this[kDirReadImpl]).bind(this, false); this[kDirClosePromisified] = internalUtil.promisify(this.close).bind(this); } @@ -49,6 +53,10 @@ class Dir { } read(callback) { + return this[kDirReadImpl](true, callback); + } + + [kDirReadImpl](maybeSync, callback) { if (this[kDirClosed] === true) { throw new ERR_DIR_CLOSED(); } @@ -59,11 +67,22 @@ class Dir { throw new ERR_INVALID_CALLBACK(callback); } + if (this[kDirBufferedEntries].length > 0) { + const [ name, type ] = this[kDirBufferedEntries].splice(0, 2); + if (maybeSync) + process.nextTick(getDirent, this[kDirPath], name, type, callback); + else + getDirent(this[kDirPath], name, type, callback); + return; + } + const req = new FSReqCallback(); req.oncomplete = (err, result) => { if (err || result === null) { return callback(err, result); } + + this[kDirBufferedEntries] = result.slice(2); getDirent(this[kDirPath], result[0], result[1], callback); }; @@ -78,6 +97,11 @@ class Dir { throw new ERR_DIR_CLOSED(); } + if (this[kDirBufferedEntries].length > 0) { + const [ name, type ] = this[kDirBufferedEntries].splice(0, 2); + return getDirent(this[kDirPath], name, type); + } + const ctx = { path: this[kDirPath] }; const result = this[kDirHandle].read( this[kDirOptions].encoding, @@ -90,6 +114,7 @@ class Dir { return result; } + this[kDirBufferedEntries] = result.slice(2); return getDirent(this[kDirPath], result[0], result[1]); } diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 28c91ee22d8f6d..f4e419b0f88334 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -2174,14 +2174,11 @@ function processHeaders(oldHeaders) { return headers; } -function onFileCloseError(stream, err) { - stream.emit(err); -} function onFileUnpipe() { const stream = this.sink[kOwner]; if (stream.ownsFd) - this.source.close().catch(onFileCloseError.bind(stream)); + this.source.close().catch(stream.destroy.bind(stream)); else this.source.releaseFD(); } diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 2d058b7e0dace3..64505220ab9e18 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -261,7 +261,10 @@ function readPackageScope(checkPath) { if (checkPath.endsWith(path.sep + 'node_modules')) return false; const pjson = readPackage(checkPath); - if (pjson) return pjson; + if (pjson) return { + path: checkPath, + data: pjson + }; } return false; } @@ -960,13 +963,32 @@ Module.prototype._compile = function(content, filename) { return result; }; - // Native extension for .js +let warnRequireESM = true; Module._extensions['.js'] = function(module, filename) { - if (experimentalModules && filename.endsWith('.js')) { + if (filename.endsWith('.js')) { const pkg = readPackageScope(filename); - if (pkg && pkg.type === 'module') { - throw new ERR_REQUIRE_ESM(filename); + if (pkg && pkg.data && pkg.data.type === 'module') { + if (warnRequireESM) { + const parentPath = module.parent && module.parent.filename; + const basename = parentPath && + path.basename(filename) === path.basename(parentPath) ? + filename : path.basename(filename); + process.emitWarning( + 'require() of ES modules is not supported.\nrequire() of ' + + `${filename} ${parentPath ? `from ${module.parent.filename} ` : ''}` + + 'is an ES module file as it is a .js file whose nearest parent ' + + 'package.json contains "type": "module" which defines all .js ' + + 'files in that package scope as ES modules.\nInstead rename ' + + `${basename} to end in .cjs, change the requiring code to use ` + + 'import(), or remove "type": "module" from ' + + `${path.resolve(pkg.path, 'package.json')}.` + ); + warnRequireESM = false; + } + if (experimentalModules) { + throw new ERR_REQUIRE_ESM(filename); + } } } const content = fs.readFileSync(filename, 'utf8'); diff --git a/lib/internal/modules/esm/default_resolve.js b/lib/internal/modules/esm/default_resolve.js index 7686e3e003eede..88af3cb5f8d286 100644 --- a/lib/internal/modules/esm/default_resolve.js +++ b/lib/internal/modules/esm/default_resolve.js @@ -9,6 +9,8 @@ const { getOptionValue } = require('internal/options'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const experimentalJsonModules = getOptionValue('--experimental-json-modules'); +const esModuleSpecifierResolution = + getOptionValue('--es-module-specifier-resolution'); const typeFlag = getOptionValue('--input-type'); const experimentalWasmModules = getOptionValue('--experimental-wasm-modules'); const { resolve: moduleWrapResolve, @@ -110,6 +112,8 @@ function resolve(specifier, parentURL) { if (!format) { if (isMain) format = type === TYPE_MODULE ? 'module' : 'commonjs'; + else if (esModuleSpecifierResolution === 'node') + format = 'commonjs'; else throw new ERR_UNKNOWN_FILE_EXTENSION(fileURLToPath(url)); } diff --git a/lib/internal/source_map/prepare_stack_trace.js b/lib/internal/source_map/prepare_stack_trace.js new file mode 100644 index 00000000000000..d6c5fce60a29e3 --- /dev/null +++ b/lib/internal/source_map/prepare_stack_trace.js @@ -0,0 +1,52 @@ +'use strict'; + +const debug = require('internal/util/debuglog').debuglog('source_map'); +const { findSourceMap } = require('internal/source_map/source_map_cache'); +const { overrideStackTrace } = require('internal/errors'); + +// Create a prettified stacktrace, inserting context from source maps +// if possible. +const ErrorToString = Error.prototype.toString; // Capture original toString. +const prepareStackTrace = (globalThis, error, trace) => { + // API for node internals to override error stack formatting + // without interfering with userland code. + // TODO(bcoe): add support for source-maps to repl. + if (overrideStackTrace.has(error)) { + const f = overrideStackTrace.get(error); + overrideStackTrace.delete(error); + return f(error, trace); + } + + const { SourceMap } = require('internal/source_map/source_map'); + const errorString = ErrorToString.call(error); + + if (trace.length === 0) { + return errorString; + } + const preparedTrace = trace.map((t, i) => { + let str = i !== 0 ? '\n at ' : ''; + str = `${str}${t}`; + try { + const sourceMap = findSourceMap(t.getFileName(), error); + if (sourceMap && sourceMap.data) { + const sm = new SourceMap(sourceMap.data); + // Source Map V3 lines/columns use zero-based offsets whereas, in + // stack traces, they start at 1/1. + const [, , url, line, col] = + sm.findEntry(t.getLineNumber() - 1, t.getColumnNumber() - 1); + if (url && line !== undefined && col !== undefined) { + str += + `\n -> ${url.replace('file://', '')}:${line + 1}:${col + 1}`; + } + } + } catch (err) { + debug(err.stack); + } + return str; + }); + return `${errorString}\n at ${preparedTrace.join('')}`; +}; + +module.exports = { + prepareStackTrace, +}; diff --git a/lib/internal/source_map/source_map_cache.js b/lib/internal/source_map/source_map_cache.js index 94a4165546b77c..0e77203e9d6f1d 100644 --- a/lib/internal/source_map/source_map_cache.js +++ b/lib/internal/source_map/source_map_cache.js @@ -17,7 +17,6 @@ const cjsSourceMapCache = new WeakMap(); // on filenames. const esmSourceMapCache = new Map(); const { fileURLToPath, URL } = require('url'); -const { overrideStackTrace } = require('internal/errors'); let experimentalSourceMaps; function maybeCacheSourceMap(filename, content, cjsModuleInstance) { @@ -38,18 +37,22 @@ function maybeCacheSourceMap(filename, content, cjsModuleInstance) { const match = content.match(/\/[*/]#\s+sourceMappingURL=(?[^\s]+)/); if (match) { + const data = dataFromUrl(basePath, match.groups.sourceMappingURL); + const url = data ? null : match.groups.sourceMappingURL; if (cjsModuleInstance) { cjsSourceMapCache.set(cjsModuleInstance, { filename, - url: match.groups.sourceMappingURL, - data: dataFromUrl(basePath, match.groups.sourceMappingURL) + lineLengths: lineLengths(content), + data, + url }); } else { // If there is no cjsModuleInstance assume we are in a // "modules/esm" context. esmSourceMapCache.set(filename, { - url: match.groups.sourceMappingURL, - data: dataFromUrl(basePath, match.groups.sourceMappingURL) + lineLengths: lineLengths(content), + data, + url }); } } @@ -73,6 +76,18 @@ function dataFromUrl(basePath, sourceMappingURL) { } } +// Cache the length of each line in the file that a source map was extracted +// from. This allows translation from byte offset V8 coverage reports, +// to line/column offset Source Map V3. +function lineLengths(content) { + // We purposefully keep \r as part of the line-length calculation, in + // cases where there is a \r\n separator, so that this can be taken into + // account in coverage calculations. + return content.split(/\n|\u2028|\u2029/).map((line) => { + return line.length; + }); +} + function sourceMapFromFile(sourceMapFile) { try { const content = fs.readFileSync(sourceMapFile, 'utf8'); @@ -161,56 +176,14 @@ function appendCJSCache(obj) { const value = cjsSourceMapCache.get(Module._cache[key]); if (value) { obj[`file://${key}`] = { - url: value.url, - data: value.data + lineLengths: value.lineLengths, + data: value.data, + url: value.url }; } }); } -// Create a prettified stacktrace, inserting context from source maps -// if possible. -const ErrorToString = Error.prototype.toString; // Capture original toString. -const prepareStackTrace = (globalThis, error, trace) => { - // API for node internals to override error stack formatting - // without interfering with userland code. - // TODO(bcoe): add support for source-maps to repl. - if (overrideStackTrace.has(error)) { - const f = overrideStackTrace.get(error); - overrideStackTrace.delete(error); - return f(error, trace); - } - - const { SourceMap } = require('internal/source_map/source_map'); - const errorString = ErrorToString.call(error); - - if (trace.length === 0) { - return errorString; - } - const preparedTrace = trace.map((t, i) => { - let str = i !== 0 ? '\n at ' : ''; - str = `${str}${t}`; - try { - const sourceMap = findSourceMap(t.getFileName(), error); - if (sourceMap && sourceMap.data) { - const sm = new SourceMap(sourceMap.data); - // Source Map V3 lines/columns use zero-based offsets whereas, in - // stack traces, they start at 1/1. - const [, , url, line, col] = - sm.findEntry(t.getLineNumber() - 1, t.getColumnNumber() - 1); - if (url && line !== undefined && col !== undefined) { - str += - `\n -> ${url.replace('file://', '')}:${line + 1}:${col + 1}`; - } - } - } catch (err) { - debug(err.stack); - } - return str; - }); - return `${errorString}\n at ${preparedTrace.join('')}`; -}; - // Attempt to lookup a source map, which is either attached to a file URI, or // keyed on an error instance. function findSourceMap(uri, error) { @@ -230,8 +203,8 @@ function findSourceMap(uri, error) { } module.exports = { + findSourceMap, maybeCacheSourceMap, - prepareStackTrace, rekeySourceMap, sourceMapCacheToObject, }; diff --git a/lib/internal/streams/from.js b/lib/internal/streams/from.js new file mode 100644 index 00000000000000..e809f2658d5a9a --- /dev/null +++ b/lib/internal/streams/from.js @@ -0,0 +1,46 @@ +'use strict'; + +const { + ERR_INVALID_ARG_TYPE +} = require('internal/errors').codes; + +function from(Readable, iterable, opts) { + let iterator; + if (iterable && iterable[Symbol.asyncIterator]) + iterator = iterable[Symbol.asyncIterator](); + else if (iterable && iterable[Symbol.iterator]) + iterator = iterable[Symbol.iterator](); + else + throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); + + const readable = new Readable({ + objectMode: true, + ...opts + }); + // Reading boolean to protect against _read + // being called before last iteration completion. + let reading = false; + readable._read = function() { + if (!reading) { + reading = true; + next(); + } + }; + async function next() { + try { + const { value, done } = await iterator.next(); + if (done) { + readable.push(null); + } else if (readable.push(await value)) { + next(); + } else { + reading = false; + } + } catch (err) { + readable.destroy(err); + } + } + return readable; +} + +module.exports = from; diff --git a/lib/net.js b/lib/net.js index baaf2180d1b463..c0d2576afc496b 100644 --- a/lib/net.js +++ b/lib/net.js @@ -39,7 +39,8 @@ const { const assert = require('internal/assert'); const { UV_EADDRINUSE, - UV_EINVAL + UV_EINVAL, + UV_ENOTCONN } = internalBinding('uv'); const { Buffer } = require('buffer'); @@ -403,7 +404,7 @@ Socket.prototype._final = function(cb) { req.callback = cb; const err = this._handle.shutdown(req); - if (err === 1) // synchronous finish + if (err === 1 || err === UV_ENOTCONN) // synchronous finish return afterShutdown.call(req, 0); else if (err !== 0) return this.destroy(errnoException(err, 'shutdown')); diff --git a/lib/stream.js b/lib/stream.js index 826f0e6d9adb6c..725038ba9c0d1c 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -21,9 +21,9 @@ 'use strict'; -const { Buffer } = require('buffer'); const pipeline = require('internal/streams/pipeline'); const eos = require('internal/streams/end-of-stream'); +const internalBuffer = require('internal/buffer'); // Note: export Stream before Readable/Writable/Duplex/... // to avoid a cross-reference(require) issues @@ -42,24 +42,8 @@ Stream.finished = eos; Stream.Stream = Stream; Stream._isUint8Array = require('internal/util/types').isUint8Array; - -const version = process.version.substr(1).split('.'); -if (version[0] === 0 && version[1] < 12) { - Stream._uint8ArrayToBuffer = Buffer; -} else { - try { - const internalBuffer = require('internal/buffer'); - Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { - return new internalBuffer.FastBuffer(chunk.buffer, - chunk.byteOffset, - chunk.byteLength); - }; - } catch (e) { // eslint-disable-line no-unused-vars - } - - if (!Stream._uint8ArrayToBuffer) { - Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { - return Buffer.prototype.slice.call(chunk); - }; - } -} +Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { + return new internalBuffer.FastBuffer(chunk.buffer, + chunk.byteOffset, + chunk.byteLength); +}; diff --git a/node.gyp b/node.gyp index f2fcf85d74b394..8f4dc518e1600a 100644 --- a/node.gyp +++ b/node.gyp @@ -176,6 +176,7 @@ 'lib/internal/repl/history.js', 'lib/internal/repl/utils.js', 'lib/internal/socket_list.js', + 'lib/internal/source_map/prepare_stack_trace.js', 'lib/internal/source_map/source_map.js', 'lib/internal/source_map/source_map_cache.js', 'lib/internal/test/binding.js', @@ -204,6 +205,7 @@ 'lib/internal/streams/async_iterator.js', 'lib/internal/streams/buffer_list.js', 'lib/internal/streams/duplexpair.js', + 'lib/internal/streams/from.js', 'lib/internal/streams/legacy.js', 'lib/internal/streams/destroy.js', 'lib/internal/streams/state.js', @@ -290,7 +292,7 @@ '-Wl,-bnoerrmsg', ], }], - ['(OS=="linux" or OS=="mac") and llvm_version!=0', { + ['OS in ("linux", "mac") and llvm_version != "0.0"', { 'libraries': ['-latomic'], }], ], diff --git a/src/api/environment.cc b/src/api/environment.cc index 2c0fe1306319b2..138f9ada984a95 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -349,6 +349,9 @@ MaybeLocal GetPerContextExports(Local context) { return handle_scope.Escape(exports); } +// Any initialization logic should be performed in +// InitializeContext, because embedders don't necessarily +// call NewContext and so they will experience breakages. Local NewContext(Isolate* isolate, Local object_template) { auto context = Context::New(isolate, nullptr, object_template); @@ -358,8 +361,6 @@ Local NewContext(Isolate* isolate, return Local(); } - InitializeContextRuntime(context); - return context; } @@ -393,7 +394,7 @@ void InitializeContextRuntime(Local context) { } } -bool InitializeContext(Local context) { +bool InitializeContextForSnapshot(Local context) { Isolate* isolate = context->GetIsolate(); HandleScope handle_scope(isolate); @@ -447,6 +448,15 @@ bool InitializeContext(Local context) { return true; } +bool InitializeContext(Local context) { + if (!InitializeContextForSnapshot(context)) { + return false; + } + + InitializeContextRuntime(context); + return true; +} + uv_loop_t* GetCurrentEventLoop(Isolate* isolate) { HandleScope handle_scope(isolate); Local context = isolate->GetCurrentContext(); diff --git a/src/connection_wrap.h b/src/connection_wrap.h index 5b114088760dad..db74dc5df4aa5b 100644 --- a/src/connection_wrap.h +++ b/src/connection_wrap.h @@ -3,12 +3,13 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "env.h" #include "stream_wrap.h" #include "v8.h" namespace node { +class Environment; + template class ConnectionWrap : public LibuvStreamWrap { public: diff --git a/src/diagnosticfilename-inl.h b/src/diagnosticfilename-inl.h index 58a3a933acc605..a0d44fd56bcd60 100644 --- a/src/diagnosticfilename-inl.h +++ b/src/diagnosticfilename-inl.h @@ -4,10 +4,10 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node_internals.h" -#include "env-inl.h" - namespace node { +class Environment; + inline DiagnosticFilename::DiagnosticFilename( Environment* env, const char* prefix, diff --git a/src/env.h b/src/env.h index 8e12764ea3a9a3..6ffacd47212571 100644 --- a/src/env.h +++ b/src/env.h @@ -869,7 +869,7 @@ class Environment : public MemoryRetainer { void CreateProperties(); // Should be called before InitializeInspector() void InitializeDiagnostics(); -#if HAVE_INSPECTOR && NODE_USE_V8_PLATFORM +#if HAVE_INSPECTOR // If the environment is created for a worker, pass parent_handle and // the ownership if transferred into the Environment. int InitializeInspector(inspector::ParentInspectorHandle* parent_handle); diff --git a/src/inspector/main_thread_interface.cc b/src/inspector/main_thread_interface.cc index ac4461baed4afd..48a964d564fec2 100644 --- a/src/inspector/main_thread_interface.cc +++ b/src/inspector/main_thread_interface.cc @@ -87,15 +87,15 @@ class CallRequest : public Request { class DispatchMessagesTask : public v8::Task { public: - explicit DispatchMessagesTask(MainThreadInterface* thread) + explicit DispatchMessagesTask(std::weak_ptr thread) : thread_(thread) {} void Run() override { - thread_->DispatchMessages(); + if (auto thread = thread_.lock()) thread->DispatchMessages(); } private: - MainThreadInterface* thread_; + std::weak_ptr thread_; }; template @@ -231,11 +231,16 @@ void MainThreadInterface::Post(std::unique_ptr request) { if (needs_notify) { if (isolate_ != nullptr && platform_ != nullptr) { std::shared_ptr taskrunner = - platform_->GetForegroundTaskRunner(isolate_); - taskrunner->PostTask(std::make_unique(this)); - isolate_->RequestInterrupt([](v8::Isolate* isolate, void* thread) { - static_cast(thread)->DispatchMessages(); - }, this); + platform_->GetForegroundTaskRunner(isolate_); + std::weak_ptr* interface_ptr = + new std::weak_ptr(shared_from_this()); + taskrunner->PostTask( + std::make_unique(*interface_ptr)); + isolate_->RequestInterrupt([](v8::Isolate* isolate, void* opaque) { + std::unique_ptr> interface_ptr { + static_cast*>(opaque) }; + if (auto iface = interface_ptr->lock()) iface->DispatchMessages(); + }, static_cast(interface_ptr)); } } incoming_message_cond_.Broadcast(scoped_lock); diff --git a/src/inspector/main_thread_interface.h b/src/inspector/main_thread_interface.h index 9a48192cd374e5..78337a25e43808 100644 --- a/src/inspector/main_thread_interface.h +++ b/src/inspector/main_thread_interface.h @@ -5,7 +5,6 @@ #error("This header can only be used when inspector is enabled") #endif -#include "env.h" #include "inspector_agent.h" #include "node_mutex.h" @@ -70,7 +69,8 @@ class MainThreadHandle : public std::enable_shared_from_this { friend class MainThreadInterface; }; -class MainThreadInterface { +class MainThreadInterface : + public std::enable_shared_from_this { public: MainThreadInterface(Agent* agent, uv_loop_t*, v8::Isolate* isolate, v8::Platform* platform); diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index cf0110144a535d..fb3415c275e6db 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -665,10 +665,10 @@ class NodeInspectorClient : public V8InspectorClient { } std::shared_ptr getThreadHandle() { - if (interface_ == nullptr) { - interface_.reset(new MainThreadInterface( + if (!interface_) { + interface_ = std::make_shared( env_->inspector_agent(), env_->event_loop(), env_->isolate(), - env_->isolate_data()->platform())); + env_->isolate_data()->platform()); } return interface_->GetHandle(); } @@ -739,7 +739,7 @@ class NodeInspectorClient : public V8InspectorClient { bool waiting_for_frontend_ = false; bool waiting_for_sessions_disconnect_ = false; // Allows accessing Inspector from non-main threads - std::unique_ptr interface_; + std::shared_ptr interface_; std::shared_ptr worker_manager_; }; diff --git a/src/inspector_profiler.h b/src/inspector_profiler.h index 4a21eb3a2d3383..187bc0d1c49a16 100644 --- a/src/inspector_profiler.h +++ b/src/inspector_profiler.h @@ -7,7 +7,6 @@ #error("This header can only be used when inspector is enabled") #endif -#include "env.h" #include "inspector_agent.h" namespace node { diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index a87af79a890832..eea8adea3769ee 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -186,7 +186,7 @@ inline static napi_status ConcludeDeferred(napi_env env, } // Wrapper around v8impl::Persistent that implements reference counting. -class Reference : private Finalizer { +class Reference : private Finalizer, RefTracker { private: Reference(napi_env env, v8::Local value, @@ -203,6 +203,9 @@ class Reference : private Finalizer { _persistent.SetWeak( this, FinalizeCallback, v8::WeakCallbackType::kParameter); } + Link(finalize_callback == nullptr + ? &env->reflist + : &env->finalizing_reflist); } public: @@ -242,6 +245,7 @@ class Reference : private Finalizer { // the finalizer and _delete_self is set. In this case we // know we need to do the deletion so just do it. static void Delete(Reference* reference) { + reference->Unlink(); if ((reference->RefCount() != 0) || (reference->_delete_self) || (reference->_finalize_ran)) { @@ -286,6 +290,26 @@ class Reference : private Finalizer { } private: + void Finalize(bool is_env_teardown = false) override { + if (_finalize_callback != nullptr) { + _env->CallIntoModuleThrow([&](napi_env env) { + _finalize_callback( + env, + _finalize_data, + _finalize_hint); + }); + } + + // this is safe because if a request to delete the reference + // is made in the finalize_callback it will defer deletion + // to this block and set _delete_self to true + if (_delete_self || is_env_teardown) { + Delete(this); + } else { + _finalize_ran = true; + } + } + // The N-API finalizer callback may make calls into the engine. V8's heap is // not in a consistent state during the weak callback, and therefore it does // not support calls back into it. However, it provides a mechanism for adding @@ -303,25 +327,7 @@ class Reference : private Finalizer { } static void SecondPassCallback(const v8::WeakCallbackInfo& data) { - Reference* reference = data.GetParameter(); - - if (reference->_finalize_callback != nullptr) { - reference->_env->CallIntoModuleThrow([&](napi_env env) { - reference->_finalize_callback( - env, - reference->_finalize_data, - reference->_finalize_hint); - }); - } - - // this is safe because if a request to delete the reference - // is made in the finalize_callback it will defer deletion - // to this block and set _delete_self to true - if (reference->_delete_self) { - Delete(reference); - } else { - reference->_finalize_ran = true; - } + data.GetParameter()->Finalize(); } v8impl::Persistent _persistent; diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 506e693f821227..2e0a7a1d6add20 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -15,6 +15,13 @@ struct napi_env__ { CHECK_EQ(isolate, context->GetIsolate()); } virtual ~napi_env__() { + // First we must finalize those references that have `napi_finalizer` + // callbacks. The reason is that addons might store other references which + // they delete during their `napi_finalizer` callbacks. If we deleted such + // references here first, they would be doubly deleted when the + // `napi_finalizer` deleted them subsequently. + v8impl::RefTracker::FinalizeAll(&finalizing_reflist); + v8impl::RefTracker::FinalizeAll(&reflist); if (instance_data.finalize_cb != nullptr) { CallIntoModuleThrow([&](napi_env env) { instance_data.finalize_cb(env, instance_data.data, instance_data.hint); @@ -55,6 +62,12 @@ struct napi_env__ { } v8impl::Persistent last_exception; + + // We store references in two different lists, depending on whether they have + // `napi_finalizer` callbacks, because we must first finalize the ones that + // have such a callback. See `~napi_env__()` above for details. + v8impl::RefTracker::RefList reflist; + v8impl::RefTracker::RefList finalizing_reflist; napi_extended_error_info last_error; int open_handle_scopes = 0; int open_callback_scopes = 0; diff --git a/src/js_native_api_v8_internals.h b/src/js_native_api_v8_internals.h index ddd219818cdfa9..74afd1172e527e 100644 --- a/src/js_native_api_v8_internals.h +++ b/src/js_native_api_v8_internals.h @@ -28,6 +28,45 @@ namespace v8impl { +class RefTracker { + public: + RefTracker() {} + virtual ~RefTracker() {} + virtual void Finalize(bool isEnvTeardown) {} + + typedef RefTracker RefList; + + inline void Link(RefList* list) { + prev_ = list; + next_ = list->next_; + if (next_ != nullptr) { + next_->prev_ = this; + } + list->next_ = this; + } + + inline void Unlink() { + if (prev_ != nullptr) { + prev_->next_ = next_; + } + if (next_ != nullptr) { + next_->prev_ = prev_; + } + prev_ = nullptr; + next_ = nullptr; + } + + static void FinalizeAll(RefList* list) { + while (list->next_ != nullptr) { + list->next_->Finalize(true); + } + } + + private: + RefList* next_ = nullptr; + RefList* prev_ = nullptr; +}; + template using Persistent = v8::Global; diff --git a/src/js_stream.h b/src/js_stream.h index 8198a6bb36a4e1..460ac23bc98b21 100644 --- a/src/js_stream.h +++ b/src/js_stream.h @@ -4,12 +4,13 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "async_wrap.h" -#include "env.h" #include "stream_base.h" #include "v8.h" namespace node { +class Environment; + class JSStream : public AsyncWrap, public StreamBase { public: static void Initialize(v8::Local target, diff --git a/src/large_pages/node_large_page.cc b/src/large_pages/node_large_page.cc index f6f5e72c283632..4e2f8fc4410316 100644 --- a/src/large_pages/node_large_page.cc +++ b/src/large_pages/node_large_page.cc @@ -83,11 +83,11 @@ static void PrintSystemError(int error) { return; } -inline int64_t hugepage_align_up(int64_t addr) { +inline uintptr_t hugepage_align_up(uintptr_t addr) { return (((addr) + (hps) - 1) & ~((hps) - 1)); } -inline int64_t hugepage_align_down(int64_t addr) { +inline uintptr_t hugepage_align_down(uintptr_t addr) { return ((addr) & ~((hps) - 1)); } @@ -103,7 +103,7 @@ static struct text_region FindNodeTextRegion() { std::string permission; std::string dev; char dash; - int64_t start, end, offset, inode; + uintptr_t start, end, offset, inode; struct text_region nregion; nregion.found_text_region = false; @@ -138,18 +138,20 @@ static struct text_region FindNodeTextRegion() { std::string pathname; iss >> pathname; if (pathname == exename && permission == "r-xp") { - start = reinterpret_cast(&__nodetext); - char* from = reinterpret_cast(hugepage_align_up(start)); - char* to = reinterpret_cast(hugepage_align_down(end)); - - if (from < to) { - size_t size = to - from; - nregion.found_text_region = true; - nregion.from = from; - nregion.to = to; - nregion.total_hugepages = size / hps; + uintptr_t ntext = reinterpret_cast(&__nodetext); + if (ntext >= start && ntext < end) { + char* from = reinterpret_cast(hugepage_align_up(ntext)); + char* to = reinterpret_cast(hugepage_align_down(end)); + + if (from < to) { + size_t size = to - from; + nregion.found_text_region = true; + nregion.from = from; + nregion.to = to; + nregion.total_hugepages = size / hps; + } + break; } - break; } } } @@ -359,6 +361,7 @@ MoveTextRegionToLargePages(const text_region& r) { } return -1; } + memcpy(start, nmem, size); #elif defined(__FreeBSD__) tmem = mmap(start, size, PROT_READ | PROT_WRITE | PROT_EXEC, @@ -393,8 +396,6 @@ MoveTextRegionToLargePages(const text_region& r) { return -1; } memcpy(start, tmem, size); -#else - memcpy(start, nmem, size); #endif ret = mprotect(start, size, PROT_READ | PROT_EXEC); diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 67e0cbc6185f34..5448cea575dc67 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -48,11 +48,10 @@ using v8::Undefined; using v8::Value; static const char* const EXTENSIONS[] = { - ".mjs", - ".cjs", ".js", ".json", - ".node" + ".node", + ".mjs" }; ModuleWrap::ModuleWrap(Environment* env, diff --git a/src/node.cc b/src/node.cc index 572490730da585..ae53d0c31c3568 100644 --- a/src/node.cc +++ b/src/node.cc @@ -220,7 +220,7 @@ MaybeLocal ExecuteBootstrapper(Environment* env, return scope.EscapeMaybe(result); } -#if HAVE_INSPECTOR && NODE_USE_V8_PLATFORM +#if HAVE_INSPECTOR int Environment::InitializeInspector( inspector::ParentInspectorHandle* parent_handle) { std::string inspector_path; @@ -785,13 +785,6 @@ int InitializeNodeWithArgs(std::vector* argv, &default_env_options->redirect_warnings); } -#if HAVE_OPENSSL - std::string* openssl_config = &per_process::cli_options->openssl_config; - if (openssl_config->empty()) { - credentials::SafeGetenv("OPENSSL_CONF", openssl_config); - } -#endif - #if !defined(NODE_WITHOUT_NODE_OPTIONS) std::string node_options; diff --git a/src/node.h b/src/node.h index 13d71d41398545..d5691513992adb 100644 --- a/src/node.h +++ b/src/node.h @@ -254,7 +254,11 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { // flushing. virtual bool FlushForegroundTasks(v8::Isolate* isolate) = 0; virtual void DrainTasks(v8::Isolate* isolate) = 0; - virtual void CancelPendingDelayedTasks(v8::Isolate* isolate) = 0; + + // TODO(addaleax): Remove this, it is unnecessary. + // This would currently be called before `UnregisterIsolate()` but will be + // folded into it in the future. + virtual void CancelPendingDelayedTasks(v8::Isolate* isolate); // This needs to be called between the calls to `Isolate::Allocate()` and // `Isolate::Initialize()`, so that initialization can already start @@ -263,9 +267,11 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { // This function may only be called once per `Isolate`. virtual void RegisterIsolate(v8::Isolate* isolate, struct uv_loop_s* loop) = 0; - // This needs to be called right before calling `Isolate::Dispose()`. - // This function may only be called once per `Isolate`. + + // This function may only be called once per `Isolate`, and discard any + // pending delayed tasks scheduled for that isolate. virtual void UnregisterIsolate(v8::Isolate* isolate) = 0; + // The platform should call the passed function once all state associated // with the given isolate has been cleaned up. This can, but does not have to, // happen asynchronously. diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 2d539094a0589e..ad06141752eae9 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2735,7 +2735,7 @@ void SSLWrap::GetSharedSigalgs(const FunctionCallbackInfo& args) { case NID_ED448: sig_with_md = "Ed448+"; break; - +#ifndef OPENSSL_NO_GOST case NID_id_GostR3410_2001: sig_with_md = "gost2001+"; break; @@ -2747,7 +2747,7 @@ void SSLWrap::GetSharedSigalgs(const FunctionCallbackInfo& args) { case NID_id_GostR3410_2012_512: sig_with_md = "gost2012_512+"; break; - +#endif // !OPENSSL_NO_GOST default: const char* sn = OBJ_nid2sn(sign_nid); @@ -6961,30 +6961,19 @@ void TimingSafeEqual(const FunctionCallbackInfo& args) { } void InitCryptoOnce() { - SSL_load_error_strings(); - OPENSSL_no_config(); +#ifndef OPENSSL_IS_BORINGSSL + OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new(); // --openssl-config=... if (!per_process::cli_options->openssl_config.empty()) { - OPENSSL_load_builtin_modules(); -#ifndef OPENSSL_NO_ENGINE - ENGINE_load_builtin_engines(); -#endif - ERR_clear_error(); - CONF_modules_load_file(per_process::cli_options->openssl_config.c_str(), - nullptr, - CONF_MFLAGS_DEFAULT_SECTION); - int err = ERR_get_error(); - if (0 != err) { - fprintf(stderr, - "openssl config failed: %s\n", - ERR_error_string(err, nullptr)); - CHECK_NE(err, 0); - } + const char* conf = per_process::cli_options->openssl_config.c_str(); + OPENSSL_INIT_set_config_filename(settings, conf); } - SSL_library_init(); - OpenSSL_add_all_algorithms(); + OPENSSL_init_ssl(0, settings); + OPENSSL_INIT_free(settings); + settings = nullptr; +#endif #ifdef NODE_FIPS_MODE /* Override FIPS settings in cnf file, if needed. */ diff --git a/src/node_crypto_bio.h b/src/node_crypto_bio.h index fef91750d541e1..5de943806a9642 100644 --- a/src/node_crypto_bio.h +++ b/src/node_crypto_bio.h @@ -26,11 +26,13 @@ #include "node_crypto.h" #include "openssl/bio.h" -#include "env.h" #include "util.h" #include "v8.h" namespace node { + +class Environment; + namespace crypto { // This class represents buffers for OpenSSL I/O, implemented as a singly-linked diff --git a/src/node_dir.cc b/src/node_dir.cc index c9df7e67e8323a..382f00f56e627c 100644 --- a/src/node_dir.cc +++ b/src/node_dir.cc @@ -59,8 +59,8 @@ DirHandle::DirHandle(Environment* env, Local obj, uv_dir_t* dir) dir_(dir) { MakeWeak(); - dir_->nentries = 1; - dir_->dirents = &dirent_; + dir_->nentries = arraysize(dirents_); + dir_->dirents = dirents_; } DirHandle* DirHandle::New(Environment* env, uv_dir_t* dir) { @@ -160,7 +160,37 @@ void DirHandle::Close(const FunctionCallbackInfo& args) { } } -void AfterDirReadSingle(uv_fs_t* req) { +static MaybeLocal DirentListToArray( + Environment* env, + uv_dirent_t* ents, + int num, + enum encoding encoding, + Local* err_out) { + MaybeStackBuffer, 96> entries(num * 3); + + // Return an array of all read filenames. + int j = 0; + for (int i = 0; i < num; i++) { + Local filename; + Local error; + const size_t namelen = strlen(ents[i].name); + if (!StringBytes::Encode(env->isolate(), + ents[i].name, + namelen, + encoding, + &error).ToLocal(&filename)) { + *err_out = error; + return MaybeLocal(); + } + + entries[j++] = filename; + entries[j++] = Integer::New(env->isolate(), ents[i].type); + } + + return Array::New(env->isolate(), entries.out(), j); +} + +static void AfterDirRead(uv_fs_t* req) { FSReqBase* req_wrap = FSReqBase::from_req(req); FSReqAfterScope after(req_wrap, req); @@ -170,7 +200,6 @@ void AfterDirReadSingle(uv_fs_t* req) { Environment* env = req_wrap->env(); Isolate* isolate = env->isolate(); - Local error; if (req->result == 0) { // Done @@ -182,26 +211,17 @@ void AfterDirReadSingle(uv_fs_t* req) { uv_dir_t* dir = static_cast(req->ptr); req->ptr = nullptr; - // Single entries are returned without an array wrapper - const uv_dirent_t& ent = dir->dirents[0]; - - MaybeLocal filename = - StringBytes::Encode(isolate, - ent.name, - req_wrap->encoding(), - &error); - if (filename.IsEmpty()) + Local error; + Local js_array; + if (!DirentListToArray(env, + dir->dirents, + req->result, + req_wrap->encoding(), + &error).ToLocal(&js_array)) { return req_wrap->Reject(error); + } - - Local result = Array::New(isolate, 2); - result->Set(env->context(), - 0, - filename.ToLocalChecked()).FromJust(); - result->Set(env->context(), - 1, - Integer::New(isolate, ent.type)).FromJust(); - req_wrap->Resolve(result); + req_wrap->Resolve(js_array); } @@ -217,10 +237,10 @@ void DirHandle::Read(const FunctionCallbackInfo& args) { DirHandle* dir; ASSIGN_OR_RETURN_UNWRAP(&dir, args.Holder()); - FSReqBase* req_wrap_async = static_cast(GetReqWrap(env, args[1])); + FSReqBase* req_wrap_async = GetReqWrap(env, args[1]); if (req_wrap_async != nullptr) { // dir.read(encoding, req) AsyncCall(env, req_wrap_async, args, "readdir", encoding, - AfterDirReadSingle, uv_fs_readdir, dir->dir()); + AfterDirRead, uv_fs_readdir, dir->dir()); } else { // dir.read(encoding, undefined, ctx) CHECK_EQ(argc, 3); FSReqWrapSync req_wrap_sync; @@ -240,28 +260,20 @@ void DirHandle::Read(const FunctionCallbackInfo& args) { } CHECK_GE(req_wrap_sync.req.result, 0); - const uv_dirent_t& ent = dir->dir()->dirents[0]; Local error; - MaybeLocal filename = - StringBytes::Encode(isolate, - ent.name, - encoding, - &error); - if (filename.IsEmpty()) { + Local js_array; + if (!DirentListToArray(env, + dir->dir()->dirents, + req_wrap_sync.req.result, + encoding, + &error).ToLocal(&js_array)) { Local ctx = args[2].As(); - ctx->Set(env->context(), env->error_string(), error).FromJust(); + USE(ctx->Set(env->context(), env->error_string(), error)); return; } - Local result = Array::New(isolate, 2); - result->Set(env->context(), - 0, - filename.ToLocalChecked()).FromJust(); - result->Set(env->context(), - 1, - Integer::New(isolate, ent.type)).FromJust(); - args.GetReturnValue().Set(result); + args.GetReturnValue().Set(js_array); } } diff --git a/src/node_dir.h b/src/node_dir.h index e099fe55107064..03e4a06efcecbe 100644 --- a/src/node_dir.h +++ b/src/node_dir.h @@ -25,7 +25,6 @@ class DirHandle : public AsyncWrap { static void Close(const v8::FunctionCallbackInfo& args); inline uv_dir_t* dir() { return dir_; } - AsyncWrap* GetAsyncWrap() { return this; } void MemoryInfo(MemoryTracker* tracker) const override { tracker->TrackFieldWithSize("dir", sizeof(*dir_)); @@ -46,7 +45,8 @@ class DirHandle : public AsyncWrap { void GCClose(); uv_dir_t* dir_; - uv_dirent_t dirent_; + // Up to 32 directory entries are read through a single libuv call. + uv_dirent_t dirents_[32]; bool closing_ = false; bool closed_ = false; }; diff --git a/src/node_dtrace.h b/src/node_dtrace.h index cbabe905597cb0..b887542abfc9cf 100644 --- a/src/node_dtrace.h +++ b/src/node_dtrace.h @@ -24,7 +24,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "env.h" #include "v8.h" extern "C" { @@ -76,6 +75,8 @@ typedef struct { namespace node { +class Environment; + void InitDTrace(Environment* env); } // namespace node diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index e41e0c1fb6fe1f..0744063e0dc3a9 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -155,7 +155,6 @@ int NodeMainInstance::Run() { RunAtExit(env.get()); per_process::v8_platform.DrainVMTasks(isolate_); - per_process::v8_platform.CancelVMTasks(isolate_); #if defined(LEAK_SANITIZER) __lsan_do_leak_check(); @@ -204,7 +203,7 @@ std::unique_ptr NodeMainInstance::CreateMainEnvironment( // TODO(joyeecheung): when we snapshot the bootstrapped context, // the inspector and diagnostics setup should after after deserialization. -#if HAVE_INSPECTOR && NODE_USE_V8_PLATFORM +#if HAVE_INSPECTOR *exit_code = env->InitializeInspector(nullptr); #endif if (*exit_code != 0) { diff --git a/src/node_options.cc b/src/node_options.cc index d53ab2a4bfe873..35cac18a916c2c 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -27,10 +27,10 @@ std::shared_ptr cli_options{new PerProcessOptions()}; } // namespace per_process void DebugOptions::CheckOptions(std::vector* errors) { -#if !NODE_USE_V8_PLATFORM +#if !NODE_USE_V8_PLATFORM && !HAVE_INSPECTOR if (inspector_enabled) { errors->push_back("Inspector is not available when Node is compiled " - "--without-v8-platform"); + "--without-v8-platform and --without-inspector."); } #endif diff --git a/src/node_perf.h b/src/node_perf.h index e8441e3bb72444..c5e45261c2c6fd 100644 --- a/src/node_perf.h +++ b/src/node_perf.h @@ -5,7 +5,6 @@ #include "node.h" #include "node_perf_common.h" -#include "env.h" #include "base_object-inl.h" #include "histogram-inl.h" @@ -15,6 +14,9 @@ #include namespace node { + +class Environment; + namespace performance { using v8::FunctionCallbackInfo; diff --git a/src/node_platform.cc b/src/node_platform.cc index f726382171488c..6e3b4abfee7287 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -285,22 +285,33 @@ void PerIsolatePlatformData::Shutdown() { // effectively deleting the tasks instead of running them. foreground_delayed_tasks_.PopAll(); foreground_tasks_.PopAll(); + scheduled_delayed_tasks_.clear(); - CancelPendingDelayedTasks(); - - ShutdownCbList* copy = new ShutdownCbList(std::move(shutdown_callbacks_)); - flush_tasks_->data = copy; + // Both destroying the scheduled_delayed_tasks_ lists and closing + // flush_tasks_ handle add tasks to the event loop. We keep a count of all + // non-closed handles, and when that reaches zero, we inform any shutdown + // callbacks that the platform is done as far as this Isolate is concerned. + self_reference_ = shared_from_this(); uv_close(reinterpret_cast(flush_tasks_), [](uv_handle_t* handle) { - std::unique_ptr callbacks( - static_cast(handle->data)); - for (const auto& callback : *callbacks) - callback.cb(callback.data); - delete reinterpret_cast(handle); + std::unique_ptr flush_tasks { + reinterpret_cast(handle) }; + PerIsolatePlatformData* platform_data = + static_cast(flush_tasks->data); + platform_data->DecreaseHandleCount(); + platform_data->self_reference_.reset(); }); flush_tasks_ = nullptr; } +void PerIsolatePlatformData::DecreaseHandleCount() { + CHECK_GE(uv_handle_count_, 1); + if (--uv_handle_count_ == 0) { + for (const auto& callback : shutdown_callbacks_) + callback.cb(callback.data); + } +} + NodePlatform::NodePlatform(int thread_pool_size, TracingController* tracing_controller) { if (tracing_controller) { @@ -382,10 +393,6 @@ void PerIsolatePlatformData::RunForegroundTask(uv_timer_t* handle) { delayed->platform_data->DeleteFromScheduledTasks(delayed); } -void PerIsolatePlatformData::CancelPendingDelayedTasks() { - scheduled_delayed_tasks_.clear(); -} - void NodePlatform::DrainTasks(Isolate* isolate) { std::shared_ptr per_isolate = ForIsolate(isolate); @@ -409,12 +416,15 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() { // the delay is non-zero. This should not be a problem in practice. uv_timer_start(&delayed->timer, RunForegroundTask, delay_millis, 0); uv_unref(reinterpret_cast(&delayed->timer)); + uv_handle_count_++; scheduled_delayed_tasks_.emplace_back(delayed.release(), [](DelayedTask* delayed) { uv_close(reinterpret_cast(&delayed->timer), [](uv_handle_t* handle) { - delete static_cast(handle->data); + std::unique_ptr task { + static_cast(handle->data) }; + task->platform_data->DecreaseHandleCount(); }); }); } @@ -454,10 +464,6 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) { return ForIsolate(isolate)->FlushForegroundTasksInternal(); } -void NodePlatform::CancelPendingDelayedTasks(Isolate* isolate) { - ForIsolate(isolate)->CancelPendingDelayedTasks(); -} - bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { return false; } std::shared_ptr @@ -548,4 +554,6 @@ std::queue> TaskQueue::PopAll() { return result; } +void MultiIsolatePlatform::CancelPendingDelayedTasks(Isolate* isolate) {} + } // namespace node diff --git a/src/node_platform.h b/src/node_platform.h index d2eb325c12113e..24f7b337bb8fd7 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -78,12 +78,12 @@ class PerIsolatePlatformData : // posted during flushing of the queue are postponed until the next // flushing. bool FlushForegroundTasksInternal(); - void CancelPendingDelayedTasks(); const uv_loop_t* event_loop() const { return loop_; } private: void DeleteFromScheduledTasks(DelayedTask* task); + void DecreaseHandleCount(); static void FlushTasks(uv_async_t* handle); static void RunForegroundTask(std::unique_ptr task); @@ -95,6 +95,9 @@ class PerIsolatePlatformData : }; typedef std::vector ShutdownCbList; ShutdownCbList shutdown_callbacks_; + // shared_ptr to self to keep this object alive during shutdown. + std::shared_ptr self_reference_; + uint32_t uv_handle_count_ = 1; // 1 = flush_tasks_ uv_loop_t* const loop_; uv_async_t* flush_tasks_ = nullptr; @@ -102,7 +105,7 @@ class PerIsolatePlatformData : TaskQueue foreground_delayed_tasks_; // Use a custom deleter because libuv needs to close the handle first. - typedef std::unique_ptr> + typedef std::unique_ptr DelayedTaskPointer; std::vector scheduled_delayed_tasks_; }; @@ -137,7 +140,6 @@ class NodePlatform : public MultiIsolatePlatform { ~NodePlatform() override = default; void DrainTasks(v8::Isolate* isolate) override; - void CancelPendingDelayedTasks(v8::Isolate* isolate) override; void Shutdown(); // v8::Platform implementation. diff --git a/src/node_postmortem_metadata.cc b/src/node_postmortem_metadata.cc index 05800f79b09ecc..ccb347e95175c1 100644 --- a/src/node_postmortem_metadata.cc +++ b/src/node_postmortem_metadata.cc @@ -27,9 +27,11 @@ HandleWrap::handle_wrap_queue_) \ V(Environment_HandleWrapQueue, head_, ListNode_HandleWrap, \ Environment::HandleWrapQueue::head_) \ + V(ListNode_HandleWrap, prev_, uintptr_t, ListNode::prev_) \ V(ListNode_HandleWrap, next_, uintptr_t, ListNode::next_) \ V(Environment_ReqWrapQueue, head_, ListNode_ReqWrapQueue, \ Environment::ReqWrapQueue::head_) \ + V(ListNode_ReqWrap, prev_, uintptr_t, ListNode::prev_) \ V(ListNode_ReqWrap, next_, uintptr_t, ListNode::next_) extern "C" { diff --git a/src/node_report.cc b/src/node_report.cc index 088c63b9e8402d..ddeb216c82d6bc 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -18,7 +18,6 @@ #include #include #include -#include constexpr int NODE_REPORT_VERSION = 1; constexpr int NANOS_PER_SEC = 1000 * 1000 * 1000; @@ -111,8 +110,7 @@ std::string TriggerNodeReport(Isolate* isolate, } // Check for errors on the file open if (!outfile.is_open()) { - std::cerr << std::endl - << "Failed to open Node.js report file: " << filename; + std::cerr << "\nFailed to open Node.js report file: " << filename; if (env != nullptr && options->report_directory.length() > 0) std::cerr << " directory: " << options->report_directory; @@ -121,7 +119,7 @@ std::string TriggerNodeReport(Isolate* isolate, return ""; } outstream = &outfile; - std::cerr << std::endl << "Writing Node.js report to file: " << filename; + std::cerr << "\nWriting Node.js report to file: " << filename; } WriteNodeReport(isolate, env, message, trigger, filename, *outstream, @@ -132,7 +130,7 @@ std::string TriggerNodeReport(Isolate* isolate, outfile.close(); } - std::cerr << std::endl << "Node.js report completed" << std::endl; + std::cerr << "\nNode.js report completed" << std::endl; return filename; } diff --git a/src/node_stat_watcher.h b/src/node_stat_watcher.h index 3d819b45787e98..9669806ce796c9 100644 --- a/src/node_stat_watcher.h +++ b/src/node_stat_watcher.h @@ -26,12 +26,13 @@ #include "node.h" #include "handle_wrap.h" -#include "env.h" #include "uv.h" #include "v8.h" namespace node { +class Environment; + class StatWatcher : public HandleWrap { public: static void Initialize(Environment* env, v8::Local target); diff --git a/src/node_url.h b/src/node_url.h index e85ca6e7129f6a..963273f988c983 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -4,7 +4,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node.h" -#include "env.h" #include diff --git a/src/node_v8_platform-inl.h b/src/node_v8_platform-inl.h index e36f0a7d88bea4..ecd8f21d1a2653 100644 --- a/src/node_v8_platform-inl.h +++ b/src/node_v8_platform-inl.h @@ -113,10 +113,6 @@ struct V8Platform { platform_->DrainTasks(isolate); } - inline void CancelVMTasks(v8::Isolate* isolate) { - platform_->CancelPendingDelayedTasks(isolate); - } - inline void StartTracingAgent() { // Attach a new NodeTraceWriter only if this function hasn't been called // before. @@ -150,7 +146,6 @@ struct V8Platform { inline void Initialize(int thread_pool_size) {} inline void Dispose() {} inline void DrainVMTasks(v8::Isolate* isolate) {} - inline void CancelVMTasks(v8::Isolate* isolate) {} inline void StartTracingAgent() { if (!per_process::cli_options->trace_event_categories.empty()) { fprintf(stderr, diff --git a/src/node_version.h b/src/node_version.h index e6f86e02263629..4cb6200b4ba9d8 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -29,7 +29,7 @@ #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Erbium" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) diff --git a/src/node_worker.cc b/src/node_worker.cc index 3dce5e25980ce2..af79540631f153 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -8,7 +8,7 @@ #include "util-inl.h" #include "async_wrap-inl.h" -#if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR +#if HAVE_INSPECTOR #include "inspector/worker_inspector.h" // ParentInspectorHandle #endif @@ -18,10 +18,8 @@ using node::options_parser::kDisallowedInEnvironment; using v8::Array; -using v8::ArrayBuffer; using v8::Boolean; using v8::Context; -using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; @@ -41,7 +39,7 @@ namespace worker { namespace { -#if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR +#if HAVE_INSPECTOR void WaitForWorkerInspectorToStop(Environment* child) { child->inspector_agent()->WaitForDisconnect(); child->inspector_agent()->Stop(); @@ -84,7 +82,7 @@ Worker::Worker(Environment* env, Number::New(env->isolate(), static_cast(thread_id_))) .Check(); -#if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR +#if HAVE_INSPECTOR inspector_parent_handle_ = env->inspector_agent()->GetParentHandle(thread_id_, url); #endif @@ -150,8 +148,6 @@ class WorkerThreadData { w_->isolate_ = nullptr; } - w_->platform_->CancelPendingDelayedTasks(isolate); - bool platform_finished = false; isolate_data_.reset(); @@ -159,9 +155,9 @@ class WorkerThreadData { w_->platform_->AddIsolateFinishedCallback(isolate, [](void* data) { *static_cast(data) = true; }, &platform_finished); - w_->platform_->UnregisterIsolate(isolate); isolate->Dispose(); + w_->platform_->UnregisterIsolate(isolate); // Wait until the platform has cleaned up all relevant resources. while (!platform_finished) @@ -195,7 +191,7 @@ void Worker::Run() { Locker locker(isolate_); Isolate::Scope isolate_scope(isolate_); SealHandleScope outer_seal(isolate_); -#if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR +#if HAVE_INSPECTOR bool inspector_started = false; #endif @@ -227,7 +223,7 @@ void Worker::Run() { env_->stop_sub_worker_contexts(); env_->RunCleanup(); RunAtExit(env_.get()); -#if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR +#if HAVE_INSPECTOR if (inspector_started) WaitForWorkerInspectorToStop(env_.get()); #endif @@ -272,7 +268,7 @@ void Worker::Run() { if (is_stopped()) return; { env_->InitializeDiagnostics(); -#if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR +#if HAVE_INSPECTOR env_->InitializeInspector(inspector_parent_handle_.release()); inspector_started = true; #endif diff --git a/src/node_worker.h b/src/node_worker.h index ffc4f19882cc26..77f68801e7c247 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -65,7 +65,7 @@ class Worker : public AsyncWrap { bool start_profiler_idle_notifier_; uv_thread_t tid_; -#if NODE_USE_V8_PLATFORM && HAVE_INSPECTOR +#if HAVE_INSPECTOR std::unique_ptr inspector_parent_handle_; #endif diff --git a/src/pipe_wrap.h b/src/pipe_wrap.h index 473179a4f6fba0..53008b0d165044 100644 --- a/src/pipe_wrap.h +++ b/src/pipe_wrap.h @@ -26,10 +26,11 @@ #include "async_wrap.h" #include "connection_wrap.h" -#include "env.h" namespace node { +class Environment; + class PipeWrap : public ConnectionWrap { public: enum SocketType { diff --git a/src/req_wrap.h b/src/req_wrap.h index c20912cc95e22f..36eeb1cbc24005 100644 --- a/src/req_wrap.h +++ b/src/req_wrap.h @@ -4,12 +4,13 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "async_wrap.h" -#include "env.h" #include "util.h" #include "v8.h" namespace node { +class Environment; + class ReqWrapBase { public: explicit inline ReqWrapBase(Environment* env); diff --git a/src/stream_base.h b/src/stream_base.h index 3bfdaedb791ca9..3df9e99f6e438e 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -3,7 +3,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "env.h" #include "async_wrap-inl.h" #include "node.h" #include "util.h" @@ -13,6 +12,7 @@ namespace node { // Forward declarations +class Environment; class ShutdownWrap; class WriteWrap; class StreamBase; diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 19366ff4fba2c4..37f5af46066181 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -25,14 +25,14 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "stream_base.h" - -#include "env.h" #include "handle_wrap.h" #include "string_bytes.h" #include "v8.h" namespace node { +class Environment; + class LibuvStreamWrap : public HandleWrap, public StreamBase { public: static void Initialize(v8::Local target, diff --git a/src/tcp_wrap.h b/src/tcp_wrap.h index 0467a1c3f3bf20..0099eedb4bc629 100644 --- a/src/tcp_wrap.h +++ b/src/tcp_wrap.h @@ -25,11 +25,12 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "async_wrap.h" -#include "env.h" #include "connection_wrap.h" namespace node { +class Environment; + class TCPWrap : public ConnectionWrap { public: enum SocketType { diff --git a/src/tls_wrap.h b/src/tls_wrap.h index 631ef8e7c3d8db..14b7327e7d8259 100644 --- a/src/tls_wrap.h +++ b/src/tls_wrap.h @@ -27,7 +27,6 @@ #include "node_crypto.h" // SSLWrap #include "async_wrap.h" -#include "env.h" #include "stream_wrap.h" #include "v8.h" @@ -38,6 +37,7 @@ namespace node { // Forward-declarations +class Environment; class WriteWrap; namespace crypto { class SecureContext; diff --git a/src/tty_wrap.h b/src/tty_wrap.h index df0c4b7c145612..fdf07e4242c1f8 100644 --- a/src/tty_wrap.h +++ b/src/tty_wrap.h @@ -24,12 +24,13 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "env.h" #include "uv.h" #include "stream_wrap.h" namespace node { +class Environment; + class TTYWrap : public LibuvStreamWrap { public: static void Initialize(v8::Local target, diff --git a/src/udp_wrap.h b/src/udp_wrap.h index fb2a9362cdf2bc..78c8aa4239b317 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -25,13 +25,14 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "async_wrap.h" -#include "env.h" #include "handle_wrap.h" #include "uv.h" #include "v8.h" namespace node { +class Environment; + class UDPWrap: public HandleWrap { public: enum SocketType { diff --git a/test/addons/make-callback-recurse/test.js b/test/addons/make-callback-recurse/test.js index 102890cc964d2a..a93a0a4e01bfd7 100644 --- a/test/addons/make-callback-recurse/test.js +++ b/test/addons/make-callback-recurse/test.js @@ -10,8 +10,8 @@ const makeCallback = binding.makeCallback; const mustCallCheckDomains = common.mustCall(checkDomains); // Make sure that using MakeCallback allows the error to propagate. -assert.throws(function() { - makeCallback({}, function() { +assert.throws(() => { + makeCallback({}, () => { throw new Error('hi from domain error'); }); }, /^Error: hi from domain error$/); @@ -27,22 +27,22 @@ assert.throws(function() { // Processing of the MicrotaskQueue is manually handled by node. They are not // processed until after the nextTickQueue has been processed. - Promise.resolve(1).then(common.mustCall(function() { + Promise.resolve(1).then(common.mustCall(() => { results.push(7); })); // The nextTick should run after all immediately invoked calls. - process.nextTick(common.mustCall(function() { + process.nextTick(common.mustCall(() => { results.push(3); // Run same test again but while processing the nextTickQueue to make sure // the following MakeCallback call breaks in the middle of processing the // queue and allows the script to run normally. - process.nextTick(common.mustCall(function() { + process.nextTick(common.mustCall(() => { results.push(6); })); - makeCallback({}, common.mustCall(function() { + makeCallback({}, common.mustCall(() => { results.push(4); })); @@ -54,7 +54,7 @@ assert.throws(function() { // MakeCallback is calling the function immediately, but should then detect // that a script is already in the middle of execution and return before // either the nextTickQueue or MicrotaskQueue are processed. - makeCallback({}, common.mustCall(function() { + makeCallback({}, common.mustCall(() => { results.push(1); })); @@ -63,7 +63,7 @@ assert.throws(function() { // and process them immediately. results.push(2); - setImmediate(common.mustCall(function() { + setImmediate(common.mustCall(() => { for (let i = 0; i < results.length; i++) { assert.strictEqual(results[i], i, `verifyExecutionOrder(${arg}) results: ${results}`); @@ -72,14 +72,14 @@ assert.throws(function() { // The tests are first run on bootstrap during LoadEnvironment() in // src/node.cc. Now run the tests through node::MakeCallback(). setImmediate(function() { - makeCallback({}, common.mustCall(function() { + makeCallback({}, common.mustCall(() => { verifyExecutionOrder(2); })); }); } else if (arg === 2) { // Make sure there are no conflicts using node::MakeCallback() // within timers. - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { verifyExecutionOrder(3); }), 10); } else if (arg === 3) { @@ -94,16 +94,16 @@ assert.throws(function() { function checkDomains() { // Check that domains are properly entered/exited when called in multiple // levels from both node::MakeCallback() and AsyncWrap::MakeCallback - setImmediate(common.mustCall(function() { + setImmediate(common.mustCall(() => { const d1 = domain.create(); const d2 = domain.create(); const d3 = domain.create(); - makeCallback({ domain: d1 }, common.mustCall(function() { + makeCallback({ domain: d1 }, common.mustCall(() => { assert.strictEqual(d1, process.domain); - makeCallback({ domain: d2 }, common.mustCall(function() { + makeCallback({ domain: d2 }, common.mustCall(() => { assert.strictEqual(d2, process.domain); - makeCallback({ domain: d3 }, common.mustCall(function() { + makeCallback({ domain: d3 }, common.mustCall(() => { assert.strictEqual(d3, process.domain); })); assert.strictEqual(d2, process.domain); @@ -112,16 +112,16 @@ function checkDomains() { })); })); - setTimeout(common.mustCall(function() { + setTimeout(common.mustCall(() => { const d1 = domain.create(); const d2 = domain.create(); const d3 = domain.create(); - makeCallback({ domain: d1 }, common.mustCall(function() { + makeCallback({ domain: d1 }, common.mustCall(() => { assert.strictEqual(d1, process.domain); - makeCallback({ domain: d2 }, common.mustCall(function() { + makeCallback({ domain: d2 }, common.mustCall(() => { assert.strictEqual(d2, process.domain); - makeCallback({ domain: d3 }, common.mustCall(function() { + makeCallback({ domain: d3 }, common.mustCall(() => { assert.strictEqual(d3, process.domain); })); assert.strictEqual(d2, process.domain); @@ -134,10 +134,10 @@ function checkDomains() { // Make sure nextTick, setImmediate and setTimeout can all recover properly // after a thrown makeCallback call. const d = domain.create(); - d.on('error', common.mustCall(function(e) { + d.on('error', common.mustCall((e) => { assert.strictEqual(e.message, `throw from domain ${id}`); })); - makeCallback({ domain: d }, function() { + makeCallback({ domain: d }, () => { throw new Error(`throw from domain ${id}`); }); throw new Error('UNREACHABLE'); diff --git a/test/benchmark/test-benchmark-fs.js b/test/benchmark/test-benchmark-fs.js index 7ae32fe617d58f..8811b8c8710b9d 100644 --- a/test/benchmark/test-benchmark-fs.js +++ b/test/benchmark/test-benchmark-fs.js @@ -7,16 +7,17 @@ const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); runBenchmark('fs', [ - 'n=1', - 'size=1', + 'concurrent=1', + 'dir=.github', 'dur=0.1', + 'encodingType=buf', + 'filesize=1024', 'len=1024', - 'concurrent=1', + 'mode=callback', + 'n=1', 'pathType=relative', - 'statType=fstat', + 'size=1', 'statSyncType=fstatSync', - 'encodingType=buf', - 'filesize=1024', - 'dir=.github', - 'withFileTypes=false' + 'statType=fstat', + 'withFileTypes=false', ], { NODE_TMPDIR: tmpdir.path, NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); diff --git a/test/cctest/test_node_postmortem_metadata.cc b/test/cctest/test_node_postmortem_metadata.cc index 79b766939b9d0d..f33d40eb5c23fe 100644 --- a/test/cctest/test_node_postmortem_metadata.cc +++ b/test/cctest/test_node_postmortem_metadata.cc @@ -19,8 +19,10 @@ extern uintptr_t extern uintptr_t nodedbg_offset_Environment__req_wrap_queue___Environment_ReqWrapQueue; extern uintptr_t nodedbg_offset_ExternalString__data__uintptr_t; +extern uintptr_t nodedbg_offset_ListNode_ReqWrap__prev___uintptr_t; extern uintptr_t nodedbg_offset_ListNode_ReqWrap__next___uintptr_t; extern uintptr_t nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; +extern uintptr_t nodedbg_offset_ListNode_HandleWrap__prev___uintptr_t; extern uintptr_t nodedbg_offset_ListNode_HandleWrap__next___uintptr_t; extern uintptr_t nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; @@ -129,6 +131,12 @@ TEST_F(DebugSymbolsTest, HandleWrapList) { const Argv argv; Env env{handle_scope, argv}; + auto queue = reinterpret_cast((*env)->handle_wrap_queue()); + auto head = queue + + nodedbg_offset_Environment_HandleWrapQueue__head___ListNode_HandleWrap; + auto tail = head + nodedbg_offset_ListNode_HandleWrap__prev___uintptr_t; + tail = *reinterpret_cast(tail); + uv_tcp_t handle; auto obj_template = v8::FunctionTemplate::New(isolate_); @@ -140,16 +148,12 @@ TEST_F(DebugSymbolsTest, HandleWrapList) { .ToLocalChecked(); TestHandleWrap obj(*env, object, &handle); - auto queue = reinterpret_cast((*env)->handle_wrap_queue()); - auto head = queue + - nodedbg_offset_Environment_HandleWrapQueue__head___ListNode_HandleWrap; - auto next = - head + nodedbg_offset_ListNode_HandleWrap__next___uintptr_t; - next = *reinterpret_cast(next); + auto last = tail + nodedbg_offset_ListNode_HandleWrap__next___uintptr_t; + last = *reinterpret_cast(last); auto expected = reinterpret_cast(&obj); - auto calculated = next - - nodedbg_offset_HandleWrap__handle_wrap_queue___ListNode_HandleWrap; + auto calculated = + last - nodedbg_offset_HandleWrap__handle_wrap_queue___ListNode_HandleWrap; EXPECT_EQ(expected, calculated); obj.persistent().Reset(); // ~HandleWrap() expects an empty handle. @@ -160,6 +164,13 @@ TEST_F(DebugSymbolsTest, ReqWrapList) { const Argv argv; Env env{handle_scope, argv}; + auto queue = reinterpret_cast((*env)->req_wrap_queue()); + auto head = + queue + + nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; + auto tail = head + nodedbg_offset_ListNode_ReqWrap__prev___uintptr_t; + tail = *reinterpret_cast(tail); + auto obj_template = v8::FunctionTemplate::New(isolate_); obj_template->InstanceTemplate()->SetInternalFieldCount(1); @@ -174,16 +185,12 @@ TEST_F(DebugSymbolsTest, ReqWrapList) { // ARM64 CI machinies. for (auto it : *(*env)->req_wrap_queue()) (void) ⁢ - auto queue = reinterpret_cast((*env)->req_wrap_queue()); - auto head = queue + - nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; - auto next = - head + nodedbg_offset_ListNode_ReqWrap__next___uintptr_t; - next = *reinterpret_cast(next); + auto last = tail + nodedbg_offset_ListNode_ReqWrap__next___uintptr_t; + last = *reinterpret_cast(last); auto expected = reinterpret_cast(&obj); auto calculated = - next - nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; + last - nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; EXPECT_EQ(expected, calculated); obj.Dispatched(); diff --git a/test/common/README.md b/test/common/README.md index 90000908fee14e..ad4e5b7f5e1f6d 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -29,10 +29,10 @@ The `benchmark` module is used by tests to run benchmarks. ### runBenchmark(name, args, env) -* `name` [<string>] Name of benchmark suite to be run. -* `args` [<Array>] Array of environment variable key/value pairs (ex: +* `name` [<string>][] Name of benchmark suite to be run. +* `args` [<Array>][] Array of environment variable key/value pairs (ex: `n=1`) to be applied via `--set`. -* `env` [<Object>] Environment variables to be applied during the run. +* `env` [<Object>][] Environment variables to be applied during the run. ## Common Module API @@ -40,18 +40,18 @@ The `common` module is used by tests for consistency across repeated tasks. ### allowGlobals(...whitelist) -* `whitelist` [<Array>] Array of Globals -* return [<Array>] +* `whitelist` [<Array>][] Array of Globals +* return [<Array>][] Takes `whitelist` and concats that with predefined `knownGlobals`. ### busyLoop(time) -* `time` [<number>] +* `time` [<number>][] Blocks for `time` amount of time. ### canCreateSymLink() -* return [<boolean>] +* return [<boolean>][] Checks whether the current running process can create symlinks. On Windows, this returns `false` if the process running doesn't have privileges to create @@ -72,28 +72,28 @@ failures. However, it is useful in some rare cases to disable it, for example if the `unhandledRejection` hook is directly used by the test. ### enoughTestMem -* [<boolean>] +* [<boolean>][] Indicates if there is more than 1gb of total memory. -### expectsError([fn, ]settings[, exact]) -* `fn` [<Function>] a function that should throw. -* `settings` [<Object>] +### expectsError(\[fn, \]settings\[, exact\]) +* `fn` [<Function>][] a function that should throw. +* `settings` [<Object>][] that must contain the `code` property plus any of the other following properties (some properties only apply for `AssertionError`): - * `code` [<string>] + * `code` [<string>][] expected error must have this value for its `code` property. - * `type` [<Function>] + * `type` [<Function>][] expected error must be an instance of `type` and must be an Error subclass. - * `message` [<string>] or [<RegExp>] + * `message` [<string>][] or [<RegExp>][] if a string is provided for `message`, expected error must have it for its `message` property; if a regular expression is provided for `message`, the regular expression must match the `message` property of the expected error. - * `name` [<string>] + * `name` [<string>][] expected error must have this value for its `name` property. * `info` <Object> expected error must have the same `info` property that is deeply equal to this value. - * `generatedMessage` [<string>] + * `generatedMessage` [<string>][] (`AssertionError` only) expected error must have this value for its `generatedMessage` property. * `actual` <any> @@ -105,8 +105,8 @@ Indicates if there is more than 1gb of total memory. * `operator` <any> (`AssertionError` only) expected error must have this value for its `operator` property. -* `exact` [<number>] default = 1 -* return [<Function>] +* `exact` [<number>][] default = 1 +* return [<Function>][] If `fn` is provided, it will be passed to `assert.throws` as first argument and `undefined` will be returned. @@ -115,10 +115,10 @@ Indicates if there is more than 1gb of total memory. returned function has not been called exactly `exact` number of times when the test is complete, then the test will fail. -### expectWarning(name[, expected[, code]]) -* `name` [<string>] | [<Object>] -* `expected` [<string>] | [<Array>] | [<Object>] -* `code` [<string>] +### expectWarning(name\[, expected\[, code\]\]) +* `name` [<string>][] | [<Object>][] +* `expected` [<string>][] | [<Array>][] | [<Object>][] +* `code` [<string>][] Tests whether `name`, `expected`, and `code` are part of a raised warning. @@ -162,21 +162,21 @@ expectWarning({ ``` ### getArrayBufferViews(buf) -* `buf` [<Buffer>] -* return [<ArrayBufferView[]>] +* `buf` [<Buffer>][] +* return [<ArrayBufferView>][]\[\] Returns an instance of all possible `ArrayBufferView`s of the provided Buffer. ### getBufferSources(buf) -* `buf` [<Buffer>] -* return [<BufferSource[]>] +* `buf` [<Buffer>][] +* return [<BufferSource>][]\[\] Returns an instance of all possible `BufferSource`s of the provided Buffer, consisting of all `ArrayBufferView` and an `ArrayBuffer`. ### getCallSite(func) -* `func` [<Function>] -* return [<string>] +* `func` [<Function>][] +* return [<string>][] Returns the file name and line number for the provided Function. @@ -187,12 +187,12 @@ Attempts to get a valid TTY file descriptor. Returns `-1` if it fails. The TTY file descriptor is assumed to be capable of being writable. ### hasCrypto -* [<boolean>] +* [<boolean>][] Indicates whether OpenSSL is available. ### hasFipsCrypto -* [<boolean>] +* [<boolean>][] Indicates that Node.js has been linked with a FIPS compatible OpenSSL library, and that FIPS as been enabled using `--enable-fips`. @@ -202,80 +202,80 @@ been enabled or not, then `process.config.variables.openssl_is_fips` can be used to determine that situation. ### hasIntl -* [<boolean>] +* [<boolean>][] -Indicates if [internationalization] is supported. +Indicates if [internationalization][] is supported. ### hasIPv6 -* [<boolean>] +* [<boolean>][] Indicates whether `IPv6` is supported on this platform. ### hasMultiLocalhost -* [<boolean>] +* [<boolean>][] Indicates if there are multiple localhosts available. ### inFreeBSDJail -* [<boolean>] +* [<boolean>][] Checks whether free BSD Jail is true or false. ### isAIX -* [<boolean>] +* [<boolean>][] Platform check for Advanced Interactive eXecutive (AIX). ### isAlive(pid) -* `pid` [<number>] -* return [<boolean>] +* `pid` [<number>][] +* return [<boolean>][] Attempts to 'kill' `pid` ### isFreeBSD -* [<boolean>] +* [<boolean>][] Platform check for Free BSD. ### isLinux -* [<boolean>] +* [<boolean>][] Platform check for Linux. ### isLinuxPPCBE -* [<boolean>] +* [<boolean>][] Platform check for Linux on PowerPC. ### isOSX -* [<boolean>] +* [<boolean>][] Platform check for macOS. ### isSunOS -* [<boolean>] +* [<boolean>][] Platform check for SunOS. ### isWindows -* [<boolean>] +* [<boolean>][] Platform check for Windows. ### localhostIPv4 -* [<string>] +* [<string>][] IP of `localhost`. ### localIPv6Hosts -* [<Array>] +* [<Array>][] Array of IPV6 representations for `localhost`. -### mustCall([fn][, exact]) -* `fn` [<Function>] default = () => {} -* `exact` [<number>] default = 1 -* return [<Function>] +### mustCall(\[fn\]\[, exact\]) +* `fn` [<Function>][] default = () => {} +* `exact` [<number>][] default = 1 +* return [<Function>][] Returns a function that calls `fn`. If the returned function has not been called exactly `exact` number of times when the test is complete, then the test will @@ -283,10 +283,10 @@ fail. If `fn` is not provided, an empty function will be used. -### mustCallAtLeast([fn][, minimum]) -* `fn` [<Function>] default = () => {} -* `minimum` [<number>] default = 1 -* return [<Function>] +### mustCallAtLeast(\[fn\]\[, minimum\]) +* `fn` [<Function>][] default = () => {} +* `minimum` [<number>][] default = 1 +* return [<Function>][] Returns a function that calls `fn`. If the returned function has not been called at least `minimum` number of times when the test is complete, then the test will @@ -294,52 +294,52 @@ fail. If `fn` is not provided, an empty function will be used. -### mustNotCall([msg]) -* `msg` [<string>] default = 'function should not have been called' -* return [<Function>] +### mustNotCall(\[msg\]) +* `msg` [<string>][] default = 'function should not have been called' +* return [<Function>][] Returns a function that triggers an `AssertionError` if it is invoked. `msg` is used as the error message for the `AssertionError`. ### nodeProcessAborted(exitCode, signal) -* `exitCode` [<number>] -* `signal` [<string>] -* return [<boolean>] +* `exitCode` [<number>][] +* `signal` [<string>][] +* return [<boolean>][] Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise. ### opensslCli -* [<boolean>] +* [<boolean>][] Indicates whether 'opensslCli' is supported. ### platformTimeout(ms) -* `ms` [<number>] | [<bigint>] -* return [<number>] | [<bigint>] +* `ms` [<number>][] | [<bigint>][] +* return [<number>][] | [<bigint>][] Returns a timeout value based on detected conditions. For example, a debug build may need extra time so the returned value will be larger than on a release build. ### PIPE -* [<string>] +* [<string>][] Path to the test socket. ### PORT -* [<number>] +* [<number>][] A port number for tests to use if one is needed. ### printSkipMessage(msg) -* `msg` [<string>] +* `msg` [<string>][] Logs '1..0 # Skipped: ' + `msg` ### pwdCommand -* [<array>] First two argument for the `spawn`/`exec` functions. +* [<array>][] First two argument for the `spawn`/`exec` functions. Platform normalized `pwd` command options. Usage example: ```js @@ -350,12 +350,12 @@ spawn(...common.pwdCommand, { stdio: ['pipe'] }); ``` ### rootDir -* [<string>] +* [<string>][] Path to the 'root' directory. either `/` or `c:\\` (windows) ### runWithInvalidFD(func) -* `func` [<Function>] +* `func` [<Function>][] Runs `func` with an invalid file descriptor that is an unsigned integer and can be used to trigger `EBADF` as the first argument. If no such file @@ -363,7 +363,7 @@ descriptor could be generated, a skip message will be printed and the `func` will not be run. ### skip(msg) -* `msg` [<string>] +* `msg` [<string>][] Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`. @@ -450,7 +450,7 @@ Environment variables used in profiled processes. ### getCpuProfiles(dir) * `dir` {string} The directory containing the CPU profile files. -* return [<string>] +* return [<string>][] Returns an array of all `.cpuprofile` files found in `dir`. @@ -458,7 +458,7 @@ Returns an array of all `.cpuprofile` files found in `dir`. * `file` {string} Path to a `.cpuprofile` file. * `suffix` {string} Suffix of the URL of call frames to retrieve. -* returns { frames: [<Object>], nodes: [<Object>] } +* returns { frames: [<Object>][], nodes: [<Object>][] } Returns an object containing an array of the relevant call frames and an array of all the profile nodes. @@ -482,9 +482,9 @@ The `DNS` module provides utilities related to the `dns` built-in module. ### errorLookupMock(code, syscall) -* `code` [<string>] Defaults to `dns.mockedErrorCode`. -* `syscall` [<string>] Defaults to `dns.mockedSysCall`. -* return [<Function>] +* `code` [<string>][] Defaults to `dns.mockedErrorCode`. +* `syscall` [<string>][] Defaults to `dns.mockedSysCall`. +* return [<Function>][] A mock for the `lookup` option of `net.connect()` that would result in an error with the `code` and the `syscall` specified. Returns a function that has the @@ -500,39 +500,39 @@ The default `syscall` of errors generated by `errorLookupMock`. ### readDomainFromPacket(buffer, offset) -* `buffer` [<Buffer>] -* `offset` [<number>] -* return [<Object>] +* `buffer` [<Buffer>][] +* `offset` [<number>][] +* return [<Object>][] Reads the domain string from a packet and returns an object containing the number of bytes read and the domain. ### parseDNSPacket(buffer) -* `buffer` [<Buffer>] -* return [<Object>] +* `buffer` [<Buffer>][] +* return [<Object>][] Parses a DNS packet. Returns an object with the values of the various flags of the packet depending on the type of packet. ### writeIPv6(ip) -* `ip` [<string>] -* return [<Buffer>] +* `ip` [<string>][] +* return [<Buffer>][] Reads an IPv6 String and returns a Buffer containing the parts. ### writeDomainName(domain) -* `domain` [<string>] -* return [<Buffer>] +* `domain` [<string>][] +* return [<Buffer>][] Reads a Domain String and returns a Buffer containing the domain. ### writeDNSPacket(parsed) -* `parsed` [<Object>] -* return [<Buffer>] +* `parsed` [<Object>][] +* return [<Buffer>][] Takes in a parsed Object and writes its fields to a DNS packet as a Buffer object. @@ -572,26 +572,26 @@ files in the `test/fixtures` directory. ### fixtures.fixturesDir -* [<string>] +* [<string>][] The absolute path to the `test/fixtures/` directory. ### fixtures.path(...args) -* `...args` [<string>] +* `...args` [<string>][] Returns the result of `path.join(fixtures.fixturesDir, ...args)`. -### fixtures.readSync(args[, enc]) +### fixtures.readSync(args\[, enc\]) -* `args` [<string>] | [<Array>] +* `args` [<string>][] | [<Array>][] Returns the result of `fs.readFileSync(path.join(fixtures.fixturesDir, ...args), 'enc')`. -### fixtures.readKey(arg[, enc]) +### fixtures.readKey(arg\[, enc\]) -* `arg` [<string>] +* `arg` [<string>][] Returns the result of `fs.readFileSync(path.join(fixtures.fixturesDir, 'keys', arg), 'enc')`. @@ -610,11 +610,11 @@ one listed below. (`heap.validateSnapshotNodes(...)` is a shortcut for ### heap.validateSnapshotNodes(name, expected, options) -* `name` [<string>] Look for this string as the name of heap dump nodes. -* `expected` [<Array>] A list of objects, possibly with an `children` +* `name` [<string>][] Look for this string as the name of heap dump nodes. +* `expected` [<Array>][] A list of objects, possibly with an `children` property that points to expected other adjacent nodes. -* `options` [<Array>] - * `loose` [<boolean>] Do not expect an exact listing of occurrences +* `options` [<Array>][] + * `loose` [<boolean>][] Do not expect an exact listing of occurrences of nodes with name `name` in `expected`. Create a heap dump and an embedder graph copy and validate occurrences. @@ -650,7 +650,7 @@ console.log('this is sent to the hijacked listener'); ``` ### hijackStderr(listener) -* `listener` [<Function>]: a listener with a single parameter +* `listener` [<Function>][]: a listener with a single parameter called `data`. Eavesdrop to `process.stderr.write()` calls. Once `process.stderr.write()` is @@ -659,7 +659,7 @@ be passed to `listener`. What's more, `process.stderr.writeTimes` is a count of the number of calls. ### hijackStdout(listener) -* `listener` [<Function>]: a listener with a single parameter +* `listener` [<Function>][]: a listener with a single parameter called `data`. Eavesdrop to `process.stdout.write()` calls. Once `process.stdout.write()` is @@ -795,27 +795,27 @@ internet-related tests. ### internet.addresses -* [<Object>] - * `INET_HOST` [<string>] A generic host that has registered common +* [<Object>][] + * `INET_HOST` [<string>][] A generic host that has registered common DNS records, supports both IPv4 and IPv6, and provides basic HTTP/HTTPS services - * `INET4_HOST` [<string>] A host that provides IPv4 services - * `INET6_HOST` [<string>] A host that provides IPv6 services - * `INET4_IP` [<string>] An accessible IPv4 IP, defaults to the + * `INET4_HOST` [<string>][] A host that provides IPv4 services + * `INET6_HOST` [<string>][] A host that provides IPv6 services + * `INET4_IP` [<string>][] An accessible IPv4 IP, defaults to the Google Public DNS IPv4 address - * `INET6_IP` [<string>] An accessible IPv6 IP, defaults to the + * `INET6_IP` [<string>][] An accessible IPv6 IP, defaults to the Google Public DNS IPv6 address - * `INVALID_HOST` [<string>] An invalid host that cannot be resolved - * `MX_HOST` [<string>] A host with MX records registered - * `SRV_HOST` [<string>] A host with SRV records registered - * `PTR_HOST` [<string>] A host with PTR records registered - * `NAPTR_HOST` [<string>] A host with NAPTR records registered - * `SOA_HOST` [<string>] A host with SOA records registered - * `CNAME_HOST` [<string>] A host with CNAME records registered - * `NS_HOST` [<string>] A host with NS records registered - * `TXT_HOST` [<string>] A host with TXT records registered - * `DNS4_SERVER` [<string>] An accessible IPv4 DNS server - * `DNS6_SERVER` [<string>] An accessible IPv6 DNS server + * `INVALID_HOST` [<string>][] An invalid host that cannot be resolved + * `MX_HOST` [<string>][] A host with MX records registered + * `SRV_HOST` [<string>][] A host with SRV records registered + * `PTR_HOST` [<string>][] A host with PTR records registered + * `NAPTR_HOST` [<string>][] A host with NAPTR records registered + * `SOA_HOST` [<string>][] A host with SOA records registered + * `CNAME_HOST` [<string>][] A host with CNAME records registered + * `NS_HOST` [<string>][] A host with NS records registered + * `TXT_HOST` [<string>][] A host with TXT records registered + * `DNS4_SERVER` [<string>][] An accessible IPv4 DNS server + * `DNS6_SERVER` [<string>][] An accessible IPv6 DNS server A set of addresses for internet-related tests. All properties are configurable via `NODE_TEST_*` environment variables. For example, to configure @@ -835,9 +835,9 @@ onGC({}, { ongc() { console.log('collected'); } }); ``` ### onGC(target, listener) -* `target` [<Object>] -* `listener` [<Object>] - * `ongc` [<Function>] +* `target` [<Object>][] +* `listener` [<Object>][] + * `ongc` [<Function>][] Installs a GC listener for the collection of `target`. @@ -856,24 +856,25 @@ functionality. ### findReports(pid, dir) -* `pid` [<number>] Process ID to retrieve diagnostic report files for. -* `dir` [<string>] Directory to search for diagnostic report files. -* return [<Array>] +* `pid` [<number>][] Process ID to retrieve diagnostic report files for. +* `dir` [<string>][] Directory to search for diagnostic report files. +* return [<Array>][] Returns an array of diagnotic report file names found in `dir`. The files should have been generated by a process whose PID matches `pid`. ### validate(filepath) -* `filepath` [<string>] Diagnostic report filepath to validate. +* `filepath` [<string>][] Diagnostic report filepath to validate. Validates the schema of a diagnostic report file whose path is specified in `filepath`. If the report fails validation, an exception is thrown. ### validateContent(report) -* `report` [<Object|string>] JSON contents of a diagnostic report file, the -parsed Object thereof, or the result of `process.report.getReport()`. +* `report` [<Object>][] | [<string>][] JSON contents of a diagnostic + report file, the parsed Object thereof, or the result of + `process.report.getReport()`. Validates the schema of a diagnostic report whose content is specified in `report`. If the report fails validation, an exception is thrown. @@ -885,23 +886,23 @@ after a given number of event loop "ticks". ### tick(x, cb) -* `x` [<number>] Number of event loop "ticks". -* `cb` [<Function>] A callback function. +* `x` [<number>][] Number of event loop "ticks". +* `cb` [<Function>][] A callback function. ## tmpdir Module The `tmpdir` module supports the use of a temporary directory for testing. ### path -* [<string>] +* [<string>][] The realpath of the testing temporary directory. -### refresh([opts]) +### refresh(\[opts\]) -* `opts` [<Object>] (optional) Extra options. - * `spawn` [<boolean>] (default: `true`) Indicates that `refresh` is allowed - to optionally spawn a subprocess. +* `opts` [<Object>][] (optional) Extra options. + * `spawn` [<boolean>][] (default: `true`) Indicates that `refresh` is + allowed to optionally spawn a subprocess. Deletes and recreates the testing temporary directory. @@ -922,8 +923,9 @@ A driver class for running WPT with the WPT harness in a vm. See [the WPT tests README][] for details. [<Array>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array -[<ArrayBufferView[]>]: https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView +[<ArrayBufferView>]: https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView [<Buffer>]: https://nodejs.org/api/buffer.html#buffer_class_buffer +[<BufferSource>]: https://developer.mozilla.org/en-US/docs/Web/API/BufferSource [<Function>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function [<Object>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object [<RegExp>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp diff --git a/test/common/index.js b/test/common/index.js index 00ebd283a0c3e9..98a26872223cb9 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -651,12 +651,6 @@ function skipIfInspectorDisabled() { } } -function skipIfInspectorEnabled() { - if (process.features.inspector) { - skip('V8 inspector is enabled'); - } -} - function skipIfReportDisabled() { if (!process.config.variables.node_report) { skip('Diagnostic reporting is disabled'); @@ -789,7 +783,6 @@ module.exports = { skipIf32Bits, skipIfEslintMissing, skipIfInspectorDisabled, - skipIfInspectorEnabled, skipIfReportDisabled, skipIfWorker, diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 703a7dcd21acb0..11b28dc8a2a717 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -22,7 +22,7 @@ const remark2rehype = require('remark-rehype'); const raw = require('rehype-raw'); const htmlStringify = require('rehype-stringify'); -function toHTML({ input, filename, nodeVersion }, cb) { +async function toHTML({ input, filename, nodeVersion }) { const content = unified() .use(markdown) .use(html.firstHeader) @@ -34,10 +34,7 @@ function toHTML({ input, filename, nodeVersion }, cb) { .use(htmlStringify) .processSync(input); - html.toHTML( - { input, content, filename, nodeVersion }, - cb - ); + return html.toHTML({ input, content, filename, nodeVersion }); } // Test data is a list of objects with two properties. @@ -107,23 +104,16 @@ testData.forEach(({ file, html }) => { // Normalize expected data by stripping whitespace. const expected = html.replace(spaces, ''); - readFile(file, 'utf8', common.mustCall((err, input) => { + readFile(file, 'utf8', common.mustCall(async (err, input) => { assert.ifError(err); - toHTML( - { - input: input, - filename: 'foo', - nodeVersion: process.version, - }, - common.mustCall((err, output) => { - assert.ifError(err); + const output = await toHTML({ input: input, + filename: 'foo', + nodeVersion: process.version }); - const actual = output.replace(spaces, ''); - // Assert that the input stripped of all whitespace contains the - // expected markup. - assert(actual.includes(expected), - `ACTUAL: ${actual}\nEXPECTED: ${expected}`); - }) - ); + const actual = output.replace(spaces, ''); + // Assert that the input stripped of all whitespace contains the + // expected markup. + assert(actual.includes(expected), + `ACTUAL: ${actual}\nEXPECTED: ${expected}`); })); }); diff --git a/test/es-module/test-cjs-esm-warn.js b/test/es-module/test-cjs-esm-warn.js new file mode 100644 index 00000000000000..ec368c73e2ef2d --- /dev/null +++ b/test/es-module/test-cjs-esm-warn.js @@ -0,0 +1,38 @@ +'use strict'; + +const common = require('../common'); +const fixtures = require('../common/fixtures'); +const { spawn } = require('child_process'); +const assert = require('assert'); +const path = require('path'); + +const requiring = path.resolve(fixtures.path('/es-modules/cjs-esm.js')); +const required = path.resolve( + fixtures.path('/es-modules/package-type-module/cjs.js') +); +const pjson = path.resolve( + fixtures.path('/es-modules/package-type-module/package.json') +); + +const basename = 'cjs.js'; + +const child = spawn(process.execPath, [requiring]); +let stderr = ''; +child.stderr.setEncoding('utf8'); +child.stderr.on('data', (data) => { + stderr += data; +}); +child.on('close', common.mustCall((code, signal) => { + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); + + assert.strictEqual(stderr, `(node:${child.pid}) Warning: ` + + 'require() of ES modules is not supported.\nrequire() of ' + + `${required} from ${requiring} ` + + 'is an ES module file as it is a .js file whose nearest parent ' + + 'package.json contains "type": "module" which defines all .js ' + + 'files in that package scope as ES modules.\nInstead rename ' + + `${basename} to end in .cjs, change the requiring code to use ` + + 'import(), or remove "type": "module" from ' + + `${pjson}.\n`); +})); diff --git a/test/es-module/test-esm-specifiers.mjs b/test/es-module/test-esm-specifiers.mjs index 0c5e1ac04ad1a8..59d54cbf63dc79 100644 --- a/test/es-module/test-esm-specifiers.mjs +++ b/test/es-module/test-esm-specifiers.mjs @@ -1,5 +1,5 @@ // Flags: --experimental-modules --es-module-specifier-resolution=node -import { mustNotCall } from '../common'; +import { mustNotCall } from '../common/index.mjs'; import assert from 'assert'; // commonJS index.js @@ -14,8 +14,8 @@ assert.strictEqual(commonjs, 'commonjs'); assert.strictEqual(module, 'module'); assert.strictEqual(success, 'success'); assert.strictEqual(explicit, 'esm'); -assert.strictEqual(implicit, 'esm'); -assert.strictEqual(implicitModule, 'esm'); +assert.strictEqual(implicit, 'cjs'); +assert.strictEqual(implicitModule, 'cjs'); async function main() { try { diff --git a/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/entry.js b/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/entry.js index 5d7af588fd65b7..06db4db1581b44 100644 --- a/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/entry.js +++ b/test/fixtures/es-module-specifiers/node_modules/implicit-main-type-module/entry.js @@ -1 +1 @@ -export default 'nope'; +export default 'cjs'; diff --git a/test/fixtures/es-modules/cjs-esm.js b/test/fixtures/es-modules/cjs-esm.js new file mode 100644 index 00000000000000..3599178996800d --- /dev/null +++ b/test/fixtures/es-modules/cjs-esm.js @@ -0,0 +1 @@ +require('./package-type-module/cjs.js'); diff --git a/test/fixtures/es-modules/package-type-module/cjs.js b/test/fixtures/es-modules/package-type-module/cjs.js new file mode 100644 index 00000000000000..683f2d8ba623a7 --- /dev/null +++ b/test/fixtures/es-modules/package-type-module/cjs.js @@ -0,0 +1 @@ +module.exports = 'asdf'; diff --git a/test/js-native-api/8_passing_wrapped/myobject.cc b/test/js-native-api/8_passing_wrapped/myobject.cc index 0c9ca90f52f8f3..28e207a4248d09 100644 --- a/test/js-native-api/8_passing_wrapped/myobject.cc +++ b/test/js-native-api/8_passing_wrapped/myobject.cc @@ -51,10 +51,9 @@ napi_value MyObject::New(napi_env env, napi_callback_info info) { obj->env_ = env; - // It is important that the below call to napi_wrap() be such that we request - // a reference to the wrapped object via the out-parameter, because this - // ensures that we test the code path that deals with a reference that is - // destroyed from its own finalizer. + // The below call to napi_wrap() must request a reference to the wrapped + // object via the out-parameter, because this ensures that we test the code + // path that deals with a reference that is destroyed from its own finalizer. NAPI_CALL(env, napi_wrap(env, _this, obj, diff --git a/test/js-native-api/test_general/testEnvCleanup.js b/test/js-native-api/test_general/testEnvCleanup.js new file mode 100644 index 00000000000000..8d567bef4518ce --- /dev/null +++ b/test/js-native-api/test_general/testEnvCleanup.js @@ -0,0 +1,57 @@ +'use strict'; + +if (process.argv[2] === 'child') { + const common = require('../../common'); + const test_general = require(`./build/${common.buildType}/test_general`); + + // The second argument to `envCleanupWrap()` is an index into the global + // static string array named `env_cleanup_finalizer_messages` on the native + // side. A reverse mapping is reproduced here for clarity. + const finalizerMessages = { + 'simple wrap': 0, + 'wrap, removeWrap': 1, + 'first wrap': 2, + 'second wrap': 3 + }; + + // We attach the three objects we will test to `module.exports` to ensure they + // will not be garbage-collected before the process exits. + + // Make sure the finalizer for a simple wrap will be called at env cleanup. + module.exports['simple wrap'] = + test_general.envCleanupWrap({}, finalizerMessages['simple wrap']); + + // Make sure that a removed wrap does not result in a call to its finalizer at + // env cleanup. + module.exports['wrap, removeWrap'] = + test_general.envCleanupWrap({}, finalizerMessages['wrap, removeWrap']); + test_general.removeWrap(module.exports['wrap, removeWrap']); + + // Make sure that only the latest attached version of a re-wrapped item's + // finalizer gets called at env cleanup. + module.exports['first wrap'] = + test_general.envCleanupWrap({}, finalizerMessages['first wrap']), + test_general.removeWrap(module.exports['first wrap']); + test_general.envCleanupWrap(module.exports['first wrap'], + finalizerMessages['second wrap']); +} else { + const assert = require('assert'); + const { spawnSync } = require('child_process'); + + const child = spawnSync(process.execPath, [__filename, 'child'], { + stdio: [ process.stdin, 'pipe', process.stderr ] + }); + + // Grab the child's output and construct an object whose keys are the rows of + // the output and whose values are `true`, so we can compare the output while + // ignoring the order in which the lines of it were produced. + assert.deepStrictEqual( + child.stdout.toString().split(/\r\n|\r|\n/g).reduce((obj, item) => + Object.assign(obj, item ? { [item]: true } : {}), {}), { + 'finalize at env cleanup for simple wrap': true, + 'finalize at env cleanup for second wrap': true + }); + + // Ensure that the child exited successfully. + assert.strictEqual(child.status, 0); +} diff --git a/test/js-native-api/test_general/test_general.c b/test/js-native-api/test_general/test_general.c index a7453e42f7456b..f6e641167d5bcc 100644 --- a/test/js-native-api/test_general/test_general.c +++ b/test/js-native-api/test_general/test_general.c @@ -1,5 +1,7 @@ -#include +#include #include +#include +#include #include "../common.h" static napi_value testStrictEquals(napi_env env, napi_callback_info info) { @@ -146,16 +148,22 @@ static napi_value deref_item_was_called(napi_env env, napi_callback_info info) { return it_was_called; } -static napi_value wrap(napi_env env, napi_callback_info info) { +static napi_value wrap_first_arg(napi_env env, + napi_callback_info info, + napi_finalize finalizer, + void* data) { size_t argc = 1; napi_value to_wrap; - deref_item_called = false; - NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &to_wrap, NULL, NULL)); - NAPI_CALL(env, napi_wrap(env, to_wrap, &deref_item_called, deref_item, NULL, NULL)); + NAPI_CALL(env, napi_wrap(env, to_wrap, data, finalizer, NULL, NULL)); - return NULL; + return to_wrap; +} + +static napi_value wrap(napi_env env, napi_callback_info info) { + deref_item_called = false; + return wrap_first_arg(env, info, deref_item, &deref_item_called); } static napi_value unwrap(napi_env env, napi_callback_info info) { @@ -186,13 +194,7 @@ static void test_finalize(napi_env env, void* data, void* hint) { } static napi_value test_finalize_wrap(napi_env env, napi_callback_info info) { - size_t argc = 1; - napi_value js_object; - - NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &js_object, NULL, NULL)); - NAPI_CALL(env, napi_wrap(env, js_object, NULL, test_finalize, NULL, NULL)); - - return NULL; + return wrap_first_arg(env, info, test_finalize, NULL); } static napi_value finalize_was_called(napi_env env, napi_callback_info info) { @@ -251,6 +253,34 @@ static napi_value add_finalizer_only(napi_env env, napi_callback_info info) { return NULL; } +static const char* env_cleanup_finalizer_messages[] = { + "simple wrap", + "wrap, removeWrap", + "first wrap", + "second wrap" +}; + +static void cleanup_env_finalizer(napi_env env, void* data, void* hint) { + (void) env; + (void) hint; + + printf("finalize at env cleanup for %s\n", + env_cleanup_finalizer_messages[(uintptr_t)data]); +} + +static napi_value env_cleanup_wrap(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value argv[2]; + uint32_t value; + uintptr_t ptr_value; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); + + NAPI_CALL(env, napi_get_value_uint32(env, argv[1], &value)); + + ptr_value = value; + return wrap_first_arg(env, info, cleanup_env_finalizer, (void*)ptr_value); +} + EXTERN_C_START napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { @@ -265,6 +295,7 @@ napi_value Init(napi_env env, napi_value exports) { DECLARE_NAPI_PROPERTY("testNapiErrorCleanup", testNapiErrorCleanup), DECLARE_NAPI_PROPERTY("testNapiTypeof", testNapiTypeof), DECLARE_NAPI_PROPERTY("wrap", wrap), + DECLARE_NAPI_PROPERTY("envCleanupWrap", env_cleanup_wrap), DECLARE_NAPI_PROPERTY("unwrap", unwrap), DECLARE_NAPI_PROPERTY("removeWrap", remove_wrap), DECLARE_NAPI_PROPERTY("addFinalizerOnly", add_finalizer_only), diff --git a/test/parallel/test-coverage-with-inspector-disabled.js b/test/parallel/test-coverage-with-inspector-disabled.js index 0b0c2aea43fa60..f2ba070859527e 100644 --- a/test/parallel/test-coverage-with-inspector-disabled.js +++ b/test/parallel/test-coverage-with-inspector-disabled.js @@ -1,7 +1,9 @@ 'use strict'; const common = require('../common'); -common.skipIfInspectorEnabled(); +if (process.features.inspector) { + common.skip('V8 inspector is enabled'); +} const fixtures = require('../common/fixtures'); const assert = require('assert'); diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index 558f7dc1f4b673..15de241b358fb1 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -200,6 +200,27 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', library: 'BIO routines', function: 'BIO_new_mem_buf', }); + + // This should not abort either: https://github.com/nodejs/node/issues/29904 + assert.throws(() => { + createPrivateKey({ key: Buffer.alloc(0), format: 'der', type: 'spki' }); + }, { + code: 'ERR_INVALID_OPT_VALUE', + message: 'The value "spki" is invalid for option "type"' + }); + + // Unlike SPKI, PKCS#1 is a valid encoding for private keys (and public keys), + // so it should be accepted by createPrivateKey, but OpenSSL won't parse it. + assert.throws(() => { + const key = createPublicKey(publicPem).export({ + format: 'der', + type: 'pkcs1' + }); + createPrivateKey({ key, format: 'der', type: 'pkcs1' }); + }, { + message: /asn1 encoding/, + library: 'asn1 encoding routines' + }); } [ diff --git a/test/parallel/test-fs-close-errors.js b/test/parallel/test-fs-close-errors.js index 42d990410f9848..6168d5c20ab8e5 100644 --- a/test/parallel/test-fs-close-errors.js +++ b/test/parallel/test-fs-close-errors.js @@ -17,3 +17,19 @@ const fs = require('fs'); assert.throws(() => fs.close(input), errObj); assert.throws(() => fs.closeSync(input), errObj); }); + +{ + // Test error when cb is not a function + const fd = fs.openSync(__filename, 'r'); + + const errObj = { + code: 'ERR_INVALID_CALLBACK', + name: 'TypeError' + }; + + ['', false, null, {}, []].forEach((input) => { + assert.throws(() => fs.close(fd, input), errObj); + }); + + fs.closeSync(fd); +} diff --git a/test/parallel/test-fs-opendir.js b/test/parallel/test-fs-opendir.js index c9a6d657ed890d..f2c5d033451261 100644 --- a/test/parallel/test-fs-opendir.js +++ b/test/parallel/test-fs-opendir.js @@ -58,17 +58,27 @@ const dirclosedError = { // Check the opendir async version fs.opendir(testDir, common.mustCall(function(err, dir) { assert.ifError(err); - dir.read(common.mustCall(function(err, dirent) { + let sync = true; + dir.read(common.mustCall((err, dirent) => { + assert(!sync); assert.ifError(err); // Order is operating / file system dependent assert(files.includes(dirent.name), `'files' should include ${dirent}`); assertDirent(dirent); - dir.close(common.mustCall(function(err) { + let syncInner = true; + dir.read(common.mustCall((err, dirent) => { + assert(!syncInner); assert.ifError(err); + + dir.close(common.mustCall(function(err) { + assert.ifError(err); + })); })); + syncInner = false; })); + sync = false; })); // opendir() on file should throw ENOTDIR diff --git a/test/parallel/test-queue-microtask-uncaught-asynchooks.js b/test/parallel/test-queue-microtask-uncaught-asynchooks.js new file mode 100644 index 00000000000000..ee64c6e68ab7ab --- /dev/null +++ b/test/parallel/test-queue-microtask-uncaught-asynchooks.js @@ -0,0 +1,36 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const async_hooks = require('async_hooks'); + +// Regression test for https://github.com/nodejs/node/issues/30080: +// An uncaught exception inside a queueMicrotask callback should not lead +// to multiple after() calls for it. + +let µtaskId; +const events = []; + +async_hooks.createHook({ + init(id, type, triggerId, resoure) { + if (type === 'Microtask') { + µtaskId = id; + events.push('init'); + } + }, + before(id) { + if (id === µtaskId) events.push('before'); + }, + after(id) { + if (id === µtaskId) events.push('after'); + }, + destroy(id) { + if (id === µtaskId) events.push('destroy'); + } +}).enable(); + +queueMicrotask(() => { throw new Error(); }); + +process.on('uncaughtException', common.mustCall()); +process.on('exit', () => { + assert.deepStrictEqual(events, ['init', 'after', 'before', 'destroy']); +}); diff --git a/test/parallel/test-release-npm.js b/test/parallel/test-release-npm.js new file mode 100644 index 00000000000000..412cb0cc64acb7 --- /dev/null +++ b/test/parallel/test-release-npm.js @@ -0,0 +1,25 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const child_process = require('child_process'); +const path = require('path'); + +const releaseReg = /^v\d+\.\d+\.\d+$/; + +// Npm requires crypto support. +if (!releaseReg.test(process.version) || !common.hasCrypto) { + common.skip('This test is only for release builds'); +} + +{ + // Verify that npm does not print out a warning when executed. + + const npmCli = path.join(__dirname, '../../deps/npm/bin/npm-cli.js'); + const npmExec = child_process.spawnSync(process.execPath, [npmCli]); + assert.strictEqual(npmExec.status, 1); + + const stderr = npmExec.stderr.toString(); + assert.strictEqual(stderr.length, 0, 'npm is not ready for this release ' + + 'and is going to print warnings to users:\n' + stderr); +} diff --git a/test/parallel/test-source-map.js b/test/parallel/test-source-map.js index 41a315e3f8184c..2ded13a631dd8c 100644 --- a/test/parallel/test-source-map.js +++ b/test/parallel/test-source-map.js @@ -193,6 +193,36 @@ function nextdir() { ); } +// Does not persist url parameter if source-map has been parsed. +{ + const coverageDirectory = nextdir(); + spawnSync(process.execPath, [ + require.resolve('../fixtures/source-map/inline-base64.js') + ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); + const sourceMap = getSourceMapFromCache( + 'inline-base64.js', + coverageDirectory + ); + assert.strictEqual(sourceMap.url, null); +} + +// Persists line lengths for in-memory representation of source file. +{ + const coverageDirectory = nextdir(); + spawnSync(process.execPath, [ + require.resolve('../fixtures/source-map/istanbul-throw.js') + ], { env: { ...process.env, NODE_V8_COVERAGE: coverageDirectory } }); + const sourceMap = getSourceMapFromCache( + 'istanbul-throw.js', + coverageDirectory + ); + if (common.isWindows) { + assert.deepStrictEqual(sourceMap.lineLengths, [1086, 31, 185, 649, 0]); + } else { + assert.deepStrictEqual(sourceMap.lineLengths, [1085, 30, 184, 648, 0]); + } +} + function getSourceMapFromCache(fixtureFile, coverageDirectory) { const jsonFiles = fs.readdirSync(coverageDirectory); for (const jsonFile of jsonFiles) { diff --git a/test/parallel/test-url-parse-format.js b/test/parallel/test-url-parse-format.js index 43c459d936fe61..58f0bccbd2757b 100644 --- a/test/parallel/test-url-parse-format.js +++ b/test/parallel/test-url-parse-format.js @@ -892,9 +892,8 @@ const parseTests = { href: 'https:///*' }, - // The following two URLs are the same, but they differ for - // a capital A: it is important that we verify that the protocol - // is checked in a case-insensitive manner. + // The following two URLs are the same, but they differ for a capital A. + // Verify that the protocol is checked in a case-insensitive manner. 'javascript:alert(1);a=\x27@white-listed.com\x27': { protocol: 'javascript:', slashes: null, diff --git a/test/parallel/test-worker-sharedarraybuffer-from-worker-thread.js b/test/parallel/test-worker-sharedarraybuffer-from-worker-thread.js index 56dfe2ec41ab3a..ce8410f6dd3d75 100644 --- a/test/parallel/test-worker-sharedarraybuffer-from-worker-thread.js +++ b/test/parallel/test-worker-sharedarraybuffer-from-worker-thread.js @@ -5,19 +5,24 @@ const assert = require('assert'); const { Worker } = require('worker_threads'); // Regression test for https://github.com/nodejs/node/issues/28777 -// Make sure that SharedArrayBuffers created in Worker threads are accessible -// after the creating thread ended. +// Make sure that SharedArrayBuffers and transferred ArrayBuffers created in +// Worker threads are accessible after the creating thread ended. -const w = new Worker(` -const { parentPort } = require('worker_threads'); -const sharedArrayBuffer = new SharedArrayBuffer(4); -parentPort.postMessage(sharedArrayBuffer); -`, { eval: true }); +for (const ctor of ['ArrayBuffer', 'SharedArrayBuffer']) { + const w = new Worker(` + const { parentPort } = require('worker_threads'); + const arrayBuffer = new ${ctor}(4); + parentPort.postMessage( + arrayBuffer, + '${ctor}' === 'SharedArrayBuffer' ? [] : [arrayBuffer]); + `, { eval: true }); -let sharedArrayBuffer; -w.once('message', common.mustCall((message) => sharedArrayBuffer = message)); -w.once('exit', common.mustCall(() => { - const uint8array = new Uint8Array(sharedArrayBuffer); - uint8array[0] = 42; - assert.deepStrictEqual(uint8array, new Uint8Array([42, 0, 0, 0])); -})); + let arrayBuffer; + w.once('message', common.mustCall((message) => arrayBuffer = message)); + w.once('exit', common.mustCall(() => { + assert.strictEqual(arrayBuffer.constructor.name, ctor); + const uint8array = new Uint8Array(arrayBuffer); + uint8array[0] = 42; + assert.deepStrictEqual(uint8array, new Uint8Array([42, 0, 0, 0])); + })); +} diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index 9c70e18d6a1291..c89ab6e8b576f4 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -29,6 +29,7 @@ import os import re from functools import reduce +from io import open FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") @@ -56,7 +57,7 @@ def GetName(self): def GetCommand(self): result = [self.config.context.GetVm(self.arch, self.mode)] - source = open(self.file).read() + source = open(self.file, encoding='utf8').read() flags_match = FLAGS_PATTERN.search(source) if flags_match: flags = flags_match.group(1).strip().split() diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 8e3e733e52a1a1..cd85d5365791ba 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -21,7 +21,7 @@ 'use strict'; -const fs = require('fs'); +const { promises: fs } = require('fs'); const path = require('path'); const unified = require('unified'); const markdown = require('remark-parse'); @@ -41,36 +41,35 @@ let nodeVersion = null; let outputDir = null; let apilinks = {}; -args.forEach((arg) => { - if (!arg.startsWith('--')) { - filename = arg; - } else if (arg.startsWith('--node-version=')) { - nodeVersion = arg.replace(/^--node-version=/, ''); - } else if (arg.startsWith('--output-directory=')) { - outputDir = arg.replace(/^--output-directory=/, ''); - } else if (arg.startsWith('--apilinks=')) { - const linkFile = arg.replace(/^--apilinks=/, ''); - const data = fs.readFileSync(linkFile, 'utf8'); - if (!data.trim()) { - throw new Error(`${linkFile} is empty`); +async function main() { + for (const arg of args) { + if (!arg.startsWith('--')) { + filename = arg; + } else if (arg.startsWith('--node-version=')) { + nodeVersion = arg.replace(/^--node-version=/, ''); + } else if (arg.startsWith('--output-directory=')) { + outputDir = arg.replace(/^--output-directory=/, ''); + } else if (arg.startsWith('--apilinks=')) { + const linkFile = arg.replace(/^--apilinks=/, ''); + const data = await fs.readFile(linkFile, 'utf8'); + if (!data.trim()) { + throw new Error(`${linkFile} is empty`); + } + apilinks = JSON.parse(data); } - apilinks = JSON.parse(data); } -}); -nodeVersion = nodeVersion || process.version; - -if (!filename) { - throw new Error('No input file specified'); -} else if (!outputDir) { - throw new Error('No output directory specified'); -} + nodeVersion = nodeVersion || process.version; + if (!filename) { + throw new Error('No input file specified'); + } else if (!outputDir) { + throw new Error('No output directory specified'); + } -fs.readFile(filename, 'utf8', (er, input) => { - if (er) throw er; + const input = await fs.readFile(filename, 'utf8'); - const content = unified() + const content = await unified() .use(markdown) .use(html.preprocessText) .use(json.jsonAPI, { filename }) @@ -80,19 +79,40 @@ fs.readFile(filename, 'utf8', (er, input) => { .use(remark2rehype, { allowDangerousHTML: true }) .use(raw) .use(htmlStringify) - .processSync(input); + .process(input); + const myHtml = await html.toHTML({ input, content, filename, nodeVersion }); const basename = path.basename(filename, '.md'); + const htmlTarget = path.join(outputDir, `${basename}.html`); + const jsonTarget = path.join(outputDir, `${basename}.json`); + + return Promise.allSettled([ + fs.writeFile(htmlTarget, myHtml), + fs.writeFile(jsonTarget, JSON.stringify(content.json, null, 2)), + ]); +} - html.toHTML( - { input, content, filename, nodeVersion }, - (err, html) => { - const target = path.join(outputDir, `${basename}.html`); - if (err) throw err; - fs.writeFileSync(target, html); +main() + .then((tasks) => { + // Filter rejected tasks + const errors = tasks.filter(({ status }) => status === 'rejected') + .map(({ reason }) => reason); + + // Log errors + for (const error of errors) { + console.error(error); + } + + // Exit process with code 1 if some errors + if (errors.length > 0) { + return process.exit(1); } - ); - const target = path.join(outputDir, `${basename}.json`); - fs.writeFileSync(target, JSON.stringify(content.json, null, 2)); -}); + // Else with code 0 + process.exit(0); + }) + .catch((error) => { + console.error(error); + + process.exit(1); + }); diff --git a/tools/doc/html.js b/tools/doc/html.js index 318feefe3461a1..f4246a781c5a79 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -63,7 +63,7 @@ const gtocHTML = unified() const templatePath = path.join(docPath, 'template.html'); const template = fs.readFileSync(templatePath, 'utf8'); -async function toHTML({ input, content, filename, nodeVersion }, cb) { +async function toHTML({ input, content, filename, nodeVersion }) { filename = path.basename(filename, '.md'); const id = filename.replace(/\W+/g, '-'); @@ -87,7 +87,7 @@ async function toHTML({ input, content, filename, nodeVersion }, cb) { HTML = HTML.replace('__ALTDOCS__', ''); } - cb(null, HTML); + return HTML; } // Set the section name based on the first header. Default to 'Index'. diff --git a/tools/doc/package.json b/tools/doc/package.json index 1d2953b023b06d..11f6c76c911a59 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -4,7 +4,7 @@ "description": "Internal tool for generating Node.js API docs", "version": "0.0.0", "engines": { - "node": ">=6" + "node": ">=12.10.0" }, "dependencies": { "rehype-raw": "^2.0.0", diff --git a/tools/gyp/buildbot/buildbot_run.py b/tools/gyp/buildbot/buildbot_run.py index 9a2b71f1b355cf..cdd347d0bcc95a 100755 --- a/tools/gyp/buildbot/buildbot_run.py +++ b/tools/gyp/buildbot/buildbot_run.py @@ -4,6 +4,7 @@ # found in the LICENSE file. """Argument-less script to select what to run on the buildbots.""" +from __future__ import print_function import os import shutil @@ -24,14 +25,14 @@ def CallSubProcess(*args, **kwargs): with open(os.devnull) as devnull_fd: retcode = subprocess.call(stdin=devnull_fd, *args, **kwargs) if retcode != 0: - print '@@@STEP_EXCEPTION@@@' + print('@@@STEP_EXCEPTION@@@') sys.exit(1) def PrepareCmake(): """Build CMake 2.8.8 since the version in Precise is 2.8.7.""" if os.environ['BUILDBOT_CLOBBER'] == '1': - print '@@@BUILD_STEP Clobber CMake checkout@@@' + print('@@@BUILD_STEP Clobber CMake checkout@@@') shutil.rmtree(CMAKE_DIR) # We always build CMake 2.8.8, so no need to do anything @@ -39,10 +40,10 @@ def PrepareCmake(): if os.path.isdir(CMAKE_DIR): return - print '@@@BUILD_STEP Initialize CMake checkout@@@' + print('@@@BUILD_STEP Initialize CMake checkout@@@') os.mkdir(CMAKE_DIR) - print '@@@BUILD_STEP Sync CMake@@@' + print('@@@BUILD_STEP Sync CMake@@@') CallSubProcess( ['git', 'clone', '--depth', '1', @@ -53,7 +54,7 @@ def PrepareCmake(): CMAKE_DIR], cwd=CMAKE_DIR) - print '@@@BUILD_STEP Build CMake@@@' + print('@@@BUILD_STEP Build CMake@@@') CallSubProcess( ['/bin/bash', 'bootstrap', '--prefix=%s' % CMAKE_DIR], cwd=CMAKE_DIR) @@ -74,7 +75,7 @@ def GypTestFormat(title, format=None, msvs_version=None, tests=[]): if not format: format = title - print '@@@BUILD_STEP ' + title + '@@@' + print('@@@BUILD_STEP ' + title + '@@@') sys.stdout.flush() env = os.environ.copy() if msvs_version: @@ -89,17 +90,17 @@ def GypTestFormat(title, format=None, msvs_version=None, tests=[]): retcode = subprocess.call(command, cwd=ROOT_DIR, env=env, shell=True) if retcode: # Emit failure tag, and keep going. - print '@@@STEP_FAILURE@@@' + print('@@@STEP_FAILURE@@@') return 1 return 0 def GypBuild(): # Dump out/ directory. - print '@@@BUILD_STEP cleanup@@@' - print 'Removing %s...' % OUT_DIR + print('@@@BUILD_STEP cleanup@@@') + print('Removing %s...' % OUT_DIR) shutil.rmtree(OUT_DIR, ignore_errors=True) - print 'Done.' + print('Done.') retcode = 0 if sys.platform.startswith('linux'): @@ -128,7 +129,7 @@ def GypBuild(): # after the build proper that could be used for cumulative failures), # use that instead of this. This isolates the final return value so # that it isn't misattributed to the last stage. - print '@@@BUILD_STEP failures@@@' + print('@@@BUILD_STEP failures@@@') sys.exit(retcode) diff --git a/tools/gyp/gyptest.py b/tools/gyp/gyptest.py index 9930e78c7b0f1c..1a9ffca7a134ae 100755 --- a/tools/gyp/gyptest.py +++ b/tools/gyp/gyptest.py @@ -58,7 +58,7 @@ def main(argv=None): os.chdir(args.chdir) if args.path: - extra_path = [os.path.abspath(p) for p in opts.path] + extra_path = [os.path.abspath(p) for p in args.path] extra_path = os.pathsep.join(extra_path) os.environ['PATH'] = extra_path + os.pathsep + os.environ['PATH'] diff --git a/tools/gyp/pylib/gyp/MSVSNew.py b/tools/gyp/pylib/gyp/MSVSNew.py index 0ec628cc1f759d..740ef2c73fa71b 100644 --- a/tools/gyp/pylib/gyp/MSVSNew.py +++ b/tools/gyp/pylib/gyp/MSVSNew.py @@ -7,6 +7,7 @@ import hashlib import os import random +from operator import attrgetter import gyp.common @@ -45,7 +46,7 @@ def MakeGuid(name, seed='msvs_new'): not change when the project for a target is rebuilt. """ # Calculate a MD5 signature for the seed and name. - d = hashlib.md5(str(seed) + str(name)).hexdigest().upper() + d = hashlib.md5((str(seed) + str(name)).encode('utf-8')).hexdigest().upper() # Convert most of the signature to GUID form (discard the rest) guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20] + '-' + d[20:32] + '}') @@ -86,7 +87,7 @@ def __init__(self, path, name = None, entries = None, self.guid = guid # Copy passed lists (or set to empty lists) - self.entries = sorted(list(entries or [])) + self.entries = sorted(entries or [], key=attrgetter('path')) self.items = list(items or []) self.entry_type_guid = ENTRY_TYPE_GUIDS['folder'] @@ -230,7 +231,7 @@ def Write(self, writer=gyp.common.WriteOnDiff): if isinstance(e, MSVSFolder): entries_to_check += e.entries - all_entries = sorted(all_entries) + all_entries = sorted(all_entries, key=attrgetter('path')) # Open file and print header f = writer(self.path) diff --git a/tools/gyp/pylib/gyp/common.py b/tools/gyp/pylib/gyp/common.py index e6280d2476cf67..e5ebcd9c9f2f06 100644 --- a/tools/gyp/pylib/gyp/common.py +++ b/tools/gyp/pylib/gyp/common.py @@ -394,6 +394,9 @@ def close(self): os.unlink(self.tmp_path) raise + def write(self, s): + self.tmp_file.write(s.encode('utf-8')) + return Writer() diff --git a/tools/gyp/pylib/gyp/easy_xml.py b/tools/gyp/pylib/gyp/easy_xml.py index acccb47b75ad31..86d0ba6c0c57d4 100644 --- a/tools/gyp/pylib/gyp/easy_xml.py +++ b/tools/gyp/pylib/gyp/easy_xml.py @@ -120,7 +120,7 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False, default_encoding = locale.getdefaultlocale()[1] if default_encoding and default_encoding.upper() != encoding.upper(): - xml_string = xml_string.decode(default_encoding).encode(encoding) + xml_string = xml_string.encode(encoding) # Get the old content try: @@ -132,7 +132,7 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False, # It has changed, write it if existing != xml_string: - f = open(path, 'w') + f = open(path, 'wb') f.write(xml_string) f.close() diff --git a/tools/gyp/pylib/gyp/generator/analyzer.py b/tools/gyp/pylib/gyp/generator/analyzer.py index 88d6c72d7ada61..59d73dbedbd319 100644 --- a/tools/gyp/pylib/gyp/generator/analyzer.py +++ b/tools/gyp/pylib/gyp/generator/analyzer.py @@ -671,7 +671,7 @@ def find_matching_compile_target_names(self): assert self.is_build_impacted() # Compile targets are found by searching up from changed targets. # Reset the visited status for _GetBuildTargets. - for target in self._name_to_target.itervalues(): + for target in self._name_to_target.values(): target.visited = False supplied_targets = _LookupTargets(self._supplied_target_names_no_all(), diff --git a/tools/gyp/pylib/gyp/generator/eclipse.py b/tools/gyp/pylib/gyp/generator/eclipse.py index b7c6aa951fd131..372ceec246dedb 100644 --- a/tools/gyp/pylib/gyp/generator/eclipse.py +++ b/tools/gyp/pylib/gyp/generator/eclipse.py @@ -272,7 +272,7 @@ def WriteMacros(out, eclipse_langs, defines): out.write(' \n') for lang in eclipse_langs: out.write(' \n' % lang) - for key in sorted(defines.iterkeys()): + for key in sorted(defines): out.write(' %s%s\n' % (escape(key), escape(defines[key]))) out.write(' \n') diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py index acc6813966c71e..91a119c5a57694 100644 --- a/tools/gyp/pylib/gyp/generator/make.py +++ b/tools/gyp/pylib/gyp/generator/make.py @@ -800,7 +800,7 @@ def Write(self, qualified_target, base_path, output_filename, spec, configs, gyp.xcode_emulation.MacPrefixHeader( self.xcode_settings, lambda p: Sourceify(self.Absolutify(p)), self.Pchify)) - sources = filter(Compilable, all_sources) + sources = list(filter(Compilable, all_sources)) if sources: self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1) extensions = set([os.path.splitext(s)[1] for s in sources]) @@ -953,7 +953,7 @@ def WriteActions(self, actions, extra_sources, extra_outputs, outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] - self.WriteDoCmd(outputs, map(Sourceify, map(self.Absolutify, inputs)), + self.WriteDoCmd(outputs, [Sourceify(self.Absolutify(i)) for i in inputs], part_of_all=part_of_all, command=name) # Stuff the outputs in a variable so we can refer to them later. @@ -1002,8 +1002,8 @@ def WriteRules(self, rules, extra_sources, extra_outputs, extra_sources += outputs if int(rule.get('process_outputs_as_mac_bundle_resources', False)): extra_mac_bundle_resources += outputs - inputs = map(Sourceify, map(self.Absolutify, [rule_source] + - rule.get('inputs', []))) + inputs = [Sourceify(self.Absolutify(i)) for i + in [rule_source] + rule.get('inputs', [])] actions = ['$(call do_cmd,%s_%d)' % (name, count)] if name == 'resources_grit': @@ -1126,7 +1126,7 @@ def WriteCopies(self, copies, extra_outputs, part_of_all): path = gyp.xcode_emulation.ExpandEnvVars(path, env) self.WriteDoCmd([output], [path], 'copy', part_of_all) outputs.append(output) - self.WriteLn('%s = %s' % (variable, ' '.join(map(QuoteSpaces, outputs)))) + self.WriteLn('%s = %s' % (variable, ' '.join(QuoteSpaces(o) for o in outputs))) extra_outputs.append('$(%s)' % variable) self.WriteLn() @@ -1137,7 +1137,7 @@ def WriteMacBundleResources(self, resources, bundle_deps): for output, res in gyp.xcode_emulation.GetMacBundleResources( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, - map(Sourceify, map(self.Absolutify, resources))): + [Sourceify(self.Absolutify(r)) for r in resources]): _, ext = os.path.splitext(output) if ext != '.xcassets': # Make does not supports '.xcassets' emulation. @@ -1217,11 +1217,11 @@ def WriteSources(self, configs, deps, sources, self.WriteList(cflags_objcc, 'CFLAGS_OBJCC_%s' % configname) includes = config.get('include_dirs') if includes: - includes = map(Sourceify, map(self.Absolutify, includes)) + includes = [Sourceify(self.Absolutify(i)) for i in includes] self.WriteList(includes, 'INCS_%s' % configname, prefix='-I') - compilable = filter(Compilable, sources) - objs = map(self.Objectify, map(self.Absolutify, map(Target, compilable))) + compilable = list(filter(Compilable, sources)) + objs = [self.Objectify(self.Absolutify(Target(c))) for c in compilable] self.WriteList(objs, 'OBJS') for obj in objs: @@ -1293,7 +1293,7 @@ def WriteSources(self, configs, deps, sources, # If there are any object files in our input file list, link them into our # output. - extra_link_deps += filter(Linkable, sources) + extra_link_deps += list(filter(Linkable, sources)) self.WriteLn() @@ -1543,7 +1543,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps, # Bundle dependencies. Note that the code below adds actions to this # target, so if you move these two lines, move the lines below as well. - self.WriteList(map(QuoteSpaces, bundle_deps), 'BUNDLE_DEPS') + self.WriteList([QuoteSpaces(dep) for dep in bundle_deps], 'BUNDLE_DEPS') self.WriteLn('%s: $(BUNDLE_DEPS)' % QuoteSpaces(self.output)) # After the framework is built, package it. Needs to happen before @@ -1577,7 +1577,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps, if self.type == 'executable': self.WriteLn('%s: LD_INPUTS := %s' % ( QuoteSpaces(self.output_binary), - ' '.join(map(QuoteSpaces, link_deps)))) + ' '.join(QuoteSpaces(dep) for dep in link_deps))) if self.toolset == 'host' and self.flavor == 'android': self.WriteDoCmd([self.output_binary], link_deps, 'link_host', part_of_all, postbuilds=postbuilds) @@ -1599,7 +1599,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps, elif self.type == 'shared_library': self.WriteLn('%s: LD_INPUTS := %s' % ( QuoteSpaces(self.output_binary), - ' '.join(map(QuoteSpaces, link_deps)))) + ' '.join(QuoteSpaces(dep) for dep in link_deps))) self.WriteDoCmd([self.output_binary], link_deps, 'solink', part_of_all, postbuilds=postbuilds) elif self.type == 'loadable_module': @@ -1815,7 +1815,7 @@ def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): default_cpp_ext = ext self.WriteLn('LOCAL_CPP_EXTENSION := ' + default_cpp_ext) - self.WriteList(map(self.Absolutify, filter(Compilable, all_sources)), + self.WriteList(list(map(self.Absolutify, filter(Compilable, all_sources))), 'LOCAL_SRC_FILES') # Filter out those which do not match prefix and suffix and produce @@ -1956,7 +1956,7 @@ def WriteAutoRegenerationRule(params, root_makefile, makefile_name, "%(makefile_name)s: %(deps)s\n" "\t$(call do_cmd,regen_makefile)\n\n" % { 'makefile_name': makefile_name, - 'deps': ' '.join(map(Sourceify, build_files)), + 'deps': ' '.join(Sourceify(bf) for bf in build_files), 'cmd': gyp.common.EncodePOSIXShellList( [gyp_binary, '-fmake'] + gyp.RegenerateFlags(options) + diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py index 3a9e6a7aa5cd67..1aed4ca8aa7e00 100644 --- a/tools/gyp/pylib/gyp/generator/msvs.py +++ b/tools/gyp/pylib/gyp/generator/msvs.py @@ -1778,8 +1778,8 @@ def _CollapseSingles(parent, node): # such projects up one level. if (type(node) == dict and len(node) == 1 and - node.keys()[0] == parent + '.vcproj'): - return node[node.keys()[0]] + list(node)[0] == parent + '.vcproj'): + return node[list(node)[0]] if type(node) != dict: return node for child in node: @@ -1798,8 +1798,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat): # Walk down from the top until we hit a folder that has more than one entry. # In practice, this strips the top-level "src/" dir from the hierarchy in # the solution. - while len(root) == 1 and type(root[root.keys()[0]]) == dict: - root = root[root.keys()[0]] + while len(root) == 1 and type(root[list(root)[0]]) == dict: + root = root[list(root)[0]] # Collapse singles. root = _CollapseSingles('', root) # Merge buckets until everything is a root entry. @@ -2728,7 +2728,7 @@ def _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name): platform_name = None msvs_windows_sdk_version = None - for configuration in spec['configurations'].itervalues(): + for configuration in spec['configurations'].values(): platform_name = platform_name or _ConfigPlatform(configuration) msvs_windows_sdk_version = (msvs_windows_sdk_version or _ConfigWindowsTargetPlatformVersion(configuration, version)) @@ -3299,7 +3299,7 @@ def _GetMSBuildProjectReferences(project): ['Project', guid], ['ReferenceOutputAssembly', 'false'] ] - for config in dependency.spec.get('configurations', {}).itervalues(): + for config in dependency.spec.get('configurations', {}).values(): if config.get('msvs_use_library_dependency_inputs', 0): project_ref.append(['UseLibraryDependencyInputs', 'true']) break @@ -3368,7 +3368,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): extension_to_rule_name, _GetUniquePlatforms(spec)) missing_sources = _VerifySourcesExist(sources, project_dir) - for configuration in configurations.itervalues(): + for configuration in configurations.values(): _FinalizeMSBuildSettings(spec, configuration) # Add attributes to root element diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py index 5d4a03020a7c23..6db204e4010284 100644 --- a/tools/gyp/pylib/gyp/input.py +++ b/tools/gyp/pylib/gyp/input.py @@ -19,6 +19,7 @@ import threading import time import traceback +from distutils.version import StrictVersion from gyp.common import GypError from gyp.common import OrderedSet @@ -942,8 +943,12 @@ def to_utf8(s): else: replacement = variables[contents] + if isinstance(replacement, bytes) and not isinstance(replacement, str): + replacement = replacement.decode("utf-8") # done on Python 3 only if type(replacement) is list: for item in replacement: + if isinstance(item, bytes) and not isinstance(item, str): + item = item.decode("utf-8") # done on Python 3 only if not contents[-1] == '/' and type(item) not in (str, int): raise GypError('Variable ' + contents + ' must expand to a string or list of strings; ' + @@ -1084,7 +1089,8 @@ def EvalSingleCondition( else: ast_code = compile(cond_expr_expanded, '', 'eval') cached_conditions_asts[cond_expr_expanded] = ast_code - if eval(ast_code, {'__builtins__': None}, variables): + env = {'__builtins__': None, 'v': StrictVersion} + if eval(ast_code, env, variables): return true_dict return false_dict except SyntaxError as e: diff --git a/tools/gyp/pylib/gyp/mac_tool.py b/tools/gyp/pylib/gyp/mac_tool.py index 409c7fedbd2368..c4c4a6df130404 100755 --- a/tools/gyp/pylib/gyp/mac_tool.py +++ b/tools/gyp/pylib/gyp/mac_tool.py @@ -24,6 +24,8 @@ import sys import tempfile +PY3 = bytes != str + def main(args): executor = MacTool() @@ -137,29 +139,25 @@ def _CopyStringsFile(self, source, dest): # semicolon in dictionary. # on invalid files. Do the same kind of validation. import CoreFoundation - s = open(source, 'rb').read() + with open(source, 'rb') as in_file: + s = in_file.read() d = CoreFoundation.CFDataCreate(None, s, len(s)) _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) if error: return - fp = open(dest, 'wb') - fp.write(s.decode(input_code).encode('UTF-16')) - fp.close() + with open(dest, 'wb') as fp: + fp.write(s.decode(input_code).encode('UTF-16')) def _DetectInputEncoding(self, file_name): """Reads the first few bytes from file_name and tries to guess the text encoding. Returns None as a guess if it can't detect it.""" - fp = open(file_name, 'rb') - try: - header = fp.read(3) - except Exception: - fp.close() - return None - fp.close() - if header.startswith("\xFE\xFF"): - return "UTF-16" - elif header.startswith("\xFF\xFE"): + with open(file_name, 'rb') as fp: + try: + header = fp.read(3) + except Exception: + return None + if header.startswith(("\xFE\xFF", "\xFF\xFE")): return "UTF-16" elif header.startswith("\xEF\xBB\xBF"): return "UTF-8" @@ -169,9 +167,8 @@ def _DetectInputEncoding(self, file_name): def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys): """Copies the |source| Info.plist to the destination directory |dest|.""" # Read the source Info.plist into memory. - fd = open(source, 'r') - lines = fd.read() - fd.close() + with open(source, 'r') as fd: + lines = fd.read() # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). plist = plistlib.readPlistFromString(lines) @@ -204,17 +201,16 @@ def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys): lines = string.replace(lines, evar, evalue) # Remove any keys with values that haven't been replaced. - lines = lines.split('\n') + lines = lines.splitlines() for i in range(len(lines)): if lines[i].strip().startswith("${"): lines[i] = None lines[i - 1] = None - lines = '\n'.join(filter(lambda x: x is not None, lines)) + lines = '\n'.join(line for line in lines if line is not None) # Write out the file with variables replaced. - fd = open(dest, 'w') - fd.write(lines) - fd.close() + with open(dest, 'w') as fd: + fd.write(lines) # Now write out PkgInfo file now that the Info.plist file has been # "compiled". @@ -242,9 +238,8 @@ def _WritePkgInfo(self, info_plist): signature_code = '?' * 4 dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') - fp = open(dest, 'w') - fp.write('%s%s' % (package_type, signature_code)) - fp.close() + with open(dest, 'w') as fp: + fp.write('%s%s' % (package_type, signature_code)) def ExecFlock(self, lockfile, *cmd_list): """Emulates the most basic behavior of Linux's flock(1).""" @@ -270,6 +265,8 @@ def ExecFilterLibtool(self, *cmd_list): env['ZERO_AR_DATE'] = '1' libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) _, err = libtoolout.communicate() + if PY3: + err = err.decode('utf-8') for line in err.splitlines(): if not libtool_re.match(line) and not libtool_re5.match(line): print(line, file=sys.stderr) @@ -295,9 +292,8 @@ def ExecPackageIosFramework(self, framework): ' module * { export * }\n' \ '}\n' % (binary, binary) - module_file = open(os.path.join(module_path, 'module.modulemap'), "w") - module_file.write(module_template) - module_file.close() + with open(os.path.join(module_path, 'module.modulemap'), "w") as module_file: + module_file.write(module_template) def ExecPackageFramework(self, framework, version): """Takes a path to Something.framework and the Current version of that and @@ -337,7 +333,7 @@ def _Relink(self, dest, link): def ExecCompileIosFrameworkHeaderMap(self, out, framework, *all_headers): framework_name = os.path.basename(framework).split('.')[0] - all_headers = map(os.path.abspath, all_headers) + all_headers = [os.path.abspath(header) for header in all_headers] filelist = {} for header in all_headers: filename = os.path.basename(header) @@ -669,7 +665,7 @@ def WriteHmap(output_name, filelist): count = len(filelist) capacity = NextGreaterPowerOf2(count) strings_offset = 24 + (12 * capacity) - max_value_length = len(max(filelist.items(), key=lambda (k,v):len(v))[1]) + max_value_length = max(len(value) for value in filelist.values()) out = open(output_name, "wb") out.write(struct.pack('= '0720': + if xcode_version >= '0720': cache['DTSDKBuild'] = self._GetSdkVersionInfoItem( sdk_root, '--show-sdk-build-version') - elif xcode >= '0430': + elif xcode_version >= '0430': cache['DTSDKBuild'] = sdk_version else: cache['DTSDKBuild'] = cache['BuildMachineOSBuild'] @@ -1254,7 +1257,7 @@ def _DefaultSdkRoot(self): project, then the environment variable was empty. Starting with this version, Xcode uses the name of the newest SDK installed. """ - xcode_version, xcode_build = XcodeVersion() + xcode_version, _ = XcodeVersion() if xcode_version < '0500': return '' default_sdk_path = self._XcodeSdkPath('') @@ -1263,7 +1266,7 @@ def _DefaultSdkRoot(self): return default_sdk_root try: all_sdks = GetStdout(['xcodebuild', '-showsdks']) - except: + except GypError: # If xcodebuild fails, there will be no valid SDKs return '' for line in all_sdks.splitlines(): @@ -1391,10 +1394,12 @@ def XcodeVersion(): # Xcode 3.2.6 # Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0 # BuildVersion: 10M2518 - # Convert that to '0463', '4H1503'. + # Convert that to ('0463', '4H1503') or ('0326', '10M2518'). global XCODE_VERSION_CACHE if XCODE_VERSION_CACHE: return XCODE_VERSION_CACHE + version = "" + build = "" try: version_list = GetStdoutQuiet(['xcodebuild', '-version']).splitlines() # In some circumstances xcodebuild exits 0 but doesn't return @@ -1404,21 +1409,16 @@ def XcodeVersion(): # checking that version. if len(version_list) < 2: raise GypError("xcodebuild returned unexpected results") - except: - version = CLTVersion() - if version: - version = re.match(r'(\d+\.\d+\.?\d*)', version).groups()[0] - else: + version = version_list[0].split()[-1] # Last word on first line + build = version_list[-1].split()[-1] # Last word on last line + except GypError: # Xcode not installed so look for XCode Command Line Tools + version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322 + if not version: raise GypError("No Xcode or CLT version detected!") - # The CLT has no build information, so we return an empty string. - version_list = [version, ''] - version = version_list[0] - build = version_list[-1] - # Be careful to convert "4.2" to "0420": - version = version.split()[-1].replace('.', '') - version = (version + '0' * (3 - len(version))).zfill(4) - if build: - build = build.split()[-1] + # Be careful to convert "4.2.3" to "0423" and "11.0.0" to "1100": + version = version.split(".")[:3] # Just major, minor, micro + version[0] = version[0].zfill(2) # Add a leading zero if major is one digit + version = ("".join(version) + "00")[:4] # Limit to exactly four characters XCODE_VERSION_CACHE = (version, build) return XCODE_VERSION_CACHE @@ -1442,7 +1442,7 @@ def CLTVersion(): try: output = GetStdout(['/usr/sbin/pkgutil', '--pkg-info', key]) return re.search(regex, output).groupdict()['version'] - except: + except GypError: continue @@ -1453,6 +1453,8 @@ def GetStdoutQuiet(cmdlist): job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = job.communicate()[0] + if PY3: + out = out.decode("utf-8") if job.returncode != 0: raise GypError('Error %d running %s' % (job.returncode, cmdlist[0])) return out.rstrip('\n') @@ -1463,6 +1465,8 @@ def GetStdout(cmdlist): Raises |GypError| if the command return with a non-zero return code.""" job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE) out = job.communicate()[0] + if PY3: + out = out.decode("utf-8") if job.returncode != 0: sys.stderr.write(out + '\n') raise GypError('Error %d running %s' % (job.returncode, cmdlist[0])) @@ -1674,7 +1678,8 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, install_name_base = xcode_settings.GetInstallNameBase() if install_name_base: env['DYLIB_INSTALL_NAME_BASE'] = install_name_base - if XcodeVersion() >= '0500' and not env.get('SDKROOT'): + xcode_version, _ = XcodeVersion() + if xcode_version >= '0500' and not env.get('SDKROOT'): sdk_root = xcode_settings._SdkRoot(configuration) if not sdk_root: sdk_root = xcode_settings._XcodeSdkPath('') @@ -1792,7 +1797,7 @@ def _HasIOSTarget(targets): def _AddIOSDeviceConfigurations(targets): """Clone all targets and append -iphoneos to the name. Configure these targets to build for iOS devices and use correct architectures for those builds.""" - for target_dict in targets.itervalues(): + for target_dict in targets.values(): toolset = target_dict['toolset'] configs = target_dict['configurations'] for config_name, simulator_config_dict in dict(configs).items(): diff --git a/tools/gyp/pylib/gyp/xcode_ninja.py b/tools/gyp/pylib/gyp/xcode_ninja.py index 5bf6b9cfb5a0bd..2bc2143340229b 100644 --- a/tools/gyp/pylib/gyp/xcode_ninja.py +++ b/tools/gyp/pylib/gyp/xcode_ninja.py @@ -85,7 +85,7 @@ def _TargetFromSpec(old_spec, params): "%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" % ninja_toplevel if 'configurations' in old_spec: - for config in old_spec['configurations'].iterkeys(): + for config in old_spec['configurations']: old_xcode_settings = \ old_spec['configurations'][config].get('xcode_settings', {}) if 'IPHONEOS_DEPLOYMENT_TARGET' in old_xcode_settings: diff --git a/tools/icu/README.md b/tools/icu/README.md index 94eaf50a55c82a..4ce7e4483fcf40 100644 --- a/tools/icu/README.md +++ b/tools/icu/README.md @@ -128,9 +128,9 @@ ICU in the future. As of this writing, however, the tools are separate entities within Node.js, although theyare being scrutinized by interested members of the ICU-TC. The “upstream” ICU bugs are given below. - * [#10919](http://bugs.icu-project.org/trac/ticket/10919) - (experimental branch - may copy any source patches here) - * [#10922](http://bugs.icu-project.org/trac/ticket/10922) - (data packaging improvements) - * [#10923](http://bugs.icu-project.org/trac/ticket/10923) - (rewrite data building in python) +* [#10919](http://bugs.icu-project.org/trac/ticket/10919) + (experimental branch - may copy any source patches here) +* [#10922](http://bugs.icu-project.org/trac/ticket/10922) + (data packaging improvements) +* [#10923](http://bugs.icu-project.org/trac/ticket/10923) + (rewrite data building in python) diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index fbd99b12df19da..fd0c14668743bc 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -40,7 +40,7 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J ## Installation and Usage -Prerequisites: [Node.js](https://nodejs.org/) (`^8.10.0`, `^10.13.0`, or `>=11.10.1`), npm version 3+. +Prerequisites: [Node.js](https://nodejs.org/) (`^8.10.0`, `^10.13.0`, or `>=11.10.1`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.) You can install ESLint using npm: @@ -156,8 +156,9 @@ ESLint follows [semantic versioning](https://semver.org). However, due to the na * A new CLI capability is created. * New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.). * A new formatter is created. + * `eslint:recommended` is updated and will result in strictly fewer errors (e.g., rule removals). * Major release (likely to break your lint build) - * `eslint:recommended` is updated. + * `eslint:recommended` is updated and may result in new errors (e.g., rule additions, most rule option updates). * A new option to an existing rule that results in ESLint reporting more errors by default. * An existing formatter is removed. * Part of the public API is removed or changed in an incompatible way. @@ -264,7 +265,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

    Gold Sponsors

    Shopify Salesforce Badoo Airbnb Facebook Open Source

    Silver Sponsors

    AMP Project

    Bronze Sponsors

    -

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

    +

    UI UX Design Agencies Bugsnag Stability Monitoring MiniTool Software Ltd Codacy Mixpanel VPS Server Free Icons by Icons8 Crosswordsolver clay Discord ThemeIsle TekHattan Marfeel Fire Stick Tricks JSHeroes

    ## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js b/tools/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js index 13b240f12b3d9b..6c914ea491c1b4 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js +++ b/tools/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js @@ -152,8 +152,9 @@ function createCLIConfigArray({ */ class ConfigurationNotFoundError extends Error { + // eslint-disable-next-line jsdoc/require-description /** - * @param {string} directoryPath - The directory path. + * @param {string} directoryPath The directory path. */ constructor(directoryPath) { super(`No ESLint configuration found in ${directoryPath}.`); diff --git a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js index 3c67d33daa6413..8afd262708fa8b 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -145,7 +145,7 @@ function validateFixTypes(fixTypes) { /** * It will calculate the error and warning count for collection of messages per file - * @param {LintMessage[]} messages - Collection of messages + * @param {LintMessage[]} messages Collection of messages * @returns {Object} Contains the stats * @private */ @@ -173,7 +173,7 @@ function calculateStatsPerFile(messages) { /** * It will calculate the error and warning count for collection of results from all files - * @param {LintResult[]} results - Collection of messages from all the files + * @param {LintResult[]} results Collection of messages from all the files * @returns {Object} Contains the stats * @private */ @@ -272,8 +272,8 @@ function verifyText({ /** * Returns result with warning by ignore settings - * @param {string} filePath - File path of checked code - * @param {string} baseDir - Absolute path of base directory + * @param {string} filePath File path of checked code + * @param {string} baseDir Absolute path of base directory * @returns {LintResult} Result with single warning * @private */ @@ -387,7 +387,6 @@ function isErrorMessage(message) { * name will be the `cacheFile/.cache_hashOfCWD` * * if cacheFile points to a file or looks like a file then in will just use that file - * * @param {string} cacheFile The name of file to be used to store the cache * @param {string} cwd Current working directory * @returns {string} the resolved path to the cache file @@ -568,7 +567,7 @@ class CLIEngine { }); const lintResultCache = options.cache ? new LintResultCache(cacheFilePath) : null; - const linter = new Linter(); + const linter = new Linter({ cwd: options.cwd }); /** @type {ConfigArray[]} */ const lastConfigArrays = [configArrayFactory.getConfigArrayForFile()]; @@ -668,11 +667,14 @@ class CLIEngine { addPlugin(name, pluginObject) { const { additionalPluginPool, - configArrayFactory + configArrayFactory, + lastConfigArrays } = internalSlotsMap.get(this); additionalPluginPool.set(name, pluginObject); configArrayFactory.clearCache(); + lastConfigArrays.length = 1; + lastConfigArrays[0] = configArrayFactory.getConfigArrayForFile(); } /** diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js index 6e1ba1e02b964c..cf529b6ee6313e 100644 --- a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js +++ b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js @@ -859,8 +859,14 @@ class ConfigArrayFactory { if (filePath) { try { writeDebugLogForLoading(request, relativeTo, filePath); + + const startTime = Date.now(); + const pluginDefinition = require(filePath); + + debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`); + return new ConfigDependency({ - definition: normalizePlugin(require(filePath)), + definition: normalizePlugin(pluginDefinition), filePath, id, importerName, diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js b/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js index 6383c02115f98d..089ff305a2ba44 100644 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js +++ b/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js @@ -126,7 +126,6 @@ function isNonNullObject(x) { * * Assign every property values of `y` to `x` if `x` doesn't have the property. * If `x`'s property value is an object, it does recursive. - * * @param {Object} target The destination to merge * @param {Object|undefined} source The source to merge. * @returns {void} @@ -157,7 +156,6 @@ function mergeWithoutOverwrite(target, source) { /** * Merge plugins. * `target`'s definition is prior to `source`'s. - * * @param {Record} target The destination to merge * @param {Record|undefined} source The source to merge. * @returns {void} @@ -187,7 +185,6 @@ function mergePlugins(target, source) { /** * Merge rule configs. * `target`'s definition is prior to `source`'s. - * * @param {Record} target The destination to merge * @param {Record|undefined} source The source to merge. * @returns {void} @@ -382,7 +379,6 @@ function ensurePluginMemberMaps(instance) { * You need to call `ConfigArray#extractConfig(filePath)` method in order to * extract, merge and get only the config data which is related to an arbitrary * file. - * * @extends {Array} */ class ConfigArray extends Array { diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js b/tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js index 8db9ff00c5c287..0d5f6f71395eab 100644 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js +++ b/tools/node_modules/eslint/lib/cli-engine/config-array/config-dependency.js @@ -81,6 +81,7 @@ class ConfigDependency { this.importerPath = importerPath; } + // eslint-disable-next-line jsdoc/require-description /** * @returns {Object} a JSON compatible object. */ @@ -95,6 +96,7 @@ class ConfigDependency { return obj; } + // eslint-disable-next-line jsdoc/require-description /** * @returns {Object} an object to display by `console.log()`. */ diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js b/tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js index d6695423e25eb9..67c8a6ed8a0cbb 100644 --- a/tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js +++ b/tools/node_modules/eslint/lib/cli-engine/config-array/override-tester.js @@ -166,6 +166,7 @@ class OverrideTester { )); } + // eslint-disable-next-line jsdoc/require-description /** * @returns {Object} a JSON compatible object. */ @@ -182,6 +183,7 @@ class OverrideTester { }; } + // eslint-disable-next-line jsdoc/require-description /** * @returns {Object} an object to display by `console.log()`. */ diff --git a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js index a027359ae511b1..38f55de039d6d1 100644 --- a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js +++ b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js @@ -149,9 +149,10 @@ function readdirSafeSync(directoryPath) { */ class NoFilesFoundError extends Error { + // eslint-disable-next-line jsdoc/require-description /** - * @param {string} pattern - The glob pattern which was not found. - * @param {boolean} globDisabled - If `true` then the pattern was a glob pattern, but glob was disabled. + * @param {string} pattern The glob pattern which was not found. + * @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled. */ constructor(pattern, globDisabled) { super(`No files matching '${pattern}' were found${globDisabled ? " (glob was disabled)" : ""}.`); @@ -165,8 +166,9 @@ class NoFilesFoundError extends Error { */ class AllFilesIgnoredError extends Error { + // eslint-disable-next-line jsdoc/require-description /** - * @param {string} pattern - The glob pattern which was not found. + * @param {string} pattern The glob pattern which was not found. */ constructor(pattern) { super(`All files matched by '${pattern}' are ignored.`); diff --git a/tools/node_modules/eslint/lib/cli-engine/formatters/html.js b/tools/node_modules/eslint/lib/cli-engine/formatters/html.js index 091eab1c4ad772..69f7395550f2e2 100644 --- a/tools/node_modules/eslint/lib/cli-engine/formatters/html.js +++ b/tools/node_modules/eslint/lib/cli-engine/formatters/html.js @@ -96,6 +96,7 @@ function renderMessages(messages, parentIndex, rulesMeta) { }).join("\n"); } +// eslint-disable-next-line jsdoc/require-description /** * @param {Array} results Test results. * @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis. diff --git a/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js b/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js index 12dfce06665eef..dec8e1860420e2 100644 --- a/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js +++ b/tools/node_modules/eslint/lib/cli-engine/ignored-paths.js @@ -121,6 +121,7 @@ function relativize(globPattern, relativePathToOldBaseDir) { */ class IgnoredPaths { + // eslint-disable-next-line jsdoc/require-description /** * @param {Object} providedOptions object containing 'ignore', 'ignorePath' and 'patterns' properties */ diff --git a/tools/node_modules/eslint/lib/init/autoconfig.js b/tools/node_modules/eslint/lib/init/autoconfig.js index 19c4986c31bbfe..64be3d2a84f49b 100644 --- a/tools/node_modules/eslint/lib/init/autoconfig.js +++ b/tools/node_modules/eslint/lib/init/autoconfig.js @@ -31,7 +31,6 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only /** * Information about a rule configuration, in the context of a Registry. - * * @typedef {Object} registryItem * @param {ruleConfig} config A valid configuration for the rule * @param {number} specificity The number of elements in the ruleConfig array @@ -70,6 +69,7 @@ function makeRegistryItems(rulesConfig) { */ class Registry { + // eslint-disable-next-line jsdoc/require-description /** * @param {rulesConfig} [rulesConfig] Hash of rule names and arrays of possible configurations */ @@ -82,7 +82,6 @@ class Registry { * * It will set the registry's `rule` property to an object having rule names * as keys and an array of registryItems as values. - * * @returns {void} */ populateFromCoreRules() { @@ -101,7 +100,6 @@ class Registry { * configurations. * * The length of the returned array will be <= MAX_CONFIG_COMBINATIONS. - * * @returns {Object[]} "rules" configurations to use for linting */ buildRuleSets() { @@ -114,7 +112,6 @@ class Registry { * * This is broken out into its own function so that it doesn't need to be * created inside of the while loop. - * * @param {string} rule The ruleId to add. * @returns {void} */ @@ -162,7 +159,6 @@ class Registry { * * Note: this also removes rule configurations which were not linted * (meaning, they have an undefined errorCount). - * * @returns {void} */ stripFailingConfigs() { @@ -185,7 +181,6 @@ class Registry { /** * Removes rule configurations which were not included in a ruleSet - * * @returns {void} */ stripExtraConfigs() { @@ -204,7 +199,6 @@ class Registry { * Creates a registry of rules which had no error-free configs. * The new registry is intended to be analyzed to determine whether its rules * should be disabled or set to warning. - * * @returns {Registry} A registry of failing rules. */ getFailingRulesRegistry() { @@ -225,7 +219,6 @@ class Registry { /** * Create an eslint config for any rules which only have one configuration * in the registry. - * * @returns {Object} An eslint config with rules section populated */ createConfig() { @@ -243,7 +236,6 @@ class Registry { /** * Return a cloned registry containing only configs with a desired specificity - * * @param {number} specificity Only keep configs with this specificity * @returns {Registry} A registry of rules */ @@ -261,7 +253,6 @@ class Registry { /** * Lint SourceCodes against all configurations in the registry, and record results - * * @param {Object[]} sourceCodes SourceCode objects for each filename * @param {Object} config ESLint config object * @param {progressCallback} [cb] Optional callback for reporting execution status @@ -327,7 +318,6 @@ class Registry { * * This will return a new config with `"extends": "eslint:recommended"` and * only the rules which have configurations different from the recommended config. - * * @param {Object} config config object * @returns {Object} config object using `"extends": "eslint:recommended"` */ diff --git a/tools/node_modules/eslint/lib/init/config-file.js b/tools/node_modules/eslint/lib/init/config-file.js index 77f14a47299cde..960b572cddb3ea 100644 --- a/tools/node_modules/eslint/lib/init/config-file.js +++ b/tools/node_modules/eslint/lib/init/config-file.js @@ -23,7 +23,6 @@ const debug = require("debug")("eslint:config-file"); * Determines sort order for object keys for json-stable-stringify * * see: https://github.com/samn/json-stable-stringify#cmp - * * @param {Object} a The first comparison object ({key: akey, value: avalue}) * @param {Object} b The second comparison object ({key: bkey, value: bvalue}) * @returns {number} 1 or -1, used in stringify cmp method diff --git a/tools/node_modules/eslint/lib/init/config-initializer.js b/tools/node_modules/eslint/lib/init/config-initializer.js index 2e47e902c7782e..48e56ce526131a 100644 --- a/tools/node_modules/eslint/lib/init/config-initializer.js +++ b/tools/node_modules/eslint/lib/init/config-initializer.js @@ -147,7 +147,6 @@ function getModulesList(config, installESLint) { * * Note: This clones the config object and returns a new config to avoid mutating * the original config parameter. - * * @param {Object} answers answers received from inquirer * @param {Object} config config object * @returns {Object} config object with configured rules diff --git a/tools/node_modules/eslint/lib/init/config-rule.js b/tools/node_modules/eslint/lib/init/config-rule.js index e40feb7145b0cf..7aec89c3df004f 100644 --- a/tools/node_modules/eslint/lib/init/config-rule.js +++ b/tools/node_modules/eslint/lib/init/config-rule.js @@ -33,7 +33,6 @@ function explodeArray(xs) { * * For example: * combineArrays([a, [b, c]], [x, y]); // -> [[a, x], [a, y], [b, c, x], [b, c, y]] - * * @param {Array} arr1 The first array to combine. * @param {Array} arr2 The second array to combine. * @returns {Array} A mixture of the elements of the first and second arrays. @@ -71,7 +70,6 @@ function combineArrays(arr1, arr2) { * [{before: true}, {before: false}], * [{after: true}, {after: false}] * ] - * * @param {Object[]} objects Array of objects, each with one property/value pair * @returns {Array[]} Array of arrays of objects grouped by property */ @@ -98,7 +96,6 @@ function groupByProperty(objects) { * element in the array is the severity, and is the only required element. * Configs may also have one or more additional elements to specify rule * configuration or options. - * * @typedef {Array|number} ruleConfig * @param {number} 0 The rule's severity (0, 1, 2). */ @@ -134,7 +131,6 @@ function groupByProperty(objects) { * {before: false, after: true}, * {before: false, after: false} * ] - * * @param {Object[]} objArr1 Single key/value objects, all with the same key * @param {Object[]} objArr2 Single key/value objects, all with another key * @returns {Object[]} Combined objects for each combination of input properties and values @@ -178,6 +174,7 @@ function combinePropertyObjects(objArr1, objArr2) { */ class RuleConfigSet { + // eslint-disable-next-line jsdoc/require-description /** * @param {ruleConfig[]} configs Valid rule configurations */ @@ -193,7 +190,6 @@ class RuleConfigSet { /** * Add a severity level to the front of all configs in the instance. * This should only be called after all configs have been added to the instance. - * * @returns {void} */ addErrorSeverity() { diff --git a/tools/node_modules/eslint/lib/init/npm-utils.js b/tools/node_modules/eslint/lib/init/npm-utils.js index 3d4a896b6f6e51..28c198fc8ada67 100644 --- a/tools/node_modules/eslint/lib/init/npm-utils.js +++ b/tools/node_modules/eslint/lib/init/npm-utils.js @@ -21,7 +21,6 @@ const fs = require("fs"), /** * Find the closest package.json file, starting at process.cwd (by default), * and working up to root. - * * @param {string} [startDir=process.cwd()] Starting directory * @returns {string} Absolute path to closest package.json file */ @@ -88,7 +87,6 @@ function fetchPeerDependencies(packageName) { /** * Check whether node modules are include in a project's package.json. - * * @param {string[]} packages Array of node module names * @param {Object} opt Options Object * @param {boolean} opt.dependencies Set to true to check for direct dependencies @@ -136,7 +134,6 @@ function check(packages, opt) { * package.json. * * Convenience wrapper around check(). - * * @param {string[]} packages Array of node modules to check. * @param {string} rootDir The directory contianing a package.json * @returns {Object} An object whose keys are the module names @@ -151,7 +148,6 @@ function checkDeps(packages, rootDir) { * package.json. * * Convenience wrapper around check(). - * * @param {string[]} packages Array of node modules to check. * @returns {Object} An object whose keys are the module names * and values are booleans indicating installation. @@ -162,7 +158,6 @@ function checkDevDeps(packages) { /** * Check whether package.json is found in current path. - * * @param {string} [startDir] Starting directory * @returns {boolean} Whether a package.json is found in current path. */ diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js index 821477aef9933c..6822ae2be0a6cd 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js @@ -22,8 +22,7 @@ const assert = require("assert"), /** * Checks whether or not a given node is a `case` node (not `default` node). - * - * @param {ASTNode} node - A `SwitchCase` node to check. + * @param {ASTNode} node A `SwitchCase` node to check. * @returns {boolean} `true` if the node is a `case` node (not `default` node). */ function isCaseNode(node) { @@ -33,8 +32,7 @@ function isCaseNode(node) { /** * Checks whether the given logical operator is taken into account for the code * path analysis. - * - * @param {string} operator - The operator found in the LogicalExpression node + * @param {string} operator The operator found in the LogicalExpression node * @returns {boolean} `true` if the operator is "&&" or "||" */ function isHandledLogicalOperator(operator) { @@ -43,8 +41,7 @@ function isHandledLogicalOperator(operator) { /** * Gets the label if the parent node of a given node is a LabeledStatement. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {string|null} The label or `null`. */ function getLabel(node) { @@ -57,8 +54,7 @@ function getLabel(node) { /** * Checks whether or not a given logical expression node goes different path * between the `true` case and the `false` case. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a test of a choice statement. */ function isForkingByTrueOrFalse(node) { @@ -86,8 +82,7 @@ function isForkingByTrueOrFalse(node) { * This is used to detect infinity loops (e.g. `while (true) {}`). * Statements preceded by an infinity loop are unreachable if the loop didn't * have any `break` statement. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {boolean|undefined} a boolean value if the node is a Literal node, * otherwise `undefined`. */ @@ -102,8 +97,7 @@ function getBooleanValueIfSimpleConstant(node) { * Checks that a given identifier node is a reference or not. * * This is used to detect the first throwable node in a `try` block. - * - * @param {ASTNode} node - An Identifier node to check. + * @param {ASTNode} node An Identifier node to check. * @returns {boolean} `true` if the node is a reference. */ function isIdentifierReference(node) { @@ -153,9 +147,8 @@ function isIdentifierReference(node) { * * In this process, both "onCodePathSegmentStart" and "onCodePathSegmentEnd" * events are fired. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function forwardCurrentToHead(analyzer, node) { @@ -211,9 +204,8 @@ function forwardCurrentToHead(analyzer, node) { /** * Updates the current segment with empty. * This is called at the last of functions or the program. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function leaveFromCurrentSegment(analyzer, node) { @@ -242,9 +234,8 @@ function leaveFromCurrentSegment(analyzer, node) { * * For example, if the node is `parent.consequent`, this creates a fork from the * current path. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function preprocess(analyzer, node) { @@ -352,9 +343,8 @@ function preprocess(analyzer, node) { /** * Updates the code path due to the type of a given node in entering. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function processCodePathToEnter(analyzer, node) { @@ -449,9 +439,8 @@ function processCodePathToEnter(analyzer, node) { /** * Updates the code path due to the type of a given node in leaving. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function processCodePathToExit(analyzer, node) { @@ -563,9 +552,8 @@ function processCodePathToExit(analyzer, node) { /** * Updates the code path to finalize the current code path. - * - * @param {CodePathAnalyzer} analyzer - The instance. - * @param {ASTNode} node - The current AST node. + * @param {CodePathAnalyzer} analyzer The instance. + * @param {ASTNode} node The current AST node. * @returns {void} */ function postprocess(analyzer, node) { @@ -609,8 +597,9 @@ function postprocess(analyzer, node) { */ class CodePathAnalyzer { + // eslint-disable-next-line jsdoc/require-description /** - * @param {EventGenerator} eventGenerator - An event generator to wrap. + * @param {EventGenerator} eventGenerator An event generator to wrap. */ constructor(eventGenerator) { this.original = eventGenerator; @@ -624,8 +613,7 @@ class CodePathAnalyzer { /** * Does the process to enter a given AST node. * This updates state of analysis and calls `enterNode` of the wrapped. - * - * @param {ASTNode} node - A node which is entering. + * @param {ASTNode} node A node which is entering. * @returns {void} */ enterNode(node) { @@ -651,8 +639,7 @@ class CodePathAnalyzer { /** * Does the process to leave a given AST node. * This updates state of analysis and calls `leaveNode` of the wrapped. - * - * @param {ASTNode} node - A node which is leaving. + * @param {ASTNode} node A node which is leaving. * @returns {void} */ leaveNode(node) { @@ -676,9 +663,8 @@ class CodePathAnalyzer { /** * This is called on a code path looped. * Then this raises a looped event. - * - * @param {CodePathSegment} fromSegment - A segment of prev. - * @param {CodePathSegment} toSegment - A segment of next. + * @param {CodePathSegment} fromSegment A segment of prev. + * @param {CodePathSegment} toSegment A segment of next. * @returns {void} */ onLooped(fromSegment, toSegment) { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js index 8145f9280162bb..6b17b25c7fdffd 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js @@ -17,8 +17,7 @@ const debug = require("./debug-helpers"); /** * Checks whether or not a given segment is reachable. - * - * @param {CodePathSegment} segment - A segment to check. + * @param {CodePathSegment} segment A segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -34,11 +33,12 @@ function isReachable(segment) { */ class CodePathSegment { + // eslint-disable-next-line jsdoc/require-description /** - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * This array includes unreachable segments. - * @param {boolean} reachable - A flag which shows this is reachable. + * @param {boolean} reachable A flag which shows this is reachable. */ constructor(id, allPrevSegments, reachable) { @@ -98,8 +98,7 @@ class CodePathSegment { /** * Checks a given previous segment is coming from the end of a loop. - * - * @param {CodePathSegment} segment - A previous segment to check. + * @param {CodePathSegment} segment A previous segment to check. * @returns {boolean} `true` if the segment is coming from the end of a loop. */ isLoopedPrevSegment(segment) { @@ -108,8 +107,7 @@ class CodePathSegment { /** * Creates the root segment. - * - * @param {string} id - An identifier. + * @param {string} id An identifier. * @returns {CodePathSegment} The created segment. */ static newRoot(id) { @@ -118,9 +116,8 @@ class CodePathSegment { /** * Creates a segment that follows given segments. - * - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * @returns {CodePathSegment} The created segment. */ static newNext(id, allPrevSegments) { @@ -133,9 +130,8 @@ class CodePathSegment { /** * Creates an unreachable segment that follows given segments. - * - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * @returns {CodePathSegment} The created segment. */ static newUnreachable(id, allPrevSegments) { @@ -154,9 +150,8 @@ class CodePathSegment { * Creates a segment that follows given segments. * This factory method does not connect with `allPrevSegments`. * But this inherits `reachable` flag. - * - * @param {string} id - An identifier. - * @param {CodePathSegment[]} allPrevSegments - An array of the previous segments. + * @param {string} id An identifier. + * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. * @returns {CodePathSegment} The created segment. */ static newDisconnected(id, allPrevSegments) { @@ -167,8 +162,7 @@ class CodePathSegment { * Makes a given segment being used. * * And this function registers the segment into the previous segments as a next. - * - * @param {CodePathSegment} segment - A segment to mark. + * @param {CodePathSegment} segment A segment to mark. * @returns {void} */ static markUsed(segment) { @@ -195,9 +189,8 @@ class CodePathSegment { /** * Marks a previous segment as looped. - * - * @param {CodePathSegment} segment - A segment. - * @param {CodePathSegment} prevSegment - A previous segment to mark. + * @param {CodePathSegment} segment A segment. + * @param {CodePathSegment} prevSegment A previous segment to mark. * @returns {void} */ static markPrevSegmentAsLooped(segment, prevSegment) { @@ -206,8 +199,7 @@ class CodePathSegment { /** * Replaces unused segments with the previous segments of each unused segment. - * - * @param {CodePathSegment[]} segments - An array of segments to replace. + * @param {CodePathSegment[]} segments An array of segments to replace. * @returns {CodePathSegment[]} The replaced array. */ static flattenUnusedSegments(segments) { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js index 57da10fa915a36..75de1bc6ce4c4a 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js @@ -22,11 +22,10 @@ const CodePathSegment = require("./code-path-segment"), * array as well. * * This adds only reachable and used segments. - * - * @param {CodePathSegment[]} dest - A destination array (`returnedSegments` or `thrownSegments`). - * @param {CodePathSegment[]} others - Another destination array (`returnedSegments` or `thrownSegments`). - * @param {CodePathSegment[]} all - The unified destination array (`finalSegments`). - * @param {CodePathSegment[]} segments - Segments to add. + * @param {CodePathSegment[]} dest A destination array (`returnedSegments` or `thrownSegments`). + * @param {CodePathSegment[]} others Another destination array (`returnedSegments` or `thrownSegments`). + * @param {CodePathSegment[]} all The unified destination array (`finalSegments`). + * @param {CodePathSegment[]} segments Segments to add. * @returns {void} */ function addToReturnedOrThrown(dest, others, all, segments) { @@ -42,9 +41,8 @@ function addToReturnedOrThrown(dest, others, all, segments) { /** * Gets a loop-context for a `continue` statement. - * - * @param {CodePathState} state - A state to get. - * @param {string} label - The label of a `continue` statement. + * @param {CodePathState} state A state to get. + * @param {string} label The label of a `continue` statement. * @returns {LoopContext} A loop-context for a `continue` statement. */ function getContinueContext(state, label) { @@ -67,9 +65,8 @@ function getContinueContext(state, label) { /** * Gets a context for a `break` statement. - * - * @param {CodePathState} state - A state to get. - * @param {string} label - The label of a `break` statement. + * @param {CodePathState} state A state to get. + * @param {string} label The label of a `break` statement. * @returns {LoopContext|SwitchContext} A context for a `break` statement. */ function getBreakContext(state, label) { @@ -88,8 +85,7 @@ function getBreakContext(state, label) { /** * Gets a context for a `return` statement. - * - * @param {CodePathState} state - A state to get. + * @param {CodePathState} state A state to get. * @returns {TryContext|CodePathState} A context for a `return` statement. */ function getReturnContext(state) { @@ -107,8 +103,7 @@ function getReturnContext(state) { /** * Gets a context for a `throw` statement. - * - * @param {CodePathState} state - A state to get. + * @param {CodePathState} state A state to get. * @returns {TryContext|CodePathState} A context for a `throw` statement. */ function getThrowContext(state) { @@ -128,9 +123,8 @@ function getThrowContext(state) { /** * Removes a given element from a given array. - * - * @param {any[]} xs - An array to remove the specific element. - * @param {any} x - An element to be removed. + * @param {any[]} xs An array to remove the specific element. + * @param {any} x An element to be removed. * @returns {void} */ function remove(xs, x) { @@ -143,9 +137,8 @@ function remove(xs, x) { * This is used in a process for switch statements. * If there is the "default" chunk before other cases, the order is different * between node's and running's. - * - * @param {CodePathSegment[]} prevSegments - Forward segments to disconnect. - * @param {CodePathSegment[]} nextSegments - Backward segments to disconnect. + * @param {CodePathSegment[]} prevSegments Forward segments to disconnect. + * @param {CodePathSegment[]} nextSegments Backward segments to disconnect. * @returns {void} */ function removeConnection(prevSegments, nextSegments) { @@ -162,10 +155,9 @@ function removeConnection(prevSegments, nextSegments) { /** * Creates looping path. - * - * @param {CodePathState} state - The instance. - * @param {CodePathSegment[]} unflattenedFromSegments - Segments which are source. - * @param {CodePathSegment[]} unflattenedToSegments - Segments which are destination. + * @param {CodePathState} state The instance. + * @param {CodePathSegment[]} unflattenedFromSegments Segments which are source. + * @param {CodePathSegment[]} unflattenedToSegments Segments which are destination. * @returns {void} */ function makeLooped(state, unflattenedFromSegments, unflattenedToSegments) { @@ -200,10 +192,9 @@ function makeLooped(state, unflattenedFromSegments, unflattenedToSegments) { * * - Adds `false` paths to paths which are leaving from the loop. * - Sets `true` paths to paths which go to the body. - * - * @param {LoopContext} context - A loop context to modify. - * @param {ChoiceContext} choiceContext - A choice context of this loop. - * @param {CodePathSegment[]} head - The current head paths. + * @param {LoopContext} context A loop context to modify. + * @param {ChoiceContext} choiceContext A choice context of this loop. + * @param {CodePathSegment[]} head The current head paths. * @returns {void} */ function finalizeTestSegmentsOfFor(context, choiceContext, head) { @@ -227,10 +218,11 @@ function finalizeTestSegmentsOfFor(context, choiceContext, head) { */ class CodePathState { + // eslint-disable-next-line jsdoc/require-description /** - * @param {IdGenerator} idGenerator - An id generator to generate id for code + * @param {IdGenerator} idGenerator An id generator to generate id for code * path segments. - * @param {Function} onLooped - A callback function to notify looping. + * @param {Function} onLooped A callback function to notify looping. */ constructor(idGenerator, onLooped) { this.idGenerator = idGenerator; @@ -275,8 +267,7 @@ class CodePathState { /** * Creates and stacks new forking context. - * - * @param {boolean} forkLeavingPath - A flag which shows being in a + * @param {boolean} forkLeavingPath A flag which shows being in a * "finally" block. * @returns {ForkContext} The created context. */ @@ -313,7 +304,6 @@ class CodePathState { /** * Creates a bypass path. * This is used for such as IfStatement which does not have "else" chunk. - * * @returns {void} */ forkBypassPath() { @@ -346,12 +336,11 @@ class CodePathState { * a -> foo(); * a -> b -> foo(); * a -> b -> bar(); - * - * @param {string} kind - A kind string. + * @param {string} kind A kind string. * If the new context is LogicalExpression's, this is `"&&"` or `"||"`. * If it's IfStatement's or ConditionalExpression's, this is `"test"`. * Otherwise, this is `"loop"`. - * @param {boolean} isForkingAsResult - A flag that shows that goes different + * @param {boolean} isForkingAsResult A flag that shows that goes different * paths between `true` and `false`. * @returns {void} */ @@ -368,7 +357,6 @@ class CodePathState { /** * Pops the last choice context and finalizes it. - * * @returns {ChoiceContext} The popped context. */ popChoiceContext() { @@ -456,7 +444,6 @@ class CodePathState { /** * Makes a code path segment of the right-hand operand of a logical * expression. - * * @returns {void} */ makeLogicalRight() { @@ -500,7 +487,6 @@ class CodePathState { /** * Makes a code path segment of the `if` block. - * * @returns {void} */ makeIfConsequent() { @@ -527,7 +513,6 @@ class CodePathState { /** * Makes a code path segment of the `else` block. - * * @returns {void} */ makeIfAlternate() { @@ -554,10 +539,9 @@ class CodePathState { /** * Creates a context object of SwitchStatement and stacks it. - * - * @param {boolean} hasCase - `true` if the switch statement has one or more + * @param {boolean} hasCase `true` if the switch statement has one or more * case parts. - * @param {string|null} label - The label text. + * @param {string|null} label The label text. * @returns {void} */ pushSwitchContext(hasCase, label) { @@ -581,7 +565,6 @@ class CodePathState { * - Creates the next code path segment from `context.brokenForkContext`. * - If the last `SwitchCase` node is not a `default` part, creates a path * to the `default` body. - * * @returns {void} */ popSwitchContext() { @@ -655,9 +638,8 @@ class CodePathState { /** * Makes a code path segment for a `SwitchCase` node. - * - * @param {boolean} isEmpty - `true` if the body is empty. - * @param {boolean} isDefault - `true` if the body is the default case. + * @param {boolean} isEmpty `true` if the body is empty. + * @param {boolean} isDefault `true` if the body is the default case. * @returns {void} */ makeSwitchCaseBody(isEmpty, isDefault) { @@ -706,8 +688,7 @@ class CodePathState { /** * Creates a context object of TryStatement and stacks it. - * - * @param {boolean} hasFinalizer - `true` if the try statement has a + * @param {boolean} hasFinalizer `true` if the try statement has a * `finally` block. * @returns {void} */ @@ -729,7 +710,6 @@ class CodePathState { /** * Pops the last context of TryStatement and finalizes it. - * * @returns {void} */ popTryContext() { @@ -785,7 +765,6 @@ class CodePathState { /** * Makes a code path segment for a `catch` block. - * * @returns {void} */ makeCatchBlock() { @@ -814,7 +793,6 @@ class CodePathState { * In the `finally` block, parallel paths are created. The parallel paths * are used as leaving-paths. The leaving-paths are paths from `return` * statements and `throw` statements in a `try` block or a `catch` block. - * * @returns {void} */ makeFinallyBlock() { @@ -874,7 +852,6 @@ class CodePathState { /** * Makes a code path segment from the first throwable node to the `catch` * block or the `finally` block. - * * @returns {void} */ makeFirstThrowablePathInTryBlock() { @@ -903,11 +880,10 @@ class CodePathState { /** * Creates a context object of a loop statement and stacks it. - * - * @param {string} type - The type of the node which was triggered. One of + * @param {string} type The type of the node which was triggered. One of * `WhileStatement`, `DoWhileStatement`, `ForStatement`, `ForInStatement`, * and `ForStatement`. - * @param {string|null} label - A label of the node which was triggered. + * @param {string|null} label A label of the node which was triggered. * @returns {void} */ pushLoopContext(type, label) { @@ -979,7 +955,6 @@ class CodePathState { /** * Pops the last context of a loop statement and finalizes it. - * * @returns {void} */ popLoopContext() { @@ -1051,8 +1026,7 @@ class CodePathState { /** * Makes a code path segment for the test part of a WhileStatement. - * - * @param {boolean|undefined} test - The test value (only when constant). + * @param {boolean|undefined} test The test value (only when constant). * @returns {void} */ makeWhileTest(test) { @@ -1068,7 +1042,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a WhileStatement. - * * @returns {void} */ makeWhileBody() { @@ -1090,7 +1063,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a DoWhileStatement. - * * @returns {void} */ makeDoWhileBody() { @@ -1105,8 +1077,7 @@ class CodePathState { /** * Makes a code path segment for the test part of a DoWhileStatement. - * - * @param {boolean|undefined} test - The test value (only when constant). + * @param {boolean|undefined} test The test value (only when constant). * @returns {void} */ makeDoWhileTest(test) { @@ -1126,8 +1097,7 @@ class CodePathState { /** * Makes a code path segment for the test part of a ForStatement. - * - * @param {boolean|undefined} test - The test value (only when constant). + * @param {boolean|undefined} test The test value (only when constant). * @returns {void} */ makeForTest(test) { @@ -1145,7 +1115,6 @@ class CodePathState { /** * Makes a code path segment for the update part of a ForStatement. - * * @returns {void} */ makeForUpdate() { @@ -1173,7 +1142,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a ForStatement. - * * @returns {void} */ makeForBody() { @@ -1227,7 +1195,6 @@ class CodePathState { /** * Makes a code path segment for the left part of a ForInStatement and a * ForOfStatement. - * * @returns {void} */ makeForInOfLeft() { @@ -1244,7 +1211,6 @@ class CodePathState { /** * Makes a code path segment for the right part of a ForInStatement and a * ForOfStatement. - * * @returns {void} */ makeForInOfRight() { @@ -1263,7 +1229,6 @@ class CodePathState { /** * Makes a code path segment for the body part of a ForInStatement and a * ForOfStatement. - * * @returns {void} */ makeForInOfBody() { @@ -1288,10 +1253,9 @@ class CodePathState { /** * Creates new context for BreakStatement. - * - * @param {boolean} breakable - The flag to indicate it can break by + * @param {boolean} breakable The flag to indicate it can break by * an unlabeled BreakStatement. - * @param {string|null} label - The label of this context. + * @param {string|null} label The label of this context. * @returns {Object} The new context. */ pushBreakContext(breakable, label) { @@ -1306,7 +1270,6 @@ class CodePathState { /** * Removes the top item of the break context stack. - * * @returns {Object} The removed context. */ popBreakContext() { @@ -1333,8 +1296,7 @@ class CodePathState { * * It registers the head segment to a context of `break`. * It makes new unreachable segment, then it set the head with the segment. - * - * @param {string} label - A label of the break statement. + * @param {string} label A label of the break statement. * @returns {void} */ makeBreak(label) { @@ -1359,8 +1321,7 @@ class CodePathState { * * It makes a looping path. * It makes new unreachable segment, then it set the head with the segment. - * - * @param {string} label - A label of the continue statement. + * @param {string} label A label of the continue statement. * @returns {void} */ makeContinue(label) { @@ -1395,7 +1356,6 @@ class CodePathState { * * It registers the head segment to a context of `return`. * It makes new unreachable segment, then it set the head with the segment. - * * @returns {void} */ makeReturn() { @@ -1412,7 +1372,6 @@ class CodePathState { * * It registers the head segment to a context of `throw`. * It makes new unreachable segment, then it set the head with the segment. - * * @returns {void} */ makeThrow() { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js index cb26ea18a3ee67..49b37c6b2272db 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/code-path.js @@ -21,10 +21,11 @@ const IdGenerator = require("./id-generator"); */ class CodePath { + // eslint-disable-next-line jsdoc/require-description /** - * @param {string} id - An identifier. - * @param {CodePath|null} upper - The code path of the upper function scope. - * @param {Function} onLooped - A callback function to notify looping. + * @param {string} id An identifier. + * @param {CodePath|null} upper The code path of the upper function scope. + * @param {Function} onLooped A callback function to notify looping. */ constructor(id, upper, onLooped) { @@ -62,8 +63,7 @@ class CodePath { /** * Gets the state of a given code path. - * - * @param {CodePath} codePath - A code path to get. + * @param {CodePath} codePath A code path to get. * @returns {CodePathState} The state of the code path. */ static getState(codePath) { @@ -126,11 +126,10 @@ class CodePath { * * - `controller.skip()` - Skip the following segments in this branch. * - `controller.break()` - Skip all following segments. - * - * @param {Object} [options] - Omittable. - * @param {CodePathSegment} [options.first] - The first segment to traverse. - * @param {CodePathSegment} [options.last] - The last segment to traverse. - * @param {Function} callback - A callback function. + * @param {Object} [options] Omittable. + * @param {CodePathSegment} [options.first] The first segment to traverse. + * @param {CodePathSegment} [options.last] The last segment to traverse. + * @param {Function} callback A callback function. * @returns {void} */ traverseSegments(options, callback) { @@ -171,7 +170,7 @@ class CodePath { /** * Checks a given previous segment has been visited. - * @param {CodePathSegment} prevSegment - A previous segment to check. + * @param {CodePathSegment} prevSegment A previous segment to check. * @returns {boolean} `true` if the segment has been visited. */ function isVisited(prevSegment) { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js index 2ca6dbc1e5293c..35a4cb2dacb1ca 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js @@ -17,7 +17,7 @@ const debug = require("debug")("eslint:code-path"); /** * Gets id of a given segment. - * @param {CodePathSegment} segment - A segment to get. + * @param {CodePathSegment} segment A segment to get. * @returns {string} Id of the segment. */ /* istanbul ignore next */ @@ -39,18 +39,16 @@ module.exports = { /** * Dumps given objects. - * - * @param {...any} args - objects to dump. + * @param {...any} args objects to dump. * @returns {void} */ dump: debug, /** * Dumps the current analyzing state. - * - * @param {ASTNode} node - A node to dump. - * @param {CodePathState} state - A state to dump. - * @param {boolean} leaving - A flag whether or not it's leaving + * @param {ASTNode} node A node to dump. + * @param {CodePathState} state A state to dump. + * @param {boolean} leaving A flag whether or not it's leaving * @returns {void} */ dumpState: !debug.enabled ? debug : /* istanbul ignore next */ function(node, state, leaving) { @@ -73,8 +71,7 @@ module.exports = { /** * Dumps a DOT code of a given code path. * The DOT code can be visialized with Graphvis. - * - * @param {CodePath} codePath - A code path to dump. + * @param {CodePath} codePath A code path to dump. * @returns {void} * @see http://www.graphviz.org * @see http://www.webgraphviz.com @@ -139,9 +136,8 @@ module.exports = { /** * Makes a DOT code of a given code path. * The DOT code can be visialized with Graphvis. - * - * @param {CodePath} codePath - A code path to make DOT. - * @param {Object} traceMap - Optional. A map to check whether or not segments had been done. + * @param {CodePath} codePath A code path to make DOT. + * @param {Object} traceMap Optional. A map to check whether or not segments had been done. * @returns {string} A DOT code of the code path. */ makeDotArrows(codePath, traceMap) { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js index 939ed2d0d9af11..eb1d2de5a7db5b 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js @@ -22,8 +22,7 @@ const assert = require("assert"), /** * Gets whether or not a given segment is reachable. - * - * @param {CodePathSegment} segment - A segment to get. + * @param {CodePathSegment} segment A segment to get. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -36,11 +35,10 @@ function isReachable(segment) { * When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and * `end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`. * This `h` is from `b`, `d`, and `f`. - * - * @param {ForkContext} context - An instance. - * @param {number} begin - The first index of the previous segments. - * @param {number} end - The last index of the previous segments. - * @param {Function} create - A factory function of new segments. + * @param {ForkContext} context An instance. + * @param {number} begin The first index of the previous segments. + * @param {number} end The last index of the previous segments. + * @param {Function} create A factory function of new segments. * @returns {CodePathSegment[]} New segments. */ function makeSegments(context, begin, end, create) { @@ -69,9 +67,8 @@ function makeSegments(context, begin, end, create) { * control statement (such as `break`, `continue`) from the `finally` block, the * destination's segments may be half of the source segments. In that case, this * merges segments. - * - * @param {ForkContext} context - An instance. - * @param {CodePathSegment[]} segments - Segments to merge. + * @param {ForkContext} context An instance. + * @param {CodePathSegment[]} segments Segments to merge. * @returns {CodePathSegment[]} The merged segments. */ function mergeExtraSegments(context, segments) { @@ -100,10 +97,11 @@ function mergeExtraSegments(context, segments) { */ class ForkContext { + // eslint-disable-next-line jsdoc/require-description /** - * @param {IdGenerator} idGenerator - An identifier generator for segments. - * @param {ForkContext|null} upper - An upper fork context. - * @param {number} count - A number of parallel segments. + * @param {IdGenerator} idGenerator An identifier generator for segments. + * @param {ForkContext|null} upper An upper fork context. + * @param {number} count A number of parallel segments. */ constructor(idGenerator, upper, count) { this.idGenerator = idGenerator; @@ -142,9 +140,8 @@ class ForkContext { /** * Creates new segments from this context. - * - * @param {number} begin - The first index of previous segments. - * @param {number} end - The last index of previous segments. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. * @returns {CodePathSegment[]} New segments. */ makeNext(begin, end) { @@ -154,9 +151,8 @@ class ForkContext { /** * Creates new segments from this context. * The new segments is always unreachable. - * - * @param {number} begin - The first index of previous segments. - * @param {number} end - The last index of previous segments. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. * @returns {CodePathSegment[]} New segments. */ makeUnreachable(begin, end) { @@ -167,9 +163,8 @@ class ForkContext { * Creates new segments from this context. * The new segments don't have connections for previous segments. * But these inherit the reachable flag from this context. - * - * @param {number} begin - The first index of previous segments. - * @param {number} end - The last index of previous segments. + * @param {number} begin The first index of previous segments. + * @param {number} end The last index of previous segments. * @returns {CodePathSegment[]} New segments. */ makeDisconnected(begin, end) { @@ -179,8 +174,7 @@ class ForkContext { /** * Adds segments into this context. * The added segments become the head. - * - * @param {CodePathSegment[]} segments - Segments to add. + * @param {CodePathSegment[]} segments Segments to add. * @returns {void} */ add(segments) { @@ -192,8 +186,7 @@ class ForkContext { /** * Replaces the head segments with given segments. * The current head segments are removed. - * - * @param {CodePathSegment[]} segments - Segments to add. + * @param {CodePathSegment[]} segments Segments to add. * @returns {void} */ replaceHead(segments) { @@ -204,8 +197,7 @@ class ForkContext { /** * Adds all segments of a given fork context into this context. - * - * @param {ForkContext} context - A fork context to add. + * @param {ForkContext} context A fork context to add. * @returns {void} */ addAll(context) { @@ -220,7 +212,6 @@ class ForkContext { /** * Clears all secments in this context. - * * @returns {void} */ clear() { @@ -229,8 +220,7 @@ class ForkContext { /** * Creates the root fork context. - * - * @param {IdGenerator} idGenerator - An identifier generator for segments. + * @param {IdGenerator} idGenerator An identifier generator for segments. * @returns {ForkContext} New fork context. */ static newRoot(idGenerator) { @@ -243,9 +233,8 @@ class ForkContext { /** * Creates an empty fork context preceded by a given context. - * - * @param {ForkContext} parentContext - The parent fork context. - * @param {boolean} forkLeavingPath - A flag which shows inside of `finally` block. + * @param {ForkContext} parentContext The parent fork context. + * @param {boolean} forkLeavingPath A flag which shows inside of `finally` block. * @returns {ForkContext} New fork context. */ static newEmpty(parentContext, forkLeavingPath) { diff --git a/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js b/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js index 062058ddc12639..4cb2e0e3d87cc1 100644 --- a/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +++ b/tools/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js @@ -18,8 +18,9 @@ */ class IdGenerator { + // eslint-disable-next-line jsdoc/require-description /** - * @param {string} prefix - Optional. A prefix of generated ids. + * @param {string} prefix Optional. A prefix of generated ids. */ constructor(prefix) { this.prefix = String(prefix); @@ -28,7 +29,6 @@ class IdGenerator { /** * Generates id. - * * @returns {string} A generated id. */ next() { diff --git a/tools/node_modules/eslint/lib/linter/linter.js b/tools/node_modules/eslint/lib/linter/linter.js index 534181da9e4752..6d88cb5aa1245f 100644 --- a/tools/node_modules/eslint/lib/linter/linter.js +++ b/tools/node_modules/eslint/lib/linter/linter.js @@ -292,10 +292,15 @@ function getDirectiveComments(filename, ast, ruleMapper, warnInlineConfig) { if (!match) { return; } - const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(match[1]); + const directiveText = match[1]; + const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(directiveText); - if (warnInlineConfig && (lineCommentSupported || comment.type === "Block")) { - const kind = comment.type === "Block" ? `/*${match[1]}*/` : `//${match[1]}`; + if (comment.type === "Line" && !lineCommentSupported) { + return; + } + + if (warnInlineConfig) { + const kind = comment.type === "Block" ? `/*${directiveText}*/` : `//${directiveText}`; problems.push(createLintingProblem({ ruleId: null, @@ -306,108 +311,101 @@ function getDirectiveComments(filename, ast, ruleMapper, warnInlineConfig) { return; } - const directiveValue = trimmedCommentText.slice(match.index + match[1].length); - let directiveType = ""; + if (lineCommentSupported && comment.loc.start.line !== comment.loc.end.line) { + const message = `${directiveText} comment should not span multiple lines.`; - if (lineCommentSupported) { - if (comment.loc.start.line === comment.loc.end.line) { - directiveType = match[1].slice("eslint-".length); - } else { - const message = `${match[1]} comment should not span multiple lines.`; + problems.push(createLintingProblem({ + ruleId: null, + message, + loc: comment.loc + })); + return; + } - problems.push(createLintingProblem({ - ruleId: null, - message, - loc: comment.loc - })); + const directiveValue = trimmedCommentText.slice(match.index + directiveText.length); + + switch (directiveText) { + case "eslint-disable": + case "eslint-enable": + case "eslint-disable-next-line": + case "eslint-disable-line": { + const directiveType = directiveText.slice("eslint-".length); + const options = { type: directiveType, loc: comment.loc, value: directiveValue, ruleMapper }; + const { directives, directiveProblems } = createDisableDirectives(options); + + disableDirectives.push(...directives); + problems.push(...directiveProblems); + break; } - } else if (comment.type === "Block") { - switch (match[1]) { - case "exported": - Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment)); - break; - case "globals": - case "global": - for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) { - let normalizedValue; + case "exported": + Object.assign(exportedVariables, commentParser.parseStringConfig(directiveValue, comment)); + break; + + case "globals": + case "global": + for (const [id, { value }] of Object.entries(commentParser.parseStringConfig(directiveValue, comment))) { + let normalizedValue; + + try { + normalizedValue = ConfigOps.normalizeConfigGlobal(value); + } catch (err) { + problems.push(createLintingProblem({ + ruleId: null, + loc: comment.loc, + message: err.message + })); + continue; + } + + if (enabledGlobals[id]) { + enabledGlobals[id].comments.push(comment); + enabledGlobals[id].value = normalizedValue; + } else { + enabledGlobals[id] = { + comments: [comment], + value: normalizedValue + }; + } + } + break; + + case "eslint": { + const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); + + if (parseResult.success) { + Object.keys(parseResult.config).forEach(name => { + const rule = ruleMapper(name); + const ruleValue = parseResult.config[name]; + + if (rule === null) { + problems.push(createLintingProblem({ ruleId: name, loc: comment.loc })); + return; + } try { - normalizedValue = ConfigOps.normalizeConfigGlobal(value); + validator.validateRuleOptions(rule, name, ruleValue); } catch (err) { problems.push(createLintingProblem({ - ruleId: null, - loc: comment.loc, - message: err.message + ruleId: name, + message: err.message, + loc: comment.loc })); - continue; - } - if (enabledGlobals[id]) { - enabledGlobals[id].comments.push(comment); - enabledGlobals[id].value = normalizedValue; - } else { - enabledGlobals[id] = { - comments: [comment], - value: normalizedValue - }; + // do not apply the config, if found invalid options. + return; } - } - break; - - case "eslint-disable": - directiveType = "disable"; - break; - - case "eslint-enable": - directiveType = "enable"; - break; - - case "eslint": { - const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); - - if (parseResult.success) { - Object.keys(parseResult.config).forEach(name => { - const rule = ruleMapper(name); - const ruleValue = parseResult.config[name]; - - if (rule === null) { - problems.push(createLintingProblem({ ruleId: name, loc: comment.loc })); - return; - } - - try { - validator.validateRuleOptions(rule, name, ruleValue); - } catch (err) { - problems.push(createLintingProblem({ - ruleId: name, - message: err.message, - loc: comment.loc - })); - - // do not apply the config, if found invalid options. - return; - } - - configuredRules[name] = ruleValue; - }); - } else { - problems.push(parseResult.error); - } - break; + configuredRules[name] = ruleValue; + }); + } else { + problems.push(parseResult.error); } - // no default + break; } - } - - if (directiveType !== "") { - const options = { type: directiveType, loc: comment.loc, value: directiveValue, ruleMapper }; - const { directives, directiveProblems } = createDisableDirectives(options); - disableDirectives.push(...directives); - problems.push(...directiveProblems); + // no default } }); @@ -438,7 +436,7 @@ const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//gu; /** * Checks whether or not there is a comment which has "eslint-env *" in a given text. - * @param {string} text - A source code text to check. + * @param {string} text A source code text to check. * @returns {Object|null} A result of parseListConfig() with "eslint-env *" comment. */ function findEslintEnv(text) { @@ -555,8 +553,7 @@ function resolveGlobals(providedGlobals, enabledEnvironments) { /** * Strips Unicode BOM from a given text. - * - * @param {string} text - A text to strip. + * @param {string} text A text to strip. * @returns {string} The stripped text. */ function stripUnicodeBOM(text) { @@ -669,6 +666,8 @@ function parse(text, parser, providedParserOptions, filePath) { // If the message includes a leading line number, strip it: const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`; + debug("%s\n%s", message, ex.stack); + return { success: false, error: { @@ -813,9 +812,10 @@ const BASE_TRAVERSAL_CONTEXT = Object.freeze( * @param {Object} settings The settings that were enabled in the config * @param {string} filename The reported filename of the code * @param {boolean} disableFixes If true, it doesn't make `fix` properties. + * @param {string | undefined} cwd cwd of the cli * @returns {Problem[]} An array of reported problems */ -function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parserName, settings, filename, disableFixes) { +function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parserName, settings, filename, disableFixes, cwd) { const emitter = createEmitter(); const nodeQueue = []; let currentNode = sourceCode.ast; @@ -842,6 +842,7 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser { getAncestors: () => getAncestors(currentNode), getDeclaredVariables: sourceCode.scopeManager.getDeclaredVariables.bind(sourceCode.scopeManager), + getCwd: () => cwd, getFilename: () => filename, getScope: () => getScope(sourceCode.scopeManager, currentNode), getSourceCode: () => sourceCode, @@ -988,6 +989,24 @@ function getRule(slots, ruleId) { ); } +/** + * Normalize the value of the cwd + * @param {string | undefined} cwd raw value of the cwd, path to a directory that should be considered as the current working directory, can be undefined. + * @returns {string | undefined} normalized cwd + */ +function normalizeCwd(cwd) { + if (cwd) { + return cwd; + } + if (typeof process === "object") { + return process.cwd(); + } + + // It's more explicit to assign the undefined + // eslint-disable-next-line no-undefined + return undefined; +} + /** * The map to store private data. * @type {WeakMap} @@ -1004,8 +1023,14 @@ const internalSlotsMap = new WeakMap(); */ class Linter { - constructor() { + /** + * Initialize the Linter. + * @param {Object} [config] the config object + * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. + */ + constructor({ cwd } = {}) { internalSlotsMap.set(this, { + cwd: normalizeCwd(cwd), lastConfigArray: null, lastSourceCode: null, parserMap: new Map([["espree", espree]]), @@ -1137,7 +1162,8 @@ class Linter { parserName, settings, options.filename, - options.disableFixes + options.disableFixes, + slots.cwd ); } catch (err) { err.message += `\nOccurred while linting ${options.filename}`; diff --git a/tools/node_modules/eslint/lib/linter/node-event-generator.js b/tools/node_modules/eslint/lib/linter/node-event-generator.js index 1267081d95b08a..fc7b879f64172b 100644 --- a/tools/node_modules/eslint/lib/linter/node-event-generator.js +++ b/tools/node_modules/eslint/lib/linter/node-event-generator.js @@ -202,6 +202,7 @@ const parseSelector = lodash.memoize(rawSelector => { */ class NodeEventGenerator { + // eslint-disable-next-line jsdoc/require-description /** * @param {SafeEmitter} emitter * An SafeEmitter which is the destination of events. This emitter must already @@ -286,7 +287,7 @@ class NodeEventGenerator { /** * Emits an event of entering AST node. - * @param {ASTNode} node - A node which was entered. + * @param {ASTNode} node A node which was entered. * @returns {void} */ enterNode(node) { @@ -298,7 +299,7 @@ class NodeEventGenerator { /** * Emits an event of leaving AST node. - * @param {ASTNode} node - A node which was left. + * @param {ASTNode} node A node which was left. * @returns {void} */ leaveNode(node) { diff --git a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js index 9f8324a358fd77..e57cd09bd87014 100644 --- a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js +++ b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js @@ -78,8 +78,7 @@ const hasOwnProperty = Function.call.bind(Object.hasOwnProperty); /** * Clones a given value deeply. * Note: This ignores `parent` property. - * - * @param {any} x - A value to clone. + * @param {any} x A value to clone. * @returns {any} A cloned value. */ function cloneDeeplyExcludesParent(x) { @@ -104,8 +103,7 @@ function cloneDeeplyExcludesParent(x) { /** * Freezes a given value deeply. - * - * @param {any} x - A value to freeze. + * @param {any} x A value to freeze. * @returns {void} */ function freezeDeeply(x) { @@ -146,8 +144,8 @@ const IT = Symbol("it"); /** * This is `it` default handler if `it` don't exist. * @this {Mocha} - * @param {string} text - The description of the test case. - * @param {Function} method - The logic of the test case. + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. * @returns {any} Returned value of `method`. */ function itDefaultHandler(text, method) { @@ -164,8 +162,8 @@ function itDefaultHandler(text, method) { /** * This is `describe` default handler if `describe` don't exist. * @this {Mocha} - * @param {string} text - The description of the test case. - * @param {Function} method - The logic of the test case. + * @param {string} text The description of the test case. + * @param {Function} method The logic of the test case. * @returns {any} Returned value of `method`. */ function describeDefaultHandler(text, method) { diff --git a/tools/node_modules/eslint/lib/rules/accessor-pairs.js b/tools/node_modules/eslint/lib/rules/accessor-pairs.js index a33d1f32f2e000..3a32db6eac7214 100644 --- a/tools/node_modules/eslint/lib/rules/accessor-pairs.js +++ b/tools/node_modules/eslint/lib/rules/accessor-pairs.js @@ -79,7 +79,7 @@ function areEqualKeys(left, right) { /** * Checks whether or not a given node is of an accessor kind ('get' or 'set'). - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is of an accessor kind. */ function isAccessorKind(node) { @@ -88,8 +88,8 @@ function isAccessorKind(node) { /** * Checks whether or not a given node is an `Identifier` node which was named a given name. - * @param {ASTNode} node - A node to check. - * @param {string} name - An expected name of the node. + * @param {ASTNode} node A node to check. + * @param {string} name An expected name of the node. * @returns {boolean} `true` if the node is an `Identifier` node which was named as expected. */ function isIdentifier(node, name) { @@ -98,10 +98,10 @@ function isIdentifier(node, name) { /** * Checks whether or not a given node is an argument of a specified method call. - * @param {ASTNode} node - A node to check. - * @param {number} index - An expected index of the node in arguments. - * @param {string} object - An expected name of the object of the method. - * @param {string} property - An expected name of the method. + * @param {ASTNode} node A node to check. + * @param {number} index An expected index of the node in arguments. + * @param {string} object An expected name of the object of the method. + * @param {string} property An expected name of the method. * @returns {boolean} `true` if the node is an argument of the specified method call. */ function isArgumentOfMethodCall(node, index, object, property) { @@ -119,7 +119,7 @@ function isArgumentOfMethodCall(node, index, object, property) { /** * Checks whether or not a given node is a property descriptor. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a property descriptor. */ function isPropertyDescriptor(node) { 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 f6be2e8dd02c82..b4b4dd430f6564 100644 --- a/tools/node_modules/eslint/lib/rules/array-bracket-newline.js +++ b/tools/node_modules/eslint/lib/rules/array-bracket-newline.js @@ -65,8 +65,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} option - An option value to parse. + * @param {string|Object|undefined} option An option value to parse. * @returns {{multiline: boolean, minItems: number}} Normalized option object. */ function normalizeOptionValue(option) { @@ -97,8 +96,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} options - An option value to parse. + * @param {string|Object|undefined} options An option value to parse. * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. */ function normalizeOptions(options) { @@ -109,8 +107,8 @@ module.exports = { /** * Reports that there shouldn't be a linebreak after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoBeginningLinebreak(node, token) { @@ -132,8 +130,8 @@ module.exports = { /** * Reports that there shouldn't be a linebreak before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoEndingLinebreak(node, token) { @@ -155,8 +153,8 @@ module.exports = { /** * Reports that there should be a linebreak after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningLinebreak(node, token) { @@ -172,8 +170,8 @@ module.exports = { /** * Reports that there should be a linebreak before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingLinebreak(node, token) { @@ -189,8 +187,7 @@ module.exports = { /** * Reports a given node if it violated this rule. - * - * @param {ASTNode} node - A node to check. This is an ArrayExpression node or an ArrayPattern node. + * @param {ASTNode} node A node to check. This is an ArrayExpression node or an ArrayPattern node. * @returns {void} */ function check(node) { @@ -219,7 +216,7 @@ module.exports = { ) || ( options.consistent && - firstIncComment.loc.start.line !== openBracket.loc.end.line + openBracket.loc.end.line !== first.loc.start.line ) ); diff --git a/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js b/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js index 0a51d350cd79ea..2510159ee48fa7 100644 --- a/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js +++ b/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js @@ -59,7 +59,7 @@ module.exports = { * Determines whether an option is set, relative to the spacing option. * If spaced is "always", then check whether option is set to false. * If spaced is "never", then check whether option is set to true. - * @param {Object} option - The option to exclude. + * @param {Object} option The option to exclude. * @returns {boolean} Whether or not the property is excluded. */ function isOptionSet(option) { @@ -79,8 +79,8 @@ module.exports = { /** * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoBeginningSpace(node, token) { @@ -101,8 +101,8 @@ module.exports = { /** * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoEndingSpace(node, token) { @@ -123,8 +123,8 @@ module.exports = { /** * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningSpace(node, token) { @@ -143,8 +143,8 @@ module.exports = { /** * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingSpace(node, token) { @@ -163,7 +163,7 @@ module.exports = { /** * Determines if a node is an object type - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node is an object type. */ function isObjectType(node) { @@ -172,7 +172,7 @@ module.exports = { /** * Determines if a node is an array type - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node is an array type. */ function isArrayType(node) { @@ -181,7 +181,7 @@ module.exports = { /** * Validates the spacing around array brackets - * @param {ASTNode} node - The node we're checking for spacing + * @param {ASTNode} node The node we're checking for spacing * @returns {void} */ function validateArraySpacing(node) { 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 bd1f3a37aad29d..d632a3f30c28a3 100644 --- a/tools/node_modules/eslint/lib/rules/array-callback-return.js +++ b/tools/node_modules/eslint/lib/rules/array-callback-return.js @@ -22,8 +22,7 @@ const TARGET_METHODS = /^(?:every|filter|find(?:Index)?|map|reduce(?:Right)?|som /** * Checks a given code path segment is reachable. - * - * @param {CodePathSegment} segment - A segment to check. + * @param {CodePathSegment} segment A segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -35,9 +34,8 @@ function isReachable(segment) { * * - FunctionExpression -> the function name or `function` keyword. * - ArrowFunctionExpression -> `=>` token. - * - * @param {ASTNode} node - A function node to get. - * @param {SourceCode} sourceCode - A source code to get tokens. + * @param {ASTNode} node A function node to get. + * @param {SourceCode} sourceCode A source code to get tokens. * @returns {ASTNode|Token} The node or the token of a location. */ function getLocation(node, sourceCode) { @@ -50,8 +48,7 @@ function getLocation(node, sourceCode) { /** * Checks a given node is a MemberExpression node which has the specified name's * property. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a MemberExpression node which has * the specified name's property */ @@ -65,8 +62,7 @@ function isTargetMethod(node) { /** * Checks whether or not a given node is a function expression which is the * callback of an array method. - * - * @param {ASTNode} node - A node to check. This is one of + * @param {ASTNode} node A node to check. This is one of * FunctionExpression or ArrowFunctionExpression. * @returns {boolean} `true` if the node is the callback of an array method. */ @@ -188,8 +184,7 @@ module.exports = { * * If the last code path segment is reachable, there are paths which are not * returned or thrown. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function checkLastSegment(node) { 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 c3d026ad6965b6..1da67667bee849 100644 --- a/tools/node_modules/eslint/lib/rules/array-element-newline.js +++ b/tools/node_modules/eslint/lib/rules/array-element-newline.js @@ -62,8 +62,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} providedOption - An option value to parse. + * @param {string|Object|undefined} providedOption An option value to parse. * @returns {{multiline: boolean, minItems: number}} Normalized option object. */ function normalizeOptionValue(providedOption) { @@ -90,8 +89,7 @@ module.exports = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} options - An option value to parse. + * @param {string|Object|undefined} options An option value to parse. * @returns {{ArrayExpression: {multiline: boolean, minItems: number}, ArrayPattern: {multiline: boolean, minItems: number}}} Normalized option object. */ function normalizeOptions(options) { @@ -102,7 +100,7 @@ module.exports = { /** * Reports that there shouldn't be a line break after the first token - * @param {Token} token - The token to use for the report. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoLineBreak(token) { @@ -151,7 +149,7 @@ module.exports = { /** * Reports that there should be a line break after the first token - * @param {Token} token - The token to use for the report. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredLineBreak(token) { @@ -171,8 +169,7 @@ module.exports = { /** * Reports a given node if it violated this rule. - * - * @param {ASTNode} node - A node to check. This is an ObjectExpression node or an ObjectPattern node. + * @param {ASTNode} node A node to check. This is an ObjectExpression node or an ObjectPattern node. * @returns {void} */ function check(node) { diff --git a/tools/node_modules/eslint/lib/rules/arrow-parens.js b/tools/node_modules/eslint/lib/rules/arrow-parens.js index b4b26e35342dc6..dc3c3825791a68 100644 --- a/tools/node_modules/eslint/lib/rules/arrow-parens.js +++ b/tools/node_modules/eslint/lib/rules/arrow-parens.js @@ -16,7 +16,6 @@ const astUtils = require("./utils/ast-utils"); /** * Get location should be reported by AST node. - * * @param {ASTNode} node AST Node. * @returns {Location} Location information. */ diff --git a/tools/node_modules/eslint/lib/rules/block-scoped-var.js b/tools/node_modules/eslint/lib/rules/block-scoped-var.js index 053cfc334cd11a..481057ba6c7c6b 100644 --- a/tools/node_modules/eslint/lib/rules/block-scoped-var.js +++ b/tools/node_modules/eslint/lib/rules/block-scoped-var.js @@ -31,7 +31,7 @@ module.exports = { /** * Makes a block scope. - * @param {ASTNode} node - A node of a scope. + * @param {ASTNode} node A node of a scope. * @returns {void} */ function enterScope(node) { @@ -48,7 +48,7 @@ module.exports = { /** * Reports a given reference. - * @param {eslint-scope.Reference} reference - A reference to report. + * @param {eslint-scope.Reference} reference A reference to report. * @returns {void} */ function report(reference) { @@ -59,7 +59,7 @@ module.exports = { /** * Finds and reports references which are outside of valid scopes. - * @param {ASTNode} node - A node to get variables. + * @param {ASTNode} node A node to get variables. * @returns {void} */ function checkForVariables(node) { diff --git a/tools/node_modules/eslint/lib/rules/block-spacing.js b/tools/node_modules/eslint/lib/rules/block-spacing.js index e843148e5d151a..c6ed44a2798a6b 100644 --- a/tools/node_modules/eslint/lib/rules/block-spacing.js +++ b/tools/node_modules/eslint/lib/rules/block-spacing.js @@ -41,7 +41,7 @@ module.exports = { /** * Gets the open brace token from a given node. - * @param {ASTNode} node - A BlockStatement/SwitchStatement node to get. + * @param {ASTNode} node A BlockStatement/SwitchStatement node to get. * @returns {Token} The token of the open brace. */ function getOpenBrace(node) { @@ -58,8 +58,8 @@ module.exports = { * Checks whether or not: * - given tokens are on same line. * - there is/isn't a space between given tokens. - * @param {Token} left - A token to check. - * @param {Token} right - The token which is next to `left`. + * @param {Token} left A token to check. + * @param {Token} right The token which is next to `left`. * @returns {boolean} * When the option is `"always"`, `true` if there are one or more spaces between given tokens. * When the option is `"never"`, `true` if there are not any spaces between given tokens. @@ -74,7 +74,7 @@ module.exports = { /** * Reports invalid spacing style inside braces. - * @param {ASTNode} node - A BlockStatement/SwitchStatement node to get. + * @param {ASTNode} node A BlockStatement/SwitchStatement node to get. * @returns {void} */ function checkSpacingInsideBraces(node) { diff --git a/tools/node_modules/eslint/lib/rules/capitalized-comments.js b/tools/node_modules/eslint/lib/rules/capitalized-comments.js index dd7ef145648c66..d7524b878d2275 100644 --- a/tools/node_modules/eslint/lib/rules/capitalized-comments.js +++ b/tools/node_modules/eslint/lib/rules/capitalized-comments.js @@ -54,7 +54,6 @@ const DEFAULTS = { * set is returned. Options specified in overrides will take priority * over options specified in the main options object, which will in * turn take priority over the rule's defaults. - * * @param {Object|string} rawOptions The user-provided options. * @param {string} which Either "line" or "block". * @returns {Object} The normalized options. @@ -65,7 +64,6 @@ function getNormalizedOptions(rawOptions, which) { /** * Get normalized options for block and line comments. - * * @param {Object|string} rawOptions The user-provided options. * @returns {Object} An object with "Line" and "Block" keys and corresponding * normalized options objects. @@ -82,7 +80,6 @@ function getAllNormalizedOptions(rawOptions = {}) { * options. * * This is done in order to avoid invoking the RegExp constructor repeatedly. - * * @param {Object} normalizedOptions The normalized rule options. * @returns {void} */ @@ -162,7 +159,6 @@ module.exports = { * Also, it follows from this definition that only block comments can * be considered as possibly inline. This is because line comments * would consume any following tokens on the same line as the comment. - * * @param {ASTNode} comment The comment node to check. * @returns {boolean} True if the comment is an inline comment, false * otherwise. @@ -181,7 +177,6 @@ module.exports = { /** * Determine if a comment follows another comment. - * * @param {ASTNode} comment The comment to check. * @returns {boolean} True if the comment follows a valid comment. */ @@ -196,7 +191,6 @@ module.exports = { /** * Check a comment to determine if it is valid for this rule. - * * @param {ASTNode} comment The comment node to process. * @param {Object} options The options for checking this comment. * @returns {boolean} True if the comment is valid, false otherwise. @@ -261,7 +255,6 @@ module.exports = { /** * Process a comment to determine if it needs to be reported. - * * @param {ASTNode} comment The comment node to process. * @returns {void} */ 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 4bf17090abcb87..2cc5cc41842c0c 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 @@ -61,7 +61,7 @@ module.exports = { /** * Check if the node is an instance method - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} True if its an instance method * @private */ @@ -71,7 +71,7 @@ module.exports = { /** * Check if the node is an instance method not excluded by config - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} True if it is an instance method, and not excluded by config * @private */ @@ -84,7 +84,7 @@ module.exports = { * Checks if we are leaving a function that is a method, and reports if 'this' has not been used. * Static methods and the constructor are exempt. * Then pops the context off the stack. - * @param {ASTNode} node - A function node that was entered. + * @param {ASTNode} node A function node that was entered. * @returns {void} * @private */ diff --git a/tools/node_modules/eslint/lib/rules/comma-dangle.js b/tools/node_modules/eslint/lib/rules/comma-dangle.js index 9cd6660d5d1e7f..fb2d167c77eef9 100644 --- a/tools/node_modules/eslint/lib/rules/comma-dangle.js +++ b/tools/node_modules/eslint/lib/rules/comma-dangle.js @@ -27,8 +27,7 @@ const DEFAULT_OPTIONS = Object.freeze({ /** * Checks whether or not a trailing comma is allowed in a given node. * If the `lastItem` is `RestElement` or `RestProperty`, it disallows trailing commas. - * - * @param {ASTNode} lastItem - The node of the last element in the given node. + * @param {ASTNode} lastItem The node of the last element in the given node. * @returns {boolean} `true` if a trailing comma is allowed. */ function isTrailingCommaAllowed(lastItem) { @@ -41,20 +40,18 @@ function isTrailingCommaAllowed(lastItem) { /** * Normalize option value. - * - * @param {string|Object|undefined} optionValue - The 1st option value to normalize. + * @param {string|Object|undefined} optionValue The 1st option value to normalize. + * @param {number} ecmaVersion The normalized ECMAScript version. * @returns {Object} The normalized option value. */ -function normalizeOptions(optionValue) { +function normalizeOptions(optionValue, ecmaVersion) { if (typeof optionValue === "string") { return { arrays: optionValue, objects: optionValue, imports: optionValue, exports: optionValue, - - // For backward compatibility, always ignore functions. - functions: "ignore" + functions: (!ecmaVersion || ecmaVersion < 8) ? "ignore" : optionValue }; } if (typeof optionValue === "object" && optionValue !== null) { @@ -137,12 +134,13 @@ module.exports = { }, create(context) { - const options = normalizeOptions(context.options[0]); + const options = normalizeOptions(context.options[0], context.parserOptions.ecmaVersion); + const sourceCode = context.getSourceCode(); /** * Gets the last item of the given node. - * @param {ASTNode} node - The node to get. + * @param {ASTNode} node The node to get. * @returns {ASTNode|null} The last node or null. */ function getLastItem(node) { @@ -172,9 +170,8 @@ module.exports = { * Gets the trailing comma token of the given node. * If the trailing comma does not exist, this returns the token which is * the insertion point of the trailing comma token. - * - * @param {ASTNode} node - The node to get. - * @param {ASTNode} lastItem - The last item of the node. + * @param {ASTNode} node The node to get. + * @param {ASTNode} lastItem The last item of the node. * @returns {Token} The trailing comma token or the insertion point. */ function getTrailingToken(node, lastItem) { @@ -199,8 +196,7 @@ module.exports = { * Checks whether or not a given node is multiline. * This rule handles a given node as multiline when the closing parenthesis * and the last element are not on the same line. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is multiline. */ function isMultiline(node) { @@ -218,8 +214,7 @@ module.exports = { /** * Reports a trailing comma if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} @@ -251,8 +246,7 @@ module.exports = { * * If a given node is `ArrayPattern` which has `RestElement`, the trailing * comma is disallowed, so report if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} @@ -286,8 +280,7 @@ module.exports = { * If a given node is multiline, reports the last element of a given node * when it does not have a trailing comma. * Otherwise, reports a trailing comma if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} @@ -304,8 +297,7 @@ module.exports = { * Only if a given node is not multiline, reports the last element of a given node * when it does not have a trailing comma. * Otherwise, reports a trailing comma if it exists. - * - * @param {ASTNode} node - A node to check. Its type is one of + * @param {ASTNode} node A node to check. Its type is one of * ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern, * ImportDeclaration, and ExportNamedDeclaration. * @returns {void} diff --git a/tools/node_modules/eslint/lib/rules/comma-spacing.js b/tools/node_modules/eslint/lib/rules/comma-spacing.js index 79a556a8857d1f..73c10a7711b904 100644 --- a/tools/node_modules/eslint/lib/rules/comma-spacing.js +++ b/tools/node_modules/eslint/lib/rules/comma-spacing.js @@ -105,7 +105,7 @@ module.exports = { /** * Validates the spacing around a comma token. - * @param {Object} tokens - The tokens to be validated. + * @param {Object} tokens The tokens to be validated. * @param {Token} tokens.comma The token representing the comma. * @param {Token} [tokens.left] The last token before the comma. * @param {Token} [tokens.right] The first token after the comma. diff --git a/tools/node_modules/eslint/lib/rules/computed-property-spacing.js b/tools/node_modules/eslint/lib/rules/computed-property-spacing.js index 33f7c9401a9769..bc8be964f4ffee 100644 --- a/tools/node_modules/eslint/lib/rules/computed-property-spacing.js +++ b/tools/node_modules/eslint/lib/rules/computed-property-spacing.js @@ -59,9 +59,9 @@ module.exports = { /** * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @param {Token} tokenAfter - The token after `token`. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @param {Token} tokenAfter The token after `token`. * @returns {void} */ function reportNoBeginningSpace(node, token, tokenAfter) { @@ -80,9 +80,9 @@ module.exports = { /** * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @param {Token} tokenBefore - The token before `token`. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. + * @param {Token} tokenBefore The token before `token`. * @returns {void} */ function reportNoEndingSpace(node, token, tokenBefore) { @@ -101,8 +101,8 @@ module.exports = { /** * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningSpace(node, token) { @@ -121,8 +121,8 @@ module.exports = { /** * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingSpace(node, token) { diff --git a/tools/node_modules/eslint/lib/rules/consistent-return.js b/tools/node_modules/eslint/lib/rules/consistent-return.js index 16f0070bc7c3be..22667fa4707724 100644 --- a/tools/node_modules/eslint/lib/rules/consistent-return.js +++ b/tools/node_modules/eslint/lib/rules/consistent-return.js @@ -18,8 +18,8 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is an `Identifier` node which was named a given name. - * @param {ASTNode} node - A node to check. - * @param {string} name - An expected name of the node. + * @param {ASTNode} node A node to check. + * @param {string} name An expected name of the node. * @returns {boolean} `true` if the node is an `Identifier` node which was named as expected. */ function isIdentifier(node, name) { @@ -28,7 +28,7 @@ function isIdentifier(node, name) { /** * Checks whether or not a given code path segment is unreachable. - * @param {CodePathSegment} segment - A CodePathSegment to check. + * @param {CodePathSegment} segment A CodePathSegment to check. * @returns {boolean} `true` if the segment is unreachable. */ function isUnreachable(segment) { @@ -88,8 +88,7 @@ module.exports = { /** * Checks whether of not the implicit returning is consistent if the last * code path segment is reachable. - * - * @param {ASTNode} node - A program/function node to check. + * @param {ASTNode} node A program/function node to check. * @returns {void} */ function checkLastSegment(node) { diff --git a/tools/node_modules/eslint/lib/rules/consistent-this.js b/tools/node_modules/eslint/lib/rules/consistent-this.js index 4bdcdfdc10e8f0..16f53b5374cd24 100644 --- a/tools/node_modules/eslint/lib/rules/consistent-this.js +++ b/tools/node_modules/eslint/lib/rules/consistent-this.js @@ -46,8 +46,8 @@ module.exports = { /** * Reports that a variable declarator or assignment expression is assigning * a non-'this' value to the specified alias. - * @param {ASTNode} node - The assigning node. - * @param {string} name - the name of the alias that was incorrectly used. + * @param {ASTNode} node The assigning node. + * @param {string} name the name of the alias that was incorrectly used. * @returns {void} */ function reportBadAssignment(node, name) { @@ -57,9 +57,9 @@ module.exports = { /** * Checks that an assignment to an identifier only assigns 'this' to the * appropriate alias, and the alias is only assigned to 'this'. - * @param {ASTNode} node - The assigning node. - * @param {Identifier} name - The name of the variable assigned to. - * @param {Expression} value - The value of the assignment. + * @param {ASTNode} node The assigning node. + * @param {Identifier} name The name of the variable assigned to. + * @param {Expression} value The value of the assignment. * @returns {void} */ function checkAssignment(node, name, value) { diff --git a/tools/node_modules/eslint/lib/rules/constructor-super.js b/tools/node_modules/eslint/lib/rules/constructor-super.js index e4cdb099b3bf52..5a848f210cae52 100644 --- a/tools/node_modules/eslint/lib/rules/constructor-super.js +++ b/tools/node_modules/eslint/lib/rules/constructor-super.js @@ -11,8 +11,7 @@ /** * Checks whether a given code path segment is reachable or not. - * - * @param {CodePathSegment} segment - A code path segment to check. + * @param {CodePathSegment} segment A code path segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -21,7 +20,7 @@ function isReachable(segment) { /** * Checks whether or not a given node is a constructor. - * @param {ASTNode} node - A node to check. This node type is one of + * @param {ASTNode} node A node to check. This node type is one of * `Program`, `FunctionDeclaration`, `FunctionExpression`, and * `ArrowFunctionExpression`. * @returns {boolean} `true` if the node is a constructor. @@ -36,8 +35,7 @@ function isConstructorFunction(node) { /** * Checks whether a given node can be a constructor or not. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node can be a constructor. */ function isPossibleConstructor(node) { @@ -137,7 +135,7 @@ module.exports = { /** * Gets the flag which shows `super()` is called in some paths. - * @param {CodePathSegment} segment - A code path segment to get. + * @param {CodePathSegment} segment A code path segment to get. * @returns {boolean} The flag which shows `super()` is called in some paths */ function isCalledInSomePath(segment) { @@ -146,7 +144,7 @@ module.exports = { /** * Gets the flag which shows `super()` is called in all paths. - * @param {CodePathSegment} segment - A code path segment to get. + * @param {CodePathSegment} segment A code path segment to get. * @returns {boolean} The flag which shows `super()` is called in all paths. */ function isCalledInEveryPath(segment) { @@ -168,8 +166,8 @@ module.exports = { /** * Stacks a constructor information. - * @param {CodePath} codePath - A code path which was started. - * @param {ASTNode} node - The current node. + * @param {CodePath} codePath A code path which was started. + * @param {ASTNode} node The current node. * @returns {void} */ onCodePathStart(codePath, node) { @@ -200,8 +198,8 @@ module.exports = { /** * Pops a constructor information. * And reports if `super()` lacked. - * @param {CodePath} codePath - A code path which was ended. - * @param {ASTNode} node - The current node. + * @param {CodePath} codePath A code path which was ended. + * @param {ASTNode} node The current node. * @returns {void} */ onCodePathEnd(codePath, node) { @@ -231,7 +229,7 @@ module.exports = { /** * Initialize information of a given code path segment. - * @param {CodePathSegment} segment - A code path segment to initialize. + * @param {CodePathSegment} segment A code path segment to initialize. * @returns {void} */ onCodePathSegmentStart(segment) { @@ -258,9 +256,9 @@ module.exports = { /** * Update information of the code path segment when a code path was * looped. - * @param {CodePathSegment} fromSegment - The code path segment of the + * @param {CodePathSegment} fromSegment The code path segment of the * end of a loop. - * @param {CodePathSegment} toSegment - A code path segment of the head + * @param {CodePathSegment} toSegment A code path segment of the head * of a loop. * @returns {void} */ @@ -303,7 +301,7 @@ module.exports = { /** * Checks for a call of `super()`. - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {void} */ "CallExpression:exit"(node) { @@ -358,7 +356,7 @@ module.exports = { /** * Set the mark to the returned path as `super()` was called. - * @param {ASTNode} node - A ReturnStatement node to check. + * @param {ASTNode} node A ReturnStatement node to check. * @returns {void} */ ReturnStatement(node) { diff --git a/tools/node_modules/eslint/lib/rules/curly.js b/tools/node_modules/eslint/lib/rules/curly.js index 8eaaddc25c6ff7..93c74d11fcf35f 100644 --- a/tools/node_modules/eslint/lib/rules/curly.js +++ b/tools/node_modules/eslint/lib/rules/curly.js @@ -119,8 +119,7 @@ module.exports = { /** * Checks if the given token is an `else` token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an `else` token. */ function isElseKeywordToken(token) { @@ -129,7 +128,7 @@ module.exports = { /** * Gets the `else` keyword token of a given `IfStatement` node. - * @param {ASTNode} node - A `IfStatement` node to get. + * @param {ASTNode} node A `IfStatement` node to get. * @returns {Token} The `else` keyword token. */ function getElseKeyword(node) { @@ -143,8 +142,7 @@ module.exports = { * 1. The given node has the `alternate` node. * 2. There is a `IfStatement` which doesn't have `alternate` node in the * trailing statement chain of the `consequent` node. - * - * @param {ASTNode} node - A IfStatement node to check. + * @param {ASTNode} node A IfStatement node to check. * @returns {boolean} `true` if the node requires braces of the consequent chunk. */ function requiresBraceOfConsequent(node) { diff --git a/tools/node_modules/eslint/lib/rules/default-param-last.js b/tools/node_modules/eslint/lib/rules/default-param-last.js index ee73aaf3215969..12e0b5950dace6 100644 --- a/tools/node_modules/eslint/lib/rules/default-param-last.js +++ b/tools/node_modules/eslint/lib/rules/default-param-last.js @@ -25,6 +25,7 @@ module.exports = { create(context) { + // eslint-disable-next-line jsdoc/require-description /** * @param {ASTNode} node function node * @returns {void} diff --git a/tools/node_modules/eslint/lib/rules/dot-location.js b/tools/node_modules/eslint/lib/rules/dot-location.js index c2e734a1a0b141..d483e217a94980 100644 --- a/tools/node_modules/eslint/lib/rules/dot-location.js +++ b/tools/node_modules/eslint/lib/rules/dot-location.js @@ -47,19 +47,18 @@ module.exports = { /** * Reports if the dot between object and property is on the correct loccation. - * @param {ASTNode} obj The object owning the property. - * @param {ASTNode} prop The property of the object. - * @param {ASTNode} node The corresponding node of the token. + * @param {ASTNode} node The `MemberExpression` node. * @returns {void} */ - function checkDotLocation(obj, prop, node) { - const dot = sourceCode.getTokenBefore(prop); + function checkDotLocation(node) { + const property = node.property; + const dot = sourceCode.getTokenBefore(property); // `obj` expression can be parenthesized, but those paren tokens are not a part of the `obj` node. const tokenBeforeDot = sourceCode.getTokenBefore(dot); const textBeforeDot = sourceCode.getText().slice(tokenBeforeDot.range[1], dot.range[0]); - const textAfterDot = sourceCode.getText().slice(dot.range[1], prop.range[0]); + const textAfterDot = sourceCode.getText().slice(dot.range[1], property.range[0]); if (onObject) { if (!astUtils.isTokenOnSameLine(tokenBeforeDot, dot)) { @@ -67,17 +66,17 @@ module.exports = { context.report({ node, - loc: dot.loc.start, + loc: dot.loc, messageId: "expectedDotAfterObject", - fix: fixer => fixer.replaceTextRange([tokenBeforeDot.range[1], prop.range[0]], `${neededTextAfterToken}.${textBeforeDot}${textAfterDot}`) + fix: fixer => fixer.replaceTextRange([tokenBeforeDot.range[1], property.range[0]], `${neededTextAfterToken}.${textBeforeDot}${textAfterDot}`) }); } - } else if (!astUtils.isTokenOnSameLine(dot, prop)) { + } else if (!astUtils.isTokenOnSameLine(dot, property)) { context.report({ node, - loc: dot.loc.start, + loc: dot.loc, messageId: "expectedDotBeforeProperty", - fix: fixer => fixer.replaceTextRange([tokenBeforeDot.range[1], prop.range[0]], `${textBeforeDot}${textAfterDot}.`) + fix: fixer => fixer.replaceTextRange([tokenBeforeDot.range[1], property.range[0]], `${textBeforeDot}${textAfterDot}.`) }); } } @@ -89,7 +88,7 @@ module.exports = { */ function checkNode(node) { if (!node.computed) { - checkDotLocation(node.object, node.property, node); + checkDotLocation(node); } } diff --git a/tools/node_modules/eslint/lib/rules/func-names.js b/tools/node_modules/eslint/lib/rules/func-names.js index ff3a1f4b5bf890..1341d03630823f 100644 --- a/tools/node_modules/eslint/lib/rules/func-names.js +++ b/tools/node_modules/eslint/lib/rules/func-names.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given variable is a function name. - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is a function name. */ function isFunctionName(variable) { @@ -73,7 +73,7 @@ module.exports = { /** * Returns the config option for the given node. - * @param {ASTNode} node - A node to get the config for. + * @param {ASTNode} node A node to get the config for. * @returns {string} The config option. */ function getConfigForNode(node) { @@ -91,7 +91,7 @@ module.exports = { /** * Determines whether the current FunctionExpression node is a get, set, or * shorthand method in an object literal or a class. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} True if the node is a get, set, or shorthand method. */ function isObjectOrClassMethod(node) { @@ -109,7 +109,7 @@ module.exports = { /** * Determines whether the current FunctionExpression node has a name that would be * inferred from context in a conforming ES6 environment. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} True if the node would have a name assigned automatically. */ function hasInferredName(node) { @@ -125,7 +125,7 @@ module.exports = { /** * Reports that an unnamed function should be named - * @param {ASTNode} node - The node to report in the event of an error. + * @param {ASTNode} node The node to report in the event of an error. * @returns {void} */ function reportUnexpectedUnnamedFunction(node) { @@ -139,7 +139,7 @@ module.exports = { /** * Reports that a named function should be unnamed - * @param {ASTNode} node - The node to report in the event of an error. + * @param {ASTNode} node The node to report in the event of an error. * @returns {void} */ function reportUnexpectedNamedFunction(node) { diff --git a/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js b/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js index 8bf31f7c713d5d..31ebc097c46f51 100644 --- a/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js +++ b/tools/node_modules/eslint/lib/rules/function-call-argument-newline.js @@ -40,13 +40,13 @@ module.exports = { const checkers = { unexpected: { messageId: "unexpectedLineBreak", - check: (prevToken, currentToken) => prevToken.loc.start.line !== currentToken.loc.start.line, + check: (prevToken, currentToken) => prevToken.loc.end.line !== currentToken.loc.start.line, createFix: (token, tokenBefore) => fixer => fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], " ") }, missing: { messageId: "missingLineBreak", - check: (prevToken, currentToken) => prevToken.loc.start.line === currentToken.loc.start.line, + check: (prevToken, currentToken) => prevToken.loc.end.line === currentToken.loc.start.line, createFix: (token, tokenBefore) => fixer => fixer.replaceTextRange([tokenBefore.range[1], token.range[0]], "\n") } @@ -61,7 +61,7 @@ module.exports = { */ function checkArguments(node, checker) { for (let i = 1; i < node.arguments.length; i++) { - const prevArgToken = sourceCode.getFirstToken(node.arguments[i - 1]); + const prevArgToken = sourceCode.getLastToken(node.arguments[i - 1]); const currentArgToken = sourceCode.getFirstToken(node.arguments[i]); if (checker.check(prevArgToken, currentArgToken)) { @@ -101,10 +101,10 @@ module.exports = { } else if (option === "always") { checkArguments(node, checkers.missing); } else if (option === "consistent") { - const firstArgToken = sourceCode.getFirstToken(node.arguments[0]); + const firstArgToken = sourceCode.getLastToken(node.arguments[0]); const secondArgToken = sourceCode.getFirstToken(node.arguments[1]); - if (firstArgToken.loc.start.line === secondArgToken.loc.start.line) { + if (firstArgToken.loc.end.line === secondArgToken.loc.start.line) { checkArguments(node, checkers.unexpected); } else { checkArguments(node, checkers.missing); diff --git a/tools/node_modules/eslint/lib/rules/generator-star-spacing.js b/tools/node_modules/eslint/lib/rules/generator-star-spacing.js index 6f860290cec8b6..65534f727fad0e 100644 --- a/tools/node_modules/eslint/lib/rules/generator-star-spacing.js +++ b/tools/node_modules/eslint/lib/rules/generator-star-spacing.js @@ -78,9 +78,8 @@ module.exports = { /** * Returns resolved option definitions based on an option and defaults - * - * @param {any} option - The option object or string value - * @param {Object} defaults - The defaults to use if options are not present + * @param {any} option The option object or string value + * @param {Object} defaults The defaults to use if options are not present * @returns {Object} the resolved object definition */ function optionToDefinition(option, defaults) { @@ -107,8 +106,7 @@ module.exports = { /** * Checks if the given token is a star token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a star token. */ function isStarToken(token) { @@ -117,8 +115,7 @@ module.exports = { /** * Gets the generator star token of the given function node. - * - * @param {ASTNode} node - The function node to get. + * @param {ASTNode} node The function node to get. * @returns {Token} Found star token. */ function getStarToken(node) { @@ -139,7 +136,6 @@ module.exports = { /** * Checks the spacing between two tokens before or after the star token. - * * @param {string} kind Either "named", "anonymous", or "method" * @param {string} side Either "before" or "after". * @param {Token} leftToken `function` keyword token if side is "before", or @@ -173,7 +169,6 @@ module.exports = { /** * Enforces the spacing around the star if node is a generator function. - * * @param {ASTNode} node A function expression or declaration node. * @returns {void} */ diff --git a/tools/node_modules/eslint/lib/rules/getter-return.js b/tools/node_modules/eslint/lib/rules/getter-return.js index 6549555646e355..e1468a5b19f88d 100644 --- a/tools/node_modules/eslint/lib/rules/getter-return.js +++ b/tools/node_modules/eslint/lib/rules/getter-return.js @@ -18,8 +18,7 @@ const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u; /** * Checks a given code path segment is reachable. - * - * @param {CodePathSegment} segment - A segment to check. + * @param {CodePathSegment} segment A segment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -30,8 +29,7 @@ function isReachable(segment) { * Gets a readable location. * * - FunctionExpression -> the function name or `function` keyword. - * - * @param {ASTNode} node - A function node to get. + * @param {ASTNode} node A function node to get. * @returns {ASTNode|Token} The node or the token of a location. */ function getId(node) { @@ -92,8 +90,7 @@ module.exports = { * * If the last code path segment is reachable, there are paths which are not * returned or thrown. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function checkLastSegment(node) { @@ -113,7 +110,7 @@ module.exports = { /** * Checks whether a node means a getter function. - * @param {ASTNode} node - a node to check. + * @param {ASTNode} node a node to check. * @returns {boolean} if node means a getter, return true; else return false. */ function isGetter(node) { diff --git a/tools/node_modules/eslint/lib/rules/indent.js b/tools/node_modules/eslint/lib/rules/indent.js index a2fa9c4f409c01..94c83692b39f0f 100644 --- a/tools/node_modules/eslint/lib/rules/indent.js +++ b/tools/node_modules/eslint/lib/rules/indent.js @@ -187,6 +187,7 @@ class BinarySearchTree { */ class TokenInfo { + // eslint-disable-next-line jsdoc/require-description /** * @param {SourceCode} sourceCode A SourceCode object */ @@ -236,6 +237,7 @@ class TokenInfo { */ class OffsetStorage { + // eslint-disable-next-line jsdoc/require-description /** * @param {TokenInfo} tokenInfo a TokenInfo instance * @param {number} indentSize The desired size of each indentation level @@ -329,7 +331,6 @@ class OffsetStorage { * Instead, the correct way would be to offset `baz` by 1 level from `bar`, offset `bar` by 1 level from the `)`, and * offset the `)` by 0 levels from `foo`. This ensures that the offset between `bar` and the `)` are correctly collapsed * in the second case. - * * @param {Token} token The token * @param {Token} fromToken The token that `token` should be offset from * @param {number} offset The desired indent level @@ -358,7 +359,6 @@ class OffsetStorage { * * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: * `setDesiredOffsets([30, 43], fooToken, 1);` - * * @param {[number, number]} range A [start, end] pair. All tokens with range[0] <= token.start < range[1] will have the offset applied. * @param {Token} fromToken The token that this is offset from * @param {number} offset The desired indent level diff --git a/tools/node_modules/eslint/lib/rules/init-declarations.js b/tools/node_modules/eslint/lib/rules/init-declarations.js index 65197358e60df8..6cfdf92c909155 100644 --- a/tools/node_modules/eslint/lib/rules/init-declarations.js +++ b/tools/node_modules/eslint/lib/rules/init-declarations.js @@ -11,7 +11,7 @@ /** * Checks whether or not a given node is a for loop. - * @param {ASTNode} block - A node to check. + * @param {ASTNode} block A node to check. * @returns {boolean} `true` when the node is a for loop. */ function isForLoop(block) { @@ -22,7 +22,7 @@ function isForLoop(block) { /** * Checks whether or not a given declarator node has its initializer. - * @param {ASTNode} node - A declarator node to check. + * @param {ASTNode} node A declarator node to check. * @returns {boolean} `true` when the node has its initializer. */ function isInitialized(node) { diff --git a/tools/node_modules/eslint/lib/rules/jsx-quotes.js b/tools/node_modules/eslint/lib/rules/jsx-quotes.js index e6764b2e817732..3b282df2f07601 100644 --- a/tools/node_modules/eslint/lib/rules/jsx-quotes.js +++ b/tools/node_modules/eslint/lib/rules/jsx-quotes.js @@ -65,7 +65,7 @@ module.exports = { /** * Checks if the given string literal node uses the expected quotes - * @param {ASTNode} node - A string literal node. + * @param {ASTNode} node A string literal node. * @returns {boolean} Whether or not the string literal used the expected quotes. * @public */ diff --git a/tools/node_modules/eslint/lib/rules/keyword-spacing.js b/tools/node_modules/eslint/lib/rules/keyword-spacing.js index a1bf9910427eae..2b3fef33bd7ac4 100644 --- a/tools/node_modules/eslint/lib/rules/keyword-spacing.js +++ b/tools/node_modules/eslint/lib/rules/keyword-spacing.js @@ -41,8 +41,7 @@ const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of" /** * Checks whether or not a given token is a "Template" token ends with "${". - * - * @param {Token} token - A token to check. + * @param {Token} token A token to check. * @returns {boolean} `true` if the token is a "Template" token ends with "${". */ function isOpenParenOfTemplate(token) { @@ -51,8 +50,7 @@ function isOpenParenOfTemplate(token) { /** * Checks whether or not a given token is a "Template" token starts with "}". - * - * @param {Token} token - A token to check. + * @param {Token} token A token to check. * @returns {boolean} `true` if the token is a "Template" token starts with "}". */ function isCloseParenOfTemplate(token) { @@ -88,8 +86,8 @@ module.exports = { retv[key] = { type: "object", properties: { - before: { type: "boolean", default: true }, - after: { type: "boolean", default: true } + before: { type: "boolean" }, + after: { type: "boolean" } }, additionalProperties: false }; @@ -114,9 +112,8 @@ module.exports = { /** * Reports a given token if there are not space(s) before the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the previous token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the previous token to check. * @returns {void} */ function expectSpaceBefore(token, pattern) { @@ -141,9 +138,8 @@ module.exports = { /** * Reports a given token if there are space(s) before the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the previous token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the previous token to check. * @returns {void} */ function unexpectSpaceBefore(token, pattern) { @@ -168,9 +164,8 @@ module.exports = { /** * Reports a given token if there are not space(s) after the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the next token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the next token to check. * @returns {void} */ function expectSpaceAfter(token, pattern) { @@ -195,9 +190,8 @@ module.exports = { /** * Reports a given token if there are space(s) after the token. - * - * @param {Token} token - A token to report. - * @param {RegExp} pattern - A pattern of the next token to check. + * @param {Token} token A token to report. + * @param {RegExp} pattern A pattern of the next token to check. * @returns {void} */ function unexpectSpaceAfter(token, pattern) { @@ -222,8 +216,7 @@ module.exports = { /** * Parses the option object and determines check methods for each keyword. - * - * @param {Object|undefined} options - The option object to parse. + * @param {Object|undefined} options The option object to parse. * @returns {Object} - Normalized option object. * Keys are keywords (there are for every keyword). * Values are instances of `{"before": function, "after": function}`. @@ -263,9 +256,8 @@ module.exports = { /** * Reports a given token if usage of spacing followed by the token is * invalid. - * - * @param {Token} token - A token to report. - * @param {RegExp|undefined} pattern - Optional. A pattern of the previous + * @param {Token} token A token to report. + * @param {RegExp} [pattern] Optional. A pattern of the previous * token to check. * @returns {void} */ @@ -276,9 +268,8 @@ module.exports = { /** * Reports a given token if usage of spacing preceded by the token is * invalid. - * - * @param {Token} token - A token to report. - * @param {RegExp|undefined} pattern - Optional. A pattern of the next + * @param {Token} token A token to report. + * @param {RegExp} [pattern] Optional. A pattern of the next * token to check. * @returns {void} */ @@ -288,8 +279,7 @@ module.exports = { /** * Reports a given token if usage of spacing around the token is invalid. - * - * @param {Token} token - A token to report. + * @param {Token} token A token to report. * @returns {void} */ function checkSpacingAround(token) { @@ -300,8 +290,7 @@ module.exports = { /** * Reports the first token of a given node if the first token is a keyword * and usage of spacing around the token is invalid. - * - * @param {ASTNode|null} node - A node to report. + * @param {ASTNode|null} node A node to report. * @returns {void} */ function checkSpacingAroundFirstToken(node) { @@ -318,8 +307,7 @@ module.exports = { * * This is used for unary operators (e.g. `typeof`), `function`, and `super`. * Other rules are handling usage of spacing preceded by those keywords. - * - * @param {ASTNode|null} node - A node to report. + * @param {ASTNode|null} node A node to report. * @returns {void} */ function checkSpacingBeforeFirstToken(node) { @@ -333,8 +321,7 @@ module.exports = { /** * Reports the previous token of a given node if the token is a keyword and * usage of spacing around the token is invalid. - * - * @param {ASTNode|null} node - A node to report. + * @param {ASTNode|null} node A node to report. * @returns {void} */ function checkSpacingAroundTokenBefore(node) { @@ -348,8 +335,7 @@ module.exports = { /** * Reports `async` or `function` keywords of a given node if usage of * spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForFunction(node) { @@ -366,8 +352,7 @@ module.exports = { /** * Reports `class` and `extends` keywords of a given node if usage of * spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForClass(node) { @@ -378,8 +363,7 @@ module.exports = { /** * Reports `if` and `else` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForIfStatement(node) { @@ -390,8 +374,7 @@ module.exports = { /** * Reports `try`, `catch`, and `finally` keywords of a given node if usage * of spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForTryStatement(node) { @@ -403,8 +386,7 @@ module.exports = { /** * Reports `do` and `while` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForDoWhileStatement(node) { @@ -415,8 +397,7 @@ module.exports = { /** * Reports `for` and `in` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForForInStatement(node) { @@ -427,8 +408,7 @@ module.exports = { /** * Reports `for` and `of` keywords of a given node if usage of spacing * around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForForOfStatement(node) { @@ -449,8 +429,7 @@ module.exports = { * * import*as A from "./a"; /*error Expected space(s) after "import". * error Expected space(s) before "as". - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForModuleDeclaration(node) { @@ -474,8 +453,7 @@ module.exports = { /** * Reports `as` keyword of a given node if usage of spacing around this * keyword is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForImportNamespaceSpecifier(node) { @@ -487,8 +465,7 @@ module.exports = { /** * Reports `static`, `get`, and `set` keywords of a given node if usage of * spacing around those keywords is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForProperty(node) { @@ -528,8 +505,7 @@ module.exports = { /** * Reports `await` keyword of a given node if usage of spacing before * this keyword is invalid. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function checkSpacingForAwaitExpression(node) { diff --git a/tools/node_modules/eslint/lib/rules/lines-around-directive.js b/tools/node_modules/eslint/lib/rules/lines-around-directive.js index 39686d98916f80..fb439dad6a3c75 100644 --- a/tools/node_modules/eslint/lib/rules/lines-around-directive.js +++ b/tools/node_modules/eslint/lib/rules/lines-around-directive.js @@ -131,7 +131,7 @@ module.exports = { /** * Check lines around directives in node - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkDirectives(node) { diff --git a/tools/node_modules/eslint/lib/rules/max-len.js b/tools/node_modules/eslint/lib/rules/max-len.js index 45b02f35117834..b29099ed4c4f09 100644 --- a/tools/node_modules/eslint/lib/rules/max-len.js +++ b/tools/node_modules/eslint/lib/rules/max-len.js @@ -198,7 +198,6 @@ module.exports = { /** * Ensure that an array exists at [key] on `object`, and add `value` to it. - * * @param {Object} object the object to mutate * @param {string} key the object's key * @param {*} value the value to add @@ -214,7 +213,6 @@ module.exports = { /** * Retrieves an array containing all strings (" or ') in the source code. - * * @returns {ASTNode[]} An array of string nodes. */ function getAllStrings() { @@ -224,7 +222,6 @@ module.exports = { /** * Retrieves an array containing all template literals in the source code. - * * @returns {ASTNode[]} An array of template literal nodes. */ function getAllTemplateLiterals() { @@ -234,7 +231,6 @@ module.exports = { /** * Retrieves an array containing all RegExp literals in the source code. - * * @returns {ASTNode[]} An array of RegExp literal nodes. */ function getAllRegExpLiterals() { @@ -244,7 +240,6 @@ module.exports = { /** * A reducer to group an AST node by line number, both start and end. - * * @param {Object} acc the accumulator * @param {ASTNode} node the AST node in question * @returns {Object} the modified accumulator 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 e9212001a34156..5407cff3c54874 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 @@ -61,7 +61,6 @@ module.exports = { /** * Reports with the first extra statement, and clears it. - * * @returns {void} */ function reportFirstExtraStatementAndClear() { @@ -81,8 +80,7 @@ module.exports = { /** * Gets the actual last token of a given node. - * - * @param {ASTNode} node - A node to get. This is a node except EmptyStatement. + * @param {ASTNode} node A node to get. This is a node except EmptyStatement. * @returns {Token} The actual last token. */ function getActualLastToken(node) { @@ -92,8 +90,7 @@ module.exports = { /** * Addresses a given node. * It updates the state of this rule, then reports the node if the node violated this rule. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function enterStatement(node) { @@ -127,8 +124,7 @@ module.exports = { /** * Updates the state of this rule with the end line of leaving node to check with the next statement. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function leaveStatement(node) { diff --git a/tools/node_modules/eslint/lib/rules/multiline-ternary.js b/tools/node_modules/eslint/lib/rules/multiline-ternary.js index 3b98d0b3cf12dc..1df90b6feb8321 100644 --- a/tools/node_modules/eslint/lib/rules/multiline-ternary.js +++ b/tools/node_modules/eslint/lib/rules/multiline-ternary.js @@ -46,9 +46,9 @@ module.exports = { /** * Tests whether node is preceded by supplied tokens - * @param {ASTNode} node - node to check - * @param {ASTNode} parentNode - parent of node to report - * @param {boolean} expected - whether newline was expected or not + * @param {ASTNode} node node to check + * @param {ASTNode} parentNode parent of node to report + * @param {boolean} expected whether newline was expected or not * @returns {void} * @private */ diff --git a/tools/node_modules/eslint/lib/rules/newline-after-var.js b/tools/node_modules/eslint/lib/rules/newline-after-var.js index 8f244149c5574a..4809d9bfc5a2da 100644 --- a/tools/node_modules/eslint/lib/rules/newline-after-var.js +++ b/tools/node_modules/eslint/lib/rules/newline-after-var.js @@ -72,8 +72,7 @@ module.exports = { * var foo = 1 * * ;(a || b).doSomething() - * - * @param {ASTNode} node - The node to get. + * @param {ASTNode} node The node to get. * @returns {Token} The token to compare line to the next statement. */ function getLastToken(node) { @@ -93,7 +92,7 @@ module.exports = { /** * Determine if provided keyword is a variable declaration * @private - * @param {string} keyword - keyword to test + * @param {string} keyword keyword to test * @returns {boolean} True if `keyword` is a type of var */ function isVar(keyword) { @@ -103,7 +102,7 @@ module.exports = { /** * Determine if provided keyword is a variant of for specifiers * @private - * @param {string} keyword - keyword to test + * @param {string} keyword keyword to test * @returns {boolean} True if `keyword` is a variant of for specifier */ function isForTypeSpecifier(keyword) { @@ -113,7 +112,7 @@ module.exports = { /** * Determine if provided keyword is an export specifiers * @private - * @param {string} nodeType - nodeType to test + * @param {string} nodeType nodeType to test * @returns {boolean} True if `nodeType` is an export specifier */ function isExportSpecifier(nodeType) { @@ -124,7 +123,7 @@ module.exports = { /** * Determine if provided node is the last of their parent block. * @private - * @param {ASTNode} node - node to test + * @param {ASTNode} node node to test * @returns {boolean} True if `node` is last of their parent block. */ function isLastNode(node) { @@ -159,7 +158,7 @@ module.exports = { * set to "always", or checks that there is no blank line when mode is set * to "never" * @private - * @param {ASTNode} node - `VariableDeclaration` node to test + * @param {ASTNode} node `VariableDeclaration` node to test * @returns {void} */ function checkForBlankLine(node) { diff --git a/tools/node_modules/eslint/lib/rules/newline-before-return.js b/tools/node_modules/eslint/lib/rules/newline-before-return.js index 816ddba72b2c5a..65ca32321cc823 100644 --- a/tools/node_modules/eslint/lib/rules/newline-before-return.js +++ b/tools/node_modules/eslint/lib/rules/newline-before-return.js @@ -39,8 +39,8 @@ module.exports = { /** * Tests whether node is preceded by supplied tokens - * @param {ASTNode} node - node to check - * @param {Array} testTokens - array of tokens to test against + * @param {ASTNode} node node to check + * @param {Array} testTokens array of tokens to test against * @returns {boolean} Whether or not the node is preceded by one of the supplied tokens * @private */ @@ -52,7 +52,7 @@ module.exports = { /** * Checks whether node is the first node after statement or in block - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} Whether or not the node is the first node after statement or in block * @private */ @@ -80,8 +80,8 @@ module.exports = { /** * Returns the number of lines of comments that precede the node - * @param {ASTNode} node - node to check for overlapping comments - * @param {number} lineNumTokenBefore - line number of previous token, to check for overlapping comments + * @param {ASTNode} node node to check for overlapping comments + * @param {number} lineNumTokenBefore line number of previous token, to check for overlapping comments * @returns {number} Number of lines of comments that precede the node * @private */ @@ -115,7 +115,7 @@ module.exports = { /** * Returns the line number of the token before the node that is passed in as an argument - * @param {ASTNode} node - The node to use as the start of the calculation + * @param {ASTNode} node The node to use as the start of the calculation * @returns {number} Line number of the token before `node` * @private */ @@ -142,7 +142,7 @@ module.exports = { /** * Checks whether node is preceded by a newline - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {boolean} Whether or not the node is preceded by a newline * @private */ @@ -160,8 +160,7 @@ module.exports = { * The fix is not considered safe if the given return statement has leading comments, * as we cannot safely determine if the newline should be added before or after the comments. * For more information, see: https://github.com/eslint/eslint/issues/5958#issuecomment-222767211 - * - * @param {ASTNode} node - The return statement node to check. + * @param {ASTNode} node The return statement node to check. * @returns {boolean} `true` if it can fix the node. * @private */ 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 4aee76da108989..8ad88386c0f61d 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 @@ -53,8 +53,7 @@ module.exports = { * Get the prefix of a given MemberExpression node. * If the MemberExpression node is a computed value it returns a * left bracket. If not it returns a period. - * - * @param {ASTNode} node - A MemberExpression node to get + * @param {ASTNode} node A MemberExpression node to get * @returns {string} The prefix of the node. */ function getPrefix(node) { @@ -64,8 +63,7 @@ module.exports = { /** * Gets the property text of a given MemberExpression node. * If the text is multiline, this returns only the first line. - * - * @param {ASTNode} node - A MemberExpression node to get. + * @param {ASTNode} node A MemberExpression node to get. * @returns {string} The property text of the node. */ function getPropertyText(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-class-assign.js b/tools/node_modules/eslint/lib/rules/no-class-assign.js index 986bdd7c1c3e01..887058ba0f967d 100644 --- a/tools/node_modules/eslint/lib/rules/no-class-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-class-assign.js @@ -33,7 +33,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { @@ -45,7 +45,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {ASTNode} node - A ClassDeclaration/ClassExpression node to check. + * @param {ASTNode} node A ClassDeclaration/ClassExpression node to check. * @returns {void} */ function checkForClass(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js b/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js index f5c8d5f417b20a..0c6865ad59e8fe 100644 --- a/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js +++ b/tools/node_modules/eslint/lib/rules/no-compare-neg-zero.js @@ -35,8 +35,7 @@ module.exports = { /** * Checks a given node is -0 - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is -0. */ function isNegZero(node) { 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 895b9499dde051..b9a0e6ed0a70b5 100644 --- a/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js +++ b/tools/node_modules/eslint/lib/rules/no-confusing-arrow.js @@ -14,7 +14,7 @@ const astUtils = require("./utils/ast-utils.js"); /** * Checks whether or not a node is a conditional expression. - * @param {ASTNode} node - node to test + * @param {ASTNode} node node to test * @returns {boolean} `true` if the node is a conditional expression. */ function isConditional(node) { @@ -59,7 +59,7 @@ module.exports = { /** * Reports if an arrow function contains an ambiguous conditional. - * @param {ASTNode} node - A node to check and report. + * @param {ASTNode} node A node to check and report. * @returns {void} */ function checkArrowFunc(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-console.js b/tools/node_modules/eslint/lib/rules/no-console.js index e4b5ce1ea44739..56dbbc3a9fd595 100644 --- a/tools/node_modules/eslint/lib/rules/no-console.js +++ b/tools/node_modules/eslint/lib/rules/no-console.js @@ -54,8 +54,7 @@ module.exports = { /** * Checks whether the given reference is 'console' or not. - * - * @param {eslint-scope.Reference} reference - The reference to check. + * @param {eslint-scope.Reference} reference The reference to check. * @returns {boolean} `true` if the reference is 'console'. */ function isConsole(reference) { @@ -67,8 +66,7 @@ module.exports = { /** * Checks whether the property name of the given MemberExpression node * is allowed by options or not. - * - * @param {ASTNode} node - The MemberExpression node to check. + * @param {ASTNode} node The MemberExpression node to check. * @returns {boolean} `true` if the property name of the node is allowed. */ function isAllowed(node) { @@ -80,8 +78,7 @@ module.exports = { /** * Checks whether the given reference is a member access which is not * allowed by options or not. - * - * @param {eslint-scope.Reference} reference - The reference to check. + * @param {eslint-scope.Reference} reference The reference to check. * @returns {boolean} `true` if the reference is a member access which * is not allowed by options. */ @@ -98,8 +95,7 @@ module.exports = { /** * Reports the given reference as a violation. - * - * @param {eslint-scope.Reference} reference - The reference to report. + * @param {eslint-scope.Reference} reference The reference to report. * @returns {void} */ function report(reference) { diff --git a/tools/node_modules/eslint/lib/rules/no-const-assign.js b/tools/node_modules/eslint/lib/rules/no-const-assign.js index 9f4c91fa305c16..e4ae891705f899 100644 --- a/tools/node_modules/eslint/lib/rules/no-const-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-const-assign.js @@ -33,7 +33,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { diff --git a/tools/node_modules/eslint/lib/rules/no-dupe-args.js b/tools/node_modules/eslint/lib/rules/no-dupe-args.js index 4e42336ae3dc34..817277f522e732 100644 --- a/tools/node_modules/eslint/lib/rules/no-dupe-args.js +++ b/tools/node_modules/eslint/lib/rules/no-dupe-args.js @@ -35,7 +35,7 @@ module.exports = { /** * Checks whether or not a given definition is a parameter's. - * @param {eslint-scope.DefEntry} def - A definition to check. + * @param {eslint-scope.DefEntry} def A definition to check. * @returns {boolean} `true` if the definition is a parameter's. */ function isParameter(def) { diff --git a/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js b/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js index 97f63a2896282b..6041e9e371ce5e 100644 --- a/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js +++ b/tools/node_modules/eslint/lib/rules/no-dupe-class-members.js @@ -32,8 +32,8 @@ module.exports = { /** * Gets state of a given member name. - * @param {string} name - A name of a member. - * @param {boolean} isStatic - A flag which specifies that is a static member. + * @param {string} name A name of a member. + * @param {boolean} isStatic A flag which specifies that is a static member. * @returns {Object} A state of a given member name. * - retv.init {boolean} A flag which shows the name is declared as normal member. * - retv.get {boolean} A flag which shows the name is declared as getter. @@ -55,8 +55,7 @@ module.exports = { /** * Gets the name text of a given node. - * - * @param {ASTNode} node - A node to get the name. + * @param {ASTNode} node A node to get the name. * @returns {string} The name text of the node. */ function getName(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-dupe-keys.js b/tools/node_modules/eslint/lib/rules/no-dupe-keys.js index 1b7f69cfaca655..89e1f2de642285 100644 --- a/tools/node_modules/eslint/lib/rules/no-dupe-keys.js +++ b/tools/node_modules/eslint/lib/rules/no-dupe-keys.js @@ -23,9 +23,10 @@ const SET_KIND = /^(?:init|set)$/u; */ class ObjectInfo { + // eslint-disable-next-line jsdoc/require-description /** - * @param {ObjectInfo|null} upper - The information of the outer object. - * @param {ASTNode} node - The ObjectExpression node of this information. + * @param {ObjectInfo|null} upper The information of the outer object. + * @param {ASTNode} node The ObjectExpression node of this information. */ constructor(upper, node) { this.upper = upper; @@ -35,7 +36,7 @@ class ObjectInfo { /** * Gets the information of the given Property node. - * @param {ASTNode} node - The Property node to get. + * @param {ASTNode} node The Property node to get. * @returns {{get: boolean, set: boolean}} The information of the property. */ getPropertyInfo(node) { @@ -49,7 +50,7 @@ class ObjectInfo { /** * Checks whether the given property has been defined already or not. - * @param {ASTNode} node - The Property node to check. + * @param {ASTNode} node The Property node to check. * @returns {boolean} `true` if the property has been defined. */ isPropertyDefined(node) { @@ -63,7 +64,7 @@ class ObjectInfo { /** * Defines the given property. - * @param {ASTNode} node - The Property node to define. + * @param {ASTNode} node The Property node to define. * @returns {void} */ defineProperty(node) { 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 03b5e2c12393ae..7218dc64add343 100644 --- a/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js +++ b/tools/node_modules/eslint/lib/rules/no-duplicate-imports.js @@ -10,8 +10,7 @@ /** * Returns the name of the module imported or re-exported. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {string} the name of the module, or empty string if no name. */ function getValue(node) { @@ -24,12 +23,11 @@ function getValue(node) { /** * Checks if the name of the import or export exists in the given array, and reports if so. - * - * @param {RuleContext} context - The ESLint rule context object. - * @param {ASTNode} node - A node to get. - * @param {string} value - The name of the imported or exported module. - * @param {string[]} array - The array containing other imports or exports in the file. - * @param {string} messageId - A messageId to be reported after the name of the module + * @param {RuleContext} context The ESLint rule context object. + * @param {ASTNode} node A node to get. + * @param {string} value The name of the imported or exported module. + * @param {string[]} array The array containing other imports or exports in the file. + * @param {string} messageId A messageId to be reported after the name of the module * * @returns {void} No return value */ @@ -47,16 +45,15 @@ function checkAndReport(context, node, value, array, messageId) { /** * @callback nodeCallback - * @param {ASTNode} node - A node to handle. + * @param {ASTNode} node A node to handle. */ /** * Returns a function handling the imports of a given file - * - * @param {RuleContext} context - The ESLint rule context object. - * @param {boolean} includeExports - Whether or not to check for exports in addition to imports. - * @param {string[]} importsInFile - The array containing other imports in the file. - * @param {string[]} exportsInFile - The array containing other exports in the file. + * @param {RuleContext} context The ESLint rule context object. + * @param {boolean} includeExports Whether or not to check for exports in addition to imports. + * @param {string[]} importsInFile The array containing other imports in the file. + * @param {string[]} exportsInFile The array containing other exports in the file. * * @returns {nodeCallback} A function passed to ESLint to handle the statement. */ @@ -78,10 +75,9 @@ function handleImports(context, includeExports, importsInFile, exportsInFile) { /** * Returns a function handling the exports of a given file - * - * @param {RuleContext} context - The ESLint rule context object. - * @param {string[]} importsInFile - The array containing other imports in the file. - * @param {string[]} exportsInFile - The array containing other exports in the file. + * @param {RuleContext} context The ESLint rule context object. + * @param {string[]} importsInFile The array containing other imports in the file. + * @param {string[]} exportsInFile The array containing other exports in the file. * * @returns {nodeCallback} A function passed to ESLint to handle the statement. */ 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 c63af2be523e1c..84409fac87cff8 100644 --- a/tools/node_modules/eslint/lib/rules/no-else-return.js +++ b/tools/node_modules/eslint/lib/rules/no-else-return.js @@ -58,7 +58,6 @@ module.exports = { * * This is not a generic function. In particular, it is assumed that the scope is a function scope or * a function's inner scope, and that the names can be valid identifiers in the given scope. - * * @param {string[]} names Array of variable names. * @param {eslint-scope.Scope} scope Function scope or a function's inner scope. * @returns {boolean} True if all names can be safely declared, false otherwise. @@ -134,7 +133,6 @@ module.exports = { /** * Checks whether the removal of `else` and its braces is safe from variable name collisions. - * * @param {Node} node The 'else' node. * @param {eslint-scope.Scope} scope The scope in which the node and the whole 'if' statement is. * @returns {boolean} True if it is safe, false otherwise. @@ -171,7 +169,6 @@ module.exports = { /** * Display the context report if rule is violated - * * @param {Node} node The 'else' node * @returns {void} */ @@ -255,7 +252,6 @@ module.exports = { /** * Check to see if the node is a ReturnStatement - * * @param {Node} node The node being evaluated * @returns {boolean} True if node is a return */ @@ -267,7 +263,6 @@ module.exports = { * Naive return checking, does not iterate through the whole * BlockStatement because we make the assumption that the ReturnStatement * will be the last node in the body of the BlockStatement. - * * @param {Node} node The consequent/alternate node * @returns {boolean} True if it has a return */ @@ -284,7 +279,6 @@ module.exports = { /** * Check to see if the node is valid for evaluation, * meaning it has an else. - * * @param {Node} node The node being evaluated * @returns {boolean} True if the node is valid */ @@ -296,7 +290,6 @@ module.exports = { * If the consequent is an IfStatement, check to see if it has an else * and both its consequent and alternate path return, meaning this is * a nested case of rule violation. If-Else not considered currently. - * * @param {Node} node The consequent node * @returns {boolean} True if this is a nested rule violation */ @@ -309,7 +302,6 @@ module.exports = { * Check the consequent/body node to make sure it is not * a ReturnStatement or an IfStatement that returns on both * code paths. - * * @param {Node} node The consequent or body node * @returns {boolean} `true` if it is a Return/If node that always returns. */ diff --git a/tools/node_modules/eslint/lib/rules/no-empty-function.js b/tools/node_modules/eslint/lib/rules/no-empty-function.js index 149b1477dc1bd9..c57e66fd534048 100644 --- a/tools/node_modules/eslint/lib/rules/no-empty-function.js +++ b/tools/node_modules/eslint/lib/rules/no-empty-function.js @@ -28,8 +28,7 @@ const ALLOW_OPTIONS = Object.freeze([ /** * Gets the kind of a given function node. - * - * @param {ASTNode} node - A function node to get. This is one of + * @param {ASTNode} node A function node to get. This is one of * an ArrowFunctionExpression, a FunctionDeclaration, or a * FunctionExpression. * @returns {string} The kind of the function. This is one of "functions", @@ -130,8 +129,7 @@ module.exports = { * - Not allowed by options. * - The body is empty. * - The body doesn't have any comments. - * - * @param {ASTNode} node - A function node to report. This is one of + * @param {ASTNode} node A function node to report. This is one of * an ArrowFunctionExpression, a FunctionDeclaration, or a * FunctionExpression. * @returns {void} diff --git a/tools/node_modules/eslint/lib/rules/no-eval.js b/tools/node_modules/eslint/lib/rules/no-eval.js index d580f369259e2d..9e56fb00b9fc5b 100644 --- a/tools/node_modules/eslint/lib/rules/no-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-eval.js @@ -22,9 +22,8 @@ const candidatesOfGlobalObject = Object.freeze([ /** * Checks a given node is a Identifier node of the specified name. - * - * @param {ASTNode} node - A node to check. - * @param {string} name - A name to check. + * @param {ASTNode} node A node to check. + * @param {string} name A name to check. * @returns {boolean} `true` if the node is a Identifier node of the name. */ function isIdentifier(node, name) { @@ -33,9 +32,8 @@ function isIdentifier(node, name) { /** * Checks a given node is a Literal node of the specified string value. - * - * @param {ASTNode} node - A node to check. - * @param {string} name - A name to check. + * @param {ASTNode} node A node to check. + * @param {string} name A name to check. * @returns {boolean} `true` if the node is a Literal node of the name. */ function isConstant(node, name) { @@ -57,9 +55,8 @@ function isConstant(node, name) { /** * Checks a given node is a MemberExpression node which has the specified name's * property. - * - * @param {ASTNode} node - A node to check. - * @param {string} name - A name to check. + * @param {ASTNode} node A node to check. + * @param {string} name A name to check. * @returns {boolean} `true` if the node is a MemberExpression node which has * the specified name's property */ @@ -113,8 +110,7 @@ module.exports = { * * This is used in order to check whether or not `this` binding is a * reference to the global object. - * - * @param {ASTNode} node - A node of the scope. This is one of Program, + * @param {ASTNode} node A node of the scope. This is one of Program, * FunctionDeclaration, FunctionExpression, and ArrowFunctionExpression. * @returns {void} */ @@ -132,7 +128,6 @@ module.exports = { /** * Pops a variable scope from the stack. - * * @returns {void} */ function exitVarScope() { @@ -148,8 +143,7 @@ module.exports = { * The location of the report is always `eval` `Identifier` (or possibly * `Literal`). The type of the report is `CallExpression` if the parent is * `CallExpression`. Otherwise, it's the given node type. - * - * @param {ASTNode} node - A node to report. + * @param {ASTNode} node A node to report. * @returns {void} */ function report(node) { @@ -171,8 +165,7 @@ module.exports = { /** * Reports accesses of `eval` via the global object. - * - * @param {eslint-scope.Scope} globalScope - The global scope. + * @param {eslint-scope.Scope} globalScope The global scope. * @returns {void} */ function reportAccessingEvalViaGlobalObject(globalScope) { @@ -205,8 +198,7 @@ module.exports = { /** * Reports all accesses of `eval` (excludes direct calls to eval). - * - * @param {eslint-scope.Scope} globalScope - The global scope. + * @param {eslint-scope.Scope} globalScope The global scope. * @returns {void} */ function reportAccessingEval(globalScope) { diff --git a/tools/node_modules/eslint/lib/rules/no-ex-assign.js b/tools/node_modules/eslint/lib/rules/no-ex-assign.js index 21d3220799b876..1163920361d2d4 100644 --- a/tools/node_modules/eslint/lib/rules/no-ex-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-ex-assign.js @@ -33,7 +33,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { diff --git a/tools/node_modules/eslint/lib/rules/no-extra-bind.js b/tools/node_modules/eslint/lib/rules/no-extra-bind.js index cc5611b10894ee..d938c0f51b06dd 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-bind.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-bind.js @@ -47,7 +47,6 @@ module.exports = { * Checks if a node is free of side effects. * * This check is stricter than it needs to be, in order to keep the implementation simple. - * * @param {ASTNode} node A node to check. * @returns {boolean} True if the node is known to be side-effect free, false otherwise. */ @@ -57,8 +56,7 @@ module.exports = { /** * Reports a given function node. - * - * @param {ASTNode} node - A node to report. This is a FunctionExpression or + * @param {ASTNode} node A node to report. This is a FunctionExpression or * an ArrowFunctionExpression. * @returns {void} */ @@ -90,8 +88,7 @@ module.exports = { * method. * * e.g. `(function() {}.bind(foo))` - * - * @param {ASTNode} node - A node to report. This is a FunctionExpression or + * @param {ASTNode} node A node to report. This is a FunctionExpression or * an ArrowFunctionExpression. * @returns {boolean} `true` if the node is the callee of `.bind()` method. */ @@ -113,8 +110,7 @@ module.exports = { /** * Adds a scope information object to the stack. - * - * @param {ASTNode} node - A node to add. This node is a FunctionExpression + * @param {ASTNode} node A node to add. This node is a FunctionExpression * or a FunctionDeclaration node. * @returns {void} */ @@ -130,8 +126,7 @@ module.exports = { * Removes the scope information object from the top of the stack. * At the same time, this reports the function node if the function has * `.bind()` and the `this` keywords found. - * - * @param {ASTNode} node - A node to remove. This node is a + * @param {ASTNode} node A node to remove. This node is a * FunctionExpression or a FunctionDeclaration node. * @returns {void} */ @@ -146,8 +141,7 @@ module.exports = { /** * Reports a given arrow function if the function is callee of `.bind()` * method. - * - * @param {ASTNode} node - A node to report. This node is an + * @param {ASTNode} node A node to report. This node is an * ArrowFunctionExpression. * @returns {void} */ @@ -159,7 +153,6 @@ module.exports = { /** * Set the mark as the `this` keyword was found in this scope. - * * @returns {void} */ function markAsThisFound() { diff --git a/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js b/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js index e818cd448c495a..336f601d1652de 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js @@ -49,7 +49,6 @@ module.exports = { /** * Check if a node is in a context where its value would be coerced to a boolean at runtime. - * * @param {ASTNode} node The node * @param {ASTNode} parent Its parent * @returns {boolean} If it is in a boolean context @@ -67,7 +66,6 @@ module.exports = { /** * Check if a node has comments inside. - * * @param {ASTNode} node The node to check. * @returns {boolean} `true` if it has comments inside. */ diff --git a/tools/node_modules/eslint/lib/rules/no-extra-label.js b/tools/node_modules/eslint/lib/rules/no-extra-label.js index 48add937e6ef57..81406e76095733 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-label.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-label.js @@ -40,8 +40,7 @@ module.exports = { /** * Creates a new scope with a breakable statement. - * - * @param {ASTNode} node - A node to create. This is a BreakableStatement. + * @param {ASTNode} node A node to create. This is a BreakableStatement. * @returns {void} */ function enterBreakableStatement(node) { @@ -54,7 +53,6 @@ module.exports = { /** * Removes the top scope of the stack. - * * @returns {void} */ function exitBreakableStatement() { @@ -66,8 +64,7 @@ module.exports = { * * This ignores it if the body is a breakable statement. * In this case it's handled in the `enterBreakableStatement` function. - * - * @param {ASTNode} node - A node to create. This is a LabeledStatement. + * @param {ASTNode} node A node to create. This is a LabeledStatement. * @returns {void} */ function enterLabeledStatement(node) { @@ -85,8 +82,7 @@ module.exports = { * * This ignores it if the body is a breakable statement. * In this case it's handled in the `exitBreakableStatement` function. - * - * @param {ASTNode} node - A node. This is a LabeledStatement. + * @param {ASTNode} node A node. This is a LabeledStatement. * @returns {void} */ function exitLabeledStatement(node) { @@ -97,8 +93,7 @@ module.exports = { /** * Reports a given control node if it's unnecessary. - * - * @param {ASTNode} node - A node. This is a BreakStatement or a + * @param {ASTNode} node A node. This is a BreakStatement or a * ContinueStatement. * @returns {void} */ 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 c6809c355bc752..f96e572bfeef54 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js @@ -50,7 +50,8 @@ module.exports = { returnAssign: { type: "boolean" }, ignoreJSX: { enum: ["none", "all", "single-line", "multi-line"] }, enforceForArrowConditionals: { type: "boolean" }, - enforceForSequenceExpressions: { type: "boolean" } + enforceForSequenceExpressions: { type: "boolean" }, + enforceForNewInMemberExpressions: { type: "boolean" } }, additionalProperties: false } @@ -80,6 +81,8 @@ module.exports = { context.options[1].enforceForArrowConditionals === false; const IGNORE_SEQUENCE_EXPRESSIONS = ALL_NODES && context.options[1] && context.options[1].enforceForSequenceExpressions === false; + const IGNORE_NEW_IN_MEMBER_EXPR = ALL_NODES && context.options[1] && + context.options[1].enforceForNewInMemberExpressions === false; const PRECEDENCE_OF_ASSIGNMENT_EXPR = precedence({ type: "AssignmentExpression" }); const PRECEDENCE_OF_UPDATE_EXPR = precedence({ type: "UpdateExpression" }); @@ -88,7 +91,7 @@ module.exports = { /** * Determines if this rule should be enforced for a node given the current configuration. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the rule should be enforced for this node. * @private */ @@ -127,7 +130,7 @@ module.exports = { /** * Determines if a node is surrounded by parentheses. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is parenthesised. * @private */ @@ -137,7 +140,7 @@ module.exports = { /** * Determines if a node is surrounded by parentheses twice. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is doubly parenthesised. * @private */ @@ -147,7 +150,7 @@ module.exports = { /** * Determines if a node is surrounded by (potentially) invalid parentheses. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is incorrectly parenthesised. * @private */ @@ -158,7 +161,7 @@ module.exports = { /** * Determines if a node that is expected to be parenthesised is surrounded by * (potentially) invalid extra parentheses. - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is has an unexpected extra pair of parentheses. * @private */ @@ -168,7 +171,7 @@ module.exports = { /** * Determines if a node test expression is allowed to have a parenthesised assignment - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the assignment can be parenthesised. * @private */ @@ -178,7 +181,7 @@ module.exports = { /** * Determines if a node is in a return statement - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is in a return statement. * @private */ @@ -197,7 +200,7 @@ module.exports = { /** * Determines if a constructor function is newed-up with parens - * @param {ASTNode} newExpression - The NewExpression node to be checked. + * @param {ASTNode} newExpression The NewExpression node to be checked. * @returns {boolean} True if the constructor is called with parens. * @private */ @@ -217,7 +220,7 @@ module.exports = { /** * Determines if a node is or contains an assignment expression - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is or contains an assignment expression. * @private */ @@ -239,7 +242,7 @@ module.exports = { /** * Determines if a node is contained by or is itself a return statement and is allowed to have a parenthesised assignment - * @param {ASTNode} node - The node to be checked. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the assignment can be parenthesised. * @private */ @@ -261,8 +264,8 @@ module.exports = { /** * Determines if a node following a [no LineTerminator here] restriction is * surrounded by (potentially) invalid extra parentheses. - * @param {Token} token - The token preceding the [no LineTerminator here] restriction. - * @param {ASTNode} node - The node to be checked. + * @param {Token} token The token preceding the [no LineTerminator here] restriction. + * @param {ASTNode} node The node to be checked. * @returns {boolean} True if the node is incorrectly parenthesised. * @private */ @@ -567,7 +570,6 @@ module.exports = { /** * Checks whether the syntax of the given ancestor of an 'in' expression inside a for-loop initializer * is preventing the 'in' keyword from being interpreted as a part of an ill-formed for-in loop. - * * @param {ASTNode} node Ancestor of an 'in' expression. * @param {ASTNode} child Child of the node, ancestor of the same 'in' expression or the 'in' expression itself. * @returns {boolean} True if the keyword 'in' would be interpreted as the 'in' operator, without any parenthesis. @@ -599,7 +601,6 @@ module.exports = { /** * Starts a new reports buffering. Warnings will be stored in a buffer instead of being reported immediately. * An additional logic that requires multiple nodes (e.g. a whole subtree) may dismiss some of the stored warnings. - * * @returns {void} */ function startNewReportsBuffering() { @@ -895,6 +896,7 @@ module.exports = { } if (nodeObjHasExcessParens && + !IGNORE_NEW_IN_MEMBER_EXPR && node.object.type === "NewExpression" && isNewExpressionWithParens(node.object)) { report(node.object); diff --git a/tools/node_modules/eslint/lib/rules/no-extra-semi.js b/tools/node_modules/eslint/lib/rules/no-extra-semi.js index e99dd67b35b8fc..e0a8df0565af98 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-semi.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-semi.js @@ -40,7 +40,7 @@ module.exports = { /** * Reports an unnecessary semicolon error. - * @param {Node|Token} nodeOrToken - A node or a token to be reported. + * @param {Node|Token} nodeOrToken A node or a token to be reported. * @returns {void} */ function report(nodeOrToken) { @@ -64,8 +64,7 @@ module.exports = { /** * Checks for a part of a class body. * This checks tokens from a specified token to a next MethodDefinition or the end of class body. - * - * @param {Token} firstToken - The first token to check. + * @param {Token} firstToken The first token to check. * @returns {void} */ function checkForPartOfClassBody(firstToken) { @@ -83,7 +82,7 @@ module.exports = { /** * Reports this empty statement, except if the parent node is a loop. - * @param {Node} node - A EmptyStatement node to be reported. + * @param {Node} node A EmptyStatement node to be reported. * @returns {void} */ EmptyStatement(node) { @@ -106,7 +105,7 @@ module.exports = { /** * Checks tokens from the head of this class body to the first MethodDefinition or the end of this class body. - * @param {Node} node - A ClassBody node to check. + * @param {Node} node A ClassBody node to check. * @returns {void} */ ClassBody(node) { @@ -115,7 +114,7 @@ module.exports = { /** * Checks tokens from this MethodDefinition to the next MethodDefinition or the end of this class body. - * @param {Node} node - A MethodDefinition node of the start point. + * @param {Node} node A MethodDefinition node of the start point. * @returns {void} */ MethodDefinition(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-fallthrough.js b/tools/node_modules/eslint/lib/rules/no-fallthrough.js index c6a71b6c8c63b2..dd1f3ed9d9a74e 100644 --- a/tools/node_modules/eslint/lib/rules/no-fallthrough.js +++ b/tools/node_modules/eslint/lib/rules/no-fallthrough.js @@ -18,9 +18,9 @@ const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/iu; /** * Checks whether or not a given node has a fallthrough comment. - * @param {ASTNode} node - A SwitchCase node to get comments. - * @param {RuleContext} context - A rule context which stores comments. - * @param {RegExp} fallthroughCommentPattern - A pattern to match comment to. + * @param {ASTNode} node A SwitchCase node to get comments. + * @param {RuleContext} context A rule context which stores comments. + * @param {RegExp} fallthroughCommentPattern A pattern to match comment to. * @returns {boolean} `true` if the node has a valid fallthrough comment. */ function hasFallthroughComment(node, context, fallthroughCommentPattern) { @@ -32,7 +32,7 @@ function hasFallthroughComment(node, context, fallthroughCommentPattern) { /** * Checks whether or not a given code path segment is reachable. - * @param {CodePathSegment} segment - A CodePathSegment to check. + * @param {CodePathSegment} segment A CodePathSegment to check. * @returns {boolean} `true` if the segment is reachable. */ function isReachable(segment) { @@ -41,8 +41,8 @@ function isReachable(segment) { /** * Checks whether a node and a token are separated by blank lines - * @param {ASTNode} node - The node to check - * @param {Token} token - The token to compare against + * @param {ASTNode} node The node to check + * @param {Token} token The token to compare against * @returns {boolean} `true` if there are blank lines between node and token */ function hasBlankLinesBetween(node, token) { diff --git a/tools/node_modules/eslint/lib/rules/no-func-assign.js b/tools/node_modules/eslint/lib/rules/no-func-assign.js index d2b4109fa33964..66756e62bef5b2 100644 --- a/tools/node_modules/eslint/lib/rules/no-func-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-func-assign.js @@ -29,7 +29,7 @@ module.exports = { /** * Reports a reference if is non initializer and writable. - * @param {References} references - Collection of reference to check. + * @param {References} references Collection of reference to check. * @returns {void} */ function checkReference(references) { @@ -40,7 +40,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { @@ -51,7 +51,7 @@ module.exports = { /** * Checks parameters of a given function node. - * @param {ASTNode} node - A function node to check. + * @param {ASTNode} node A function node to check. * @returns {void} */ function checkForFunction(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-global-assign.js b/tools/node_modules/eslint/lib/rules/no-global-assign.js index 73f36b25e4763e..4ab0c706446256 100644 --- a/tools/node_modules/eslint/lib/rules/no-global-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-global-assign.js @@ -41,9 +41,9 @@ module.exports = { /** * Reports write references. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {void} */ function checkReference(reference, index, references) { @@ -68,7 +68,7 @@ module.exports = { /** * Reports write references if a given variable is read-only builtin. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { 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 7d463ac2bdc107..c80f9813020be5 100644 --- a/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js +++ b/tools/node_modules/eslint/lib/rules/no-implicit-coercion.js @@ -16,7 +16,7 @@ const ALLOWABLE_OPERATORS = ["~", "!!", "+", "*"]; /** * Parses and normalizes an option object. - * @param {Object} options - An option object to parse. + * @param {Object} options An option object to parse. * @returns {Object} The parsed and normalized option object. */ function parseOptions(options) { @@ -30,7 +30,7 @@ function parseOptions(options) { /** * Checks whether or not a node is a double logical nigating. - * @param {ASTNode} node - An UnaryExpression node to check. + * @param {ASTNode} node An UnaryExpression node to check. * @returns {boolean} Whether or not the node is a double logical nigating. */ function isDoubleLogicalNegating(node) { @@ -43,7 +43,7 @@ function isDoubleLogicalNegating(node) { /** * Checks whether or not a node is a binary negating of `.indexOf()` method calling. - * @param {ASTNode} node - An UnaryExpression node to check. + * @param {ASTNode} node An UnaryExpression node to check. * @returns {boolean} Whether or not the node is a binary negating of `.indexOf()` method calling. */ function isBinaryNegatingOfIndexOf(node) { @@ -58,7 +58,7 @@ function isBinaryNegatingOfIndexOf(node) { /** * Checks whether or not a node is a multiplying by one. - * @param {BinaryExpression} node - A BinaryExpression node to check. + * @param {BinaryExpression} node A BinaryExpression node to check. * @returns {boolean} Whether or not the node is a multiplying by one. */ function isMultiplyByOne(node) { @@ -118,7 +118,7 @@ function isEmptyString(node) { /** * Checks whether or not a node is a concatenating with an empty string. - * @param {ASTNode} node - A BinaryExpression node to check. + * @param {ASTNode} node A BinaryExpression node to check. * @returns {boolean} Whether or not the node is a concatenating with an empty string. */ function isConcatWithEmptyString(node) { @@ -130,7 +130,7 @@ function isConcatWithEmptyString(node) { /** * Checks whether or not a node is appended with an empty string. - * @param {ASTNode} node - An AssignmentExpression node to check. + * @param {ASTNode} node An AssignmentExpression node to check. * @returns {boolean} Whether or not the node is appended with an empty string. */ function isAppendEmptyString(node) { @@ -139,7 +139,7 @@ function isAppendEmptyString(node) { /** * Returns the operand that is not an empty string from a flagged BinaryExpression. - * @param {ASTNode} node - The flagged BinaryExpression node to check. + * @param {ASTNode} node The flagged BinaryExpression node to check. * @returns {ASTNode} The operand that is not an empty string from a flagged BinaryExpression. */ function getNonEmptyOperand(node) { @@ -196,9 +196,9 @@ module.exports = { /** * Reports an error and autofixes the node - * @param {ASTNode} node - An ast node to report the error on. - * @param {string} recommendation - The recommended code for the issue - * @param {bool} shouldFix - Whether this report should fix the node + * @param {ASTNode} node An ast node to report the error on. + * @param {string} recommendation The recommended code for the issue + * @param {bool} shouldFix Whether this report should fix the node * @returns {void} */ function report(node, recommendation, shouldFix) { diff --git a/tools/node_modules/eslint/lib/rules/no-implied-eval.js b/tools/node_modules/eslint/lib/rules/no-implied-eval.js index f2f6f9cea4fb68..e0764d8223db0a 100644 --- a/tools/node_modules/eslint/lib/rules/no-implied-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-implied-eval.js @@ -64,7 +64,6 @@ module.exports = { * Determines if a node represents a call to a potentially implied eval. * * This checks the callee name and that there's an argument, but not the type of the argument. - * * @param {ASTNode} node The CallExpression to check. * @returns {boolean} True if the node matches, false if not. * @private diff --git a/tools/node_modules/eslint/lib/rules/no-invalid-this.js b/tools/node_modules/eslint/lib/rules/no-invalid-this.js index 30ae3fdc31a58f..b1dddd9319c745 100644 --- a/tools/node_modules/eslint/lib/rules/no-invalid-this.js +++ b/tools/node_modules/eslint/lib/rules/no-invalid-this.js @@ -38,7 +38,6 @@ module.exports = { * * The return value has a flag that whether or not `this` keyword is valid. * The flag is initialized when got at the first time. - * * @returns {{valid: boolean}} * an object which has a flag that whether or not `this` keyword is valid. */ @@ -61,8 +60,7 @@ module.exports = { * The checking context is not initialized yet. * Because most functions don't have `this` keyword. * When `this` keyword was found, the checking context is initialized. - * - * @param {ASTNode} node - A function node that was entered. + * @param {ASTNode} node A function node that was entered. * @returns {void} */ function enterFunction(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-labels.js b/tools/node_modules/eslint/lib/rules/no-labels.js index 8168dc06c17f91..52f4b0f5168b71 100644 --- a/tools/node_modules/eslint/lib/rules/no-labels.js +++ b/tools/node_modules/eslint/lib/rules/no-labels.js @@ -51,8 +51,7 @@ module.exports = { /** * Gets the kind of a given node. - * - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {string} The kind of the node. */ function getBodyKind(node) { @@ -67,8 +66,7 @@ module.exports = { /** * Checks whether the label of a given kind is allowed or not. - * - * @param {string} kind - A kind to check. + * @param {string} kind A kind to check. * @returns {boolean} `true` if the kind is allowed. */ function isAllowed(kind) { @@ -81,8 +79,7 @@ module.exports = { /** * Checks whether a given name is a label of a loop or not. - * - * @param {string} label - A name of a label to check. + * @param {string} label A name of a label to check. * @returns {boolean} `true` if the name is a label of a loop. */ function getKind(label) { diff --git a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js index 4365b047861cc0..37561b0f9a3055 100644 --- a/tools/node_modules/eslint/lib/rules/no-lone-blocks.js +++ b/tools/node_modules/eslint/lib/rules/no-lone-blocks.js @@ -31,7 +31,7 @@ module.exports = { /** * Reports a node as invalid. - * @param {ASTNode} node - The node to be reported. + * @param {ASTNode} node The node to be reported. * @returns {void} */ function report(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-loop-func.js b/tools/node_modules/eslint/lib/rules/no-loop-func.js index f4531f3a7da5e7..13ebd3ee22b8d7 100644 --- a/tools/node_modules/eslint/lib/rules/no-loop-func.js +++ b/tools/node_modules/eslint/lib/rules/no-loop-func.js @@ -14,8 +14,7 @@ * * We don't need to check nested functions, so this ignores those. * `Scope.through` contains references of nested functions. - * - * @param {ASTNode} node - An AST node to get. + * @param {ASTNode} node An AST node to get. * @returns {ASTNode|null} The containing loop node of the specified node, or * `null`. */ @@ -63,9 +62,8 @@ function getContainingLoopNode(node) { /** * Gets the containing loop node of a given node. * If the loop was nested, this returns the most outer loop. - * - * @param {ASTNode} node - A node to get. This is a loop node. - * @param {ASTNode|null} excludedNode - A node that the result node should not + * @param {ASTNode} node A node to get. This is a loop node. + * @param {ASTNode|null} excludedNode A node that the result node should not * include. * @returns {ASTNode} The most outer loop node. */ @@ -85,9 +83,8 @@ function getTopLoopNode(node, excludedNode) { /** * Checks whether a given reference which refers to an upper scope's variable is * safe or not. - * - * @param {ASTNode} loopNode - A containing loop node. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {ASTNode} loopNode A containing loop node. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is safe or not. */ function isSafe(loopNode, reference) { @@ -131,8 +128,7 @@ function isSafe(loopNode, reference) { * It's safeafe if the reference matches one of the following condition. * - is readonly. * - doesn't exist inside a local function and after the border. - * - * @param {eslint-scope.Reference} upperRef - A reference to check. + * @param {eslint-scope.Reference} upperRef A reference to check. * @returns {boolean} `true` if the reference is safe. */ function isSafeReference(upperRef) { @@ -177,7 +173,6 @@ module.exports = { * * - has a loop node in ancestors. * - has any references which refers to an unsafe variable. - * * @param {ASTNode} node The AST node to check. * @returns {boolean} Whether or not the node is within a loop. */ 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 2c6ea61e283315..0909e3166d952e 100644 --- a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js +++ b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js @@ -61,7 +61,7 @@ module.exports = { /** * Returns whether the node is number literal - * @param {Node} node - the node literal being evaluated + * @param {Node} node the node literal being evaluated * @returns {boolean} true if the node is a number literal */ function isNumber(node) { @@ -70,7 +70,7 @@ module.exports = { /** * Returns whether the number should be ignored - * @param {number} num - the number + * @param {number} num the number * @returns {boolean} true if the number should be ignored */ function shouldIgnoreNumber(num) { @@ -79,8 +79,8 @@ module.exports = { /** * Returns whether the number should be ignored when used as a radix within parseInt() or Number.parseInt() - * @param {ASTNode} parent - the non-"UnaryExpression" parent - * @param {ASTNode} node - the node literal being evaluated + * @param {ASTNode} parent the non-"UnaryExpression" parent + * @param {ASTNode} node the node literal being evaluated * @returns {boolean} true if the number should be ignored */ function shouldIgnoreParseInt(parent, node) { @@ -93,7 +93,7 @@ module.exports = { /** * Returns whether the number should be ignored when used to define a JSX prop - * @param {ASTNode} parent - the non-"UnaryExpression" parent + * @param {ASTNode} parent the non-"UnaryExpression" parent * @returns {boolean} true if the number should be ignored */ function shouldIgnoreJSXNumbers(parent) { @@ -102,7 +102,7 @@ module.exports = { /** * Returns whether the number should be ignored when used as an array index with enabled 'ignoreArrayIndexes' option. - * @param {ASTNode} parent - the non-"UnaryExpression" parent. + * @param {ASTNode} parent the non-"UnaryExpression" parent. * @returns {boolean} true if the number should be ignored */ function shouldIgnoreArrayIndexes(parent) { diff --git a/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js b/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js index d7c394f463b6a6..9315ba64972f79 100644 --- a/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js +++ b/tools/node_modules/eslint/lib/rules/no-misleading-character-class.js @@ -16,7 +16,6 @@ const { isCombiningCharacter, isEmojiModifier, isRegionalIndicatorSymbol, isSurr * * CharacterClassRange syntax can steal a part of character sequence, * so this function reverts CharacterClassRange syntax and restore the sequence. - * * @param {regexpp.AST.CharacterClassElement[]} nodes The node list to iterate character sequences. * @returns {IterableIterator} The list of character sequences. */ @@ -131,12 +130,6 @@ module.exports = { * @returns {void} */ function verify(node, pattern, flags) { - const patternNode = parser.parsePattern( - pattern, - 0, - pattern.length, - flags.includes("u") - ); const has = { surrogatePairWithoutUFlag: false, combiningClass: false, @@ -145,6 +138,20 @@ module.exports = { regionalIndicatorSymbol: false, zwj: false }; + let patternNode; + + try { + patternNode = parser.parsePattern( + pattern, + 0, + pattern.length, + flags.includes("u") + ); + } catch (e) { + + // Ignore regular expressions with syntax errors + return; + } visitRegExpAST(patternNode, { onCharacterClassEnter(ccNode) { 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 8d1c7a6af43975..80fac79affdb0e 100644 --- a/tools/node_modules/eslint/lib/rules/no-mixed-operators.js +++ b/tools/node_modules/eslint/lib/rules/no-mixed-operators.js @@ -40,8 +40,7 @@ const TARGET_NODE_TYPE = /^(?:Binary|Logical|Conditional)Expression$/u; /** * Normalizes options. - * - * @param {Object|undefined} options - A options object to normalize. + * @param {Object|undefined} options A options object to normalize. * @returns {Object} Normalized option object. */ function normalizeOptions(options = {}) { @@ -57,10 +56,9 @@ function normalizeOptions(options = {}) { /** * Checks whether any group which includes both given operator exists or not. - * - * @param {Array.} groups - A list of groups to check. - * @param {string} left - An operator. - * @param {string} right - Another operator. + * @param {Array.} groups A list of groups to check. + * @param {string} left An operator. + * @param {string} right Another operator. * @returns {boolean} `true` if such group existed. */ function includesBothInAGroup(groups, left, right) { @@ -69,8 +67,7 @@ function includesBothInAGroup(groups, left, right) { /** * Checks whether the given node is a conditional expression and returns the test node else the left node. - * - * @param {ASTNode} node - A node which can be a BinaryExpression or a LogicalExpression node. + * @param {ASTNode} node A node which can be a BinaryExpression or a LogicalExpression node. * This parent node can be BinaryExpression, LogicalExpression * , or a ConditionalExpression node * @returns {ASTNode} node the appropriate node(left or test). @@ -124,8 +121,7 @@ module.exports = { /** * Checks whether a given node should be ignored by options or not. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. This parent node is one of * them, too. * @returns {boolean} `true` if the node should be ignored. @@ -146,8 +142,7 @@ module.exports = { /** * Checks whether the operator of a given node is mixed with parent * node's operator or not. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. This parent node is one of * them, too. * @returns {boolean} `true` if the node was mixed. @@ -163,8 +158,7 @@ module.exports = { /** * Checks whether the operator of a given node is mixed with a * conditional expression. - * - * @param {ASTNode} node - A node to check. This is a conditional + * @param {ASTNode} node A node to check. This is a conditional * expression node * @returns {boolean} `true` if the node was mixed. */ @@ -174,8 +168,7 @@ module.exports = { /** * Gets the operator token of a given node. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. * @returns {Token} The operator token of the node. */ @@ -186,8 +179,7 @@ module.exports = { /** * Reports both the operator of a given node and the operator of the * parent node. - * - * @param {ASTNode} node - A node to check. This is a BinaryExpression + * @param {ASTNode} node A node to check. This is a BinaryExpression * node or a LogicalExpression node. This parent node is one of * them, too. * @returns {void} @@ -205,13 +197,13 @@ module.exports = { context.report({ node: left, - loc: getOperatorToken(left).loc.start, + loc: getOperatorToken(left).loc, message, data }); context.report({ node: right, - loc: getOperatorToken(right).loc.start, + loc: getOperatorToken(right).loc, message, data }); @@ -220,8 +212,7 @@ module.exports = { /** * Checks between the operator of this node and the operator of the * parent node. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function check(node) { 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 e3164a8aba67e5..fda8a11d9e2e74 100644 --- a/tools/node_modules/eslint/lib/rules/no-mixed-requires.js +++ b/tools/node_modules/eslint/lib/rules/no-mixed-requires.js @@ -58,7 +58,6 @@ module.exports = { /** * Returns the list of built-in modules. - * * @returns {string[]} An array of built-in Node.js modules. */ function getBuiltinModules() { 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 64a04c5cc58354..403d04da9dd9ec 100644 --- a/tools/node_modules/eslint/lib/rules/no-multi-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-multi-spaces.js @@ -121,7 +121,7 @@ module.exports = { context.report({ node: rightToken, - loc: rightToken.loc.start, + loc: { start: leftToken.loc.end, end: rightToken.loc.start }, message: "Multiple spaces found before '{{displayValue}}'.", data: { displayValue }, fix: fixer => fixer.replaceTextRange([leftToken.range[1], rightToken.range[0]], " ") diff --git a/tools/node_modules/eslint/lib/rules/no-native-reassign.js b/tools/node_modules/eslint/lib/rules/no-native-reassign.js index 9ecfb4da7cbee9..eb233c80b1cca0 100644 --- a/tools/node_modules/eslint/lib/rules/no-native-reassign.js +++ b/tools/node_modules/eslint/lib/rules/no-native-reassign.js @@ -46,9 +46,9 @@ module.exports = { /** * Reports write references. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {void} */ function checkReference(reference, index, references) { @@ -73,7 +73,7 @@ module.exports = { /** * Reports write references if a given variable is read-only builtin. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { 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 9b8c828d2c2a1d..d65eb34762aaf2 100644 --- a/tools/node_modules/eslint/lib/rules/no-param-reassign.js +++ b/tools/node_modules/eslint/lib/rules/no-param-reassign.js @@ -45,6 +45,13 @@ module.exports = { type: "string" }, uniqueItems: true + }, + ignorePropertyModificationsForRegex: { + type: "array", + items: { + type: "string" + }, + uniqueItems: true } }, additionalProperties: false @@ -57,10 +64,11 @@ module.exports = { create(context) { const props = context.options[0] && context.options[0].props; const ignoredPropertyAssignmentsFor = context.options[0] && context.options[0].ignorePropertyModificationsFor || []; + const ignoredPropertyAssignmentsForRegex = context.options[0] && context.options[0].ignorePropertyModificationsForRegex || []; /** * Checks whether or not the reference modifies properties of its variable. - * @param {Reference} reference - A reference to check. + * @param {Reference} reference A reference to check. * @returns {boolean} Whether or not the reference modifies properties of its variable. */ function isModifyingProp(reference) { @@ -136,11 +144,24 @@ module.exports = { return false; } + /** + * Tests that an identifier name matches any of the ignored property assignments. + * First we test strings in ignoredPropertyAssignmentsFor. + * Then we instantiate and test RegExp objects from ignoredPropertyAssignmentsForRegex strings. + * @param {string} identifierName A string that describes the name of an identifier to + * ignore property assignments for. + * @returns {boolean} Whether the string matches an ignored property assignment regular expression or not. + */ + function isIgnoredPropertyAssignment(identifierName) { + return ignoredPropertyAssignmentsFor.includes(identifierName) || + ignoredPropertyAssignmentsForRegex.some(ignored => new RegExp(ignored, "u").test(identifierName)); + } + /** * Reports a reference if is non initializer and writable. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {void} */ function checkReference(reference, index, references) { @@ -157,7 +178,7 @@ module.exports = { ) { if (reference.isWrite()) { context.report({ node: identifier, message: "Assignment to function parameter '{{name}}'.", data: { name: identifier.name } }); - } else if (props && isModifyingProp(reference) && ignoredPropertyAssignmentsFor.indexOf(identifier.name) === -1) { + } else if (props && isModifyingProp(reference) && !isIgnoredPropertyAssignment(identifier.name)) { context.report({ node: identifier, message: "Assignment to property of function parameter '{{name}}'.", data: { name: identifier.name } }); } } @@ -165,7 +186,7 @@ module.exports = { /** * Finds and reports references that are non initializer and writable. - * @param {Variable} variable - A variable to check. + * @param {Variable} variable A variable to check. * @returns {void} */ function checkVariable(variable) { @@ -176,7 +197,7 @@ module.exports = { /** * Checks parameters of a given function node. - * @param {ASTNode} node - A function node to check. + * @param {ASTNode} node A function node to check. * @returns {void} */ function checkForFunction(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-redeclare.js b/tools/node_modules/eslint/lib/rules/no-redeclare.js index 9de2f4ed730364..6ddb21c9e15d9d 100644 --- a/tools/node_modules/eslint/lib/rules/no-redeclare.js +++ b/tools/node_modules/eslint/lib/rules/no-redeclare.js @@ -86,7 +86,7 @@ module.exports = { /** * Find variables in a given scope and flag redeclared ones. - * @param {Scope} scope - An eslint-scope scope object. + * @param {Scope} scope An eslint-scope scope object. * @returns {void} * @private */ diff --git a/tools/node_modules/eslint/lib/rules/no-regex-spaces.js b/tools/node_modules/eslint/lib/rules/no-regex-spaces.js index 41f5e149df049b..7581e9271fdf14 100644 --- a/tools/node_modules/eslint/lib/rules/no-regex-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-regex-spaces.js @@ -52,7 +52,6 @@ module.exports = { /** * Validate regular expression - * * @param {ASTNode} nodeToReport Node to report. * @param {string} pattern Regular expression pattern to validate. * @param {string} rawPattern Raw representation of the pattern in the source code. diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-imports.js b/tools/node_modules/eslint/lib/rules/no-restricted-imports.js index 6f3d2158c8d239..bed9c2432a58dd 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-imports.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-imports.js @@ -116,7 +116,7 @@ module.exports = { /** * Checks to see if "*" is being used to import everything. - * @param {Set.} importNames - Set of import names that are being imported + * @param {Set.} importNames Set of import names that are being imported * @returns {boolean} whether everything is imported or not */ function isEverythingImported(importNames) { @@ -145,7 +145,7 @@ module.exports = { /** * Report a restricted path specifically for patterns. - * @param {node} node - representing the restricted path reference + * @param {node} node representing the restricted path reference * @returns {void} * @private */ @@ -163,8 +163,8 @@ module.exports = { /** * Report a restricted path specifically when using the '*' import. - * @param {string} importSource - path of the import - * @param {node} node - representing the restricted path reference + * @param {string} importSource path of the import + * @param {node} node representing the restricted path reference * @returns {void} * @private */ @@ -185,8 +185,8 @@ module.exports = { /** * Check if the given importSource is restricted because '*' is being imported. - * @param {string} importSource - path of the import - * @param {Set.} importNames - Set of import names that are being imported + * @param {string} importSource path of the import + * @param {Set.} importNames Set of import names that are being imported * @returns {boolean} whether the path is restricted * @private */ @@ -198,8 +198,8 @@ module.exports = { /** * Check if the given importNames are restricted given a list of restrictedImportNames. - * @param {Set.} importNames - Set of import names that are being imported - * @param {string[]} restrictedImportNames - array of import names that are restricted for this import + * @param {Set.} importNames Set of import names that are being imported + * @param {string[]} restrictedImportNames array of import names that are restricted for this import * @returns {boolean} whether the objectName is restricted * @private */ @@ -211,8 +211,8 @@ module.exports = { /** * Check if the given importSource is a restricted path. - * @param {string} importSource - path of the import - * @param {Set.} importNames - Set of import names that are being imported + * @param {string} importSource path of the import + * @param {Set.} importNames Set of import names that are being imported * @returns {boolean} whether the variable is a restricted path or not * @private */ @@ -232,7 +232,7 @@ module.exports = { /** * Check if the given importSource is restricted by a pattern. - * @param {string} importSource - path of the import + * @param {string} importSource path of the import * @returns {boolean} whether the variable is a restricted pattern or not * @private */ 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 6ebd1925e497cd..705d0f409c4128 100644 --- a/tools/node_modules/eslint/lib/rules/no-self-assign.js +++ b/tools/node_modules/eslint/lib/rules/no-self-assign.js @@ -20,9 +20,8 @@ const SPACES = /\s+/gu; /** * Checks whether the property of 2 given member expression nodes are the same * property or not. - * - * @param {ASTNode} left - A member expression node to check. - * @param {ASTNode} right - Another member expression node to check. + * @param {ASTNode} left A member expression node to check. + * @param {ASTNode} right Another member expression node to check. * @returns {boolean} `true` if the member expressions have the same property. */ function isSameProperty(left, right) { @@ -43,9 +42,8 @@ function isSameProperty(left, right) { /** * Checks whether 2 given member expression nodes are the reference to the same * property or not. - * - * @param {ASTNode} left - A member expression node to check. - * @param {ASTNode} right - Another member expression node to check. + * @param {ASTNode} left A member expression node to check. + * @param {ASTNode} right Another member expression node to check. * @returns {boolean} `true` if the member expressions are the reference to the * same property or not. */ @@ -63,18 +61,20 @@ function isSameMember(left, right) { if (lobj.type === "MemberExpression") { return isSameMember(lobj, robj); } + if (lobj.type === "ThisExpression") { + return true; + } return lobj.type === "Identifier" && lobj.name === robj.name; } /** * Traverses 2 Pattern nodes in parallel, then reports self-assignments. - * - * @param {ASTNode|null} left - A left node to traverse. This is a Pattern or + * @param {ASTNode|null} left A left node to traverse. This is a Pattern or * a Property. - * @param {ASTNode|null} right - A right node to traverse. This is a Pattern or + * @param {ASTNode|null} right A right node to traverse. This is a Pattern or * a Property. - * @param {boolean} props - The flag to check member expressions as well. - * @param {Function} report - A callback function to report. + * @param {boolean} props The flag to check member expressions as well. + * @param {Function} report A callback function to report. * @returns {void} */ function eachSelfAssignment(left, right, props, report) { @@ -205,8 +205,7 @@ module.exports = { /** * Reports a given node as self assignments. - * - * @param {ASTNode} node - A node to report. This is an Identifier node. + * @param {ASTNode} node A node to report. This is an Identifier node. * @returns {void} */ function report(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-sequences.js b/tools/node_modules/eslint/lib/rules/no-sequences.js index 39d147b69be165..8046a8711a3e9a 100644 --- a/tools/node_modules/eslint/lib/rules/no-sequences.js +++ b/tools/node_modules/eslint/lib/rules/no-sequences.js @@ -54,7 +54,7 @@ module.exports = { /** * Determines whether a node is required by the grammar to be wrapped in * parens, e.g. the test of an if statement. - * @param {ASTNode} node - The AST node + * @param {ASTNode} node The AST node * @returns {boolean} True if parens around node belong to parent node. */ function requiresExtraParens(node) { @@ -64,7 +64,7 @@ module.exports = { /** * Check if a node is wrapped in parens. - * @param {ASTNode} node - The AST node + * @param {ASTNode} node The AST node * @returns {boolean} True if the node has a paren on each side. */ function isParenthesised(node) { @@ -73,7 +73,7 @@ module.exports = { /** * Check if a node is wrapped in two levels of parens. - * @param {ASTNode} node - The AST node + * @param {ASTNode} node The AST node * @returns {boolean} True if two parens surround the node on each side. */ function isParenthesisedTwice(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-shadow.js b/tools/node_modules/eslint/lib/rules/no-shadow.js index 1993d60078b662..bad6cb5f3094cc 100644 --- a/tools/node_modules/eslint/lib/rules/no-shadow.js +++ b/tools/node_modules/eslint/lib/rules/no-shadow.js @@ -54,7 +54,6 @@ module.exports = { /** * Check if variable name is allowed. - * * @param {ASTNode} variable The variable to check. * @returns {boolean} Whether or not the variable name is allowed. */ @@ -67,7 +66,6 @@ module.exports = { * * ClassDeclaration creates two variables of its name into its outer scope and its class scope. * So we should ignore the variable in the class scope. - * * @param {Object} variable The variable to check. * @returns {boolean} Whether or not the variable of the class name in the class scope of ClassDeclaration. */ @@ -82,7 +80,6 @@ module.exports = { * * To avoid reporting at declarations such as `var a = function a() {};`. * But it should report `var a = function(a) {};` or `var a = function() { function a() {} };`. - * * @param {Object} variable The variable to check. * @param {Object} scopeVar The scope variable to look for. * @returns {boolean} Whether or not the variable is inside initializer of scopeVar. @@ -139,7 +136,7 @@ module.exports = { /** * Checks the current context for shadowed variables. - * @param {Scope} scope - Fixme + * @param {Scope} scope Fixme * @returns {void} */ function checkForShadows(scope) { diff --git a/tools/node_modules/eslint/lib/rules/no-tabs.js b/tools/node_modules/eslint/lib/rules/no-tabs.js index 0c0a220110c609..3fc0b78b6e741c 100644 --- a/tools/node_modules/eslint/lib/rules/no-tabs.js +++ b/tools/node_modules/eslint/lib/rules/no-tabs.js @@ -55,8 +55,14 @@ module.exports = { context.report({ node, loc: { - line: index + 1, - column: match.index + start: { + line: index + 1, + column: match.index + }, + end: { + line: index + 1, + column: match.index + match[0].length + } }, message: "Unexpected tab character." }); diff --git a/tools/node_modules/eslint/lib/rules/no-this-before-super.js b/tools/node_modules/eslint/lib/rules/no-this-before-super.js index b271797240a5ec..6975ea060bf00d 100644 --- a/tools/node_modules/eslint/lib/rules/no-this-before-super.js +++ b/tools/node_modules/eslint/lib/rules/no-this-before-super.js @@ -17,7 +17,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is a constructor. - * @param {ASTNode} node - A node to check. This node type is one of + * @param {ASTNode} node A node to check. This node type is one of * `Program`, `FunctionDeclaration`, `FunctionExpression`, and * `ArrowFunctionExpression`. * @returns {boolean} `true` if the node is a constructor. @@ -71,7 +71,7 @@ module.exports = { /** * Gets whether or not `super()` is called in a given code path segment. - * @param {CodePathSegment} segment - A code path segment to get. + * @param {CodePathSegment} segment A code path segment to get. * @returns {boolean} `true` if `super()` is called. */ function isCalled(segment) { @@ -99,7 +99,7 @@ module.exports = { /** * Sets a given node as invalid. - * @param {ASTNode} node - A node to set as invalid. This is one of + * @param {ASTNode} node A node to set as invalid. This is one of * a ThisExpression and a Super. * @returns {void} */ @@ -135,8 +135,8 @@ module.exports = { /** * Adds information of a constructor into the stack. - * @param {CodePath} codePath - A code path which was started. - * @param {ASTNode} node - The current node. + * @param {CodePath} codePath A code path which was started. + * @param {ASTNode} node The current node. * @returns {void} */ onCodePathStart(codePath, node) { @@ -169,8 +169,7 @@ module.exports = { * * And this treverses all segments of this code path then reports every * invalid node. - * - * @param {CodePath} codePath - A code path which was ended. + * @param {CodePath} codePath A code path which was ended. * @returns {void} */ onCodePathEnd(codePath) { @@ -204,7 +203,7 @@ module.exports = { /** * Initialize information of a given code path segment. - * @param {CodePathSegment} segment - A code path segment to initialize. + * @param {CodePathSegment} segment A code path segment to initialize. * @returns {void} */ onCodePathSegmentStart(segment) { @@ -225,9 +224,9 @@ module.exports = { /** * Update information of the code path segment when a code path was * looped. - * @param {CodePathSegment} fromSegment - The code path segment of the + * @param {CodePathSegment} fromSegment The code path segment of the * end of a loop. - * @param {CodePathSegment} toSegment - A code path segment of the head + * @param {CodePathSegment} toSegment A code path segment of the head * of a loop. * @returns {void} */ @@ -258,7 +257,7 @@ module.exports = { /** * Reports if this is before `super()`. - * @param {ASTNode} node - A target node. + * @param {ASTNode} node A target node. * @returns {void} */ ThisExpression(node) { @@ -269,7 +268,7 @@ module.exports = { /** * Reports if this is before `super()`. - * @param {ASTNode} node - A target node. + * @param {ASTNode} node A target node. * @returns {void} */ Super(node) { @@ -280,7 +279,7 @@ module.exports = { /** * Marks `super()` called. - * @param {ASTNode} node - A target node. + * @param {ASTNode} node A target node. * @returns {void} */ "CallExpression:exit"(node) { 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 83c01d5e7e2bb3..3a4124f4c0f7a4 100644 --- a/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js +++ b/tools/node_modules/eslint/lib/rules/no-trailing-spaces.js @@ -90,7 +90,11 @@ module.exports = { const lines = new Set(); comments.forEach(comment => { - for (let i = comment.loc.start.line; i <= comment.loc.end.line; i++) { + const endLine = comment.type === "Block" + ? comment.loc.end.line - 1 + : comment.loc.end.line; + + for (let i = comment.loc.start.line; i <= endLine; i++) { lines.add(i); } }); @@ -122,7 +126,7 @@ module.exports = { fixRange = []; for (let i = 0, ii = lines.length; i < ii; i++) { - const matches = re.exec(lines[i]); + const lineNumber = i + 1; /* * Always add linebreak length to line length to accommodate for line break (\n or \r\n) @@ -132,14 +136,22 @@ module.exports = { const linebreakLength = linebreaks && linebreaks[i] ? linebreaks[i].length : 1; const lineLength = lines[i].length + linebreakLength; + const matches = re.exec(lines[i]); + if (matches) { const location = { - line: i + 1, - column: matches.index + start: { + line: lineNumber, + column: matches.index + }, + end: { + line: lineNumber, + column: lineLength - linebreakLength + } }; - const rangeStart = totalLength + location.column; - const rangeEnd = totalLength + lineLength - linebreakLength; + const rangeStart = totalLength + location.start.column; + const rangeEnd = totalLength + location.end.column; const containingNode = sourceCode.getNodeByRangeIndex(rangeStart); if (containingNode && containingNode.type === "TemplateElement" && @@ -160,7 +172,7 @@ module.exports = { fixRange = [rangeStart, rangeEnd]; - if (!ignoreComments || !commentLineNumbers.has(location.line)) { + if (!ignoreComments || !commentLineNumbers.has(lineNumber)) { report(node, location, fixRange); } } diff --git a/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js b/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js index 85292d136ec532..3b8e7417d5b586 100644 --- a/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +++ b/tools/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js @@ -35,8 +35,7 @@ const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/u; /** * Checks whether or not a given reference is a write reference. - * - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is a write reference. */ function isWriteReference(reference) { @@ -53,8 +52,7 @@ function isWriteReference(reference) { /** * Checks whether or not a given loop condition info does not have the modified * flag. - * - * @param {LoopConditionInfo} condition - A loop condition info to check. + * @param {LoopConditionInfo} condition A loop condition info to check. * @returns {boolean} `true` if the loop condition info is "unmodified". */ function isUnmodified(condition) { @@ -64,8 +62,7 @@ function isUnmodified(condition) { /** * Checks whether or not a given loop condition info does not have the modified * flag and does not have the group this condition belongs to. - * - * @param {LoopConditionInfo} condition - A loop condition info to check. + * @param {LoopConditionInfo} condition A loop condition info to check. * @returns {boolean} `true` if the loop condition info is "unmodified". */ function isUnmodifiedAndNotBelongToGroup(condition) { @@ -74,9 +71,8 @@ function isUnmodifiedAndNotBelongToGroup(condition) { /** * Checks whether or not a given reference is inside of a given node. - * - * @param {ASTNode} node - A node to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {ASTNode} node A node to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the node. */ function isInRange(node, reference) { @@ -88,9 +84,8 @@ function isInRange(node, reference) { /** * Checks whether or not a given reference is inside of a loop node's condition. - * - * @param {ASTNode} node - A node to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {ASTNode} node A node to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the loop node's * condition. */ @@ -108,8 +103,7 @@ const isInLoop = { /** * Gets the function which encloses a given reference. * This supports only FunctionDeclaration. - * - * @param {eslint-scope.Reference} reference - A reference to get. + * @param {eslint-scope.Reference} reference A reference to get. * @returns {ASTNode|null} The function node or null. */ function getEncloseFunctionDeclaration(reference) { @@ -128,9 +122,8 @@ function getEncloseFunctionDeclaration(reference) { /** * Updates the "modified" flags of given loop conditions with given modifiers. - * - * @param {LoopConditionInfo[]} conditions - The loop conditions to be updated. - * @param {eslint-scope.Reference[]} modifiers - The references to update. + * @param {LoopConditionInfo[]} conditions The loop conditions to be updated. + * @param {eslint-scope.Reference[]} modifiers The references to update. * @returns {void} */ function updateModifiedFlag(conditions, modifiers) { @@ -183,8 +176,7 @@ module.exports = { /** * Reports a given condition info. - * - * @param {LoopConditionInfo} condition - A loop condition info to report. + * @param {LoopConditionInfo} condition A loop condition info to report. * @returns {void} */ function report(condition) { @@ -199,8 +191,7 @@ module.exports = { /** * Registers given conditions to the group the condition belongs to. - * - * @param {LoopConditionInfo[]} conditions - A loop condition info to + * @param {LoopConditionInfo[]} conditions A loop condition info to * register. * @returns {void} */ @@ -222,8 +213,7 @@ module.exports = { /** * Reports references which are inside of unmodified groups. - * - * @param {LoopConditionInfo[]} conditions - A loop condition info to report. + * @param {LoopConditionInfo[]} conditions A loop condition info to report. * @returns {void} */ function checkConditionsInGroup(conditions) { @@ -234,8 +224,7 @@ module.exports = { /** * Checks whether or not a given group node has any dynamic elements. - * - * @param {ASTNode} root - A node to check. + * @param {ASTNode} root A node to check. * This node is one of BinaryExpression or ConditionalExpression. * @returns {boolean} `true` if the node is dynamic. */ @@ -259,8 +248,7 @@ module.exports = { /** * Creates the loop condition information from a given reference. - * - * @param {eslint-scope.Reference} reference - A reference to create. + * @param {eslint-scope.Reference} reference A reference to create. * @returns {LoopConditionInfo|null} Created loop condition info, or null. */ function toLoopCondition(reference) { @@ -313,8 +301,7 @@ module.exports = { /** * Finds unmodified references which are inside of a loop condition. * Then reports the references which are outside of groups. - * - * @param {eslint-scope.Variable} variable - A variable to report. + * @param {eslint-scope.Variable} variable A variable to report. * @returns {void} */ function checkReferences(variable) { 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 331c9ce94d7fad..893baa34f74917 100644 --- a/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js +++ b/tools/node_modules/eslint/lib/rules/no-unneeded-ternary.js @@ -57,7 +57,7 @@ module.exports = { /** * Test if the node is a boolean literal - * @param {ASTNode} node - The node to report. + * @param {ASTNode} node The node to report. * @returns {boolean} True if the its a boolean literal * @private */ @@ -91,7 +91,7 @@ module.exports = { /** * Tests if a given node always evaluates to a boolean value - * @param {ASTNode} node - An expression node + * @param {ASTNode} node An expression node * @returns {boolean} True if it is determined that the node will always evaluate to a boolean value */ function isBooleanExpression(node) { @@ -101,7 +101,7 @@ module.exports = { /** * Test if the node matches the pattern id ? id : expression - * @param {ASTNode} node - The ConditionalExpression to check. + * @param {ASTNode} node The ConditionalExpression to check. * @returns {boolean} True if the pattern is matched, and false otherwise * @private */ diff --git a/tools/node_modules/eslint/lib/rules/no-unreachable.js b/tools/node_modules/eslint/lib/rules/no-unreachable.js index 8ea2583f7cb251..91c4ca7150903f 100644 --- a/tools/node_modules/eslint/lib/rules/no-unreachable.js +++ b/tools/node_modules/eslint/lib/rules/no-unreachable.js @@ -10,7 +10,7 @@ /** * Checks whether or not a given variable declarator has the initializer. - * @param {ASTNode} node - A VariableDeclarator node to check. + * @param {ASTNode} node A VariableDeclarator node to check. * @returns {boolean} `true` if the node has the initializer. */ function isInitialized(node) { @@ -19,7 +19,7 @@ function isInitialized(node) { /** * Checks whether or not a given code path segment is unreachable. - * @param {CodePathSegment} segment - A CodePathSegment to check. + * @param {CodePathSegment} segment A CodePathSegment to check. * @returns {boolean} `true` if the segment is unreachable. */ function isUnreachable(segment) { @@ -57,7 +57,7 @@ class ConsecutiveRange { /** * Checks whether the given node is inside of this range. - * @param {ASTNode|Token} node - The node to check. + * @param {ASTNode|Token} node The node to check. * @returns {boolean} `true` if the node is inside of this range. */ contains(node) { @@ -69,7 +69,7 @@ class ConsecutiveRange { /** * Checks whether the given node is consecutive to this range. - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is consecutive to this range. */ isConsecutive(node) { @@ -78,7 +78,7 @@ class ConsecutiveRange { /** * Merges the given node to this range. - * @param {ASTNode} node - The node to merge. + * @param {ASTNode} node The node to merge. * @returns {void} */ merge(node) { @@ -87,7 +87,7 @@ class ConsecutiveRange { /** * Resets this range by the given node or null. - * @param {ASTNode|null} node - The node to reset, or null. + * @param {ASTNode|null} node The node to reset, or null. * @returns {void} */ reset(node) { @@ -120,7 +120,7 @@ module.exports = { /** * Reports a given node if it's unreachable. - * @param {ASTNode} node - A statement node to report. + * @param {ASTNode} node A statement node to report. * @returns {void} */ function reportIfUnreachable(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js b/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js index 4daa63b6929e30..a41dff9c80372f 100644 --- a/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js +++ b/tools/node_modules/eslint/lib/rules/no-unsafe-finally.js @@ -35,8 +35,7 @@ module.exports = { /** * Checks if the node is the finalizer of a TryStatement - * - * @param {ASTNode} node - node to check. + * @param {ASTNode} node node to check. * @returns {boolean} - true if the node is the finalizer of a TryStatement */ function isFinallyBlock(node) { @@ -45,9 +44,8 @@ module.exports = { /** * Climbs up the tree if the node is not a sentinel node - * - * @param {ASTNode} node - node to check. - * @param {string} label - label of the break or continue statement + * @param {ASTNode} node node to check. + * @param {string} label label of the break or continue statement * @returns {boolean} - return whether the node is a finally block or a sentinel node */ function isInFinallyBlock(node, label) { @@ -82,8 +80,7 @@ module.exports = { /** * Checks whether the possibly-unsafe statement is inside a finally block. - * - * @param {ASTNode} node - node to check. + * @param {ASTNode} node node to check. * @returns {void} */ function check(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js b/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js index 717e5f6be3977e..5c8f569d7b8a2d 100644 --- a/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js +++ b/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js @@ -16,19 +16,26 @@ const astUtils = require("./utils/ast-utils"); //------------------------------------------------------------------------------ /** - * Checks whether the given operator is a relational operator or not. - * - * @param {string} op - The operator type to check. - * @returns {boolean} `true` if the operator is a relational operator. + * Checks whether the given operator is `in` or `instanceof` + * @param {string} op The operator type to check. + * @returns {boolean} `true` if the operator is `in` or `instanceof` */ -function isRelationalOperator(op) { +function isInOrInstanceOfOperator(op) { return op === "in" || op === "instanceof"; } +/** + * Checks whether the given operator is an ordering relational operator or not. + * @param {string} op The operator type to check. + * @returns {boolean} `true` if the operator is an ordering relational operator. + */ +function isOrderingRelationalOperator(op) { + return op === "<" || op === ">" || op === ">=" || op === "<="; +} + /** * Checks whether the given node is a logical negation expression or not. - * - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is a logical negation expression. */ function isNegation(node) { @@ -50,7 +57,18 @@ module.exports = { url: "https://eslint.org/docs/rules/no-unsafe-negation" }, - schema: [], + schema: [ + { + type: "object", + properties: { + enforceForOrderingRelations: { + type: "boolean", + default: false + } + }, + additionalProperties: false + } + ], fixable: null, messages: { unexpected: "Unexpected negating the left operand of '{{operator}}' operator." @@ -59,10 +77,15 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); + const options = context.options[0] || {}; + const enforceForOrderingRelations = options.enforceForOrderingRelations === true; return { BinaryExpression(node) { - if (isRelationalOperator(node.operator) && + const orderingRelationRuleApplies = enforceForOrderingRelations && isOrderingRelationalOperator(node.operator); + + if ( + (isInOrInstanceOfOperator(node.operator) || orderingRelationRuleApplies) && isNegation(node.left) && !astUtils.isParenthesised(sourceCode, node.left) ) { 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 02cce309ee973a..fd0440256be016 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-expressions.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-expressions.js @@ -47,8 +47,9 @@ module.exports = { allowTernary = config.allowTernary || false, allowTaggedTemplates = config.allowTaggedTemplates || false; + // eslint-disable-next-line jsdoc/require-description /** - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ function looksLikeDirective(node) { @@ -56,9 +57,10 @@ module.exports = { node.expression.type === "Literal" && typeof node.expression.value === "string"; } + // eslint-disable-next-line jsdoc/require-description /** - * @param {Function} predicate - ([a] -> Boolean) the function used to make the determination - * @param {a[]} list - the input list + * @param {Function} predicate ([a] -> Boolean) the function used to make the determination + * @param {a[]} list the input list * @returns {a[]} the leading sequence of members in the given list that pass the given predicate */ function takeWhile(predicate, list) { @@ -70,17 +72,19 @@ module.exports = { return list.slice(); } + // eslint-disable-next-line jsdoc/require-description /** - * @param {ASTNode} node - a Program or BlockStatement node + * @param {ASTNode} node a Program or BlockStatement node * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body */ function directives(node) { return takeWhile(looksLikeDirective, node.body); } + // eslint-disable-next-line jsdoc/require-description /** - * @param {ASTNode} node - any node - * @param {ASTNode[]} ancestors - the given node's ancestors + * @param {ASTNode} node any node + * @param {ASTNode[]} ancestors the given node's ancestors * @returns {boolean} whether the given node is considered a directive in its current position */ function isDirective(node, ancestors) { @@ -94,7 +98,7 @@ module.exports = { /** * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags. - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node is a valid expression */ function isValidExpression(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-unused-labels.js b/tools/node_modules/eslint/lib/rules/no-unused-labels.js index 1ba1d05d5c6ae7..b33fcb786790c4 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-labels.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-labels.js @@ -35,8 +35,7 @@ module.exports = { /** * Adds a scope info to the stack. - * - * @param {ASTNode} node - A node to add. This is a LabeledStatement. + * @param {ASTNode} node A node to add. This is a LabeledStatement. * @returns {void} */ function enterLabeledScope(node) { @@ -50,8 +49,7 @@ module.exports = { /** * Removes the top of the stack. * At the same time, this reports the label if it's never used. - * - * @param {ASTNode} node - A node to report. This is a LabeledStatement. + * @param {ASTNode} node A node to report. This is a LabeledStatement. * @returns {void} */ function exitLabeledScope(node) { @@ -81,8 +79,7 @@ module.exports = { /** * Marks the label of a given node as used. - * - * @param {ASTNode} node - A node to mark. This is a BreakStatement or + * @param {ASTNode} node A node to mark. This is a BreakStatement or * ContinueStatement. * @returns {void} */ 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 8094de57c731fb..63e6e048ef1e46 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-vars.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-vars.js @@ -103,7 +103,7 @@ module.exports = { /** * Generate the warning message about the variable being * defined and unused, including the ignore pattern if configured. - * @param {Variable} unusedVar - eslint-scope variable object. + * @param {Variable} unusedVar eslint-scope variable object. * @returns {string} The warning message to be used with this unused variable. */ function getDefinedMessage(unusedVar) { @@ -146,7 +146,7 @@ module.exports = { /** * Determines if a given variable is being exported from a module. - * @param {Variable} variable - eslint-scope variable object. + * @param {Variable} variable eslint-scope variable object. * @returns {boolean} True if the variable is exported, false if not. * @private */ @@ -172,7 +172,7 @@ module.exports = { /** * Determines if a variable has a sibling rest property - * @param {Variable} variable - eslint-scope variable object. + * @param {Variable} variable eslint-scope variable object. * @returns {boolean} True if the variable is exported, false if not. * @private */ @@ -195,7 +195,7 @@ module.exports = { /** * Determines if a reference is a read operation. - * @param {Reference} ref - An eslint-scope Reference + * @param {Reference} ref An eslint-scope Reference * @returns {boolean} whether the given reference represents a read operation * @private */ @@ -205,8 +205,8 @@ module.exports = { /** * Determine if an identifier is referencing an enclosing function name. - * @param {Reference} ref - The reference to check. - * @param {ASTNode[]} nodes - The candidate function nodes. + * @param {Reference} ref The reference to check. + * @param {ASTNode[]} nodes The candidate function nodes. * @returns {boolean} True if it's a self-reference, false if not. * @private */ @@ -226,7 +226,7 @@ module.exports = { /** * Gets a list of function definitions for a specified variable. - * @param {Variable} variable - eslint-scope variable object. + * @param {Variable} variable eslint-scope variable object. * @returns {ASTNode[]} Function nodes. * @private */ @@ -252,9 +252,8 @@ module.exports = { /** * Checks the position of given nodes. - * - * @param {ASTNode} inner - A node which is expected as inside. - * @param {ASTNode} outer - A node which is expected as outside. + * @param {ASTNode} inner A node which is expected as inside. + * @param {ASTNode} outer A node which is expected as outside. * @returns {boolean} `true` if the `inner` node exists in the `outer` node. * @private */ @@ -275,9 +274,8 @@ module.exports = { * - The reference is inside of a loop. * - The reference is inside of a function scope which is different from * the declaration. - * - * @param {eslint-scope.Reference} ref - A reference to check. - * @param {ASTNode} prevRhsNode - The previous RHS node. + * @param {eslint-scope.Reference} ref A reference to check. + * @param {ASTNode} prevRhsNode The previous RHS node. * @returns {ASTNode|null} The RHS node or null. * @private */ @@ -310,9 +308,8 @@ module.exports = { /** * Checks whether a given function node is stored to somewhere or not. * If the function node is stored, the function can be used later. - * - * @param {ASTNode} funcNode - A function node to check. - * @param {ASTNode} rhsNode - The RHS node of the previous assignment. + * @param {ASTNode} funcNode A function node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. * @returns {boolean} `true` if under the following conditions: * - the funcNode is assigned to a variable. * - the funcNode is bound as an argument of a function call. @@ -367,9 +364,8 @@ module.exports = { * - the function is bound as an argument of a function call. * * If a reference exists in a function which can be used later, the reference is read when the function is called. - * - * @param {ASTNode} id - An Identifier node to check. - * @param {ASTNode} rhsNode - The RHS node of the previous assignment. + * @param {ASTNode} id An Identifier node to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. * @returns {boolean} `true` if the `id` node exists inside of a function node which can be used later. * @private */ @@ -385,9 +381,8 @@ module.exports = { /** * Checks whether a given reference is a read to update itself or not. - * - * @param {eslint-scope.Reference} ref - A reference to check. - * @param {ASTNode} rhsNode - The RHS node of the previous assignment. + * @param {eslint-scope.Reference} ref A reference to check. + * @param {ASTNode} rhsNode The RHS node of the previous assignment. * @returns {boolean} The reference is a read to update itself. * @private */ @@ -416,8 +411,7 @@ module.exports = { /** * Determine if an identifier is used either in for-in loops. - * - * @param {Reference} ref - The reference to check. + * @param {Reference} ref The reference to check. * @returns {boolean} whether reference is used in the for-in loops * @private */ @@ -453,7 +447,7 @@ module.exports = { /** * Determines if the variable is used. - * @param {Variable} variable - The variable to check. + * @param {Variable} variable The variable to check. * @returns {boolean} True if the variable is used * @private */ @@ -481,8 +475,7 @@ module.exports = { /** * Checks whether the given variable is after the last used parameter. - * - * @param {eslint-scope.Variable} variable - The variable to check. + * @param {eslint-scope.Variable} variable The variable to check. * @returns {boolean} `true` if the variable is defined after the last * used parameter. */ @@ -497,8 +490,8 @@ module.exports = { /** * Gets an array of variables without read references. - * @param {Scope} scope - an eslint-scope Scope object. - * @param {Variable[]} unusedVars - an array that saving result. + * @param {Scope} scope an eslint-scope Scope object. + * @param {Variable[]} unusedVars an array that saving result. * @returns {Variable[]} unused variables of the scope and descendant scopes. * @private */ 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 a98f6c87ff8c98..ed3540532f9095 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 @@ -14,8 +14,7 @@ const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u; /** * Parses a given value as options. - * - * @param {any} options - A value to parse. + * @param {any} options A value to parse. * @returns {Object} The parsed options. */ function parseOptions(options) { @@ -36,8 +35,7 @@ function parseOptions(options) { /** * Checks whether or not a given variable is a function declaration. - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is a function declaration. */ function isFunction(variable) { @@ -46,9 +44,8 @@ function isFunction(variable) { /** * Checks whether or not a given variable is a class declaration in an upper function scope. - * - * @param {eslint-scope.Variable} variable - A variable to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Variable} variable A variable to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the variable is a class declaration. */ function isOuterClass(variable, reference) { @@ -60,8 +57,8 @@ function isOuterClass(variable, reference) { /** * Checks whether or not a given variable is a variable declaration in an upper function scope. - * @param {eslint-scope.Variable} variable - A variable to check. - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Variable} variable A variable to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the variable is a variable declaration. */ function isOuterVariable(variable, reference) { @@ -73,9 +70,8 @@ function isOuterVariable(variable, reference) { /** * Checks whether or not a given location is inside of the range of a given node. - * - * @param {ASTNode} node - An node to check. - * @param {number} location - A location to check. + * @param {ASTNode} node An node to check. + * @param {number} location A location to check. * @returns {boolean} `true` if the location is inside of the range of the node. */ function isInRange(node, location) { @@ -92,9 +88,8 @@ function isInRange(node, location) { * var {a = a} = obj * for (var a in a) {} * for (var a of a) {} - * - * @param {Variable} variable - A variable to check. - * @param {Reference} reference - A reference to check. + * @param {Variable} variable A variable to check. + * @param {Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the initializers. */ function isInInitializer(variable, reference) { diff --git a/tools/node_modules/eslint/lib/rules/no-useless-call.js b/tools/node_modules/eslint/lib/rules/no-useless-call.js index d08b9cb8cb7bb5..11cf524d124211 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-call.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-call.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a node is a `.call()`/`.apply()`. - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {boolean} Whether or not the node is a `.call()`/`.apply()`. */ function isCallOrNonVariadicApply(node) { @@ -31,9 +31,9 @@ function isCallOrNonVariadicApply(node) { /** * Checks whether or not `thisArg` is not changed by `.call()`/`.apply()`. - * @param {ASTNode|null} expectedThis - The node that is the owner of the applied function. - * @param {ASTNode} thisArg - The node that is given to the first argument of the `.call()`/`.apply()`. - * @param {SourceCode} sourceCode - The ESLint source code object. + * @param {ASTNode|null} expectedThis The node that is the owner of the applied function. + * @param {ASTNode} thisArg The node that is given to the first argument of the `.call()`/`.apply()`. + * @param {SourceCode} sourceCode The ESLint source code object. * @returns {boolean} Whether or not `thisArg` is not changed by `.call()`/`.apply()`. */ function isValidThisArg(expectedThis, thisArg, sourceCode) { diff --git a/tools/node_modules/eslint/lib/rules/no-useless-concat.js b/tools/node_modules/eslint/lib/rules/no-useless-concat.js index d26003f1e4f4a0..cdaca273eb003f 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-concat.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-concat.js @@ -16,7 +16,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is a concatenation. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a concatenation. */ function isConcatenation(node) { @@ -25,7 +25,7 @@ function isConcatenation(node) { /** * Checks if the given token is a `+` token or not. - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a `+` token. */ function isConcatOperatorToken(token) { @@ -34,7 +34,7 @@ function isConcatOperatorToken(token) { /** * Get's the right most node on the left side of a BinaryExpression with + operator. - * @param {ASTNode} node - A BinaryExpression node to check. + * @param {ASTNode} node A BinaryExpression node to check. * @returns {ASTNode} node */ function getLeft(node) { @@ -48,7 +48,7 @@ function getLeft(node) { /** * Get's the left most node on the right side of a BinaryExpression with + operator. - * @param {ASTNode} node - A BinaryExpression node to check. + * @param {ASTNode} node A BinaryExpression node to check. * @returns {ASTNode} node */ function getRight(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-useless-constructor.js b/tools/node_modules/eslint/lib/rules/no-useless-constructor.js index c10376450eb5b5..7cf033805f99d9 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-constructor.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-constructor.js @@ -10,8 +10,7 @@ /** * Checks whether a given array of statements is a single call of `super`. - * - * @param {ASTNode[]} body - An array of statements to check. + * @param {ASTNode[]} body An array of statements to check. * @returns {boolean} `true` if the body is a single call of `super`. */ function isSingleSuperCall(body) { @@ -26,8 +25,7 @@ function isSingleSuperCall(body) { /** * Checks whether a given node is a pattern which doesn't have any side effects. * Default parameters and Destructuring parameters can have side effects. - * - * @param {ASTNode} node - A pattern node. + * @param {ASTNode} node A pattern node. * @returns {boolean} `true` if the node doesn't have any side effects. */ function isSimple(node) { @@ -37,8 +35,7 @@ function isSimple(node) { /** * Checks whether a given array of expressions is `...arguments` or not. * `super(...arguments)` passes all arguments through. - * - * @param {ASTNode[]} superArgs - An array of expressions to check. + * @param {ASTNode[]} superArgs An array of expressions to check. * @returns {boolean} `true` if the superArgs is `...arguments`. */ function isSpreadArguments(superArgs) { @@ -52,9 +49,8 @@ function isSpreadArguments(superArgs) { /** * Checks whether given 2 nodes are identifiers which have the same name or not. - * - * @param {ASTNode} ctorParam - A node to check. - * @param {ASTNode} superArg - A node to check. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. * @returns {boolean} `true` if the nodes are identifiers which have the same * name. */ @@ -68,9 +64,8 @@ function isValidIdentifierPair(ctorParam, superArg) { /** * Checks whether given 2 nodes are a rest/spread pair which has the same values. - * - * @param {ASTNode} ctorParam - A node to check. - * @param {ASTNode} superArg - A node to check. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. * @returns {boolean} `true` if the nodes are a rest/spread pair which has the * same values. */ @@ -84,9 +79,8 @@ function isValidRestSpreadPair(ctorParam, superArg) { /** * Checks whether given 2 nodes have the same value or not. - * - * @param {ASTNode} ctorParam - A node to check. - * @param {ASTNode} superArg - A node to check. + * @param {ASTNode} ctorParam A node to check. + * @param {ASTNode} superArg A node to check. * @returns {boolean} `true` if the nodes have the same value or not. */ function isValidPair(ctorParam, superArg) { @@ -99,9 +93,8 @@ function isValidPair(ctorParam, superArg) { /** * Checks whether the parameters of a constructor and the arguments of `super()` * have the same values or not. - * - * @param {ASTNode} ctorParams - The parameters of a constructor to check. - * @param {ASTNode} superArgs - The arguments of `super()` to check. + * @param {ASTNode} ctorParams The parameters of a constructor to check. + * @param {ASTNode} superArgs The arguments of `super()` to check. * @returns {boolean} `true` if those have the same values. */ function isPassingThrough(ctorParams, superArgs) { @@ -120,9 +113,8 @@ function isPassingThrough(ctorParams, superArgs) { /** * Checks whether the constructor body is a redundant super call. - * - * @param {Array} body - constructor body content. - * @param {Array} ctorParams - The params to check against super call. + * @param {Array} body constructor body content. + * @param {Array} ctorParams The params to check against super call. * @returns {boolean} true if the construtor body is redundant */ function isRedundantSuperCall(body, ctorParams) { @@ -158,7 +150,7 @@ module.exports = { /** * Checks whether a node is a redundant constructor - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkForConstructor(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-useless-escape.js b/tools/node_modules/eslint/lib/rules/no-useless-escape.js index e161e4acedf270..ebfe4cba38a9a7 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-escape.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-escape.js @@ -117,10 +117,9 @@ module.exports = { /** * Checks if the escape character in given string slice is unnecessary. - * * @private - * @param {ASTNode} node - node to validate. - * @param {string} match - string slice to validate. + * @param {ASTNode} node node to validate. + * @param {string} match string slice to validate. * @returns {void} */ function validateString(node, match) { @@ -156,8 +155,7 @@ module.exports = { /** * Checks if a node has an escape. - * - * @param {ASTNode} node - node to check. + * @param {ASTNode} node node to check. * @returns {void} */ function check(node) { 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 f31459bd8ae281..eb570a3ef5c1d3 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-rename.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-rename.js @@ -48,10 +48,10 @@ module.exports = { /** * Reports error for unnecessarily renamed assignments - * @param {ASTNode} node - node to report - * @param {ASTNode} initial - node with initial name value - * @param {ASTNode} result - node with new name value - * @param {string} type - the type of the offending node + * @param {ASTNode} node node to report + * @param {ASTNode} initial node with initial name value + * @param {ASTNode} result node with new name value + * @param {string} type the type of the offending node * @returns {void} */ function reportError(node, initial, result, type) { @@ -83,7 +83,7 @@ module.exports = { /** * Checks whether a destructured assignment is unnecessarily renamed - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkDestructured(node) { @@ -120,7 +120,7 @@ module.exports = { /** * Checks whether an import is unnecessarily renamed - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkImport(node) { @@ -136,7 +136,7 @@ module.exports = { /** * Checks whether an export is unnecessarily renamed - * @param {ASTNode} node - node to check + * @param {ASTNode} node node to check * @returns {void} */ function checkExport(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-useless-return.js b/tools/node_modules/eslint/lib/rules/no-useless-return.js index 7b12e85091c644..942d4eede9964e 100644 --- a/tools/node_modules/eslint/lib/rules/no-useless-return.js +++ b/tools/node_modules/eslint/lib/rules/no-useless-return.js @@ -17,9 +17,8 @@ const astUtils = require("./utils/ast-utils"), /** * Removes the given element from the array. - * - * @param {Array} array - The source array to remove. - * @param {any} element - The target item to remove. + * @param {Array} array The source array to remove. + * @param {any} element The target item to remove. * @returns {void} */ function remove(array, element) { @@ -32,8 +31,7 @@ function remove(array, element) { /** * Checks whether it can remove the given return statement or not. - * - * @param {ASTNode} node - The return statement node to check. + * @param {ASTNode} node The return statement node to check. * @returns {boolean} `true` if the node is removeable. */ function isRemovable(node) { @@ -42,8 +40,7 @@ function isRemovable(node) { /** * Checks whether the given return statement is in a `finally` block or not. - * - * @param {ASTNode} node - The return statement node to check. + * @param {ASTNode} node The return statement node to check. * @returns {boolean} `true` if the node is in a `finally` block. */ function isInFinally(node) { @@ -87,8 +84,7 @@ module.exports = { /** * Checks whether the given segment is terminated by a return statement or not. - * - * @param {CodePathSegment} segment - The segment to check. + * @param {CodePathSegment} segment The segment to check. * @returns {boolean} `true` if the segment is terminated by a return statement, or if it's still a part of unreachable. */ function isReturned(segment) { @@ -110,9 +106,8 @@ module.exports = { * * This behavior would simulate code paths for the case that the return * statement does not exist. - * - * @param {ASTNode[]} uselessReturns - The collected return statements. - * @param {CodePathSegment[]} prevSegments - The previous segments to traverse. + * @param {ASTNode[]} uselessReturns The collected return statements. + * @param {CodePathSegment[]} prevSegments The previous segments to traverse. * @param {WeakSet} [providedTraversedSegments] A set of segments that have already been traversed in this call * @returns {ASTNode[]} `uselessReturns`. */ @@ -152,8 +147,7 @@ module.exports = { * * This behavior would simulate code paths for the case that the return * statement does not exist. - * - * @param {CodePathSegment} segment - The segment to get return statements. + * @param {CodePathSegment} segment The segment to get return statements. * @returns {void} */ function markReturnStatementsOnSegmentAsUsed(segment) { @@ -184,7 +178,6 @@ module.exports = { * - FunctionDeclarations are always executed whether it's returned or not. * - BlockStatements do nothing. * - BreakStatements go the next merely. - * * @returns {void} */ function markReturnStatementsOnCurrentSegmentsAsUsed() { diff --git a/tools/node_modules/eslint/lib/rules/no-var.js b/tools/node_modules/eslint/lib/rules/no-var.js index a3c750f9011bb7..74203f8bf3bebf 100644 --- a/tools/node_modules/eslint/lib/rules/no-var.js +++ b/tools/node_modules/eslint/lib/rules/no-var.js @@ -27,8 +27,7 @@ function isGlobal(variable) { /** * Finds the nearest function scope or global scope walking up the scope * hierarchy. - * - * @param {eslint-scope.Scope} scope - The scope to traverse. + * @param {eslint-scope.Scope} scope The scope to traverse. * @returns {eslint-scope.Scope} a function scope or global scope containing the given * scope. */ @@ -44,8 +43,7 @@ function getEnclosingFunctionScope(scope) { /** * Checks whether the given variable has any references from a more specific * function expression (i.e. a closure). - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is used from a closure. */ function isReferencedInClosure(variable) { @@ -57,8 +55,7 @@ function isReferencedInClosure(variable) { /** * Checks whether the given node is the assignee of a loop. - * - * @param {ASTNode} node - A VariableDeclaration node to check. + * @param {ASTNode} node A VariableDeclaration node to check. * @returns {boolean} `true` if the declaration is assigned as part of loop * iteration. */ @@ -69,8 +66,7 @@ function isLoopAssignee(node) { /** * Checks whether the given variable declaration is immediately initialized. - * - * @param {ASTNode} node - A VariableDeclaration node to check. + * @param {ASTNode} node A VariableDeclaration node to check. * @returns {boolean} `true` if the declaration has an initializer. */ function isDeclarationInitialized(node) { @@ -81,8 +77,7 @@ const SCOPE_NODE_TYPE = /^(?:Program|BlockStatement|SwitchStatement|ForStatement /** * Gets the scope node which directly contains a given node. - * - * @param {ASTNode} node - A node to get. This is a `VariableDeclaration` or + * @param {ASTNode} node A node to get. This is a `VariableDeclaration` or * an `Identifier`. * @returns {ASTNode} A scope node. This is one of `Program`, `BlockStatement`, * `SwitchStatement`, `ForStatement`, `ForInStatement`, and @@ -101,8 +96,7 @@ function getScopeNode(node) { /** * Checks whether a given variable is redeclared or not. - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is redeclared. */ function isRedeclared(variable) { @@ -111,8 +105,7 @@ function isRedeclared(variable) { /** * Checks whether a given variable is used from outside of the specified scope. - * - * @param {ASTNode} scopeNode - A scope node to check. + * @param {ASTNode} scopeNode A scope node to check. * @returns {Function} The predicate function which checks whether a given * variable is used from outside of the specified scope. */ @@ -120,8 +113,7 @@ function isUsedFromOutsideOf(scopeNode) { /** * Checks whether a given reference is inside of the specified scope or not. - * - * @param {eslint-scope.Reference} reference - A reference to check. + * @param {eslint-scope.Reference} reference A reference to check. * @returns {boolean} `true` if the reference is inside of the specified * scope. */ @@ -145,8 +137,7 @@ function isUsedFromOutsideOf(scopeNode) { * - if a reference is before the declarator. E.g. (var a = b, b = 1;)(var {a = b, b} = {};) * - if a reference is in the expression of their default value. E.g. (var {a = a} = {};) * - if a reference is in the expression of their initializer. E.g. (var a = a;) - * - * @param {ASTNode} node - The initializer node of VariableDeclarator. + * @param {ASTNode} node The initializer node of VariableDeclarator. * @returns {Function} The predicate function. * @private */ @@ -177,7 +168,6 @@ function hasReferenceInTDZ(node) { /** * Checks whether a given variable has name that is allowed for 'var' declarations, * but disallowed for `let` declarations. - * * @param {eslint-scope.Variable} variable The variable to check. * @returns {boolean} `true` if the variable has a disallowed name. */ @@ -209,8 +199,7 @@ module.exports = { /** * Checks whether the variables which are defined by the given declarator node have their references in TDZ. - * - * @param {ASTNode} declarator - The VariableDeclarator node to check. + * @param {ASTNode} declarator The VariableDeclarator node to check. * @returns {boolean} `true` if one of the variables which are defined by the given declarator node have their references in TDZ. */ function hasSelfReferenceInTDZ(declarator) { @@ -271,8 +260,7 @@ module.exports = { * the implementation simple, we only convert `var` to `let` within * loops when the variable is a loop assignee or the declaration has an * initializer. - * - * @param {ASTNode} node - A variable declaration node to check. + * @param {ASTNode} node A variable declaration node to check. * @returns {boolean} `true` if it can fix the node. */ function canFix(node) { @@ -313,8 +301,7 @@ module.exports = { /** * Reports a given variable declaration node. - * - * @param {ASTNode} node - A variable declaration node to report. + * @param {ASTNode} node A variable declaration node to report. * @returns {void} */ function report(node) { diff --git a/tools/node_modules/eslint/lib/rules/no-warning-comments.js b/tools/node_modules/eslint/lib/rules/no-warning-comments.js index 5a8e0bc7ec221c..a400c446767ff7 100644 --- a/tools/node_modules/eslint/lib/rules/no-warning-comments.js +++ b/tools/node_modules/eslint/lib/rules/no-warning-comments.js @@ -54,7 +54,6 @@ module.exports = { * Convert a warning term into a RegExp which will match a comment containing that whole word in the specified * location ("start" or "anywhere"). If the term starts or ends with non word characters, then the match will not * require word boundaries on that side. - * * @param {string} term A term to convert to a RegExp * @returns {RegExp} The term converted to a RegExp */ diff --git a/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js b/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js index 83ff801b2b8a83..9541401a3176b7 100644 --- a/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js +++ b/tools/node_modules/eslint/lib/rules/no-whitespace-before-property.js @@ -38,9 +38,9 @@ module.exports = { /** * Reports whitespace before property token - * @param {ASTNode} node - the node to report in the event of an error - * @param {Token} leftToken - the left token - * @param {Token} rightToken - the right token + * @param {ASTNode} node the node to report in the event of an error + * @param {Token} leftToken the left token + * @param {Token} rightToken the right token * @returns {void} * @private */ 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 be9ae23a6f4d40..e870a69a954180 100644 --- a/tools/node_modules/eslint/lib/rules/object-curly-newline.js +++ b/tools/node_modules/eslint/lib/rules/object-curly-newline.js @@ -44,8 +44,7 @@ const OPTION_VALUE = { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} value - An option value to parse. + * @param {string|Object|undefined} value An option value to parse. * @returns {{multiline: boolean, minProperties: number, consistent: boolean}} Normalized option object. */ function normalizeOptionValue(value) { @@ -72,8 +71,7 @@ function normalizeOptionValue(value) { /** * Normalizes a given option value. - * - * @param {string|Object|undefined} options - An option value to parse. + * @param {string|Object|undefined} options An option value to parse. * @returns {{ * ObjectExpression: {multiline: boolean, minProperties: number, consistent: boolean}, * ObjectPattern: {multiline: boolean, minProperties: number, consistent: boolean}, @@ -101,11 +99,10 @@ function normalizeOptions(options) { /** * Determines if ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration * node needs to be checked for missing line breaks - * - * @param {ASTNode} node - Node under inspection - * @param {Object} options - option specific to node type - * @param {Token} first - First object property - * @param {Token} last - Last object property + * @param {ASTNode} node Node under inspection + * @param {Object} options option specific to node type + * @param {Token} first First object property + * @param {Token} last Last object property * @returns {boolean} `true` if node needs to be checked for missing line breaks */ function areLineBreaksRequired(node, options, first, last) { @@ -171,7 +168,7 @@ module.exports = { /** * Reports a given node if it violated this rule. - * @param {ASTNode} node - A node to check. This is an ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration node. + * @param {ASTNode} node A node to check. This is an ObjectExpression, ObjectPattern, ImportDeclaration or ExportNamedDeclaration node. * @returns {void} */ function check(node) { diff --git a/tools/node_modules/eslint/lib/rules/object-curly-spacing.js b/tools/node_modules/eslint/lib/rules/object-curly-spacing.js index 48a7dd953b7e72..53ddaaa24ad01e 100644 --- a/tools/node_modules/eslint/lib/rules/object-curly-spacing.js +++ b/tools/node_modules/eslint/lib/rules/object-curly-spacing.js @@ -50,7 +50,7 @@ module.exports = { * Determines whether an option is set, relative to the spacing option. * If spaced is "always", then check whether option is set to false. * If spaced is "never", then check whether option is set to true. - * @param {Object} option - The option to exclude. + * @param {Object} option The option to exclude. * @returns {boolean} Whether or not the property is excluded. */ function isOptionSet(option) { @@ -69,8 +69,8 @@ module.exports = { /** * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoBeginningSpace(node, token) { @@ -91,8 +91,8 @@ module.exports = { /** * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportNoEndingSpace(node, token) { @@ -113,8 +113,8 @@ module.exports = { /** * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredBeginningSpace(node, token) { @@ -133,8 +133,8 @@ module.exports = { /** * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. + * @param {ASTNode} node The node to report in the event of an error. + * @param {Token} token The token to use for the report. * @returns {void} */ function reportRequiredEndingSpace(node, token) { @@ -201,8 +201,7 @@ module.exports = { * Because the last token of object patterns might be a type annotation, * this traverses tokens preceded by the last property, then returns the * first '}' token. - * - * @param {ASTNode} node - The node to get. This node is an + * @param {ASTNode} node The node to get. This node is an * ObjectExpression or an ObjectPattern. And this node has one or * more properties. * @returns {Token} '}' token. @@ -215,7 +214,7 @@ module.exports = { /** * Reports a given object node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ObjectExpression or ObjectPattern node to check. + * @param {ASTNode} node An ObjectExpression or ObjectPattern node to check. * @returns {void} */ function checkForObject(node) { @@ -233,7 +232,7 @@ module.exports = { /** * Reports a given import node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ImportDeclaration node to check. + * @param {ASTNode} node An ImportDeclaration node to check. * @returns {void} */ function checkForImport(node) { @@ -261,7 +260,7 @@ module.exports = { /** * Reports a given export node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ExportNamedDeclaration node to check. + * @param {ASTNode} node An ExportNamedDeclaration node to check. * @returns {void} */ function checkForExport(node) { diff --git a/tools/node_modules/eslint/lib/rules/object-shorthand.js b/tools/node_modules/eslint/lib/rules/object-shorthand.js index df302b5e8728c8..d4afd09c5a52c4 100644 --- a/tools/node_modules/eslint/lib/rules/object-shorthand.js +++ b/tools/node_modules/eslint/lib/rules/object-shorthand.js @@ -147,7 +147,7 @@ module.exports = { /** * Checks whether a node is a string literal. - * @param {ASTNode} node - Any AST node. + * @param {ASTNode} node Any AST node. * @returns {boolean} `true` if it is a string literal. */ function isStringLiteral(node) { diff --git a/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js b/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js index e7e40d66c0ced4..b64656eefed0a9 100644 --- a/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +++ b/tools/node_modules/eslint/lib/rules/one-var-declaration-per-line.js @@ -41,7 +41,7 @@ module.exports = { /** * Determine if provided keyword is a variant of for specifiers * @private - * @param {string} keyword - keyword to test + * @param {string} keyword keyword to test * @returns {boolean} True if `keyword` is a variant of for specifier */ function isForTypeSpecifier(keyword) { @@ -51,7 +51,7 @@ module.exports = { /** * Checks newlines around variable declarations. * @private - * @param {ASTNode} node - `VariableDeclaration` node to test + * @param {ASTNode} node `VariableDeclaration` node to test * @returns {void} */ function checkForNewLine(node) { diff --git a/tools/node_modules/eslint/lib/rules/operator-assignment.js b/tools/node_modules/eslint/lib/rules/operator-assignment.js index 63982cf39202fa..e294668b42b1ce 100644 --- a/tools/node_modules/eslint/lib/rules/operator-assignment.js +++ b/tools/node_modules/eslint/lib/rules/operator-assignment.js @@ -150,6 +150,11 @@ module.exports = { const leftText = sourceCode.getText().slice(node.range[0], equalsToken.range[0]); const rightText = sourceCode.getText().slice(operatorToken.range[1], node.right.range[1]); + // Check for comments that would be removed. + if (sourceCode.commentsExistBetween(equalsToken, operatorToken)) { + return null; + } + return fixer.replaceText(node, `${leftText}${expr.operator}=${rightText}`); } return null; @@ -182,11 +187,17 @@ module.exports = { messageId: "unexpected", fix(fixer) { if (canBeFixed(node.left)) { + const firstToken = sourceCode.getFirstToken(node); const operatorToken = getOperatorToken(node); const leftText = sourceCode.getText().slice(node.range[0], operatorToken.range[0]); const newOperator = node.operator.slice(0, -1); let rightText; + // Check for comments that would be duplicated. + if (sourceCode.commentsExistBetween(firstToken, operatorToken)) { + return null; + } + // If this change would modify precedence (e.g. `foo *= bar + 1` => `foo = foo * (bar + 1)`), parenthesize the right side. if ( astUtils.getPrecedence(node.right) <= astUtils.getPrecedence({ type: "BinaryExpression", operator: newOperator }) && @@ -194,7 +205,17 @@ module.exports = { ) { rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`; } else { - rightText = sourceCode.text.slice(operatorToken.range[1], node.range[1]); + const firstRightToken = sourceCode.getFirstToken(node.right); + let rightTextPrefix = ""; + + if ( + operatorToken.range[1] === firstRightToken.range[0] && + !astUtils.canTokensBeAdjacent(newOperator, firstRightToken) + ) { + rightTextPrefix = " "; // foo+=+bar -> foo= foo+ +bar + } + + rightText = `${rightTextPrefix}${sourceCode.text.slice(operatorToken.range[1], node.range[1])}`; } return fixer.replaceText(node, `${leftText}= ${leftText}${newOperator}${rightText}`); diff --git a/tools/node_modules/eslint/lib/rules/padded-blocks.js b/tools/node_modules/eslint/lib/rules/padded-blocks.js index d5bd5499c6e167..dafa88115edd78 100644 --- a/tools/node_modules/eslint/lib/rules/padded-blocks.js +++ b/tools/node_modules/eslint/lib/rules/padded-blocks.js @@ -97,7 +97,7 @@ module.exports = { /** * Gets the open brace token from a given node. - * @param {ASTNode} node - A BlockStatement or SwitchStatement node from which to get the open brace. + * @param {ASTNode} node A BlockStatement or SwitchStatement node from which to get the open brace. * @returns {Token} The token of the open brace. */ function getOpenBrace(node) { diff --git a/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js b/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js index d98cb1f247fbb7..350a9dbf2aba15 100644 --- a/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js +++ b/tools/node_modules/eslint/lib/rules/padding-line-between-statements.js @@ -25,7 +25,6 @@ const CJS_IMPORT = /^require\(/u; /** * Creates tester which check if a node starts with specific keyword. - * * @param {string} keyword The keyword to test. * @returns {Object} the created tester. * @private @@ -39,7 +38,6 @@ function newKeywordTester(keyword) { /** * Creates tester which check if a node starts with specific keyword and spans a single line. - * * @param {string} keyword The keyword to test. * @returns {Object} the created tester. * @private @@ -54,7 +52,6 @@ function newSinglelineKeywordTester(keyword) { /** * Creates tester which check if a node starts with specific keyword and spans multiple lines. - * * @param {string} keyword The keyword to test. * @returns {Object} the created tester. * @private @@ -69,7 +66,6 @@ function newMultilineKeywordTester(keyword) { /** * Creates tester which check if a node is specific type. - * * @param {string} type The node type to test. * @returns {Object} the created tester. * @private @@ -83,7 +79,6 @@ function newNodeTypeTester(type) { /** * Checks the given node is an expression statement of IIFE. - * * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is an expression statement of IIFE. * @private @@ -103,7 +98,6 @@ function isIIFEStatement(node) { /** * Checks whether the given node is a block-like statement. * This checks the last token of the node is the closing brace of a block. - * * @param {SourceCode} sourceCode The source code to get tokens. * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is a block-like statement. @@ -187,7 +181,6 @@ function isDirectivePrologue(node, sourceCode) { * * foo() * ;[1, 2, 3].forEach(bar) - * * @param {SourceCode} sourceCode The source code to get tokens. * @param {ASTNode} node The node to get. * @returns {Token} The actual last token. @@ -224,7 +217,6 @@ function replacerToRemovePaddingLines(_, trailingSpaces, indentSpaces) { /** * Check and report statements for `any` configuration. * It does nothing. - * * @returns {void} * @private */ @@ -236,7 +228,6 @@ function verifyForAny() { * This autofix removes blank lines between the given 2 statements. * However, if comments exist between 2 blank lines, it does not remove those * blank lines automatically. - * * @param {RuleContext} context The rule context to report. * @param {ASTNode} _ Unused. The previous node to check. * @param {ASTNode} nextNode The next node to check. @@ -276,7 +267,6 @@ function verifyForNever(context, _, nextNode, paddingLines) { * This autofix inserts a blank line between the given 2 statements. * If the `prevNode` has trailing comments, it inserts a blank line after the * trailing comments. - * * @param {RuleContext} context The rule context to report. * @param {ASTNode} prevNode The previous node to check. * @param {ASTNode} nextNode The next node to check. @@ -318,7 +308,6 @@ function verifyForAlways(context, prevNode, nextNode, paddingLines) { * * // comment. * bar(); - * * @param {Token} token The token to check. * @returns {boolean} `true` if the token is not a trailing comment. * @private @@ -511,7 +500,6 @@ module.exports = { /** * Checks whether the given node matches the given type. - * * @param {ASTNode} node The statement node to check. * @param {string|string[]} type The statement type to check. * @returns {boolean} `true` if the statement node matched the type. @@ -531,7 +519,6 @@ module.exports = { /** * Finds the last matched configure from configureList. - * * @param {ASTNode} prevNode The previous statement to match. * @param {ASTNode} nextNode The current statement to match. * @returns {Object} The tester of the last matched configure. @@ -554,7 +541,6 @@ module.exports = { /** * Gets padding line sequences between the given 2 statements. * Comments are separators of the padding line sequences. - * * @param {ASTNode} prevNode The previous statement to count. * @param {ASTNode} nextNode The current statement to count. * @returns {Array} The array of token pairs. @@ -584,7 +570,6 @@ module.exports = { /** * Verify padding lines between the given node and the previous node. - * * @param {ASTNode} node The node to verify. * @returns {void} * @private @@ -616,7 +601,6 @@ module.exports = { /** * Verify padding lines between the given node and the previous node. * Then process to enter to new scope. - * * @param {ASTNode} node The node to verify. * @returns {void} * @private 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 a0957399ea5ad1..08126e5b1a5459 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js +++ b/tools/node_modules/eslint/lib/rules/prefer-arrow-callback.js @@ -11,7 +11,7 @@ /** * Checks whether or not a given variable is a function name. - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is a function name. */ function isFunctionName(variable) { @@ -20,9 +20,9 @@ function isFunctionName(variable) { /** * Checks whether or not a given MetaProperty node equals to a given value. - * @param {ASTNode} node - A MetaProperty node to check. - * @param {string} metaName - The name of `MetaProperty.meta`. - * @param {string} propertyName - The name of `MetaProperty.property`. + * @param {ASTNode} node A MetaProperty node to check. + * @param {string} metaName The name of `MetaProperty.meta`. + * @param {string} propertyName The name of `MetaProperty.property`. * @returns {boolean} `true` if the node is the specific value. */ function checkMetaProperty(node, metaName, propertyName) { @@ -31,7 +31,7 @@ function checkMetaProperty(node, metaName, propertyName) { /** * Gets the variable object of `arguments` which is defined implicitly. - * @param {eslint-scope.Scope} scope - A scope to get. + * @param {eslint-scope.Scope} scope A scope to get. * @returns {eslint-scope.Variable} The found variable object. */ function getVariableOfArguments(scope) { @@ -57,7 +57,7 @@ function getVariableOfArguments(scope) { /** * Checkes whether or not a given node is a callback. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {Object} * {boolean} retv.isCallback - `true` if the node is a callback. * {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`. diff --git a/tools/node_modules/eslint/lib/rules/prefer-const.js b/tools/node_modules/eslint/lib/rules/prefer-const.js index 854da310e4be72..87f83892126d50 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-const.js +++ b/tools/node_modules/eslint/lib/rules/prefer-const.js @@ -17,8 +17,7 @@ const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u /** * Checks whether a given node is located at `ForStatement.init` or not. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is located at `ForStatement.init`. */ function isInitOfForStatement(node) { @@ -27,8 +26,7 @@ function isInitOfForStatement(node) { /** * Checks whether a given Identifier node becomes a VariableDeclaration or not. - * - * @param {ASTNode} identifier - An Identifier node to check. + * @param {ASTNode} identifier An Identifier node to check. * @returns {boolean} `true` if the node can become a VariableDeclaration. */ function canBecomeVariableDeclaration(identifier) { @@ -51,9 +49,8 @@ function canBecomeVariableDeclaration(identifier) { /** * Checks if an property or element is from outer scope or function parameters * in destructing pattern. - * - * @param {string} name - A variable name to be checked. - * @param {eslint-scope.Scope} initScope - A scope to start find. + * @param {string} name A variable name to be checked. + * @param {eslint-scope.Scope} initScope A scope to start find. * @returns {boolean} Indicates if the variable is from outer scope or function parameters. */ function isOuterVariableInDestructing(name, initScope) { @@ -76,8 +73,7 @@ function isOuterVariableInDestructing(name, initScope) { * belongs to. * This is used to detect a mix of reassigned and never reassigned in a * destructuring. - * - * @param {eslint-scope.Reference} reference - A reference to get. + * @param {eslint-scope.Reference} reference A reference to get. * @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or * null. */ @@ -162,9 +158,8 @@ function hasMemberExpressionAssignment(node) { * `/*exported foo` directive comment makes such variables. This rule does not * warn such variables because this rule cannot distinguish whether the * exported variables are reassigned or not. - * - * @param {eslint-scope.Variable} variable - A variable to get. - * @param {boolean} ignoreReadBeforeAssign - + * @param {eslint-scope.Variable} variable A variable to get. + * @param {boolean} ignoreReadBeforeAssign * The value of `ignoreReadBeforeAssign` option. * @returns {ASTNode|null} * An Identifier node if the variable should change to const. @@ -262,9 +257,8 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) { * reference of given variables belongs to. * This is used to detect a mix of reassigned and never reassigned in a * destructuring. - * - * @param {eslint-scope.Variable[]} variables - Variables to group by destructuring. - * @param {boolean} ignoreReadBeforeAssign - + * @param {eslint-scope.Variable[]} variables Variables to group by destructuring. + * @param {boolean} ignoreReadBeforeAssign * The value of `ignoreReadBeforeAssign` option. * @returns {Map} Grouped identifier nodes. */ @@ -308,10 +302,9 @@ function groupByDestructuring(variables, ignoreReadBeforeAssign) { /** * Finds the nearest parent of node with a given type. - * - * @param {ASTNode} node – The node to search from. - * @param {string} type – The type field of the parent node. - * @param {Function} shouldStop – a predicate that returns true if the traversal should stop, and false otherwise. + * @param {ASTNode} node The node to search from. + * @param {string} type The type field of the parent node. + * @param {Function} shouldStop A predicate that returns true if the traversal should stop, and false otherwise. * @returns {ASTNode} The closest ancestor with the specified type; null if no such ancestor exists. */ function findUp(node, type, shouldStop) { @@ -374,8 +367,7 @@ module.exports = { * nullable. In simple declaration or assignment cases, the length of * the array is 1. In destructuring cases, the length of the array can * be 2 or more. - * - * @param {(eslint-scope.Reference|null)[]} nodes - + * @param {(eslint-scope.Reference|null)[]} nodes * References which are grouped by destructuring to report. * @returns {void} */ diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index dec93d51f2d214..eff37294a9b6ef 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -103,6 +103,7 @@ module.exports = { // Helpers //-------------------------------------------------------------------------- + // eslint-disable-next-line jsdoc/require-description /** * @param {string} nodeType "AssignmentExpression" or "VariableDeclarator" * @param {string} destructuringType "array" or "object" @@ -119,7 +120,6 @@ module.exports = { * * This is used to differentiate array index access from object property * access. - * * @param {ASTNode} node the node to evaluate * @returns {boolean} whether or not the node is an integer */ @@ -129,7 +129,6 @@ module.exports = { /** * Report that the given node should use destructuring - * * @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 @@ -153,7 +152,6 @@ module.exports = { * 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 */ @@ -168,7 +166,6 @@ module.exports = { * 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 @@ -189,7 +186,6 @@ module.exports = { * * Pulled out into a separate method so that VariableDeclarators and * AssignmentExpressions can share the same verification logic. - * * @param {ASTNode} leftNode the left-hand side of the assignment * @param {ASTNode} rightNode the right-hand side of the assignment * @param {ASTNode} reportNode the node to report the error on @@ -231,7 +227,6 @@ module.exports = { /** * Check if a given variable declarator is coming from an property access * that should be using destructuring instead - * * @param {ASTNode} node the variable declarator to check * @returns {void} */ @@ -252,7 +247,6 @@ module.exports = { /** * Run the `prefer-destructuring` check on an AssignmentExpression - * * @param {ASTNode} node the AssignmentExpression node * @returns {void} */ diff --git a/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js b/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js index 7f4a9c3c8e34a1..c8af043c1b5268 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js +++ b/tools/node_modules/eslint/lib/rules/prefer-named-capture-group.js @@ -49,7 +49,6 @@ module.exports = { /** * Function to check regular expression. - * * @param {string} pattern The regular expression pattern to be check. * @param {ASTNode} node AST node which contains regular expression. * @param {boolean} uFlag Flag indicates whether unicode mode is enabled or not. diff --git a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js index b4113a3b327542..672d9bcaa0c508 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js +++ b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js @@ -5,6 +5,12 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -94,13 +100,13 @@ module.exports = { functionName: sourceCode.getText(node.callee) }, fix(fixer) { - const newPrefix = prefixMap[node.arguments[1].value]; - if (sourceCode.getCommentsInside(node).length) { return null; } - if (+(newPrefix + node.arguments[0].value) !== parseInt(node.arguments[0].value, node.arguments[1].value)) { + const replacement = `${prefixMap[node.arguments[1].value]}${node.arguments[0].value}`; + + if (+replacement !== parseInt(node.arguments[0].value, node.arguments[1].value)) { /* * If the newly-produced literal would be invalid, (e.g. 0b1234), @@ -108,7 +114,29 @@ module.exports = { */ return null; } - return fixer.replaceText(node, prefixMap[node.arguments[1].value] + node.arguments[0].value); + + const tokenBefore = sourceCode.getTokenBefore(node), + tokenAfter = sourceCode.getTokenAfter(node); + let prefix = "", + suffix = ""; + + if ( + tokenBefore && + tokenBefore.range[1] === node.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, replacement) + ) { + prefix = " "; + } + + if ( + tokenAfter && + node.range[1] === tokenAfter.range[0] && + !astUtils.canTokensBeAdjacent(replacement, tokenAfter) + ) { + suffix = " "; + } + + return fixer.replaceText(node, `${prefix}${replacement}${suffix}`); } }); } diff --git a/tools/node_modules/eslint/lib/rules/prefer-object-spread.js b/tools/node_modules/eslint/lib/rules/prefer-object-spread.js index 214f950c64212e..bbcd88bee3d071 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-object-spread.js +++ b/tools/node_modules/eslint/lib/rules/prefer-object-spread.js @@ -18,7 +18,7 @@ const ANY_SPACE = /\s/u; /** * Helper that checks if the Object.assign call has array spread - * @param {ASTNode} node - The node that the rule warns on + * @param {ASTNode} node The node that the rule warns on * @returns {boolean} - Returns true if the Object.assign call has array spread */ function hasArraySpread(node) { @@ -28,8 +28,8 @@ function hasArraySpread(node) { /** * Helper that checks if the node needs parentheses to be valid JS. * The default is to wrap the node in parentheses to avoid parsing errors. - * @param {ASTNode} node - The node that the rule warns on - * @param {Object} sourceCode - in context sourcecode object + * @param {ASTNode} node The node that the rule warns on + * @param {Object} sourceCode in context sourcecode object * @returns {boolean} - Returns true if the node needs parentheses */ function needsParens(node, sourceCode) { @@ -51,8 +51,8 @@ function needsParens(node, sourceCode) { /** * Determines if an argument needs parentheses. The default is to not add parens. - * @param {ASTNode} node - The node to be checked. - * @param {Object} sourceCode - in context sourcecode object + * @param {ASTNode} node The node to be checked. + * @param {Object} sourceCode in context sourcecode object * @returns {boolean} True if the node needs parentheses */ function argNeedsParens(node, sourceCode) { @@ -142,8 +142,8 @@ function getEndWithSpaces(token, sourceCode) { /** * Autofixes the Object.assign call to use an object spread instead. - * @param {ASTNode|null} node - The node that the rule warns on, i.e. the Object.assign call - * @param {string} sourceCode - sourceCode of the Object.assign call + * @param {ASTNode|null} node The node that the rule warns on, i.e. the Object.assign call + * @param {string} sourceCode sourceCode of the Object.assign call * @returns {Function} autofixer - replaces the Object.assign with a spread object. */ function defineFixer(node, sourceCode) { diff --git a/tools/node_modules/eslint/lib/rules/prefer-rest-params.js b/tools/node_modules/eslint/lib/rules/prefer-rest-params.js index 95a562c4a2f4de..3a28584f6bc126 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-rest-params.js +++ b/tools/node_modules/eslint/lib/rules/prefer-rest-params.js @@ -11,7 +11,7 @@ /** * Gets the variable object of `arguments` which is defined implicitly. - * @param {eslint-scope.Scope} scope - A scope to get. + * @param {eslint-scope.Scope} scope A scope to get. * @returns {eslint-scope.Variable} The found variable object. */ function getVariableOfArguments(scope) { @@ -41,8 +41,7 @@ function getVariableOfArguments(scope) { * - arguments[i] .... true // computed member access * - arguments[0] .... true // computed member access * - arguments.length .... false // normal member access - * - * @param {eslint-scope.Reference} reference - The reference to check. + * @param {eslint-scope.Reference} reference The reference to check. * @returns {boolean} `true` if the reference is not normal member access. */ function isNotNormalMemberAccess(reference) { @@ -78,8 +77,7 @@ module.exports = { /** * Reports a given reference. - * - * @param {eslint-scope.Reference} reference - A reference to report. + * @param {eslint-scope.Reference} reference A reference to report. * @returns {void} */ function report(reference) { @@ -92,7 +90,6 @@ module.exports = { /** * Reports references of the implicit `arguments` variable if exist. - * * @returns {void} */ function checkForArguments() { diff --git a/tools/node_modules/eslint/lib/rules/prefer-spread.js b/tools/node_modules/eslint/lib/rules/prefer-spread.js index 9368c972c086ba..14c05bd97103de 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-spread.js +++ b/tools/node_modules/eslint/lib/rules/prefer-spread.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a node is a `.apply()` for variadic. - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {boolean} Whether or not the node is a `.apply()` for variadic. */ function isVariadicApplyCalling(node) { @@ -31,9 +31,9 @@ function isVariadicApplyCalling(node) { /** * Checks whether or not `thisArg` is not changed by `.apply()`. - * @param {ASTNode|null} expectedThis - The node that is the owner of the applied function. - * @param {ASTNode} thisArg - The node that is given to the first argument of the `.apply()`. - * @param {RuleContext} context - The ESLint rule context object. + * @param {ASTNode|null} expectedThis The node that is the owner of the applied function. + * @param {ASTNode} thisArg The node that is given to the first argument of the `.apply()`. + * @param {RuleContext} context The ESLint rule context object. * @returns {boolean} Whether or not `thisArg` is not changed by `.apply()`. */ function isValidThisArg(expectedThis, thisArg, context) { diff --git a/tools/node_modules/eslint/lib/rules/prefer-template.js b/tools/node_modules/eslint/lib/rules/prefer-template.js index a2507d452c68eb..fa6e58d9721e12 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-template.js +++ b/tools/node_modules/eslint/lib/rules/prefer-template.js @@ -17,7 +17,7 @@ const astUtils = require("./utils/ast-utils"); /** * Checks whether or not a given node is a concatenation. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a concatenation. */ function isConcatenation(node) { @@ -26,7 +26,7 @@ function isConcatenation(node) { /** * Gets the top binary expression node for concatenation in parents of a given node. - * @param {ASTNode} node - A node to get. + * @param {ASTNode} node A node to get. * @returns {ASTNode} the top binary expression node in parents of a given node. */ function getTopConcatBinaryExpression(node) { @@ -70,7 +70,7 @@ function hasOctalEscapeSequence(node) { /** * Checks whether or not a given binary expression has string literals. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node has string literals. */ function hasStringLiteral(node) { @@ -84,7 +84,7 @@ function hasStringLiteral(node) { /** * Checks whether or not a given binary expression has non string literals. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node has non string literals. */ function hasNonStringLiteral(node) { @@ -242,8 +242,7 @@ module.exports = { /** * Reports if a given node is string concatenation with non string literals. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {void} */ function checkForStringConcat(node) { diff --git a/tools/node_modules/eslint/lib/rules/quote-props.js b/tools/node_modules/eslint/lib/rules/quote-props.js index 79493b2499eb31..ab09b8fa938e63 100644 --- a/tools/node_modules/eslint/lib/rules/quote-props.js +++ b/tools/node_modules/eslint/lib/rules/quote-props.js @@ -85,7 +85,7 @@ module.exports = { /** * Checks whether a certain string constitutes an ES3 token - * @param {string} tokenStr - The string to be checked. + * @param {string} tokenStr The string to be checked. * @returns {boolean} `true` if it is an ES3 token. */ function isKeyword(tokenStr) { diff --git a/tools/node_modules/eslint/lib/rules/quotes.js b/tools/node_modules/eslint/lib/rules/quotes.js index 5f260e55f0a501..f78d1129425633 100644 --- a/tools/node_modules/eslint/lib/rules/quotes.js +++ b/tools/node_modules/eslint/lib/rules/quotes.js @@ -41,7 +41,7 @@ const UNESCAPED_LINEBREAK_PATTERN = new RegExp(String.raw`(^|[^\\])(\\\\)*[${Arr * escaping and unescaping as necessary. * Only escaping of the minimal set of characters is changed. * Note: escaping of newlines when switching from backtick to other quotes is not handled. - * @param {string} str - A string to convert. + * @param {string} str A string to convert. * @returns {string} The string with changed quotes. * @private */ @@ -143,7 +143,6 @@ module.exports = { * * In both cases, inside of the braces is handled as normal JavaScript. * The braces are `JSXExpressionContainer` nodes. - * * @param {ASTNode} node The Literal node to check. * @returns {boolean} True if the node is a part of JSX, false if not. * @private @@ -155,7 +154,7 @@ module.exports = { /** * Checks whether or not a given node is a directive. * The directive is a `ExpressionStatement` which has only a string literal. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a directive. * @private */ @@ -170,7 +169,7 @@ module.exports = { /** * Checks whether or not a given node is a part of directive prologues. * See also: http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a part of directive prologues. * @private */ @@ -198,7 +197,7 @@ module.exports = { /** * Checks whether or not a given node is allowed as non backtick. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is allowed as non backtick. * @private */ @@ -230,7 +229,7 @@ module.exports = { /** * Checks whether or not a given TemplateLiteral node is actually using any of the special features provided by template literal strings. - * @param {ASTNode} node - A TemplateLiteral node to check. + * @param {ASTNode} node A TemplateLiteral node to check. * @returns {boolean} Whether or not the TemplateLiteral node is using any of the special features provided by template literal strings. * @private */ diff --git a/tools/node_modules/eslint/lib/rules/radix.js b/tools/node_modules/eslint/lib/rules/radix.js index b7b296f45155ff..ed3c5cb66b8cdc 100644 --- a/tools/node_modules/eslint/lib/rules/radix.js +++ b/tools/node_modules/eslint/lib/rules/radix.js @@ -20,8 +20,7 @@ const MODE_ALWAYS = "always", /** * Checks whether a given variable is shadowed or not. - * - * @param {eslint-scope.Variable} variable - A variable to check. + * @param {eslint-scope.Variable} variable A variable to check. * @returns {boolean} `true` if the variable is shadowed. */ function isShadowed(variable) { @@ -30,8 +29,7 @@ function isShadowed(variable) { /** * Checks whether a given node is a MemberExpression of `parseInt` method or not. - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a MemberExpression of `parseInt` * method. */ @@ -51,8 +49,7 @@ function isParseIntMethod(node) { * * - A literal except numbers. * - undefined. - * - * @param {ASTNode} radix - A node of radix to check. + * @param {ASTNode} radix A node of radix to check. * @returns {boolean} `true` if the node is valid. */ function isValidRadix(radix) { @@ -64,8 +61,7 @@ function isValidRadix(radix) { /** * Checks whether a given node is a default value of radix or not. - * - * @param {ASTNode} radix - A node of radix to check. + * @param {ASTNode} radix A node of radix to check. * @returns {boolean} `true` if the node is the literal node of `10`. */ function isDefaultRadix(radix) { @@ -100,8 +96,7 @@ module.exports = { /** * Checks the arguments of a given CallExpression node and reports it if it * offends this rule. - * - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {void} */ function checkArguments(node) { diff --git a/tools/node_modules/eslint/lib/rules/require-await.js b/tools/node_modules/eslint/lib/rules/require-await.js index 298cb951de3b39..0aa6fce7e19859 100644 --- a/tools/node_modules/eslint/lib/rules/require-await.js +++ b/tools/node_modules/eslint/lib/rules/require-await.js @@ -17,8 +17,7 @@ const astUtils = require("./utils/ast-utils"); /** * Capitalize the 1st letter of the given text. - * - * @param {string} text - The text to capitalize. + * @param {string} text The text to capitalize. * @returns {string} The text that the 1st letter was capitalized. */ function capitalizeFirstLetter(text) { @@ -49,7 +48,6 @@ module.exports = { /** * Push the scope info object to the stack. - * * @returns {void} */ function enterFunction() { @@ -62,8 +60,7 @@ module.exports = { /** * Pop the top scope info object from the stack. * Also, it reports the function if needed. - * - * @param {ASTNode} node - The node to report. + * @param {ASTNode} node The node to report. * @returns {void} */ function exitFunction(node) { diff --git a/tools/node_modules/eslint/lib/rules/require-yield.js b/tools/node_modules/eslint/lib/rules/require-yield.js index 7bb7cf9a872bd8..dbfd759948af78 100644 --- a/tools/node_modules/eslint/lib/rules/require-yield.js +++ b/tools/node_modules/eslint/lib/rules/require-yield.js @@ -28,7 +28,7 @@ module.exports = { /** * If the node is a generator function, start counting `yield` keywords. - * @param {Node} node - A function node to check. + * @param {Node} node A function node to check. * @returns {void} */ function beginChecking(node) { @@ -40,7 +40,7 @@ module.exports = { /** * If the node is a generator function, end counting `yield` keywords, then * reports result. - * @param {Node} node - A function node to check. + * @param {Node} node A function node to check. * @returns {void} */ function endChecking(node) { diff --git a/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js b/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js index 04539395ef4ec1..cd740fd3a99057 100644 --- a/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js +++ b/tools/node_modules/eslint/lib/rules/rest-spread-spacing.js @@ -39,7 +39,7 @@ module.exports = { /** * Checks whitespace between rest/spread operators and their expressions - * @param {ASTNode} node - The node to check + * @param {ASTNode} node The node to check * @returns {void} */ function checkWhiteSpace(node) { diff --git a/tools/node_modules/eslint/lib/rules/sort-imports.js b/tools/node_modules/eslint/lib/rules/sort-imports.js index 05e643ca0611d5..3b7f1d010348ad 100644 --- a/tools/node_modules/eslint/lib/rules/sort-imports.js +++ b/tools/node_modules/eslint/lib/rules/sort-imports.js @@ -70,8 +70,7 @@ module.exports = { * import * as myModule from "my-module.js" --> all * import {myMember} from "my-module.js" --> single * import {foo, bar} from "my-module.js" --> multiple - * - * @param {ASTNode} node - the ImportDeclaration node. + * @param {ASTNode} node the ImportDeclaration node. * @returns {string} used member parameter style, ["all", "multiple", "single"] */ function usedMemberSyntax(node) { @@ -90,7 +89,7 @@ module.exports = { /** * Gets the group by member parameter index for given declaration. - * @param {ASTNode} node - the ImportDeclaration node. + * @param {ASTNode} node the ImportDeclaration node. * @returns {number} the declaration group by member index. */ function getMemberParameterGroupIndex(node) { @@ -99,7 +98,7 @@ module.exports = { /** * Gets the local name of the first imported module. - * @param {ASTNode} node - the ImportDeclaration node. + * @param {ASTNode} node the ImportDeclaration node. * @returns {?string} the local name of the first imported module. */ function getFirstLocalMemberName(node) { diff --git a/tools/node_modules/eslint/lib/rules/sort-keys.js b/tools/node_modules/eslint/lib/rules/sort-keys.js index c314d4a63611b6..a5ce445f71ae93 100644 --- a/tools/node_modules/eslint/lib/rules/sort-keys.js +++ b/tools/node_modules/eslint/lib/rules/sort-keys.js @@ -23,8 +23,7 @@ const astUtils = require("./utils/ast-utils"), * whether it's a computed property or not. * - If the property has a static name, this returns the static name. * - Otherwise, this returns null. - * - * @param {ASTNode} node - The `Property` node to get. + * @param {ASTNode} node The `Property` node to get. * @returns {string|null} The property name or null. * @private */ @@ -43,7 +42,6 @@ function getPropertyName(node) { * * Postfix `I` is meant insensitive. * Postfix `N` is meant natual. - * * @private */ const isValidOrders = { diff --git a/tools/node_modules/eslint/lib/rules/space-before-blocks.js b/tools/node_modules/eslint/lib/rules/space-before-blocks.js index 527366aaccf089..038e88db5215f5 100644 --- a/tools/node_modules/eslint/lib/rules/space-before-blocks.js +++ b/tools/node_modules/eslint/lib/rules/space-before-blocks.js @@ -79,8 +79,7 @@ module.exports = { /** * Checks whether or not a given token is an arrow operator (=>) or a keyword * in order to avoid to conflict with `arrow-spacing` and `keyword-spacing`. - * - * @param {Token} token - A token to check. + * @param {Token} token A token to check. * @returns {boolean} `true` if the token is an arrow operator. */ function isConflicted(token) { diff --git a/tools/node_modules/eslint/lib/rules/space-in-parens.js b/tools/node_modules/eslint/lib/rules/space-in-parens.js index 35ded5e7863114..85ee74210d6007 100644 --- a/tools/node_modules/eslint/lib/rules/space-in-parens.js +++ b/tools/node_modules/eslint/lib/rules/space-in-parens.js @@ -232,7 +232,7 @@ module.exports = { if (token.value === "(" && openerMissingSpace(token, nextToken)) { context.report({ node, - loc: token.loc.start, + loc: token.loc, messageId: "missingOpeningSpace", fix(fixer) { return fixer.insertTextAfter(token, " "); @@ -244,7 +244,7 @@ module.exports = { if (token.value === "(" && openerRejectsSpace(token, nextToken)) { context.report({ node, - loc: token.loc.start, + loc: { start: token.loc.end, end: nextToken.loc.start }, messageId: "rejectedOpeningSpace", fix(fixer) { return fixer.removeRange([token.range[1], nextToken.range[0]]); @@ -256,7 +256,7 @@ module.exports = { if (token.value === ")" && closerMissingSpace(prevToken, token)) { context.report({ node, - loc: token.loc.start, + loc: token.loc, messageId: "missingClosingSpace", fix(fixer) { return fixer.insertTextBefore(token, " "); @@ -268,7 +268,7 @@ module.exports = { if (token.value === ")" && closerRejectsSpace(prevToken, token)) { context.report({ node, - loc: token.loc.start, + loc: { start: prevToken.loc.end, end: token.loc.start }, messageId: "rejectedClosingSpace", fix(fixer) { return fixer.removeRange([prevToken.range[1], token.range[0]]); 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 8d1d172c6697b6..b2fbe47b4765e6 100644 --- a/tools/node_modules/eslint/lib/rules/space-infix-ops.js +++ b/tools/node_modules/eslint/lib/rules/space-infix-ops.js @@ -41,9 +41,9 @@ module.exports = { /** * Returns the first token which violates the rule - * @param {ASTNode} left - The left node of the main node - * @param {ASTNode} right - The right node of the main node - * @param {string} op - The operator of the main node + * @param {ASTNode} left The left node of the main node + * @param {ASTNode} right The right node of the main node + * @param {string} op The operator of the main node * @returns {Object} The violator token or null * @private */ @@ -61,8 +61,8 @@ module.exports = { /** * Reports an AST node as a rule violation - * @param {ASTNode} mainNode - The node to report - * @param {Object} culpritToken - The token which has a problem + * @param {ASTNode} mainNode The node to report + * @param {Object} culpritToken The token which has a problem * @returns {void} * @private */ diff --git a/tools/node_modules/eslint/lib/rules/spaced-comment.js b/tools/node_modules/eslint/lib/rules/spaced-comment.js index 731bd212e3e786..958bb2c6444080 100644 --- a/tools/node_modules/eslint/lib/rules/spaced-comment.js +++ b/tools/node_modules/eslint/lib/rules/spaced-comment.js @@ -13,7 +13,7 @@ const astUtils = require("./utils/ast-utils"); /** * Escapes the control characters of a given string. - * @param {string} s - A string to escape. + * @param {string} s A string to escape. * @returns {string} An escaped string. */ function escape(s) { @@ -23,7 +23,7 @@ function escape(s) { /** * Escapes the control characters of a given string. * And adds a repeat flag. - * @param {string} s - A string to escape. + * @param {string} s A string to escape. * @returns {string} An escaped string. */ function escapeAndRepeat(s) { @@ -33,7 +33,7 @@ function escapeAndRepeat(s) { /** * Parses `markers` option. * If markers don't include `"*"`, this adds `"*"` to allow JSDoc comments. - * @param {string[]} [markers] - A marker list. + * @param {string[]} [markers] A marker list. * @returns {string[]} A marker list. */ function parseMarkersOption(markers) { @@ -51,8 +51,7 @@ function parseMarkersOption(markers) { * Generated pattern: * * 1. A space or an exception pattern sequence. - * - * @param {string[]} exceptions - An exception pattern list. + * @param {string[]} exceptions An exception pattern list. * @returns {string} A regular expression string for exceptions. */ function createExceptionsPattern(exceptions) { @@ -97,9 +96,8 @@ function createExceptionsPattern(exceptions) { * * 1. First, a marker or nothing. * 2. Next, a space or an exception pattern sequence. - * - * @param {string[]} markers - A marker list. - * @param {string[]} exceptions - An exception pattern list. + * @param {string[]} markers A marker list. + * @param {string[]} exceptions An exception pattern list. * @returns {RegExp} A RegExp object for the beginning of a comment in `always` mode. */ function createAlwaysStylePattern(markers, exceptions) { @@ -135,8 +133,7 @@ function createAlwaysStylePattern(markers, exceptions) { * * 1. First, a marker or nothing (captured). * 2. Next, a space or a tab. - * - * @param {string[]} markers - A marker list. + * @param {string[]} markers A marker list. * @returns {RegExp} A RegExp object for `never` mode. */ function createNeverStylePattern(markers) { @@ -260,10 +257,10 @@ module.exports = { /** * Reports a beginning spacing error with an appropriate message. - * @param {ASTNode} node - A comment node to check. - * @param {string} message - An error message to report. - * @param {Array} match - An array of match results for markers. - * @param {string} refChar - Character used for reference in the error message. + * @param {ASTNode} node A comment node to check. + * @param {string} message An error message to report. + * @param {Array} match An array of match results for markers. + * @param {string} refChar Character used for reference in the error message. * @returns {void} */ function reportBegin(node, message, match, refChar) { @@ -293,9 +290,9 @@ module.exports = { /** * Reports an ending spacing error with an appropriate message. - * @param {ASTNode} node - A comment node to check. - * @param {string} message - An error message to report. - * @param {string} match - An array of the matched whitespace characters. + * @param {ASTNode} node A comment node to check. + * @param {string} message An error message to report. + * @param {string} match An array of the matched whitespace characters. * @returns {void} */ function reportEnd(node, message, match) { @@ -317,7 +314,7 @@ module.exports = { /** * Reports a given comment if it's invalid. - * @param {ASTNode} node - a comment node to check. + * @param {ASTNode} node a comment node to check. * @returns {void} */ function checkCommentForSpace(node) { diff --git a/tools/node_modules/eslint/lib/rules/strict.js b/tools/node_modules/eslint/lib/rules/strict.js index b93a6a1a17adb5..b0d6cf9172a74b 100644 --- a/tools/node_modules/eslint/lib/rules/strict.js +++ b/tools/node_modules/eslint/lib/rules/strict.js @@ -43,8 +43,7 @@ function getUseStrictDirectives(statements) { /** * Checks whether a given parameter is a simple parameter. - * - * @param {ASTNode} node - A pattern node to check. + * @param {ASTNode} node A pattern node to check. * @returns {boolean} `true` if the node is an Identifier node. */ function isSimpleParameter(node) { @@ -53,8 +52,7 @@ function isSimpleParameter(node) { /** * Checks whether a given parameter list is a simple parameter list. - * - * @param {ASTNode[]} params - A parameter list to check. + * @param {ASTNode[]} params A parameter list to check. * @returns {boolean} `true` if the every parameter is an Identifier node. */ function isSimpleParameterList(params) { diff --git a/tools/node_modules/eslint/lib/rules/symbol-description.js b/tools/node_modules/eslint/lib/rules/symbol-description.js index 3fd5a359671f6a..155cea4dc0bceb 100644 --- a/tools/node_modules/eslint/lib/rules/symbol-description.js +++ b/tools/node_modules/eslint/lib/rules/symbol-description.js @@ -38,8 +38,7 @@ module.exports = { /** * Reports if node does not conform the rule in case rule is set to * report missing description - * - * @param {ASTNode} node - A CallExpression node to check. + * @param {ASTNode} node A CallExpression node to check. * @returns {void} */ function checkArgument(node) { diff --git a/tools/node_modules/eslint/lib/rules/template-curly-spacing.js b/tools/node_modules/eslint/lib/rules/template-curly-spacing.js index 2794b45cf78548..07da6a39b0e9bb 100644 --- a/tools/node_modules/eslint/lib/rules/template-curly-spacing.js +++ b/tools/node_modules/eslint/lib/rules/template-curly-spacing.js @@ -53,7 +53,7 @@ module.exports = { /** * Checks spacing before `}` of a given token. - * @param {Token} token - A token to check. This is a Template token. + * @param {Token} token A token to check. This is a Template token. * @returns {void} */ function checkSpacingBefore(token) { @@ -82,7 +82,7 @@ module.exports = { /** * Checks spacing after `${` of a given token. - * @param {Token} token - A token to check. This is a Template token. + * @param {Token} token A token to check. This is a Template token. * @returns {void} */ function checkSpacingAfter(token) { diff --git a/tools/node_modules/eslint/lib/rules/use-isnan.js b/tools/node_modules/eslint/lib/rules/use-isnan.js index b2eb84b7b37f60..cd9ccdbaf898ee 100644 --- a/tools/node_modules/eslint/lib/rules/use-isnan.js +++ b/tools/node_modules/eslint/lib/rules/use-isnan.js @@ -5,6 +5,12 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -40,6 +46,10 @@ module.exports = { enforceForSwitchCase: { type: "boolean", default: false + }, + enforceForIndexOf: { + type: "boolean", + default: false } }, additionalProperties: false @@ -49,16 +59,18 @@ module.exports = { messages: { comparisonWithNaN: "Use the isNaN function to compare with NaN.", switchNaN: "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch.", - caseNaN: "'case NaN' can never match. Use Number.isNaN before the switch." + caseNaN: "'case NaN' can never match. Use Number.isNaN before the switch.", + indexOfNaN: "Array prototype method '{{ methodName }}' cannot find NaN." } }, create(context) { const enforceForSwitchCase = context.options[0] && context.options[0].enforceForSwitchCase; + const enforceForIndexOf = context.options[0] && context.options[0].enforceForIndexOf; /** - * Checks the given `BinaryExpression` node. + * Checks the given `BinaryExpression` node for `foo === NaN` and other comparisons. * @param {ASTNode} node The node to check. * @returns {void} */ @@ -72,7 +84,7 @@ module.exports = { } /** - * Checks the discriminant and all case clauses of the given `SwitchStatement` node. + * Checks the discriminant and all case clauses of the given `SwitchStatement` node for `switch(NaN)` and `case NaN:` * @param {ASTNode} node The node to check. * @returns {void} */ @@ -88,6 +100,27 @@ module.exports = { } } + /** + * Checks the the given `CallExpression` node for `.indexOf(NaN)` and `.lastIndexOf(NaN)`. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkCallExpression(node) { + const callee = node.callee; + + if (callee.type === "MemberExpression") { + const methodName = astUtils.getStaticPropertyName(callee); + + if ( + (methodName === "indexOf" || methodName === "lastIndexOf") && + node.arguments.length === 1 && + isNaNIdentifier(node.arguments[0]) + ) { + context.report({ node, messageId: "indexOfNaN", data: { methodName } }); + } + } + } + const listeners = { BinaryExpression: checkBinaryExpression }; @@ -96,6 +129,10 @@ module.exports = { listeners.SwitchStatement = checkSwitchStatement; } + if (enforceForIndexOf) { + listeners.CallExpression = checkCallExpression; + } + return listeners; } }; diff --git a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js index f0b926e3298f86..17e056c240c13d 100644 --- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -42,9 +42,9 @@ const OCTAL_ESCAPE_PATTERN = /^(?:[^\\]|\\[^0-7]|\\0(?![0-9]))*\\(?:[1-7]|0[0-9] /** * Checks reference if is non initializer and writable. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. + * @param {Reference} reference A reference to check. + * @param {int} index The index of the reference in the references. + * @param {Reference[]} references The array that the reference belongs to. * @returns {boolean} Success/Failure * @private */ @@ -68,8 +68,7 @@ function isModifyingReference(reference, index, references) { /** * Checks whether the given string starts with uppercase or not. - * - * @param {string} s - The string to check. + * @param {string} s The string to check. * @returns {boolean} `true` if the string starts with uppercase. */ function startsWithUpperCase(s) { @@ -78,7 +77,7 @@ function startsWithUpperCase(s) { /** * Checks whether or not a node is a constructor. - * @param {ASTNode} node - A function node to check. + * @param {ASTNode} node A function node to check. * @returns {boolean} Wehether or not a node is a constructor. */ function isES5Constructor(node) { @@ -87,7 +86,7 @@ function isES5Constructor(node) { /** * Finds a function node from ancestors of a node. - * @param {ASTNode} node - A start node to find. + * @param {ASTNode} node A start node to find. * @returns {Node|null} A found function node. */ function getUpperFunction(node) { @@ -106,8 +105,7 @@ function getUpperFunction(node) { * - ArrowFunctionExpression * - FunctionDeclaration * - FunctionExpression - * - * @param {ASTNode|null} node - A node to check. + * @param {ASTNode|null} node A node to check. * @returns {boolean} `true` if the node is a function node. */ function isFunction(node) { @@ -123,8 +121,7 @@ function isFunction(node) { * - ForOfStatement * - ForStatement * - WhileStatement - * - * @param {ASTNode|null} node - A node to check. + * @param {ASTNode|null} node A node to check. * @returns {boolean} `true` if the node is a loop node. */ function isLoop(node) { @@ -133,8 +130,7 @@ function isLoop(node) { /** * Checks whether the given node is in a loop or not. - * - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if the node is in a loop. */ function isInLoop(node) { @@ -149,7 +145,7 @@ function isInLoop(node) { /** * Checks whether or not a node is `null` or `undefined`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a `null` or `undefined`. * @public */ @@ -163,7 +159,7 @@ function isNullOrUndefined(node) { /** * Checks whether or not a node is callee. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is callee. */ function isCallee(node) { @@ -172,7 +168,7 @@ function isCallee(node) { /** * Checks whether or not a node is `Reflect.apply`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a `Reflect.apply`. */ function isReflectApply(node) { @@ -188,7 +184,7 @@ function isReflectApply(node) { /** * Checks whether or not a node is `Array.from`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a `Array.from`. */ function isArrayFromMethod(node) { @@ -204,7 +200,7 @@ function isArrayFromMethod(node) { /** * Checks whether or not a node is a method which has `thisArg`. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} Whether or not the node is a method which has `thisArg`. */ function isMethodWhichHasThisArg(node) { @@ -223,7 +219,7 @@ function isMethodWhichHasThisArg(node) { /** * Creates the negate function of the given function. - * @param {Function} f - The function to negate. + * @param {Function} f The function to negate. * @returns {Function} Negated function. */ function negate(f) { @@ -232,8 +228,8 @@ function negate(f) { /** * Checks whether or not a node has a `@this` tag in its comments. - * @param {ASTNode} node - A node to check. - * @param {SourceCode} sourceCode - A SourceCode instance to get comments. + * @param {ASTNode} node A node to check. + * @param {SourceCode} sourceCode A SourceCode instance to get comments. * @returns {boolean} Whether or not the node has a `@this` tag in its comments. */ function hasJSDocThisTag(node, sourceCode) { @@ -268,8 +264,7 @@ function isParenthesised(sourceCode, node) { /** * Checks if the given token is an arrow token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an arrow token. */ function isArrowToken(token) { @@ -278,8 +273,7 @@ function isArrowToken(token) { /** * Checks if the given token is a comma token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a comma token. */ function isCommaToken(token) { @@ -288,8 +282,7 @@ function isCommaToken(token) { /** * Checks if the given token is a dot token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a dot token. */ function isDotToken(token) { @@ -298,8 +291,7 @@ function isDotToken(token) { /** * Checks if the given token is a semicolon token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a semicolon token. */ function isSemicolonToken(token) { @@ -308,8 +300,7 @@ function isSemicolonToken(token) { /** * Checks if the given token is a colon token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a colon token. */ function isColonToken(token) { @@ -318,8 +309,7 @@ function isColonToken(token) { /** * Checks if the given token is an opening parenthesis token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an opening parenthesis token. */ function isOpeningParenToken(token) { @@ -328,8 +318,7 @@ function isOpeningParenToken(token) { /** * Checks if the given token is a closing parenthesis token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a closing parenthesis token. */ function isClosingParenToken(token) { @@ -338,8 +327,7 @@ function isClosingParenToken(token) { /** * Checks if the given token is an opening square bracket token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an opening square bracket token. */ function isOpeningBracketToken(token) { @@ -348,8 +336,7 @@ function isOpeningBracketToken(token) { /** * Checks if the given token is a closing square bracket token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a closing square bracket token. */ function isClosingBracketToken(token) { @@ -358,8 +345,7 @@ function isClosingBracketToken(token) { /** * Checks if the given token is an opening brace token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is an opening brace token. */ function isOpeningBraceToken(token) { @@ -368,8 +354,7 @@ function isOpeningBraceToken(token) { /** * Checks if the given token is a closing brace token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a closing brace token. */ function isClosingBraceToken(token) { @@ -378,8 +363,7 @@ function isClosingBraceToken(token) { /** * Checks if the given token is a comment token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a comment token. */ function isCommentToken(token) { @@ -388,8 +372,7 @@ function isCommentToken(token) { /** * Checks if the given token is a keyword token or not. - * - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if the token is a keyword token. */ function isKeywordToken(token) { @@ -398,9 +381,8 @@ function isKeywordToken(token) { /** * Gets the `(` token of the given function node. - * - * @param {ASTNode} node - The function node to get. - * @param {SourceCode} sourceCode - The source code object to get tokens. + * @param {ASTNode} node The function node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. * @returns {Token} `(` token. */ function getOpeningParenOfParams(node, sourceCode) { @@ -411,9 +393,9 @@ function getOpeningParenOfParams(node, sourceCode) { /** * Checks whether or not the tokens of two given nodes are same. - * @param {ASTNode} left - A node 1 to compare. - * @param {ASTNode} right - A node 2 to compare. - * @param {SourceCode} sourceCode - The ESLint source code object. + * @param {ASTNode} left A node 1 to compare. + * @param {ASTNode} right A node 2 to compare. + * @param {SourceCode} sourceCode The ESLint source code object. * @returns {boolean} the source code for the given node. */ function equalTokens(left, right, sourceCode) { @@ -447,8 +429,8 @@ module.exports = { /** * Determines whether two adjacent tokens are on the same line. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. + * @param {Object} left The left token object. + * @param {Object} right The right token object. * @returns {boolean} Whether or not the tokens are on the same line. * @public */ @@ -494,7 +476,7 @@ module.exports = { /** * Checks whether or not a given node is a string literal. - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is a string literal. */ isStringLiteral(node) { @@ -514,8 +496,7 @@ module.exports = { * - ForStatement * - SwitchStatement * - WhileStatement - * - * @param {ASTNode} node - A node to check. + * @param {ASTNode} node A node to check. * @returns {boolean} `true` if the node is breakable. */ isBreakableStatement(node) { @@ -524,7 +505,7 @@ module.exports = { /** * Gets references which are non initializer and writable. - * @param {Reference[]} references - An array of references. + * @param {Reference[]} references An array of references. * @returns {Reference[]} An array of only references which are non initializer and writable. * @public */ @@ -568,7 +549,6 @@ module.exports = { * consequent; * * When taking this `IfStatement`, returns `consequent;` statement. - * * @param {ASTNode} A node to get. * @returns {ASTNode|null} The trailing statement's node. */ @@ -576,9 +556,8 @@ module.exports = { /** * Finds the variable by a given name in a given scope and its upper scopes. - * - * @param {eslint-scope.Scope} initScope - A scope to start find. - * @param {string} name - A variable name to find. + * @param {eslint-scope.Scope} initScope A scope to start find. + * @param {string} name A variable name to find. * @returns {eslint-scope.Variable|null} A found variable or `null`. */ getVariableByName(initScope, name) { @@ -613,9 +592,8 @@ module.exports = { * - The location is not on an ES2015 class. * - Its `bind`/`call`/`apply` method is not called directly. * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given. - * - * @param {ASTNode} node - A function node to check. - * @param {SourceCode} sourceCode - A SourceCode instance to get comments. + * @param {ASTNode} node A function node to check. + * @param {SourceCode} sourceCode A SourceCode instance to get comments. * @returns {boolean} The function node is the default `this` binding. */ isDefaultThisBinding(node, sourceCode) { @@ -861,8 +839,7 @@ module.exports = { /** * Checks whether the given node is an empty block node or not. - * - * @param {ASTNode|null} node - The node to check. + * @param {ASTNode|null} node The node to check. * @returns {boolean} `true` if the node is an empty block. */ isEmptyBlock(node) { @@ -871,8 +848,7 @@ module.exports = { /** * Checks whether the given node is an empty function node or not. - * - * @param {ASTNode|null} node - The node to check. + * @param {ASTNode|null} node The node to check. * @returns {boolean} `true` if the node is an empty function. */ isEmptyFunction(node) { @@ -906,8 +882,7 @@ module.exports = { * let a = {["a" + "b"]: 1} // => null * let a = {[tag`b`]: 1} // => null * let a = {[`${b}`]: 1} // => null - * - * @param {ASTNode} node - The node to get. + * @param {ASTNode} node The node to get. * @returns {string|null} The property name if static. Otherwise, null. */ getStaticPropertyName(node) { @@ -950,7 +925,7 @@ module.exports = { /** * Get directives from directive prologue of a Program or Function node. - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {ASTNode[]} The directives found in the directive prologue. */ getDirectivePrologue(node) { @@ -989,7 +964,7 @@ module.exports = { /** * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added * after the node will be parsed as a decimal point, rather than a property-access dot. - * @param {ASTNode} node - The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} `true` if this node is a decimal integer. * @example * @@ -1011,7 +986,7 @@ module.exports = { /** * Determines whether this token is a decimal integer numeric token. * This is similar to isDecimalInteger(), but for tokens. - * @param {Token} token - The token to check. + * @param {Token} token The token to check. * @returns {boolean} `true` if this token is a decimal integer. */ isDecimalIntegerNumericToken(token) { @@ -1063,8 +1038,7 @@ module.exports = { * - `class A { static async foo() {} }` .... `static async method 'foo'` * - `class A { static get foo() {} }` ...... `static getter 'foo'` * - `class A { static set foo(a) {} }` ..... `static setter 'foo'` - * - * @param {ASTNode} node - The function node to get. + * @param {ASTNode} node The function node to get. * @returns {string} The name and kind of the function node. */ getFunctionNameWithKind(node) { @@ -1198,9 +1172,8 @@ module.exports = { * ^^^^^^^^^^^^^^ * - `class A { static set foo(a) {} }` * ^^^^^^^^^^^^^^ - * - * @param {ASTNode} node - The function node to get. - * @param {SourceCode} sourceCode - The source code object to get tokens. + * @param {ASTNode} node The function node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. * @returns {string} The location of the function node for reporting. */ getFunctionHeadLoc(node, sourceCode) { @@ -1384,7 +1357,6 @@ module.exports = { * "\00", "\01" ... "\09" * * "\0", when not followed by a digit, is not an octal escape sequence. - * * @param {string} rawString A string in its raw representation. * @returns {boolean} `true` if the string contains at least one octal escape sequence. */ diff --git a/tools/node_modules/eslint/lib/rules/utils/fix-tracker.js b/tools/node_modules/eslint/lib/rules/utils/fix-tracker.js index c987a28ca6cb49..589870b39b5215 100644 --- a/tools/node_modules/eslint/lib/rules/utils/fix-tracker.js +++ b/tools/node_modules/eslint/lib/rules/utils/fix-tracker.js @@ -23,7 +23,6 @@ class FixTracker { /** * Create a new FixTracker. - * * @param {ruleFixer} fixer A ruleFixer instance. * @param {SourceCode} sourceCode A SourceCode object for the current code. */ @@ -36,7 +35,6 @@ class FixTracker { /** * Mark the given range as "retained", meaning that other fixes may not * may not modify this region in the same pass. - * * @param {int[]} range The range to retain. * @returns {FixTracker} The same RuleFixer, for chained calls. */ @@ -50,7 +48,6 @@ class FixTracker { * mark it as retained, meaning that other fixes may not modify it in this * pass. This is useful for avoiding conflicts in fixes that modify control * flow. - * * @param {ASTNode} node The node to use as a starting point. * @returns {FixTracker} The same RuleFixer, for chained calls. */ @@ -65,7 +62,6 @@ class FixTracker { * range as retained, meaning that other fixes may not modify it in this * pass. This is useful for avoiding conflicts in fixes that make a small * change to the code where the AST should not be changed. - * * @param {ASTNode|Token} nodeOrToken The node or token to use as a starting * point. The token to the left and right are use in the range. * @returns {FixTracker} The same RuleFixer, for chained calls. @@ -80,7 +76,6 @@ class FixTracker { /** * Create a fix command that replaces the given range with the given text, * accounting for any retained ranges. - * * @param {int[]} range The range to remove in the fix. * @param {string} text The text to insert in place of the range. * @returns {Object} The fix command. @@ -108,7 +103,6 @@ class FixTracker { /** * Create a fix command that removes the given node or token, accounting for * any retained ranges. - * * @param {ASTNode|Token} nodeOrToken The node or token to remove. * @returns {Object} The fix command. */ diff --git a/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js b/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js index e0caddb9b2821c..d426d85c59a7b3 100644 --- a/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +++ b/tools/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js @@ -10,7 +10,6 @@ const debug = require("debug")("eslint:rules"); /** * The `Map` object that loads each rule when it's accessed. - * * @example * const rules = new LazyLoadingRuleMap([ * ["eqeqeq", () => require("eqeqeq")], diff --git a/tools/node_modules/eslint/lib/rules/vars-on-top.js b/tools/node_modules/eslint/lib/rules/vars-on-top.js index e919d02da00a84..28ddae442b517a 100644 --- a/tools/node_modules/eslint/lib/rules/vars-on-top.js +++ b/tools/node_modules/eslint/lib/rules/vars-on-top.js @@ -32,8 +32,9 @@ module.exports = { // Helpers //-------------------------------------------------------------------------- + // eslint-disable-next-line jsdoc/require-description /** - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ function looksLikeDirective(node) { @@ -43,7 +44,7 @@ module.exports = { /** * Check to see if its a ES6 import declaration - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} whether the given node represents a import declaration */ function looksLikeImport(node) { @@ -53,8 +54,7 @@ module.exports = { /** * Checks whether a given node is a variable declaration or not. - * - * @param {ASTNode} node - any node + * @param {ASTNode} node any node * @returns {boolean} `true` if the node is a variable declaration. */ function isVariableDeclaration(node) { @@ -70,8 +70,8 @@ module.exports = { /** * Checks whether this variable is on top of the block body - * @param {ASTNode} node - The node to check - * @param {ASTNode[]} statements - collection of ASTNodes for the parent node block + * @param {ASTNode} node The node to check + * @param {ASTNode[]} statements collection of ASTNodes for the parent node block * @returns {boolean} True if var is on top otherwise false */ function isVarOnTop(node, statements) { @@ -99,8 +99,8 @@ module.exports = { /** * Checks whether variable is on top at the global level - * @param {ASTNode} node - The node to check - * @param {ASTNode} parent - Parent of the node + * @param {ASTNode} node The node to check + * @param {ASTNode} parent Parent of the node * @returns {void} */ function globalVarCheck(node, parent) { @@ -111,9 +111,9 @@ module.exports = { /** * Checks whether variable is on top at functional block scope level - * @param {ASTNode} node - The node to check - * @param {ASTNode} parent - Parent of the node - * @param {ASTNode} grandParent - Parent of the node's parent + * @param {ASTNode} node The node to check + * @param {ASTNode} parent Parent of the node + * @param {ASTNode} grandParent Parent of the node's parent * @returns {void} */ function blockScopeVarCheck(node, parent, grandParent) { diff --git a/tools/node_modules/eslint/lib/shared/config-ops.js b/tools/node_modules/eslint/lib/shared/config-ops.js index d2ffda4b5ffe8a..3b4d5699d86928 100644 --- a/tools/node_modules/eslint/lib/shared/config-ops.js +++ b/tools/node_modules/eslint/lib/shared/config-ops.js @@ -77,7 +77,7 @@ module.exports = { /** * Checks whether a given config has valid severity or not. - * @param {number|string|Array} ruleConfig - The configuration for an individual rule. + * @param {number|string|Array} ruleConfig The configuration for an individual rule. * @returns {boolean} `true` if the configuration has valid severity. */ isValidSeverity(ruleConfig) { @@ -91,7 +91,7 @@ module.exports = { /** * Checks whether every rule of a given config has valid severity or not. - * @param {Object} config - The configuration for rules. + * @param {Object} config The configuration for rules. * @returns {boolean} `true` if the configuration has valid severity. */ isEverySeverityValid(config) { diff --git a/tools/node_modules/eslint/lib/shared/runtime-info.js b/tools/node_modules/eslint/lib/shared/runtime-info.js index 169bbc58f13c16..feed005330e622 100644 --- a/tools/node_modules/eslint/lib/shared/runtime-info.js +++ b/tools/node_modules/eslint/lib/shared/runtime-info.js @@ -28,8 +28,8 @@ function environment() { /** * Checks if a path is a child of a directory. - * @param {string} parentPath - The parent path to check. - * @param {string} childPath - The path to check. + * @param {string} parentPath The parent path to check. + * @param {string} childPath The path to check. * @returns {boolean} Whether or not the given path is a child of a directory. */ function isChildOfDirectory(parentPath, childPath) { @@ -38,8 +38,8 @@ function environment() { /** * Synchronously executes a shell command and formats the result. - * @param {string} cmd - The command to execute. - * @param {Array} args - The arguments to be executed with the command. + * @param {string} cmd The command to execute. + * @param {Array} args The arguments to be executed with the command. * @returns {string} The version returned by the command. */ function execCommand(cmd, args) { @@ -63,7 +63,7 @@ function environment() { /** * Normalizes a version number. - * @param {string} versionStr - The string to normalize. + * @param {string} versionStr The string to normalize. * @returns {string} The normalized version number. */ function normalizeVersionStr(versionStr) { @@ -72,7 +72,7 @@ function environment() { /** * Gets bin version. - * @param {string} bin - The bin to check. + * @param {string} bin The bin to check. * @returns {string} The normalized version returned by the command. */ function getBinVersion(bin) { @@ -88,8 +88,8 @@ function environment() { /** * Gets installed npm package version. - * @param {string} pkg - The package to check. - * @param {boolean} global - Whether to check globally or not. + * @param {string} pkg The package to check. + * @param {boolean} global Whether to check globally or not. * @returns {string} The normalized version returned by the command. */ function getNpmPackageVersion(pkg, { global = false } = {}) { diff --git a/tools/node_modules/eslint/lib/shared/traverser.js b/tools/node_modules/eslint/lib/shared/traverser.js index 79fb32faf95cff..32f76779507c5a 100644 --- a/tools/node_modules/eslint/lib/shared/traverser.js +++ b/tools/node_modules/eslint/lib/shared/traverser.js @@ -65,6 +65,7 @@ class Traverser { this._leave = null; } + // eslint-disable-next-line jsdoc/require-description /** * @returns {ASTNode} The current node. */ @@ -72,6 +73,7 @@ class Traverser { return this._current; } + // eslint-disable-next-line jsdoc/require-description /** * @returns {ASTNode[]} The ancestor nodes. */ diff --git a/tools/node_modules/eslint/lib/source-code/source-code.js b/tools/node_modules/eslint/lib/source-code/source-code.js index 42e7b0c2f475e4..86a56803ed76c3 100644 --- a/tools/node_modules/eslint/lib/source-code/source-code.js +++ b/tools/node_modules/eslint/lib/source-code/source-code.js @@ -86,13 +86,13 @@ class SourceCode extends TokenStore { /** * Represents parsed source code. - * @param {string|Object} textOrConfig - The source code text or config object. - * @param {string} textOrConfig.text - The source code text. - * @param {ASTNode} textOrConfig.ast - The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. - * @param {Object|null} textOrConfig.parserServices - The parser services. - * @param {ScopeManager|null} textOrConfig.scopeManager - The scope of this source code. - * @param {Object|null} textOrConfig.visitorKeys - The visitor keys to traverse AST. - * @param {ASTNode} [astIfNoConfig] - The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. + * @param {string|Object} textOrConfig The source code text or config object. + * @param {string} textOrConfig.text The source code text. + * @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. + * @param {Object|null} textOrConfig.parserServices The parser services. + * @param {ScopeManager|null} textOrConfig.scopeManager The scope of this source code. + * @param {Object|null} textOrConfig.visitorKeys The visitor keys to traverse AST. + * @param {ASTNode} [astIfNoConfig] The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. */ constructor(textOrConfig, astIfNoConfig) { let text, ast, parserServices, scopeManager, visitorKeys; @@ -423,7 +423,7 @@ class SourceCode extends TokenStore { isSpaceBetweenTokens(first, second) { const text = this.text.slice(first.range[1], second.range[0]); - return /\s/u.test(text.replace(/\/\*.*?\*\//gu, "")); + return /\s/u.test(text.replace(/\/\*.*?\*\//gus, "")); } /** diff --git a/tools/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js index 7c2137a176ff21..7255a62260b29a 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/backward-token-comment-cursor.js @@ -22,11 +22,11 @@ module.exports = class BackwardTokenCommentCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js index 93973bce443df7..454a2449701cf1 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/backward-token-cursor.js @@ -22,11 +22,11 @@ module.exports = class BackwardTokenCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/cursors.js b/tools/node_modules/eslint/lib/source-code/token-store/cursors.js index b315c7e65e1a7c..30c72b69b8f962 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/cursors.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/cursors.js @@ -28,8 +28,8 @@ class CursorFactory { /** * Initializes this cursor. - * @param {Function} TokenCursor - The class of the cursor which iterates tokens only. - * @param {Function} TokenCommentCursor - The class of the cursor which iterates the mix of tokens and comments. + * @param {Function} TokenCursor The class of the cursor which iterates tokens only. + * @param {Function} TokenCommentCursor The class of the cursor which iterates the mix of tokens and comments. */ constructor(TokenCursor, TokenCommentCursor) { this.TokenCursor = TokenCursor; @@ -38,13 +38,12 @@ class CursorFactory { /** * Creates a base cursor instance that can be decorated by createCursor. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {boolean} includeComments - The flag to iterate comments as well. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {boolean} includeComments The flag to iterate comments as well. * @returns {Cursor} The created base cursor. */ createBaseCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments) { @@ -55,16 +54,15 @@ class CursorFactory { /** * Creates a cursor that iterates tokens with normalized options. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {boolean} includeComments - The flag to iterate comments as well. - * @param {Function|null} filter - The predicate function to choose tokens. - * @param {number} skip - The count of tokens the cursor skips. - * @param {number} count - The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {boolean} includeComments The flag to iterate comments as well. + * @param {Function|null} filter The predicate function to choose tokens. + * @param {number} skip The count of tokens the cursor skips. + * @param {number} count The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. * @returns {Cursor} The created cursor. */ createCursor(tokens, comments, indexMap, startLoc, endLoc, includeComments, filter, skip, count) { diff --git a/tools/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js index f0bff9c51dba76..3ee7b0b39755e1 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/decorative-cursor.js @@ -21,7 +21,7 @@ module.exports = class DecorativeCursor extends Cursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. + * @param {Cursor} cursor The cursor to be decorated. */ constructor(cursor) { super(); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/filter-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/filter-cursor.js index 7133627bd395a1..08c4f22031af86 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/filter-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/filter-cursor.js @@ -21,8 +21,8 @@ module.exports = class FilterCursor extends DecorativeCursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. - * @param {Function} predicate - The predicate function to decide tokens this cursor iterates. + * @param {Cursor} cursor The cursor to be decorated. + * @param {Function} predicate The predicate function to decide tokens this cursor iterates. */ constructor(cursor, predicate) { super(cursor); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js index be08552970fcd1..50c7a394f38476 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/forward-token-comment-cursor.js @@ -22,11 +22,11 @@ module.exports = class ForwardTokenCommentCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js index 523ed398fa3d9e..e8c18609621fba 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/forward-token-cursor.js @@ -22,11 +22,11 @@ module.exports = class ForwardTokenCursor extends Cursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. */ constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/index.js b/tools/node_modules/eslint/lib/source-code/token-store/index.js index 8f9b09e95efe86..25db8a4f4dbe59 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/index.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/index.js @@ -28,9 +28,8 @@ const INDEX_MAP = Symbol("indexMap"); * * The first/last location of tokens is mapped to the index of the token. * The first/last location of comments is mapped to the index of the next token of each comment. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. * @returns {Object} The map from locations to indices in `tokens`. * @private */ @@ -62,17 +61,16 @@ function createIndexMap(tokens, comments) { /** * Creates the cursor iterates tokens with options. - * - * @param {CursorFactory} factory - The cursor factory to initialize cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number|Function|Object} [opts=0] - The option object. If this is a number then it's `opts.skip`. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] - The predicate function to choose tokens. - * @param {number} [opts.skip=0] - The count of tokens the cursor skips. + * @param {CursorFactory} factory The cursor factory to initialize cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.skip`. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.skip=0] The count of tokens the cursor skips. * @returns {Cursor} The created cursor. * @private */ @@ -98,17 +96,16 @@ function createCursorWithSkip(factory, tokens, comments, indexMap, startLoc, end /** * Creates the cursor iterates tokens with options. - * - * @param {CursorFactory} factory - The cursor factory to initialize cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number|Function|Object} [opts=0] - The option object. If this is a number then it's `opts.count`. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments] - The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] - The predicate function to choose tokens. - * @param {number} [opts.count=0] - The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @param {CursorFactory} factory The cursor factory to initialize cursor. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number|Function|Object} [opts=0] The option object. If this is a number then it's `opts.count`. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. * @returns {Cursor} The created cursor. * @private */ @@ -138,29 +135,27 @@ function createCursorWithCount(factory, tokens, comments, indexMap, startLoc, en /** * Creates the cursor iterates tokens with options. * This is overload function of the below. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {Function|Object} opts - The option object. If this is a function then it's `opts.filter`. - * @param {boolean} [opts.includeComments] - The flag to iterate comments as well. - * @param {Function|null} [opts.filter=null] - The predicate function to choose tokens. - * @param {number} [opts.count=0] - The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {Function|Object} opts The option object. If this is a function then it's `opts.filter`. + * @param {boolean} [opts.includeComments] The flag to iterate comments as well. + * @param {Function|null} [opts.filter=null] The predicate function to choose tokens. + * @param {number} [opts.count=0] The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility. * @returns {Cursor} The created cursor. * @private */ /** * Creates the cursor iterates tokens with options. - * - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number} [beforeCount=0] - The number of tokens before the node to retrieve. - * @param {boolean} [afterCount=0] - The number of tokens after the node to retrieve. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number} [beforeCount=0] The number of tokens before the node to retrieve. + * @param {boolean} [afterCount=0] The number of tokens after the node to retrieve. * @returns {Cursor} The created cursor. * @private */ @@ -176,7 +171,7 @@ function createCursorWithPadding(tokens, comments, indexMap, startLoc, endLoc, b /** * Gets comment tokens that are adjacent to the current cursor position. - * @param {Cursor} cursor - A cursor instance. + * @param {Cursor} cursor A cursor instance. * @returns {Array} An array of comment tokens adjacent to the current cursor position. * @private */ @@ -211,8 +206,8 @@ module.exports = class TokenStore { /** * Initializes this token store. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. */ constructor(tokens, comments) { this[TOKENS] = tokens; @@ -226,9 +221,9 @@ module.exports = class TokenStore { /** * Gets the token starting at the specified index. - * @param {number} offset - Index of the start of the token's range. - * @param {Object} [options=0] - The option object. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. + * @param {number} offset Index of the start of the token's range. + * @param {Object} [options=0] The option object. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. * @returns {Token|null} The token starting at index, or null if no such token. */ getTokenByRangeStart(offset, options) { @@ -250,11 +245,11 @@ module.exports = class TokenStore { /** * Gets the first token of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.skip=0] - The count of tokens the cursor skips. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.skip`. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.skip=0] The count of tokens the cursor skips. * @returns {Token|null} An object representing the token. */ getFirstToken(node, options) { @@ -271,8 +266,8 @@ module.exports = class TokenStore { /** * Gets the last token of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getLastToken(node, options) { @@ -289,8 +284,8 @@ module.exports = class TokenStore { /** * Gets the token that precedes a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getTokenBefore(node, options) { @@ -307,8 +302,8 @@ module.exports = class TokenStore { /** * Gets the token that follows a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getTokenAfter(node, options) { @@ -325,9 +320,9 @@ module.exports = class TokenStore { /** * Gets the first token between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left - Node before the desired token range. - * @param {ASTNode|Token|Comment} right - Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getFirstTokenBetween(left, right, options) { @@ -346,7 +341,7 @@ module.exports = class TokenStore { * Gets the last token between two non-overlapping nodes. * @param {ASTNode|Token|Comment} left Node before the desired token range. * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstToken() + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstToken() * @returns {Token|null} An object representing the token. */ getLastTokenBetween(left, right, options) { @@ -393,11 +388,11 @@ module.exports = class TokenStore { /** * Gets the first `count` tokens of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates. + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. If this is a number then it's `options.count`. If this is a function then it's `options.filter`. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. * @returns {Token[]} Tokens. */ getFirstTokens(node, options) { @@ -414,8 +409,8 @@ module.exports = class TokenStore { /** * Gets the last `count` tokens of the given node. - * @param {ASTNode} node - The AST node. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode} node The AST node. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens. */ getLastTokens(node, options) { @@ -432,8 +427,8 @@ module.exports = class TokenStore { /** * Gets the `count` tokens that precedes a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens. */ getTokensBefore(node, options) { @@ -450,8 +445,8 @@ module.exports = class TokenStore { /** * Gets the `count` tokens that follows a given node or token. - * @param {ASTNode|Token|Comment} node - The AST node or token. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode|Token|Comment} node The AST node or token. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens. */ getTokensAfter(node, options) { @@ -468,9 +463,9 @@ module.exports = class TokenStore { /** * Gets the first `count` tokens between two non-overlapping nodes. - * @param {ASTNode|Token|Comment} left - Node before the desired token range. - * @param {ASTNode|Token|Comment} right - Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {ASTNode|Token|Comment} left Node before the desired token range. + * @param {ASTNode|Token|Comment} right Node after the desired token range. + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens between left and right. */ getFirstTokensBetween(left, right, options) { @@ -489,7 +484,7 @@ module.exports = class TokenStore { * Gets the last `count` tokens between two non-overlapping nodes. * @param {ASTNode|Token|Comment} left Node before the desired token range. * @param {ASTNode|Token|Comment} right Node after the desired token range. - * @param {number|Function|Object} [options=0] - The option object. Same options as getFirstTokens() + * @param {number|Function|Object} [options=0] The option object. Same options as getFirstTokens() * @returns {Token[]} Tokens between left and right. */ getLastTokensBetween(left, right, options) { @@ -506,18 +501,18 @@ module.exports = class TokenStore { /** * Gets all tokens that are related to the given node. - * @param {ASTNode} node - The AST node. + * @param {ASTNode} node The AST node. * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. * @returns {Token[]} Array of objects representing tokens. */ /** * Gets all tokens that are related to the given node. - * @param {ASTNode} node - The AST node. - * @param {int} [beforeCount=0] - The number of tokens before the node to retrieve. - * @param {int} [afterCount=0] - The number of tokens after the node to retrieve. + * @param {ASTNode} node The AST node. + * @param {int} [beforeCount=0] The number of tokens before the node to retrieve. + * @param {int} [afterCount=0] The number of tokens after the node to retrieve. * @returns {Token[]} Array of objects representing tokens. */ getTokens(node, beforeCount, afterCount) { @@ -537,9 +532,9 @@ module.exports = class TokenStore { * @param {ASTNode|Token|Comment} left Node before the desired token range. * @param {ASTNode|Token|Comment} right Node after the desired token range. * @param {Function|Object} options The option object. If this is a function then it's `options.filter`. - * @param {boolean} [options.includeComments=false] - The flag to iterate comments as well. - * @param {Function|null} [options.filter=null] - The predicate function to choose tokens. - * @param {number} [options.count=0] - The maximum count of tokens the cursor iterates. + * @param {boolean} [options.includeComments=false] The flag to iterate comments as well. + * @param {Function|null} [options.filter=null] The predicate function to choose tokens. + * @param {number} [options.count=0] The maximum count of tokens the cursor iterates. * @returns {Token[]} Tokens between left and right. */ /** @@ -567,9 +562,8 @@ module.exports = class TokenStore { /** * Checks whether any comments exist or not between the given 2 nodes. - * - * @param {ASTNode} left - The node to check. - * @param {ASTNode} right - The node to check. + * @param {ASTNode} left The node to check. + * @param {ASTNode} right The node to check. * @returns {boolean} `true` if one or more comments exist. */ commentsExistBetween(left, right) { diff --git a/tools/node_modules/eslint/lib/source-code/token-store/limit-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/limit-cursor.js index efb46cf0e3f40d..0fd92a77657ab3 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/limit-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/limit-cursor.js @@ -21,8 +21,8 @@ module.exports = class LimitCursor extends DecorativeCursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. - * @param {number} count - The count of tokens this cursor iterates. + * @param {Cursor} cursor The cursor to be decorated. + * @param {number} count The count of tokens this cursor iterates. */ constructor(cursor, count) { super(cursor); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js index c083aed1e9bab9..89349fa1c69526 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/padded-token-cursor.js @@ -22,13 +22,13 @@ module.exports = class PaddedTokenCursor extends ForwardTokenCursor { /** * Initializes this cursor. - * @param {Token[]} tokens - The array of tokens. - * @param {Comment[]} comments - The array of comments. - * @param {Object} indexMap - The map from locations to indices in `tokens`. - * @param {number} startLoc - The start location of the iteration range. - * @param {number} endLoc - The end location of the iteration range. - * @param {number} beforeCount - The number of tokens this cursor iterates before start. - * @param {number} afterCount - The number of tokens this cursor iterates after end. + * @param {Token[]} tokens The array of tokens. + * @param {Comment[]} comments The array of comments. + * @param {Object} indexMap The map from locations to indices in `tokens`. + * @param {number} startLoc The start location of the iteration range. + * @param {number} endLoc The end location of the iteration range. + * @param {number} beforeCount The number of tokens this cursor iterates before start. + * @param {number} afterCount The number of tokens this cursor iterates after end. */ constructor(tokens, comments, indexMap, startLoc, endLoc, beforeCount, afterCount) { super(tokens, comments, indexMap, startLoc, endLoc); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/skip-cursor.js b/tools/node_modules/eslint/lib/source-code/token-store/skip-cursor.js index ab34dfab0db3c6..f068f531c1e3df 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/skip-cursor.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/skip-cursor.js @@ -21,8 +21,8 @@ module.exports = class SkipCursor extends DecorativeCursor { /** * Initializes this cursor. - * @param {Cursor} cursor - The cursor to be decorated. - * @param {number} count - The count of tokens this cursor skips. + * @param {Cursor} cursor The cursor to be decorated. + * @param {number} count The count of tokens this cursor skips. */ constructor(cursor, count) { super(cursor); diff --git a/tools/node_modules/eslint/lib/source-code/token-store/utils.js b/tools/node_modules/eslint/lib/source-code/token-store/utils.js index 34b0a9af6da68d..444684b52f1bb0 100644 --- a/tools/node_modules/eslint/lib/source-code/token-store/utils.js +++ b/tools/node_modules/eslint/lib/source-code/token-store/utils.js @@ -16,8 +16,7 @@ const lodash = require("lodash"); /** * Gets `token.range[0]` from the given token. - * - * @param {Node|Token|Comment} token - The token to get. + * @param {Node|Token|Comment} token The token to get. * @returns {number} The start location. * @private */ @@ -32,9 +31,8 @@ function getStartLocation(token) { /** * Binary-searches the index of the first token which is after the given location. * If it was not found, this returns `tokens.length`. - * - * @param {(Token|Comment)[]} tokens - It searches the token in this list. - * @param {number} location - The location to search. + * @param {(Token|Comment)[]} tokens It searches the token in this list. + * @param {number} location The location to search. * @returns {number} The found index or `tokens.length`. */ exports.search = function search(tokens, location) { @@ -48,10 +46,9 @@ exports.search = function search(tokens, location) { /** * Gets the index of the `startLoc` in `tokens`. * `startLoc` can be the value of `node.range[1]`, so this checks about `startLoc - 1` as well. - * - * @param {(Token|Comment)[]} tokens - The tokens to find an index. - * @param {Object} indexMap - The map from locations to indices. - * @param {number} startLoc - The location to get an index. + * @param {(Token|Comment)[]} tokens The tokens to find an index. + * @param {Object} indexMap The map from locations to indices. + * @param {number} startLoc The location to get an index. * @returns {number} The index. */ exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) { @@ -77,10 +74,9 @@ exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) { /** * Gets the index of the `endLoc` in `tokens`. * The information of end locations are recorded at `endLoc - 1` in `indexMap`, so this checks about `endLoc - 1` as well. - * - * @param {(Token|Comment)[]} tokens - The tokens to find an index. - * @param {Object} indexMap - The map from locations to indices. - * @param {number} endLoc - The location to get an index. + * @param {(Token|Comment)[]} tokens The tokens to find an index. + * @param {Object} indexMap The map from locations to indices. + * @param {number} endLoc The location to get an index. * @returns {number} The index. */ exports.getLastIndex = function getLastIndex(tokens, indexMap, endLoc) { diff --git a/tools/node_modules/eslint/node_modules/acorn-jsx/README.md b/tools/node_modules/eslint/node_modules/acorn-jsx/README.md index 2bbb1d99fd8cfa..317c3ac4a5534e 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/README.md +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/README.md @@ -1,19 +1,15 @@ # Acorn-JSX -[![Build Status](https://travis-ci.org/RReverser/acorn-jsx.svg?branch=master)](https://travis-ci.org/RReverser/acorn-jsx) +[![Build Status](https://travis-ci.org/acornjs/acorn-jsx.svg?branch=master)](https://travis-ci.org/acornjs/acorn-jsx) [![NPM version](https://img.shields.io/npm/v/acorn-jsx.svg)](https://www.npmjs.org/package/acorn-jsx) This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript. -It was created as an experimental alternative, faster [React.js JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) parser. - -According to [benchmarks](https://github.com/RReverser/acorn-jsx/blob/master/test/bench.html), Acorn-JSX is 2x faster than official [Esprima-based parser](https://github.com/facebook/esprima) when location tracking is turned on in both (call it "source maps enabled mode"). At the same time, it consumes all the ES6+JSX syntax that can be consumed by Esprima-FB (this is proved by [official tests](https://github.com/RReverser/acorn-jsx/blob/master/test/tests-jsx.js)). - -**UPDATE [14-Apr-2015]**: Facebook implementation started [deprecation process](https://github.com/facebook/esprima/issues/111) in favor of Acorn + Acorn-JSX + Babel for parsing and transpiling JSX syntax. +It was created as an experimental alternative, faster [React.js JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) parser. Later, it replaced the [official parser](https://github.com/facebookarchive/esprima) and these days is used by many prominent development tools. ## Transpiler -Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out the [babel transpiler](https://babeljs.io/) which uses `acorn-jsx` under the hood. +Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out [Babel](https://babeljs.io/) and [Buble](https://buble.surge.sh/) transpilers which use `acorn-jsx` under the hood. ## Usage diff --git a/tools/node_modules/eslint/node_modules/acorn-jsx/index.js b/tools/node_modules/eslint/node_modules/acorn-jsx/index.js index 460e7933992122..6df802bee9185e 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/index.js +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/index.js @@ -5,40 +5,53 @@ const XHTMLEntities = require('./xhtml'); const hexNumber = /^[\da-fA-F]+$/; const decimalNumber = /^\d+$/; -const acorn = require("acorn"); -const tt = acorn.tokTypes; -const TokContext = acorn.TokContext; -const tokContexts = acorn.tokContexts; -const TokenType = acorn.TokenType; -const isNewLine = acorn.isNewLine; -const isIdentifierStart = acorn.isIdentifierStart; -const isIdentifierChar = acorn.isIdentifierChar; - -const tc_oTag = new TokContext('...', true, true); - -const tok = { - jsxName: new TokenType('jsxName'), - jsxText: new TokenType('jsxText', {beforeExpr: true}), - jsxTagStart: new TokenType('jsxTagStart'), - jsxTagEnd: new TokenType('jsxTagEnd') -} +// The map to `acorn-jsx` tokens from `acorn` namespace objects. +const acornJsxMap = new WeakMap(); + +// Get the original tokens for the given `acorn` namespace object. +function getJsxTokens(acorn) { + acorn = acorn.Parser.acorn || acorn; + let acornJsx = acornJsxMap.get(acorn); + if (!acornJsx) { + const tt = acorn.tokTypes; + const TokContext = acorn.TokContext; + const TokenType = acorn.TokenType; + const tc_oTag = new TokContext('...', true, true); + const tokContexts = { + tc_oTag: tc_oTag, + tc_cTag: tc_cTag, + tc_expr: tc_expr + }; + const tokTypes = { + jsxName: new TokenType('jsxName'), + jsxText: new TokenType('jsxText', {beforeExpr: true}), + jsxTagStart: new TokenType('jsxTagStart'), + jsxTagEnd: new TokenType('jsxTagEnd') + }; + + tokTypes.jsxTagStart.updateContext = function() { + this.context.push(tc_expr); // treat as beginning of JSX expression + this.context.push(tc_oTag); // start opening tag context + this.exprAllowed = false; + }; + tokTypes.jsxTagEnd.updateContext = function(prevType) { + let out = this.context.pop(); + if (out === tc_oTag && prevType === tt.slash || out === tc_cTag) { + this.context.pop(); + this.exprAllowed = this.curContext() === tc_expr; + } else { + this.exprAllowed = true; + } + }; -tok.jsxTagStart.updateContext = function() { - this.context.push(tc_expr); // treat as beginning of JSX expression - this.context.push(tc_oTag); // start opening tag context - this.exprAllowed = false; -}; -tok.jsxTagEnd.updateContext = function(prevType) { - let out = this.context.pop(); - if (out === tc_oTag && prevType === tt.slash || out === tc_cTag) { - this.context.pop(); - this.exprAllowed = this.curContext() === tc_expr; - } else { - this.exprAllowed = true; + acornJsx = { tokContexts: tokContexts, tokTypes: tokTypes }; + acornJsxMap.set(acorn, acornJsx); } -}; + + return acornJsx; +} // Transforms JSX element name to string. @@ -64,12 +77,38 @@ module.exports = function(options) { allowNamespaces: options.allowNamespaces !== false, allowNamespacedObjects: !!options.allowNamespacedObjects }, Parser); - } + }; }; -module.exports.tokTypes = tok; + +// This is `tokTypes` of the peer dep. +// This can be different instances from the actual `tokTypes` this plugin uses. +Object.defineProperty(module.exports, "tokTypes", { + get: function get_tokTypes() { + return getJsxTokens(require("acorn")).tokTypes; + }, + configurable: true, + enumerable: true +}); function plugin(options, Parser) { + const acorn = Parser.acorn || require("acorn"); + const acornJsx = getJsxTokens(acorn); + const tt = acorn.tokTypes; + const tok = acornJsx.tokTypes; + const tokContexts = acorn.tokContexts; + const tc_oTag = acornJsx.tokContexts.tc_oTag; + const tc_cTag = acornJsx.tokContexts.tc_cTag; + const tc_expr = acornJsx.tokContexts.tc_expr; + const isNewLine = acorn.isNewLine; + const isIdentifierStart = acorn.isIdentifierStart; + const isIdentifierChar = acorn.isIdentifierChar; + return class extends Parser { + // Expose actual `tokTypes` and `tokContexts` to other plugins. + static get acornJsx() { + return acornJsx; + } + // Reads inline JSX contents token. jsx_readToken() { let out = '', chunkStart = this.pos; @@ -419,7 +458,7 @@ function plugin(options, Parser) { ++this.pos; return this.finishToken(tok.jsxTagStart); } - return super.readToken(code) + return super.readToken(code); } updateContext(prevType) { @@ -427,7 +466,7 @@ function plugin(options, Parser) { var curContext = this.curContext(); if (curContext == tc_oTag) this.context.push(tokContexts.b_expr); else if (curContext == tc_expr) this.context.push(tokContexts.b_tmpl); - else super.updateContext(prevType) + else super.updateContext(prevType); this.exprAllowed = true; } else if (this.type === tt.slash && prevType === tok.jsxTagStart) { this.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore diff --git a/tools/node_modules/eslint/node_modules/acorn-jsx/package.json b/tools/node_modules/eslint/node_modules/acorn-jsx/package.json index a8f903e4aacede..55b6aadbcedb08 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/package.json +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/package.json @@ -1,14 +1,14 @@ { "bugs": { - "url": "https://github.com/RReverser/acorn-jsx/issues" + "url": "https://github.com/acornjs/acorn-jsx/issues" }, "bundleDependencies": false, "deprecated": false, - "description": "Alternative, faster React.js JSX parser", + "description": "Modern, fast React.js JSX parser", "devDependencies": { "acorn": "^7.0.0" }, - "homepage": "https://github.com/RReverser/acorn-jsx", + "homepage": "https://github.com/acornjs/acorn-jsx", "license": "MIT", "maintainers": [ { @@ -23,10 +23,10 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/RReverser/acorn-jsx.git" + "url": "git+https://github.com/acornjs/acorn-jsx.git" }, "scripts": { "test": "node test/run.js" }, - "version": "5.0.2" + "version": "5.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ansi-escapes/index.js b/tools/node_modules/eslint/node_modules/ansi-escapes/index.js index f201915dee9290..4638bbc3d62b29 100644 --- a/tools/node_modules/eslint/node_modules/ansi-escapes/index.js +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/index.js @@ -1,12 +1,15 @@ 'use strict'; -const x = module.exports; +const ansiEscapes = module.exports; +// TODO: remove this in the next major version +module.exports.default = ansiEscapes; + const ESC = '\u001B['; const OSC = '\u001B]'; const BEL = '\u0007'; const SEP = ';'; const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'; -x.cursorTo = (x, y) => { +ansiEscapes.cursorTo = (x, y) => { if (typeof x !== 'number') { throw new TypeError('The `x` argument is required'); } @@ -18,7 +21,7 @@ x.cursorTo = (x, y) => { return ESC + (y + 1) + ';' + (x + 1) + 'H'; }; -x.cursorMove = (x, y) => { +ansiEscapes.cursorMove = (x, y) => { if (typeof x !== 'number') { throw new TypeError('The `x` argument is required'); } @@ -40,56 +43,56 @@ x.cursorMove = (x, y) => { return ret; }; -x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A'; -x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B'; -x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C'; -x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D'; - -x.cursorLeft = ESC + 'G'; -x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's'); -x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u'); -x.cursorGetPosition = ESC + '6n'; -x.cursorNextLine = ESC + 'E'; -x.cursorPrevLine = ESC + 'F'; -x.cursorHide = ESC + '?25l'; -x.cursorShow = ESC + '?25h'; - -x.eraseLines = count => { +ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'; +ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'; +ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'; +ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'; + +ansiEscapes.cursorLeft = ESC + 'G'; +ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'; +ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'; +ansiEscapes.cursorGetPosition = ESC + '6n'; +ansiEscapes.cursorNextLine = ESC + 'E'; +ansiEscapes.cursorPrevLine = ESC + 'F'; +ansiEscapes.cursorHide = ESC + '?25l'; +ansiEscapes.cursorShow = ESC + '?25h'; + +ansiEscapes.eraseLines = count => { let clear = ''; for (let i = 0; i < count; i++) { - clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : ''); + clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : ''); } if (count) { - clear += x.cursorLeft; + clear += ansiEscapes.cursorLeft; } return clear; }; -x.eraseEndLine = ESC + 'K'; -x.eraseStartLine = ESC + '1K'; -x.eraseLine = ESC + '2K'; -x.eraseDown = ESC + 'J'; -x.eraseUp = ESC + '1J'; -x.eraseScreen = ESC + '2J'; -x.scrollUp = ESC + 'S'; -x.scrollDown = ESC + 'T'; +ansiEscapes.eraseEndLine = ESC + 'K'; +ansiEscapes.eraseStartLine = ESC + '1K'; +ansiEscapes.eraseLine = ESC + '2K'; +ansiEscapes.eraseDown = ESC + 'J'; +ansiEscapes.eraseUp = ESC + '1J'; +ansiEscapes.eraseScreen = ESC + '2J'; +ansiEscapes.scrollUp = ESC + 'S'; +ansiEscapes.scrollDown = ESC + 'T'; -x.clearScreen = '\u001Bc'; +ansiEscapes.clearScreen = '\u001Bc'; -x.clearTerminal = process.platform === 'win32' ? - `${x.eraseScreen}${ESC}0f` : +ansiEscapes.clearTerminal = process.platform === 'win32' ? + `${ansiEscapes.eraseScreen}${ESC}0f` : // 1. Erases the screen (Only done in case `2` is not supported) // 2. Erases the whole screen including scrollback buffer // 3. Moves cursor to the top-left position // More info: https://www.real-world-systems.com/docs/ANSIcode.html - `${x.eraseScreen}${ESC}3J${ESC}H`; + `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`; -x.beep = BEL; +ansiEscapes.beep = BEL; -x.link = (text, url) => { +ansiEscapes.link = (text, url) => { return [ OSC, '8', @@ -106,26 +109,24 @@ x.link = (text, url) => { ].join(''); }; -x.image = (buf, opts) => { - opts = opts || {}; - - let ret = OSC + '1337;File=inline=1'; +ansiEscapes.image = (buffer, options = {}) => { + let ret = `${OSC}1337;File=inline=1`; - if (opts.width) { - ret += `;width=${opts.width}`; + if (options.width) { + ret += `;width=${options.width}`; } - if (opts.height) { - ret += `;height=${opts.height}`; + if (options.height) { + ret += `;height=${options.height}`; } - if (opts.preserveAspectRatio === false) { + if (options.preserveAspectRatio === false) { ret += ';preserveAspectRatio=0'; } - return ret + ':' + buf.toString('base64') + BEL; + return ret + ':' + buffer.toString('base64') + BEL; }; -x.iTerm = {}; - -x.iTerm.setCwd = cwd => OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL; +ansiEscapes.iTerm = { + setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}` +}; diff --git a/tools/node_modules/eslint/node_modules/ansi-escapes/package.json b/tools/node_modules/eslint/node_modules/ansi-escapes/package.json index d1ba760b8b5dd9..a58ed743a59171 100644 --- a/tools/node_modules/eslint/node_modules/ansi-escapes/package.json +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/package.json @@ -8,17 +8,23 @@ "url": "https://github.com/sindresorhus/ansi-escapes/issues" }, "bundleDependencies": false, + "dependencies": { + "type-fest": "^0.5.2" + }, "deprecated": false, "description": "ANSI escape codes for manipulating the terminal", "devDependencies": { - "ava": "*", - "xo": "*" + "@types/node": "^12.0.7", + "ava": "^2.1.0", + "tsd": "^0.7.1", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=8" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/ansi-escapes#readme", "keywords": [ @@ -53,7 +59,7 @@ "url": "git+https://github.com/sindresorhus/ansi-escapes.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "3.2.0" + "version": "4.2.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ansi-escapes/readme.md b/tools/node_modules/eslint/node_modules/ansi-escapes/readme.md index 513ef6082614cd..b290753094d948 100644 --- a/tools/node_modules/eslint/node_modules/ansi-escapes/readme.md +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/readme.md @@ -23,11 +23,11 @@ process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft); ## API -### cursorTo(x, [y]) +### cursorTo(x, y?) Set the absolute position of the cursor. `x0` `y0` is the top left of the screen. -### cursorMove(x, [y]) +### cursorMove(x, y?) Set the position of the cursor relative to its current position. @@ -41,11 +41,11 @@ Move cursor down a specific amount of rows. Default is `1`. ### cursorForward(count) -Move cursor forward a specific amount of rows. Default is `1`. +Move cursor forward a specific amount of columns. Default is `1`. ### cursorBackward(count) -Move cursor backward a specific amount of rows. Default is `1`. +Move cursor backward a specific amount of columns. Default is `1`. ### cursorLeft @@ -133,7 +133,7 @@ Create a clickable link. [Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support. -### image(input, [options]) +### image(filePath, options?) Display an image. @@ -149,10 +149,12 @@ Buffer of an image. Usually read in with `fs.readFile()`. #### options +Type: `object` + ##### width ##### height -Type: `string` `number` +Type: `string | number` The width and height are given as a number followed by a unit, or the word "auto". @@ -166,7 +168,7 @@ The width and height are given as a number followed by a unit, or the word "auto Type: `boolean`
    Default: `true` -### iTerm.setCwd([path]) +### iTerm.setCwd(path?) Type: `string`
    Default: `process.cwd()` @@ -179,6 +181,14 @@ Default: `process.cwd()` - [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal -## License +--- -MIT © [Sindre Sorhus](https://sindresorhus.com) +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/tools/node_modules/eslint/node_modules/ansi-regex/index.js b/tools/node_modules/eslint/node_modules/ansi-regex/index.js index c4aaecf5050639..c25448009f304d 100644 --- a/tools/node_modules/eslint/node_modules/ansi-regex/index.js +++ b/tools/node_modules/eslint/node_modules/ansi-regex/index.js @@ -1,10 +1,14 @@ 'use strict'; -module.exports = () => { +module.exports = options => { + options = Object.assign({ + onlyFirst: false + }, options); + const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))' + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' ].join('|'); - return new RegExp(pattern, 'g'); + return new RegExp(pattern, options.onlyFirst ? undefined : 'g'); }; diff --git a/tools/node_modules/eslint/node_modules/ansi-regex/package.json b/tools/node_modules/eslint/node_modules/ansi-regex/package.json index d4df7d97af4f3f..db8f3cc8c7d14e 100644 --- a/tools/node_modules/eslint/node_modules/ansi-regex/package.json +++ b/tools/node_modules/eslint/node_modules/ansi-regex/package.json @@ -11,11 +11,11 @@ "deprecated": false, "description": "Regular expression for matching ANSI escape codes", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^0.25.0", + "xo": "^0.23.0" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ "index.js" @@ -58,5 +58,5 @@ "test": "xo && ava", "view-supported": "node fixtures/view-codes.js" }, - "version": "3.0.0" + "version": "4.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ansi-regex/readme.md b/tools/node_modules/eslint/node_modules/ansi-regex/readme.md index 22db1c34055556..d19c44667e704b 100644 --- a/tools/node_modules/eslint/node_modules/ansi-regex/readme.md +++ b/tools/node_modules/eslint/node_modules/ansi-regex/readme.md @@ -2,6 +2,20 @@ > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) +--- + +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    + +--- + ## Install @@ -23,9 +37,31 @@ ansiRegex().test('cake'); '\u001B[4mcake\u001B[0m'.match(ansiRegex()); //=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] ``` +## API + +### ansiRegex([options]) + +Returns a regex for matching ANSI escape codes. + +#### options + +##### onlyFirst + +Type: `boolean`
    +Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + ## FAQ ### Why do you test for codes not in the ECMA 48 standard? @@ -35,6 +71,11 @@ Some of the codes we run as a test are codes that we acquired finding various li On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. +## Security + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. + + ## Maintainers - [Sindre Sorhus](https://github.com/sindresorhus) diff --git a/tools/node_modules/eslint/node_modules/cli-cursor/index.js b/tools/node_modules/eslint/node_modules/cli-cursor/index.js index 6284a8289642e6..710c4051742f52 100644 --- a/tools/node_modules/eslint/node_modules/cli-cursor/index.js +++ b/tools/node_modules/eslint/node_modules/cli-cursor/index.js @@ -1,39 +1,35 @@ 'use strict'; const restoreCursor = require('restore-cursor'); -let hidden = false; +let isHidden = false; -exports.show = stream => { - const s = stream || process.stderr; - - if (!s.isTTY) { +exports.show = (writableStream = process.stderr) => { + if (!writableStream.isTTY) { return; } - hidden = false; - s.write('\u001b[?25h'); + isHidden = false; + writableStream.write('\u001B[?25h'); }; -exports.hide = stream => { - const s = stream || process.stderr; - - if (!s.isTTY) { +exports.hide = (writableStream = process.stderr) => { + if (!writableStream.isTTY) { return; } restoreCursor(); - hidden = true; - s.write('\u001b[?25l'); + isHidden = true; + writableStream.write('\u001B[?25l'); }; -exports.toggle = (force, stream) => { +exports.toggle = (force, writableStream) => { if (force !== undefined) { - hidden = force; + isHidden = force; } - if (hidden) { - exports.show(stream); + if (isHidden) { + exports.show(writableStream); } else { - exports.hide(stream); + exports.hide(writableStream); } }; diff --git a/tools/node_modules/eslint/node_modules/cli-cursor/license b/tools/node_modules/eslint/node_modules/cli-cursor/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/cli-cursor/license +++ b/tools/node_modules/eslint/node_modules/cli-cursor/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/cli-cursor/package.json b/tools/node_modules/eslint/node_modules/cli-cursor/package.json index 44efffe03b4e66..f67104cccbd246 100644 --- a/tools/node_modules/eslint/node_modules/cli-cursor/package.json +++ b/tools/node_modules/eslint/node_modules/cli-cursor/package.json @@ -9,19 +9,22 @@ }, "bundleDependencies": false, "dependencies": { - "restore-cursor": "^2.0.0" + "restore-cursor": "^3.1.0" }, "deprecated": false, "description": "Toggle the CLI cursor", "devDependencies": { - "ava": "*", - "xo": "*" + "@types/node": "^12.0.7", + "ava": "^2.1.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=8" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/cli-cursor#readme", "keywords": [ @@ -46,10 +49,7 @@ "url": "git+https://github.com/sindresorhus/cli-cursor.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "2.1.0", - "xo": { - "esnext": true - } + "version": "3.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/cli-cursor/readme.md b/tools/node_modules/eslint/node_modules/cli-cursor/readme.md index 75c18e5fea8108..3478ac80e54fce 100644 --- a/tools/node_modules/eslint/node_modules/cli-cursor/readme.md +++ b/tools/node_modules/eslint/node_modules/cli-cursor/readme.md @@ -8,7 +8,7 @@ The cursor is [gracefully restored](https://github.com/sindresorhus/restore-curs ## Install ``` -$ npm install --save cli-cursor +$ npm install cli-cursor ``` @@ -26,20 +26,30 @@ cliCursor.toggle(unicornsAreAwesome); ## API -### .show([stream]) +### .show(stream?) -### .hide([stream]) +### .hide(stream?) -### .toggle(force, [stream]) +### .toggle(force?, stream?) -`force` is useful to show or hide the cursor based on a boolean. +#### force + +Useful for showing or hiding the cursor based on a boolean. #### stream -Type: `Stream`
    +Type: `stream.Writable`
    Default: `process.stderr` -## License +--- -MIT © [Sindre Sorhus](https://sindresorhus.com) +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/tools/node_modules/eslint/node_modules/emoji-regex/README.md b/tools/node_modules/eslint/node_modules/emoji-regex/README.md index 37cf14e01f72a5..f10e1733350471 100644 --- a/tools/node_modules/eslint/node_modules/emoji-regex/README.md +++ b/tools/node_modules/eslint/node_modules/emoji-regex/README.md @@ -2,7 +2,7 @@ _emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard. -This repository contains a script that generates this regular expression based on [the data from Unicode Technical Report #51](https://github.com/mathiasbynens/unicode-tr51). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard. +This repository contains a script that generates this regular expression based on [the data from Unicode v12](https://github.com/mathiasbynens/unicode-12.0.0). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard. ## Installation diff --git a/tools/node_modules/eslint/node_modules/emoji-regex/es2015/index.js b/tools/node_modules/eslint/node_modules/emoji-regex/es2015/index.js index 0216db95876da0..b4cf3dcd389935 100644 --- a/tools/node_modules/eslint/node_modules/emoji-regex/es2015/index.js +++ b/tools/node_modules/eslint/node_modules/emoji-regex/es2015/index.js @@ -2,5 +2,5 @@ module.exports = () => { // https://mths.be/emoji - return /\u{1F3F4}(?:\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074})\u{E007F}|\u200D\u2620\uFE0F)|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F468}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u{1F468}(?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F469}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F468}(?:\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|[\u{1F3FB}-\u{1F3FF}])|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}]|\u{1F469}\u200D\u{1F466}|\u{1F1F6}\u{1F1E6}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]|\u{1F1ED}[\u{1F1F0}\u{1F1F2}\u{1F1F3}\u{1F1F7}\u{1F1F9}\u{1F1FA}]|\u{1F1EC}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EE}\u{1F1F1}-\u{1F1F3}\u{1F1F5}-\u{1F1FA}\u{1F1FC}\u{1F1FE}]|\u{1F1EA}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1ED}\u{1F1F7}-\u{1F1FA}]|\u{1F1E8}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1EE}\u{1F1F0}-\u{1F1F5}\u{1F1F7}\u{1F1FA}-\u{1F1FF}]|\u{1F1F2}[\u{1F1E6}\u{1F1E8}-\u{1F1ED}\u{1F1F0}-\u{1F1FF}]|\u{1F1F3}[\u{1F1E6}\u{1F1E8}\u{1F1EA}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F4}\u{1F1F5}\u{1F1F7}\u{1F1FA}\u{1F1FF}]|\u{1F1FC}[\u{1F1EB}\u{1F1F8}]|\u{1F1FA}[\u{1F1E6}\u{1F1EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1F0}[\u{1F1EA}\u{1F1EC}-\u{1F1EE}\u{1F1F2}\u{1F1F3}\u{1F1F5}\u{1F1F7}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|\u{1F1F8}[\u{1F1E6}-\u{1F1EA}\u{1F1EC}-\u{1F1F4}\u{1F1F7}-\u{1F1F9}\u{1F1FB}\u{1F1FD}-\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1FF}[\u{1F1E6}\u{1F1F2}\u{1F1FC}]|\u{1F1EB}[\u{1F1EE}-\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1F7}]|\u{1F1F5}[\u{1F1E6}\u{1F1EA}-\u{1F1ED}\u{1F1F0}-\u{1F1F3}\u{1F1F7}-\u{1F1F9}\u{1F1FC}\u{1F1FE}]|\u{1F1E9}[\u{1F1EA}\u{1F1EC}\u{1F1EF}\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1FF}]|\u{1F1F9}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1ED}\u{1F1EF}-\u{1F1F4}\u{1F1F7}\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FF}]|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|[#\*0-9]\uFE0F\u20E3|\u{1F1F1}[\u{1F1E6}-\u{1F1E8}\u{1F1EE}\u{1F1F0}\u{1F1F7}-\u{1F1FB}\u{1F1FE}]|\u{1F1E6}[\u{1F1E8}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F2}\u{1F1F4}\u{1F1F6}-\u{1F1FA}\u{1F1FC}\u{1F1FD}\u{1F1FF}]|\u{1F1F7}[\u{1F1EA}\u{1F1F4}\u{1F1F8}\u{1F1FA}\u{1F1FC}]|\u{1F1FB}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1EE}\u{1F1F3}\u{1F1FA}]|\u{1F1FE}[\u{1F1EA}\u{1F1F9}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9D1}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F469}\u{1F46E}\u{1F470}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9D1}-\u{1F9DD}]/gu; + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F3F4}\u200D\u2620)\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F415}\u200D\u{1F9BA}|\u{1F469}\u200D\u{1F466}|\u{1F469}\u200D\u{1F467}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F1F6}\u{1F1E6}|[#\*0-9]\uFE0F\u20E3|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1F9}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1ED}\u{1F1EF}-\u{1F1F4}\u{1F1F7}\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FF}]|\u{1F1EA}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1ED}\u{1F1F7}-\u{1F1FA}]|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u{1F1F7}[\u{1F1EA}\u{1F1F4}\u{1F1F8}\u{1F1FA}\u{1F1FC}]|\u{1F469}[\u{1F3FB}-\u{1F3FF}]|\u{1F1F2}[\u{1F1E6}\u{1F1E8}-\u{1F1ED}\u{1F1F0}-\u{1F1FF}]|\u{1F1E6}[\u{1F1E8}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F2}\u{1F1F4}\u{1F1F6}-\u{1F1FA}\u{1F1FC}\u{1F1FD}\u{1F1FF}]|\u{1F1F0}[\u{1F1EA}\u{1F1EC}-\u{1F1EE}\u{1F1F2}\u{1F1F3}\u{1F1F5}\u{1F1F7}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1ED}[\u{1F1F0}\u{1F1F2}\u{1F1F3}\u{1F1F7}\u{1F1F9}\u{1F1FA}]|\u{1F1E9}[\u{1F1EA}\u{1F1EC}\u{1F1EF}\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1FF}]|\u{1F1FE}[\u{1F1EA}\u{1F1F9}]|\u{1F1EC}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EE}\u{1F1F1}-\u{1F1F3}\u{1F1F5}-\u{1F1FA}\u{1F1FC}\u{1F1FE}]|\u{1F1F8}[\u{1F1E6}-\u{1F1EA}\u{1F1EC}-\u{1F1F4}\u{1F1F7}-\u{1F1F9}\u{1F1FB}\u{1F1FD}-\u{1F1FF}]|\u{1F1EB}[\u{1F1EE}-\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1F7}]|\u{1F1F5}[\u{1F1E6}\u{1F1EA}-\u{1F1ED}\u{1F1F0}-\u{1F1F3}\u{1F1F7}-\u{1F1F9}\u{1F1FC}\u{1F1FE}]|\u{1F1FB}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1EE}\u{1F1F3}\u{1F1FA}]|\u{1F1F3}[\u{1F1E6}\u{1F1E8}\u{1F1EA}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F4}\u{1F1F5}\u{1F1F7}\u{1F1FA}\u{1F1FF}]|\u{1F1E8}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1EE}\u{1F1F0}-\u{1F1F5}\u{1F1F7}\u{1F1FA}-\u{1F1FF}]|\u{1F1F1}[\u{1F1E6}-\u{1F1E8}\u{1F1EE}\u{1F1F0}\u{1F1F7}-\u{1F1FB}\u{1F1FE}]|\u{1F1FF}[\u{1F1E6}\u{1F1F2}\u{1F1FC}]|\u{1F1FC}[\u{1F1EB}\u{1F1F8}]|\u{1F1FA}[\u{1F1E6}\u{1F1EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; }; diff --git a/tools/node_modules/eslint/node_modules/emoji-regex/es2015/text.js b/tools/node_modules/eslint/node_modules/emoji-regex/es2015/text.js index d0a771d36e487f..780309df58f1a2 100644 --- a/tools/node_modules/eslint/node_modules/emoji-regex/es2015/text.js +++ b/tools/node_modules/eslint/node_modules/emoji-regex/es2015/text.js @@ -2,5 +2,5 @@ module.exports = () => { // https://mths.be/emoji - return /\u{1F3F4}(?:\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074})\u{E007F}|\u200D\u2620\uFE0F)|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F468}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u{1F468}(?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F469}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F468}(?:\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|[\u{1F3FB}-\u{1F3FF}])|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}]|\u{1F469}\u200D\u{1F466}|\u{1F1F6}\u{1F1E6}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]|\u{1F1ED}[\u{1F1F0}\u{1F1F2}\u{1F1F3}\u{1F1F7}\u{1F1F9}\u{1F1FA}]|\u{1F1EC}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EE}\u{1F1F1}-\u{1F1F3}\u{1F1F5}-\u{1F1FA}\u{1F1FC}\u{1F1FE}]|\u{1F1EA}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1ED}\u{1F1F7}-\u{1F1FA}]|\u{1F1E8}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1EE}\u{1F1F0}-\u{1F1F5}\u{1F1F7}\u{1F1FA}-\u{1F1FF}]|\u{1F1F2}[\u{1F1E6}\u{1F1E8}-\u{1F1ED}\u{1F1F0}-\u{1F1FF}]|\u{1F1F3}[\u{1F1E6}\u{1F1E8}\u{1F1EA}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F4}\u{1F1F5}\u{1F1F7}\u{1F1FA}\u{1F1FF}]|\u{1F1FC}[\u{1F1EB}\u{1F1F8}]|\u{1F1FA}[\u{1F1E6}\u{1F1EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1F0}[\u{1F1EA}\u{1F1EC}-\u{1F1EE}\u{1F1F2}\u{1F1F3}\u{1F1F5}\u{1F1F7}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|\u{1F1F8}[\u{1F1E6}-\u{1F1EA}\u{1F1EC}-\u{1F1F4}\u{1F1F7}-\u{1F1F9}\u{1F1FB}\u{1F1FD}-\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1FF}[\u{1F1E6}\u{1F1F2}\u{1F1FC}]|\u{1F1EB}[\u{1F1EE}-\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1F7}]|\u{1F1F5}[\u{1F1E6}\u{1F1EA}-\u{1F1ED}\u{1F1F0}-\u{1F1F3}\u{1F1F7}-\u{1F1F9}\u{1F1FC}\u{1F1FE}]|\u{1F1E9}[\u{1F1EA}\u{1F1EC}\u{1F1EF}\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1FF}]|\u{1F1F9}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1ED}\u{1F1EF}-\u{1F1F4}\u{1F1F7}\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FF}]|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|[#\*0-9]\uFE0F\u20E3|\u{1F1F1}[\u{1F1E6}-\u{1F1E8}\u{1F1EE}\u{1F1F0}\u{1F1F7}-\u{1F1FB}\u{1F1FE}]|\u{1F1E6}[\u{1F1E8}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F2}\u{1F1F4}\u{1F1F6}-\u{1F1FA}\u{1F1FC}\u{1F1FD}\u{1F1FF}]|\u{1F1F7}[\u{1F1EA}\u{1F1F4}\u{1F1F8}\u{1F1FA}\u{1F1FC}]|\u{1F1FB}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1EE}\u{1F1F3}\u{1F1FA}]|\u{1F1FE}[\u{1F1EA}\u{1F1F9}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9D1}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]\uFE0F?|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F469}\u{1F46E}\u{1F470}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9D1}-\u{1F9DD}]/gu; + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F3F4}\u200D\u2620)\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F415}\u200D\u{1F9BA}|\u{1F469}\u200D\u{1F466}|\u{1F469}\u200D\u{1F467}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F1F6}\u{1F1E6}|[#\*0-9]\uFE0F\u20E3|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1F9}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1ED}\u{1F1EF}-\u{1F1F4}\u{1F1F7}\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FF}]|\u{1F1EA}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1ED}\u{1F1F7}-\u{1F1FA}]|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u{1F1F7}[\u{1F1EA}\u{1F1F4}\u{1F1F8}\u{1F1FA}\u{1F1FC}]|\u{1F469}[\u{1F3FB}-\u{1F3FF}]|\u{1F1F2}[\u{1F1E6}\u{1F1E8}-\u{1F1ED}\u{1F1F0}-\u{1F1FF}]|\u{1F1E6}[\u{1F1E8}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F2}\u{1F1F4}\u{1F1F6}-\u{1F1FA}\u{1F1FC}\u{1F1FD}\u{1F1FF}]|\u{1F1F0}[\u{1F1EA}\u{1F1EC}-\u{1F1EE}\u{1F1F2}\u{1F1F3}\u{1F1F5}\u{1F1F7}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1ED}[\u{1F1F0}\u{1F1F2}\u{1F1F3}\u{1F1F7}\u{1F1F9}\u{1F1FA}]|\u{1F1E9}[\u{1F1EA}\u{1F1EC}\u{1F1EF}\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1FF}]|\u{1F1FE}[\u{1F1EA}\u{1F1F9}]|\u{1F1EC}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EE}\u{1F1F1}-\u{1F1F3}\u{1F1F5}-\u{1F1FA}\u{1F1FC}\u{1F1FE}]|\u{1F1F8}[\u{1F1E6}-\u{1F1EA}\u{1F1EC}-\u{1F1F4}\u{1F1F7}-\u{1F1F9}\u{1F1FB}\u{1F1FD}-\u{1F1FF}]|\u{1F1EB}[\u{1F1EE}-\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1F7}]|\u{1F1F5}[\u{1F1E6}\u{1F1EA}-\u{1F1ED}\u{1F1F0}-\u{1F1F3}\u{1F1F7}-\u{1F1F9}\u{1F1FC}\u{1F1FE}]|\u{1F1FB}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1EE}\u{1F1F3}\u{1F1FA}]|\u{1F1F3}[\u{1F1E6}\u{1F1E8}\u{1F1EA}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F4}\u{1F1F5}\u{1F1F7}\u{1F1FA}\u{1F1FF}]|\u{1F1E8}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1EE}\u{1F1F0}-\u{1F1F5}\u{1F1F7}\u{1F1FA}-\u{1F1FF}]|\u{1F1F1}[\u{1F1E6}-\u{1F1E8}\u{1F1EE}\u{1F1F0}\u{1F1F7}-\u{1F1FB}\u{1F1FE}]|\u{1F1FF}[\u{1F1E6}\u{1F1F2}\u{1F1FC}]|\u{1F1FC}[\u{1F1EB}\u{1F1F8}]|\u{1F1FA}[\u{1F1E6}\u{1F1EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F?|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; }; diff --git a/tools/node_modules/eslint/node_modules/emoji-regex/index.js b/tools/node_modules/eslint/node_modules/emoji-regex/index.js index e2237a4e805327..d993a3a99cb95a 100644 --- a/tools/node_modules/eslint/node_modules/emoji-regex/index.js +++ b/tools/node_modules/eslint/node_modules/emoji-regex/index.js @@ -2,5 +2,5 @@ module.exports = function () { // https://mths.be/emoji - return /\uD83C\uDFF4(?:\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74)\uDB40\uDC7F|\u200D\u2620\uFE0F)|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3]))|\uD83D\uDC69\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83D\uDC69\u200D[\u2695\u2696\u2708])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC68(?:\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDD1-\uDDDD])/g; + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; }; diff --git a/tools/node_modules/eslint/node_modules/emoji-regex/package.json b/tools/node_modules/eslint/node_modules/emoji-regex/package.json index 439b65e4354d5c..eecc5eb318cd0a 100644 --- a/tools/node_modules/eslint/node_modules/emoji-regex/package.json +++ b/tools/node_modules/eslint/node_modules/emoji-regex/package.json @@ -10,14 +10,13 @@ "deprecated": false, "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", "devDependencies": { - "@babel/cli": "^7.0.0", - "@babel/core": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.0.0", - "@babel/preset-env": "^7.0.0", - "mocha": "^5.2.0", + "@babel/cli": "^7.2.3", + "@babel/core": "^7.3.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.2.0", + "@babel/preset-env": "^7.3.4", + "mocha": "^6.0.2", "regexgen": "^1.3.0", - "unicode-11.0.0": "^0.7.7", - "unicode-tr51": "^9.0.1" + "unicode-12.0.0": "^0.7.9" }, "files": [ "LICENSE-MIT.txt", @@ -51,5 +50,5 @@ "test:watch": "npm run test -- --watch" }, "types": "index.d.ts", - "version": "7.0.3" + "version": "8.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/emoji-regex/text.js b/tools/node_modules/eslint/node_modules/emoji-regex/text.js index 199ae3be35b418..0a55ce2f2308ad 100644 --- a/tools/node_modules/eslint/node_modules/emoji-regex/text.js +++ b/tools/node_modules/eslint/node_modules/emoji-regex/text.js @@ -2,5 +2,5 @@ module.exports = function () { // https://mths.be/emoji - return /\uD83C\uDFF4(?:\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74)\uDB40\uDC7F|\u200D\u2620\uFE0F)|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3]))|\uD83D\uDC69\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83D\uDC69\u200D[\u2695\u2696\u2708])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC68(?:\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDD1-\uDDDD])/g; + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; }; diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md index aa5e2b8ff7bac6..22f5099b65cccd 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/README.md @@ -32,42 +32,46 @@ eslint --ext md . It will lint `js`, `javascript`, `jsx`, or `node` [fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) in your Markdown documents: - ```js - // This gets linted - var answer = 6 * 7; - console.log(answer); - ``` +````markdown +```js +// This gets linted +var answer = 6 * 7; +console.log(answer); +``` - ```JavaScript - // This also gets linted +```JavaScript +// This also gets linted - /* eslint quotes: [2, "double"] */ +/* eslint quotes: [2, "double"] */ - function hello() { - console.log("Hello, world!"); - } - hello(); - ``` +function hello() { + console.log("Hello, world!"); +} +hello(); +``` - ```jsx - // This gets linted too - var div =
    ; - ``` +```jsx +// This gets linted too +var div =
    ; +``` - ```node - // And this - console.log(process.version); - ``` +```node +// And this +console.log(process.version); +``` +```` Blocks that don't specify either `js`, `javascript`, `jsx`, or `node` syntax are ignored: - ``` - This is plain text and doesn't get linted. - ``` +````markdown +``` +This is plain text and doesn't get linted. +``` - ```python - print("This doesn't get linted either.") - ``` +```python +print("This doesn't get linted either.") +``` +```` ## Configuration Comments @@ -75,52 +79,58 @@ The processor will convert HTML comments immediately preceding a code block into This example enables the `browser` environment, disables the `no-alert` rule, and configures the `quotes` rule to prefer single quotes: - - - +````markdown + + + - ```js - alert('Hello, world!'); - ``` +```js +alert('Hello, world!'); +``` +```` Each code block in a file is linted separately, so configuration comments apply only to the code block that immediately follows. - Assuming `no-alert` is enabled in `.eslintrc`, the first code block will have no error from `no-alert`: +````markdown +Assuming `no-alert` is enabled in `.eslintrc`, the first code block will have no error from `no-alert`: - - + + - ```js - alert("Hello, world!"); - ``` +```js +alert("Hello, world!"); +``` - But the next code block will have an error from `no-alert`: +But the next code block will have an error from `no-alert`: - + - ```js - alert("Hello, world!"); - ``` +```js +alert("Hello, world!"); +``` +```` ## Skipping Blocks Sometimes it can be useful to have code blocks marked with `js` even though they don't contain valid JavaScript syntax, such as commented JSON blobs that need `js` syntax highlighting. Standard `eslint-disable` comments only silence rule reporting, but ESLint still reports any syntax errors it finds. In cases where a code block should not even be parsed, insert a non-standard `` comment before the block, and this plugin will hide the following block from ESLint. Neither rule nor syntax errors will be reported. - There are comments in this JSON, so we use `js` syntax for better - highlighting. Skip the block to prevent warnings about invalid syntax. +````markdown +There are comments in this JSON, so we use `js` syntax for better +highlighting. Skip the block to prevent warnings about invalid syntax. - + - ```js - { - // This code block is hidden from ESLint. - "hello": "world" - } - ``` +```js +{ + // This code block is hidden from ESLint. + "hello": "world" +} +``` - ```js - console.log("This code block is linted normally."); - ``` +```js +console.log("This code block is linted normally."); +``` +```` ## Fix issues automatically diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js index 890425ff8aefa0..e27aa162f98cb0 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/index.js @@ -5,10 +5,10 @@ "use strict"; -var processor = require("./processor"); +const processor = require("./processor"); module.exports = { - "processors": { + processors: { ".markdown": processor, ".mdown": processor, ".mkdn": processor, diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js index a3c9e06da2852e..8efcc55b9a698a 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/lib/processor.js @@ -5,37 +5,35 @@ "use strict"; -var assign = require("object-assign"); -var unified = require("unified"); -var remarkParse = require("remark-parse"); +const assign = require("object-assign"); +const unified = require("unified"); +const remarkParse = require("remark-parse"); -var SUPPORTED_SYNTAXES = ["js", "javascript", "node", "jsx"]; -var UNSATISFIABLE_RULES = [ +const SUPPORTED_SYNTAXES = ["js", "javascript", "node", "jsx"]; +const UNSATISFIABLE_RULES = [ "eol-last", // The Markdown parser strips trailing newlines in code fences "unicode-bom" // Code blocks will begin in the middle of Markdown files ]; -var SUPPORTS_AUTOFIX = true; +const SUPPORTS_AUTOFIX = true; -var markdown = unified().use(remarkParse); +const markdown = unified().use(remarkParse); -var blocks = []; +let blocks = []; /** * Performs a depth-first traversal of the Markdown AST. * @param {ASTNode} node A Markdown AST node. - * @param {object} callbacks A map of node types to callbacks. - * @param {object} [parent] The node's parent AST node. + * @param {Object} callbacks A map of node types to callbacks. + * @param {Object} [parent] The node's parent AST node. * @returns {void} */ function traverse(node, callbacks, parent) { - var i; - if (callbacks[node.type]) { callbacks[node.type](node, parent); } if (typeof node.children !== "undefined") { - for (i = 0; i < node.children.length; i++) { + for (let i = 0; i < node.children.length; i++) { traverse(node.children[i], callbacks, node); } } @@ -47,9 +45,9 @@ function traverse(node, callbacks, parent) { * @returns {string[]} An array of JS block comments. */ function getComment(html) { - var commentStart = ""; - var regex = /^(eslint\b|global\s)/; + const commentStart = ""; + const regex = /^(eslint\b|global\s)/; if ( html.slice(0, commentStart.length) !== commentStart || @@ -58,16 +56,42 @@ function getComment(html) { return ""; } - html = html.slice(commentStart.length, -commentEnd.length); + const comment = html.slice(commentStart.length, -commentEnd.length); - if (!regex.test(html.trim())) { + if (!regex.test(comment.trim())) { return ""; } - return html; + return comment; } -var leadingWhitespaceRegex = /^\s*/; +// Before a code block, blockquote characters (`>`) are also considered +// "whitespace". +const leadingWhitespaceRegex = /^[>\s]*/; + +/** + * Gets the offset for the first column of the node's first line in the + * original source text. + * @param {ASTNode} node A Markdown code block AST node. + * @returns {number} The offset for the first column of the node's first line. + */ +function getBeginningOfLineOffset(node) { + return node.position.start.offset - node.position.start.column + 1; +} + +/** + * Gets the leading text, typically whitespace with possible blockquote chars, + * used to indent a code block. + * @param {string} text The text of the file. + * @param {ASTNode} node A Markdown code block AST node. + * @returns {string} The text from the start of the first line to the opening + * fence of the code block. + */ +function getIndentText(text, node) { + return leadingWhitespaceRegex.exec( + text.slice(getBeginningOfLineOffset(node)) + )[0]; +} /** * When applying fixes, the postprocess step needs to know how to map fix ranges @@ -97,24 +121,12 @@ var leadingWhitespaceRegex = /^\s*/; * @param {ASTNode} node A Markdown code block AST node. * @param {comments} comments List of configuration comment strings that will be * inserted at the beginning of the code block. - * @returns {object[]} A list of offset-based adjustments, where lookups are + * @returns {Object[]} A list of offset-based adjustments, where lookups are * done based on the `js` key, which represents the range in the linted JS, * and the `md` key is the offset delta that, when added to the JS range, * returns the corresponding location in the original Markdown source. */ function getBlockRangeMap(text, node, comments) { - var baseIndent, - code, - commentLength, - i, - jsOffset, - leadingWhitespaceLength, - line, - lines, - mdOffset, - rangeMap, - startOffset, - trimLength; /* * The parser sets the fenced code block's start offset to wherever content @@ -124,14 +136,14 @@ function getBlockRangeMap(text, node, comments) { * additional indenting, the opening fence's first backtick may be up to * three whitespace characters after the start offset. */ - startOffset = node.position.start.offset; + const startOffset = getBeginningOfLineOffset(node); /* * Extract the Markdown source to determine the leading whitespace for each * line. */ - code = text.slice(startOffset, node.position.end.offset); - lines = code.split("\n"); + const code = text.slice(startOffset, node.position.end.offset); + const lines = code.split("\n"); /* * The parser trims leading whitespace from each line of code within the @@ -139,16 +151,13 @@ function getBlockRangeMap(text, node, comments) { * backtick's column is the AST node's starting column plus any additional * indentation. */ - baseIndent = node.position.start.column - 1 - + leadingWhitespaceRegex.exec(lines[0])[0].length; + const baseIndent = getIndentText(text, node).length; /* * Track the length of any inserted configuration comments at the beginning * of the linted JS and start the JS offset lookup keys at this index. */ - commentLength = comments.reduce(function(len, comment) { - return len + comment.length + 1; - }, 0); + const commentLength = comments.reduce((len, comment) => len + comment.length + 1, 0); /* * In case there are configuration comments, initialize the map so that the @@ -156,35 +165,37 @@ function getBlockRangeMap(text, node, comments) { * the lookup index will also be 0, and the lookup should always go to the * last range that matches, skipping this initialization entry. */ - rangeMap = [{ + const rangeMap = [{ js: 0, md: 0 }]; // Start the JS offset after any configuration comments. - jsOffset = commentLength; + let jsOffset = commentLength; /* * Start the Markdown offset at the beginning of the block's first line of * actual code. The first line of the block is always the opening fence, so * the code begins on the second line. */ - mdOffset = startOffset + lines[0].length + 1; + let mdOffset = startOffset + lines[0].length + 1; /* * For each line, determine how much leading whitespace was trimmed due to * indentation. Increase the JS lookup offset by the length of the line * post-trimming and the Markdown offset by the total line length. */ - for (i = 0; i + 1 < lines.length; i++) { - line = lines[i + 1]; - leadingWhitespaceLength = leadingWhitespaceRegex.exec(line)[0].length; + for (let i = 0; i + 1 < lines.length; i++) { + const line = lines[i + 1]; + const leadingWhitespaceLength = leadingWhitespaceRegex.exec(line)[0].length; + // The parser trims leading whitespace up to the level of the opening // fence, so keep any additional indentation beyond that. - trimLength = Math.min(baseIndent, leadingWhitespaceLength); + const trimLength = Math.min(baseIndent, leadingWhitespaceLength); rangeMap.push({ js: jsOffset, + // Advance `trimLength` character from the beginning of the Markdown // line to the beginning of the equivalent JS line, then compute the // delta. @@ -196,6 +207,7 @@ function getBlockRangeMap(text, node, comments) { mdOffset += line.length + 1; jsOffset += line.length - trimLength + 1; } + return rangeMap; } @@ -205,19 +217,19 @@ function getBlockRangeMap(text, node, comments) { * @returns {string[]} Source code strings to lint. */ function preprocess(text) { - var ast = markdown.parse(text); + const ast = markdown.parse(text); blocks = []; traverse(ast, { - "code": function(node, parent) { - var comments = []; - var index, previousNode, comment; + code(node, parent) { + const comments = []; if (node.lang && SUPPORTED_SYNTAXES.indexOf(node.lang.split(" ")[0].toLowerCase()) >= 0) { - index = parent.children.indexOf(node) - 1; - previousNode = parent.children[index]; + let index = parent.children.indexOf(node) - 1; + let previousNode = parent.children[index]; + while (previousNode && previousNode.type === "html") { - comment = getComment(previousNode.value); + const comment = getComment(previousNode.value); if (!comment) { break; @@ -227,35 +239,36 @@ function preprocess(text) { return; } - comments.unshift("/*" + comment + "*/"); + comments.unshift(`/*${comment}*/`); index--; previousNode = parent.children[index]; } blocks.push(assign({}, node, { - comments: comments, + baseIndentText: getIndentText(text, node), + comments, rangeMap: getBlockRangeMap(text, node, comments) })); } } }); - return blocks.map(function(block) { - return block.comments.concat(block.value).concat("").join("\n"); - }); + return blocks.map(block => [ + ...block.comments, + block.value, + "" + ].join("\n")); } /** * Creates a map function that adjusts messages in a code block. * @param {Block} block A code block. - * @returns {function} A function that adjusts messages in a code block. + * @returns {Function} A function that adjusts messages in a code block. */ function adjustBlock(block) { - var leadingCommentLines = block.comments.reduce(function(count, comment) { - return count + comment.split("\n").length; - }, 0); + const leadingCommentLines = block.comments.reduce((count, comment) => count + comment.split("\n").length, 0); - var blockStart = block.position.start.line; + const blockStart = block.position.start.line; /** * Adjusts ESLint messages to point to the correct location in the Markdown. @@ -264,34 +277,38 @@ function adjustBlock(block) { */ return function adjustMessage(message) { - var lineInCode = message.line - leadingCommentLines; - var endLine = message.endLine - leadingCommentLines; + const lineInCode = message.line - leadingCommentLines; + const endLine = message.endLine - leadingCommentLines; + if (lineInCode < 1) { return null; } - var out = { + const out = { line: lineInCode + blockStart, endLine: endLine ? endLine + blockStart : endLine, column: message.column + block.position.indent[lineInCode - 1] - 1 }; - var adjustedFix = {}; + const adjustedFix = {}; + if (message.fix) { adjustedFix.fix = { - range: message.fix.range.map(function(range) { + range: message.fix.range.map(range => { + // Advance through the block's range map to find the last // matching range by finding the first range too far and // then going back one. - var i = 1; - while (i < block.rangeMap.length && block.rangeMap[i].js < range) { + let i = 1; + + while (i < block.rangeMap.length && block.rangeMap[i].js <= range) { i++; } // Apply the mapping delta for this range. return range + block.rangeMap[i - 1].md; }), - text: message.fix.text + text: message.fix.text.replace("\n", `\n${block.baseIndentText}`) }; } @@ -315,14 +332,15 @@ function excludeUnsatisfiableRules(message) { * @returns {Message[]} A flattened array of messages with mapped locations. */ function postprocess(messages) { - return [].concat.apply([], messages.map(function(group, i) { - var adjust = adjustBlock(blocks[i]); + return [].concat(...messages.map((group, i) => { + const adjust = adjustBlock(blocks[i]); + return group.map(adjust).filter(excludeUnsatisfiableRules); })); } module.exports = { - preprocess: preprocess, - postprocess: postprocess, + preprocess, + postprocess, supportsAutofix: SUPPORTS_AUTOFIX }; diff --git a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json index 2fb0406aa2e89d..93aa90513db2a8 100644 --- a/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json +++ b/tools/node_modules/eslint/node_modules/eslint-plugin-markdown/package.json @@ -17,7 +17,8 @@ "devDependencies": { "chai": "^3.0.0", "eslint": "^4.19.1", - "eslint-config-eslint": "^3.0.0", + "eslint-config-eslint": "^5.0.1", + "eslint-plugin-node": "^6.0.1", "eslint-release": "^1.0.0", "istanbul": "^0.4.5", "mocha": "^2.2.5" @@ -55,5 +56,5 @@ "test": "npm run lint && npm run test-cov", "test-cov": "istanbul cover _mocha -- -c tests/lib/**/*.js" }, - "version": "1.0.0" + "version": "1.0.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/README.md b/tools/node_modules/eslint/node_modules/eslint-utils/README.md index 7069f04f7392a9..03583806246467 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/README.md +++ b/tools/node_modules/eslint/node_modules/eslint-utils/README.md @@ -2,7 +2,7 @@ [![npm version](https://img.shields.io/npm/v/eslint-utils.svg)](https://www.npmjs.com/package/eslint-utils) [![Downloads/month](https://img.shields.io/npm/dm/eslint-utils.svg)](http://www.npmtrends.com/eslint-utils) -[![Build Status](https://travis-ci.org/mysticatea/eslint-utils.svg?branch=master)](https://travis-ci.org/mysticatea/eslint-utils) +[![Build Status](https://github.com/mysticatea/eslint-utils/workflows/CI/badge.svg)](https://github.com/mysticatea/eslint-utils/actions) [![Coverage Status](https://codecov.io/gh/mysticatea/eslint-utils/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/eslint-utils) [![Dependency Status](https://david-dm.org/mysticatea/eslint-utils.svg)](https://david-dm.org/mysticatea/eslint-utils) @@ -12,13 +12,13 @@ This package provides utility functions and classes for make ESLint custom rules For examples: -- [getStaticValue](https://mysticatea.github.io/eslint-utils/api/ast-utils.html#getstaticvalue) evaluates static value on AST. -- [PatternMatcher](https://mysticatea.github.io/eslint-utils/api/ast-utils.html#patternmatcher-class) finds a regular expression pattern as handling escape sequences. -- [ReferenceTracker](https://mysticatea.github.io/eslint-utils/api/scope-utils.html#referencetracker-class) checks the members of modules/globals as handling assignments and destructuring. +- [getStaticValue](https://eslint-utils.mysticatea.dev/api/ast-utils.html#getstaticvalue) evaluates static value on AST. +- [PatternMatcher](https://eslint-utils.mysticatea.dev/api/ast-utils.html#patternmatcher-class) finds a regular expression pattern as handling escape sequences. +- [ReferenceTracker](https://eslint-utils.mysticatea.dev/api/scope-utils.html#referencetracker-class) checks the members of modules/globals as handling assignments and destructuring. ## 📖 Usage -See [documentation](https://mysticatea.github.io/eslint-utils/). +See [documentation](https://eslint-utils.mysticatea.dev/). ## 📰 Changelog diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/index.js b/tools/node_modules/eslint/node_modules/eslint-utils/index.js index 7805b05ef36290..f5d3f3e6097d2f 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/index.js +++ b/tools/node_modules/eslint/node_modules/eslint-utils/index.js @@ -240,7 +240,18 @@ function getFunctionHeadLocation(node, sourceCode) { } } -/* globals BigInt */ +/* globals BigInt, globalThis, global, self, window */ + +const globalObject = + typeof globalThis !== "undefined" + ? globalThis + : typeof self !== "undefined" + ? self + : typeof window !== "undefined" + ? window + : typeof global !== "undefined" + ? global + : {}; const builtinNames = Object.freeze( new Set([ @@ -316,13 +327,13 @@ const callAllowed = new Set( Number.parseFloat, Number.parseInt, Object, - Object.entries, //eslint-disable-line @mysticatea/node/no-unsupported-features/es-builtins + Object.entries, Object.is, Object.isExtensible, Object.isFrozen, Object.isSealed, Object.keys, - Object.values, //eslint-disable-line @mysticatea/node/no-unsupported-features/es-builtins + Object.values, parseFloat, parseInt, RegExp, @@ -534,9 +545,9 @@ const operations = Object.freeze({ variable != null && variable.defs.length === 0 && builtinNames.has(variable.name) && - variable.name in global + variable.name in globalObject ) { - return { value: global[variable.name] } + return { value: globalObject[variable.name] } } // Constants. @@ -1287,7 +1298,6 @@ class PatternMatcher { } } -const SENTINEL_TYPE = /^(?:.+?Statement|.+?Declaration|(?:Array|ArrowFunction|Assignment|Call|Class|Function|Member|New|Object)Expression|AssignmentPattern|Program|VariableDeclarator)$/u; const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u; const has = Function.call.bind(Object.hasOwnProperty); @@ -1311,6 +1321,28 @@ function isModifiedGlobal(variable) { ) } +/** + * Check if the value of a given node is passed through to the parent syntax as-is. + * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through. + * @param {Node} node A node to check. + * @returns {boolean} `true` if the node is passed through. + */ +function isPassThrough(node) { + const parent = node.parent; + + switch (parent && parent.type) { + case "ConditionalExpression": + return parent.consequent === node || parent.alternate === node + case "LogicalExpression": + return true + case "SequenceExpression": + return parent.expressions[parent.expressions.length - 1] === node + + default: + return false + } +} + /** * The reference tracker. */ @@ -1447,11 +1479,11 @@ class ReferenceTracker { esm ? nextTraceMap : this.mode === "legacy" - ? Object.assign( - { default: nextTraceMap }, - nextTraceMap - ) - : { default: nextTraceMap } + ? Object.assign( + { default: nextTraceMap }, + nextTraceMap + ) + : { default: nextTraceMap } ); if (esm) { @@ -1512,7 +1544,7 @@ class ReferenceTracker { //eslint-disable-next-line complexity *_iteratePropertyReferences(rootNode, path, traceMap) { let node = rootNode; - while (!SENTINEL_TYPE.test(node.parent.type)) { + while (isPassThrough(node)) { node = node.parent; } diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/index.mjs b/tools/node_modules/eslint/node_modules/eslint-utils/index.mjs index 2e6391e9b321e0..4b2a20edf5f077 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/index.mjs +++ b/tools/node_modules/eslint/node_modules/eslint-utils/index.mjs @@ -234,7 +234,18 @@ function getFunctionHeadLocation(node, sourceCode) { } } -/* globals BigInt */ +/* globals BigInt, globalThis, global, self, window */ + +const globalObject = + typeof globalThis !== "undefined" + ? globalThis + : typeof self !== "undefined" + ? self + : typeof window !== "undefined" + ? window + : typeof global !== "undefined" + ? global + : {}; const builtinNames = Object.freeze( new Set([ @@ -310,13 +321,13 @@ const callAllowed = new Set( Number.parseFloat, Number.parseInt, Object, - Object.entries, //eslint-disable-line @mysticatea/node/no-unsupported-features/es-builtins + Object.entries, Object.is, Object.isExtensible, Object.isFrozen, Object.isSealed, Object.keys, - Object.values, //eslint-disable-line @mysticatea/node/no-unsupported-features/es-builtins + Object.values, parseFloat, parseInt, RegExp, @@ -528,9 +539,9 @@ const operations = Object.freeze({ variable != null && variable.defs.length === 0 && builtinNames.has(variable.name) && - variable.name in global + variable.name in globalObject ) { - return { value: global[variable.name] } + return { value: globalObject[variable.name] } } // Constants. @@ -1281,7 +1292,6 @@ class PatternMatcher { } } -const SENTINEL_TYPE = /^(?:.+?Statement|.+?Declaration|(?:Array|ArrowFunction|Assignment|Call|Class|Function|Member|New|Object)Expression|AssignmentPattern|Program|VariableDeclarator)$/u; const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u; const has = Function.call.bind(Object.hasOwnProperty); @@ -1305,6 +1315,28 @@ function isModifiedGlobal(variable) { ) } +/** + * Check if the value of a given node is passed through to the parent syntax as-is. + * For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through. + * @param {Node} node A node to check. + * @returns {boolean} `true` if the node is passed through. + */ +function isPassThrough(node) { + const parent = node.parent; + + switch (parent && parent.type) { + case "ConditionalExpression": + return parent.consequent === node || parent.alternate === node + case "LogicalExpression": + return true + case "SequenceExpression": + return parent.expressions[parent.expressions.length - 1] === node + + default: + return false + } +} + /** * The reference tracker. */ @@ -1441,11 +1473,11 @@ class ReferenceTracker { esm ? nextTraceMap : this.mode === "legacy" - ? Object.assign( - { default: nextTraceMap }, - nextTraceMap - ) - : { default: nextTraceMap } + ? Object.assign( + { default: nextTraceMap }, + nextTraceMap + ) + : { default: nextTraceMap } ); if (esm) { @@ -1506,7 +1538,7 @@ class ReferenceTracker { //eslint-disable-next-line complexity *_iteratePropertyReferences(rootNode, path, traceMap) { let node = rootNode; - while (!SENTINEL_TYPE.test(node.parent.type)) { + while (isPassThrough(node)) { node = node.parent; } diff --git a/tools/node_modules/eslint/node_modules/eslint-utils/package.json b/tools/node_modules/eslint/node_modules/eslint-utils/package.json index bbade790ea5f1a..5b9b668f293690 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/package.json +++ b/tools/node_modules/eslint/node_modules/eslint-utils/package.json @@ -7,24 +7,25 @@ }, "bundleDependencies": false, "dependencies": { - "eslint-visitor-keys": "^1.0.0" + "eslint-visitor-keys": "^1.1.0" }, "deprecated": false, "description": "Utilities for ESLint plugins.", "devDependencies": { - "@mysticatea/eslint-plugin": "^10.0.3", - "codecov": "^3.0.2", + "@mysticatea/eslint-plugin": "^12.0.0", + "codecov": "^3.6.1", "dot-prop": "^4.2.0", - "eslint": "^5.16.0", - "esm": "^3.0.55", - "espree": "^5.0.1", - "mocha": "^5.2.0", - "nyc": "^13.0.1", - "opener": "^1.4.3", - "rimraf": "^2.6.2", - "rollup": "^1.16.7", + "eslint": "^6.5.1", + "esm": "^3.2.25", + "espree": "^6.1.1", + "mocha": "^6.2.2", + "npm-run-all": "^4.1.5", + "nyc": "^14.1.1", + "opener": "^1.5.1", + "rimraf": "^3.0.0", + "rollup": "^1.25.0", "rollup-plugin-sourcemaps": "^0.4.2", - "vuepress": "^0.14.4", + "vuepress": "^1.2.0", "warun": "^1.0.0" }, "engines": { @@ -49,18 +50,18 @@ "build": "rollup -c", "clean": "rimraf .nyc_output coverage index.*", "codecov": "nyc report -r lcovonly && codecov", - "coverage": "nyc report -r lcov && opener ./coverage/lcov-report/index.html", + "coverage": "opener ./coverage/lcov-report/index.html", "docs:build": "vuepress build docs", "docs:watch": "vuepress dev docs", "lint": "eslint src test", "postversion": "git push && git push --tags", "prebuild": "npm run -s clean", - "pretest": "npm run -s lint && npm run -s build", "preversion": "npm test && npm run -s build", "prewatch": "npm run -s clean", - "test": "nyc mocha --reporter dot \"test/*.js\"", - "watch": "warun \"{src,test}/**/*.js\" -- nyc --reporter lcov mocha --reporter dot \"test/*.js\"" + "test": "run-s lint build test:mocha", + "test:mocha": "nyc mocha --reporter dot \"test/*.js\"", + "watch": "warun \"{src,test}/**/*.js\" -- npm run -s test:mocha" }, "sideEffects": false, - "version": "1.4.2" + "version": "1.4.3" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/espree/lib/espree.js b/tools/node_modules/eslint/node_modules/espree/lib/espree.js index cd362e71a04a5d..9fd035ebe8f968 100644 --- a/tools/node_modules/eslint/node_modules/espree/lib/espree.js +++ b/tools/node_modules/eslint/node_modules/espree/lib/espree.js @@ -1,15 +1,11 @@ "use strict"; /* eslint-disable no-param-reassign*/ -const acorn = require("acorn"); -const jsx = require("acorn-jsx"); const TokenTranslator = require("./token-translator"); const DEFAULT_ECMA_VERSION = 5; const STATE = Symbol("espree's internal state"); const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); -const tokTypes = Object.assign({}, acorn.tokTypes, jsx.tokTypes); - /** * Normalize ECMAScript version from the initial config @@ -111,238 +107,246 @@ function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, return comment; } -module.exports = () => Parser => class Espree extends Parser { - constructor(opts, code) { - if (typeof opts !== "object" || opts === null) { - opts = {}; - } - if (typeof code !== "string" && !(code instanceof String)) { - code = String(code); - } - - const options = normalizeOptions(opts); - const ecmaFeatures = options.ecmaFeatures || {}; - const tokenTranslator = - options.tokens === true - ? new TokenTranslator(tokTypes, code) - : null; +module.exports = () => Parser => { + const tokTypes = Object.assign({}, Parser.acorn.tokTypes); - // Initialize acorn parser. - super({ - - // TODO: use {...options} when spread is supported(Node.js >= 8.3.0). - ecmaVersion: options.ecmaVersion, - sourceType: options.sourceType, - ranges: options.ranges, - locations: options.locations, - - // Truthy value is true for backward compatibility. - allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn), + if (Parser.acornJsx) { + Object.assign(tokTypes, Parser.acornJsx.tokTypes); + } - // Collect tokens - onToken: token => { - if (tokenTranslator) { + return class Espree extends Parser { + constructor(opts, code) { + if (typeof opts !== "object" || opts === null) { + opts = {}; + } + if (typeof code !== "string" && !(code instanceof String)) { + code = String(code); + } - // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. - tokenTranslator.onToken(token, this[STATE]); + const options = normalizeOptions(opts); + const ecmaFeatures = options.ecmaFeatures || {}; + const tokenTranslator = + options.tokens === true + ? new TokenTranslator(tokTypes, code) + : null; + + // Initialize acorn parser. + super({ + + // TODO: use {...options} when spread is supported(Node.js >= 8.3.0). + ecmaVersion: options.ecmaVersion, + sourceType: options.sourceType, + ranges: options.ranges, + locations: options.locations, + + // Truthy value is true for backward compatibility. + allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn), + + // Collect tokens + onToken: token => { + if (tokenTranslator) { + + // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. + tokenTranslator.onToken(token, this[STATE]); + } + if (token.type !== tokTypes.eof) { + this[STATE].lastToken = token; + } + }, + + // Collect comments + onComment: (block, text, start, end, startLoc, endLoc) => { + if (this[STATE].comments) { + const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + + this[STATE].comments.push(comment); + } } - if (token.type !== tokTypes.eof) { - this[STATE].lastToken = token; - } - }, + }, code); + + // Initialize internal state. + this[STATE] = { + tokens: tokenTranslator ? [] : null, + comments: options.comment === true ? [] : null, + impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, + ecmaVersion: this.options.ecmaVersion, + jsxAttrValueToken: false, + lastToken: null + }; + } - // Collect comments - onComment: (block, text, start, end, startLoc, endLoc) => { - if (this[STATE].comments) { - const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + tokenize() { + do { + this.next(); + } while (this.type !== tokTypes.eof); - this[STATE].comments.push(comment); - } - } - }, code); - - // Initialize internal state. - this[STATE] = { - tokens: tokenTranslator ? [] : null, - comments: options.comment === true ? [] : null, - impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, - ecmaVersion: this.options.ecmaVersion, - jsxAttrValueToken: false, - lastToken: null - }; - } - - tokenize() { - do { + // Consume the final eof token this.next(); - } while (this.type !== tokTypes.eof); - // Consume the final eof token - this.next(); + const extra = this[STATE]; + const tokens = extra.tokens; - const extra = this[STATE]; - const tokens = extra.tokens; + if (extra.comments) { + tokens.comments = extra.comments; + } - if (extra.comments) { - tokens.comments = extra.comments; + return tokens; } - return tokens; - } + finishNode(...args) { + const result = super.finishNode(...args); - finishNode(...args) { - const result = super.finishNode(...args); + return this[ESPRIMA_FINISH_NODE](result); + } - return this[ESPRIMA_FINISH_NODE](result); - } + finishNodeAt(...args) { + const result = super.finishNodeAt(...args); - finishNodeAt(...args) { - const result = super.finishNodeAt(...args); + return this[ESPRIMA_FINISH_NODE](result); + } - return this[ESPRIMA_FINISH_NODE](result); - } + parse() { + const extra = this[STATE]; + const program = super.parse(); + + program.sourceType = this.options.sourceType; - parse() { - const extra = this[STATE]; - const program = super.parse(); + if (extra.comments) { + program.comments = extra.comments; + } + if (extra.tokens) { + program.tokens = extra.tokens; + } - program.sourceType = this.options.sourceType; + /* + * Adjust opening and closing position of program to match Esprima. + * Acorn always starts programs at range 0 whereas Esprima starts at the + * first AST node's start (the only real difference is when there's leading + * whitespace or leading comments). Acorn also counts trailing whitespace + * as part of the program whereas Esprima only counts up to the last token. + */ + if (program.range) { + program.range[0] = program.body.length ? program.body[0].range[0] : program.range[0]; + program.range[1] = extra.lastToken ? extra.lastToken.range[1] : program.range[1]; + } + if (program.loc) { + program.loc.start = program.body.length ? program.body[0].loc.start : program.loc.start; + program.loc.end = extra.lastToken ? extra.lastToken.loc.end : program.loc.end; + } - if (extra.comments) { - program.comments = extra.comments; + return program; } - if (extra.tokens) { - program.tokens = extra.tokens; + + parseTopLevel(node) { + if (this[STATE].impliedStrict) { + this.strict = true; + } + return super.parseTopLevel(node); } - /* - * Adjust opening and closing position of program to match Esprima. - * Acorn always starts programs at range 0 whereas Esprima starts at the - * first AST node's start (the only real difference is when there's leading - * whitespace or leading comments). Acorn also counts trailing whitespace - * as part of the program whereas Esprima only counts up to the last token. + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} */ - if (program.range) { - program.range[0] = program.body.length ? program.body[0].range[0] : program.range[0]; - program.range[1] = extra.lastToken ? extra.lastToken.range[1] : program.range[1]; - } - if (program.loc) { - program.loc.start = program.body.length ? program.body[0].loc.start : program.loc.start; - program.loc.end = extra.lastToken ? extra.lastToken.loc.end : program.loc.end; + raise(pos, message) { + const loc = Parser.acorn.getLineInfo(this.input, pos); + const err = new SyntaxError(message); + + err.index = pos; + err.lineNumber = loc.line; + err.column = loc.column + 1; // acorn uses 0-based columns + throw err; } - return program; - } - - parseTopLevel(node) { - if (this[STATE].impliedStrict) { - this.strict = true; + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + raiseRecoverable(pos, message) { + this.raise(pos, message); } - return super.parseTopLevel(node); - } - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - raise(pos, message) { - const loc = acorn.getLineInfo(this.input, pos); - const err = new SyntaxError(message); - - err.index = pos; - err.lineNumber = loc.line; - err.column = loc.column + 1; // acorn uses 0-based columns - throw err; - } + /** + * Overwrites the default unexpected method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + unexpected(pos) { + let message = "Unexpected token"; - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - raiseRecoverable(pos, message) { - this.raise(pos, message); - } + if (pos !== null && pos !== void 0) { + this.pos = pos; - /** - * Overwrites the default unexpected method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - unexpected(pos) { - let message = "Unexpected token"; - - if (pos !== null && pos !== void 0) { - this.pos = pos; - - if (this.options.locations) { - while (this.pos < this.lineStart) { - this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; - --this.curLine; + if (this.options.locations) { + while (this.pos < this.lineStart) { + this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; + --this.curLine; + } } + + this.nextToken(); } - this.nextToken(); - } + if (this.end > this.start) { + message += ` ${this.input.slice(this.start, this.end)}`; + } - if (this.end > this.start) { - message += ` ${this.input.slice(this.start, this.end)}`; + this.raise(this.start, message); } - this.raise(this.start, message); - } - - /* - * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX - * uses regular tt.string without any distinction between this and regular JS - * strings. As such, we intercept an attempt to read a JSX string and set a flag - * on extra so that when tokens are converted, the next token will be switched - * to JSXText via onToken. - */ - jsx_readString(quote) { // eslint-disable-line camelcase - const result = super.jsx_readString(quote); - - if (this.type === tokTypes.string) { - this[STATE].jsxAttrValueToken = true; + /* + * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX + * uses regular tt.string without any distinction between this and regular JS + * strings. As such, we intercept an attempt to read a JSX string and set a flag + * on extra so that when tokens are converted, the next token will be switched + * to JSXText via onToken. + */ + jsx_readString(quote) { // eslint-disable-line camelcase + const result = super.jsx_readString(quote); + + if (this.type === tokTypes.string) { + this[STATE].jsxAttrValueToken = true; + } + return result; } - return result; - } - /** - * Performs last-minute Esprima-specific compatibility checks and fixes. - * @param {ASTNode} result The node to check. - * @returns {ASTNode} The finished node. - */ - [ESPRIMA_FINISH_NODE](result) { + /** + * Performs last-minute Esprima-specific compatibility checks and fixes. + * @param {ASTNode} result The node to check. + * @returns {ASTNode} The finished node. + */ + [ESPRIMA_FINISH_NODE](result) { - // Acorn doesn't count the opening and closing backticks as part of templates - // so we have to adjust ranges/locations appropriately. - if (result.type === "TemplateElement") { + // Acorn doesn't count the opening and closing backticks as part of templates + // so we have to adjust ranges/locations appropriately. + if (result.type === "TemplateElement") { - // additional adjustment needed if ${ is the last token - const terminalDollarBraceL = this.input.slice(result.end, result.end + 2) === "${"; + // additional adjustment needed if ${ is the last token + const terminalDollarBraceL = this.input.slice(result.end, result.end + 2) === "${"; - if (result.range) { - result.range[0]--; - result.range[1] += (terminalDollarBraceL ? 2 : 1); + if (result.range) { + result.range[0]--; + result.range[1] += (terminalDollarBraceL ? 2 : 1); + } + + if (result.loc) { + result.loc.start.column--; + result.loc.end.column += (terminalDollarBraceL ? 2 : 1); + } } - if (result.loc) { - result.loc.start.column--; - result.loc.end.column += (terminalDollarBraceL ? 2 : 1); + if (result.type.indexOf("Function") > -1 && !result.generator) { + result.generator = false; } - } - if (result.type.indexOf("Function") > -1 && !result.generator) { - result.generator = false; + return result; } - - return result; - } + }; }; diff --git a/tools/node_modules/eslint/node_modules/espree/package.json b/tools/node_modules/eslint/node_modules/espree/package.json index 0a3460432a26b6..17d49f6e22af56 100644 --- a/tools/node_modules/eslint/node_modules/espree/package.json +++ b/tools/node_modules/eslint/node_modules/espree/package.json @@ -8,8 +8,8 @@ }, "bundleDependencies": false, "dependencies": { - "acorn": "^7.0.0", - "acorn-jsx": "^5.0.2", + "acorn": "^7.1.0", + "acorn-jsx": "^5.1.0", "eslint-visitor-keys": "^1.1.0" }, "deprecated": false, @@ -66,5 +66,5 @@ "publish-release": "eslint-publish-release", "test": "npm run-script lint && node Makefile.js test" }, - "version": "6.1.1" + "version": "6.1.2" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/figures/index.js b/tools/node_modules/eslint/node_modules/figures/index.js index c01148ccb1507a..10bd6edba0693f 100644 --- a/tools/node_modules/eslint/node_modules/figures/index.js +++ b/tools/node_modules/eslint/node_modules/figures/index.js @@ -1,7 +1,7 @@ 'use strict'; const escapeStringRegexp = require('escape-string-regexp'); -const platform = process.platform; +const {platform} = process; const main = { tick: '✔', @@ -31,6 +31,7 @@ const main = { smiley: '㋡', mustache: '෴', heart: '♥', + nodejs: '⬢', arrowUp: '↑', arrowDown: '↓', arrowLeft: '←', @@ -62,7 +63,7 @@ const main = { sevenEighths: '⅞' }; -const win = { +const windows = { tick: '√', cross: '×', star: '*', @@ -90,6 +91,7 @@ const win = { smiley: '☺', mustache: '┌─┐', heart: main.heart, + nodejs: '♦', arrowUp: main.arrowUp, arrowDown: main.arrowDown, arrowLeft: main.arrowLeft, @@ -122,26 +124,26 @@ const win = { }; if (platform === 'linux') { - // the main one doesn't look that good on Ubuntu + // The main one doesn't look that good on Ubuntu main.questionMarkPrefix = '?'; } -const figures = platform === 'win32' ? win : main; +const figures = platform === 'win32' ? windows : main; -const fn = str => { +const fn = string => { if (figures === main) { - return str; + return string; } - Object.keys(main).forEach(key => { - if (main[key] === figures[key]) { - return; + for (const [key, value] of Object.entries(main)) { + if (value === figures[key]) { + continue; } - str = str.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]); - }); + string = string.replace(new RegExp(escapeStringRegexp(value), 'g'), figures[key]); + } - return str; + return string; }; module.exports = Object.assign(fn, figures); diff --git a/tools/node_modules/eslint/node_modules/figures/license b/tools/node_modules/eslint/node_modules/figures/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/figures/license +++ b/tools/node_modules/eslint/node_modules/figures/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/figures/package.json b/tools/node_modules/eslint/node_modules/figures/package.json index 65f9a9fd5c0efc..b84bc46481a942 100644 --- a/tools/node_modules/eslint/node_modules/figures/package.json +++ b/tools/node_modules/eslint/node_modules/figures/package.json @@ -14,16 +14,18 @@ "deprecated": false, "description": "Unicode symbols with Windows CMD fallbacks", "devDependencies": { - "ava": "*", - "markdown-table": "^1.0.0", - "require-uncached": "^1.0.2", - "xo": "*" + "ava": "^1.4.1", + "import-fresh": "^3.0.0", + "markdown-table": "^1.1.2", + "tsd": "^0.7.2", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=8" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/figures#readme", "keywords": [ @@ -32,7 +34,6 @@ "cmd", "command-line", "characters", - "char", "symbol", "symbols", "figure", @@ -47,10 +48,7 @@ }, "scripts": { "make": "./makefile.js", - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "2.0.0", - "xo": { - "esnext": true - } + "version": "3.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/figures/readme.md b/tools/node_modules/eslint/node_modules/figures/readme.md index 628703a0a7e110..cf537009acb0e1 100644 --- a/tools/node_modules/eslint/node_modules/figures/readme.md +++ b/tools/node_modules/eslint/node_modules/figures/readme.md @@ -1,4 +1,4 @@ -# figures [![Build Status: Linux](https://travis-ci.org/sindresorhus/figures.svg?branch=master)](https://travis-ci.org/sindresorhus/figures) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/mb743hl70269be3r/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/figures/branch/master) +# figures [![Build Status](https://travis-ci.org/sindresorhus/figures.svg?branch=master)](https://travis-ci.org/sindresorhus/figures) > Unicode symbols with Windows CMD fallbacks @@ -12,7 +12,7 @@ Windows CMD only supports a [limited character set](http://en.wikipedia.org/wiki ## Install ``` -$ npm install --save figures +$ npm install figures ``` @@ -35,17 +35,17 @@ console.log(figures.tick); ## API -### figures(input) +### figures(string) -Returns the input with replaced fallback unicode symbols on Windows. +Returns the input with replaced fallback Unicode symbols on Windows. All the below [figures](#figures) are attached to the main export as shown in the example above. -#### input +#### string Type: `string` -String where the unicode symbols will be replaced with fallback symbols depending on the OS. +String where the Unicode symbols will be replaced with fallback symbols depending on the OS. ## Figures @@ -79,6 +79,7 @@ String where the unicode symbols will be replaced with fallback symbols dependin | smiley | ㋡ | ☺ | | mustache | ෴ | ┌─┐ | | heart | ♥ | ♥ | +| nodejs | ⬢ | ♦ | | arrowUp | ↑ | ↑ | | arrowDown | ↓ | ↓ | | arrowLeft | ← | ← | @@ -115,6 +116,14 @@ String where the unicode symbols will be replaced with fallback symbols dependin - [log-symbols](https://github.com/sindresorhus/log-symbols) - Colored symbols for various log levels -## License +--- -MIT © [Sindre Sorhus](https://sindresorhus.com) +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/tools/node_modules/eslint/node_modules/glob/README.md b/tools/node_modules/eslint/node_modules/glob/README.md index e71b967ea28809..0916a48255cd6f 100644 --- a/tools/node_modules/eslint/node_modules/glob/README.md +++ b/tools/node_modules/eslint/node_modules/glob/README.md @@ -371,3 +371,5 @@ npm run bench # to profile javascript npm run prof ``` + +![](oh-my-glob.gif) diff --git a/tools/node_modules/eslint/node_modules/glob/package.json b/tools/node_modules/eslint/node_modules/glob/package.json index fca34f2f998d21..cf2be43974e853 100644 --- a/tools/node_modules/eslint/node_modules/glob/package.json +++ b/tools/node_modules/eslint/node_modules/glob/package.json @@ -49,5 +49,5 @@ "test": "tap test/*.js --cov", "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" }, - "version": "7.1.4" + "version": "7.1.5" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/inquirer/README.md b/tools/node_modules/eslint/node_modules/inquirer/README.md index 00183582c48455..fe3326fd7448fb 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/README.md +++ b/tools/node_modules/eslint/node_modules/inquirer/README.md @@ -1,11 +1,5 @@ Inquirer Logo -# Compat Version # - -This version is branched from Inquirer master branch to maintain support for Node 6. - -See latest version release line at https://github.com/SBoudrias/Inquirer.js - # Inquirer.js [![npm](https://badge.fury.io/js/inquirer.svg)](http://badge.fury.io/js/inquirer) [![tests](https://travis-ci.org/SBoudrias/Inquirer.js.svg?branch=master)](http://travis-ci.org/SBoudrias/Inquirer.js) [![Coverage Status](https://codecov.io/gh/SBoudrias/Inquirer.js/branch/master/graph/badge.svg)](https://codecov.io/gh/SBoudrias/Inquirer.js) [![dependencies](https://david-dm.org/SBoudrias/Inquirer.js.svg?theme=shields.io)](https://david-dm.org/SBoudrias/Inquirer.js) @@ -364,7 +358,7 @@ look at issues found on other command line - feel free to report any! -Please refer to the [Github releases section for the changelog](https://github.com/SBoudrias/Inquirer.js/releases) +Please refer to the [GitHub releases section for the changelog](https://github.com/SBoudrias/Inquirer.js/releases) ## Contributing diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/checkbox.js b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/checkbox.js index 3d6c7d81130032..1fee1d2f305965 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/checkbox.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/checkbox.js @@ -122,7 +122,7 @@ class CheckboxPrompt extends Base { onEnd(state) { this.status = 'answered'; - + this.spaceKeyPressed = true; // Rerender prompt (and clean subline error) this.render(); diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/utils/events.js b/tools/node_modules/eslint/node_modules/inquirer/lib/utils/events.js index 2a0734b5afed32..966d146cff91b5 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/utils/events.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/utils/events.js @@ -1,6 +1,6 @@ 'use strict'; var { fromEvent } = require('rxjs'); -var { filter, map, share } = require('rxjs/operators'); +var { filter, map, share, takeUntil } = require('rxjs/operators'); function normalizeKeypressEvents(value, key) { return { value: value, key: key || {} }; @@ -8,6 +8,7 @@ function normalizeKeypressEvents(value, key) { module.exports = function(rl) { var keypress = fromEvent(rl.input, 'keypress', normalizeKeypressEvents) + .pipe(takeUntil(fromEvent(rl, 'close'))) // Ignore `enter` key. On the readline, we only care about the `line` event. .pipe(filter(({ key }) => key.name !== 'enter' && key.name !== 'return')); diff --git a/tools/node_modules/eslint/node_modules/inquirer/package.json b/tools/node_modules/eslint/node_modules/inquirer/package.json index 9c1a62d2773fe9..a3efb9cb4b2d35 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/package.json +++ b/tools/node_modules/eslint/node_modules/inquirer/package.json @@ -8,17 +8,17 @@ }, "bundleDependencies": false, "dependencies": { - "ansi-escapes": "^3.2.0", + "ansi-escapes": "^4.2.1", "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", + "cli-cursor": "^3.1.0", "cli-width": "^2.0.0", "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.12", - "mute-stream": "0.0.7", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", "run-async": "^2.2.0", "rxjs": "^6.4.0", - "string-width": "^2.1.0", + "string-width": "^4.1.0", "strip-ansi": "^5.1.0", "through": "^2.3.6" }, @@ -28,10 +28,10 @@ "chai": "^4.2.0", "chalk-pipe": "^2.0.0", "cmdify": "^0.0.4", - "mocha": "^5.0.0", + "mocha": "^6.2.0", "mockery": "^2.1.0", - "nyc": "^13.1.0", - "sinon": "^7.1.1" + "nyc": "^14.1.1", + "sinon": "^7.4.1" }, "engines": { "node": ">=6.0.0" @@ -40,7 +40,7 @@ "lib", "README.md" ], - "gitHead": "7d87f666042c67638d2e89bd4586d22f61e90130", + "gitHead": "be4558e0314afcd3852361929397588744a745d8", "homepage": "https://github.com/SBoudrias/Inquirer.js#readme", "keywords": [ "command", @@ -63,5 +63,5 @@ "prepublishOnly": "cp ../../README.md .", "test": "nyc mocha test/**/* -r ./test/before" }, - "version": "6.5.2" + "version": "7.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/index.js b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/index.js index d506327c3e5576..671f97f7607790 100644 --- a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/index.js +++ b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/index.js @@ -1,42 +1,43 @@ -'use strict'; /* eslint-disable yoda */ -module.exports = x => { - if (Number.isNaN(x)) { +'use strict'; + +const isFullwidthCodePoint = codePoint => { + if (Number.isNaN(codePoint)) { return false; } - // code points are derived from: + // Code points are derived from: // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt if ( - x >= 0x1100 && ( - x <= 0x115f || // Hangul Jamo - x === 0x2329 || // LEFT-POINTING ANGLE BRACKET - x === 0x232a || // RIGHT-POINTING ANGLE BRACKET + codePoint >= 0x1100 && ( + codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET // CJK Radicals Supplement .. Enclosed CJK Letters and Months - (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A - (0x3250 <= x && x <= 0x4dbf) || + (0x3250 <= codePoint && codePoint <= 0x4DBF) || // CJK Unified Ideographs .. Yi Radicals - (0x4e00 <= x && x <= 0xa4c6) || + (0x4E00 <= codePoint && codePoint <= 0xA4C6) || // Hangul Jamo Extended-A - (0xa960 <= x && x <= 0xa97c) || + (0xA960 <= codePoint && codePoint <= 0xA97C) || // Hangul Syllables - (0xac00 <= x && x <= 0xd7a3) || + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || // CJK Compatibility Ideographs - (0xf900 <= x && x <= 0xfaff) || + (0xF900 <= codePoint && codePoint <= 0xFAFF) || // Vertical Forms - (0xfe10 <= x && x <= 0xfe19) || + (0xFE10 <= codePoint && codePoint <= 0xFE19) || // CJK Compatibility Forms .. Small Form Variants - (0xfe30 <= x && x <= 0xfe6b) || + (0xFE30 <= codePoint && codePoint <= 0xFE6B) || // Halfwidth and Fullwidth Forms - (0xff01 <= x && x <= 0xff60) || - (0xffe0 <= x && x <= 0xffe6) || + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || // Kana Supplement - (0x1b000 <= x && x <= 0x1b001) || + (0x1B000 <= codePoint && codePoint <= 0x1B001) || // Enclosed Ideographic Supplement - (0x1f200 <= x && x <= 0x1f251) || + (0x1F200 <= codePoint && codePoint <= 0x1F251) || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane - (0x20000 <= x && x <= 0x3fffd) + (0x20000 <= codePoint && codePoint <= 0x3FFFD) ) ) { return true; @@ -44,3 +45,6 @@ module.exports = x => { return false; }; + +module.exports = isFullwidthCodePoint; +module.exports.default = isFullwidthCodePoint; diff --git a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/license b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/license +++ b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/package.json b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/package.json index 5db53104f21a75..c556c1c78dd459 100644 --- a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/package.json +++ b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/package.json @@ -11,14 +11,16 @@ "deprecated": false, "description": "Check if the character represented by a given Unicode code point is fullwidth", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^1.3.1", + "tsd-check": "^0.5.0", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=8" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", "keywords": [ @@ -28,9 +30,7 @@ "width", "unicode", "character", - "char", "string", - "str", "codepoint", "code", "point", @@ -45,10 +45,7 @@ "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd-check" }, - "version": "2.0.0", - "xo": { - "esnext": true - } + "version": "3.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/readme.md b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/readme.md index 093b0281b2c46b..4236bba980d8fe 100644 --- a/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/readme.md +++ b/tools/node_modules/eslint/node_modules/is-fullwidth-code-point/readme.md @@ -6,7 +6,7 @@ ## Install ``` -$ npm install --save is-fullwidth-code-point +$ npm install is-fullwidth-code-point ``` @@ -15,23 +15,23 @@ $ npm install --save is-fullwidth-code-point ```js const isFullwidthCodePoint = require('is-fullwidth-code-point'); -isFullwidthCodePoint('谢'.codePointAt()); +isFullwidthCodePoint('谢'.codePointAt(0)); //=> true -isFullwidthCodePoint('a'.codePointAt()); +isFullwidthCodePoint('a'.codePointAt(0)); //=> false ``` ## API -### isFullwidthCodePoint(input) +### isFullwidthCodePoint(codePoint) -#### input +#### codePoint Type: `number` -[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. +The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. ## License diff --git a/tools/node_modules/eslint/node_modules/mimic-fn/index.js b/tools/node_modules/eslint/node_modules/mimic-fn/index.js index 08e69d3d88f020..1a597051750da2 100644 --- a/tools/node_modules/eslint/node_modules/mimic-fn/index.js +++ b/tools/node_modules/eslint/node_modules/mimic-fn/index.js @@ -1,9 +1,13 @@ 'use strict'; -module.exports = (to, from) => { - // TODO: use `Reflect.ownKeys()` when targeting Node.js 6 - for (const prop of Object.getOwnPropertyNames(from).concat(Object.getOwnPropertySymbols(from))) { + +const mimicFn = (to, from) => { + for (const prop of Reflect.ownKeys(from)) { Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop)); } return to; }; + +module.exports = mimicFn; +// TODO: Remove this for the next major release +module.exports.default = mimicFn; diff --git a/tools/node_modules/eslint/node_modules/mimic-fn/package.json b/tools/node_modules/eslint/node_modules/mimic-fn/package.json index 28e9bebe29b3f6..cc764d1d2ee7b6 100644 --- a/tools/node_modules/eslint/node_modules/mimic-fn/package.json +++ b/tools/node_modules/eslint/node_modules/mimic-fn/package.json @@ -11,14 +11,16 @@ "deprecated": false, "description": "Make a function mimic another one", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/mimic-fn#readme", "keywords": [ @@ -43,7 +45,7 @@ "url": "git+https://github.com/sindresorhus/mimic-fn.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "1.2.0" + "version": "2.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/mimic-fn/readme.md b/tools/node_modules/eslint/node_modules/mimic-fn/readme.md index e57573438997b1..0ef8a13d7e0d95 100644 --- a/tools/node_modules/eslint/node_modules/mimic-fn/readme.md +++ b/tools/node_modules/eslint/node_modules/mimic-fn/readme.md @@ -21,7 +21,7 @@ function foo() {} foo.unicorn = '🦄'; function wrapper() { - return foo() {}; + return foo(); } console.log(wrapper.name); @@ -43,7 +43,7 @@ It will copy over the properties `name`, `length`, `displayName`, and any custom ### mimicFn(to, from) -It will modify `to` and return it. +Modifies the `to` function and returns it. #### to @@ -61,6 +61,7 @@ Function to mimic. ## Related - [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function +- [keep-func-props](https://github.com/ehmicky/keep-func-props) - Wrap a function without changing its name, length and other properties ## License diff --git a/tools/node_modules/eslint/node_modules/mute-stream/.nyc_output/33508.json b/tools/node_modules/eslint/node_modules/mute-stream/.nyc_output/33508.json deleted file mode 100644 index 9e26dfeeb6e641..00000000000000 --- a/tools/node_modules/eslint/node_modules/mute-stream/.nyc_output/33508.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/mute-stream/.nyc_output/33510.json b/tools/node_modules/eslint/node_modules/mute-stream/.nyc_output/33510.json deleted file mode 100644 index 1d04442328beff..00000000000000 --- a/tools/node_modules/eslint/node_modules/mute-stream/.nyc_output/33510.json +++ /dev/null @@ -1 +0,0 @@ -{"./mute.js":{"path":"./mute.js","s":{"1":1,"2":1,"3":1,"4":7,"5":7,"6":7,"7":7,"8":7,"9":7,"10":7,"11":7,"12":1,"13":1,"14":1,"15":10,"16":1,"17":6,"18":1,"19":1,"20":5,"21":1,"22":1,"23":8,"24":1,"25":2,"26":1,"27":5,"28":1,"29":5,"30":1,"31":2,"32":2,"33":1,"34":2,"35":2,"36":1,"37":2,"38":2,"39":1,"40":25,"41":13,"42":5,"43":8,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":8,"51":0,"52":0,"53":0,"54":8,"55":20,"56":1,"57":2,"58":2,"59":0,"60":2,"61":2,"62":0,"63":2,"64":1,"65":3,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":1,"73":1,"74":1},"b":{"1":[7,5],"2":[7,7],"3":[3,5],"4":[3,2],"5":[4,1],"6":[0,1],"7":[4,1],"8":[0,1],"9":[2,0],"10":[2,0],"11":[13,12],"12":[5,8],"13":[0,8],"14":[0,0],"15":[0,8],"16":[8,0,0],"17":[2,0],"18":[0,2],"19":[2,1],"20":[0,2],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0]},"f":{"1":7,"2":10,"3":6,"4":5,"5":8,"6":2,"7":5,"8":5,"9":2,"10":2,"11":2,"12":25,"13":2,"14":3,"15":0},"fnMap":{"1":{"name":"MuteStream","line":7,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":27}}},"2":{"name":"(anonymous_2)","line":29,"loc":{"start":{"line":29,"column":28},"end":{"line":29,"column":40}}},"3":{"name":"(anonymous_3)","line":33,"loc":{"start":{"line":33,"column":30},"end":{"line":33,"column":42}}},"4":{"name":"onPipe","line":44,"loc":{"start":{"line":44,"column":0},"end":{"line":44,"column":22}}},"5":{"name":"getIsTTY","line":55,"loc":{"start":{"line":55,"column":0},"end":{"line":55,"column":21}}},"6":{"name":"setIsTTY","line":63,"loc":{"start":{"line":63,"column":0},"end":{"line":63,"column":26}}},"7":{"name":"(anonymous_7)","line":73,"loc":{"start":{"line":73,"column":7},"end":{"line":73,"column":19}}},"8":{"name":"(anonymous_8)","line":80,"loc":{"start":{"line":80,"column":7},"end":{"line":80,"column":19}}},"9":{"name":"(anonymous_9)","line":87,"loc":{"start":{"line":87,"column":28},"end":{"line":87,"column":53}}},"10":{"name":"(anonymous_10)","line":92,"loc":{"start":{"line":92,"column":29},"end":{"line":92,"column":41}}},"11":{"name":"(anonymous_11)","line":96,"loc":{"start":{"line":96,"column":30},"end":{"line":96,"column":42}}},"12":{"name":"(anonymous_12)","line":100,"loc":{"start":{"line":100,"column":29},"end":{"line":100,"column":42}}},"13":{"name":"(anonymous_13)","line":124,"loc":{"start":{"line":124,"column":27},"end":{"line":124,"column":40}}},"14":{"name":"proxy","line":136,"loc":{"start":{"line":136,"column":0},"end":{"line":136,"column":20}}},"15":{"name":"(anonymous_15)","line":136,"loc":{"start":{"line":136,"column":29},"end":{"line":136,"column":41}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":27}},"3":{"start":{"line":7,"column":0},"end":{"line":20,"column":1}},"4":{"start":{"line":8,"column":2},"end":{"line":8,"column":20}},"5":{"start":{"line":9,"column":2},"end":{"line":9,"column":19}},"6":{"start":{"line":10,"column":2},"end":{"line":10,"column":38}},"7":{"start":{"line":11,"column":2},"end":{"line":11,"column":20}},"8":{"start":{"line":12,"column":2},"end":{"line":12,"column":31}},"9":{"start":{"line":13,"column":2},"end":{"line":13,"column":29}},"10":{"start":{"line":18,"column":2},"end":{"line":18,"column":36}},"11":{"start":{"line":19,"column":2},"end":{"line":19,"column":26}},"12":{"start":{"line":22,"column":0},"end":{"line":22,"column":54}},"13":{"start":{"line":24,"column":0},"end":{"line":27,"column":2}},"14":{"start":{"line":29,"column":0},"end":{"line":31,"column":1}},"15":{"start":{"line":30,"column":2},"end":{"line":30,"column":19}},"16":{"start":{"line":33,"column":0},"end":{"line":35,"column":1}},"17":{"start":{"line":34,"column":2},"end":{"line":34,"column":20}},"18":{"start":{"line":37,"column":0},"end":{"line":42,"column":2}},"19":{"start":{"line":44,"column":0},"end":{"line":46,"column":1}},"20":{"start":{"line":45,"column":2},"end":{"line":45,"column":17}},"21":{"start":{"line":48,"column":0},"end":{"line":53,"column":2}},"22":{"start":{"line":55,"column":0},"end":{"line":60,"column":1}},"23":{"start":{"line":56,"column":2},"end":{"line":59,"column":9}},"24":{"start":{"line":63,"column":0},"end":{"line":70,"column":1}},"25":{"start":{"line":64,"column":2},"end":{"line":69,"column":4}},"26":{"start":{"line":72,"column":0},"end":{"line":77,"column":44}},"27":{"start":{"line":74,"column":4},"end":{"line":76,"column":23}},"28":{"start":{"line":79,"column":0},"end":{"line":84,"column":44}},"29":{"start":{"line":81,"column":4},"end":{"line":83,"column":23}},"30":{"start":{"line":87,"column":0},"end":{"line":90,"column":1}},"31":{"start":{"line":88,"column":2},"end":{"line":88,"column":19}},"32":{"start":{"line":89,"column":2},"end":{"line":89,"column":56}},"33":{"start":{"line":92,"column":0},"end":{"line":94,"column":1}},"34":{"start":{"line":93,"column":2},"end":{"line":93,"column":41}},"35":{"start":{"line":93,"column":17},"end":{"line":93,"column":41}},"36":{"start":{"line":96,"column":0},"end":{"line":98,"column":1}},"37":{"start":{"line":97,"column":2},"end":{"line":97,"column":42}},"38":{"start":{"line":97,"column":17},"end":{"line":97,"column":42}},"39":{"start":{"line":100,"column":0},"end":{"line":122,"column":1}},"40":{"start":{"line":101,"column":2},"end":{"line":120,"column":3}},"41":{"start":{"line":102,"column":4},"end":{"line":102,"column":34}},"42":{"start":{"line":102,"column":23},"end":{"line":102,"column":34}},"43":{"start":{"line":103,"column":4},"end":{"line":119,"column":5}},"44":{"start":{"line":104,"column":6},"end":{"line":108,"column":7}},"45":{"start":{"line":105,"column":8},"end":{"line":105,"column":42}},"46":{"start":{"line":106,"column":8},"end":{"line":106,"column":42}},"47":{"start":{"line":107,"column":8},"end":{"line":107,"column":29}},"48":{"start":{"line":109,"column":6},"end":{"line":109,"column":29}},"49":{"start":{"line":110,"column":6},"end":{"line":110,"column":33}},"50":{"start":{"line":112,"column":6},"end":{"line":117,"column":7}},"51":{"start":{"line":114,"column":8},"end":{"line":114,"column":32}},"52":{"start":{"line":115,"column":8},"end":{"line":115,"column":39}},"53":{"start":{"line":116,"column":8},"end":{"line":116,"column":41}},"54":{"start":{"line":118,"column":6},"end":{"line":118,"column":50}},"55":{"start":{"line":121,"column":2},"end":{"line":121,"column":22}},"56":{"start":{"line":124,"column":0},"end":{"line":134,"column":1}},"57":{"start":{"line":125,"column":2},"end":{"line":131,"column":3}},"58":{"start":{"line":126,"column":4},"end":{"line":130,"column":5}},"59":{"start":{"line":127,"column":6},"end":{"line":127,"column":50}},"60":{"start":{"line":129,"column":6},"end":{"line":129,"column":14}},"61":{"start":{"line":132,"column":2},"end":{"line":132,"column":29}},"62":{"start":{"line":132,"column":9},"end":{"line":132,"column":29}},"63":{"start":{"line":133,"column":2},"end":{"line":133,"column":18}},"64":{"start":{"line":136,"column":0},"end":{"line":141,"column":2}},"65":{"start":{"line":136,"column":22},"end":{"line":141,"column":1}},"66":{"start":{"line":137,"column":2},"end":{"line":137,"column":20}},"67":{"start":{"line":138,"column":2},"end":{"line":138,"column":19}},"68":{"start":{"line":139,"column":2},"end":{"line":139,"column":43}},"69":{"start":{"line":139,"column":18},"end":{"line":139,"column":43}},"70":{"start":{"line":140,"column":2},"end":{"line":140,"column":43}},"71":{"start":{"line":140,"column":18},"end":{"line":140,"column":43}},"72":{"start":{"line":143,"column":0},"end":{"line":143,"column":47}},"73":{"start":{"line":144,"column":0},"end":{"line":144,"column":55}},"74":{"start":{"line":145,"column":0},"end":{"line":145,"column":43}}},"branchMap":{"1":{"line":9,"type":"binary-expr","locations":[{"start":{"line":9,"column":9},"end":{"line":9,"column":13}},{"start":{"line":9,"column":17},"end":{"line":9,"column":19}}]},"2":{"line":18,"type":"binary-expr","locations":[{"start":{"line":18,"column":17},"end":{"line":18,"column":28}},{"start":{"line":18,"column":32},"end":{"line":18,"column":36}}]},"3":{"line":56,"type":"cond-expr","locations":[{"start":{"line":56,"column":25},"end":{"line":56,"column":41}},{"start":{"line":57,"column":10},"end":{"line":58,"column":15}}]},"4":{"line":57,"type":"cond-expr","locations":[{"start":{"line":57,"column":24},"end":{"line":57,"column":39}},{"start":{"line":58,"column":10},"end":{"line":58,"column":15}}]},"5":{"line":74,"type":"cond-expr","locations":[{"start":{"line":74,"column":25},"end":{"line":74,"column":40}},{"start":{"line":75,"column":12},"end":{"line":76,"column":21}}]},"6":{"line":75,"type":"cond-expr","locations":[{"start":{"line":75,"column":24},"end":{"line":75,"column":38}},{"start":{"line":76,"column":12},"end":{"line":76,"column":21}}]},"7":{"line":81,"type":"cond-expr","locations":[{"start":{"line":81,"column":25},"end":{"line":81,"column":43}},{"start":{"line":82,"column":12},"end":{"line":83,"column":21}}]},"8":{"line":82,"type":"cond-expr","locations":[{"start":{"line":82,"column":24},"end":{"line":82,"column":41}},{"start":{"line":83,"column":12},"end":{"line":83,"column":21}}]},"9":{"line":93,"type":"if","locations":[{"start":{"line":93,"column":2},"end":{"line":93,"column":2}},{"start":{"line":93,"column":2},"end":{"line":93,"column":2}}]},"10":{"line":97,"type":"if","locations":[{"start":{"line":97,"column":2},"end":{"line":97,"column":2}},{"start":{"line":97,"column":2},"end":{"line":97,"column":2}}]},"11":{"line":101,"type":"if","locations":[{"start":{"line":101,"column":2},"end":{"line":101,"column":2}},{"start":{"line":101,"column":2},"end":{"line":101,"column":2}}]},"12":{"line":102,"type":"if","locations":[{"start":{"line":102,"column":4},"end":{"line":102,"column":4}},{"start":{"line":102,"column":4},"end":{"line":102,"column":4}}]},"13":{"line":103,"type":"if","locations":[{"start":{"line":103,"column":4},"end":{"line":103,"column":4}},{"start":{"line":103,"column":4},"end":{"line":103,"column":4}}]},"14":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":6},"end":{"line":104,"column":6}},{"start":{"line":104,"column":6},"end":{"line":104,"column":6}}]},"15":{"line":112,"type":"if","locations":[{"start":{"line":112,"column":6},"end":{"line":112,"column":6}},{"start":{"line":112,"column":6},"end":{"line":112,"column":6}}]},"16":{"line":112,"type":"binary-expr","locations":[{"start":{"line":112,"column":10},"end":{"line":112,"column":22}},{"start":{"line":112,"column":26},"end":{"line":112,"column":42}},{"start":{"line":113,"column":10},"end":{"line":113,"column":39}}]},"17":{"line":125,"type":"if","locations":[{"start":{"line":125,"column":2},"end":{"line":125,"column":2}},{"start":{"line":125,"column":2},"end":{"line":125,"column":2}}]},"18":{"line":126,"type":"if","locations":[{"start":{"line":126,"column":4},"end":{"line":126,"column":4}},{"start":{"line":126,"column":4},"end":{"line":126,"column":4}}]},"19":{"line":126,"type":"binary-expr","locations":[{"start":{"line":126,"column":8},"end":{"line":126,"column":9}},{"start":{"line":126,"column":13},"end":{"line":126,"column":25}}]},"20":{"line":132,"type":"if","locations":[{"start":{"line":132,"column":2},"end":{"line":132,"column":2}},{"start":{"line":132,"column":2},"end":{"line":132,"column":2}}]},"21":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":2},"end":{"line":139,"column":2}},{"start":{"line":139,"column":2},"end":{"line":139,"column":2}}]},"22":{"line":139,"type":"binary-expr","locations":[{"start":{"line":139,"column":6},"end":{"line":139,"column":7}},{"start":{"line":139,"column":11},"end":{"line":139,"column":16}}]},"23":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":2},"end":{"line":140,"column":2}},{"start":{"line":140,"column":2},"end":{"line":140,"column":2}}]},"24":{"line":140,"type":"binary-expr","locations":[{"start":{"line":140,"column":6},"end":{"line":140,"column":7}},{"start":{"line":140,"column":11},"end":{"line":140,"column":16}}]}}}} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/mute-stream/package.json b/tools/node_modules/eslint/node_modules/mute-stream/package.json index 8a5981780d27c5..a5839c56bb2567 100644 --- a/tools/node_modules/eslint/node_modules/mute-stream/package.json +++ b/tools/node_modules/eslint/node_modules/mute-stream/package.json @@ -11,11 +11,14 @@ "deprecated": false, "description": "Bytes go in, but they don't come out (when muted).", "devDependencies": { - "tap": "^5.4.4" + "tap": "^12.1.1" }, "directories": { "test": "test" }, + "files": [ + "mute.js" + ], "homepage": "https://github.com/isaacs/mute-stream#readme", "keywords": [ "mute", @@ -32,5 +35,5 @@ "scripts": { "test": "tap test/*.js --cov" }, - "version": "0.0.7" + "version": "0.0.8" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/onetime/index.js b/tools/node_modules/eslint/node_modules/onetime/index.js index 0d76476b0b6307..a3f412af1b4869 100644 --- a/tools/node_modules/eslint/node_modules/onetime/index.js +++ b/tools/node_modules/eslint/node_modules/onetime/index.js @@ -1,39 +1,50 @@ 'use strict'; const mimicFn = require('mimic-fn'); -module.exports = (fn, opts) => { - // TODO: Remove this in v3 - if (opts === true) { - throw new TypeError('The second argument is now an options object'); - } +const calledFunctions = new WeakMap(); +const oneTime = (fn, options = {}) => { if (typeof fn !== 'function') { throw new TypeError('Expected a function'); } - opts = opts || {}; - let ret; - let called = false; - const fnName = fn.displayName || fn.name || ''; + let isCalled = false; + let callCount = 0; + const functionName = fn.displayName || fn.name || ''; - const onetime = function () { - if (called) { - if (opts.throw === true) { - throw new Error(`Function \`${fnName}\` can only be called once`); + const onetime = function (...args) { + calledFunctions.set(onetime, ++callCount); + + if (isCalled) { + if (options.throw === true) { + throw new Error(`Function \`${functionName}\` can only be called once`); } return ret; } - called = true; - ret = fn.apply(this, arguments); + isCalled = true; + ret = fn.apply(this, args); fn = null; return ret; }; mimicFn(onetime, fn); + calledFunctions.set(onetime, callCount); return onetime; }; + +module.exports = oneTime; +// TODO: Remove this for the next major release +module.exports.default = oneTime; + +module.exports.callCount = fn => { + if (!calledFunctions.has(fn)) { + throw new Error(`The given function \`${fn.name}\` is not wrapped by the \`onetime\` package`); + } + + return calledFunctions.get(fn); +}; diff --git a/tools/node_modules/eslint/node_modules/onetime/license b/tools/node_modules/eslint/node_modules/onetime/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/onetime/license +++ b/tools/node_modules/eslint/node_modules/onetime/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/onetime/package.json b/tools/node_modules/eslint/node_modules/onetime/package.json index c448600d33de99..3b9293f2b5884d 100644 --- a/tools/node_modules/eslint/node_modules/onetime/package.json +++ b/tools/node_modules/eslint/node_modules/onetime/package.json @@ -9,19 +9,21 @@ }, "bundleDependencies": false, "dependencies": { - "mimic-fn": "^1.0.0" + "mimic-fn": "^2.1.0" }, "deprecated": false, "description": "Ensure a function is only called once", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/onetime#readme", "keywords": [ @@ -43,7 +45,7 @@ "url": "git+https://github.com/sindresorhus/onetime.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "2.0.1" + "version": "5.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/onetime/readme.md b/tools/node_modules/eslint/node_modules/onetime/readme.md index 95eb3b7c9e1c44..9ecd1b24db12d7 100644 --- a/tools/node_modules/eslint/node_modules/onetime/readme.md +++ b/tools/node_modules/eslint/node_modules/onetime/readme.md @@ -4,29 +4,35 @@ When called multiple times it will return the return value from the first call. -*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty extending `Function.prototype`.* +*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty and extending `Function.prototype`.* ## Install ``` -$ npm install --save onetime +$ npm install onetime ``` ## Usage ```js +const onetime = require('onetime'); + let i = 0; -const foo = onetime(() => i++); +const foo = onetime(() => ++i); foo(); //=> 0 foo(); //=> 0 foo(); //=> 0 + +onetime.callCount(foo); //=> 3 ``` ```js +const onetime = require('onetime'); + const foo = onetime(() => {}, {throw: true}); foo(); @@ -59,6 +65,29 @@ Default: `false` Throw an error when called more than once. +### onetime.callCount(fn) + +Returns a number representing how many times `fn` has been called. + +Note: It throws an error if you pass in a function that is not wrapped by `onetime`. + +```js +const foo = onetime(() => {}); + +foo(); +foo(); +foo(); + +console.log(onetime.callCount(foo)); +//=> 3 +``` + +#### fn + +Type: `Function` + +Function to get call count from. + ## License diff --git a/tools/node_modules/eslint/node_modules/restore-cursor/index.js b/tools/node_modules/eslint/node_modules/restore-cursor/index.js index 2b8e009883cb9b..3e8dd07dc3d661 100644 --- a/tools/node_modules/eslint/node_modules/restore-cursor/index.js +++ b/tools/node_modules/eslint/node_modules/restore-cursor/index.js @@ -4,6 +4,6 @@ const signalExit = require('signal-exit'); module.exports = onetime(() => { signalExit(() => { - process.stderr.write('\u001b[?25h'); + process.stderr.write('\u001B[?25h'); }, {alwaysLast: true}); }); diff --git a/tools/node_modules/eslint/node_modules/restore-cursor/license b/tools/node_modules/eslint/node_modules/restore-cursor/license index 654d0bfe943437..e7af2f77107d73 100644 --- a/tools/node_modules/eslint/node_modules/restore-cursor/license +++ b/tools/node_modules/eslint/node_modules/restore-cursor/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/restore-cursor/package.json b/tools/node_modules/eslint/node_modules/restore-cursor/package.json index a764f365980e72..5f0ba05592d886 100644 --- a/tools/node_modules/eslint/node_modules/restore-cursor/package.json +++ b/tools/node_modules/eslint/node_modules/restore-cursor/package.json @@ -9,16 +9,21 @@ }, "bundleDependencies": false, "dependencies": { - "onetime": "^2.0.0", + "onetime": "^5.1.0", "signal-exit": "^3.0.2" }, "deprecated": false, "description": "Gracefully restore the CLI cursor on exit", + "devDependencies": { + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, "engines": { - "node": ">=4" + "node": ">=8" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/restore-cursor#readme", "keywords": [ @@ -49,5 +54,8 @@ "type": "git", "url": "git+https://github.com/sindresorhus/restore-cursor.git" }, - "version": "2.0.0" + "scripts": { + "test": "xo && tsd" + }, + "version": "3.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/restore-cursor/readme.md b/tools/node_modules/eslint/node_modules/restore-cursor/readme.md index a2f5afbc540bf3..c224a2904cc9bd 100644 --- a/tools/node_modules/eslint/node_modules/restore-cursor/readme.md +++ b/tools/node_modules/eslint/node_modules/restore-cursor/readme.md @@ -1,4 +1,4 @@ -# restore-cursor +# restore-cursor [![Build Status](https://travis-ci.org/sindresorhus/restore-cursor.svg?branch=master)](https://travis-ci.org/sindresorhus/restore-cursor) > Gracefully restore the CLI cursor on exit @@ -8,7 +8,7 @@ Prevent the cursor you've hidden interactively from remaining hidden if the proc ## Install ``` -$ npm install --save restore-cursor +$ npm install restore-cursor ``` @@ -16,6 +16,7 @@ $ npm install --save restore-cursor ```js const restoreCursor = require('restore-cursor'); + restoreCursor(); ``` diff --git a/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/index.js b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/index.js new file mode 100644 index 00000000000000..d506327c3e5576 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/index.js @@ -0,0 +1,46 @@ +'use strict'; +/* eslint-disable yoda */ +module.exports = x => { + if (Number.isNaN(x)) { + return false; + } + + // code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + x >= 0x1100 && ( + x <= 0x115f || // Hangul Jamo + x === 0x2329 || // LEFT-POINTING ANGLE BRACKET + x === 0x232a || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= x && x <= 0x4dbf) || + // CJK Unified Ideographs .. Yi Radicals + (0x4e00 <= x && x <= 0xa4c6) || + // Hangul Jamo Extended-A + (0xa960 <= x && x <= 0xa97c) || + // Hangul Syllables + (0xac00 <= x && x <= 0xd7a3) || + // CJK Compatibility Ideographs + (0xf900 <= x && x <= 0xfaff) || + // Vertical Forms + (0xfe10 <= x && x <= 0xfe19) || + // CJK Compatibility Forms .. Small Form Variants + (0xfe30 <= x && x <= 0xfe6b) || + // Halfwidth and Fullwidth Forms + (0xff01 <= x && x <= 0xff60) || + (0xffe0 <= x && x <= 0xffe6) || + // Kana Supplement + (0x1b000 <= x && x <= 0x1b001) || + // Enclosed Ideographic Supplement + (0x1f200 <= x && x <= 0x1f251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= x && x <= 0x3fffd) + ) + ) { + return true; + } + + return false; +}; diff --git a/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/license b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/license new file mode 100644 index 00000000000000..654d0bfe943437 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/package.json b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/package.json new file mode 100644 index 00000000000000..5db53104f21a75 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/package.json @@ -0,0 +1,54 @@ +{ + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Check if the character represented by a given Unicode code point is fullwidth", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", + "keywords": [ + "fullwidth", + "full-width", + "full", + "width", + "unicode", + "character", + "char", + "string", + "str", + "codepoint", + "code", + "point", + "is", + "detect", + "check" + ], + "license": "MIT", + "name": "is-fullwidth-code-point", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.0", + "xo": { + "esnext": true + } +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/readme.md b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/readme.md new file mode 100644 index 00000000000000..093b0281b2c46b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/slice-ansi/node_modules/is-fullwidth-code-point/readme.md @@ -0,0 +1,39 @@ +# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) + +> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) + + +## Install + +``` +$ npm install --save is-fullwidth-code-point +``` + + +## Usage + +```js +const isFullwidthCodePoint = require('is-fullwidth-code-point'); + +isFullwidthCodePoint('谢'.codePointAt()); +//=> true + +isFullwidthCodePoint('a'.codePointAt()); +//=> false +``` + + +## API + +### isFullwidthCodePoint(input) + +#### input + +Type: `number` + +[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/tools/node_modules/eslint/node_modules/string-width/index.js b/tools/node_modules/eslint/node_modules/string-width/index.js index bbc49d29b156c3..a348067f032dfc 100644 --- a/tools/node_modules/eslint/node_modules/string-width/index.js +++ b/tools/node_modules/eslint/node_modules/string-width/index.js @@ -1,18 +1,21 @@ 'use strict'; const stripAnsi = require('strip-ansi'); const isFullwidthCodePoint = require('is-fullwidth-code-point'); +const emojiRegex = require('emoji-regex'); -module.exports = str => { - if (typeof str !== 'string' || str.length === 0) { +const stringWidth = string => { + string = string.replace(emojiRegex(), ' '); + + if (typeof string !== 'string' || string.length === 0) { return 0; } - str = stripAnsi(str); + string = stripAnsi(string); let width = 0; - for (let i = 0; i < str.length; i++) { - const code = str.codePointAt(i); + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); // Ignore control characters if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { @@ -34,3 +37,7 @@ module.exports = str => { return width; }; + +module.exports = stringWidth; +// TODO: remove this in the next major version +module.exports.default = stringWidth; diff --git a/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/index.js b/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/index.js deleted file mode 100644 index 96e0292c8e2f64..00000000000000 --- a/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const ansiRegex = require('ansi-regex'); - -module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; diff --git a/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/package.json b/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/package.json deleted file mode 100644 index 472b3021ed8201..00000000000000 --- a/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/strip-ansi/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "deprecated": false, - "description": "Strip ANSI escape codes", - "devDependencies": { - "ava": "*", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/strip-ansi#readme", - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "strip-ansi", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/strip-ansi.git" - }, - "scripts": { - "test": "xo && ava" - }, - "version": "4.0.0" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/readme.md b/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/readme.md deleted file mode 100644 index dc76f0cb1a0595..00000000000000 --- a/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) - -> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -``` -$ npm install strip-ansi -``` - - -## Usage - -```js -const stripAnsi = require('strip-ansi'); - -stripAnsi('\u001B[4mUnicorn\u001B[0m'); -//=> 'Unicorn' -``` - - -## Related - -- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - -## License - -MIT diff --git a/tools/node_modules/eslint/node_modules/string-width/package.json b/tools/node_modules/eslint/node_modules/string-width/package.json index f076208ad38fa1..9ef5253e54d49b 100644 --- a/tools/node_modules/eslint/node_modules/string-width/package.json +++ b/tools/node_modules/eslint/node_modules/string-width/package.json @@ -9,27 +9,28 @@ }, "bundleDependencies": false, "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^5.2.0" }, "deprecated": false, "description": "Get the visual width of a string - the number of columns required to display it", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=8" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/string-width#readme", "keywords": [ "string", - "str", "character", - "char", "unicode", "width", "visual", @@ -58,7 +59,7 @@ "url": "git+https://github.com/sindresorhus/string-width.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "2.1.1" + "version": "4.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/string-width/readme.md b/tools/node_modules/eslint/node_modules/string-width/readme.md index df5b7199f90913..35a0c0377a900d 100644 --- a/tools/node_modules/eslint/node_modules/string-width/readme.md +++ b/tools/node_modules/eslint/node_modules/string-width/readme.md @@ -19,14 +19,14 @@ $ npm install string-width ```js const stringWidth = require('string-width'); +stringWidth('a'); +//=> 1 + stringWidth('古'); //=> 2 -stringWidth('\u001b[1m古\u001b[22m'); +stringWidth('\u001B[1m古\u001B[22m'); //=> 2 - -stringWidth('a'); -//=> 1 ``` diff --git a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/index.js deleted file mode 100644 index c25448009f304d..00000000000000 --- a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -module.exports = options => { - options = Object.assign({ - onlyFirst: false - }, options); - - const pattern = [ - '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' - ].join('|'); - - return new RegExp(pattern, options.onlyFirst ? undefined : 'g'); -}; diff --git a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/license b/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/package.json deleted file mode 100644 index db8f3cc8c7d14e..00000000000000 --- a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/chalk/ansi-regex/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Regular expression for matching ANSI escape codes", - "devDependencies": { - "ava": "^0.25.0", - "xo": "^0.23.0" - }, - "engines": { - "node": ">=6" - }, - "files": [ - "index.js" - ], - "homepage": "https://github.com/chalk/ansi-regex#readme", - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "license": "MIT", - "name": "ansi-regex", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/ansi-regex.git" - }, - "scripts": { - "test": "xo && ava", - "view-supported": "node fixtures/view-codes.js" - }, - "version": "4.1.0" -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/readme.md deleted file mode 100644 index d19c44667e704b..00000000000000 --- a/tools/node_modules/eslint/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +++ /dev/null @@ -1,87 +0,0 @@ -# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) - -> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) - ---- - -
    - - Get professional support for this package with a Tidelift subscription - -
    - - Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. -
    -
    - ---- - - -## Install - -``` -$ npm install ansi-regex -``` - - -## Usage - -```js -const ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001B[4mcake\u001B[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001B[4mcake\u001B[0m'.match(ansiRegex()); -//=> ['\u001B[4m', '\u001B[0m'] - -'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); -//=> ['\u001B[4m'] - -'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); -//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] -``` - - -## API - -### ansiRegex([options]) - -Returns a regex for matching ANSI escape codes. - -#### options - -##### onlyFirst - -Type: `boolean`
    -Default: `false` *(Matches any ANSI escape codes in a string)* - -Match only the first ANSI escape. - - -## FAQ - -### Why do you test for codes not in the ECMA 48 standard? - -Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. - -On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. - - -## Security - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - -## License - -MIT diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/LICENSE-MIT.txt b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/LICENSE-MIT.txt new file mode 100644 index 00000000000000..a41e0a7ef970ec --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/README.md b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/README.md new file mode 100644 index 00000000000000..37cf14e01f72a5 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/README.md @@ -0,0 +1,73 @@ +# emoji-regex [![Build status](https://travis-ci.org/mathiasbynens/emoji-regex.svg?branch=master)](https://travis-ci.org/mathiasbynens/emoji-regex) + +_emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard. + +This repository contains a script that generates this regular expression based on [the data from Unicode Technical Report #51](https://github.com/mathiasbynens/unicode-tr51). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard. + +## Installation + +Via [npm](https://www.npmjs.com/): + +```bash +npm install emoji-regex +``` + +In [Node.js](https://nodejs.org/): + +```js +const emojiRegex = require('emoji-regex'); +// Note: because the regular expression has the global flag set, this module +// exports a function that returns the regex rather than exporting the regular +// expression itself, to make it impossible to (accidentally) mutate the +// original regular expression. + +const text = ` +\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation) +\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji +\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base) +\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier +`; + +const regex = emojiRegex(); +let match; +while (match = regex.exec(text)) { + const emoji = match[0]; + console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`); +} +``` + +Console output: + +``` +Matched sequence ⌚ — code points: 1 +Matched sequence ⌚ — code points: 1 +Matched sequence ↔️ — code points: 2 +Matched sequence ↔️ — code points: 2 +Matched sequence 👩 — code points: 1 +Matched sequence 👩 — code points: 1 +Matched sequence 👩🏿 — code points: 2 +Matched sequence 👩🏿 — code points: 2 +``` + +To match emoji in their textual representation as well (i.e. emoji that are not `Emoji_Presentation` symbols and that aren’t forced to render as emoji by a variation selector), `require` the other regex: + +```js +const emojiRegex = require('emoji-regex/text.js'); +``` + +Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes: + +```js +const emojiRegex = require('emoji-regex/es2015/index.js'); +const emojiRegexText = require('emoji-regex/es2015/text.js'); +``` + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## License + +_emoji-regex_ is available under the [MIT](https://mths.be/mit) license. diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/es2015/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/es2015/index.js new file mode 100644 index 00000000000000..0216db95876da0 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/es2015/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}(?:\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074})\u{E007F}|\u200D\u2620\uFE0F)|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F468}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u{1F468}(?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F469}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F468}(?:\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|[\u{1F3FB}-\u{1F3FF}])|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}]|\u{1F469}\u200D\u{1F466}|\u{1F1F6}\u{1F1E6}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]|\u{1F1ED}[\u{1F1F0}\u{1F1F2}\u{1F1F3}\u{1F1F7}\u{1F1F9}\u{1F1FA}]|\u{1F1EC}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EE}\u{1F1F1}-\u{1F1F3}\u{1F1F5}-\u{1F1FA}\u{1F1FC}\u{1F1FE}]|\u{1F1EA}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1ED}\u{1F1F7}-\u{1F1FA}]|\u{1F1E8}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1EE}\u{1F1F0}-\u{1F1F5}\u{1F1F7}\u{1F1FA}-\u{1F1FF}]|\u{1F1F2}[\u{1F1E6}\u{1F1E8}-\u{1F1ED}\u{1F1F0}-\u{1F1FF}]|\u{1F1F3}[\u{1F1E6}\u{1F1E8}\u{1F1EA}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F4}\u{1F1F5}\u{1F1F7}\u{1F1FA}\u{1F1FF}]|\u{1F1FC}[\u{1F1EB}\u{1F1F8}]|\u{1F1FA}[\u{1F1E6}\u{1F1EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1F0}[\u{1F1EA}\u{1F1EC}-\u{1F1EE}\u{1F1F2}\u{1F1F3}\u{1F1F5}\u{1F1F7}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|\u{1F1F8}[\u{1F1E6}-\u{1F1EA}\u{1F1EC}-\u{1F1F4}\u{1F1F7}-\u{1F1F9}\u{1F1FB}\u{1F1FD}-\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1FF}[\u{1F1E6}\u{1F1F2}\u{1F1FC}]|\u{1F1EB}[\u{1F1EE}-\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1F7}]|\u{1F1F5}[\u{1F1E6}\u{1F1EA}-\u{1F1ED}\u{1F1F0}-\u{1F1F3}\u{1F1F7}-\u{1F1F9}\u{1F1FC}\u{1F1FE}]|\u{1F1E9}[\u{1F1EA}\u{1F1EC}\u{1F1EF}\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1FF}]|\u{1F1F9}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1ED}\u{1F1EF}-\u{1F1F4}\u{1F1F7}\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FF}]|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|[#\*0-9]\uFE0F\u20E3|\u{1F1F1}[\u{1F1E6}-\u{1F1E8}\u{1F1EE}\u{1F1F0}\u{1F1F7}-\u{1F1FB}\u{1F1FE}]|\u{1F1E6}[\u{1F1E8}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F2}\u{1F1F4}\u{1F1F6}-\u{1F1FA}\u{1F1FC}\u{1F1FD}\u{1F1FF}]|\u{1F1F7}[\u{1F1EA}\u{1F1F4}\u{1F1F8}\u{1F1FA}\u{1F1FC}]|\u{1F1FB}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1EE}\u{1F1F3}\u{1F1FA}]|\u{1F1FE}[\u{1F1EA}\u{1F1F9}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9D1}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F469}\u{1F46E}\u{1F470}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/es2015/text.js b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/es2015/text.js new file mode 100644 index 00000000000000..d0a771d36e487f --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/es2015/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}(?:\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074})\u{E007F}|\u200D\u2620\uFE0F)|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F468}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u{1F468}(?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F469}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F468}(?:\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|[\u{1F3FB}-\u{1F3FF}])|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9B0}-\u{1F9B3}]|\u{1F469}\u200D\u{1F466}|\u{1F1F6}\u{1F1E6}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F469}[\u{1F3FB}-\u{1F3FF}]|\u{1F1ED}[\u{1F1F0}\u{1F1F2}\u{1F1F3}\u{1F1F7}\u{1F1F9}\u{1F1FA}]|\u{1F1EC}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EE}\u{1F1F1}-\u{1F1F3}\u{1F1F5}-\u{1F1FA}\u{1F1FC}\u{1F1FE}]|\u{1F1EA}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1ED}\u{1F1F7}-\u{1F1FA}]|\u{1F1E8}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1EE}\u{1F1F0}-\u{1F1F5}\u{1F1F7}\u{1F1FA}-\u{1F1FF}]|\u{1F1F2}[\u{1F1E6}\u{1F1E8}-\u{1F1ED}\u{1F1F0}-\u{1F1FF}]|\u{1F1F3}[\u{1F1E6}\u{1F1E8}\u{1F1EA}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F4}\u{1F1F5}\u{1F1F7}\u{1F1FA}\u{1F1FF}]|\u{1F1FC}[\u{1F1EB}\u{1F1F8}]|\u{1F1FA}[\u{1F1E6}\u{1F1EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1F0}[\u{1F1EA}\u{1F1EC}-\u{1F1EE}\u{1F1F2}\u{1F1F3}\u{1F1F5}\u{1F1F7}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|\u{1F1F8}[\u{1F1E6}-\u{1F1EA}\u{1F1EC}-\u{1F1F4}\u{1F1F7}-\u{1F1F9}\u{1F1FB}\u{1F1FD}-\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1FF}[\u{1F1E6}\u{1F1F2}\u{1F1FC}]|\u{1F1EB}[\u{1F1EE}-\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1F7}]|\u{1F1F5}[\u{1F1E6}\u{1F1EA}-\u{1F1ED}\u{1F1F0}-\u{1F1F3}\u{1F1F7}-\u{1F1F9}\u{1F1FC}\u{1F1FE}]|\u{1F1E9}[\u{1F1EA}\u{1F1EC}\u{1F1EF}\u{1F1F0}\u{1F1F2}\u{1F1F4}\u{1F1FF}]|\u{1F1F9}[\u{1F1E6}\u{1F1E8}\u{1F1E9}\u{1F1EB}-\u{1F1ED}\u{1F1EF}-\u{1F1F4}\u{1F1F7}\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FF}]|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|[#\*0-9]\uFE0F\u20E3|\u{1F1F1}[\u{1F1E6}-\u{1F1E8}\u{1F1EE}\u{1F1F0}\u{1F1F7}-\u{1F1FB}\u{1F1FE}]|\u{1F1E6}[\u{1F1E8}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F2}\u{1F1F4}\u{1F1F6}-\u{1F1FA}\u{1F1FC}\u{1F1FD}\u{1F1FF}]|\u{1F1F7}[\u{1F1EA}\u{1F1F4}\u{1F1F8}\u{1F1FA}\u{1F1FC}]|\u{1F1FB}[\u{1F1E6}\u{1F1E8}\u{1F1EA}\u{1F1EC}\u{1F1EE}\u{1F1F3}\u{1F1FA}]|\u{1F1FE}[\u{1F1EA}\u{1F1F9}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9D1}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6F9}\u{1F910}-\u{1F93A}\u{1F93C}-\u{1F93E}\u{1F940}-\u{1F945}\u{1F947}-\u{1F970}\u{1F973}-\u{1F976}\u{1F97A}\u{1F97C}-\u{1F9A2}\u{1F9B0}-\u{1F9B9}\u{1F9C0}-\u{1F9C2}\u{1F9D0}-\u{1F9FF}]\uFE0F?|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F469}\u{1F46E}\u{1F470}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/index.js new file mode 100644 index 00000000000000..e2237a4e805327 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4(?:\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74)\uDB40\uDC7F|\u200D\u2620\uFE0F)|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3]))|\uD83D\uDC69\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83D\uDC69\u200D[\u2695\u2696\u2708])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC68(?:\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDD1-\uDDDD])/g; +}; diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/package.json b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/package.json new file mode 100644 index 00000000000000..439b65e4354d5c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/package.json @@ -0,0 +1,55 @@ +{ + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "bugs": { + "url": "https://github.com/mathiasbynens/emoji-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", + "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "mocha": "^5.2.0", + "regexgen": "^1.3.0", + "unicode-11.0.0": "^0.7.7", + "unicode-tr51": "^9.0.1" + }, + "files": [ + "LICENSE-MIT.txt", + "index.js", + "index.d.ts", + "text.js", + "es2015/index.js", + "es2015/text.js" + ], + "homepage": "https://mths.be/emoji-regex", + "keywords": [ + "unicode", + "regex", + "regexp", + "regular expressions", + "code points", + "symbols", + "characters", + "emoji" + ], + "license": "MIT", + "main": "index.js", + "name": "emoji-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/mathiasbynens/emoji-regex.git" + }, + "scripts": { + "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js", + "test": "mocha", + "test:watch": "npm run test -- --watch" + }, + "types": "index.d.ts", + "version": "7.0.3" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/text.js b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/text.js new file mode 100644 index 00000000000000..199ae3be35b418 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/emoji-regex/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4(?:\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74)\uDB40\uDC7F|\u200D\u2620\uFE0F)|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3]))|\uD83D\uDC69\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83D\uDC69\u200D[\u2695\u2696\u2708])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC68(?:\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDB0-\uDDB3])|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF9]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD70\uDD73-\uDD76\uDD7A\uDD7C-\uDDA2\uDDB0-\uDDB9\uDDC0-\uDDC2\uDDD0-\uDDFF])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDD1-\uDDDD])/g; +}; diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/index.js b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/index.js new file mode 100644 index 00000000000000..d506327c3e5576 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/index.js @@ -0,0 +1,46 @@ +'use strict'; +/* eslint-disable yoda */ +module.exports = x => { + if (Number.isNaN(x)) { + return false; + } + + // code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + x >= 0x1100 && ( + x <= 0x115f || // Hangul Jamo + x === 0x2329 || // LEFT-POINTING ANGLE BRACKET + x === 0x232a || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= x && x <= 0x4dbf) || + // CJK Unified Ideographs .. Yi Radicals + (0x4e00 <= x && x <= 0xa4c6) || + // Hangul Jamo Extended-A + (0xa960 <= x && x <= 0xa97c) || + // Hangul Syllables + (0xac00 <= x && x <= 0xd7a3) || + // CJK Compatibility Ideographs + (0xf900 <= x && x <= 0xfaff) || + // Vertical Forms + (0xfe10 <= x && x <= 0xfe19) || + // CJK Compatibility Forms .. Small Form Variants + (0xfe30 <= x && x <= 0xfe6b) || + // Halfwidth and Fullwidth Forms + (0xff01 <= x && x <= 0xff60) || + (0xffe0 <= x && x <= 0xffe6) || + // Kana Supplement + (0x1b000 <= x && x <= 0x1b001) || + // Enclosed Ideographic Supplement + (0x1f200 <= x && x <= 0x1f251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= x && x <= 0x3fffd) + ) + ) { + return true; + } + + return false; +}; diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/license b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/license new file mode 100644 index 00000000000000..654d0bfe943437 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/package.json b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/package.json new file mode 100644 index 00000000000000..5db53104f21a75 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/package.json @@ -0,0 +1,54 @@ +{ + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Check if the character represented by a given Unicode code point is fullwidth", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme", + "keywords": [ + "fullwidth", + "full-width", + "full", + "width", + "unicode", + "character", + "char", + "string", + "str", + "codepoint", + "code", + "point", + "is", + "detect", + "check" + ], + "license": "MIT", + "name": "is-fullwidth-code-point", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.0.0", + "xo": { + "esnext": true + } +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/readme.md b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/readme.md new file mode 100644 index 00000000000000..093b0281b2c46b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/node_modules/is-fullwidth-code-point/readme.md @@ -0,0 +1,39 @@ +# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) + +> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) + + +## Install + +``` +$ npm install --save is-fullwidth-code-point +``` + + +## Usage + +```js +const isFullwidthCodePoint = require('is-fullwidth-code-point'); + +isFullwidthCodePoint('谢'.codePointAt()); +//=> true + +isFullwidthCodePoint('a'.codePointAt()); +//=> false +``` + + +## API + +### isFullwidthCodePoint(input) + +#### input + +Type: `number` + +[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/license b/tools/node_modules/eslint/node_modules/type-fest/license similarity index 100% rename from tools/node_modules/eslint/node_modules/string-width/node_modules/strip-ansi/license rename to tools/node_modules/eslint/node_modules/type-fest/license diff --git a/tools/node_modules/eslint/node_modules/type-fest/package.json b/tools/node_modules/eslint/node_modules/type-fest/package.json new file mode 100644 index 00000000000000..a5a398048dc370 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/type-fest/package.json @@ -0,0 +1,59 @@ +{ + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/type-fest/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "A collection of essential TypeScript types", + "devDependencies": { + "@sindresorhus/tsconfig": "^0.3.0", + "@typescript-eslint/eslint-plugin": "^1.8.0", + "eslint-config-xo-typescript": "^0.11.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "index.d.ts", + "source" + ], + "homepage": "https://github.com/sindresorhus/type-fest#readme", + "keywords": [ + "typescript", + "ts", + "types", + "utility", + "util", + "utilities", + "omit", + "merge", + "json" + ], + "license": "(MIT OR CC0-1.0)", + "name": "type-fest", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/type-fest.git" + }, + "scripts": { + "test": "xo && tsd" + }, + "version": "0.5.2", + "xo": { + "extends": "xo-typescript", + "extensions": [ + "ts" + ], + "rules": { + "import/no-unresolved": "off", + "@typescript-eslint/indent": "off" + } + } +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/type-fest/readme.md b/tools/node_modules/eslint/node_modules/type-fest/readme.md new file mode 100644 index 00000000000000..3f11c3c1edb6c3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/type-fest/readme.md @@ -0,0 +1,118 @@ +
    +
    +
    + type-fest +
    +
    + A collection of essential TypeScript types +
    +
    +
    +
    +
    + +[![Build Status](https://travis-ci.com/sindresorhus/type-fest.svg?branch=master)](https://travis-ci.com/sindresorhus/type-fest) +[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) + + +Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). + +Either add this package as a dependency or copy-paste the needed types. No credit required. 👌 + +PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first. + + +## Install + +``` +$ npm install type-fest +``` + +*Requires TypeScript >=3.2* + + +## Usage + +```ts +import {Omit} from 'type-fest'; + +type Foo = { + unicorn: string; + rainbow: boolean; +}; + +type FooWithoutRainbow = Omit; +//=> {unicorn: string} +``` + + +## API + +Click the type names for complete docs. + +### Basic + +- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive). +- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). +- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`. +- [`JsonObject`](source/basic.d.ts) - Matches a JSON object. +- [`JsonArray`](source/basic.d.ts) - Matches a JSON array. +- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value. +- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable). + +### Utilities + +- [`Omit`](source/omit.d.ts) - Create a type from an object type without certain keys. +- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` properties into a mutable object. Inverse of `Readonly`. +- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type. +- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive properties. +- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given properties. +- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of a `object`/`Map`/`Set`/`Array` type. +- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). + +### Miscellaneous + +- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). + + +## Declined types + +*If we decline a type addition, we will make sure to document the better solution here.* + +- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider. + + +## Tips + +### Built-in types + +There are many advanced types most users don't know about. + +- [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional. +- [`Required`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required. +- [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly. +- [`Pick`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`. +- [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`. +- [`Exclude`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`. +- [`Extract`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`. +- [`NonNullable`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`. +- [`Parameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple. +- [`ConstructorParameters`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple. +- [`ReturnType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type. +- [`InstanceType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type. + +You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types). + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Jarek Radosz](https://github.com/CvX) +- [Dimitri Benin](https://github.com/BendingBender) + + +## License + +(MIT OR CC0-1.0) diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index b57c88bc36455b..93da0c92fd0cc2 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -17,11 +17,11 @@ "cross-spawn": "^6.0.5", "debug": "^4.0.1", "doctrine": "^3.0.0", - "eslint-plugin-markdown": "^1.0.0", + "eslint-plugin-markdown": "^1.0.1", "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.2", + "eslint-utils": "^1.4.3", "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.1", + "espree": "^6.1.2", "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^5.0.1", @@ -31,7 +31,7 @@ "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^6.4.1", + "inquirer": "^7.0.0", "is-glob": "^4.0.0", "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", @@ -55,7 +55,7 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "acorn": "^7.0.0", + "acorn": "^7.1.0", "babel-loader": "^8.0.5", "chai": "^4.0.1", "cheerio": "^0.22.0", @@ -149,7 +149,8 @@ "perf": "node Makefile.js perf", "publish-release": "node Makefile.js publishRelease", "test": "node Makefile.js test", + "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "6.5.1" + "version": "6.6.0" } \ No newline at end of file diff --git a/tools/test.py b/tools/test.py index ff08749425eb5a..8a7e8987bd1f8e 100755 --- a/tools/test.py +++ b/tools/test.py @@ -29,7 +29,6 @@ from __future__ import print_function -import imp import logging import optparse import os @@ -45,6 +44,28 @@ import errno import copy + +if sys.version_info >= (3, 5): + from importlib import machinery, util + def get_module(name, path): + loader_details = (machinery.SourceFileLoader, machinery.SOURCE_SUFFIXES) + spec = machinery.FileFinder(path, loader_details).find_spec(name) + module = util.module_from_spec(spec) + spec.loader.exec_module(module) + return module +else: + import imp + def get_module(name, path): + file = None + try: + (file, pathname, description) = imp.find_module(name, [path]) + return imp.load_module(name, file, pathname, description) + finally: + if file: + file.close() + + +from io import open from os.path import join, dirname, abspath, basename, isdir, exists from datetime import datetime try: @@ -700,6 +721,10 @@ def Execute(args, context, timeout=None, env=None, disable_core_files=False, std if "NODE_PATH" in env_copy: del env_copy["NODE_PATH"] + # Remove NODE_REPL_EXTERNAL_MODULE + if "NODE_REPL_EXTERNAL_MODULE" in env_copy: + del env_copy["NODE_REPL_EXTERNAL_MODULE"] + # Extend environment for key, value in env.items(): env_copy[key] = value @@ -724,8 +749,8 @@ def disableCoreFiles(): ) os.close(fd_out) os.close(fd_err) - output = open(outname).read() - errors = open(errname).read() + output = open(outname, encoding='utf8').read() + errors = open(errname, encoding='utf8').read() CheckedUnlink(outname) CheckedUnlink(errname) @@ -781,18 +806,13 @@ def GetConfiguration(self, context): if self.is_loaded: return self.config self.is_loaded = True - file = None - try: - (file, pathname, description) = imp.find_module('testcfg', [ self.path ]) - module = imp.load_module('testcfg', file, pathname, description) - self.config = module.GetConfiguration(context, self.path) - if hasattr(self.config, 'additional_flags'): - self.config.additional_flags += context.node_args - else: - self.config.additional_flags = context.node_args - finally: - if file: - file.close() + + module = get_module('testcfg', self.path) + self.config = module.GetConfiguration(context, self.path) + if hasattr(self.config, 'additional_flags'): + self.config.additional_flags += context.node_args + else: + self.config.additional_flags = context.node_args return self.config def GetBuildRequirements(self, path, context): diff --git a/tools/v8_gypfiles/broken/all.gyp b/tools/v8_gypfiles/broken/all.gyp deleted file mode 100644 index 99248205b600c7..00000000000000 --- a/tools/v8_gypfiles/broken/all.gyp +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2011 the V8 project authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -{ - 'targets': [ - { - 'target_name': 'All', - 'type': 'none', - 'dependencies': [ - 'd8.gyp:d8', - 'mkgrokdump.gyp:*', - ], - 'conditions': [ - ['component!="shared_library"', { - 'dependencies': [ - 'parser-shell.gyp:parser-shell', - ], - }], - # These items don't compile for Android on Mac. - ['host_os!="mac" or OS!="android"', { - 'dependencies': [ - 'samples.gyp:*', - ], - }], - ] - } - ] -} diff --git a/tools/v8_gypfiles/broken/coverage_wrapper.py b/tools/v8_gypfiles/broken/coverage_wrapper.py deleted file mode 100644 index d5fdee43cfb761..00000000000000 --- a/tools/v8_gypfiles/broken/coverage_wrapper.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 the V8 project authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# CC/CXX wrapper script that excludes certain file patterns from coverage -# instrumentation. - -import re -import subprocess -import sys - -exclusions = [ - 'buildtools', - 'src/third_party', - 'third_party', - 'test', - 'testing', -] - -def remove_if_exists(string_list, item): - if item in string_list: - string_list.remove(item) - -args = sys.argv[1:] -text = ' '.join(sys.argv[2:]) -for exclusion in exclusions: - if re.search(r'\-o obj/%s[^ ]*\.o' % exclusion, text): - remove_if_exists(args, '-fprofile-arcs') - remove_if_exists(args, '-ftest-coverage') - remove_if_exists(args, '-fsanitize-coverage=func') - remove_if_exists(args, '-fsanitize-coverage=bb') - remove_if_exists(args, '-fsanitize-coverage=edge') - remove_if_exists(args, '-fsanitize-coverage=trace-pc-guard') - remove_if_exists(args, '-fsanitize-coverage=bb,trace-pc-guard') - break - -sys.exit(subprocess.check_call(args)) diff --git a/tools/v8_gypfiles/broken/gyp_environment.py b/tools/v8_gypfiles/broken/gyp_environment.py deleted file mode 100644 index fe6b51f28abbdf..00000000000000 --- a/tools/v8_gypfiles/broken/gyp_environment.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2015 the V8 project authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Sets up various automatic gyp environment variables. These are used by -gyp_v8 and landmines.py which run at different stages of runhooks. To -make sure settings are consistent between them, all setup should happen here. -""" - -import os -import sys - -SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -V8_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir)) - - -def apply_gyp_environment(file_path=None): - """ - Reads in a *.gyp_env file and applies the valid keys to os.environ. - """ - if not file_path or not os.path.exists(file_path): - return - file_contents = open(file_path).read() - try: - file_data = eval(file_contents, {'__builtins__': None}, None) - except SyntaxError, e: - e.filename = os.path.abspath(file_path) - raise - supported_vars = ( 'V8_GYP_FILE', - 'V8_GYP_SYNTAX_CHECK', - 'GYP_DEFINES', - 'GYP_GENERATORS', - 'GYP_GENERATOR_FLAGS', - 'GYP_GENERATOR_OUTPUT', ) - for var in supported_vars: - val = file_data.get(var) - if val: - if var in os.environ: - print 'INFO: Environment value for "%s" overrides value in %s.' % ( - var, os.path.abspath(file_path) - ) - else: - os.environ[var] = val - - -def set_environment(): - """Sets defaults for GYP_* variables.""" - - if 'SKIP_V8_GYP_ENV' not in os.environ: - # Update the environment based on v8.gyp_env - gyp_env_path = os.path.join(os.path.dirname(V8_ROOT), 'v8.gyp_env') - apply_gyp_environment(gyp_env_path) - - if not os.environ.get('GYP_GENERATORS'): - # Default to ninja on all platforms. - os.environ['GYP_GENERATORS'] = 'ninja' diff --git a/tools/v8_gypfiles/broken/gyp_v8 b/tools/v8_gypfiles/broken/gyp_v8 deleted file mode 100644 index a0971cce36e610..00000000000000 --- a/tools/v8_gypfiles/broken/gyp_v8 +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012 the V8 project authors. All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This script is wrapper for V8 that adds some support for how GYP -# is invoked by V8 beyond what can be done in the gclient hooks. - -import argparse -import glob -import os -import platform -import shlex -import sys - -script_dir = os.path.dirname(os.path.realpath(__file__)) -sys.path.insert(0, script_dir) -import gyp_environment - -v8_root = os.path.abspath(os.path.join(script_dir, os.pardir)) - -sys.path.insert(0, os.path.join(v8_root, 'tools', 'gyp', 'pylib')) -import gyp - -# Add paths so that pymod_do_main(...) can import files. -sys.path.insert( - 1, os.path.abspath(os.path.join(v8_root, 'tools', 'generate_shim_headers'))) -sys.path.append( - os.path.abspath(os.path.join(v8_root, 'third_party', 'binutils'))) - -def GetOutputDirectory(): - """Returns the output directory that GYP will use.""" - - # Handle command line generator flags. - parser = argparse.ArgumentParser() - parser.add_argument('-G', dest='genflags', default=[], action='append') - genflags = parser.parse_known_args()[0].genflags - - # Handle generator flags from the environment. - genflags += shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')) - - needle = 'output_dir=' - for item in genflags: - if item.startswith(needle): - return item[len(needle):] - - return 'out' - - -def additional_include_files(args=[]): - """ - Returns a list of additional (.gypi) files to include, without - duplicating ones that are already specified on the command line. - """ - # Determine the include files specified on the command line. - # This doesn't cover all the different option formats you can use, - # but it's mainly intended to avoid duplicating flags on the automatic - # makefile regeneration which only uses this format. - specified_includes = set() - for arg in args: - if arg.startswith('-I') and len(arg) > 2: - specified_includes.add(os.path.realpath(arg[2:])) - - result = [] - def AddInclude(path): - if os.path.realpath(path) not in specified_includes: - result.append(path) - - # Always include standalone.gypi - AddInclude(os.path.join(v8_root, 'gypfiles', 'standalone.gypi')) - - # Optionally add supplemental .gypi files if present. - supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) - for supplement in supplements: - AddInclude(supplement) - - return result - - -def run_gyp(args): - if gyp.main(args) != 0: - print 'Error running GYP' - sys.exit(rc) - - -if __name__ == '__main__': - args = sys.argv[1:] - - gyp_chromium_no_action = os.environ.get('GYP_CHROMIUM_NO_ACTION') - if gyp_chromium_no_action == '1': - print 'Skipping gyp_v8 due to GYP_CHROMIUM_NO_ACTION env var.' - sys.exit(0) - - running_as_hook = '--running-as-hook' - if running_as_hook in args and gyp_chromium_no_action != '0': - print 'GYP is now disabled by default in runhooks.\n' - print 'If you really want to run this, either run ' - print '`python gypfiles/gyp_v8` explicitly by hand ' - print 'or set the environment variable GYP_CHROMIUM_NO_ACTION=0.' - sys.exit(0) - - if running_as_hook in args: - args.remove(running_as_hook) - - gyp_environment.set_environment() - - # This could give false positives since it doesn't actually do real option - # parsing. Oh well. - gyp_file_specified = False - for arg in args: - if arg.endswith('.gyp'): - gyp_file_specified = True - break - - # If we didn't get a file, check an env var, and then fall back to - # assuming 'all.gyp' from the same directory as the script. - if not gyp_file_specified: - gyp_file = os.environ.get('V8_GYP_FILE') - if gyp_file: - # Note that V8_GYP_FILE values can't have backslashes as - # path separators even on Windows due to the use of shlex.split(). - args.extend(shlex.split(gyp_file)) - else: - args.append(os.path.join(script_dir, 'all.gyp')) - - args.extend(['-I' + i for i in additional_include_files(args)]) - - # There shouldn't be a circular dependency relationship between .gyp files - args.append('--no-circular-check') - - # Set the GYP DEPTH variable to the root of the V8 project. - args.append('--depth=' + os.path.relpath(v8_root)) - - # If V8_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check - # to enfore syntax checking. - syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK') - if syntax_check and int(syntax_check): - args.append('--check') - - print 'Updating projects from gyp files...' - sys.stdout.flush() - - # Generate for the architectures supported on the given platform. - gyp_args = list(args) - gyp_args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) - gyp_generators = os.environ.get('GYP_GENERATORS', '') - if platform.system() == 'Linux' and gyp_generators != 'ninja': - # Work around for crbug.com/331475. - for f in glob.glob(os.path.join(v8_root, 'out', 'Makefile.*')): - os.unlink(f) - # --generator-output defines where the Makefile goes. - gyp_args.append('--generator-output=out') - # -Goutput_dir defines where the build output goes, relative to the - # Makefile. Set it to . so that the build output doesn't end up in out/out. - gyp_args.append('-Goutput_dir=.') - - gyp_defines = os.environ.get('GYP_DEFINES', '') - - # Automatically turn on crosscompile support for platforms that need it. - if all(('ninja' in gyp_generators, - 'OS=android' in gyp_defines, - 'GYP_CROSSCOMPILE' not in os.environ)): - os.environ['GYP_CROSSCOMPILE'] = '1' - - run_gyp(gyp_args) diff --git a/tools/v8_gypfiles/broken/gyp_v8.py b/tools/v8_gypfiles/broken/gyp_v8.py deleted file mode 100644 index 462ee674acbbc5..00000000000000 --- a/tools/v8_gypfiles/broken/gyp_v8.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2013 the V8 project authors. All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This file is (possibly, depending on python version) imported by -# gyp_v8 when GYP_PARALLEL=1 and it creates sub-processes through the -# multiprocessing library. - -# Importing in Python 2.6 (fixed in 2.7) on Windows doesn't search for imports -# that don't end in .py (and aren't directories with an __init__.py). This -# wrapper makes "import gyp_v8" work with those old versions and makes it -# possible to execute gyp_v8.py directly on Windows where the extension is -# useful. - -import os - -path = os.path.abspath(os.path.split(__file__)[0]) -execfile(os.path.join(path, 'gyp_v8')) diff --git a/tools/v8_gypfiles/broken/mac/asan.gyp b/tools/v8_gypfiles/broken/mac/asan.gyp deleted file mode 100644 index 3fc7f58d434915..00000000000000 --- a/tools/v8_gypfiles/broken/mac/asan.gyp +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2015 the V8 project authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -{ - 'targets': [ - { - 'target_name': 'asan_dynamic_runtime', - 'toolsets': ['target', 'host'], - 'type': 'none', - 'variables': { - # Every target is going to depend on asan_dynamic_runtime, so allow - # this one to depend on itself. - 'prune_self_dependency': 1, - # Path is relative to this GYP file. - 'asan_rtl_mask_path': - '../../third_party/llvm-build/Release+Asserts/lib/clang/*/lib/darwin', - 'asan_osx_dynamic': - '<(asan_rtl_mask_path)/libclang_rt.asan_osx_dynamic.dylib', - }, - 'copies': [ - { - 'destination': '<(PRODUCT_DIR)', - 'files': [ - '@ instead of @< to also see clang_warning_flags set in - # targets directly, not just the clang_warning_flags in target_defaults. - 'cflags': [ '>@(clang_warning_flags)' ], - 'cflags!': [ '>@(clang_warning_flags_unset)' ], - 'xcode_settings': { - 'WARNING_CFLAGS': ['>@(clang_warning_flags)'], - 'WARNING_CFLAGS!': ['>@(clang_warning_flags_unset)'], - }, - 'msvs_settings': { - 'VCCLCompilerTool': { - 'AdditionalOptions': [ '>@(clang_warning_flags)' ], - 'AdditionalOptions!': [ '>@(clang_warning_flags_unset)' ], - }, - }, - }], - ['clang==0 and host_clang==1', { - 'target_conditions': [ - ['_toolset=="host"', { - 'cflags': [ '>@(clang_warning_flags)' ], - 'cflags!': [ '>@(clang_warning_flags_unset)' ], - }], - ], - }], - ], -} diff --git a/tools/v8_gypfiles/broken/shim_headers.gypi b/tools/v8_gypfiles/broken/shim_headers.gypi deleted file mode 100644 index 940211c2401c43..00000000000000 --- a/tools/v8_gypfiles/broken/shim_headers.gypi +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2013 the V8 project authors. All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This file is meant to be included into a target to handle shim headers -# in a consistent manner. To use this the following variables need to be -# defined: -# headers_root_path: string: path to directory containing headers -# header_filenames: list: list of header file names - -{ - 'variables': { - 'shim_headers_path': '<(SHARED_INTERMEDIATE_DIR)/shim_headers/<(_target_name)/<(_toolset)', - 'shim_generator_additional_args%': [], - }, - 'include_dirs++': [ - '<(shim_headers_path)', - ], - 'all_dependent_settings': { - 'include_dirs+++': [ - '<(shim_headers_path)', - ], - }, - 'actions': [ - { - 'variables': { - 'generator_path': '<(DEPTH)/tools/generate_shim_headers/generate_shim_headers.py', - 'generator_args': [ - '--headers-root', '<(headers_root_path)', - '--output-directory', '<(shim_headers_path)', - '<@(shim_generator_additional_args)', - '<@(header_filenames)', - ], - }, - 'action_name': 'generate_<(_target_name)_shim_headers', - 'inputs': [ - '<(generator_path)', - ], - 'outputs': [ - '