From 7f0ed89892c53b8cb31071f50c39d25b45ad7a57 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Mar 2020 11:52:18 -0400 Subject: [PATCH 001/181] doc: add link to DNS definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/32228 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen --- doc/api/dns.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/api/dns.md b/doc/api/dns.md index 6c7f29cfaf0f85..cea7db52f9b9d4 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -7,11 +7,12 @@ The `dns` module enables name resolution. For example, use it to look up IP addresses of host names. -Although named for the Domain Name System (DNS), it does not always use the DNS -protocol for lookups. [`dns.lookup()`][] uses the operating system facilities to -perform name resolution. It may not need to perform any network communication. -Developers looking to perform name resolution in the same way that other -applications on the same operating system behave should use [`dns.lookup()`][]. +Although named for the [Domain Name System (DNS)][], it does not always use the +DNS protocol for lookups. [`dns.lookup()`][] uses the operating system +facilities to perform name resolution. It may not need to perform any network +communication. Developers looking to perform name resolution in the same way +that other applications on the same operating system behave should use +[`dns.lookup()`][]. ```js const dns = require('dns'); @@ -1172,6 +1173,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_. [`socket.connect()`]: net.html#net_socket_connect_options_connectlistener [`util.promisify()`]: util.html#util_util_promisify_original [DNS error codes]: #dns_error_codes +[Domain Name System (DNS)]: https://en.wikipedia.org/wiki/Domain_Name_System [Implementation considerations section]: #dns_implementation_considerations [RFC 8482]: https://tools.ietf.org/html/rfc8482 [RFC 5952]: https://tools.ietf.org/html/rfc5952#section-6 From 8e00f0d2a2cd3a0617b1951beda86591a278621e Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 15:05:39 -0700 Subject: [PATCH 002/181] repl: fixup error message Use "cmd.action" instead of just "action" for ERR_INVALID_ARG_TYPE Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32474 Reviewed-By: Anto Aravinth Reviewed-By: Anna Henningsen --- lib/repl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/repl.js b/lib/repl.js index 183dcd43499f47..00194c58db4116 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -1380,7 +1380,7 @@ REPLServer.prototype.defineCommand = function(keyword, cmd) { if (typeof cmd === 'function') { cmd = { action: cmd }; } else if (typeof cmd.action !== 'function') { - throw new ERR_INVALID_ARG_TYPE('action', 'Function', cmd.action); + throw new ERR_INVALID_ARG_TYPE('cmd.action', 'Function', cmd.action); } this.commands[keyword] = cmd; }; From 567b352062931df47c826bb21e30b5eb20a63deb Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 14:32:37 -0700 Subject: [PATCH 003/181] http: fixup options.method error message Use `options.method` instead of just `method` Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32471 Reviewed-By: Evan Lucas Reviewed-By: Trivikram Kamat --- lib/_http_client.js | 4 ++-- lib/_http_server.js | 2 +- test/parallel/test-http-client-check-http-token.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 32eef681d5cf4e..b1535815050db3 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -170,7 +170,7 @@ function ClientRequest(input, options, cb) { let method = options.method; const methodIsString = (typeof method === 'string'); if (method !== null && method !== undefined && !methodIsString) { - throw new ERR_INVALID_ARG_TYPE('method', 'string', method); + throw new ERR_INVALID_ARG_TYPE('options.method', 'string', method); } if (methodIsString && method) { @@ -191,7 +191,7 @@ function ClientRequest(input, options, cb) { if (insecureHTTPParser !== undefined && typeof insecureHTTPParser !== 'boolean') { throw new ERR_INVALID_ARG_TYPE( - 'insecureHTTPParser', 'boolean', insecureHTTPParser); + 'options.insecureHTTPParser', 'boolean', insecureHTTPParser); } this.insecureHTTPParser = insecureHTTPParser; diff --git a/lib/_http_server.js b/lib/_http_server.js index 3f9c98e8380363..d39c2b781adc7c 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -339,7 +339,7 @@ function Server(options, requestListener) { if (insecureHTTPParser !== undefined && typeof insecureHTTPParser !== 'boolean') { throw new ERR_INVALID_ARG_TYPE( - 'insecureHTTPParser', 'boolean', insecureHTTPParser); + 'options.insecureHTTPParser', 'boolean', insecureHTTPParser); } this.insecureHTTPParser = insecureHTTPParser; diff --git a/test/parallel/test-http-client-check-http-token.js b/test/parallel/test-http-client-check-http-token.js index d09fbe1b8ee959..ef2445ec66e520 100644 --- a/test/parallel/test-http-client-check-http-token.js +++ b/test/parallel/test-http-client-check-http-token.js @@ -23,7 +23,7 @@ server.listen(0, common.mustCall(() => { }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "method" argument must be of type string.' + + message: 'The "options.method" property must be of type string.' + common.invalidArgTypeHelper(method) }); }); From eda165feb0702e16b34dd31f6672ad6f0624ead9 Mon Sep 17 00:00:00 2001 From: Matheus Marchini Date: Mon, 23 Mar 2020 11:41:05 -0700 Subject: [PATCH 004/181] build: drop Travis in favor of Actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub Actions is running all tests already present on Travis, as well as building on more platforms (OS X and Windows). With Travis we're also getting timeouts more frequently than with Actions, which gives the false impression tests are failing (making it harder to triage PRs ready to merge). To make our config simpler, CI.yml and pythonpackage.yml got merged. The coverage is also increased by running tests on OS X. Signed-off-by: Matheus Marchini PR-URL: https://github.com/nodejs/node/pull/32450 Reviewed-By: Richard Lau Reviewed-By: Christian Clauss Reviewed-By: Jiawen Geng Reviewed-By: Matteo Collina Reviewed-By: Ben Coe Reviewed-By: Tobias Nießen Reviewed-By: Michaël Zasso --- .github/workflows/CI.yml | 79 -------------------------- .github/workflows/build-windows.yml | 23 ++++++++ .github/workflows/linters.yml | 73 ++++++++++++++++++++++++ .github/workflows/misc.yml | 24 ++++++++ .github/workflows/pythonpackage.yml | 33 ----------- .github/workflows/test-linux.yml | 23 ++++++++ .github/workflows/test-macos.yml | 23 ++++++++ .gitignore | 1 - .travis.yml | 88 ----------------------------- configure | 3 - doc/guides/collaborator-guide.md | 9 +-- 11 files changed, 167 insertions(+), 212 deletions(-) delete mode 100644 .github/workflows/CI.yml create mode 100644 .github/workflows/build-windows.yml create mode 100644 .github/workflows/linters.yml create mode 100644 .github/workflows/misc.yml delete mode 100644 .github/workflows/pythonpackage.yml create mode 100644 .github/workflows/test-linux.yml create mode 100644 .github/workflows/test-macos.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml deleted file mode 100644 index f5b6281149c0fb..00000000000000 --- a/.github/workflows/CI.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - build-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Build - run: NODE=$(which node) make doc-only - - uses: actions/upload-artifact@v1 - with: - name: docs - path: out/doc - build-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Environment Information - run: npx envinfo - - name: Build - run: ./configure && make -j2 - build-windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - name: Environment Information - run: npx envinfo - - name: Install deps - run: choco install nasm - - name: Build - run: ./vcbuild.bat - build-macOS: - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Environment Information - run: npx envinfo - - name: Build - run: ./configure && make -j8 - lint-addon-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 10 - uses: actions/setup-node@v1 - with: - node-version: 10.x - - name: Lint addon docs - run: NODE=$(which node) make lint-addon-docs - lint-cpp: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Lint C/C++ files - run: make lint-cpp - lint-md: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 10 - uses: actions/setup-node@v1 - with: - node-version: 10.x - - name: Lint docs - run: | - echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" - NODE=$(which node) make lint-md - lint-js: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 10 - uses: actions/setup-node@v1 - with: - node-version: 10.x - - name: Lint JavaScript files - run: NODE=$(which node) make lint-js diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000000000..e342d93332b596 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,23 @@ +name: build-windows + +on: [push, pull_request] + +env: + PYTHON_VERSION: 3.8 + FLAKY_TESTS: dontcare + +jobs: + build-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v1 + with: + PYTHON_VERSION: ${{ env.PYTHON_VERSION }} + - name: Install deps + run: choco install nasm + - name: Environment Information + run: npx envinfo + - name: Build + run: ./vcbuild.bat diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 00000000000000..f0ee528a0f4e0f --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,73 @@ +name: linters + +on: [push, pull_request] + +env: + PYTHON_VERSION: 3.8 + NODE_VERSION: 10.x + +jobs: + lint-addon-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Lint addon docs + run: NODE=$(which node) make lint-addon-docs + lint-cpp: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v1 + with: + PYTHON_VERSION: ${{ env.PYTHON_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Lint C/C++ files + run: make lint-cpp + lint-md: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Lint docs + run: | + echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" + NODE=$(which node) make lint-md + lint-js: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Lint JavaScript files + run: NODE=$(which node) make lint-js + lint-py: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v1 + with: + PYTHON_VERSION: ${{ env.PYTHON_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Lint Python + run: | + make lint-py-build || true + NODE=$(which node) make lint lint-py diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml new file mode 100644 index 00000000000000..b23120ae0f1d74 --- /dev/null +++ b/.github/workflows/misc.yml @@ -0,0 +1,24 @@ +name: misc + +on: [push, pull_request] + +env: + NODE_VERSION: 12.x + +jobs: + build-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Build + run: NODE=$(which node) make doc-only + - uses: actions/upload-artifact@v1 + with: + name: docs + path: out/doc diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml deleted file mode 100644 index 9ff5e9a39d81fa..00000000000000 --- a/.github/workflows/pythonpackage.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Python 3 testing - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - max-parallel: 1 - matrix: - python-version: [3.8] # [2.7, 3.5, 3.6, 3.7] - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Compile Node.js - run: | - python ./configure.py - make -j2 V=1 - - name: Test JS Suites - run: | - python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare default - - name: Test C++ Suites - run: | - make -j1 V=1 test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp - python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare addons js-native-api node-api - - name: Make lint - run: | - make lint-py-build || true - NODE=$(which node) make lint lint-py diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml new file mode 100644 index 00000000000000..9b428b1f507d94 --- /dev/null +++ b/.github/workflows/test-linux.yml @@ -0,0 +1,23 @@ +name: test-linux + +on: [push, pull_request] + +env: + PYTHON_VERSION: 3.8 + FLAKY_TESTS: dontcare + +jobs: + test-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v1 + with: + PYTHON_VERSION: ${{ env.PYTHON_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Build + run: make build-ci -j2 V=1 + - name: Test + run: make run-ci -j2 V=1 diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml new file mode 100644 index 00000000000000..55fda9317a91fb --- /dev/null +++ b/.github/workflows/test-macos.yml @@ -0,0 +1,23 @@ +name: test-macOS + +on: [push, pull_request] + +env: + PYTHON_VERSION: 3.8 + FLAKY_TESTS: dontcare + +jobs: + test-macOS: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v1 + with: + PYTHON_VERSION: ${{ env.PYTHON_VERSION }} + - name: Environment Information + run: npx envinfo + - name: Build + run: make build-ci -j8 V=1 + - name: Test + run: make run-ci -j8 V=1 diff --git a/.gitignore b/.gitignore index 425a5ddbec0fca..1a0758ca5c1fd7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ !.gitkeep !.mailmap !.nycrc -!.travis.yml !.eslintrc.yaml !.cpplint diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index de7d7d47f88681..00000000000000 --- a/.travis.yml +++ /dev/null @@ -1,88 +0,0 @@ -os: linux -language: cpp -env: - global: - - PYTHON_VERSION="3.7.1" - - PYTHON=python3 -jobs: - include: - - stage: "Compile" - name: "Compile Node.js" - cache: ccache - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-6 - install: - - export CCACHE_NOSTATS=1 - - export CCACHE_SLOPPINESS="file_macro,include_file_mtime,include_file_ctime,time_macros,file_stat_matches" - - export CC='ccache gcc-6' - - export CXX='ccache g++-6' - script: - - pyenv global ${PYTHON_VERSION} - - ./configure - - timeout --preserve-status 45m make -j2 V=1 - before_cache: - - cp out/Release/node /home/travis/.ccache - - cp out/Release/cctest /home/travis/.ccache - - - stage: "Tests" - name: "Test JS Suites" - cache: ccache - install: - - mkdir -p out/Release - - cp /home/travis/.ccache/node out/Release/node - script: - - pyenv global ${PYTHON_VERSION} - - python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare default - - - name: "Test C++ Suites" - cache: ccache - install: - - export CCACHE_NOSTATS=1 - - export CCACHE_SLOPPINESS="file_macro,include_file_mtime,include_file_ctime,time_macros,file_stat_matches" - - export CC='ccache gcc' - - export CXX='ccache g++' - - mkdir -p out/Release - - cp /home/travis/.ccache/node out/Release/node - - ln -fs out/Release/node node - - cp /home/travis/.ccache/cctest out/Release/cctest - - touch config.gypi - script: - - pyenv global ${PYTHON_VERSION} - - out/Release/cctest - - make -j1 V=1 test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp - - python tools/test.py -j 2 -p dots --report --mode=release --flaky-tests=dontcare addons js-native-api node-api - - - name: "Run Linter and Build Docs" - language: node_js - node_js: "node" - install: - - pyenv global ${PYTHON_VERSION} - - make lint-py-build || true - script: - - NODE=$(which node) make lint-py doc-only lint - - - name: "First commit message adheres to guidelines at https://goo.gl/p2fr5Q" - if: type = pull_request - language: node_js - node_js: "node" - script: - - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then - bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST}; - fi - - - name: "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" - - name: "First commit message adheres to guidelines at https://goo.gl/p2fr5Q" diff --git a/configure b/configure index bc0a01d985520b..71c2fc87ca4cfc 100755 --- a/configure +++ b/configure @@ -3,10 +3,7 @@ # Locate an acceptable python interpreter and then re-execute the script. # Note that the mix of single and double quotes is intentional, # as is the fact that the ] goes on a new line. -# When a 'which' call is made for a specific version of Python on Travis CI, -# 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 test ${FORCE_PYTHON2} && exec python2 "$0" "$@" # workaround for gclient which python3.8 >/dev/null && exec python3.8 "$0" "$@" which python3.7 >/dev/null && exec python3.7 "$0" "$@" diff --git a/doc/guides/collaborator-guide.md b/doc/guides/collaborator-guide.md index 7e887d7543f50a..956eae7fb23726 100644 --- a/doc/guides/collaborator-guide.md +++ b/doc/guides/collaborator-guide.md @@ -175,14 +175,7 @@ fail before the change, and pass after the change. All pull requests must pass continuous integration tests. Code changes must pass on [project CI server](https://ci.nodejs.org/). Pull requests that only change -documentation and comments can use Travis CI results. - -Travis CI jobs have a fixed running time limit that building Node.js sometimes -exceeds. If the `Compile Node.js` Travis CI job has timed out it will fail after -around 45 minutes. The exit code will be 143, indicating that a `SIGTERM` signal -terminated the `make` command. When this happens, restart the timed out job. It -will reuse built artifacts from the previous timed-out run, and thus take less -time to complete. +documentation and comments can use GitHub Actions results. Do not land any pull requests without passing (green or yellow) CI runs. If there are CI failures unrelated to the change in the pull request, try "Resume From 13377a0f0fa8b7db93ba520a04a1fbf74424fb0a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 22 Mar 2020 11:33:35 +0100 Subject: [PATCH 005/181] src: cleanup DestroyParam when Environment exits Otherwise, this leaks memory if the weak callback is never called. PR-URL: https://github.com/nodejs/node/pull/32421 Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: James M Snell --- src/async_wrap.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 4d4cd01b5511c0..ea23896881cc3f 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -350,6 +350,10 @@ class DestroyParam { Global propBag; }; +static void DestroyParamCleanupHook(void* ptr) { + delete static_cast(ptr); +} + void AsyncWrap::WeakCallback(const WeakCallbackInfo& info) { HandleScope scope(info.GetIsolate()); @@ -358,6 +362,8 @@ void AsyncWrap::WeakCallback(const WeakCallbackInfo& info) { p->propBag); Local val; + p->env->RemoveCleanupHook(DestroyParamCleanupHook, p.get()); + if (!prop_bag->Get(p->env->context(), p->env->destroyed_string()) .ToLocal(&val)) { return; @@ -382,6 +388,7 @@ static void RegisterDestroyHook(const FunctionCallbackInfo& args) { p->target.Reset(isolate, args[0].As()); p->propBag.Reset(isolate, args[2].As()); p->target.SetWeak(p, AsyncWrap::WeakCallback, WeakCallbackType::kParameter); + p->env->AddCleanupHook(DestroyParamCleanupHook, p); } void AsyncWrap::GetAsyncId(const FunctionCallbackInfo& args) { From aa282276ecdc6fab709a98297680ce71b6af3601 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Wed, 18 Mar 2020 08:46:40 +0100 Subject: [PATCH 006/181] src: check for empty maybe local MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using ToLocalChecked on MaybeLocal without verifying it's empty can lead to unattempted crash. PR-URL: https://github.com/nodejs/node/pull/32339 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/udp_wrap.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 277eb6b81bae32..770782ee9cf38e 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -516,7 +516,8 @@ void UDPWrap::DoSend(const FunctionCallbackInfo& args, int family) { // construct uv_buf_t array for (size_t i = 0; i < count; i++) { - Local chunk = chunks->Get(env->context(), i).ToLocalChecked(); + Local chunk; + if (!chunks->Get(env->context(), i).ToLocal(&chunk)) return; size_t length = Buffer::Length(chunk); From 778dcc8f1ae72746f101fda11aaaf9c0bfd227bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Thu, 19 Mar 2020 16:35:13 -0500 Subject: [PATCH 007/181] src: clean v8 namespaces in env.cc file PR-URL: https://github.com/nodejs/node/pull/32374 Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: David Carlier Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca --- src/env.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/env.cc b/src/env.cc index 9b5c2776b1399a..66c3a386beefff 100644 --- a/src/env.cc +++ b/src/env.cc @@ -64,9 +64,9 @@ std::vector IsolateData::Serialize(SnapshotCreator* creator) { // but that's not part of the V8 API contract so we use an array // just to be safe. -#define VP(PropertyName, StringValue) V(v8::Private, PropertyName) -#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) -#define VS(PropertyName, StringValue) V(v8::String, PropertyName) +#define VP(PropertyName, StringValue) V(Private, PropertyName) +#define VY(PropertyName, StringValue) V(Symbol, PropertyName) +#define VS(PropertyName, StringValue) V(String, PropertyName) #define V(TypeName, PropertyName) \ indexes.push_back(creator->AddData(PropertyName##_.Get(isolate))); PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP) @@ -84,9 +84,9 @@ void IsolateData::DeserializeProperties(const std::vector* indexes) { size_t i = 0; HandleScope handle_scope(isolate_); -#define VP(PropertyName, StringValue) V(v8::Private, PropertyName) -#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName) -#define VS(PropertyName, StringValue) V(v8::String, PropertyName) +#define VP(PropertyName, StringValue) V(Private, PropertyName) +#define VY(PropertyName, StringValue) V(Symbol, PropertyName) +#define VS(PropertyName, StringValue) V(String, PropertyName) #define V(TypeName, PropertyName) \ do { \ MaybeLocal field = \ @@ -994,7 +994,7 @@ Environment* Environment::worker_parent_env() const { void MemoryTracker::TrackField(const char* edge_name, const CleanupHookCallback& value, const char* node_name) { - v8::HandleScope handle_scope(isolate_); + HandleScope handle_scope(isolate_); // Here, we utilize the fact that CleanupHookCallback instances // are all unique and won't be tracked twice in one BuildEmbedderGraph // callback. From edee4ecade933da6a48f1753bfc165d54184842c Mon Sep 17 00:00:00 2001 From: Alba Mendez Date: Sat, 28 Mar 2020 00:20:05 +0100 Subject: [PATCH 008/181] doc: add mildsunrise to collaborators PR-URL: https://github.com/nodejs/node/pull/32525 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c9e62b68007255..c7fe50e2e95278 100644 --- a/README.md +++ b/README.md @@ -347,6 +347,8 @@ For information about the governance of the Node.js project, see **Matteo Collina** <matteo.collina@gmail.com> (he/him) * [mhdawson](https://github.com/mhdawson) - **Michael Dawson** <michael_dawson@ca.ibm.com> (he/him) +* [mildsunrise](https://github.com/mildsunrise) +**Alba Mendez** <me@alba.sh> (she/her) * [misterdjules](https://github.com/misterdjules) - **Julien Gilli** <jgilli@nodejs.org> * [mmarchini](https://github.com/mmarchini) - From 2f8f619c7ebd429e3b0679dd377daa29b867189d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 25 Mar 2020 14:55:50 -0700 Subject: [PATCH 009/181] test: revise test-http-client-default-headers-exist * Remove assert.strictEqual where assert.ok suffices * Replace countdown with Promise.all() PR-URL: https://github.com/nodejs/node/pull/32493 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- .../test-http-client-default-headers-exist.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-http-client-default-headers-exist.js b/test/parallel/test-http-client-default-headers-exist.js index ba4d4fa660b2cc..e19be4b7d70856 100644 --- a/test/parallel/test-http-client-default-headers-exist.js +++ b/test/parallel/test-http-client-default-headers-exist.js @@ -23,7 +23,8 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); -const Countdown = require('../common/countdown'); + +const { once } = require('events'); const expectedHeaders = { 'DELETE': ['host', 'connection'], @@ -37,10 +38,6 @@ const expectedHeaders = { const expectedMethods = Object.keys(expectedHeaders); -const countdown = - new Countdown(expectedMethods.length, - common.mustCall(() => server.close())); - const server = http.createServer(common.mustCall((req, res) => { res.end(); @@ -49,9 +46,8 @@ const server = http.createServer(common.mustCall((req, res) => { const requestHeaders = Object.keys(req.headers); requestHeaders.forEach((header) => { - assert.strictEqual( + assert.ok( expectedHeaders[req.method].includes(header.toLowerCase()), - true, `${header} should not exist for method ${req.method}` ); }); @@ -61,15 +57,14 @@ const server = http.createServer(common.mustCall((req, res) => { expectedHeaders[req.method].length, `some headers were missing for method: ${req.method}` ); - - countdown.dec(); }, expectedMethods.length)); server.listen(0, common.mustCall(() => { - expectedMethods.forEach((method) => { - http.request({ + Promise.all(expectedMethods.map(async (method) => { + const request = http.request({ method: method, port: server.address().port }).end(); - }); + return once(request, 'response'); + })).then(common.mustCall(() => { server.close(); })); })); From 09cd7449e240341ca2e605b384d0915a546ee92e Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Fri, 20 Mar 2020 12:00:27 -0700 Subject: [PATCH 010/181] src: simplify large pages mapping code * Introduce `OnScopeLeave` handler for cleaning up mmap()ed range(s). * Factor out failure scenario at the bottom of the function with `fail` label for use with `goto`. * Do not allocate temporary range (`nmem`) on FreeBSD, because it is not used. The intention is that the steps involved in re-mapping to large pages become more clearly visible. Signed-off-by: Gabriel Schulhof Co-authored-by: Ben Noordhuis PR-URL: https://github.com/nodejs/node/pull/32396 Reviewed-By: Ben Noordhuis Reviewed-By: David Carlier --- src/large_pages/node_large_page.cc | 81 +++++++++--------------------- 1 file changed, 25 insertions(+), 56 deletions(-) diff --git a/src/large_pages/node_large_page.cc b/src/large_pages/node_large_page.cc index 4d4ff1aaf039b6..7c747047b6ab9a 100644 --- a/src/large_pages/node_large_page.cc +++ b/src/large_pages/node_large_page.cc @@ -339,20 +339,23 @@ __attribute__((__noinline__)) MoveTextRegionToLargePages(const text_region& r) { void* nmem = nullptr; void* tmem = nullptr; - int ret = 0; - - size_t size = r.to - r.from; void* start = r.from; + size_t size = r.to - r.from; + + auto free_mems = OnScopeLeave([&nmem, &tmem, size]() { + if (nmem != nullptr && nmem != MAP_FAILED && munmap(nmem, size) == -1) + PrintSystemError(errno); + if (tmem != nullptr && tmem != MAP_FAILED && munmap(tmem, size) == -1) + PrintSystemError(errno); + }); - // Allocate temporary region preparing for copy. +#if !defined (__FreeBSD__) + // Allocate temporary region and back up the code we will re-map. nmem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (nmem == MAP_FAILED) { - PrintSystemError(errno); - return -1; - } - + if (nmem == MAP_FAILED) goto fail; memcpy(nmem, r.from, size); +#endif #if defined(__linux__) // We already know the original page is r-xp @@ -362,32 +365,15 @@ MoveTextRegionToLargePages(const text_region& r) { tmem = mmap(start, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1 , 0); - if (tmem == MAP_FAILED) { - PrintSystemError(errno); - return -1; - } - - ret = madvise(tmem, size, 14 /* MADV_HUGEPAGE */); - if (ret == -1) { - PrintSystemError(errno); - ret = munmap(tmem, size); - if (ret == -1) { - PrintSystemError(errno); - } - if (-1 == munmap(nmem, size)) PrintSystemError(errno); - return -1; - } + if (tmem == MAP_FAILED) goto fail; + if (madvise(tmem, size, 14 /* MADV_HUGEPAGE */) == -1) goto fail; memcpy(start, nmem, size); #elif defined(__FreeBSD__) tmem = mmap(start, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED | MAP_ALIGNED_SUPER, -1 , 0); - if (tmem == MAP_FAILED) { - PrintSystemError(errno); - if (-1 == munmap(nmem, size)) PrintSystemError(errno); - return -1; - } + if (tmem == MAP_FAILED) goto fail; #elif defined(__APPLE__) // There is not enough room to reserve the mapping close // to the region address so we content to give a hint @@ -398,37 +384,20 @@ MoveTextRegionToLargePages(const text_region& r) { PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, VM_FLAGS_SUPERPAGE_SIZE_2MB, 0); - if (tmem == MAP_FAILED) { - PrintSystemError(errno); - if (-1 == munmap(nmem, size)) PrintSystemError(errno); - return -1; - } + if (tmem == MAP_FAILED) goto fail; memcpy(tmem, nmem, size); - ret = mprotect(start, size, PROT_READ | PROT_WRITE | PROT_EXEC); - if (ret == -1) { - PrintSystemError(errno); - ret = munmap(tmem, size); - if (ret == -1) { - PrintSystemError(errno); - } - if (-1 == munmap(nmem, size)) PrintSystemError(errno); - return -1; - } + if (mprotect(start, size, PROT_READ | PROT_WRITE | PROT_EXEC) == -1) + goto fail; memcpy(start, tmem, size); #endif - ret = mprotect(start, size, PROT_READ | PROT_EXEC); - if (ret == -1) { - PrintSystemError(errno); - ret = munmap(tmem, size); - if (ret == -1) { - PrintSystemError(errno); - } - if (-1 == munmap(nmem, size)) PrintSystemError(errno); - return -1; - } - if (-1 == munmap(nmem, size)) PrintSystemError(errno); - return ret; + if (mprotect(start, size, PROT_READ | PROT_EXEC) == -1) goto fail; + // We need not `munmap(tmem, size)` in the above `OnScopeLeave` on success. + tmem = nullptr; + return 0; +fail: + PrintSystemError(errno); + return -1; } #endif // defined(NODE_ENABLE_LARGE_CODE_PAGES) && NODE_ENABLE_LARGE_CODE_PAGES From 11d7cf155a816e8c29c1ee9be72d7413dbe890a1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 20 Mar 2020 06:55:07 -0700 Subject: [PATCH 011/181] test: replace Map with Array in test-cluster-net-listen-ipv6only-false Signed-off-by: Rich Trott PR-URL: https://github.com/nodejs/node/pull/32398 Reviewed-By: Anna Henningsen --- test/parallel/test-cluster-net-listen-ipv6only-false.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cluster-net-listen-ipv6only-false.js b/test/parallel/test-cluster-net-listen-ipv6only-false.js index 4d495d8faf6ddc..104a1d41aa6ac7 100644 --- a/test/parallel/test-cluster-net-listen-ipv6only-false.js +++ b/test/parallel/test-cluster-net-listen-ipv6only-false.js @@ -15,7 +15,7 @@ const host = '::'; const WORKER_COUNT = 3; if (cluster.isMaster) { - const workers = new Map(); + const workers = []; let address; const countdown = new Countdown(WORKER_COUNT, () => { @@ -45,7 +45,7 @@ if (cluster.isMaster) { countdown.dec(); })); - workers.set(i, worker); + workers[i] = worker; } } else { net.createServer().listen({ From b1e6f297cf27ea1188ffc10624cd96b851c0ab40 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 20 Mar 2020 20:11:15 -0700 Subject: [PATCH 012/181] test: use Promise.all() in test-cluster-net-listen-ipv6only-false Use Promise.all() instead of countdown in test-cluster-net-listen-ipv6only-false. Signed-off-by: Rich Trott PR-URL: https://github.com/nodejs/node/pull/32398 Reviewed-By: Anna Henningsen --- .../test-cluster-net-listen-ipv6only-false.js | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/test/parallel/test-cluster-net-listen-ipv6only-false.js b/test/parallel/test-cluster-net-listen-ipv6only-false.js index 104a1d41aa6ac7..f48e9f1c29dc4a 100644 --- a/test/parallel/test-cluster-net-listen-ipv6only-false.js +++ b/test/parallel/test-cluster-net-listen-ipv6only-false.js @@ -7,7 +7,6 @@ if (!common.hasIPv6) const assert = require('assert'); const cluster = require('cluster'); const net = require('net'); -const Countdown = require('../common/countdown'); // This test ensures that dual-stack support still works for cluster module // when `ipv6Only` is not `true`. @@ -18,35 +17,37 @@ if (cluster.isMaster) { const workers = []; let address; - const countdown = new Countdown(WORKER_COUNT, () => { + for (let i = 0; i < WORKER_COUNT; i += 1) { + const myWorker = new Promise((resolve) => { + const worker = cluster.fork().on('exit', common.mustCall((statusCode) => { + assert.strictEqual(statusCode, 0); + })).on('listening', common.mustCall((workerAddress) => { + if (!address) { + address = workerAddress; + } else { + assert.strictEqual(address.addressType, workerAddress.addressType); + assert.strictEqual(address.host, workerAddress.host); + assert.strictEqual(address.port, workerAddress.port); + } + resolve(worker); + })); + }); + + workers.push(myWorker); + } + + Promise.all(workers).then(common.mustCall((resolvedWorkers) => { const socket = net.connect({ port: address.port, host: '0.0.0.0', }, common.mustCall(() => { socket.destroy(); - workers.forEach((worker) => { - worker.disconnect(); + resolvedWorkers.forEach((resolvedWorker) => { + resolvedWorker.disconnect(); }); })); socket.on('error', common.mustNotCall()); - }); - - for (let i = 0; i < WORKER_COUNT; i += 1) { - const worker = cluster.fork().on('exit', common.mustCall((statusCode) => { - assert.strictEqual(statusCode, 0); - })).on('listening', common.mustCall((workerAddress) => { - if (!address) { - address = workerAddress; - } else { - assert.strictEqual(address.addressType, workerAddress.addressType); - assert.strictEqual(address.host, workerAddress.host); - assert.strictEqual(address.port, workerAddress.port); - } - countdown.dec(); - })); - - workers[i] = worker; - } + })); } else { net.createServer().listen({ host, From 1de9718b54f63a4003dacb672efe448eacd3104b Mon Sep 17 00:00:00 2001 From: himself65 Date: Wed, 11 Mar 2020 15:22:34 +0800 Subject: [PATCH 013/181] src: remove excess v8 namespace PR-URL: https://github.com/nodejs/node/pull/32191 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- src/node_crypto.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index de3354d2ef14b9..c5af0924846c0b 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -520,7 +520,7 @@ void SecureContext::Initialize(Environment* env, Local target) { env->set_secure_context_constructor_template(t); } -SecureContext::SecureContext(Environment* env, v8::Local wrap) +SecureContext::SecureContext(Environment* env, Local wrap) : BaseObject(env, wrap) { MakeWeak(); env->isolate()->AdjustAmountOfExternalAllocatedMemory(kExternalSize); @@ -3305,7 +3305,7 @@ KeyType KeyObject::GetKeyType() const { } KeyObject::KeyObject(Environment* env, - v8::Local wrap, + Local wrap, KeyType key_type) : BaseObject(env, wrap), key_type_(key_type), @@ -3350,7 +3350,7 @@ void KeyObject::Init(const FunctionCallbackInfo& args) { } } -void KeyObject::InitSecret(v8::Local abv) { +void KeyObject::InitSecret(Local abv) { CHECK_EQ(this->key_type_, kKeyTypeSecret); size_t key_len = abv->ByteLength(); @@ -3414,7 +3414,7 @@ void KeyObject::GetSymmetricKeySize(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(static_cast(key->GetSymmetricKeySize())); } -void KeyObject::Export(const v8::FunctionCallbackInfo& args) { +void KeyObject::Export(const FunctionCallbackInfo& args) { KeyObject* key; ASSIGN_OR_RETURN_UNWRAP(&key, args.Holder()); @@ -3458,7 +3458,7 @@ MaybeLocal KeyObject::ExportPrivateKey( } CipherBase::CipherBase(Environment* env, - v8::Local wrap, + Local wrap, CipherKind kind) : BaseObject(env, wrap), ctx_(nullptr), @@ -4077,7 +4077,7 @@ void CipherBase::Final(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(out.ToBuffer().ToLocalChecked()); } -Hmac::Hmac(Environment* env, v8::Local wrap) +Hmac::Hmac(Environment* env, Local wrap) : BaseObject(env, wrap), ctx_(nullptr) { MakeWeak(); @@ -4187,7 +4187,7 @@ void Hmac::HmacDigest(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(rc.ToLocalChecked()); } -Hash::Hash(Environment* env, v8::Local wrap) +Hash::Hash(Environment* env, Local wrap) : BaseObject(env, wrap), mdctx_(nullptr), has_md_(false), @@ -4420,7 +4420,7 @@ void CheckThrow(Environment* env, SignBase::Error error) { } } -SignBase::SignBase(Environment* env, v8::Local wrap) +SignBase::SignBase(Environment* env, Local wrap) : BaseObject(env, wrap) { } @@ -4447,7 +4447,7 @@ static bool ApplyRSAOptions(const ManagedEVPPKey& pkey, } -Sign::Sign(Environment* env, v8::Local wrap) : SignBase(env, wrap) { +Sign::Sign(Environment* env, Local wrap) : SignBase(env, wrap) { MakeWeak(); } @@ -4768,8 +4768,8 @@ void SignOneShot(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(signature.ToBuffer().ToLocalChecked()); } -Verify::Verify(Environment* env, v8::Local wrap) : - SignBase(env, wrap) { +Verify::Verify(Environment* env, Local wrap) + : SignBase(env, wrap) { MakeWeak(); } @@ -5075,7 +5075,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(out.ToBuffer().ToLocalChecked()); } -DiffieHellman::DiffieHellman(Environment* env, v8::Local wrap) +DiffieHellman::DiffieHellman(Environment* env, Local wrap) : BaseObject(env, wrap), verifyError_(0) { MakeWeak(); } @@ -5441,7 +5441,7 @@ void ECDH::Initialize(Environment* env, Local target) { t->GetFunction(env->context()).ToLocalChecked()).Check(); } -ECDH::ECDH(Environment* env, v8::Local wrap, ECKeyPointer&& key) +ECDH::ECDH(Environment* env, Local wrap, ECKeyPointer&& key) : BaseObject(env, wrap), key_(std::move(key)), group_(EC_KEY_get0_group(key_.get())) { From 8770fd96a7288e2d603c028683c15344b7563994 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 14:56:58 -0700 Subject: [PATCH 014/181] fs: fixup error message for invalid options.recursive Use "options.recursive" instead of just "recursive" Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32472 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- lib/fs.js | 4 ++-- lib/internal/fs/promises.js | 2 +- test/parallel/test-fs-mkdir.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 033c25cda948d6..d48bd523cc3e68 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -859,7 +859,7 @@ function mkdir(path, options, callback) { path = getValidatedPath(path); if (typeof recursive !== 'boolean') - throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive); + throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive); const req = new FSReqCallback(); req.oncomplete = callback; @@ -878,7 +878,7 @@ function mkdirSync(path, options) { path = getValidatedPath(path); if (typeof recursive !== 'boolean') - throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive); + throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive); const ctx = { path }; const result = binding.mkdir(pathModule.toNamespacedPath(path), diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index b29aace4a5b464..a7192c4848855b 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -346,7 +346,7 @@ async function mkdir(path, options) { } = options || {}; path = getValidatedPath(path); if (typeof recursive !== 'boolean') - throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive); + throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive); return binding.mkdir(pathModule.toNamespacedPath(path), parseMode(mode, 'mode', 0o777), recursive, diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index add0926f8379f6..5e28d6b944b6e0 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -229,7 +229,7 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) { { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "recursive" argument must be of type boolean.' + + message: 'The "options.recursive" property must be of type boolean.' + received } ); @@ -238,7 +238,7 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) { { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "recursive" argument must be of type boolean.' + + message: 'The "options.recursive" property must be of type boolean.' + received } ); From 814d88a01a15655fd9ea34dbd3a93e35a5a9e024 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 15:17:02 -0700 Subject: [PATCH 015/181] console: fixup error message Use "options.inspectOptions" instead of just "inspectOptions" Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32475 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- lib/internal/console/constructor.js | 7 +++++-- test/parallel/test-console-instance.js | 2 +- test/parallel/test-console-tty-colors.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index f1ba8fbbd7c7e6..dc8dcaa1d054ed 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -110,11 +110,14 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) { if (inspectOptions.colors !== undefined && options.colorMode !== undefined) { throw new ERR_INCOMPATIBLE_OPTION_PAIR( - 'inspectOptions.color', 'colorMode'); + 'options.inspectOptions.color', 'colorMode'); } optionsMap.set(this, inspectOptions); } else if (inspectOptions !== undefined) { - throw new ERR_INVALID_ARG_TYPE('inspectOptions', 'object', inspectOptions); + throw new ERR_INVALID_ARG_TYPE( + 'options.inspectOptions', + 'object', + inspectOptions); } // Bind the prototype functions to this Console instance diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index 19c4271d243ea7..bf22314e22e031 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -140,7 +140,7 @@ out.write = err.write = (d) => {}; }); }, { - message: 'The "inspectOptions" argument must be of type object.' + + message: 'The "options.inspectOptions" property must be of type object.' + common.invalidArgTypeHelper(inspectOptions), code: 'ERR_INVALID_ARG_TYPE' } diff --git a/test/parallel/test-console-tty-colors.js b/test/parallel/test-console-tty-colors.js index 41e72c3c8513bc..e906c71c186177 100644 --- a/test/parallel/test-console-tty-colors.js +++ b/test/parallel/test-console-tty-colors.js @@ -86,7 +86,7 @@ check(false, false, false); }); }, { - message: 'Option "inspectOptions.color" cannot be used in ' + + message: 'Option "options.inspectOptions.color" cannot be used in ' + 'combination with option "colorMode"', code: 'ERR_INCOMPATIBLE_OPTION_PAIR' } From fbf0493b0541744bab93bc7a2fa9db747c687e66 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 26 Mar 2020 05:22:30 +0100 Subject: [PATCH 016/181] src: fix compiler warnings in node_report_module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the following compiler warnings are generated: ../src/node_report_module.cc: In function ‘void report::ShouldReportOnFatalError( const v8::FunctionCallbackInfo&)’: ../src/node_report_module.cc:132:16: warning: unused variable ‘env’ [-Wunused-variable] 132 | Environment* env = Environment::GetCurrent(info); | ^~~ ../src/node_report_module.cc: In function ‘void report::SetReportOnFatalError( const v8::FunctionCallbackInfo&)’: ../src/node_report_module.cc:138:16: warning: unused variable ‘env’ [-Wunused-variable] 138 | Environment* env = Environment::GetCurrent(info); | ^~~ This commit removes the unused variables. PR-URL: https://github.com/nodejs/node/pull/32498 Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: Jiawen Geng Reviewed-By: Gireesh Punathil Reviewed-By: Richard Lau Reviewed-By: James M Snell --- src/node_report_module.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/node_report_module.cc b/src/node_report_module.cc index 769511ec468af2..dfcae53be1313f 100644 --- a/src/node_report_module.cc +++ b/src/node_report_module.cc @@ -129,13 +129,11 @@ static void SetSignal(const FunctionCallbackInfo& info) { } static void ShouldReportOnFatalError(const FunctionCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); info.GetReturnValue().Set( node::per_process::cli_options->report_on_fatalerror); } static void SetReportOnFatalError(const FunctionCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); CHECK(info[0]->IsBoolean()); node::per_process::cli_options->report_on_fatalerror = info[0]->IsTrue(); } From 432e58fcf010e288b50417275af856bd01aaa1f1 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 22 Mar 2020 10:26:18 +0100 Subject: [PATCH 017/181] build: disable -Wattributes warnings on aix Disable the following compiler warning: warning: visibility attribute not supported in this configuration; ignored [-Wattributes] This is gcc complaining about `__attribute((visibility("default"))` in static library builds. Legitimate but harmless (and uninteresting) and it drowns out more relevant warnings. PR-URL: https://github.com/nodejs/node/pull/32419 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- common.gypi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common.gypi b/common.gypi index 7f87a8cc1fea13..954a824ab01885 100644 --- a/common.gypi +++ b/common.gypi @@ -401,6 +401,15 @@ '-Wl,-brtl', ], }, { # else it's `AIX` + # Disable the following compiler warning: + # + # warning: visibility attribute not supported in this + # configuration; ignored [-Wattributes] + # + # This is gcc complaining about __attribute((visibility("default")) + # in static library builds. Legitimate but harmless and it drowns + # out more relevant warnings. + 'cflags': [ '-Wno-attributes' ], 'ldflags': [ '-Wl,-blibpath:/usr/lib:/lib:/opt/freeware/lib/pthread/ppc64', ], From 1e27f66ce6d30413c458bf88294ac1e16daf1c75 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 25 Mar 2020 21:02:46 +0100 Subject: [PATCH 018/181] doc: add missing changes: entry for mkdir Refs: https://github.com/nodejs/node/pull/31530 PR-URL: https://github.com/nodejs/node/pull/32490 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Ben Coe Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau --- doc/api/fs.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 116b3bdc73a887..2db3fc932ba8d9 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2438,6 +2438,10 @@ Synchronous lstat(2). -Specify the maximum size, in bytes, of HTTP headers. Defaults to 8KB. +Specify the maximum size, in bytes, of HTTP headers. Defaults to 16KB. ### `--napi-modules` * `privateKey` {Object | string | Buffer | KeyObject} - * `oaepHash` {string} The hash function to use for OAEP padding. + * `oaepHash` {string} The hash function to use for OAEP padding and MGF1. **Default:** `'sha1'` * `oaepLabel` {Buffer | TypedArray | DataView} The label to use for OAEP padding. If not specified, no label is used. @@ -2564,7 +2564,7 @@ changes: * `key` {Object | string | Buffer | KeyObject} * `key` {string | Buffer | KeyObject} A PEM encoded public or private key. - * `oaepHash` {string} The hash function to use for OAEP padding. + * `oaepHash` {string} The hash function to use for OAEP padding and MGF1. **Default:** `'sha1'` * `oaepLabel` {Buffer | TypedArray | DataView} The label to use for OAEP padding. If not specified, no label is used. From b973b938a299167f7a533316c31ffc78d803dfff Mon Sep 17 00:00:00 2001 From: himself65 Date: Tue, 17 Mar 2020 22:28:03 +0800 Subject: [PATCH 025/181] src: enhance template function 'MakeUtf8String' PR-URL: https://github.com/nodejs/node/pull/32322 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Gus Caplan --- src/util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.cc b/src/util.cc index 29bfb5d351e35b..c604c4c9555b60 100644 --- a/src/util.cc +++ b/src/util.cc @@ -63,7 +63,7 @@ using v8::Value; template static void MakeUtf8String(Isolate* isolate, Local value, - T* target) { + MaybeStackBuffer* target) { Local string; if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return; From f690fc93d6ea983e2f7bd34b4abfa20e4dfc2da5 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 17 Mar 2020 02:01:18 +0100 Subject: [PATCH 026/181] deps: update acorn to v7.1.1 Also clean up the plugins package.json files. PR-URL: https://github.com/nodejs/node/pull/32310 Reviewed-By: Rich Trott Reviewed-By: Jiawen Geng Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- .../acorn-class-fields/package.json | 80 +++----- .../acorn-numeric-separator/package.json | 74 ++----- .../acorn-private-class-elements/CHANGELOG.md | 4 + .../acorn-private-class-elements/index.js | 4 +- .../acorn-private-class-elements/package.json | 71 ++----- .../acorn-private-methods/package.json | 78 +++----- .../acorn-static-class-features/package.json | 80 +++----- deps/acorn/acorn-walk/CHANGELOG.md | 18 ++ deps/acorn/acorn-walk/dist/walk.js | 9 +- deps/acorn/acorn-walk/package.json | 3 +- deps/acorn/acorn/CHANGELOG.md | 48 ++++- deps/acorn/acorn/README.md | 10 +- deps/acorn/acorn/dist/acorn.js | 180 ++++++++++++------ deps/acorn/acorn/package.json | 3 +- 14 files changed, 316 insertions(+), 346 deletions(-) diff --git a/deps/acorn-plugins/acorn-class-fields/package.json b/deps/acorn-plugins/acorn-class-fields/package.json index 4df166ba19fa4a..550511399f248d 100644 --- a/deps/acorn-plugins/acorn-class-fields/package.json +++ b/deps/acorn-plugins/acorn-class-fields/package.json @@ -1,68 +1,36 @@ { - "_from": "acorn-class-fields", - "_id": "acorn-class-fields@0.3.1", - "_inBundle": false, - "_integrity": "sha512-X/8hSJuregAnrvfV1Y80VJNfeJx1uhw7yskOwvL631ygYeCGVLPumCnnPDHYZ8acV3ytHhg53K171H3tAemgiw==", - "_location": "/acorn-class-fields", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "acorn-class-fields", - "name": "acorn-class-fields", - "escapedName": "acorn-class-fields", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/acorn-class-fields/-/acorn-class-fields-0.3.1.tgz", - "_shasum": "032ce47a9688a71d4713ee366fadcb7fefaea9e0", - "_spec": "acorn-class-fields", - "_where": "/home/ruben/repos/node/node", - "bugs": { - "url": "https://github.com/acornjs/acorn-class-fields/issues" - }, - "bundleDependencies": false, + "name": "acorn-class-fields", + "description": "Support for class fields in acorn", + "homepage": "https://github.com/acornjs/acorn-class-fields", "contributors": [ - { - "name": "Adrian Heine", - "email": "mail@adrianheine.de" - } + "Adrian Heine " ], - "dependencies": { - "acorn-private-class-elements": "^0.1.1" - }, - "deprecated": false, - "description": "Support for class fields in acorn", - "devDependencies": { - "acorn": "^6.1.0", - "eslint": "^5.13.0", - "eslint-plugin-node": "^8.0.1", - "mocha": "^5.2.0", - "test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d", - "test262-parser-runner": "^0.5.0" - }, "engines": { "node": ">=4.8.2" }, - "homepage": "https://github.com/acornjs/acorn-class-fields", - "license": "MIT", - "name": "acorn-class-fields", - "peerDependencies": { - "acorn": "^6.0.0" - }, "repository": { "type": "git", - "url": "git+https://github.com/acornjs/acorn-class-fields.git" + "url": "https://github.com/acornjs/acorn-class-fields" }, + "license": "MIT", "scripts": { - "lint": "eslint -c .eslintrc.json .", "test": "mocha", - "test:test262": "node run_test262.js" + "test:test262": "node run_test262.js", + "lint": "eslint -c .eslintrc.json ." }, - "version": "0.3.1" -} + "peerDependencies": { + "acorn": "^6.0.0" + }, + "version": "0.3.1", + "devDependencies": { + "acorn": "^6.1.0", + "eslint": "^5.13.0", + "eslint-plugin-node": "^8.0.1", + "mocha": "^5.2.0", + "test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d", + "test262-parser-runner": "^0.5.0" + }, + "dependencies": { + "acorn-private-class-elements": "^0.1.1" + } +} \ No newline at end of file diff --git a/deps/acorn-plugins/acorn-numeric-separator/package.json b/deps/acorn-plugins/acorn-numeric-separator/package.json index bf3615e6b7e7ea..cc0c52a65d2dfe 100644 --- a/deps/acorn-plugins/acorn-numeric-separator/package.json +++ b/deps/acorn-plugins/acorn-numeric-separator/package.json @@ -1,65 +1,33 @@ { - "_from": "acorn-numeric-separator", - "_id": "acorn-numeric-separator@0.3.0", - "_inBundle": false, - "_integrity": "sha512-g9FikQZHwG/P1Xs+dDzecqagmGBbU4b8OF4UbDQK8Wr8apwuFGG1c7KiaFxC4ClYU8D7zNl60vzqOCUuhKM3kA==", - "_location": "/acorn-numeric-separator", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "acorn-numeric-separator", - "name": "acorn-numeric-separator", - "escapedName": "acorn-numeric-separator", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/acorn-numeric-separator/-/acorn-numeric-separator-0.3.0.tgz", - "_shasum": "15e2f9a698bbec83a339a70a7026ab1d9d257de2", - "_spec": "acorn-numeric-separator", - "_where": "/home/ruben/repos/node/node", - "bugs": { - "url": "https://github.com/acornjs/acorn-numeric-separator/issues" - }, - "bundleDependencies": false, + "name": "acorn-numeric-separator", + "description": "Support for numeric separators in acorn", + "homepage": "https://github.com/acornjs/acorn-numeric-separator", "contributors": [ - { - "name": "Adrian Heine", - "email": "mail@adrianheine.de" - } + "Adrian Heine " ], - "deprecated": false, - "description": "Support for numeric separators in acorn", - "devDependencies": { - "acorn": "^6.0.0", - "eslint": "^5.5.0", - "eslint-plugin-node": "^8.0.1", - "mocha": "^6.0.2", - "test262": "git+https://github.com/tc39/test262.git#de567d3aa5de4eaa11e00131d26b9fe77997dfb0", - "test262-parser-runner": "^0.5.0" - }, "engines": { "node": ">=4.8.2" }, - "homepage": "https://github.com/acornjs/acorn-numeric-separator", - "license": "MIT", - "name": "acorn-numeric-separator", - "peerDependencies": { - "acorn": "^6.0.0" - }, "repository": { "type": "git", - "url": "git+https://github.com/acornjs/acorn-numeric-separator.git" + "url": "https://github.com/acornjs/acorn-numeric-separator" }, + "license": "MIT", "scripts": { - "lint": "eslint -c .eslintrc.json .", "test": "mocha", - "test:test262": "node run_test262.js" + "test:test262": "node run_test262.js", + "lint": "eslint -c .eslintrc.json ." + }, + "peerDependencies": { + "acorn": "^6.0.0" }, - "version": "0.3.0" -} + "version": "0.3.0", + "devDependencies": { + "acorn": "^6.0.0", + "eslint": "^5.5.0", + "eslint-plugin-node": "^8.0.1", + "mocha": "^6.0.2", + "test262": "git+https://github.com/tc39/test262.git#de567d3aa5de4eaa11e00131d26b9fe77997dfb0", + "test262-parser-runner": "^0.5.0" + } +} \ No newline at end of file diff --git a/deps/acorn-plugins/acorn-private-class-elements/CHANGELOG.md b/deps/acorn-plugins/acorn-private-class-elements/CHANGELOG.md index 5b49344b7ac5b6..6d4854429aacfa 100644 --- a/deps/acorn-plugins/acorn-private-class-elements/CHANGELOG.md +++ b/deps/acorn-plugins/acorn-private-class-elements/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0 (2020-03-07) + +* Mark as compatible with acorn v7 + ## 0.1.1 (2019-02-09) * Add \_branch() method diff --git a/deps/acorn-plugins/acorn-private-class-elements/index.js b/deps/acorn-plugins/acorn-private-class-elements/index.js index 90f2b704371c9f..1f40bda9baa2eb 100644 --- a/deps/acorn-plugins/acorn-private-class-elements/index.js +++ b/deps/acorn-plugins/acorn-private-class-elements/index.js @@ -1,8 +1,8 @@ "use strict" const acorn = require('internal/deps/acorn/acorn/dist/acorn') -if (acorn.version.indexOf("6.") != 0 || acorn.version.indexOf("6.0.") == 0) { - throw new Error(`acorn-private-class-elements requires acorn@^6.1.0, not ${acorn.version}`) +if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) { + throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`) } const tt = acorn.tokTypes const TokenType = acorn.TokenType diff --git a/deps/acorn-plugins/acorn-private-class-elements/package.json b/deps/acorn-plugins/acorn-private-class-elements/package.json index cd43012dc79884..b8b652a1e9e2f3 100644 --- a/deps/acorn-plugins/acorn-private-class-elements/package.json +++ b/deps/acorn-plugins/acorn-private-class-elements/package.json @@ -1,63 +1,30 @@ { - "_from": "acorn-private-class-elements@^0.1.1", - "_id": "acorn-private-class-elements@0.1.1", - "_inBundle": false, - "_integrity": "sha512-bZpmSnaOsK3jkF7J8xaLJ05f008vapPX+XliIv8+jjkclvDR+M4OnTHLhFnCCSeJ0fMwRKjbY+BXsglSNpVZtw==", - "_location": "/acorn-private-class-elements", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "acorn-private-class-elements@^0.1.1", - "name": "acorn-private-class-elements", - "escapedName": "acorn-private-class-elements", - "rawSpec": "^0.1.1", - "saveSpec": null, - "fetchSpec": "^0.1.1" - }, - "_requiredBy": [ - "/acorn-class-fields" - ], - "_resolved": "https://registry.npmjs.org/acorn-private-class-elements/-/acorn-private-class-elements-0.1.1.tgz", - "_shasum": "85209cb5791ab84fde2362cb208fa51e7679bcdc", - "_spec": "acorn-private-class-elements@^0.1.1", - "_where": "/home/ruben/repos/node/node/node_modules/acorn-class-fields", - "bugs": { - "url": "https://github.com/acornjs/acorn-private-class-elements/issues" - }, - "bundleDependencies": false, + "name": "acorn-private-class-elements", + "description": "Helpers for supporting private class methods and fields in acorn", + "homepage": "https://github.com/acornjs/acorn-private-class-elements", "contributors": [ - { - "name": "Adrian Heine", - "email": "mail@adrianheine.de" - } + "Adrian Heine " ], - "dependencies": { - "mocha": "^5.2.0" - }, - "deprecated": false, - "description": "Helpers for supporting private class methods and fields in acorn", - "devDependencies": { - "acorn": "^6.1.0", - "eslint": "^5.13.0", - "eslint-plugin-node": "^8.0.1" - }, "engines": { "node": ">=4.8.2" }, - "homepage": "https://github.com/acornjs/acorn-private-class-elements", - "license": "MIT", - "name": "acorn-private-class-elements", - "peerDependencies": { - "acorn": "^6.1.0" - }, "repository": { "type": "git", - "url": "git+https://github.com/acornjs/acorn-private-class-elements.git" + "url": "https://github.com/acornjs/acorn-private-class-elements" }, + "license": "MIT", "scripts": { - "lint": "eslint -c .eslintrc.json .", - "test": "mocha" + "test": "mocha", + "lint": "eslint -c .eslintrc.json ." + }, + "peerDependencies": { + "acorn": "^6.1.0 || ^7.0.0" }, - "version": "0.1.1" -} + "version": "0.2.0", + "devDependencies": { + "acorn": "^7.0.0", + "eslint": "^6.8.0", + "eslint-plugin-node": "^11.0.0", + "mocha": "^7.1.0" + } +} \ No newline at end of file diff --git a/deps/acorn-plugins/acorn-private-methods/package.json b/deps/acorn-plugins/acorn-private-methods/package.json index d25c611316019f..e7b91592aaa9b9 100644 --- a/deps/acorn-plugins/acorn-private-methods/package.json +++ b/deps/acorn-plugins/acorn-private-methods/package.json @@ -1,43 +1,30 @@ { - "_from": "acorn-private-methods", - "_id": "acorn-private-methods@0.3.0", - "_inBundle": false, - "_integrity": "sha512-+gWTjSA+13lsv1mwCPosSrLzEyghYtWgrr/1Ck7i7Pu5iK7Ke0hOgw3IW1RUxhc4qS2QTQBQx2+qHYqsa4Qlqw==", - "_location": "/acorn-private-methods", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "acorn-private-methods", - "name": "acorn-private-methods", - "escapedName": "acorn-private-methods", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/acorn-private-methods/-/acorn-private-methods-0.3.0.tgz", - "_shasum": "a5a9f8cd83d175bc138fa22592fababd0afda35d", - "_spec": "acorn-private-methods", - "_where": "/home/ruben/repos/node/node", - "bugs": { - "url": "https://github.com/acornjs/acorn-private-methods/issues" - }, - "bundleDependencies": false, + "name": "acorn-private-methods", + "description": "Support for private methods in acorn", + "homepage": "https://github.com/acornjs/acorn-private-methods", "contributors": [ - { - "name": "Adrian Heine", - "email": "mail@adrianheine.de" - } + "Adrian Heine " ], + "engines": { + "node": ">=4.8.2" + }, + "repository": { + "type": "git", + "url": "https://github.com/acornjs/acorn-private-methods" + }, + "license": "MIT", + "scripts": { + "test": "mocha", + "test:test262": "node run_test262.js", + "lint": "eslint -c .eslintrc.json ." + }, + "peerDependencies": { + "acorn": "^6.1.0" + }, "dependencies": { "acorn-private-class-elements": "^0.1.0" }, - "deprecated": false, - "description": "Support for private methods in acorn", + "version": "0.3.0", "devDependencies": { "acorn": "^6.1.0", "eslint": "^5.13.0", @@ -45,24 +32,5 @@ "mocha": "^5.2.0", "test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d", "test262-parser-runner": "^0.5.0" - }, - "engines": { - "node": ">=4.8.2" - }, - "homepage": "https://github.com/acornjs/acorn-private-methods", - "license": "MIT", - "name": "acorn-private-methods", - "peerDependencies": { - "acorn": "^6.1.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/acornjs/acorn-private-methods.git" - }, - "scripts": { - "lint": "eslint -c .eslintrc.json .", - "test": "mocha", - "test:test262": "node run_test262.js" - }, - "version": "0.3.0" -} + } +} \ No newline at end of file diff --git a/deps/acorn-plugins/acorn-static-class-features/package.json b/deps/acorn-plugins/acorn-static-class-features/package.json index ff9ff30c05911b..066223d9965df5 100644 --- a/deps/acorn-plugins/acorn-static-class-features/package.json +++ b/deps/acorn-plugins/acorn-static-class-features/package.json @@ -1,68 +1,36 @@ { - "_from": "acorn-static-class-features", - "_id": "acorn-static-class-features@0.2.0", - "_inBundle": false, - "_integrity": "sha512-46IooHSRsvgSi+t36Wx9iPfF9BKFKVDcAWELXVqvKHmZogSCk11iUCi2FiZmLeTaM0hlJ3EYDyYiVmHRUGPzWA==", - "_location": "/acorn-static-class-features", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "acorn-static-class-features", - "name": "acorn-static-class-features", - "escapedName": "acorn-static-class-features", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/acorn-static-class-features/-/acorn-static-class-features-0.2.0.tgz", - "_shasum": "8a12b0b280b2e067e268fdbb14116a5b02affd71", - "_spec": "acorn-static-class-features", - "_where": "/home/ruben/repos/node/node", - "bugs": { - "url": "https://github.com/acornjs/acorn-static-class-features/issues" - }, - "bundleDependencies": false, + "name": "acorn-static-class-features", + "description": "Support for static class features in acorn", + "homepage": "https://github.com/acornjs/acorn-static-class-features", "contributors": [ - { - "name": "Adrian Heine", - "email": "mail@adrianheine.de" - } + "Adrian Heine " ], - "dependencies": { - "acorn-private-class-elements": "^0.1.0" - }, - "deprecated": false, - "description": "Support for static class features in acorn", - "devDependencies": { - "acorn": "^6.1.0", - "eslint": "^5.13.0", - "eslint-plugin-node": "^8.0.1", - "mocha": "^5.2.0", - "test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d", - "test262-parser-runner": "^0.5.0" - }, "engines": { "node": ">=4.8.2" }, - "homepage": "https://github.com/acornjs/acorn-static-class-features", - "license": "MIT", - "name": "acorn-static-class-features", - "peerDependencies": { - "acorn": "^6.1.0" - }, "repository": { "type": "git", - "url": "git+https://github.com/acornjs/acorn-static-class-features.git" + "url": "https://github.com/acornjs/acorn-static-class-features" }, + "license": "MIT", "scripts": { - "lint": "eslint -c .eslintrc.json .", "test": "mocha", - "test:test262": "node run_test262.js" + "test:test262": "node run_test262.js", + "lint": "eslint -c .eslintrc.json ." + }, + "peerDependencies": { + "acorn": "^6.1.0" }, - "version": "0.2.0" -} + "version": "0.2.0", + "devDependencies": { + "acorn": "^6.1.0", + "eslint": "^5.13.0", + "eslint-plugin-node": "^8.0.1", + "mocha": "^5.2.0", + "test262": "git+https://github.com/tc39/test262.git#33a306d1026b72227eb50a918db19ada16f12b3d", + "test262-parser-runner": "^0.5.0" + }, + "dependencies": { + "acorn-private-class-elements": "^0.1.1" + } +} \ No newline at end of file diff --git a/deps/acorn/acorn-walk/CHANGELOG.md b/deps/acorn/acorn-walk/CHANGELOG.md index c02dbd7dda8417..89114970bbeae4 100644 --- a/deps/acorn/acorn-walk/CHANGELOG.md +++ b/deps/acorn/acorn-walk/CHANGELOG.md @@ -1,3 +1,21 @@ +## 7.1.1 (2020-02-13) + +### Bug fixes + +Clean up the type definitions to actually work well with the main parser. + +## 7.1.0 (2020-02-11) + +### New features + +Add a TypeScript definition file for the library. + +## 7.0.0 (2017-08-12) + +### New features + +Support walking `ImportExpression` nodes. + ## 6.2.0 (2017-07-04) ### New features diff --git a/deps/acorn/acorn-walk/dist/walk.js b/deps/acorn/acorn-walk/dist/walk.js index 398a0032f4bb65..7aaab9ce824f60 100644 --- a/deps/acorn/acorn-walk/dist/walk.js +++ b/deps/acorn/acorn-walk/dist/walk.js @@ -34,7 +34,7 @@ // An ancestor walk keeps an array of ancestor nodes (including the // current node) and passes them to the callback as third parameter // (and also as state parameter when no other state is present). - function ancestor(node, visitors, baseVisitor, state) { + function ancestor(node, visitors, baseVisitor, state, override) { var ancestors = []; if (!baseVisitor) { baseVisitor = base ; }(function c(node, st, override) { @@ -44,7 +44,7 @@ baseVisitor[type](node, st, c); if (found) { found(node, st || ancestors, ancestors); } if (isNew) { ancestors.pop(); } - })(node, state); + })(node, state, override); } // A recursive walk is one where your functions override the default @@ -416,7 +416,10 @@ } c(node.source, st, "Expression"); }; - base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = base.Import = ignore; + base.ImportExpression = function (node, st, c) { + c(node.source, st, "Expression"); + }; + base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore; base.TaggedTemplateExpression = function (node, st, c) { c(node.tag, st, "Expression"); diff --git a/deps/acorn/acorn-walk/package.json b/deps/acorn/acorn-walk/package.json index 239e6c729aedfe..a66ca892ced577 100644 --- a/deps/acorn/acorn-walk/package.json +++ b/deps/acorn/acorn-walk/package.json @@ -3,8 +3,9 @@ "description": "ECMAScript (ESTree) AST walker", "homepage": "https://github.com/acornjs/acorn", "main": "dist/walk.js", + "types": "dist/walk.d.ts", "module": "dist/walk.mjs", - "version": "6.2.0", + "version": "7.1.1", "engines": {"node": ">=0.4.0"}, "maintainers": [ { diff --git a/deps/acorn/acorn/CHANGELOG.md b/deps/acorn/acorn/CHANGELOG.md index f94f23ccf295b0..32f5ce8f3bb4bf 100644 --- a/deps/acorn/acorn/CHANGELOG.md +++ b/deps/acorn/acorn/CHANGELOG.md @@ -1,3 +1,47 @@ +## 7.1.1 (2020-03-01) + +### Bug fixes + +Treat `\8` and `\9` as invalid escapes in template strings. + +Allow unicode escapes in property names that are keywords. + +Don't error on an exponential operator expression as argument to `await`. + +More carefully check for valid UTF16 surrogate pairs in regexp validator. + +## 7.1.0 (2019-09-24) + +### Bug fixes + +Disallow trailing object literal commas when ecmaVersion is less than 5. + +### New features + +Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on. + +## 7.0.0 (2019-08-13) + +### Breaking changes + +Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression). + +Makes 10 (ES2019) the default value for the `ecmaVersion` option. + +## 6.3.0 (2019-08-12) + +### New features + +`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard. + +## 6.2.1 (2019-07-21) + +### Bug fixes + +Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such. + +Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances. + ## 6.2.0 (2019-07-04) ### Bug fixes @@ -8,9 +52,9 @@ Disallow binding `let` in patterns. ### New features -Support bigint syntax with `ecmaVersion` >= 10. +Support bigint syntax with `ecmaVersion` >= 11. -Support dynamic `import` syntax with `ecmaVersion` >= 10. +Support dynamic `import` syntax with `ecmaVersion` >= 11. Upgrade to Unicode version 12. diff --git a/deps/acorn/acorn/README.md b/deps/acorn/acorn/README.md index fa372ee6821bab..585f2736fc05b5 100644 --- a/deps/acorn/acorn/README.md +++ b/deps/acorn/acorn/README.md @@ -52,9 +52,10 @@ Options can be provided by passing a second argument, which should be an object containing any of these fields: - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be - either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial - support). This influences support for strict mode, the set of - reserved words, and support for new syntax features. Default is 9. + either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11 + (2020, partial support). This influences support for strict mode, + the set of reserved words, and support for new syntax features. + Default is 10. **NOTE**: Only 'stage 4' (finalized) ECMAScript features are being implemented by Acorn. Other proposed new features can be implemented @@ -64,6 +65,9 @@ an object containing any of these fields: either `"script"` or `"module"`. This influences global strict mode and parsing of `import` and `export` declarations. + **NOTE**: If set to `"module"`, then static `import` / `export` syntax + will be valid, even if `ecmaVersion` is less than 6. + - **onInsertedSemicolon**: If given a callback, that callback will be called whenever a missing semicolon is inserted by the parser. The callback will be given the character offset of the point where the diff --git a/deps/acorn/acorn/dist/acorn.js b/deps/acorn/acorn/dist/acorn.js index dcb091fd4fe3d9..e2b33179c789c7 100644 --- a/deps/acorn/acorn/dist/acorn.js +++ b/deps/acorn/acorn/dist/acorn.js @@ -20,6 +20,7 @@ var keywords = { 5: ecma5AndLessKeywords, + "5module": ecma5AndLessKeywords + " export import", 6: ecma5AndLessKeywords + " const class extends export import super" }; @@ -32,9 +33,8 @@ // are only applied when a character is found to actually have a // code point above 128. // Generated by `bin/generate-identifier-regex.js`. - - var nonASCIIidentifierStartChars = "aab5bac0-d6d8-f6f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; - var nonASCIIidentifierChars = "\u200c\u200db7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; + var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; + var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); @@ -320,8 +320,8 @@ // either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10 // (2019). This influences support for strict mode, the set of // reserved words, and support for new syntax features. The default - // is 9. - ecmaVersion: 9, + // is 10. + ecmaVersion: 10, // `sourceType` indicates the mode the code should be parsed in. // Can be either `"script"` or `"module"`. This influences global // strict mode and parsing of `import` and `export` declarations. @@ -468,9 +468,9 @@ var Parser = function Parser(options, input, startPos) { this.options = options = getOptions(options); this.sourceFile = options.sourceFile; - this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5]); + this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); var reserved = ""; - if (!options.allowReserved) { + if (options.allowReserved !== true) { for (var v = options.ecmaVersion;; v--) { if (reserved = reservedWords[v]) { break } } if (options.sourceType === "module") { reserved += " await"; } @@ -755,9 +755,7 @@ } } this.adaptDirectivePrologue(node.body); this.next(); - if (this.options.ecmaVersion >= 6) { - node.sourceType = this.options.sourceType; - } + node.sourceType = this.options.sourceType; return this.finishNode(node, "Program") }; @@ -1886,9 +1884,11 @@ if (this.options.ecmaVersion >= 6) { if (name === "__proto__" && kind === "init") { if (propHash.proto) { - if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) { refDestructuringErrors.doubleProto = key.start; } - // Backwards-compat kludge. Can be removed in version 6.0 - else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } + if (refDestructuringErrors) { + if (refDestructuringErrors.doubleProto < 0) + { refDestructuringErrors.doubleProto = key.start; } + // Backwards-compat kludge. Can be removed in version 6.0 + } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } } propHash.proto = true; } @@ -1953,12 +1953,11 @@ else { this.exprAllowed = false; } } - var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldShorthandAssign = -1; + var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1; if (refDestructuringErrors) { oldParenAssign = refDestructuringErrors.parenthesizedAssign; oldTrailingComma = refDestructuringErrors.trailingComma; - oldShorthandAssign = refDestructuringErrors.shorthandAssign; - refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.shorthandAssign = -1; + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; } else { refDestructuringErrors = new DestructuringErrors; ownDestructuringErrors = true; @@ -1973,8 +1972,11 @@ var node = this.startNodeAt(startPos, startLoc); node.operator = this.value; node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left; - if (!ownDestructuringErrors) { DestructuringErrors.call(refDestructuringErrors); } - refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly + if (!ownDestructuringErrors) { + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; + } + if (refDestructuringErrors.shorthandAssign >= node.left.start) + { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly this.checkLVal(left); this.next(); node.right = this.parseMaybeAssign(noIn); @@ -1984,7 +1986,6 @@ } if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; } if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; } - if (oldShorthandAssign > -1) { refDestructuringErrors.shorthandAssign = oldShorthandAssign; } return left }; @@ -2089,8 +2090,8 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) { var startPos = this.start, startLoc = this.startLoc; var expr = this.parseExprAtom(refDestructuringErrors); - var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")"; - if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) { return expr } + if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") + { return expr } var result = this.parseSubscripts(expr, startPos, startLoc); if (refDestructuringErrors && result.type === "MemberExpression") { if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; } @@ -2114,7 +2115,7 @@ if (computed || this.eat(types.dot)) { var node = this.startNodeAt(startPos, startLoc); node.object = base; - node.property = computed ? this.parseExpression() : this.parseIdent(true); + node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never"); node.computed = !!computed; if (computed) { this.expect(types.bracketR); } base = this.finishNode(node, "MemberExpression"); @@ -2123,7 +2124,7 @@ this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8 && base.type !== "Import", false, refDestructuringErrors); + var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) { this.checkPatternErrors(refDestructuringErrors, false); this.checkYieldAwaitInDefaultParams(); @@ -2141,16 +2142,6 @@ var node$1 = this.startNodeAt(startPos, startLoc); node$1.callee = base; node$1.arguments = exprList; - if (node$1.callee.type === "Import") { - if (node$1.arguments.length !== 1) { - this.raise(node$1.start, "import() requires exactly one argument"); - } - - var importArg = node$1.arguments[0]; - if (importArg && importArg.type === "SpreadElement") { - this.raise(importArg.start, "... is not allowed in import()"); - } - } base = this.finishNode(node$1, "CallExpression"); } else if (this.type === types.backQuote) { var node$2 = this.startNodeAt(startPos, startLoc); @@ -2185,7 +2176,7 @@ // super [ Expression ] // super . IdentifierName // SuperCall: - // super Arguments + // super ( Arguments ) if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL) { this.unexpected(); } return this.finishNode(node, "Super") @@ -2262,8 +2253,8 @@ return this.parseTemplate() case types._import: - if (this.options.ecmaVersion > 10) { - return this.parseDynamicImport() + if (this.options.ecmaVersion >= 11) { + return this.parseExprImport() } else { return this.unexpected() } @@ -2273,13 +2264,34 @@ } }; - pp$3.parseDynamicImport = function() { + pp$3.parseExprImport = function() { var node = this.startNode(); - this.next(); - if (this.type !== types.parenL) { + this.next(); // skip `import` + switch (this.type) { + case types.parenL: + return this.parseDynamicImport(node) + default: this.unexpected(); } - return this.finishNode(node, "Import") + }; + + pp$3.parseDynamicImport = function(node) { + this.next(); // skip `(` + + // Parse node.source. + node.source = this.parseMaybeAssign(); + + // Verify ending. + if (!this.eat(types.parenR)) { + var errorPos = this.start; + if (this.eat(types.comma) && this.eat(types.parenR)) { + this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); + } else { + this.unexpected(errorPos); + } + } + + return this.finishNode(node, "ImportExpression") }; pp$3.parseLiteral = function(value) { @@ -2377,6 +2389,7 @@ var empty$1 = []; pp$3.parseNew = function() { + if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } var node = this.startNode(); var meta = this.parseIdent(true); if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) { @@ -2389,12 +2402,12 @@ { this.raiseRecoverable(node.start, "new.target can only be used in functions"); } return this.finishNode(node, "MetaProperty") } - var startPos = this.start, startLoc = this.startLoc; + var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import; node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); - if (this.options.ecmaVersion > 10 && node.callee.type === "Import") { - this.raise(node.callee.start, "Cannot use new with import(...)"); + if (isImport && node.callee.type === "ImportExpression") { + this.raise(startPos, "Cannot use new with import()"); } - if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8 && node.callee.type !== "Import", false); } + if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); } else { node.arguments = empty$1; } return this.finishNode(node, "NewExpression") }; @@ -2459,7 +2472,7 @@ while (!this.eat(types.braceR)) { if (!first) { this.expect(types.comma); - if (this.afterTrailingComma(types.braceR)) { break } + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break } } else { first = false; } var prop = this.parseProperty(isPattern, refDestructuringErrors); @@ -2581,7 +2594,7 @@ prop.computed = false; } } - return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(true) + return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never") }; // Initialize empty function node. @@ -2761,7 +2774,6 @@ pp$3.parseIdent = function(liberal, isBinding) { var node = this.startNode(); - if (liberal && this.options.allowReserved === "never") { liberal = false; } if (this.type === types.name) { node.name = this.value; } else if (this.type.keyword) { @@ -2778,7 +2790,7 @@ } else { this.unexpected(); } - this.next(); + this.next(!!liberal); this.finishNode(node, "Identifier"); if (!liberal) { this.checkUnreserved(node); @@ -2810,7 +2822,7 @@ var node = this.startNode(); this.next(); - node.argument = this.parseMaybeUnary(null, true); + node.argument = this.parseMaybeUnary(null, false); return this.finishNode(node, "AwaitExpression") }; @@ -3123,9 +3135,12 @@ // #table-binary-unicode-properties var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"; + var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; + var ecma11BinaryProperties = ecma10BinaryProperties; var unicodeBinaryProperties = { 9: ecma9BinaryProperties, - 10: ecma9BinaryProperties + " Extended_Pictographic" + 10: ecma10BinaryProperties, + 11: ecma11BinaryProperties }; // #table-unicode-general-category-values @@ -3133,9 +3148,12 @@ // #table-unicode-script-values var ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"; + var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; + var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; var unicodeScriptValues = { 9: ecma9ScriptValues, - 10: ecma9ScriptValues + " Dogra Dogr Elymaic Elym Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Old_Sogdian Sogo Sogdian Sogd Wancho Wcho" + 10: ecma10ScriptValues, + 11: ecma11ScriptValues }; var data = {}; @@ -3155,13 +3173,14 @@ } buildUnicodeData(9); buildUnicodeData(10); + buildUnicodeData(11); var pp$8 = Parser.prototype; var RegExpValidationState = function RegExpValidationState(parser) { this.parser = parser; this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : ""); - this.unicodeProperties = data[parser.options.ecmaVersion >= 10 ? 10 : parser.options.ecmaVersion]; + this.unicodeProperties = data[parser.options.ecmaVersion >= 11 ? 11 : parser.options.ecmaVersion]; this.source = ""; this.flags = ""; this.start = 0; @@ -3202,7 +3221,8 @@ if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { return c } - return (c << 10) + s.charCodeAt(i + 1) - 0x35FDC00 + var next = s.charCodeAt(i + 1); + return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c }; RegExpValidationState.prototype.nextIndex = function nextIndex (i) { @@ -3211,8 +3231,9 @@ if (i >= l) { return l } - var c = s.charCodeAt(i); - if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { + var c = s.charCodeAt(i), next; + if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || + (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) { return i + 1 } return i + 2 @@ -3303,7 +3324,7 @@ if (state.eat(0x29 /* ) */)) { state.raise("Unmatched ')'"); } - if (state.eat(0x5D /* [ */) || state.eat(0x7D /* } */)) { + if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) { state.raise("Lone quantifier brackets"); } } @@ -3992,7 +4013,7 @@ if (state.eat(0x5B /* [ */)) { state.eat(0x5E /* ^ */); this.regexp_classRanges(state); - if (state.eat(0x5D /* [ */)) { + if (state.eat(0x5D /* ] */)) { return true } // Unreachable since it threw "unterminated regular expression" error before. @@ -4040,7 +4061,7 @@ } var ch = state.current(); - if (ch !== 0x5D /* [ */) { + if (ch !== 0x5D /* ] */) { state.lastIntValue = ch; state.advance(); return true @@ -4219,7 +4240,9 @@ // Move to the next token - pp$9.next = function() { + pp$9.next = function(ignoreEscapeSequenceInKeyword) { + if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) + { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); } if (this.options.onToken) { this.options.onToken(new Token(this)); } @@ -4638,7 +4661,6 @@ if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); } var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48; if (octal && this.strict) { this.raise(start, "Invalid number"); } - if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; } var next = this.input.charCodeAt(this.pos); if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { var str$1 = this.input.slice(start, this.pos); @@ -4647,6 +4669,7 @@ if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types.num, val$1) } + if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; } if (next === 46 && !octal) { // '.' ++this.pos; this.readInt(10); @@ -4821,6 +4844,18 @@ case 10: // ' \n' if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; } return "" + case 56: + case 57: + if (inTemplate) { + var codePos = this.pos - 1; + + this.invalidStringToken( + codePos, + "Invalid escape sequence in template string" + ); + + return null + } default: if (ch >= 48 && ch <= 55) { var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]; @@ -4900,7 +4935,6 @@ var word = this.readWord1(); var type = types.name; if (this.keywords.test(word)) { - if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword " + word); } type = keywords$1[word]; } return this.finishToken(type, word) @@ -4908,7 +4942,29 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript. - var version = "6.2.0"; + var version = "7.1.0"; + + Parser.acorn = { + Parser: Parser, + version: version, + defaultOptions: defaultOptions, + Position: Position, + SourceLocation: SourceLocation, + getLineInfo: getLineInfo, + Node: Node, + TokenType: TokenType, + tokTypes: types, + keywordTypes: keywords$1, + TokContext: TokContext, + tokContexts: types$1, + isIdentifierChar: isIdentifierChar, + isIdentifierStart: isIdentifierStart, + Token: Token, + isNewLine: isNewLine, + lineBreak: lineBreak, + lineBreakG: lineBreakG, + nonASCIIwhitespace: nonASCIIwhitespace + }; // The main exported interface (under `self.acorn` when in the // browser) is a `parse` function that takes a code string and diff --git a/deps/acorn/acorn/package.json b/deps/acorn/acorn/package.json index 446e6b065bb3aa..6a8f036073a2ab 100644 --- a/deps/acorn/acorn/package.json +++ b/deps/acorn/acorn/package.json @@ -3,8 +3,9 @@ "description": "ECMAScript parser", "homepage": "https://github.com/acornjs/acorn", "main": "dist/acorn.js", + "types": "dist/acorn.d.ts", "module": "dist/acorn.mjs", - "version": "6.2.0", + "version": "7.1.1", "engines": {"node": ">=0.4.0"}, "maintainers": [ { From e7e3aeec349b97f29aafccec463144b56d9ad5b2 Mon Sep 17 00:00:00 2001 From: himself65 Date: Mon, 16 Mar 2020 14:48:00 +0800 Subject: [PATCH 027/181] doc: use uppercase on windows path PR-URL: https://github.com/nodejs/node/pull/32294 Reviewed-By: Bartosz Sosnowski Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen --- doc/api/fs.md | 4 ++-- doc/api/path.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 2db3fc932ba8d9..aea1303e5360d3 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -152,8 +152,8 @@ fs.open(Buffer.from('/open/some/file.txt'), 'r', (err, fd) => { On Windows, Node.js follows the concept of per-drive working directory. This behavior can be observed when using a drive path without a backslash. For -example `fs.readdirSync('c:\\')` can potentially return a different result than -`fs.readdirSync('c:')`. For more information, see +example `fs.readdirSync('C:\\')` can potentially return a different result than +`fs.readdirSync('C:')`. For more information, see [this MSDN page][MSDN-Rel-Path]. ### URL object support diff --git a/doc/api/path.md b/doc/api/path.md index c05a5c29efb12f..945c1a0394ca46 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -56,8 +56,8 @@ path.posix.basename('/tmp/myfile.html'); On Windows Node.js follows the concept of per-drive working directory. This behavior can be observed when using a drive path without a backslash. For -example, `path.resolve('c:\\')` can potentially return a different result than -`path.resolve('c:')`. For more information, see +example, `path.resolve('C:\\')` can potentially return a different result than +`path.resolve('C:')`. For more information, see [this MSDN page][MSDN-Rel-Path]. ## `path.basename(path[, ext])` From 7d4ec42b3a99779dfaff710e2af9bd7f8e8fe5d4 Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Sat, 21 Mar 2020 17:29:06 +0900 Subject: [PATCH 028/181] doc: fix profile type of --heap-prof-name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit V8 CPU profile -> V8 heap profile PR-URL: https://github.com/nodejs/node/pull/32404 Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: James M Snell --- src/node_options.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_options.cc b/src/node_options.cc index 7245cd252bad01..c9276e12fe2e79 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -409,7 +409,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "the profile to the current working directory.", &EnvironmentOptions::heap_prof); AddOption("--heap-prof-name", - "specified file name of the V8 CPU profile generated with " + "specified file name of the V8 heap profile generated with " "--heap-prof", &EnvironmentOptions::heap_prof_name); AddOption("--heap-prof-dir", From 06bff18fa8bce4d9c624b5947ed9e080f2dda439 Mon Sep 17 00:00:00 2001 From: Harshitha KP Date: Mon, 16 Mar 2020 06:22:27 -0400 Subject: [PATCH 029/181] src: replace handle dereference with ContainerOf this was influenced by https://github.com/nodejs/node/pull/32269 PR-URL: https://github.com/nodejs/node/pull/32298 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/process_wrap.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/process_wrap.cc b/src/process_wrap.cc index 1e7de56c6d1581..3d1065c9922183 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -292,8 +292,7 @@ class ProcessWrap : public HandleWrap { static void OnExit(uv_process_t* handle, int64_t exit_status, int term_signal) { - ProcessWrap* wrap = static_cast(handle->data); - CHECK_NOT_NULL(wrap); + ProcessWrap* wrap = ContainerOf(&ProcessWrap::process_, handle); CHECK_EQ(&wrap->process_, handle); Environment* env = wrap->env(); From c71736efd84dc8a0ed3eb3cc3a8ad4141ea881fd Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Thu, 26 Mar 2020 03:14:59 +0000 Subject: [PATCH 030/181] src: unify Linux and FreeBSD large pages implem dl_iterate_phdr(3) is also available for FreeBSD. This change adds the same trimming code for the start and end of the .text section as on Linux, making it work on FreeBSD, and removing the need for the additional FreeBSD-specific check. Manually tested on * https://www.osboxes.org/freebsd/#freebsd-12-1-vbox * https://www.osboxes.org/freebsd/#freebsd-11-vbox * test-digitalocean-freebsd11-x64-2 Signed-off-by: Gabriel Schulhof PR-URL: https://github.com/nodejs/node/pull/32534 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: David Carlier --- node.gyp | 4 +- src/large_pages/node_large_page.cc | 108 ++++++++++------------------- 2 files changed, 37 insertions(+), 75 deletions(-) diff --git a/node.gyp b/node.gyp index ebb0376c856f41..bbe796bc24a9b5 100644 --- a/node.gyp +++ b/node.gyp @@ -322,7 +322,7 @@ 'target_name': 'node_text_start', 'type': 'none', 'conditions': [ - [ 'OS=="linux" and ' + [ 'OS in "linux freebsd" and ' 'target_arch=="x64"', { 'type': 'static_library', 'sources': [ @@ -511,7 +511,7 @@ 'src/node_snapshot_stub.cc' ], }], - [ 'OS=="linux" and ' + [ 'OS in "linux freebsd" and ' 'target_arch=="x64"', { 'dependencies': [ 'node_text_start' ], 'ldflags+': [ diff --git a/src/large_pages/node_large_page.cc b/src/large_pages/node_large_page.cc index 7c747047b6ab9a..d0200937b727e6 100644 --- a/src/large_pages/node_large_page.cc +++ b/src/large_pages/node_large_page.cc @@ -30,12 +30,16 @@ #include "util.h" #include "uv.h" +#if defined(__linux__) || defined(__FreeBSD__) +#include #if defined(__linux__) #ifndef _GNU_SOURCE #define _GNU_SOURCE -#endif +#endif // ifndef _GNU_SOURCE +#endif // defined(__linux__) #include -#endif +#endif // defined(__linux__) || defined(__FreeBSD__) + #include #include #if defined(__FreeBSD__) @@ -73,7 +77,7 @@ // Use madvise with MADV_HUGEPAGE to use Anonymous 2M Pages // If successful copy the code there and unmap the original region. -#if defined(__linux__) +#if defined(__linux__) || defined(__FreeBSD__) extern "C" { // This symbol must be declared weak because this file becomes part of all // Node.js targets (like node_mksnapshot, node_mkcodecache, and cctest) and @@ -81,7 +85,7 @@ extern "C" { extern char __attribute__((weak)) __node_text_start; extern char __start_lpstub; } // extern "C" -#endif // defined(__linux__) +#endif // defined(__linux__) || defined(__FreeBSD__) #endif // defined(NODE_ENABLE_LARGE_CODE_PAGES) && NODE_ENABLE_LARGE_CODE_PAGES namespace node { @@ -121,19 +125,26 @@ inline uintptr_t hugepage_align_down(uintptr_t addr) { return ((addr) & ~((hps) - 1)); } +#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__FreeBSD__) +#ifndef ElfW +#define ElfW(name) Elf_##name +#endif // ifndef ElfW +#endif // defined(__FreeBSD__) + struct dl_iterate_params { uintptr_t start; uintptr_t end; uintptr_t reference_sym; + std::string exename; }; -#if defined(__linux__) int FindMapping(struct dl_phdr_info* info, size_t, void* data) { - if (info->dlpi_name[0] == 0) { + auto dl_params = static_cast(data); + if (dl_params->exename == std::string(info->dlpi_name)) { for (int idx = 0; idx < info->dlpi_phnum; idx++) { const ElfW(Phdr)* phdr = &info->dlpi_phdr[idx]; if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X)) { - auto dl_params = static_cast(data); uintptr_t start = info->dlpi_addr + phdr->p_vaddr; uintptr_t end = start + phdr->p_memsz; @@ -148,17 +159,30 @@ int FindMapping(struct dl_phdr_info* info, size_t, void* data) { } return 0; } -#endif // defined(__linux__) +#endif // defined(__linux__) || defined(__FreeBSD__) struct text_region FindNodeTextRegion() { struct text_region nregion; nregion.found_text_region = false; -#if defined(__linux__) +#if defined(__linux__) || defined(__FreeBSD__) dl_iterate_params dl_params = { - 0, 0, reinterpret_cast(&__node_text_start) + 0, 0, reinterpret_cast(&__node_text_start), "" }; uintptr_t lpstub_start = reinterpret_cast(&__start_lpstub); +#if defined(__FreeBSD__) + // On FreeBSD we need the name of the binary, because `dl_iterate_phdr` does + // not pass in an empty string as the `dlpi_name` of the binary but rather its + // absolute path. + { + char selfexe[PATH_MAX]; + size_t count = sizeof(selfexe); + if (uv_exepath(selfexe, &count)) + return nregion; + dl_params.exename = std::string(selfexe, count); + } +#endif // defined(__FreeBSD__) + if (dl_iterate_phdr(FindMapping, &dl_params) == 1) { Debug("Hugepages info: start: %p - sym: %p - end: %p\n", reinterpret_cast(dl_params.start), @@ -187,62 +211,6 @@ struct text_region FindNodeTextRegion() { } } } -#elif defined(__FreeBSD__) - std::string exename; - { - char selfexe[PATH_MAX]; - size_t count = sizeof(selfexe); - if (uv_exepath(selfexe, &count)) - return nregion; - - exename = std::string(selfexe, count); - } - - size_t numpg; - int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()}; - const size_t miblen = arraysize(mib); - if (sysctl(mib, miblen, nullptr, &numpg, nullptr, 0) == -1) { - return nregion; - } - - // Enough for struct kinfo_vmentry. - numpg = numpg * 4 / 3; - auto alg = std::vector(numpg); - - if (sysctl(mib, miblen, alg.data(), &numpg, nullptr, 0) == -1) { - return nregion; - } - - char* start = alg.data(); - char* end = start + numpg; - - while (start < end) { - kinfo_vmentry* entry = reinterpret_cast(start); - const size_t cursz = entry->kve_structsize; - if (cursz == 0) { - break; - } - - if (entry->kve_path[0] == '\0') { - continue; - } - bool excmapping = ((entry->kve_protection & KVME_PROT_READ) && - (entry->kve_protection & KVME_PROT_EXEC)); - - if (!strcmp(exename.c_str(), entry->kve_path) && excmapping) { - char* estart = - reinterpret_cast(hugepage_align_up(entry->kve_start)); - char* eend = - reinterpret_cast(hugepage_align_down(entry->kve_end)); - size_t size = eend - estart; - nregion.found_text_region = true; - nregion.from = estart; - nregion.to = eend; - nregion.total_hugepages = size / hps; - break; - } - start += cursz; - } #elif defined(__APPLE__) struct vm_region_submap_info_64 map; mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64; @@ -349,13 +317,11 @@ MoveTextRegionToLargePages(const text_region& r) { PrintSystemError(errno); }); -#if !defined (__FreeBSD__) // Allocate temporary region and back up the code we will re-map. nmem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (nmem == MAP_FAILED) goto fail; memcpy(nmem, r.from, size); -#endif #if defined(__linux__) // We already know the original page is r-xp @@ -374,6 +340,7 @@ MoveTextRegionToLargePages(const text_region& r) { MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED | MAP_ALIGNED_SUPER, -1 , 0); if (tmem == MAP_FAILED) goto fail; + memcpy(start, nmem, size); #elif defined(__APPLE__) // There is not enough room to reserve the mapping close // to the region address so we content to give a hint @@ -420,11 +387,6 @@ int MapStaticCodeToLargePages() { if (r.found_text_region == false) return ENOENT; -#if defined(__FreeBSD__) - if (r.from < reinterpret_cast(&MoveTextRegionToLargePages)) - return -1; -#endif - return MoveTextRegionToLargePages(r); #else return ENOTSUP; From 02eea7773a92d6ea20d5559e5bb5997f0a0b38ce Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 27 Mar 2020 16:46:33 -0700 Subject: [PATCH 031/181] test: revise test-http-response-multi-content-length Isolate the two test cases here a bit more and refactor code. PR-URL: https://github.com/nodejs/node/pull/32526 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- ...test-http-response-multi-content-length.js | 66 +++++++++---------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/test/parallel/test-http-response-multi-content-length.js b/test/parallel/test-http-response-multi-content-length.js index b2d28b7a9bcec1..0ef45a027fb64d 100644 --- a/test/parallel/test-http-response-multi-content-length.js +++ b/test/parallel/test-http-response-multi-content-length.js @@ -3,45 +3,39 @@ const common = require('../common'); const http = require('http'); const assert = require('assert'); -const Countdown = require('../common/countdown'); -const MAX_COUNT = 2; +// TODO(@jasnell) At some point this should be refactored as the API should not +// be allowing users to set multiple content-length values in the first place. -const server = http.createServer((req, res) => { - const num = req.headers['x-num']; - // TODO(@jasnell) At some point this should be refactored as the API - // should not be allowing users to set multiple content-length values - // in the first place. - switch (num) { - case '1': - res.setHeader('content-length', [2, 1]); - break; - case '2': - res.writeHead(200, { 'content-length': [1, 2] }); - break; - default: - assert.fail('should never get here'); - } - res.end('ok'); -}); - -const countdown = new Countdown(MAX_COUNT, () => server.close()); - -server.listen(0, common.mustCall(() => { - for (let n = 1; n <= MAX_COUNT; n++) { - // This runs twice, the first time, the server will use - // setHeader, the second time it uses writeHead. In either - // case, the error handler must be called because the client - // is not allowed to accept multiple content-length headers. +function test(server) { + server.listen(0, common.mustCall(() => { http.get( - { port: server.address().port, headers: { 'x-num': n } }, - (res) => { - assert.fail('client allowed multiple content-length headers.'); - } + { port: server.address().port }, + () => { assert.fail('Client allowed multiple content-length headers.'); } ).on('error', common.mustCall((err) => { - assert(/^Parse Error/.test(err.message)); + assert.ok(err.message.startsWith('Parse Error'), err.message); assert.strictEqual(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); - countdown.dec(); + server.close(); })); - } -})); + })); +} + +// Test adding an extra content-length header using setHeader(). +{ + const server = http.createServer((req, res) => { + res.setHeader('content-length', [2, 1]); + res.end('ok'); + }); + + test(server); +} + +// Test adding an extra content-length header using writeHead(). +{ + const server = http.createServer((req, res) => { + res.writeHead(200, { 'content-length': [1, 2] }); + res.end('ok'); + }); + + test(server); +} From 6cdccc8f281f58a8027f45390c4cf5ac99c6fd8a Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 30 Mar 2020 11:18:04 +0530 Subject: [PATCH 032/181] doc: fix typo in maintaining-openssl guide PR-URL: https://github.com/nodejs/node/pull/32292 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- doc/guides/maintaining-openssl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/guides/maintaining-openssl.md b/doc/guides/maintaining-openssl.md index a3d34bbdc6538c..bc17c1cc208b5e 100644 --- a/doc/guides/maintaining-openssl.md +++ b/doc/guides/maintaining-openssl.md @@ -94,7 +94,7 @@ The commit message can be (with the openssl version set to the relevant value): deps: update archs files for OpenSSL-1.1.0 After an OpenSSL source update, all the config files need to be regenerated and - comitted by: + committed by: $ cd deps/openssl/config $ make $ git add deps/openssl/config/archs From 02b0c9e46992ef50379df41a1e463825d89493f6 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 30 Mar 2020 11:18:49 +0530 Subject: [PATCH 033/181] doc: fix typo in maintaining-zlib guide PR-URL: https://github.com/nodejs/node/pull/32292 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- doc/guides/maintaining-zlib.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/guides/maintaining-zlib.md b/doc/guides/maintaining-zlib.md index c293fdf5d40fc6..f60ba4614962ba 100644 --- a/doc/guides/maintaining-zlib.md +++ b/doc/guides/maintaining-zlib.md @@ -22,7 +22,7 @@ Check that Node.js still builds and tests. It may be necessary to update deps/zlib/zlib.gyp if any significant changes have occurred upstream. -## Commiting zlib +## Committing zlib Add zlib: `git add --all deps/zlib` From 002048ef9fee32a87af908818310adc67631fab1 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Mon, 30 Mar 2020 11:19:18 +0530 Subject: [PATCH 034/181] doc: fix typo in http2 docs PR-URL: https://github.com/nodejs/node/pull/32292 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- doc/api/http2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 0e7d47e14fdcec..ceda983559d1ed 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -2281,7 +2281,7 @@ changes: * `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 + * `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 From 05111c437791aeee7abc598d97128c0a1787743e Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 12:46:23 +0100 Subject: [PATCH 035/181] benchmark: add `no-var` rule in .eslintrc.yaml PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/.eslintrc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/benchmark/.eslintrc.yaml b/benchmark/.eslintrc.yaml index 7de962dc9002af..8ce0f9f6e148c1 100644 --- a/benchmark/.eslintrc.yaml +++ b/benchmark/.eslintrc.yaml @@ -5,6 +5,7 @@ env: es6: true rules: + no-var: error comma-dangle: - error - arrays: 'always-multiline' From b188b3c1bad6c5bfe5a7aeadba94810b13dc9c7e Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 12:47:44 +0100 Subject: [PATCH 036/181] benchmark: use const instead of var in async_hooks PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/async_hooks/async-resource-vs-destroy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/async_hooks/async-resource-vs-destroy.js b/benchmark/async_hooks/async-resource-vs-destroy.js index da0b52afa0ec40..1894e4e8777b8b 100644 --- a/benchmark/async_hooks/async-resource-vs-destroy.js +++ b/benchmark/async_hooks/async-resource-vs-destroy.js @@ -54,7 +54,7 @@ function buildCurrentResource(getServe) { } function init(asyncId, type, triggerAsyncId, resource) { - var cr = executionAsyncResource(); + const cr = executionAsyncResource(); if (cr !== null) { resource[cls] = cr[cls]; } From 54c6219c0b71896d9a7999276cbde9d420de28aa Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 12:48:46 +0100 Subject: [PATCH 037/181] benchmark: use let instead of var in common.js PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/common.js b/benchmark/common.js index d2103704ab2838..701a8d6c34f07f 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -268,7 +268,7 @@ function formatResult(data) { conf += ` ${key}=${JSON.stringify(data.conf[key])}`; } - var rate = data.rate.toString().split('.'); + let rate = data.rate.toString().split('.'); rate[0] = rate[0].replace(/(\d)(?=(?:\d\d\d)+(?!\d))/g, '$1,'); rate = (rate[1] ? rate.join('.') : rate[0]); return `${data.name}${conf}: ${rate}`; From 93b39974523e1d592d80186623b15610d4a0cd94 Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 13:02:27 +0100 Subject: [PATCH 038/181] benchmark: use let instead of var in dns PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/dns/lookup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/dns/lookup.js b/benchmark/dns/lookup.js index 164e490bd3bc24..691daa8a879e2b 100644 --- a/benchmark/dns/lookup.js +++ b/benchmark/dns/lookup.js @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, { }); function main({ name, n, all }) { - var i = 0; + let i = 0; if (all === 'true') { const opts = { all: true }; From 4ce6fc5f9b9ea810e99f2dd47409a847072d9920 Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 13:04:46 +0100 Subject: [PATCH 039/181] benchmark: use let instead of var in run.js PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/run.js b/benchmark/run.js index c2e38ce96d7895..aa7c71bdd4ecd3 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -67,7 +67,7 @@ if (format === 'csv') { conf = conf.replace(/"/g, '""'); console.log(`"${data.name}", "${conf}", ${data.rate}, ${data.time}`); } else { - var rate = data.rate.toString().split('.'); + let rate = data.rate.toString().split('.'); rate[0] = rate[0].replace(/(\d)(?=(?:\d\d\d)+(?!\d))/g, '$1,'); rate = (rate[1] ? rate.join('.') : rate[0]); console.log(`${data.name} ${conf}: ${rate}`); From f1720145af9a897430f17cd0305f251050d5318f Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 13:13:58 +0100 Subject: [PATCH 040/181] benchmark: use let instead of var in timers PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/timers/immediate.js | 10 +++++----- benchmark/timers/timers-breadth-args.js | 2 +- benchmark/timers/timers-breadth.js | 2 +- benchmark/timers/timers-cancel-pooled.js | 4 ++-- benchmark/timers/timers-cancel-unpooled.js | 5 ++--- benchmark/timers/timers-depth.js | 2 +- benchmark/timers/timers-insert-unpooled.js | 5 ++--- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/benchmark/timers/immediate.js b/benchmark/timers/immediate.js index d12106a0e030fc..3bd4c097dce5a0 100644 --- a/benchmark/timers/immediate.js +++ b/benchmark/timers/immediate.js @@ -31,7 +31,7 @@ function main({ n, type }) { // setImmediate tail recursion, 0 arguments function depth(N) { - var n = 0; + let n = 0; bench.start(); setImmediate(cb); function cb() { @@ -45,7 +45,7 @@ function depth(N) { // setImmediate tail recursion, 1 argument function depth1(N) { - var n = 0; + let n = 0; bench.start(); setImmediate(cb, 1); function cb(a1) { @@ -59,7 +59,7 @@ function depth1(N) { // Concurrent setImmediate, 0 arguments function breadth(N) { - var n = 0; + let n = 0; bench.start(); function cb() { n++; @@ -73,7 +73,7 @@ function breadth(N) { // Concurrent setImmediate, 1 argument function breadth1(N) { - var n = 0; + let n = 0; bench.start(); function cb(a1) { n++; @@ -88,7 +88,7 @@ function breadth1(N) { // Concurrent setImmediate, 4 arguments function breadth4(N) { N /= 2; - var n = 0; + let n = 0; bench.start(); function cb(a1, a2, a3, a4) { n++; diff --git a/benchmark/timers/timers-breadth-args.js b/benchmark/timers/timers-breadth-args.js index 63a301dc9bc7dc..bf1727ab865b6d 100644 --- a/benchmark/timers/timers-breadth-args.js +++ b/benchmark/timers/timers-breadth-args.js @@ -6,7 +6,7 @@ const bench = common.createBenchmark(main, { }); function main({ n }) { - var j = 0; + let j = 0; function cb1(arg1) { j++; if (j === n) diff --git a/benchmark/timers/timers-breadth.js b/benchmark/timers/timers-breadth.js index 78bd5a97ae84b8..7af5d380018898 100644 --- a/benchmark/timers/timers-breadth.js +++ b/benchmark/timers/timers-breadth.js @@ -6,7 +6,7 @@ const bench = common.createBenchmark(main, { }); function main({ n }) { - var j = 0; + let j = 0; bench.start(); function cb() { j++; diff --git a/benchmark/timers/timers-cancel-pooled.js b/benchmark/timers/timers-cancel-pooled.js index 5045983210263e..30dbd7bc007d7a 100644 --- a/benchmark/timers/timers-cancel-pooled.js +++ b/benchmark/timers/timers-cancel-pooled.js @@ -8,11 +8,11 @@ const bench = common.createBenchmark(main, { function main({ n }) { - var timer = setTimeout(() => {}, 1); + let timer = setTimeout(() => {}, 1); for (let i = 0; i < n; i++) { setTimeout(cb, 1); } - var next = timer._idlePrev; + let next = timer._idlePrev; clearTimeout(timer); bench.start(); diff --git a/benchmark/timers/timers-cancel-unpooled.js b/benchmark/timers/timers-cancel-unpooled.js index df203ee4810b1d..70f8fd96c9cbf1 100644 --- a/benchmark/timers/timers-cancel-unpooled.js +++ b/benchmark/timers/timers-cancel-unpooled.js @@ -14,14 +14,13 @@ function main({ n, direction }) { timersList.push(setTimeout(cb, i + 1)); } - var j; bench.start(); if (direction === 'start') { - for (j = 0; j < n; j++) { + for (let j = 0; j < n; j++) { clearTimeout(timersList[j]); } } else { - for (j = n - 1; j >= 0; j--) { + for (let j = n - 1; j >= 0; j--) { clearTimeout(timersList[j]); } } diff --git a/benchmark/timers/timers-depth.js b/benchmark/timers/timers-depth.js index bfc6dd02cf5c65..766733ba1862a9 100644 --- a/benchmark/timers/timers-depth.js +++ b/benchmark/timers/timers-depth.js @@ -6,7 +6,7 @@ const bench = common.createBenchmark(main, { }); function main({ n }) { - var i = 0; + let i = 0; bench.start(); setTimeout(cb, 1); function cb() { diff --git a/benchmark/timers/timers-insert-unpooled.js b/benchmark/timers/timers-insert-unpooled.js index 11d25d5fe79670..5ee255b5e15fd2 100644 --- a/benchmark/timers/timers-insert-unpooled.js +++ b/benchmark/timers/timers-insert-unpooled.js @@ -10,14 +10,13 @@ const bench = common.createBenchmark(main, { function main({ direction, n }) { const timersList = []; - var i; bench.start(); if (direction === 'start') { - for (i = 1; i <= n; i++) { + for (let i = 1; i <= n; i++) { timersList.push(setTimeout(cb, i)); } } else { - for (i = n; i > 0; i--) { + for (let i = n; i > 0; i--) { timersList.push(setTimeout(cb, i)); } } From 108e91fb8522a09371d5ce2ebad2e21aa7c1e233 Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 14:17:20 +0100 Subject: [PATCH 041/181] benchmark: use let instead of var in tls PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/tls/convertprotocols.js | 2 +- benchmark/tls/throughput.js | 10 +++++----- benchmark/tls/tls-connect.js | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/benchmark/tls/convertprotocols.js b/benchmark/tls/convertprotocols.js index 74bb942bfcec4f..87c447436a44db 100644 --- a/benchmark/tls/convertprotocols.js +++ b/benchmark/tls/convertprotocols.js @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { function main({ n }) { const input = ['ABC', 'XYZ123', 'FOO']; - var m = {}; + let m = {}; // First call dominates results if (n > 1) { tls.convertALPNProtocols(input, m); diff --git a/benchmark/tls/throughput.js b/benchmark/tls/throughput.js index 3ea84aa84ef453..f3a96abcbc0174 100644 --- a/benchmark/tls/throughput.js +++ b/benchmark/tls/throughput.js @@ -7,12 +7,12 @@ const bench = common.createBenchmark(main, { }); const fixtures = require('../../test/common/fixtures'); -var options; +let options; const tls = require('tls'); function main({ dur, type, size }) { - var encoding; - var chunk; + let encoding; + let chunk; switch (type) { case 'buf': chunk = Buffer.alloc(size, 'b'); @@ -37,7 +37,7 @@ function main({ dur, type, size }) { }; const server = tls.createServer(options, onConnection); - var conn; + let conn; server.listen(common.PORT, () => { const opt = { port: common.PORT, rejectUnauthorized: false }; conn = tls.connect(opt, () => { @@ -52,7 +52,7 @@ function main({ dur, type, size }) { } }); - var received = 0; + let received = 0; function onConnection(conn) { conn.on('data', (chunk) => { received += chunk.length; diff --git a/benchmark/tls/tls-connect.js b/benchmark/tls/tls-connect.js index 1cb04d98a52721..3fc2ecb614978b 100644 --- a/benchmark/tls/tls-connect.js +++ b/benchmark/tls/tls-connect.js @@ -8,11 +8,11 @@ const bench = common.createBenchmark(main, { dur: [5] }); -var clientConn = 0; -var serverConn = 0; -var dur; -var concurrency; -var running = true; +let clientConn = 0; +let serverConn = 0; +let dur; +let concurrency; +let running = true; function main(conf) { dur = conf.dur; From 148df0a7431f7fd53f285cd8833e88d5ed979d23 Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 14:32:11 +0100 Subject: [PATCH 042/181] benchmark: use let instead of var in url PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/url/legacy-vs-whatwg-url-parse.js | 10 +++++----- benchmark/url/legacy-vs-whatwg-url-serialize.js | 6 +++--- benchmark/url/whatwg-url-properties.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/benchmark/url/legacy-vs-whatwg-url-parse.js b/benchmark/url/legacy-vs-whatwg-url-parse.js index 6e5e25d231242f..94115d1305bb95 100644 --- a/benchmark/url/legacy-vs-whatwg-url-parse.js +++ b/benchmark/url/legacy-vs-whatwg-url-parse.js @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, { function useLegacy(data) { const len = data.length; - var result = url.parse(data[0]); // Avoid dead code elimination + let result = url.parse(data[0]); // Avoid dead code elimination bench.start(); for (let i = 0; i < len; ++i) { result = url.parse(data[i]); @@ -24,7 +24,7 @@ function useLegacy(data) { function useWHATWGWithBase(data) { const len = data.length; - var result = new URL(data[0][0], data[0][1]); // Avoid dead code elimination + let result = new URL(data[0][0], data[0][1]); // Avoid dead code elimination bench.start(); for (let i = 0; i < len; ++i) { const item = data[i]; @@ -36,7 +36,7 @@ function useWHATWGWithBase(data) { function useWHATWGWithoutBase(data) { const len = data.length; - var result = new URL(data[0]); // Avoid dead code elimination + let result = new URL(data[0]); // Avoid dead code elimination bench.start(); for (let i = 0; i < len; ++i) { result = new URL(data[i]); @@ -47,8 +47,8 @@ function useWHATWGWithoutBase(data) { function main({ e, method, type, withBase }) { withBase = withBase === 'true'; - var noDead; // Avoid dead code elimination. - var data; + let noDead; // Avoid dead code elimination. + let data; switch (method) { case 'legacy': data = common.bakeUrlData(type, e, false, false); diff --git a/benchmark/url/legacy-vs-whatwg-url-serialize.js b/benchmark/url/legacy-vs-whatwg-url-serialize.js index 5523e549ceb233..e3254ede3acee8 100644 --- a/benchmark/url/legacy-vs-whatwg-url-serialize.js +++ b/benchmark/url/legacy-vs-whatwg-url-serialize.js @@ -13,7 +13,7 @@ const bench = common.createBenchmark(main, { function useLegacy(data) { const obj = url.parse(data[0]); const len = data.length; - var noDead = url.format(obj); + let noDead = url.format(obj); bench.start(); for (let i = 0; i < len; i++) { noDead = data[i].toString(); @@ -25,7 +25,7 @@ function useLegacy(data) { function useWHATWG(data) { const obj = new URL(data[0]); const len = data.length; - var noDead = obj.toString(); + let noDead = obj.toString(); bench.start(); for (let i = 0; i < len; i++) { noDead = data[i].toString(); @@ -37,7 +37,7 @@ function useWHATWG(data) { function main({ type, e, method }) { const data = common.bakeUrlData(type, e, false, false); - var noDead; // Avoid dead code elimination. + let noDead; // Avoid dead code elimination. switch (method) { case 'legacy': noDead = useLegacy(data); diff --git a/benchmark/url/whatwg-url-properties.js b/benchmark/url/whatwg-url-properties.js index ac71ff4f636d66..f0ba2931e51f1e 100644 --- a/benchmark/url/whatwg-url-properties.js +++ b/benchmark/url/whatwg-url-properties.js @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, { function setAndGet(data, prop) { const len = data.length; - var result = data[0][prop]; + let result = data[0][prop]; bench.start(); for (let i = 0; i < len; ++i) { result = data[i][prop]; @@ -24,7 +24,7 @@ function setAndGet(data, prop) { function get(data, prop) { const len = data.length; - var result = data[0][prop]; + let result = data[0][prop]; bench.start(); for (let i = 0; i < len; ++i) { result = data[i][prop]; // get From f1d3fb067bcdacf94212d7bc624013d593a3d625 Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 14:43:01 +0100 Subject: [PATCH 043/181] benchmark: use let instead of var in util PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/util/inspect-array.js | 8 ++++---- benchmark/util/inspect.js | 2 +- benchmark/util/normalize-encoding.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/benchmark/util/inspect-array.js b/benchmark/util/inspect-array.js index 987b40479184d2..958030d99bd192 100644 --- a/benchmark/util/inspect-array.js +++ b/benchmark/util/inspect-array.js @@ -15,8 +15,8 @@ const bench = common.createBenchmark(main, { }); function main({ n, len, type }) { - var arr = Array(len); - var i, opts; + let arr = Array(len); + let opts; switch (type) { case 'denseArray_showHidden': @@ -29,14 +29,14 @@ function main({ n, len, type }) { case 'sparseArray': break; case 'mixedArray': - for (i = 0; i < n; i += 2) + for (let i = 0; i < n; i += 2) arr[i] = i; break; default: throw new Error(`Unsupported type ${type}`); } bench.start(); - for (i = 0; i < n; i++) { + for (let i = 0; i < n; i++) { util.inspect(arr, opts); } bench.end(n); diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js index 159d831f762884..0a19e65ea234be 100644 --- a/benchmark/util/inspect.js +++ b/benchmark/util/inspect.js @@ -37,7 +37,7 @@ function benchmark(n, obj, options) { } function main({ method, n, option }) { - var obj; + let obj; const options = opts[option]; switch (method) { case 'Object': diff --git a/benchmark/util/normalize-encoding.js b/benchmark/util/normalize-encoding.js index 464bda52f35c44..03769cb3b229cb 100644 --- a/benchmark/util/normalize-encoding.js +++ b/benchmark/util/normalize-encoding.js @@ -46,11 +46,11 @@ function getInput(input) { function main({ input, n }) { const { normalizeEncoding } = require('internal/util'); const inputs = getInput(input); - var noDead = ''; + let noDead = ''; bench.start(); - for (var i = 0; i < n; ++i) { - for (var j = 0; j < inputs.length; ++j) { + for (let i = 0; i < n; ++i) { + for (let j = 0; j < inputs.length; ++j) { noDead = normalizeEncoding(inputs[j]); } } From d8316654fbfbf3a2e17990bbf8f6da88c86acefd Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 14:51:09 +0100 Subject: [PATCH 044/181] benchmark: use let instead of var in worker PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/worker/echo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/worker/echo.js b/benchmark/worker/echo.js index 8d45a1f76b5eac..7988ffc7e121eb 100644 --- a/benchmark/worker/echo.js +++ b/benchmark/worker/echo.js @@ -55,7 +55,7 @@ function main({ n, workers, sendsPerBroadcast: sends, payload: payloadType }) { return; } for (const worker of workerObjs) { - for (var i = 0; i < sends; ++i) + for (let i = 0; i < sends; ++i) worker.postMessage(payload); } } From b556670d559a3da5425eb3c04d2071ac7e8b185e Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Fri, 14 Feb 2020 14:59:09 +0100 Subject: [PATCH 045/181] benchmark: use let instead of var in zlib PR-URL: https://github.com/nodejs/node/pull/31794 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat --- benchmark/zlib/creation.js | 5 ++--- benchmark/zlib/deflate.js | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/benchmark/zlib/creation.js b/benchmark/zlib/creation.js index 30e6afe6b4355f..c2d063c20d8d02 100644 --- a/benchmark/zlib/creation.js +++ b/benchmark/zlib/creation.js @@ -15,17 +15,16 @@ function main({ n, type, options }) { const fn = zlib[`create${type}`]; if (typeof fn !== 'function') throw new Error('Invalid zlib type'); - var i = 0; if (options === 'true') { const opts = {}; bench.start(); - for (; i < n; ++i) + for (let i = 0; i < n; ++i) fn(opts); bench.end(n); } else { bench.start(); - for (; i < n; ++i) + for (let i = 0; i < n; ++i) fn(); bench.end(n); } diff --git a/benchmark/zlib/deflate.js b/benchmark/zlib/deflate.js index 6d3bda90c6fdfa..5baedc924d4bc8 100644 --- a/benchmark/zlib/deflate.js +++ b/benchmark/zlib/deflate.js @@ -13,11 +13,11 @@ function main({ n, method, inputLen }) { method = method || 'deflate'; const chunk = Buffer.alloc(inputLen, 'a'); - var i = 0; switch (method) { // Performs `n` writes for a single deflate stream - case 'createDeflate': - var deflater = zlib.createDeflate(); + case 'createDeflate': { + let i = 0; + const deflater = zlib.createDeflate(); deflater.resume(); deflater.on('finish', () => { bench.end(n); @@ -30,9 +30,11 @@ function main({ n, method, inputLen }) { deflater.write(chunk, next); })(); break; + } // Performs `n` single deflate operations - case 'deflate': - var deflate = zlib.deflate; + case 'deflate': { + let i = 0; + const deflate = zlib.deflate; bench.start(); (function next(err, result) { if (i++ === n) @@ -40,14 +42,16 @@ function main({ n, method, inputLen }) { deflate(chunk, next); })(); break; + } // Performs `n` single deflateSync operations - case 'deflateSync': - var deflateSync = zlib.deflateSync; + case 'deflateSync': { + const deflateSync = zlib.deflateSync; bench.start(); - for (; i < n; ++i) + for (let i = 0; i < n; ++i) deflateSync(chunk); bench.end(n); break; + } default: throw new Error('Unsupported deflate method'); } From 1e76bc67ddca4abd6399b83f92005c334a643385 Mon Sep 17 00:00:00 2001 From: Christian Niederer Date: Tue, 11 Feb 2020 16:27:19 +0100 Subject: [PATCH 046/181] src: check for overflow when extending AliasedBufferBase When resizing an aliased_buffer check if the new size will overflow. PR-URL: https://github.com/nodejs/node/pull/31740 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: Colin Ihrig --- src/aliased_buffer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aliased_buffer.h b/src/aliased_buffer.h index 281c8fed581645..e762e8ede8ebee 100644 --- a/src/aliased_buffer.h +++ b/src/aliased_buffer.h @@ -221,7 +221,8 @@ class AliasedBufferBase { const v8::HandleScope handle_scope(isolate_); const size_t old_size_in_bytes = sizeof(NativeT) * count_; - const size_t new_size_in_bytes = sizeof(NativeT) * new_capacity; + const size_t new_size_in_bytes = MultiplyWithOverflowCheck(sizeof(NativeT), + new_capacity); // allocate v8 new ArrayBuffer v8::Local ab = v8::ArrayBuffer::New( From 9c901a5ef0e29f3b999edd3aada313033408600a Mon Sep 17 00:00:00 2001 From: Christian Niederer Date: Wed, 12 Feb 2020 21:07:10 +0100 Subject: [PATCH 047/181] src: add aliased-buffer-overflow abort test Added native extension similar to test/addons/stringbytes-external-exceeded-max. Added an abort test to regression test the non overflow behaviour. PR-URL: https://github.com/nodejs/node/pull/31740 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: Colin Ihrig --- test/abort/common.gypi | 8 ++++++ .../binding.cc | 23 +++++++++++++++ .../binding.gyp | 9 ++++++ .../test-abort-aliased-buffer-overflow.js | 28 +++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 test/abort/common.gypi create mode 100644 test/abort/test_abort-aliased-buffer-overflow/binding.cc create mode 100644 test/abort/test_abort-aliased-buffer-overflow/binding.gyp create mode 100644 test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js diff --git a/test/abort/common.gypi b/test/abort/common.gypi new file mode 100644 index 00000000000000..19396c61856af3 --- /dev/null +++ b/test/abort/common.gypi @@ -0,0 +1,8 @@ +{ + 'defines': [ 'V8_DEPRECATION_WARNINGS=1', 'NODE_WANT_INTERNALS=1' ], + 'conditions': [ + [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { + 'cflags': ['-Wno-cast-function-type'], + }], + ], +} diff --git a/test/abort/test_abort-aliased-buffer-overflow/binding.cc b/test/abort/test_abort-aliased-buffer-overflow/binding.cc new file mode 100644 index 00000000000000..c3bf66061bf0ee --- /dev/null +++ b/test/abort/test_abort-aliased-buffer-overflow/binding.cc @@ -0,0 +1,23 @@ +#include +#include +#include + +#include +#include + +void AllocateAndResizeBuffer( + const v8::FunctionCallbackInfo& args) { + v8::Isolate* isolate = args.GetIsolate(); + int64_t length = args[0].As()->Int64Value(); + + node::AliasedBigUint64Array array{isolate, 0}; + + array.reserve(length); + assert(false); + } + +void init(v8::Local exports) { + NODE_SET_METHOD(exports, + "allocateAndResizeBuffer", + AllocateAndResizeBuffer); +} diff --git a/test/abort/test_abort-aliased-buffer-overflow/binding.gyp b/test/abort/test_abort-aliased-buffer-overflow/binding.gyp new file mode 100644 index 00000000000000..55fbe7050f18e4 --- /dev/null +++ b/test/abort/test_abort-aliased-buffer-overflow/binding.gyp @@ -0,0 +1,9 @@ +{ + 'targets': [ + { + 'target_name': 'binding', + 'sources': [ 'binding.cc' ], + 'includes': ['../common.gypi'], + } + ] +} diff --git a/test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js b/test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js new file mode 100644 index 00000000000000..33cd21295848b9 --- /dev/null +++ b/test/abort/test_abort-aliased-buffer-overflow/test-abort-aliased-buffer-overflow.js @@ -0,0 +1,28 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); + +// This test ensures that during resizing of an Aliased*Array the computation +// of the new size does not overflow. + +if (process.argv[2] === 'child') { + // test + const binding = require(`./build/${common.buildType}/binding`); + + const bigValue = BigInt('0xE000 0000 E000 0000'); + binding.AllocateAndResizeBuffer(bigValue); + assert.fail('this should be unreachable'); +} else { + // observer + const child = cp.spawn(`${process.execPath}`, [`${__filename}`, 'child']); + child.on('exit', common.mustCall(function(code, signal) { + if (common.isWindows) { + assert.strictEqual(code, 134); + assert.strictEqual(signal, null); + } else { + assert.strictEqual(code, null); + assert.strictEqual(signal, 'SIGABRT'); + } + })); +} From 928a49004eb0795b10290010cd940317bf625753 Mon Sep 17 00:00:00 2001 From: Christian Niederer Date: Fri, 14 Feb 2020 21:16:59 +0100 Subject: [PATCH 048/181] src: add test/abort build tasks The Aliased*Array overflow check test introduced a dependency to a compiled artifact. Add this artifact to the build process in a similar fashion as test/addons and test/js-native-api do. PR-URL: https://github.com/nodejs/node/pull/31740 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: Colin Ihrig --- Makefile | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ vcbuild.bat | 30 ++++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 3a97f15fc3c6a4..5eed314c2c7964 100644 --- a/Makefile +++ b/Makefile @@ -292,7 +292,7 @@ v8: tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) .PHONY: jstest -jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests +jstest: build-addons build-abort-tests build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ --skip-tests=$(CI_SKIP_TESTS) \ $(CI_JS_SUITES) \ @@ -316,6 +316,7 @@ test: all ## Runs default tests, linters, and builds docs. $(MAKE) -s tooltest $(MAKE) -s test-doc $(MAKE) -s build-addons + $(MAKE) -s build-abort-tests $(MAKE) -s build-js-native-api-tests $(MAKE) -s build-node-api-tests $(MAKE) -s cctest @@ -324,6 +325,7 @@ test: all ## Runs default tests, linters, and builds docs. .PHONY: test-only test-only: all ## For a quick test, does not run linter or build docs. $(MAKE) build-addons + $(MAKE) build-abort-tests $(MAKE) build-js-native-api-tests $(MAKE) build-node-api-tests $(MAKE) cctest @@ -333,6 +335,7 @@ test-only: all ## For a quick test, does not run linter or build docs. # Used by `make coverage-test` test-cov: all $(MAKE) build-addons + $(MAKE) build-abort-tests $(MAKE) build-js-native-api-tests $(MAKE) build-node-api-tests $(MAKE) cctest @@ -452,6 +455,31 @@ test/node-api/.buildstamp: $(ADDONS_PREREQS) \ # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp +ABORT_BINDING_GYPS := \ + $(filter-out test/abort/??_*/binding.gyp, \ + $(wildcard test/abort/*/binding.gyp)) + +ABORT_BINDING_SOURCES := \ + $(filter-out test/abort/??_*/*.c, $(wildcard test/abort/*/*.c)) \ + $(filter-out test/abort/??_*/*.cc, $(wildcard test/abort/*/*.cc)) \ + $(filter-out test/abort/??_*/*.h, $(wildcard test/abort/*/*.h)) + +# Implicitly depends on $(NODE_EXE), see the build-node-api-tests rule for rationale. +test/abort/.buildstamp: $(ADDONS_PREREQS) \ + $(ABORT_BINDING_GYPS) $(ABORT_BINDING_SOURCES) \ + src/node_api.h src/node_api_types.h src/js_native_api.h \ + src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h + @$(call run_build_addons,"$$PWD/test/abort",$@) + +.PHONY: build-abort-tests +# .buildstamp needs $(NODE_EXE) but cannot depend on it +# directly because it calls make recursively. The parent make cannot know +# if the subprocess touched anything so it pessimistically assumes that +# .buildstamp is out of date and need a rebuild. +# Just goes to show that recursive make really is harmful... +# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update. +build-abort-tests: | $(NODE_EXE) test/abort/.buildstamp + BENCHMARK_NAPI_BINDING_GYPS := $(wildcard benchmark/napi/*/binding.gyp) BENCHMARK_NAPI_BINDING_SOURCES := \ @@ -472,12 +500,14 @@ clear-stalled: echo $${PS_OUT} | xargs kill -9; \ fi -test-build: | all build-addons build-js-native-api-tests build-node-api-tests +test-build: | all build-addons build-abort-tests build-js-native-api-tests build-node-api-tests test-build-js-native-api: all build-js-native-api-tests test-build-node-api: all build-node-api-tests +test-build-abort: all build-abort-tests + .PHONY: test-all test-all: test-build ## Run default tests with both Debug and Release builds. $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release @@ -490,7 +520,7 @@ test-all-suites: | clear-stalled test-build bench-addons-build doc-only ## Run a $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test/* # CI_* variables should be kept synchronized with the ones in vcbuild.bat -CI_NATIVE_SUITES ?= addons js-native-api node-api +CI_NATIVE_SUITES ?= addons js-native-api node-api abort CI_JS_SUITES ?= default ifeq ($(node_use_openssl), false) CI_DOC := doctool @@ -502,7 +532,7 @@ endif # Build and test addons without building anything else # Related CI job: node-test-commit-arm-fanned test-ci-native: LOGLEVEL := info -test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp +test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp test/abort/.buildstamp $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ $(TEST_CI_ARGS) $(CI_NATIVE_SUITES) @@ -524,7 +554,7 @@ test-ci-js: | clear-stalled .PHONY: test-ci # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned test-ci: LOGLEVEL := info -test-ci: | clear-stalled build-addons build-js-native-api-tests build-node-api-tests doc-only +test-ci: | clear-stalled build-addons build-abort-tests build-js-native-api-tests build-node-api-tests doc-only out/Release/cctest --gtest_output=xml:out/junit/cctest.xml $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ @@ -628,8 +658,17 @@ test-node-api-clean: $(RM) -r test/node-api/*/build $(RM) test/node-api/.buildstamp +.PHONY: test-abort +test-abort: test-build-abort + $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test-abort + +.PHONY: test-abort-clean +test-abort-clean: + $(RM) -r test/abort/*/build + $(RM) test/abort/.buildstamp + .PHONY: test-addons -test-addons: test-build test-js-native-api test-node-api +test-addons: test-build test-js-native-api test-node-api test-abort $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons .PHONY: test-addons-clean @@ -639,6 +678,7 @@ test-addons-clean: $(RM) test/addons/.buildstamp test/addons/.docbuildstamp $(MAKE) test-js-native-api-clean $(MAKE) test-node-api-clean + $(MAKE) test-abort-clean test-async-hooks: $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) async-hooks @@ -647,6 +687,7 @@ test-with-async-hooks: $(MAKE) build-addons $(MAKE) build-js-native-api-tests $(MAKE) build-node-api-tests + $(MAKE) build-abort-tests $(MAKE) cctest NODE_TEST_WITH_ASYNC_HOOKS=1 $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ $(CI_JS_SUITES) \ diff --git a/vcbuild.bat b/vcbuild.bat index 561eb535f2965e..4956a4ac2ca482 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -16,11 +16,11 @@ if /i "%1"=="/?" goto help cd %~dp0 @rem CI_* variables should be kept synchronized with the ones in Makefile -set CI_NATIVE_SUITES=addons js-native-api node-api +set CI_NATIVE_SUITES=addons js-native-api node-api abort set CI_JS_SUITES=default set CI_DOC=doctool @rem Same as the test-ci target in Makefile -set "common_test_suites=%CI_JS_SUITES% %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1" +set "common_test_suites=%CI_JS_SUITES% %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1&set build_aborts_tests=1" @rem Process arguments. set config=Release @@ -68,6 +68,7 @@ set openssl_no_asm= set doc= set extra_msbuild_args= set exit_code=0 +set build_aborts_tests= :next-arg if "%1"=="" goto args-done @@ -96,6 +97,8 @@ if /i "%1"=="test-ci-js" set test_args=%test_args% %test_ci_args% -J -p tap - if /i "%1"=="build-addons" set build_addons=1&goto arg-ok if /i "%1"=="build-js-native-api-tests" set build_js_native_api_tests=1&goto arg-ok if /i "%1"=="build-node-api-tests" set build_node_api_tests=1&goto arg-ok +if /i "%1"=="build-abort-tests" set build_abort_tests=1&goto arg-ok +if /i "%1"=="test-abort" set test_args=%test_args% abort&set build_abort_tests=1&goto arg-ok if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok if /i "%1"=="test-js-native-api" set test_args=%test_args% js-native-api&set build_js_native_api_tests=1&goto arg-ok if /i "%1"=="test-node-api" set test_args=%test_args% node-api&set build_node_api_tests=1&goto arg-ok @@ -585,10 +588,10 @@ endlocal goto build-node-api-tests :build-node-api-tests -if not defined build_node_api_tests goto run-tests +if not defined build_node_api_tests goto build-abort-tests if not exist "%node_exe%" ( echo Failed to find node.exe - goto run-tests + goto build-abort-tests ) echo Building node-api :: clear @@ -601,6 +604,25 @@ set npm_config_nodedir=%~dp0 "%node_exe%" "%~dp0tools\build-addons.js" "%~dp0deps\npm\node_modules\node-gyp\bin\node-gyp.js" "%~dp0test\node-api" if errorlevel 1 exit /b 1 endlocal +goto build-abort-tests + +:build-abort-tests +if not defined build_abort_tests goto run-tests +if not exist "%node_exe%" ( + echo Failed to find node.exe + goto run-tests +) +echo Building abort +:: clear +for /d %%F in (test\abort\??_*) do ( + rd /s /q %%F +) +:: building abort +setlocal +set npm_config_nodedir=%~dp0 +"%node_exe%" "%~dp0tools\build-addons.js" "%~dp0deps\npm\node_modules\node-gyp\bin\node-gyp.js" "%~dp0test\abort" +if errorlevel 1 exit /b 1 +endlocal goto run-tests :run-tests From 6d86651076558b7d33cca90bd317108a499ea811 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 24 Feb 2020 13:34:38 -0800 Subject: [PATCH 049/181] util: fix inspecting document.all Fixes: https://github.com/nodejs/node/issues/31889 PR-URL: https://github.com/nodejs/node/pull/31938 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- lib/internal/util/inspect.js | 9 +++++++-- test/parallel/test-util-inspect.js | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index f1300cf640000c..719209b17482f6 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -134,6 +134,9 @@ const builtInObjects = new Set( ObjectGetOwnPropertyNames(global).filter((e) => /^[A-Z][a-zA-Z0-9]+$/.test(e)) ); +// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot +const isUndetectableObject = (v) => typeof v === 'undefined' && v !== undefined; + // These options must stay in sync with `getUserOptions`. So if any option will // be added or removed, `getUserOptions` must also be updated accordingly. const inspectDefaultOptions = ObjectSeal({ @@ -477,7 +480,7 @@ function getEmptyFormatArray() { function getConstructorName(obj, ctx, recurseTimes, protoProps) { let firstProto; const tmp = obj; - while (obj) { + while (obj || isUndetectableObject(obj)) { const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor'); if (descriptor !== undefined && typeof descriptor.value === 'function' && @@ -675,7 +678,9 @@ function findTypedConstructor(value) { // value afterwards again. function formatValue(ctx, value, recurseTimes, typedArray) { // Primitive types cannot have properties. - if (typeof value !== 'object' && typeof value !== 'function') { + if (typeof value !== 'object' && + typeof value !== 'function' && + !isUndetectableObject(value)) { return formatPrimitive(ctx.stylize, value, ctx); } if (value === null) { diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 4850988ba02fd7..40511de44aa89b 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -26,6 +26,7 @@ const { internalBinding } = require('internal/test/binding'); const JSStream = internalBinding('js_stream').JSStream; const util = require('util'); const vm = require('vm'); +const v8 = require('v8'); const { previewEntries } = internalBinding('util'); const { inspect } = util; const { MessageChannel } = require('worker_threads'); @@ -2749,3 +2750,11 @@ assert.strictEqual( assert.deepStrictEqual(colors.gray, originalValue); assert.strictEqual(colors.grey, colors.gray); } + +// https://github.com/nodejs/node/issues/31889 +{ + v8.setFlagsFromString('--allow-natives-syntax'); + const undetectable = vm.runInThisContext('%GetUndetectable()'); + v8.setFlagsFromString('--no-allow-natives-syntax'); + assert.strictEqual(inspect(undetectable), '{}'); +} From 30d55a3517cb64233c8d87f17f199b2cff355abd Mon Sep 17 00:00:00 2001 From: Sk Sajidul Kadir Date: Tue, 17 Mar 2020 00:50:27 +1100 Subject: [PATCH 050/181] fs: add fs.readv() Fixes: https://github.com/nodejs/node/issues/2298 PR-URL: https://github.com/nodejs/node/pull/32356 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- doc/api/fs.md | 56 ++++++++++++++ lib/fs.js | 35 +++++++++ lib/internal/fs/promises.js | 16 ++++ src/node_file.cc | 47 ++++++++++++ test/parallel/test-fs-readv-promises.js | 67 +++++++++++++++++ test/parallel/test-fs-readv-sync.js | 92 +++++++++++++++++++++++ test/parallel/test-fs-readv.js | 97 +++++++++++++++++++++++++ 7 files changed, 410 insertions(+) create mode 100644 test/parallel/test-fs-readv-promises.js create mode 100644 test/parallel/test-fs-readv-sync.js create mode 100644 test/parallel/test-fs-readv.js diff --git a/doc/api/fs.md b/doc/api/fs.md index aea1303e5360d3..d7d8c4d24f9a16 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3080,6 +3080,42 @@ Returns the number of `bytesRead`. For detailed information, see the documentation of the asynchronous version of this API: [`fs.read()`][]. +## `fs.readv(fd, buffers[, position], callback)` + + +* `fd` {integer} +* `buffers` {ArrayBufferView[]} +* `position` {integer} +* `callback` {Function} + * `err` {Error} + * `bytesRead` {integer} + * `buffers` {ArrayBufferView[]} + +Read from a file specified by `fd` and write to an array of `ArrayBufferView`s +using `readv()`. + +`position` is the offset from the beginning of the file from where data +should be read. If `typeof position !== 'number'`, the data will be read +from the current position. + +The callback will be given three arguments: `err`, `bytesRead`, and +`buffers`. `bytesRead` is how many bytes were read from the file. + +## `fs.readvSync(fd, buffers[, position])` + + +* `fd` {integer} +* `buffers` {ArrayBufferView[]} +* `position` {integer} +* Returns: {number} The number of bytes read. + +For detailed information, see the documentation of the asynchronous version of +this API: [`fs.readv()`][]. + ## `fs.realpath(path[, options], callback)` + +* `buffers` {ArrayBufferView[]} +* `position` {integer} +* Returns: {Promise} + +Read from a file and write to an array of `ArrayBufferView`s + +The `Promise` is resolved with an object containing a `bytesRead` property +identifying the number of bytes read, and a `buffers` property containing +a reference to the `buffers` input. + +`position` is the offset from the beginning of the file where this data +should be read from. If `typeof position !== 'number'`, the data will be read +from the current position. + #### `filehandle.stat([options])` /); if (docCreated) { - HTML = HTML.replace('__ALTDOCS__', await altDocs(filename, docCreated)); + HTML = HTML.replace('__ALTDOCS__', altDocs(filename, docCreated, versions)); } else { console.error(`Failed to add alternative version links to ${filename}`); HTML = HTML.replace('__ALTDOCS__', ''); @@ -391,10 +390,9 @@ function getId(text, idCounters) { return text; } -async function altDocs(filename, docCreated) { +function altDocs(filename, docCreated, versions) { const [, docCreatedMajor, docCreatedMinor] = docCreated.map(Number); const host = 'https://nodejs.org'; - const versions = await getVersions.versions(); const getHref = (versionNum) => `${host}/docs/latest-v${versionNum}/api/${filename}.html`; diff --git a/tools/doc/versions.js b/tools/doc/versions.js index bff6ac3617fbde..52f5648ecae92f 100644 --- a/tools/doc/versions.js +++ b/tools/doc/versions.js @@ -1,11 +1,9 @@ 'use strict'; -const { readFileSync } = require('fs'); +const { readFileSync, writeFileSync } = require('fs'); const path = require('path'); const srcRoot = path.join(__dirname, '..', '..'); -let _versions; - const isRelease = () => { const re = /#define NODE_VERSION_IS_RELEASE 0/; const file = path.join(srcRoot, 'src', 'node_version.h'); @@ -15,7 +13,7 @@ const isRelease = () => { const getUrl = (url) => { return new Promise((resolve, reject) => { const https = require('https'); - const request = https.get(url, { timeout: 5000 }, (response) => { + const request = https.get(url, { timeout: 30000 }, (response) => { if (response.statusCode !== 200) { reject(new Error( `Failed to get ${url}, status code ${response.statusCode}`)); @@ -32,45 +30,51 @@ const getUrl = (url) => { }; const kNoInternet = !!process.env.NODE_TEST_NO_INTERNET; +const outFile = (process.argv.length > 2 ? process.argv[2] : undefined); -module.exports = { - async versions() { - if (_versions) { - return _versions; - } - - // The CHANGELOG.md on release branches may not reference newer semver - // majors of Node.js so fetch and parse the version from the master branch. - const url = - 'https://raw.githubusercontent.com/nodejs/node/master/CHANGELOG.md'; - let changelog; - const file = path.join(srcRoot, 'CHANGELOG.md'); - if (kNoInternet) { - changelog = readFileSync(file, { encoding: 'utf8' }); - } else { - try { - changelog = await getUrl(url); - } catch (e) { - // Fail if this is a release build, otherwise fallback to local files. - if (isRelease()) { - throw e; - } else { - console.warn(`Unable to retrieve ${url}. Falling back to ${file}.`); - changelog = readFileSync(file, { encoding: 'utf8' }); - } +async function versions() { + // The CHANGELOG.md on release branches may not reference newer semver + // majors of Node.js so fetch and parse the version from the master branch. + const url = + 'https://raw.githubusercontent.com/nodejs/node/master/CHANGELOG.md'; + let changelog; + const file = path.join(srcRoot, 'CHANGELOG.md'); + if (kNoInternet) { + changelog = readFileSync(file, { encoding: 'utf8' }); + } else { + try { + changelog = await getUrl(url); + } catch (e) { + // Fail if this is a release build, otherwise fallback to local files. + if (isRelease()) { + throw e; + } else { + console.warn(`Unable to retrieve ${url}. Falling back to ${file}.`); + changelog = readFileSync(file, { encoding: 'utf8' }); } } - const ltsRE = /Long Term Support/i; - const versionRE = /\* \[Node\.js ([0-9.]+)\]\S+ (.*)\r?\n/g; - _versions = []; - let match; - while ((match = versionRE.exec(changelog)) != null) { - const entry = { num: `${match[1]}.x` }; - if (ltsRE.test(match[2])) { - entry.lts = true; - } - _versions.push(entry); + } + const ltsRE = /Long Term Support/i; + const versionRE = /\* \[Node\.js ([0-9.]+)\]\S+ (.*)\r?\n/g; + const _versions = []; + let match; + while ((match = versionRE.exec(changelog)) != null) { + const entry = { num: `${match[1]}.x` }; + if (ltsRE.test(match[2])) { + entry.lts = true; } - return _versions; + _versions.push(entry); } -}; + return _versions; +} + +versions().then((v) => { + if (outFile) { + writeFileSync(outFile, JSON.stringify(v)); + } else { + console.log(JSON.stringify(v)); + } +}).catch((err) => { + console.error(err); + process.exit(1); +}); From bc7f819263429dbe61ce8af41082dd0342388c1d Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Thu, 19 Mar 2020 01:49:49 +0200 Subject: [PATCH 075/181] module: path-only CJS exports extension searching PR-URL: https://github.com/nodejs/node/pull/32351 Reviewed-By: Geoffrey Booth Reviewed-By: Bradley Farias Reviewed-By: Jan Krems Reviewed-By: Myles Borins --- doc/api/esm.md | 2 +- doc/api/modules.md | 70 ++++------ lib/internal/modules/cjs/loader.js | 130 +++++++----------- test/es-module/test-esm-exports.mjs | 38 +++-- .../node_modules/pkgexports/package.json | 4 +- .../pkgexports/subpath/dir1/dir1.js | 1 + .../pkgexports/subpath/dir1/package.json | 3 + .../pkgexports/subpath/dir2/index.js | 1 + .../node_modules/pkgexports/subpath/file.js | 2 + 9 files changed, 122 insertions(+), 129 deletions(-) create mode 100644 test/fixtures/node_modules/pkgexports/subpath/dir1/dir1.js create mode 100644 test/fixtures/node_modules/pkgexports/subpath/dir1/package.json create mode 100644 test/fixtures/node_modules/pkgexports/subpath/dir2/index.js create mode 100644 test/fixtures/node_modules/pkgexports/subpath/file.js diff --git a/doc/api/esm.md b/doc/api/esm.md index fc0138babebd5f..101f82b2d98f6f 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1635,7 +1635,7 @@ The resolver can throw the following errors: > 1. If _exports_ contains any index property keys, as defined in ECMA-262 > [6.1.7 Array Index][], throw an _Invalid Package Configuration_ error. > 1. For each property _p_ of _target_, in object insertion order as, -> 1. If _env_ contains an entry for _p_, then +> 1. If _p_ equals _"default"_ or _env_ contains an entry for _p_, then > 1. Let _targetValue_ be the value of the _p_ property in _target_. > 1. Return the result of **PACKAGE_EXPORTS_TARGET_RESOLVE**( > _packageURL_, _targetValue_, _subpath_, _env_), continuing the diff --git a/doc/api/modules.md b/doc/api/modules.md index 9587e2ef0d38e5..57d36392188058 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -165,7 +165,7 @@ require(X) from module at path Y 6. THROW "not found" LOAD_AS_FILE(X) -1. If X is a file, load X as JavaScript text. STOP +1. If X is a file, load X as its file extension format. STOP 2. If X.js is a file, load X.js as JavaScript text. STOP 3. If X.json is a file, parse X.json to a JavaScript Object. STOP 4. If X.node is a file, load X.node as binary addon. STOP @@ -189,8 +189,9 @@ LOAD_AS_DIRECTORY(X) LOAD_NODE_MODULES(X, START) 1. let DIRS = NODE_MODULES_PATHS(START) 2. for each DIR in DIRS: - a. LOAD_AS_FILE(DIR/X) - b. LOAD_AS_DIRECTORY(DIR/X) + a. LOAD_PACKAGE_EXPORTS(DIR, X) + b. LOAD_AS_FILE(DIR/X) + c. LOAD_AS_DIRECTORY(DIR/X) NODE_MODULES_PATHS(START) 1. let PARTS = path split(START) @@ -208,50 +209,35 @@ LOAD_SELF_REFERENCE(X, START) 2. If no scope was found, return. 3. If the `package.json` has no "exports", return. 4. If the name in `package.json` isn't a prefix of X, throw "not found". -5. 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 -`LOAD_NODE_MODULES` to explicitly declare which file paths to expose and how -they should be interpreted. This expands on the control packages already had -using the `main` field. - -With this feature enabled, the `LOAD_NODE_MODULES` changes are: +5. Otherwise, load the remainder of X relative to this package as if it + was loaded via `LOAD_NODE_MODULES` with a name in `package.json`. -```txt -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) - b. LOAD_AS_FILE(FILE_PATH) - c. LOAD_AS_DIRECTORY(FILE_PATH) - -RESOLVE_BARE_SPECIFIER(DIR, X) +LOAD_PACKAGE_EXPORTS(DIR, X) 1. Try to interpret X as a combination of name and subpath where the name may have a @scope/ prefix and the subpath begins with a slash (`/`). -2. If X matches this pattern and DIR/name/package.json is a file: - a. Parse DIR/name/package.json, and look for "exports" field. - b. If "exports" is null or undefined, GOTO 3. - c. If "exports" is an object with some keys starting with "." and some keys - not starting with ".", throw "invalid config". - d. If "exports" is a string, or object with no keys starting with ".", treat - it as having that value as its "." object property. - e. If subpath is "." and "exports" does not have a "." entry, GOTO 3. - f. Find the longest key in "exports" that the subpath starts with. - g. If no such key can be found, throw "not found". - h. let RESOLVED_URL = - PACKAGE_EXPORTS_TARGET_RESOLVE(pathToFileURL(DIR/name), exports[key], - subpath.slice(key.length), ["node", "require"]), as defined in the ESM - resolver. - i. return fileURLToPath(RESOLVED_URL) -3. return DIR/X +2. If X does not match this pattern or DIR/name/package.json is not a file, + return. +3. Parse DIR/name/package.json, and look for "exports" field. +4. If "exports" is null or undefined, return. +5. If "exports" is an object with some keys starting with "." and some keys + not starting with ".", throw "invalid config". +6. If "exports" is a string, or object with no keys starting with ".", treat + it as having that value as its "." object property. +7. If subpath is "." and "exports" does not have a "." entry, return. +8. Find the longest key in "exports" that the subpath starts with. +9. If no such key can be found, throw "not found". +10. let RESOLVED = + fileURLToPath(PACKAGE_EXPORTS_TARGET_RESOLVE(pathToFileURL(DIR/name), + exports[key], subpath.slice(key.length), ["node", "require"])), as defined + in the ESM resolver. +11. If key ends with "/": + a. LOAD_AS_FILE(RESOLVED) + b. LOAD_AS_DIRECTORY(RESOLVED) +12. Otherwise + a. If RESOLVED is a file, load it as its file extension format. STOP +13. Throw "not found" ``` -`"exports"` is only honored when loading a package "name" as defined above. Any -`"exports"` values within nested directories and packages must be declared by -the `package.json` responsible for the "name". - ## Caching diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 92551236dc0aa4..1d89698a7cfe24 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -34,6 +34,7 @@ const { ObjectKeys, ObjectPrototypeHasOwnProperty, ReflectSet, + RegExpPrototypeTest, SafeMap, String, StringPrototypeIndexOf, @@ -121,7 +122,7 @@ function enrichCJSError(err) { after a comment block and/or after a variable definition. */ if (err.message.startsWith('Unexpected token \'export\'') || - (/^\s*import(?=[ {'"*])\s*(?![ (])/).test(lineWithErr)) { + (RegExpPrototypeTest(/^\s*import(?=[ {'"*])\s*(?![ (])/, lineWithErr))) { process.emitWarning( 'To load an ES module, set "type": "module" in the package.json or use ' + 'the .mjs extension.', @@ -348,10 +349,11 @@ const realpathCache = new Map(); // absolute realpath. function tryFile(requestPath, isMain) { const rc = stat(requestPath); + if (rc !== 0) return; if (preserveSymlinks && !isMain) { - return rc === 0 && path.resolve(requestPath); + return path.resolve(requestPath); } - return rc === 0 && toRealPath(requestPath); + return toRealPath(requestPath); } function toRealPath(requestPath) { @@ -388,52 +390,7 @@ 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 = ObjectKeys(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 = ObjectKeys(Module._extensions); - filename = tryPackage(basePath, exts, isMain, request); - } - - return filename; -} - -function trySelf(parentPath, isMain, request) { +function trySelf(parentPath, request) { const { data: pkg, path: basePath } = readPackageScope(parentPath) || {}; if (!pkg || pkg.exports === undefined) return false; if (typeof pkg.name !== 'string') return false; @@ -447,20 +404,11 @@ function trySelf(parentPath, isMain, request) { return false; } - const exts = ObjectKeys(Module._extensions); const fromExports = applyExports(basePath, expansion); - // Use exports if (fromExports) { - let trailingSlash = request.length > 0 && - request.charCodeAt(request.length - 1) === CHAR_FORWARD_SLASH; - if (!trailingSlash) { - trailingSlash = /(?:^|\/)\.?\.$/.test(request); - } - return resolveBasePath(fromExports, exts, isMain, trailingSlash, request); - } else { - // Use main field - return tryPackage(basePath, exts, isMain, request); + return tryFile(fromExports, false); } + assert(fromExports !== false); } function isConditionalDotExportSugar(exports, basePath) { @@ -492,7 +440,7 @@ function applyExports(basePath, expansion) { let pkgExports = readPackageExports(basePath); if (pkgExports === undefined || pkgExports === null) - return path.resolve(basePath, mappingKey); + return false; if (isConditionalDotExportSugar(pkgExports, basePath)) pkgExports = { '.': pkgExports }; @@ -516,8 +464,24 @@ function applyExports(basePath, expansion) { if (dirMatch !== '') { const mapping = pkgExports[dirMatch]; const subpath = StringPrototypeSlice(mappingKey, dirMatch.length); - return resolveExportsTarget(pathToFileURL(basePath + '/'), mapping, - subpath, mappingKey); + const resolved = resolveExportsTarget(pathToFileURL(basePath + '/'), + mapping, subpath, mappingKey); + // Extension searching for folder exports only + const rc = stat(resolved); + if (rc === 0) return resolved; + if (!(RegExpPrototypeTest(trailingSlashRegex, resolved))) { + const exts = ObjectKeys(Module._extensions); + const filename = tryExtensions(resolved, exts, false); + if (filename) return filename; + } + if (rc === 1) { + const exts = ObjectKeys(Module._extensions); + const filename = tryPackage(resolved, exts, false, + basePath + expansion); + if (filename) return filename; + } + // Undefined means not found + return; } } @@ -528,20 +492,20 @@ function applyExports(basePath, expansion) { // 1. name/.* // 2. @scope/name/.* const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/; -function resolveExports(nmPath, request, absoluteRequest) { +function resolveExports(nmPath, request) { // The implementation's behavior is meant to mirror resolution in ESM. - if (!absoluteRequest) { - const [, name, expansion = ''] = - StringPrototypeMatch(request, EXPORTS_PATTERN) || []; - if (!name) { - return path.resolve(nmPath, request); - } - - const basePath = path.resolve(nmPath, name); - return applyExports(basePath, expansion); + const [, name, expansion = ''] = + StringPrototypeMatch(request, EXPORTS_PATTERN) || []; + if (!name) { + return false; } - return path.resolve(nmPath, request); + const basePath = path.resolve(nmPath, name); + const fromExports = applyExports(basePath, expansion); + if (fromExports) { + return tryFile(fromExports, false); + } + return fromExports; } function isArrayIndex(p) { @@ -632,6 +596,7 @@ function resolveExportsTarget(baseUrl, target, subpath, mappingKey) { StringPrototypeSlice(baseUrl.pathname, 0, -1), mappingKey, subpath, target); } +const trailingSlashRegex = /(?:^|\/)\.?\.$/; Module._findPath = function(request, paths, isMain) { const absoluteRequest = path.isAbsolute(request); if (absoluteRequest) { @@ -650,7 +615,7 @@ Module._findPath = function(request, paths, isMain) { let trailingSlash = request.length > 0 && request.charCodeAt(request.length - 1) === CHAR_FORWARD_SLASH; if (!trailingSlash) { - trailingSlash = /(?:^|\/)\.?\.$/.test(request); + trailingSlash = RegExpPrototypeTest(trailingSlashRegex, request); } // For each path @@ -658,7 +623,18 @@ Module._findPath = function(request, paths, isMain) { // Don't search further if path doesn't exist const curPath = paths[i]; if (curPath && stat(curPath) < 1) continue; - const basePath = resolveExports(curPath, request, absoluteRequest); + + if (!absoluteRequest) { + const exportsResolved = resolveExports(curPath, request); + // Undefined means not found, false means no exports + if (exportsResolved === undefined) + break; + if (exportsResolved) { + return exportsResolved; + } + } + + const basePath = path.resolve(curPath, request); let filename; const rc = stat(basePath); @@ -950,7 +926,7 @@ Module._resolveFilename = function(request, parent, isMain, options) { } if (parent && parent.filename) { - const filename = trySelf(parent.filename, isMain, request); + const filename = trySelf(parent.filename, request); if (filename) { const cacheKey = request + '\x00' + (paths.length === 1 ? paths[0] : paths.join('\x00')); diff --git a/test/es-module/test-esm-exports.mjs b/test/es-module/test-esm-exports.mjs index 9003c119bc9447..f71e2172951843 100644 --- a/test/es-module/test-esm-exports.mjs +++ b/test/es-module/test-esm-exports.mjs @@ -35,6 +35,14 @@ import fromInside from '../fixtures/node_modules/pkgexports/lib/hole.js'; ['pkgexports-sugar', { default: 'main' }], ]); + if (isRequire) { + validSpecifiers.set('pkgexports/subpath/file', { default: 'file' }); + validSpecifiers.set('pkgexports/subpath/dir1', { default: 'main' }); + validSpecifiers.set('pkgexports/subpath/dir1/', { default: 'main' }); + validSpecifiers.set('pkgexports/subpath/dir2', { default: 'index' }); + validSpecifiers.set('pkgexports/subpath/dir2/', { default: 'index' }); + } + for (const [validSpecifier, expected] of validSpecifiers) { if (validSpecifier === null) continue; @@ -118,14 +126,28 @@ import fromInside from '../fixtures/node_modules/pkgexports/lib/hole.js'; })); } - // Covering out bases - not a file is still not a file after dir mapping. - loadFixture('pkgexports/sub/not-a-file.js').catch(mustCall((err) => { - strictEqual(err.code, (isRequire ? '' : 'ERR_') + 'MODULE_NOT_FOUND'); - // ESM returns a full file path - assertStartsWith(err.message, isRequire ? - 'Cannot find module \'pkgexports/sub/not-a-file.js\'' : - 'Cannot find module'); - })); + const notFoundExports = new Map([ + // Non-existing file + ['pkgexports/sub/not-a-file.js', 'pkgexports/sub/not-a-file.js'], + // No extension lookups + ['pkgexports/no-ext', 'pkgexports/no-ext'], + ]); + + if (!isRequire) { + notFoundExports.set('pkgexports/subpath/file', 'pkgexports/subpath/file'); + notFoundExports.set('pkgexports/subpath/dir1', 'pkgexports/subpath/dir1'); + notFoundExports.set('pkgexports/subpath/dir2', 'pkgexports/subpath/dir2'); + } + + for (const [specifier, request] of notFoundExports) { + loadFixture(specifier).catch(mustCall((err) => { + strictEqual(err.code, (isRequire ? '' : 'ERR_') + 'MODULE_NOT_FOUND'); + // ESM returns a full file path + assertStartsWith(err.message, isRequire ? + `Cannot find module '${request}'` : + 'Cannot find module'); + })); + } // The use of %2F escapes in paths fails loading loadFixture('pkgexports/sub/..%2F..%2Fbar.js').catch(mustCall((err) => { diff --git a/test/fixtures/node_modules/pkgexports/package.json b/test/fixtures/node_modules/pkgexports/package.json index 7f417ad5457bfc..200c028f88c9d3 100644 --- a/test/fixtures/node_modules/pkgexports/package.json +++ b/test/fixtures/node_modules/pkgexports/package.json @@ -32,6 +32,7 @@ "nomatch": "./nothing.js" } }], + "./no-ext": "./asdf", "./resolve-self": { "require": "./resolve-self.js", "import": "./resolve-self.mjs" @@ -39,6 +40,7 @@ "./resolve-self-invalid": { "require": "./resolve-self-invalid.js", "import": "./resolve-self-invalid.mjs" - } + }, + "./subpath/": "./subpath/" } } diff --git a/test/fixtures/node_modules/pkgexports/subpath/dir1/dir1.js b/test/fixtures/node_modules/pkgexports/subpath/dir1/dir1.js new file mode 100644 index 00000000000000..dfdd47b877319c --- /dev/null +++ b/test/fixtures/node_modules/pkgexports/subpath/dir1/dir1.js @@ -0,0 +1 @@ +module.exports = 'main'; diff --git a/test/fixtures/node_modules/pkgexports/subpath/dir1/package.json b/test/fixtures/node_modules/pkgexports/subpath/dir1/package.json new file mode 100644 index 00000000000000..ca1584ec6fe659 --- /dev/null +++ b/test/fixtures/node_modules/pkgexports/subpath/dir1/package.json @@ -0,0 +1,3 @@ +{ + "main": "dir1" +} diff --git a/test/fixtures/node_modules/pkgexports/subpath/dir2/index.js b/test/fixtures/node_modules/pkgexports/subpath/dir2/index.js new file mode 100644 index 00000000000000..d17bd0f1e9ba0f --- /dev/null +++ b/test/fixtures/node_modules/pkgexports/subpath/dir2/index.js @@ -0,0 +1 @@ +module.exports = 'index'; diff --git a/test/fixtures/node_modules/pkgexports/subpath/file.js b/test/fixtures/node_modules/pkgexports/subpath/file.js new file mode 100644 index 00000000000000..1485f701f49e67 --- /dev/null +++ b/test/fixtures/node_modules/pkgexports/subpath/file.js @@ -0,0 +1,2 @@ +module.exports = 'file'; + From 9ee2afa0f7ce9b671b00db8e05102654a099ea61 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Mon, 23 Mar 2020 20:07:29 +0800 Subject: [PATCH 076/181] doc: add ASAN build instructions PR-URL: https://github.com/nodejs/node/pull/32436 Reviewed-By: James M Snell Reviewed-By: Matheus Marchini --- BUILDING.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 469a4f9281db88..70b405133ba082 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -28,6 +28,7 @@ file a new issue. * [Running Coverage](#running-coverage) * [Building the documentation](#building-the-documentation) * [Building a debug build](#building-a-debug-build) + * [Building an ASAN build](#building-an-asan-build) * [Troubleshooting Unix and macOS builds](#troubleshooting-unix-and-macos-builds) * [Windows](#windows) * [Prerequisites](#prerequisites) @@ -490,6 +491,22 @@ $ gdb /opt/node-debug/node core.node.8.1535359906 $ backtrace ``` +#### Building an ASAN build + +[ASAN](https://github.com/google/sanitizers) can help detect various memory +related bugs. ASAN builds are currently only supported on linux. +If you want to check it on Windows or macOS or you want a consistent toolchain +on Linux, you can try [Docker](https://www.docker.com/products/docker-desktop) + (using an image like `gengjiawen/node-build:2020-02-14`). + +The `--debug` is not necessary and will slow down build and testing, but it can +show clear stacktrace if ASAN hits an issue. + +``` console +$ ./configure --debug --enable-asan && make -j4 +$ make test-only +``` + #### Troubleshooting Unix and macOS builds Stale builds can sometimes result in `file not found` errors while building. From 3c8bf9022a805234f9172a57e88dab6ce8ba354d Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 25 Mar 2020 22:03:42 +0100 Subject: [PATCH 077/181] net: wait for shutdown to complete before closing When not allowing half open, handle.close would be invoked before shutdown has been called and completed causing a potential data race. Fixes: https://github.com/nodejs/node/issues/32486#issuecomment-604072559 PR-URL: https://github.com/nodejs/node/pull/32491 Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca --- lib/internal/stream_base_commons.js | 10 +++++++++ lib/net.js | 6 +++--- test/async-hooks/test-graph.tls-write.js | 4 +--- test/parallel/test-net-allow-half-open.js | 25 +++++++++++++++++++++++ 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 test/parallel/test-net-allow-half-open.js diff --git a/lib/internal/stream_base_commons.js b/lib/internal/stream_base_commons.js index 800ba4cefd6370..2a31221f11d2d6 100644 --- a/lib/internal/stream_base_commons.js +++ b/lib/internal/stream_base_commons.js @@ -213,6 +213,16 @@ function onStreamRead(arrayBuffer) { if (stream[kMaybeDestroy]) stream.on('end', stream[kMaybeDestroy]); + // TODO(ronag): Without this `readStop`, `onStreamRead` + // will be called once more (i.e. after Readable.ended) + // on Windows causing a ECONNRESET, failing the + // test-https-truncate test. + if (handle.readStop) { + const err = handle.readStop(); + if (err) + return stream.destroy(errnoException(err, 'read')); + } + // Push a null to signal the end of data. // Do it before `maybeDestroy` for correct order of events: // `end` -> `close` diff --git a/lib/net.js b/lib/net.js index 67e38497e6f885..fa6574c183e48e 100644 --- a/lib/net.js +++ b/lib/net.js @@ -631,9 +631,9 @@ function onReadableStreamEnd() { this.write = writeAfterFIN; if (this.writable) this.end(); - } - - if (!this.destroyed && !this.writable && !this.writableLength) + else if (!this.writableLength) + this.destroy(); + } else if (!this.destroyed && !this.writable && !this.writableLength) this.destroy(); } diff --git a/test/async-hooks/test-graph.tls-write.js b/test/async-hooks/test-graph.tls-write.js index f8bee6a879d0b4..078dd27c36088c 100644 --- a/test/async-hooks/test-graph.tls-write.js +++ b/test/async-hooks/test-graph.tls-write.js @@ -65,9 +65,7 @@ function onexit() { { type: 'TCPCONNECTWRAP', id: 'tcpconnect:1', triggerAsyncId: 'tcp:1' }, { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, - { type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' }, - { type: 'Immediate', id: 'immediate:1', triggerAsyncId: 'tcp:2' }, - { type: 'Immediate', id: 'immediate:2', triggerAsyncId: 'tcp:1' }, + { type: 'TLSWRAP', id: 'tls:2', triggerAsyncId: 'tcpserver:1' } ] ); } diff --git a/test/parallel/test-net-allow-half-open.js b/test/parallel/test-net-allow-half-open.js new file mode 100644 index 00000000000000..8f68c0105a15dc --- /dev/null +++ b/test/parallel/test-net-allow-half-open.js @@ -0,0 +1,25 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); + +const server = net.createServer(common.mustCall((socket) => { + socket.end(Buffer.alloc(1024)); +})).listen(0, common.mustCall(() => { + const socket = net.connect(server.address().port); + assert.strictEqual(socket.allowHalfOpen, false); + socket.resume(); + socket.on('end', common.mustCall(() => { + process.nextTick(() => { + // Ensure socket is not destroyed straight away + // without proper shutdown. + assert(!socket.destroyed); + server.close(); + }); + })); + socket.on('finish', common.mustCall(() => { + assert(!socket.destroyed); + })); + socket.on('close', common.mustCall()); +})); From ca2662012eb157ec97885840f869201ca998c937 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Tue, 31 Mar 2020 18:23:15 -0400 Subject: [PATCH 078/181] test: add test-worker-prof to the SLOW list for debug Consistently failing on ubuntu1804_sharedlibs_debug_x64 Refs: https://github.com/nodejs/node/issues/26401 PR-URL: https://github.com/nodejs/node/pull/32589 Reviewed-By: Richard Lau Reviewed-By: Gireesh Punathil Reviewed-By: Sam Roberts --- test/root.status | 1 + 1 file changed, 1 insertion(+) diff --git a/test/root.status b/test/root.status index 43e4aea29d9c4c..85d907b1f9cc07 100644 --- a/test/root.status +++ b/test/root.status @@ -153,6 +153,7 @@ sequential/test-inspector-port-cluster: SLOW sequential/test-net-bytes-per-incoming-chunk-overhead: SLOW sequential/test-pipe: SLOW sequential/test-util-debug: SLOW +sequential/test-worker-prof: SLOW [$type==coverage] async-hooks/test-callback-error: PASS,FAIL,CRASH From 28077a01cc096953c5af10b2f98c97a34e253924 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 1 Apr 2020 02:49:54 -0400 Subject: [PATCH 079/181] test: mark test-http2-reset-flood flaky on bsd This test is somewhat regularly flaky on 12.x and it appears master as well. There appears to be an issue tracking flakes for 6+ months. Seems reasonable to mark this to keep us from having red CI. Refs: https://github.com/nodejs/node/issues/29802 PR-URL: https://github.com/nodejs/node/pull/32595 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig --- test/parallel/parallel.status | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index bfe88f9720d968..6c3158a650023d 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -49,6 +49,8 @@ test-crypto-keygen: SKIP [$system==freebsd] # https://github.com/nodejs/node/issues/31727 test-fs-stat-bigint: PASS,FLAKY +# https://github.com/nodejs/node/issues/29802 +test-http2-reset-flood: PASS,FLAKY [$system==aix] From 3417cc57775fd80a077582b4a4ae320676643e23 Mon Sep 17 00:00:00 2001 From: Hassaan Pasha Date: Tue, 31 Mar 2020 18:04:58 +0500 Subject: [PATCH 080/181] deps: upgrade openssl sources to 1.1.1f MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates all sources in deps/openssl/openssl by: $ cd deps/openssl/ $ rm -rf openssl $ tar zxf ~/tmp/openssl-1.1.1f.tar.gz $ mv openssl-1.1.0h openssl $ git add --all openssl $ git commit openssl PR-URL: https://github.com/nodejs/node/pull/32583 Reviewed-By: Sam Roberts Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- deps/openssl/openssl/CHANGES | 18 ++ .../openssl/Configurations/unix-Makefile.tmpl | 200 ++++++++--------- deps/openssl/openssl/NEWS | 6 + deps/openssl/openssl/README | 4 +- deps/openssl/openssl/apps/rehash.c | 14 +- deps/openssl/openssl/apps/s_server.c | 4 +- deps/openssl/openssl/crypto/bn/bn_local.h | 5 +- deps/openssl/openssl/crypto/bn/bn_prime.c | 201 ++++++------------ deps/openssl/openssl/crypto/conf/conf_lib.c | 8 +- deps/openssl/openssl/crypto/err/openssl.txt | 1 - deps/openssl/openssl/crypto/ex_data.c | 6 +- deps/openssl/openssl/crypto/pkcs12/p12_crt.c | 5 +- deps/openssl/openssl/crypto/ts/ts_rsp_sign.c | 5 +- .../openssl/openssl/crypto/ts/ts_rsp_verify.c | 10 +- deps/openssl/openssl/crypto/x509/x509_cmp.c | 9 +- deps/openssl/openssl/crypto/x509/x509_trs.c | 7 +- deps/openssl/openssl/crypto/x509/x509_vfy.c | 10 +- deps/openssl/openssl/crypto/x509/x_all.c | 8 +- deps/openssl/openssl/crypto/x509/x_crl.c | 37 ++-- deps/openssl/openssl/crypto/x509v3/v3_purp.c | 97 ++++++--- .../openssl/doc/man3/BN_generate_prime.pod | 10 +- .../openssl/doc/man3/SSL_get_error.pod | 14 +- .../doc/man3/X509_get_extension_flags.pod | 13 +- deps/openssl/openssl/include/crypto/bn_conf.h | 1 - .../openssl/openssl/include/crypto/dso_conf.h | 1 - .../openssl/include/openssl/opensslconf.h | 1 - .../openssl/include/openssl/opensslv.h | 6 +- deps/openssl/openssl/include/openssl/sslerr.h | 1 - .../openssl/openssl/ssl/record/rec_layer_s3.c | 6 - deps/openssl/openssl/ssl/ssl_err.c | 4 +- 30 files changed, 367 insertions(+), 345 deletions(-) delete mode 100644 deps/openssl/openssl/include/crypto/bn_conf.h delete mode 100644 deps/openssl/openssl/include/crypto/dso_conf.h delete mode 100644 deps/openssl/openssl/include/openssl/opensslconf.h diff --git a/deps/openssl/openssl/CHANGES b/deps/openssl/openssl/CHANGES index 0250e4ef026bf7..f4230aaac03185 100644 --- a/deps/openssl/openssl/CHANGES +++ b/deps/openssl/openssl/CHANGES @@ -7,6 +7,24 @@ https://github.com/openssl/openssl/commits/ and pick the appropriate release branch. + Changes between 1.1.1e and 1.1.1f [31 Mar 2020] + + *) Revert the change of EOF detection while reading in libssl to avoid + regressions in applications depending on the current way of reporting + the EOF. As the existing method is not fully accurate the change to + reporting the EOF via SSL_ERROR_SSL is kept on the current development + branch and will be present in the 3.0 release. + [Tomas Mraz] + + *) Revised BN_generate_prime_ex to not avoid factors 3..17863 in p-1 + when primes for RSA keys are computed. + Since we previously always generated primes == 2 (mod 3) for RSA keys, + the 2-prime and 3-prime RSA modules were easy to distinguish, since + N = p*q = 1 (mod 3), but N = p*q*r = 2 (mod 3). Therefore fingerprinting + 2-prime vs. 3-prime RSA keys was possible by computing N mod 3. + This avoids possible fingerprinting of newly generated RSA modules. + [Bernd Edlinger] + Changes between 1.1.1d and 1.1.1e [17 Mar 2020] *) Properly detect EOF while reading in libssl. Previously if we hit an EOF while reading in libssl then we would report an error back to the diff --git a/deps/openssl/openssl/Configurations/unix-Makefile.tmpl b/deps/openssl/openssl/Configurations/unix-Makefile.tmpl index 9bf54f21277fcb..3a24d551359bd0 100644 --- a/deps/openssl/openssl/Configurations/unix-Makefile.tmpl +++ b/deps/openssl/openssl/Configurations/unix-Makefile.tmpl @@ -547,78 +547,78 @@ uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev install_docs: install_man_docs install_html_docs uninstall_docs: uninstall_man_docs uninstall_html_docs - $(RM) -r $(DESTDIR)$(DOCDIR) + $(RM) -r "$(DESTDIR)$(DOCDIR)" install_ssldirs: - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs" + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private" + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc" @set -e; for x in dummy $(MISC_SCRIPTS); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ x1=`echo "$$x" | cut -f1 -d:`; \ x2=`echo "$$x" | cut -f2 -d:`; \ fn=`basename $$x1`; \ $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ - cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ - chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ - mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ - $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ + cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ + chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ + mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \ + "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ if [ "$$x1" != "$$x2" ]; then \ ln=`basename "$$x2"`; \ : {- output_off() unless windowsdll(); "" -}; \ $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ - cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ + cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ : {- output_on() unless windowsdll(); output_off() if windowsdll(); "" -}; \ $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ - ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ + ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ : {- output_on() if windowsdll(); "" -}; \ fi; \ done @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" - @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new - @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new - @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist + @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" + @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" + @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ - cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ - chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ + cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ + chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ fi @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" - @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new - @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new - @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist + @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" + @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" + @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ - cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ - chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ + cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ + chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ fi install_dev: install_runtime_libs @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) @$(ECHO) "*** Installing development files" - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl" @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" - @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c - @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c + @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" + @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @set -e; for i in $(SRCDIR)/include/openssl/*.h \ $(BLDDIR)/include/openssl/*.h; do \ fn=`basename $$i`; \ $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ - cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ - chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ + cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ + chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ done - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" @set -e; for l in $(INSTALL_LIBS); do \ fn=`basename $$l`; \ $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ - cp $$l $(DESTDIR)$(libdir)/$$fn.new; \ - $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \ - chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \ - mv -f $(DESTDIR)$(libdir)/$$fn.new \ - $(DESTDIR)$(libdir)/$$fn; \ + cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \ + $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \ + chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \ + mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ + "$(DESTDIR)$(libdir)/$$fn"; \ done @ : {- output_off() if $disabled{shared}; "" -} @set -e; for s in $(INSTALL_SHLIB_INFO); do \ @@ -629,61 +629,61 @@ install_dev: install_runtime_libs : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \ if [ "$$fn1" != "$$fn2" ]; then \ $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ - ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \ + ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \ fi; \ : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \ $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \ - cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \ - chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \ - mv -f $(DESTDIR)$(libdir)/$$fn2.new \ - $(DESTDIR)$(libdir)/$$fn2; \ + cp $$s2 "$(DESTDIR)$(libdir)/$$fn2.new"; \ + chmod 755 "$(DESTDIR)$(libdir)/$$fn2.new"; \ + mv -f "$(DESTDIR)$(libdir)/$$fn2.new" \ + "$(DESTDIR)$(libdir)/$$fn2"; \ : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \ - a=$(DESTDIR)$(libdir)/$$fn2; \ + a="$(DESTDIR)$(libdir)/$$fn2"; \ $(ECHO) "install $$s1 -> $$a"; \ - if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ + if [ -f "$$a" ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ - cp -f $$a $$a.new; \ - for so in `$(AR) t $$a`; do \ - $(AR) x $$a $$so; \ - chmod u+w $$so; \ - strip -X32_64 -e $$so; \ - $(AR) r $$a.new $$so; \ + cp -f "$$a" "$$a.new"; \ + for so in `$(AR) t "$$a"`; do \ + $(AR) x "$$a" "$$so"; \ + chmod u+w "$$so"; \ + strip -X32_64 -e "$$so"; \ + $(AR) r "$$a.new" "$$so"; \ done; \ )); fi; \ - $(AR) r $$a.new $$s1; \ - mv -f $$a.new $$a; \ + $(AR) r "$$a.new" "$$s1"; \ + mv -f "$$a.new" "$$a"; \ : {- output_off() if sharedaix(); output_on(); "" -}; \ done @ : {- output_on() if $disabled{shared}; "" -} - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)/pkgconfig" @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" - @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig - @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc + @cp libcrypto.pc "$(DESTDIR)$(libdir)/pkgconfig" + @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc" - @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig - @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc + @cp libssl.pc "$(DESTDIR)$(libdir)/pkgconfig" + @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc" @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc" - @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig - @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc + @cp openssl.pc "$(DESTDIR)$(libdir)/pkgconfig" + @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc" uninstall_dev: uninstall_runtime_libs @$(ECHO) "*** Uninstalling development files" @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" - @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c + @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @set -e; for i in $(SRCDIR)/include/openssl/*.h \ $(BLDDIR)/include/openssl/*.h; do \ fn=`basename $$i`; \ $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ - $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ + $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ done - -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl - -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include + -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl" + -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include" @set -e; for l in $(INSTALL_LIBS); do \ fn=`basename $$l`; \ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ - $(RM) $(DESTDIR)$(libdir)/$$fn; \ + $(RM) "$(DESTDIR)$(libdir)/$$fn"; \ done @ : {- output_off() if $disabled{shared}; "" -} @set -e; for s in $(INSTALL_SHLIB_INFO); do \ @@ -693,35 +693,35 @@ uninstall_dev: uninstall_runtime_libs fn2=`basename $$s2`; \ : {- output_off() if windowsdll(); "" -}; \ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ - $(RM) $(DESTDIR)$(libdir)/$$fn2; \ + $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ - $(RM) $(DESTDIR)$(libdir)/$$fn1; \ + $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \ fi; \ : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ - $(RM) $(DESTDIR)$(libdir)/$$fn2; \ + $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ : {- output_on() unless windowsdll(); "" -}; \ done @ : {- output_on() if $disabled{shared}; "" -} - $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc - $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc - $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc - -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig - -$(RMDIR) $(DESTDIR)$(libdir) + $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" + $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc" + $(RM) "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc" + -$(RMDIR) "$(DESTDIR)$(libdir)/pkgconfig" + -$(RMDIR) "$(DESTDIR)$(libdir)" install_engines: install_runtime_libs build_engines @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/" @$(ECHO) "*** Installing engines" @set -e; for e in dummy $(INSTALL_ENGINES); do \ if [ "$$e" = "dummy" ]; then continue; fi; \ fn=`basename $$e`; \ $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ - cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ - chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ - mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \ - $(DESTDIR)$(ENGINESDIR)/$$fn; \ + cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ + chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ + mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \ + "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ done uninstall_engines: @@ -733,18 +733,18 @@ uninstall_engines: continue; \ fi; \ $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ - $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \ + $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ done - -$(RMDIR) $(DESTDIR)$(ENGINESDIR) + -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)" install_runtime: install_programs install_runtime_libs: build_libs @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) @ : {- output_off() if windowsdll(); "" -} - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin" @ : {- output_on() unless windowsdll(); "" -} @$(ECHO) "*** Installing runtime libraries" @set -e; for s in dummy $(INSTALL_SHLIBS); do \ @@ -752,40 +752,40 @@ install_runtime_libs: build_libs fn=`basename $$s`; \ : {- output_off() unless windowsdll(); "" -}; \ $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ - cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ - chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ - mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ - $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ + cp $$s "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ + chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ + mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ + "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ - cp $$s $(DESTDIR)$(libdir)/$$fn.new; \ - chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \ - mv -f $(DESTDIR)$(libdir)/$$fn.new \ - $(DESTDIR)$(libdir)/$$fn; \ + cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \ + chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \ + mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ + "$(DESTDIR)$(libdir)/$$fn"; \ : {- output_on() if windowsdll(); "" -}; \ done install_programs: install_runtime_libs build_programs @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) - @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin" @$(ECHO) "*** Installing runtime programs" @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ - cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ - chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ - mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ - $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ + cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ + chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ + mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ + "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ done @set -e; for x in dummy $(BIN_SCRIPTS); do \ if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ - cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ - chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ - mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ - $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ + cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ + chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ + mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ + "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ done uninstall_runtime: uninstall_programs uninstall_runtime_libs @@ -797,16 +797,16 @@ uninstall_programs: if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ - $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ + $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ done; @set -e; for x in dummy $(BIN_SCRIPTS); \ do \ if [ "$$x" = "dummy" ]; then continue; fi; \ fn=`basename $$x`; \ $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ - $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ + $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ done - -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin + -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/bin" uninstall_runtime_libs: @$(ECHO) "*** Uninstalling runtime libraries" @@ -815,7 +815,7 @@ uninstall_runtime_libs: if [ "$$s" = "dummy" ]; then continue; fi; \ fn=`basename $$s`; \ $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ - $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ + $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ done @ : {- output_on() unless windowsdll(); "" -} @@ -824,24 +824,24 @@ install_man_docs: @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) @$(ECHO) "*** Installing manpages" $(PERL) $(SRCDIR)/util/process_docs.pl \ - --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) + "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) uninstall_man_docs: @$(ECHO) "*** Uninstalling manpages" $(PERL) $(SRCDIR)/util/process_docs.pl \ - --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \ + "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) \ --remove install_html_docs: @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) @$(ECHO) "*** Installing HTML manpages" $(PERL) $(SRCDIR)/util/process_docs.pl \ - --destdir=$(DESTDIR)$(HTMLDIR) --type=html + "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html uninstall_html_docs: @$(ECHO) "*** Uninstalling manpages" $(PERL) $(SRCDIR)/util/process_docs.pl \ - --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove + "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html --remove # Developer targets (note: these are only available on Unix) ######### diff --git a/deps/openssl/openssl/NEWS b/deps/openssl/openssl/NEWS index eba6c3b6d93fc2..85470793b20996 100644 --- a/deps/openssl/openssl/NEWS +++ b/deps/openssl/openssl/NEWS @@ -5,10 +5,16 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.1.1e and OpenSSL 1.1.1f [31 Mar 2020] + + o Revert the unexpected EOF reporting via SSL_ERROR_SSL + Major changes between OpenSSL 1.1.1d and OpenSSL 1.1.1e [17 Mar 2020] o Fixed an overflow bug in the x64_64 Montgomery squaring procedure used in exponentiation with 512-bit moduli (CVE-2019-1551) + o Properly detect unexpected EOF while reading in libssl and report + it via SSL_ERROR_SSL Major changes between OpenSSL 1.1.1c and OpenSSL 1.1.1d [10 Sep 2019] diff --git a/deps/openssl/openssl/README b/deps/openssl/openssl/README index 8e9ce75a335d74..d7d44aa3a01b13 100644 --- a/deps/openssl/openssl/README +++ b/deps/openssl/openssl/README @@ -1,7 +1,7 @@ - OpenSSL 1.1.1e 17 Mar 2020 + OpenSSL 1.1.1f 31 Mar 2020 - Copyright (c) 1998-2019 The OpenSSL Project + Copyright (c) 1998-2020 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson All rights reserved. diff --git a/deps/openssl/openssl/apps/rehash.c b/deps/openssl/openssl/apps/rehash.c index 2b769fbceb87ef..fc1dffe974976d 100644 --- a/deps/openssl/openssl/apps/rehash.c +++ b/deps/openssl/openssl/apps/rehash.c @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2013-2014 Timo Teräs * * Licensed under the OpenSSL license (the "License"). You may not use @@ -274,11 +274,19 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h) if (x->x509 != NULL) { type = TYPE_CERT; name = X509_get_subject_name(x->x509); - X509_digest(x->x509, evpmd, digest, NULL); + if (!X509_digest(x->x509, evpmd, digest, NULL)) { + BIO_printf(bio_err, "out of memory\n"); + ++errs; + goto end; + } } else if (x->crl != NULL) { type = TYPE_CRL; name = X509_CRL_get_issuer(x->crl); - X509_CRL_digest(x->crl, evpmd, digest, NULL); + if (!X509_CRL_digest(x->crl, evpmd, digest, NULL)) { + BIO_printf(bio_err, "out of memory\n"); + ++errs; + goto end; + } } else { ++errs; goto end; diff --git a/deps/openssl/openssl/apps/s_server.c b/deps/openssl/openssl/apps/s_server.c index 2248a432e26814..0ba75999fd286e 100644 --- a/deps/openssl/openssl/apps/s_server.c +++ b/deps/openssl/openssl/apps/s_server.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * Copyright 2005 Nokia. All rights reserved. * @@ -1904,7 +1904,7 @@ int s_server_main(int argc, char *argv[]) BIO_printf(bio_s_out, "Setting secondary ctx parameters\n"); if (sdebug) - ssl_ctx_security_debug(ctx, sdebug); + ssl_ctx_security_debug(ctx2, sdebug); if (session_id_prefix) { if (strlen(session_id_prefix) >= 32) diff --git a/deps/openssl/openssl/crypto/bn/bn_local.h b/deps/openssl/openssl/crypto/bn/bn_local.h index 37228104c640f4..8ad69ccd3639ed 100644 --- a/deps/openssl/openssl/crypto/bn/bn_local.h +++ b/deps/openssl/openssl/crypto/bn/bn_local.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -654,9 +654,6 @@ BIGNUM *int_bn_mod_inverse(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, int *noinv); -int bn_probable_prime_dh(BIGNUM *rnd, int bits, - const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); - static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) { if (bits > (INT_MAX - BN_BITS2 + 1)) diff --git a/deps/openssl/openssl/crypto/bn/bn_prime.c b/deps/openssl/openssl/crypto/bn/bn_prime.c index 6d74da26d3c702..d0cf3779fa50d8 100644 --- a/deps/openssl/openssl/crypto/bn/bn_prime.c +++ b/deps/openssl/openssl/crypto/bn/bn_prime.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -22,10 +22,12 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, const BIGNUM *a1_odd, int k, BN_CTX *ctx, BN_MONT_CTX *mont); -static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods); -static int probable_prime_dh_safe(BIGNUM *rnd, int bits, - const BIGNUM *add, const BIGNUM *rem, - BN_CTX *ctx); +static int probable_prime(BIGNUM *rnd, int bits, int safe, prime_t *mods); +static int probable_prime_dh(BIGNUM *rnd, int bits, int safe, prime_t *mods, + const BIGNUM *add, const BIGNUM *rem, + BN_CTX *ctx); + +#define square(x) ((BN_ULONG)(x) * (BN_ULONG)(x)) int BN_GENCB_call(BN_GENCB *cb, int a, int b) { @@ -87,16 +89,11 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, loop: /* make a random number and set the top and bottom bits */ if (add == NULL) { - if (!probable_prime(ret, bits, mods)) + if (!probable_prime(ret, bits, safe, mods)) goto err; } else { - if (safe) { - if (!probable_prime_dh_safe(ret, bits, add, rem, ctx)) - goto err; - } else { - if (!bn_probable_prime_dh(ret, bits, add, rem, ctx)) - goto err; - } + if (!probable_prime_dh(ret, bits, safe, mods, add, rem, ctx)) + goto err; } if (!BN_GENCB_call(cb, 0, c1++)) @@ -272,17 +269,18 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, return 1; } -static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods) +static int probable_prime(BIGNUM *rnd, int bits, int safe, prime_t *mods) { int i; BN_ULONG delta; BN_ULONG maxdelta = BN_MASK2 - primes[NUMPRIMES - 1]; - char is_single_word = bits <= BN_BITS2; again: /* TODO: Not all primes are private */ if (!BN_priv_rand(rnd, bits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ODD)) return 0; + if (safe && !BN_set_bit(rnd, 1)) + return 0; /* we now have a random number 'rnd' to test. */ for (i = 1; i < NUMPRIMES; i++) { BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]); @@ -290,61 +288,25 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods) return 0; mods[i] = (prime_t) mod; } - /* - * If bits is so small that it fits into a single word then we - * additionally don't want to exceed that many bits. - */ - if (is_single_word) { - BN_ULONG size_limit; - - if (bits == BN_BITS2) { - /* - * Shifting by this much has undefined behaviour so we do it a - * different way - */ - size_limit = ~((BN_ULONG)0) - BN_get_word(rnd); - } else { - size_limit = (((BN_ULONG)1) << bits) - BN_get_word(rnd) - 1; - } - if (size_limit < maxdelta) - maxdelta = size_limit; - } delta = 0; loop: - if (is_single_word) { - BN_ULONG rnd_word = BN_get_word(rnd); - - /*- - * In the case that the candidate prime is a single word then - * we check that: - * 1) It's greater than primes[i] because we shouldn't reject - * 3 as being a prime number because it's a multiple of - * three. - * 2) That it's not a multiple of a known prime. We don't - * check that rnd-1 is also coprime to all the known - * primes because there aren't many small primes where - * that's true. + for (i = 1; i < NUMPRIMES; i++) { + /* + * check that rnd is a prime and also that + * gcd(rnd-1,primes) == 1 (except for 2) + * do the second check only if we are interested in safe primes + * in the case that the candidate prime is a single word then + * we check only the primes up to sqrt(rnd) */ - for (i = 1; i < NUMPRIMES && primes[i] < rnd_word; i++) { - if ((mods[i] + delta) % primes[i] == 0) { - delta += 2; - if (delta > maxdelta) - goto again; - goto loop; - } - } - } else { - for (i = 1; i < NUMPRIMES; i++) { - /* - * check that rnd is not a prime and also that gcd(rnd-1,primes) - * == 1 (except for 2) - */ - if (((mods[i] + delta) % primes[i]) <= 1) { - delta += 2; - if (delta > maxdelta) - goto again; - goto loop; - } + if (bits <= 31 && delta <= 0x7fffffff + && square(primes[i]) > BN_get_word(rnd) + delta) + break; + if (safe ? (mods[i] + delta) % primes[i] <= 1 + : (mods[i] + delta) % primes[i] == 0) { + delta += safe ? 4 : 2; + if (delta > maxdelta) + goto again; + goto loop; } } if (!BN_add_word(rnd, delta)) @@ -355,16 +317,23 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods) return 1; } -int bn_probable_prime_dh(BIGNUM *rnd, int bits, - const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx) +static int probable_prime_dh(BIGNUM *rnd, int bits, int safe, prime_t *mods, + const BIGNUM *add, const BIGNUM *rem, + BN_CTX *ctx) { int i, ret = 0; BIGNUM *t1; + BN_ULONG delta; + BN_ULONG maxdelta = BN_MASK2 - primes[NUMPRIMES - 1]; BN_CTX_start(ctx); if ((t1 = BN_CTX_get(ctx)) == NULL) goto err; + if (maxdelta > BN_MASK2 - BN_get_word(add)) + maxdelta = BN_MASK2 - BN_get_word(add); + + again: if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD)) goto err; @@ -375,98 +344,48 @@ int bn_probable_prime_dh(BIGNUM *rnd, int bits, if (!BN_sub(rnd, rnd, t1)) goto err; if (rem == NULL) { - if (!BN_add_word(rnd, 1)) + if (!BN_add_word(rnd, safe ? 3u : 1u)) goto err; } else { if (!BN_add(rnd, rnd, rem)) goto err; } - /* we now have a random number 'rand' to test. */ + if (BN_num_bits(rnd) < bits + || BN_get_word(rnd) < (safe ? 5u : 3u)) { + if (!BN_add(rnd, rnd, add)) + goto err; + } - loop: + /* we now have a random number 'rnd' to test. */ for (i = 1; i < NUMPRIMES; i++) { - /* check that rnd is a prime */ BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]); if (mod == (BN_ULONG)-1) goto err; - if (mod <= 1) { - if (!BN_add(rnd, rnd, add)) - goto err; - goto loop; - } - } - ret = 1; - - err: - BN_CTX_end(ctx); - bn_check_top(rnd); - return ret; -} - -static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd, - const BIGNUM *rem, BN_CTX *ctx) -{ - int i, ret = 0; - BIGNUM *t1, *qadd, *q; - - bits--; - BN_CTX_start(ctx); - t1 = BN_CTX_get(ctx); - q = BN_CTX_get(ctx); - qadd = BN_CTX_get(ctx); - if (qadd == NULL) - goto err; - - if (!BN_rshift1(qadd, padd)) - goto err; - - if (!BN_rand(q, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD)) - goto err; - - /* we need ((rnd-rem) % add) == 0 */ - if (!BN_mod(t1, q, qadd, ctx)) - goto err; - if (!BN_sub(q, q, t1)) - goto err; - if (rem == NULL) { - if (!BN_add_word(q, 1)) - goto err; - } else { - if (!BN_rshift1(t1, rem)) - goto err; - if (!BN_add(q, q, t1)) - goto err; + mods[i] = (prime_t) mod; } - - /* we now have a random number 'rand' to test. */ - if (!BN_lshift1(p, q)) - goto err; - if (!BN_add_word(p, 1)) - goto err; - + delta = 0; loop: for (i = 1; i < NUMPRIMES; i++) { - /* check that p and q are prime */ - /* - * check that for p and q gcd(p-1,primes) == 1 (except for 2) - */ - BN_ULONG pmod = BN_mod_word(p, (BN_ULONG)primes[i]); - BN_ULONG qmod = BN_mod_word(q, (BN_ULONG)primes[i]); - if (pmod == (BN_ULONG)-1 || qmod == (BN_ULONG)-1) - goto err; - if (pmod == 0 || qmod == 0) { - if (!BN_add(p, p, padd)) - goto err; - if (!BN_add(q, q, qadd)) - goto err; + /* check that rnd is a prime */ + if (bits <= 31 && delta <= 0x7fffffff + && square(primes[i]) > BN_get_word(rnd) + delta) + break; + /* rnd mod p == 1 implies q = (rnd-1)/2 is divisible by p */ + if (safe ? (mods[i] + delta) % primes[i] <= 1 + : (mods[i] + delta) % primes[i] == 0) { + delta += BN_get_word(add); + if (delta > maxdelta) + goto again; goto loop; } } + if (!BN_add_word(rnd, delta)) + goto err; ret = 1; err: BN_CTX_end(ctx); - bn_check_top(p); + bn_check_top(rnd); return ret; } diff --git a/deps/openssl/openssl/crypto/conf/conf_lib.c b/deps/openssl/openssl/crypto/conf/conf_lib.c index 0b7dd26d63b0a0..add1dfa1c18132 100644 --- a/deps/openssl/openssl/crypto/conf/conf_lib.c +++ b/deps/openssl/openssl/crypto/conf/conf_lib.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -356,8 +356,10 @@ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void) { OPENSSL_INIT_SETTINGS *ret = malloc(sizeof(*ret)); - if (ret != NULL) - memset(ret, 0, sizeof(*ret)); + if (ret == NULL) + return NULL; + + memset(ret, 0, sizeof(*ret)); ret->flags = DEFAULT_CONF_MFLAGS; return ret; diff --git a/deps/openssl/openssl/crypto/err/openssl.txt b/deps/openssl/openssl/crypto/err/openssl.txt index f5324c6819d8e2..35512f9caf96b0 100644 --- a/deps/openssl/openssl/crypto/err/openssl.txt +++ b/deps/openssl/openssl/crypto/err/openssl.txt @@ -2852,7 +2852,6 @@ SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES:242:unable to load ssl3 md5 routines SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES:243:unable to load ssl3 sha1 routines SSL_R_UNEXPECTED_CCS_MESSAGE:262:unexpected ccs message SSL_R_UNEXPECTED_END_OF_EARLY_DATA:178:unexpected end of early data -SSL_R_UNEXPECTED_EOF_WHILE_READING:294:unexpected eof while reading SSL_R_UNEXPECTED_MESSAGE:244:unexpected message SSL_R_UNEXPECTED_RECORD:245:unexpected record SSL_R_UNINITIALIZED:276:uninitialized diff --git a/deps/openssl/openssl/crypto/ex_data.c b/deps/openssl/openssl/crypto/ex_data.c index 22f3b70edf14e3..0f5a9295056abe 100644 --- a/deps/openssl/openssl/crypto/ex_data.c +++ b/deps/openssl/openssl/crypto/ex_data.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -235,7 +235,7 @@ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) return 0; } for (i = 0; i < mx; i++) { - if (storage[i] && storage[i]->new_func) { + if (storage[i] != NULL && storage[i]->new_func != NULL) { ptr = CRYPTO_get_ex_data(ad, i); storage[i]->new_func(obj, ptr, ad, i, storage[i]->argl, storage[i]->argp); @@ -299,7 +299,7 @@ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, for (i = 0; i < mx; i++) { ptr = CRYPTO_get_ex_data(from, i); - if (storage[i] && storage[i]->dup_func) + if (storage[i] != NULL && storage[i]->dup_func != NULL) if (!storage[i]->dup_func(to, from, &ptr, i, storage[i]->argl, storage[i]->argp)) goto err; diff --git a/deps/openssl/openssl/crypto/pkcs12/p12_crt.c b/deps/openssl/openssl/crypto/pkcs12/p12_crt.c index d43dc3b30cf3a6..bfcae3f697e950 100644 --- a/deps/openssl/openssl/crypto/pkcs12/p12_crt.c +++ b/deps/openssl/openssl/crypto/pkcs12/p12_crt.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -62,7 +62,8 @@ PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, X509 * if (pkey && cert) { if (!X509_check_private_key(cert, pkey)) return NULL; - X509_digest(cert, EVP_sha1(), keyid, &keyidlen); + if (!X509_digest(cert, EVP_sha1(), keyid, &keyidlen)) + return NULL; } if (cert) { diff --git a/deps/openssl/openssl/crypto/ts/ts_rsp_sign.c b/deps/openssl/openssl/crypto/ts/ts_rsp_sign.c index a584ae5f5edde0..041a187da68c6a 100644 --- a/deps/openssl/openssl/crypto/ts/ts_rsp_sign.c +++ b/deps/openssl/openssl/crypto/ts/ts_rsp_sign.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -771,7 +771,8 @@ static ESS_CERT_ID *ess_CERT_ID_new_init(X509 *cert, int issuer_needed) X509_check_purpose(cert, -1, 0); if ((cid = ESS_CERT_ID_new()) == NULL) goto err; - X509_digest(cert, EVP_sha1(), cert_sha1, NULL); + if (!X509_digest(cert, EVP_sha1(), cert_sha1, NULL)) + goto err; if (!ASN1_OCTET_STRING_set(cid->hash, cert_sha1, SHA_DIGEST_LENGTH)) goto err; diff --git a/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c b/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c index 086021247c01ca..c2e7abd67f5096 100644 --- a/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c +++ b/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -289,11 +289,12 @@ static int ts_find_cert(STACK_OF(ESS_CERT_ID) *cert_ids, X509 *cert) if (!cert_ids || !cert) return -1; - X509_digest(cert, EVP_sha1(), cert_sha1, NULL); - /* Recompute SHA1 hash of certificate if necessary (side effect). */ X509_check_purpose(cert, -1, 0); + if (!X509_digest(cert, EVP_sha1(), cert_sha1, NULL)) + return -1; + /* Look for cert in the cert_ids vector. */ for (i = 0; i < sk_ESS_CERT_ID_num(cert_ids); ++i) { ESS_CERT_ID *cid = sk_ESS_CERT_ID_value(cert_ids, i); @@ -326,7 +327,8 @@ static int ts_find_cert_v2(STACK_OF(ESS_CERT_ID_V2) *cert_ids, X509 *cert) else md = EVP_sha256(); - X509_digest(cert, md, cert_digest, &len); + if (!X509_digest(cert, md, cert_digest, &len)) + return -1; if (cid->hash->length != (int)len) return -1; diff --git a/deps/openssl/openssl/crypto/x509/x509_cmp.c b/deps/openssl/openssl/crypto/x509/x509_cmp.c index e06489c3347b94..d1600e1e8ddab4 100644 --- a/deps/openssl/openssl/crypto/x509/x509_cmp.c +++ b/deps/openssl/openssl/crypto/x509/x509_cmp.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -134,9 +134,12 @@ unsigned long X509_subject_name_hash_old(X509 *x) int X509_cmp(const X509 *a, const X509 *b) { int rv; + /* ensure hash is valid */ - X509_check_purpose((X509 *)a, -1, 0); - X509_check_purpose((X509 *)b, -1, 0); + if (X509_check_purpose((X509 *)a, -1, 0) != 1) + return -2; + if (X509_check_purpose((X509 *)b, -1, 0) != 1) + return -2; rv = memcmp(a->sha1_hash, b->sha1_hash, SHA_DIGEST_LENGTH); if (rv) diff --git a/deps/openssl/openssl/crypto/x509/x509_trs.c b/deps/openssl/openssl/crypto/x509/x509_trs.c index 9e199d63e46a31..a10d437735b8df 100644 --- a/deps/openssl/openssl/crypto/x509/x509_trs.c +++ b/deps/openssl/openssl/crypto/x509/x509_trs.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -240,8 +240,9 @@ static int trust_1oid(X509_TRUST *trust, X509 *x, int flags) static int trust_compat(X509_TRUST *trust, X509 *x, int flags) { /* Call for side-effect of computing hash and caching extensions */ - X509_check_purpose(x, -1, 0); - if ((flags & X509_TRUST_NO_SS_COMPAT) == 0 && x->ex_flags & EXFLAG_SS) + if (X509_check_purpose(x, -1, 0) != 1) + return X509_TRUST_UNTRUSTED; + if ((flags & X509_TRUST_NO_SS_COMPAT) == 0 && (x->ex_flags & EXFLAG_SS)) return X509_TRUST_TRUSTED; else return X509_TRUST_UNTRUSTED; diff --git a/deps/openssl/openssl/crypto/x509/x509_vfy.c b/deps/openssl/openssl/crypto/x509/x509_vfy.c index 361954c62ee785..f28f2d2610f6db 100644 --- a/deps/openssl/openssl/crypto/x509/x509_vfy.c +++ b/deps/openssl/openssl/crypto/x509/x509_vfy.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -107,12 +107,8 @@ static int null_callback(int ok, X509_STORE_CTX *e) /* Return 1 is a certificate is self signed */ static int cert_self_signed(X509 *x) { - /* - * FIXME: x509v3_cache_extensions() needs to detect more failures and not - * set EXFLAG_SET when that happens. Especially, if the failures are - * parse errors, rather than memory pressure! - */ - X509_check_purpose(x, -1, 0); + if (X509_check_purpose(x, -1, 0) != 1) + return 0; if (x->ex_flags & EXFLAG_SS) return 1; else diff --git a/deps/openssl/openssl/crypto/x509/x_all.c b/deps/openssl/openssl/crypto/x509/x_all.c index 6cccfa99d1a62e..aa5ccba448997d 100644 --- a/deps/openssl/openssl/crypto/x509/x_all.c +++ b/deps/openssl/openssl/crypto/x509/x_all.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -362,7 +362,8 @@ int X509_pubkey_digest(const X509 *data, const EVP_MD *type, int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md, unsigned int *len) { - if (type == EVP_sha1() && (data->ex_flags & EXFLAG_SET) != 0) { + if (type == EVP_sha1() && (data->ex_flags & EXFLAG_SET) != 0 + && (data->ex_flags & EXFLAG_INVALID) == 0) { /* Asking for SHA1 and we already computed it. */ if (len != NULL) *len = sizeof(data->sha1_hash); @@ -376,7 +377,8 @@ int X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md, int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, unsigned char *md, unsigned int *len) { - if (type == EVP_sha1() && (data->flags & EXFLAG_SET) != 0) { + if (type == EVP_sha1() && (data->flags & EXFLAG_SET) != 0 + && (data->flags & EXFLAG_INVALID) == 0) { /* Asking for SHA1; always computed in CRL d2i. */ if (len != NULL) *len = sizeof(data->sha1_hash); diff --git a/deps/openssl/openssl/crypto/x509/x_crl.c b/deps/openssl/openssl/crypto/x509/x_crl.c index e864126fef3726..c9762f9e2394af 100644 --- a/deps/openssl/openssl/crypto/x509/x_crl.c +++ b/deps/openssl/openssl/crypto/x509/x_crl.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -17,7 +17,7 @@ static int X509_REVOKED_cmp(const X509_REVOKED *const *a, const X509_REVOKED *const *b); -static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); +static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp); ASN1_SEQUENCE(X509_REVOKED) = { ASN1_EMBED(X509_REVOKED,serialNumber, ASN1_INTEGER), @@ -155,7 +155,7 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, X509_CRL *crl = (X509_CRL *)*pval; STACK_OF(X509_EXTENSION) *exts; X509_EXTENSION *ext; - int idx; + int idx, i; switch (operation) { case ASN1_OP_D2I_PRE: @@ -184,23 +184,35 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, break; case ASN1_OP_D2I_POST: - X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL); + if (!X509_CRL_digest(crl, EVP_sha1(), crl->sha1_hash, NULL)) + crl->flags |= EXFLAG_INVALID; crl->idp = X509_CRL_get_ext_d2i(crl, - NID_issuing_distribution_point, NULL, + NID_issuing_distribution_point, &i, NULL); - if (crl->idp) - setup_idp(crl, crl->idp); + if (crl->idp != NULL) { + if (!setup_idp(crl, crl->idp)) + crl->flags |= EXFLAG_INVALID; + } + else if (i != -1) { + crl->flags |= EXFLAG_INVALID; + } crl->akid = X509_CRL_get_ext_d2i(crl, - NID_authority_key_identifier, NULL, + NID_authority_key_identifier, &i, NULL); + if (crl->akid == NULL && i != -1) + crl->flags |= EXFLAG_INVALID; crl->crl_number = X509_CRL_get_ext_d2i(crl, - NID_crl_number, NULL, NULL); + NID_crl_number, &i, NULL); + if (crl->crl_number == NULL && i != -1) + crl->flags |= EXFLAG_INVALID; crl->base_crl_number = X509_CRL_get_ext_d2i(crl, - NID_delta_crl, NULL, + NID_delta_crl, &i, NULL); + if (crl->base_crl_number == NULL && i != -1) + crl->flags |= EXFLAG_INVALID; /* Delta CRLs must have CRL number */ if (crl->base_crl_number && !crl->crl_number) crl->flags |= EXFLAG_INVALID; @@ -259,9 +271,10 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, /* Convert IDP into a more convenient form */ -static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp) +static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp) { int idp_only = 0; + /* Set various flags according to IDP */ crl->idp_flags |= IDP_PRESENT; if (idp->onlyuser > 0) { @@ -292,7 +305,7 @@ static void setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp) crl->idp_reasons &= CRLDP_ALL_REASONS; } - DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl)); + return DIST_POINT_set_dpname(idp->distpoint, X509_CRL_get_issuer(crl)); } ASN1_SEQUENCE_ref(X509_CRL, crl_cb) = { diff --git a/deps/openssl/openssl/crypto/x509v3/v3_purp.c b/deps/openssl/openssl/crypto/x509v3/v3_purp.c index 3f60c2ea1da336..2bc8253d2dab3a 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3_purp.c +++ b/deps/openssl/openssl/crypto/x509v3/v3_purp.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -81,6 +81,8 @@ int X509_check_purpose(X509 *x, int id, int ca) const X509_PURPOSE *pt; x509v3_cache_extensions(x); + if (x->ex_flags & EXFLAG_INVALID) + return -1; /* Return if side-effect only call */ if (id == -1) @@ -300,10 +302,11 @@ int X509_supported_extension(X509_EXTENSION *ex) return 0; } -static void setup_dp(X509 *x, DIST_POINT *dp) +static int setup_dp(X509 *x, DIST_POINT *dp) { X509_NAME *iname = NULL; int i; + if (dp->reasons) { if (dp->reasons->length > 0) dp->dp_reasons = dp->reasons->data[0]; @@ -313,7 +316,7 @@ static void setup_dp(X509 *x, DIST_POINT *dp) } else dp->dp_reasons = CRLDP_ALL_REASONS; if (!dp->distpoint || (dp->distpoint->type != 1)) - return; + return 1; for (i = 0; i < sk_GENERAL_NAME_num(dp->CRLissuer); i++) { GENERAL_NAME *gen = sk_GENERAL_NAME_value(dp->CRLissuer, i); if (gen->type == GEN_DIRNAME) { @@ -324,16 +327,21 @@ static void setup_dp(X509 *x, DIST_POINT *dp) if (!iname) iname = X509_get_issuer_name(x); - DIST_POINT_set_dpname(dp->distpoint, iname); - + return DIST_POINT_set_dpname(dp->distpoint, iname); } -static void setup_crldp(X509 *x) +static int setup_crldp(X509 *x) { int i; - x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, NULL, NULL); - for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++) - setup_dp(x, sk_DIST_POINT_value(x->crldp, i)); + + x->crldp = X509_get_ext_d2i(x, NID_crl_distribution_points, &i, NULL); + if (x->crldp == NULL && i != -1) + return 0; + for (i = 0; i < sk_DIST_POINT_num(x->crldp); i++) { + if (!setup_dp(x, sk_DIST_POINT_value(x->crldp, i))) + return 0; + } + return 1; } #define V1_ROOT (EXFLAG_V1|EXFLAG_SS) @@ -366,12 +374,13 @@ static void x509v3_cache_extensions(X509 *x) return; } - X509_digest(x, EVP_sha1(), x->sha1_hash, NULL); + if (!X509_digest(x, EVP_sha1(), x->sha1_hash, NULL)) + x->ex_flags |= EXFLAG_INVALID; /* V1 should mean no extensions ... */ if (!X509_get_version(x)) x->ex_flags |= EXFLAG_V1; /* Handle basic constraints */ - if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, NULL, NULL))) { + if ((bs = X509_get_ext_d2i(x, NID_basic_constraints, &i, NULL))) { if (bs->ca) x->ex_flags |= EXFLAG_CA; if (bs->pathlen) { @@ -385,9 +394,11 @@ static void x509v3_cache_extensions(X509 *x) x->ex_pathlen = -1; BASIC_CONSTRAINTS_free(bs); x->ex_flags |= EXFLAG_BCONS; + } else if (i != -1) { + x->ex_flags |= EXFLAG_INVALID; } /* Handle proxy certificates */ - if ((pci = X509_get_ext_d2i(x, NID_proxyCertInfo, NULL, NULL))) { + if ((pci = X509_get_ext_d2i(x, NID_proxyCertInfo, &i, NULL))) { if (x->ex_flags & EXFLAG_CA || X509_get_ext_by_NID(x, NID_subject_alt_name, -1) >= 0 || X509_get_ext_by_NID(x, NID_issuer_alt_name, -1) >= 0) { @@ -399,9 +410,11 @@ static void x509v3_cache_extensions(X509 *x) x->ex_pcpathlen = -1; PROXY_CERT_INFO_EXTENSION_free(pci); x->ex_flags |= EXFLAG_PROXY; + } else if (i != -1) { + x->ex_flags |= EXFLAG_INVALID; } /* Handle key usage */ - if ((usage = X509_get_ext_d2i(x, NID_key_usage, NULL, NULL))) { + if ((usage = X509_get_ext_d2i(x, NID_key_usage, &i, NULL))) { if (usage->length > 0) { x->ex_kusage = usage->data[0]; if (usage->length > 1) @@ -410,9 +423,11 @@ static void x509v3_cache_extensions(X509 *x) x->ex_kusage = 0; x->ex_flags |= EXFLAG_KUSAGE; ASN1_BIT_STRING_free(usage); + } else if (i != -1) { + x->ex_flags |= EXFLAG_INVALID; } x->ex_xkusage = 0; - if ((extusage = X509_get_ext_d2i(x, NID_ext_key_usage, NULL, NULL))) { + if ((extusage = X509_get_ext_d2i(x, NID_ext_key_usage, &i, NULL))) { x->ex_flags |= EXFLAG_XKUSAGE; for (i = 0; i < sk_ASN1_OBJECT_num(extusage); i++) { switch (OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage, i))) { @@ -455,18 +470,26 @@ static void x509v3_cache_extensions(X509 *x) } } sk_ASN1_OBJECT_pop_free(extusage, ASN1_OBJECT_free); + } else if (i != -1) { + x->ex_flags |= EXFLAG_INVALID; } - if ((ns = X509_get_ext_d2i(x, NID_netscape_cert_type, NULL, NULL))) { + if ((ns = X509_get_ext_d2i(x, NID_netscape_cert_type, &i, NULL))) { if (ns->length > 0) x->ex_nscert = ns->data[0]; else x->ex_nscert = 0; x->ex_flags |= EXFLAG_NSCERT; ASN1_BIT_STRING_free(ns); + } else if (i != -1) { + x->ex_flags |= EXFLAG_INVALID; } - x->skid = X509_get_ext_d2i(x, NID_subject_key_identifier, NULL, NULL); - x->akid = X509_get_ext_d2i(x, NID_authority_key_identifier, NULL, NULL); + x->skid = X509_get_ext_d2i(x, NID_subject_key_identifier, &i, NULL); + if (x->skid == NULL && i != -1) + x->ex_flags |= EXFLAG_INVALID; + x->akid = X509_get_ext_d2i(x, NID_authority_key_identifier, &i, NULL); + if (x->akid == NULL && i != -1) + x->ex_flags |= EXFLAG_INVALID; /* Does subject name match issuer ? */ if (!X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x))) { x->ex_flags |= EXFLAG_SI; @@ -475,16 +498,22 @@ static void x509v3_cache_extensions(X509 *x) !ku_reject(x, KU_KEY_CERT_SIGN)) x->ex_flags |= EXFLAG_SS; } - x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, NULL, NULL); + x->altname = X509_get_ext_d2i(x, NID_subject_alt_name, &i, NULL); + if (x->altname == NULL && i != -1) + x->ex_flags |= EXFLAG_INVALID; x->nc = X509_get_ext_d2i(x, NID_name_constraints, &i, NULL); - if (!x->nc && (i != -1)) + if (x->nc == NULL && i != -1) + x->ex_flags |= EXFLAG_INVALID; + if (!setup_crldp(x)) x->ex_flags |= EXFLAG_INVALID; - setup_crldp(x); #ifndef OPENSSL_NO_RFC3779 - x->rfc3779_addr = X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, NULL, NULL); - x->rfc3779_asid = X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum, - NULL, NULL); + x->rfc3779_addr = X509_get_ext_d2i(x, NID_sbgp_ipAddrBlock, &i, NULL); + if (x->rfc3779_addr == NULL && i != -1) + x->ex_flags |= EXFLAG_INVALID; + x->rfc3779_asid = X509_get_ext_d2i(x, NID_sbgp_autonomousSysNum, &i, NULL); + if (x->rfc3779_asid == NULL && i != -1) + x->ex_flags |= EXFLAG_INVALID; #endif for (i = 0; i < X509_get_ext_count(x); i++) { ex = X509_get_ext(x, i); @@ -777,7 +806,11 @@ int X509_check_issued(X509 *issuer, X509 *subject) return X509_V_ERR_SUBJECT_ISSUER_MISMATCH; x509v3_cache_extensions(issuer); + if (issuer->ex_flags & EXFLAG_INVALID) + return X509_V_ERR_UNSPECIFIED; x509v3_cache_extensions(subject); + if (subject->ex_flags & EXFLAG_INVALID) + return X509_V_ERR_UNSPECIFIED; if (subject->akid) { int ret = X509_check_akid(issuer, subject->akid); @@ -842,7 +875,8 @@ uint32_t X509_get_extension_flags(X509 *x) uint32_t X509_get_key_usage(X509 *x) { /* Call for side-effect of computing hash and caching extensions */ - X509_check_purpose(x, -1, -1); + if (X509_check_purpose(x, -1, -1) != 1) + return 0; if (x->ex_flags & EXFLAG_KUSAGE) return x->ex_kusage; return UINT32_MAX; @@ -851,7 +885,8 @@ uint32_t X509_get_key_usage(X509 *x) uint32_t X509_get_extended_key_usage(X509 *x) { /* Call for side-effect of computing hash and caching extensions */ - X509_check_purpose(x, -1, -1); + if (X509_check_purpose(x, -1, -1) != 1) + return 0; if (x->ex_flags & EXFLAG_XKUSAGE) return x->ex_xkusage; return UINT32_MAX; @@ -860,28 +895,32 @@ uint32_t X509_get_extended_key_usage(X509 *x) const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x) { /* Call for side-effect of computing hash and caching extensions */ - X509_check_purpose(x, -1, -1); + if (X509_check_purpose(x, -1, -1) != 1) + return NULL; return x->skid; } const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x) { /* Call for side-effect of computing hash and caching extensions */ - X509_check_purpose(x, -1, -1); + if (X509_check_purpose(x, -1, -1) != 1) + return NULL; return (x->akid != NULL ? x->akid->keyid : NULL); } const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x) { /* Call for side-effect of computing hash and caching extensions */ - X509_check_purpose(x, -1, -1); + if (X509_check_purpose(x, -1, -1) != 1) + return NULL; return (x->akid != NULL ? x->akid->issuer : NULL); } const ASN1_INTEGER *X509_get0_authority_serial(X509 *x) { /* Call for side-effect of computing hash and caching extensions */ - X509_check_purpose(x, -1, -1); + if (X509_check_purpose(x, -1, -1) != 1) + return NULL; return (x->akid != NULL ? x->akid->serial : NULL); } diff --git a/deps/openssl/openssl/doc/man3/BN_generate_prime.pod b/deps/openssl/openssl/doc/man3/BN_generate_prime.pod index 31fbc1ffa1743f..f1e63f3b3c4aa9 100644 --- a/deps/openssl/openssl/doc/man3/BN_generate_prime.pod +++ b/deps/openssl/openssl/doc/man3/BN_generate_prime.pod @@ -52,7 +52,9 @@ Deprecated: BN_generate_prime_ex() generates a pseudo-random prime number of at least bit length B. The returned number is probably prime -with a negligible error. +with a negligible error. If B is B the returned prime +number will have exact bit length B with the top most two +bits set. If B is not B, it will be used to store the number. @@ -89,7 +91,9 @@ If B is not B, the prime will fulfill the condition p % B generator. If B is true, it will be a safe prime (i.e. a prime p so -that (p-1)/2 is also prime). +that (p-1)/2 is also prime). If B is true, and B == B +the condition will be p % B == 3. +It is recommended that B is a multiple of 4. The random generator must be seeded prior to calling BN_generate_prime_ex(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to @@ -206,7 +210,7 @@ and BN_GENCB_get_arg() functions were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/doc/man3/SSL_get_error.pod b/deps/openssl/openssl/doc/man3/SSL_get_error.pod index 97320a6c153f6f..5221ccfe18049a 100644 --- a/deps/openssl/openssl/doc/man3/SSL_get_error.pod +++ b/deps/openssl/openssl/doc/man3/SSL_get_error.pod @@ -155,6 +155,18 @@ connection and SSL_shutdown() must not be called. =back +=head1 BUGS + +The B with B value of 0 indicates unexpected EOF from +the peer. This will be properly reported as B with reason +code B in the OpenSSL 3.0 release because +it is truly a TLS protocol error to terminate the connection without +a SSL_shutdown(). + +The issue is kept unfixed in OpenSSL 1.1.1 releases because many applications +which choose to ignore this protocol error depend on the existing way of +reporting the error. + =head1 SEE ALSO L @@ -166,7 +178,7 @@ The SSL_ERROR_WANT_CLIENT_HELLO_CB error code was added in OpenSSL 1.1.1. =head1 COPYRIGHT -Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/doc/man3/X509_get_extension_flags.pod b/deps/openssl/openssl/doc/man3/X509_get_extension_flags.pod index 2dfe2ef3727582..43c9c952c6b770 100644 --- a/deps/openssl/openssl/doc/man3/X509_get_extension_flags.pod +++ b/deps/openssl/openssl/doc/man3/X509_get_extension_flags.pod @@ -80,6 +80,17 @@ The certificate contains an unhandled critical extension. Some certificate extension values are invalid or inconsistent. The certificate should be rejected. +This bit may also be raised after an out-of-memory error while +processing the X509 object, so it may not be related to the processed +ASN1 object itself. + +=item B + +The NID_certificate_policies certificate extension is invalid or +inconsistent. The certificate should be rejected. +This bit may also be raised after an out-of-memory error while +processing the X509 object, so it may not be related to the processed +ASN1 object itself. =item B @@ -183,7 +194,7 @@ X509_get_proxy_pathlen() were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/include/crypto/bn_conf.h b/deps/openssl/openssl/include/crypto/bn_conf.h deleted file mode 100644 index 79400c6472a49c..00000000000000 --- a/deps/openssl/openssl/include/crypto/bn_conf.h +++ /dev/null @@ -1 +0,0 @@ -#include "../../../config/bn_conf.h" diff --git a/deps/openssl/openssl/include/crypto/dso_conf.h b/deps/openssl/openssl/include/crypto/dso_conf.h deleted file mode 100644 index e7f2afa9872320..00000000000000 --- a/deps/openssl/openssl/include/crypto/dso_conf.h +++ /dev/null @@ -1 +0,0 @@ -#include "../../../config/dso_conf.h" diff --git a/deps/openssl/openssl/include/openssl/opensslconf.h b/deps/openssl/openssl/include/openssl/opensslconf.h deleted file mode 100644 index 76c99d433ab886..00000000000000 --- a/deps/openssl/openssl/include/openssl/opensslconf.h +++ /dev/null @@ -1 +0,0 @@ -#include "../../config/opensslconf.h" diff --git a/deps/openssl/openssl/include/openssl/opensslv.h b/deps/openssl/openssl/include/openssl/opensslv.h index dd8ef3df722f81..8c697f5f7acc85 100644 --- a/deps/openssl/openssl/include/openssl/opensslv.h +++ b/deps/openssl/openssl/include/openssl/opensslv.h @@ -1,5 +1,5 @@ /* - * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -39,8 +39,8 @@ extern "C" { * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -# define OPENSSL_VERSION_NUMBER 0x1010105fL -# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1e 17 Mar 2020" +# define OPENSSL_VERSION_NUMBER 0x1010106fL +# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1f 31 Mar 2020" /*- * The macros below are to be used for shared library (.so, .dll, ...) diff --git a/deps/openssl/openssl/include/openssl/sslerr.h b/deps/openssl/openssl/include/openssl/sslerr.h index 0ef684f3c13192..82983d3c1e99fd 100644 --- a/deps/openssl/openssl/include/openssl/sslerr.h +++ b/deps/openssl/openssl/include/openssl/sslerr.h @@ -734,7 +734,6 @@ int ERR_load_SSL_strings(void); # define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 # define SSL_R_UNEXPECTED_CCS_MESSAGE 262 # define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 -# define SSL_R_UNEXPECTED_EOF_WHILE_READING 294 # define SSL_R_UNEXPECTED_MESSAGE 244 # define SSL_R_UNEXPECTED_RECORD 245 # define SSL_R_UNINITIALIZED 276 diff --git a/deps/openssl/openssl/ssl/record/rec_layer_s3.c b/deps/openssl/openssl/ssl/record/rec_layer_s3.c index 1c885a664f35e3..b2a7a47eb07529 100644 --- a/deps/openssl/openssl/ssl/record/rec_layer_s3.c +++ b/deps/openssl/openssl/ssl/record/rec_layer_s3.c @@ -296,12 +296,6 @@ int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold, ret = BIO_read(s->rbio, pkt + len + left, max - left); if (ret >= 0) bioread = ret; - if (ret <= 0 - && !BIO_should_retry(s->rbio) - && BIO_eof(s->rbio)) { - SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_READ_N, - SSL_R_UNEXPECTED_EOF_WHILE_READING); - } } else { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_READ_N, SSL_R_READ_BIO_NOT_SET); diff --git a/deps/openssl/openssl/ssl/ssl_err.c b/deps/openssl/openssl/ssl/ssl_err.c index a0c7b79659d4d7..4b12ed1485d985 100644 --- a/deps/openssl/openssl/ssl/ssl_err.c +++ b/deps/openssl/openssl/ssl/ssl_err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -1205,8 +1205,6 @@ static const ERR_STRING_DATA SSL_str_reasons[] = { "unexpected ccs message"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_END_OF_EARLY_DATA), "unexpected end of early data"}, - {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_EOF_WHILE_READING), - "unexpected eof while reading"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_MESSAGE), "unexpected message"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNEXPECTED_RECORD), "unexpected record"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNINITIALIZED), "uninitialized"}, From 8586838febc905672a54e5fb1e868ebd4bf7925f Mon Sep 17 00:00:00 2001 From: Hassaan Pasha Date: Tue, 31 Mar 2020 18:10:56 +0500 Subject: [PATCH 081/181] deps: update archs files for OpenSSL-1.1.1f MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After an OpenSSL source update, all the config files need to be regenerated and comitted by: $ cd deps/openssl/config $ make $ git add deps/openssl/config/archs $ git add deps/openssl/openssl/include/crypto/bn_conf.h $ git add deps/openssl/openssl/include/crypto/dso_conf.h $ git add deps/openssl/openssl/include/openssl/opensslconf.h $ git commit PR-URL: https://github.com/nodejs/node/pull/32583 Reviewed-By: Sam Roberts Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- deps/openssl/config/archs/BSD-x86/asm/configdata.pm | 6 +++--- deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm | 6 +++--- .../config/archs/BSD-x86/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm | 6 +++--- .../openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm | 6 +++--- .../openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h | 2 +- .../config/archs/BSD-x86_64/asm_avx2/configdata.pm | 6 +++--- .../config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm | 6 +++--- .../config/archs/BSD-x86_64/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/VC-WIN32/asm/configdata.pm | 8 ++++---- deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm | 8 ++++---- .../config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm | 8 ++++---- .../config/archs/VC-WIN32/no-asm/crypto/buildinf.h | 2 +- .../config/archs/VC-WIN64-ARM/no-asm/configdata.pm | 8 ++++---- .../config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm | 8 ++++---- deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h | 2 +- .../openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm | 8 ++++---- .../config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm | 8 ++++---- .../config/archs/VC-WIN64A/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/aix-gcc/asm/configdata.pm | 6 +++--- deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm | 6 +++--- .../config/archs/aix-gcc/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm | 6 +++--- .../openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/aix64-gcc/asm/configdata.pm | 6 +++--- deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h | 2 +- .../openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm | 6 +++--- .../config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm | 6 +++--- .../config/archs/aix64-gcc/no-asm/crypto/buildinf.h | 2 +- .../openssl/config/archs/darwin-i386-cc/asm/configdata.pm | 6 +++--- .../config/archs/darwin-i386-cc/asm/crypto/buildinf.h | 2 +- .../config/archs/darwin-i386-cc/asm_avx2/configdata.pm | 6 +++--- .../archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/darwin-i386-cc/no-asm/configdata.pm | 6 +++--- .../config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h | 2 +- .../config/archs/darwin64-x86_64-cc/asm/configdata.pm | 6 +++--- .../config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h | 2 +- .../archs/darwin64-x86_64-cc/asm_avx2/configdata.pm | 6 +++--- .../archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/darwin64-x86_64-cc/no-asm/configdata.pm | 6 +++--- .../archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-aarch64/asm/configdata.pm | 6 +++--- .../config/archs/linux-aarch64/asm/crypto/buildinf.h | 2 +- .../config/archs/linux-aarch64/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/linux-aarch64/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-aarch64/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-armv4/asm/configdata.pm | 6 +++--- .../config/archs/linux-armv4/asm/crypto/buildinf.h | 2 +- .../config/archs/linux-armv4/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-armv4/asm_avx2/crypto/buildinf.h | 2 +- .../openssl/config/archs/linux-armv4/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-armv4/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-elf/asm/configdata.pm | 6 +++--- deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h | 2 +- .../openssl/config/archs/linux-elf/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-elf/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-elf/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-elf/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-ppc/asm/configdata.pm | 6 +++--- deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h | 2 +- .../openssl/config/archs/linux-ppc/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-ppc/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-ppc/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-ppc64/asm/configdata.pm | 6 +++--- .../config/archs/linux-ppc64/asm/crypto/buildinf.h | 2 +- .../config/archs/linux-ppc64/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h | 2 +- .../openssl/config/archs/linux-ppc64/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-ppc64/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm | 6 +++--- .../config/archs/linux-ppc64le/asm/crypto/buildinf.h | 2 +- .../config/archs/linux-ppc64le/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/linux-ppc64le/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-ppc64le/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-x32/asm/configdata.pm | 6 +++--- deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h | 2 +- .../openssl/config/archs/linux-x32/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-x32/asm_avx2/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-x32/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-x32/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux-x86_64/asm/configdata.pm | 6 +++--- .../config/archs/linux-x86_64/asm/crypto/buildinf.h | 2 +- .../config/archs/linux-x86_64/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/linux-x86_64/no-asm/configdata.pm | 6 +++--- .../config/archs/linux-x86_64/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux32-s390x/asm/configdata.pm | 6 +++--- .../config/archs/linux32-s390x/asm/crypto/buildinf.h | 2 +- .../config/archs/linux32-s390x/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/linux32-s390x/no-asm/configdata.pm | 6 +++--- .../config/archs/linux32-s390x/no-asm/crypto/buildinf.h | 2 +- .../openssl/config/archs/linux64-mips64/asm/configdata.pm | 6 +++--- .../config/archs/linux64-mips64/asm/crypto/buildinf.h | 2 +- .../config/archs/linux64-mips64/asm_avx2/configdata.pm | 6 +++--- .../archs/linux64-mips64/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/linux64-mips64/no-asm/configdata.pm | 6 +++--- .../config/archs/linux64-mips64/no-asm/crypto/buildinf.h | 2 +- deps/openssl/config/archs/linux64-s390x/asm/configdata.pm | 6 +++--- .../config/archs/linux64-s390x/asm/crypto/buildinf.h | 2 +- .../config/archs/linux64-s390x/asm_avx2/configdata.pm | 6 +++--- .../config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/linux64-s390x/no-asm/configdata.pm | 6 +++--- .../config/archs/linux64-s390x/no-asm/crypto/buildinf.h | 2 +- .../config/archs/solaris-x86-gcc/asm/configdata.pm | 6 +++--- .../config/archs/solaris-x86-gcc/asm/crypto/buildinf.h | 2 +- .../config/archs/solaris-x86-gcc/asm_avx2/configdata.pm | 6 +++--- .../archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h | 2 +- .../config/archs/solaris-x86-gcc/no-asm/configdata.pm | 6 +++--- .../config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h | 2 +- .../config/archs/solaris64-x86_64-gcc/asm/configdata.pm | 6 +++--- .../archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h | 2 +- .../archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm | 6 +++--- .../archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h | 2 +- .../archs/solaris64-x86_64-gcc/no-asm/configdata.pm | 6 +++--- .../archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h | 2 +- deps/openssl/openssl/include/crypto/bn_conf.h | 1 + deps/openssl/openssl/include/crypto/dso_conf.h | 1 + deps/openssl/openssl/include/openssl/opensslconf.h | 1 + 131 files changed, 266 insertions(+), 263 deletions(-) create mode 100644 deps/openssl/openssl/include/crypto/bn_conf.h create mode 100644 deps/openssl/openssl/include/crypto/dso_conf.h create mode 100644 deps/openssl/openssl/include/openssl/opensslconf.h diff --git a/deps/openssl/config/archs/BSD-x86/asm/configdata.pm b/deps/openssl/config/archs/BSD-x86/asm/configdata.pm index 765ef97df004ce..08ca80d5165130 100644 --- a/deps/openssl/config/archs/BSD-x86/asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "BSD-x86" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h index cc24d30a9b9b75..c1217da5225db5 100644 --- a/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86" -#define DATE "built on: Wed Mar 18 21:04:48 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:25 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm b/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm index 08151c2b5bbcad..5ee9dadffd58ce 100644 --- a/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "BSD-x86" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h index 96c786974c2af5..060858b510af1a 100644 --- a/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86" -#define DATE "built on: Wed Mar 18 21:04:52 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:27 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm b/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm index c8fd824b7fa837..cb7ef8b1d0dc9c 100644 --- a/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "BSD-x86" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h index 4d7a6c77c175cd..da7a46d286147f 100644 --- a/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86" -#define DATE "built on: Wed Mar 18 21:04:56 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:30 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm b/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm index 49248aba5ea4b1..663c00a7885252 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "BSD-x86_64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h index b52f1881d3036e..28ea564386bb3e 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86_64" -#define DATE "built on: Wed Mar 18 21:04:59 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:31 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm index 30164e88aa0d0c..608f5cfd9124f6 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "BSD-x86_64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h index 6cb84c034f6626..304f2aeec37ea4 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86_64" -#define DATE "built on: Wed Mar 18 21:05:08 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:37 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm b/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm index 23a0ff1905e00e..830dd61c38c9e8 100644 --- a/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "BSD-x86_64" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h index 06c423068a45b5..d0b6a3b33d2127 100644 --- a/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86_64" -#define DATE "built on: Wed Mar 18 21:05:17 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:43 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm b/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm index 1354452500558b..bc6472d789ce3f 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm @@ -66,7 +66,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "VC-WIN32" ], perlenv => { "AR" => undef, @@ -115,8 +115,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN32", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( @@ -132,7 +132,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x5567c34c1cd8)", + RANLIB => "CODE(0x55e4d97a23c8)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86.s aesni-x86.s", diff --git a/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h index a0e422963d254b..c5f019621159f6 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Wed Mar 18 21:11:00 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:59 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm b/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm index 14713dbff02eeb..567fd89b831f3b 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm @@ -66,7 +66,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "VC-WIN32" ], perlenv => { "AR" => undef, @@ -115,8 +115,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN32", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( @@ -132,7 +132,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x56041fcde128)", + RANLIB => "CODE(0x55e7fe7b8518)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86.s aesni-x86.s", diff --git a/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h index 77f65c3b5445e2..6c678de053103a 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Wed Mar 18 21:11:06 2020 UTC" +#define DATE "built on: Tue Mar 31 13:09:01 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm b/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm index e2e28d75311dd3..38463db00b925e 100644 --- a/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm @@ -65,7 +65,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "VC-WIN32" ], perlenv => { "AR" => undef, @@ -114,8 +114,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN32", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( @@ -131,7 +131,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55e705f67598)", + RANLIB => "CODE(0x56297fab3cf8)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c", diff --git a/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h index 71f5a9d1a106e9..42e833d4987ca6 100644 --- a/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Wed Mar 18 21:11:12 2020 UTC" +#define DATE "built on: Tue Mar 31 13:09:04 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm index 949959ff1074ad..a2cc3195c62ea8 100644 --- a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm @@ -64,7 +64,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "VC-WIN64-ARM" ], perlenv => { "AR" => undef, @@ -113,8 +113,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64-ARM", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( @@ -128,7 +128,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55748984a208)", + RANLIB => "CODE(0x55d021518948)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/50-win-onecore.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c", diff --git a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h index 95181bd2e5e4f9..8d6831636e9cd7 100644 --- a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: VC-WIN64-ARM" -#define DATE "built on: Wed Mar 18 21:11:15 2020 UTC" +#define DATE "built on: Tue Mar 31 13:09:05 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm b/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm index 84a7982debc195..b86898557c11d6 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm @@ -67,7 +67,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "VC-WIN64A" ], perlenv => { "AR" => undef, @@ -116,8 +116,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64A", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( @@ -133,7 +133,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x556e5b07ddf8)", + RANLIB => "CODE(0x5636e84e0f08)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s", diff --git a/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h index eee9e84f1825ed..83bab9cf6b64be 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Wed Mar 18 21:10:25 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:44 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm index a95fc8411c77fe..b3fe1077ab5899 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm @@ -67,7 +67,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "VC-WIN64A" ], perlenv => { "AR" => undef, @@ -116,8 +116,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64A", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( @@ -133,7 +133,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55c8e9449798)", + RANLIB => "CODE(0x55c9eeaa7548)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s", diff --git a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h index 59f6aefb5a0ecf..5604bc0c8d4d58 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Wed Mar 18 21:10:39 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:50 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm b/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm index 0091b95296b8f9..e290ef9ba0b04f 100644 --- a/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm @@ -66,7 +66,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "VC-WIN64A" ], perlenv => { "AR" => undef, @@ -115,8 +115,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64A", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( @@ -132,7 +132,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x557c73be49d8)", + RANLIB => "CODE(0x55e2b213e978)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c", diff --git a/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h index 00baa0f8636963..25d909fedcd60a 100644 --- a/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Wed Mar 18 21:10:56 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:57 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix-gcc/asm/configdata.pm b/deps/openssl/config/archs/aix-gcc/asm/configdata.pm index 7dc4c54dd0fe4c..e215fe2c64caee 100644 --- a/deps/openssl/config/archs/aix-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/aix-gcc/asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "aix-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h index 39bc5ba3c4b295..1bf4b0c91391ac 100644 --- a/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix-gcc" -#define DATE "built on: Wed Mar 18 21:04:29 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:13 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm index 2308e3e39b6966..ee23e92155abb4 100644 --- a/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "aix-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h index eadeff3e4417da..caee112a51705c 100644 --- a/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix-gcc" -#define DATE "built on: Wed Mar 18 21:04:33 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:15 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm index 401c0fa7dc230a..d8b9a02b58d791 100644 --- a/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "aix-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h index 5a597aebe4a3eb..7700603f9c6072 100644 --- a/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix-gcc" -#define DATE "built on: Wed Mar 18 21:04:36 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:17 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm b/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm index 11958ce68b9186..b1f37dd0e2fb58 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "aix64-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h index a994547d9f6878..bf1dea5cbf71ef 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix64-gcc" -#define DATE "built on: Wed Mar 18 21:04:38 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:19 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm index ce4e06798c4b0e..85a65040b9139d 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "aix64-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h index c53f28b67b46ab..5ebc4866787eb9 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix64-gcc" -#define DATE "built on: Wed Mar 18 21:04:42 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:21 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm index e5164e6d11a314..5d2193f6036eff 100644 --- a/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "aix64-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h index eca0e52e0aa6ff..0164f65785626d 100644 --- a/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix64-gcc" -#define DATE "built on: Wed Mar 18 21:04:46 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:23 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm b/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm index e7607607e41f66..b3c3e1c8afd567 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm +++ b/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "darwin-i386-cc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin-i386-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h index c577b784d27053..88846892fcea2b 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin-i386-cc" -#define DATE "built on: Wed Mar 18 21:05:40 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:57 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm index a35bca92f08a0d..92089136fa7317 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "darwin-i386-cc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin-i386-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h index a925b543a9fac5..f1ca76d4d22c98 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin-i386-cc" -#define DATE "built on: Wed Mar 18 21:05:45 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:00 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm b/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm index 191fabfac75fcb..2cc2a0942d2e2f 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "darwin-i386-cc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "darwin-i386-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h index 17da37fa077fa2..46c7b22f94f618 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin-i386-cc" -#define DATE "built on: Wed Mar 18 21:05:49 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:02 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm index b4e4f412154218..0508addbfb9028 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "darwin64-x86_64-cc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin64-x86_64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h index ab5367073d6352..435e112c225f32 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-x86_64-cc" -#define DATE "built on: Wed Mar 18 21:05:19 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:44 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm index e07de8a9b50ad8..28e2afa0405d4c 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "darwin64-x86_64-cc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin64-x86_64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h index 7847154abb8994..f57777e0182e75 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-x86_64-cc" -#define DATE "built on: Wed Mar 18 21:05:29 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:50 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm index 12d99f475e421e..d6178f690faf12 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "darwin64-x86_64-cc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "darwin64-x86_64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h index 43f321a7ac65d0..3f9061e9182b39 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-x86_64-cc" -#define DATE "built on: Wed Mar 18 21:05:38 2020 UTC" +#define DATE "built on: Tue Mar 31 13:06:56 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm b/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm index 1e08556a96b2bc..87970f636ee3e3 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-aarch64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-aarch64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h index ed35c1e5ca7997..f6403bc170b2b1 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-aarch64" -#define DATE "built on: Wed Mar 18 21:05:53 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:04 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm index 591ab6875b226b..8ec96f7608fe44 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-aarch64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-aarch64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h index 672273eb20e94a..1706b65541668c 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-aarch64" -#define DATE "built on: Wed Mar 18 21:05:58 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:06 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm b/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm index a36f3889d4751f..2b55760f8ce3b2 100644 --- a/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-aarch64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-aarch64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h index 4f6ff84c2810f2..f48903bda838a5 100644 --- a/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-aarch64" -#define DATE "built on: Wed Mar 18 21:06:04 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:08 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-armv4/asm/configdata.pm b/deps/openssl/config/archs/linux-armv4/asm/configdata.pm index 42746324ce6230..e363ad088ac90d 100644 --- a/deps/openssl/config/archs/linux-armv4/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-armv4/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-armv4" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-armv4", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h index 69027a7fb80eb8..8b54c08b597490 100644 --- a/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-armv4" -#define DATE "built on: Wed Mar 18 21:06:07 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:10 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm index ad3c832efe9312..4baa86c1bc3a17 100644 --- a/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-armv4" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-armv4", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h index d1b23647596725..0a1cfb5af65396 100644 --- a/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-armv4" -#define DATE "built on: Wed Mar 18 21:06:14 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:12 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm b/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm index c1fb4d9a7e6d75..9d3f8edad4d5e8 100644 --- a/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-armv4" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-armv4", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h index b5e738fe28df89..b408fbceb5a6fe 100644 --- a/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-armv4" -#define DATE "built on: Wed Mar 18 21:06:19 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:15 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-elf/asm/configdata.pm b/deps/openssl/config/archs/linux-elf/asm/configdata.pm index 8a4cc46d2bc848..52cc1f512470c6 100644 --- a/deps/openssl/config/archs/linux-elf/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-elf/asm/configdata.pm @@ -63,7 +63,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-elf" ], perlenv => { "AR" => undef, @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-elf", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h index bd6dc58174b08f..ff8d7e208faf16 100644 --- a/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-elf" -#define DATE "built on: Wed Mar 18 21:06:23 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:16 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm index 214775155c00f7..502c6b3e860bcb 100644 --- a/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm @@ -63,7 +63,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-elf" ], perlenv => { "AR" => undef, @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-elf", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h index c7df3525a0d884..eca89be75df62c 100644 --- a/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-elf" -#define DATE "built on: Wed Mar 18 21:06:30 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:19 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm b/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm index cd93118c7746ca..90fb20dc6e8cc9 100644 --- a/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-elf" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-elf", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h index 7dbb94e08737c2..1c29f7b8db2b8c 100644 --- a/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-elf" -#define DATE "built on: Wed Mar 18 21:06:37 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:22 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc/asm/configdata.pm b/deps/openssl/config/archs/linux-ppc/asm/configdata.pm index 1afb56190cf72d..9ffd0d94f2b8a0 100644 --- a/deps/openssl/config/archs/linux-ppc/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-ppc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h index 1072f9d31176ca..8d2f93f288559e 100644 --- a/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc" -#define DATE "built on: Wed Mar 18 21:07:41 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:51 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm index ae2648d219adb7..151da7ad6f1d44 100644 --- a/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-ppc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h index 559beb8cb0d6b1..d4badd62c4bdf7 100644 --- a/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc" -#define DATE "built on: Wed Mar 18 21:07:49 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:53 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm b/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm index 30a59660025863..b76936f817ebd0 100644 --- a/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-ppc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h index 58a71fa717b68f..cd9f1386d1172f 100644 --- a/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc" -#define DATE "built on: Wed Mar 18 21:07:59 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:55 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm index 1f45e9693072bd..dc2a11c290559c 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-ppc64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h index f367bbd3426450..7a0f24d3f79d1d 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64" -#define DATE "built on: Wed Mar 18 21:08:05 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:57 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm index d1cc20b09ef1a5..5a400521b6c608 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-ppc64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h index dc7442135ad376..0ca1c74d67b723 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64" -#define DATE "built on: Wed Mar 18 21:08:13 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:59 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm index 4b7653af00bde5..880d6d0455672b 100644 --- a/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-ppc64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h index ca91089788aedd..1d7d48e4df4c82 100644 --- a/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64" -#define DATE "built on: Wed Mar 18 21:08:25 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:02 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm index be34b5bfb58064..2c3557016cc97e 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-ppc64le" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64le", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h index 1dbf68d3564b60..7f2ca33a6fbf08 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64le" -#define DATE "built on: Wed Mar 18 21:08:32 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:04 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm index f007db765e180d..a760edb45e8416 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-ppc64le" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64le", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h index 2bb616361144e4..10ac028310ea43 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64le" -#define DATE "built on: Wed Mar 18 21:08:43 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:06 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm index b63dcfe765aa5e..2cd3cf0361253f 100644 --- a/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-ppc64le" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64le", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h index 98bbd243c19c9a..cba3ef37310283 100644 --- a/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64le" -#define DATE "built on: Wed Mar 18 21:08:54 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:08 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x32/asm/configdata.pm b/deps/openssl/config/archs/linux-x32/asm/configdata.pm index 87cae322cfb182..35c87ff1cacb87 100644 --- a/deps/openssl/config/archs/linux-x32/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x32/asm/configdata.pm @@ -63,7 +63,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-x32" ], perlenv => { "AR" => undef, @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x32", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h index 2dbe97005cf8ad..3017190e3325a4 100644 --- a/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x32" -#define DATE "built on: Wed Mar 18 21:06:40 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:23 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm index 73d49d831b99b4..427ec7fa242d93 100644 --- a/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm @@ -63,7 +63,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-x32" ], perlenv => { "AR" => undef, @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x32", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h index 5b88a094e60a2d..5100bc5a9ecc23 100644 --- a/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x32" -#define DATE "built on: Wed Mar 18 21:06:52 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:29 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm b/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm index 7943ec12dfc802..b4c992be1e4755 100644 --- a/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-x32" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-x32", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h index fb611fa2c2e720..44c24ddc95fadd 100644 --- a/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x32" -#define DATE "built on: Wed Mar 18 21:07:03 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:36 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm b/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm index 6962df4c99b6be..64b19df0b50315 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm @@ -63,7 +63,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-x86_64" ], perlenv => { "AR" => undef, @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h index 83d6c611ca4206..de8d70dfab22ff 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x86_64" -#define DATE "built on: Wed Mar 18 21:07:06 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:37 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm index 4c4db242e4e88e..3a92a5f3df421e 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm @@ -63,7 +63,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux-x86_64" ], perlenv => { "AR" => undef, @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h index 62ab79d821c028..973a1d49fc7f8c 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x86_64" -#define DATE "built on: Wed Mar 18 21:07:18 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:43 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm b/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm index e9a7a8ce9f17d7..ec40df48a6db36 100644 --- a/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux-x86_64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h index 208c6e0e31cced..8b3e2ac9d677ce 100644 --- a/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x86_64" -#define DATE "built on: Wed Mar 18 21:07:36 2020 UTC" +#define DATE "built on: Tue Mar 31 13:07:49 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm b/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm index 3efb27cfc66c16..4baa96d1a54f66 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm +++ b/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux32-s390x" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux32-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h index 9d017d177882b0..78112639711a4f 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux32-s390x" -#define DATE "built on: Wed Mar 18 21:08:58 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:10 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm index d8384829df628d..9a6b1d89da1a1a 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux32-s390x" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux32-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h index e7fee2eb3e3165..4628d77442dc09 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux32-s390x" -#define DATE "built on: Wed Mar 18 21:09:02 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:11 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm b/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm index ba39c8551f82c0..3ba5360d81c20c 100644 --- a/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux32-s390x" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux32-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h index 2fbe63990cc612..69aac7b4136fe0 100644 --- a/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux32-s390x" -#define DATE "built on: Wed Mar 18 21:09:09 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:13 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm b/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm index 1302d730d02d59..6d647fb70ff59f 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux64-mips64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-mips64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h index 5f969bc3a4bfc0..e34c4f639e20a3 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-mips64" -#define DATE "built on: Wed Mar 18 21:09:33 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:19 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm index f53a77e0a05edb..c6552186a38de3 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux64-mips64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-mips64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h index 87d8f13efafd96..aebc04c835dbd9 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-mips64" -#define DATE "built on: Wed Mar 18 21:09:39 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:21 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm b/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm index 62586346a8d849..22ad32263b92f2 100644 --- a/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux64-mips64" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-mips64", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h index f58b88ffe332db..ccc6b1170b9199 100644 --- a/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-mips64" -#define DATE "built on: Wed Mar 18 21:09:46 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:22 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm b/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm index b73e953e4d3b32..b588a78aaa396c 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux64-s390x" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h index 48a866e7b2457e..7906059969df10 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-s390x" -#define DATE "built on: Wed Mar 18 21:09:15 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:14 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm index 4419066fcab00e..cfc5eec1e38caf 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "linux64-s390x" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h index 667449c83d298d..a64e67ec338d7b 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-s390x" -#define DATE "built on: Wed Mar 18 21:09:21 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:16 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm b/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm index 37fd739d54ceaa..fe7360fbc1263a 100644 --- a/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "linux64-s390x" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h index 984838d0e04349..c040b1b01640ae 100644 --- a/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-s390x" -#define DATE "built on: Wed Mar 18 21:09:26 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:18 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm b/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm index 6374bc5069f5eb..27ac0f01f4e9ef 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "solaris-x86-gcc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris-x86-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h index 201a165d1cd70f..d6c8a3b7631169 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris-x86-gcc" -#define DATE "built on: Wed Mar 18 21:09:49 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:24 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm index 2cca99ea71113f..46a918d381edcf 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "solaris-x86-gcc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris-x86-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h index 98a20770933a66..2b864734a6f618 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris-x86-gcc" -#define DATE "built on: Wed Mar 18 21:09:53 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:27 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm index 2bdfa61a081508..47d9080b188c77 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "solaris-x86-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "solaris-x86-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h index 0418a6f8bac290..794a3b4f92dd9c 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris-x86-gcc" -#define DATE "built on: Wed Mar 18 21:09:57 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:29 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm index 499dac23213ea1..219287bc9d6085 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "solaris64-x86_64-gcc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris64-x86_64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h index a8141d6c785966..2eb96dc54d9a91 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris64-x86_64-gcc" -#define DATE "built on: Wed Mar 18 21:10:00 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:31 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm index 6fb7716b83a4ac..dcdb2d6fbc7428 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm @@ -62,7 +62,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "solaris64-x86_64-gcc" ], perlenv => { "AR" => undef, @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris64-x86_64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h index 2e41bb9b2ce786..0a097756d91843 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris64-x86_64-gcc" -#define DATE "built on: Wed Mar 18 21:10:11 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:36 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm index d398c0a8c31c26..d4f7b159c7225e 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm @@ -61,7 +61,7 @@ our %config = ( options => "enable-ssl-trace no-afalgeng no-asan no-asm no-buildtest-c++ no-comp no-crypto-mdebug no-crypto-mdebug-backtrace no-devcryptoeng no-dynamic-engine no-ec_nistp_64_gcc_128 no-egd no-external-tests no-fuzz-afl no-fuzz-libfuzzer no-heartbeats no-md2 no-msan no-rc5 no-sctp no-shared no-ssl3 no-ssl3-method no-ubsan no-unit-test no-weak-ssl-ciphers no-zlib no-zlib-dynamic", perl_archname => "x86_64-linux-gnu-thread-multi", perl_cmd => "/usr/bin/perl", - perl_version => "5.28.1", + perl_version => "5.26.1", perlargv => [ "no-comp", "no-shared", "no-afalgeng", "enable-ssl-trace", "no-asm", "solaris64-x86_64-gcc" ], perlenv => { "AR" => undef, @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "solaris64-x86_64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1e", - version_num => "0x1010105fL", + version => "1.1.1f", + version_num => "0x1010106fL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h index c97a2322371166..b76962598a553b 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris64-x86_64-gcc" -#define DATE "built on: Wed Mar 18 21:10:22 2020 UTC" +#define DATE "built on: Tue Mar 31 13:08:42 2020 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/openssl/include/crypto/bn_conf.h b/deps/openssl/openssl/include/crypto/bn_conf.h new file mode 100644 index 00000000000000..79400c6472a49c --- /dev/null +++ b/deps/openssl/openssl/include/crypto/bn_conf.h @@ -0,0 +1 @@ +#include "../../../config/bn_conf.h" diff --git a/deps/openssl/openssl/include/crypto/dso_conf.h b/deps/openssl/openssl/include/crypto/dso_conf.h new file mode 100644 index 00000000000000..e7f2afa9872320 --- /dev/null +++ b/deps/openssl/openssl/include/crypto/dso_conf.h @@ -0,0 +1 @@ +#include "../../../config/dso_conf.h" diff --git a/deps/openssl/openssl/include/openssl/opensslconf.h b/deps/openssl/openssl/include/openssl/opensslconf.h new file mode 100644 index 00000000000000..76c99d433ab886 --- /dev/null +++ b/deps/openssl/openssl/include/openssl/opensslconf.h @@ -0,0 +1 @@ +#include "../../config/opensslconf.h" From f0a31e33a82bfd1fe7e2c650f97ccd6802ca7156 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Tue, 31 Mar 2020 03:31:40 -0400 Subject: [PATCH 082/181] doc: update releaser list in README.md Moved emeritus members keys and fixed alphabetization issues PR-URL: https://github.com/nodejs/node/pull/32577 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Beth Griggs Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c7fe50e2e95278..2d6b98744624f3 100644 --- a/README.md +++ b/README.md @@ -548,10 +548,6 @@ GPG keys used to sign Node.js releases: `4ED778F539E3634C779C87C6D7062848A1AB005C` * **Colin Ihrig** <cjihrig@gmail.com> `94AE36675C464D64BAFA68DD7434390BDBE9B9C5` -* **Evan Lucas** <evanlucas@me.com> -`B9AE9905FFD7803F25714661B63B535A4C206CA9` -* **Gibson Fahnestock** <gibfahn@gmail.com> -`77984A986EBC2AA786BC0F66B01FBB92821C587A` * **James M Snell** <jasnell@keybase.io> `71DCFD284A79C3B38668286BC97EC7A07EDE3FC1` * **Michaël Zasso** <targos@protonmail.com> @@ -569,15 +565,13 @@ To import the full set of trusted release keys: ```shell gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C -gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 -gpg --keyserver pool.sks-keyservers.net --recv-keys B9AE9905FFD7803F25714661B63B535A4C206CA9 -gpg --keyserver pool.sks-keyservers.net --recv-keys 77984A986EBC2AA786BC0F66B01FBB92821C587A gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D gpg --keyserver pool.sks-keyservers.net --recv-keys A48C2BEE680E841632CD4E44F07496B3EB3C1762 +gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C ``` See the section above on [Verifying Binaries](#verifying-binaries) for how to @@ -585,14 +579,18 @@ use these keys to verify a downloaded file. Other keys used to sign some previous releases: -* **Jeremiah Senkpiel** <fishrock@keybase.io> -`FD3A5288F042B6850C66B31F09FE44734EB7990E` * **Chris Dickinson** <christopher.s.dickinson@gmail.com> `9554F04D7259F04124DE6B476D5A82AC7E37093B` +* **Evan Lucas** <evanlucas@me.com> +`B9AE9905FFD7803F25714661B63B535A4C206CA9` +* **Gibson Fahnestock** <gibfahn@gmail.com> +`77984A986EBC2AA786BC0F66B01FBB92821C587A` * **Isaac Z. Schlueter** <i@izs.me> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6` * **Italo A. Casas** <me@italoacasas.com> `56730D5401028683275BD23C23EFEFE93C4CFFFE` +* **Jeremiah Senkpiel** <fishrock@keybase.io> +`FD3A5288F042B6850C66B31F09FE44734EB7990E` * **Julien Gilli** <jgilli@fastmail.fm> `114F43EE0176B71C7BC219DD50A3051F888C628D` * **Timothy J Fontaine** <tjfontaine@gmail.com> From 4e5271acfb3d8cfb416dab90e720c970aa9bd283 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 29 Mar 2020 16:42:00 +0200 Subject: [PATCH 083/181] tracing: do not attempt to call into JS when disallowed PR-URL: https://github.com/nodejs/node/pull/32548 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/env.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/env.cc b/src/env.cc index 66c3a386beefff..5551f36c1249e0 100644 --- a/src/env.cc +++ b/src/env.cc @@ -207,7 +207,7 @@ void InitThreadLocalOnce() { } void TrackingTraceStateObserver::UpdateTraceCategoryState() { - if (!env_->owns_process_state()) { + if (!env_->owns_process_state() || !env_->can_call_into_js()) { // Ideally, we’d have a consistent story that treats all threads/Environment // instances equally here. However, tracing is essentially global, and this // callback is called from whichever thread calls `StartTracing()` or @@ -228,8 +228,7 @@ void TrackingTraceStateObserver::UpdateTraceCategoryState() { TryCatchScope try_catch(env_); try_catch.SetVerbose(true); Local args[] = {Boolean::New(isolate, async_hooks_enabled)}; - cb->Call(env_->context(), Undefined(isolate), arraysize(args), args) - .ToLocalChecked(); + USE(cb->Call(env_->context(), Undefined(isolate), arraysize(args), args)); } static std::atomic next_thread_id{0}; From 4acd7f4390f4c73c14532fef1cb3e56911604935 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 29 Mar 2020 14:58:07 +0200 Subject: [PATCH 084/181] worker: do not emit 'exit' events during process.exit() Do not emit `'exit'` events caused by recursively stopping all running Workers from inside the `process.exit()` call. PR-URL: https://github.com/nodejs/node/pull/32546 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/env.cc | 1 + .../test-worker-nested-on-process-exit.js | 20 +++++++++++++++++ test/parallel/test-worker-on-process-exit.js | 22 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 test/parallel/test-worker-nested-on-process-exit.js create mode 100644 test/parallel/test-worker-on-process-exit.js diff --git a/src/env.cc b/src/env.cc index 5551f36c1249e0..7fb5116b3828c3 100644 --- a/src/env.cc +++ b/src/env.cc @@ -968,6 +968,7 @@ void Environment::Exit(int exit_code) { isolate(), stack_trace_limit(), StackTrace::kDetailed)); } if (is_main_thread()) { + set_can_call_into_js(false); stop_sub_worker_contexts(); DisposePlatform(); exit(exit_code); diff --git a/test/parallel/test-worker-nested-on-process-exit.js b/test/parallel/test-worker-nested-on-process-exit.js new file mode 100644 index 00000000000000..aa544fa3289a11 --- /dev/null +++ b/test/parallel/test-worker-nested-on-process-exit.js @@ -0,0 +1,20 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const { Worker, workerData } = require('worker_threads'); + +// Test that 'exit' events for nested Workers are not received when a Worker +// terminates itself through process.exit(). + +if (workerData === null) { + const nestedWorkerExitCounter = new Int32Array(new SharedArrayBuffer(4)); + const w = new Worker(__filename, { workerData: nestedWorkerExitCounter }); + w.on('exit', common.mustCall(() => { + assert.strictEqual(nestedWorkerExitCounter[0], 0); + })); +} else { + const nestedWorker = new Worker('setInterval(() => {}, 100)', { eval: true }); + // The counter should never be increased here. + nestedWorker.on('exit', () => workerData[0]++); + nestedWorker.on('online', () => process.exit()); +} diff --git a/test/parallel/test-worker-on-process-exit.js b/test/parallel/test-worker-on-process-exit.js new file mode 100644 index 00000000000000..ec1c4affd1cc6f --- /dev/null +++ b/test/parallel/test-worker-on-process-exit.js @@ -0,0 +1,22 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { spawnSync } = require('child_process'); +const { Worker } = require('worker_threads'); + +// Test that 'exit' events for Workers are not received when the main thread +// terminates itself through process.exit(). + +if (process.argv[2] !== 'child') { + const { + stdout, stderr, status + } = spawnSync(process.execPath, [__filename, 'child'], { encoding: 'utf8' }); + assert.strictEqual(stderr, ''); + assert.strictEqual(stdout, ''); + assert.strictEqual(status, 0); +} else { + const nestedWorker = new Worker('setInterval(() => {}, 100)', { eval: true }); + // This console.log() should never fire. + nestedWorker.on('exit', () => console.log('exit event received')); + nestedWorker.on('online', () => process.exit()); +} From 8597df48f79408b0a72049197982c67e424552c0 Mon Sep 17 00:00:00 2001 From: Alex R Date: Wed, 30 Oct 2019 23:33:33 +0100 Subject: [PATCH 085/181] http: fix incorrect headersTimeout measurement For keep-alive connections, the headersTimeout may fire during subsequent request because the measurement was reset after a request and not before a request. PR-URL: https://github.com/nodejs/node/pull/32329 Fixes: https://github.com/nodejs/node/issues/27363 Reviewed-By: Anna Henningsen Reviewed-By: Matteo Collina --- lib/_http_client.js | 3 +- lib/_http_common.js | 2 + lib/_http_server.js | 45 ++++------------ src/node_http_parser.cc | 37 +++++++++++++- test/async-hooks/test-graph.http.js | 4 +- ...low-headers-keepalive-multiple-requests.js | 51 +++++++++++++++++++ 6 files changed, 104 insertions(+), 38 deletions(-) create mode 100644 test/parallel/test-http-slow-headers-keepalive-multiple-requests.js diff --git a/lib/_http_client.js b/lib/_http_client.js index b414cd41a02041..2b83b8aa78ace0 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -681,7 +681,8 @@ function tickOnSocket(req, socket) { new HTTPClientAsyncResource('HTTPINCOMINGMESSAGE', req), req.maxHeaderSize || 0, req.insecureHTTPParser === undefined ? - isLenient() : req.insecureHTTPParser); + isLenient() : req.insecureHTTPParser, + 0); parser.socket = socket; parser.outgoing = req; req.parser = parser; diff --git a/lib/_http_common.js b/lib/_http_common.js index f1386e1a0915dd..eec965d7fcf8f1 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -47,6 +47,7 @@ const kOnHeadersComplete = HTTPParser.kOnHeadersComplete | 0; const kOnBody = HTTPParser.kOnBody | 0; const kOnMessageComplete = HTTPParser.kOnMessageComplete | 0; const kOnExecute = HTTPParser.kOnExecute | 0; +const kOnTimeout = HTTPParser.kOnTimeout | 0; const MAX_HEADER_PAIRS = 2000; @@ -165,6 +166,7 @@ const parsers = new FreeList('parsers', 1000, function parsersCb() { parser[kOnHeadersComplete] = parserOnHeadersComplete; parser[kOnBody] = parserOnBody; parser[kOnMessageComplete] = parserOnMessageComplete; + parser[kOnTimeout] = null; return parser; }); diff --git a/lib/_http_server.js b/lib/_http_server.js index 7b0cd8cd8ef597..c8b27dcd42cb5b 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -49,7 +49,6 @@ const { OutgoingMessage } = require('_http_outgoing'); const { kOutHeaders, kNeedDrain, - nowDate, emitStatistics } = require('internal/http'); const { @@ -142,6 +141,7 @@ const STATUS_CODES = { }; const kOnExecute = HTTPParser.kOnExecute | 0; +const kOnTimeout = HTTPParser.kOnTimeout | 0; class HTTPServerAsyncResource { constructor(type, socket) { @@ -426,11 +426,9 @@ function connectionListenerInternal(server, socket) { server.maxHeaderSize || 0, server.insecureHTTPParser === undefined ? isLenient() : server.insecureHTTPParser, + server.headersTimeout || 0, ); parser.socket = socket; - - // We are starting to wait for our headers. - parser.parsingHeadersStart = nowDate(); socket.parser = parser; // Propagate headers limit from server instance to parser @@ -482,6 +480,9 @@ function connectionListenerInternal(server, socket) { parser[kOnExecute] = onParserExecute.bind(undefined, server, socket, parser, state); + parser[kOnTimeout] = + onParserTimeout.bind(undefined, server, socket); + socket._paused = false; } @@ -570,21 +571,15 @@ function socketOnData(server, socket, parser, state, d) { function onParserExecute(server, socket, parser, state, ret) { socket._unrefTimer(); - const start = parser.parsingHeadersStart; debug('SERVER socketOnParserExecute %d', ret); + onParserExecuteCommon(server, socket, parser, state, ret, undefined); +} - // If we have not parsed the headers, destroy the socket - // after server.headersTimeout to protect from DoS attacks. - // start === 0 means that we have parsed headers. - if (start !== 0 && nowDate() - start > server.headersTimeout) { - const serverTimeout = server.emit('timeout', socket); - - if (!serverTimeout) - socket.destroy(); - return; - } +function onParserTimeout(server, socket) { + const serverTimeout = server.emit('timeout', socket); - onParserExecuteCommon(server, socket, parser, state, ret, undefined); + if (!serverTimeout) + socket.destroy(); } const noop = () => {}; @@ -722,13 +717,6 @@ function emitCloseNT(self) { function parserOnIncoming(server, socket, state, req, keepAlive) { resetSocketTimeout(server, socket, state); - if (server.keepAliveTimeout > 0) { - req.on('end', resetHeadersTimeoutOnReqEnd); - } - - // Set to zero to communicate that we have finished parsing. - socket.parser.parsingHeadersStart = 0; - if (req.upgrade) { req.upgrade = req.method === 'CONNECT' || server.listenerCount('upgrade') > 0; @@ -853,17 +841,6 @@ function generateSocketListenerWrapper(originalFnName) { }; } -function resetHeadersTimeoutOnReqEnd() { - debug('resetHeadersTimeoutOnReqEnd'); - - const parser = this.socket.parser; - // Parser can be null if the socket was destroyed - // in that case, there is nothing to do. - if (parser) { - parser.parsingHeadersStart = nowDate(); - } -} - module.exports = { STATUS_CODES, Server, diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 75d7e89a91c34f..2c75e6a532fff1 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -74,6 +74,7 @@ const uint32_t kOnHeadersComplete = 1; const uint32_t kOnBody = 2; const uint32_t kOnMessageComplete = 3; const uint32_t kOnExecute = 4; +const uint32_t kOnTimeout = 5; // Any more fields than this will be flushed into JS const size_t kMaxHeaderFieldsCount = 32; @@ -181,6 +182,7 @@ class Parser : public AsyncWrap, public StreamListener { num_fields_ = num_values_ = 0; url_.Reset(); status_message_.Reset(); + header_parsing_start_time_ = uv_hrtime(); return 0; } @@ -504,6 +506,7 @@ class Parser : public AsyncWrap, public StreamListener { bool lenient = args[3]->IsTrue(); uint64_t max_http_header_size = 0; + uint64_t headers_timeout = 0; CHECK(args[0]->IsInt32()); CHECK(args[1]->IsObject()); @@ -516,6 +519,11 @@ class Parser : public AsyncWrap, public StreamListener { max_http_header_size = env->options()->max_http_header_size; } + if (args.Length() > 4) { + CHECK(args[4]->IsInt32()); + headers_timeout = args[4].As()->Value(); + } + llhttp_type_t type = static_cast(args[0].As()->Value()); @@ -532,7 +540,7 @@ class Parser : public AsyncWrap, public StreamListener { parser->set_provider_type(provider); parser->AsyncReset(args[1].As()); - parser->Init(type, max_http_header_size, lenient); + parser->Init(type, max_http_header_size, lenient, headers_timeout); } template @@ -636,6 +644,24 @@ class Parser : public AsyncWrap, public StreamListener { if (ret.IsEmpty()) return; + // check header parsing time + if (header_parsing_start_time_ != 0 && headers_timeout_ != 0) { + uint64_t now = uv_hrtime(); + uint64_t parsing_time = (now - header_parsing_start_time_) / 1e6; + + if (parsing_time > headers_timeout_) { + Local cb = + object()->Get(env()->context(), kOnTimeout).ToLocalChecked(); + + if (!cb->IsFunction()) + return; + + MakeCallback(cb.As(), 0, nullptr); + + return; + } + } + Local cb = object()->Get(env()->context(), kOnExecute).ToLocalChecked(); @@ -779,7 +805,8 @@ class Parser : public AsyncWrap, public StreamListener { } - void Init(llhttp_type_t type, uint64_t max_http_header_size, bool lenient) { + void Init(llhttp_type_t type, uint64_t max_http_header_size, + bool lenient, uint64_t headers_timeout) { llhttp_init(&parser_, type, &settings); llhttp_set_lenient(&parser_, lenient); header_nread_ = 0; @@ -790,6 +817,8 @@ class Parser : public AsyncWrap, public StreamListener { have_flushed_ = false; got_exception_ = false; max_http_header_size_ = max_http_header_size; + header_parsing_start_time_ = 0; + headers_timeout_ = headers_timeout; } @@ -831,6 +860,8 @@ class Parser : public AsyncWrap, public StreamListener { bool pending_pause_ = false; uint64_t header_nread_ = 0; uint64_t max_http_header_size_; + uint64_t headers_timeout_; + uint64_t header_parsing_start_time_ = 0; // These are helper functions for filling `http_parser_settings`, which turn // a member function of Parser into a C-style HTTP parser callback. @@ -890,6 +921,8 @@ void InitializeHttpParser(Local target, Integer::NewFromUnsigned(env->isolate(), kOnMessageComplete)); t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kOnExecute"), Integer::NewFromUnsigned(env->isolate(), kOnExecute)); + t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kOnTimeout"), + Integer::NewFromUnsigned(env->isolate(), kOnTimeout)); Local methods = Array::New(env->isolate()); #define V(num, name, string) \ diff --git a/test/async-hooks/test-graph.http.js b/test/async-hooks/test-graph.http.js index db0c1265670a6f..3e36646e54e2ee 100644 --- a/test/async-hooks/test-graph.http.js +++ b/test/async-hooks/test-graph.http.js @@ -39,10 +39,12 @@ process.on('exit', () => { id: 'httpclientrequest:1', triggerAsyncId: 'tcpserver:1' }, { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, - { type: 'Timeout', id: 'timeout:1', triggerAsyncId: 'tcp:2' }, { type: 'HTTPINCOMINGMESSAGE', id: 'httpincomingmessage:1', triggerAsyncId: 'tcp:2' }, + { type: 'Timeout', + id: 'timeout:1', + triggerAsyncId: 'httpincomingmessage:1' }, { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ] diff --git a/test/parallel/test-http-slow-headers-keepalive-multiple-requests.js b/test/parallel/test-http-slow-headers-keepalive-multiple-requests.js new file mode 100644 index 00000000000000..9ea76e8e56e952 --- /dev/null +++ b/test/parallel/test-http-slow-headers-keepalive-multiple-requests.js @@ -0,0 +1,51 @@ +'use strict'; + +const common = require('../common'); +const http = require('http'); +const net = require('net'); +const { finished } = require('stream'); + +const headers = + 'GET / HTTP/1.1\r\n' + + 'Host: localhost\r\n' + + 'Connection: keep-alive\r\n' + + 'Agent: node\r\n'; + +const baseTimeout = 1000; + +const server = http.createServer(common.mustCall((req, res) => { + req.resume(); + res.writeHead(200); + res.end(); +}, 2)); + +server.keepAliveTimeout = 10 * baseTimeout; +server.headersTimeout = baseTimeout; + +server.once('timeout', common.mustNotCall((socket) => { + socket.destroy(); +})); + +server.listen(0, () => { + const client = net.connect(server.address().port); + + // first request + client.write(headers); + client.write('\r\n'); + + setTimeout(() => { + // second request + client.write(headers); + // `headersTimeout` doesn't seem to fire if request + // is sent altogether. + setTimeout(() => { + client.write('\r\n'); + client.end(); + }, 10); + }, baseTimeout + 10); + + client.resume(); + finished(client, common.mustCall((err) => { + server.close(); + })); +}); From 78b90d9bc48aed7166c14d2e043f796317b233d2 Mon Sep 17 00:00:00 2001 From: Andrey Pechkurov Date: Thu, 26 Mar 2020 15:11:06 +0300 Subject: [PATCH 086/181] benchmark: fix error on server close in AsyncLocalStorage benchmark PR-URL: https://github.com/nodejs/node/pull/32503 Reviewed-By: Vladimir de Turckheim Reviewed-By: Matteo Collina Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson --- benchmark/async_hooks/async-resource-vs-destroy.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/benchmark/async_hooks/async-resource-vs-destroy.js b/benchmark/async_hooks/async-resource-vs-destroy.js index 1894e4e8777b8b..d48510d8929ab2 100644 --- a/benchmark/async_hooks/async-resource-vs-destroy.js +++ b/benchmark/async_hooks/async-resource-vs-destroy.js @@ -35,7 +35,7 @@ function buildCurrentResource(getServe) { function getCLS() { const resource = executionAsyncResource(); - if (resource === null || !resource[cls]) { + if (!resource[cls]) { return null; } return resource[cls].state; @@ -43,9 +43,6 @@ function buildCurrentResource(getServe) { function setCLS(state) { const resource = executionAsyncResource(); - if (resource === null) { - return; - } if (!resource[cls]) { resource[cls] = { state }; } else { @@ -116,11 +113,17 @@ function buildAsyncLocalStorage(getServe) { function getCLS() { const store = asyncLocalStorage.getStore(); + if (store === undefined) { + return null; + } return store.state; } function setCLS(state) { const store = asyncLocalStorage.getStore(); + if (store === undefined) { + return; + } store.state = state; } From e066584d94e7fbe81cf4978c517446fca6b00bbc Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 29 Mar 2020 00:34:07 +0100 Subject: [PATCH 087/181] src: align PerformanceState class name with conventions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Class names are written in UpperCamelCase. Otherwise, this looks like it’s a variable, not a class name. PR-URL: https://github.com/nodejs/node/pull/32539 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/env-inl.h | 2 +- src/env.cc | 2 +- src/env.h | 6 +++--- src/node_perf.cc | 6 +++--- src/node_perf_common.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index 237ab8e438597b..71660a035c8ea7 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -944,7 +944,7 @@ inline const Mutex& Environment::extra_linked_bindings_mutex() const { return extra_linked_bindings_mutex_; } -inline performance::performance_state* Environment::performance_state() { +inline performance::PerformanceState* Environment::performance_state() { return performance_state_.get(); } diff --git a/src/env.cc b/src/env.cc index 7fb5116b3828c3..ec2661e68be581 100644 --- a/src/env.cc +++ b/src/env.cc @@ -348,7 +348,7 @@ Environment::Environment(IsolateData* isolate_data, this); performance_state_ = - std::make_unique(isolate()); + std::make_unique(isolate()); performance_state_->Mark( performance::NODE_PERFORMANCE_MILESTONE_ENVIRONMENT); performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_NODE_START, diff --git a/src/env.h b/src/env.h index 6a459f00edb9e2..309bb494a746bd 100644 --- a/src/env.h +++ b/src/env.h @@ -64,7 +64,7 @@ class FileHandleReadWrap; } namespace performance { -class performance_state; +class PerformanceState; } namespace tracing { @@ -1016,7 +1016,7 @@ class Environment : public MemoryRetainer { inline std::vector>& file_handle_read_wrap_freelist(); - inline performance::performance_state* performance_state(); + inline performance::PerformanceState* performance_state(); inline std::unordered_map* performance_marks(); void CollectUVExceptionInfo(v8::Local context, @@ -1323,7 +1323,7 @@ class Environment : public MemoryRetainer { AliasedInt32Array stream_base_state_; - std::unique_ptr performance_state_; + std::unique_ptr performance_state_; std::unordered_map performance_marks_; bool has_run_bootstrapping_code_ = false; diff --git a/src/node_perf.cc b/src/node_perf.cc index 21766d3b89aa3b..e54edb5fe6d6e9 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -44,7 +44,7 @@ const uint64_t timeOrigin = PERFORMANCE_NOW(); const double timeOriginTimestamp = GetCurrentTimeInMicroseconds(); uint64_t performance_v8_start; -void performance_state::Mark(enum PerformanceMilestone milestone, +void PerformanceState::Mark(enum PerformanceMilestone milestone, uint64_t ts) { this->milestones[milestone] = ts; TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( @@ -267,7 +267,7 @@ void MarkGarbageCollectionEnd(Isolate* isolate, GCCallbackFlags flags, void* data) { Environment* env = static_cast(data); - performance_state* state = env->performance_state(); + PerformanceState* state = env->performance_state(); // If no one is listening to gc performance entries, do not create them. if (!state->observers[NODE_PERFORMANCE_ENTRY_TYPE_GC]) return; @@ -553,7 +553,7 @@ void Initialize(Local target, void* priv) { Environment* env = Environment::GetCurrent(context); Isolate* isolate = env->isolate(); - performance_state* state = env->performance_state(); + PerformanceState* state = env->performance_state(); target->Set(context, FIXED_ONE_BYTE_STRING(isolate, "observerCounts"), diff --git a/src/node_perf_common.h b/src/node_perf_common.h index 8e602a766367bd..75d266afc257e9 100644 --- a/src/node_perf_common.h +++ b/src/node_perf_common.h @@ -52,9 +52,9 @@ enum PerformanceEntryType { NODE_PERFORMANCE_ENTRY_TYPE_INVALID }; -class performance_state { +class PerformanceState { public: - explicit performance_state(v8::Isolate* isolate) : + explicit PerformanceState(v8::Isolate* isolate) : root( isolate, sizeof(performance_state_internal)), From f284d599bb8b1ecd0a11e5d1c4354d5f4c69f69f Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 29 Mar 2020 20:11:56 +0200 Subject: [PATCH 088/181] src: move JSONWriter into its own file The JSONWriter feature is not inherently related to the report feature in any way. As a drive-by fix, remove a number of unused header includes. PR-URL: https://github.com/nodejs/node/pull/32552 Reviewed-By: Colin Ihrig Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Richard Lau --- node.gyp | 4 +- src/json_utils.cc | 67 ++++++++ src/json_utils.h | 160 ++++++++++++++++++ src/node_report.cc | 3 + src/node_report.h | 159 ----------------- src/node_report_utils.cc | 64 +------ ...test_report_util.cc => test_json_utils.cc} | 6 +- 7 files changed, 238 insertions(+), 225 deletions(-) create mode 100644 src/json_utils.cc create mode 100644 src/json_utils.h rename test/cctest/{test_report_util.cc => test_json_utils.cc} (90%) diff --git a/node.gyp b/node.gyp index bbe796bc24a9b5..256415c9b83ebe 100644 --- a/node.gyp +++ b/node.gyp @@ -560,6 +560,7 @@ 'src/js_native_api_v8.h', 'src/js_native_api_v8_internals.h', 'src/js_stream.cc', + 'src/json_utils.cc', 'src/module_wrap.cc', 'src/node.cc', 'src/node_api.cc', @@ -644,6 +645,7 @@ 'src/histogram.h', 'src/histogram-inl.h', 'src/js_stream.h', + 'src/json_utils.h', 'src/large_pages/node_large_page.cc', 'src/large_pages/node_large_page.h', 'src/memory_tracker.h', @@ -1141,7 +1143,7 @@ 'test/cctest/test_linked_binding.cc', 'test/cctest/test_per_process.cc', 'test/cctest/test_platform.cc', - 'test/cctest/test_report_util.cc', + 'test/cctest/test_json_utils.cc', 'test/cctest/test_sockaddr.cc', 'test/cctest/test_traced_value.cc', 'test/cctest/test_util.cc', diff --git a/src/json_utils.cc b/src/json_utils.cc new file mode 100644 index 00000000000000..aa03a6d7305d75 --- /dev/null +++ b/src/json_utils.cc @@ -0,0 +1,67 @@ +#include "json_utils.h" + +namespace node { + +std::string EscapeJsonChars(const std::string& str) { + const std::string control_symbols[0x20] = { + "\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", + "\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", + "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", + "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", + "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f" + }; + + std::string ret; + size_t last_pos = 0; + size_t pos = 0; + for (; pos < str.size(); ++pos) { + std::string replace; + char ch = str[pos]; + if (ch == '\\') { + replace = "\\\\"; + } else if (ch == '\"') { + replace = "\\\""; + } else { + size_t num = static_cast(ch); + if (num < 0x20) replace = control_symbols[num]; + } + if (!replace.empty()) { + if (pos > last_pos) { + ret += str.substr(last_pos, pos - last_pos); + } + last_pos = pos + 1; + ret += replace; + } + } + // Append any remaining symbols. + if (last_pos < str.size()) { + ret += str.substr(last_pos, pos - last_pos); + } + return ret; +} + +std::string Reindent(const std::string& str, int indent_depth) { + std::string indent; + for (int i = 0; i < indent_depth; i++) indent += ' '; + + std::string out; + std::string::size_type pos = 0; + do { + std::string::size_type prev_pos = pos; + pos = str.find('\n', pos); + + out.append(indent); + + if (pos == std::string::npos) { + out.append(str, prev_pos, std::string::npos); + break; + } else { + pos++; + out.append(str, prev_pos, pos - prev_pos); + } + } while (true); + + return out; +} + +} // namespace node diff --git a/src/json_utils.h b/src/json_utils.h new file mode 100644 index 00000000000000..21e204328058ee --- /dev/null +++ b/src/json_utils.h @@ -0,0 +1,160 @@ +#ifndef SRC_JSON_UTILS_H_ +#define SRC_JSON_UTILS_H_ + +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#include +#include +#include + +namespace node { + +std::string EscapeJsonChars(const std::string& str); +std::string Reindent(const std::string& str, int indentation); + +// JSON compiler definitions. +class JSONWriter { + public: + JSONWriter(std::ostream& out, bool compact) + : out_(out), compact_(compact) {} + + private: + inline void indent() { indent_ += 2; } + inline void deindent() { indent_ -= 2; } + inline void advance() { + if (compact_) return; + for (int i = 0; i < indent_; i++) out_ << ' '; + } + inline void write_one_space() { + if (compact_) return; + out_ << ' '; + } + inline void write_new_line() { + if (compact_) return; + out_ << '\n'; + } + + public: + inline void json_start() { + if (state_ == kAfterValue) out_ << ','; + write_new_line(); + advance(); + out_ << '{'; + indent(); + state_ = kObjectStart; + } + + inline void json_end() { + write_new_line(); + deindent(); + advance(); + out_ << '}'; + state_ = kAfterValue; + } + template + inline void json_objectstart(T key) { + if (state_ == kAfterValue) out_ << ','; + write_new_line(); + advance(); + write_string(key); + out_ << ':'; + write_one_space(); + out_ << '{'; + indent(); + state_ = kObjectStart; + } + + template + inline void json_arraystart(T key) { + if (state_ == kAfterValue) out_ << ','; + write_new_line(); + advance(); + write_string(key); + out_ << ':'; + write_one_space(); + out_ << '['; + indent(); + state_ = kObjectStart; + } + inline void json_objectend() { + write_new_line(); + deindent(); + advance(); + out_ << '}'; + if (indent_ == 0) { + // Top-level object is complete, so end the line. + out_ << '\n'; + } + state_ = kAfterValue; + } + + inline void json_arrayend() { + write_new_line(); + deindent(); + advance(); + out_ << ']'; + state_ = kAfterValue; + } + template + inline void json_keyvalue(const T& key, const U& value) { + if (state_ == kAfterValue) out_ << ','; + write_new_line(); + advance(); + write_string(key); + out_ << ':'; + write_one_space(); + write_value(value); + state_ = kAfterValue; + } + + template + inline void json_element(const U& value) { + if (state_ == kAfterValue) out_ << ','; + write_new_line(); + advance(); + write_value(value); + state_ = kAfterValue; + } + + struct Null {}; // Usable as a JSON value. + + struct ForeignJSON { + std::string as_string; + }; + + private: + template ::is_specialized, bool>::type> + inline void write_value(T number) { + if (std::is_same::value) + out_ << (number ? "true" : "false"); + else + out_ << number; + } + + inline void write_value(Null null) { out_ << "null"; } + inline void write_value(const char* str) { write_string(str); } + inline void write_value(const std::string& str) { write_string(str); } + + inline void write_value(const ForeignJSON& json) { + out_ << Reindent(json.as_string, indent_); + } + + inline void write_string(const std::string& str) { + out_ << '"' << EscapeJsonChars(str) << '"'; + } + inline void write_string(const char* str) { write_string(std::string(str)); } + + enum JSONState { kObjectStart, kAfterValue }; + std::ostream& out_; + bool compact_; + int indent_ = 0; + int state_ = kObjectStart; +}; + +} // namespace node + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#endif // SRC_JSON_UTILS_H_ diff --git a/src/node_report.cc b/src/node_report.cc index ff2206dbb44ef0..98da24c9567a28 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -1,4 +1,5 @@ #include "env-inl.h" +#include "json_utils.h" #include "node_report.h" #include "debug_utils-inl.h" #include "diagnosticfilename-inl.h" @@ -16,6 +17,7 @@ #include #endif +#include #include #include #include @@ -30,6 +32,7 @@ using node::arraysize; using node::ConditionVariable; using node::DiagnosticFilename; using node::Environment; +using node::JSONWriter; using node::Mutex; using node::NativeSymbolDebuggingContext; using node::TIME_TYPE; diff --git a/src/node_report.h b/src/node_report.h index 808e302223e5f8..98490784dd6e70 100644 --- a/src/node_report.h +++ b/src/node_report.h @@ -3,7 +3,6 @@ #include "node.h" #include "node_buffer.h" #include "uv.h" -#include "v8.h" #include "util.h" #ifndef _WIN32 @@ -11,19 +10,7 @@ #include #endif -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include namespace report { @@ -43,8 +30,6 @@ void GetNodeReport(v8::Isolate* isolate, // Function declarations - utility functions in src/node_report_utils.cc void WalkHandle(uv_handle_t* h, void* arg); -std::string EscapeJsonChars(const std::string& str); -std::string Reindent(const std::string& str, int indentation); template std::string ValueToHexString(T value) { @@ -59,148 +44,4 @@ std::string ValueToHexString(T value) { void WriteReport(const v8::FunctionCallbackInfo& info); void GetReport(const v8::FunctionCallbackInfo& info); -// Node.js boot time - defined in src/node.cc -extern double prog_start_time; - -// JSON compiler definitions. -class JSONWriter { - public: - JSONWriter(std::ostream& out, bool compact) - : out_(out), compact_(compact) {} - - private: - inline void indent() { indent_ += 2; } - inline void deindent() { indent_ -= 2; } - inline void advance() { - if (compact_) return; - for (int i = 0; i < indent_; i++) out_ << ' '; - } - inline void write_one_space() { - if (compact_) return; - out_ << ' '; - } - inline void write_new_line() { - if (compact_) return; - out_ << '\n'; - } - - public: - inline void json_start() { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - out_ << '{'; - indent(); - state_ = kObjectStart; - } - - inline void json_end() { - write_new_line(); - deindent(); - advance(); - out_ << '}'; - state_ = kAfterValue; - } - template - inline void json_objectstart(T key) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_string(key); - out_ << ':'; - write_one_space(); - out_ << '{'; - indent(); - state_ = kObjectStart; - } - - template - inline void json_arraystart(T key) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_string(key); - out_ << ':'; - write_one_space(); - out_ << '['; - indent(); - state_ = kObjectStart; - } - inline void json_objectend() { - write_new_line(); - deindent(); - advance(); - out_ << '}'; - if (indent_ == 0) { - // Top-level object is complete, so end the line. - out_ << '\n'; - } - state_ = kAfterValue; - } - - inline void json_arrayend() { - write_new_line(); - deindent(); - advance(); - out_ << ']'; - state_ = kAfterValue; - } - template - inline void json_keyvalue(const T& key, const U& value) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_string(key); - out_ << ':'; - write_one_space(); - write_value(value); - state_ = kAfterValue; - } - - template - inline void json_element(const U& value) { - if (state_ == kAfterValue) out_ << ','; - write_new_line(); - advance(); - write_value(value); - state_ = kAfterValue; - } - - struct Null {}; // Usable as a JSON value. - - struct ForeignJSON { - std::string as_string; - }; - - private: - template ::is_specialized, bool>::type> - inline void write_value(T number) { - if (std::is_same::value) - out_ << (number ? "true" : "false"); - else - out_ << number; - } - - inline void write_value(Null null) { out_ << "null"; } - inline void write_value(const char* str) { write_string(str); } - inline void write_value(const std::string& str) { write_string(str); } - - inline void write_value(const ForeignJSON& json) { - out_ << Reindent(json.as_string, indent_); - } - - inline void write_string(const std::string& str) { - out_ << '"' << EscapeJsonChars(str) << '"'; - } - inline void write_string(const char* str) { write_string(std::string(str)); } - - enum JSONState { kObjectStart, kAfterValue }; - std::ostream& out_; - bool compact_; - int indent_ = 0; - int state_ = kObjectStart; -}; - } // namespace report diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc index efa15790b9bc96..abbf6d529d0ef7 100644 --- a/src/node_report_utils.cc +++ b/src/node_report_utils.cc @@ -1,9 +1,11 @@ +#include "json_utils.h" #include "node_internals.h" #include "node_report.h" #include "util-inl.h" namespace report { +using node::JSONWriter; using node::MallocedBuffer; static constexpr auto null = JSONWriter::Null{}; @@ -225,66 +227,4 @@ void WalkHandle(uv_handle_t* h, void* arg) { writer->json_end(); } -std::string EscapeJsonChars(const std::string& str) { - const std::string control_symbols[0x20] = { - "\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", - "\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", - "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", - "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", - "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f" - }; - - std::string ret; - size_t last_pos = 0; - size_t pos = 0; - for (; pos < str.size(); ++pos) { - std::string replace; - char ch = str[pos]; - if (ch == '\\') { - replace = "\\\\"; - } else if (ch == '\"') { - replace = "\\\""; - } else { - size_t num = static_cast(ch); - if (num < 0x20) replace = control_symbols[num]; - } - if (!replace.empty()) { - if (pos > last_pos) { - ret += str.substr(last_pos, pos - last_pos); - } - last_pos = pos + 1; - ret += replace; - } - } - // Append any remaining symbols. - if (last_pos < str.size()) { - ret += str.substr(last_pos, pos - last_pos); - } - return ret; -} - -std::string Reindent(const std::string& str, int indent_depth) { - std::string indent; - for (int i = 0; i < indent_depth; i++) indent += ' '; - - std::string out; - std::string::size_type pos = 0; - do { - std::string::size_type prev_pos = pos; - pos = str.find('\n', pos); - - out.append(indent); - - if (pos == std::string::npos) { - out.append(str, prev_pos, std::string::npos); - break; - } else { - pos++; - out.append(str, prev_pos, pos - prev_pos); - } - } while (true); - - return out; -} - } // namespace report diff --git a/test/cctest/test_report_util.cc b/test/cctest/test_json_utils.cc similarity index 90% rename from test/cctest/test_report_util.cc rename to test/cctest/test_json_utils.cc index e32558ef75b5e8..06a9074a61baf1 100644 --- a/test/cctest/test_report_util.cc +++ b/test/cctest/test_json_utils.cc @@ -1,9 +1,9 @@ -#include "node_report.h" +#include "json_utils.h" #include "gtest/gtest.h" -TEST(ReportUtilTest, EscapeJsonChars) { - using report::EscapeJsonChars; +TEST(JSONUtilsTest, EscapeJsonChars) { + using node::EscapeJsonChars; EXPECT_EQ("abc", EscapeJsonChars("abc")); EXPECT_EQ("abc\\n", EscapeJsonChars("abc\n")); EXPECT_EQ("abc\\nabc", EscapeJsonChars("abc\nabc")); From c09552063bd5cc0c9b837dc6613bcd48c79c794e Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 28 Mar 2020 14:42:51 +0100 Subject: [PATCH 089/181] report: add missing locks for report_on_fatalerror accessors Overlooked in 2fa74e3e38bb028339e48763138456b3ed10ed97. Refs: https://github.com/nodejs/node/pull/32207 PR-URL: https://github.com/nodejs/node/pull/32535 Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- src/node_report_module.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node_report_module.cc b/src/node_report_module.cc index a0b54d5e6004f4..700dd88aba645e 100644 --- a/src/node_report_module.cc +++ b/src/node_report_module.cc @@ -16,6 +16,7 @@ namespace report { using node::Environment; +using node::Mutex; using node::Utf8Value; using v8::Boolean; using v8::Context; @@ -134,12 +135,14 @@ static void SetSignal(const FunctionCallbackInfo& info) { } static void ShouldReportOnFatalError(const FunctionCallbackInfo& info) { + Mutex::ScopedLock lock(node::per_process::cli_options_mutex); info.GetReturnValue().Set( node::per_process::cli_options->report_on_fatalerror); } static void SetReportOnFatalError(const FunctionCallbackInfo& info) { CHECK(info[0]->IsBoolean()); + Mutex::ScopedLock lock(node::per_process::cli_options_mutex); node::per_process::cli_options->report_on_fatalerror = info[0]->IsTrue(); } From 0e4ce8f50aaff6d86289b0f5e4c81df0e999ac2d Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 18 Feb 2020 12:26:49 +0100 Subject: [PATCH 090/181] test: add known issues test for #31733 Authenticated decryption works for file streams up to 32768 bytes but not beyond. Other streams and direct decryption are not affected. Refs: https://github.com/nodejs/node/issues/31733 PR-URL: https://github.com/nodejs/node/pull/31734 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- .../test-crypto-authenticated-stream.js | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 test/known_issues/test-crypto-authenticated-stream.js diff --git a/test/known_issues/test-crypto-authenticated-stream.js b/test/known_issues/test-crypto-authenticated-stream.js new file mode 100644 index 00000000000000..1e2a9edd7b0a6e --- /dev/null +++ b/test/known_issues/test-crypto-authenticated-stream.js @@ -0,0 +1,142 @@ +/* eslint-disable node-core/crypto-check */ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/31733 +const common = require('../common'); +const assert = require('assert'); +const crypto = require('crypto'); +const fs = require('fs'); +const path = require('path'); +const stream = require('stream'); +const tmpdir = require('../common/tmpdir'); + +class Sink extends stream.Writable { + constructor() { + super(); + this.chunks = []; + } + + _write(chunk, encoding, cb) { + this.chunks.push(chunk); + cb(); + } +} + +function direct(config) { + const { cipher, key, iv, aad, authTagLength, plaintextLength } = config; + const expected = Buffer.alloc(plaintextLength); + + const c = crypto.createCipheriv(cipher, key, iv, { authTagLength }); + c.setAAD(aad, { plaintextLength }); + const ciphertext = Buffer.concat([c.update(expected), c.final()]); + + const d = crypto.createDecipheriv(cipher, key, iv, { authTagLength }); + d.setAAD(aad, { plaintextLength }); + d.setAuthTag(c.getAuthTag()); + const actual = Buffer.concat([d.update(ciphertext), d.final()]); + + assert.deepStrictEqual(expected, actual); +} + +function mstream(config) { + const { cipher, key, iv, aad, authTagLength, plaintextLength } = config; + const expected = Buffer.alloc(plaintextLength); + + const c = crypto.createCipheriv(cipher, key, iv, { authTagLength }); + c.setAAD(aad, { plaintextLength }); + + const plain = new stream.PassThrough(); + const crypt = new Sink(); + const chunks = crypt.chunks; + plain.pipe(c).pipe(crypt); + plain.end(expected); + + crypt.on('close', common.mustCall(() => { + const d = crypto.createDecipheriv(cipher, key, iv, { authTagLength }); + d.setAAD(aad, { plaintextLength }); + d.setAuthTag(c.getAuthTag()); + + const crypt = new stream.PassThrough(); + const plain = new Sink(); + crypt.pipe(d).pipe(plain); + for (const chunk of chunks) crypt.write(chunk); + crypt.end(); + + plain.on('close', common.mustCall(() => { + const actual = Buffer.concat(plain.chunks); + assert.deepStrictEqual(expected, actual); + })); + })); +} + +function fstream(config) { + const count = fstream.count++; + const filename = (name) => path.join(tmpdir.path, `${name}${count}`); + + const { cipher, key, iv, aad, authTagLength, plaintextLength } = config; + const expected = Buffer.alloc(plaintextLength); + fs.writeFileSync(filename('a'), expected); + + const c = crypto.createCipheriv(cipher, key, iv, { authTagLength }); + c.setAAD(aad, { plaintextLength }); + + const plain = fs.createReadStream(filename('a')); + const crypt = fs.createWriteStream(filename('b')); + plain.pipe(c).pipe(crypt); + + // Observation: 'close' comes before 'end' on |c|, which definitely feels + // wrong. Switching to `c.on('end', ...)` doesn't fix the test though. + crypt.on('close', common.mustCall(() => { + // Just to drive home the point that decryption does actually work: + // reading the file synchronously, then decrypting it, works. + { + const ciphertext = fs.readFileSync(filename('b')); + const d = crypto.createDecipheriv(cipher, key, iv, { authTagLength }); + d.setAAD(aad, { plaintextLength }); + d.setAuthTag(c.getAuthTag()); + const actual = Buffer.concat([d.update(ciphertext), d.final()]); + assert.deepStrictEqual(expected, actual); + } + + const d = crypto.createDecipheriv(cipher, key, iv, { authTagLength }); + d.setAAD(aad, { plaintextLength }); + d.setAuthTag(c.getAuthTag()); + + const crypt = fs.createReadStream(filename('b')); + const plain = fs.createWriteStream(filename('c')); + crypt.pipe(d).pipe(plain); + + plain.on('close', common.mustCall(() => { + const actual = fs.readFileSync(filename('c')); + assert.deepStrictEqual(expected, actual); + })); + })); +} +fstream.count = 0; + +function test(config) { + direct(config); + mstream(config); + fstream(config); +} + +tmpdir.refresh(); + +// OK +test({ + cipher: 'aes-128-ccm', + aad: Buffer.alloc(1), + iv: Buffer.alloc(8), + key: Buffer.alloc(16), + authTagLength: 16, + plaintextLength: 32768, +}); + +// Fails the fstream test. +test({ + cipher: 'aes-128-ccm', + aad: Buffer.alloc(1), + iv: Buffer.alloc(8), + key: Buffer.alloc(16), + authTagLength: 16, + plaintextLength: 32769, +}); From b6f71969a0530d987adbd2ebee44a51d2655029d Mon Sep 17 00:00:00 2001 From: "Hachimi Aa (Sfeir)" Date: Thu, 22 Aug 2019 16:48:57 +0200 Subject: [PATCH 091/181] doc: improve fs.read documentation PR-URL: https://github.com/nodejs/node/pull/29270 Reviewed-By: Robert Nagy Reviewed-By: Trivikram Kamat Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig --- doc/api/fs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index d7d8c4d24f9a16..5eb339decbdd36 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2766,7 +2766,7 @@ changes: Read data from the file specified by `fd`. -`buffer` is the buffer that the data will be written to. +`buffer` is the buffer that the data (read from the fd) will be written to. `offset` is the offset in the buffer to start writing at. From 0faaa7c84cfe3dfe52e3fa8d175843e3eed49bd6 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 30 Mar 2020 10:35:16 +0200 Subject: [PATCH 092/181] src: clean up worker thread creation code Instead of setting and then in the case of error un-setting properties, only set them when no error occurs. Refs: https://github.com/nodejs/node/pull/32344 PR-URL: https://github.com/nodejs/node/pull/32562 Reviewed-By: Colin Ihrig Reviewed-By: Denys Otrishko Reviewed-By: James M Snell --- src/node_worker.cc | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/node_worker.cc b/src/node_worker.cc index 154fb8d6ae581a..2e91ee54db4562 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -609,16 +609,7 @@ void Worker::StartThread(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&w, args.This()); Mutex::ScopedLock lock(w->mutex_); - // The object now owns the created thread and should not be garbage collected - // until that finishes. - w->ClearWeak(); - - w->env()->add_sub_worker_context(w); w->stopped_ = false; - w->thread_joined_ = false; - - if (w->has_ref_) - w->env()->add_refs(1); uv_thread_options_t thread_options; thread_options.flags = UV_THREAD_HAS_STACK_SIZE; @@ -645,21 +636,27 @@ void Worker::StartThread(const FunctionCallbackInfo& args) { // implicitly delete w }); }, static_cast(w)); - if (ret != 0) { + + if (ret == 0) { + // The object now owns the created thread and should not be garbage + // collected until that finishes. + w->ClearWeak(); + w->thread_joined_ = false; + + if (w->has_ref_) + w->env()->add_refs(1); + + w->env()->add_sub_worker_context(w); + } else { + w->stopped_ = true; + char err_buf[128]; uv_err_name_r(ret, err_buf, sizeof(err_buf)); - w->custom_error_ = "ERR_WORKER_INIT_FAILED"; - w->custom_error_str_ = err_buf; - w->loop_init_failed_ = true; - w->thread_joined_ = true; - w->stopped_ = true; - w->env()->remove_sub_worker_context(w); { Isolate* isolate = w->env()->isolate(); HandleScope handle_scope(isolate); THROW_ERR_WORKER_INIT_FAILED(isolate, err_buf); } - w->MakeWeak(); } } From 4df3ac2a639ecdb08e9dbe48c2a4b40d6d3ae3ab Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 30 Mar 2020 10:37:57 +0200 Subject: [PATCH 093/181] src: remove loop_init_failed_ from Worker class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There’s no reason for this to not be stored alongside the loop data structure itself. PR-URL: https://github.com/nodejs/node/pull/32562 Refs: https://github.com/nodejs/node/pull/32344 Reviewed-By: Colin Ihrig Reviewed-By: Denys Otrishko Reviewed-By: James M Snell --- src/node_worker.cc | 11 +++++++---- src/node_worker.h | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/node_worker.cc b/src/node_worker.cc index 2e91ee54db4562..fe999e9bb56c22 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -140,10 +140,10 @@ class WorkerThreadData { uv_err_name_r(ret, err_buf, sizeof(err_buf)); w->custom_error_ = "ERR_WORKER_INIT_FAILED"; w->custom_error_str_ = err_buf; - w->loop_init_failed_ = true; w->stopped_ = true; return; } + loop_init_failed_ = false; std::shared_ptr allocator = ArrayBufferAllocator::Create(); @@ -199,6 +199,7 @@ class WorkerThreadData { } if (isolate != nullptr) { + CHECK(!loop_init_failed_); bool platform_finished = false; isolate_data_.reset(); @@ -217,18 +218,20 @@ class WorkerThreadData { // Wait until the platform has cleaned up all relevant resources. while (!platform_finished) { - CHECK(!w_->loop_init_failed_); uv_run(&loop_, UV_RUN_ONCE); } } - if (!w_->loop_init_failed_) { + if (!loop_init_failed_) { CheckedUvLoopClose(&loop_); } } + bool loop_is_usable() const { return !loop_init_failed_; } + private: Worker* const w_; uv_loop_t loop_; + bool loop_init_failed_ = true; DeleteFnPtr isolate_data_; friend class Worker; @@ -258,7 +261,7 @@ void Worker::Run() { WorkerThreadData data(this); if (isolate_ == nullptr) return; - CHECK(!data.w_->loop_init_failed_); + CHECK(data.loop_is_usable()); Debug(this, "Starting worker with id %llu", thread_id_); { diff --git a/src/node_worker.h b/src/node_worker.h index dbd286109948da..5591843c4b4860 100644 --- a/src/node_worker.h +++ b/src/node_worker.h @@ -86,7 +86,6 @@ class Worker : public AsyncWrap { bool thread_joined_ = true; const char* custom_error_ = nullptr; std::string custom_error_str_; - bool loop_init_failed_ = false; int exit_code_ = 0; uint64_t thread_id_ = -1; uintptr_t stack_base_ = 0; From afc6a25f42a6e41a8bcc5a80eebd9c3973c45daa Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 29 Mar 2020 09:06:57 -0700 Subject: [PATCH 094/181] src: use smart pointers for nghttp2 objects Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32551 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/node_http2.cc | 117 ++++++++++++++++++++++++---------------------- src/node_http2.h | 41 ++++++++++------ 2 files changed, 89 insertions(+), 69 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index e4b24b74341bb0..9ffc72ff9abe63 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -113,11 +113,14 @@ Http2Scope::~Http2Scope() { // uses a single TypedArray instance that is shared with the JavaScript side // to more efficiently pass values back and forth. Http2Options::Http2Options(Environment* env, nghttp2_session_type type) { - nghttp2_option_new(&options_); + nghttp2_option* option; + CHECK_EQ(nghttp2_option_new(&option), 0); + CHECK_NOT_NULL(option); + options_.reset(option); // Make sure closed connections aren't kept around, taking up memory. // Note that this breaks the priority tree, which we don't use. - nghttp2_option_set_no_closed_streams(options_, 1); + nghttp2_option_set_no_closed_streams(option, 1); // We manually handle flow control within a session in order to // implement backpressure -- that is, we only send WINDOW_UPDATE @@ -125,13 +128,13 @@ Http2Options::Http2Options(Environment* env, nghttp2_session_type type) { // code. This ensures that the flow of data over the connection // does not move too quickly and limits the amount of data we // are required to buffer. - nghttp2_option_set_no_auto_window_update(options_, 1); + nghttp2_option_set_no_auto_window_update(option, 1); // Enable built in support for receiving ALTSVC and ORIGIN frames (but // only on client side sessions if (type == NGHTTP2_SESSION_CLIENT) { - nghttp2_option_set_builtin_recv_extension_type(options_, NGHTTP2_ALTSVC); - nghttp2_option_set_builtin_recv_extension_type(options_, NGHTTP2_ORIGIN); + nghttp2_option_set_builtin_recv_extension_type(option, NGHTTP2_ALTSVC); + nghttp2_option_set_builtin_recv_extension_type(option, NGHTTP2_ORIGIN); } AliasedUint32Array& buffer = env->http2_state()->options_buffer; @@ -139,27 +142,27 @@ Http2Options::Http2Options(Environment* env, nghttp2_session_type type) { if (flags & (1 << IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE)) { nghttp2_option_set_max_deflate_dynamic_table_size( - options_, + option, buffer[IDX_OPTIONS_MAX_DEFLATE_DYNAMIC_TABLE_SIZE]); } if (flags & (1 << IDX_OPTIONS_MAX_RESERVED_REMOTE_STREAMS)) { nghttp2_option_set_max_reserved_remote_streams( - options_, + option, buffer[IDX_OPTIONS_MAX_RESERVED_REMOTE_STREAMS]); } if (flags & (1 << IDX_OPTIONS_MAX_SEND_HEADER_BLOCK_LENGTH)) { nghttp2_option_set_max_send_header_block_length( - options_, + option, buffer[IDX_OPTIONS_MAX_SEND_HEADER_BLOCK_LENGTH]); } // Recommended default - nghttp2_option_set_peer_max_concurrent_streams(options_, 100); + nghttp2_option_set_peer_max_concurrent_streams(option, 100); if (flags & (1 << IDX_OPTIONS_PEER_MAX_CONCURRENT_STREAMS)) { nghttp2_option_set_peer_max_concurrent_streams( - options_, + option, buffer[IDX_OPTIONS_PEER_MAX_CONCURRENT_STREAMS]); } @@ -178,27 +181,24 @@ Http2Options::Http2Options(Environment* env, nghttp2_session_type type) { // header pairs the session may accept. This is a hard limit.. that is, // if the remote peer sends more than this amount, the stream will be // automatically closed with an RST_STREAM. - if (flags & (1 << IDX_OPTIONS_MAX_HEADER_LIST_PAIRS)) { + if (flags & (1 << IDX_OPTIONS_MAX_HEADER_LIST_PAIRS)) SetMaxHeaderPairs(buffer[IDX_OPTIONS_MAX_HEADER_LIST_PAIRS]); - } // The HTTP2 specification places no limits on the number of HTTP2 // PING frames that can be sent. In order to prevent PINGS from being // abused as an attack vector, however, we place a strict upper limit // on the number of unacknowledged PINGS that can be sent at any given // time. - if (flags & (1 << IDX_OPTIONS_MAX_OUTSTANDING_PINGS)) { + if (flags & (1 << IDX_OPTIONS_MAX_OUTSTANDING_PINGS)) SetMaxOutstandingPings(buffer[IDX_OPTIONS_MAX_OUTSTANDING_PINGS]); - } // The HTTP2 specification places no limits on the number of HTTP2 // SETTINGS frames that can be sent. In order to prevent PINGS from being // abused as an attack vector, however, we place a strict upper limit // on the number of unacknowledged SETTINGS that can be sent at any given // time. - if (flags & (1 << IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS)) { + if (flags & (1 << IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS)) SetMaxOutstandingSettings(buffer[IDX_OPTIONS_MAX_OUTSTANDING_SETTINGS]); - } // The HTTP2 specification places no limits on the amount of memory // that a session can consume. In order to prevent abuse, we place a @@ -208,9 +208,8 @@ Http2Options::Http2Options(Environment* env, nghttp2_session_type type) { // created. // Important: The maxSessionMemory option in javascript is expressed in // terms of MB increments (i.e. the value 1 == 1 MB) - if (flags & (1 << IDX_OPTIONS_MAX_SESSION_MEMORY)) { + if (flags & (1 << IDX_OPTIONS_MAX_SESSION_MEMORY)) SetMaxSessionMemory(buffer[IDX_OPTIONS_MAX_SESSION_MEMORY] * 1e6); - } } void Http2Session::Http2Settings::Init() { @@ -420,42 +419,39 @@ Origins::Origins(Isolate* isolate, // Sets the various callback functions that nghttp2 will use to notify us // about significant events while processing http2 stuff. Http2Session::Callbacks::Callbacks(bool kHasGetPaddingCallback) { - CHECK_EQ(nghttp2_session_callbacks_new(&callbacks), 0); + nghttp2_session_callbacks* callbacks_; + CHECK_EQ(nghttp2_session_callbacks_new(&callbacks_), 0); + callbacks.reset(callbacks_); nghttp2_session_callbacks_set_on_begin_headers_callback( - callbacks, OnBeginHeadersCallback); + callbacks_, OnBeginHeadersCallback); nghttp2_session_callbacks_set_on_header_callback2( - callbacks, OnHeaderCallback); + callbacks_, OnHeaderCallback); nghttp2_session_callbacks_set_on_frame_recv_callback( - callbacks, OnFrameReceive); + callbacks_, OnFrameReceive); nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, OnStreamClose); + callbacks_, OnStreamClose); nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, OnDataChunkReceived); + callbacks_, OnDataChunkReceived); nghttp2_session_callbacks_set_on_frame_not_send_callback( - callbacks, OnFrameNotSent); + callbacks_, OnFrameNotSent); nghttp2_session_callbacks_set_on_invalid_header_callback2( - callbacks, OnInvalidHeader); + callbacks_, OnInvalidHeader); nghttp2_session_callbacks_set_error_callback( - callbacks, OnNghttpError); + callbacks_, OnNghttpError); nghttp2_session_callbacks_set_send_data_callback( - callbacks, OnSendData); + callbacks_, OnSendData); nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( - callbacks, OnInvalidFrame); + callbacks_, OnInvalidFrame); nghttp2_session_callbacks_set_on_frame_send_callback( - callbacks, OnFrameSent); + callbacks_, OnFrameSent); if (kHasGetPaddingCallback) { nghttp2_session_callbacks_set_select_padding_callback( - callbacks, OnSelectPadding); + callbacks_, OnSelectPadding); } } - -Http2Session::Callbacks::~Callbacks() { - nghttp2_session_callbacks_del(callbacks); -} - void Http2Session::StopTrackingRcbuf(nghttp2_rcbuf* buf) { StopTrackingMemory(buf); } @@ -499,9 +495,6 @@ Http2Session::Http2Session(Environment* env, bool hasGetPaddingCallback = padding_strategy_ != PADDING_STRATEGY_NONE; - nghttp2_session_callbacks* callbacks - = callback_struct_saved[hasGetPaddingCallback ? 1 : 0].callbacks; - auto fn = type == NGHTTP2_SESSION_SERVER ? nghttp2_session_server_new3 : nghttp2_session_client_new3; @@ -513,7 +506,14 @@ Http2Session::Http2Session(Environment* env, // of the options are out of acceptable range, which we should // be catching before it gets this far. Either way, crash if this // fails. - CHECK_EQ(fn(&session_, callbacks, this, *opts, &alloc_info), 0); + nghttp2_session* session; + CHECK_EQ(fn( + &session, + callback_struct_saved[hasGetPaddingCallback ? 1 : 0].callbacks.get(), + this, + *opts, + &alloc_info), 0); + session_.reset(session); outgoing_storage_.reserve(1024); outgoing_buffers_.reserve(32); @@ -533,7 +533,9 @@ Http2Session::Http2Session(Environment* env, Http2Session::~Http2Session() { CHECK_EQ(flags_ & SESSION_STATE_HAS_SCOPE, 0); Debug(this, "freeing nghttp2 session"); - nghttp2_session_del(session_); + // Explicitly reset session_ so the subsequent + // current_nghttp2_memory_ check passes. + session_.reset(); CHECK_EQ(current_nghttp2_memory_, 0); } @@ -629,7 +631,7 @@ void Http2Session::Close(uint32_t code, bool socket_closed) { // make a best effort. if (!socket_closed) { Debug(this, "terminating session with code %d", code); - CHECK_EQ(nghttp2_session_terminate_session(session_, code), 0); + CHECK_EQ(nghttp2_session_terminate_session(session_.get(), code), 0); SendPendingData(); } else if (stream_ != nullptr) { stream_->RemoveStreamListener(this); @@ -669,7 +671,7 @@ inline Http2Stream* Http2Session::FindStream(int32_t id) { inline bool Http2Session::CanAddStream() { uint32_t maxConcurrentStreams = nghttp2_session_get_local_settings( - session_, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS); + session_.get(), NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS); size_t maxSize = std::min(streams_.max_size(), static_cast(maxConcurrentStreams)); // We can add a new stream so long as we are less than the current @@ -735,10 +737,10 @@ ssize_t Http2Session::ConsumeHTTP2Data() { // multiple side effects. Debug(this, "receiving %d bytes [wants data? %d]", read_len, - nghttp2_session_want_read(session_)); + nghttp2_session_want_read(session_.get())); flags_ &= ~SESSION_STATE_NGHTTP2_RECV_PAUSED; ssize_t ret = - nghttp2_session_mem_recv(session_, + nghttp2_session_mem_recv(session_.get(), reinterpret_cast(stream_buf_.base) + stream_buf_offset_, read_len); @@ -1437,7 +1439,7 @@ void Http2Session::OnStreamAfterWrite(WriteWrap* w, int status) { if ((flags_ & SESSION_STATE_READING_STOPPED) && !(flags_ & SESSION_STATE_WRITE_IN_PROGRESS) && - nghttp2_session_want_read(session_)) { + nghttp2_session_want_read(session_.get())) { flags_ &= ~SESSION_STATE_READING_STOPPED; stream_->ReadStart(); } @@ -1465,16 +1467,16 @@ void Http2Session::OnStreamAfterWrite(WriteWrap* w, int status) { // queue), but only if a write has not already been scheduled. void Http2Session::MaybeScheduleWrite() { CHECK_EQ(flags_ & SESSION_STATE_WRITE_SCHEDULED, 0); - if (UNLIKELY(session_ == nullptr)) + if (UNLIKELY(!session_)) return; - if (nghttp2_session_want_write(session_)) { + if (nghttp2_session_want_write(session_.get())) { HandleScope handle_scope(env()->isolate()); Debug(this, "scheduling write"); flags_ |= SESSION_STATE_WRITE_SCHEDULED; BaseObjectPtr strong_ref{this}; env()->SetImmediate([this, strong_ref](Environment* env) { - if (session_ == nullptr || !(flags_ & SESSION_STATE_WRITE_SCHEDULED)) { + if (!session_ || !(flags_ & SESSION_STATE_WRITE_SCHEDULED)) { // This can happen e.g. when a stream was reset before this turn // of the event loop, in which case SendPendingData() is called early, // or the session was destroyed in the meantime. @@ -1492,7 +1494,7 @@ void Http2Session::MaybeScheduleWrite() { void Http2Session::MaybeStopReading() { if (flags_ & SESSION_STATE_READING_STOPPED) return; - int want_read = nghttp2_session_want_read(session_); + int want_read = nghttp2_session_want_read(session_.get()); Debug(this, "wants read? %d", want_read); if (want_read == 0 || (flags_ & SESSION_STATE_WRITE_IN_PROGRESS)) { flags_ |= SESSION_STATE_READING_STOPPED; @@ -1590,7 +1592,7 @@ uint8_t Http2Session::SendPendingData() { // Part One: Gather data from nghttp2 - while ((src_length = nghttp2_session_mem_send(session_, &src)) > 0) { + while ((src_length = nghttp2_session_mem_send(session_.get(), &src)) > 0) { Debug(this, "nghttp2 has %d bytes to send", src_length); CopyDataIntoOutgoing(src, src_length); } @@ -1715,7 +1717,7 @@ Http2Stream* Http2Session::SubmitRequest( Http2Stream* stream = nullptr; Http2Stream::Provider::Stream prov(options); *ret = nghttp2_submit_request( - session_, + session_.get(), prispec, headers.data(), headers.length(), @@ -2485,9 +2487,9 @@ void Http2Session::Goaway(uint32_t code, Http2Scope h2scope(this); // the last proc stream id is the most recently created Http2Stream. if (lastStreamID <= 0) - lastStreamID = nghttp2_session_get_last_proc_stream_id(session_); + lastStreamID = nghttp2_session_get_last_proc_stream_id(session_.get()); Debug(this, "submitting goaway"); - nghttp2_submit_goaway(session_, NGHTTP2_FLAG_NONE, + nghttp2_submit_goaway(session_.get(), NGHTTP2_FLAG_NONE, lastStreamID, code, data, len); } @@ -2676,13 +2678,16 @@ void Http2Session::AltSvc(int32_t id, uint8_t* value, size_t value_len) { Http2Scope h2scope(this); - CHECK_EQ(nghttp2_submit_altsvc(session_, NGHTTP2_FLAG_NONE, id, + CHECK_EQ(nghttp2_submit_altsvc(session_.get(), NGHTTP2_FLAG_NONE, id, origin, origin_len, value, value_len), 0); } void Http2Session::Origin(nghttp2_origin_entry* ov, size_t count) { Http2Scope h2scope(this); - CHECK_EQ(nghttp2_submit_origin(session_, NGHTTP2_FLAG_NONE, ov, count), 0); + CHECK_EQ(nghttp2_submit_origin( + session_.get(), + NGHTTP2_FLAG_NONE, + ov, count), 0); } // Submits an AltSvc frame to be sent to the connected peer. diff --git a/src/node_http2.h b/src/node_http2.h index 3ab9663eba9da1..dabd86b754c27e 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -44,6 +44,24 @@ namespace http2 { #define MIN_MAX_FRAME_SIZE DEFAULT_SETTINGS_MAX_FRAME_SIZE #define MAX_INITIAL_WINDOW_SIZE 2147483647 +template +struct Nghttp2Deleter { + void operator()(T* ptr) const noexcept { fn(ptr); } +}; + +using Nghttp2OptionPointer = + std::unique_ptr>; + +using Nghttp2SessionPointer = + std::unique_ptr>; + +using Nghttp2SessionCallbacksPointer = + std::unique_ptr>; + struct Http2HeadersTraits { typedef nghttp2_nv nv_t; static const uint8_t kNoneFlag = NGHTTP2_NV_FLAG_NONE; @@ -173,12 +191,10 @@ class Http2Options { public: Http2Options(Environment* env, nghttp2_session_type type); - ~Http2Options() { - nghttp2_option_del(options_); - } + ~Http2Options() = default; nghttp2_option* operator*() const { - return options_; + return options_.get(); } void SetMaxHeaderPairs(uint32_t max) { @@ -201,7 +217,7 @@ class Http2Options { max_outstanding_pings_ = max; } - size_t GetMaxOutstandingPings() { + size_t GetMaxOutstandingPings() const { return max_outstanding_pings_; } @@ -209,7 +225,7 @@ class Http2Options { max_outstanding_settings_ = max; } - size_t GetMaxOutstandingSettings() { + size_t GetMaxOutstandingSettings() const { return max_outstanding_settings_; } @@ -217,12 +233,12 @@ class Http2Options { max_session_memory_ = max; } - uint64_t GetMaxSessionMemory() { + uint64_t GetMaxSessionMemory() const { return max_session_memory_; } private: - nghttp2_option* options_; + Nghttp2OptionPointer options_; uint64_t max_session_memory_ = DEFAULT_MAX_SESSION_MEMORY; uint32_t max_header_pairs_ = DEFAULT_MAX_HEADER_LIST_PAIRS; padding_strategy_type padding_strategy_ = PADDING_STRATEGY_NONE; @@ -571,9 +587,9 @@ class Http2Session : public AsyncWrap, inline nghttp2_session_type type() const { return session_type_; } - inline nghttp2_session* session() const { return session_; } + inline nghttp2_session* session() const { return session_.get(); } - inline nghttp2_session* operator*() { return session_; } + inline nghttp2_session* operator*() { return session_.get(); } inline uint32_t GetMaxHeaderPairs() const { return max_header_pairs_; } @@ -799,16 +815,15 @@ class Http2Session : public AsyncWrap, struct Callbacks { inline explicit Callbacks(bool kHasGetPaddingCallback); - inline ~Callbacks(); - nghttp2_session_callbacks* callbacks; + Nghttp2SessionCallbacksPointer callbacks; }; /* Use callback_struct_saved[kHasGetPaddingCallback ? 1 : 0] */ static const Callbacks callback_struct_saved[2]; // The underlying nghttp2_session handle - nghttp2_session* session_; + Nghttp2SessionPointer session_; // JS-accessible numeric fields, as indexed by SessionUint8Fields. SessionJSFields js_fields_ = {}; From 8f766e839793cb3f5889a54b9e016c278c9a2bc1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 29 Mar 2020 10:14:56 -0700 Subject: [PATCH 095/181] src: rename http2 class and suppress compile warnings Suppress compile warnings on Windows, rename class for consistent styling. Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32551 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/node_http2.cc | 77 ++++++++++++++++++++++++++--------------------- src/node_http2.h | 34 ++++++++++----------- 2 files changed, 60 insertions(+), 51 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index 9ffc72ff9abe63..15b83da564bfa9 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -209,7 +209,7 @@ Http2Options::Http2Options(Environment* env, nghttp2_session_type type) { // Important: The maxSessionMemory option in javascript is expressed in // terms of MB increments (i.e. the value 1 == 1 MB) if (flags & (1 << IDX_OPTIONS_MAX_SESSION_MEMORY)) - SetMaxSessionMemory(buffer[IDX_OPTIONS_MAX_SESSION_MEMORY] * 1e6); + SetMaxSessionMemory(buffer[IDX_OPTIONS_MAX_SESSION_MEMORY] * 1000000); } void Http2Session::Http2Settings::Init() { @@ -349,8 +349,8 @@ Http2Priority::Http2Priority(Environment* env, int32_t weight_ = weight->Int32Value(context).ToChecked(); bool exclusive_ = exclusive->BooleanValue(env->isolate()); Debug(env, DebugCategory::HTTP2STREAM, - "Http2Priority: parent: %d, weight: %d, exclusive: %d\n", - parent_, weight_, exclusive_); + "Http2Priority: parent: %d, weight: %d, exclusive: %s\n", + parent_, weight_, exclusive_ ? "yes" : "no"); nghttp2_priority_spec_init(&spec, parent_, weight_, exclusive_ ? 1 : 0); } @@ -578,8 +578,10 @@ void Http2Stream::EmitStatistics() { } else { buffer[IDX_STREAM_STATS_TIMETOFIRSTBYTESENT] = 0; } - buffer[IDX_STREAM_STATS_SENTBYTES] = entry->sent_bytes(); - buffer[IDX_STREAM_STATS_RECEIVEDBYTES] = entry->received_bytes(); + buffer[IDX_STREAM_STATS_SENTBYTES] = + static_cast(entry->sent_bytes()); + buffer[IDX_STREAM_STATS_RECEIVEDBYTES] = + static_cast(entry->received_bytes()); Local obj; if (entry->ToObject().ToLocal(&obj)) entry->Notify(obj); }); @@ -602,10 +604,12 @@ void Http2Session::EmitStatistics() { buffer[IDX_SESSION_STATS_STREAMCOUNT] = entry->stream_count(); buffer[IDX_SESSION_STATS_STREAMAVERAGEDURATION] = entry->stream_average_duration(); - buffer[IDX_SESSION_STATS_DATA_SENT] = entry->data_sent(); - buffer[IDX_SESSION_STATS_DATA_RECEIVED] = entry->data_received(); + buffer[IDX_SESSION_STATS_DATA_SENT] = + static_cast(entry->data_sent()); + buffer[IDX_SESSION_STATS_DATA_RECEIVED] = + static_cast(entry->data_received()); buffer[IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS] = - entry->max_concurrent_streams(); + static_cast(entry->max_concurrent_streams()); Local obj; if (entry->ToObject().ToLocal(&obj)) entry->Notify(obj); }); @@ -1513,9 +1517,9 @@ void Http2Session::ClearOutgoing(int status) { outgoing_storage_.clear(); outgoing_length_ = 0; - std::vector current_outgoing_buffers_; + std::vector current_outgoing_buffers_; current_outgoing_buffers_.swap(outgoing_buffers_); - for (const nghttp2_stream_write& wr : current_outgoing_buffers_) { + for (const NgHttp2StreamWrite& wr : current_outgoing_buffers_) { WriteWrap* wrap = wr.req_wrap; if (wrap != nullptr) { // TODO(addaleax): Pass `status` instead of 0, so that we actually error @@ -1542,7 +1546,7 @@ void Http2Session::ClearOutgoing(int status) { } } -void Http2Session::PushOutgoingBuffer(nghttp2_stream_write&& write) { +void Http2Session::PushOutgoingBuffer(NgHttp2StreamWrite&& write) { outgoing_length_ += write.buf.len; outgoing_buffers_.emplace_back(std::move(write)); } @@ -1559,7 +1563,7 @@ void Http2Session::CopyDataIntoOutgoing(const uint8_t* src, size_t src_length) { // of the outgoing_buffers_ vector may invalidate the pointer. // The correct base pointers will be set later, before writing to the // underlying socket. - PushOutgoingBuffer(nghttp2_stream_write { + PushOutgoingBuffer(NgHttp2StreamWrite { uv_buf_init(nullptr, src_length) }); } @@ -1622,7 +1626,7 @@ uint8_t Http2Session::SendPendingData() { // (Those are marked by having .base == nullptr.) size_t offset = 0; size_t i = 0; - for (const nghttp2_stream_write& write : outgoing_buffers_) { + for (const NgHttp2StreamWrite& write : outgoing_buffers_) { statistics_.data_sent += write.buf.len; if (write.buf.base == nullptr) { bufs[i++] = uv_buf_init( @@ -1678,7 +1682,7 @@ int Http2Session::OnSendData( // we told it so, which means that we *should* have data available. CHECK(!stream->queue_.empty()); - nghttp2_stream_write& write = stream->queue_.front(); + NgHttp2StreamWrite& write = stream->queue_.front(); if (write.buf.len <= length) { // This write does not suffice by itself, so we can consume it completely. length -= write.buf.len; @@ -1688,7 +1692,7 @@ int Http2Session::OnSendData( } // Slice off `length` bytes of the first write in the queue. - session->PushOutgoingBuffer(nghttp2_stream_write { + session->PushOutgoingBuffer(NgHttp2StreamWrite { uv_buf_init(write.buf.base, length) }); write.buf.base += length; @@ -1698,7 +1702,7 @@ int Http2Session::OnSendData( if (frame->data.padlen > 0) { // Send padding if that was requested. - session->PushOutgoingBuffer(nghttp2_stream_write { + session->PushOutgoingBuffer(NgHttp2StreamWrite { uv_buf_init(const_cast(zero_bytes_256), frame->data.padlen - 1) }); } @@ -1779,7 +1783,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { // Remember the current buffer, so that OnDataChunkReceived knows the // offset of a DATA frame's data into the socket read buffer. - stream_buf_ = uv_buf_init(buf.data(), nread); + stream_buf_ = uv_buf_init(buf.data(), static_cast(nread)); Isolate* isolate = env()->isolate(); @@ -1792,7 +1796,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { if (UNLIKELY(ret < 0)) { Debug(this, "fatal error receiving data: %d", ret); - Local arg = Integer::New(isolate, ret); + Local arg = Integer::New(isolate, static_cast(ret)); MakeCallback(env()->http2session_on_error_function(), 1, &arg); return; } @@ -1801,7 +1805,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf_) { } bool Http2Session::HasWritesOnSocketForStream(Http2Stream* stream) { - for (const nghttp2_stream_write& wr : outgoing_buffers_) { + for (const NgHttp2StreamWrite& wr : outgoing_buffers_) { if (wr.req_wrap != nullptr && wr.req_wrap->stream() == stream) return true; } @@ -1948,7 +1952,7 @@ void Http2Stream::Destroy() { // here because it's possible for destroy to have been called while // we still have queued outbound writes. while (!queue_.empty()) { - nghttp2_stream_write& head = queue_.front(); + NgHttp2StreamWrite& head = queue_.front(); if (head.req_wrap != nullptr) head.req_wrap->Done(UV_ECANCELED); queue_.pop(); @@ -2166,7 +2170,7 @@ int Http2Stream::DoWrite(WriteWrap* req_wrap, for (size_t i = 0; i < nbufs; ++i) { // Store the req_wrap on the last write info in the queue, so that it is // only marked as finished once all buffers associated with it are finished. - queue_.emplace(nghttp2_stream_write { + queue_.emplace(NgHttp2StreamWrite { i == nbufs - 1 ? req_wrap : nullptr, bufs[i] }); @@ -2402,11 +2406,11 @@ void Http2Session::RefreshState(const FunctionCallbackInfo& args) { buffer[IDX_SESSION_STATE_REMOTE_WINDOW_SIZE] = nghttp2_session_get_remote_window_size(s); buffer[IDX_SESSION_STATE_OUTBOUND_QUEUE_SIZE] = - nghttp2_session_get_outbound_queue_size(s); + static_cast(nghttp2_session_get_outbound_queue_size(s)); buffer[IDX_SESSION_STATE_HD_DEFLATE_DYNAMIC_TABLE_SIZE] = - nghttp2_session_get_hd_deflate_dynamic_table_size(s); + static_cast(nghttp2_session_get_hd_deflate_dynamic_table_size(s)); buffer[IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE] = - nghttp2_session_get_hd_inflate_dynamic_table_size(s); + static_cast(nghttp2_session_get_hd_inflate_dynamic_table_size(s)); } @@ -2414,7 +2418,7 @@ void Http2Session::RefreshState(const FunctionCallbackInfo& args) { void Http2Session::New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); CHECK(args.IsConstructCall()); - int val = args[0]->IntegerValue(env->context()).ToChecked(); + int32_t val = args[0]->Int32Value(env->context()).ToChecked(); nghttp2_session_type type = static_cast(val); Http2Session* session = new Http2Session(env, args.This(), type); session->get_async_id(); // avoid compiler warning @@ -2452,7 +2456,7 @@ void Http2Session::Request(const FunctionCallbackInfo& args) { Environment* env = session->env(); Local headers = args[0].As(); - int options = args[1]->IntegerValue(env->context()).ToChecked(); + int32_t options = args[1]->Int32Value(env->context()).ToChecked(); Http2Priority priority(env, args[2], args[3], args[4]); Debug(session, "request submitted"); @@ -2463,7 +2467,7 @@ void Http2Session::Request(const FunctionCallbackInfo& args) { *priority, Http2Headers(env, headers), &ret, - options); + static_cast(options)); if (ret <= 0 || stream == nullptr) { Debug(session, "could not submit request: %s", nghttp2_strerror(ret)); @@ -2552,10 +2556,12 @@ void Http2Stream::Respond(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&stream, args.Holder()); Local headers = args[0].As(); - int options = args[1]->IntegerValue(env->context()).ToChecked(); + int32_t options = args[1]->Int32Value(env->context()).ToChecked(); args.GetReturnValue().Set( - stream->SubmitResponse(Http2Headers(env, headers), options)); + stream->SubmitResponse( + Http2Headers(env, headers), + static_cast(options))); Debug(stream, "response submitted"); } @@ -2605,13 +2611,16 @@ void Http2Stream::PushPromise(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&parent, args.Holder()); Local headers = args[0].As(); - int options = args[1]->IntegerValue(env->context()).ToChecked(); + int32_t options = args[1]->Int32Value(env->context()).ToChecked(); Debug(parent, "creating push promise"); int32_t ret = 0; Http2Stream* stream = - parent->SubmitPushPromise(Http2Headers(env, headers), &ret, options); + parent->SubmitPushPromise( + Http2Headers(env, headers), + &ret, + static_cast(options)); if (ret <= 0 || stream == nullptr) { Debug(parent, "failed to create push stream: %d", ret); @@ -2725,13 +2734,13 @@ void Http2Session::Origin(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder()); Local origin_string = args[0].As(); - int count = args[1]->IntegerValue(context).ToChecked(); + int32_t count = args[1]->Int32Value(context).ToChecked(); Origins origins(env->isolate(), env->context(), origin_string, - count); + static_cast(count)); session->Origin(*origins, origins.length()); } @@ -2885,7 +2894,7 @@ void Http2Session::Http2Ping::DetachFromSession() { session_ = nullptr; } -void nghttp2_stream_write::MemoryInfo(MemoryTracker* tracker) const { +void NgHttp2StreamWrite::MemoryInfo(MemoryTracker* tracker) const { if (req_wrap != nullptr) tracker->TrackField("req_wrap", req_wrap->GetAsyncWrap()); tracker->TrackField("buf", buf); diff --git a/src/node_http2.h b/src/node_http2.h index dabd86b754c27e..1c42fa1b52e532 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -24,13 +24,13 @@ namespace http2 { // may send in order to prevent abuse. The current default cap is 10. The // user may set a different limit using a per Http2Session configuration // option. -#define DEFAULT_MAX_PINGS 10 +constexpr size_t kDefaultMaxPings = 10; // Also strictly limit the number of outstanding SETTINGS frames a user sends -#define DEFAULT_MAX_SETTINGS 10 +constexpr size_t kDefaultMaxSettings = 10; // Default maximum total memory cap for Http2Session. -#define DEFAULT_MAX_SESSION_MEMORY 1e7 +constexpr uint64_t kDefaultMaxSessionMemory = 10000000; // These are the standard HTTP/2 defaults as specified by the RFC #define DEFAULT_SETTINGS_HEADER_TABLE_SIZE 4096 @@ -123,17 +123,17 @@ enum nghttp2_stream_options { STREAM_OPTION_GET_TRAILERS = 0x2, }; -struct nghttp2_stream_write : public MemoryRetainer { +struct NgHttp2StreamWrite : public MemoryRetainer { WriteWrap* req_wrap = nullptr; uv_buf_t buf; - inline explicit nghttp2_stream_write(uv_buf_t buf_) : buf(buf_) {} - inline nghttp2_stream_write(WriteWrap* req, uv_buf_t buf_) : + inline explicit NgHttp2StreamWrite(uv_buf_t buf_) : buf(buf_) {} + inline NgHttp2StreamWrite(WriteWrap* req, uv_buf_t buf_) : req_wrap(req), buf(buf_) {} void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(nghttp2_stream_write) - SET_SELF_SIZE(nghttp2_stream_write) + SET_MEMORY_INFO_NAME(NgHttp2StreamWrite) + SET_SELF_SIZE(NgHttp2StreamWrite) }; // The Padding Strategy determines the method by which extra padding is @@ -239,11 +239,11 @@ class Http2Options { private: Nghttp2OptionPointer options_; - uint64_t max_session_memory_ = DEFAULT_MAX_SESSION_MEMORY; + uint64_t max_session_memory_ = kDefaultMaxSessionMemory; uint32_t max_header_pairs_ = DEFAULT_MAX_HEADER_LIST_PAIRS; padding_strategy_type padding_strategy_ = PADDING_STRATEGY_NONE; - size_t max_outstanding_pings_ = DEFAULT_MAX_PINGS; - size_t max_outstanding_settings_ = DEFAULT_MAX_SETTINGS; + size_t max_outstanding_pings_ = kDefaultMaxPings; + size_t max_outstanding_settings_ = kDefaultMaxSettings; }; class Http2Priority { @@ -473,7 +473,7 @@ class Http2Stream : public AsyncWrap, // Outbound Data... This is the data written by the JS layer that is // waiting to be written out to the socket. - std::queue queue_; + std::queue queue_; size_t available_outbound_length_ = 0; Http2StreamListener stream_listener_; @@ -835,7 +835,7 @@ class Http2Session : public AsyncWrap, uint32_t max_header_pairs_ = DEFAULT_MAX_HEADER_LIST_PAIRS; // The maximum amount of memory allocated for this session - uint64_t max_session_memory_ = DEFAULT_MAX_SESSION_MEMORY; + uint64_t max_session_memory_ = kDefaultMaxSessionMemory; uint64_t current_session_memory_ = 0; // The amount of memory allocated by nghttp2 internals uint64_t current_nghttp2_memory_ = 0; @@ -858,13 +858,13 @@ class Http2Session : public AsyncWrap, AllocatedBuffer stream_buf_allocation_; size_t stream_buf_offset_ = 0; - size_t max_outstanding_pings_ = DEFAULT_MAX_PINGS; + size_t max_outstanding_pings_ = kDefaultMaxPings; std::queue> outstanding_pings_; - size_t max_outstanding_settings_ = DEFAULT_MAX_SETTINGS; + size_t max_outstanding_settings_ = kDefaultMaxSettings; std::queue> outstanding_settings_; - std::vector outgoing_buffers_; + std::vector outgoing_buffers_; std::vector outgoing_storage_; size_t outgoing_length_ = 0; std::vector pending_rst_streams_; @@ -876,7 +876,7 @@ class Http2Session : public AsyncWrap, // Also use the invalid frame count as a measure for rejecting input frames. uint32_t invalid_frame_count_ = 0; - void PushOutgoingBuffer(nghttp2_stream_write&& write); + void PushOutgoingBuffer(NgHttp2StreamWrite&& write); void CopyDataIntoOutgoing(const uint8_t* src, size_t src_length); void ClearOutgoing(int status); From 62db9a06782427bf63061bd01d7a581e172da14f Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 29 Mar 2020 10:38:24 -0700 Subject: [PATCH 096/181] src: minor http2 refactorings * Simplify Http2Priority struct * BooleanValue => IsTrue/IsFalse Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32551 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- src/node_http2.cc | 17 +++++++---------- src/node_http2.h | 9 +-------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index 15b83da564bfa9..3d2ca98743fced 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -347,11 +347,11 @@ Http2Priority::Http2Priority(Environment* env, Local context = env->context(); int32_t parent_ = parent->Int32Value(context).ToChecked(); int32_t weight_ = weight->Int32Value(context).ToChecked(); - bool exclusive_ = exclusive->BooleanValue(env->isolate()); + bool exclusive_ = exclusive->IsTrue(); Debug(env, DebugCategory::HTTP2STREAM, "Http2Priority: parent: %d, weight: %d, exclusive: %s\n", parent_, weight_, exclusive_ ? "yes" : "no"); - nghttp2_priority_spec_init(&spec, parent_, weight_, exclusive_ ? 1 : 0); + nghttp2_priority_spec_init(this, parent_, weight_, exclusive_ ? 1 : 0); } @@ -995,8 +995,7 @@ int Http2Session::OnStreamClose(nghttp2_session* handle, MaybeLocal answer = stream->MakeCallback(env->http2session_on_stream_close_function(), 1, &arg); - if (answer.IsEmpty() || - !(answer.ToLocalChecked()->BooleanValue(env->isolate()))) { + if (answer.IsEmpty() || answer.ToLocalChecked()->IsFalse()) { // Skip to destroy stream->Destroy(); } @@ -2443,9 +2442,7 @@ void Http2Session::Destroy(const FunctionCallbackInfo& args) { Local context = env->context(); uint32_t code = args[0]->Uint32Value(context).ToChecked(); - bool socketDestroyed = args[1]->BooleanValue(env->isolate()); - - session->Close(code, socketDestroyed); + session->Close(code, args[1]->IsTrue()); } // Submits a new request on the Http2Session and returns either an error code @@ -2464,7 +2461,7 @@ void Http2Session::Request(const FunctionCallbackInfo& args) { int32_t ret = 0; Http2Stream* stream = session->Http2Session::SubmitRequest( - *priority, + &priority, Http2Headers(env, headers), &ret, static_cast(options)); @@ -2637,9 +2634,9 @@ void Http2Stream::Priority(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&stream, args.Holder()); Http2Priority priority(env, args[0], args[1], args[2]); - bool silent = args[3]->BooleanValue(env->isolate()); + bool silent = args[3]->IsTrue(); - CHECK_EQ(stream->SubmitPriority(*priority, silent), 0); + CHECK_EQ(stream->SubmitPriority(&priority, silent), 0); Debug(stream, "priority submitted"); } diff --git a/src/node_http2.h b/src/node_http2.h index 1c42fa1b52e532..8881ce7ca05611 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -246,18 +246,11 @@ class Http2Options { size_t max_outstanding_settings_ = kDefaultMaxSettings; }; -class Http2Priority { - public: +struct Http2Priority : public nghttp2_priority_spec { Http2Priority(Environment* env, v8::Local parent, v8::Local weight, v8::Local exclusive); - - nghttp2_priority_spec* operator*() { - return &spec; - } - private: - nghttp2_priority_spec spec; }; class Http2StreamListener : public StreamListener { From cca269c3a07b399a47e153de1dbf13bc54978fe0 Mon Sep 17 00:00:00 2001 From: Daniel Estiven Rico Posada Date: Sun, 29 Mar 2020 09:52:44 -0500 Subject: [PATCH 097/181] test: use template strings in parallel tests PR-URL: https://github.com/nodejs/node/pull/32549 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/parallel/test-buffer-bigint64.js | 26 +++++++++---------- .../parallel/test-http-readable-data-event.js | 4 +-- test/parallel/test-http2-origin.js | 4 +-- .../test-http2-server-session-destroy.js | 2 +- ...promises-warning-on-unhandled-rejection.js | 4 +-- test/parallel/test-tls-psk-server.js | 2 +- test/parallel/test-worker-relative-path.js | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test/parallel/test-buffer-bigint64.js b/test/parallel/test-buffer-bigint64.js index 60d376bdaf84af..a160d35b4a551a 100644 --- a/test/parallel/test-buffer-bigint64.js +++ b/test/parallel/test-buffer-bigint64.js @@ -7,49 +7,49 @@ const buf = Buffer.allocUnsafe(8); ['LE', 'BE'].forEach(function(endianness) { // Should allow simple BigInts to be written and read let val = 123456789n; - buf['writeBigInt64' + endianness](val, 0); - let rtn = buf['readBigInt64' + endianness](0); + buf[`writeBigInt64${endianness}`](val, 0); + let rtn = buf[`readBigInt64${endianness}`](0); assert.strictEqual(val, rtn); // Should allow INT64_MAX to be written and read val = 0x7fffffffffffffffn; - buf['writeBigInt64' + endianness](val, 0); - rtn = buf['readBigInt64' + endianness](0); + buf[`writeBigInt64${endianness}`](val, 0); + rtn = buf[`readBigInt64${endianness}`](0); assert.strictEqual(val, rtn); // Should read and write a negative signed 64-bit integer val = -123456789n; - buf['writeBigInt64' + endianness](val, 0); - assert.strictEqual(val, buf['readBigInt64' + endianness](0)); + buf[`writeBigInt64${endianness}`](val, 0); + assert.strictEqual(val, buf[`readBigInt64${endianness}`](0)); // Should read and write an unsigned 64-bit integer val = 123456789n; - buf['writeBigUInt64' + endianness](val, 0); - assert.strictEqual(val, buf['readBigUInt64' + endianness](0)); + buf[`writeBigUInt64${endianness}`](val, 0); + assert.strictEqual(val, buf[`readBigUInt64${endianness}`](0)); // Should throw a RangeError upon INT64_MAX+1 being written assert.throws(function() { const val = 0x8000000000000000n; - buf['writeBigInt64' + endianness](val, 0); + buf[`writeBigInt64${endianness}`](val, 0); }, RangeError); // Should throw a RangeError upon UINT64_MAX+1 being written assert.throws(function() { const val = 0x10000000000000000n; - buf['writeBigUInt64' + endianness](val, 0); + buf[`writeBigUInt64${endianness}`](val, 0); }, { code: 'ERR_OUT_OF_RANGE', message: 'The value of "value" is out of range. It must be ' + - '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n' + '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n' }); // Should throw a TypeError upon invalid input assert.throws(function() { - buf['writeBigInt64' + endianness]('bad', 0); + buf[`writeBigInt64${endianness}`]('bad', 0); }, TypeError); // Should throw a TypeError upon invalid input assert.throws(function() { - buf['writeBigUInt64' + endianness]('bad', 0); + buf[`writeBigUInt64${endianness}`]('bad', 0); }, TypeError); }); diff --git a/test/parallel/test-http-readable-data-event.js b/test/parallel/test-http-readable-data-event.js index 21b1fa65c661c8..643176ec7b066a 100644 --- a/test/parallel/test-http-readable-data-event.js +++ b/test/parallel/test-http-readable-data-event.js @@ -10,14 +10,14 @@ let next = null; const server = http.createServer((req, res) => { res.writeHead(200, { - 'Content-Length': '' + (helloWorld.length + helloAgainLater.length) + 'Content-Length': `${(helloWorld.length + helloAgainLater.length)}` }); // We need to make sure the data is flushed // before writing again next = () => { res.end(helloAgainLater); - next = () => {}; + next = () => { }; }; res.write(helloWorld); diff --git a/test/parallel/test-http2-origin.js b/test/parallel/test-http2-origin.js index 6f90a043d8a7cc..519e8cb1a3dedd 100644 --- a/test/parallel/test-http2-origin.js +++ b/test/parallel/test-http2-origin.js @@ -70,7 +70,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary'); } ); }); - const longInput = 'http://foo.bar' + 'a'.repeat(16383); + const longInput = `http://foo.bar${'a'.repeat(16383)}`; throws( () => session.origin(longInput), { @@ -107,7 +107,7 @@ const ca = readKey('fake-startcom-root-cert.pem', 'binary'); // Test automatically sending origin on connection start { - const origins = [ 'https://foo.org/a/b/c', 'https://bar.org' ]; + const origins = ['https://foo.org/a/b/c', 'https://bar.org']; const server = createSecureServer({ key, cert, origins }); server.on('stream', mustCall((stream) => { stream.respond(); diff --git a/test/parallel/test-http2-server-session-destroy.js b/test/parallel/test-http2-server-session-destroy.js index 9b7f126510757c..afa3dd3398dba8 100644 --- a/test/parallel/test-http2-server-session-destroy.js +++ b/test/parallel/test-http2-server-session-destroy.js @@ -16,5 +16,5 @@ server.listen(0, common.localhostIPv4, common.mustCall(() => { const port = server.address().port; const host = common.localhostIPv4; - h2.connect('http://' + host + ':' + port, afterConnect); + h2.connect(`http://${host}:${port}`, afterConnect); })); diff --git a/test/parallel/test-promises-warning-on-unhandled-rejection.js b/test/parallel/test-promises-warning-on-unhandled-rejection.js index ba420157e72bbd..596bf27ad1917d 100644 --- a/test/parallel/test-promises-warning-on-unhandled-rejection.js +++ b/test/parallel/test-promises-warning-on-unhandled-rejection.js @@ -23,7 +23,7 @@ process.on('warning', common.mustCall((warning) => { assert( /Unhandled promise rejection/.test(warning.message), 'Expected warning message to contain "Unhandled promise rejection" ' + - 'but did not. Had "' + warning.message + '" instead.' + `but did not. Had "${warning.message}" instead.` ); break; case 2: @@ -40,7 +40,7 @@ process.on('warning', common.mustCall((warning) => { assert( /Unhandled promise rejection/.test(warning.message), 'Expected warning message to contain "Unhandled promise rejection" ' + - 'but did not. Had "' + warning.message + '" instead.' + `but did not. Had "${warning.message}" instead.` ); break; case 5: diff --git a/test/parallel/test-tls-psk-server.js b/test/parallel/test-tls-psk-server.js index 69b850c70226a6..434d31380fe2ad 100644 --- a/test/parallel/test-tls-psk-server.js +++ b/test/parallel/test-tls-psk-server.js @@ -43,7 +43,7 @@ let gotWorld = false; server.listen(0, () => { const client = spawn(common.opensslCli, [ 's_client', - '-connect', '127.0.0.1:' + server.address().port, + '-connect', `127.0.0.1:${server.address().port}`, '-cipher', CIPHERS, '-psk', KEY, '-psk_identity', IDENTITY diff --git a/test/parallel/test-worker-relative-path.js b/test/parallel/test-worker-relative-path.js index 3b7bb95b0d78f4..73dc5b3637912f 100644 --- a/test/parallel/test-worker-relative-path.js +++ b/test/parallel/test-worker-relative-path.js @@ -5,7 +5,7 @@ const assert = require('assert'); const { Worker, isMainThread, parentPort } = require('worker_threads'); if (isMainThread) { - const w = new Worker('./' + path.relative('.', __filename)); + const w = new Worker(`./${path.relative('.', __filename)}`); w.on('message', common.mustCall((message) => { assert.strictEqual(message, 'Hello, world!'); })); From 079a32e31cb076668dfaf00366fcb3ab5ee662e0 Mon Sep 17 00:00:00 2001 From: himself65 Date: Sun, 29 Mar 2020 14:06:58 +0800 Subject: [PATCH 098/181] test: use common.mustCall in test-worker-esm-exit PR-URL: https://github.com/nodejs/node/pull/32544 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca --- test/parallel/test-worker-esm-exit.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-worker-esm-exit.js b/test/parallel/test-worker-esm-exit.js index 184106936536db..8c38faf3b72f8d 100644 --- a/test/parallel/test-worker-esm-exit.js +++ b/test/parallel/test-worker-esm-exit.js @@ -6,4 +6,6 @@ const { Worker } = require('worker_threads'); const w = new Worker(fixtures.path('es-modules/import-process-exit.mjs')); w.on('error', common.mustNotCall()); -w.on('exit', (code) => assert.strictEqual(code, 42)); +w.on('exit', + common.mustCall((code) => assert.strictEqual(code, 42)) +); From edf35db27eac309ba8bdd25574621f78cce0e4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Sun, 29 Mar 2020 00:01:29 -0500 Subject: [PATCH 099/181] test: replace flag expose_internals to expose-internals PR-URL: https://github.com/nodejs/node/pull/32542 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- test/parallel/test-child-process-bad-stdio.js | 2 +- test/parallel/test-child-process-exec-kill-throws.js | 2 +- test/parallel/test-child-process-http-socket-leak.js | 2 +- test/parallel/test-child-process-spawnsync-kill-signal.js | 2 +- test/parallel/test-child-process-spawnsync-shell.js | 2 +- test/parallel/test-child-process-validate-stdio.js | 2 +- test/parallel/test-child-process-windows-hide.js | 2 +- test/parallel/test-constants.js | 2 +- test/parallel/test-fs-open-flags.js | 2 +- test/parallel/test-http2-compat-socket.js | 2 +- test/parallel/test-http2-socket-proxy.js | 2 +- test/parallel/test-icu-stringwidth.js | 2 +- test/parallel/test-internal-util-decorate-error-stack.js | 2 +- test/parallel/test-os-checked-function.js | 2 +- test/parallel/test-readline-interface.js | 2 +- test/parallel/test-readline-tab-complete.js | 2 +- test/parallel/test-repl-history-perm.js | 2 +- test/parallel/test-repl.js | 2 +- test/parallel/test-safe-get-env.js | 2 +- test/parallel/test-stream-buffer-list.js | 2 +- test/parallel/test-stream2-readable-from-list.js | 2 +- test/parallel/test-tls-parse-cert-string.js | 2 +- test/parallel/test-tls-wrap-timeout.js | 2 +- test/parallel/test-util-internal.js | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/parallel/test-child-process-bad-stdio.js b/test/parallel/test-child-process-bad-stdio.js index 45294d7d82d4f6..1f382e2966043d 100644 --- a/test/parallel/test-child-process-bad-stdio.js +++ b/test/parallel/test-child-process-bad-stdio.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose_internals +// Flags: --expose-internals const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); diff --git a/test/parallel/test-child-process-exec-kill-throws.js b/test/parallel/test-child-process-exec-kill-throws.js index d6a0d4da19eae7..fbc9677f531068 100644 --- a/test/parallel/test-child-process-exec-kill-throws.js +++ b/test/parallel/test-child-process-exec-kill-throws.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose_internals +// Flags: --expose-internals const common = require('../common'); const assert = require('assert'); const cp = require('child_process'); diff --git a/test/parallel/test-child-process-http-socket-leak.js b/test/parallel/test-child-process-http-socket-leak.js index 9b284f285c4572..cae4b051bc2b35 100644 --- a/test/parallel/test-child-process-http-socket-leak.js +++ b/test/parallel/test-child-process-http-socket-leak.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; diff --git a/test/parallel/test-child-process-spawnsync-kill-signal.js b/test/parallel/test-child-process-spawnsync-kill-signal.js index 0c8f4a6d465b4f..6d14f24724bb2b 100644 --- a/test/parallel/test-child-process-spawnsync-kill-signal.js +++ b/test/parallel/test-child-process-spawnsync-kill-signal.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-child-process-spawnsync-shell.js b/test/parallel/test-child-process-spawnsync-shell.js index 0a20a490dd6cc4..0dd50cedd123b2 100644 --- a/test/parallel/test-child-process-spawnsync-shell.js +++ b/test/parallel/test-child-process-spawnsync-shell.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-child-process-validate-stdio.js b/test/parallel/test-child-process-validate-stdio.js index 5b0259f19bbd1f..ff214ee2d78262 100644 --- a/test/parallel/test-child-process-validate-stdio.js +++ b/test/parallel/test-child-process-validate-stdio.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose_internals +// Flags: --expose-internals const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-child-process-windows-hide.js b/test/parallel/test-child-process-windows-hide.js index 42bca6471ccdbc..1d9593c0a99242 100644 --- a/test/parallel/test-child-process-windows-hide.js +++ b/test/parallel/test-child-process-windows-hide.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-constants.js b/test/parallel/test-constants.js index 62c62b101a10a8..08d1f1dbcdd0ab 100644 --- a/test/parallel/test-constants.js +++ b/test/parallel/test-constants.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; require('../common'); diff --git a/test/parallel/test-fs-open-flags.js b/test/parallel/test-fs-open-flags.js index 016363b8028817..4b44ff28e9c9c4 100644 --- a/test/parallel/test-fs-open-flags.js +++ b/test/parallel/test-fs-open-flags.js @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; const common = require('../common'); diff --git a/test/parallel/test-http2-compat-socket.js b/test/parallel/test-http2-compat-socket.js index 0db2876738c766..95bc42180ef8e9 100644 --- a/test/parallel/test-http2-compat-socket.js +++ b/test/parallel/test-http2-compat-socket.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; diff --git a/test/parallel/test-http2-socket-proxy.js b/test/parallel/test-http2-socket-proxy.js index 745006831759d1..067909069e9d86 100644 --- a/test/parallel/test-http2-socket-proxy.js +++ b/test/parallel/test-http2-socket-proxy.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; diff --git a/test/parallel/test-icu-stringwidth.js b/test/parallel/test-icu-stringwidth.js index e2f22941158578..66d75c4cbe2cb2 100644 --- a/test/parallel/test-icu-stringwidth.js +++ b/test/parallel/test-icu-stringwidth.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; const common = require('../common'); diff --git a/test/parallel/test-internal-util-decorate-error-stack.js b/test/parallel/test-internal-util-decorate-error-stack.js index 40fbf1d48caf20..b12d50bee79abc 100644 --- a/test/parallel/test-internal-util-decorate-error-stack.js +++ b/test/parallel/test-internal-util-decorate-error-stack.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; require('../common'); const fixtures = require('../common/fixtures'); diff --git a/test/parallel/test-os-checked-function.js b/test/parallel/test-os-checked-function.js index e0758437fe873f..819cdf1794155f 100644 --- a/test/parallel/test-os-checked-function.js +++ b/test/parallel/test-os-checked-function.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose_internals +// Flags: --expose-internals require('../common'); const { internalBinding } = require('internal/test/binding'); diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index 0f96f8368b5d29..59a65e8ca2020e 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; const common = require('../common'); diff --git a/test/parallel/test-readline-tab-complete.js b/test/parallel/test-readline-tab-complete.js index 5afa60e4dae9fd..d7a4bb7a9a0690 100644 --- a/test/parallel/test-readline-tab-complete.js +++ b/test/parallel/test-readline-tab-complete.js @@ -1,6 +1,6 @@ 'use strict'; -// Flags: --expose_internals +// Flags: --expose-internals const common = require('../common'); const readline = require('readline'); diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index 3db2a009eb053b..7297689422eba1 100644 --- a/test/parallel/test-repl-history-perm.js +++ b/test/parallel/test-repl-history-perm.js @@ -2,7 +2,7 @@ // Verifies that the REPL history file is created with mode 0600 -// Flags: --expose_internals +// Flags: --expose-internals const common = require('../common'); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index a7b0b453e9068c..cb66c22457fdc2 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -560,7 +560,7 @@ const errorTests = [ expect: '... ... ... undefined' }, // REPL should get a normal require() function, not one that allows - // access to internal modules without the --expose_internals flag. + // access to internal modules without the --expose-internals flag. { send: 'require("internal/repl")', expect: [ diff --git a/test/parallel/test-safe-get-env.js b/test/parallel/test-safe-get-env.js index 0bee9971dbb3eb..f57dcb566d672d 100644 --- a/test/parallel/test-safe-get-env.js +++ b/test/parallel/test-safe-get-env.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose_internals +// Flags: --expose-internals require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-stream-buffer-list.js b/test/parallel/test-stream-buffer-list.js index c78efeea24bf6b..5b495a41e08545 100644 --- a/test/parallel/test-stream-buffer-list.js +++ b/test/parallel/test-stream-buffer-list.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-stream2-readable-from-list.js b/test/parallel/test-stream2-readable-from-list.js index 0ab7c059d66a85..6564a01691f09e 100644 --- a/test/parallel/test-stream2-readable-from-list.js +++ b/test/parallel/test-stream2-readable-from-list.js @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js index a3062c227e6fd1..f5412cad4074c4 100644 --- a/test/parallel/test-tls-parse-cert-string.js +++ b/test/parallel/test-tls-parse-cert-string.js @@ -10,7 +10,7 @@ const { restoreStderr } = require('../common/hijackstdio'); const assert = require('assert'); -// Flags: --expose_internals +// Flags: --expose-internals const internalTLS = require('internal/tls'); const tls = require('tls'); diff --git a/test/parallel/test-tls-wrap-timeout.js b/test/parallel/test-tls-wrap-timeout.js index 6ae2c39c59b8d9..7b9cb4170c888f 100644 --- a/test/parallel/test-tls-wrap-timeout.js +++ b/test/parallel/test-tls-wrap-timeout.js @@ -1,4 +1,4 @@ -// Flags: --expose_internals +// Flags: --expose-internals 'use strict'; const common = require('../common'); diff --git a/test/parallel/test-util-internal.js b/test/parallel/test-util-internal.js index f16ccfdbdc534f..cd38f3e7c57f44 100644 --- a/test/parallel/test-util-internal.js +++ b/test/parallel/test-util-internal.js @@ -1,5 +1,5 @@ 'use strict'; -// Flags: --expose_internals +// Flags: --expose-internals require('../common'); const assert = require('assert'); From 97a3e2f0e239416832d9cc9c757b6577c5a72104 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 27 Mar 2020 22:41:15 -0400 Subject: [PATCH 100/181] tools: update ESLint to 7.0.0-alpha.3 Update ESLint to 7.0.0-alpha.3 PR-URL: https://github.com/nodejs/node/pull/32533 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- tools/eslint-rules/crypto-check.js | 2 +- tools/node_modules/eslint/README.md | 4 +- .../node_modules/eslint/conf/environments.js | 3 +- .../cascading-config-array-factory.js | 6 +- .../eslint/lib/cli-engine/cli-engine.js | 3 +- .../lib/cli-engine/config-array-factory.js | 479 +- .../cli-engine/config-array/config-array.js | 29 + .../eslint/lib/init/config-file.js | 4 +- .../eslint/lib/linter/node-event-generator.js | 4 +- .../eslint/lib/rule-tester/rule-tester.js | 147 +- .../eslint/lib/rules/camelcase.js | 39 +- .../eslint/lib/rules/id-blacklist.js | 240 +- .../node_modules/eslint/lib/rules/no-alert.js | 8 +- .../eslint/lib/rules/no-empty-function.js | 4 +- .../node_modules/eslint/lib/rules/no-eval.js | 3 +- .../eslint/lib/rules/no-extra-bind.js | 2 +- .../eslint/lib/rules/no-extra-boolean-cast.js | 125 +- .../eslint/lib/rules/no-extra-parens.js | 8 +- .../eslint/lib/rules/no-implied-eval.js | 184 +- .../eslint/lib/rules/no-magic-numbers.js | 109 +- .../eslint/lib/rules/no-new-wrappers.js | 2 +- .../eslint/lib/rules/no-obj-calls.js | 29 +- .../eslint/lib/rules/no-plusplus.js | 42 +- .../eslint/lib/rules/no-prototype-builtins.js | 2 +- .../eslint/lib/rules/operator-assignment.js | 6 +- .../eslint/lib/rules/operator-linebreak.js | 20 +- .../lib/rules/prefer-numeric-literals.js | 6 +- .../eslint/lib/rules/prefer-object-spread.js | 4 +- .../eslint/lib/rules/require-await.js | 2 +- .../lib/rules/template-curly-spacing.js | 101 +- .../eslint/lib/rules/utils/ast-utils.js | 69 +- tools/node_modules/eslint/lib/shared/types.js | 4 +- .../eslint/messages/plugin-conflict.txt | 7 + .../helper-validator-identifier/LICENSE | 22 + .../helper-validator-identifier/README.md | 19 + .../lib/identifier.js | 77 + .../helper-validator-identifier/lib/index.js | 57 + .../lib/keyword.js | 38 + .../helper-validator-identifier/package.json | 22 + .../scripts/generate-identifier-regex.js | 75 + .../@babel/highlight/lib/index.js | 4 +- .../@babel/highlight/package.json | 6 +- .../eslint/node_modules/acorn/dist/acorn.js | 63 +- .../eslint/node_modules/acorn/dist/acorn.mjs | 63 +- .../eslint/node_modules/acorn/package.json | 3 +- .../eslint/node_modules/ansi-escapes/license | 2 +- .../node_modules/type-fest}/license | 0 .../node_modules/type-fest/package.json | 63 + .../node_modules/type-fest/readme.md | 637 +++ .../node_modules/ansi-escapes/package.json | 9 +- .../node_modules/ansi-escapes/readme.md | 1 - .../node_modules/eslint-utils/README.md | 1 - .../eslint/node_modules/eslint-utils/index.js | 4 +- .../node_modules/eslint-utils/index.mjs | 4 +- .../node_modules/eslint-utils/package.json | 2 +- .../eslint/node_modules/espree/espree.js | 5 + .../eslint/node_modules/espree/lib/espree.js | 68 +- .../eslint/node_modules/espree/lib/options.js | 105 + .../eslint/node_modules/espree/package.json | 6 +- .../eslint/node_modules/esquery/README.md | 2 +- .../node_modules/esquery/dist/esquery.esm.js | 3682 +++++++++++++ .../esquery/dist/esquery.esm.min.js | 2 + .../node_modules/esquery/dist/esquery.js | 3690 +++++++++++++ .../node_modules/esquery/dist/esquery.min.js | 2 + .../eslint/node_modules/esquery/esquery.js | 342 -- .../node_modules/estraverse/LICENSE.BSD | 19 + .../esquery/node_modules/estraverse/README.md | 153 + .../node_modules/estraverse/estraverse.js | 781 +++ .../node_modules/estraverse/package.json | 45 + .../eslint/node_modules/esquery/package.json | 60 +- .../eslint/node_modules/esquery/parser.js | 4727 ++++++++--------- .../eslint/node_modules/glob-parent/index.js | 2 +- .../node_modules/glob-parent/package.json | 4 +- .../eslint/node_modules/globals/globals.json | 18 + .../eslint/node_modules/globals/license | 2 +- .../eslint/node_modules/globals/package.json | 5 +- .../eslint/node_modules/globals/readme.md | 13 +- .../eslint/node_modules/inquirer/README.md | 23 +- .../node_modules/inquirer/lib/inquirer.js | 11 +- .../inquirer/lib/objects/choice.js | 1 + .../inquirer/lib/prompts/confirm.js | 2 - .../node_modules/inquirer/lib/ui/baseUI.js | 19 +- .../node_modules/inquirer/lib/ui/prompt.js | 18 +- .../inquirer/node_modules/ansi-regex/index.js | 14 - .../node_modules/ansi-regex/package.json | 62 - .../node_modules/ansi-regex/readme.md | 87 - .../inquirer/node_modules/chalk/index.js | 228 - .../inquirer/node_modules/chalk/index.js.flow | 93 - .../inquirer/node_modules/chalk/license | 9 - .../inquirer/node_modules/chalk/package.json | 80 - .../inquirer/node_modules/chalk/readme.md | 314 -- .../inquirer/node_modules/chalk/templates.js | 128 - .../inquirer/node_modules/strip-ansi/index.js | 7 - .../inquirer/node_modules/strip-ansi/license | 9 - .../node_modules/strip-ansi/package.json | 63 - .../node_modules/strip-ansi/readme.md | 61 - .../eslint/node_modules/inquirer/package.json | 18 +- .../eslint/node_modules/minimist/index.js | 166 +- .../eslint/node_modules/minimist/package.json | 6 +- .../node_modules/minimist/readme.markdown | 34 +- .../eslint/node_modules/mkdirp/index.js | 1 + .../eslint/node_modules/mkdirp/package.json | 17 +- .../eslint/node_modules/signal-exit/README.md | 1 - .../eslint/node_modules/signal-exit/index.js | 6 + .../node_modules/signal-exit/package.json | 4 +- .../eslint/node_modules/tslib/README.md | 24 +- .../eslint/node_modules/tslib/tslib.es6.js | 30 +- .../eslint/node_modules/tslib/tslib.js | 54 +- tools/node_modules/eslint/package.json | 10 +- 109 files changed, 13357 insertions(+), 4845 deletions(-) create mode 100644 tools/node_modules/eslint/messages/plugin-conflict.txt create mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE create mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/README.md create mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json create mode 100644 tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js rename tools/node_modules/eslint/node_modules/{inquirer/node_modules/ansi-regex => ansi-escapes/node_modules/type-fest}/license (100%) create mode 100644 tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/package.json create mode 100644 tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/readme.md create mode 100644 tools/node_modules/eslint/node_modules/espree/lib/options.js create mode 100644 tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js create mode 100644 tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.min.js create mode 100644 tools/node_modules/eslint/node_modules/esquery/dist/esquery.js create mode 100644 tools/node_modules/eslint/node_modules/esquery/dist/esquery.min.js delete mode 100644 tools/node_modules/eslint/node_modules/esquery/esquery.js create mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/LICENSE.BSD create mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/README.md create mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js create mode 100644 tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/index.js delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/package.json delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/index.js delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/index.js.flow delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/license delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/package.json delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/templates.js delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/strip-ansi/index.js delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/strip-ansi/license delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/strip-ansi/package.json delete mode 100644 tools/node_modules/eslint/node_modules/inquirer/node_modules/strip-ansi/readme.md diff --git a/tools/eslint-rules/crypto-check.js b/tools/eslint-rules/crypto-check.js index 1087fcaa39151a..93a0c1ec865f38 100644 --- a/tools/eslint-rules/crypto-check.js +++ b/tools/eslint-rules/crypto-check.js @@ -71,7 +71,7 @@ module.exports = function(context) { if (missingCheckNodes.length > 0) { requireNodes.forEach((requireNode) => { const beforeAllChecks = missingCheckNodes.every((checkNode) => { - return requireNode.start < checkNode.start; + return requireNode.range[0] < checkNode.range[0]; }); if (beforeAllChecks) { diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index b75051e6ecd53b..da75b5c149d799 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -250,9 +250,9 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

-

Shopify Salesforce MagicLab Airbnb Facebook Open Source

Silver Sponsors

+

Shopify Salesforce MagicLab Airbnb

Silver Sponsors

AMP Project

Bronze Sponsors

-

Nettikasinot.org BonusFinder Deutschland Top Web Design Agencies Bugsnag Stability Monitoring Crosswordsolver Mixpanel VPS Server Free Icons by Icons8 UI UX Design Agencies clay Discord ThemeIsle TekHattan Marfeel Fire Stick Tricks JSHeroes

+

Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Top Web Design Agencies Bugsnag Stability Monitoring Mixpanel VPS Server Free Icons by Icons8 UI UX Design Agencies clay Discord ThemeIsle TekHattan Marfeel Fire Stick Tricks

## Technology Sponsors diff --git a/tools/node_modules/eslint/conf/environments.js b/tools/node_modules/eslint/conf/environments.js index ee5ee1b4e5b2ab..90589b1c3270f3 100644 --- a/tools/node_modules/eslint/conf/environments.js +++ b/tools/node_modules/eslint/conf/environments.js @@ -40,7 +40,8 @@ const newGlobals2017 = { const newGlobals2020 = { BigInt: false, BigInt64Array: false, - BigUint64Array: false + BigUint64Array: false, + globalThis: false }; //------------------------------------------------------------------------------ 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 f91dea4c448276..b53f67bd9dce6c 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 @@ -140,6 +140,7 @@ function createBaseConfigArray({ function createCLIConfigArray({ cliConfigData, configArrayFactory, + cwd, ignorePath, specificConfigPath }) { @@ -158,7 +159,7 @@ function createCLIConfigArray({ cliConfigArray.unshift( ...configArrayFactory.loadFile( specificConfigPath, - { name: "--config" } + { name: "--config", basePath: cwd } ) ); } @@ -198,7 +199,7 @@ class CascadingConfigArrayFactory { cliConfig: cliConfigData = null, cwd = process.cwd(), ignorePath, - resolvePluginsRelativeTo = cwd, + resolvePluginsRelativeTo, rulePaths = [], specificConfigPath = null, useEslintrc = true @@ -220,6 +221,7 @@ class CascadingConfigArrayFactory { cliConfigArray: createCLIConfigArray({ cliConfigData, configArrayFactory, + cwd, ignorePath, specificConfigPath }), 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 9d2ef8cbcdef04..72d1fa4d5dcd5d 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -276,7 +276,8 @@ function verifyText({ */ function createIgnoreResult(filePath, baseDir) { let message; - const isHidden = /^\./u.test(path.basename(filePath)); + const isHidden = filePath.split(path.sep) + .find(segment => /^\./u.test(segment)); const isInNodeModules = baseDir && path.relative(baseDir, filePath).startsWith("node_modules"); if (isHidden) { 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 997a7e15318dfd..b1429af6ad95cf 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 @@ -90,7 +90,24 @@ const configFilenames = [ * @typedef {Object} ConfigArrayFactoryInternalSlots * @property {Map} additionalPluginPool The map for additional plugins. * @property {string} cwd The path to the current working directory. - * @property {string} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from. + * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from. + */ + +/** + * @typedef {Object} ConfigArrayFactoryLoadingContext + * @property {string} filePath The path to the current configuration. + * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @property {string} name The name of the current configuration. + * @property {string} pluginBasePath The base path to resolve plugins. + * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. + */ + +/** + * @typedef {Object} ConfigArrayFactoryLoadingContext + * @property {string} filePath The path to the current configuration. + * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @property {string} name The name of the current configuration. + * @property {"config" | "ignore" | "implicit-processor"} type The type of the current configuration. This is `"config"` in normal. This is `"ignore"` if it came from `.eslintignore`. This is `"implicit-processor"` if it came from legacy file-extension processors. */ /** @type {WeakMap} */ @@ -328,21 +345,39 @@ function writeDebugLogForLoading(request, relativeTo, filePath) { } /** - * Concatenate two config data. - * @param {IterableIterator|null} elements The config elements. - * @param {ConfigArray|null} parentConfigArray The parent config array. - * @returns {ConfigArray} The concatenated config array. + * Create a new context with default values. + * @param {ConfigArrayFactoryInternalSlots} slots The internal slots. + * @param {"config" | "ignore" | "implicit-processor" | undefined} providedType The type of the current configuration. Default is `"config"`. + * @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`. + * @param {string | undefined} providedFilePath The path to the current configuration. Default is empty string. + * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`. + * @returns {ConfigArrayFactoryLoadingContext} The created context. */ -function createConfigArray(elements, parentConfigArray) { - if (!elements) { - return parentConfigArray || new ConfigArray(); - } - const configArray = new ConfigArray(...elements); - - if (parentConfigArray && !configArray.isRoot()) { - configArray.unshift(...parentConfigArray); - } - return configArray; +function createContext( + { cwd, resolvePluginsRelativeTo }, + providedType, + providedName, + providedFilePath, + providedMatchBasePath +) { + const filePath = providedFilePath + ? path.resolve(cwd, providedFilePath) + : ""; + const matchBasePath = + (providedMatchBasePath && path.resolve(cwd, providedMatchBasePath)) || + (filePath && path.dirname(filePath)) || + cwd; + const name = + providedName || + (filePath && path.relative(cwd, filePath)) || + ""; + const pluginBasePath = + resolvePluginsRelativeTo || + (filePath && path.dirname(filePath)) || + cwd; + const type = providedType || "config"; + + return { filePath, matchBasePath, name, pluginBasePath, type }; } /** @@ -377,63 +412,95 @@ class ConfigArrayFactory { constructor({ additionalPluginPool = new Map(), cwd = process.cwd(), - resolvePluginsRelativeTo = cwd + resolvePluginsRelativeTo } = {}) { - internalSlotsMap.set(this, { additionalPluginPool, cwd, resolvePluginsRelativeTo: path.resolve(cwd, resolvePluginsRelativeTo) }); + internalSlotsMap.set(this, { + additionalPluginPool, + cwd, + resolvePluginsRelativeTo: + resolvePluginsRelativeTo && + path.resolve(cwd, resolvePluginsRelativeTo) + }); } /** * Create `ConfigArray` instance from a config data. * @param {ConfigData|null} configData The config data to create. * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. * @param {string} [options.filePath] The path to this config data. * @param {string} [options.name] The config name. - * @param {ConfigArray} [options.parent] The parent config array. * @returns {ConfigArray} Loaded config. */ - create(configData, { filePath, name, parent } = {}) { - return createConfigArray( - configData - ? this._normalizeConfigData(configData, filePath, name) - : null, - parent - ); + create(configData, { basePath, filePath, name } = {}) { + if (!configData) { + return new ConfigArray(); + } + + const slots = internalSlotsMap.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); + const elements = this._normalizeConfigData(configData, ctx); + + return new ConfigArray(...elements); } /** * Load a config file. * @param {string} filePath The path to a config file. * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. * @param {string} [options.name] The config name. - * @param {ConfigArray} [options.parent] The parent config array. * @returns {ConfigArray} Loaded config. */ - loadFile(filePath, { name, parent } = {}) { - const { cwd } = internalSlotsMap.get(this); - const absolutePath = path.resolve(cwd, filePath); + loadFile(filePath, { basePath, name } = {}) { + const slots = internalSlotsMap.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); - return createConfigArray( - this._loadConfigData(absolutePath, name), - parent - ); + return new ConfigArray(...this._loadConfigData(ctx)); } /** * Load the config file on a given directory if exists. * @param {string} directoryPath The path to a directory. * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. * @param {string} [options.name] The config name. - * @param {ConfigArray} [options.parent] The parent config array. * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. */ - loadInDirectory(directoryPath, { name, parent } = {}) { - const { cwd } = internalSlotsMap.get(this); - const absolutePath = path.resolve(cwd, directoryPath); + loadInDirectory(directoryPath, { basePath, name } = {}) { + const slots = internalSlotsMap.get(this); - return createConfigArray( - this._loadConfigDataInDirectory(absolutePath, name), - parent - ); + for (const filename of configFilenames) { + const ctx = createContext( + slots, + "config", + name, + path.join(directoryPath, filename), + basePath + ); + + if (fs.existsSync(ctx.filePath)) { + let configData; + + try { + configData = loadConfigFile(ctx.filePath); + } catch (error) { + if (!error || error.code !== "ESLINT_CONFIG_FIELD_NOT_FOUND") { + throw error; + } + } + + if (configData) { + debug(`Config file found: ${ctx.filePath}`); + return new ConfigArray( + ...this._normalizeConfigData(configData, ctx) + ); + } + } + } + + debug(`Config file not found on ${directoryPath}`); + return new ConfigArray(); } /** @@ -465,13 +532,18 @@ class ConfigArrayFactory { * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. */ loadESLintIgnore(filePath) { - const { cwd } = internalSlotsMap.get(this); - const absolutePath = path.resolve(cwd, filePath); - const name = path.relative(cwd, absolutePath); - const ignorePatterns = loadESLintIgnoreFile(absolutePath); + const slots = internalSlotsMap.get(this); + const ctx = createContext( + slots, + "ignore", + void 0, + filePath, + slots.cwd + ); + const ignorePatterns = loadESLintIgnoreFile(ctx.filePath); - return createConfigArray( - this._normalizeESLintIgnoreData(ignorePatterns, absolutePath, name) + return new ConfigArray( + ...this._normalizeESLintIgnoreData(ignorePatterns, ctx) ); } @@ -480,9 +552,9 @@ class ConfigArrayFactory { * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. */ loadDefaultESLintIgnore() { - const { cwd } = internalSlotsMap.get(this); - const eslintIgnorePath = path.resolve(cwd, ".eslintignore"); - const packageJsonPath = path.resolve(cwd, "package.json"); + const slots = internalSlotsMap.get(this); + const eslintIgnorePath = path.resolve(slots.cwd, ".eslintignore"); + const packageJsonPath = path.resolve(slots.cwd, "package.json"); if (fs.existsSync(eslintIgnorePath)) { return this.loadESLintIgnore(eslintIgnorePath); @@ -494,12 +566,16 @@ class ConfigArrayFactory { if (!Array.isArray(data.eslintIgnore)) { throw new Error("Package.json eslintIgnore property requires an array of paths"); } - return createConfigArray( - this._normalizeESLintIgnoreData( - data.eslintIgnore, - packageJsonPath, - "eslintIgnore in package.json" - ) + const ctx = createContext( + slots, + "ignore", + "eslintIgnore in package.json", + packageJsonPath, + slots.cwd + ); + + return new ConfigArray( + ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx) ); } } @@ -509,65 +585,25 @@ class ConfigArrayFactory { /** * Load a given config file. - * @param {string} filePath The path to a config file. - * @param {string} name The config name. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} Loaded config. * @private */ - _loadConfigData(filePath, name) { - return this._normalizeConfigData( - loadConfigFile(filePath), - filePath, - name - ); - } - - /** - * Load the config file in a given directory if exists. - * @param {string} directoryPath The path to a directory. - * @param {string} name The config name. - * @returns {IterableIterator | null} Loaded config. `null` if any config doesn't exist. - * @private - */ - _loadConfigDataInDirectory(directoryPath, name) { - for (const filename of configFilenames) { - const filePath = path.join(directoryPath, filename); - - if (fs.existsSync(filePath)) { - let configData; - - try { - configData = loadConfigFile(filePath); - } catch (error) { - if (!error || error.code !== "ESLINT_CONFIG_FIELD_NOT_FOUND") { - throw error; - } - } - - if (configData) { - debug(`Config file found: ${filePath}`); - return this._normalizeConfigData(configData, filePath, name); - } - } - } - - debug(`Config file not found on ${directoryPath}`); - return null; + _loadConfigData(ctx) { + return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx); } /** * Normalize a given `.eslintignore` data to config array elements. * @param {string[]} ignorePatterns The patterns to ignore files. - * @param {string|undefined} filePath The file path of this config. - * @param {string|undefined} name The name of this config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ - *_normalizeESLintIgnoreData(ignorePatterns, filePath, name) { + *_normalizeESLintIgnoreData(ignorePatterns, ctx) { const elements = this._normalizeObjectConfigData( - { type: "ignore", ignorePatterns }, - filePath, - name + { ignorePatterns }, + ctx ); // Set `ignorePattern.loose` flag for backward compatibility. @@ -582,53 +618,38 @@ class ConfigArrayFactory { /** * Normalize a given config to an array. * @param {ConfigData} configData The config data to normalize. - * @param {string|undefined} providedFilePath The file path of this config. - * @param {string|undefined} providedName The name of this config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ - _normalizeConfigData(configData, providedFilePath, providedName) { - const { cwd } = internalSlotsMap.get(this); - const filePath = providedFilePath - ? path.resolve(cwd, providedFilePath) - : ""; - const name = providedName || (filePath && path.relative(cwd, filePath)); - - validateConfigSchema(configData, name || filePath); - - return this._normalizeObjectConfigData(configData, filePath, name); + _normalizeConfigData(configData, ctx) { + validateConfigSchema(configData, ctx.name || ctx.filePath); + return this._normalizeObjectConfigData(configData, ctx); } /** * Normalize a given config to an array. * @param {ConfigData|OverrideConfigData} configData The config data to normalize. - * @param {string} filePath The file path of this config. - * @param {string} name The name of this config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ - *_normalizeObjectConfigData(configData, filePath, name) { - const { cwd } = internalSlotsMap.get(this); + *_normalizeObjectConfigData(configData, ctx) { const { files, excludedFiles, ...configBody } = configData; - const basePath = filePath ? path.dirname(filePath) : cwd; - const criteria = OverrideTester.create(files, excludedFiles, basePath); - const elements = - this._normalizeObjectConfigDataBody(configBody, filePath, name); + const criteria = OverrideTester.create( + files, + excludedFiles, + ctx.matchBasePath + ); + const elements = this._normalizeObjectConfigDataBody(configBody, ctx); // Apply the criteria to every element. for (const element of elements) { - // Adopt the base path of the entry file (the outermost base path). - if (element.criteria) { - element.criteria.basePath = basePath; - } - if (element.ignorePattern) { - element.ignorePattern.basePath = basePath; - } - /* - * Merge the criteria; this is for only file extension processors in - * `overrides` section for now. + * Merge the criteria. + * This is for the `overrides` entries that came from the + * configurations of `overrides[].extends`. */ element.criteria = OverrideTester.and(criteria, element.criteria); @@ -647,8 +668,7 @@ class ConfigArrayFactory { /** * Normalize a given config to an array. * @param {ConfigData} configData The config data to normalize. - * @param {string} filePath The file path of this config. - * @param {string} name The name of this config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ @@ -667,41 +687,37 @@ class ConfigArrayFactory { root, rules, settings, - type = "config", overrides: overrideList = [] }, - filePath, - name + ctx ) { const extendList = Array.isArray(extend) ? extend : [extend]; const ignorePattern = ignorePatterns && new IgnorePattern( Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns], - filePath ? path.dirname(filePath) : internalSlotsMap.get(this).cwd + ctx.matchBasePath ); // Flatten `extends`. for (const extendName of extendList.filter(Boolean)) { - yield* this._loadExtends(extendName, filePath, name); + yield* this._loadExtends(extendName, ctx); } // Load parser & plugins. - const parser = - parserName && this._loadParser(parserName, filePath, name); - const plugins = - pluginList && this._loadPlugins(pluginList, filePath, name); + const parser = parserName && this._loadParser(parserName, ctx); + const plugins = pluginList && this._loadPlugins(pluginList, ctx); // Yield pseudo config data for file extension processors. if (plugins) { - yield* this._takeFileExtensionProcessors(plugins, filePath, name); + yield* this._takeFileExtensionProcessors(plugins, ctx); } // Yield the config data except `extends` and `overrides`. yield { // Debug information. - type, - name, - filePath, + type: ctx.type, + name: ctx.name, + filePath: ctx.filePath, // Config data. criteria: null, @@ -723,8 +739,7 @@ class ConfigArrayFactory { for (let i = 0; i < overrideList.length; ++i) { yield* this._normalizeObjectConfigData( overrideList[i], - filePath, - `${name}#overrides[${i}]` + { ...ctx, name: `${ctx.name}#overrides[${i}]` } ); } } @@ -732,34 +747,22 @@ class ConfigArrayFactory { /** * Load configs of an element in `extends`. * @param {string} extendName The name of a base config. - * @param {string} importerPath The file path which has the `extends` property. - * @param {string} importerName The name of the config which has the `extends` property. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ - _loadExtends(extendName, importerPath, importerName) { - debug("Loading {extends:%j} relative to %s", extendName, importerPath); + _loadExtends(extendName, ctx) { + debug("Loading {extends:%j} relative to %s", extendName, ctx.filePath); try { if (extendName.startsWith("eslint:")) { - return this._loadExtendedBuiltInConfig( - extendName, - importerName - ); + return this._loadExtendedBuiltInConfig(extendName, ctx); } if (extendName.startsWith("plugin:")) { - return this._loadExtendedPluginConfig( - extendName, - importerPath, - importerName - ); + return this._loadExtendedPluginConfig(extendName, ctx); } - return this._loadExtendedShareableConfig( - extendName, - importerPath, - importerName - ); + return this._loadExtendedShareableConfig(extendName, ctx); } catch (error) { - error.message += `\nReferenced from: ${importerPath || importerName}`; + error.message += `\nReferenced from: ${ctx.filePath || ctx.name}`; throw error; } } @@ -767,32 +770,37 @@ class ConfigArrayFactory { /** * Load configs of an element in `extends`. * @param {string} extendName The name of a base config. - * @param {string} importerName The name of the config which has the `extends` property. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ - _loadExtendedBuiltInConfig(extendName, importerName) { - const name = `${importerName} » ${extendName}`; - + _loadExtendedBuiltInConfig(extendName, ctx) { if (extendName === "eslint:recommended") { - return this._loadConfigData(eslintRecommendedPath, name); + return this._loadConfigData({ + ...ctx, + filePath: eslintRecommendedPath, + name: `${ctx.name} » ${extendName}` + }); } if (extendName === "eslint:all") { - return this._loadConfigData(eslintAllPath, name); + return this._loadConfigData({ + ...ctx, + filePath: eslintAllPath, + name: `${ctx.name} » ${extendName}` + }); } - throw configMissingError(extendName, importerName); + throw configMissingError(extendName, ctx.name); } /** * Load configs of an element in `extends`. * @param {string} extendName The name of a base config. - * @param {string} importerPath The file path which has the `extends` property. - * @param {string} importerName The name of the config which has the `extends` property. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ - _loadExtendedPluginConfig(extendName, importerPath, importerName) { + _loadExtendedPluginConfig(extendName, ctx) { const slashIndex = extendName.lastIndexOf("/"); const pluginName = extendName.slice("plugin:".length, slashIndex); const configName = extendName.slice(slashIndex + 1); @@ -801,33 +809,32 @@ class ConfigArrayFactory { throw new Error("'extends' cannot use a file path for plugins."); } - const plugin = this._loadPlugin(pluginName, importerPath, importerName); + const plugin = this._loadPlugin(pluginName, ctx); const configData = plugin.definition && plugin.definition.configs[configName]; if (configData) { - return this._normalizeConfigData( - configData, - plugin.filePath, - `${importerName} » plugin:${plugin.id}/${configName}` - ); + return this._normalizeConfigData(configData, { + ...ctx, + filePath: plugin.filePath, + name: `${ctx.name} » plugin:${plugin.id}/${configName}` + }); } - throw plugin.error || configMissingError(extendName, importerPath); + throw plugin.error || configMissingError(extendName, ctx.filePath); } /** * Load configs of an element in `extends`. * @param {string} extendName The name of a base config. - * @param {string} importerPath The file path which has the `extends` property. - * @param {string} importerName The name of the config which has the `extends` property. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The normalized config. * @private */ - _loadExtendedShareableConfig(extendName, importerPath, importerName) { + _loadExtendedShareableConfig(extendName, ctx) { const { cwd } = internalSlotsMap.get(this); - const relativeTo = importerPath || path.join(cwd, "__placeholder__.js"); + const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); let request; if (isFilePath(extendName)) { @@ -848,29 +855,32 @@ class ConfigArrayFactory { } catch (error) { /* istanbul ignore else */ if (error && error.code === "MODULE_NOT_FOUND") { - throw configMissingError(extendName, importerPath); + throw configMissingError(extendName, ctx.filePath); } throw error; } writeDebugLogForLoading(request, relativeTo, filePath); - return this._loadConfigData(filePath, `${importerName} » ${request}`); + return this._loadConfigData({ + ...ctx, + filePath, + name: `${ctx.name} » ${request}` + }); } /** * Load given plugins. * @param {string[]} names The plugin names to load. - * @param {string} importerPath The path to a config file that imports it. This is just a debug info. - * @param {string} importerName The name of a config file that imports it. This is just a debug info. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {Record} The loaded parser. * @private */ - _loadPlugins(names, importerPath, importerName) { + _loadPlugins(names, ctx) { return names.reduce((map, name) => { if (isFilePath(name)) { throw new Error("Plugins array cannot includes file paths."); } - const plugin = this._loadPlugin(name, importerPath, importerName); + const plugin = this._loadPlugin(name, ctx); map[plugin.id] = plugin; @@ -881,15 +891,14 @@ class ConfigArrayFactory { /** * Load a given parser. * @param {string} nameOrPath The package name or the path to a parser file. - * @param {string} importerPath The path to a config file that imports it. - * @param {string} importerName The name of a config file that imports it. This is just a debug info. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {DependentParser} The loaded parser. */ - _loadParser(nameOrPath, importerPath, importerName) { - debug("Loading parser %j from %s", nameOrPath, importerPath); + _loadParser(nameOrPath, ctx) { + debug("Loading parser %j from %s", nameOrPath, ctx.filePath); const { cwd } = internalSlotsMap.get(this); - const relativeTo = importerPath || path.join(cwd, "__placeholder__.js"); + const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); try { const filePath = ModuleResolver.resolve(nameOrPath, relativeTo); @@ -900,8 +909,8 @@ class ConfigArrayFactory { definition: require(filePath), filePath, id: nameOrPath, - importerName, - importerPath + importerName: ctx.name, + importerPath: ctx.filePath }); } catch (error) { @@ -912,19 +921,19 @@ class ConfigArrayFactory { definition: require("espree"), filePath: require.resolve("espree"), id: nameOrPath, - importerName, - importerPath + importerName: ctx.name, + importerPath: ctx.filePath }); } - debug("Failed to load parser '%s' declared in '%s'.", nameOrPath, importerName); - error.message = `Failed to load parser '${nameOrPath}' declared in '${importerName}': ${error.message}`; + debug("Failed to load parser '%s' declared in '%s'.", nameOrPath, ctx.name); + error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`; return new ConfigDependency({ error, id: nameOrPath, - importerName, - importerPath + importerName: ctx.name, + importerPath: ctx.filePath }); } } @@ -932,18 +941,17 @@ class ConfigArrayFactory { /** * Load a given plugin. * @param {string} name The plugin name to load. - * @param {string} importerPath The path to a config file that imports it. This is just a debug info. - * @param {string} importerName The name of a config file that imports it. This is just a debug info. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {DependentPlugin} The loaded plugin. * @private */ - _loadPlugin(name, importerPath, importerName) { - debug("Loading plugin %j from %s", name, importerPath); + _loadPlugin(name, ctx) { + debug("Loading plugin %j from %s", name, ctx.filePath); - const { additionalPluginPool, resolvePluginsRelativeTo } = internalSlotsMap.get(this); + const { additionalPluginPool } = internalSlotsMap.get(this); const request = naming.normalizePackageName(name, "eslint-plugin"); const id = naming.getShorthandName(request, "eslint-plugin"); - const relativeTo = path.join(resolvePluginsRelativeTo, "__placeholder__.js"); + const relativeTo = path.join(ctx.pluginBasePath, "__placeholder__.js"); if (name.match(/\s+/u)) { const error = Object.assign( @@ -957,8 +965,8 @@ class ConfigArrayFactory { return new ConfigDependency({ error, id, - importerName, - importerPath + importerName: ctx.name, + importerPath: ctx.filePath }); } @@ -970,10 +978,10 @@ class ConfigArrayFactory { if (plugin) { return new ConfigDependency({ definition: normalizePlugin(plugin), - filePath: importerPath, + filePath: ctx.filePath, id, - importerName, - importerPath + importerName: ctx.name, + importerPath: ctx.filePath }); } @@ -989,8 +997,8 @@ class ConfigArrayFactory { error.messageTemplate = "plugin-missing"; error.messageData = { pluginName: request, - resolvePluginsRelativeTo, - importerName + resolvePluginsRelativeTo: ctx.pluginBasePath, + importerName: ctx.name }; } } @@ -1008,33 +1016,32 @@ class ConfigArrayFactory { definition: normalizePlugin(pluginDefinition), filePath, id, - importerName, - importerPath + importerName: ctx.name, + importerPath: ctx.filePath }); } catch (loadError) { error = loadError; } } - debug("Failed to load plugin '%s' declared in '%s'.", name, importerName); - error.message = `Failed to load plugin '${name}' declared in '${importerName}': ${error.message}`; + debug("Failed to load plugin '%s' declared in '%s'.", name, ctx.name); + error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`; return new ConfigDependency({ error, id, - importerName, - importerPath + importerName: ctx.name, + importerPath: ctx.filePath }); } /** * Take file expression processors as config array elements. * @param {Record} plugins The plugin definitions. - * @param {string} filePath The file path of this config. - * @param {string} name The name of this config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. * @returns {IterableIterator} The config array elements of file expression processors. * @private */ - *_takeFileExtensionProcessors(plugins, filePath, name) { + *_takeFileExtensionProcessors(plugins, ctx) { for (const pluginId of Object.keys(plugins)) { const processors = plugins[pluginId] && @@ -1049,12 +1056,14 @@ class ConfigArrayFactory { if (processorId.startsWith(".")) { yield* this._normalizeObjectConfigData( { - type: "implicit-processor", files: [`*${processorId}`], processor: `${pluginId}/${processorId}` }, - filePath, - `${name}#processors["${pluginId}/${processorId}"]` + { + ...ctx, + type: "implicit-processor", + name: `${ctx.name}#processors["${pluginId}/${processorId}"]` + } ); } } @@ -1062,4 +1071,4 @@ class ConfigArrayFactory { } } -module.exports = { ConfigArrayFactory }; +module.exports = { ConfigArrayFactory, createContext }; 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 b3f7c1e7350033..b3434198b19201 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 @@ -65,6 +65,7 @@ const { IgnorePattern } = require("./ignore-pattern"); * @property {boolean|undefined} root The flag to express root. * @property {Record|undefined} rules The rule settings * @property {Object|undefined} settings The shared settings. + * @property {"config" | "ignore" | "implicit-processor"} type The element type. */ /** @@ -155,6 +156,23 @@ function mergeWithoutOverwrite(target, source) { } } +/** + * The error for plugin conflicts. + */ +class PluginConflictError extends Error { + + /** + * Initialize this error object. + * @param {string} pluginId The plugin ID. + * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins. + */ + constructor(pluginId, plugins) { + super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`); + this.messageTemplate = "plugin-conflict"; + this.messageData = { pluginId, plugins }; + } +} + /** * Merge plugins. * `target`'s definition is prior to `source`'s. @@ -180,6 +198,17 @@ function mergePlugins(target, source) { throw sourceValue.error; } target[key] = sourceValue; + } else if (sourceValue.filePath !== targetValue.filePath) { + throw new PluginConflictError(key, [ + { + filePath: targetValue.filePath, + importerName: targetValue.importerName + }, + { + filePath: sourceValue.filePath, + importerName: sourceValue.importerName + } + ]); } } } diff --git a/tools/node_modules/eslint/lib/init/config-file.js b/tools/node_modules/eslint/lib/init/config-file.js index 960b572cddb3ea..fc62b81525e66b 100644 --- a/tools/node_modules/eslint/lib/init/config-file.js +++ b/tools/node_modules/eslint/lib/init/config-file.js @@ -45,7 +45,7 @@ function sortByKey(a, b) { function writeJSONConfigFile(config, filePath) { debug(`Writing JSON config file: ${filePath}`); - const content = stringify(config, { cmp: sortByKey, space: 4 }); + const content = `${stringify(config, { cmp: sortByKey, space: 4 })}\n`; fs.writeFileSync(filePath, content, "utf8"); } @@ -80,7 +80,7 @@ function writeJSConfigFile(config, filePath) { debug(`Writing JS config file: ${filePath}`); let contentToWrite; - const stringifiedContent = `module.exports = ${stringify(config, { cmp: sortByKey, space: 4 })};`; + const stringifiedContent = `module.exports = ${stringify(config, { cmp: sortByKey, space: 4 })};\n`; try { const { CLIEngine } = require("../cli-engine"); 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 fc7b879f64172b..6f3b2513998dcd 100644 --- a/tools/node_modules/eslint/lib/linter/node-event-generator.js +++ b/tools/node_modules/eslint/lib/linter/node-event-generator.js @@ -159,8 +159,8 @@ function tryParseSelector(rawSelector) { try { return esquery.parse(rawSelector.replace(/:exit$/u, "")); } catch (err) { - if (typeof err.offset === "number") { - throw new SyntaxError(`Syntax error in selector "${rawSelector}" at position ${err.offset}: ${err.message}`); + if (err.location && err.location.start && typeof err.location.start.offset === "number") { + throw new SyntaxError(`Syntax error in selector "${rawSelector}" at position ${err.location.start.offset}: ${err.message}`); } throw err; } 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 5180f87a316f85..1c1737152c1b19 100644 --- a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js +++ b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js @@ -45,16 +45,20 @@ const path = require("path"), util = require("util"), lodash = require("lodash"), + Traverser = require("../../lib/shared/traverser"), { getRuleOptionsSchema, validate } = require("../shared/config-validator"), { Linter, SourceCodeFixer, interpolate } = require("../linter"); const ajv = require("../shared/ajv")({ strictDefaults: true }); +const espreePath = require.resolve("espree"); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ +/** @typedef {import("../shared/types").Parser} Parser */ + /** * A test case that is expected to pass lint. * @typedef {Object} ValidTestCase @@ -141,6 +145,7 @@ const friendlyErrorObjectParameterList = `[${[...errorObjectParameters].map(key const suggestionObjectParameters = new Set([ "desc", "messageId", + "data", "output" ]); const friendlySuggestionObjectParameterList = `[${[...suggestionObjectParameters].map(key => `'${key}'`).join(", ")}]`; @@ -205,6 +210,70 @@ function sanitize(text) { ); } +/** + * Define `start`/`end` properties as throwing error. + * @param {string} objName Object name used for error messages. + * @param {ASTNode} node The node to define. + * @returns {void} + */ +function defineStartEndAsError(objName, node) { + Object.defineProperties(node, { + start: { + get() { + throw new Error(`Use ${objName}.range[0] instead of ${objName}.start`); + }, + configurable: true, + enumerable: false + }, + end: { + get() { + throw new Error(`Use ${objName}.range[1] instead of ${objName}.end`); + }, + configurable: true, + enumerable: false + } + }); +} + +/** + * Define `start`/`end` properties of all nodes of the given AST as throwing error. + * @param {ASTNode} ast The root node to errorize `start`/`end` properties. + * @param {Object} [visitorKeys] Visitor keys to be used for traversing the given ast. + * @returns {void} + */ +function defineStartEndAsErrorInTree(ast, visitorKeys) { + Traverser.traverse(ast, { visitorKeys, enter: defineStartEndAsError.bind(null, "node") }); + ast.tokens.forEach(defineStartEndAsError.bind(null, "token")); + ast.comments.forEach(defineStartEndAsError.bind(null, "token")); +} + +/** + * Wraps the given parser in order to intercept and modify return values from the `parse` and `parseForESLint` methods, for test purposes. + * In particular, to modify ast nodes, tokens and comments to throw on access to their `start` and `end` properties. + * @param {Parser} parser Parser object. + * @returns {Parser} Wrapped parser object. + */ +function wrapParser(parser) { + if (typeof parser.parseForESLint === "function") { + return { + parseForESLint(...args) { + const ret = parser.parseForESLint(...args); + + defineStartEndAsErrorInTree(ret.ast, ret.visitorKeys); + return ret; + } + }; + } + return { + parse(...args) { + const ast = parser.parse(...args); + + defineStartEndAsErrorInTree(ast); + return ast; + } + }; +} + //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -449,9 +518,12 @@ class RuleTester { if (typeof config.parser === "string") { assert(path.isAbsolute(config.parser), "Parsers provided as strings to RuleTester must be absolute paths"); - linter.defineParser(config.parser, require(config.parser)); + } else { + config.parser = espreePath; } + linter.defineParser(config.parser, wrapParser(require(config.parser))); + if (schema) { ajv.validateSchema(schema); @@ -482,13 +554,9 @@ class RuleTester { // Verify the code. const messages = linter.verify(code, config, filename); + const fatalErrorMessage = messages.find(m => m.fatal); - // Ignore syntax errors for backward compatibility if `errors` is a number. - if (typeof item.errors !== "number") { - const errorMessage = messages.find(m => m.fatal); - - assert(!errorMessage, `A fatal parsing error occurred: ${errorMessage && errorMessage.message}`); - } + assert(!fatalErrorMessage, `A fatal parsing error occurred: ${fatalErrorMessage && fatalErrorMessage.message}`); // Verify if autofix makes a syntax error or not. if (messages.some(m => m.fix)) { @@ -571,10 +639,12 @@ class RuleTester { assert.ok(item.errors || item.errors === 0, `Did not specify errors for an invalid test of ${ruleName}`); + const ruleHasMetaMessages = hasOwnProperty(rule, "meta") && hasOwnProperty(rule.meta, "messages"); + const friendlyIDList = ruleHasMetaMessages ? `[${Object.keys(rule.meta.messages).map(key => `'${key}'`).join(", ")}]` : null; + const result = runRuleForItem(item); const messages = result.messages; - if (typeof item.errors === "number") { assert.strictEqual(messages.length, item.errors, util.format("Should have %d error%s but had %d: %s", item.errors, item.errors === 1 ? "" : "s", messages.length, util.inspect(messages))); @@ -620,12 +690,10 @@ class RuleTester { assertMessageMatches(message.message, error.message); } else if (hasOwnProperty(error, "messageId")) { assert.ok( - hasOwnProperty(rule, "meta") && hasOwnProperty(rule.meta, "messages"), + ruleHasMetaMessages, "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'." ); if (!hasOwnProperty(rule.meta.messages, error.messageId)) { - const friendlyIDList = `[${Object.keys(rule.meta.messages).map(key => `'${key}'`).join(", ")}]`; - assert(false, `Invalid messageId '${error.messageId}'. Expected one of ${friendlyIDList}.`); } assert.strictEqual( @@ -700,19 +768,50 @@ class RuleTester { }); const actualSuggestion = message.suggestions[index]; + const suggestionPrefix = `Error Suggestion at index ${index} :`; + + if (hasOwnProperty(expectedSuggestion, "desc")) { + assert.ok( + !hasOwnProperty(expectedSuggestion, "data"), + `${suggestionPrefix} Test should not specify both 'desc' and 'data'.` + ); + assert.strictEqual( + actualSuggestion.desc, + expectedSuggestion.desc, + `${suggestionPrefix} desc should be "${expectedSuggestion.desc}" but got "${actualSuggestion.desc}" instead.` + ); + } - /** - * Tests equality of a suggestion key if that key is defined in the expected output. - * @param {string} key Key to validate from the suggestion object - * @returns {void} - */ - function assertSuggestionKeyEquals(key) { - if (hasOwnProperty(expectedSuggestion, key)) { - assert.deepStrictEqual(actualSuggestion[key], expectedSuggestion[key], `Error suggestion at index: ${index} should have desc of: "${actualSuggestion[key]}"`); + if (hasOwnProperty(expectedSuggestion, "messageId")) { + assert.ok( + ruleHasMetaMessages, + `${suggestionPrefix} Test can not use 'messageId' if rule under test doesn't define 'meta.messages'.` + ); + assert.ok( + hasOwnProperty(rule.meta.messages, expectedSuggestion.messageId), + `${suggestionPrefix} Test has invalid messageId '${expectedSuggestion.messageId}', the rule under test allows only one of ${friendlyIDList}.` + ); + assert.strictEqual( + actualSuggestion.messageId, + expectedSuggestion.messageId, + `${suggestionPrefix} messageId should be '${expectedSuggestion.messageId}' but got '${actualSuggestion.messageId}' instead.` + ); + if (hasOwnProperty(expectedSuggestion, "data")) { + const unformattedMetaMessage = rule.meta.messages[expectedSuggestion.messageId]; + const rehydratedDesc = interpolate(unformattedMetaMessage, expectedSuggestion.data); + + assert.strictEqual( + actualSuggestion.desc, + rehydratedDesc, + `${suggestionPrefix} Hydrated test desc "${rehydratedDesc}" does not match received desc "${actualSuggestion.desc}".` + ); } + } else { + assert.ok( + !hasOwnProperty(expectedSuggestion, "data"), + `${suggestionPrefix} Test must specify 'messageId' if 'data' is used.` + ); } - assertSuggestionKeyEquals("desc"); - assertSuggestionKeyEquals("messageId"); if (hasOwnProperty(expectedSuggestion, "output")) { const codeWithAppliedSuggestion = SourceCodeFixer.applyFixes(item.code, [actualSuggestion]).output; @@ -740,6 +839,12 @@ class RuleTester { } else { assert.strictEqual(result.output, item.output, "Output is incorrect."); } + } else { + assert.strictEqual( + result.output, + item.code, + "The rule fixed the code. Please add 'output' property." + ); } assertASTDidntChange(result.beforeAST, result.afterAST); diff --git a/tools/node_modules/eslint/lib/rules/camelcase.js b/tools/node_modules/eslint/lib/rules/camelcase.js index a06c7f94042ad4..04360837294a12 100644 --- a/tools/node_modules/eslint/lib/rules/camelcase.js +++ b/tools/node_modules/eslint/lib/rules/camelcase.js @@ -125,6 +125,40 @@ module.exports = { return false; } + /** + * Checks whether the given node represents assignment target property in destructuring. + * + * For examples: + * ({a: b.foo} = c); // => true for `foo` + * ([a.foo] = b); // => true for `foo` + * ([a.foo = 1] = b); // => true for `foo` + * ({...a.foo} = b); // => true for `foo` + * @param {ASTNode} node An Identifier node to check + * @returns {boolean} True if the node is an assignment target property in destructuring. + */ + function isAssignmentTargetPropertyInDestructuring(node) { + if ( + node.parent.type === "MemberExpression" && + node.parent.property === node && + !node.parent.computed + ) { + const effectiveParent = node.parent.parent; + + return ( + effectiveParent.type === "Property" && + effectiveParent.value === node.parent && + effectiveParent.parent.type === "ObjectPattern" || + effectiveParent.type === "ArrayPattern" || + effectiveParent.type === "RestElement" || + ( + effectiveParent.type === "AssignmentPattern" && + effectiveParent.left === node.parent + ) + ); + } + return false; + } + /** * Reports an AST node as a rule violation. * @param {ASTNode} node The node to report. @@ -170,6 +204,9 @@ module.exports = { // Report AssignmentExpressions only if they are the left side of the assignment } else if (effectiveParent.type === "AssignmentExpression" && nameIsUnderscored && (effectiveParent.right.type !== "MemberExpression" || effectiveParent.left.type === "MemberExpression" && effectiveParent.left.property.name === node.name)) { report(node); + + } else if (isAssignmentTargetPropertyInDestructuring(node) && nameIsUnderscored) { + report(node); } /* @@ -186,7 +223,7 @@ module.exports = { const assignmentKeyEqualsValue = node.parent.key.name === node.parent.value.name; - if (isUnderscored(name) && node.parent.computed) { + if (nameIsUnderscored && node.parent.computed) { report(node); } diff --git a/tools/node_modules/eslint/lib/rules/id-blacklist.js b/tools/node_modules/eslint/lib/rules/id-blacklist.js index ddff9363aee8a8..d77a35d41b670d 100644 --- a/tools/node_modules/eslint/lib/rules/id-blacklist.js +++ b/tools/node_modules/eslint/lib/rules/id-blacklist.js @@ -6,6 +6,105 @@ "use strict"; +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Checks whether the given node represents assignment target in a normal assignment or destructuring. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is assignment target. + */ +function isAssignmentTarget(node) { + const parent = node.parent; + + return ( + + // normal assignment + ( + parent.type === "AssignmentExpression" && + parent.left === node + ) || + + // destructuring + parent.type === "ArrayPattern" || + parent.type === "RestElement" || + ( + parent.type === "Property" && + parent.value === node && + parent.parent.type === "ObjectPattern" + ) || + ( + parent.type === "AssignmentPattern" && + parent.left === node + ) + ); +} + +/** + * Checks whether the given node represents an imported name that is renamed in the same import/export specifier. + * + * Examples: + * import { a as b } from 'mod'; // node `a` is renamed import + * export { a as b } from 'mod'; // node `a` is renamed import + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a renamed import. + */ +function isRenamedImport(node) { + const parent = node.parent; + + return ( + ( + parent.type === "ImportSpecifier" && + parent.imported !== parent.local && + parent.imported === node + ) || + ( + parent.type === "ExportSpecifier" && + parent.parent.source && // re-export + parent.local !== parent.exported && + parent.local === node + ) + ); +} + +/** + * Checks whether the given node is a renamed identifier node in an ObjectPattern destructuring. + * + * Examples: + * const { a : b } = foo; // node `a` is renamed node. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a renamed node in an ObjectPattern destructuring. + */ +function isRenamedInDestructuring(node) { + const parent = node.parent; + + return ( + ( + !parent.computed && + parent.type === "Property" && + parent.parent.type === "ObjectPattern" && + parent.value !== node && + parent.key === node + ) + ); +} + +/** + * Checks whether the given node represents shorthand definition of a property in an object literal. + * @param {ASTNode} node `Identifier` node to check. + * @returns {boolean} `true` if the node is a shorthand property definition. + */ +function isShorthandPropertyDefinition(node) { + const parent = node.parent; + + return ( + parent.type === "Property" && + parent.parent.type === "ObjectExpression" && + parent.shorthand + ); +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -35,88 +134,64 @@ module.exports = { create(context) { - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - const blacklist = context.options; + const blacklist = new Set(context.options); const reportedNodes = new Set(); + let globalScope; /** - * Checks if a string matches the provided pattern - * @param {string} name The string to check. - * @returns {boolean} if the string is a match + * Checks whether the given name is blacklisted. + * @param {string} name The name to check. + * @returns {boolean} `true` if the name is blacklisted. * @private */ - function isInvalid(name) { - return blacklist.indexOf(name) !== -1; + function isBlacklisted(name) { + return blacklist.has(name); } /** - * Checks whether the given node represents an imported name that is renamed in the same import/export specifier. - * - * Examples: - * import { a as b } from 'mod'; // node `a` is renamed import - * export { a as b } from 'mod'; // node `a` is renamed import + * Checks whether the given node represents a reference to a global variable that is not declared in the source code. + * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a renamed import. + * @returns {boolean} `true` if the node is a reference to a global variable. */ - function isRenamedImport(node) { - const parent = node.parent; + function isReferenceToGlobalVariable(node) { + const variable = globalScope.set.get(node.name); - return ( - ( - parent.type === "ImportSpecifier" && - parent.imported !== parent.local && - parent.imported === node - ) || - ( - parent.type === "ExportSpecifier" && - parent.parent.source && // re-export - parent.local !== parent.exported && - parent.local === node - ) - ); + return variable && variable.defs.length === 0 && + variable.references.some(ref => ref.identifier === node); } /** - * Checks whether the given node is a renamed identifier node in an ObjectPattern destructuring. - * - * Examples: - * const { a : b } = foo; // node `a` is renamed node. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a renamed node in an ObjectPattern destructuring. + * Determines whether the given node should be checked. + * @param {ASTNode} node `Identifier` node. + * @returns {boolean} `true` if the node should be checked. */ - function isRenamedInDestructuring(node) { + function shouldCheck(node) { const parent = node.parent; - return ( - ( - !parent.computed && - parent.type === "Property" && - parent.parent.type === "ObjectPattern" && - parent.value !== node && - parent.key === node - ) - ); - } - - /** - * Verifies if we should report an error or not. - * @param {ASTNode} node The node to check - * @returns {boolean} whether an error should be reported or not - */ - function shouldReport(node) { - const parent = node.parent; + /* + * Member access has special rules for checking property names. + * Read access to a property with a blacklisted name is allowed, because it can be on an object that user has no control over. + * Write access isn't allowed, because it potentially creates a new property with a blacklisted name. + */ + if ( + parent.type === "MemberExpression" && + parent.property === node && + !parent.computed + ) { + return isAssignmentTarget(parent); + } return ( parent.type !== "CallExpression" && parent.type !== "NewExpression" && !isRenamedImport(node) && !isRenamedInDestructuring(node) && - isInvalid(node.name) + !( + isReferenceToGlobalVariable(node) && + !isShorthandPropertyDefinition(node) + ) ); } @@ -141,54 +216,15 @@ module.exports = { return { - Identifier(node) { - - // MemberExpressions get special rules - if (node.parent.type === "MemberExpression") { - const name = node.name, - effectiveParent = node.parent.parent; - - // Always check object names - if (node.parent.object.type === "Identifier" && - node.parent.object.name === name) { - if (isInvalid(name)) { - report(node); - } - - // Report AssignmentExpressions only if they are the left side of the assignment - } else if (effectiveParent.type === "AssignmentExpression" && - (effectiveParent.right.type !== "MemberExpression" || - effectiveParent.left.type === "MemberExpression" && - effectiveParent.left.property.name === name)) { - if (isInvalid(name)) { - report(node); - } - - // Report the last identifier in an ObjectPattern destructuring. - } else if ( - ( - effectiveParent.type === "Property" && - effectiveParent.value === node.parent && - effectiveParent.parent.type === "ObjectPattern" - ) || - effectiveParent.type === "RestElement" || - effectiveParent.type === "ArrayPattern" || - ( - effectiveParent.type === "AssignmentPattern" && - effectiveParent.left === node.parent - ) - ) { - if (isInvalid(name)) { - report(node); - } - } + Program() { + globalScope = context.getScope(); + }, - } else if (shouldReport(node)) { + Identifier(node) { + if (isBlacklisted(node.name) && shouldCheck(node)) { report(node); } } - }; - } }; diff --git a/tools/node_modules/eslint/lib/rules/no-alert.js b/tools/node_modules/eslint/lib/rules/no-alert.js index 287cd2c35701f0..22d0dd57bdd82d 100644 --- a/tools/node_modules/eslint/lib/rules/no-alert.js +++ b/tools/node_modules/eslint/lib/rules/no-alert.js @@ -8,7 +8,10 @@ // Requirements //------------------------------------------------------------------------------ -const getPropertyName = require("./utils/ast-utils").getStaticPropertyName; +const { + getStaticPropertyName: getPropertyName, + getVariableByName +} = require("./utils/ast-utils"); //------------------------------------------------------------------------------ // Helpers @@ -61,7 +64,7 @@ function isGlobalThisReferenceOrGlobalWindow(scope, node) { if (scope.type === "global" && node.type === "ThisExpression") { return true; } - if (node.name === "window") { + if (node.name === "window" || (node.name === "globalThis" && getVariableByName(scope, "globalThis"))) { return !isShadowed(scope, node); } @@ -119,7 +122,6 @@ module.exports = { }); } } - } }; 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 c57e66fd534048..c74321158b3464 100644 --- a/tools/node_modules/eslint/lib/rules/no-empty-function.js +++ b/tools/node_modules/eslint/lib/rules/no-empty-function.js @@ -23,7 +23,9 @@ const ALLOW_OPTIONS = Object.freeze([ "generatorMethods", "getters", "setters", - "constructors" + "constructors", + "asyncFunctions", + "asyncMethods" ]); /** diff --git a/tools/node_modules/eslint/lib/rules/no-eval.js b/tools/node_modules/eslint/lib/rules/no-eval.js index a293b04aa37de2..811ad4e5d73dda 100644 --- a/tools/node_modules/eslint/lib/rules/no-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-eval.js @@ -17,7 +17,8 @@ const astUtils = require("./utils/ast-utils"); const candidatesOfGlobalObject = Object.freeze([ "global", - "window" + "window", + "globalThis" ]); /** 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 d938c0f51b06dd..df695924ab5299 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-bind.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-bind.js @@ -64,7 +64,7 @@ module.exports = { context.report({ node: node.parent.parent, messageId: "unexpected", - loc: node.parent.property.loc.start, + loc: node.parent.property.loc, fix(fixer) { if (node.parent.parent.arguments.length && !isSideEffectFree(node.parent.parent.arguments[0])) { return null; 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 8ccd0bce9060b1..aba8e63e086a41 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 @@ -10,6 +10,9 @@ //------------------------------------------------------------------------------ const astUtils = require("./utils/ast-utils"); +const eslintUtils = require("eslint-utils"); + +const precedence = astUtils.getPrecedence; //------------------------------------------------------------------------------ // Rule Definition @@ -126,6 +129,60 @@ module.exports = { return Boolean(sourceCode.getCommentsInside(node).length); } + /** + * Checks if the given node is wrapped in grouping parentheses. Parentheses for constructs such as if() don't count. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is parenthesized. + * @private + */ + function isParenthesized(node) { + return eslintUtils.isParenthesized(1, node, sourceCode); + } + + /** + * Determines whether the given node needs to be parenthesized when replacing the previous node. + * It assumes that `previousNode` is the node to be reported by this rule, so it has a limited list + * of possible parent node types. By the same assumption, the node's role in a particular parent is already known. + * For example, if the parent is `ConditionalExpression`, `previousNode` must be its `test` child. + * @param {ASTNode} previousNode Previous node. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node needs to be parenthesized. + */ + function needsParens(previousNode, node) { + if (isParenthesized(previousNode)) { + + // parentheses around the previous node will stay, so there is no need for an additional pair + return false; + } + + // parent of the previous node will become parent of the replacement node + const parent = previousNode.parent; + + switch (parent.type) { + case "CallExpression": + case "NewExpression": + return node.type === "SequenceExpression"; + case "IfStatement": + case "DoWhileStatement": + case "WhileStatement": + case "ForStatement": + return false; + case "ConditionalExpression": + return precedence(node) <= precedence(parent); + case "UnaryExpression": + return precedence(node) < precedence(parent); + case "LogicalExpression": + if (previousNode === parent.left) { + return precedence(node) < precedence(parent); + } + return precedence(node) <= precedence(parent); + + /* istanbul ignore next */ + default: + throw new Error(`Unexpected parent type: ${parent.type}`); + } + } + return { UnaryExpression(node) { const parent = node.parent; @@ -143,32 +200,34 @@ module.exports = { context.report({ node: parent, messageId: "unexpectedNegation", - fix: fixer => { + fix(fixer) { if (hasCommentsInside(parent)) { return null; } + if (needsParens(parent, node.argument)) { + return fixer.replaceText(parent, `(${sourceCode.getText(node.argument)})`); + } + let prefix = ""; const tokenBefore = sourceCode.getTokenBefore(parent); const firstReplacementToken = sourceCode.getFirstToken(node.argument); - if (tokenBefore && tokenBefore.range[1] === parent.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, firstReplacementToken)) { + if ( + tokenBefore && + tokenBefore.range[1] === parent.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, firstReplacementToken) + ) { prefix = " "; } - if (astUtils.getPrecedence(node.argument) < astUtils.getPrecedence(parent.parent)) { - return fixer.replaceText(parent, `(${sourceCode.getText(node.argument)})`); - } - return fixer.replaceText(parent, prefix + sourceCode.getText(node.argument)); } }); } }, - CallExpression(node) { - const parent = node.parent; + CallExpression(node) { if (node.callee.type !== "Identifier" || node.callee.name !== "Boolean") { return; } @@ -177,11 +236,15 @@ module.exports = { context.report({ node, messageId: "unexpectedCall", - fix: fixer => { - if (!node.arguments.length) { + fix(fixer) { + const parent = node.parent; + + if (node.arguments.length === 0) { if (parent.type === "UnaryExpression" && parent.operator === "!") { - // !Boolean() -> true + /* + * !Boolean() -> true + */ if (hasCommentsInside(parent)) { return null; @@ -191,32 +254,48 @@ module.exports = { let prefix = ""; const tokenBefore = sourceCode.getTokenBefore(parent); - if (tokenBefore && tokenBefore.range[1] === parent.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, replacement)) { + if ( + tokenBefore && + tokenBefore.range[1] === parent.range[0] && + !astUtils.canTokensBeAdjacent(tokenBefore, replacement) + ) { prefix = " "; } return fixer.replaceText(parent, prefix + replacement); } - // Boolean() -> false + /* + * Boolean() -> false + */ + if (hasCommentsInside(node)) { return null; } + return fixer.replaceText(node, "false"); } - if (node.arguments.length > 1 || node.arguments[0].type === "SpreadElement" || - hasCommentsInside(node)) { - return null; - } + if (node.arguments.length === 1) { + const argument = node.arguments[0]; + + if (argument.type === "SpreadElement" || hasCommentsInside(node)) { + return null; + } + + /* + * Boolean(expression) -> expression + */ - const argument = node.arguments[0]; + if (needsParens(node, argument)) { + return fixer.replaceText(node, `(${sourceCode.getText(argument)})`); + } - if (astUtils.getPrecedence(argument) < astUtils.getPrecedence(node.parent)) { - return fixer.replaceText(node, `(${sourceCode.getText(argument)})`); + return fixer.replaceText(node, sourceCode.getText(argument)); } - return fixer.replaceText(node, sourceCode.getText(argument)); + + // two or more arguments + return null; } }); } 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 a5488c3c1c6aa4..a3dd5bab699da3 100644 --- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js +++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js @@ -307,13 +307,13 @@ module.exports = { */ function requiresLeadingSpace(node) { const leftParenToken = sourceCode.getTokenBefore(node); - const tokenBeforeLeftParen = sourceCode.getTokenBefore(node, 1); - const firstToken = sourceCode.getFirstToken(node); + const tokenBeforeLeftParen = sourceCode.getTokenBefore(leftParenToken, { includeComments: true }); + const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParenToken, { includeComments: true }); return tokenBeforeLeftParen && tokenBeforeLeftParen.range[1] === leftParenToken.range[0] && - leftParenToken.range[1] === firstToken.range[0] && - !astUtils.canTokensBeAdjacent(tokenBeforeLeftParen, firstToken); + leftParenToken.range[1] === tokenAfterLeftParen.range[0] && + !astUtils.canTokensBeAdjacent(tokenBeforeLeftParen, tokenAfterLeftParen); } /** 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 46bb5d4f76e5f7..1668a0432a5277 100644 --- a/tools/node_modules/eslint/lib/rules/no-implied-eval.js +++ b/tools/node_modules/eslint/lib/rules/no-implied-eval.js @@ -5,6 +5,13 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); +const { getStaticValue } = require("eslint-utils"); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -28,94 +35,97 @@ module.exports = { }, create(context) { - const CALLEE_RE = /^(setTimeout|setInterval|execScript)$/u; - - /* - * Figures out if we should inspect a given binary expression. Is a stack - * of stacks, where the first element in each substack is a CallExpression. - */ - const impliedEvalAncestorsStack = []; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- + const EVAL_LIKE_FUNCS = Object.freeze(["setTimeout", "execScript", "setInterval"]); + const GLOBAL_CANDIDATES = Object.freeze(["global", "window", "globalThis"]); /** - * Get the last element of an array, without modifying arr, like pop(), but non-destructive. - * @param {Array} arr What to inspect - * @returns {*} The last element of arr - * @private + * Checks whether a node is evaluated as a string or not. + * @param {ASTNode} node A node to check. + * @returns {boolean} True if the node is evaluated as a string. */ - function last(arr) { - return arr ? arr[arr.length - 1] : null; + function isEvaluatedString(node) { + if ( + (node.type === "Literal" && typeof node.value === "string") || + node.type === "TemplateLiteral" + ) { + return true; + } + if (node.type === "BinaryExpression" && node.operator === "+") { + return isEvaluatedString(node.left) || isEvaluatedString(node.right); + } + return false; } /** - * Checks if the given MemberExpression node is a potentially implied eval identifier on window. - * @param {ASTNode} node The MemberExpression node to check. - * @returns {boolean} Whether or not the given node is potentially an implied eval. - * @private + * Checks whether a node is an Identifier node named one of the specified names. + * @param {ASTNode} node A node to check. + * @param {string[]} specifiers Array of specified name. + * @returns {boolean} True if the node is a Identifier node which has specified name. */ - function isImpliedEvalMemberExpression(node) { - const object = node.object, - property = node.property, - hasImpliedEvalName = CALLEE_RE.test(property.name) || CALLEE_RE.test(property.value); - - return object.name === "window" && hasImpliedEvalName; + function isSpecifiedIdentifier(node, specifiers) { + return node.type === "Identifier" && specifiers.includes(node.name); } /** - * 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 + * Checks a given node is a MemberExpression node which has the specified name's + * property. + * @param {ASTNode} node A node to check. + * @param {string[]} specifiers Array of specified name. + * @returns {boolean} `true` if the node is a MemberExpression node which has + * the specified name's property */ - function isImpliedEvalCallExpression(node) { - const isMemberExpression = (node.callee.type === "MemberExpression"), - isIdentifier = (node.callee.type === "Identifier"), - isImpliedEvalCallee = - (isIdentifier && CALLEE_RE.test(node.callee.name)) || - (isMemberExpression && isImpliedEvalMemberExpression(node.callee)); - - return isImpliedEvalCallee && node.arguments.length; + function isSpecifiedMember(node, specifiers) { + return node.type === "MemberExpression" && specifiers.includes(astUtils.getStaticPropertyName(node)); } /** - * Checks that the parent is a direct descendent of an potential implied eval CallExpression, and if the parent is a CallExpression, that we're the first argument. - * @param {ASTNode} node The node to inspect the parent of. - * @returns {boolean} Was the parent a direct descendent, and is the child therefore potentially part of a dangerous argument? - * @private + * Reports if the `CallExpression` node has evaluated argument. + * @param {ASTNode} node A CallExpression to check. + * @returns {void} */ - function hasImpliedEvalParent(node) { + function reportImpliedEvalCallExpression(node) { + const [firstArgument] = node.arguments; - // make sure our parent is marked - return node.parent === last(last(impliedEvalAncestorsStack)) && + if (firstArgument) { + + const staticValue = getStaticValue(firstArgument, context.getScope()); + const isStaticString = staticValue && typeof staticValue.value === "string"; + const isString = isStaticString || isEvaluatedString(firstArgument); + + if (isString) { + context.report({ + node, + messageId: "impliedEval" + }); + } + } - // if our parent is a CallExpression, make sure we're the first argument - (node.parent.type !== "CallExpression" || node === node.parent.arguments[0]); } /** - * Checks if our parent is marked as part of an implied eval argument. If - * so, collapses the top of impliedEvalAncestorsStack and reports on the - * original CallExpression. - * @param {ASTNode} node The CallExpression to check. - * @returns {boolean} True if the node matches, false if not. - * @private + * Reports calls of `implied eval` via the global references. + * @param {Variable} globalVar A global variable to check. + * @returns {void} */ - function checkString(node) { - if (hasImpliedEvalParent(node)) { + function reportImpliedEvalViaGlobal(globalVar) { + const { references, name } = globalVar; - // remove the entire substack, to avoid duplicate reports - const substack = impliedEvalAncestorsStack.pop(); + references.forEach(ref => { + const identifier = ref.identifier; + let node = identifier.parent; - context.report({ - node: substack[0], - messageId: "impliedEval" - }); - } + while (isSpecifiedMember(node, [name])) { + node = node.parent; + } + + if (isSpecifiedMember(node, EVAL_LIKE_FUNCS)) { + const parent = node.parent; + + if (parent.type === "CallExpression" && parent.callee === node) { + reportImpliedEvalCallExpression(parent); + } + } + }); } //-------------------------------------------------------------------------- @@ -124,45 +134,17 @@ module.exports = { return { CallExpression(node) { - if (isImpliedEvalCallExpression(node)) { - - // call expressions create a new substack - impliedEvalAncestorsStack.push([node]); - } - }, - - "CallExpression:exit"(node) { - if (node === last(last(impliedEvalAncestorsStack))) { - - /* - * Destroys the entire sub-stack, rather than just using - * last(impliedEvalAncestorsStack).pop(), as a CallExpression is - * always the bottom of a impliedEvalAncestorsStack substack. - */ - impliedEvalAncestorsStack.pop(); - } - }, - - BinaryExpression(node) { - if (node.operator === "+" && hasImpliedEvalParent(node)) { - last(impliedEvalAncestorsStack).push(node); - } - }, - - "BinaryExpression:exit"(node) { - if (node === last(last(impliedEvalAncestorsStack))) { - last(impliedEvalAncestorsStack).pop(); - } - }, - - Literal(node) { - if (typeof node.value === "string") { - checkString(node); + if (isSpecifiedIdentifier(node.callee, EVAL_LIKE_FUNCS)) { + reportImpliedEvalCallExpression(node); } }, + "Program:exit"() { + const globalScope = context.getScope(); - TemplateLiteral(node) { - checkString(node); + GLOBAL_CANDIDATES + .map(candidate => astUtils.getVariableByName(globalScope, candidate)) + .filter(globalVar => !!globalVar && globalVar.defs.length === 0) + .forEach(reportImpliedEvalViaGlobal); } }; 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 5dd6feaab0dbff..cd07f5c3bda9d5 100644 --- a/tools/node_modules/eslint/lib/rules/no-magic-numbers.js +++ b/tools/node_modules/eslint/lib/rules/no-magic-numbers.js @@ -7,6 +7,9 @@ const { isNumericLiteral } = require("./utils/ast-utils"); +// Maximum array length by the ECMAScript Specification. +const MAX_ARRAY_LENGTH = 2 ** 32 - 1; + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -76,83 +79,115 @@ module.exports = { ignore = (config.ignore || []).map(normalizeIgnoreValue), ignoreArrayIndexes = !!config.ignoreArrayIndexes; + const okTypes = detectObjects ? [] : ["ObjectExpression", "Property", "AssignmentExpression"]; + /** - * Returns whether the number should be ignored - * @param {number} num the number - * @returns {boolean} true if the number should be ignored + * Returns whether the rule is configured to ignore the given value + * @param {bigint|number} value The value to check + * @returns {boolean} true if the value is ignored */ - function shouldIgnoreNumber(num) { - return ignore.indexOf(num) !== -1; + function isIgnoredValue(value) { + return ignore.indexOf(value) !== -1; } /** - * 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 - * @returns {boolean} true if the number should be ignored + * Returns whether the given node is used as a radix within parseInt() or Number.parseInt() + * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node + * @returns {boolean} true if the node is radix */ - function shouldIgnoreParseInt(parent, node) { - return parent.type === "CallExpression" && node === parent.arguments[1] && - (parent.callee.name === "parseInt" || - parent.callee.type === "MemberExpression" && - parent.callee.object.name === "Number" && - parent.callee.property.name === "parseInt"); + function isParseIntRadix(fullNumberNode) { + const parent = fullNumberNode.parent; + + return parent.type === "CallExpression" && fullNumberNode === parent.arguments[1] && + ( + parent.callee.name === "parseInt" || + ( + parent.callee.type === "MemberExpression" && + parent.callee.object.name === "Number" && + parent.callee.property.name === "parseInt" + ) + ); } /** - * Returns whether the number should be ignored when used to define a JSX prop - * @param {ASTNode} parent the non-"UnaryExpression" parent - * @returns {boolean} true if the number should be ignored + * Returns whether the given node is a direct child of a JSX node. + * In particular, it aims to detect numbers used as prop values in JSX tags. + * Example: + * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node + * @returns {boolean} true if the node is a JSX number */ - function shouldIgnoreJSXNumbers(parent) { - return parent.type.indexOf("JSX") === 0; + function isJSXNumber(fullNumberNode) { + return fullNumberNode.parent.type.indexOf("JSX") === 0; } /** - * Returns whether the number should be ignored when used as an array index with enabled 'ignoreArrayIndexes' option. - * @param {ASTNode} node Node to check - * @returns {boolean} true if the number should be ignored + * Returns whether the given node is used as an array index. + * Value must coerce to a valid array index name: "0", "1", "2" ... "4294967294". + * + * All other values, like "-1", "2.5", or "4294967295", are just "normal" object properties, + * which can be created and accessed on an array in addition to the array index properties, + * but they don't affect array's length and are not considered by methods such as .map(), .forEach() etc. + * + * The maximum array length by the specification is 2 ** 32 - 1 = 4294967295, + * thus the maximum valid index is 2 ** 32 - 2 = 4294967294. + * + * All notations are allowed, as long as the value coerces to one of "0", "1", "2" ... "4294967294". + * + * Valid examples: + * a[0], a[1], a[1.2e1], a[0xAB], a[0n], a[1n] + * a[-0] (same as a[0] because -0 coerces to "0") + * a[-0n] (-0n evaluates to 0n) + * + * Invalid examples: + * a[-1], a[-0xAB], a[-1n], a[2.5], a[1.23e1], a[12e-1] + * a[4294967295] (above the max index, it's an access to a regular property a["4294967295"]) + * a[999999999999999999999] (even if it wasn't above the max index, it would be a["1e+21"]) + * a[1e310] (same as a["Infinity"]) + * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node + * @param {bigint|number} value Value expressed by the fullNumberNode + * @returns {boolean} true if the node is a valid array index */ - function shouldIgnoreArrayIndexes(node) { - const parent = node.parent; + function isArrayIndex(fullNumberNode, value) { + const parent = fullNumberNode.parent; - return ignoreArrayIndexes && - parent.type === "MemberExpression" && parent.property === node; + return parent.type === "MemberExpression" && parent.property === fullNumberNode && + (Number.isInteger(value) || typeof value === "bigint") && + value >= 0 && value < MAX_ARRAY_LENGTH; } return { Literal(node) { - const okTypes = detectObjects ? [] : ["ObjectExpression", "Property", "AssignmentExpression"]; - if (!isNumericLiteral(node)) { return; } let fullNumberNode; - let parent; let value; let raw; - // For negative magic numbers: update the value and parent node + // Treat unary minus as a part of the number if (node.parent.type === "UnaryExpression" && node.parent.operator === "-") { fullNumberNode = node.parent; - parent = fullNumberNode.parent; value = -node.value; raw = `-${node.raw}`; } else { fullNumberNode = node; - parent = node.parent; value = node.value; raw = node.raw; } - if (shouldIgnoreNumber(value) || - shouldIgnoreParseInt(parent, fullNumberNode) || - shouldIgnoreArrayIndexes(fullNumberNode) || - shouldIgnoreJSXNumbers(parent)) { + // Always allow radix arguments and JSX props + if ( + isIgnoredValue(value) || + isParseIntRadix(fullNumberNode) || + isJSXNumber(fullNumberNode) || + (ignoreArrayIndexes && isArrayIndex(fullNumberNode, value)) + ) { return; } + const parent = fullNumberNode.parent; + if (parent.type === "VariableDeclarator") { if (enforceConst && parent.parent.kind !== "const") { context.report({ diff --git a/tools/node_modules/eslint/lib/rules/no-new-wrappers.js b/tools/node_modules/eslint/lib/rules/no-new-wrappers.js index 0a2861fa5f7799..d276c48d203fab 100644 --- a/tools/node_modules/eslint/lib/rules/no-new-wrappers.js +++ b/tools/node_modules/eslint/lib/rules/no-new-wrappers.js @@ -32,7 +32,7 @@ module.exports = { return { NewExpression(node) { - const wrapperObjects = ["String", "Number", "Boolean", "Math", "JSON"]; + const wrapperObjects = ["String", "Number", "Boolean"]; if (wrapperObjects.indexOf(node.callee.name) > -1) { context.report({ diff --git a/tools/node_modules/eslint/lib/rules/no-obj-calls.js b/tools/node_modules/eslint/lib/rules/no-obj-calls.js index 9ff666b03281ca..6139ba2c182b8b 100644 --- a/tools/node_modules/eslint/lib/rules/no-obj-calls.js +++ b/tools/node_modules/eslint/lib/rules/no-obj-calls.js @@ -9,7 +9,8 @@ // Requirements //------------------------------------------------------------------------------ -const { CALL, ReferenceTracker } = require("eslint-utils"); +const { CALL, CONSTRUCT, ReferenceTracker } = require("eslint-utils"); +const getPropertyName = require("./utils/ast-utils").getStaticPropertyName; //------------------------------------------------------------------------------ // Helpers @@ -17,6 +18,18 @@ const { CALL, ReferenceTracker } = require("eslint-utils"); const nonCallableGlobals = ["Atomics", "JSON", "Math", "Reflect"]; +/** + * Returns the name of the node to report + * @param {ASTNode} node A node to report + * @returns {string} name to report + */ +function getReportNodeName(node) { + if (node.callee.type === "MemberExpression") { + return getPropertyName(node.callee); + } + return node.callee.name; +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -35,7 +48,8 @@ module.exports = { schema: [], messages: { - unexpectedCall: "'{{name}}' is not a function." + unexpectedCall: "'{{name}}' is not a function.", + unexpectedRefCall: "'{{name}}' is reference to '{{ref}}', which is not a function." } }, @@ -49,12 +63,17 @@ module.exports = { for (const g of nonCallableGlobals) { traceMap[g] = { - [CALL]: true + [CALL]: true, + [CONSTRUCT]: true }; } - for (const { node } of tracker.iterateGlobalReferences(traceMap)) { - context.report({ node, messageId: "unexpectedCall", data: { name: node.callee.name } }); + for (const { node, path } of tracker.iterateGlobalReferences(traceMap)) { + const name = getReportNodeName(node); + const ref = path[0]; + const messageId = name === ref ? "unexpectedCall" : "unexpectedRefCall"; + + context.report({ node, messageId, data: { name, ref } }); } } }; diff --git a/tools/node_modules/eslint/lib/rules/no-plusplus.js b/tools/node_modules/eslint/lib/rules/no-plusplus.js index f55303863d25ca..84d6c3e1f91d51 100644 --- a/tools/node_modules/eslint/lib/rules/no-plusplus.js +++ b/tools/node_modules/eslint/lib/rules/no-plusplus.js @@ -6,6 +6,41 @@ "use strict"; +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the given node is the update node of a `ForStatement`. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is `ForStatement` update. + */ +function isForStatementUpdate(node) { + const parent = node.parent; + + return parent.type === "ForStatement" && parent.update === node; +} + +/** + * Determines whether the given node is considered to be a for loop "afterthought" by the logic of this rule. + * In particular, it returns `true` if the given node is either: + * - The update node of a `ForStatement`: for (;; i++) {} + * - An operand of a sequence expression that is the update node: for (;; foo(), i++) {} + * - An operand of a sequence expression that is child of another sequence expression, etc., + * up to the sequence expression that is the update node: for (;; foo(), (bar(), (baz(), i++))) {} + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is a for loop afterthought. + */ +function isForLoopAfterthought(node) { + const parent = node.parent; + + if (parent.type === "SequenceExpression") { + return isForLoopAfterthought(parent); + } + + return isForStatementUpdate(node); +} + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -42,18 +77,19 @@ module.exports = { create(context) { const config = context.options[0]; - let allowInForAfterthought = false; + let allowForLoopAfterthoughts = false; if (typeof config === "object") { - allowInForAfterthought = config.allowForLoopAfterthoughts === true; + allowForLoopAfterthoughts = config.allowForLoopAfterthoughts === true; } return { UpdateExpression(node) { - if (allowInForAfterthought && node.parent.type === "ForStatement") { + if (allowForLoopAfterthoughts && isForLoopAfterthought(node)) { return; } + context.report({ node, messageId: "unexpectedUnaryOp", diff --git a/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js b/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js index 5bed2539a6486b..a00d3707204ffd 100644 --- a/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js +++ b/tools/node_modules/eslint/lib/rules/no-prototype-builtins.js @@ -47,7 +47,7 @@ module.exports = { if (DISALLOWED_PROPS.indexOf(propName) > -1) { context.report({ messageId: "prototypeBuildIn", - loc: node.callee.property.loc.start, + loc: node.callee.property.loc, data: { prop: propName }, node }); diff --git a/tools/node_modules/eslint/lib/rules/operator-assignment.js b/tools/node_modules/eslint/lib/rules/operator-assignment.js index c4c8671f327a93..6820793439cb84 100644 --- a/tools/node_modules/eslint/lib/rules/operator-assignment.js +++ b/tools/node_modules/eslint/lib/rules/operator-assignment.js @@ -214,12 +214,12 @@ module.exports = { ) { rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`; } else { - const firstRightToken = sourceCode.getFirstToken(node.right); + const tokenAfterOperator = sourceCode.getTokenAfter(operatorToken, { includeComments: true }); let rightTextPrefix = ""; if ( - operatorToken.range[1] === firstRightToken.range[0] && - !astUtils.canTokensBeAdjacent({ type: "Punctuator", value: newOperator }, firstRightToken) + operatorToken.range[1] === tokenAfterOperator.range[0] && + !astUtils.canTokensBeAdjacent({ type: "Punctuator", value: newOperator }, tokenAfterOperator) ) { rightTextPrefix = " "; // foo+=+bar -> foo= foo+ +bar } diff --git a/tools/node_modules/eslint/lib/rules/operator-linebreak.js b/tools/node_modules/eslint/lib/rules/operator-linebreak.js index c2fddcffd25c7f..3395feae655f64 100644 --- a/tools/node_modules/eslint/lib/rules/operator-linebreak.js +++ b/tools/node_modules/eslint/lib/rules/operator-linebreak.js @@ -172,10 +172,7 @@ module.exports = { // lone operator context.report({ node, - loc: { - line: operatorToken.loc.end.line, - column: operatorToken.loc.end.column - }, + loc: operatorToken.loc, messageId: "badLinebreak", data: { operator @@ -187,10 +184,7 @@ module.exports = { context.report({ node, - loc: { - line: operatorToken.loc.end.line, - column: operatorToken.loc.end.column - }, + loc: operatorToken.loc, messageId: "operatorAtBeginning", data: { operator @@ -202,10 +196,7 @@ module.exports = { context.report({ node, - loc: { - line: operatorToken.loc.end.line, - column: operatorToken.loc.end.column - }, + loc: operatorToken.loc, messageId: "operatorAtEnd", data: { operator @@ -217,10 +208,7 @@ module.exports = { context.report({ node, - loc: { - line: operatorToken.loc.end.line, - column: operatorToken.loc.end.column - }, + loc: operatorToken.loc, messageId: "noLinebreak", data: { operator 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 c352d88dc07ca2..2a4fb5d954aad5 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js +++ b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js @@ -79,13 +79,13 @@ module.exports = { "CallExpression[arguments.length=2]"(node) { const [strNode, radixNode] = node.arguments, - str = strNode.value, + str = astUtils.getStaticStringValue(strNode), radix = radixNode.value; if ( - strNode.type === "Literal" && + str !== null && + astUtils.isStringLiteral(strNode) && radixNode.type === "Literal" && - typeof str === "string" && typeof radix === "number" && radixMap.has(radix) && isParseInt(node.callee) 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 1344433f52fa93..ab252c73ae3aaf 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-object-spread.js +++ b/tools/node_modules/eslint/lib/rules/prefer-object-spread.js @@ -181,8 +181,8 @@ function defineFixer(node, sourceCode) { const leftParen = sourceCode.getTokenAfter(node.callee, isOpeningParenToken); const rightParen = sourceCode.getLastToken(node); - // Remove the callee `Object.assign` - yield fixer.remove(node.callee); + // Remove everything before the opening paren: callee `Object.assign`, type arguments, and whitespace between the callee and the paren. + yield fixer.removeRange([node.range[0], leftParen.range[0]]); // Replace the parens of argument list to braces. if (needsParens(node, sourceCode)) { diff --git a/tools/node_modules/eslint/lib/rules/require-await.js b/tools/node_modules/eslint/lib/rules/require-await.js index 274e241cfc7d5b..9b5acc78c814ea 100644 --- a/tools/node_modules/eslint/lib/rules/require-await.js +++ b/tools/node_modules/eslint/lib/rules/require-await.js @@ -68,7 +68,7 @@ module.exports = { * @returns {void} */ function exitFunction(node) { - if (node.async && !scopeInfo.hasAwait && !astUtils.isEmptyFunction(node)) { + if (!node.generator && node.async && !scopeInfo.hasAwait && !astUtils.isEmptyFunction(node)) { context.report({ node, loc: astUtils.getFunctionHeadLoc(node, sourceCode), 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 a16c0732df7b50..26043bc912210a 100644 --- a/tools/node_modules/eslint/lib/rules/template-curly-spacing.js +++ b/tools/node_modules/eslint/lib/rules/template-curly-spacing.js @@ -11,13 +11,6 @@ const astUtils = require("./utils/ast-utils"); -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const OPEN_PAREN = /\$\{$/u; -const CLOSE_PAREN = /^\}/u; - //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -49,7 +42,6 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); const always = context.options[0] === "always"; - const prefix = always ? "expected" : "unexpected"; /** * Checks spacing before `}` of a given token. @@ -57,25 +49,39 @@ module.exports = { * @returns {void} */ function checkSpacingBefore(token) { - const prevToken = sourceCode.getTokenBefore(token, { includeComments: true }); + if (!token.value.startsWith("}")) { + return; // starts with a backtick, this is the first template element in the template literal + } + + const prevToken = sourceCode.getTokenBefore(token, { includeComments: true }), + hasSpace = sourceCode.isSpaceBetween(prevToken, token); + + if (!astUtils.isTokenOnSameLine(prevToken, token)) { + return; + } - if (prevToken && - CLOSE_PAREN.test(token.value) && - astUtils.isTokenOnSameLine(prevToken, token) && - sourceCode.isSpaceBetweenTokens(prevToken, token) !== always - ) { + if (always && !hasSpace) { context.report({ - loc: token.loc.start, - messageId: `${prefix}Before`, - fix(fixer) { - if (always) { - return fixer.insertTextBefore(token, " "); + loc: { + start: token.loc.start, + end: { + line: token.loc.start.line, + column: token.loc.start.column + 1 } - return fixer.removeRange([ - prevToken.range[1], - token.range[0] - ]); - } + }, + messageId: "expectedBefore", + fix: fixer => fixer.insertTextBefore(token, " ") + }); + } + + if (!always && hasSpace) { + context.report({ + loc: { + start: prevToken.loc.end, + end: token.loc.start + }, + messageId: "unexpectedBefore", + fix: fixer => fixer.removeRange([prevToken.range[1], token.range[0]]) }); } } @@ -86,28 +92,39 @@ module.exports = { * @returns {void} */ function checkSpacingAfter(token) { - const nextToken = sourceCode.getTokenAfter(token, { includeComments: true }); + if (!token.value.endsWith("${")) { + return; // ends with a backtick, this is the last template element in the template literal + } + + const nextToken = sourceCode.getTokenAfter(token, { includeComments: true }), + hasSpace = sourceCode.isSpaceBetween(token, nextToken); - if (nextToken && - OPEN_PAREN.test(token.value) && - astUtils.isTokenOnSameLine(token, nextToken) && - sourceCode.isSpaceBetweenTokens(token, nextToken) !== always - ) { + if (!astUtils.isTokenOnSameLine(token, nextToken)) { + return; + } + + if (always && !hasSpace) { context.report({ loc: { - line: token.loc.end.line, - column: token.loc.end.column - 2 + start: { + line: token.loc.end.line, + column: token.loc.end.column - 2 + }, + end: token.loc.end }, - messageId: `${prefix}After`, - fix(fixer) { - if (always) { - return fixer.insertTextAfter(token, " "); - } - return fixer.removeRange([ - token.range[1], - nextToken.range[0] - ]); - } + messageId: "expectedAfter", + fix: fixer => fixer.insertTextAfter(token, " ") + }); + } + + if (!always && hasSpace) { + context.report({ + loc: { + start: token.loc.end, + end: nextToken.loc.start + }, + messageId: "unexpectedAfter", + fix: fixer => fixer.removeRange([token.range[1], nextToken.range[0]]) }); } } 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 e10544dd61e9ca..e6a3cb4cac58be 100644 --- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -1357,17 +1357,65 @@ module.exports = { * next to each other, behavior is undefined (although it should return `true` in most cases). */ canTokensBeAdjacent(leftValue, rightValue) { + const espreeOptions = { + ecmaVersion: espree.latestEcmaVersion, + comment: true, + range: true + }; + let leftToken; if (typeof leftValue === "string") { - const leftTokens = espree.tokenize(leftValue, { ecmaVersion: 2015 }); + let tokens; + + try { + tokens = espree.tokenize(leftValue, espreeOptions); + } catch (e) { + return false; + } + + const comments = tokens.comments; - leftToken = leftTokens[leftTokens.length - 1]; + leftToken = tokens[tokens.length - 1]; + if (comments.length) { + const lastComment = comments[comments.length - 1]; + + if (lastComment.range[0] > leftToken.range[0]) { + leftToken = lastComment; + } + } } else { leftToken = leftValue; } - const rightToken = typeof rightValue === "string" ? espree.tokenize(rightValue, { ecmaVersion: 2015 })[0] : rightValue; + if (leftToken.type === "Shebang") { + return false; + } + + let rightToken; + + if (typeof rightValue === "string") { + let tokens; + + try { + tokens = espree.tokenize(rightValue, espreeOptions); + } catch (e) { + return false; + } + + const comments = tokens.comments; + + rightToken = tokens[0]; + if (comments.length) { + const firstComment = comments[0]; + + if (firstComment.range[0] < rightToken.range[0]) { + rightToken = firstComment; + } + } + } else { + rightToken = rightValue; + } if (leftToken.type === "Punctuator" || rightToken.type === "Punctuator") { if (leftToken.type === "Punctuator" && rightToken.type === "Punctuator") { @@ -1379,6 +1427,9 @@ module.exports = { MINUS_TOKENS.has(leftToken.value) && MINUS_TOKENS.has(rightToken.value) ); } + if (leftToken.type === "Punctuator" && leftToken.value === "/") { + return !["Block", "Line", "RegularExpression"].includes(rightToken.type); + } return true; } @@ -1393,6 +1444,10 @@ module.exports = { return true; } + if (leftToken.type === "Block" || rightToken.type === "Block" || rightToken.type === "Line") { + return true; + } + return false; }, @@ -1413,11 +1468,17 @@ module.exports = { const match = namePattern.exec(comment.value); // Convert the index to loc. - return sourceCode.getLocFromIndex( + const start = sourceCode.getLocFromIndex( comment.range[0] + "/*".length + (match ? match.index + 1 : 0) ); + const end = { + line: start.line, + column: start.column + (match ? name.length : 1) + }; + + return { start, end }; }, /** diff --git a/tools/node_modules/eslint/lib/shared/types.js b/tools/node_modules/eslint/lib/shared/types.js index f3d1a7f29f02f0..bf37327fa240ca 100644 --- a/tools/node_modules/eslint/lib/shared/types.js +++ b/tools/node_modules/eslint/lib/shared/types.js @@ -37,7 +37,7 @@ module.exports = {}; * @property {ParserOptions} [parserOptions] The parser options. * @property {string[]} [plugins] The plugin specifiers. * @property {string} [processor] The processor specifier. - * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. * @property {boolean} [root] The root flag. * @property {Record} [rules] The rule settings. * @property {Object} [settings] The shared settings. @@ -56,7 +56,7 @@ module.exports = {}; * @property {ParserOptions} [parserOptions] The parser options. * @property {string[]} [plugins] The plugin specifiers. * @property {string} [processor] The processor specifier. - * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments. + * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. * @property {Record} [rules] The rule settings. * @property {Object} [settings] The shared settings. */ diff --git a/tools/node_modules/eslint/messages/plugin-conflict.txt b/tools/node_modules/eslint/messages/plugin-conflict.txt new file mode 100644 index 00000000000000..6fcf7c83115d70 --- /dev/null +++ b/tools/node_modules/eslint/messages/plugin-conflict.txt @@ -0,0 +1,7 @@ +ESLint couldn't determine the plugin "<%- pluginId %>" uniquely. +<% for (const { filePath, importerName } of plugins) { %> +- <%= filePath %> (loaded in "<%= importerName %>")<% } %> + +Please remove the "plugins" setting from either config or remove either plugin installation. + +If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team. diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE new file mode 100644 index 00000000000000..f31575ec773bb1 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +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/@babel/helper-validator-identifier/README.md b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/README.md new file mode 100644 index 00000000000000..ab2dad173149e8 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/README.md @@ -0,0 +1,19 @@ +# @babel/helper-validator-identifier + +> Validate identifier/keywords name + +See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/next/babel-helper-validator-identifier.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-validator-identifier +``` + +or using yarn: + +```sh +yarn add @babel/helper-validator-identifier --dev +``` diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js new file mode 100644 index 00000000000000..92043ce6630710 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/identifier.js @@ -0,0 +1,77 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isIdentifierStart = isIdentifierStart; +exports.isIdentifierChar = isIdentifierChar; +exports.isIdentifierName = isIdentifierName; +let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"; +let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"; +const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); +const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); +nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; +const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938]; +const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239]; + +function isInAstralSet(code, set) { + let pos = 0x10000; + + for (let i = 0, length = set.length; i < length; i += 2) { + pos += set[i]; + if (pos > code) return false; + pos += set[i + 1]; + if (pos >= code) return true; + } + + return false; +} + +function isIdentifierStart(code) { + if (code < 65) return code === 36; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); + } + + return isInAstralSet(code, astralIdentifierStartCodes); +} + +function isIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code <= 90) return true; + if (code < 97) return code === 95; + if (code <= 122) return true; + + if (code <= 0xffff) { + return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); + } + + return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); +} + +function isIdentifierName(name) { + let isFirst = true; + + for (let _i = 0, _Array$from = Array.from(name); _i < _Array$from.length; _i++) { + const char = _Array$from[_i]; + const cp = char.codePointAt(0); + + if (isFirst) { + if (!isIdentifierStart(cp)) { + return false; + } + + isFirst = false; + } else if (!isIdentifierChar(cp)) { + return false; + } + } + + return true; +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js new file mode 100644 index 00000000000000..7b623c90a6e164 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/index.js @@ -0,0 +1,57 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "isIdentifierName", { + enumerable: true, + get: function () { + return _identifier.isIdentifierName; + } +}); +Object.defineProperty(exports, "isIdentifierChar", { + enumerable: true, + get: function () { + return _identifier.isIdentifierChar; + } +}); +Object.defineProperty(exports, "isIdentifierStart", { + enumerable: true, + get: function () { + return _identifier.isIdentifierStart; + } +}); +Object.defineProperty(exports, "isReservedWord", { + enumerable: true, + get: function () { + return _keyword.isReservedWord; + } +}); +Object.defineProperty(exports, "isStrictBindOnlyReservedWord", { + enumerable: true, + get: function () { + return _keyword.isStrictBindOnlyReservedWord; + } +}); +Object.defineProperty(exports, "isStrictBindReservedWord", { + enumerable: true, + get: function () { + return _keyword.isStrictBindReservedWord; + } +}); +Object.defineProperty(exports, "isStrictReservedWord", { + enumerable: true, + get: function () { + return _keyword.isStrictReservedWord; + } +}); +Object.defineProperty(exports, "isKeyword", { + enumerable: true, + get: function () { + return _keyword.isKeyword; + } +}); + +var _identifier = require("./identifier"); + +var _keyword = require("./keyword"); \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js new file mode 100644 index 00000000000000..110cee4002896b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/lib/keyword.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isReservedWord = isReservedWord; +exports.isStrictReservedWord = isStrictReservedWord; +exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord; +exports.isStrictBindReservedWord = isStrictBindReservedWord; +exports.isKeyword = isKeyword; +const reservedWords = { + keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"], + strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"], + strictBind: ["eval", "arguments"] +}; +const keywords = new Set(reservedWords.keyword); +const reservedWordsStrictSet = new Set(reservedWords.strict); +const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); + +function isReservedWord(word, inModule) { + return inModule && word === "await" || word === "enum"; +} + +function isStrictReservedWord(word, inModule) { + return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); +} + +function isStrictBindOnlyReservedWord(word) { + return reservedWordsStrictBindSet.has(word); +} + +function isStrictBindReservedWord(word, inModule) { + return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word); +} + +function isKeyword(word) { + return keywords.has(word); +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json new file mode 100644 index 00000000000000..bdc69e6c6f8926 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json @@ -0,0 +1,22 @@ +{ + "bundleDependencies": false, + "deprecated": false, + "description": "Validate identifier/keywords name", + "devDependencies": { + "charcodes": "^0.2.0", + "unicode-13.0.0": "^0.8.0" + }, + "exports": "./lib/index.js", + "gitHead": "8d5e422be27251cfaadf8dd2536b31b4a5024b02", + "license": "MIT", + "main": "./lib/index.js", + "name": "@babel/helper-validator-identifier", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/babel/babel/tree/master/packages/babel-helper-validator-identifier" + }, + "version": "7.9.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js new file mode 100644 index 00000000000000..e0f5b1656b97de --- /dev/null +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js @@ -0,0 +1,75 @@ +"use strict"; + +// Always use the latest available version of Unicode! +// https://tc39.github.io/ecma262/#sec-conformance +const version = "13.0.0"; + +const start = require("unicode-" + + version + + "/Binary_Property/ID_Start/code-points.js").filter(function(ch) { + return ch > 0x7f; +}); +let last = -1; +const cont = [0x200c, 0x200d].concat( + require("unicode-" + + version + + "/Binary_Property/ID_Continue/code-points.js").filter(function(ch) { + return ch > 0x7f && search(start, ch, last + 1) == -1; + }) +); + +function search(arr, ch, starting) { + for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) { + if (arr[i] === ch) return i; + } + return -1; +} + +function pad(str, width) { + while (str.length < width) str = "0" + str; + return str; +} + +function esc(code) { + const hex = code.toString(16); + if (hex.length <= 2) return "\\x" + pad(hex, 2); + else return "\\u" + pad(hex, 4); +} + +function generate(chars) { + const astral = []; + let re = ""; + for (let i = 0, at = 0x10000; i < chars.length; i++) { + const from = chars[i]; + let to = from; + while (i < chars.length - 1 && chars[i + 1] == to + 1) { + i++; + to++; + } + if (to <= 0xffff) { + if (from == to) re += esc(from); + else if (from + 1 == to) re += esc(from) + esc(to); + else re += esc(from) + "-" + esc(to); + } else { + astral.push(from - at, to - from); + at = to; + } + } + return { nonASCII: re, astral: astral }; +} + +const startData = generate(start); +const contData = generate(cont); + +console.log("/* prettier-ignore */"); +console.log('let nonASCIIidentifierStartChars = "' + startData.nonASCII + '";'); +console.log("/* prettier-ignore */"); +console.log('let nonASCIIidentifierChars = "' + contData.nonASCII + '";'); +console.log("/* prettier-ignore */"); +console.log( + "const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";" +); +console.log("/* prettier-ignore */"); +console.log( + "const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";" +); diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js index bf275748784b50..b0d1be7f553b64 100644 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js +++ b/tools/node_modules/eslint/node_modules/@babel/highlight/lib/index.js @@ -9,7 +9,7 @@ exports.default = highlight; var _jsTokens = _interopRequireWildcard(require("js-tokens")); -var _esutils = _interopRequireDefault(require("esutils")); +var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); var _chalk = _interopRequireDefault(require("chalk")); @@ -42,7 +42,7 @@ function getTokenType(match) { const token = (0, _jsTokens.matchToToken)(match); if (token.type === "name") { - if (_esutils.default.keyword.isReservedWordES6(token.value)) { + if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isReservedWord)(token.value)) { return "keyword"; } diff --git a/tools/node_modules/eslint/node_modules/@babel/highlight/package.json b/tools/node_modules/eslint/node_modules/@babel/highlight/package.json index a3e53bab1978ec..f4ecd5f2a42a6c 100644 --- a/tools/node_modules/eslint/node_modules/@babel/highlight/package.json +++ b/tools/node_modules/eslint/node_modules/@babel/highlight/package.json @@ -5,8 +5,8 @@ }, "bundleDependencies": false, "dependencies": { + "@babel/helper-validator-identifier": "^7.9.0", "chalk": "^2.0.0", - "esutils": "^2.0.2", "js-tokens": "^4.0.0" }, "deprecated": false, @@ -14,7 +14,7 @@ "devDependencies": { "strip-ansi": "^4.0.0" }, - "gitHead": "a7620bd266ae1345975767bbc7abf09034437017", + "gitHead": "8d5e422be27251cfaadf8dd2536b31b4a5024b02", "homepage": "https://babeljs.io/", "license": "MIT", "main": "lib/index.js", @@ -26,5 +26,5 @@ "type": "git", "url": "https://github.com/babel/babel/tree/master/packages/babel-highlight" }, - "version": "7.8.3" + "version": "7.9.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js index c9209c0f6cbdc4..e2b33179c789c7 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.js @@ -1884,9 +1884,11 @@ if (this.options.ecmaVersion >= 6) { if (name === "__proto__" && kind === "init") { if (propHash.proto) { - if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) { refDestructuringErrors.doubleProto = key.start; } - // Backwards-compat kludge. Can be removed in version 6.0 - else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } + if (refDestructuringErrors) { + if (refDestructuringErrors.doubleProto < 0) + { refDestructuringErrors.doubleProto = key.start; } + // Backwards-compat kludge. Can be removed in version 6.0 + } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } } propHash.proto = true; } @@ -1951,12 +1953,11 @@ else { this.exprAllowed = false; } } - var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldShorthandAssign = -1; + var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1; if (refDestructuringErrors) { oldParenAssign = refDestructuringErrors.parenthesizedAssign; oldTrailingComma = refDestructuringErrors.trailingComma; - oldShorthandAssign = refDestructuringErrors.shorthandAssign; - refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.shorthandAssign = -1; + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; } else { refDestructuringErrors = new DestructuringErrors; ownDestructuringErrors = true; @@ -1971,8 +1972,11 @@ var node = this.startNodeAt(startPos, startLoc); node.operator = this.value; node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left; - if (!ownDestructuringErrors) { DestructuringErrors.call(refDestructuringErrors); } - refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly + if (!ownDestructuringErrors) { + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; + } + if (refDestructuringErrors.shorthandAssign >= node.left.start) + { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly this.checkLVal(left); this.next(); node.right = this.parseMaybeAssign(noIn); @@ -1982,7 +1986,6 @@ } if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; } if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; } - if (oldShorthandAssign > -1) { refDestructuringErrors.shorthandAssign = oldShorthandAssign; } return left }; @@ -2087,8 +2090,8 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) { var startPos = this.start, startLoc = this.startLoc; var expr = this.parseExprAtom(refDestructuringErrors); - var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")"; - if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) { return expr } + if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") + { return expr } var result = this.parseSubscripts(expr, startPos, startLoc); if (refDestructuringErrors && result.type === "MemberExpression") { if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; } @@ -2386,6 +2389,7 @@ var empty$1 = []; pp$3.parseNew = function() { + if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } var node = this.startNode(); var meta = this.parseIdent(true); if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) { @@ -2786,7 +2790,7 @@ } else { this.unexpected(); } - this.next(); + this.next(!!liberal); this.finishNode(node, "Identifier"); if (!liberal) { this.checkUnreserved(node); @@ -2818,7 +2822,7 @@ var node = this.startNode(); this.next(); - node.argument = this.parseMaybeUnary(null, true); + node.argument = this.parseMaybeUnary(null, false); return this.finishNode(node, "AwaitExpression") }; @@ -3217,7 +3221,8 @@ if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { return c } - return (c << 10) + s.charCodeAt(i + 1) - 0x35FDC00 + var next = s.charCodeAt(i + 1); + return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c }; RegExpValidationState.prototype.nextIndex = function nextIndex (i) { @@ -3226,8 +3231,9 @@ if (i >= l) { return l } - var c = s.charCodeAt(i); - if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { + var c = s.charCodeAt(i), next; + if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || + (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) { return i + 1 } return i + 2 @@ -3318,7 +3324,7 @@ if (state.eat(0x29 /* ) */)) { state.raise("Unmatched ')'"); } - if (state.eat(0x5D /* [ */) || state.eat(0x7D /* } */)) { + if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) { state.raise("Lone quantifier brackets"); } } @@ -4007,7 +4013,7 @@ if (state.eat(0x5B /* [ */)) { state.eat(0x5E /* ^ */); this.regexp_classRanges(state); - if (state.eat(0x5D /* [ */)) { + if (state.eat(0x5D /* ] */)) { return true } // Unreachable since it threw "unterminated regular expression" error before. @@ -4055,7 +4061,7 @@ } var ch = state.current(); - if (ch !== 0x5D /* [ */) { + if (ch !== 0x5D /* ] */) { state.lastIntValue = ch; state.advance(); return true @@ -4234,7 +4240,9 @@ // Move to the next token - pp$9.next = function() { + pp$9.next = function(ignoreEscapeSequenceInKeyword) { + if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) + { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); } if (this.options.onToken) { this.options.onToken(new Token(this)); } @@ -4653,7 +4661,6 @@ if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); } var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48; if (octal && this.strict) { this.raise(start, "Invalid number"); } - if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; } var next = this.input.charCodeAt(this.pos); if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { var str$1 = this.input.slice(start, this.pos); @@ -4662,6 +4669,7 @@ if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types.num, val$1) } + if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; } if (next === 46 && !octal) { // '.' ++this.pos; this.readInt(10); @@ -4836,6 +4844,18 @@ case 10: // ' \n' if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; } return "" + case 56: + case 57: + if (inTemplate) { + var codePos = this.pos - 1; + + this.invalidStringToken( + codePos, + "Invalid escape sequence in template string" + ); + + return null + } default: if (ch >= 48 && ch <= 55) { var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]; @@ -4915,7 +4935,6 @@ var word = this.readWord1(); var type = types.name; if (this.keywords.test(word)) { - if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword " + word); } type = keywords$1[word]; } return this.finishToken(type, word) diff --git a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs index 7e6aa1f70f6b57..f6f707076220d2 100644 --- a/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs +++ b/tools/node_modules/eslint/node_modules/acorn/dist/acorn.mjs @@ -1878,9 +1878,11 @@ pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) { if (this.options.ecmaVersion >= 6) { if (name === "__proto__" && kind === "init") { if (propHash.proto) { - if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) { refDestructuringErrors.doubleProto = key.start; } - // Backwards-compat kludge. Can be removed in version 6.0 - else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } + if (refDestructuringErrors) { + if (refDestructuringErrors.doubleProto < 0) + { refDestructuringErrors.doubleProto = key.start; } + // Backwards-compat kludge. Can be removed in version 6.0 + } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } } propHash.proto = true; } @@ -1945,12 +1947,11 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) { else { this.exprAllowed = false; } } - var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldShorthandAssign = -1; + var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1; if (refDestructuringErrors) { oldParenAssign = refDestructuringErrors.parenthesizedAssign; oldTrailingComma = refDestructuringErrors.trailingComma; - oldShorthandAssign = refDestructuringErrors.shorthandAssign; - refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.shorthandAssign = -1; + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; } else { refDestructuringErrors = new DestructuringErrors; ownDestructuringErrors = true; @@ -1965,8 +1966,11 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) { var node = this.startNodeAt(startPos, startLoc); node.operator = this.value; node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left; - if (!ownDestructuringErrors) { DestructuringErrors.call(refDestructuringErrors); } - refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly + if (!ownDestructuringErrors) { + refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; + } + if (refDestructuringErrors.shorthandAssign >= node.left.start) + { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly this.checkLVal(left); this.next(); node.right = this.parseMaybeAssign(noIn); @@ -1976,7 +1980,6 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) { } if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; } if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; } - if (oldShorthandAssign > -1) { refDestructuringErrors.shorthandAssign = oldShorthandAssign; } return left }; @@ -2081,8 +2084,8 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) { pp$3.parseExprSubscripts = function(refDestructuringErrors) { var startPos = this.start, startLoc = this.startLoc; var expr = this.parseExprAtom(refDestructuringErrors); - var skipArrowSubscripts = expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")"; - if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) { return expr } + if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") + { return expr } var result = this.parseSubscripts(expr, startPos, startLoc); if (refDestructuringErrors && result.type === "MemberExpression") { if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; } @@ -2380,6 +2383,7 @@ pp$3.parseParenArrowList = function(startPos, startLoc, exprList) { var empty$1 = []; pp$3.parseNew = function() { + if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } var node = this.startNode(); var meta = this.parseIdent(true); if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) { @@ -2780,7 +2784,7 @@ pp$3.parseIdent = function(liberal, isBinding) { } else { this.unexpected(); } - this.next(); + this.next(!!liberal); this.finishNode(node, "Identifier"); if (!liberal) { this.checkUnreserved(node); @@ -2812,7 +2816,7 @@ pp$3.parseAwait = function() { var node = this.startNode(); this.next(); - node.argument = this.parseMaybeUnary(null, true); + node.argument = this.parseMaybeUnary(null, false); return this.finishNode(node, "AwaitExpression") }; @@ -3211,7 +3215,8 @@ RegExpValidationState.prototype.at = function at (i) { if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { return c } - return (c << 10) + s.charCodeAt(i + 1) - 0x35FDC00 + var next = s.charCodeAt(i + 1); + return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c }; RegExpValidationState.prototype.nextIndex = function nextIndex (i) { @@ -3220,8 +3225,9 @@ RegExpValidationState.prototype.nextIndex = function nextIndex (i) { if (i >= l) { return l } - var c = s.charCodeAt(i); - if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) { + var c = s.charCodeAt(i), next; + if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || + (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) { return i + 1 } return i + 2 @@ -3312,7 +3318,7 @@ pp$8.regexp_pattern = function(state) { if (state.eat(0x29 /* ) */)) { state.raise("Unmatched ')'"); } - if (state.eat(0x5D /* [ */) || state.eat(0x7D /* } */)) { + if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) { state.raise("Lone quantifier brackets"); } } @@ -4001,7 +4007,7 @@ pp$8.regexp_eatCharacterClass = function(state) { if (state.eat(0x5B /* [ */)) { state.eat(0x5E /* ^ */); this.regexp_classRanges(state); - if (state.eat(0x5D /* [ */)) { + if (state.eat(0x5D /* ] */)) { return true } // Unreachable since it threw "unterminated regular expression" error before. @@ -4049,7 +4055,7 @@ pp$8.regexp_eatClassAtom = function(state) { } var ch = state.current(); - if (ch !== 0x5D /* [ */) { + if (ch !== 0x5D /* ] */) { state.lastIntValue = ch; state.advance(); return true @@ -4228,7 +4234,9 @@ var pp$9 = Parser.prototype; // Move to the next token -pp$9.next = function() { +pp$9.next = function(ignoreEscapeSequenceInKeyword) { + if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) + { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); } if (this.options.onToken) { this.options.onToken(new Token(this)); } @@ -4647,7 +4655,6 @@ pp$9.readNumber = function(startsWithDot) { if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); } var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48; if (octal && this.strict) { this.raise(start, "Invalid number"); } - if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; } var next = this.input.charCodeAt(this.pos); if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) { var str$1 = this.input.slice(start, this.pos); @@ -4656,6 +4663,7 @@ pp$9.readNumber = function(startsWithDot) { if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number"); } return this.finishToken(types.num, val$1) } + if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; } if (next === 46 && !octal) { // '.' ++this.pos; this.readInt(10); @@ -4830,6 +4838,18 @@ pp$9.readEscapedChar = function(inTemplate) { case 10: // ' \n' if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; } return "" + case 56: + case 57: + if (inTemplate) { + var codePos = this.pos - 1; + + this.invalidStringToken( + codePos, + "Invalid escape sequence in template string" + ); + + return null + } default: if (ch >= 48 && ch <= 55) { var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0]; @@ -4909,7 +4929,6 @@ pp$9.readWord = function() { var word = this.readWord1(); var type = types.name; if (this.keywords.test(word)) { - if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword " + word); } type = keywords$1[word]; } return this.finishToken(type, word) diff --git a/tools/node_modules/eslint/node_modules/acorn/package.json b/tools/node_modules/eslint/node_modules/acorn/package.json index b61cffa9961ef9..39139962fa8331 100644 --- a/tools/node_modules/eslint/node_modules/acorn/package.json +++ b/tools/node_modules/eslint/node_modules/acorn/package.json @@ -39,5 +39,6 @@ "scripts": { "prepare": "cd ..; npm run build:main && npm run build:bin" }, - "version": "7.1.0" + "types": "dist/acorn.d.ts", + "version": "7.1.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/ansi-escapes/license b/tools/node_modules/eslint/node_modules/ansi-escapes/license index e7af2f77107d73..fa7ceba3eb4a96 100644 --- a/tools/node_modules/eslint/node_modules/ansi-escapes/license +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://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: diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/license b/tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/license similarity index 100% rename from tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/license rename to tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/license diff --git a/tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/package.json b/tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/package.json new file mode 100644 index 00000000000000..998747f17a2882 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/package.json @@ -0,0 +1,63 @@ +{ + "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.7.0", + "@typescript-eslint/eslint-plugin": "2.17.0", + "@typescript-eslint/parser": "2.17.0", + "eslint-config-xo-typescript": "^0.24.1", + "tsd": "^0.7.3", + "typescript": "3.7.5", + "xo": "^0.25.3" + }, + "engines": { + "node": ">=8" + }, + "files": [ + "index.d.ts", + "source" + ], + "funding": "https://github.com/sponsors/sindresorhus", + "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" + }, + "types": "index.d.ts", + "version": "0.11.0", + "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/ansi-escapes/node_modules/type-fest/readme.md b/tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/readme.md new file mode 100644 index 00000000000000..6eed5e359eb233 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/node_modules/type-fest/readme.md @@ -0,0 +1,637 @@ +
+
+
+ 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 {Except} from 'type-fest'; + +type Foo = { + unicorn: string; + rainbow: boolean; +}; + +type FooWithoutRainbow = Except; +//=> {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 + +- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). +- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` keys into a mutable object. The 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 keys. +- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys. +- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more. +- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep. +- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep. +- [`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). +- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`. +- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/). +- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional. +- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required. +- [`PromiseValue`](source/promise-value.d.ts) - Returns the type that is wrapped inside a `Promise`. +- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`. +- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type. +- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type. +- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type. + +### Miscellaneous + +- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). +- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7). + +## 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. +- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary` vs `Record`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now. + +## 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. +
+ + Example + + + [Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA) + + ```ts + interface NodeConfig { + appName: string; + port: number; + } + + class NodeAppBuilder { + private configuration: NodeConfig = { + appName: 'NodeApp', + port: 3000 + }; + + private updateConfig(key: Key, value: NodeConfig[Key]) { + this.configuration[key] = value; + } + + config(config: Partial) { + type NodeConfigKey = keyof NodeConfig; + + for (const key of Object.keys(config) as NodeConfigKey[]) { + const updateValue = config[key]; + + if (updateValue === undefined) { + continue; + } + + this.updateConfig(key, updateValue); + } + + return this; + } + } + + // `Partial`` allows us to provide only a part of the + // NodeConfig interface. + new NodeAppBuilder().config({appName: 'ToDoApp'}); + ``` +
+ +- [`Required`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA) + + ```ts + interface ContactForm { + email?: string; + message?: string; + } + + function submitContactForm(formData: Required) { + // Send the form data to the server. + } + + submitContactForm({ + email: 'ex@mple.com', + message: 'Hi! Could you tell me more about…', + }); + + // TypeScript error: missing property 'message' + submitContactForm({ + email: 'ex@mple.com', + }); + ``` +
+ +- [`Readonly`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA) + + ```ts + enum LogLevel { + Off, + Debug, + Error, + Fatal + }; + + interface LoggerConfig { + name: string; + level: LogLevel; + } + + class Logger { + config: Readonly; + + constructor({name, level}: LoggerConfig) { + this.config = {name, level}; + Object.freeze(this.config); + } + } + + const config: LoggerConfig = { + name: 'MyApp', + level: LogLevel.Debug + }; + + const logger = new Logger(config); + + // TypeScript Error: cannot assign to read-only property. + logger.config.level = LogLevel.Error; + + // We are able to edit config variable as we please. + config.level = LogLevel.Error; + ``` +
+ +- [`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`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA) + + ```ts + interface Article { + title: string; + thumbnail: string; + content: string; + } + + // Creates new type out of the `Article` interface composed + // from the Articles' two properties: `title` and `thumbnail`. + // `ArticlePreview = {title: string; thumbnail: string}` + type ArticlePreview = Pick; + + // Render a list of articles using only title and description. + function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement { + const articles = document.createElement('div'); + + for (const preview of previews) { + // Append preview to the articles. + } + + return articles; + } + + const articles = renderArticlePreviews([ + { + title: 'TypeScript tutorial!', + thumbnail: '/assets/ts.jpg' + } + ]); + ``` +
+ +- [`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`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA) + + ```ts + // Positions of employees in our company. + type MemberPosition = 'intern' | 'developer' | 'tech-lead'; + + // Interface describing properties of a single employee. + interface Employee { + firstName: string; + lastName: string; + yearsOfExperience: number; + } + + // Create an object that has all possible `MemberPosition` values set as keys. + // Those keys will store a collection of Employees of the same position. + const team: Record = { + intern: [], + developer: [], + 'tech-lead': [], + }; + + // Our team has decided to help John with his dream of becoming Software Developer. + team.intern.push({ + firstName: 'John', + lastName: 'Doe', + yearsOfExperience: 0 + }); + + // `Record` forces you to initialize all of the property keys. + // TypeScript Error: "tech-lead" property is missing + const teamEmpty: Record = { + intern: null, + developer: null, + }; + ``` +
+ +- [`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`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA) + + ```ts + interface ServerConfig { + port: null | string | number; + } + + type RequestHandler = (request: Request, response: Response) => void; + + // Exclude `null` type from `null | string | number`. + // In case the port is equal to `null`, we will use default value. + function getPortValue(port: Exclude): number { + if (typeof port === 'string') { + return parseInt(port, 10); + } + + return port; + } + + function startServer(handler: RequestHandler, config: ServerConfig): void { + const server = require('http').createServer(handler); + + const port = config.port === null ? 3000 : getPortValue(config.port); + server.listen(port); + } + ``` +
+ +- [`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`. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA) + + ```ts + declare function uniqueId(): number; + + const ID = Symbol('ID'); + + interface Person { + [ID]: number; + name: string; + age: number; + } + + // Allows changing the person data as long as the property key is of string type. + function changePersonData< + Obj extends Person, + Key extends Extract, + Value extends Obj[Key] + > (obj: Obj, key: Key, value: Value): void { + obj[key] = value; + } + + // Tiny Andrew was born. + const andrew = { + [ID]: uniqueId(), + name: 'Andrew', + age: 0, + }; + + // Cool, we're fine with that. + changePersonData(andrew, 'name', 'Pony'); + + // Goverment didn't like the fact that you wanted to change your identity. + changePersonData(andrew, ID, uniqueId()); + ``` +
+ +- [`NonNullable`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`. +
+ + Example + + Works with strictNullChecks set to true. (Read more here) + + [Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA) + + ```ts + type PortNumber = string | number | null; + + /** Part of a class definition that is used to build a server */ + class ServerBuilder { + portNumber!: NonNullable; + + port(this: ServerBuilder, port: PortNumber): ServerBuilder { + if (port == null) { + this.portNumber = 8000; + } else { + this.portNumber = port; + } + + return this; + } + } + + const serverBuilder = new ServerBuilder(); + + serverBuilder + .port('8000') // portNumber = '8000' + .port(null) // portNumber = 8000 + .port(3000); // portNumber = 3000 + + // TypeScript error + serverBuilder.portNumber = null; + ``` +
+ +- [`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. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA) + + ```ts + function shuffle(input: any[]): void { + // Mutate array randomly changing its' elements indexes. + } + + function callNTimes any> (func: Fn, callCount: number) { + // Type that represents the type of the received function parameters. + type FunctionParameters = Parameters; + + return function (...args: FunctionParameters) { + for (let i = 0; i < callCount; i++) { + func(...args); + } + } + } + + const shuffleTwice = callNTimes(shuffle, 2); + ``` +
+ +- [`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. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA) + + ```ts + class ArticleModel { + title: string; + content?: string; + + constructor(title: string) { + this.title = title; + } + } + + class InstanceCache any)> { + private ClassConstructor: T; + private cache: Map> = new Map(); + + constructor (ctr: T) { + this.ClassConstructor = ctr; + } + + getInstance (...args: ConstructorParameters): InstanceType { + const hash = this.calculateArgumentsHash(...args); + + const existingInstance = this.cache.get(hash); + if (existingInstance !== undefined) { + return existingInstance; + } + + return new this.ClassConstructor(...args); + } + + private calculateArgumentsHash(...args: any[]): string { + // Calculate hash. + return 'hash'; + } + } + + const articleCache = new InstanceCache(ArticleModel); + const amazonArticle = articleCache.getInstance('Amazon forests burining!'); + ``` +
+ +- [`ReturnType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) + + ```ts + /** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */ + function mapIter< + Elem, + Func extends (elem: Elem) => any, + Ret extends ReturnType + >(iter: Iterable, callback: Func): Ret[] { + const mapped: Ret[] = []; + + for (const elem of iter) { + mapped.push(callback(elem)); + } + + return mapped; + } + + const setObject: Set = new Set(); + const mapObject: Map = new Map(); + + mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[] + + mapIter(mapObject, ([key, value]: [number, string]) => { + return key % 2 === 0 ? value : 'Odd'; + }); // string[] + ``` +
+ +- [`InstanceType`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA) + + ```ts + class IdleService { + doNothing (): void {} + } + + class News { + title: string; + content: string; + + constructor(title: string, content: string) { + this.title = title; + this.content = content; + } + } + + const instanceCounter: Map = new Map(); + + interface Constructor { + new(...args: any[]): any; + } + + // Keep track how many instances of `Constr` constructor have been created. + function getInstance< + Constr extends Constructor, + Args extends ConstructorParameters + >(constructor: Constr, ...args: Args): InstanceType { + let count = instanceCounter.get(constructor) || 0; + + const instance = new constructor(...args); + + instanceCounter.set(constructor, count + 1); + + console.log(`Created ${count + 1} instances of ${Constr.name} class`); + + return instance; + } + + + const idleService = getInstance(IdleService); + // Will log: `Created 1 instances of IdleService class` + const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...'); + // Will log: `Created 1 instances of News class` + ``` +
+ +- [`Omit`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K. +
+ + Example + + + [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA) + + ```ts + interface Animal { + imageUrl: string; + species: string; + images: string[]; + paragraphs: string[]; + } + + // Creates new type with all properties of the `Animal` interface + // except 'images' and 'paragraphs' properties. We can use this + // type to render small hover tooltip for a wiki entry list. + type AnimalShortInfo = Omit; + + function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement { + const container = document.createElement('div'); + // Internal implementation. + return container; + } + ``` +
+ +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) + +--- + +
+ + 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-escapes/package.json b/tools/node_modules/eslint/node_modules/ansi-escapes/package.json index 3d97c617866121..7af795b0400c03 100644 --- a/tools/node_modules/eslint/node_modules/ansi-escapes/package.json +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/package.json @@ -2,19 +2,19 @@ "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/ansi-escapes/issues" }, "bundleDependencies": false, "dependencies": { - "type-fest": "^0.8.1" + "type-fest": "^0.11.0" }, "deprecated": false, "description": "ANSI escape codes for manipulating the terminal", "devDependencies": { - "@types/node": "^12.0.7", + "@types/node": "^13.7.7", "ava": "^2.1.0", "tsd": "^0.11.0", "xo": "^0.25.3" @@ -26,6 +26,7 @@ "index.js", "index.d.ts" ], + "funding": "https://github.com/sponsors/sindresorhus", "homepage": "https://github.com/sindresorhus/ansi-escapes#readme", "keywords": [ "ansi", @@ -61,5 +62,5 @@ "scripts": { "test": "xo && ava && tsd" }, - "version": "4.3.0" + "version": "4.3.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 818a9263f4e680..4bed0f825070e4 100644 --- a/tools/node_modules/eslint/node_modules/ansi-escapes/readme.md +++ b/tools/node_modules/eslint/node_modules/ansi-escapes/readme.md @@ -232,7 +232,6 @@ Annotations created this way can be shown using the "Show Annotations" iTerm com - [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal - ---
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 03583806246467..0b917591b0220b 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/README.md +++ b/tools/node_modules/eslint/node_modules/eslint-utils/README.md @@ -13,7 +13,6 @@ This package provides utility functions and classes for make ESLint custom rules For examples: - [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 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 f5d3f3e6097d2f..b61c8741abdf7a 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/index.js +++ b/tools/node_modules/eslint/node_modules/eslint-utils/index.js @@ -1352,13 +1352,13 @@ class ReferenceTracker { * @param {Scope} globalScope The global scope. * @param {object} [options] The options. * @param {"legacy"|"strict"} [options.mode="strict"] The mode to determine the ImportDeclaration's behavior for CJS modules. - * @param {string[]} [options.globalObjectNames=["global","self","window"]] The variable names for Global Object. + * @param {string[]} [options.globalObjectNames=["global","globalThis","self","window"]] The variable names for Global Object. */ constructor( globalScope, { mode = "strict", - globalObjectNames = ["global", "self", "window"], + globalObjectNames = ["global", "globalThis", "self", "window"], } = {} ) { this.variableStack = []; 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 4b2a20edf5f077..c6fab531e1fe6f 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/index.mjs +++ b/tools/node_modules/eslint/node_modules/eslint-utils/index.mjs @@ -1346,13 +1346,13 @@ class ReferenceTracker { * @param {Scope} globalScope The global scope. * @param {object} [options] The options. * @param {"legacy"|"strict"} [options.mode="strict"] The mode to determine the ImportDeclaration's behavior for CJS modules. - * @param {string[]} [options.globalObjectNames=["global","self","window"]] The variable names for Global Object. + * @param {string[]} [options.globalObjectNames=["global","globalThis","self","window"]] The variable names for Global Object. */ constructor( globalScope, { mode = "strict", - globalObjectNames = ["global", "self", "window"], + globalObjectNames = ["global", "globalThis", "self", "window"], } = {} ) { this.variableStack = []; 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 5b9b668f293690..81da6fd3701e75 100644 --- a/tools/node_modules/eslint/node_modules/eslint-utils/package.json +++ b/tools/node_modules/eslint/node_modules/eslint-utils/package.json @@ -63,5 +63,5 @@ "watch": "warun \"{src,test}/**/*.js\" -- npm run -s test:mocha" }, "sideEffects": false, - "version": "1.4.3" + "version": "2.0.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/espree/espree.js b/tools/node_modules/eslint/node_modules/espree/espree.js index ce277c1867b44c..d8069528b16946 100644 --- a/tools/node_modules/eslint/node_modules/espree/espree.js +++ b/tools/node_modules/eslint/node_modules/espree/espree.js @@ -62,6 +62,7 @@ const acorn = require("acorn"); const jsx = require("acorn-jsx"); const astNodeTypes = require("./lib/ast-node-types"); const espree = require("./lib/espree"); +const { getLatestEcmaVersion, getSupportedEcmaVersions } = require("./lib/options"); // To initialize lazily. const parsers = { @@ -170,3 +171,7 @@ exports.Syntax = (function() { exports.VisitorKeys = (function() { return require("eslint-visitor-keys").KEYS; }()); + +exports.latestEcmaVersion = getLatestEcmaVersion(); + +exports.supportedEcmaVersions = getSupportedEcmaVersions(); 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 9fd035ebe8f968..50ca6e42f250f6 100644 --- a/tools/node_modules/eslint/node_modules/espree/lib/espree.js +++ b/tools/node_modules/eslint/node_modules/espree/lib/espree.js @@ -2,77 +2,11 @@ /* eslint-disable no-param-reassign*/ const TokenTranslator = require("./token-translator"); +const { normalizeOptions } = require("./options"); -const DEFAULT_ECMA_VERSION = 5; const STATE = Symbol("espree's internal state"); const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); -/** - * Normalize ECMAScript version from the initial config - * @param {number} ecmaVersion ECMAScript version from the initial config - * @throws {Error} throws an error if the ecmaVersion is invalid. - * @returns {number} normalized ECMAScript version - */ -function normalizeEcmaVersion(ecmaVersion = DEFAULT_ECMA_VERSION) { - if (typeof ecmaVersion !== "number") { - throw new Error(`ecmaVersion must be a number. Received value of type ${typeof ecmaVersion} instead.`); - } - - let version = ecmaVersion; - - // Calculate ECMAScript edition number from official year version starting with - // ES2015, which corresponds with ES6 (or a difference of 2009). - if (version >= 2015) { - version -= 2009; - } - - switch (version) { - case 3: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - return version; - - // no default - } - - throw new Error("Invalid ecmaVersion."); -} - -/** - * Normalize sourceType from the initial config - * @param {string} sourceType to normalize - * @throws {Error} throw an error if sourceType is invalid - * @returns {string} normalized sourceType - */ -function normalizeSourceType(sourceType = "script") { - if (sourceType === "script" || sourceType === "module") { - return sourceType; - } - throw new Error("Invalid sourceType."); -} - -/** - * Normalize parserOptions - * @param {Object} options the parser options to normalize - * @throws {Error} throw an error if found invalid option. - * @returns {Object} normalized options - */ -function normalizeOptions(options) { - const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); - const sourceType = normalizeSourceType(options.sourceType); - const ranges = options.range === true; - const locations = options.loc === true; - - if (sourceType === "module" && ecmaVersion < 6) { - throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); - } - return Object.assign({}, options, { ecmaVersion, sourceType, ranges, locations }); -} /** * Converts an Acorn comment to a Esprima comment. diff --git a/tools/node_modules/eslint/node_modules/espree/lib/options.js b/tools/node_modules/eslint/node_modules/espree/lib/options.js new file mode 100644 index 00000000000000..ccebbea477855b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/espree/lib/options.js @@ -0,0 +1,105 @@ +/** + * @fileoverview A collection of methods for processing Espree's options. + * @author Kai Cataldo + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const DEFAULT_ECMA_VERSION = 5; +const SUPPORTED_VERSIONS = [ + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11 +]; + +/** + * Normalize ECMAScript version from the initial config + * @param {number} ecmaVersion ECMAScript version from the initial config + * @throws {Error} throws an error if the ecmaVersion is invalid. + * @returns {number} normalized ECMAScript version + */ +function normalizeEcmaVersion(ecmaVersion = DEFAULT_ECMA_VERSION) { + if (typeof ecmaVersion !== "number") { + throw new Error(`ecmaVersion must be a number. Received value of type ${typeof ecmaVersion} instead.`); + } + + let version = ecmaVersion; + + // Calculate ECMAScript edition number from official year version starting with + // ES2015, which corresponds with ES6 (or a difference of 2009). + if (version >= 2015) { + version -= 2009; + } + + if (!SUPPORTED_VERSIONS.includes(version)) { + throw new Error("Invalid ecmaVersion."); + } + + return version; +} + +/** + * Normalize sourceType from the initial config + * @param {string} sourceType to normalize + * @throws {Error} throw an error if sourceType is invalid + * @returns {string} normalized sourceType + */ +function normalizeSourceType(sourceType = "script") { + if (sourceType === "script" || sourceType === "module") { + return sourceType; + } + throw new Error("Invalid sourceType."); +} + +/** + * Normalize parserOptions + * @param {Object} options the parser options to normalize + * @throws {Error} throw an error if found invalid option. + * @returns {Object} normalized options + */ +function normalizeOptions(options) { + const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); + const sourceType = normalizeSourceType(options.sourceType); + const ranges = options.range === true; + const locations = options.loc === true; + + if (sourceType === "module" && ecmaVersion < 6) { + throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); + } + return Object.assign({}, options, { ecmaVersion, sourceType, ranges, locations }); +} + +/** + * Get the latest ECMAScript version supported by Espree. + * @returns {number} The latest ECMAScript version. + */ +function getLatestEcmaVersion() { + return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; +} + +/** + * Get the list of ECMAScript versions supported by Espree. + * @returns {number[]} An array containing the supported ECMAScript versions. + */ +function getSupportedEcmaVersions() { + return [...SUPPORTED_VERSIONS]; +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + normalizeOptions, + getLatestEcmaVersion, + getSupportedEcmaVersions +}; diff --git a/tools/node_modules/eslint/node_modules/espree/package.json b/tools/node_modules/eslint/node_modules/espree/package.json index 17d49f6e22af56..d22f11891bdd84 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.1.0", - "acorn-jsx": "^5.1.0", + "acorn": "^7.1.1", + "acorn-jsx": "^5.2.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.2" + "version": "6.2.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/esquery/README.md b/tools/node_modules/eslint/node_modules/esquery/README.md index 3e51cdb04ece13..8264efcb90db96 100644 --- a/tools/node_modules/eslint/node_modules/esquery/README.md +++ b/tools/node_modules/eslint/node_modules/esquery/README.md @@ -7,7 +7,7 @@ The following selectors are supported: * [wildcard](http://dev.w3.org/csswg/selectors4/#universal-selector): `*` * [attribute existence](http://dev.w3.org/csswg/selectors4/#attribute-selectors): `[attr]` * [attribute value](http://dev.w3.org/csswg/selectors4/#attribute-selectors): `[attr="foo"]` or `[attr=123]` -* attribute regex: `[attr=/foo.*/]` +* attribute regex: `[attr=/foo.*/]` or (with flags) `[attr=/foo.*/is]` * attribute conditions: `[attr!="foo"]`, `[attr>2]`, `[attr<3]`, `[attr>=2]`, or `[attr<=3]` * nested attribute: `[attr.level2="foo"]` * field: `FunctionDeclaration > Identifier.id` diff --git a/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js new file mode 100644 index 00000000000000..bfb6bbee93e54c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.js @@ -0,0 +1,3682 @@ +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var estraverse = createCommonjsModule(function (module, exports) { +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; + + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + + // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + function upperBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; + + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() { } + + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } + + // root node + if (!this.__current.path) { + return null; + } + + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; + + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + + result = undefined; + + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + + return result; + }; + + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; + + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; + + function removeElem(element) { + var i, + key, + nextElem, + parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + target = this.__execute(visitor.leave, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + + target = this.__execute(visitor.enter, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + // node may be null + node = element.node; + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } + + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + return tree; + } + + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ +}); + +var parser = createCommonjsModule(function (module) { +/* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ +(function(root, factory) { + if ( module.exports) { + module.exports = factory(); + } +})(commonjsGlobal, function() { + + function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + "class": function(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array + ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) + : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + + any: function(expectation) { + return "any character"; + }, + + end: function(expectation) { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + + function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, + + peg$c0 = function(ss) { + return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss }; + }, + peg$c1 = function() { return void 0; }, + peg$c2 = " ", + peg$c3 = peg$literalExpectation(" ", false), + peg$c4 = /^[^ [\],():#!=><~+.]/, + peg$c5 = peg$classExpectation([" ", "[", "]", ",", "(", ")", ":", "#", "!", "=", ">", "<", "~", "+", "."], true, false), + peg$c6 = function(i) { return i.join(''); }, + peg$c7 = ">", + peg$c8 = peg$literalExpectation(">", false), + peg$c9 = function() { return 'child'; }, + peg$c10 = "~", + peg$c11 = peg$literalExpectation("~", false), + peg$c12 = function() { return 'sibling'; }, + peg$c13 = "+", + peg$c14 = peg$literalExpectation("+", false), + peg$c15 = function() { return 'adjacent'; }, + peg$c16 = function() { return 'descendant'; }, + peg$c17 = ",", + peg$c18 = peg$literalExpectation(",", false), + peg$c19 = function(s, ss) { + return [s].concat(ss.map(function (s) { return s[3]; })); + }, + peg$c20 = function(a, ops) { + return ops.reduce(function (memo, rhs) { + return { type: rhs[0], left: memo, right: rhs[1] }; + }, a); + }, + peg$c21 = "!", + peg$c22 = peg$literalExpectation("!", false), + peg$c23 = function(subject, as) { + const b = as.length === 1 ? as[0] : { type: 'compound', selectors: as }; + if(subject) b.subject = true; + return b; + }, + peg$c24 = "*", + peg$c25 = peg$literalExpectation("*", false), + peg$c26 = function(a) { return { type: 'wildcard', value: a }; }, + peg$c27 = "#", + peg$c28 = peg$literalExpectation("#", false), + peg$c29 = function(i) { return { type: 'identifier', value: i }; }, + peg$c30 = "[", + peg$c31 = peg$literalExpectation("[", false), + peg$c32 = "]", + peg$c33 = peg$literalExpectation("]", false), + peg$c34 = function(v) { return v; }, + peg$c35 = /^[>", "<", "!"], false, false), + peg$c37 = "=", + peg$c38 = peg$literalExpectation("=", false), + peg$c39 = function(a) { return (a || '') + '='; }, + peg$c40 = /^[><]/, + peg$c41 = peg$classExpectation([">", "<"], false, false), + peg$c42 = ".", + peg$c43 = peg$literalExpectation(".", false), + peg$c44 = function(name, op, value) { + return { type: 'attribute', name: name, operator: op, value: value }; + }, + peg$c45 = function(name) { return { type: 'attribute', name: name }; }, + peg$c46 = "\"", + peg$c47 = peg$literalExpectation("\"", false), + peg$c48 = /^[^\\"]/, + peg$c49 = peg$classExpectation(["\\", "\""], true, false), + peg$c50 = "\\", + peg$c51 = peg$literalExpectation("\\", false), + peg$c52 = peg$anyExpectation(), + peg$c53 = function(a, b) { return a + b; }, + peg$c54 = function(d) { + return { type: 'literal', value: strUnescape(d.join('')) }; + }, + peg$c55 = "'", + peg$c56 = peg$literalExpectation("'", false), + peg$c57 = /^[^\\']/, + peg$c58 = peg$classExpectation(["\\", "'"], true, false), + peg$c59 = /^[0-9]/, + peg$c60 = peg$classExpectation([["0", "9"]], false, false), + peg$c61 = function(a, b) { + // Can use `a.flat().join('')` once supported + const leadingDecimals = a ? [].concat.apply([], a).join('') : ''; + return { type: 'literal', value: parseFloat(leadingDecimals + b.join('')) }; + }, + peg$c62 = function(i) { return { type: 'literal', value: i }; }, + peg$c63 = "type(", + peg$c64 = peg$literalExpectation("type(", false), + peg$c65 = /^[^ )]/, + peg$c66 = peg$classExpectation([" ", ")"], true, false), + peg$c67 = ")", + peg$c68 = peg$literalExpectation(")", false), + peg$c69 = function(t) { return { type: 'type', value: t.join('') }; }, + peg$c70 = /^[imsu]/, + peg$c71 = peg$classExpectation(["i", "m", "s", "u"], false, false), + peg$c72 = "/", + peg$c73 = peg$literalExpectation("/", false), + peg$c74 = /^[^\/]/, + peg$c75 = peg$classExpectation(["/"], true, false), + peg$c76 = function(d, flgs) { return { + type: 'regexp', value: new RegExp(d.join(''), flgs ? flgs.join('') : '') }; + }, + peg$c77 = function(i, is) { + return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)}; + }, + peg$c78 = ":not(", + peg$c79 = peg$literalExpectation(":not(", false), + peg$c80 = function(ss) { return { type: 'not', selectors: ss }; }, + peg$c81 = ":matches(", + peg$c82 = peg$literalExpectation(":matches(", false), + peg$c83 = function(ss) { return { type: 'matches', selectors: ss }; }, + peg$c84 = ":has(", + peg$c85 = peg$literalExpectation(":has(", false), + peg$c86 = function(ss) { return { type: 'has', selectors: ss }; }, + peg$c87 = ":first-child", + peg$c88 = peg$literalExpectation(":first-child", false), + peg$c89 = function() { return nth(1); }, + peg$c90 = ":last-child", + peg$c91 = peg$literalExpectation(":last-child", false), + peg$c92 = function() { return nthLast(1); }, + peg$c93 = ":nth-child(", + peg$c94 = peg$literalExpectation(":nth-child(", false), + peg$c95 = function(n) { return nth(parseInt(n.join(''), 10)); }, + peg$c96 = ":nth-last-child(", + peg$c97 = peg$literalExpectation(":nth-last-child(", false), + peg$c98 = function(n) { return nthLast(parseInt(n.join(''), 10)); }, + peg$c99 = ":", + peg$c100 = peg$literalExpectation(":", false), + peg$c101 = "statement", + peg$c102 = peg$literalExpectation("statement", true), + peg$c103 = "expression", + peg$c104 = peg$literalExpectation("expression", true), + peg$c105 = "declaration", + peg$c106 = peg$literalExpectation("declaration", true), + peg$c107 = "function", + peg$c108 = peg$literalExpectation("function", true), + peg$c109 = "pattern", + peg$c110 = peg$literalExpectation("pattern", true), + peg$c111 = function(c) { + return { type: 'class', name: c }; + }, + + peg$currPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1 }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$resultsCache = {}, + + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], p; + + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 0, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseselectors(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c0(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s1 = peg$c1(); + } + s0 = s1; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parse_() { + var s0, s1; + + var key = peg$currPos * 30 + 1, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c3); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c3); } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifierName() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 2, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c5); } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s1 = peg$c6(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebinaryOp() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 3, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c7; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c8); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c9(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s2 = peg$c10; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c11); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c12(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c14); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c15(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c3); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s1 = peg$c16(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselectors() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 30 + 4, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseselector(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + s1 = peg$c19(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 5, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsesequence(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + s1 = peg$c20(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesequence() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 6, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseatom(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseatom(); + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseatom() { + var s0; + + var key = peg$currPos * 30 + 7, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parsewildcard(); + if (s0 === peg$FAILED) { + s0 = peg$parseidentifier(); + if (s0 === peg$FAILED) { + s0 = peg$parseattr(); + if (s0 === peg$FAILED) { + s0 = peg$parsefield(); + if (s0 === peg$FAILED) { + s0 = peg$parsenegation(); + if (s0 === peg$FAILED) { + s0 = peg$parsematches(); + if (s0 === peg$FAILED) { + s0 = peg$parsehas(); + if (s0 === peg$FAILED) { + s0 = peg$parsefirstChild(); + if (s0 === peg$FAILED) { + s0 = peg$parselastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthLastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parseclass(); + } + } + } + } + } + } + } + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsewildcard() { + var s0, s1; + + var key = peg$currPos * 30 + 8, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c25); } + } + if (s1 !== peg$FAILED) { + s1 = peg$c26(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 9, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c28); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattr() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 10, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c30; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c31); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrValue(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c33); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c34(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrOps() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 11, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c36); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c38); } + } + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + if (peg$c40.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + { peg$fail(peg$c41); } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrEqOps() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 12, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c38); } + } + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrName() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 13, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseidentifierName(); + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c42; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c43); } + } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseidentifierName(); + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c42; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c43); } + } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s1 = peg$c6(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrValue() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 14, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrEqOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsetype(); + if (s5 === peg$FAILED) { + s5 = peg$parseregex(); + } + if (s5 !== peg$FAILED) { + s1 = peg$c44(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsestring(); + if (s5 === peg$FAILED) { + s5 = peg$parsenumber(); + if (s5 === peg$FAILED) { + s5 = peg$parsepath(); + } + } + if (s5 !== peg$FAILED) { + s1 = peg$c44(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s1 = peg$c45(s1); + } + s0 = s1; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsestring() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 15, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c46; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c47); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c48.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c49); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c48.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c49); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c46; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c47); } + } + if (s3 !== peg$FAILED) { + s1 = peg$c54(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c55; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c56); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c57.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c58); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c57.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c58); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c55; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c56); } + } + if (s3 !== peg$FAILED) { + s1 = peg$c54(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 16, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = peg$c61(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsepath() { + var s0, s1; + + var key = peg$currPos * 30 + 17, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + if (s1 !== peg$FAILED) { + s1 = peg$c62(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetype() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 18, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c63) { + s1 = peg$c63; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c64); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c65.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c66); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c65.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c66); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c69(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseflags() { + var s0, s1; + + var key = peg$currPos * 30 + 19, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (peg$c70.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c71); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c70.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c71); } + } + } + } else { + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseregex() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 30 + 20, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c72; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c73); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c74.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c75); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c74.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c75); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s3 = peg$c72; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c73); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseflags(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + s1 = peg$c76(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefield() { + var s0, s1, s2, s3, s4, s5, s6; + + var key = peg$currPos * 30 + 21, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + s1 = peg$c77(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenegation() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 22, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c78) { + s1 = peg$c78; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c79); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c80(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsematches() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 23, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c81) { + s1 = peg$c81; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c82); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c83(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsehas() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 24, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c84) { + s1 = peg$c84; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c85); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c86(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefirstChild() { + var s0, s1; + + var key = peg$currPos * 30 + 25, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12) === peg$c87) { + s1 = peg$c87; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c88); } + } + if (s1 !== peg$FAILED) { + s1 = peg$c89(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parselastChild() { + var s0, s1; + + var key = peg$currPos * 30 + 26, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c90) { + s1 = peg$c90; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c91); } + } + if (s1 !== peg$FAILED) { + s1 = peg$c92(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 27, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c93) { + s1 = peg$c93; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c94); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c95(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthLastChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 28, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 16) === peg$c96) { + s1 = peg$c96; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c97); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c98(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseclass() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 29, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c99; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c100); } + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c101) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c102); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c103) { + s2 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c104); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c105) { + s2 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c106); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c107) { + s2 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c108); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c109) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c110); } + } + } + } + } + } + if (s2 !== peg$FAILED) { + s1 = peg$c111(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + + function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; } + function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; } + function strUnescape(s) { + return s.replace(/\\(.)/g, function(match, ch) { + switch(ch) { + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + default: return ch; + } + }); + } + + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse + }; +}); +}); + +/* vim: set sw=4 sts=4 : */ + +/** +* @typedef {"LEFT_SIDE"|"RIGHT_SIDE"} Side +*/ + +const LEFT_SIDE = 'LEFT_SIDE'; +const RIGHT_SIDE = 'RIGHT_SIDE'; + +/** + * @external AST + * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html + */ + +/** + * One of the rules of `grammar.pegjs` + * @typedef {PlainObject} SelectorAST + * @see grammar.pegjs +*/ + +/** + * The `sequence` production of `grammar.pegjs` + * @typedef {PlainObject} SelectorSequenceAST +*/ + +/** + * Get the value of a property which may be multiple levels down + * in the object. + * @param {?PlainObject} obj + * @param {string} key + * @returns {undefined|boolean|string|number|external:AST} + */ +function getPath(obj, key) { + const keys = key.split('.'); + for (let i = 0; i < keys.length; i++) { + if (obj == null) { return obj; } + obj = obj[keys[i]]; + } + return obj; +} + +/** + * Determine whether `node` can be reached by following `path`, + * starting at `ancestor`. + * @param {?external:AST} node + * @param {?external:AST} ancestor + * @param {string[]} path + * @returns {boolean} + */ +function inPath(node, ancestor, path) { + if (path.length === 0) { return node === ancestor; } + if (ancestor == null) { return false; } + const field = ancestor[path[0]]; + const remainingPath = path.slice(1); + if (Array.isArray(field)) { + for (let i = 0, l = field.length; i < l; ++i) { + if (inPath(node, field[i], remainingPath)) { return true; } + } + return false; + } else { + return inPath(node, field, remainingPath); + } +} + +/** + * Given a `node` and its ancestors, determine if `node` is matched + * by `selector`. + * @param {?external:AST} node + * @param {?SelectorAST} selector + * @param {external:AST[]} [ancestry=[]] + * @throws {Error} Unknowns (operator, class name, selector type, or + * selector value type) + * @returns {boolean} + */ +function matches(node, selector, ancestry) { + if (!selector) { return true; } + if (!node) { return false; } + if (!ancestry) { ancestry = []; } + + switch(selector.type) { + case 'wildcard': + return true; + + case 'identifier': + return selector.value.toLowerCase() === node.type.toLowerCase(); + + case 'field': { + const path = selector.name.split('.'); + const ancestor = ancestry[path.length - 1]; + return inPath(node, ancestor, path); + + } + case 'matches': + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + if (matches(node, selector.selectors[i], ancestry)) { return true; } + } + return false; + + case 'compound': + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + if (!matches(node, selector.selectors[i], ancestry)) { return false; } + } + return true; + + case 'not': + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + if (matches(node, selector.selectors[i], ancestry)) { return false; } + } + return true; + + case 'has': { + const collector = []; + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + const a = []; + estraverse.traverse(node, { + enter (node, parent) { + if (parent != null) { a.unshift(parent); } + if (matches(node, selector.selectors[i], a)) { + collector.push(node); + } + }, + leave () { a.shift(); }, + fallback: 'iteration' + }); + } + return collector.length !== 0; + + } + case 'child': + if (matches(node, selector.right, ancestry)) { + return matches(ancestry[0], selector.left, ancestry.slice(1)); + } + return false; + + case 'descendant': + if (matches(node, selector.right, ancestry)) { + for (let i = 0, l = ancestry.length; i < l; ++i) { + if (matches(ancestry[i], selector.left, ancestry.slice(i + 1))) { + return true; + } + } + } + return false; + + case 'attribute': { + const p = getPath(node, selector.name); + switch (selector.operator) { + case void 0: + return p != null; + case '=': + switch (selector.value.type) { + case 'regexp': return typeof p === 'string' && selector.value.value.test(p); + case 'literal': return `${selector.value.value}` === `${p}`; + case 'type': return selector.value.value === typeof p; + } + throw new Error(`Unknown selector value type: ${selector.value.type}`); + case '!=': + switch (selector.value.type) { + case 'regexp': return !selector.value.value.test(p); + case 'literal': return `${selector.value.value}` !== `${p}`; + case 'type': return selector.value.value !== typeof p; + } + throw new Error(`Unknown selector value type: ${selector.value.type}`); + case '<=': return p <= selector.value.value; + case '<': return p < selector.value.value; + case '>': return p > selector.value.value; + case '>=': return p >= selector.value.value; + } + throw new Error(`Unknown operator: ${selector.operator}`); + } + case 'sibling': + return matches(node, selector.right, ancestry) && + sibling(node, selector.left, ancestry, LEFT_SIDE) || + selector.left.subject && + matches(node, selector.left, ancestry) && + sibling(node, selector.right, ancestry, RIGHT_SIDE); + case 'adjacent': + return matches(node, selector.right, ancestry) && + adjacent(node, selector.left, ancestry, LEFT_SIDE) || + selector.right.subject && + matches(node, selector.left, ancestry) && + adjacent(node, selector.right, ancestry, RIGHT_SIDE); + + case 'nth-child': + return matches(node, selector.right, ancestry) && + nthChild(node, ancestry, function () { + return selector.index.value - 1; + }); + + case 'nth-last-child': + return matches(node, selector.right, ancestry) && + nthChild(node, ancestry, function (length) { + return length - selector.index.value; + }); + + case 'class': + switch(selector.name.toLowerCase()){ + case 'statement': + if(node.type.slice(-9) === 'Statement') return true; + // fallthrough: interface Declaration <: Statement { } + case 'declaration': + return node.type.slice(-11) === 'Declaration'; + case 'pattern': + if(node.type.slice(-7) === 'Pattern') return true; + // fallthrough: interface Expression <: Node, Pattern { } + case 'expression': + return node.type.slice(-10) === 'Expression' || + node.type.slice(-7) === 'Literal' || + ( + node.type === 'Identifier' && + (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty') + ) || + node.type === 'MetaProperty'; + case 'function': + return node.type === 'FunctionDeclaration' || + node.type === 'FunctionExpression' || + node.type === 'ArrowFunctionExpression'; + } + throw new Error(`Unknown class name: ${selector.name}`); + } + + throw new Error(`Unknown selector type: ${selector.type}`); +} + +/** + * Determines if the given node has a sibling that matches the + * given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @returns {boolean} + */ +function sibling(node, selector, ancestry, side) { + const [parent] = ancestry; + if (!parent) { return false; } + const keys = estraverse.VisitorKeys[parent.type]; + for (let i = 0, l = keys.length; i < l; ++i) { + const listProp = parent[keys[i]]; + if (Array.isArray(listProp)) { + const startIndex = listProp.indexOf(node); + if (startIndex < 0) { continue; } + let lowerBound, upperBound; + if (side === LEFT_SIDE) { + lowerBound = 0; + upperBound = startIndex; + } else { + lowerBound = startIndex + 1; + upperBound = listProp.length; + } + for (let k = lowerBound; k < upperBound; ++k) { + if (matches(listProp[k], selector, ancestry)) { + return true; + } + } + } + } + return false; +} + +/** + * Determines if the given node has an adjacent sibling that matches + * the given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @returns {boolean} + */ +function adjacent(node, selector, ancestry, side) { + const [parent] = ancestry; + if (!parent) { return false; } + const keys = estraverse.VisitorKeys[parent.type]; + for (let i = 0, l = keys.length; i < l; ++i) { + const listProp = parent[keys[i]]; + if (Array.isArray(listProp)) { + const idx = listProp.indexOf(node); + if (idx < 0) { continue; } + if (side === LEFT_SIDE && idx > 0 && matches(listProp[idx - 1], selector, ancestry)) { + return true; + } + if (side === RIGHT_SIDE && idx < listProp.length - 1 && matches(listProp[idx + 1], selector, ancestry)) { + return true; + } + } + } + return false; +} + +/** +* @callback IndexFunction +* @param {Integer} len Containing list's length +* @returns {Integer} +*/ + +/** + * Determines if the given node is the nth child, determined by + * `idxFn`, which is given the containing list's length. + * @param {external:AST} node + * @param {external:AST[]} ancestry + * @param {IndexFunction} idxFn + * @returns {boolean} + */ +function nthChild(node, ancestry, idxFn) { + const [parent] = ancestry; + if (!parent) { return false; } + const keys = estraverse.VisitorKeys[parent.type]; + for (let i = 0, l = keys.length; i < l; ++i) { + const listProp = parent[keys[i]]; + if (Array.isArray(listProp)) { + const idx = listProp.indexOf(node); + if (idx >= 0 && idx === idxFn(listProp.length)) { return true; } + } + } + return false; +} + +/** + * For each selector node marked as a subject, find the portion of the + * selector that the subject must match. + * @param {SelectorAST} selector + * @param {SelectorAST} [ancestor] Defaults to `selector` + * @returns {SelectorAST[]} + */ +function subjects(selector, ancestor) { + if (selector == null || typeof selector != 'object') { return []; } + if (ancestor == null) { ancestor = selector; } + const results = selector.subject ? [ancestor] : []; + for (const [p, sel] of Object.entries(selector)) { + results.push(...subjects(sel, p === 'left' ? sel : ancestor)); + } + return results; +} + +/** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @returns {external:AST[]} + */ +function match(ast, selector) { + const ancestry = [], results = []; + if (!selector) { return results; } + const altSubjects = subjects(selector); + estraverse.traverse(ast, { + enter (node, parent) { + if (parent != null) { ancestry.unshift(parent); } + if (matches(node, selector, ancestry)) { + if (altSubjects.length) { + for (let i = 0, l = altSubjects.length; i < l; ++i) { + if (matches(node, altSubjects[i], ancestry)) { results.push(node); } + for (let k = 0, m = ancestry.length; k < m; ++k) { + if (matches(ancestry[k], altSubjects[i], ancestry.slice(k + 1))) { + results.push(ancestry[k]); + } + } + } + } else { + results.push(node); + } + } + }, + leave () { ancestry.shift(); }, + fallback: 'iteration' + }); + return results; +} + +/** + * Parse a selector string and return its AST. + * @param {string} selector + * @returns {SelectorAST} + */ +function parse(selector) { + return parser.parse(selector); +} + +/** + * Query the code AST using the selector string. + * @param {external:AST} ast + * @param {string} selector + * @returns {external:AST[]} + */ +function query(ast, selector) { + return match(ast, parse(selector)); +} + +query.parse = parse; +query.match = match; +query.matches = matches; +query.query = query; + +export default query; diff --git a/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.min.js b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.min.js new file mode 100644 index 00000000000000..507a98c8dc29de --- /dev/null +++ b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.esm.min.js @@ -0,0 +1,2 @@ +"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e((function(e,t){!function e(t){var r,n,s,o,a,i;function l(e){var t,r,n={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r&&null!==r?l(r):r);return n}function u(e,t){this.parent=e,this.key=t}function c(e,t,r,n){this.node=e,this.path=t,this.wrap=r,this.ref=n}function p(){}function f(e){return null!=e&&("object"==typeof e&&"string"==typeof e.type)}function h(e,t){return(e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function d(e,t){return(new p).traverse(e,t)}function x(e,t){var r;return r=function(e,t){var r,n,s,o;for(n=e.length,s=0;n;)t(e[o=s+(r=n>>>1)])?n=r:(s=o+1,n-=r+1);return s}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n={Break:o={},Skip:a={},Remove:i={}},u.prototype.replace=function(e){this.parent[this.key]=e},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},p.prototype.path=function(){var e,t,r,n,s;function o(e,t){if(Array.isArray(t))for(r=0,n=t.length;r=0;)if(y=i[p=m[d]])if(Array.isArray(y)){for(x=y.length;(x-=1)>=0;)if(y[x]){if(h(l,m[d]))s=new c(y[x],[p,x],"Property",null);else{if(!f(y[x]))continue;s=new c(y[x],[p,x],null,null)}r.push(s)}}else f(y)&&r.push(new c(y,p,null,null))}}else if(s=n.pop(),u=this.__execute(t.leave,s),this.__state===o||u===o)return},p.prototype.replace=function(e,t){var r,n,s,l,p,d,x,m,y,g,v,A,E;function _(e){var t,n,s,o;if(e.ref.remove())for(n=e.ref.key,o=e.ref.parent,t=r.length;t--;)if((s=r[t]).ref&&s.ref.parent===o){if(s.ref.key=0;)if(g=s[E=y[x]])if(Array.isArray(g)){for(m=g.length;(m-=1)>=0;)if(g[m]){if(h(l,y[x]))d=new c(g[m],[E,m],"Property",new u(g,m));else{if(!f(g[m]))continue;d=new c(g[m],[E,m],null,new u(g,m))}r.push(d)}}else f(g)&&r.push(new c(g,E,null,new u(s,E)))}}else if(d=n.pop(),void 0!==(p=this.__execute(t.leave,d))&&p!==o&&p!==a&&p!==i&&d.ref.replace(p),this.__state!==i&&p!==i||_(d),this.__state===o||p===o)return A.root;return A.root},t.Syntax=r,t.traverse=d,t.replace=function(e,t){return(new p).replace(e,t)},t.attachComments=function(e,t,r){var s,o,a,i,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(a=0,o=t.length;ae.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),u.splice(i,1)):i+=1;return i===u.length?n.Break:u[i].extendedRange[0]>e.range[1]?n.Skip:void 0}}),i=0,d(e,{leave:function(e){for(var t;ie.range[1]?n.Skip:void 0}}),e},t.VisitorKeys=s,t.VisitorOption=n,t.Controller=p,t.cloneEnvironment=function(){return e({})},t}(t)})),r=e((function(e){e.exports&&(e.exports=function(){function e(t,r,n,s){this.message=t,this.expected=r,this.found=n,this.location=s,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return'"'+s(e.text)+'"'},class:function(e){var t,r="";for(t=0;t0){for(t=1,n=1;t<~+.]/,f=ye([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),h=function(e){return e.join("")},d=me(">",!1),x=me("~",!1),m=me("+",!1),y=me(",",!1),g=me("!",!1),v=me("*",!1),A=me("#",!1),E=me("[",!1),_=me("]",!1),b=/^[>","<","!"],!1,!1),C=me("=",!1),w=function(e){return(e||"")+"="},P=/^[><]/,k=ye([">","<"],!1,!1),D=me(".",!1),I=function(e,t,r){return{type:"attribute",name:e,operator:t,value:r}},F=me('"',!1),j=/^[^\\"]/,T=ye(["\\",'"'],!0,!1),L=me("\\",!1),R={type:"any"},O=function(e,t){return e+t},B=function(e){return{type:"literal",value:(t=e.join(""),t.replace(/\\(.)/g,(function(e,t){switch(t){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";default:return t}})))};var t},M=me("'",!1),U=/^[^\\']/,V=ye(["\\","'"],!0,!1),q=/^[0-9]/,N=ye([["0","9"]],!1,!1),W=me("type(",!1),$=/^[^ )]/,G=ye([" ",")"],!0,!1),z=me(")",!1),K=/^[imsu]/,H=ye(["i","m","s","u"],!1,!1),Y=me("/",!1),J=/^[^\/]/,Q=ye(["/"],!0,!1),X=me(":not(",!1),Z=me(":matches(",!1),ee=me(":has(",!1),te=me(":first-child",!1),re=me(":last-child",!1),ne=me(":nth-child(",!1),se=me(":nth-last-child(",!1),oe=me(":",!1),ae=me("statement",!0),ie=me("expression",!0),le=me("declaration",!0),ue=me("function",!0),ce=me("pattern",!0),pe=0,fe=[{line:1,column:1}],he=0,de=[],xe={};if("startRule"in r){if(!(r.startRule in l))throw new Error("Can't start parsing from rule \""+r.startRule+'".');u=l[r.startRule]}function me(e,t){return{type:"literal",text:e,ignoreCase:t}}function ye(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function ge(e){var r,n=fe[e];if(n)return n;for(r=e-1;!fe[r];)r--;for(n={line:(n=fe[r]).line,column:n.column};rhe&&(he=pe,de=[]),de.push(e))}function Ee(){var e,t,r,n,s=30*pe+0,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,(t=_e())!==i&&(r=Ce())!==i&&_e()!==i?e=t=1===(n=r).length?n[0]:{type:"matches",selectors:n}:(pe=e,e=i),e===i&&(e=pe,(t=_e())!==i&&(t=void 0),e=t),xe[s]={nextPos:pe,result:e},e)}function _e(){var e,r,n=30*pe+1,s=xe[n];if(s)return pe=s.nextPos,s.result;for(e=[],32===t.charCodeAt(pe)?(r=" ",pe++):(r=i,Ae(c));r!==i;)e.push(r),32===t.charCodeAt(pe)?(r=" ",pe++):(r=i,Ae(c));return xe[n]={nextPos:pe,result:e},e}function be(){var e,r,n,s=30*pe+2,o=xe[s];if(o)return pe=o.nextPos,o.result;if(r=[],p.test(t.charAt(pe))?(n=t.charAt(pe),pe++):(n=i,Ae(f)),n!==i)for(;n!==i;)r.push(n),p.test(t.charAt(pe))?(n=t.charAt(pe),pe++):(n=i,Ae(f));else r=i;return r!==i&&(r=h(r)),e=r,xe[s]={nextPos:pe,result:e},e}function Se(){var e,r,n,s=30*pe+3,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,(r=_e())!==i?(62===t.charCodeAt(pe)?(n=">",pe++):(n=i,Ae(d)),n!==i&&_e()!==i?e=r="child":(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=_e())!==i?(126===t.charCodeAt(pe)?(n="~",pe++):(n=i,Ae(x)),n!==i&&_e()!==i?e=r="sibling":(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=_e())!==i?(43===t.charCodeAt(pe)?(n="+",pe++):(n=i,Ae(m)),n!==i&&_e()!==i?e=r="adjacent":(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,32===t.charCodeAt(pe)?(r=" ",pe++):(r=i,Ae(c)),r!==i&&(n=_e())!==i?e=r="descendant":(pe=e,e=i)))),xe[s]={nextPos:pe,result:e},e)}function Ce(){var e,r,n,s,o,a,l,u,c=30*pe+4,p=xe[c];if(p)return pe=p.nextPos,p.result;if(e=pe,(r=we())!==i){for(n=[],s=pe,(o=_e())!==i?(44===t.charCodeAt(pe)?(a=",",pe++):(a=i,Ae(y)),a!==i&&(l=_e())!==i&&(u=we())!==i?s=o=[o,a,l,u]:(pe=s,s=i)):(pe=s,s=i);s!==i;)n.push(s),s=pe,(o=_e())!==i?(44===t.charCodeAt(pe)?(a=",",pe++):(a=i,Ae(y)),a!==i&&(l=_e())!==i&&(u=we())!==i?s=o=[o,a,l,u]:(pe=s,s=i)):(pe=s,s=i);n!==i?e=r=[r].concat(n.map((function(e){return e[3]}))):(pe=e,e=i)}else pe=e,e=i;return xe[c]={nextPos:pe,result:e},e}function we(){var e,t,r,n,s,o,a,l=30*pe+5,u=xe[l];if(u)return pe=u.nextPos,u.result;if(e=pe,(t=Pe())!==i){for(r=[],n=pe,(s=Se())!==i&&(o=Pe())!==i?n=s=[s,o]:(pe=n,n=i);n!==i;)r.push(n),n=pe,(s=Se())!==i&&(o=Pe())!==i?n=s=[s,o]:(pe=n,n=i);r!==i?(a=t,e=t=r.reduce((function(e,t){return{type:t[0],left:e,right:t[1]}}),a)):(pe=e,e=i)}else pe=e,e=i;return xe[l]={nextPos:pe,result:e},e}function Pe(){var e,r,n,s,o=30*pe+6,a=xe[o];if(a)return pe=a.nextPos,a.result;if(e=pe,33===t.charCodeAt(pe)?(r="!",pe++):(r=i,Ae(g)),r===i&&(r=null),r!==i){if(n=[],(s=ke())!==i)for(;s!==i;)n.push(s),s=ke();else n=i;n!==i?e=r=function(e,t){const r=1===t.length?t[0]:{type:"compound",selectors:t};return e&&(r.subject=!0),r}(r,n):(pe=e,e=i)}else pe=e,e=i;return xe[o]={nextPos:pe,result:e},e}function ke(){var e,r=30*pe+7,n=xe[r];return n?(pe=n.nextPos,n.result):((e=function(){var e,r,n=30*pe+8,s=xe[n];return s?(pe=s.nextPos,s.result):(42===t.charCodeAt(pe)?(r="*",pe++):(r=i,Ae(v)),r!==i&&(r={type:"wildcard",value:r}),e=r,xe[n]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s=30*pe+9,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,35===t.charCodeAt(pe)?(r="#",pe++):(r=i,Ae(A)),r===i&&(r=null),r!==i&&(n=be())!==i?e=r={type:"identifier",value:n}:(pe=e,e=i),xe[s]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o=30*pe+10,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,91===t.charCodeAt(pe)?(r="[",pe++):(r=i,Ae(E)),r!==i&&_e()!==i&&(n=function(){var e,r,n,s,o=30*pe+14,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,(r=De())!==i&&_e()!==i&&(n=function(){var e,r,n,s=30*pe+12,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,33===t.charCodeAt(pe)?(r="!",pe++):(r=i,Ae(g)),r===i&&(r=null),r!==i?(61===t.charCodeAt(pe)?(n="=",pe++):(n=i,Ae(C)),n!==i?(r=w(r),e=r):(pe=e,e=i)):(pe=e,e=i),xe[s]={nextPos:pe,result:e},e)}())!==i&&_e()!==i?((s=function(){var e,r,n,s,o,a=30*pe+18,l=xe[a];if(l)return pe=l.nextPos,l.result;if(e=pe,"type("===t.substr(pe,5)?(r="type(",pe+=5):(r=i,Ae(W)),r!==i)if(_e()!==i){if(n=[],$.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(G)),s!==i)for(;s!==i;)n.push(s),$.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(G));else n=i;n!==i&&(s=_e())!==i?(41===t.charCodeAt(pe)?(o=")",pe++):(o=i,Ae(z)),o!==i?(r={type:"type",value:n.join("")},e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[a]={nextPos:pe,result:e},e}())===i&&(s=function(){var e,r,n,s,o,a,l=30*pe+20,u=xe[l];if(u)return pe=u.nextPos,u.result;if(e=pe,47===t.charCodeAt(pe)?(r="/",pe++):(r=i,Ae(Y)),r!==i){if(n=[],J.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(Q)),s!==i)for(;s!==i;)n.push(s),J.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(Q));else n=i;n!==i?(47===t.charCodeAt(pe)?(s="/",pe++):(s=i,Ae(Y)),s!==i?((o=function(){var e,r,n=30*pe+19,s=xe[n];if(s)return pe=s.nextPos,s.result;if(e=[],K.test(t.charAt(pe))?(r=t.charAt(pe),pe++):(r=i,Ae(H)),r!==i)for(;r!==i;)e.push(r),K.test(t.charAt(pe))?(r=t.charAt(pe),pe++):(r=i,Ae(H));else e=i;return xe[n]={nextPos:pe,result:e},e}())===i&&(o=null),o!==i?(a=o,r={type:"regexp",value:new RegExp(n.join(""),a?a.join(""):"")},e=r):(pe=e,e=i)):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;return xe[l]={nextPos:pe,result:e},e}()),s!==i?(r=I(r,n,s),e=r):(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=De())!==i&&_e()!==i&&(n=function(){var e,r,n,s=30*pe+11,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,b.test(t.charAt(pe))?(r=t.charAt(pe),pe++):(r=i,Ae(S)),r===i&&(r=null),r!==i?(61===t.charCodeAt(pe)?(n="=",pe++):(n=i,Ae(C)),n!==i?(r=w(r),e=r):(pe=e,e=i)):(pe=e,e=i),e===i&&(P.test(t.charAt(pe))?(e=t.charAt(pe),pe++):(e=i,Ae(k))),xe[s]={nextPos:pe,result:e},e)}())!==i&&_e()!==i?((s=function(){var e,r,n,s,o,a,l=30*pe+15,u=xe[l];if(u)return pe=u.nextPos,u.result;if(e=pe,34===t.charCodeAt(pe)?(r='"',pe++):(r=i,Ae(F)),r!==i){for(n=[],j.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(T)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));s!==i;)n.push(s),j.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(T)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));n!==i?(34===t.charCodeAt(pe)?(s='"',pe++):(s=i,Ae(F)),s!==i?(r=B(n),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;if(e===i)if(e=pe,39===t.charCodeAt(pe)?(r="'",pe++):(r=i,Ae(M)),r!==i){for(n=[],U.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(V)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));s!==i;)n.push(s),U.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(V)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));n!==i?(39===t.charCodeAt(pe)?(s="'",pe++):(s=i,Ae(M)),s!==i?(r=B(n),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;return xe[l]={nextPos:pe,result:e},e}())===i&&(s=function(){var e,r,n,s,o=30*pe+16,a=xe[o];if(a)return pe=a.nextPos,a.result;for(e=pe,r=pe,n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));if(n!==i?(46===t.charCodeAt(pe)?(s=".",pe++):(s=i,Ae(D)),s!==i?r=n=[n,s]:(pe=r,r=i)):(pe=r,r=i),r===i&&(r=null),r!==i){if(n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N)),s!==i)for(;s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));else n=i;n!==i?(r=function(e,t){const r=e?[].concat.apply([],e).join(""):"";return{type:"literal",value:parseFloat(r+t.join(""))}}(r,n),e=r):(pe=e,e=i)}else pe=e,e=i;return xe[o]={nextPos:pe,result:e},e}())===i&&(s=function(){var e,t,r=30*pe+17,n=xe[r];return n?(pe=n.nextPos,n.result):((t=be())!==i&&(t={type:"literal",value:t}),e=t,xe[r]={nextPos:pe,result:e},e)}()),s!==i?(r=I(r,n,s),e=r):(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=De())!==i&&(r={type:"attribute",name:r}),e=r)),xe[o]={nextPos:pe,result:e},e)}())!==i&&_e()!==i?(93===t.charCodeAt(pe)?(s="]",pe++):(s=i,Ae(_)),s!==i?e=r=n:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o,a,l,u,c=30*pe+21,p=xe[c];if(p)return pe=p.nextPos,p.result;if(e=pe,46===t.charCodeAt(pe)?(r=".",pe++):(r=i,Ae(D)),r!==i)if((n=be())!==i){for(s=[],o=pe,46===t.charCodeAt(pe)?(a=".",pe++):(a=i,Ae(D)),a!==i&&(l=be())!==i?o=a=[a,l]:(pe=o,o=i);o!==i;)s.push(o),o=pe,46===t.charCodeAt(pe)?(a=".",pe++):(a=i,Ae(D)),a!==i&&(l=be())!==i?o=a=[a,l]:(pe=o,o=i);s!==i?(u=n,r={type:"field",name:s.reduce((function(e,t){return e+t[0]+t[1]}),u)},e=r):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[c]={nextPos:pe,result:e},e}())===i&&(e=function(){var e,r,n,s,o=30*pe+22,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,":not("===t.substr(pe,5)?(r=":not(",pe+=5):(r=i,Ae(X)),r!==i&&_e()!==i&&(n=Ce())!==i&&_e()!==i?(41===t.charCodeAt(pe)?(s=")",pe++):(s=i,Ae(z)),s!==i?e=r={type:"not",selectors:n}:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o=30*pe+23,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,":matches("===t.substr(pe,9)?(r=":matches(",pe+=9):(r=i,Ae(Z)),r!==i&&_e()!==i&&(n=Ce())!==i&&_e()!==i?(41===t.charCodeAt(pe)?(s=")",pe++):(s=i,Ae(z)),s!==i?e=r={type:"matches",selectors:n}:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o=30*pe+24,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,":has("===t.substr(pe,5)?(r=":has(",pe+=5):(r=i,Ae(ee)),r!==i&&_e()!==i&&(n=Ce())!==i&&_e()!==i?(41===t.charCodeAt(pe)?(s=")",pe++):(s=i,Ae(z)),s!==i?e=r={type:"has",selectors:n}:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n=30*pe+25,s=xe[n];return s?(pe=s.nextPos,s.result):(":first-child"===t.substr(pe,12)?(r=":first-child",pe+=12):(r=i,Ae(te)),r!==i&&(r=Ie(1)),e=r,xe[n]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n=30*pe+26,s=xe[n];return s?(pe=s.nextPos,s.result):(":last-child"===t.substr(pe,11)?(r=":last-child",pe+=11):(r=i,Ae(re)),r!==i&&(r=Fe(1)),e=r,xe[n]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o,a=30*pe+27,l=xe[a];if(l)return pe=l.nextPos,l.result;if(e=pe,":nth-child("===t.substr(pe,11)?(r=":nth-child(",pe+=11):(r=i,Ae(ne)),r!==i)if(_e()!==i){if(n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N)),s!==i)for(;s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));else n=i;n!==i&&(s=_e())!==i?(41===t.charCodeAt(pe)?(o=")",pe++):(o=i,Ae(z)),o!==i?(r=Ie(parseInt(n.join(""),10)),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[a]={nextPos:pe,result:e},e}())===i&&(e=function(){var e,r,n,s,o,a=30*pe+28,l=xe[a];if(l)return pe=l.nextPos,l.result;if(e=pe,":nth-last-child("===t.substr(pe,16)?(r=":nth-last-child(",pe+=16):(r=i,Ae(se)),r!==i)if(_e()!==i){if(n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N)),s!==i)for(;s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));else n=i;n!==i&&(s=_e())!==i?(41===t.charCodeAt(pe)?(o=")",pe++):(o=i,Ae(z)),o!==i?(r=Fe(parseInt(n.join(""),10)),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[a]={nextPos:pe,result:e},e}())===i&&(e=function(){var e,r,n,s=30*pe+29,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,58===t.charCodeAt(pe)?(r=":",pe++):(r=i,Ae(oe)),r!==i?("statement"===t.substr(pe,9).toLowerCase()?(n=t.substr(pe,9),pe+=9):(n=i,Ae(ae)),n===i&&("expression"===t.substr(pe,10).toLowerCase()?(n=t.substr(pe,10),pe+=10):(n=i,Ae(ie)),n===i&&("declaration"===t.substr(pe,11).toLowerCase()?(n=t.substr(pe,11),pe+=11):(n=i,Ae(le)),n===i&&("function"===t.substr(pe,8).toLowerCase()?(n=t.substr(pe,8),pe+=8):(n=i,Ae(ue)),n===i&&("pattern"===t.substr(pe,7).toLowerCase()?(n=t.substr(pe,7),pe+=7):(n=i,Ae(ce)))))),n!==i?e=r={type:"class",name:n}:(pe=e,e=i)):(pe=e,e=i),xe[s]={nextPos:pe,result:e},e)}()),xe[r]={nextPos:pe,result:e},e)}function De(){var e,r,n,s=30*pe+13,o=xe[s];if(o)return pe=o.nextPos,o.result;if(r=[],(n=be())===i&&(46===t.charCodeAt(pe)?(n=".",pe++):(n=i,Ae(D))),n!==i)for(;n!==i;)r.push(n),(n=be())===i&&(46===t.charCodeAt(pe)?(n=".",pe++):(n=i,Ae(D)));else r=i;return r!==i&&(r=h(r)),e=r,xe[s]={nextPos:pe,result:e},e}function Ie(e){return{type:"nth-child",index:{type:"literal",value:e}}}function Fe(e){return{type:"nth-last-child",index:{type:"literal",value:e}}}if((n=u())!==i&&pe===t.length)return n;throw n!==i&&pe":return t>r.value.value;case">=":return t>=r.value.value}throw new Error(`Unknown operator: ${r.operator}`)}case"sibling":return n(e,r.right,i)&&s(e,r.left,i,"LEFT_SIDE")||r.left.subject&&n(e,r.left,i)&&s(e,r.right,i,"RIGHT_SIDE");case"adjacent":return n(e,r.right,i)&&o(e,r.left,i,"LEFT_SIDE")||r.right.subject&&n(e,r.left,i)&&o(e,r.right,i,"RIGHT_SIDE");case"nth-child":return n(e,r.right,i)&&a(e,i,(function(){return r.index.value-1}));case"nth-last-child":return n(e,r.right,i)&&a(e,i,(function(e){return e-r.index.value}));case"class":switch(r.name.toLowerCase()){case"statement":if("Statement"===e.type.slice(-9))return!0;case"declaration":return"Declaration"===e.type.slice(-11);case"pattern":if("Pattern"===e.type.slice(-7))return!0;case"expression":return"Expression"===e.type.slice(-10)||"Literal"===e.type.slice(-7)||"Identifier"===e.type&&(0===i.length||"MetaProperty"!==i[0].type)||"MetaProperty"===e.type;case"function":return"FunctionDeclaration"===e.type||"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type}throw new Error(`Unknown class name: ${r.name}`)}throw new Error(`Unknown selector type: ${r.type}`)}function s(e,r,s,o){const[a]=s;if(!a)return!1;const i=t.VisitorKeys[a.type];for(let t=0,l=i.length;t0&&n(l[t-1],r,s))return!0;if("RIGHT_SIDE"===o&&t=0&&t===n(r.length))return!0}}return!1}function i(e,r){const s=[],o=[];if(!r)return o;const a=function e(t,r){if(null==t||"object"!=typeof t)return[];null==r&&(r=t);const n=t.subject?[r]:[];for(const[s,o]of Object.entries(t))n.push(...e(o,"left"===s?o:r));return n}(r);return t.traverse(e,{enter(e,t){if(null!=t&&s.unshift(t),n(e,r,s))if(a.length)for(let t=0,r=a.length;t + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /*jslint vars:false, bitwise:true*/ + /*jshint indent:4*/ + /*global exports:true*/ + (function clone(exports) { + + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; + + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + + // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + function upperBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; + + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() { } + + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } + + // root node + if (!this.__current.path) { + return null; + } + + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; + + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + + result = undefined; + + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + + return result; + }; + + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; + + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; + + function removeElem(element) { + var i, + key, + nextElem, + parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + target = this.__execute(visitor.leave, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + + target = this.__execute(visitor.enter, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + // node may be null + node = element.node; + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } + + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + return tree; + } + + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + + return exports; + }(exports)); + /* vim: set sw=4 ts=4 et tw=80 : */ + }); + + var parser = createCommonjsModule(function (module) { + /* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ + (function(root, factory) { + if ( module.exports) { + module.exports = factory(); + } + })(commonjsGlobal, function() { + + function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + "class": function(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array + ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) + : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + + any: function(expectation) { + return "any character"; + }, + + end: function(expectation) { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + + function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, + + peg$c0 = function(ss) { + return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss }; + }, + peg$c1 = function() { return void 0; }, + peg$c2 = " ", + peg$c3 = peg$literalExpectation(" ", false), + peg$c4 = /^[^ [\],():#!=><~+.]/, + peg$c5 = peg$classExpectation([" ", "[", "]", ",", "(", ")", ":", "#", "!", "=", ">", "<", "~", "+", "."], true, false), + peg$c6 = function(i) { return i.join(''); }, + peg$c7 = ">", + peg$c8 = peg$literalExpectation(">", false), + peg$c9 = function() { return 'child'; }, + peg$c10 = "~", + peg$c11 = peg$literalExpectation("~", false), + peg$c12 = function() { return 'sibling'; }, + peg$c13 = "+", + peg$c14 = peg$literalExpectation("+", false), + peg$c15 = function() { return 'adjacent'; }, + peg$c16 = function() { return 'descendant'; }, + peg$c17 = ",", + peg$c18 = peg$literalExpectation(",", false), + peg$c19 = function(s, ss) { + return [s].concat(ss.map(function (s) { return s[3]; })); + }, + peg$c20 = function(a, ops) { + return ops.reduce(function (memo, rhs) { + return { type: rhs[0], left: memo, right: rhs[1] }; + }, a); + }, + peg$c21 = "!", + peg$c22 = peg$literalExpectation("!", false), + peg$c23 = function(subject, as) { + const b = as.length === 1 ? as[0] : { type: 'compound', selectors: as }; + if(subject) b.subject = true; + return b; + }, + peg$c24 = "*", + peg$c25 = peg$literalExpectation("*", false), + peg$c26 = function(a) { return { type: 'wildcard', value: a }; }, + peg$c27 = "#", + peg$c28 = peg$literalExpectation("#", false), + peg$c29 = function(i) { return { type: 'identifier', value: i }; }, + peg$c30 = "[", + peg$c31 = peg$literalExpectation("[", false), + peg$c32 = "]", + peg$c33 = peg$literalExpectation("]", false), + peg$c34 = function(v) { return v; }, + peg$c35 = /^[>", "<", "!"], false, false), + peg$c37 = "=", + peg$c38 = peg$literalExpectation("=", false), + peg$c39 = function(a) { return (a || '') + '='; }, + peg$c40 = /^[><]/, + peg$c41 = peg$classExpectation([">", "<"], false, false), + peg$c42 = ".", + peg$c43 = peg$literalExpectation(".", false), + peg$c44 = function(name, op, value) { + return { type: 'attribute', name: name, operator: op, value: value }; + }, + peg$c45 = function(name) { return { type: 'attribute', name: name }; }, + peg$c46 = "\"", + peg$c47 = peg$literalExpectation("\"", false), + peg$c48 = /^[^\\"]/, + peg$c49 = peg$classExpectation(["\\", "\""], true, false), + peg$c50 = "\\", + peg$c51 = peg$literalExpectation("\\", false), + peg$c52 = peg$anyExpectation(), + peg$c53 = function(a, b) { return a + b; }, + peg$c54 = function(d) { + return { type: 'literal', value: strUnescape(d.join('')) }; + }, + peg$c55 = "'", + peg$c56 = peg$literalExpectation("'", false), + peg$c57 = /^[^\\']/, + peg$c58 = peg$classExpectation(["\\", "'"], true, false), + peg$c59 = /^[0-9]/, + peg$c60 = peg$classExpectation([["0", "9"]], false, false), + peg$c61 = function(a, b) { + // Can use `a.flat().join('')` once supported + const leadingDecimals = a ? [].concat.apply([], a).join('') : ''; + return { type: 'literal', value: parseFloat(leadingDecimals + b.join('')) }; + }, + peg$c62 = function(i) { return { type: 'literal', value: i }; }, + peg$c63 = "type(", + peg$c64 = peg$literalExpectation("type(", false), + peg$c65 = /^[^ )]/, + peg$c66 = peg$classExpectation([" ", ")"], true, false), + peg$c67 = ")", + peg$c68 = peg$literalExpectation(")", false), + peg$c69 = function(t) { return { type: 'type', value: t.join('') }; }, + peg$c70 = /^[imsu]/, + peg$c71 = peg$classExpectation(["i", "m", "s", "u"], false, false), + peg$c72 = "/", + peg$c73 = peg$literalExpectation("/", false), + peg$c74 = /^[^\/]/, + peg$c75 = peg$classExpectation(["/"], true, false), + peg$c76 = function(d, flgs) { return { + type: 'regexp', value: new RegExp(d.join(''), flgs ? flgs.join('') : '') }; + }, + peg$c77 = function(i, is) { + return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)}; + }, + peg$c78 = ":not(", + peg$c79 = peg$literalExpectation(":not(", false), + peg$c80 = function(ss) { return { type: 'not', selectors: ss }; }, + peg$c81 = ":matches(", + peg$c82 = peg$literalExpectation(":matches(", false), + peg$c83 = function(ss) { return { type: 'matches', selectors: ss }; }, + peg$c84 = ":has(", + peg$c85 = peg$literalExpectation(":has(", false), + peg$c86 = function(ss) { return { type: 'has', selectors: ss }; }, + peg$c87 = ":first-child", + peg$c88 = peg$literalExpectation(":first-child", false), + peg$c89 = function() { return nth(1); }, + peg$c90 = ":last-child", + peg$c91 = peg$literalExpectation(":last-child", false), + peg$c92 = function() { return nthLast(1); }, + peg$c93 = ":nth-child(", + peg$c94 = peg$literalExpectation(":nth-child(", false), + peg$c95 = function(n) { return nth(parseInt(n.join(''), 10)); }, + peg$c96 = ":nth-last-child(", + peg$c97 = peg$literalExpectation(":nth-last-child(", false), + peg$c98 = function(n) { return nthLast(parseInt(n.join(''), 10)); }, + peg$c99 = ":", + peg$c100 = peg$literalExpectation(":", false), + peg$c101 = "statement", + peg$c102 = peg$literalExpectation("statement", true), + peg$c103 = "expression", + peg$c104 = peg$literalExpectation("expression", true), + peg$c105 = "declaration", + peg$c106 = peg$literalExpectation("declaration", true), + peg$c107 = "function", + peg$c108 = peg$literalExpectation("function", true), + peg$c109 = "pattern", + peg$c110 = peg$literalExpectation("pattern", true), + peg$c111 = function(c) { + return { type: 'class', name: c }; + }, + + peg$currPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1 }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$resultsCache = {}, + + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], p; + + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 0, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseselectors(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c0(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s1 = peg$c1(); + } + s0 = s1; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parse_() { + var s0, s1; + + var key = peg$currPos * 30 + 1, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c3); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c3); } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifierName() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 2, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c5); } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s1 = peg$c6(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebinaryOp() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 3, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c7; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c8); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c9(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s2 = peg$c10; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c11); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c12(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c13; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c14); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s1 = peg$c15(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c3); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s1 = peg$c16(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselectors() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 30 + 4, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseselector(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + s1 = peg$c19(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 5, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsesequence(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + s1 = peg$c20(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesequence() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 6, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseatom(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseatom(); + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseatom() { + var s0; + + var key = peg$currPos * 30 + 7, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parsewildcard(); + if (s0 === peg$FAILED) { + s0 = peg$parseidentifier(); + if (s0 === peg$FAILED) { + s0 = peg$parseattr(); + if (s0 === peg$FAILED) { + s0 = peg$parsefield(); + if (s0 === peg$FAILED) { + s0 = peg$parsenegation(); + if (s0 === peg$FAILED) { + s0 = peg$parsematches(); + if (s0 === peg$FAILED) { + s0 = peg$parsehas(); + if (s0 === peg$FAILED) { + s0 = peg$parsefirstChild(); + if (s0 === peg$FAILED) { + s0 = peg$parselastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthLastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parseclass(); + } + } + } + } + } + } + } + } + } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsewildcard() { + var s0, s1; + + var key = peg$currPos * 30 + 8, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c25); } + } + if (s1 !== peg$FAILED) { + s1 = peg$c26(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 9, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c28); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattr() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 10, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c30; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c31); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrValue(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c33); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c34(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrOps() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 11, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c36); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c38); } + } + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + if (peg$c40.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + { peg$fail(peg$c41); } + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrEqOps() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 12, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c38); } + } + if (s2 !== peg$FAILED) { + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrName() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 13, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseidentifierName(); + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c42; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c43); } + } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseidentifierName(); + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c42; + peg$currPos++; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c43); } + } + } + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + s1 = peg$c6(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrValue() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 14, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrEqOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsetype(); + if (s5 === peg$FAILED) { + s5 = peg$parseregex(); + } + if (s5 !== peg$FAILED) { + s1 = peg$c44(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsestring(); + if (s5 === peg$FAILED) { + s5 = peg$parsenumber(); + if (s5 === peg$FAILED) { + s5 = peg$parsepath(); + } + } + if (s5 !== peg$FAILED) { + s1 = peg$c44(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s1 = peg$c45(s1); + } + s0 = s1; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsestring() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 15, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c46; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c47); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c48.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c49); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c48.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c49); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c46; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c47); } + } + if (s3 !== peg$FAILED) { + s1 = peg$c54(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c55; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c56); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c57.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c58); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c57.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c58); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c51); } + } + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c55; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c56); } + } + if (s3 !== peg$FAILED) { + s1 = peg$c54(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 16, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s1 = peg$c61(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsepath() { + var s0, s1; + + var key = peg$currPos * 30 + 17, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + if (s1 !== peg$FAILED) { + s1 = peg$c62(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetype() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 18, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c63) { + s1 = peg$c63; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c64); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c65.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c66); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c65.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c66); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c69(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseflags() { + var s0, s1; + + var key = peg$currPos * 30 + 19, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (peg$c70.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c71); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c70.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c71); } + } + } + } else { + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseregex() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 30 + 20, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c72; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c73); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c74.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c75); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c74.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c75); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s3 = peg$c72; + peg$currPos++; + } else { + s3 = peg$FAILED; + { peg$fail(peg$c73); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseflags(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + s1 = peg$c76(s2, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefield() { + var s0, s1, s2, s3, s4, s5, s6; + + var key = peg$currPos * 30 + 21, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + s1 = peg$c77(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenegation() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 22, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c78) { + s1 = peg$c78; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c79); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c80(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsematches() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 23, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c81) { + s1 = peg$c81; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c82); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c83(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsehas() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 24, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c84) { + s1 = peg$c84; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c85); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c86(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefirstChild() { + var s0, s1; + + var key = peg$currPos * 30 + 25, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12) === peg$c87) { + s1 = peg$c87; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c88); } + } + if (s1 !== peg$FAILED) { + s1 = peg$c89(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parselastChild() { + var s0, s1; + + var key = peg$currPos * 30 + 26, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c90) { + s1 = peg$c90; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c91); } + } + if (s1 !== peg$FAILED) { + s1 = peg$c92(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 27, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c93) { + s1 = peg$c93; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c94); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c95(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthLastChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 28, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 16) === peg$c96) { + s1 = peg$c96; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c97); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + { peg$fail(peg$c60); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + s1 = peg$c98(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseclass() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 29, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c99; + peg$currPos++; + } else { + s1 = peg$FAILED; + { peg$fail(peg$c100); } + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c101) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c102); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c103) { + s2 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c104); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c105) { + s2 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c106); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c107) { + s2 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c108); } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c109) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } else { + s2 = peg$FAILED; + { peg$fail(peg$c110); } + } + } + } + } + } + if (s2 !== peg$FAILED) { + s1 = peg$c111(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + + function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; } + function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; } + function strUnescape(s) { + return s.replace(/\\(.)/g, function(match, ch) { + switch(ch) { + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + default: return ch; + } + }); + } + + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse + }; + }); + }); + + /* vim: set sw=4 sts=4 : */ + + /** + * @typedef {"LEFT_SIDE"|"RIGHT_SIDE"} Side + */ + + const LEFT_SIDE = 'LEFT_SIDE'; + const RIGHT_SIDE = 'RIGHT_SIDE'; + + /** + * @external AST + * @see https://esprima.readthedocs.io/en/latest/syntax-tree-format.html + */ + + /** + * One of the rules of `grammar.pegjs` + * @typedef {PlainObject} SelectorAST + * @see grammar.pegjs + */ + + /** + * The `sequence` production of `grammar.pegjs` + * @typedef {PlainObject} SelectorSequenceAST + */ + + /** + * Get the value of a property which may be multiple levels down + * in the object. + * @param {?PlainObject} obj + * @param {string} key + * @returns {undefined|boolean|string|number|external:AST} + */ + function getPath(obj, key) { + const keys = key.split('.'); + for (let i = 0; i < keys.length; i++) { + if (obj == null) { return obj; } + obj = obj[keys[i]]; + } + return obj; + } + + /** + * Determine whether `node` can be reached by following `path`, + * starting at `ancestor`. + * @param {?external:AST} node + * @param {?external:AST} ancestor + * @param {string[]} path + * @returns {boolean} + */ + function inPath(node, ancestor, path) { + if (path.length === 0) { return node === ancestor; } + if (ancestor == null) { return false; } + const field = ancestor[path[0]]; + const remainingPath = path.slice(1); + if (Array.isArray(field)) { + for (let i = 0, l = field.length; i < l; ++i) { + if (inPath(node, field[i], remainingPath)) { return true; } + } + return false; + } else { + return inPath(node, field, remainingPath); + } + } + + /** + * Given a `node` and its ancestors, determine if `node` is matched + * by `selector`. + * @param {?external:AST} node + * @param {?SelectorAST} selector + * @param {external:AST[]} [ancestry=[]] + * @throws {Error} Unknowns (operator, class name, selector type, or + * selector value type) + * @returns {boolean} + */ + function matches(node, selector, ancestry) { + if (!selector) { return true; } + if (!node) { return false; } + if (!ancestry) { ancestry = []; } + + switch(selector.type) { + case 'wildcard': + return true; + + case 'identifier': + return selector.value.toLowerCase() === node.type.toLowerCase(); + + case 'field': { + const path = selector.name.split('.'); + const ancestor = ancestry[path.length - 1]; + return inPath(node, ancestor, path); + + } + case 'matches': + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + if (matches(node, selector.selectors[i], ancestry)) { return true; } + } + return false; + + case 'compound': + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + if (!matches(node, selector.selectors[i], ancestry)) { return false; } + } + return true; + + case 'not': + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + if (matches(node, selector.selectors[i], ancestry)) { return false; } + } + return true; + + case 'has': { + const collector = []; + for (let i = 0, l = selector.selectors.length; i < l; ++i) { + const a = []; + estraverse.traverse(node, { + enter (node, parent) { + if (parent != null) { a.unshift(parent); } + if (matches(node, selector.selectors[i], a)) { + collector.push(node); + } + }, + leave () { a.shift(); }, + fallback: 'iteration' + }); + } + return collector.length !== 0; + + } + case 'child': + if (matches(node, selector.right, ancestry)) { + return matches(ancestry[0], selector.left, ancestry.slice(1)); + } + return false; + + case 'descendant': + if (matches(node, selector.right, ancestry)) { + for (let i = 0, l = ancestry.length; i < l; ++i) { + if (matches(ancestry[i], selector.left, ancestry.slice(i + 1))) { + return true; + } + } + } + return false; + + case 'attribute': { + const p = getPath(node, selector.name); + switch (selector.operator) { + case void 0: + return p != null; + case '=': + switch (selector.value.type) { + case 'regexp': return typeof p === 'string' && selector.value.value.test(p); + case 'literal': return `${selector.value.value}` === `${p}`; + case 'type': return selector.value.value === typeof p; + } + throw new Error(`Unknown selector value type: ${selector.value.type}`); + case '!=': + switch (selector.value.type) { + case 'regexp': return !selector.value.value.test(p); + case 'literal': return `${selector.value.value}` !== `${p}`; + case 'type': return selector.value.value !== typeof p; + } + throw new Error(`Unknown selector value type: ${selector.value.type}`); + case '<=': return p <= selector.value.value; + case '<': return p < selector.value.value; + case '>': return p > selector.value.value; + case '>=': return p >= selector.value.value; + } + throw new Error(`Unknown operator: ${selector.operator}`); + } + case 'sibling': + return matches(node, selector.right, ancestry) && + sibling(node, selector.left, ancestry, LEFT_SIDE) || + selector.left.subject && + matches(node, selector.left, ancestry) && + sibling(node, selector.right, ancestry, RIGHT_SIDE); + case 'adjacent': + return matches(node, selector.right, ancestry) && + adjacent(node, selector.left, ancestry, LEFT_SIDE) || + selector.right.subject && + matches(node, selector.left, ancestry) && + adjacent(node, selector.right, ancestry, RIGHT_SIDE); + + case 'nth-child': + return matches(node, selector.right, ancestry) && + nthChild(node, ancestry, function () { + return selector.index.value - 1; + }); + + case 'nth-last-child': + return matches(node, selector.right, ancestry) && + nthChild(node, ancestry, function (length) { + return length - selector.index.value; + }); + + case 'class': + switch(selector.name.toLowerCase()){ + case 'statement': + if(node.type.slice(-9) === 'Statement') return true; + // fallthrough: interface Declaration <: Statement { } + case 'declaration': + return node.type.slice(-11) === 'Declaration'; + case 'pattern': + if(node.type.slice(-7) === 'Pattern') return true; + // fallthrough: interface Expression <: Node, Pattern { } + case 'expression': + return node.type.slice(-10) === 'Expression' || + node.type.slice(-7) === 'Literal' || + ( + node.type === 'Identifier' && + (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty') + ) || + node.type === 'MetaProperty'; + case 'function': + return node.type === 'FunctionDeclaration' || + node.type === 'FunctionExpression' || + node.type === 'ArrowFunctionExpression'; + } + throw new Error(`Unknown class name: ${selector.name}`); + } + + throw new Error(`Unknown selector type: ${selector.type}`); + } + + /** + * Determines if the given node has a sibling that matches the + * given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @returns {boolean} + */ + function sibling(node, selector, ancestry, side) { + const [parent] = ancestry; + if (!parent) { return false; } + const keys = estraverse.VisitorKeys[parent.type]; + for (let i = 0, l = keys.length; i < l; ++i) { + const listProp = parent[keys[i]]; + if (Array.isArray(listProp)) { + const startIndex = listProp.indexOf(node); + if (startIndex < 0) { continue; } + let lowerBound, upperBound; + if (side === LEFT_SIDE) { + lowerBound = 0; + upperBound = startIndex; + } else { + lowerBound = startIndex + 1; + upperBound = listProp.length; + } + for (let k = lowerBound; k < upperBound; ++k) { + if (matches(listProp[k], selector, ancestry)) { + return true; + } + } + } + } + return false; + } + + /** + * Determines if the given node has an adjacent sibling that matches + * the given selector. + * @param {external:AST} node + * @param {SelectorSequenceAST} selector + * @param {external:AST[]} ancestry + * @param {Side} side + * @returns {boolean} + */ + function adjacent(node, selector, ancestry, side) { + const [parent] = ancestry; + if (!parent) { return false; } + const keys = estraverse.VisitorKeys[parent.type]; + for (let i = 0, l = keys.length; i < l; ++i) { + const listProp = parent[keys[i]]; + if (Array.isArray(listProp)) { + const idx = listProp.indexOf(node); + if (idx < 0) { continue; } + if (side === LEFT_SIDE && idx > 0 && matches(listProp[idx - 1], selector, ancestry)) { + return true; + } + if (side === RIGHT_SIDE && idx < listProp.length - 1 && matches(listProp[idx + 1], selector, ancestry)) { + return true; + } + } + } + return false; + } + + /** + * @callback IndexFunction + * @param {Integer} len Containing list's length + * @returns {Integer} + */ + + /** + * Determines if the given node is the nth child, determined by + * `idxFn`, which is given the containing list's length. + * @param {external:AST} node + * @param {external:AST[]} ancestry + * @param {IndexFunction} idxFn + * @returns {boolean} + */ + function nthChild(node, ancestry, idxFn) { + const [parent] = ancestry; + if (!parent) { return false; } + const keys = estraverse.VisitorKeys[parent.type]; + for (let i = 0, l = keys.length; i < l; ++i) { + const listProp = parent[keys[i]]; + if (Array.isArray(listProp)) { + const idx = listProp.indexOf(node); + if (idx >= 0 && idx === idxFn(listProp.length)) { return true; } + } + } + return false; + } + + /** + * For each selector node marked as a subject, find the portion of the + * selector that the subject must match. + * @param {SelectorAST} selector + * @param {SelectorAST} [ancestor] Defaults to `selector` + * @returns {SelectorAST[]} + */ + function subjects(selector, ancestor) { + if (selector == null || typeof selector != 'object') { return []; } + if (ancestor == null) { ancestor = selector; } + const results = selector.subject ? [ancestor] : []; + for (const [p, sel] of Object.entries(selector)) { + results.push(...subjects(sel, p === 'left' ? sel : ancestor)); + } + return results; + } + + /** + * From a JS AST and a selector AST, collect all JS AST nodes that + * match the selector. + * @param {external:AST} ast + * @param {?SelectorAST} selector + * @returns {external:AST[]} + */ + function match(ast, selector) { + const ancestry = [], results = []; + if (!selector) { return results; } + const altSubjects = subjects(selector); + estraverse.traverse(ast, { + enter (node, parent) { + if (parent != null) { ancestry.unshift(parent); } + if (matches(node, selector, ancestry)) { + if (altSubjects.length) { + for (let i = 0, l = altSubjects.length; i < l; ++i) { + if (matches(node, altSubjects[i], ancestry)) { results.push(node); } + for (let k = 0, m = ancestry.length; k < m; ++k) { + if (matches(ancestry[k], altSubjects[i], ancestry.slice(k + 1))) { + results.push(ancestry[k]); + } + } + } + } else { + results.push(node); + } + } + }, + leave () { ancestry.shift(); }, + fallback: 'iteration' + }); + return results; + } + + /** + * Parse a selector string and return its AST. + * @param {string} selector + * @returns {SelectorAST} + */ + function parse(selector) { + return parser.parse(selector); + } + + /** + * Query the code AST using the selector string. + * @param {external:AST} ast + * @param {string} selector + * @returns {external:AST[]} + */ + function query(ast, selector) { + return match(ast, parse(selector)); + } + + query.parse = parse; + query.match = match; + query.matches = matches; + query.query = query; + + return query; + +}))); diff --git a/tools/node_modules/eslint/node_modules/esquery/dist/esquery.min.js b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.min.js new file mode 100644 index 00000000000000..eb2665517ea280 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/esquery/dist/esquery.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).esquery=t()}(this,(function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e((function(e,t){!function e(t){var r,n,s,o,a,i;function l(e){var t,r,n={};for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r&&null!==r?l(r):r);return n}function u(e,t){this.parent=e,this.key=t}function c(e,t,r,n){this.node=e,this.path=t,this.wrap=r,this.ref=n}function p(){}function f(e){return null!=e&&("object"==typeof e&&"string"==typeof e.type)}function h(e,t){return(e===r.ObjectExpression||e===r.ObjectPattern)&&"properties"===t}function d(e,t){return(new p).traverse(e,t)}function x(e,t){var r;return r=function(e,t){var r,n,s,o;for(n=e.length,s=0;n;)t(e[o=s+(r=n>>>1)])?n=r:(s=o+1,n-=r+1);return s}(t,(function(t){return t.range[0]>e.range[0]})),e.extendedRange=[e.range[0],e.range[1]],r!==t.length&&(e.extendedRange[1]=t[r].range[0]),(r-=1)>=0&&(e.extendedRange[0]=t[r].range[1]),e}return r={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},s={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},n={Break:o={},Skip:a={},Remove:i={}},u.prototype.replace=function(e){this.parent[this.key]=e},u.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)},p.prototype.path=function(){var e,t,r,n,s;function o(e,t){if(Array.isArray(t))for(r=0,n=t.length;r=0;)if(y=i[p=m[d]])if(Array.isArray(y)){for(x=y.length;(x-=1)>=0;)if(y[x]){if(h(l,m[d]))s=new c(y[x],[p,x],"Property",null);else{if(!f(y[x]))continue;s=new c(y[x],[p,x],null,null)}r.push(s)}}else f(y)&&r.push(new c(y,p,null,null))}}else if(s=n.pop(),u=this.__execute(t.leave,s),this.__state===o||u===o)return},p.prototype.replace=function(e,t){var r,n,s,l,p,d,x,m,y,g,v,A,E;function _(e){var t,n,s,o;if(e.ref.remove())for(n=e.ref.key,o=e.ref.parent,t=r.length;t--;)if((s=r[t]).ref&&s.ref.parent===o){if(s.ref.key=0;)if(g=s[E=y[x]])if(Array.isArray(g)){for(m=g.length;(m-=1)>=0;)if(g[m]){if(h(l,y[x]))d=new c(g[m],[E,m],"Property",new u(g,m));else{if(!f(g[m]))continue;d=new c(g[m],[E,m],null,new u(g,m))}r.push(d)}}else f(g)&&r.push(new c(g,E,null,new u(s,E)))}}else if(d=n.pop(),void 0!==(p=this.__execute(t.leave,d))&&p!==o&&p!==a&&p!==i&&d.ref.replace(p),this.__state!==i&&p!==i||_(d),this.__state===o||p===o)return A.root;return A.root},t.Syntax=r,t.traverse=d,t.replace=function(e,t){return(new p).replace(e,t)},t.attachComments=function(e,t,r){var s,o,a,i,u=[];if(!e.range)throw new Error("attachComments needs range information");if(!r.length){if(t.length){for(a=0,o=t.length;ae.range[0]);)t.extendedRange[1]===e.range[0]?(e.leadingComments||(e.leadingComments=[]),e.leadingComments.push(t),u.splice(i,1)):i+=1;return i===u.length?n.Break:u[i].extendedRange[0]>e.range[1]?n.Skip:void 0}}),i=0,d(e,{leave:function(e){for(var t;ie.range[1]?n.Skip:void 0}}),e},t.VisitorKeys=s,t.VisitorOption=n,t.Controller=p,t.cloneEnvironment=function(){return e({})},t}(t)})),r=e((function(e){e.exports&&(e.exports=function(){function e(t,r,n,s){this.message=t,this.expected=r,this.found=n,this.location=s,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(e,Error),e.buildMessage=function(e,t){var r={literal:function(e){return'"'+s(e.text)+'"'},class:function(e){var t,r="";for(t=0;t0){for(t=1,n=1;t<~+.]/,f=ye([" ","[","]",",","(",")",":","#","!","=",">","<","~","+","."],!0,!1),h=function(e){return e.join("")},d=me(">",!1),x=me("~",!1),m=me("+",!1),y=me(",",!1),g=me("!",!1),v=me("*",!1),A=me("#",!1),E=me("[",!1),_=me("]",!1),b=/^[>","<","!"],!1,!1),C=me("=",!1),w=function(e){return(e||"")+"="},P=/^[><]/,k=ye([">","<"],!1,!1),D=me(".",!1),I=function(e,t,r){return{type:"attribute",name:e,operator:t,value:r}},j=me('"',!1),F=/^[^\\"]/,T=ye(["\\",'"'],!0,!1),L=me("\\",!1),R={type:"any"},O=function(e,t){return e+t},B=function(e){return{type:"literal",value:(t=e.join(""),t.replace(/\\(.)/g,(function(e,t){switch(t){case"b":return"\b";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";default:return t}})))};var t},M=me("'",!1),U=/^[^\\']/,V=ye(["\\","'"],!0,!1),q=/^[0-9]/,N=ye([["0","9"]],!1,!1),W=me("type(",!1),$=/^[^ )]/,G=ye([" ",")"],!0,!1),z=me(")",!1),K=/^[imsu]/,H=ye(["i","m","s","u"],!1,!1),Y=me("/",!1),J=/^[^\/]/,Q=ye(["/"],!0,!1),X=me(":not(",!1),Z=me(":matches(",!1),ee=me(":has(",!1),te=me(":first-child",!1),re=me(":last-child",!1),ne=me(":nth-child(",!1),se=me(":nth-last-child(",!1),oe=me(":",!1),ae=me("statement",!0),ie=me("expression",!0),le=me("declaration",!0),ue=me("function",!0),ce=me("pattern",!0),pe=0,fe=[{line:1,column:1}],he=0,de=[],xe={};if("startRule"in r){if(!(r.startRule in l))throw new Error("Can't start parsing from rule \""+r.startRule+'".');u=l[r.startRule]}function me(e,t){return{type:"literal",text:e,ignoreCase:t}}function ye(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function ge(e){var r,n=fe[e];if(n)return n;for(r=e-1;!fe[r];)r--;for(n={line:(n=fe[r]).line,column:n.column};rhe&&(he=pe,de=[]),de.push(e))}function Ee(){var e,t,r,n,s=30*pe+0,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,(t=_e())!==i&&(r=Ce())!==i&&_e()!==i?e=t=1===(n=r).length?n[0]:{type:"matches",selectors:n}:(pe=e,e=i),e===i&&(e=pe,(t=_e())!==i&&(t=void 0),e=t),xe[s]={nextPos:pe,result:e},e)}function _e(){var e,r,n=30*pe+1,s=xe[n];if(s)return pe=s.nextPos,s.result;for(e=[],32===t.charCodeAt(pe)?(r=" ",pe++):(r=i,Ae(c));r!==i;)e.push(r),32===t.charCodeAt(pe)?(r=" ",pe++):(r=i,Ae(c));return xe[n]={nextPos:pe,result:e},e}function be(){var e,r,n,s=30*pe+2,o=xe[s];if(o)return pe=o.nextPos,o.result;if(r=[],p.test(t.charAt(pe))?(n=t.charAt(pe),pe++):(n=i,Ae(f)),n!==i)for(;n!==i;)r.push(n),p.test(t.charAt(pe))?(n=t.charAt(pe),pe++):(n=i,Ae(f));else r=i;return r!==i&&(r=h(r)),e=r,xe[s]={nextPos:pe,result:e},e}function Se(){var e,r,n,s=30*pe+3,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,(r=_e())!==i?(62===t.charCodeAt(pe)?(n=">",pe++):(n=i,Ae(d)),n!==i&&_e()!==i?e=r="child":(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=_e())!==i?(126===t.charCodeAt(pe)?(n="~",pe++):(n=i,Ae(x)),n!==i&&_e()!==i?e=r="sibling":(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=_e())!==i?(43===t.charCodeAt(pe)?(n="+",pe++):(n=i,Ae(m)),n!==i&&_e()!==i?e=r="adjacent":(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,32===t.charCodeAt(pe)?(r=" ",pe++):(r=i,Ae(c)),r!==i&&(n=_e())!==i?e=r="descendant":(pe=e,e=i)))),xe[s]={nextPos:pe,result:e},e)}function Ce(){var e,r,n,s,o,a,l,u,c=30*pe+4,p=xe[c];if(p)return pe=p.nextPos,p.result;if(e=pe,(r=we())!==i){for(n=[],s=pe,(o=_e())!==i?(44===t.charCodeAt(pe)?(a=",",pe++):(a=i,Ae(y)),a!==i&&(l=_e())!==i&&(u=we())!==i?s=o=[o,a,l,u]:(pe=s,s=i)):(pe=s,s=i);s!==i;)n.push(s),s=pe,(o=_e())!==i?(44===t.charCodeAt(pe)?(a=",",pe++):(a=i,Ae(y)),a!==i&&(l=_e())!==i&&(u=we())!==i?s=o=[o,a,l,u]:(pe=s,s=i)):(pe=s,s=i);n!==i?e=r=[r].concat(n.map((function(e){return e[3]}))):(pe=e,e=i)}else pe=e,e=i;return xe[c]={nextPos:pe,result:e},e}function we(){var e,t,r,n,s,o,a,l=30*pe+5,u=xe[l];if(u)return pe=u.nextPos,u.result;if(e=pe,(t=Pe())!==i){for(r=[],n=pe,(s=Se())!==i&&(o=Pe())!==i?n=s=[s,o]:(pe=n,n=i);n!==i;)r.push(n),n=pe,(s=Se())!==i&&(o=Pe())!==i?n=s=[s,o]:(pe=n,n=i);r!==i?(a=t,e=t=r.reduce((function(e,t){return{type:t[0],left:e,right:t[1]}}),a)):(pe=e,e=i)}else pe=e,e=i;return xe[l]={nextPos:pe,result:e},e}function Pe(){var e,r,n,s,o=30*pe+6,a=xe[o];if(a)return pe=a.nextPos,a.result;if(e=pe,33===t.charCodeAt(pe)?(r="!",pe++):(r=i,Ae(g)),r===i&&(r=null),r!==i){if(n=[],(s=ke())!==i)for(;s!==i;)n.push(s),s=ke();else n=i;n!==i?e=r=function(e,t){const r=1===t.length?t[0]:{type:"compound",selectors:t};return e&&(r.subject=!0),r}(r,n):(pe=e,e=i)}else pe=e,e=i;return xe[o]={nextPos:pe,result:e},e}function ke(){var e,r=30*pe+7,n=xe[r];return n?(pe=n.nextPos,n.result):((e=function(){var e,r,n=30*pe+8,s=xe[n];return s?(pe=s.nextPos,s.result):(42===t.charCodeAt(pe)?(r="*",pe++):(r=i,Ae(v)),r!==i&&(r={type:"wildcard",value:r}),e=r,xe[n]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s=30*pe+9,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,35===t.charCodeAt(pe)?(r="#",pe++):(r=i,Ae(A)),r===i&&(r=null),r!==i&&(n=be())!==i?e=r={type:"identifier",value:n}:(pe=e,e=i),xe[s]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o=30*pe+10,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,91===t.charCodeAt(pe)?(r="[",pe++):(r=i,Ae(E)),r!==i&&_e()!==i&&(n=function(){var e,r,n,s,o=30*pe+14,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,(r=De())!==i&&_e()!==i&&(n=function(){var e,r,n,s=30*pe+12,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,33===t.charCodeAt(pe)?(r="!",pe++):(r=i,Ae(g)),r===i&&(r=null),r!==i?(61===t.charCodeAt(pe)?(n="=",pe++):(n=i,Ae(C)),n!==i?(r=w(r),e=r):(pe=e,e=i)):(pe=e,e=i),xe[s]={nextPos:pe,result:e},e)}())!==i&&_e()!==i?((s=function(){var e,r,n,s,o,a=30*pe+18,l=xe[a];if(l)return pe=l.nextPos,l.result;if(e=pe,"type("===t.substr(pe,5)?(r="type(",pe+=5):(r=i,Ae(W)),r!==i)if(_e()!==i){if(n=[],$.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(G)),s!==i)for(;s!==i;)n.push(s),$.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(G));else n=i;n!==i&&(s=_e())!==i?(41===t.charCodeAt(pe)?(o=")",pe++):(o=i,Ae(z)),o!==i?(r={type:"type",value:n.join("")},e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[a]={nextPos:pe,result:e},e}())===i&&(s=function(){var e,r,n,s,o,a,l=30*pe+20,u=xe[l];if(u)return pe=u.nextPos,u.result;if(e=pe,47===t.charCodeAt(pe)?(r="/",pe++):(r=i,Ae(Y)),r!==i){if(n=[],J.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(Q)),s!==i)for(;s!==i;)n.push(s),J.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(Q));else n=i;n!==i?(47===t.charCodeAt(pe)?(s="/",pe++):(s=i,Ae(Y)),s!==i?((o=function(){var e,r,n=30*pe+19,s=xe[n];if(s)return pe=s.nextPos,s.result;if(e=[],K.test(t.charAt(pe))?(r=t.charAt(pe),pe++):(r=i,Ae(H)),r!==i)for(;r!==i;)e.push(r),K.test(t.charAt(pe))?(r=t.charAt(pe),pe++):(r=i,Ae(H));else e=i;return xe[n]={nextPos:pe,result:e},e}())===i&&(o=null),o!==i?(a=o,r={type:"regexp",value:new RegExp(n.join(""),a?a.join(""):"")},e=r):(pe=e,e=i)):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;return xe[l]={nextPos:pe,result:e},e}()),s!==i?(r=I(r,n,s),e=r):(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=De())!==i&&_e()!==i&&(n=function(){var e,r,n,s=30*pe+11,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,b.test(t.charAt(pe))?(r=t.charAt(pe),pe++):(r=i,Ae(S)),r===i&&(r=null),r!==i?(61===t.charCodeAt(pe)?(n="=",pe++):(n=i,Ae(C)),n!==i?(r=w(r),e=r):(pe=e,e=i)):(pe=e,e=i),e===i&&(P.test(t.charAt(pe))?(e=t.charAt(pe),pe++):(e=i,Ae(k))),xe[s]={nextPos:pe,result:e},e)}())!==i&&_e()!==i?((s=function(){var e,r,n,s,o,a,l=30*pe+15,u=xe[l];if(u)return pe=u.nextPos,u.result;if(e=pe,34===t.charCodeAt(pe)?(r='"',pe++):(r=i,Ae(j)),r!==i){for(n=[],F.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(T)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));s!==i;)n.push(s),F.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(T)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));n!==i?(34===t.charCodeAt(pe)?(s='"',pe++):(s=i,Ae(j)),s!==i?(r=B(n),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;if(e===i)if(e=pe,39===t.charCodeAt(pe)?(r="'",pe++):(r=i,Ae(M)),r!==i){for(n=[],U.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(V)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));s!==i;)n.push(s),U.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(V)),s===i&&(s=pe,92===t.charCodeAt(pe)?(o="\\",pe++):(o=i,Ae(L)),o!==i?(t.length>pe?(a=t.charAt(pe),pe++):(a=i,Ae(R)),a!==i?(o=O(o,a),s=o):(pe=s,s=i)):(pe=s,s=i));n!==i?(39===t.charCodeAt(pe)?(s="'",pe++):(s=i,Ae(M)),s!==i?(r=B(n),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;return xe[l]={nextPos:pe,result:e},e}())===i&&(s=function(){var e,r,n,s,o=30*pe+16,a=xe[o];if(a)return pe=a.nextPos,a.result;for(e=pe,r=pe,n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));if(n!==i?(46===t.charCodeAt(pe)?(s=".",pe++):(s=i,Ae(D)),s!==i?r=n=[n,s]:(pe=r,r=i)):(pe=r,r=i),r===i&&(r=null),r!==i){if(n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N)),s!==i)for(;s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));else n=i;n!==i?(r=function(e,t){const r=e?[].concat.apply([],e).join(""):"";return{type:"literal",value:parseFloat(r+t.join(""))}}(r,n),e=r):(pe=e,e=i)}else pe=e,e=i;return xe[o]={nextPos:pe,result:e},e}())===i&&(s=function(){var e,t,r=30*pe+17,n=xe[r];return n?(pe=n.nextPos,n.result):((t=be())!==i&&(t={type:"literal",value:t}),e=t,xe[r]={nextPos:pe,result:e},e)}()),s!==i?(r=I(r,n,s),e=r):(pe=e,e=i)):(pe=e,e=i),e===i&&(e=pe,(r=De())!==i&&(r={type:"attribute",name:r}),e=r)),xe[o]={nextPos:pe,result:e},e)}())!==i&&_e()!==i?(93===t.charCodeAt(pe)?(s="]",pe++):(s=i,Ae(_)),s!==i?e=r=n:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o,a,l,u,c=30*pe+21,p=xe[c];if(p)return pe=p.nextPos,p.result;if(e=pe,46===t.charCodeAt(pe)?(r=".",pe++):(r=i,Ae(D)),r!==i)if((n=be())!==i){for(s=[],o=pe,46===t.charCodeAt(pe)?(a=".",pe++):(a=i,Ae(D)),a!==i&&(l=be())!==i?o=a=[a,l]:(pe=o,o=i);o!==i;)s.push(o),o=pe,46===t.charCodeAt(pe)?(a=".",pe++):(a=i,Ae(D)),a!==i&&(l=be())!==i?o=a=[a,l]:(pe=o,o=i);s!==i?(u=n,r={type:"field",name:s.reduce((function(e,t){return e+t[0]+t[1]}),u)},e=r):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[c]={nextPos:pe,result:e},e}())===i&&(e=function(){var e,r,n,s,o=30*pe+22,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,":not("===t.substr(pe,5)?(r=":not(",pe+=5):(r=i,Ae(X)),r!==i&&_e()!==i&&(n=Ce())!==i&&_e()!==i?(41===t.charCodeAt(pe)?(s=")",pe++):(s=i,Ae(z)),s!==i?e=r={type:"not",selectors:n}:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o=30*pe+23,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,":matches("===t.substr(pe,9)?(r=":matches(",pe+=9):(r=i,Ae(Z)),r!==i&&_e()!==i&&(n=Ce())!==i&&_e()!==i?(41===t.charCodeAt(pe)?(s=")",pe++):(s=i,Ae(z)),s!==i?e=r={type:"matches",selectors:n}:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o=30*pe+24,a=xe[o];return a?(pe=a.nextPos,a.result):(e=pe,":has("===t.substr(pe,5)?(r=":has(",pe+=5):(r=i,Ae(ee)),r!==i&&_e()!==i&&(n=Ce())!==i&&_e()!==i?(41===t.charCodeAt(pe)?(s=")",pe++):(s=i,Ae(z)),s!==i?e=r={type:"has",selectors:n}:(pe=e,e=i)):(pe=e,e=i),xe[o]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n=30*pe+25,s=xe[n];return s?(pe=s.nextPos,s.result):(":first-child"===t.substr(pe,12)?(r=":first-child",pe+=12):(r=i,Ae(te)),r!==i&&(r=Ie(1)),e=r,xe[n]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n=30*pe+26,s=xe[n];return s?(pe=s.nextPos,s.result):(":last-child"===t.substr(pe,11)?(r=":last-child",pe+=11):(r=i,Ae(re)),r!==i&&(r=je(1)),e=r,xe[n]={nextPos:pe,result:e},e)}())===i&&(e=function(){var e,r,n,s,o,a=30*pe+27,l=xe[a];if(l)return pe=l.nextPos,l.result;if(e=pe,":nth-child("===t.substr(pe,11)?(r=":nth-child(",pe+=11):(r=i,Ae(ne)),r!==i)if(_e()!==i){if(n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N)),s!==i)for(;s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));else n=i;n!==i&&(s=_e())!==i?(41===t.charCodeAt(pe)?(o=")",pe++):(o=i,Ae(z)),o!==i?(r=Ie(parseInt(n.join(""),10)),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[a]={nextPos:pe,result:e},e}())===i&&(e=function(){var e,r,n,s,o,a=30*pe+28,l=xe[a];if(l)return pe=l.nextPos,l.result;if(e=pe,":nth-last-child("===t.substr(pe,16)?(r=":nth-last-child(",pe+=16):(r=i,Ae(se)),r!==i)if(_e()!==i){if(n=[],q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N)),s!==i)for(;s!==i;)n.push(s),q.test(t.charAt(pe))?(s=t.charAt(pe),pe++):(s=i,Ae(N));else n=i;n!==i&&(s=_e())!==i?(41===t.charCodeAt(pe)?(o=")",pe++):(o=i,Ae(z)),o!==i?(r=je(parseInt(n.join(""),10)),e=r):(pe=e,e=i)):(pe=e,e=i)}else pe=e,e=i;else pe=e,e=i;return xe[a]={nextPos:pe,result:e},e}())===i&&(e=function(){var e,r,n,s=30*pe+29,o=xe[s];return o?(pe=o.nextPos,o.result):(e=pe,58===t.charCodeAt(pe)?(r=":",pe++):(r=i,Ae(oe)),r!==i?("statement"===t.substr(pe,9).toLowerCase()?(n=t.substr(pe,9),pe+=9):(n=i,Ae(ae)),n===i&&("expression"===t.substr(pe,10).toLowerCase()?(n=t.substr(pe,10),pe+=10):(n=i,Ae(ie)),n===i&&("declaration"===t.substr(pe,11).toLowerCase()?(n=t.substr(pe,11),pe+=11):(n=i,Ae(le)),n===i&&("function"===t.substr(pe,8).toLowerCase()?(n=t.substr(pe,8),pe+=8):(n=i,Ae(ue)),n===i&&("pattern"===t.substr(pe,7).toLowerCase()?(n=t.substr(pe,7),pe+=7):(n=i,Ae(ce)))))),n!==i?e=r={type:"class",name:n}:(pe=e,e=i)):(pe=e,e=i),xe[s]={nextPos:pe,result:e},e)}()),xe[r]={nextPos:pe,result:e},e)}function De(){var e,r,n,s=30*pe+13,o=xe[s];if(o)return pe=o.nextPos,o.result;if(r=[],(n=be())===i&&(46===t.charCodeAt(pe)?(n=".",pe++):(n=i,Ae(D))),n!==i)for(;n!==i;)r.push(n),(n=be())===i&&(46===t.charCodeAt(pe)?(n=".",pe++):(n=i,Ae(D)));else r=i;return r!==i&&(r=h(r)),e=r,xe[s]={nextPos:pe,result:e},e}function Ie(e){return{type:"nth-child",index:{type:"literal",value:e}}}function je(e){return{type:"nth-last-child",index:{type:"literal",value:e}}}if((n=u())!==i&&pe===t.length)return n;throw n!==i&&pe":return t>r.value.value;case">=":return t>=r.value.value}throw new Error(`Unknown operator: ${r.operator}`)}case"sibling":return n(e,r.right,i)&&s(e,r.left,i,"LEFT_SIDE")||r.left.subject&&n(e,r.left,i)&&s(e,r.right,i,"RIGHT_SIDE");case"adjacent":return n(e,r.right,i)&&o(e,r.left,i,"LEFT_SIDE")||r.right.subject&&n(e,r.left,i)&&o(e,r.right,i,"RIGHT_SIDE");case"nth-child":return n(e,r.right,i)&&a(e,i,(function(){return r.index.value-1}));case"nth-last-child":return n(e,r.right,i)&&a(e,i,(function(e){return e-r.index.value}));case"class":switch(r.name.toLowerCase()){case"statement":if("Statement"===e.type.slice(-9))return!0;case"declaration":return"Declaration"===e.type.slice(-11);case"pattern":if("Pattern"===e.type.slice(-7))return!0;case"expression":return"Expression"===e.type.slice(-10)||"Literal"===e.type.slice(-7)||"Identifier"===e.type&&(0===i.length||"MetaProperty"!==i[0].type)||"MetaProperty"===e.type;case"function":return"FunctionDeclaration"===e.type||"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type}throw new Error(`Unknown class name: ${r.name}`)}throw new Error(`Unknown selector type: ${r.type}`)}function s(e,r,s,o){const[a]=s;if(!a)return!1;const i=t.VisitorKeys[a.type];for(let t=0,l=i.length;t0&&n(l[t-1],r,s))return!0;if("RIGHT_SIDE"===o&&t=0&&t===n(r.length))return!0}}return!1}function i(e,r){const s=[],o=[];if(!r)return o;const a=function e(t,r){if(null==t||"object"!=typeof t)return[];null==r&&(r=t);const n=t.subject?[r]:[];for(const[s,o]of Object.entries(t))n.push(...e(o,"left"===s?o:r));return n}(r);return t.traverse(e,{enter(e,t){if(null!=t&&s.unshift(t),n(e,r,s))if(a.length)for(let t=0,r=a.length;t': return p > selector.value.value; - case '>=': return p >= selector.value.value; - } - - case 'sibling': - return matches(node, selector.right, ancestry) && - sibling(node, selector.left, ancestry, LEFT_SIDE) || - selector.left.subject && - matches(node, selector.left, ancestry) && - sibling(node, selector.right, ancestry, RIGHT_SIDE); - - case 'adjacent': - return matches(node, selector.right, ancestry) && - adjacent(node, selector.left, ancestry, LEFT_SIDE) || - selector.right.subject && - matches(node, selector.left, ancestry) && - adjacent(node, selector.right, ancestry, RIGHT_SIDE); - - case 'nth-child': - return matches(node, selector.right, ancestry) && - nthChild(node, ancestry, function (length) { - return selector.index.value - 1; - }); - - case 'nth-last-child': - return matches(node, selector.right, ancestry) && - nthChild(node, ancestry, function (length) { - return length - selector.index.value; - }); - - case 'class': - if(!node.type) return false; - switch(selector.name.toLowerCase()){ - case 'statement': - if(node.type.slice(-9) === 'Statement') return true; - // fallthrough: interface Declaration <: Statement { } - case 'declaration': - return node.type.slice(-11) === 'Declaration'; - case 'pattern': - if(node.type.slice(-7) === 'Pattern') return true; - // fallthrough: interface Expression <: Node, Pattern { } - case 'expression': - return node.type.slice(-10) === 'Expression' || - node.type.slice(-7) === 'Literal' || - ( - node.type === 'Identifier' && - (ancestry.length === 0 || ancestry[0].type !== 'MetaProperty') - ) || - node.type === 'MetaProperty'; - case 'function': - return node.type.slice(0, 8) === 'Function' || - node.type === 'ArrowFunctionExpression'; - } - throw new Error('Unknown class name: ' + selector.name); - } - - throw new Error('Unknown selector type: ' + selector.type); - } - - /* - * Determines if the given node has a sibling that matches the given selector. - */ - function sibling(node, selector, ancestry, side) { - var parent = ancestry[0], listProp, startIndex, keys, i, l, k, lowerBound, upperBound; - if (!parent) { return false; } - keys = estraverse.VisitorKeys[parent.type]; - for (i = 0, l = keys.length; i < l; ++i) { - listProp = parent[keys[i]]; - if (isArray(listProp)) { - startIndex = listProp.indexOf(node); - if (startIndex < 0) { continue; } - if (side === LEFT_SIDE) { - lowerBound = 0; - upperBound = startIndex; - } else { - lowerBound = startIndex + 1; - upperBound = listProp.length; - } - for (k = lowerBound; k < upperBound; ++k) { - if (matches(listProp[k], selector, ancestry)) { - return true; - } - } - } - } - return false; - } - - /* - * Determines if the given node has an adjacent sibling that matches the given selector. - */ - function adjacent(node, selector, ancestry, side) { - var parent = ancestry[0], listProp, keys, i, l, idx; - if (!parent) { return false; } - keys = estraverse.VisitorKeys[parent.type]; - for (i = 0, l = keys.length; i < l; ++i) { - listProp = parent[keys[i]]; - if (isArray(listProp)) { - idx = listProp.indexOf(node); - if (idx < 0) { continue; } - if (side === LEFT_SIDE && idx > 0 && matches(listProp[idx - 1], selector, ancestry)) { - return true; - } - if (side === RIGHT_SIDE && idx < listProp.length - 1 && matches(listProp[idx + 1], selector, ancestry)) { - return true; - } - } - } - return false; - } - - /* - * Determines if the given node is the nth child, determined by idxFn, which is given the containing list's length. - */ - function nthChild(node, ancestry, idxFn) { - var parent = ancestry[0], listProp, keys, i, l, idx; - if (!parent) { return false; } - keys = estraverse.VisitorKeys[parent.type]; - for (i = 0, l = keys.length; i < l; ++i) { - listProp = parent[keys[i]]; - if (isArray(listProp)) { - idx = listProp.indexOf(node); - if (idx >= 0 && idx === idxFn(listProp.length)) { return true; } - } - } - return false; - } - - /* - * For each selector node marked as a subject, find the portion of the selector that the subject must match. - */ - function subjects(selector, ancestor) { - var results, p; - if (selector == null || typeof selector != 'object') { return []; } - if (ancestor == null) { ancestor = selector; } - results = selector.subject ? [ancestor] : []; - for(p in selector) { - if(!{}.hasOwnProperty.call(selector, p)) { continue; } - [].push.apply(results, subjects(selector[p], p === 'left' ? selector[p] : ancestor)); - } - return results; - } - - /** - * From a JS AST and a selector AST, collect all JS AST nodes that match the selector. - */ - function match(ast, selector) { - var ancestry = [], results = [], altSubjects, i, l, k, m; - if (!selector) { return results; } - altSubjects = subjects(selector); - estraverse.traverse(ast, { - enter: function (node, parent) { - if (parent != null) { ancestry.unshift(parent); } - if (matches(node, selector, ancestry)) { - if (altSubjects.length) { - for (i = 0, l = altSubjects.length; i < l; ++i) { - if (matches(node, altSubjects[i], ancestry)) { results.push(node); } - for (k = 0, m = ancestry.length; k < m; ++k) { - if (matches(ancestry[k], altSubjects[i], ancestry.slice(k + 1))) { - results.push(ancestry[k]); - } - } - } - } else { - results.push(node); - } - } - }, - leave: function () { ancestry.shift(); }, - fallback: 'iteration' - }); - return results; - } - - /** - * Parse a selector string and return its AST. - */ - function parse(selector) { - return parser.parse(selector); - } - - /** - * Query the code AST using the selector string. - */ - function query(ast, selector) { - return match(ast, parse(selector)); - } - - query.parse = parse; - query.match = match; - query.matches = matches; - return query.query = query; - } - - - if (typeof define === "function" && define.amd) { - define(esqueryModule); - } else if (typeof module !== 'undefined' && module.exports) { - module.exports = esqueryModule(); - } else { - this.esquery = esqueryModule(); - } - -})(); diff --git a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/LICENSE.BSD b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/LICENSE.BSD new file mode 100644 index 00000000000000..3e580c355a96e5 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/LICENSE.BSD @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/README.md b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/README.md new file mode 100644 index 00000000000000..ccd3377f3e9449 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/README.md @@ -0,0 +1,153 @@ +### Estraverse [![Build Status](https://secure.travis-ci.org/estools/estraverse.svg)](http://travis-ci.org/estools/estraverse) + +Estraverse ([estraverse](http://github.com/estools/estraverse)) is +[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm) +traversal functions from [esmangle project](http://github.com/estools/esmangle). + +### Documentation + +You can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage). + +### Example Usage + +The following code will output all variables declared at the root of a file. + +```javascript +estraverse.traverse(ast, { + enter: function (node, parent) { + if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration') + return estraverse.VisitorOption.Skip; + }, + leave: function (node, parent) { + if (node.type == 'VariableDeclarator') + console.log(node.id.name); + } +}); +``` + +We can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break. + +```javascript +estraverse.traverse(ast, { + enter: function (node) { + this.break(); + } +}); +``` + +And estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it. + +```javascript +result = estraverse.replace(tree, { + enter: function (node) { + // Replace it with replaced. + if (node.type === 'Literal') + return replaced; + } +}); +``` + +By passing `visitor.keys` mapping, we can extend estraverse traversing functionality. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Extending the existing traversing rules. + keys: { + // TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ] + TestExpression: ['argument'] + } +}); +``` + +By passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Iterating the child **nodes** of unknown nodes. + fallback: 'iteration' +}); +``` + +When `visitor.fallback` is a function, we can determine which keys to visit on each node. + +```javascript +// This tree contains a user-defined `TestExpression` node. +var tree = { + type: 'TestExpression', + + // This 'argument' is the property containing the other **node**. + argument: { + type: 'Literal', + value: 20 + }, + + // This 'extended' is the property not containing the other **node**. + extended: true +}; +estraverse.traverse(tree, { + enter: function (node) { }, + + // Skip the `argument` property of each node + fallback: function(node) { + return Object.keys(node).filter(function(key) { + return key !== 'argument'; + }); + } +}); +``` + +### License + +Copyright (C) 2012-2016 [Yusuke Suzuki](http://github.com/Constellation) + (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js new file mode 100644 index 00000000000000..6e28ca02f1c848 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/estraverse.js @@ -0,0 +1,781 @@ +/* + Copyright (C) 2012-2013 Yusuke Suzuki + Copyright (C) 2012 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/*jslint vars:false, bitwise:true*/ +/*jshint indent:4*/ +/*global exports:true*/ +(function clone(exports) { + 'use strict'; + + var Syntax, + VisitorOption, + VisitorKeys, + BREAK, + SKIP, + REMOVE; + + function deepCopy(obj) { + var ret = {}, key, val; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + val = obj[key]; + if (typeof val === 'object' && val !== null) { + ret[key] = deepCopy(val); + } else { + ret[key] = val; + } + } + } + return ret; + } + + // based on LLVM libc++ upper_bound / lower_bound + // MIT License + + function upperBound(array, func) { + var diff, len, i, current; + + len = array.length; + i = 0; + + while (len) { + diff = len >>> 1; + current = i + diff; + if (func(array[current])) { + len = diff; + } else { + i = current + 1; + len -= diff + 1; + } + } + return i; + } + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + AssignmentPattern: 'AssignmentPattern', + ArrayExpression: 'ArrayExpression', + ArrayPattern: 'ArrayPattern', + ArrowFunctionExpression: 'ArrowFunctionExpression', + AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7. + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ClassBody: 'ClassBody', + ClassDeclaration: 'ClassDeclaration', + ClassExpression: 'ClassExpression', + ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7. + ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7. + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DebuggerStatement: 'DebuggerStatement', + DirectiveStatement: 'DirectiveStatement', + DoWhileStatement: 'DoWhileStatement', + EmptyStatement: 'EmptyStatement', + ExportAllDeclaration: 'ExportAllDeclaration', + ExportDefaultDeclaration: 'ExportDefaultDeclaration', + ExportNamedDeclaration: 'ExportNamedDeclaration', + ExportSpecifier: 'ExportSpecifier', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + ForOfStatement: 'ForOfStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7. + Identifier: 'Identifier', + IfStatement: 'IfStatement', + ImportExpression: 'ImportExpression', + ImportDeclaration: 'ImportDeclaration', + ImportDefaultSpecifier: 'ImportDefaultSpecifier', + ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', + ImportSpecifier: 'ImportSpecifier', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + MetaProperty: 'MetaProperty', + MethodDefinition: 'MethodDefinition', + ModuleSpecifier: 'ModuleSpecifier', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + ObjectPattern: 'ObjectPattern', + Program: 'Program', + Property: 'Property', + RestElement: 'RestElement', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SpreadElement: 'SpreadElement', + Super: 'Super', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + TaggedTemplateExpression: 'TaggedTemplateExpression', + TemplateElement: 'TemplateElement', + TemplateLiteral: 'TemplateLiteral', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement', + YieldExpression: 'YieldExpression' + }; + + VisitorKeys = { + AssignmentExpression: ['left', 'right'], + AssignmentPattern: ['left', 'right'], + ArrayExpression: ['elements'], + ArrayPattern: ['elements'], + ArrowFunctionExpression: ['params', 'body'], + AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7. + BlockStatement: ['body'], + BinaryExpression: ['left', 'right'], + BreakStatement: ['label'], + CallExpression: ['callee', 'arguments'], + CatchClause: ['param', 'body'], + ClassBody: ['body'], + ClassDeclaration: ['id', 'superClass', 'body'], + ClassExpression: ['id', 'superClass', 'body'], + ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7. + ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + ConditionalExpression: ['test', 'consequent', 'alternate'], + ContinueStatement: ['label'], + DebuggerStatement: [], + DirectiveStatement: [], + DoWhileStatement: ['body', 'test'], + EmptyStatement: [], + ExportAllDeclaration: ['source'], + ExportDefaultDeclaration: ['declaration'], + ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], + ExportSpecifier: ['exported', 'local'], + ExpressionStatement: ['expression'], + ForStatement: ['init', 'test', 'update', 'body'], + ForInStatement: ['left', 'right', 'body'], + ForOfStatement: ['left', 'right', 'body'], + FunctionDeclaration: ['id', 'params', 'body'], + FunctionExpression: ['id', 'params', 'body'], + GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7. + Identifier: [], + IfStatement: ['test', 'consequent', 'alternate'], + ImportExpression: ['source'], + ImportDeclaration: ['specifiers', 'source'], + ImportDefaultSpecifier: ['local'], + ImportNamespaceSpecifier: ['local'], + ImportSpecifier: ['imported', 'local'], + Literal: [], + LabeledStatement: ['label', 'body'], + LogicalExpression: ['left', 'right'], + MemberExpression: ['object', 'property'], + MetaProperty: ['meta', 'property'], + MethodDefinition: ['key', 'value'], + ModuleSpecifier: [], + NewExpression: ['callee', 'arguments'], + ObjectExpression: ['properties'], + ObjectPattern: ['properties'], + Program: ['body'], + Property: ['key', 'value'], + RestElement: [ 'argument' ], + ReturnStatement: ['argument'], + SequenceExpression: ['expressions'], + SpreadElement: ['argument'], + Super: [], + SwitchStatement: ['discriminant', 'cases'], + SwitchCase: ['test', 'consequent'], + TaggedTemplateExpression: ['tag', 'quasi'], + TemplateElement: [], + TemplateLiteral: ['quasis', 'expressions'], + ThisExpression: [], + ThrowStatement: ['argument'], + TryStatement: ['block', 'handler', 'finalizer'], + UnaryExpression: ['argument'], + UpdateExpression: ['argument'], + VariableDeclaration: ['declarations'], + VariableDeclarator: ['id', 'init'], + WhileStatement: ['test', 'body'], + WithStatement: ['object', 'body'], + YieldExpression: ['argument'] + }; + + // unique id + BREAK = {}; + SKIP = {}; + REMOVE = {}; + + VisitorOption = { + Break: BREAK, + Skip: SKIP, + Remove: REMOVE + }; + + function Reference(parent, key) { + this.parent = parent; + this.key = key; + } + + Reference.prototype.replace = function replace(node) { + this.parent[this.key] = node; + }; + + Reference.prototype.remove = function remove() { + if (Array.isArray(this.parent)) { + this.parent.splice(this.key, 1); + return true; + } else { + this.replace(null); + return false; + } + }; + + function Element(node, path, wrap, ref) { + this.node = node; + this.path = path; + this.wrap = wrap; + this.ref = ref; + } + + function Controller() { } + + // API: + // return property path array from root to current node + Controller.prototype.path = function path() { + var i, iz, j, jz, result, element; + + function addToPath(result, path) { + if (Array.isArray(path)) { + for (j = 0, jz = path.length; j < jz; ++j) { + result.push(path[j]); + } + } else { + result.push(path); + } + } + + // root node + if (!this.__current.path) { + return null; + } + + // first node is sentinel, second node is root element + result = []; + for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { + element = this.__leavelist[i]; + addToPath(result, element.path); + } + addToPath(result, this.__current.path); + return result; + }; + + // API: + // return type of current node + Controller.prototype.type = function () { + var node = this.current(); + return node.type || this.__current.wrap; + }; + + // API: + // return array of parent elements + Controller.prototype.parents = function parents() { + var i, iz, result; + + // first node is sentinel + result = []; + for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { + result.push(this.__leavelist[i].node); + } + + return result; + }; + + // API: + // return current node + Controller.prototype.current = function current() { + return this.__current.node; + }; + + Controller.prototype.__execute = function __execute(callback, element) { + var previous, result; + + result = undefined; + + previous = this.__current; + this.__current = element; + this.__state = null; + if (callback) { + result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); + } + this.__current = previous; + + return result; + }; + + // API: + // notify control skip / break + Controller.prototype.notify = function notify(flag) { + this.__state = flag; + }; + + // API: + // skip child nodes of current node + Controller.prototype.skip = function () { + this.notify(SKIP); + }; + + // API: + // break traversals + Controller.prototype['break'] = function () { + this.notify(BREAK); + }; + + // API: + // remove node + Controller.prototype.remove = function () { + this.notify(REMOVE); + }; + + Controller.prototype.__initialize = function(root, visitor) { + this.visitor = visitor; + this.root = root; + this.__worklist = []; + this.__leavelist = []; + this.__current = null; + this.__state = null; + this.__fallback = null; + if (visitor.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof visitor.fallback === 'function') { + this.__fallback = visitor.fallback; + } + + this.__keys = VisitorKeys; + if (visitor.keys) { + this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); + } + }; + + function isNode(node) { + if (node == null) { + return false; + } + return typeof node === 'object' && typeof node.type === 'string'; + } + + function isProperty(nodeType, key) { + return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; + } + + Controller.prototype.traverse = function traverse(root, visitor) { + var worklist, + leavelist, + element, + node, + nodeType, + ret, + key, + current, + current2, + candidates, + candidate, + sentinel; + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + worklist.push(new Element(root, null, null, null)); + leavelist.push(new Element(null, null, null, null)); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + ret = this.__execute(visitor.leave, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + continue; + } + + if (element.node) { + + ret = this.__execute(visitor.enter, element); + + if (this.__state === BREAK || ret === BREAK) { + return; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || ret === SKIP) { + continue; + } + + node = element.node; + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', null); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, null); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, null)); + } + } + } + } + }; + + Controller.prototype.replace = function replace(root, visitor) { + var worklist, + leavelist, + node, + nodeType, + target, + element, + current, + current2, + candidates, + candidate, + sentinel, + outer, + key; + + function removeElem(element) { + var i, + key, + nextElem, + parent; + + if (element.ref.remove()) { + // When the reference is an element of an array. + key = element.ref.key; + parent = element.ref.parent; + + // If removed from array, then decrease following items' keys. + i = worklist.length; + while (i--) { + nextElem = worklist[i]; + if (nextElem.ref && nextElem.ref.parent === parent) { + if (nextElem.ref.key < key) { + break; + } + --nextElem.ref.key; + } + } + } + } + + this.__initialize(root, visitor); + + sentinel = {}; + + // reference + worklist = this.__worklist; + leavelist = this.__leavelist; + + // initialize + outer = { + root: root + }; + element = new Element(root, null, null, new Reference(outer, 'root')); + worklist.push(element); + leavelist.push(element); + + while (worklist.length) { + element = worklist.pop(); + + if (element === sentinel) { + element = leavelist.pop(); + + target = this.__execute(visitor.leave, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + continue; + } + + target = this.__execute(visitor.enter, element); + + // node may be replaced with null, + // so distinguish between undefined and null in this place + if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { + // replace + element.ref.replace(target); + element.node = target; + } + + if (this.__state === REMOVE || target === REMOVE) { + removeElem(element); + element.node = null; + } + + if (this.__state === BREAK || target === BREAK) { + return outer.root; + } + + // node may be null + node = element.node; + if (!node) { + continue; + } + + worklist.push(sentinel); + leavelist.push(element); + + if (this.__state === SKIP || target === SKIP) { + continue; + } + + nodeType = node.type || element.wrap; + candidates = this.__keys[nodeType]; + if (!candidates) { + if (this.__fallback) { + candidates = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + nodeType + '.'); + } + } + + current = candidates.length; + while ((current -= 1) >= 0) { + key = candidates[current]; + candidate = node[key]; + if (!candidate) { + continue; + } + + if (Array.isArray(candidate)) { + current2 = candidate.length; + while ((current2 -= 1) >= 0) { + if (!candidate[current2]) { + continue; + } + if (isProperty(nodeType, candidates[current])) { + element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); + } else if (isNode(candidate[current2])) { + element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); + } else { + continue; + } + worklist.push(element); + } + } else if (isNode(candidate)) { + worklist.push(new Element(candidate, key, null, new Reference(node, key))); + } + } + } + + return outer.root; + }; + + function traverse(root, visitor) { + var controller = new Controller(); + return controller.traverse(root, visitor); + } + + function replace(root, visitor) { + var controller = new Controller(); + return controller.replace(root, visitor); + } + + function extendCommentRange(comment, tokens) { + var target; + + target = upperBound(tokens, function search(token) { + return token.range[0] > comment.range[0]; + }); + + comment.extendedRange = [comment.range[0], comment.range[1]]; + + if (target !== tokens.length) { + comment.extendedRange[1] = tokens[target].range[0]; + } + + target -= 1; + if (target >= 0) { + comment.extendedRange[0] = tokens[target].range[1]; + } + + return comment; + } + + function attachComments(tree, providedComments, tokens) { + // At first, we should calculate extended comment ranges. + var comments = [], comment, len, i, cursor; + + if (!tree.range) { + throw new Error('attachComments needs range information'); + } + + // tokens array is empty, we attach comments to tree as 'leadingComments' + if (!tokens.length) { + if (providedComments.length) { + for (i = 0, len = providedComments.length; i < len; i += 1) { + comment = deepCopy(providedComments[i]); + comment.extendedRange = [0, tree.range[0]]; + comments.push(comment); + } + tree.leadingComments = comments; + } + return tree; + } + + for (i = 0, len = providedComments.length; i < len; i += 1) { + comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); + } + + // This is based on John Freeman's implementation. + cursor = 0; + traverse(tree, { + enter: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (comment.extendedRange[1] > node.range[0]) { + break; + } + + if (comment.extendedRange[1] === node.range[0]) { + if (!node.leadingComments) { + node.leadingComments = []; + } + node.leadingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + cursor = 0; + traverse(tree, { + leave: function (node) { + var comment; + + while (cursor < comments.length) { + comment = comments[cursor]; + if (node.range[1] < comment.extendedRange[0]) { + break; + } + + if (node.range[1] === comment.extendedRange[0]) { + if (!node.trailingComments) { + node.trailingComments = []; + } + node.trailingComments.push(comment); + comments.splice(cursor, 1); + } else { + cursor += 1; + } + } + + // already out of owned node + if (cursor === comments.length) { + return VisitorOption.Break; + } + + if (comments[cursor].extendedRange[0] > node.range[1]) { + return VisitorOption.Skip; + } + } + }); + + return tree; + } + + exports.Syntax = Syntax; + exports.traverse = traverse; + exports.replace = replace; + exports.attachComments = attachComments; + exports.VisitorKeys = VisitorKeys; + exports.VisitorOption = VisitorOption; + exports.Controller = Controller; + exports.cloneEnvironment = function () { return clone({}); }; + + return exports; +}(exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json new file mode 100644 index 00000000000000..f4cce047d0fcff --- /dev/null +++ b/tools/node_modules/eslint/node_modules/esquery/node_modules/estraverse/package.json @@ -0,0 +1,45 @@ +{ + "bugs": { + "url": "https://github.com/estools/estraverse/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "ECMAScript JS AST traversal functions", + "devDependencies": { + "babel-preset-env": "^1.6.1", + "babel-register": "^6.3.13", + "chai": "^2.1.1", + "espree": "^1.11.0", + "gulp": "^3.8.10", + "gulp-bump": "^0.2.2", + "gulp-filter": "^2.0.0", + "gulp-git": "^1.0.1", + "gulp-tag-version": "^1.3.0", + "jshint": "^2.5.6", + "mocha": "^2.1.0" + }, + "engines": { + "node": ">=4.0" + }, + "homepage": "https://github.com/estools/estraverse", + "license": "BSD-2-Clause", + "main": "estraverse.js", + "maintainers": [ + { + "name": "Yusuke Suzuki", + "email": "utatane.tea@gmail.com", + "url": "http://github.com/Constellation" + } + ], + "name": "estraverse", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/estools/estraverse.git" + }, + "scripts": { + "lint": "jshint estraverse.js", + "test": "npm run-script lint && npm run-script unit-test", + "unit-test": "mocha --compilers js:babel-register" + }, + "version": "5.0.0" +} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/esquery/package.json b/tools/node_modules/eslint/node_modules/esquery/package.json index 0c7beea2c592e9..8d19ba044293b0 100644 --- a/tools/node_modules/eslint/node_modules/esquery/package.json +++ b/tools/node_modules/eslint/node_modules/esquery/package.json @@ -4,30 +4,40 @@ "email": "jrfeenst+esquery@gmail.com" }, "bugs": { - "url": "https://github.com/jrfeenst/esquery/issues" + "url": "https://github.com/estools/esquery/issues" }, "bundleDependencies": false, + "contributors": [], "dependencies": { - "estraverse": "^4.0.0" + "estraverse": "^5.0.0" }, "deprecated": false, "description": "A query library for ECMAScript AST using a CSS selector like query language.", "devDependencies": { - "commonjs-everywhere": "~0.9.4", - "esprima": "~1.1.1", - "jstestr": ">=0.4", - "pegjs": "~0.7.0" + "@rollup/plugin-commonjs": "^11.0.2", + "@rollup/plugin-json": "^4.0.2", + "@rollup/plugin-node-resolve": "^7.1.1", + "chai": "^4.2.0", + "eslint": "^6.8.0", + "esm": "^3.2.25", + "esprima": "~4.0.1", + "mocha": "^7.1.1", + "nyc": "^15.0.0", + "pegjs": "~0.10.0", + "rollup": "^1.32.0", + "rollup-plugin-terser": "^5.2.0" }, "engines": { - "node": ">=0.6" + "node": ">=8.0" }, "files": [ - "esquery.js", + "dist/*.js", + "dist/*.map", "parser.js", "license.txt", "README.md" ], - "homepage": "https://github.com/jrfeenst/esquery#readme", + "homepage": "https://github.com/estools/esquery/", "keywords": [ "ast", "ecmascript", @@ -35,15 +45,37 @@ "query" ], "license": "BSD-3-Clause", - "main": "esquery.js", + "main": "dist/esquery.min.js", + "module": "dist/esquery.esm.min.js", "name": "esquery", - "preferGlobal": false, + "nyc": { + "branches": 100, + "lines": 100, + "functions": 100, + "statements": 100, + "reporter": [ + "html", + "text" + ], + "exclude": [ + "parser.js", + "dist", + "tests" + ] + }, "repository": { "type": "git", - "url": "git+https://github.com/jrfeenst/esquery.git" + "url": "git+https://github.com/estools/esquery.git" }, "scripts": { - "test": "node node_modules/jstestr/bin/jstestr.js path=tests" + "build": "npm run build:parser && npm run build:browser", + "build:browser": "rollup -c", + "build:parser": "rm parser.js && pegjs --cache --format umd -o \"parser.js\" \"grammar.pegjs\"", + "lint": "eslint .", + "mocha": "mocha --require chai/register-assert --require esm tests", + "prepublishOnly": "npm run build && npm test", + "test": "nyc npm run mocha && npm run lint", + "test:ci": "npm run mocha" }, - "version": "1.1.0" + "version": "1.2.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/esquery/parser.js b/tools/node_modules/eslint/node_modules/esquery/parser.js index b7cd714ae8e55e..ef8bf10a44e4a3 100644 --- a/tools/node_modules/eslint/node_modules/esquery/parser.js +++ b/tools/node_modules/eslint/node_modules/esquery/parser.js @@ -1,718 +1,947 @@ -var result = (function(){ - /* - * Generated by PEG.js 0.7.0. - * - * http://pegjs.majda.cz/ - */ - - function quote(s) { - /* - * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a - * string literal except for the closing quote character, backslash, - * carriage return, line separator, paragraph separator, and line feed. - * Any character may appear in the form of an escape sequence. - * - * For portability, we also escape escape all control and non-ASCII - * characters. Note that "\0" and "\v" escape sequences are not used - * because JSHint does not like the first and IE the second. - */ - return '"' + s - .replace(/\\/g, '\\\\') // backslash - .replace(/"/g, '\\"') // closing quote character - .replace(/\x08/g, '\\b') // backspace - .replace(/\t/g, '\\t') // horizontal tab - .replace(/\n/g, '\\n') // line feed - .replace(/\f/g, '\\f') // form feed - .replace(/\r/g, '\\r') // carriage return - .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape) - + '"'; +/* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ +(function(root, factory) { + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof module === "object" && module.exports) { + module.exports = factory(); } - - var result = { - /* - * Parses the input with a generated parser. If the parsing is successful, - * returns a value explicitly or implicitly specified by the grammar from - * which the parser was generated (see |PEG.buildParser|). If the parsing is - * unsuccessful, throws |PEG.parser.SyntaxError| describing the error. - */ - parse: function(input, startRule) { - var parseFunctions = { - "start": parse_start, - "_": parse__, - "identifierName": parse_identifierName, - "binaryOp": parse_binaryOp, - "selectors": parse_selectors, - "selector": parse_selector, - "sequence": parse_sequence, - "atom": parse_atom, - "wildcard": parse_wildcard, - "identifier": parse_identifier, - "attr": parse_attr, - "attrOps": parse_attrOps, - "attrEqOps": parse_attrEqOps, - "attrName": parse_attrName, - "attrValue": parse_attrValue, - "string": parse_string, - "number": parse_number, - "path": parse_path, - "type": parse_type, - "regex": parse_regex, - "field": parse_field, - "negation": parse_negation, - "matches": parse_matches, - "has": parse_has, - "firstChild": parse_firstChild, - "lastChild": parse_lastChild, - "nthChild": parse_nthChild, - "nthLastChild": parse_nthLastChild, - "class": parse_class - }; - - if (startRule !== undefined) { - if (parseFunctions[startRule] === undefined) { - throw new Error("Invalid rule name: " + quote(startRule) + "."); +})(this, function() { + "use strict"; + + function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } + } + + peg$subclass(peg$SyntaxError, Error); + + peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + "class": function(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array + ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) + : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + + any: function(expectation) { + return "any character"; + }, + + end: function(expectation) { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + + function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, + + peg$c0 = function(ss) { + return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss }; + }, + peg$c1 = function() { return void 0; }, + peg$c2 = " ", + peg$c3 = peg$literalExpectation(" ", false), + peg$c4 = /^[^ [\],():#!=><~+.]/, + peg$c5 = peg$classExpectation([" ", "[", "]", ",", "(", ")", ":", "#", "!", "=", ">", "<", "~", "+", "."], true, false), + peg$c6 = function(i) { return i.join(''); }, + peg$c7 = ">", + peg$c8 = peg$literalExpectation(">", false), + peg$c9 = function() { return 'child'; }, + peg$c10 = "~", + peg$c11 = peg$literalExpectation("~", false), + peg$c12 = function() { return 'sibling'; }, + peg$c13 = "+", + peg$c14 = peg$literalExpectation("+", false), + peg$c15 = function() { return 'adjacent'; }, + peg$c16 = function() { return 'descendant'; }, + peg$c17 = ",", + peg$c18 = peg$literalExpectation(",", false), + peg$c19 = function(s, ss) { + return [s].concat(ss.map(function (s) { return s[3]; })); + }, + peg$c20 = function(a, ops) { + return ops.reduce(function (memo, rhs) { + return { type: rhs[0], left: memo, right: rhs[1] }; + }, a); + }, + peg$c21 = "!", + peg$c22 = peg$literalExpectation("!", false), + peg$c23 = function(subject, as) { + const b = as.length === 1 ? as[0] : { type: 'compound', selectors: as }; + if(subject) b.subject = true; + return b; + }, + peg$c24 = "*", + peg$c25 = peg$literalExpectation("*", false), + peg$c26 = function(a) { return { type: 'wildcard', value: a }; }, + peg$c27 = "#", + peg$c28 = peg$literalExpectation("#", false), + peg$c29 = function(i) { return { type: 'identifier', value: i }; }, + peg$c30 = "[", + peg$c31 = peg$literalExpectation("[", false), + peg$c32 = "]", + peg$c33 = peg$literalExpectation("]", false), + peg$c34 = function(v) { return v; }, + peg$c35 = /^[>", "<", "!"], false, false), + peg$c37 = "=", + peg$c38 = peg$literalExpectation("=", false), + peg$c39 = function(a) { return (a || '') + '='; }, + peg$c40 = /^[><]/, + peg$c41 = peg$classExpectation([">", "<"], false, false), + peg$c42 = ".", + peg$c43 = peg$literalExpectation(".", false), + peg$c44 = function(name, op, value) { + return { type: 'attribute', name: name, operator: op, value: value }; + }, + peg$c45 = function(name) { return { type: 'attribute', name: name }; }, + peg$c46 = "\"", + peg$c47 = peg$literalExpectation("\"", false), + peg$c48 = /^[^\\"]/, + peg$c49 = peg$classExpectation(["\\", "\""], true, false), + peg$c50 = "\\", + peg$c51 = peg$literalExpectation("\\", false), + peg$c52 = peg$anyExpectation(), + peg$c53 = function(a, b) { return a + b; }, + peg$c54 = function(d) { + return { type: 'literal', value: strUnescape(d.join('')) }; + }, + peg$c55 = "'", + peg$c56 = peg$literalExpectation("'", false), + peg$c57 = /^[^\\']/, + peg$c58 = peg$classExpectation(["\\", "'"], true, false), + peg$c59 = /^[0-9]/, + peg$c60 = peg$classExpectation([["0", "9"]], false, false), + peg$c61 = function(a, b) { + // Can use `a.flat().join('')` once supported + const leadingDecimals = a ? [].concat.apply([], a).join('') : ''; + return { type: 'literal', value: parseFloat(leadingDecimals + b.join('')) }; + }, + peg$c62 = function(i) { return { type: 'literal', value: i }; }, + peg$c63 = "type(", + peg$c64 = peg$literalExpectation("type(", false), + peg$c65 = /^[^ )]/, + peg$c66 = peg$classExpectation([" ", ")"], true, false), + peg$c67 = ")", + peg$c68 = peg$literalExpectation(")", false), + peg$c69 = function(t) { return { type: 'type', value: t.join('') }; }, + peg$c70 = /^[imsu]/, + peg$c71 = peg$classExpectation(["i", "m", "s", "u"], false, false), + peg$c72 = "/", + peg$c73 = peg$literalExpectation("/", false), + peg$c74 = /^[^\/]/, + peg$c75 = peg$classExpectation(["/"], true, false), + peg$c76 = function(d, flgs) { return { + type: 'regexp', value: new RegExp(d.join(''), flgs ? flgs.join('') : '') }; + }, + peg$c77 = function(i, is) { + return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)}; + }, + peg$c78 = ":not(", + peg$c79 = peg$literalExpectation(":not(", false), + peg$c80 = function(ss) { return { type: 'not', selectors: ss }; }, + peg$c81 = ":matches(", + peg$c82 = peg$literalExpectation(":matches(", false), + peg$c83 = function(ss) { return { type: 'matches', selectors: ss }; }, + peg$c84 = ":has(", + peg$c85 = peg$literalExpectation(":has(", false), + peg$c86 = function(ss) { return { type: 'has', selectors: ss }; }, + peg$c87 = ":first-child", + peg$c88 = peg$literalExpectation(":first-child", false), + peg$c89 = function() { return nth(1); }, + peg$c90 = ":last-child", + peg$c91 = peg$literalExpectation(":last-child", false), + peg$c92 = function() { return nthLast(1); }, + peg$c93 = ":nth-child(", + peg$c94 = peg$literalExpectation(":nth-child(", false), + peg$c95 = function(n) { return nth(parseInt(n.join(''), 10)); }, + peg$c96 = ":nth-last-child(", + peg$c97 = peg$literalExpectation(":nth-last-child(", false), + peg$c98 = function(n) { return nthLast(parseInt(n.join(''), 10)); }, + peg$c99 = ":", + peg$c100 = peg$literalExpectation(":", false), + peg$c101 = "statement", + peg$c102 = peg$literalExpectation("statement", true), + peg$c103 = "expression", + peg$c104 = peg$literalExpectation("expression", true), + peg$c105 = "declaration", + peg$c106 = peg$literalExpectation("declaration", true), + peg$c107 = "function", + peg$c108 = peg$literalExpectation("function", true), + peg$c109 = "pattern", + peg$c110 = peg$literalExpectation("pattern", true), + peg$c111 = function(c) { + return { type: 'class', name: c }; + }, + + peg$currPos = 0, + peg$savedPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1 }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, + + peg$resultsCache = {}, + + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + return input.substring(peg$savedPos, peg$currPos); + } + + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } + + function expected(description, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } + + function error(message, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], p; + + if (details) { + return details; } else { - startRule = "start"; - } - - var pos = 0; - var reportFailures = 0; - var rightmostFailuresPos = 0; - var rightmostFailuresExpected = []; - var cache = {}; - - function padLeft(input, padding, length) { - var result = input; - - var padLength = length - input.length; - for (var i = 0; i < padLength; i++) { - result = padding + result; - } - - return result; - } - - function escape(ch) { - var charCode = ch.charCodeAt(0); - var escapeChar; - var length; - - if (charCode <= 0xFF) { - escapeChar = 'x'; - length = 2; - } else { - escapeChar = 'u'; - length = 4; + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; } - - return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length); + + peg$posDetailsCache[pos] = details; + return details; } - - function matchFailed(failure) { - if (pos < rightmostFailuresPos) { - return; - } - - if (pos > rightmostFailuresPos) { - rightmostFailuresPos = pos; - rightmostFailuresExpected = []; - } - - rightmostFailuresExpected.push(failure); - } - - function parse_start() { - var cacheKey = "start@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column } - - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse__(); - if (result0 !== null) { - result1 = parse_selectors(); - if (result1 !== null) { - result2 = parse__(); - if (result2 !== null) { - result0 = [result0, result1, result2]; - } else { - result0 = null; - pos = pos1; - } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 0, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseselectors(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result0 = (function(offset, ss) { return ss.length === 1 ? ss[0] : { type: 'matches', selectors: ss }; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; - } - if (result0 === null) { - pos0 = pos; - result0 = parse__(); - if (result0 !== null) { - result0 = (function(offset) { return void 0; })(pos0); - } - if (result0 === null) { - pos = pos0; - } - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse__() { - var cacheKey = "_@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1; - - result0 = []; - if (input.charCodeAt(pos) === 32) { - result1 = " "; - pos++; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c1(); + } + s0 = s1; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parse_() { + var s0, s1; + + var key = peg$currPos * 30 + 1, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\" \""); - } + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } } - while (result1 !== null) { - result0.push(result1); - if (input.charCodeAt(pos) === 32) { - result1 = " "; - pos++; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifierName() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 2, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c4.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\" \""); - } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } } } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_identifierName() { - var cacheKey = "identifierName@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1; - var pos0; - - pos0 = pos; - if (/^[^ [\],():#!=><~+.]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); - pos++; + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c6(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsebinaryOp() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 3, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c7; + peg$currPos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[^ [\\],():#!=><~+.]"); - } - } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - if (/^[^ [\],():#!=><~+.]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); - pos++; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[^ [\\],():#!=><~+.]"); - } - } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c8); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c9(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - } - if (result0 !== null) { - result0 = (function(offset, i) { return i.join(''); })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + peg$currPos = s0; + s0 = peg$FAILED; } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_binaryOp() { - var cacheKey = "binaryOp@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse__(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 62) { - result1 = ">"; - pos++; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 126) { + s2 = peg$c10; + peg$currPos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\">\""); - } - } - if (result1 !== null) { - result2 = parse__(); - if (result2 !== null) { - result0 = [result0, result1, result2]; + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c11); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c12(); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset) { return 'child'; })(pos0); - } - if (result0 === null) { - pos = pos0; - } - if (result0 === null) { - pos0 = pos; - pos1 = pos; - result0 = parse__(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 126) { - result1 = "~"; - pos++; + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 43) { + s2 = peg$c13; + peg$currPos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"~\""); - } - } - if (result1 !== null) { - result2 = parse__(); - if (result2 !== null) { - result0 = [result0, result1, result2]; + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c14); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c15(); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset) { return 'sibling'; })(pos0); - } - if (result0 === null) { - pos = pos0; - } - if (result0 === null) { - pos0 = pos; - pos1 = pos; - result0 = parse__(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 43) { - result1 = "+"; - pos++; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"+\""); - } - } - if (result1 !== null) { - result2 = parse__(); - if (result2 !== null) { - result0 = [result0, result1, result2]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 32) { + s1 = peg$c2; + peg$currPos++; } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset) { return 'adjacent'; })(pos0); - } - if (result0 === null) { - pos = pos0; - } - if (result0 === null) { - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 32) { - result0 = " "; - pos++; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\" \""); - } - } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - result0 = [result0, result1]; - } else { - result0 = null; - pos = pos1; - } + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c3); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(); + s0 = s1; } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset) { return 'descendant'; })(pos0); - } - if (result0 === null) { - pos = pos0; + peg$currPos = s0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } } } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_selectors() { - var cacheKey = "selectors@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4, result5; - var pos0, pos1, pos2; - - pos0 = pos; - pos1 = pos; - result0 = parse_selector(); - if (result0 !== null) { - result1 = []; - pos2 = pos; - result2 = parse__(); - if (result2 !== null) { - if (input.charCodeAt(pos) === 44) { - result3 = ","; - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\",\""); - } - } - if (result3 !== null) { - result4 = parse__(); - if (result4 !== null) { - result5 = parse_selector(); - if (result5 !== null) { - result2 = [result2, result3, result4, result5]; - } else { - result2 = null; - pos = pos2; - } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselectors() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + var key = peg$currPos * 30 + 4, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseselector(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } - while (result2 !== null) { - result1.push(result2); - pos2 = pos; - result2 = parse__(); - if (result2 !== null) { - if (input.charCodeAt(pos) === 44) { - result3 = ","; - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\",\""); - } - } - if (result3 !== null) { - result4 = parse__(); - if (result4 !== null) { - result5 = parse_selector(); - if (result5 !== null) { - result2 = [result2, result3, result4, result5]; - } else { - result2 = null; - pos = pos2; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseselector(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } - } - if (result1 !== null) { - result0 = [result0, result1]; } else { - result0 = null; - pos = pos1; + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, s, ss) { - return [s].concat(ss.map(function (s) { return s[3]; })); - })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_selector() { - var cacheKey = "selector@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - var result0, result1, result2, result3; - var pos0, pos1, pos2; - - pos0 = pos; - pos1 = pos; - result0 = parse_sequence(); - if (result0 !== null) { - result1 = []; - pos2 = pos; - result2 = parse_binaryOp(); - if (result2 !== null) { - result3 = parse_sequence(); - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos2; - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 5, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parsesequence(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } - while (result2 !== null) { - result1.push(result2); - pos2 = pos; - result2 = parse_binaryOp(); - if (result2 !== null) { - result3 = parse_sequence(); - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos2; - } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsebinaryOp(); + if (s4 !== peg$FAILED) { + s5 = peg$parsesequence(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; } else { - result2 = null; - pos = pos2; + peg$currPos = s3; + s3 = peg$FAILED; } - } - if (result1 !== null) { - result0 = [result0, result1]; } else { - result0 = null; - pos = pos1; + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, a, ops) { - return ops.reduce(function (memo, rhs) { - return { type: rhs[0], left: memo, right: rhs[1] }; - }, a); - })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_sequence() { - var cacheKey = "sequence@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 33) { - result0 = "!"; - pos++; + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c20(s1, s2); + s0 = s1; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"!\""); - } + peg$currPos = s0; + s0 = peg$FAILED; } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result2 = parse_atom(); - if (result2 !== null) { - result1 = []; - while (result2 !== null) { - result1.push(result2); - result2 = parse_atom(); - } - } else { - result1 = null; - } - if (result1 !== null) { - result0 = [result0, result1]; - } else { - result0 = null; - pos = pos1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsesequence() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 6, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$parseatom(); + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$parseatom(); } } else { - result0 = null; - pos = pos1; + s2 = peg$FAILED; } - if (result0 !== null) { - result0 = (function(offset, subject, as) { - var b = as.length === 1 ? as[0] : { type: 'compound', selectors: as }; - if(subject) b.subject = true; - return b; - })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_atom() { - var cacheKey = "atom@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - var result0; - - result0 = parse_wildcard(); - if (result0 === null) { - result0 = parse_identifier(); - if (result0 === null) { - result0 = parse_attr(); - if (result0 === null) { - result0 = parse_field(); - if (result0 === null) { - result0 = parse_negation(); - if (result0 === null) { - result0 = parse_matches(); - if (result0 === null) { - result0 = parse_has(); - if (result0 === null) { - result0 = parse_firstChild(); - if (result0 === null) { - result0 = parse_lastChild(); - if (result0 === null) { - result0 = parse_nthChild(); - if (result0 === null) { - result0 = parse_nthLastChild(); - if (result0 === null) { - result0 = parse_class(); - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseatom() { + var s0; + + var key = peg$currPos * 30 + 7, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$parsewildcard(); + if (s0 === peg$FAILED) { + s0 = peg$parseidentifier(); + if (s0 === peg$FAILED) { + s0 = peg$parseattr(); + if (s0 === peg$FAILED) { + s0 = peg$parsefield(); + if (s0 === peg$FAILED) { + s0 = peg$parsenegation(); + if (s0 === peg$FAILED) { + s0 = peg$parsematches(); + if (s0 === peg$FAILED) { + s0 = peg$parsehas(); + if (s0 === peg$FAILED) { + s0 = peg$parsefirstChild(); + if (s0 === peg$FAILED) { + s0 = peg$parselastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthChild(); + if (s0 === peg$FAILED) { + s0 = peg$parsenthLastChild(); + if (s0 === peg$FAILED) { + s0 = peg$parseclass(); } } } @@ -723,1951 +952,1621 @@ var result = (function(){ } } } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_wildcard() { - var cacheKey = "wildcard@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0; - var pos0; - - pos0 = pos; - if (input.charCodeAt(pos) === 42) { - result0 = "*"; - pos++; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"*\""); - } - } - if (result0 !== null) { - result0 = (function(offset, a) { return { type: 'wildcard', value: a }; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_identifier() { - var cacheKey = "identifier@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 35) { - result0 = "#"; - pos++; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"#\""); - } - } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_identifierName(); - if (result1 !== null) { - result0 = [result0, result1]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, i) { return { type: 'identifier', value: i }; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_attr() { - var cacheKey = "attr@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 91) { - result0 = "["; - pos++; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsewildcard() { + var s0, s1; + + var key = peg$currPos * 30 + 8, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c24; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c25); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c26(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 9, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 35) { + s1 = peg$c27; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c28); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c29(s2); + s0 = s1; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"[\""); - } + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - result2 = parse_attrValue(); - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 93) { - result4 = "]"; - pos++; - } else { - result4 = null; - if (reportFailures === 0) { - matchFailed("\"]\""); - } - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattr() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 10, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c30; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c31); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrValue(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c32; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c33); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c34(s3); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, v) { return v; })(pos0, result0[2]); + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_attrOps() { - var cacheKey = "attrOps@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (/^[><]/.test(input.charAt(pos))) { - result0 = input.charAt(pos); - pos++; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("[><]"); - } - } - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_attrEqOps() { - var cacheKey = "attrEqOps@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; + peg$currPos = s0; + s0 = peg$FAILED; } - - var result0, result1; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 33) { - result0 = "!"; - pos++; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + if (peg$c40.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"!\""); - } + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c41); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - if (input.charCodeAt(pos) === 61) { - result1 = "="; - pos++; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"=\""); - } - } - if (result1 !== null) { - result0 = [result0, result1]; - } else { - result0 = null; - pos = pos1; - } + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrEqOps() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 12, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c21; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c22); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c37; + peg$currPos++; } else { - result0 = null; - pos = pos1; + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c38); } } - if (result0 !== null) { - result0 = (function(offset, a) { return a + '='; })(pos0, result0[0]); - } - if (result0 === null) { - pos = pos0; + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c39(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_attrName() { - var cacheKey = "attrName@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrName() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 13, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseidentifierName(); + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c42; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } } - - var result0, result1; - var pos0; - - pos0 = pos; - result1 = parse_identifierName(); - if (result1 === null) { - if (input.charCodeAt(pos) === 46) { - result1 = "."; - pos++; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\".\""); + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseidentifierName(); + if (s2 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c42; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } } } } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - result1 = parse_identifierName(); - if (result1 === null) { - if (input.charCodeAt(pos) === 46) { - result1 = "."; - pos++; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\".\""); - } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c6(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseattrValue() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 14, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrEqOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsetype(); + if (s5 === peg$FAILED) { + s5 = peg$parseregex(); } - } - } - } else { - result0 = null; - } - if (result0 !== null) { - result0 = (function(offset, i) { return i.join(''); })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_attrValue() { - var cacheKey = "attrValue@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_attrName(); - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - result2 = parse_attrEqOps(); - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - result4 = parse_type(); - if (result4 === null) { - result4 = parse_regex(); - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c44(s1, s3, s5); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result0 = (function(offset, name, op, value) { - return { type: 'attribute', name: name, operator: op, value: value }; - })(pos0, result0[0], result0[2], result0[4]); - } - if (result0 === null) { - pos = pos0; - } - if (result0 === null) { - pos0 = pos; - pos1 = pos; - result0 = parse_attrName(); - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - result2 = parse_attrOps(); - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - result4 = parse_string(); - if (result4 === null) { - result4 = parse_number(); - if (result4 === null) { - result4 = parse_path(); - } - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseattrOps(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsestring(); + if (s5 === peg$FAILED) { + s5 = peg$parsenumber(); + if (s5 === peg$FAILED) { + s5 = peg$parsepath(); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c44(s1, s3, s5); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, op, value) { - return { type: 'attribute', name: name, operator: op, value: value }; - })(pos0, result0[0], result0[2], result0[4]); + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 === null) { - pos = pos0; - } - if (result0 === null) { - pos0 = pos; - result0 = parse_attrName(); - if (result0 !== null) { - result0 = (function(offset, name) { return { type: 'attribute', name: name }; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } - } - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_string() { - var cacheKey = "string@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3; - var pos0, pos1, pos2, pos3; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 34) { - result0 = "\""; - pos++; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"\\\"\""); + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseattrName(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c45(s1); } + s0 = s1; } - if (result0 !== null) { - result1 = []; - if (/^[^\\"]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsestring() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 15, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c46; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c48.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c49); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[^\\\\\"]"); - } - } - if (result2 === null) { - pos2 = pos; - pos3 = pos; - if (input.charCodeAt(pos) === 92) { - result2 = "\\"; - pos++; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"\\\\\""); - } - } - if (result2 !== null) { - if (input.length > pos) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("any character"); - } - } - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos3; - } - } else { - result2 = null; - pos = pos3; - } - if (result2 !== null) { - result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]); - } - if (result2 === null) { - pos = pos2; - } - } - while (result2 !== null) { - result1.push(result2); - if (/^[^\\"]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[^\\\\\"]"); - } - } - if (result2 === null) { - pos2 = pos; - pos3 = pos; - if (input.charCodeAt(pos) === 92) { - result2 = "\\"; - pos++; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"\\\\\""); - } - } - if (result2 !== null) { - if (input.length > pos) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("any character"); - } - } - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos3; - } - } else { - result2 = null; - pos = pos3; - } - if (result2 !== null) { - result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]); - } - if (result2 === null) { - pos = pos2; - } - } + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c51); } } - if (result1 !== null) { - if (input.charCodeAt(pos) === 34) { - result2 = "\""; - pos++; + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"\\\"\""); - } + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c53(s4, s5); + s3 = s4; } else { - result0 = null; - pos = pos1; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - result0 = null; - pos = pos1; } - if (result0 !== null) { - result0 = (function(offset, d) { - return { type: 'literal', value: strUnescape(d.join('')) }; - })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; - } - if (result0 === null) { - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 39) { - result0 = "'"; - pos++; + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c48.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"'\""); - } - } - if (result0 !== null) { - result1 = []; - if (/^[^\\']/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c49); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[^\\\\']"); - } - } - if (result2 === null) { - pos2 = pos; - pos3 = pos; - if (input.charCodeAt(pos) === 92) { - result2 = "\\"; - pos++; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"\\\\\""); - } - } - if (result2 !== null) { - if (input.length > pos) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("any character"); - } - } - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos3; - } - } else { - result2 = null; - pos = pos3; - } - if (result2 !== null) { - result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]); - } - if (result2 === null) { - pos = pos2; - } + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c51); } } - while (result2 !== null) { - result1.push(result2); - if (/^[^\\']/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[^\\\\']"); - } + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } } - if (result2 === null) { - pos2 = pos; - pos3 = pos; - if (input.charCodeAt(pos) === 92) { - result2 = "\\"; - pos++; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"\\\\\""); - } - } - if (result2 !== null) { - if (input.length > pos) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("any character"); - } - } - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos3; - } - } else { - result2 = null; - pos = pos3; - } - if (result2 !== null) { - result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]); - } - if (result2 === null) { - pos = pos2; - } - } - } - if (result1 !== null) { - if (input.charCodeAt(pos) === 39) { - result2 = "'"; - pos++; + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c53(s4, s5); + s3 = s4; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"'\""); - } - } - if (result2 !== null) { - result0 = [result0, result1, result2]; - } else { - result0 = null; - pos = pos1; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, d) { - return { type: 'literal', value: strUnescape(d.join('')) }; - })(pos0, result0[1]); } - if (result0 === null) { - pos = pos0; - } - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_number() { - var cacheKey = "number@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; } - - var result0, result1, result2; - var pos0, pos1, pos2; - - pos0 = pos; - pos1 = pos; - pos2 = pos; - result0 = []; - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); - pos++; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); - } - } - while (result1 !== null) { - result0.push(result1); - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); - pos++; + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c46; + peg$currPos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); - } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } } - } - if (result0 !== null) { - if (input.charCodeAt(pos) === 46) { - result1 = "."; - pos++; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\".\""); - } - } - if (result1 !== null) { - result0 = [result0, result1]; + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c54(s2); + s0 = s1; } else { - result0 = null; - pos = pos2; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos2; + peg$currPos = s0; + s0 = peg$FAILED; } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - if (/^[0-9]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c55; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c56); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c57.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c58); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c51); } } - } - if (result2 !== null) { - result1 = []; - while (result2 !== null) { - result1.push(result2); - if (/^[0-9]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); - } + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c53(s4, s5); + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; } + } else { + peg$currPos = s3; + s3 = peg$FAILED; } - } else { - result1 = null; } - if (result1 !== null) { - result0 = [result0, result1]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, a, b) { - return { type: 'literal', value: parseFloat((a ? a.join('') : '') + b.join('')) }; - })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_path() { - var cacheKey = "path@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0; - var pos0; - - pos0 = pos; - result0 = parse_identifierName(); - if (result0 !== null) { - result0 = (function(offset, i) { return { type: 'literal', value: i }; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_type() { - var cacheKey = "type@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.substr(pos, 5) === "type(") { - result0 = "type("; - pos += 5; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"type(\""); - } - } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - if (/^[^ )]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); - pos++; + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c57.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("[^ )]"); - } - } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[^ )]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("[^ )]"); - } - } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c58); } + } + if (s3 === peg$FAILED) { + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 92) { + s4 = peg$c50; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c51); } } - } else { - result2 = null; - } - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; + if (s4 !== peg$FAILED) { + if (input.length > peg$currPos) { + s5 = input.charAt(peg$currPos); + peg$currPos++; } else { - result4 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c52); } } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; + if (s5 !== peg$FAILED) { + peg$savedPos = s3; + s4 = peg$c53(s4, s5); + s3 = s4; } else { - result0 = null; - pos = pos1; + peg$currPos = s3; + s3 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, t) { return { type: 'type', value: t.join('') }; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_regex() { - var cacheKey = "regex@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 47) { - result0 = "/"; - pos++; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"/\""); - } - } - if (result0 !== null) { - if (/^[^\/]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[^\\/]"); - } - } - if (result2 !== null) { - result1 = []; - while (result2 !== null) { - result1.push(result2); - if (/^[^\/]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); - pos++; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("[^\\/]"); - } + peg$currPos = s3; + s3 = peg$FAILED; } } - } else { - result1 = null; } - if (result1 !== null) { - if (input.charCodeAt(pos) === 47) { - result2 = "/"; - pos++; + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c55; + peg$currPos++; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"/\""); - } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c56); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c54(s2); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result0 = (function(offset, d) { return { type: 'regexp', value: new RegExp(d.join('')) }; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3; + + var key = peg$currPos * 30 + 16, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$currPos; + s2 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_field() { - var cacheKey = "field@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s3 = peg$c42; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } } - - var result0, result1, result2, result3, result4; - var pos0, pos1, pos2; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 46) { - result0 = "."; - pos++; + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\".\""); - } + peg$currPos = s1; + s1 = peg$FAILED; } - if (result0 !== null) { - result1 = parse_identifierName(); - if (result1 !== null) { - result2 = []; - pos2 = pos; - if (input.charCodeAt(pos) === 46) { - result3 = "."; - pos++; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c59.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\".\""); - } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } } - if (result3 !== null) { - result4 = parse_identifierName(); - if (result4 !== null) { - result3 = [result3, result4]; + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c61(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsepath() { + var s0, s1; + + var key = peg$currPos * 30 + 17, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + s1 = peg$parseidentifierName(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c62(s1); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetype() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 18, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c63) { + s1 = peg$c63; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c64); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c65.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c66); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c65.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; } else { - result3 = null; - pos = pos2; + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c66); } } - } else { - result3 = null; - pos = pos2; } - while (result3 !== null) { - result2.push(result3); - pos2 = pos; - if (input.charCodeAt(pos) === 46) { - result3 = "."; - pos++; + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\".\""); - } + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c68); } } - if (result3 !== null) { - result4 = parse_identifierName(); - if (result4 !== null) { - result3 = [result3, result4]; - } else { - result3 = null; - pos = pos2; - } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c69(s3); + s0 = s1; } else { - result3 = null; - pos = pos2; + peg$currPos = s0; + s0 = peg$FAILED; } - } - if (result2 !== null) { - result0 = [result0, result1, result2]; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, i, is) { - return { type: 'field', name: is.reduce(function(memo, p){ return memo + p[0] + p[1]; }, i)}; - })(pos0, result0[1], result0[2]); - } - if (result0 === null) { - pos = pos0; + peg$currPos = s0; + s0 = peg$FAILED; } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_negation() { - var cacheKey = "negation@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseflags() { + var s0, s1; + + var key = peg$currPos * 30 + 19, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = []; + if (peg$c70.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c71); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c70.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c71); } + } } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.substr(pos, 5) === ":not(") { - result0 = ":not("; - pos += 5; + } else { + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseregex() { + var s0, s1, s2, s3, s4; + + var key = peg$currPos * 30 + 20, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c72; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c73); } + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c74.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":not(\""); + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c75); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c74.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c75); } + } } + } else { + s2 = peg$FAILED; } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - result2 = parse_selectors(); - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; - } else { - result4 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 47) { + s3 = peg$c72; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c73); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parseflags(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c76(s2, s4); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, ss) { return { type: 'not', selectors: ss }; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_matches() { - var cacheKey = "matches@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.substr(pos, 9) === ":matches(") { - result0 = ":matches("; - pos += 9; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":matches(\""); - } + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - result2 = parse_selectors(); - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; - } else { - result4 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefield() { + var s0, s1, s2, s3, s4, s5, s6; + + var key = peg$currPos * 30 + 21, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s1 = peg$c42; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseidentifierName(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c42; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c43); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseidentifierName(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; } else { - result0 = null; - pos = pos1; + peg$currPos = s4; + s4 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s4; + s4 = peg$FAILED; } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c77(s2, s3); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, ss) { return { type: 'matches', selectors: ss }; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_has() { - var cacheKey = "has@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.substr(pos, 5) === ":has(") { - result0 = ":has("; - pos += 5; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":has(\""); - } + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - result2 = parse_selectors(); - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; - } else { - result4 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenegation() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 22, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c78) { + s1 = peg$c78; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c79); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c80(s3); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result0 = (function(offset, ss) { return { type: 'has', selectors: ss }; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_firstChild() { - var cacheKey = "firstChild@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0; - var pos0; - - pos0 = pos; - if (input.substr(pos, 12) === ":first-child") { - result0 = ":first-child"; - pos += 12; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":first-child\""); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsematches() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 23, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 9) === peg$c81) { + s1 = peg$c81; + peg$currPos += 9; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c82); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c83(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - } - if (result0 !== null) { - result0 = (function(offset) { return nth(1); })(pos0); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_lastChild() { - var cacheKey = "lastChild@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0; - var pos0; - - pos0 = pos; - if (input.substr(pos, 11) === ":last-child") { - result0 = ":last-child"; - pos += 11; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":last-child\""); - } + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result0 = (function(offset) { return nthLast(1); })(pos0); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_nthChild() { - var cacheKey = "nthChild@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.substr(pos, 11) === ":nth-child(") { - result0 = ":nth-child("; - pos += 11; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":nth-child(\""); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsehas() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 24, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 5) === peg$c84) { + s1 = peg$c84; + peg$currPos += 5; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c85); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseselectors(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c68); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c86(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsefirstChild() { + var s0, s1; + + var key = peg$currPos * 30 + 25, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 12) === peg$c87) { + s1 = peg$c87; + peg$currPos += 12; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c88); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c89(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parselastChild() { + var s0, s1; + + var key = peg$currPos * 30 + 26, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c90) { + s1 = peg$c90; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c91); } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c92(); + } + s0 = s1; + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 27, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 11) === peg$c93) { + s1 = peg$c93; + peg$currPos += 11; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c94); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); - } - } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c68); } } - } else { - result2 = null; - } - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; - } else { - result4 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c95(s3); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, n) { return nth(parseInt(n.join(''), 10)); })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_nthLastChild() { - var cacheKey = "nthLastChild@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.substr(pos, 16) === ":nth-last-child(") { - result0 = ":nth-last-child("; - pos += 16; - } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":nth-last-child(\""); - } + peg$currPos = s0; + s0 = peg$FAILED; } - if (result0 !== null) { - result1 = parse__(); - if (result1 !== null) { - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsenthLastChild() { + var s0, s1, s2, s3, s4, s5; + + var key = peg$currPos * 30 + 28, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.substr(peg$currPos, 16) === peg$c96) { + s1 = peg$c96; + peg$currPos += 16; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c97); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = []; + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c59.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); - pos++; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("[0-9]"); - } - } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c67; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c68); } } - } else { - result2 = null; - } - if (result2 !== null) { - result3 = parse__(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; - } else { - result4 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } - } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c98(s3); + s0 = s1; } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; + peg$currPos = s0; + s0 = peg$FAILED; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, n) { return nthLast(parseInt(n.join(''), 10)); })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + peg$currPos = s0; + s0 = peg$FAILED; } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - function parse_class() { - var cacheKey = "class@" + pos; - var cachedResult = cache[cacheKey]; - if (cachedResult) { - pos = cachedResult.nextPos; - return cachedResult.result; - } - - var result0, result1; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 58) { - result0 = ":"; - pos++; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parseclass() { + var s0, s1, s2; + + var key = peg$currPos * 30 + 29, + cached = peg$resultsCache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + + return cached.result; + } + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 58) { + s1 = peg$c99; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c100); } + } + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9).toLowerCase() === peg$c101) { + s2 = input.substr(peg$currPos, 9); + peg$currPos += 9; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\":\""); - } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c102); } } - if (result0 !== null) { - if (input.substr(pos, 9).toLowerCase() === "statement") { - result1 = input.substr(pos, 9); - pos += 9; + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c103) { + s2 = input.substr(peg$currPos, 10); + peg$currPos += 10; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"statement\""); - } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c104); } } - if (result1 === null) { - if (input.substr(pos, 10).toLowerCase() === "expression") { - result1 = input.substr(pos, 10); - pos += 10; + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c105) { + s2 = input.substr(peg$currPos, 11); + peg$currPos += 11; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"expression\""); - } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c106); } } - if (result1 === null) { - if (input.substr(pos, 11).toLowerCase() === "declaration") { - result1 = input.substr(pos, 11); - pos += 11; + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c107) { + s2 = input.substr(peg$currPos, 8); + peg$currPos += 8; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"declaration\""); - } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c108); } } - if (result1 === null) { - if (input.substr(pos, 8).toLowerCase() === "function") { - result1 = input.substr(pos, 8); - pos += 8; + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c109) { + s2 = input.substr(peg$currPos, 7); + peg$currPos += 7; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"function\""); - } - } - if (result1 === null) { - if (input.substr(pos, 7).toLowerCase() === "pattern") { - result1 = input.substr(pos, 7); - pos += 7; - } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("\"pattern\""); - } - } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c110); } } } } } - if (result1 !== null) { - result0 = [result0, result1]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, c) { - return { type: 'class', name: c }; - })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; - } - - cache[cacheKey] = { - nextPos: pos, - result: result0 - }; - return result0; - } - - - function cleanupExpected(expected) { - expected.sort(); - - var lastExpected = null; - var cleanExpected = []; - for (var i = 0; i < expected.length; i++) { - if (expected[i] !== lastExpected) { - cleanExpected.push(expected[i]); - lastExpected = expected[i]; - } - } - return cleanExpected; - } - - function computeErrorPosition() { - /* - * The first idea was to use |String.split| to break the input up to the - * error position along newlines and derive the line and column from - * there. However IE's |split| implementation is so broken that it was - * enough to prevent it. - */ - - var line = 1; - var column = 1; - var seenCR = false; - - for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) { - var ch = input.charAt(i); - if (ch === "\n") { - if (!seenCR) { line++; } - column = 1; - seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { - line++; - column = 1; - seenCR = true; - } else { - column++; - seenCR = false; - } } - - return { line: line, column: column }; - } - - - function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; } - function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; } - function strUnescape(s) { - return s.replace(/\\(.)/g, function(match, ch) { - switch(ch) { - case 'a': return '\a'; - case 'b': return '\b'; - case 'f': return '\f'; - case 'n': return '\n'; - case 'r': return '\r'; - case 't': return '\t'; - case 'v': return '\v'; - default: return ch; - } - }); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c111(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - - var result = parseFunctions[startRule](); - - /* - * The parser is now in one of the following three states: - * - * 1. The parser successfully parsed the whole input. - * - * - |result !== null| - * - |pos === input.length| - * - |rightmostFailuresExpected| may or may not contain something - * - * 2. The parser successfully parsed only a part of the input. - * - * - |result !== null| - * - |pos < input.length| - * - |rightmostFailuresExpected| may or may not contain something - * - * 3. The parser did not successfully parse any part of the input. - * - * - |result === null| - * - |pos === 0| - * - |rightmostFailuresExpected| contains at least one failure - * - * All code following this comment (including called functions) must - * handle these states. - */ - if (result === null || pos !== input.length) { - var offset = Math.max(pos, rightmostFailuresPos); - var found = offset < input.length ? input.charAt(offset) : null; - var errorPosition = computeErrorPosition(); - - throw new this.SyntaxError( - cleanupExpected(rightmostFailuresExpected), - found, - offset, - errorPosition.line, - errorPosition.column - ); - } - - return result; - }, - - /* Returns the parser source code. */ - toSource: function() { return this._source; } - }; - - /* Thrown when a parser encounters a syntax error. */ - - result.SyntaxError = function(expected, found, offset, line, column) { - function buildMessage(expected, found) { - var expectedHumanized, foundHumanized; - - switch (expected.length) { - case 0: - expectedHumanized = "end of input"; - break; - case 1: - expectedHumanized = expected[0]; - break; - default: - expectedHumanized = expected.slice(0, expected.length - 1).join(", ") - + " or " - + expected[expected.length - 1]; - } - - foundHumanized = found ? quote(found) : "end of input"; - - return "Expected " + expectedHumanized + " but " + foundHumanized + " found."; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; } - - this.name = "SyntaxError"; - this.expected = expected; - this.found = found; - this.message = buildMessage(expected, found); - this.offset = offset; - this.line = line; - this.column = column; + + + function nth(n) { return { type: 'nth-child', index: { type: 'literal', value: n } }; } + function nthLast(n) { return { type: 'nth-last-child', index: { type: 'literal', value: n } }; } + function strUnescape(s) { + return s.replace(/\\(.)/g, function(match, ch) { + switch(ch) { + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + default: return ch; + } + }); + } + + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } + } + + return { + SyntaxError: peg$SyntaxError, + parse: peg$parse }; - - result.SyntaxError.prototype = Error.prototype; - - return result; -})(); -if (typeof define === "function" && define.amd) { define(function(){ return result; }); } else if (typeof module !== "undefined" && module.exports) { module.exports = result; } else { this.esquery = result; } +}); diff --git a/tools/node_modules/eslint/node_modules/glob-parent/index.js b/tools/node_modules/eslint/node_modules/glob-parent/index.js index 2ded6ea7e63ba0..789dbbf2ff09ef 100644 --- a/tools/node_modules/eslint/node_modules/glob-parent/index.js +++ b/tools/node_modules/eslint/node_modules/glob-parent/index.js @@ -8,7 +8,7 @@ var slash = '/'; var backslash = /\\/g; var enclosure = /[\{\[].*[\/]*.*[\}\]]$/; var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; -var escaped = /\\([\*\?\|\[\]\(\)\{\}])/g; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; /** * @param {string} str diff --git a/tools/node_modules/eslint/node_modules/glob-parent/package.json b/tools/node_modules/eslint/node_modules/glob-parent/package.json index af850b522587b3..4d6f2f6dd4bf4b 100644 --- a/tools/node_modules/eslint/node_modules/glob-parent/package.json +++ b/tools/node_modules/eslint/node_modules/glob-parent/package.json @@ -24,7 +24,7 @@ "deprecated": false, "description": "Extract the non-magic parent path from a glob string.", "devDependencies": { - "coveralls": "github:phated/node-coveralls#2.x", + "coveralls": "^3.0.11", "eslint": "^2.13.1", "eslint-config-gulp": "^3.0.1", "expect": "^1.20.2", @@ -63,5 +63,5 @@ "pretest": "npm run lint", "test": "nyc mocha --async-only" }, - "version": "5.1.0" + "version": "5.1.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/globals/globals.json b/tools/node_modules/eslint/node_modules/globals/globals.json index b33f0431b544e9..b85dc3f80d5148 100644 --- a/tools/node_modules/eslint/node_modules/globals/globals.json +++ b/tools/node_modules/eslint/node_modules/globals/globals.json @@ -1027,6 +1027,24 @@ "URL": false, "URLSearchParams": false }, + "nodeBuiltin": { + "Buffer": false, + "clearImmediate": false, + "clearInterval": false, + "clearTimeout": false, + "console": false, + "global": false, + "Intl": false, + "process": false, + "queueMicrotask": false, + "setImmediate": false, + "setInterval": false, + "setTimeout": false, + "TextDecoder": false, + "TextEncoder": false, + "URL": false, + "URLSearchParams": false + }, "commonjs": { "exports": true, "global": false, diff --git a/tools/node_modules/eslint/node_modules/globals/license b/tools/node_modules/eslint/node_modules/globals/license index e7af2f77107d73..fa7ceba3eb4a96 100644 --- a/tools/node_modules/eslint/node_modules/globals/license +++ b/tools/node_modules/eslint/node_modules/globals/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://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: diff --git a/tools/node_modules/eslint/node_modules/globals/package.json b/tools/node_modules/eslint/node_modules/globals/package.json index de6b8926f166d9..66435a6834e8f4 100644 --- a/tools/node_modules/eslint/node_modules/globals/package.json +++ b/tools/node_modules/eslint/node_modules/globals/package.json @@ -2,7 +2,7 @@ "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/globals/issues" @@ -26,6 +26,7 @@ "index.d.ts", "globals.json" ], + "funding": "https://github.com/sponsors/sindresorhus", "homepage": "https://github.com/sindresorhus/globals#readme", "keywords": [ "globals", @@ -51,7 +52,7 @@ "resolveJsonModule": true } }, - "version": "12.3.0", + "version": "12.4.0", "xo": { "ignores": [ "get-browser-globals.js" diff --git a/tools/node_modules/eslint/node_modules/globals/readme.md b/tools/node_modules/eslint/node_modules/globals/readme.md index 96ce28347a8de0..fdcfa087ab1107 100644 --- a/tools/node_modules/eslint/node_modules/globals/readme.md +++ b/tools/node_modules/eslint/node_modules/globals/readme.md @@ -8,14 +8,12 @@ It's just a [JSON file](globals.json), so use it in whatever environment you lik **This module [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).** - ## Install ``` $ npm install globals ``` - ## Usage ```js @@ -28,13 +26,22 @@ console.log(globals.browser); applicationCache: false, ArrayBuffer: false, atob: false, - ... + … } */ ``` Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise. +For Node.js this package provides two sets of globals: + +- `globals.nodeBuiltin`: Globals available to all code running in Node.js. + These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`. + See: https://nodejs.org/api/globals.html +- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope"). + See: https://nodejs.org/api/modules.html#modules_the_module_scope + +When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references. --- diff --git a/tools/node_modules/eslint/node_modules/inquirer/README.md b/tools/node_modules/eslint/node_modules/inquirer/README.md index 8fb61ba6a18d62..7fa511995ea730 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/README.md +++ b/tools/node_modules/eslint/node_modules/inquirer/README.md @@ -23,6 +23,7 @@ A collection of common interactive command line user interfaces. 2. [User Interfaces and Layouts](#layouts) 1. [Reactive Interface](#reactive) 3. [Support](#support) +4. [Known issues](#issues) 4. [News](#news) 5. [Contributing](#contributing) 6. [License](#license) @@ -62,6 +63,13 @@ inquirer ]) .then(answers => { // Use user feedback for... whatever!! + }) + .catch(error => { + if(error.isTtyError) { + // Prompt couldn't be rendered in the current environment + } else { + // Something else when wrong + } }); ``` @@ -128,6 +136,7 @@ A question object is a `hash` containing question related values: - **pageSize**: (Number) Change the number of lines that will be rendered when using `list`, `rawList`, `expand` or `checkbox`. - **prefix**: (String) Change the default _prefix_ message. - **suffix**: (String) Change the default _suffix_ message. +- **askAnswered**: (Boolean) Force to prompt the question if the answer already exists. `default`, `choices`(if defined as functions), `validate`, `filter` and `when` functions can be called asynchronously. Either return a promise or use `this.async()` to get a callback you'll call with the final value. @@ -283,6 +292,10 @@ Launches an instance of the users preferred editor on a temporary file. Once the +### Use in Non-Interactive Environments +`prompt()` requires that it is run in an interactive environment. (I.e. [One where `process.stdin.isTTY` is `true`](https://nodejs.org/docs/latest-v12.x/api/process.html#process_a_note_on_process_i_o)). If `prompt()` is invoked outside of such an environment, then `prompt()` will return a rejected promise with an error. For convenience, the error will have a `isTtyError` property to programmatically indicate the cause. + + ## User Interfaces and layouts Along with the prompts, Inquirer offers some basic text UI. @@ -346,7 +359,7 @@ look at issues found on other command line - feel free to report any! - **Mac OS**: - Terminal.app - iTerm -- **Windows**: +- **Windows ([Known issues](#issues))**: - [ConEmu](https://conemu.github.io/) - cmd.exe - Powershell @@ -355,6 +368,14 @@ look at issues found on other command line - feel free to report any! - gnome-terminal (Terminal GNOME) - konsole +## Know issues + + + +Running Inquirer together with network streams in Windows platform inside some terminals can result in process hang. +Workaround: run inside another terminal. +Please refer to the https://github.com/nodejs/node/issues/21771 + ## News on the march (Release notes) diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/inquirer.js b/tools/node_modules/eslint/node_modules/inquirer/lib/inquirer.js index 820e2525c2f77c..aa8b2a17e9153d 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/inquirer.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/inquirer.js @@ -23,9 +23,14 @@ inquirer.ui = { * Create a new self-contained prompt module. */ inquirer.createPromptModule = function(opt) { - var promptModule = function(questions) { - var ui = new inquirer.ui.Prompt(promptModule.prompts, opt); - var promise = ui.run(questions); + var promptModule = function(questions, answers) { + var ui; + try { + ui = new inquirer.ui.Prompt(promptModule.prompts, opt); + } catch (error) { + return Promise.reject(error); + } + var promise = ui.run(questions, answers); // Monkey patch the UI on the promise object so // that it remains publicly accessible. diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choice.js b/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choice.js index 76f93293329244..1bc1acdcddac60 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choice.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choice.js @@ -13,6 +13,7 @@ module.exports = class Choice { constructor(val, answers) { // Don't process Choice and Separator object if (val instanceof Choice || val.type === 'separator') { + // eslint-disable-next-line no-constructor-return return val; } diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/confirm.js b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/confirm.js index ee66d9b80af08f..1ede6b8951d973 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/confirm.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/confirm.js @@ -31,8 +31,6 @@ class ConfirmPrompt extends Base { } this.opt.default = rawDefault ? 'Y/n' : 'y/N'; - - return this; } /** diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/ui/baseUI.js b/tools/node_modules/eslint/node_modules/inquirer/lib/ui/baseUI.js index 0903e9af565dba..45248eff5a9bcc 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/ui/baseUI.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/ui/baseUI.js @@ -55,20 +55,29 @@ class UI { // Close the readline this.rl.output.end(); this.rl.pause(); - - // @see https://github.com/nodejs/node/issues/21771 - if (!/^win/i.test(process.platform)) { - this.rl.close(); - } + this.rl.close(); } } function setupReadlineOptions(opt) { opt = opt || {}; + // Inquirer 8.x: + // opt.skipTTYChecks = opt.skipTTYChecks === undefined ? opt.input !== undefined : opt.skipTTYChecks; + opt.skipTTYChecks = opt.skipTTYChecks === undefined ? true : opt.skipTTYChecks; // Default `input` to stdin var input = opt.input || process.stdin; + // Check if prompt is being called in TTY environment + // If it isn't return a failed promise + if (!opt.skipTTYChecks && !input.isTTY) { + const nonTtyError = new Error( + 'Prompts can not be meaningfully rendered in non-TTY environments' + ); + nonTtyError.isTtyError = true; + throw nonTtyError; + } + // Add mute capabilities to the output var ms = new MuteStream(); ms.pipe(opt.output || process.stdout); diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/ui/prompt.js b/tools/node_modules/eslint/node_modules/inquirer/lib/ui/prompt.js index bc1ee9eb86a290..9735c999f342a3 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/ui/prompt.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/ui/prompt.js @@ -16,9 +16,13 @@ class PromptUI extends Base { this.prompts = prompts; } - run(questions) { + run(questions, answers) { // Keep global reference to the answers - this.answers = {}; + if (_.isPlainObject(answers)) { + this.answers = _.clone(answers); + } else { + this.answers = {}; + } // Make sure questions is an array. if (_.isPlainObject(questions)) { @@ -40,9 +44,9 @@ class PromptUI extends Base { return this.process .pipe( reduce((answers, answer) => { - _.set(this.answers, answer.name, answer.answer); - return this.answers; - }, {}) + _.set(answers, answer.name, answer.answer); + return answers; + }, this.answers) ) .toPromise(Promise) .then(this.onCompletion.bind(this)); @@ -100,6 +104,10 @@ class PromptUI extends Base { } filterIfRunnable(question) { + if (question.askAnswered !== true && this.answers[question.name] !== undefined) { + return empty(); + } + if (question.when === false) { return empty(); } diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/index.js b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/index.js deleted file mode 100644 index c25448009f304d..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/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/inquirer/node_modules/ansi-regex/package.json b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/package.json deleted file mode 100644 index db8f3cc8c7d14e..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/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/inquirer/node_modules/ansi-regex/readme.md b/tools/node_modules/eslint/node_modules/inquirer/node_modules/ansi-regex/readme.md deleted file mode 100644 index d19c44667e704b..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/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/inquirer/node_modules/chalk/index.js b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/index.js deleted file mode 100644 index 1cc5fa89a95159..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/index.js +++ /dev/null @@ -1,228 +0,0 @@ -'use strict'; -const escapeStringRegexp = require('escape-string-regexp'); -const ansiStyles = require('ansi-styles'); -const stdoutColor = require('supports-color').stdout; - -const template = require('./templates.js'); - -const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); - -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; - -// `color-convert` models to exclude from the Chalk API due to conflicts and such -const skipModels = new Set(['gray']); - -const styles = Object.create(null); - -function applyOptions(obj, options) { - options = options || {}; - - // Detect level if not set manually - const scLevel = stdoutColor ? stdoutColor.level : 0; - obj.level = options.level === undefined ? scLevel : options.level; - obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; -} - -function Chalk(options) { - // We check for this.template here since calling `chalk.constructor()` - // by itself will have a `this` of a previously constructed chalk object - if (!this || !(this instanceof Chalk) || this.template) { - const chalk = {}; - applyOptions(chalk, options); - - chalk.template = function () { - const args = [].slice.call(arguments); - return chalkTag.apply(null, [chalk.template].concat(args)); - }; - - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); - - chalk.template.constructor = Chalk; - - return chalk.template; - } - - applyOptions(this, options); -} - -// Use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; -} - -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - - styles[key] = { - get() { - const codes = ansiStyles[key]; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); - } - }; -} - -styles.visible = { - get() { - return build.call(this, this._styles || [], true, 'visible'); - } -}; - -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { - if (skipModels.has(model)) { - continue; - } - - styles[model] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { - if (skipModels.has(model)) { - continue; - } - - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -const proto = Object.defineProperties(() => {}, styles); - -function build(_styles, _empty, key) { - const builder = function () { - return applyStyle.apply(builder, arguments); - }; - - builder._styles = _styles; - builder._empty = _empty; - - const self = this; - - Object.defineProperty(builder, 'level', { - enumerable: true, - get() { - return self.level; - }, - set(level) { - self.level = level; - } - }); - - Object.defineProperty(builder, 'enabled', { - enumerable: true, - get() { - return self.enabled; - }, - set(enabled) { - self.enabled = enabled; - } - }); - - // See below for fix regarding invisible grey/dim combination on Windows - builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; - - // `__proto__` is used because we must return a function, but there is - // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto - - return builder; -} - -function applyStyle() { - // Support varags, but simply cast to string in case there's only one arg - const args = arguments; - const argsLen = args.length; - let str = String(arguments[0]); - - if (argsLen === 0) { - return ''; - } - - if (argsLen > 1) { - // Don't slice `arguments`, it prevents V8 optimizations - for (let a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } - } - - if (!this.enabled || this.level <= 0 || !str) { - return this._empty ? '' : str; - } - - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - const originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; - } - - for (const code of this._styles.slice().reverse()) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; - - // Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS - // https://github.com/chalk/chalk/pull/92 - str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); - } - - // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; - - return str; -} - -function chalkTag(chalk, strings) { - if (!Array.isArray(strings)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return [].slice.call(arguments, 1).join(' '); - } - - const args = [].slice.call(arguments, 2); - const parts = [strings.raw[0]]; - - for (let i = 1; i < strings.length; i++) { - parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); - parts.push(String(strings.raw[i])); - } - - return template(chalk, parts.join('')); -} - -Object.defineProperties(Chalk.prototype, styles); - -module.exports = Chalk(); // eslint-disable-line new-cap -module.exports.supportsColor = stdoutColor; -module.exports.default = module.exports; // For TypeScript diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/index.js.flow b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/index.js.flow deleted file mode 100644 index 622caaa2e803f3..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/index.js.flow +++ /dev/null @@ -1,93 +0,0 @@ -// @flow strict - -type TemplateStringsArray = $ReadOnlyArray; - -export type Level = $Values<{ - None: 0, - Basic: 1, - Ansi256: 2, - TrueColor: 3 -}>; - -export type ChalkOptions = {| - enabled?: boolean, - level?: Level -|}; - -export type ColorSupport = {| - level: Level, - hasBasic: boolean, - has256: boolean, - has16m: boolean -|}; - -export interface Chalk { - (...text: string[]): string, - (text: TemplateStringsArray, ...placeholders: string[]): string, - constructor(options?: ChalkOptions): Chalk, - enabled: boolean, - level: Level, - rgb(r: number, g: number, b: number): Chalk, - hsl(h: number, s: number, l: number): Chalk, - hsv(h: number, s: number, v: number): Chalk, - hwb(h: number, w: number, b: number): Chalk, - bgHex(color: string): Chalk, - bgKeyword(color: string): Chalk, - bgRgb(r: number, g: number, b: number): Chalk, - bgHsl(h: number, s: number, l: number): Chalk, - bgHsv(h: number, s: number, v: number): Chalk, - bgHwb(h: number, w: number, b: number): Chalk, - hex(color: string): Chalk, - keyword(color: string): Chalk, - - +reset: Chalk, - +bold: Chalk, - +dim: Chalk, - +italic: Chalk, - +underline: Chalk, - +inverse: Chalk, - +hidden: Chalk, - +strikethrough: Chalk, - - +visible: Chalk, - - +black: Chalk, - +red: Chalk, - +green: Chalk, - +yellow: Chalk, - +blue: Chalk, - +magenta: Chalk, - +cyan: Chalk, - +white: Chalk, - +gray: Chalk, - +grey: Chalk, - +blackBright: Chalk, - +redBright: Chalk, - +greenBright: Chalk, - +yellowBright: Chalk, - +blueBright: Chalk, - +magentaBright: Chalk, - +cyanBright: Chalk, - +whiteBright: Chalk, - - +bgBlack: Chalk, - +bgRed: Chalk, - +bgGreen: Chalk, - +bgYellow: Chalk, - +bgBlue: Chalk, - +bgMagenta: Chalk, - +bgCyan: Chalk, - +bgWhite: Chalk, - +bgBlackBright: Chalk, - +bgRedBright: Chalk, - +bgGreenBright: Chalk, - +bgYellowBright: Chalk, - +bgBlueBright: Chalk, - +bgMagentaBright: Chalk, - +bgCyanBright: Chalk, - +bgWhiteBrigh: Chalk, - - supportsColor: ColorSupport -}; - -declare module.exports: Chalk; diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/license b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/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/inquirer/node_modules/chalk/package.json b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/package.json deleted file mode 100644 index 270fecdc347d42..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "bugs": { - "url": "https://github.com/chalk/chalk/issues" - }, - "bundleDependencies": false, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "deprecated": false, - "description": "Terminal string styling done right", - "devDependencies": { - "ava": "*", - "coveralls": "^3.0.0", - "execa": "^0.9.0", - "flow-bin": "^0.68.0", - "import-fresh": "^2.0.0", - "matcha": "^0.7.0", - "nyc": "^11.0.2", - "resolve-from": "^4.0.0", - "typescript": "^2.5.3", - "xo": "*" - }, - "engines": { - "node": ">=4" - }, - "files": [ - "index.js", - "templates.js", - "types/index.d.ts", - "index.js.flow" - ], - "homepage": "https://github.com/chalk/chalk#readme", - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "str", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "license": "MIT", - "name": "chalk", - "repository": { - "type": "git", - "url": "git+https://github.com/chalk/chalk.git" - }, - "scripts": { - "bench": "matcha benchmark.js", - "coveralls": "nyc report --reporter=text-lcov | coveralls", - "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava" - }, - "types": "types/index.d.ts", - "version": "2.4.2", - "xo": { - "envs": [ - "node", - "mocha" - ], - "ignores": [ - "test/_flow.js" - ] - } -} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/readme.md deleted file mode 100644 index d298e2c48d64a0..00000000000000 --- a/tools/node_modules/eslint/node_modules/inquirer/node_modules/chalk/readme.md +++ /dev/null @@ -1,314 +0,0 @@ -

-
-
- Chalk -
-
-
-

- -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs) - -### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0) - - - - -## Highlights - -- Expressive API -- Highly performant -- Ability to nest styles -- [256/Truecolor color support](#256-and-truecolor-color-support) -- Auto-detects color support -- Doesn't extend `String.prototype` -- Clean and focused -- Actively maintained -- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017 - - -## Install - -```console -$ npm install chalk -``` - - - - - - -## Usage - -```js -const chalk = require('chalk'); - -console.log(chalk.blue('Hello world!')); -``` - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -const chalk = require('chalk'); -const log = console.log; - -// Combine styled and normal strings -log(chalk.blue('Hello') + ' World' + chalk.red('!')); - -// Compose multiple styles using the chainable API -log(chalk.blue.bgRed.bold('Hello world!')); - -// Pass in multiple arguments -log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); - -// Nest styles -log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); - -// Nest styles of the same type even (color, underline, background) -log(chalk.green( - 'I am a green line ' + - chalk.blue.underline.bold('with a blue substring') + - ' that becomes green again!' -)); - -// ES2015 template literal -log(` -CPU: ${chalk.red('90%')} -RAM: ${chalk.green('40%')} -DISK: ${chalk.yellow('70%')} -`); - -// ES2015 tagged template literal -log(chalk` -CPU: {red ${cpu.totalPercent}%} -RAM: {green ${ram.used / ram.total * 100}%} -DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} -`); - -// Use RGB colors in terminal emulators that support it. -log(chalk.keyword('orange')('Yay for orange colored text!')); -log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); -log(chalk.hex('#DEADED').bold('Bold gray!')); -``` - -Easily define your own themes: - -```js -const chalk = require('chalk'); - -const error = chalk.bold.red; -const warning = chalk.keyword('orange'); - -console.log(error('Error!')); -console.log(warning('Warning!')); -``` - -Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): - -```js -const name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> 'Hello Sindre' -``` - - -## API - -### chalk.`