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 6d7e00af1a482f..e140392b723514 100644 --- a/.mailmap +++ b/.mailmap @@ -270,6 +270,7 @@ Miguel Angel Asencio Hurtado maasencioh Mike Kaufman Minqi Pan P.S.V.R +Minuk Park Minwoo Jung JungMinu Minwoo Jung Minwoo Jung @@ -338,6 +339,7 @@ Santiago Gimeno Sarah Meyer sarahmeyer Sartrey Lee sartrey Saúl Ibarra Corretgé +Shobhit Chittora Scott Blomquist Segu Riluvan Sergey Kryzhanovsky @@ -384,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 8aa321ec1626d8..6c16bdad821f0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,3 +88,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 006c21521df1f5..0df731b099e5c5 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -246,7 +246,7 @@ transition before the year-end deadline. * GNU Make 3.81 or newer * Python (see note above) * Python 2.7 - * Python 3.5, 3.6, and 3.7 are experimental. + * Python 3.5, 3.6, 3.7, and 3.8 are experimental. Installation via Linux package manager can be achieved with: @@ -262,7 +262,7 @@ FreeBSD and OpenBSD users may also need to install `libexecinfo`. * Xcode Command Line Tools >= 10 for macOS * Python (see note above) * Python 2.7 - * Python 3.5, 3.6, and 3.7 are experimental. + * Python 3.5, 3.6, 3.7, and 3.8 are experimental. macOS users can install the `Xcode Command Line Tools` by running `xcode-select --install`. Alternatively, if you already have the full Xcode @@ -282,6 +282,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 fca5a1818eb8d6..0b5817827fd274 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,8 @@ release. -13.0.1
+13.1.0
+13.0.1
13.0.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/README.md b/README.md index c46aac2a42cab4..aa5ca6d6595170 100644 --- a/README.md +++ b/README.md @@ -338,8 +338,6 @@ 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) - @@ -348,16 +346,14 @@ For information about the governance of the Node.js project, see **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/fs/bench-opendir.js b/benchmark/fs/bench-opendir.js index 419c3a231a850b..20e178d9cc5236 100644 --- a/benchmark/fs/bench-opendir.js +++ b/benchmark/fs/bench-opendir.js @@ -7,10 +7,11 @@ const path = require('path'); const bench = common.createBenchmark(main, { n: [100], dir: [ 'lib', 'test/parallel'], - mode: [ 'async', 'sync', 'callback' ] + mode: [ 'async', 'sync', 'callback' ], + bufferSize: [ 4, 32, 1024 ] }); -async function main({ n, dir, mode }) { +async function main({ n, dir, mode, bufferSize }) { const fullPath = path.resolve(__dirname, '../../', dir); bench.start(); @@ -18,11 +19,12 @@ async function main({ n, dir, mode }) { let counter = 0; for (let i = 0; i < n; i++) { if (mode === 'async') { + const dir = await fs.promises.opendir(fullPath, { bufferSize }); // eslint-disable-next-line no-unused-vars - for await (const entry of await fs.promises.opendir(fullPath)) + for await (const entry of dir) counter++; } else if (mode === 'callback') { - const dir = await fs.promises.opendir(fullPath); + const dir = await fs.promises.opendir(fullPath, { bufferSize }); await new Promise((resolve, reject) => { function read() { dir.read((err, entry) => { @@ -40,7 +42,7 @@ async function main({ n, dir, mode }) { read(); }); } else { - const dir = fs.opendirSync(fullPath); + const dir = fs.opendirSync(fullPath, { bufferSize }); while (dir.readSync() !== null) counter++; dir.closeSync(); diff --git a/common.gypi b/common.gypi index 78a57d929198be..b5df26fd2be34f 100644 --- a/common.gypi +++ b/common.gypi @@ -39,7 +39,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.14', + 'v8_embedder_string': '-node.19', ##### V8 defaults for Node.js ##### diff --git a/configure b/configure index 9259feb9e61671..f199a353482bec 100755 --- a/configure +++ b/configure @@ -7,10 +7,11 @@ # pyenv will alert which shims are available and then will fail the build. _=[ 'exec' '/bin/sh' '-c' ''' test ${TRAVIS} && exec python "$0" "$@" # workaround for pyenv on Travis CI -which python2.7 >/dev/null && exec python2.7 "$0" "$@" +which python3.8 >/dev/null && exec python3.8 "$0" "$@" which python3.7 >/dev/null && exec python3.7 "$0" "$@" which python3.6 >/dev/null && exec python3.6 "$0" "$@" which python3.5 >/dev/null && exec python3.5 "$0" "$@" +which python2.7 >/dev/null && exec python2.7 "$0" "$@" exec python "$0" "$@" ''' "$0" "$@" ] @@ -20,7 +21,7 @@ import sys from distutils.spawn import find_executable print('Node configure: Found Python {0}.{1}.{2}...'.format(*sys.version_info)) -acceptable_pythons = ((2, 7), (3, 7), (3, 6), (3, 5)) +acceptable_pythons = ((3, 8), (3, 7), (3, 6), (3, 5), (2, 7)) if sys.version_info[:2] in acceptable_pythons: import configure else: diff --git a/configure.py b/configure.py index bfc50d7fbde6e7..959c1db6518fdb 100755 --- a/configure.py +++ b/configure.py @@ -12,6 +12,7 @@ import subprocess import shutil import bz2 +import io from distutils.spawn import find_executable as which from distutils.version import StrictVersion @@ -297,23 +298,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) @@ -1137,12 +1138,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']] @@ -1497,10 +1499,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']: @@ -1652,11 +1655,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/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/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/v8/include/v8.h b/deps/v8/include/v8.h index fa26d2dd36d9a1..9d0b6a6c65479e 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -1440,11 +1440,19 @@ class V8_EXPORT Module { /** * Set this module's exported value for the name export_name to the specified * export_value. This method must be called only on Modules created via - * CreateSyntheticModule. export_name must be one of the export_names that - * were passed in that CreateSyntheticModule call. - */ - void SetSyntheticModuleExport(Local export_name, - Local export_value); + * CreateSyntheticModule. An error will be thrown if export_name is not one + * of the export_names that were passed in that CreateSyntheticModule call. + * Returns Just(true) on success, Nothing() if an error was thrown. + */ + V8_WARN_UNUSED_RESULT Maybe SetSyntheticModuleExport( + Isolate* isolate, Local export_name, Local export_value); + V8_DEPRECATE_SOON( + "Use the preceding SetSyntheticModuleExport with an Isolate parameter, " + "instead of the one that follows. The former will throw a runtime " + "error if called for an export that doesn't exist (as per spec); " + "the latter will crash with a failed CHECK().", + void SetSyntheticModuleExport(Local export_name, + Local export_value)); }; /** diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 30eceb6223377f..8be7f8558c8dde 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -1314,6 +1314,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; @@ -2362,6 +2363,28 @@ Local Module::CreateSyntheticModule( i_module_name, i_export_names, evaluation_steps))); } +Maybe Module::SetSyntheticModuleExport(Isolate* isolate, + Local export_name, + Local export_value) { + auto i_isolate = reinterpret_cast(isolate); + i::Handle i_export_name = Utils::OpenHandle(*export_name); + i::Handle i_export_value = Utils::OpenHandle(*export_value); + i::Handle self = Utils::OpenHandle(this); + Utils::ApiCheck(self->IsSyntheticModule(), + "v8::Module::SyntheticModuleSetExport", + "v8::Module::SyntheticModuleSetExport must only be called on " + "a SyntheticModule"); + ENTER_V8_NO_SCRIPT(i_isolate, isolate->GetCurrentContext(), Module, + SetSyntheticModuleExport, Nothing(), i::HandleScope); + has_pending_exception = + i::SyntheticModule::SetExport(i_isolate, + i::Handle::cast(self), + i_export_name, i_export_value) + .IsNothing(); + RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); + return Just(true); +} + void Module::SetSyntheticModuleExport(Local export_name, Local export_value) { i::Handle i_export_name = Utils::OpenHandle(*export_name); @@ -2371,9 +2394,9 @@ void Module::SetSyntheticModuleExport(Local export_name, "v8::Module::SetSyntheticModuleExport", "v8::Module::SetSyntheticModuleExport must only be called on " "a SyntheticModule"); - i::SyntheticModule::SetExport(self->GetIsolate(), - i::Handle::cast(self), - i_export_name, i_export_value); + i::SyntheticModule::SetExportStrict(self->GetIsolate(), + i::Handle::cast(self), + i_export_name, i_export_value); } namespace { diff --git a/deps/v8/src/builtins/proxy-get-prototype-of.tq b/deps/v8/src/builtins/proxy-get-prototype-of.tq index 653d4503d16477..5b90a1bb02a064 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/logging/counters.h b/deps/v8/src/logging/counters.h index 4466e0a53bc6ca..35df5ec0384565 100644 --- a/deps/v8/src/logging/counters.h +++ b/deps/v8/src/logging/counters.h @@ -780,6 +780,7 @@ class RuntimeCallTimer final { V(Message_GetStartColumn) \ V(Module_Evaluate) \ V(Module_InstantiateModule) \ + V(Module_SetSyntheticModuleExport) \ V(NumberObject_New) \ V(NumberObject_NumberValue) \ V(Object_CallAsConstructor) \ diff --git a/deps/v8/src/objects/synthetic-module.cc b/deps/v8/src/objects/synthetic-module.cc index 0cca30a37b9e7f..850721ac99d303 100644 --- a/deps/v8/src/objects/synthetic-module.cc +++ b/deps/v8/src/objects/synthetic-module.cc @@ -17,16 +17,36 @@ namespace internal { // Implements SetSyntheticModuleBinding: // https://heycam.github.io/webidl/#setsyntheticmoduleexport -void SyntheticModule::SetExport(Isolate* isolate, - Handle module, - Handle export_name, - Handle export_value) { +Maybe SyntheticModule::SetExport(Isolate* isolate, + Handle module, + Handle export_name, + Handle export_value) { Handle exports(module->exports(), isolate); Handle export_object(exports->Lookup(export_name), isolate); - CHECK(export_object->IsCell()); + + if (!export_object->IsCell()) { + isolate->Throw(*isolate->factory()->NewReferenceError( + MessageTemplate::kModuleExportUndefined, export_name)); + return Nothing(); + } + Handle export_cell(Handle::cast(export_object)); // Spec step 2: Set the mutable binding of export_name to export_value export_cell->set_value(*export_value); + + return Just(true); +} + +void SyntheticModule::SetExportStrict(Isolate* isolate, + Handle module, + Handle export_name, + Handle export_value) { + Handle exports(module->exports(), isolate); + Handle export_object(exports->Lookup(export_name), isolate); + CHECK(export_object->IsCell()); + Maybe set_export_result = + SetExport(isolate, module, export_name, export_value); + CHECK(set_export_result.FromJust()); } // Implements Synthetic Module Record's ResolveExport concrete method: diff --git a/deps/v8/src/objects/synthetic-module.h b/deps/v8/src/objects/synthetic-module.h index 6f3bb0438e9597..77a6eed2761da6 100644 --- a/deps/v8/src/objects/synthetic-module.h +++ b/deps/v8/src/objects/synthetic-module.h @@ -24,9 +24,21 @@ class SyntheticModule DECL_VERIFIER(SyntheticModule) DECL_PRINTER(SyntheticModule) - static void SetExport(Isolate* isolate, Handle module, - Handle export_name, - Handle export_value); + // Set module's exported value for the specified export_name to the specified + // export_value. An error will be thrown if export_name is not one + // of the export_names that were supplied during module construction. + // Returns Just(true) on success, Nothing() if an error was thrown. + static Maybe SetExport(Isolate* isolate, Handle module, + Handle export_name, + Handle export_value); + // The following redundant method should be deleted when the deprecated + // version of v8::SetSyntheticModuleExport is removed. It differs from + // SetExport in that it crashes rather than throwing an error if the caller + // attempts to set an export_name that was not present during construction of + // the module. + static void SetExportStrict(Isolate* isolate, Handle module, + Handle export_name, + Handle export_value); using BodyDescriptor = SubclassBodyDescriptor< Module::BodyDescriptor, 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 d6e421cafa3f89..ec1beca84b7b4f 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 1a670a9b10f1f9..345ee0bfc9de97 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)); } } @@ -23654,7 +23658,9 @@ v8::MaybeLocal SyntheticModuleEvaluationStepsCallbackFail( v8::MaybeLocal SyntheticModuleEvaluationStepsCallbackSetExport( Local context, Local module) { - module->SetSyntheticModuleExport(v8_str("test_export"), v8_num(42)); + Maybe set_export_result = module->SetSyntheticModuleExport( + context->GetIsolate(), v8_str("test_export"), v8_num(42)); + CHECK(set_export_result.FromJust()); return v8::Undefined(reinterpret_cast(context->GetIsolate())); } @@ -23861,7 +23867,9 @@ TEST(SyntheticModuleSetExports) { // undefined. CHECK(foo_cell->value().IsUndefined()); - module->SetSyntheticModuleExport(foo_string, bar_string); + Maybe set_export_result = + module->SetSyntheticModuleExport(isolate, foo_string, bar_string); + CHECK(set_export_result.FromJust()); // After setting the export the Cell should still have the same idenitity. CHECK_EQ(exports->Lookup(v8::Utils::OpenHandle(*foo_string)), *foo_cell); @@ -23872,6 +23880,34 @@ TEST(SyntheticModuleSetExports) { ->Equals(*v8::Utils::OpenHandle(*bar_string))); } +TEST(SyntheticModuleSetMissingExport) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + auto i_isolate = reinterpret_cast(isolate); + v8::Isolate::Scope iscope(isolate); + v8::HandleScope scope(isolate); + v8::Local context = v8::Context::New(isolate); + v8::Context::Scope cscope(context); + + Local foo_string = v8_str("foo"); + Local bar_string = v8_str("bar"); + + Local module = CreateAndInstantiateSyntheticModule( + isolate, v8_str("SyntheticModuleSetExports-TestSyntheticModule"), context, + std::vector>(), + UnexpectedSyntheticModuleEvaluationStepsCallback); + + i::Handle i_module = + i::Handle::cast(v8::Utils::OpenHandle(*module)); + i::Handle exports(i_module->exports(), i_isolate); + + TryCatch try_catch(isolate); + Maybe set_export_result = + module->SetSyntheticModuleExport(isolate, foo_string, bar_string); + CHECK(set_export_result.IsNothing()); + CHECK(try_catch.HasCaught()); +} + TEST(SyntheticModuleEvaluationStepsNoThrow) { synthetic_module_callback_count = 0; LocalContext env; 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 8724b988f0f2fe..ceaf7798fd32c2 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 @@ -382,7 +383,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 = ''; @@ -577,7 +578,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/abi_version_registry.json b/doc/abi_version_registry.json index 3234b95fd1fe2e..ba27aeb024d0d8 100644 --- a/doc/abi_version_registry.json +++ b/doc/abi_version_registry.json @@ -1,5 +1,6 @@ { "NODE_MODULE_VERSION": [ + { "modules": 80, "runtime": "electron", "variant": "electron", "versions": "9" }, { "modules": 79, "runtime": "node", "variant": "v8_7.8", "versions": "13" }, { "modules": 78, "runtime": "node", "variant": "v8_7.7", "versions": "13.0.0-pre" }, { "modules": 77, "runtime": "node", "variant": "v8_7.6", "versions": "13.0.0-pre" }, 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 e47d315019c87b..fa46a00aff8f0f 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. @@ -127,6 +127,15 @@ added: v12.0.0 Specify the file name of the CPU profile generated by `--cpu-prof`. +### `--disallow-code-generation-from-strings` + + +Make built-in language features like `eval` and `new Function` that generate +code from strings throw an exception instead. This does not affect the Node.js +`vm` module. + ### `--enable-fips` + +Enable experimental support for a package using `require` or `import` to load +itself. + ### `--experimental-vm-modules` + +Print stack traces for uncaught exceptions; usually, the stack trace associated +with the creation of an `Error` is printed, whereas this makes Node.js also +print the stack trace associated with throwing the value (which does not need +to be an `Error` instance). + +Enabling this option may affect garbage collection behavior negatively. + ### `--trace-warnings` * `--abort-on-uncaught-exception` +* `--disallow-code-generation-from-strings` * `--interpreted-frames-native-stack` * `--max-old-space-size` * `--perf-basic-prof-only-functions` diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 6ea11b08ae2a16..112da9b2aa402e 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -456,7 +456,7 @@ Workers will call `process.exit(0)` if the `'disconnect'` event occurs on `process` and `.exitedAfterDisconnect` is not `true`. This protects against accidental disconnection. -### worker.send(message\[, sendHandle\]\[, callback\]) +### worker.send(message\[, sendHandle\[, options\]\]\[, callback\]) + +* `options` {Object} [`stream.transform` options][] +* Returns: {Hash} + +Creates a new `Hash` object that contains a deep copy of the internal state +of the current `Hash` object. + +The optional `options` argument controls stream behavior. For XOF hash +functions such as `'shake256'`, the `outputLength` option can be used to +specify the desired output length in bytes. + +An error is thrown when an attempt is made to copy the `Hash` object after +its [`hash.digest()`][] method has been called. + +```js +// Calculate a rolling hash. +const crypto = require('crypto'); +const hash = crypto.createHash('sha256'); + +hash.update('one'); +console.log(hash.copy().digest('hex')); + +hash.update('two'); +console.log(hash.copy().digest('hex')); + +hash.update('three'); +console.log(hash.copy().digest('hex')); + +// Etc. +``` + ### hash.digest(\[encoding\]) +* `sourceAddress` {string} +* `groupAddress` {string} +* `multicastInterface` {string} + +Tells the kernel to join a source-specific multicast channel at the given +`sourceAddress` and `groupAddress`, using the `multicastInterface` with the +`IP_ADD_SOURCE_MEMBERSHIP` socket option. If the `multicastInterface` argument +is not specified, the operating system will choose one interface and will add +membership to it. To add membership to every available interface, call +`socket.addSourceSpecificMembership()` multiple times, once per interface. + ### socket.address() + +* `sourceAddress` {string} +* `groupAddress` {string} +* `multicastInterface` {string} + +Instructs the kernel to leave a source-specific multicast channel at the given +`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` +socket option. This method is automatically called by the kernel when the +socket is closed or the process terminates, so most apps will never have +reason to call this. + +If `multicastInterface` is not specified, the operating system will attempt to +drop membership on all valid interfaces. + ### socket.getRecvBufferSize() -* `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 e1002f11fb3054..5cb44868e8d47c 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 @@ -839,9 +839,6 @@ _isMain_ is **true** when resolving the Node.js application entry point. > 1. Let _packageSubpath_ be *undefined*. > 1. If _packageSpecifier_ is an empty string, then > 1. Throw an _Invalid Specifier_ error. -> 1. If _packageSpecifier_ does not start with _"@"_, then -> 1. Set _packageName_ to the substring of _packageSpecifier_ until the -> first _"/"_ separator or the end of the string. > 1. Otherwise, > 1. If _packageSpecifier_ does not contain a _"/"_ separator, then > 1. Throw an _Invalid Specifier_ error. @@ -855,7 +852,7 @@ _isMain_ is **true** when resolving the Node.js application entry point. > 1. Set _packageSubpath_ to _"."_ concatenated with the substring of > _packageSpecifier_ from the position at the length of _packageName_. > 1. If _packageSubpath_ contains any _"."_ or _".."_ segments or percent -> encoded strings for _"/"_ or _"\\"_ then, +> encoded strings for _"/"_ or _"\\"_, then > 1. Throw an _Invalid Specifier_ error. > 1. If _packageSubpath_ is _undefined_ and _packageName_ is a Node.js builtin > module, then @@ -878,8 +875,31 @@ _isMain_ is **true** when resolving the Node.js application entry point. > 1. Return **PACKAGE_EXPORTS_RESOLVE**(_packageURL_, > _packageSubpath_, _pjson.exports_). > 1. Return the URL resolution of _packageSubpath_ in _packageURL_. +> 1. Set _selfUrl_ to the result of +> **SELF_REFERENCE_RESOLE**(_packageSpecifier_, _parentURL_). +> 1. If _selfUrl_ isn't empty, return _selfUrl_. > 1. Throw a _Module Not Found_ error. +**SELF_REFERENCE_RESOLVE**(_specifier_, _parentURL_) + +> 1. Let _packageURL_ be the result of **READ_PACKAGE_SCOPE**(_parentURL_). +> 1. If _packageURL_ is **null**, then +> 1. Return an empty result. +> 1. Let _pjson_ be the result of **READ_PACKAGE_JSON**(_packageURL_). +> 1. Set _name_ to _pjson.name_. +> 1. If _name_ is empty, then return an empty result. +> 1. If _name_ is equal to _specifier_, then +> 1. Return the result of **PACKAGE_MAIN_RESOLVE**(_packageURL_, _pjson_). +> 1. If _specifier_ starts with _name_ followed by "/", then +> 1. Set _subpath_ to everything after the "/". +> 1. If _pjson_ is not **null** and _pjson_ has an _"exports"_ key, then +> 1. Let _exports_ be _pjson.exports_. +> 1. If _exports_ is not **null** or **undefined**, then +> 1. Return **PACKAGE_EXPORTS_RESOLVE**(_packageURL_, _subpath_, +> _pjson.exports_). +> 1. Return the URL resolution of _subpath_ in _packageURL_. +> 1. Otherwise return an empty result. + **PACKAGE_MAIN_RESOLVE**(_packageURL_, _pjson_) > 1. If _pjson_ is **null**, then 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 66cc7d7a7ccbd7..de0acff8eac34e 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -982,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 @@ -1571,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. @@ -1619,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. @@ -2625,11 +2625,18 @@ Functions based on `fs.open()` exhibit this behavior as well: ## fs.opendir(path\[, options\], callback) * `path` {string|Buffer|URL} * `options` {Object} * `encoding` {string|null} **Default:** `'utf8'` + * `bufferSize` {number} Number of directory entries that are buffered + internally when reading from the directory. Higher values lead to better + performance but higher memory usage. **Default:** `32` * `callback` {Function} * `err` {Error} * `dir` {fs.Dir} @@ -2645,11 +2652,18 @@ directory and subsequent read operations. ## fs.opendirSync(path\[, options\]) * `path` {string|Buffer|URL} * `options` {Object} * `encoding` {string|null} **Default:** `'utf8'` + * `bufferSize` {number} Number of directory entries that are buffered + internally when reading from the directory. Higher values lead to better + performance but higher memory usage. **Default:** `32` * Returns: {fs.Dir} Synchronously open a directory. See opendir(3). @@ -3834,7 +3848,7 @@ event (its disappearance). This happens when: * the file is deleted, followed by a restore -* the file is renamed twice - the second time back to its original name +* the file is renamed and then renamed a second time back to its original name ## fs.write(fd, buffer\[, offset\[, length\[, position\]\]\], callback) * `path` {string|Buffer|URL} * `options` {Object} * `encoding` {string|null} **Default:** `'utf8'` + * `bufferSize` {number} Number of directory entries that are buffered + internally when reading from the directory. Higher values lead to better + performance but higher memory usage. **Default:** `32` * Returns: {Promise} containing {fs.Dir} Asynchronously open a directory. See opendir(3). @@ -5371,31 +5392,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 @@ -5406,15 +5427,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 @@ -5434,7 +5455,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. 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 * Extends: {stream.Readable} diff --git a/doc/api/http2.md b/doc/api/http2.md index fbd51fd86a62d3..53461ac58d4605 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -311,6 +311,7 @@ added: v8.4.0 After the `http2session.setTimeout()` method is used to set the timeout period for this `Http2Session`, the `'timeout'` event is emitted if there is no activity on the `Http2Session` after the configured number of milliseconds. +Its listener does not expect any arguments. ```js session.setTimeout(2000); @@ -937,6 +938,7 @@ added: v8.4.0 The `'aborted'` event is emitted whenever a `Http2Stream` instance is abnormally aborted in mid-communication. +Its listener does not expect any arguments. The `'aborted'` event will only be emitted if the `Http2Stream` writable side has not been ended. @@ -1982,21 +1984,19 @@ changes: serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted and the stream being closed and destroyed. - * `paddingStrategy` {number} Identifies the strategy used for determining the - amount of padding to use for `HEADERS` and `DATA` frames. **Default:** + * `paddingStrategy` {number} The strategy used for determining the amount of + padding to use for `HEADERS` and `DATA` frames. **Default:** `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of: - * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is - to be applied. - * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum - amount of padding, as determined by the internal implementation, is to - be applied. - * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply - enough padding to ensure that the total frame length, including the - 9-byte header, is a multiple of 8. For each frame, however, there is a - maximum allowed number of padding bytes that is determined by current - flow control state and settings. If this maximum is less than the - calculated amount needed to ensure alignment, the maximum will be used - and the total frame length will *not* necessarily be aligned at 8 bytes. + * `http2.constants.PADDING_STRATEGY_NONE`: No padding is applied. + * `http2.constants.PADDING_STRATEGY_MAX`: The maximum amount of padding, + determined by the internal implementation, is applied. + * `http2.constants.PADDING_STRATEGY_ALIGNED`: Attempts to apply enough + padding to ensure that the total frame length, including the 9-byte + header, is a multiple of 8. For each frame, there is a maximum allowed + number of padding bytes that is determined by current flow control state + and settings. If this maximum is less than the calculated amount needed to + ensure alignment, the maximum is used and the total frame length is not + necessarily aligned at 8 bytes. * `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received. Will be overridden if the remote peer sets its own value for @@ -2096,21 +2096,19 @@ changes: serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted and the stream being closed and destroyed. - * `paddingStrategy` {number} Identifies the strategy used for determining the - amount of padding to use for `HEADERS` and `DATA` frames. **Default:** + * `paddingStrategy` {number} Strategy used for determining the amount of + padding to use for `HEADERS` and `DATA` frames. **Default:** `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of: - * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is - to be applied. - * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum - amount of padding, as determined by the internal implementation, is to - be applied. - * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply - enough padding to ensure that the total frame length, including the - 9-byte header, is a multiple of 8. For each frame, however, there is a - maximum allowed number of padding bytes that is determined by current - flow control state and settings. If this maximum is less than the - calculated amount needed to ensure alignment, the maximum will be used - and the total frame length will *not* necessarily be aligned at 8 bytes. + * `http2.constants.PADDING_STRATEGY_NONE`: No padding is applied. + * `http2.constants.PADDING_STRATEGY_MAX`: The maximum amount of padding, + determined by the internal implementation, is applied. + * `http2.constants.PADDING_STRATEGY_ALIGNED`: Attempts to apply enough + padding to ensure that the total frame length, including the + 9-byte header, is a multiple of 8. For each frame, there is a maximum + allowed number of padding bytes that is determined by current flow control + state and settings. If this maximum is less than the calculated amount + needed to ensure alignment, the maximum is used and the total frame length + is not necessarily aligned at 8 bytes. * `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received. Will be overridden if the remote peer sets its own value for @@ -2196,21 +2194,19 @@ changes: serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted and the stream being closed and destroyed. - * `paddingStrategy` {number} Identifies the strategy used for determining the - amount of padding to use for `HEADERS` and `DATA` frames. **Default:** + * `paddingStrategy` {number} Strategy used for determining the amount of + padding to use for `HEADERS` and `DATA` frames. **Default:** `http2.constants.PADDING_STRATEGY_NONE`. Value may be one of: - * `http2.constants.PADDING_STRATEGY_NONE` - Specifies that no padding is - to be applied. - * `http2.constants.PADDING_STRATEGY_MAX` - Specifies that the maximum - amount of padding, as determined by the internal implementation, is to - be applied. - * `http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply - enough padding to ensure that the total frame length, including the - 9-byte header, is a multiple of 8. For each frame, however, there is a - maximum allowed number of padding bytes that is determined by current - flow control state and settings. If this maximum is less than the - calculated amount needed to ensure alignment, the maximum will be used - and the total frame length will *not* necessarily be aligned at 8 bytes. + * `http2.constants.PADDING_STRATEGY_NONE`: No padding is applied. + * `http2.constants.PADDING_STRATEGY_MAX`: The maximum amount of padding, + determined by the internal implementation, is applied. + * `http2.constants.PADDING_STRATEGY_ALIGNED`: Attemps to apply enough + padding to ensure that the total frame length, including the + 9-byte header, is a multiple of 8. For each frame, there is a maximum + allowed number of padding bytes that is determined by current flow control + state and settings. If this maximum is less than the calculated amount + needed to ensure alignment, the maximum is used and the total frame length + is not necessarily aligned at 8 bytes. * `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received. Will be overridden if the remote peer sets its own value for diff --git a/doc/api/index.md b/doc/api/index.md index ad16610edaa461..ceb3ce7f1985ef 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -14,7 +14,7 @@ * [Async Hooks](async_hooks.html) * [Buffer](buffer.html) * [C++ Addons](addons.html) -* [C/C++ Addons - N-API](n-api.html) +* [C/C++ Addons with N-API](n-api.html) * [Child Processes](child_process.html) * [Cluster](cluster.html) * [Command Line Options](cli.html) diff --git a/doc/api/inspector.md b/doc/api/inspector.md index a5407cad336757..41d96a0024e934 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -152,7 +152,7 @@ added: v8.0.0 Posts a message to the inspector back-end. `callback` will be notified when a response is received. `callback` is a function that accepts two optional -arguments - error and message-specific result. +arguments: error and message-specific result. ```js session.post('Runtime.evaluate', { expression: '2 + 2' }, diff --git a/doc/api/modules.md b/doc/api/modules.md index cb14c8face77ae..8715218b32c8a4 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -83,9 +83,9 @@ by checking `require.main.filename`. 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,8 +159,10 @@ 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" +5. LOAD_SELF_REFERENCE(X, dirname(Y)) +6. THROW "not found" LOAD_AS_FILE(X) 1. If X is a file, load X as JavaScript text. STOP @@ -200,6 +202,13 @@ NODE_MODULES_PATHS(START) c. DIRS = DIRS + DIR d. let I = I - 1 5. return DIRS + +LOAD_SELF_REFERENCE(X, START) +1. Find the closest package scope to START. +2. If no scope was found, throw "not found". +3. If the name in `package.json` isn't a prefix of X, throw "not found". +4. Otherwise, resolve the remainder of X relative to this package as if it + was loaded via `LOAD_NODE_MODULES` with a name in `package.json`. ``` Node.js allows packages loaded via @@ -214,8 +223,8 @@ LOAD_NODE_MODULES(X, START) 1. let DIRS = NODE_MODULES_PATHS(START) 2. for each DIR in DIRS: a. let FILE_PATH = RESOLVE_BARE_SPECIFIER(DIR, X) - a. LOAD_AS_FILE(FILE_PATH) - b. LOAD_AS_DIRECTORY(FILE_PATH) + b. LOAD_AS_FILE(FILE_PATH) + c. LOAD_AS_DIRECTORY(FILE_PATH) RESOLVE_BARE_SPECIFIER(DIR, X) 1. Try to interpret X as a combination of name and subpath where the name diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 40145674671433..e04283fdba968b 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 @@ -728,11 +810,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, @@ -1664,9 +1746,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`][]. @@ -2387,18 +2468,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. @@ -2849,7 +2930,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][] @@ -3336,17 +3417,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 @@ -4265,8 +4344,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. @@ -4800,7 +4878,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 @@ -4869,9 +4947,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 @@ -4916,13 +4994,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()`. @@ -5138,40 +5216,51 @@ 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.1.1.3]: https://tc39.es/ecma262/#sec-detacharraybuffer +[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 +[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 +[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 @@ -5215,10 +5304,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 eedbfeefdd7d40..9fa2b786547e52 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} @@ -2381,40 +2383,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 d08de8636a3bb8..b39a5286398b2c 100644 --- a/doc/api/report.md +++ b/doc/api/report.md @@ -445,11 +445,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 { @@ -483,8 +483,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 ef0bbb502735d3..54521737704990 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 @@ -1534,7 +1534,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(); // ... }); @@ -1658,11 +1658,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 @@ -2508,7 +2508,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. @@ -2609,8 +2609,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 5529bd3529aecc..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 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 5cb5786a5274de..a38288d4585867 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: @@ -665,18 +665,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`, @@ -1108,11 +1108,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_V13.md b/doc/changelogs/CHANGELOG_V13.md index 67c3a3528c0c79..74b7294bee8c78 100644 --- a/doc/changelogs/CHANGELOG_V13.md +++ b/doc/changelogs/CHANGELOG_V13.md @@ -9,6 +9,8 @@ @@ -29,6 +31,97 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2019-11-05, Version 13.1.0 (Current), @targos + +### Notable Changes + +* **cli**: + * Added a new flag (`--trace-uncaught`) that makes Node.js print the stack + trace at the time of throwing uncaught exceptions, rather than at the + creation of the `Error` object, if there is any. This is disabled by default + because it affects GC behavior (Anna Henningsen) [#30025](https://github.com/nodejs/node/pull/30025). +* **crypto**: + * Added `Hash.prototype.copy()` method. It returns a new `Hash` object with + its internal state cloned from the original one (Ben Noordhuis) [#29910](https://github.com/nodejs/node/pull/29910). +* **dgram**: + * Added source-specific multicast support. This adds methods to Datagram + sockets to support [RFC 4607](https://tools.ietf.org/html/rfc4607) for IPv4 + and IPv6 (Lucas Pardue) [#15735](https://github.com/nodejs/node/pull/15735). +* **fs**: + * Added a `bufferSize` option to `fs.opendir()`. It allows to control the + number of entries that are buffered internally when reading from the + directory (Anna Henningsen) [#30114](https://github.com/nodejs/node/pull/30114). +* **meta**: + * Added [Chengzhong Wu](https://github.com/legendecas) to collaborators [#30115](https://github.com/nodejs/node/pull/30115). + +### Commits + +* [[`445837851b`](https://github.com/nodejs/node/commit/445837851b)] - **async_hooks**: only emit `after` for AsyncResource if stack not empty (Anna Henningsen) [#30087](https://github.com/nodejs/node/pull/30087) +* [[`8860bd68b6`](https://github.com/nodejs/node/commit/8860bd68b6)] - **buffer**: improve performance caused by primordials (Jizu Sun) [#30235](https://github.com/nodejs/node/pull/30235) +* [[`1bded9841c`](https://github.com/nodejs/node/commit/1bded9841c)] - **build**: fix detection of Visual Studio 2017 (Richard Lau) [#30119](https://github.com/nodejs/node/pull/30119) +* [[`49e7f042f9`](https://github.com/nodejs/node/commit/49e7f042f9)] - **build**: add workaround for WSL (gengjiawen) [#30221](https://github.com/nodejs/node/pull/30221) +* [[`03827ddf38`](https://github.com/nodejs/node/commit/03827ddf38)] - **build**: allow Python 3.8 (Michaël Zasso) [#30194](https://github.com/nodejs/node/pull/30194) +* [[`54698113c0`](https://github.com/nodejs/node/commit/54698113c0)] - **build**: find Python syntax errors in dependencies (Christian Clauss) [#30143](https://github.com/nodejs/node/pull/30143) +* [[`b255688d5f`](https://github.com/nodejs/node/commit/b255688d5f)] - **build**: fix pkg-config search for libnghttp2 (Ben Noordhuis) [#30145](https://github.com/nodejs/node/pull/30145) +* [[`8980d8c25f`](https://github.com/nodejs/node/commit/8980d8c25f)] - **build**: vcbuild uses default Python, not Py2 (João Reis) [#30091](https://github.com/nodejs/node/pull/30091) +* [[`cedad02406`](https://github.com/nodejs/node/commit/cedad02406)] - **build**: prefer python 3 over 2 for configure (Sam Roberts) [#30091](https://github.com/nodejs/node/pull/30091) +* [[`5ba842b8f9`](https://github.com/nodejs/node/commit/5ba842b8f9)] - **build**: python3 support for configure (Rod Vagg) [#30047](https://github.com/nodejs/node/pull/30047) +* [[`d05f67caef`](https://github.com/nodejs/node/commit/d05f67caef)] - **cli**: whitelist new V8 flag in NODE\_OPTIONS (Shelley Vohr) [#30094](https://github.com/nodejs/node/pull/30094) +* [[`5ca58646c1`](https://github.com/nodejs/node/commit/5ca58646c1)] - **(SEMVER-MINOR)** **cli**: add --trace-uncaught flag (Anna Henningsen) [#30025](https://github.com/nodejs/node/pull/30025) +* [[`8b75aabee9`](https://github.com/nodejs/node/commit/8b75aabee9)] - **crypto**: guard with OPENSSL\_NO\_GOST (Shelley Vohr) [#30050](https://github.com/nodejs/node/pull/30050) +* [[`1d03df4c5e`](https://github.com/nodejs/node/commit/1d03df4c5e)] - **(SEMVER-MINOR)** **crypto**: add Hash.prototype.copy() method (Ben Noordhuis) [#29910](https://github.com/nodejs/node/pull/29910) +* [[`46c9194ec8`](https://github.com/nodejs/node/commit/46c9194ec8)] - **deps**: V8: cherry-pick a7dffcd767be (Christian Clauss) [#30218](https://github.com/nodejs/node/pull/30218) +* [[`104bfb9a38`](https://github.com/nodejs/node/commit/104bfb9a38)] - **deps**: V8: cherry-pick e5dbc95 (Gabriel Schulhof) [#30130](https://github.com/nodejs/node/pull/30130) +* [[`e3124481c2`](https://github.com/nodejs/node/commit/e3124481c2)] - **deps**: update npm to 6.12.1 (Michael Perrotte) [#30164](https://github.com/nodejs/node/pull/30164) +* [[`f3d00c594d`](https://github.com/nodejs/node/commit/f3d00c594d)] - **deps**: V8: backport 777fa98 (Michaël Zasso) [#30062](https://github.com/nodejs/node/pull/30062) +* [[`1cfa98c23e`](https://github.com/nodejs/node/commit/1cfa98c23e)] - **deps**: V8: cherry-pick c721203 (Michaël Zasso) [#30065](https://github.com/nodejs/node/pull/30065) +* [[`0d9ae1b8f6`](https://github.com/nodejs/node/commit/0d9ae1b8f6)] - **deps**: V8: cherry-pick ed40ab1 (Michaël Zasso) [#30064](https://github.com/nodejs/node/pull/30064) +* [[`a63f7e73c4`](https://github.com/nodejs/node/commit/a63f7e73c4)] - **(SEMVER-MINOR)** **dgram**: add source-specific multicast support (Lucas Pardue) [#15735](https://github.com/nodejs/node/pull/15735) +* [[`fc407bb555`](https://github.com/nodejs/node/commit/fc407bb555)] - **doc**: add missing hash for header link (Nick Schonning) [#30188](https://github.com/nodejs/node/pull/30188) +* [[`201a60e6ba`](https://github.com/nodejs/node/commit/201a60e6ba)] - **doc**: linkify `.setupMaster()` in cluster doc (Trivikram Kamat) [#30204](https://github.com/nodejs/node/pull/30204) +* [[`b7070f315f`](https://github.com/nodejs/node/commit/b7070f315f)] - **doc**: explain http2 aborted event callback (dev-313) [#30179](https://github.com/nodejs/node/pull/30179) +* [[`f8fb2c06c5`](https://github.com/nodejs/node/commit/f8fb2c06c5)] - **doc**: linkify `.fork()` in cluster documentation (Anna Henningsen) [#30163](https://github.com/nodejs/node/pull/30163) +* [[`ae81360214`](https://github.com/nodejs/node/commit/ae81360214)] - **doc**: update AUTHORS list (Michaël Zasso) [#30142](https://github.com/nodejs/node/pull/30142) +* [[`1499a72a1f`](https://github.com/nodejs/node/commit/1499a72a1f)] - **doc**: improve doc Http2Session:Timeout (dev-313) [#30161](https://github.com/nodejs/node/pull/30161) +* [[`3709b5cc7e`](https://github.com/nodejs/node/commit/3709b5cc7e)] - **doc**: move inactive Collaborators to emeriti (Rich Trott) [#30177](https://github.com/nodejs/node/pull/30177) +* [[`a48d17900b`](https://github.com/nodejs/node/commit/a48d17900b)] - **doc**: add options description for send APIs (dev-313) [#29868](https://github.com/nodejs/node/pull/29868) +* [[`dfb4a24695`](https://github.com/nodejs/node/commit/dfb4a24695)] - **doc**: fix an error in resolution algorithm steps (Alex Zherdev) [#29940](https://github.com/nodejs/node/pull/29940) +* [[`403a648a16`](https://github.com/nodejs/node/commit/403a648a16)] - **doc**: fix numbering in require algorithm (Jan Krems) [#30117](https://github.com/nodejs/node/pull/30117) +* [[`e4ab6fced1`](https://github.com/nodejs/node/commit/e4ab6fced1)] - **doc**: remove incorrect and outdated example (Tobias Nießen) [#30138](https://github.com/nodejs/node/pull/30138) +* [[`3c23224a76`](https://github.com/nodejs/node/commit/3c23224a76)] - **doc**: adjust code sample for stream.finished (Cotton Hou) [#29983](https://github.com/nodejs/node/pull/29983) +* [[`d91d270416`](https://github.com/nodejs/node/commit/d91d270416)] - **doc**: claim NODE\_MODULE\_VERSION=80 for Electron 9 (Samuel Attard) [#30052](https://github.com/nodejs/node/pull/30052) +* [[`621eaf9ed5`](https://github.com/nodejs/node/commit/621eaf9ed5)] - **doc**: remove "it is important to" phrasing (Rich Trott) [#30108](https://github.com/nodejs/node/pull/30108) +* [[`9a71091098`](https://github.com/nodejs/node/commit/9a71091098)] - **doc**: revise os.md (Rich Trott) [#30102](https://github.com/nodejs/node/pull/30102) +* [[`381c6cd0d2`](https://github.com/nodejs/node/commit/381c6cd0d2)] - **doc**: delete "a number of" things in the docs (Rich Trott) [#30103](https://github.com/nodejs/node/pull/30103) +* [[`45c70a9793`](https://github.com/nodejs/node/commit/45c70a9793)] - **doc**: remove dashes (Rich Trott) [#30101](https://github.com/nodejs/node/pull/30101) +* [[`ea9d125536`](https://github.com/nodejs/node/commit/ea9d125536)] - **doc**: add legendecas to collaborators (legendecas) [#30115](https://github.com/nodejs/node/pull/30115) +* [[`39070bbed0`](https://github.com/nodejs/node/commit/39070bbed0)] - **doc**: make YAML matter consistent in crypto.md (Rich Trott) [#30016](https://github.com/nodejs/node/pull/30016) +* [[`978946e38b`](https://github.com/nodejs/node/commit/978946e38b)] - **doc,meta**: prefer aliases and stubs over Runtime Deprecations (Rich Trott) [#30153](https://github.com/nodejs/node/pull/30153) +* [[`32a538901f`](https://github.com/nodejs/node/commit/32a538901f)] - **doc,n-api**: sort bottom-of-the-page references (Gabriel Schulhof) [#30124](https://github.com/nodejs/node/pull/30124) +* [[`07b5584a3f`](https://github.com/nodejs/node/commit/07b5584a3f)] - **(SEMVER-MINOR)** **fs**: add `bufferSize` option to `fs.opendir()` (Anna Henningsen) [#30114](https://github.com/nodejs/node/pull/30114) +* [[`2505f678ef`](https://github.com/nodejs/node/commit/2505f678ef)] - **http**: support readable hwm in IncomingMessage (Colin Ihrig) [#30135](https://github.com/nodejs/node/pull/30135) +* [[`f01c5c51b0`](https://github.com/nodejs/node/commit/f01c5c51b0)] - **inspector**: turn platform tasks that outlive Agent into no-ops (Anna Henningsen) [#30031](https://github.com/nodejs/node/pull/30031) +* [[`050efebf24`](https://github.com/nodejs/node/commit/050efebf24)] - **meta**: use contact\_links instead of issue templates (Michaël Zasso) [#30172](https://github.com/nodejs/node/pull/30172) +* [[`edfbee3727`](https://github.com/nodejs/node/commit/edfbee3727)] - **module**: resolve self-references (Jan Krems) [#29327](https://github.com/nodejs/node/pull/29327) +* [[`93b1bb8cb5`](https://github.com/nodejs/node/commit/93b1bb8cb5)] - **n-api,doc**: add info about building n-api addons (Jim Schlight) [#30032](https://github.com/nodejs/node/pull/30032) +* [[`cc1cd2b3c5`](https://github.com/nodejs/node/commit/cc1cd2b3c5)] - **src**: isolate-\>Dispose() order consistency (Shelley Vohr) [#30181](https://github.com/nodejs/node/pull/30181) +* [[`a0df91cce1`](https://github.com/nodejs/node/commit/a0df91cce1)] - **(SEMVER-MINOR)** **src**: expose granular SetIsolateUpForNode (Shelley Vohr) [#30150](https://github.com/nodejs/node/pull/30150) +* [[`ec7b69ff05`](https://github.com/nodejs/node/commit/ec7b69ff05)] - **src**: change env.h includes for forward declarations (Alexandre Ferrando) [#30133](https://github.com/nodejs/node/pull/30133) +* [[`98c8f76dd1`](https://github.com/nodejs/node/commit/98c8f76dd1)] - **src**: split up InitializeContext (Shelley Vohr) [#30067](https://github.com/nodejs/node/pull/30067) +* [[`d78e3176dd`](https://github.com/nodejs/node/commit/d78e3176dd)] - **src**: fix crash with SyntheticModule#setExport (Michaël Zasso) [#30062](https://github.com/nodejs/node/pull/30062) +* [[`fd0aded233`](https://github.com/nodejs/node/commit/fd0aded233)] - **src**: allow inspector without v8 platform (Shelley Vohr) [#30049](https://github.com/nodejs/node/pull/30049) +* [[`87f14e13b3`](https://github.com/nodejs/node/commit/87f14e13b3)] - **stream**: extract Readable.from in its own file (Matteo Collina) [#30140](https://github.com/nodejs/node/pull/30140) +* [[`1d9f4278dd`](https://github.com/nodejs/node/commit/1d9f4278dd)] - **test**: use arrow functions for callbacks (Minuk Park) [#30069](https://github.com/nodejs/node/pull/30069) +* [[`a03809d7dd`](https://github.com/nodejs/node/commit/a03809d7dd)] - **test**: verify npm compatibility with releases (Michaël Zasso) [#30082](https://github.com/nodejs/node/pull/30082) +* [[`68e4b5a1fc`](https://github.com/nodejs/node/commit/68e4b5a1fc)] - **tools**: fix Python 3 deprecation warning in test.py (Loris Zinsou) [#30208](https://github.com/nodejs/node/pull/30208) +* [[`348ec693ac`](https://github.com/nodejs/node/commit/348ec693ac)] - **tools**: fix Python 3 syntax error in mac\_tool.py (Christian Clauss) [#30146](https://github.com/nodejs/node/pull/30146) +* [[`e2fb353df3`](https://github.com/nodejs/node/commit/e2fb353df3)] - **tools**: use print() function in buildbot\_run.py (Christian Clauss) [#30148](https://github.com/nodejs/node/pull/30148) +* [[`bcbcce5983`](https://github.com/nodejs/node/commit/bcbcce5983)] - **tools**: undefined name opts -\> args in gyptest.py (Christian Clauss) [#30144](https://github.com/nodejs/node/pull/30144) +* [[`14981f5bba`](https://github.com/nodejs/node/commit/14981f5bba)] - **tools**: git rm -r tools/v8\_gypfiles/broken (Christian Clauss) [#30149](https://github.com/nodejs/node/pull/30149) +* [[`d549a34597`](https://github.com/nodejs/node/commit/d549a34597)] - **tools**: update ESLint to 6.6.0 (Colin Ihrig) [#30123](https://github.com/nodejs/node/pull/30123) +* [[`a3757546e8`](https://github.com/nodejs/node/commit/a3757546e8)] - **tools**: doc: improve async workflow of generate.js (Theotime Poisseau) [#30106](https://github.com/nodejs/node/pull/30106) + ## 2019-10-23, Version 13.0.1 (Current), @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/node.1 b/doc/node.1 index 7f786a05c6e51a..e9b7855b9be483 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -100,6 +100,11 @@ The default is File name of the V8 CPU profile generated with .Fl -cpu-prof . +.It Fl -disallow-code-generation-from-strings +Make built-in language features like `eval` and `new Function` that generate +code from strings throw an exception instead. This does not affect the Node.js +`vm` module. +. .It Fl -enable-fips Enable FIPS-compliant crypto at startup. Requires Node.js to be built with @@ -337,6 +342,18 @@ Print a stack trace whenever synchronous I/O is detected after the first turn of .It Fl -trace-tls Prints TLS packet trace information to stderr. . +.It Fl -trace-uncaught +Print stack traces for uncaught exceptions; usually, the stack trace associated +with the creation of an +.Sy Error +is printed, whereas this makes Node.js also +print the stack trace associated with throwing the value (which does not need +to be an +.Sy Error +instance). +.Pp +Enabling this option may affect garbage collection behavior negatively. +. .It Fl -trace-warnings Print stack traces for process warnings (including deprecations). . 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/_http_incoming.js b/lib/_http_incoming.js index ad3699cc44dc33..3e8bd69c04f0cf 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -37,7 +37,15 @@ function readStop(socket) { /* Abstract base class for ServerRequest and ClientResponse. */ function IncomingMessage(socket) { - Stream.Readable.call(this); + let streamOptions; + + if (socket) { + streamOptions = { + highWaterMark: socket.readableHighWaterMark + }; + } + + Stream.Readable.call(this, streamOptions); this._readableState.readingMore = true; diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 5d2300cf891bca..91cf2f75b07125 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); @@ -1209,40 +1210,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/dgram.js b/lib/dgram.js index cc61d4d274eea1..d29d1e7b190f3a 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -832,6 +832,55 @@ Socket.prototype.dropMembership = function(multicastAddress, } }; +Socket.prototype.addSourceSpecificMembership = function(sourceAddress, + groupAddress, + interfaceAddress) { + healthCheck(this); + + if (typeof sourceAddress !== 'string') { + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'sourceAddress', + 'string'); + } + + if (typeof groupAddress !== 'string') { + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'groupAddress', + 'string'); + } + + const err = + this[kStateSymbol].handle.addSourceSpecificMembership(sourceAddress, + groupAddress, + interfaceAddress); + if (err) { + throw errnoException(err, 'addSourceSpecificMembership'); + } +}; + + +Socket.prototype.dropSourceSpecificMembership = function(sourceAddress, + groupAddress, + interfaceAddress) { + healthCheck(this); + + if (typeof sourceAddress !== 'string') { + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'sourceAddress', + 'string'); + } + + if (typeof groupAddress !== 'string') { + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'groupAddress', + 'string'); + } + + const err = + this[kStateSymbol].handle.dropSourceSpecificMembership(sourceAddress, + groupAddress, + interfaceAddress); + if (err) { + throw errnoException(err, 'dropSourceSpecificMembership'); + } +}; + function healthCheck(socket) { if (!socket[kStateSymbol].handle) { diff --git a/lib/internal/crypto/hash.js b/lib/internal/crypto/hash.js index eccfb445690b1c..b28f9fca13365c 100644 --- a/lib/internal/crypto/hash.js +++ b/lib/internal/crypto/hash.js @@ -34,7 +34,8 @@ const kFinalized = Symbol('kFinalized'); function Hash(algorithm, options) { if (!(this instanceof Hash)) return new Hash(algorithm, options); - validateString(algorithm, 'algorithm'); + if (!(algorithm instanceof _Hash)) + validateString(algorithm, 'algorithm'); const xofLen = typeof options === 'object' && options !== null ? options.outputLength : undefined; if (xofLen !== undefined) @@ -49,6 +50,14 @@ function Hash(algorithm, options) { Object.setPrototypeOf(Hash.prototype, LazyTransform.prototype); Object.setPrototypeOf(Hash, LazyTransform); +Hash.prototype.copy = function copy(options) { + const state = this[kState]; + if (state[kFinalized]) + throw new ERR_CRYPTO_HASH_FINALIZED(); + + return new Hash(this[kHandle], options); +}; + Hash.prototype._transform = function _transform(chunk, encoding, callback) { this[kHandle].update(chunk, encoding); callback(); diff --git a/lib/internal/fs/dir.js b/lib/internal/fs/dir.js index fedd7ff8eddb2b..90ab31fe5abc73 100644 --- a/lib/internal/fs/dir.js +++ b/lib/internal/fs/dir.js @@ -21,6 +21,9 @@ const { getValidatedPath, handleErrorFromBinding } = require('internal/fs/utils'); +const { + validateUint32 +} = require('internal/validators'); const kDirHandle = Symbol('kDirHandle'); const kDirPath = Symbol('kDirPath'); @@ -39,9 +42,14 @@ class Dir { this[kDirPath] = path; this[kDirClosed] = false; - this[kDirOptions] = getOptions(options, { - encoding: 'utf8' - }); + this[kDirOptions] = { + bufferSize: 32, + ...getOptions(options, { + encoding: 'utf8' + }) + }; + + validateUint32(this[kDirOptions].bufferSize, 'options.bufferSize', true); this[kDirReadPromisified] = internalUtil.promisify(this[kDirReadImpl]).bind(this, false); @@ -88,6 +96,7 @@ class Dir { this[kDirHandle].read( this[kDirOptions].encoding, + this[kDirOptions].bufferSize, req ); } @@ -105,6 +114,7 @@ class Dir { const ctx = { path: this[kDirPath] }; const result = this[kDirHandle].read( this[kDirOptions].encoding, + this[kDirOptions].bufferSize, undefined, ctx ); diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index a28383690ae2d9..7df91ce4fd1c67 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -58,6 +58,7 @@ const enableSourceMaps = getOptionValue('--enable-source-maps'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const experimentalModules = getOptionValue('--experimental-modules'); +const experimentalSelf = getOptionValue('--experimental-resolve-self'); const manifest = getOptionValue('--experimental-policy') ? require('internal/process/policy').manifest : null; @@ -241,6 +242,7 @@ function readPackage(requestPath) { try { const parsed = JSON.parse(json); const filtered = { + name: parsed.name, main: parsed.main, exports: parsed.exports, type: parsed.type @@ -370,6 +372,125 @@ function findLongestRegisteredExtension(filename) { return '.js'; } +function resolveBasePath(basePath, exts, isMain, trailingSlash, request) { + let filename; + + const rc = stat(basePath); + if (!trailingSlash) { + if (rc === 0) { // File. + if (!isMain) { + if (preserveSymlinks) { + filename = path.resolve(basePath); + } else { + filename = toRealPath(basePath); + } + } else if (preserveSymlinksMain) { + // For the main module, we use the preserveSymlinksMain flag instead + // mainly for backward compatibility, as the preserveSymlinks flag + // historically has not applied to the main module. Most likely this + // was intended to keep .bin/ binaries working, as following those + // symlinks is usually required for the imports in the corresponding + // files to resolve; that said, in some use cases following symlinks + // causes bigger problems which is why the preserveSymlinksMain option + // is needed. + filename = path.resolve(basePath); + } else { + filename = toRealPath(basePath); + } + } + + if (!filename) { + // Try it with each of the extensions + if (exts === undefined) + exts = Object.keys(Module._extensions); + filename = tryExtensions(basePath, exts, isMain); + } + } + + if (!filename && rc === 1) { // Directory. + // try it with each of the extensions at "index" + if (exts === undefined) + exts = Object.keys(Module._extensions); + filename = tryPackage(basePath, exts, isMain, request); + } + + return filename; +} + +function trySelf(paths, exts, isMain, trailingSlash, request) { + if (!experimentalSelf) { + return false; + } + + const { data: pkg, path: basePath } = readPackageScope(paths[0]); + if (!pkg) return false; + if (typeof pkg.name !== 'string') return false; + + let expansion; + if (request === pkg.name) { + expansion = ''; + } else if (StringPrototype.startsWith(request, `${pkg.name}/`)) { + expansion = StringPrototype.slice(request, pkg.name.length); + } else { + return false; + } + + if (exts === undefined) + exts = Object.keys(Module._extensions); + + if (expansion) { + // Use exports + const fromExports = applyExports(basePath, expansion); + if (!fromExports) return false; + return resolveBasePath(fromExports, exts, isMain, trailingSlash, request); + } else { + // Use main field + return tryPackage(basePath, exts, isMain, request); + } +} + +function applyExports(basePath, expansion) { + const pkgExports = readPackageExports(basePath); + const mappingKey = `.${expansion}`; + + if (typeof pkgExports === 'object' && pkgExports !== null) { + if (ObjectPrototype.hasOwnProperty(pkgExports, mappingKey)) { + const mapping = pkgExports[mappingKey]; + return resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, '', + basePath, mappingKey); + } + + let dirMatch = ''; + for (const candidateKey of Object.keys(pkgExports)) { + if (candidateKey[candidateKey.length - 1] !== '/') continue; + if (candidateKey.length > dirMatch.length && + StringPrototype.startsWith(mappingKey, candidateKey)) { + dirMatch = candidateKey; + } + } + + if (dirMatch !== '') { + const mapping = pkgExports[dirMatch]; + const subpath = StringPrototype.slice(mappingKey, dirMatch.length); + return resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, + subpath, basePath, mappingKey); + } + } + if (mappingKey === '.' && typeof pkgExports === 'string') { + return resolveExportsTarget(pathToFileURL(basePath + '/'), pkgExports, + '', basePath, mappingKey); + } + if (pkgExports != null) { + // eslint-disable-next-line no-restricted-syntax + const e = new Error(`Package exports for '${basePath}' do not define ` + + `a '${mappingKey}' subpath`); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + + return path.resolve(basePath, mappingKey); +} + // This only applies to requests of a specific form: // 1. name/.* // 2. @scope/name/.* @@ -384,43 +505,7 @@ function resolveExports(nmPath, request, absoluteRequest) { } const basePath = path.resolve(nmPath, name); - const pkgExports = readPackageExports(basePath); - const mappingKey = `.${expansion}`; - - if (typeof pkgExports === 'object' && pkgExports !== null) { - if (ObjectPrototype.hasOwnProperty(pkgExports, mappingKey)) { - const mapping = pkgExports[mappingKey]; - return resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, '', - basePath, mappingKey); - } - - let dirMatch = ''; - for (const candidateKey of Object.keys(pkgExports)) { - if (candidateKey[candidateKey.length - 1] !== '/') continue; - if (candidateKey.length > dirMatch.length && - StringPrototype.startsWith(mappingKey, candidateKey)) { - dirMatch = candidateKey; - } - } - - if (dirMatch !== '') { - const mapping = pkgExports[dirMatch]; - const subpath = StringPrototype.slice(mappingKey, dirMatch.length); - return resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, - subpath, basePath, mappingKey); - } - } - if (mappingKey === '.' && typeof pkgExports === 'string') { - return resolveExportsTarget(pathToFileURL(basePath + '/'), pkgExports, - '', basePath, mappingKey); - } - if (pkgExports != null) { - // eslint-disable-next-line no-restricted-syntax - const e = new Error(`Package exports for '${basePath}' do not define ` + - `a '${mappingKey}' subpath`); - e.code = 'MODULE_NOT_FOUND'; - throw e; - } + return applyExports(basePath, expansion); } return path.resolve(nmPath, request); @@ -536,6 +621,13 @@ Module._findPath = function(request, paths, isMain) { return filename; } } + + const selfFilename = trySelf(paths, exts, isMain, trailingSlash, request); + if (selfFilename) { + Module._pathCache[cacheKey] = selfFilename; + return selfFilename; + } + return false; }; 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/node.gyp b/node.gyp index ecdecb05f4da8f..5f8089e617a247 100644 --- a/node.gyp +++ b/node.gyp @@ -205,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', diff --git a/src/api/environment.cc b/src/api/environment.cc index 3c5665a2d22623..846e4a873da51c 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -196,36 +196,56 @@ void SetIsolateCreateParamsForNode(Isolate::CreateParams* params) { } } -void SetIsolateUpForNode(v8::Isolate* isolate, IsolateSettingCategories cat) { - switch (cat) { - case IsolateSettingCategories::kErrorHandlers: - isolate->AddMessageListenerWithErrorLevel( - errors::PerIsolateMessageListener, - Isolate::MessageErrorLevel::kMessageError | - Isolate::MessageErrorLevel::kMessageWarning); - isolate->SetAbortOnUncaughtExceptionCallback( - ShouldAbortOnUncaughtException); - isolate->SetFatalErrorHandler(OnFatalError); - isolate->SetPrepareStackTraceCallback(PrepareStackTraceCallback); - break; - case IsolateSettingCategories::kMisc: - isolate->SetMicrotasksPolicy(MicrotasksPolicy::kExplicit); - isolate->SetAllowWasmCodeGenerationCallback( - AllowWasmCodeGenerationCallback); - isolate->SetPromiseRejectCallback(task_queue::PromiseRejectCallback); - isolate->SetHostCleanupFinalizationGroupCallback( - HostCleanupFinalizationGroupCallback); - v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); - break; - default: - UNREACHABLE(); - break; - } +void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) { + if (s.flags & MESSAGE_LISTENER_WITH_ERROR_LEVEL) + isolate->AddMessageListenerWithErrorLevel( + errors::PerIsolateMessageListener, + Isolate::MessageErrorLevel::kMessageError | + Isolate::MessageErrorLevel::kMessageWarning); + + auto* abort_callback = s.should_abort_on_uncaught_exception_callback ? + s.should_abort_on_uncaught_exception_callback : + ShouldAbortOnUncaughtException; + isolate->SetAbortOnUncaughtExceptionCallback(abort_callback); + + auto* fatal_error_cb = s.fatal_error_callback ? + s.fatal_error_callback : OnFatalError; + isolate->SetFatalErrorHandler(fatal_error_cb); + + auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ? + s.prepare_stack_trace_callback : PrepareStackTraceCallback; + isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb); +} + +void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) { + isolate->SetMicrotasksPolicy(s.policy); + + auto* allow_wasm_codegen_cb = s.allow_wasm_code_generation_callback ? + s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback; + isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb); + + auto* promise_reject_cb = s.promise_reject_callback ? + s.promise_reject_callback : task_queue::PromiseRejectCallback; + isolate->SetPromiseRejectCallback(promise_reject_cb); + + auto* host_cleanup_cb = s.host_cleanup_finalization_group_callback ? + s.host_cleanup_finalization_group_callback : + HostCleanupFinalizationGroupCallback; + isolate->SetHostCleanupFinalizationGroupCallback(host_cleanup_cb); + + if (s.flags & DETAILED_SOURCE_POSITIONS_FOR_PROFILING) + v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate); +} + +void SetIsolateUpForNode(v8::Isolate* isolate, + const IsolateSettings& settings) { + SetIsolateErrorHandlers(isolate, settings); + SetIsolateMiscHandlers(isolate, settings); } void SetIsolateUpForNode(v8::Isolate* isolate) { - SetIsolateUpForNode(isolate, IsolateSettingCategories::kErrorHandlers); - SetIsolateUpForNode(isolate, IsolateSettingCategories::kMisc); + IsolateSettings settings; + SetIsolateUpForNode(isolate, settings); } Isolate* NewIsolate(ArrayBufferAllocator* allocator, uv_loop_t* event_loop) { @@ -361,6 +381,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); @@ -370,8 +393,6 @@ Local NewContext(Isolate* isolate, return Local(); } - InitializeContextRuntime(context); - return context; } @@ -405,7 +426,7 @@ void InitializeContextRuntime(Local context) { } } -bool InitializeContext(Local context) { +bool InitializeContextForSnapshot(Local context) { Isolate* isolate = context->GetIsolate(); HandleScope handle_scope(isolate); @@ -459,6 +480,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 0e34c43ebafdf2..a649675c7cc902 100644 --- a/src/env.h +++ b/src/env.h @@ -93,12 +93,15 @@ struct PackageConfig { enum class Exists { Yes, No }; enum class IsValid { Yes, No }; enum class HasMain { Yes, No }; + enum class HasName { Yes, No }; enum PackageType : uint32_t { None = 0, CommonJS, Module }; const Exists exists; const IsValid is_valid; const HasMain has_main; const std::string main; + const HasName has_name; + const std::string name; const PackageType type; v8::Global exports; 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 424b09d6e1d22a..469e0b4f8f335a 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_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/module_wrap.cc b/src/module_wrap.cc index e7df8688cb8582..4c4a1ce863849e 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -566,6 +566,7 @@ Maybe ReadIfFile(const std::string& path) { using Exists = PackageConfig::Exists; using IsValid = PackageConfig::IsValid; using HasMain = PackageConfig::HasMain; +using HasName = PackageConfig::HasName; using PackageType = PackageConfig::PackageType; Maybe GetPackageConfig(Environment* env, @@ -588,6 +589,7 @@ Maybe GetPackageConfig(Environment* env, if (source.IsNothing()) { auto entry = env->package_json_cache.emplace(path, PackageConfig { Exists::No, IsValid::Yes, HasMain::No, "", + HasName::No, "", PackageType::None, Global() }); return Just(&entry.first->second); } @@ -608,6 +610,7 @@ Maybe GetPackageConfig(Environment* env, !pkg_json_v->ToObject(context).ToLocal(&pkg_json)) { env->package_json_cache.emplace(path, PackageConfig { Exists::Yes, IsValid::No, HasMain::No, "", + HasName::No, "", PackageType::None, Global() }); std::string msg = "Invalid JSON in " + path + " imported from " + base.ToFilePath(); @@ -627,6 +630,18 @@ Maybe GetPackageConfig(Environment* env, main_std.assign(std::string(*main_utf8, main_utf8.length())); } + Local pkg_name; + HasName has_name = HasName::No; + std::string name_std; + if (pkg_json->Get(env->context(), env->name_string()).ToLocal(&pkg_name)) { + if (pkg_name->IsString()) { + has_name = HasName::Yes; + + Utf8Value name_utf8(isolate, pkg_name); + name_std.assign(std::string(*name_utf8, name_utf8.length())); + } + } + PackageType pkg_type = PackageType::None; Local type_v; if (pkg_json->Get(env->context(), env->type_string()).ToLocal(&type_v)) { @@ -647,12 +662,14 @@ Maybe GetPackageConfig(Environment* env, auto entry = env->package_json_cache.emplace(path, PackageConfig { Exists::Yes, IsValid::Yes, has_main, main_std, + has_name, name_std, pkg_type, std::move(exports) }); return Just(&entry.first->second); } auto entry = env->package_json_cache.emplace(path, PackageConfig { Exists::Yes, IsValid::Yes, has_main, main_std, + has_name, name_std, pkg_type, Global() }); return Just(&entry.first->second); } @@ -682,6 +699,7 @@ Maybe GetPackageScopeConfig(Environment* env, } auto entry = env->package_json_cache.emplace(pjson_url.ToFilePath(), PackageConfig { Exists::No, IsValid::Yes, HasMain::No, "", + HasName::No, "", PackageType::None, Global() }); const PackageConfig* pcfg = &entry.first->second; return Just(pcfg); @@ -1107,6 +1125,62 @@ Maybe PackageExportsResolve(Environment* env, return Nothing(); } +Maybe ResolveSelf(Environment* env, + const std::string& specifier, + const URL& base) { + if (!env->options()->experimental_resolve_self) { + return Nothing(); + } + + const PackageConfig* pcfg; + if (GetPackageScopeConfig(env, base, base).To(&pcfg) && + pcfg->exists == Exists::Yes) { + // TODO(jkrems): Find a way to forward the pair/iterator already generated + // while executing GetPackageScopeConfig + URL pjson_url(""); + bool found_pjson = false; + for (auto it = env->package_json_cache.begin(); + it != env->package_json_cache.end(); + ++it) { + if (&it->second == pcfg) { + pjson_url = URL::FromFilePath(it->first); + found_pjson = true; + } + } + + if (!found_pjson) { + return Nothing(); + } + + // "If specifier starts with pcfg name" + std::string subpath; + if (specifier.rfind(pcfg->name, 0)) { + // We know now: specifier is either equal to name or longer. + if (specifier == subpath) { + subpath = ""; + } else if (specifier[pcfg->name.length()] == '/') { + // Return everything after the slash + subpath = "." + specifier.substr(pcfg->name.length() + 1); + } else { + // The specifier is neither the name of the package nor a subpath of it + return Nothing(); + } + } + + if (found_pjson && !subpath.length()) { + return PackageMainResolve(env, pjson_url, *pcfg, base); + } else if (found_pjson) { + if (!pcfg->exports.IsEmpty()) { + return PackageExportsResolve(env, pjson_url, subpath, *pcfg, base); + } else { + return FinalizeResolution(env, URL(subpath, pjson_url), base); + } + } + } + + return Nothing(); +} + Maybe PackageResolve(Environment* env, const std::string& specifier, const URL& base) { @@ -1180,6 +1254,11 @@ Maybe PackageResolve(Environment* env, // Cross-platform root check. } while (pjson_path.length() != last_path.length()); + Maybe self_url = ResolveSelf(env, specifier, base); + if (self_url.IsJust()) { + return self_url; + } + std::string msg = "Cannot find package '" + pkg_name + "' imported from " + base.ToFilePath(); node::THROW_ERR_MODULE_NOT_FOUND(env, msg.c_str()); @@ -1421,7 +1500,7 @@ void ModuleWrap::SetSyntheticExport( Local export_value = args[1]; Local module = obj->module_.Get(isolate); - module->SetSyntheticModuleExport(export_name, export_value); + USE(module->SetSyntheticModuleExport(isolate, export_name, export_value)); } void ModuleWrap::Initialize(Local target, diff --git a/src/node.cc b/src/node.cc index 935be9343f0025..f437ea4be96450 100644 --- a/src/node.cc +++ b/src/node.cc @@ -265,6 +265,8 @@ int Environment::InitializeInspector( void Environment::InitializeDiagnostics() { isolate_->GetHeapProfiler()->AddBuildEmbedderGraphCallback( Environment::BuildEmbedderGraph, this); + if (options_->trace_uncaught) + isolate_->SetCaptureStackTraceForUncaughtExceptions(true); #if defined HAVE_DTRACE || defined HAVE_ETW InitDTrace(this); diff --git a/src/node.h b/src/node.h index cae0673a37f80e..872e0a811a608b 100644 --- a/src/node.h +++ b/src/node.h @@ -273,10 +273,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`, 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. @@ -291,9 +292,40 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { NODE_EXTERN void SetIsolateCreateParams(v8::Isolate::CreateParams* params, ArrayBufferAllocator* allocator = nullptr); + +enum IsolateSettingsFlags { + MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0, + DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1 +}; + +struct IsolateSettings { + uint64_t flags = MESSAGE_LISTENER_WITH_ERROR_LEVEL | + DETAILED_SOURCE_POSITIONS_FOR_PROFILING; + v8::MicrotasksPolicy policy = v8::MicrotasksPolicy::kExplicit; + + // Error handling callbacks + v8::Isolate::AbortOnUncaughtExceptionCallback + should_abort_on_uncaught_exception_callback = nullptr; + v8::FatalErrorCallback fatal_error_callback = nullptr; + v8::PrepareStackTraceCallback prepare_stack_trace_callback = nullptr; + + // Miscellaneous callbacks + v8::PromiseRejectCallback promise_reject_callback = nullptr; + v8::AllowWasmCodeGenerationCallback + allow_wasm_code_generation_callback = nullptr; + v8::HostCleanupFinalizationGroupCallback + host_cleanup_finalization_group_callback = nullptr; +}; + +// Overriding IsolateSettings may produce unexpected behavior +// in Node.js core functionality, so proceed at your own risk. +NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate, + const IsolateSettings& settings); + // Set a number of callbacks for the `isolate`, in particular the Node.js // uncaught exception listener. NODE_EXTERN void SetIsolateUpForNode(v8::Isolate* isolate); + // Creates a new isolate with Node.js-specific settings. // This is a convenience method equivalent to using SetIsolateCreateParams(), // Isolate::Allocate(), MultiIsolatePlatform::RegisterIsolate(), diff --git a/src/node_crypto.cc b/src/node_crypto.cc index d2563c0fb5326b..20cc52fbff7910 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); @@ -4720,7 +4720,16 @@ void Hash::Initialize(Environment* env, Local target) { void Hash::New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - const node::Utf8Value hash_type(env->isolate(), args[0]); + const Hash* orig = nullptr; + const EVP_MD* md = nullptr; + + if (args[0]->IsObject()) { + ASSIGN_OR_RETURN_UNWRAP(&orig, args[0].As()); + md = EVP_MD_CTX_md(orig->mdctx_.get()); + } else { + const node::Utf8Value hash_type(env->isolate(), args[0]); + md = EVP_get_digestbyname(*hash_type); + } Maybe xof_md_len = Nothing(); if (!args[1]->IsUndefined()) { @@ -4729,17 +4738,19 @@ void Hash::New(const FunctionCallbackInfo& args) { } Hash* hash = new Hash(env, args.This()); - if (!hash->HashInit(*hash_type, xof_md_len)) { + if (md == nullptr || !hash->HashInit(md, xof_md_len)) { return ThrowCryptoError(env, ERR_get_error(), "Digest method not supported"); } + + if (orig != nullptr && + 0 >= EVP_MD_CTX_copy(hash->mdctx_.get(), orig->mdctx_.get())) { + return ThrowCryptoError(env, ERR_get_error(), "Digest copy error"); + } } -bool Hash::HashInit(const char* hash_type, Maybe xof_md_len) { - const EVP_MD* md = EVP_get_digestbyname(hash_type); - if (md == nullptr) - return false; +bool Hash::HashInit(const EVP_MD* md, Maybe xof_md_len) { mdctx_.reset(EVP_MD_CTX_new()); if (!mdctx_ || EVP_DigestInit_ex(mdctx_.get(), md, nullptr) <= 0) { mdctx_.reset(); diff --git a/src/node_crypto.h b/src/node_crypto.h index 206a19119a7321..777ba5d302a536 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -591,7 +591,7 @@ class Hash : public BaseObject { SET_MEMORY_INFO_NAME(Hash) SET_SELF_SIZE(Hash) - bool HashInit(const char* hash_type, v8::Maybe xof_md_len); + bool HashInit(const EVP_MD* md, v8::Maybe xof_md_len); bool HashUpdate(const char* data, int len); protected: 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 382f00f56e627c..ffef27f4521403 100644 --- a/src/node_dir.cc +++ b/src/node_dir.cc @@ -36,6 +36,7 @@ using v8::Isolate; using v8::Local; using v8::MaybeLocal; using v8::Null; +using v8::Number; using v8::Object; using v8::ObjectTemplate; using v8::String; @@ -59,8 +60,8 @@ DirHandle::DirHandle(Environment* env, Local obj, uv_dir_t* dir) dir_(dir) { MakeWeak(); - dir_->nentries = arraysize(dirents_); - dir_->dirents = dirents_; + dir_->nentries = 0; + dir_->dirents = nullptr; } DirHandle* DirHandle::New(Environment* env, uv_dir_t* dir) { @@ -230,22 +231,31 @@ void DirHandle::Read(const FunctionCallbackInfo& args) { Isolate* isolate = env->isolate(); const int argc = args.Length(); - CHECK_GE(argc, 2); + CHECK_GE(argc, 3); const enum encoding encoding = ParseEncoding(isolate, args[0], UTF8); DirHandle* dir; ASSIGN_OR_RETURN_UNWRAP(&dir, args.Holder()); - FSReqBase* req_wrap_async = GetReqWrap(env, args[1]); - if (req_wrap_async != nullptr) { // dir.read(encoding, req) + CHECK(args[1]->IsNumber()); + uint64_t buffer_size = args[1].As()->Value(); + + if (buffer_size != dir->dirents_.size()) { + dir->dirents_.resize(buffer_size); + dir->dir_->nentries = buffer_size; + dir->dir_->dirents = dir->dirents_.data(); + } + + FSReqBase* req_wrap_async = GetReqWrap(env, args[2]); + if (req_wrap_async != nullptr) { // dir.read(encoding, bufferSize, req) AsyncCall(env, req_wrap_async, args, "readdir", encoding, AfterDirRead, uv_fs_readdir, dir->dir()); - } else { // dir.read(encoding, undefined, ctx) - CHECK_EQ(argc, 3); + } else { // dir.read(encoding, bufferSize, undefined, ctx) + CHECK_EQ(argc, 4); FSReqWrapSync req_wrap_sync; FS_DIR_SYNC_TRACE_BEGIN(readdir); - int err = SyncCall(env, args[2], &req_wrap_sync, "readdir", uv_fs_readdir, + int err = SyncCall(env, args[3], &req_wrap_sync, "readdir", uv_fs_readdir, dir->dir()); FS_DIR_SYNC_TRACE_END(readdir); if (err < 0) { diff --git a/src/node_dir.h b/src/node_dir.h index 03e4a06efcecbe..ae6d0eb170d679 100644 --- a/src/node_dir.h +++ b/src/node_dir.h @@ -45,8 +45,8 @@ class DirHandle : public AsyncWrap { void GCClose(); uv_dir_t* dir_; - // Up to 32 directory entries are read through a single libuv call. - uv_dirent_t dirents_[32]; + // Multiple entries are read through a single libuv call. + std::vector dirents_; 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_errors.cc b/src/node_errors.cc index d3a409b1ab455a..ec14746514e420 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -380,6 +380,19 @@ static void ReportFatalException(Environment* env, "%s\n%s: %s\n", *arrow_string, *name_string, *message_string); } } + + if (!env->options()->trace_uncaught) { + PrintErrorString("(Use `node --trace-uncaught ...` to show " + "where the exception was thrown)\n"); + } + } + + if (env->options()->trace_uncaught) { + Local trace = message->GetStackTrace(); + if (!trace.IsEmpty()) { + PrintErrorString("Thrown at:\n"); + PrintStackTrace(env->isolate(), trace); + } } fflush(stderr); diff --git a/src/node_internals.h b/src/node_internals.h index 0f4c32bb941a31..4ec883c8913e45 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -296,8 +296,8 @@ struct InitializationResult { }; InitializationResult InitializeOncePerProcess(int argc, char** argv); void TearDownOncePerProcess(); -enum class IsolateSettingCategories { kErrorHandlers, kMisc }; -void SetIsolateUpForNode(v8::Isolate* isolate, IsolateSettingCategories cat); +void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s); +void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s); void SetIsolateCreateParamsForNode(v8::Isolate::CreateParams* params); #if HAVE_INSPECTOR diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index 0744063e0dc3a9..1c1a09280b70d8 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -30,7 +30,9 @@ NodeMainInstance::NodeMainInstance(Isolate* isolate, owns_isolate_(false), deserialize_mode_(false) { isolate_data_.reset(new IsolateData(isolate_, event_loop, platform, nullptr)); - SetIsolateUpForNode(isolate_, IsolateSettingCategories::kMisc); + + IsolateSettings misc; + SetIsolateMiscHandlers(isolate_, misc); } std::unique_ptr NodeMainInstance::Create( @@ -74,11 +76,12 @@ NodeMainInstance::NodeMainInstance( platform, array_buffer_allocator_.get(), per_isolate_data_indexes)); - SetIsolateUpForNode(isolate_, IsolateSettingCategories::kMisc); + IsolateSettings s; + SetIsolateMiscHandlers(isolate_, s); if (!deserialize_mode_) { // If in deserialize mode, delay until after the deserialization is // complete. - SetIsolateUpForNode(isolate_, IsolateSettingCategories::kErrorHandlers); + SetIsolateErrorHandlers(isolate_, s); } } @@ -182,7 +185,8 @@ std::unique_ptr NodeMainInstance::CreateMainEnvironment( context = Context::FromSnapshot(isolate_, kNodeContextIndex).ToLocalChecked(); InitializeContextRuntime(context); - SetIsolateUpForNode(isolate_, IsolateSettingCategories::kErrorHandlers); + IsolateSettings s; + SetIsolateErrorHandlers(isolate_, s); } else { context = NewContext(isolate_); } diff --git a/src/node_options.cc b/src/node_options.cc index 23fa3c0f54c17e..695d7cee6541cc 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 @@ -331,6 +331,10 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "experimental ES Module support and caching modules", &EnvironmentOptions::experimental_modules, kAllowedInEnvironment); + AddOption("--experimental-resolve-self", + "experimental support for require/import of the current package", + &EnvironmentOptions::experimental_resolve_self, + kAllowedInEnvironment); AddOption("--experimental-wasm-modules", "experimental ES Module support for webassembly modules", &EnvironmentOptions::experimental_wasm_modules, @@ -476,6 +480,10 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "prints TLS packet trace information to stderr", &EnvironmentOptions::trace_tls, kAllowedInEnvironment); + AddOption("--trace-uncaught", + "show stack traces for the `throw` behind uncaught exceptions", + &EnvironmentOptions::trace_uncaught, + kAllowedInEnvironment); AddOption("--trace-warnings", "show stack traces on process warnings", &EnvironmentOptions::trace_warnings, @@ -581,6 +589,10 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( V8Option{}, kAllowedInEnvironment); AddOption("--stack-trace-limit", "", V8Option{}, kAllowedInEnvironment); + AddOption("--disallow-code-generation-from-strings", + "disallow eval and friends", + V8Option{}, + kAllowedInEnvironment); #ifdef NODE_REPORT AddOption("--report-uncaught-exception", diff --git a/src/node_options.h b/src/node_options.h index f9d2581deb5b5f..a4af15e3e00c31 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -103,6 +103,7 @@ class EnvironmentOptions : public Options { bool enable_source_maps = false; bool experimental_json_modules = false; bool experimental_modules = false; + bool experimental_resolve_self = false; std::string es_module_specifier_resolution; bool experimental_wasm_modules = false; std::string module_type; @@ -140,6 +141,7 @@ class EnvironmentOptions : public Options { bool trace_deprecation = false; bool trace_sync_io = false; bool trace_tls = false; + bool trace_uncaught = false; bool trace_warnings = false; std::string unhandled_rejections; std::string userland_loader; 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_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_version.h b/src/node_version.h index 1989afcf485501..7331023933e5ac 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -23,13 +23,13 @@ #define SRC_NODE_VERSION_H_ #define NODE_MAJOR_VERSION 13 -#define NODE_MINOR_VERSION 0 -#define NODE_PATCH_VERSION 2 +#define NODE_MINOR_VERSION 1 +#define NODE_PATCH_VERSION 0 #define NODE_VERSION_IS_LTS 0 #define NODE_VERSION_LTS_CODENAME "" -#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 025b5fed49cbb5..af79540631f153 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -155,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) 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.cc b/src/udp_wrap.cc index 64c4c8b304fc5f..4a66ce0a1f1018 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -128,6 +128,10 @@ void UDPWrap::Initialize(Local target, GetSockOrPeerName); env->SetProtoMethod(t, "addMembership", AddMembership); env->SetProtoMethod(t, "dropMembership", DropMembership); + env->SetProtoMethod(t, "addSourceSpecificMembership", + AddSourceSpecificMembership); + env->SetProtoMethod(t, "dropSourceSpecificMembership", + DropSourceSpecificMembership); env->SetProtoMethod(t, "setMulticastInterface", SetMulticastInterface); env->SetProtoMethod(t, "setMulticastTTL", SetMulticastTTL); env->SetProtoMethod(t, "setMulticastLoopback", SetMulticastLoopback); @@ -397,6 +401,44 @@ void UDPWrap::DropMembership(const FunctionCallbackInfo& args) { SetMembership(args, UV_LEAVE_GROUP); } +void UDPWrap::SetSourceMembership(const FunctionCallbackInfo& args, + uv_membership membership) { + UDPWrap* wrap; + ASSIGN_OR_RETURN_UNWRAP(&wrap, + args.Holder(), + args.GetReturnValue().Set(UV_EBADF)); + + CHECK_EQ(args.Length(), 3); + + node::Utf8Value source_address(args.GetIsolate(), args[0]); + node::Utf8Value group_address(args.GetIsolate(), args[1]); + node::Utf8Value iface(args.GetIsolate(), args[2]); + + if (*iface == nullptr) return; + const char* iface_cstr = *iface; + if (args[2]->IsUndefined() || args[2]->IsNull()) { + iface_cstr = nullptr; + } + + int err = uv_udp_set_source_membership(&wrap->handle_, + *group_address, + iface_cstr, + *source_address, + membership); + args.GetReturnValue().Set(err); +} + +void UDPWrap::AddSourceSpecificMembership( + const FunctionCallbackInfo& args) { + SetSourceMembership(args, UV_JOIN_GROUP); +} + + +void UDPWrap::DropSourceSpecificMembership( + const FunctionCallbackInfo& args) { + SetSourceMembership(args, UV_LEAVE_GROUP); +} + void UDPWrap::DoSend(const FunctionCallbackInfo& args, int family) { Environment* env = Environment::GetCurrent(args); diff --git a/src/udp_wrap.h b/src/udp_wrap.h index fb2a9362cdf2bc..6375ac2d1b8c80 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 { @@ -55,6 +56,10 @@ class UDPWrap: public HandleWrap { static void RecvStop(const v8::FunctionCallbackInfo& args); static void AddMembership(const v8::FunctionCallbackInfo& args); static void DropMembership(const v8::FunctionCallbackInfo& args); + static void AddSourceSpecificMembership( + const v8::FunctionCallbackInfo& args); + static void DropSourceSpecificMembership( + const v8::FunctionCallbackInfo& args); static void SetMulticastInterface( const v8::FunctionCallbackInfo& args); static void SetMulticastTTL(const v8::FunctionCallbackInfo& args); @@ -88,6 +93,9 @@ class UDPWrap: public HandleWrap { int family); static void SetMembership(const v8::FunctionCallbackInfo& args, uv_membership membership); + static void SetSourceMembership( + const v8::FunctionCallbackInfo& args, + uv_membership membership); static void OnAlloc(uv_handle_t* handle, size_t suggested_size, 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 3168e6f0a0ce1f..cf382407235304 100644 --- a/test/benchmark/test-benchmark-fs.js +++ b/test/benchmark/test-benchmark-fs.js @@ -7,6 +7,7 @@ const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); runBenchmark('fs', [ + 'bufferSize=32', 'concurrent=1', 'dir=.github', 'dur=0.1', diff --git a/test/es-module/test-esm-exports.mjs b/test/es-module/test-esm-exports.mjs index 5059a2d4189cee..d8c33994188138 100644 --- a/test/es-module/test-esm-exports.mjs +++ b/test/es-module/test-esm-exports.mjs @@ -1,9 +1,10 @@ -// Flags: --experimental-modules +// Flags: --experimental-modules --experimental-resolve-self import { mustCall } from '../common/index.mjs'; import { ok, deepStrictEqual, strictEqual } from 'assert'; import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs'; +import fromInside from '../fixtures/node_modules/pkgexports/lib/hole.js'; [requireFixture, importFixture].forEach((loadFixture) => { const isRequire = loadFixture === requireFixture; @@ -99,6 +100,24 @@ import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs'; })); }); +const { requireFromInside, importFromInside } = fromInside; +[importFromInside, requireFromInside].forEach((loadFromInside) => { + const validSpecifiers = new Map([ + // A file not visible from outside of the package + ['../not-exported.js', { default: 'not-exported' }], + // Part of the public interface + ['@pkgexports/name/valid-cjs', { default: 'asdf' }], + ]); + for (const [validSpecifier, expected] of validSpecifiers) { + if (validSpecifier === null) continue; + + loadFromInside(validSpecifier) + .then(mustCall((actual) => { + deepStrictEqual({ ...actual }, expected); + })); + } +}); + function assertStartsWith(actual, expected) { const start = actual.toString().substr(0, expected.length); strictEqual(start, expected); diff --git a/test/fixtures/node_modules/pkgexports/lib/hole.js b/test/fixtures/node_modules/pkgexports/lib/hole.js new file mode 100644 index 00000000000000..124b0932ad6761 --- /dev/null +++ b/test/fixtures/node_modules/pkgexports/lib/hole.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = { + async importFromInside(specifier) { + return import(specifier); + }, + async requireFromInside(specifier) { + return { default: require(specifier) }; + }, +}; diff --git a/test/fixtures/node_modules/pkgexports/not-exported.js b/test/fixtures/node_modules/pkgexports/not-exported.js new file mode 100644 index 00000000000000..02e146dbe90985 --- /dev/null +++ b/test/fixtures/node_modules/pkgexports/not-exported.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = 'not-exported'; diff --git a/test/fixtures/node_modules/pkgexports/package.json b/test/fixtures/node_modules/pkgexports/package.json index 2b190521e5f987..38e2fc1a5c02f6 100644 --- a/test/fixtures/node_modules/pkgexports/package.json +++ b/test/fixtures/node_modules/pkgexports/package.json @@ -1,6 +1,8 @@ { + "name": "@pkgexports/name", "exports": { ".": "./asdf.js", + "./hole": "./lib/hole.js", "./space": "./sp%20ce.js", "./valid-cjs": "./asdf.js", "./sub/": "./", diff --git a/test/internet/test-dgram-multicast-ssm-multi-process.js b/test/internet/test-dgram-multicast-ssm-multi-process.js new file mode 100644 index 00000000000000..1771a4204c137b --- /dev/null +++ b/test/internet/test-dgram-multicast-ssm-multi-process.js @@ -0,0 +1,229 @@ +'use strict'; +const common = require('../common'); +// Skip test in FreeBSD jails. +if (common.inFreeBSDJail) + common.skip('In a FreeBSD jail'); + +const assert = require('assert'); +const dgram = require('dgram'); +const fork = require('child_process').fork; +const networkInterfaces = require('os').networkInterfaces(); +const GROUP_ADDRESS = '232.1.1.1'; +const TIMEOUT = common.platformTimeout(5000); +const messages = [ + Buffer.from('First message to send'), + Buffer.from('Second message to send'), + Buffer.from('Third message to send'), + Buffer.from('Fourth message to send') +]; +const workers = {}; +const listeners = 3; +let listening, sendSocket, done, timer, dead; + +let sourceAddress = null; + +// Take the first non-internal interface as the IPv4 address for binding. +// Ideally, this should favor internal/private interfaces. +get_sourceAddress: for (const name in networkInterfaces) { + const interfaces = networkInterfaces[name]; + for (let i = 0; i < interfaces.length; i++) { + const localInterface = interfaces[i]; + if (!localInterface.internal && localInterface.family === 'IPv4') { + sourceAddress = localInterface.address; + break get_sourceAddress; + } + } +} +assert.ok(sourceAddress); + +function launchChildProcess() { + const worker = fork(__filename, ['child']); + workers[worker.pid] = worker; + + worker.messagesReceived = []; + + // Handle the death of workers. + worker.on('exit', function(code) { + // Don't consider this the true death if the worker has finished + // successfully or if the exit code is 0. + if (worker.isDone || code === 0) { + return; + } + + dead += 1; + console.error('[PARENT] Worker %d died. %d dead of %d', + worker.pid, + dead, + listeners); + + if (dead === listeners) { + console.error('[PARENT] All workers have died.'); + console.error('[PARENT] Fail'); + assert.fail(); + } + }); + + worker.on('message', function(msg) { + if (msg.listening) { + listening += 1; + + if (listening === listeners) { + // All child process are listening, so start sending. + sendSocket.sendNext(); + } + return; + } + if (msg.message) { + worker.messagesReceived.push(msg.message); + + if (worker.messagesReceived.length === messages.length) { + done += 1; + worker.isDone = true; + console.error('[PARENT] %d received %d messages total.', + worker.pid, + worker.messagesReceived.length); + } + + if (done === listeners) { + console.error('[PARENT] All workers have received the ' + + 'required number of messages. Will now compare.'); + + Object.keys(workers).forEach(function(pid) { + const worker = workers[pid]; + + let count = 0; + + worker.messagesReceived.forEach(function(buf) { + for (let i = 0; i < messages.length; ++i) { + if (buf.toString() === messages[i].toString()) { + count++; + break; + } + } + }); + + console.error('[PARENT] %d received %d matching messages.', + worker.pid, count); + + assert.strictEqual(count, messages.length); + }); + + clearTimeout(timer); + console.error('[PARENT] Success'); + killChildren(workers); + } + } + }); +} + +function killChildren(children) { + Object.keys(children).forEach(function(key) { + const child = children[key]; + child.kill(); + }); +} + +if (process.argv[2] !== 'child') { + listening = 0; + dead = 0; + let i = 0; + done = 0; + + // Exit the test if it doesn't succeed within TIMEOUT. + timer = setTimeout(function() { + console.error('[PARENT] Responses were not received within %d ms.', + TIMEOUT); + console.error('[PARENT] Fail'); + + killChildren(workers); + + assert.fail(); + }, TIMEOUT); + + // Launch child processes. + for (let x = 0; x < listeners; x++) { + launchChildProcess(x); + } + + sendSocket = dgram.createSocket('udp4'); + + // The socket is actually created async now. + sendSocket.on('listening', function() { + sendSocket.setTTL(1); + sendSocket.setBroadcast(true); + sendSocket.setMulticastTTL(1); + sendSocket.setMulticastLoopback(true); + sendSocket.addSourceSpecificMembership(sourceAddress, GROUP_ADDRESS); + }); + + sendSocket.on('close', function() { + console.error('[PARENT] sendSocket closed'); + }); + + sendSocket.sendNext = function() { + const buf = messages[i++]; + + if (!buf) { + try { sendSocket.close(); } catch {} + return; + } + + sendSocket.send( + buf, + 0, + buf.length, + common.PORT, + GROUP_ADDRESS, + function(err) { + assert.ifError(err); + console.error('[PARENT] sent "%s" to %s:%s', + buf.toString(), + GROUP_ADDRESS, common.PORT); + process.nextTick(sendSocket.sendNext); + } + ); + }; +} + +if (process.argv[2] === 'child') { + const receivedMessages = []; + const listenSocket = dgram.createSocket({ + type: 'udp4', + reuseAddr: true + }); + + listenSocket.on('listening', function() { + listenSocket.setMulticastLoopback(true); + listenSocket.addSourceSpecificMembership(sourceAddress, GROUP_ADDRESS); + + listenSocket.on('message', function(buf, rinfo) { + console.error('[CHILD] %s received "%s" from %j', process.pid, + buf.toString(), rinfo); + + receivedMessages.push(buf); + + process.send({ message: buf.toString() }); + + if (receivedMessages.length === messages.length) { + // .dropSourceSpecificMembership() not strictly needed, + // it is here as a sanity check. + listenSocket.dropSourceSpecificMembership(sourceAddress, GROUP_ADDRESS); + process.nextTick(function() { + listenSocket.close(); + }); + } + }); + + listenSocket.on('close', function() { + // HACK: Wait to exit the process to ensure that the parent + // process has had time to receive all messages via process.send() + // This may be indicative of some other issue. + setTimeout(function() { + process.exit(); + }, common.platformTimeout(1000)); + }); + process.send({ listening: true }); + }); + + listenSocket.bind(common.PORT); +} diff --git a/test/internet/test-dgram-multicast-ssmv6-multi-process.js b/test/internet/test-dgram-multicast-ssmv6-multi-process.js new file mode 100644 index 00000000000000..88bb563364bfe3 --- /dev/null +++ b/test/internet/test-dgram-multicast-ssmv6-multi-process.js @@ -0,0 +1,229 @@ +'use strict'; +const common = require('../common'); +// Skip test in FreeBSD jails. +if (common.inFreeBSDJail) + common.skip('In a FreeBSD jail'); + +const assert = require('assert'); +const dgram = require('dgram'); +const fork = require('child_process').fork; +const networkInterfaces = require('os').networkInterfaces(); +const GROUP_ADDRESS = 'ff3e::1234'; +const TIMEOUT = common.platformTimeout(5000); +const messages = [ + Buffer.from('First message to send'), + Buffer.from('Second message to send'), + Buffer.from('Third message to send'), + Buffer.from('Fourth message to send') +]; +const workers = {}; +const listeners = 3; +let listening, sendSocket, done, timer, dead; + +let sourceAddress = null; + +// Take the first non-internal interface as the IPv6 address for binding. +// Ideally, this should check favor internal/private interfaces. +get_sourceAddress: for (const name in networkInterfaces) { + const interfaces = networkInterfaces[name]; + for (let i = 0; i < interfaces.length; i++) { + const localInterface = interfaces[i]; + if (!localInterface.internal && localInterface.family === 'IPv6') { + sourceAddress = localInterface.address; + break get_sourceAddress; + } + } +} +assert.ok(sourceAddress); + +function launchChildProcess() { + const worker = fork(__filename, ['child']); + workers[worker.pid] = worker; + + worker.messagesReceived = []; + + // Handle the death of workers. + worker.on('exit', function(code) { + // Don't consider this the true death if the worker has finished + // successfully or if the exit code is 0. + if (worker.isDone || code === 0) { + return; + } + + dead += 1; + console.error('[PARENT] Worker %d died. %d dead of %d', + worker.pid, + dead, + listeners); + + if (dead === listeners) { + console.error('[PARENT] All workers have died.'); + console.error('[PARENT] Fail'); + assert.fail(); + } + }); + + worker.on('message', function(msg) { + if (msg.listening) { + listening += 1; + + if (listening === listeners) { + // All child process are listening, so start sending. + sendSocket.sendNext(); + } + return; + } + if (msg.message) { + worker.messagesReceived.push(msg.message); + + if (worker.messagesReceived.length === messages.length) { + done += 1; + worker.isDone = true; + console.error('[PARENT] %d received %d messages total.', + worker.pid, + worker.messagesReceived.length); + } + + if (done === listeners) { + console.error('[PARENT] All workers have received the ' + + 'required number of messages. Will now compare.'); + + Object.keys(workers).forEach(function(pid) { + const worker = workers[pid]; + + let count = 0; + + worker.messagesReceived.forEach(function(buf) { + for (let i = 0; i < messages.length; ++i) { + if (buf.toString() === messages[i].toString()) { + count++; + break; + } + } + }); + + console.error('[PARENT] %d received %d matching messages.', + worker.pid, count); + + assert.strictEqual(count, messages.length); + }); + + clearTimeout(timer); + console.error('[PARENT] Success'); + killChildren(workers); + } + } + }); +} + +function killChildren(children) { + Object.keys(children).forEach(function(key) { + const child = children[key]; + child.kill(); + }); +} + +if (process.argv[2] !== 'child') { + listening = 0; + dead = 0; + let i = 0; + done = 0; + + // Exit the test if it doesn't succeed within TIMEOUT. + timer = setTimeout(function() { + console.error('[PARENT] Responses were not received within %d ms.', + TIMEOUT); + console.error('[PARENT] Fail'); + + killChildren(workers); + + assert.fail(); + }, TIMEOUT); + + // Launch child processes. + for (let x = 0; x < listeners; x++) { + launchChildProcess(x); + } + + sendSocket = dgram.createSocket('udp6'); + + // The socket is actually created async now. + sendSocket.on('listening', function() { + sendSocket.setTTL(1); + sendSocket.setBroadcast(true); + sendSocket.setMulticastTTL(1); + sendSocket.setMulticastLoopback(true); + sendSocket.addSourceSpecificMembership(sourceAddress, GROUP_ADDRESS); + }); + + sendSocket.on('close', function() { + console.error('[PARENT] sendSocket closed'); + }); + + sendSocket.sendNext = function() { + const buf = messages[i++]; + + if (!buf) { + try { sendSocket.close(); } catch {} + return; + } + + sendSocket.send( + buf, + 0, + buf.length, + common.PORT, + GROUP_ADDRESS, + function(err) { + assert.ifError(err); + console.error('[PARENT] sent "%s" to %s:%s', + buf.toString(), + GROUP_ADDRESS, common.PORT); + process.nextTick(sendSocket.sendNext); + } + ); + }; +} + +if (process.argv[2] === 'child') { + const receivedMessages = []; + const listenSocket = dgram.createSocket({ + type: 'udp6', + reuseAddr: true + }); + + listenSocket.on('listening', function() { + listenSocket.setMulticastLoopback(true); + listenSocket.addSourceSpecificMembership(sourceAddress, GROUP_ADDRESS); + + listenSocket.on('message', function(buf, rinfo) { + console.error('[CHILD] %s received "%s" from %j', process.pid, + buf.toString(), rinfo); + + receivedMessages.push(buf); + + process.send({ message: buf.toString() }); + + if (receivedMessages.length === messages.length) { + // .dropSourceSpecificMembership() not strictly needed, + // it is here as a sanity check. + listenSocket.dropSourceSpecificMembership(sourceAddress, GROUP_ADDRESS); + process.nextTick(function() { + listenSocket.close(); + }); + } + }); + + listenSocket.on('close', function() { + // HACK: Wait to exit the process to ensure that the parent + // process has had time to receive all messages via process.send() + // This may be indicative of some other issue. + setTimeout(function() { + process.exit(); + }, common.platformTimeout(1000)); + }); + process.send({ listening: true }); + }); + + listenSocket.bind(common.PORT); +} 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/message/eval_messages.out b/test/message/eval_messages.out index 0d2e68f3d79b04..8840633959a18b 100644 --- a/test/message/eval_messages.out +++ b/test/message/eval_messages.out @@ -55,9 +55,11 @@ ReferenceError: y is not defined var ______________________________________________; throw 10 ^ 10 +(Use `node --trace-uncaught ...` to show where the exception was thrown) [eval]:1 var ______________________________________________; throw 10 ^ 10 +(Use `node --trace-uncaught ...` to show where the exception was thrown) done diff --git a/test/message/stdin_messages.out b/test/message/stdin_messages.out index d048a0d947d7d2..58bbe110297f8c 100644 --- a/test/message/stdin_messages.out +++ b/test/message/stdin_messages.out @@ -67,9 +67,11 @@ ReferenceError: y is not defined var ______________________________________________; throw 10 ^ 10 +(Use `node --trace-uncaught ...` to show where the exception was thrown) [stdin]:1 var ______________________________________________; throw 10 ^ 10 +(Use `node --trace-uncaught ...` to show where the exception was thrown) done diff --git a/test/message/throw_error_with_getter_throw.out b/test/message/throw_error_with_getter_throw.out index 62d546d0bce862..5daf35aad44ce3 100644 --- a/test/message/throw_error_with_getter_throw.out +++ b/test/message/throw_error_with_getter_throw.out @@ -3,3 +3,4 @@ throw { // eslint-disable-line no-throw-literal ^ [object Object] +(Use `node --trace-uncaught ...` to show where the exception was thrown) diff --git a/test/message/throw_error_with_getter_throw_traced.js b/test/message/throw_error_with_getter_throw_traced.js new file mode 100644 index 00000000000000..609bd9caf83fe2 --- /dev/null +++ b/test/message/throw_error_with_getter_throw_traced.js @@ -0,0 +1,11 @@ +// Flags: --trace-uncaught +'use strict'; +require('../common'); +throw { // eslint-disable-line no-throw-literal + get stack() { + throw new Error('weird throw but ok'); + }, + get name() { + throw new Error('weird throw but ok'); + }, +}; diff --git a/test/message/throw_error_with_getter_throw_traced.out b/test/message/throw_error_with_getter_throw_traced.out new file mode 100644 index 00000000000000..5ea6aa8e269662 --- /dev/null +++ b/test/message/throw_error_with_getter_throw_traced.out @@ -0,0 +1,12 @@ + +*:4 +throw { // eslint-disable-line no-throw-literal +^ +[object Object] +Thrown at: + at *throw_error_with_getter_throw_traced.js:*:* + at Module._compile (internal/modules/cjs/loader.js:*:*) + at Module._extensions..js (internal/modules/cjs/loader.js:*:*) + at Module.load (internal/modules/cjs/loader.js:*:*) + at Module._load (internal/modules/cjs/loader.js:*:*) + at Module.runMain (internal/modules/cjs/loader.js:*:*) diff --git a/test/message/throw_null.out b/test/message/throw_null.out index c013c24d24d707..db6cc3edf583ef 100644 --- a/test/message/throw_null.out +++ b/test/message/throw_null.out @@ -3,3 +3,4 @@ throw null; ^ null +(Use `node --trace-uncaught ...` to show where the exception was thrown) diff --git a/test/message/throw_null_traced.js b/test/message/throw_null_traced.js new file mode 100644 index 00000000000000..fee8928f887403 --- /dev/null +++ b/test/message/throw_null_traced.js @@ -0,0 +1,6 @@ +// Flags: --trace-uncaught +'use strict'; +require('../common'); + +// eslint-disable-next-line no-throw-literal +throw null; diff --git a/test/message/throw_null_traced.out b/test/message/throw_null_traced.out new file mode 100644 index 00000000000000..44bc34dcbd7434 --- /dev/null +++ b/test/message/throw_null_traced.out @@ -0,0 +1,12 @@ + +*test*message*throw_null_traced.js:* +throw null; +^ +null +Thrown at: + at *throw_null_traced.js:*:* + at Module._compile (internal/modules/cjs/loader.js:*:*) + at Module._extensions..js (internal/modules/cjs/loader.js:*:*) + at Module.load (internal/modules/cjs/loader.js:*:*) + at Module._load (internal/modules/cjs/loader.js:*:*) + at Module.runMain (internal/modules/cjs/loader.js:*:*) diff --git a/test/message/throw_undefined.out b/test/message/throw_undefined.out index 5c633caa2ec69d..016eb8ffd95e33 100644 --- a/test/message/throw_undefined.out +++ b/test/message/throw_undefined.out @@ -3,3 +3,4 @@ throw undefined; ^ undefined +(Use `node --trace-uncaught ...` to show where the exception was thrown) diff --git a/test/message/throw_undefined_traced.js b/test/message/throw_undefined_traced.js new file mode 100644 index 00000000000000..f6ded43378dc91 --- /dev/null +++ b/test/message/throw_undefined_traced.js @@ -0,0 +1,6 @@ +// Flags: --trace-uncaught +'use strict'; +require('../common'); + +// eslint-disable-next-line no-throw-literal +throw undefined; diff --git a/test/message/throw_undefined_traced.out b/test/message/throw_undefined_traced.out new file mode 100644 index 00000000000000..070e9a1ec1c104 --- /dev/null +++ b/test/message/throw_undefined_traced.out @@ -0,0 +1,12 @@ + +*test*message*throw_undefined_traced.js:* +throw undefined; +^ +undefined +Thrown at: + at *throw_undefined_traced.js:*:* + at Module._compile (internal/modules/cjs/loader.js:*:*) + at Module._extensions..js (internal/modules/cjs/loader.js:*:*) + at Module.load (internal/modules/cjs/loader.js:*:*) + at Module._load (internal/modules/cjs/loader.js:*:*) + at Module.runMain (internal/modules/cjs/loader.js:*:*) diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 7e42139470e964..698f463b627644 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -60,6 +60,7 @@ if (common.hasCrypto) { // V8 options expect('--abort_on-uncaught_exception', 'B\n'); +expect('--disallow-code-generation-from-strings', 'B\n'); expect('--max-old-space-size=0', 'B\n'); expect('--stack-trace-limit=100', /(\s*at f \(\[eval\]:1:\d*\)\r?\n){100}/, diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 7f752f898a2898..a0c3ffeb20ca9a 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -192,14 +192,27 @@ common.expectsError( assert.strictEqual(crypto.createHash('shake256').digest('hex'), '46b9dd2b0ba88d13233b3feb743eeb24' + '3fcd52ea62b81b82b50c27646ed5762f'); + assert.strictEqual(crypto.createHash('shake256', { outputLength: 0 }) + .copy() // Default outputLength. + .digest('hex'), + '46b9dd2b0ba88d13233b3feb743eeb24' + + '3fcd52ea62b81b82b50c27646ed5762f'); // Short outputLengths. assert.strictEqual(crypto.createHash('shake128', { outputLength: 0 }) .digest('hex'), ''); + assert.strictEqual(crypto.createHash('shake128', { outputLength: 5 }) + .copy({ outputLength: 0 }) + .digest('hex'), + ''); assert.strictEqual(crypto.createHash('shake128', { outputLength: 5 }) .digest('hex'), '7f9c2ba4e8'); + assert.strictEqual(crypto.createHash('shake128', { outputLength: 0 }) + .copy({ outputLength: 5 }) + .digest('hex'), + '7f9c2ba4e8'); assert.strictEqual(crypto.createHash('shake128', { outputLength: 15 }) .digest('hex'), '7f9c2ba4e88f827d61604550760585'); @@ -249,3 +262,19 @@ common.expectsError( { code: 'ERR_OUT_OF_RANGE' }); } } + +{ + const h = crypto.createHash('sha512'); + h.digest(); + common.expectsError(() => h.copy(), { code: 'ERR_CRYPTO_HASH_FINALIZED' }); + common.expectsError(() => h.digest(), { code: 'ERR_CRYPTO_HASH_FINALIZED' }); +} + +{ + const a = crypto.createHash('sha512').update('abc'); + const b = a.copy(); + const c = b.copy().update('def'); + const d = crypto.createHash('sha512').update('abcdef'); + assert.strictEqual(a.digest('hex'), b.digest('hex')); + assert.strictEqual(c.digest('hex'), d.digest('hex')); +} diff --git a/test/parallel/test-fs-opendir.js b/test/parallel/test-fs-opendir.js index f2c5d033451261..05fded527fe7f1 100644 --- a/test/parallel/test-fs-opendir.js +++ b/test/parallel/test-fs-opendir.js @@ -182,3 +182,26 @@ async function doAsyncIterThrowTest() { await assert.rejects(async () => dir.read(), dirclosedError); } doAsyncIterThrowTest().then(common.mustCall()); + +// Check error thrown on invalid values of bufferSize +for (const bufferSize of [-1, 0, 0.5, 1.5, Infinity, NaN]) { + assert.throws( + () => fs.opendirSync(testDir, { bufferSize }), + { + code: 'ERR_OUT_OF_RANGE' + }); +} +for (const bufferSize of ['', '1', null]) { + assert.throws( + () => fs.opendirSync(testDir, { bufferSize }), + { + code: 'ERR_INVALID_ARG_TYPE' + }); +} + +// Check that passing a positive integer as bufferSize works +{ + const dir = fs.opendirSync(testDir, { bufferSize: 1024 }); + assertDirent(dir.readSync()); + dir.close(); +} diff --git a/test/parallel/test-http-incoming-message-options.js b/test/parallel/test-http-incoming-message-options.js new file mode 100644 index 00000000000000..61e178eb47aeda --- /dev/null +++ b/test/parallel/test-http-incoming-message-options.js @@ -0,0 +1,24 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const http = require('http'); +const net = require('net'); +const readableHighWaterMark = 1024; +const server = http.createServer((req, res) => { res.end(); }); + +server.listen(0, common.mustCall(() => { + const req = http.request({ + port: server.address().port, + createConnection(options) { + options.readableHighWaterMark = readableHighWaterMark; + return net.createConnection(options); + } + }, common.mustCall((res) => { + assert.strictEqual(res.socket, req.socket); + assert.strictEqual(res.socket.readableHighWaterMark, readableHighWaterMark); + assert.strictEqual(res.readableHighWaterMark, readableHighWaterMark); + server.close(); + })); + + req.end(); +})); 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..23d9cb39cea182 --- /dev/null +++ b/test/parallel/test-release-npm.js @@ -0,0 +1,24 @@ +'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+$/; + +if (!releaseReg.test(process.version)) { + 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-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-vm-module-synthetic.js b/test/parallel/test-vm-module-synthetic.js index 71df9bd2633daf..83a78f2f3f5ba2 100644 --- a/test/parallel/test-vm-module-synthetic.js +++ b/test/parallel/test-vm-module-synthetic.js @@ -36,8 +36,6 @@ const assert = require('assert'); }); } - // https://bugs.chromium.org/p/v8/issues/detail?id=9828 - /* { const s = new SyntheticModule([], () => {}); await s.link(() => {}); @@ -47,7 +45,6 @@ const assert = require('assert'); name: 'ReferenceError', }); } - */ { const s = new SyntheticModule([], () => {}); diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 7be5f3f73fc26a..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', async (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,14 +79,40 @@ fs.readFile(filename, 'utf8', async (er, input) => { .use(remark2rehype, { allowDangerousHTML: true }) .use(raw) .use(htmlStringify) - .processSync(input); - - const basename = path.basename(filename, '.md'); + .process(input); const myHtml = await html.toHTML({ input, content, filename, nodeVersion }); + const basename = path.basename(filename, '.md'); const htmlTarget = path.join(outputDir, `${basename}.html`); - fs.writeFileSync(htmlTarget, myHtml); - const jsonTarget = path.join(outputDir, `${basename}.json`); - fs.writeFileSync(jsonTarget, JSON.stringify(content.json, null, 2)); -}); + + return Promise.allSettled([ + fs.writeFile(htmlTarget, myHtml), + fs.writeFile(jsonTarget, JSON.stringify(content.json, null, 2)), + ]); +} + +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); + } + + // Else with code 0 + process.exit(0); + }) + .catch((error) => { + console.error(error); + + process.exit(1); + }); 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/mac_tool.py b/tools/gyp/pylib/gyp/mac_tool.py index 409c7fedbd2368..e1faa5679f90a2 100755 --- a/tools/gyp/pylib/gyp/mac_tool.py +++ b/tools/gyp/pylib/gyp/mac_tool.py @@ -137,29 +137,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 +165,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 +199,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 +236,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).""" @@ -295,9 +288,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 +329,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 +661,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(' nul ^| findstr /r ^^HK ^| findstr "\\2\."') do ( - call :read-installpath %%a - if not errorlevel 1 exit /b 0 -) -exit /b 1 - :: Find Python installations in a registry location :find-versions for /f "delims=" %%a in ('reg query "%~1\Python\PythonCore" /f * /k 2^> nul ^| findstr /r ^^HK') do ( @@ -73,32 +44,11 @@ for /f "skip=2 tokens=1* delims=)" %%a in ('reg query "%1\InstallPath" /ve /t RE ) exit /b 1 - -:: Python 2: Check if %p% holds a path to a real python2 executable -:validate-v2 -IF NOT EXIST "%p%\python.exe" EXIT /B 1 -:: Check if %p% is python2 -"%p%\python.exe" -V 2>&1 | findstr /R "^Python.2.*" > NUL -EXIT /B %ERRORLEVEL% - - -:: Python 2: -:found-python2 -echo Python 2 found in %p%\python.exe -set pyver=2 -goto :done - :found-python echo Python found in %p%\python.exe -echo WARNING: Python 3 is not yet fully supported, to avoid issues Python 2 should be installed. -set pyver=3 -goto :done - -:done endlocal ^ & set "pt=%p%" ^ - & set "need_path_ext=%need_path%" ^ - & set "VCBUILD_PYTHON_VERSION=%pyver%" + & set "need_path_ext=%need_path%" set "VCBUILD_PYTHON_LOCATION=%pt%\python.exe" if %need_path_ext%==1 set "PATH=%pt%;%PATH%" set "pt=" 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 04babded24b590..b928662decf36c 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,27 @@ 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 @@ -791,18 +811,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': [ - '
    +13.1.0
    +13.0.1
    13.0.0