diff --git a/.eslintrc.js b/.eslintrc.js index d0aa8955351e5e..e504e085eb387f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,7 +17,7 @@ Module._findPath = (request, paths, isMain) => { if (!r && hacks.includes(request)) { try { return require.resolve(`./tools/node_modules/${request}`); - } catch (err) { + } catch { return require.resolve( `./tools/node_modules/eslint/node_modules/${request}`); } @@ -212,7 +212,7 @@ module.exports = { 'no-unsafe-finally': 'error', 'no-unsafe-negation': 'error', 'no-unused-labels': 'error', - 'no-unused-vars': ['error', { args: 'none' }], + 'no-unused-vars': ['error', { args: 'none', caughtErrors: 'all' }], 'no-use-before-define': ['error', { classes: true, functions: false, diff --git a/.gitignore b/.gitignore index f652a2c74c37d6..dad5a3efd8bcae 100644 --- a/.gitignore +++ b/.gitignore @@ -133,3 +133,5 @@ deps/uv/docs/src/guide/ deps/v8/gypfiles/Debug/ deps/v8/gypfiles/Release/ deps/v8/third_party/eu-strip/ + +.DS_Store diff --git a/.travis.yml b/.travis.yml index fad2e7f0c77509..80c729a772fed5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,30 @@ language: cpp -compiler: - - clang sudo: false cache: ccache os: linux matrix: include: - name: "Linter" - node_js: "latest" + language: node_js + node_js: "node" env: - NODE=$(which node) script: - make lint # Lint the first commit in the PR. - - git log $TRAVIS_COMMIT_RANGE --pretty=format:'%h' --no-merges | tail -1 | xargs npx core-validate-commit --no-validate-metadata + - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + bash tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST} || true; + fi - name: "Test Suite" + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.9 install: + - export CC='ccache gcc-4.9' CXX='ccache g++-4.9' JOBS=2 - ./configure - make -j2 V= script: - - make -j2 test - before_install: - - export CXX="ccache clang++ -Qunused-arguments" - - export CC="ccache clang -Qunused-arguments -Wno-unknown-warning-option" - - export JOBS=2 + - PARALLEL_ARGS='--flaky-tests=skip' make -j1 test diff --git a/BUILDING.md b/BUILDING.md index 839480eec38a88..efe39e656b383a 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -48,30 +48,28 @@ file a new issue. ## Supported platforms This list of supported platforms is current as of the branch/release to -which it is attached. +which it belongs. ### Input -Node.js relies on V8 and libuv. Therefore, we adopt a subset of their -supported platforms. +Node.js relies on V8 and libuv. We adopt a subset of their supported platforms. ### Strategy -Support is divided into three tiers: +There are three support tiers: * **Tier 1**: Full test coverage and maintenance by the Node.js core team and the broader community. -* **Tier 2**: Full test coverage but more limited maintenance, - often provided by the vendor of the platform. -* **Experimental**: May not compile reliably or test suite may not pass. - These are often working to be promoted to Tier 2 but are not quite ready. - There is at least one individual actively providing maintenance and the team - is striving to broaden quality and reliability of support. +* **Tier 2**: Full test coverage. Limited maintenance, often provided by the + vendor of the platform. +* **Experimental**: May not compile or test suite may not pass. + These are often approaching Tier 2 support but are not quite ready. + There is at least one individual providing maintenance. ### Supported platforms The community does not build or test against end-of-life distributions (EoL). -Thus, we do not recommend that you use Node on end-of-life or unsupported +Thus, we do not recommend that you use Node.js on end-of-life or unsupported platforms in production. | System | Support type | Version | Architectures | Notes | @@ -97,8 +95,8 @@ platforms in production. by Joyent. SmartOS images >= 16.4 are not supported because GCC 4.8 runtime libraries are not available in their pkgsrc repository -2: Tier 1 support for building on Windows is only on 64 bit - hosts. Support is experimental for 32 bit hosts. +2: Tier 1 support for building on Windows is only on 64-bit + hosts. Support is experimental for 32-bit hosts. 3: On Windows, running Node.js in Windows terminal emulators like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty) @@ -111,12 +109,12 @@ platforms in production. community will only address issues that reproduce on native GNU/Linux systems. Issues that only reproduce on WSL should be reported in the [WSL issue tracker](https://github.com/Microsoft/WSL/issues). Running the - Windows binary (`node.exe`) in WSL is not recommended, and will not work - without adjustment (such as stdio redirection). + Windows binary (`node.exe`) in WSL is not recommended. It will not work + without workarounds such as stdio redirection. ### Supported toolchains -Depending on host platform, the selection of toolchains may vary. +Depending on the host platform, the selection of toolchains may vary. #### Unix @@ -128,11 +126,11 @@ Depending on host platform, the selection of toolchains may vary. #### Windows -* Visual Studio 2017 with the Windows 10 SDK on a 64 bit host. +* Visual Studio 2017 with the Windows 10 SDK on a 64-bit host. #### OpenSSL asm support -OpenSSL-1.1.0 requires the following asssembler version for use of asm +OpenSSL-1.1.0 requires the following assembler version for use of asm support on x86_64 and ia32. * gas (GNU assembler) version 2.23 or higher @@ -144,10 +142,8 @@ Otherwise `configure` will fail with an error. This can be avoided by either providing a newer assembler as per the list above or by using the `--openssl-no-asm` flag. -*Note:* The forthcoming OpenSSL-1.1.1 will require higher - version. Please refer - https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html for - details. +The forthcoming OpenSSL-1.1.1 will have different requirements. Please refer to + https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html for details. ## Building Node.js on supported platforms @@ -216,7 +212,7 @@ $ make test-only At this point, you are ready to make code changes and re-run the tests. -If you are running tests prior to submitting a Pull Request, the recommended +If you are running tests before submitting a Pull Request, the recommended command is: ```console @@ -318,7 +314,7 @@ These core dumps are useful for debugging when provided with the corresponding original debug binary and system information. Reading the core dump requires `gdb` built on the same platform the core dump -was captured on (i.e. 64 bit `gdb` for `node` built on a 64 bit system, Linux +was captured on (i.e. 64-bit `gdb` for `node` built on a 64-bit system, Linux `gdb` for `node` built on Linux) otherwise you will get errors like `not in executable format: File format not recognized`. @@ -344,7 +340,7 @@ Prerequisites: and tools which can be included in the global `PATH`. * The [NetWide Assembler](http://www.nasm.us/), for OpenSSL assembler modules. If not installed in the default location, it needs to be manually added - to `PATH`. Build with `openssl-no-asm` option does not require this. + to `PATH`. A build with the `openssl-no-asm` option does not need this. * **Optional** (to build the MSI): the [WiX Toolset v3.11](http://wixtoolset.org/releases/) and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension). @@ -369,12 +365,10 @@ To test if Node.js was built correctly: ### Android/Android-based devices (e.g. Firefox OS) -Although these instructions for building on Android are provided, please note -that Android is not an officially supported platform at this time. Patches to -improve the Android build are accepted. However, there is no testing on Android -in the current continuous integration environment. The participation of people -dedicated and determined to improve Android building, testing, and support is -encouraged. +Android is not a supported platform. Patches to improve the Android build are +welcome. There is no testing on Android in the current continuous integration +environment. The participation of people dedicated and determined to improve +Android building, testing, and support is encouraged. Be sure you have downloaded and extracted [Android NDK](https://developer.android.com/tools/sdk/ndk/index.html) before in @@ -439,7 +433,7 @@ $ ./configure --without-intl $ pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu ``` -If you are cross compiling, your `pkg-config` must be able to supply a path +If you are cross-compiling, your `pkg-config` must be able to supply a path that works for both your host and target environments. #### Build with a specific ICU: @@ -449,6 +443,10 @@ You can find other ICU releases at Download the file named something like `icu4c-**##.#**-src.tgz` (or `.zip`). +To check the minimum recommended ICU, run `./configure --help` and see +the help for the `--with-icu-source` option. A warning will be printed +during configuration if the ICU version is too old. + ##### Unix/macOS From an already-unpacked ICU: @@ -483,7 +481,7 @@ This version of Node.js does not support FIPS. ## Building Node.js with external core modules It is possible to specify one or more JavaScript text files to be bundled in -the binary as builtin modules when building Node.js. +the binary as built-in modules when building Node.js. ### Unix/macOS @@ -503,3 +501,14 @@ To make `./myModule.js` available via `require('myModule')` and ```console > .\vcbuild link-module './myModule.js' link-module './myModule2.js' ``` + +## Note for downstream distributors of Node.js + +The Node.js ecosystem is reliant on ABI compatibility within a major +release. To maintain ABI compatibility it is required that production +builds of Node.js will be built against the same version of dependencies as the +project vendors. If Node.js is to be built against a different version of a +dependency please create a custom `NODE_MODULE_VERSION` to ensure ecosystem +compatibility. Please consult with the TSC by opening an issue at +https://github.com/nodejs/tsc/issues if you decide to create a custom +`NODE_MODULE_VERSION` so we can avoid duplication in the ecosystem. diff --git a/CHANGELOG.md b/CHANGELOG.md index ffc341d69a8820..6d05bd8013ad19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,5 @@ # Node.js Changelog - - -To make the changelog easier to both use and manage, it has been split into -multiple files organized according to significant major and minor Node.js -release lines. - Select a Node.js version below to view the changelog history: * [Node.js 10](doc/changelogs/CHANGELOG_V10.md) — **Long Term Support** @@ -23,6 +17,7 @@ Select a Node.js version below to view the changelog history: Please use the following table to find the changelog for a specific Node.js release. + @@ -31,7 +26,8 @@ release.
10Current
-10.14.1
+10.14.2
+10.14.1
10.14.0
10.13.0
10.12.0
@@ -119,10 +115,9 @@ release. ### Notes -* Release streams marked with `LTS` are currently covered by the - [Node.js Long Term Support plan](https://github.com/nodejs/Release). -* Release versions displayed in **bold** text represent the most - recent actively supported release. +* The [Node.js Long Term Support plan](https://github.com/nodejs/Release) covers + LTS releases. +* Release versions in **bold** text are the most recent supported releases. ---- ---- diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 5a935352a1f9f0..4c211405596cb4 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,8 +1,4 @@ # Code of Conduct -The Node.js Code of Conduct document has moved to -https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md. Please update -links to this document accordingly. - -The Node.js Moderation policy can be found at -https://github.com/nodejs/admin/blob/master/Moderation-Policy.md +* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) +* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 7a435c6478bf45..7fa6fee197aabc 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -28,7 +28,7 @@ - [Using `git-node`](#using-git-node) - [Technical HOWTO](#technical-howto) - [Troubleshooting](#troubleshooting) - - [I Just Made a Mistake](#i-just-made-a-mistake) + - [I Made a Mistake](#i-made-a-mistake) - [Long Term Support](#long-term-support) - [What is LTS?](#what-is-lts) - [How does LTS work?](#how-does-lts-work) @@ -38,13 +38,10 @@ - [How is an LTS release cut?](#how-is-an-lts-release-cut) * [Who to CC in the issue tracker](#who-to-cc-in-the-issue-tracker) -This document contains information for Collaborators of the Node.js -project regarding managing the project's code, documentation, and issue tracker. - -Collaborators should be familiar with the guidelines for new -contributors in [CONTRIBUTING.md](./CONTRIBUTING.md) and also -understand the project governance model as outlined in -[GOVERNANCE.md](./GOVERNANCE.md). +This document explains how Collaborators manage the Node.js project. +Collaborators should understand the +[guidelines for new contributors](CONTRIBUTING.md) and the +[project governance model](GOVERNANCE.md). ## Issues and Pull Requests @@ -100,7 +97,8 @@ As soon as the PR is ready to land, please do so. Landing your own pull requests allows other Collaborators to focus on other pull requests. If your pull request is still awaiting the [minimum time to land](#waiting-for-approvals), add the `author ready` label so other Collaborators know it can land as soon as the time -ends. +ends. If instead you wish to land the PR yourself, indicate this intent by using +the "assign yourself" button, to self-assign the PR. ## Accepting Modifications @@ -139,30 +137,26 @@ the CI outcome. ### Consensus Seeking -If there is no disagreement amongst Collaborators, a pull request should be -landed given appropriate review, a green CI, and the minimum -[waiting time](#waiting-for-approvals) for a PR. If it is still awaiting the -[minimum time to land](#waiting-for-approvals), please add the `author ready` -label to it so it is obvious that the PR can land as soon as the time ends. - -Where there is discussion amongst Collaborators, consensus should be sought if -possible. The lack of consensus may indicate the need to elevate discussion to -the TSC for resolution. - -If any Collaborator objects to a change *without giving any additional -explanation or context*, and the objecting Collaborator fails to respond to -explicit requests for explanation or context within a reasonable period of -time, the objection may be dismissed. Note that this does not apply to -objections that are explained. - -Note that breaking changes (that is, pull requests that require an increase in -the major version number, known as `semver-major` changes) must be [elevated for -review by the TSC](#involving-the-tsc). This does not necessarily mean that the -PR must be put onto the TSC meeting agenda. If multiple TSC members approve -(`LGTM`) the PR and no Collaborators oppose the PR, it should be landed. Where -there is disagreement among TSC members or objections from one or more -Collaborators, `semver-major` pull requests may be put on the TSC meeting -agenda. +If there are no objecting Collaborators, a pull request may land if it has the +needed [approvals](#code-reviews), [CI](#testing-and-ci), and +[wait time](#waiting-for-approvals). If a pull request meets all requirements +except the [wait time](#waiting-for-approvals), please add the +[`author ready`](#author-ready-pull-requests) label. + +Where there is disagreement among Collaborators, consensus should be sought if +possible. If reaching consensus is not possible, a Collaborator may escalate the +issue to the TSC. + +Collaborators should not block a pull request without providing a reason. +Another Collaborator may ask an objecting Collaborator to explain their +objection. If the objector is unresponsive, another Collaborator may dismiss the +objection. + +[Breaking changes](#breaking-changes) must receive +[TSC review](#involving-the-tsc). If two TSC members approve the pull request +and no Collaborators object, then it may land. If there are objections, a +Collaborator may apply the `tsc-agenda` label. That will put the pull request on +the TSC meeting agenda. #### Helpful resources @@ -190,7 +184,9 @@ Collaborators that previously approved the pull request. If someone disagrees with the fast-tracking request, remove the label and leave a comment indicating why the pull request should not be fast-tracked. The pull request can be landed once two or more Collaborators approve both the pull request and the -fast-tracking request, and the necessary CI testing is done. +fast-tracking request, and the necessary CI testing is done. A request to +fast-track a PR made by a different Collaborator than the pull-request author +counts as a fast-track approval. ### Testing and CI @@ -498,19 +494,23 @@ This should be done where a pull request: Assign the `tsc-review` label or @-mention the `@nodejs/tsc` GitHub team if you want to elevate an issue to the [TSC][]. -Do not use the GitHub UI on the right hand side to assign to +Do not use the GitHub UI on the right-hand side to assign to `@nodejs/tsc` or request a review from `@nodejs/tsc`. The TSC should serve as the final arbiter where required. ## Landing Pull Requests +1. Avoid landing PRs that are assigned to someone else. Authors who wish to land + their own PRs will self-assign them, or delegate to someone else. If in + doubt, ask the assignee whether it is okay to land. 1. Never use GitHub's green ["Merge Pull Request"][] button. Reasons for not using the web interface button: - * The merge method will add an unnecessary merge commit. - * The squash & merge method can add metadata (the PR #) to the commit title. - * If more than one author has contributed to the PR, keep the most recent - author when squashing. + * The "Create a merge commit" method will add an unnecessary merge commit. + * The "Squash and merge" method will add metadata (the PR #) to the commit + title. If more than one author has contributed to the PR, squashing will + only keep the most recent author. + * The "Rebase and merge" method has no way of adding metadata to the commit. 1. Make sure the CI is done and the result is green. If the CI is not green, check for flaky tests and infrastructure failures. Please check if those were already reported in the appropriate repository ([node][flaky tests] and @@ -521,13 +521,12 @@ The TSC should serve as the final arbiter where required. present. 1. Review the commit message to ensure that it adheres to the guidelines outlined in the [contributing][] guide. -1. Add all necessary [metadata](#metadata) to commit messages before landing. - See the commit log for examples such as [this - one](https://github.com/nodejs/node/commit/b636ba8186) if unsure exactly how - to format your commit messages. +1. Add all necessary [metadata](#metadata) to commit messages before landing. If + you are unsure exactly how to format the commit messages, use the commit log + as a reference. See [this commit][commit-example] as an example. -Check PRs from new contributors to make sure the person's name and email address -are correct before merging. +For PRs from first-time contributors, be [welcoming](#welcoming-first-time-contributors). +Also, verify that their git settings are to their liking. All commits should be self-contained, meaning every commit should pass all tests. This makes it much easier when bisecting to find a breaking change. @@ -745,7 +744,7 @@ make -j4 test git push upstream master ``` -### I Just Made a Mistake +### I Made a Mistake * Ping a TSC member. * `#node-dev` on freenode @@ -905,6 +904,7 @@ If you cannot find who to cc for a file, `git shortlog -n -s ` may help. [`node-core-utils`]: https://github.com/nodejs/node-core-utils [backporting guide]: doc/guides/backporting-to-release-lines.md [contributing]: ./doc/guides/contributing/pull-requests.md#commit-message-guidelines +[commit-example]: https://github.com/nodejs/node/commit/b636ba8186 [flaky tests]: https://github.com/nodejs/node/issues?q=is%3Aopen+is%3Aissue+label%3A%22CI+%2F+flaky+test%22y [git-node]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md [git-node-metadata]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-metadata diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 684277980a8ee6..1a3babf8405ea2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,18 +1,5 @@ # Contributing to Node.js -Contributions to Node.js include code, documentation, answering user questions, -running the project's infrastructure, and advocating for all types of Node.js -users. - -The Node.js project welcomes all contributions from anyone willing to work in -good faith with other contributors and the community. No contribution is too -small and all contributions are valued. - -This guide explains the process for contributing to the Node.js project's core -`nodejs/node` GitHub Repository and describes what to expect at each step. - -## Contents - * [Code of Conduct](#code-of-conduct) * [Issues](#issues) * [Pull Requests](#pull-requests) @@ -22,16 +9,12 @@ This guide explains the process for contributing to the Node.js project's core The Node.js project has a [Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) -that *all* contributors are expected to follow. This code describes the -*minimum* behavior expectations for all contributors. +to which all contributors must adhere. See [details on our policy on Code of Conduct](./doc/guides/contributing/coc.md). ## [Issues](./doc/guides/contributing/issues.md) -Issues in `nodejs/node` are the primary means by which bug reports and -general discussions are made. - * [How to Contribute in Issues](./doc/guides/contributing/issues.md#how-to-contribute-in-issues) * [Asking for General Help](./doc/guides/contributing/issues.md#asking-for-general-help) * [Discussing non-technical topics](./doc/guides/contributing/issues.md#discussing-non-technical-topics) @@ -41,14 +24,11 @@ general discussions are made. ## [Pull Requests](./doc/guides/contributing/pull-requests.md) -Pull Requests are the way concrete changes are made to the code, documentation, -dependencies, and tools contained in the `nodejs/node` repository. - * [Dependencies](./doc/guides/contributing/pull-requests.md#dependencies) * [Setting up your local environment](./doc/guides/contributing/pull-requests.md#setting-up-your-local-environment) * [The Process of Making Changes](./doc/guides/contributing/pull-requests.md#the-process-of-making-changes) * [Reviewing Pull Requests](./doc/guides/contributing/pull-requests.md#reviewing-pull-requests) -* [Additional Notes](./doc/guides/contributing/pull-requests.md#additional-notes) +* [Notes](./doc/guides/contributing/pull-requests.md#notes) ## Developer's Certificate of Origin 1.1 diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index ae0135b5c0bdff..5099f34ea866c9 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -2,6 +2,7 @@ ## Table of Contents +* [Guides and References](#guides-and-references) * [Formatting](#formatting) * [Left-leaning (C++ style) asterisks for pointer declarations](#left-leaning-c-style-asterisks-for-pointer-declarations) * [C++ style comments](#c-style-comments) @@ -17,7 +18,9 @@ * [Memory Management](#memory-management) * [Memory allocation](#memory-allocation) * [Use `nullptr` instead of `NULL` or `0`](#use-nullptr-instead-of-null-or-0) + * [Use explicit pointer comparisons](#use-explicit-pointer-comparisons) * [Ownership and Smart Pointers](#ownership-and-smart-pointers) + * [Avoid non-const references](#avoid-non-const-references) * [Others](#others) * [Type casting](#type-casting) * [Using `auto`](#using-auto) @@ -25,14 +28,30 @@ * [Avoid throwing JavaScript errors in C++ methods](#avoid-throwing-javascript-errors-in-c) * [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods) -Unfortunately, the C++ linter (based on -[Google’s `cpplint`](https://github.com/google/styleguide)), which can be run -explicitly via `make lint-cpp`, does not currently catch a lot of rules that are -specific to the Node.js C++ code base. This document explains the most common of -these rules: + +## Guides and References + +The Node.js C++ codebase strives to be consistent in its use of language +features and idioms, as well as have some specific guidelines for the use of +runtime features. + +Coding guidelines are based on the following guides (highest priority first): +1. This document +2. The [Google C++ Style Guide][] +3. The ISO [C++ Core Guidelines][] + +In general code should follow the C++ Core Guidelines, unless overridden by the +Google C++ Style Guide or this document. At the moment these guidelines are +checked manually by reviewers, with the goal to validate this with automatic +tools. ## Formatting +Unfortunately, the C++ linter (based on [Google’s `cpplint`][]), which can be +run explicitly via `make lint-cpp`, does not currently catch a lot of rules that +are specific to the Node.js C++ code base. This document explains the most +common of these rules: + ### Left-leaning (C++ style) asterisks for pointer declarations `char* buffer;` instead of `char *buffer;` @@ -175,40 +194,82 @@ class FancyContainer { ### Use `nullptr` instead of `NULL` or `0` -What it says in the title. +Further reading in the [C++ Core Guidelines][ES.47]. + +### Use explicit pointer comparisons + +Use explicit comparisons to `nullptr` when testing pointers, i.e. +`if (foo == nullptr)` instead of `if (foo)` and +`foo != nullptr` instead of `!foo`. ### Ownership and Smart Pointers -"Smart" pointers are classes that act like pointers, e.g. -by overloading the `*` and `->` operators. Some smart pointer types can be -used to automate ownership bookkeeping, to ensure these responsibilities are -met. `std::unique_ptr` is a smart pointer type introduced in C++11, which -expresses exclusive ownership of a dynamically allocated object; the object -is deleted when the `std::unique_ptr` goes out of scope. It cannot be -copied, but can be moved to represent ownership transfer. -`std::shared_ptr` is a smart pointer type that expresses shared ownership of a -dynamically allocated object. `std::shared_ptr`s can be copied; ownership -of the object is shared among all copies, and the object -is deleted when the last `std::shared_ptr` is destroyed. - -Prefer to use `std::unique_ptr` to make ownership -transfer explicit. For example: +* [R.20]: Use `std::unique_ptr` or `std::shared_ptr` to represent ownership +* [R.21]: Prefer `unique_ptr` over `shared_ptr` unless you need to share + ownership + +Use `std::unique_ptr` to make ownership transfer explicit. For example: ```cpp std::unique_ptr FooFactory(); void FooConsumer(std::unique_ptr ptr); ``` -Never use `std::auto_ptr`. Instead, use `std::unique_ptr`. +Since `std::unique_ptr` has only move semantics, passing one by value transfers +ownership to the callee and invalidates the caller's instance. + +Don't use `std::auto_ptr`, it is deprecated ([Reference][cppref_auto_ptr]). + +### Avoid non-const references + +Using non-const references often obscures which values are changed by an +assignment. Consider using a pointer instead, which requires more explicit +syntax to indicate that modifications take place. + +```c++ +class ExampleClass { + public: + explicit ExampleClass(OtherClass* other_ptr) : pointer_to_other_(other_ptr) {} + + void SomeMethod(const std::string& input_param, + std::string* in_out_param); // Pointer instead of reference + + const std::string& get_foo() const { return foo_string_; } + void set_foo(const std::string& new_value) { foo_string_ = new_value; } + + void ReplaceCharacterInFoo(char from, char to) { + // A non-const reference is okay here, because the method name already tells + // users that this modifies 'foo_string_' -- if that is not the case, + // it can still be better to use an indexed for loop, or leave appropriate + // comments. + for (char& character : foo_string_) { + if (character == from) + character = to; + } + } + + private: + std::string foo_string_; + // Pointer instead of reference. If this object 'owns' the other object, + // this should be a `std::unique_ptr`; a + // `std::shared_ptr` can also be a better choice. + OtherClass* pointer_to_other_; +}; +``` ## Others ### Type casting -- Always avoid C-style casts (`(type)value`) -- `dynamic_cast` does not work because RTTI is not enabled -- Use `static_cast` for casting whenever it works -- `reinterpret_cast` is okay if `static_cast` is not appropriate +- Use `static_cast` if casting is required, and it is valid +- Use `reinterpret_cast` only when it is necessary +- Avoid C-style casts (`(type)value`) +- `dynamic_cast` does not work because Node.js is built without + [Run Time Type Information][] + +Further reading: +* [ES.48]: Avoid casts +* [ES.49]: If you must use a cast, use a named cast ### Using `auto` @@ -299,9 +360,25 @@ exports.foo = function(str) { #### Avoid throwing JavaScript errors in nested C++ methods -When you have to throw the errors from C++, try to do it at the top level and -not inside of nested calls. +When you need to throw a JavaScript exception from C++ (i.e. +`isolate()->ThrowException()`) prefer to do it as close to the return to JS as +possible, and not inside of nested C++ calls. Since this changes the JS +execution state doing it closest to where it is consumed reduces the chances of +side effects. + +Node.js is built [without C++ exception handling][], so code using `throw` or +even `try` and `catch` **will** break. -Using C++ `throw` is not allowed. +[C++ Core Guidelines]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines +[Google C++ Style Guide]: https://google.github.io/styleguide/cppguide.html +[Google’s `cpplint`]: https://github.com/google/styleguide [errors]: https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md +[ES.47]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-nullptr +[ES.48]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-casts +[ES.49]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-casts-named +[R.20]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-owner +[R.21]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-unique +[Run Time Type Information]: https://en.wikipedia.org/wiki/Run-time_type_information +[cppref_auto_ptr]: https://en.cppreference.com/w/cpp/memory/auto_ptr +[without C++ exception handling]: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_exceptions.html#intro.using.exception.no diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 40ef6e7bbe5fcb..d92d3c821e85b3 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -45,7 +45,7 @@ be accepted unless: * Discussions and/or additional changes result in no Collaborators objecting to the change. Previously-objecting Collaborators do not necessarily have to - sign-off on the change, but they should not be opposed to it. + sign off on the change, but they should not be opposed to it. * The change is escalated to the TSC and the TSC votes to approve the change. This should only happen if disagreements between Collaborators cannot be resolved through discussion. @@ -123,8 +123,8 @@ The meeting chair is responsible for ensuring that minutes are taken and that a pull request with the minutes is submitted after the meeting. Due to the challenges of scheduling a global meeting with participants in -several timezones, the TSC will seek to resolve as many agenda items as possible -outside of meetings using +several time zones, the TSC will seek to resolve as many agenda items as +possible outside of meetings using [the TSC issue tracker](https://github.com/nodejs/TSC/issues). The process in the issue tracker is: @@ -196,7 +196,7 @@ completed within a month after the nomination is accepted. ## Consensus Seeking Process -The TSC follows a [Consensus Seeking][] decision making model as described by +The TSC follows a [Consensus Seeking][] decision-making model as described by the [TSC Charter][]. [collaborators-discussions]: https://github.com/orgs/nodejs/teams/collaborators/discussions diff --git a/Makefile b/Makefile index a98772faea6dca..ae3830ddd40e00 100644 --- a/Makefile +++ b/Makefile @@ -203,9 +203,9 @@ coverage: coverage-test ## Run the tests and generate a coverage report. coverage-build: all mkdir -p node_modules if [ ! -d node_modules/nyc ]; then \ - $(NODE) ./deps/npm install nyc --no-save --no-package-lock; fi + $(NODE) ./deps/npm install nyc@13 --no-save --no-package-lock; fi if [ ! -d gcovr ]; then git clone -b 3.4 --depth=1 \ - --single-branch git://github.com/gcovr/gcovr.git; fi + --single-branch https://github.com/gcovr/gcovr.git; fi if [ ! -d build ]; then git clone --depth=1 \ --single-branch https://github.com/nodejs/build.git; fi if [ ! -f gcovr/scripts/gcovr.orig ]; then \ @@ -234,8 +234,9 @@ coverage-test: coverage-build $(NODE) ./node_modules/.bin/nyc merge 'out/Release/.coverage' \ .cov_tmp/libcov.json (cd lib && .$(NODE) ../node_modules/.bin/nyc report \ - --temp-directory "$(CURDIR)/.cov_tmp" \ - --report-dir "$(CURDIR)/coverage") + --temp-dir "$(CURDIR)/.cov_tmp" \ + --report-dir "$(CURDIR)/coverage" \ + --reporter html) -(cd out && "../gcovr/scripts/gcovr" --gcov-exclude='.*deps' \ --gcov-exclude='.*usr' -v -r Release/obj.target \ --html --html-detail -o ../coverage/cxxcoverage.html \ @@ -269,7 +270,7 @@ v8: tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS) .PHONY: jstest -jstest: build-addons build-addons-napi ## Runs addon tests and JS tests +jstest: build-addons build-addons-napi bench-addons-build ## Runs addon tests and JS tests $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \ --skip-tests=$(CI_SKIP_TESTS) \ $(CI_JS_SUITES) \ @@ -307,19 +308,19 @@ test-valgrind: all test-check-deopts: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) --check-deopts parallel sequential -benchmark/napi/function_call/build/Release/binding.node: all \ +benchmark/napi/function_call/build/Release/binding.node: \ benchmark/napi/function_call/napi_binding.c \ benchmark/napi/function_call/binding.cc \ - benchmark/napi/function_call/binding.gyp + benchmark/napi/function_call/binding.gyp | all $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ --python="$(PYTHON)" \ --directory="$(shell pwd)/benchmark/napi/function_call" \ --nodedir="$(shell pwd)" -benchmark/napi/function_args/build/Release/binding.node: all \ +benchmark/napi/function_args/build/Release/binding.node: \ benchmark/napi/function_args/napi_binding.c \ benchmark/napi/function_args/binding.cc \ - benchmark/napi/function_args/binding.gyp + benchmark/napi/function_args/binding.gyp | all $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ --python="$(PYTHON)" \ --directory="$(shell pwd)/benchmark/napi/function_args" \ @@ -413,7 +414,7 @@ clear-stalled: echo $${PS_OUT} | xargs kill -9; \ fi -test-build: | all build-addons build-addons-napi +test-build: | all build-addons build-addons-napi bench-addons-build test-build-addons-napi: all build-addons-napi @@ -443,7 +444,7 @@ test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp test-ci-js: | clear-stalled $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ - $(TEST_CI_ARGS) $(CI_JS_SUITES) + $(TEST_CI_ARGS) $(CI_JS_SUITES) --skip-tests=sequential/test-benchmark-napi @echo "Clean up any leftover processes, error if found." ps awwx | grep Release/node | grep -v grep | cat @PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \ @@ -454,7 +455,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-addons-napi doc-only +test-ci: | clear-stalled build-addons build-addons-napi doc-only bench-addons-build out/Release/cctest --gtest_output=tap:cctest.tap $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \ --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \ @@ -495,7 +496,7 @@ test-debug: test-build test-message: test-build $(PYTHON) tools/test.py $(PARALLEL_ARGS) message -test-simple: | cctest # Depends on 'all'. +test-simple: | cctest bench-addons-build # Depends on 'all'. $(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential test-pummel: all @@ -809,12 +810,11 @@ MACOSOUTDIR=out/macos .PHONY: release-only release-only: - @if [ "$(DISTTYPE)" != "nightly" ] && [ "$(DISTTYPE)" != "next-nightly" ] && \ - `grep -q REPLACEME doc/api/*.md`; then \ + @if [ "$(DISTTYPE)" = "release" ] && `grep -q REPLACEME doc/api/*.md`; then \ echo 'Please update REPLACEME in Added: tags in doc/api/*.md (See doc/releases.md)' ; \ exit 1 ; \ fi - @if [ "$(DISTTYPE)" != "nightly" ] && [ "$(DISTTYPE)" != "next-nightly" ] && \ + @if [ "$(DISTTYPE)" = "release" ] && \ `grep -q DEP...X doc/api/deprecations.md`; then \ echo 'Please update DEP...X in doc/api/deprecations.md (See doc/releases.md)' ; \ exit 1 ; \ @@ -1207,6 +1207,28 @@ lint-addon-docs: test/addons/.docbuildstamp cpplint: lint-cpp @echo "Please use lint-cpp instead of cpplint" +.PHONY: lint-py-build +# python -m pip install flake8 +# Try with '--system' is to overcome systems that blindly set '--user' +lint-py-build: + @echo "Pip installing flake8 linter on $(shell $(PYTHON) --version)..." + $(PYTHON) -m pip install --upgrade -t tools/pip/site-packages flake8 || \ + $(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages flake8 + +ifneq ("","$(wildcard tools/pip/site-packages)") +.PHONY: lint-py +# Lints the Python code with flake8. +# Flag the build if there are Python syntax errors or undefined names +lint-py: + PYTHONPATH=tools/pip $(PYTHON) -m flake8 . \ + --count --show-source --statistics --select=E901,E999,F821,F822,F823 \ + --exclude=deps,lib,src,tools/*_macros.py,tools/gyp,tools/jinja2,tools/pip +else +lint-py: + @echo "Python linting with flake8 is not avalible" + @echo "Run 'make lint-py-build'" +endif + .PHONY: lint .PHONY: lint-ci ifneq ("","$(wildcard tools/node_modules/eslint/)") @@ -1220,7 +1242,7 @@ lint: ## Run JS, C++, MD and doc linters. CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+ # Related CI job: node-test-linter -lint-ci: lint-js-ci lint-cpp lint-md lint-addon-docs +lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs @if ! ( grep -IEqrs "$(CONFLICT_RE)" benchmark deps doc lib src test tools ) \ && ! ( find . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \ exit 0 ; \ diff --git a/README.md b/README.md index 47e178845d1dbf..79b12e289a58f4 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The Node.js project uses an [open governance model](./GOVERNANCE.md). The * [Current Project Team Members](#current-project-team-members) * [TSC (Technical Steering Committee)](#tsc-technical-steering-committee) * [Collaborators](#collaborators) - * [Release Team](#release-team) + * [Release Keys](#release-keys) * [Contributing to Node.js](#contributing-to-nodejs) ## Support @@ -81,7 +81,7 @@ your expectations. changes. Use with caution. Current and LTS releases follow [Semantic Versioning](https://semver.org). A -member of the [Release Team](#release-team) signs each Current and LTS release. +member of the Release Team [signs](#release-keys) each Current and LTS release. For more information, see the [Release README](https://github.com/nodejs/Release). @@ -133,9 +133,9 @@ $ grep node-vx.y.z.tar.gz SHASUMS256.txt | sha256sum -c - For Current and LTS, the GPG detached signature of `SHASUMS256.txt` is in `SHASUMS256.txt.sig`. You can use it with `gpg` to verify the integrity of -`SHASUM256.txt`. You will first need to import all the GPG keys of individuals -authorized to create releases. They are at the bottom of this README under -[Release Team](#release-team). To import the keys: +`SHASUM256.txt`. You will first need to import +[the GPG keys of individuals authorized to create releases](#release-keys). To +import the keys: ```console $ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D @@ -159,64 +159,12 @@ source and a list of supported platforms. ## Security -Security flaws in Node.js should be reported by emailing security@nodejs.org. -Please do not disclose security bugs publicly until they have been handled by -the security team. - -Your email will be acknowledged within 24 hours, and you will receive a more -detailed response to your email within 48 hours indicating the next steps in -handling your report. - -There are no hard and fast rules to determine if a bug is worth reporting as -a security issue. The general rule is an issue worth reporting should allow an -attacker to compromise the confidentiality, integrity, or availability of the -Node.js application or its system for which the attacker does not already have -the capability. - -To illustrate the point, here are some examples of past issues and what the -Security Response Team thinks of them. When in doubt, however, please do send -us a report nonetheless. - - -### Public disclosure preferred - -- [#14519](https://github.com/nodejs/node/issues/14519): _Internal domain - function can be used to cause segfaults_. Causing program termination using - either the public JavaScript APIs or the private bindings layer APIs requires - the ability to execute arbitrary JavaScript code, which is already the highest - level of privilege possible. - -- [#12141](https://github.com/nodejs/node/pull/12141): _buffer: zero fill - Buffer(num) by default_. The buffer constructor behavior was documented, - but found to be prone to [mis-use](https://snyk.io/blog/exploiting-buffer/). - It has since been changed, but despite much debate, was not considered misuse - prone enough to justify fixing in older release lines and breaking our - API stability contract. - -### Private disclosure preferred - -- [CVE-2016-7099](https://nodejs.org/en/blog/vulnerability/september-2016-security-releases/): - _Fix invalid wildcard certificate validation check_. This is a high severity - defect that would allow a malicious TLS server to serve an invalid wildcard - certificate for its hostname and be improperly validated by a Node.js client. - -- [#5507](https://github.com/nodejs/node/pull/5507): _Fix a defect that makes - the CacheBleed Attack possible_. Many, though not all, OpenSSL vulnerabilities - in the TLS/SSL protocols also affect Node.js. - -- [CVE-2016-2216](https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/): - _Fix defects in HTTP header parsing for requests and responses that can allow - response splitting_. While the impact of this vulnerability is application and - network dependent, it is remotely exploitable in the HTTP protocol. - -When in doubt, please do send us a report. - +For information on reporting security vulnerabilities in Node.js, see +[SECURITY.md](./SECURITY.md). ## Current Project Team Members -The Node.js project team comprises a group of core collaborators and a sub-group -that forms the _Technical Steering Committee_ (TSC) which governs the project. -For more information about the governance of the Node.js project, see +For information about the governance of the Node.js project, see [GOVERNANCE.md](./GOVERNANCE.md). ### TSC (Technical Steering Committee) @@ -453,12 +401,12 @@ For more information about the governance of the Node.js project, see **Alexis Campailla** <orangemocha@nodejs.org> * [othiym23](https://github.com/othiym23) - **Forrest L Norvell** <ogd@aoaioxxysz.net> (he/him) -* [phillipj](https://github.com/phillipj) - -**Phillip Johnsen** <johphi@gmail.com> * [pmq20](https://github.com/pmq20) - **Minqi Pan** <pmq2001@gmail.com> * [princejwesley](https://github.com/princejwesley) - **Prince John Wesley** <princejohnwesley@gmail.com> +* [psmarshall](https://github.com/psmarshall) - +**Peter Marshall** <petermarshall@chromium.org> (he/him) * [Qard](https://github.com/Qard) - **Stephen Belanger** <admin@stephenbelanger.com> (he/him) * [refack](https://github.com/refack) - @@ -487,6 +435,8 @@ For more information about the governance of the Node.js project, see **Nikolai Vavilov** <vvnicholas@gmail.com> * [shigeki](https://github.com/shigeki) - **Shigeki Ohtsu** <ohtsu@ohtsu.org> (he/him) +* [shisama](https://github.com/shisama) - +**Masashi Hirano** <shisama07@gmail.com> (he/him) * [silverwind](https://github.com/silverwind) - **Roman Reiss** <me@silverwind.io> * [srl295](https://github.com/srl295) - @@ -554,6 +504,8 @@ For more information about the governance of the Node.js project, see **Oleg Elifantiev** <oleg@elifantiev.ru> * [petkaantonov](https://github.com/petkaantonov) - **Petka Antonov** <petka_antonov@hotmail.com> +* [phillipj](https://github.com/phillipj) - +**Phillip Johnsen** <johphi@gmail.com> * [piscisaureus](https://github.com/piscisaureus) - **Bert Belder** <bertbelder@gmail.com> * [rlidwka](https://github.com/rlidwka) - @@ -572,9 +524,9 @@ For more information about the governance of the Node.js project, see Collaborators follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js project. -### Release Team +### Release Keys -Node.js releases are signed with one of the following GPG keys: +GPG keys used to sign Node.js releases: * **Colin Ihrig** <cjihrig@gmail.com> `94AE36675C464D64BAFA68DD7434390BDBE9B9C5` @@ -593,7 +545,7 @@ Node.js releases are signed with one of the following GPG keys: * **Rod Vagg** <rod@vagg.org> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D` -The full set of trusted release keys can be imported by running: +To import the full set of trusted release keys: ```shell gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 @@ -609,7 +561,7 @@ gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273 See the section above on [Verifying Binaries](#verifying-binaries) for how to use these keys to verify a downloaded file. -Previous releases may also have been signed with one of the following GPG keys: +Other keys used to sign some previous releases: * **Chris Dickinson** <christopher.s.dickinson@gmail.com> `9554F04D7259F04124DE6B476D5A82AC7E37093B` diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000000000..5f1e3e2cc7d563 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,37 @@ +# Security + +If you find a security vulnerability in Node.js, please report it to +security@nodejs.org. Please withhold public disclosure until after the security +team has addressed the vulnerability. + +The security team will acknowledge your email within 24 hours. You will receive +a more detailed response within 48 hours. + +There are no hard and fast rules to determine if a bug is worth reporting as a +security issue. Here are some examples of past issues and what the Security +Response Team thinks of them. When in doubt, please do send us a report +nonetheless. + +## Public disclosure preferred + +- [#14519](https://github.com/nodejs/node/issues/14519): _Internal domain + function can be used to cause segfaults_. Requires the ability to execute + arbitrary JavaScript code. That is already the highest level of privilege + possible. + +## Private disclosure preferred + +- [CVE-2016-7099](https://nodejs.org/en/blog/vulnerability/september-2016-security-releases/): + _Fix invalid wildcard certificate validation check_. This was a high-severity + defect. It caused Node.js TLS clients to accept invalid wildcard certificates. + +- [#5507](https://github.com/nodejs/node/pull/5507): _Fix a defect that makes + the CacheBleed Attack possible_. Many, though not all, OpenSSL vulnerabilities + in the TLS/SSL protocols also affect Node.js. + +- [CVE-2016-2216](https://nodejs.org/en/blog/vulnerability/february-2016-security-releases/): + _Fix defects in HTTP header parsing for requests and responses that can allow + response splitting_. This was a remotely-exploitable defect in the Node.js + HTTP implementation. + +When in doubt, please do send us a report. diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js index 76e02504b27ec1..c0e85316be7634 100644 --- a/benchmark/_http-benchmarkers.js +++ b/benchmark/_http-benchmarkers.js @@ -8,7 +8,7 @@ const requirementsURL = 'https://github.com/nodejs/node/blob/master/doc/guides/writing-and-running-benchmarks.md#http-benchmark-requirements'; // The port used by servers and wrk -exports.PORT = process.env.PORT || 12346; +exports.PORT = Number(process.env.PORT) || 12346; class AutocannonBenchmarker { constructor() { @@ -35,7 +35,7 @@ class AutocannonBenchmarker { let result; try { result = JSON.parse(output); - } catch (err) { + } catch { return undefined; } if (!result || !result.requests || !result.requests.average) { @@ -105,7 +105,7 @@ class TestDoubleBenchmarker { let result; try { result = JSON.parse(output); - } catch (err) { + } catch { return undefined; } return result.throughput; diff --git a/benchmark/child_process/child-process-exec-stdout.js b/benchmark/child_process/child-process-exec-stdout.js index a891026b86971f..88c02533f605c2 100644 --- a/benchmark/child_process/child-process-exec-stdout.js +++ b/benchmark/child_process/child-process-exec-stdout.js @@ -30,7 +30,7 @@ function childProcessExecStdout({ dur, len }) { // Sometimes there's a yes.exe process left hanging around on Windows. try { execSync(`taskkill /f /t /pid ${child.pid}`); - } catch (_) { + } catch { // this is a best effort kill. stderr is piped to parent for tracing. } } else { diff --git a/benchmark/fs/bench-mkdirp.js b/benchmark/fs/bench-mkdirp.js index 96a792c35a48e4..b9e62045f6cf50 100644 --- a/benchmark/fs/bench-mkdirp.js +++ b/benchmark/fs/bench-mkdirp.js @@ -16,7 +16,7 @@ function main({ n }) { if (cntr-- <= 0) return bench.end(n); const pathname = `${tmpdir.path}/${++dirc}/${++dirc}/${++dirc}/${++dirc}`; - fs.mkdir(pathname, { createParents: true }, (err) => { + fs.mkdir(pathname, { recursive: true }, (err) => { r(cntr); }); }(n)); diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index 3af80132725ec0..7f290a310b592c 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -55,7 +55,7 @@ function runTest() { }); rs.on('end', function() { - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} // MB/sec bench.end(bytes / (1024 * 1024)); }); @@ -74,7 +74,7 @@ function makeFile() { buf.fill('x'); } - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} var w = 1024; const ws = fs.createWriteStream(filename); ws.on('close', runTest); diff --git a/benchmark/fs/readfile-partitioned.js b/benchmark/fs/readfile-partitioned.js index be3b7fd057bbe0..6e355c158da850 100644 --- a/benchmark/fs/readfile-partitioned.js +++ b/benchmark/fs/readfile-partitioned.js @@ -24,7 +24,7 @@ const bench = common.createBenchmark(main, { function main(conf) { const len = +conf.len; - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} var data = Buffer.alloc(len, 'x'); fs.writeFileSync(filename, data); data = null; @@ -39,7 +39,7 @@ function main(conf) { const totalOps = reads + zips; benchEnded = true; bench.end(totalOps); - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} }, +conf.dur * 1000); function read() { diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index 282b4ac7621340..36439bdf909f1d 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, { }); function main({ len, dur, concurrent }) { - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} var data = Buffer.alloc(len, 'x'); fs.writeFileSync(filename, data); data = null; @@ -28,7 +28,7 @@ function main({ len, dur, concurrent }) { setTimeout(function() { benchEnded = true; bench.end(reads); - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} process.exit(0); }, dur * 1000); diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index 60ad47bc4eabe1..baf98f849fed07 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -33,7 +33,7 @@ function main({ dur, encodingType, size }) { throw new Error(`invalid encodingType: ${encodingType}`); } - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} var started = false; var ended = false; @@ -45,7 +45,7 @@ function main({ dur, encodingType, size }) { f.on('finish', function() { ended = true; const written = fs.statSync(filename).size / 1024; - try { fs.unlinkSync(filename); } catch (e) {} + try { fs.unlinkSync(filename); } catch {} bench.end(written / 1024); }); diff --git a/benchmark/http/bench-parser.js b/benchmark/http/bench-parser.js index d629fe67e59e76..fdf4ec0d1eda14 100644 --- a/benchmark/http/bench-parser.js +++ b/benchmark/http/bench-parser.js @@ -31,7 +31,7 @@ function processHeader(header, n) { bench.start(); for (var i = 0; i < n; i++) { parser.execute(header, 0, header.length); - parser.reinitialize(REQUEST); + parser.reinitialize(REQUEST, i > 0); } bench.end(n); } diff --git a/benchmark/misc/freelist.js b/benchmark/misc/freelist.js index 8c3281cc407363..7fa9af4f3ddb7f 100644 --- a/benchmark/misc/freelist.js +++ b/benchmark/misc/freelist.js @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { }); function main({ n }) { - const FreeList = require('internal/freelist'); + const { FreeList } = require('internal/freelist'); const poolSize = 1000; const list = new FreeList('test', poolSize, Object); var j; diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js index 369adcf17d3973..dc8df58ef38185 100644 --- a/benchmark/misc/punycode.js +++ b/benchmark/misc/punycode.js @@ -4,7 +4,7 @@ const common = require('../common.js'); let icu; try { icu = process.binding('icu'); -} catch (err) {} +} catch {} const punycode = require('punycode'); const bench = common.createBenchmark(main, { diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js index c79e1a73d4f21a..e780d6376b5e8d 100644 --- a/benchmark/module/module-loader.js +++ b/benchmark/module/module-loader.js @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, { function main({ n, fullPath, useCache }) { tmpdir.refresh(); - try { fs.mkdirSync(benchmarkDirectory); } catch (e) {} + try { fs.mkdirSync(benchmarkDirectory); } catch {} for (var i = 0; i <= n; i++) { fs.mkdirSync(`${benchmarkDirectory}${i}`); fs.writeFileSync( diff --git a/benchmark/napi/function_args/index.js b/benchmark/napi/function_args/index.js index 4beab531c17301..c41b5d78abadd9 100644 --- a/benchmark/napi/function_args/index.js +++ b/benchmark/napi/function_args/index.js @@ -11,14 +11,14 @@ let napi; try { v8 = require('./build/Release/binding'); -} catch (err) { +} catch { console.error(`${__filename}: V8 Binding failed to load`); process.exit(0); } try { napi = require('./build/Release/napi_binding'); -} catch (err) { +} catch { console.error(`${__filename}: NAPI-Binding failed to load`); process.exit(0); } diff --git a/benchmark/napi/function_args/napi_binding.c b/benchmark/napi/function_args/napi_binding.c index b697644ca441e9..1a3a0f1cd2b96e 100644 --- a/benchmark/napi/function_args/napi_binding.c +++ b/benchmark/napi/function_args/napi_binding.c @@ -50,7 +50,8 @@ static napi_value CallWithArray(napi_env env, napi_callback_info info) { status = napi_get_array_length(env, array, &length); assert(status == napi_ok); - for (uint32_t i = 0; i < length; ++i) { + uint32_t i; + for (i = 0; i < length; ++i) { napi_value v; status = napi_get_element(env, array, i, &v); assert(status == napi_ok); @@ -173,7 +174,8 @@ static napi_value CallWithArguments(napi_env env, napi_callback_info info) { status = napi_get_value_uint32(env, args[0], &loop); assert(status == napi_ok); - for (uint32_t i = 1; i < loop; ++i) { + uint32_t i; + for (i = 1; i < loop; ++i) { assert(i < argc); status = napi_typeof(env, args[i], types); assert(status == napi_ok); diff --git a/benchmark/napi/function_call/index.js b/benchmark/napi/function_call/index.js index cbc512c9729137..272c41662d2830 100644 --- a/benchmark/napi/function_call/index.js +++ b/benchmark/napi/function_call/index.js @@ -13,7 +13,7 @@ const common = require('../../common.js'); try { var binding = require('./build/Release/binding'); -} catch (er) { +} catch { console.error('misc/function_call.js Binding failed to load'); process.exit(0); } @@ -22,7 +22,7 @@ const cxx = binding.hello; let napi_binding; try { napi_binding = require('./build/Release/napi_binding'); -} catch (er) { +} catch { console.error('misc/function_call/index.js NAPI-Binding failed to load'); process.exit(0); } diff --git a/common.gypi b/common.gypi index 14c6b5ae9f8463..e2295ee35de832 100644 --- a/common.gypi +++ b/common.gypi @@ -33,7 +33,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.36', + 'v8_embedder_string': '-node.45', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/configure.py b/configure.py index b98e37d944d7f0..a5075bd9d8a60b 100755 --- a/configure.py +++ b/configure.py @@ -1,3 +1,4 @@ +import json import sys import errno import optparse @@ -50,6 +51,8 @@ valid_mips_fpu = ('fp32', 'fp64', 'fpxx') valid_mips_float_abi = ('soft', 'hard') valid_intl_modes = ('none', 'small-icu', 'full-icu', 'system-icu') +with open ('tools/icu/icu_versions.json') as f: + icu_versions = json.load(f) # create option groups shared_optgroup = optparse.OptionGroup(parser, "Shared libraries", @@ -387,6 +390,12 @@ dest='with_etw', help='build with ETW (default is true on Windows)') +parser.add_option('--use-largepages', + action='store_true', + dest='node_use_large_pages', + help='build with Large Pages support. This feature is supported only on Linux kernel' + + '>= 2.6.38 with Transparent Huge pages enabled') + intl_optgroup.add_option('--with-intl', action='store', dest='with_intl', @@ -418,7 +427,9 @@ intl_optgroup.add_option('--with-icu-source', action='store', dest='with_icu_source', - help='Intl mode: optional local path to icu/ dir, or path/URL of icu source archive.') + help='Intl mode: optional local path to icu/ dir, or path/URL of ' + 'the icu4c source archive. ' + 'v%d.x or later recommended.' % icu_versions["minimum_icu"]) parser.add_option('--with-ltcg', action='store_true', @@ -1007,6 +1018,24 @@ def configure_node(o): else: o['variables']['node_use_dtrace'] = 'false' + if options.node_use_large_pages and flavor != 'linux': + raise Exception( + 'Large pages are supported only on Linux Systems.') + if options.node_use_large_pages and flavor == 'linux': + if options.shared or options.enable_static: + raise Exception( + 'Large pages are supported only while creating node executable.') + if target_arch!="x64": + raise Exception( + 'Large pages are supported only x64 platform.') + # Example full version string: 2.6.32-696.28.1.el6.x86_64 + FULL_KERNEL_VERSION=os.uname()[2] + KERNEL_VERSION=FULL_KERNEL_VERSION.split('-')[0] + if KERNEL_VERSION < "2.6.38": + raise Exception( + 'Large pages need Linux kernel version >= 2.6.38') + o['variables']['node_use_large_pages'] = b(options.node_use_large_pages) + if options.no_ifaddrs: o['defines'] += ['SUNOS_NO_IFADDRS'] @@ -1252,13 +1281,9 @@ def glob_to_var(dir_base, dir_sub, patch_dir): return list def configure_intl(o): - icus = [ - { - 'url': 'https://sourceforge.net/projects/icu/files/ICU4C/62.1/icu4c-62_1-src.zip', - 'md5': '408854f7b9b58311b68fab4b4dfc80be', - }, - ] def icu_download(path): + with open('tools/icu/current_ver.dep') as f: + icus = json.load(f) # download ICU, if needed if not os.access(options.download_path, os.W_OK): error('''Cannot write to desired download path. @@ -1449,6 +1474,9 @@ def write_config(data, name): icu_ver_major = m.group(1) if not icu_ver_major: error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h) + elif int(icu_ver_major) < icu_versions["minimum_icu"]: + error('icu4c v%d.x is too old, v%d.x or later is required.' % (int(icu_ver_major), + icu_versions["minimum_icu"])) icu_endianness = sys.byteorder[0]; o['variables']['icu_ver_major'] = icu_ver_major o['variables']['icu_endianness'] = icu_endianness diff --git a/deps/cares/LICENSE.md b/deps/cares/LICENSE.md index 86b520b91d3705..ad6bb52b729ed4 100644 --- a/deps/cares/LICENSE.md +++ b/deps/cares/LICENSE.md @@ -1,6 +1,6 @@ # c-ares license -Copyright (c) 2007 - 2016, Daniel Stenberg with many contributors, see AUTHORS +Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS file. Copyright 1998 by the Massachusetts Institute of Technology. diff --git a/deps/cares/Makefile b/deps/cares/Makefile deleted file mode 100644 index 069c67e542fa74..00000000000000 --- a/deps/cares/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright Joyent, Inc. and other Node contributors. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -SRCDIR ?= $(CURDIR) - -ifeq (,$(builddir_name)) - -VPATH := $(SRCDIR) -include $(SRCDIR)/build.mk - -else # Out of tree build. - -# Drop all built-in rules. -.SUFFIXES: - -.PHONY: $(builddir_name) -$(builddir_name): $(builddir_name)/.buildstamp - $(MAKE) -C $@ -f $(CURDIR)/Makefile $(MAKECMDGOALS) \ - SRCDIR=$(CURDIR) builddir_name= - -$(builddir_name)/.buildstamp: - mkdir -p $(dir $@) - touch $@ - -# Add no-op rules for Makefiles to stop make from trying to rebuild them. -Makefile:: ; -%.mk:: ; - -# Turn everything else into a no-op rule that depends on the build directory. -%:: $(builddir_name) ; - -.PHONY: clean -clean: - $(RM) -fr $(builddir_name) - -endif diff --git a/deps/cares/android-configure b/deps/cares/android-configure deleted file mode 100755 index 5299e5c718a9bd..00000000000000 --- a/deps/cares/android-configure +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -export TOOLCHAIN=$PWD/android-toolchain -mkdir -p $TOOLCHAIN -$1/build/tools/make-standalone-toolchain.sh \ - --toolchain=arm-linux-androideabi-4.7 \ - --arch=arm \ - --install-dir=$TOOLCHAIN \ - --platform=android-9 -export PATH=$TOOLCHAIN/bin:$PATH -export AR=arm-linux-androideabi-ar -export CC=arm-linux-androideabi-gcc -export CXX=arm-linux-androideabi-g++ -export LINK=arm-linux-androideabi-g++ -export PLATFORM=android -export OS=android - -if [ $2 -a $2 == 'gyp' ] - then - ./gyp_cares -DOS=android -Dtarget_arch=arm -fi diff --git a/deps/cares/build.mk b/deps/cares/build.mk deleted file mode 100644 index 91af512721ce8d..00000000000000 --- a/deps/cares/build.mk +++ /dev/null @@ -1,147 +0,0 @@ -# Copyright Joyent, Inc. and other Node contributors. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -OS ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"') - -OBJS= \ - src/ares_cancel.o \ - src/ares__close_sockets.o \ - src/ares_create_query.o \ - src/ares_data.o \ - src/ares_destroy.o \ - src/ares_expand_name.o \ - src/ares_expand_string.o \ - src/ares_fds.o \ - src/ares_free_hostent.o \ - src/ares_free_string.o \ - src/ares_gethostbyaddr.o \ - src/ares_gethostbyname.o \ - src/ares__get_hostent.o \ - src/ares_getnameinfo.o \ - src/ares_getopt.o \ - src/ares_getsock.o \ - src/ares_init.o \ - src/ares_library_init.o \ - src/ares_llist.o \ - src/ares_mkquery.o \ - src/ares_nowarn.o \ - src/ares_options.o \ - src/ares_parse_aaaa_reply.o \ - src/ares_parse_a_reply.o \ - src/ares_parse_mx_reply.o \ - src/ares_parse_naptr_reply.o \ - src/ares_parse_ns_reply.o \ - src/ares_parse_ptr_reply.o \ - src/ares_parse_soa_reply.o \ - src/ares_parse_srv_reply.o \ - src/ares_parse_txt_reply.o \ - src/ares_process.o \ - src/ares_query.o \ - src/ares__read_line.o \ - src/ares_search.o \ - src/ares_send.o \ - src/ares_strcasecmp.o \ - src/ares_strdup.o \ - src/ares_strerror.o \ - src/ares_timeout.o \ - src/ares__timeval.o \ - src/ares_version.o \ - src/ares_writev.o \ - src/bitncmp.o \ - src/inet_net_pton.o \ - src/inet_ntop.o \ - -CFLAGS += -I. -I$(SRCDIR)/include -DHAVE_CONFIG_H - -ARES_CONFIG_OS = $(OS) -SOEXT = so - -# if on windows -ifneq (,$(findstring mingw,$(OS))) -ARES_CONFIG_OS = win32 -OBJS += src/windows_port.o -OBJS += src/ares_getenv.o -OBJS += src/ares_platform.o - -LDFLAGS += -lws2_32.lib -liphlpapi.lib -else # else a posix system -CFLAGS += -g --std=gnu89 -pedantic -CFLAGS += -Wall -Wextra -Wno-unused-parameter -CFLAGS += -D_LARGEFILE_SOURCE -CFLAGS += -D_FILE_OFFSET_BITS=64 -endif - -ifneq (,$(findstring cygwin,$(OS))) -ARES_CONFIG_OS = cygwin -CFLAGS += -D_GNU_SOURCE -endif - -ifeq (dragonflybsd,$(OS)) -ARES_CONFIG_OS = freebsd -endif - -ifeq (darwin,$(OS)) -CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1 -LDFLAGS += -dynamiclib -install_name "@rpath/libcares.dylib" -SOEXT = dylib -endif - -ifeq (linux,$(OS)) -CFLAGS += -D_GNU_SOURCE -endif - -ifeq (android,$(OS)) -CFLAGS += -D_GNU_SOURCE -endif - -ifeq (sunos,$(OS)) -LDFLAGS += -lsocket -lnsl -CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -endif - -CFLAGS += -I$(SRCDIR)/config/$(ARES_CONFIG_OS) - -ifneq (,$(findstring libcares.$(SOEXT),$(MAKECMDGOALS))) -CFLAGS += -DCARES_BUILDING_LIBRARY -else -CFLAGS += -DCARES_STATICLIB -endif - -all: libcares.a - -src/.buildstamp: - mkdir -p $(dir $@) - touch $@ - -libcares.a: $(OBJS) - $(AR) rcs $@ $^ - -libcares.$(SOEXT): override CFLAGS += -fPIC -libcares.$(SOEXT): $(OBJS:%.o=%.pic.o) - $(CC) -shared -o $@ $^ $(LDFLAGS) - -src/%.o src/%.pic.o: src/%.c include/ares.h include/ares_version.h \ - include/nameser.h src/.buildstamp \ - $(SRCDIR)/config/$(ARES_CONFIG_OS)/ares_config.h - $(CC) $(CFLAGS) -c $< -o $@ - -.PHONY: clean -clean: - $(RM) -f libcares.a libcares.$(SOEXT) src/*.o src/.buildstamp diff --git a/deps/cares/build/gcc_version.py b/deps/cares/build/gcc_version.py deleted file mode 100644 index da019e866114b0..00000000000000 --- a/deps/cares/build/gcc_version.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python - -import os -import re -import subprocess -import sys - - -def DoMain(*args): - cc = os.environ.get('CC', 'gcc') - stdin, stderr = os.pipe() - subprocess.call([cc, '-v'], stderr=stderr) - output = os.read(stdin, 4096) - match = re.search("\ngcc version (\d+\.\d+\.\d+)", output) - if match: - print(match.group(1)) - - -if __name__ == '__main__': - DoMain(*sys.argv) diff --git a/deps/cares/cares.gyp b/deps/cares/cares.gyp index fce52acb31f495..be7931f7743db1 100644 --- a/deps/cares/cares.gyp +++ b/deps/cares/cares.gyp @@ -35,7 +35,6 @@ 'include_dirs': [ 'include' ] }, 'sources': [ - 'common.gypi', 'include/ares.h', 'include/ares_rules.h', 'include/ares_version.h', @@ -93,6 +92,7 @@ 'src/ares_strdup.c', 'src/ares_strdup.h', 'src/ares_strerror.c', + 'src/ares_strsplit.c', 'src/ares_timeout.c', 'src/ares__timeval.c', 'src/ares_version.c', diff --git a/deps/cares/common.gypi b/deps/cares/common.gypi deleted file mode 100644 index 609ad62a3965d0..00000000000000 --- a/deps/cares/common.gypi +++ /dev/null @@ -1,172 +0,0 @@ -{ - 'variables': { - 'visibility%': 'hidden', - 'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds - 'component%': 'static_library', - 'host_arch%': '', - 'target_arch%': '' - }, - - 'target_defaults': { - 'default_configuration': 'Debug', - 'configurations': { - - 'Debug': { - 'defines': [ 'DEBUG', '_DEBUG' ], - 'cflags': [ '-g', '-O0' ], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'target_conditions': [ - ['library=="static_library"', { - 'RuntimeLibrary': 1 # static debug - }, { - 'RuntimeLibrary': 3 # DLL debug - }] - ], - 'Optimization': 0, # /Od, no optimization - 'MinimalRebuild': 'false', - 'OmitFramePointers': 'false', - 'BasicRuntimeChecks': 3 # /RTC1 - }, - 'VCLinkerTool': { - 'LinkIncremental': 2 # enable incremental linking - } - }, - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '0' - } - }, - - 'Release': { - 'defines': [ 'NDEBUG' ], - 'cflags': [ - '-O3', - '-fomit-frame-pointer', - '-fdata-sections', - '-ffunction-sections' - ], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'target_conditions': [ - ['library=="static_library"', { - 'RuntimeLibrary': 0, # static release - }, { - 'RuntimeLibrary': 2, # debug release - }], - ], - 'Optimization': 3, # /Ox, full optimization - 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size - 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible - 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG - 'OmitFramePointers': 'true', - 'EnableFunctionLevelLinking': 'true', - 'EnableIntrinsicFunctions': 'true' - }, - 'VCLibrarianTool': { - 'AdditionalOptions': [ - '/LTCG' # link time code generation - ] - }, - 'VCLinkerTool': { - 'LinkTimeCodeGeneration': 1, # link-time code generation - 'OptimizeReferences': 2, # /OPT:REF - 'EnableCOMDATFolding': 2, # /OPT:ICF - 'LinkIncremental': 1 # disable incremental linking - }, - }, - } - }, - - 'msvs_settings': { - 'VCCLCompilerTool': { - 'StringPooling': 'true', # pool string literals - 'DebugInformationFormat': 3, # Generate a PDB - 'WarningLevel': 3, - 'BufferSecurityCheck': 'true', - 'ExceptionHandling': 1, # /EHsc - 'SuppressStartupBanner': 'true', - 'WarnAsError': 'false', - 'AdditionalOptions': [ - '/MP', # compile across multiple CPUs - ], - }, - 'VCLinkerTool': { - 'GenerateDebugInformation': 'true', - 'RandomizedBaseAddress': 2, # enable ASLR - 'DataExecutionPrevention': 2, # enable DEP - 'AllowIsolation': 'true', - 'SuppressStartupBanner': 'true', - 'target_conditions': [ - ['_type=="executable"', { - 'SubSystem': 1, # console executable - }], - ], - }, - }, - - 'xcode_settings': { - 'ALWAYS_SEARCH_USER_PATHS': 'NO', - 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks - 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions - 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti - 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings - # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden - 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', - 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden - 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics - 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof - 'PREBINDING': 'NO', # No -Wl,-prebind - 'USE_HEADERMAP': 'NO', - 'WARNING_CFLAGS': [ - '-Wall', - '-Wendif-labels', - '-W', - '-Wno-unused-parameter' - ] - }, - - 'conditions': [ - ['OS == "win"', { - 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin - 'defines': [ - 'WIN32', - # we don't want VC++ warning us about how dangerous C functions are. - '_CRT_SECURE_NO_DEPRECATE', - # ... or that C implementations shouldn't use POSIX names - '_CRT_NONSTDC_NO_DEPRECATE' - ], - }], - - [ 'OS in "linux freebsd openbsd solaris android aix"', { - 'variables': { - 'gcc_version%': ')' - }, - 'cflags': [ '-Wall' ], - 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ], - 'conditions': [ - [ 'host_arch != target_arch and target_arch=="ia32"', { - 'cflags': [ '-m32' ], - 'ldflags': [ '-m32' ] - }], - [ 'OS=="linux"', { - 'cflags': [ '-ansi' ] - }], - [ 'visibility=="hidden" and gcc_version >= "4.0.0"', { - 'cflags': [ '-fvisibility=hidden' ] - }], - ] - }] - ], - - 'target_conditions': [ - ['_type!="static_library"', { - 'cflags': [ '-fPIC' ], - 'xcode_settings': { - 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic - # (Equivalent to -fPIC) - 'OTHER_LDFLAGS': [ '-Wl,-search_paths_first' ] - } - }] - ] - } -} diff --git a/deps/cares/get_ver.awk b/deps/cares/get_ver.awk deleted file mode 100644 index f9929b73614ba3..00000000000000 --- a/deps/cares/get_ver.awk +++ /dev/null @@ -1,26 +0,0 @@ -# *************************************************************************** -# * Project: c-ares -# * -# *************************************************************************** -# awk script which fetches c-ares version number and string from input -# file and writes them to STDOUT. Here you can get an awk version for Win32: -# http://www.gknw.net/development/prgtools/awk-20100523.zip -# -BEGIN { - while ((getline < ARGV[1]) > 0) { - sub("\r", "") # make MSYS gawk work with CRLF header input. - if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) - copyright_string = substr($0, 25, length($0)-25) - else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) - version_string = substr($3, 2, length($3)-2) - else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) - version_major = $3 - else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) - version_minor = $3 - else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) - version_patch = $3 - } - print "LIBCARES_VERSION = " version_major "," version_minor "," version_patch - print "LIBCARES_VERSION_STR = " version_string - print "LIBCARES_COPYRIGHT_STR = " copyright_string -} diff --git a/deps/cares/gyp_cares b/deps/cares/gyp_cares deleted file mode 100755 index d1f1640e015706..00000000000000 --- a/deps/cares/gyp_cares +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python - -import glob -import platform -import os -import subprocess -import sys - -CC = os.environ.get('CC', 'cc') -script_dir = os.path.dirname(__file__) -cares_root = os.path.normpath(script_dir) -output_dir = os.path.join(os.path.abspath(cares_root), 'out') - -sys.path.insert(0, os.path.join(cares_root, 'build', 'gyp', 'pylib')) -try: - import gyp -except ImportError: - print('You need to install gyp in build/gyp first. See the README.') - sys.exit(42) - - -def host_arch(): - machine = platform.machine() - if machine == 'i386': return 'ia32' - if machine == 'x86_64': return 'x64' - if machine.startswith('arm'): return 'arm' - return machine # Return as-is and hope for the best. - - -def compiler_version(): - proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE) - is_clang = 'clang' in proc.communicate()[0].split('\n')[0] - proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE) - version = proc.communicate()[0].split('.') - version = map(int, version[:2]) - version = tuple(version) - return (version, is_clang) - - -def run_gyp(args): - rc = gyp.main(args) - if rc != 0: - print 'Error running GYP' - sys.exit(rc) - - -if __name__ == '__main__': - args = sys.argv[1:] - - # GYP bug. - # On msvs it will crash if it gets an absolute path. - # On Mac/make it will crash if it doesn't get an absolute path. - if sys.platform == 'win32': - args.append(os.path.join(cares_root, 'cares.gyp')) - common_fn = os.path.join(cares_root, 'common.gypi') - options_fn = os.path.join(cares_root, 'options.gypi') - # we force vs 2010 over 2008 which would otherwise be the default for gyp - if not os.environ.get('GYP_MSVS_VERSION'): - os.environ['GYP_MSVS_VERSION'] = '2010' - else: - args.append(os.path.join(os.path.abspath(cares_root), 'cares.gyp')) - common_fn = os.path.join(os.path.abspath(cares_root), 'common.gypi') - options_fn = os.path.join(os.path.abspath(cares_root), 'options.gypi') - - if os.path.exists(common_fn): - args.extend(['-I', common_fn]) - - if os.path.exists(options_fn): - args.extend(['-I', options_fn]) - - args.append('--depth=' + cares_root) - - # There's a bug with windows which doesn't allow this feature. - if sys.platform != 'win32': - if '-f' not in args: - args.extend('-f make'.split()) - if 'ninja' not in args: - args.extend(['-Goutput_dir=' + output_dir]) - args.extend(['--generator-output', output_dir]) - (major, minor), is_clang = compiler_version() - args.append('-Dgcc_version=%d' % (10 * major + minor)) - args.append('-Dclang=%d' % int(is_clang)) - - if not any(a.startswith('-Dhost_arch=') for a in args): - args.append('-Dhost_arch=%s' % host_arch()) - - if not any(a.startswith('-Dtarget_arch=') for a in args): - args.append('-Dtarget_arch=%s' % host_arch()) - - if not any(a.startswith('-Dlibrary=') for a in args): - args.append('-Dlibrary=static_library') - - if not any(a.startswith('-Dcomponent=') for a in args): - args.append('-Dcomponent=static_library') - - gyp_args = list(args) - print gyp_args - run_gyp(gyp_args) diff --git a/deps/cares/include/ares.h b/deps/cares/include/ares.h index 65a82cb5b7eb47..06f60b33304b80 100644 --- a/deps/cares/include/ares.h +++ b/deps/cares/include/ares.h @@ -164,6 +164,7 @@ extern "C" { #define ARES_OPT_ROTATE (1 << 14) #define ARES_OPT_EDNSPSZ (1 << 15) #define ARES_OPT_NOROTATE (1 << 16) +#define ARES_OPT_RESOLVCONF (1 << 17) /* Nameinfo flag values */ #define ARES_NI_NOFQDN (1 << 0) @@ -270,6 +271,7 @@ struct ares_options { struct apattern *sortlist; int nsort; int ednspsz; + char *resolvconf_path; }; struct hostent; diff --git a/deps/cares/include/ares_build.h b/deps/cares/include/ares_build.h index f5535b38493fcb..5e3ba9f0d8cb0c 100644 --- a/deps/cares/include/ares_build.h +++ b/deps/cares/include/ares_build.h @@ -194,16 +194,14 @@ /* Data type definition of ares_ssize_t. */ #ifdef _WIN32 # ifdef _WIN64 - typedef __int64 ares_ssize_t; +# define CARES_TYPEOF_ARES_SSIZE_T __int64 # else - typedef long ares_ssize_t; +# define CARES_TYPEOF_ARES_SSIZE_T long # endif #else -# ifdef CARES_TYPEOF_ARES_SSIZE_T - typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; -# else - typedef ssize_t ares_ssize_t; -# endif +# define CARES_TYPEOF_ARES_SSIZE_T ssize_t #endif +typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; + #endif /* __CARES_BUILD_H */ diff --git a/deps/cares/include/ares_rules.h b/deps/cares/include/ares_rules.h index e617fdc6daaa49..cac23cf2e32db3 100644 --- a/deps/cares/include/ares_rules.h +++ b/deps/cares/include/ares_rules.h @@ -83,7 +83,7 @@ /* * Verify that the size previously defined and expected for - * ares_socklen_t is actually the the same as the one reported + * ares_socklen_t is actually the same as the one reported * by sizeof() at compile time. */ diff --git a/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h index 61b2b98a8d3683..3fe5b00a1171c2 100644 --- a/deps/cares/include/ares_version.h +++ b/deps/cares/include/ares_version.h @@ -3,15 +3,15 @@ #define ARES__VERSION_H /* This is the global package copyright */ -#define ARES_COPYRIGHT "2004 - 2017 Daniel Stenberg, ." +#define ARES_COPYRIGHT "2004 - 2018 Daniel Stenberg, ." #define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 14 +#define ARES_VERSION_MINOR 15 #define ARES_VERSION_PATCH 0 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.14.0" +#define ARES_VERSION_STR "1.15.0" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/deps/cares/src/RELEASE-NOTES b/deps/cares/src/RELEASE-NOTES index 91230a325b9a73..62276fdf4e38c6 100644 --- a/deps/cares/src/RELEASE-NOTES +++ b/deps/cares/src/RELEASE-NOTES @@ -1,47 +1,43 @@ -c-ares version 1.14.0 +c-ares version 1.15.0 Changes: - o android: Introduce new ares_library_init_android() call for Oreo support. [5] + o Add ares_init_options() configurability for path to resolv.conf file [1] + o Ability to exclude building of tools (adig, ahost, acountry) in CMake [3] + o Android: Support for domain search suffix [4] + o Report ARES_ENOTFOUND for .onion domain names as per RFC7686. [13] Bug fixes: - - o Fix patch for CVE-2017-1000381 to not be overly aggressive. [1] - o win32: Preserve DNS server order returned by Windows when sorting and exclude - DNS servers in legacy subnets. [2] [4] - o win32: Support most recent Visual Studio 2017 - o gethostbyaddr should fail with ECANCELLED not ENOTFOUND when ares_cancel - is called. [3] - o win32: Exclude legacy ipv6 subnets [4] - o android: Applications compiled for Oreo can no longer use - __system_property_get and must use Java calls to retrieve DNS servers. - [5] [7] - o win32: Force use of ANSI functions [6] - o CMake minimum version is now 3.1 - o ares_gethostbyname.3: fix callback status values [8] - o docs: Document WSAStartup requirement [9] - o Fix a typo in init_by_resolv_conf [10] - o Android JNI code leaks local references in some cases [11] - o Force using the ANSI versions of WinAPI functions [12] + o AIX build fix for trying to include both nameser_compat.h and + onameser_compat.h [2] + o Windows: Improve DNS suffixes extracting from WinNT registry [5] + o Fix modern GCC warnings [6] + o Apply the IPv6 server blacklist to all nameserver sources, not just Windows + [7] + o Fix warnings emitted by MSVC when using -W4 [8] + o Prevent changing name servers while queries are outstanding [9] + o Harden and rationalize c-ares timeout computation [10] + o Distribute ares_android.h [11] + o ares_set_servers_csv() on failure should not leave channel in a bad state + [12] + o Add missing docs to distribution Thanks go to these friendly people for their efforts and contributions: - - AC Thompson, Anna Henningsen, Antonio Tajuelo, Brad House, Brad Spencer, - Christian Ammer, Daniel Stenberg, David Drysdale, David Hotham, Felix Yan, - Gergely Nagy, Gregor Jasny, Jakub Hrozek, John Schember, - Konstantinos Sofokleous, Roman Teterin, Sergey Kolomenkin, Sheel Bedi, - (18 contributors) + @afalin, Andi Schnebinger, Ben Noordhuis, Brad House, Brad Spencer, + David Hotham, @flyingdutchman23, John Schember, Ruslan Baratov, + Sarat Addepalli, Tobias Nießen (11 contributors) References to bug reports and discussions on issues: + [1] = https://github.com/c-ares/c-ares/issues/220 + [2] = https://github.com/c-ares/c-ares/issues/224 + [3] = https://github.com/c-ares/c-ares/issues/200 + [4] = https://github.com/c-ares/c-ares/issues/207 + [5] = https://github.com/c-ares/c-ares/pull/202 + [6] = https://github.com/c-ares/c-ares/pull/201 + [7] = https://github.com/c-ares/c-ares/pull/193 + [8] = https://github.com/c-ares/c-ares/pull/192 + [9] = https://github.com/c-ares/c-ares/pull/191 + [10] = https://github.com/c-ares/c-ares/pull/187 + [11] = https://c-ares.haxx.se/mail/c-ares-archive-2018-04/0000.shtml + [12] = https://c-ares.haxx.se/mail/c-ares-archive-2018-03/0000.shtml + [13] = https://github.com/c-ares/c-ares/issues/196 - [1] = https://github.com/c-ares/c-ares/commit/18ea99 - [2] = https://github.com/c-ares/c-ares/issues/150 - [3] = https://github.com/c-ares/c-ares/pull/138 - [4] = https://github.com/c-ares/c-ares/pull/144 - [5] = https://github.com/c-ares/c-ares/pull/148 - [6] = https://github.com/c-ares/c-ares/pull/142 - [7] = https://github.com/c-ares/c-ares/pull/175 - [8] = https://c-ares.haxx.se/mail/c-ares-archive-2011-06/0012.shtml - [9] = https://github.com/c-ares/c-ares/pull/180 - [10] = https://github.com/c-ares/c-ares/pull/160 - [11] = https://github.com/c-ares/c-ares/pull/175 - [12] = https://github.com/c-ares/c-ares/pull/142 diff --git a/deps/cares/src/ares_android.c b/deps/cares/src/ares_android.c index ab388110bdeff9..bf77131b58cf84 100644 --- a/deps/cares/src/ares_android.c +++ b/deps/cares/src/ares_android.c @@ -30,6 +30,8 @@ static jmethodID android_cm_active_net_mid = NULL; static jmethodID android_cm_link_props_mid = NULL; /* LinkProperties.getDnsServers */ static jmethodID android_lp_dns_servers_mid = NULL; +/* LinkProperties.getDomains */ +static jmethodID android_lp_domains_mid = NULL; /* List.size */ static jmethodID android_list_size_mid = NULL; /* List.get */ @@ -139,6 +141,12 @@ int ares_library_init_android(jobject connectivity_manager) if (android_lp_dns_servers_mid == NULL) goto cleanup; + /* getDomains in API 21. */ + android_lp_domains_mid = jni_get_method_id(env, obj_cls, "getDomains", + "()Ljava/lang/String;"); + if (android_lp_domains_mid == NULL) + goto cleanup; + (*env)->DeleteLocalRef(env, obj_cls); obj_cls = jni_get_class(env, "java/util/List"); if (obj_cls == NULL) @@ -173,6 +181,7 @@ int ares_library_init_android(jobject connectivity_manager) android_cm_active_net_mid = NULL; android_cm_link_props_mid = NULL; android_lp_dns_servers_mid = NULL; + android_lp_domains_mid = NULL; android_list_size_mid = NULL; android_list_get_mid = NULL; android_ia_host_addr_mid = NULL; @@ -213,6 +222,7 @@ void ares_library_cleanup_android(void) android_cm_active_net_mid = NULL; android_cm_link_props_mid = NULL; android_lp_dns_servers_mid = NULL; + android_lp_domains_mid = NULL; android_list_size_mid = NULL; android_list_get_mid = NULL; android_ia_host_addr_mid = NULL; @@ -341,6 +351,95 @@ char **ares_get_android_server_list(size_t max_servers, (*android_jvm)->DetachCurrentThread(android_jvm); return dns_list; } + +char *ares_get_android_search_domains_list(void) +{ + JNIEnv *env = NULL; + jobject active_network = NULL; + jobject link_properties = NULL; + jstring domains = NULL; + const char *domain; + int res; + size_t i; + size_t cnt = 0; + char *domain_list = NULL; + int need_detatch = 0; + + if (android_jvm == NULL || android_connectivity_manager == NULL) + { + return NULL; + } + + if (android_cm_active_net_mid == NULL || android_cm_link_props_mid == NULL || + android_lp_domains_mid == NULL) + { + return NULL; + } + + res = (*android_jvm)->GetEnv(android_jvm, (void **)&env, JNI_VERSION_1_6); + if (res == JNI_EDETACHED) + { + env = NULL; + res = (*android_jvm)->AttachCurrentThread(android_jvm, &env, NULL); + need_detatch = 1; + } + if (res != JNI_OK || env == NULL) + goto done; + + /* JNI below is equivalent to this Java code. + import android.content.Context; + import android.net.ConnectivityManager; + import android.net.LinkProperties; + + ConnectivityManager cm = (ConnectivityManager)this.getApplicationContext() + .getSystemService(Context.CONNECTIVITY_SERVICE); + Network an = cm.getActiveNetwork(); + LinkProperties lp = cm.getLinkProperties(an); + String domains = lp.getDomains(); + for (String domain: domains.split(",")) { + String d = domain; + } + + Note: The JNI ConnectivityManager object and all method IDs were previously + initialized in ares_library_init_android. + */ + + active_network = (*env)->CallObjectMethod(env, android_connectivity_manager, + android_cm_active_net_mid); + if (active_network == NULL) + goto done; + + link_properties = + (*env)->CallObjectMethod(env, android_connectivity_manager, + android_cm_link_props_mid, active_network); + if (link_properties == NULL) + goto done; + + /* Get the domains. It is a common separated list of domains to search. */ + domains = (*env)->CallObjectMethod(env, link_properties, + android_lp_domains_mid); + if (domains == NULL) + goto done; + + /* Split on , */ + domain = (*env)->GetStringUTFChars(env, domains, 0); + domain_list = ares_strdup(domain); + (*env)->ReleaseStringUTFChars(env, domains, domain); + (*env)->DeleteLocalRef(env, domains); + +done: + if ((*env)->ExceptionOccurred(env)) + (*env)->ExceptionClear(env); + + if (link_properties != NULL) + (*env)->DeleteLocalRef(env, link_properties); + if (active_network != NULL) + (*env)->DeleteLocalRef(env, active_network); + + if (need_detatch) + (*android_jvm)->DetachCurrentThread(android_jvm); + return domain_list; +} #else /* warning: ISO C forbids an empty translation unit */ typedef int dummy_make_iso_compilers_happy; diff --git a/deps/cares/src/ares_android.h b/deps/cares/src/ares_android.h new file mode 100644 index 00000000000000..93fb75f585057e --- /dev/null +++ b/deps/cares/src/ares_android.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2017 by John Schember + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#ifndef __ARES_ANDROID_H__ +#define __ARES_ANDROID_H__ + +#if defined(ANDROID) || defined(__ANDROID__) + +char **ares_get_android_server_list(size_t max_servers, size_t *num_servers); +char *ares_get_android_search_domains_list(void); +void ares_library_cleanup_android(void); + +#endif + +#endif /* __ARES_ANDROID_H__ */ diff --git a/deps/cares/src/ares_create_query.c b/deps/cares/src/ares_create_query.c index 07d7570114403b..1606b1a1004706 100644 --- a/deps/cares/src/ares_create_query.c +++ b/deps/cares/src/ares_create_query.c @@ -94,6 +94,10 @@ int ares_create_query(const char *name, int dnsclass, int type, size_t buflen; unsigned char *buf; + /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ + if (ares__is_onion_domain(name)) + return ARES_ENOTFOUND; + /* Set our results early, in case we bail out early with an error. */ *buflenp = 0; *bufp = NULL; @@ -188,7 +192,7 @@ int ares_create_query(const char *name, int dnsclass, int type, * specified in RFC 1035 ("To simplify implementations, the total length of * a domain name (i.e., label octets and label length octets) is restricted * to 255 octets or less."). */ - if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ + + if (buflen > (size_t)(MAXCDNAME + HFIXEDSZ + QFIXEDSZ + (max_udp_size ? EDNSFIXEDSZ : 0))) { ares_free (buf); return ARES_EBADNAME; diff --git a/deps/cares/src/ares_destroy.c b/deps/cares/src/ares_destroy.c index 8aa42236aecffe..fed2009ab324ff 100644 --- a/deps/cares/src/ares_destroy.c +++ b/deps/cares/src/ares_destroy.c @@ -36,6 +36,8 @@ void ares_destroy_options(struct ares_options *options) ares_free(options->sortlist); if(options->lookups) ares_free(options->lookups); + if(options->resolvconf_path) + ares_free(options->resolvconf_path); } void ares_destroy(ares_channel channel) @@ -44,7 +46,7 @@ void ares_destroy(ares_channel channel) struct query *query; struct list_node* list_head; struct list_node* list_node; - + if (!channel) return; @@ -85,6 +87,9 @@ void ares_destroy(ares_channel channel) if (channel->lookups) ares_free(channel->lookups); + if (channel->resolvconf_path) + ares_free(channel->resolvconf_path); + ares_free(channel); } diff --git a/deps/cares/src/ares_gethostbyname.c b/deps/cares/src/ares_gethostbyname.c index 7c46d96ceaf214..8187746bb14c7f 100644 --- a/deps/cares/src/ares_gethostbyname.c +++ b/deps/cares/src/ares_gethostbyname.c @@ -95,6 +95,13 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family, return; } + /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ + if (ares__is_onion_domain(name)) + { + callback(arg, ARES_ENOTFOUND, 0, NULL); + return; + } + if (fake_hostent(name, family, callback, arg)) return; @@ -339,6 +346,10 @@ static int file_lookup(const char *name, int family, struct hostent **host) int status; int error; + /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ + if (ares__is_onion_domain(name)) + return ARES_ENOTFOUND; + #ifdef WIN32 char PATH_HOSTS[MAX_PATH]; win_platform platform; diff --git a/deps/cares/src/ares_getnameinfo.c b/deps/cares/src/ares_getnameinfo.c index c77b1f81537834..aa089417060fec 100644 --- a/deps/cares/src/ares_getnameinfo.c +++ b/deps/cares/src/ares_getnameinfo.c @@ -440,3 +440,14 @@ STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2) } return (char *)c1_begin; } + +int ares__is_onion_domain(const char *name) +{ + if (ares_striendstr(name, ".onion")) + return 1; + + if (ares_striendstr(name, ".onion.")) + return 1; + + return 0; +} diff --git a/deps/cares/src/ares_init.c b/deps/cares/src/ares_init.c index 90cfcabdd33a9e..c2c00d65237072 100644 --- a/deps/cares/src/ares_init.c +++ b/deps/cares/src/ares_init.c @@ -169,6 +169,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, channel->sock_config_cb_data = NULL; channel->sock_funcs = NULL; channel->sock_func_cb_data = NULL; + channel->resolvconf_path = NULL; channel->last_server = 0; channel->last_timeout_processed = (time_t)now.tv_sec; @@ -236,16 +237,14 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, /* Something failed; clean up memory we may have allocated. */ if (channel->servers) ares_free(channel->servers); - if (channel->domains) - { - for (i = 0; i < channel->ndomains; i++) - ares_free(channel->domains[i]); - ares_free(channel->domains); - } + if (channel->ndomains != -1) + ares_strsplit_free(channel->domains, channel->ndomains); if (channel->sortlist) ares_free(channel->sortlist); if(channel->lookups) ares_free(channel->lookups); + if(channel->resolvconf_path) + ares_free(channel->resolvconf_path); ares_free(channel); return status; } @@ -299,7 +298,7 @@ int ares_dup(ares_channel *dest, ares_channel src) (*dest)->sock_func_cb_data = src->sock_func_cb_data; strncpy((*dest)->local_dev_name, src->local_dev_name, - sizeof(src->local_dev_name)); + sizeof((*dest)->local_dev_name)); (*dest)->local_ip4 = src->local_ip4; memcpy((*dest)->local_ip6, src->local_ip6, sizeof(src->local_ip6)); @@ -354,6 +353,9 @@ int ares_save_options(ares_channel channel, struct ares_options *options, ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS); (*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE); + if (channel->resolvconf_path) + (*optmask) |= ARES_OPT_RESOLVCONF; + /* Copy easy stuff */ options->flags = channel->flags; @@ -426,6 +428,13 @@ int ares_save_options(ares_channel channel, struct ares_options *options, } options->nsort = channel->nsort; + /* copy path for resolv.conf file */ + if (channel->resolvconf_path) { + options->resolvconf_path = ares_strdup(channel->resolvconf_path); + if (!options->resolvconf_path) + return ARES_ENOMEM; + } + return ARES_SUCCESS; } @@ -534,6 +543,14 @@ static int init_by_options(ares_channel channel, channel->nsort = options->nsort; } + /* Set path for resolv.conf file, if given. */ + if ((optmask & ARES_OPT_RESOLVCONF) && !channel->resolvconf_path) + { + channel->resolvconf_path = ares_strdup(options->resolvconf_path); + if (!channel->resolvconf_path && options->resolvconf_path) + return ARES_ENOMEM; + } + channel->optmask = optmask; return ARES_SUCCESS; @@ -997,63 +1014,6 @@ static int compareAddresses(const void *arg1, return 0; } -/* Validate that the ip address matches the subnet (network base and network - * mask) specified. Addresses are specified in standard Network Byte Order as - * 16 bytes, and the netmask is 0 to 128 (bits). - */ -static int ares_ipv6_subnet_matches(const unsigned char netbase[16], - unsigned char netmask, - const unsigned char ipaddr[16]) -{ - unsigned char mask[16] = { 0 }; - unsigned char i; - - /* Misuse */ - if (netmask > 128) - return 0; - - /* Quickly set whole bytes */ - memset(mask, 0xFF, netmask / 8); - - /* Set remaining bits */ - if(netmask % 8) { - mask[netmask / 8] = (unsigned char)(0xff << (8 - (netmask % 8))); - } - - for (i=0; i<16; i++) { - if ((netbase[i] & mask[i]) != (ipaddr[i] & mask[i])) - return 0; - } - - return 1; -} - -static int ares_ipv6_server_blacklisted(const unsigned char ipaddr[16]) -{ - const struct { - const char *netbase; - unsigned char netmask; - } blacklist[] = { - /* Deprecated by [RFC3879] in September 2004. Formerly a Site-Local scoped - * address prefix. Causes known issues on Windows as these are not valid DNS - * servers. */ - { "fec0::", 10 }, - { NULL, 0 } - }; - size_t i; - - for (i=0; blacklist[i].netbase != NULL; i++) { - unsigned char netbase[16]; - - if (ares_inet_pton(AF_INET6, blacklist[i].netbase, netbase) != 1) - continue; - - if (ares_ipv6_subnet_matches(netbase, blacklist[i].netmask, ipaddr)) - return 1; - } - return 0; -} - /* There can be multiple routes to "the Internet". And there can be different * DNS servers associated with each of the interfaces that offer those routes. * We have to assume that any DNS server can serve any request. But, some DNS @@ -1257,7 +1217,7 @@ static int get_DNS_AdaptersAddresses(char **outptr) } else { - addresses[addressesIndex].metric = -1; + addresses[addressesIndex].metric = (ULONG)-1; } /* Record insertion index to make qsort stable */ @@ -1272,20 +1232,10 @@ static int get_DNS_AdaptersAddresses(char **outptr) } else if (namesrvr.sa->sa_family == AF_INET6) { - /* Windows apparently always reports some IPv6 DNS servers that - * prefixed with fec0:0:0:ffff. These ususally do not point to - * working DNS servers, so we ignore them. */ - if (strncmp(addresses[addressesIndex].text, "fec0:0:0:ffff:", 14) == 0) - continue; if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any, sizeof(namesrvr.sa6->sin6_addr)) == 0) continue; - if (ares_ipv6_server_blacklisted( - (const unsigned char *)&namesrvr.sa6->sin6_addr) - ) - continue; - /* Allocate room for another address, if necessary, else skip. */ if(addressesIndex == addressesSize) { const size_t newSize = addressesSize + 4; @@ -1309,7 +1259,7 @@ static int get_DNS_AdaptersAddresses(char **outptr) } else { - addresses[addressesIndex].metric = -1; + addresses[addressesIndex].metric = (ULONG)-1; } /* Record insertion index to make qsort stable */ @@ -1394,59 +1344,6 @@ static int get_DNS_Windows(char **outptr) return get_DNS_Registry(outptr); } -static void replace_comma_by_space(char* str) -{ - /* replace ',' by ' ' to coincide with resolv.conf search parameter */ - char *p; - for (p = str; *p != '\0'; p++) - { - if (*p == ',') - *p = ' '; - } -} - -/* Search if 'suffix' is containted in the 'searchlist'. Returns true if yes, - * otherwise false. 'searchlist' is a comma separated list of domain suffixes, - * 'suffix' is one domain suffix, 'len' is the length of 'suffix'. - * The search ignores case. E.g.: - * contains_suffix("abc.def,ghi.jkl", "ghi.JKL") returns true */ -static bool contains_suffix(const char* const searchlist, - const char* const suffix, const size_t len) -{ - const char* beg = searchlist; - const char* end; - if (!*suffix) - return true; - for (;;) - { - while (*beg && (ISSPACE(*beg) || (*beg == ','))) - ++beg; - if (!*beg) - return false; - end = beg; - while (*end && !ISSPACE(*end) && (*end != ',')) - ++end; - if (len == (end - beg) && !strnicmp(beg, suffix, len)) - return true; - beg = end; - } -} - -/* advances list to the next suffix within a comma separated search list. - * len is the length of the next suffix. */ -static size_t next_suffix(const char** list, const size_t advance) -{ - const char* beg = *list + advance; - const char* end; - while (*beg && (ISSPACE(*beg) || (*beg == ','))) - ++beg; - end = beg; - while (*end && !ISSPACE(*end) && (*end != ',')) - ++end; - *list = beg; - return end - beg; -} - /* * get_SuffixList_Windows() * @@ -1467,8 +1364,6 @@ static int get_SuffixList_Windows(char **outptr) DWORD keyNameBuffSize; DWORD keyIdx = 0; char *p = NULL; - const char *pp; - size_t len = 0; *outptr = NULL; @@ -1479,11 +1374,26 @@ static int get_SuffixList_Windows(char **outptr) if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { - if (get_REG_SZ(hKey, SEARCHLIST_KEY, outptr)) - replace_comma_by_space(*outptr); + get_REG_SZ(hKey, SEARCHLIST_KEY, outptr); + if (get_REG_SZ(hKey, DOMAIN_KEY, &p)) + { + commajoin(outptr, p); + ares_free(p); + p = NULL; + } + RegCloseKey(hKey); + } + + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NT_DNSCLIENT, 0, + KEY_READ, &hKey) == ERROR_SUCCESS) + { + if (get_REG_SZ(hKey, SEARCHLIST_KEY, &p)) + { + commajoin(outptr, p); + ares_free(p); + p = NULL; + } RegCloseKey(hKey); - if (*outptr) - return 1; } /* 2. Connection Specific Search List composed of: @@ -1491,45 +1401,53 @@ static int get_SuffixList_Windows(char **outptr) if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_DNSCLIENT, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { - get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, outptr); + if (get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, &p)) + { + commajoin(outptr, p); + ares_free(p); + p = NULL; + } RegCloseKey(hKey); } - if (!*outptr) - return 0; /* b. Interface SearchList, Domain, DhcpDomain */ - if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY "\\" INTERFACES_KEY, 0, + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY "\\" INTERFACES_KEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS) - return 0; - for(;;) { - keyNameBuffSize = sizeof(keyName); - if (RegEnumKeyExA(hKey, keyIdx++, keyName, &keyNameBuffSize, - 0, NULL, NULL, NULL) - != ERROR_SUCCESS) - break; - if (RegOpenKeyExA(hKey, keyName, 0, KEY_QUERY_VALUE, &hKeyEnum) - != ERROR_SUCCESS) - continue; - if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p) || - get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p) || - get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p)) + for(;;) { + keyNameBuffSize = sizeof(keyName); + if (RegEnumKeyExA(hKey, keyIdx++, keyName, &keyNameBuffSize, + 0, NULL, NULL, NULL) + != ERROR_SUCCESS) + break; + if (RegOpenKeyExA(hKey, keyName, 0, KEY_QUERY_VALUE, &hKeyEnum) + != ERROR_SUCCESS) + continue; /* p can be comma separated (SearchList) */ - pp = p; - while ((len = next_suffix(&pp, len)) != 0) + if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p)) { - if (!contains_suffix(*outptr, pp, len)) - commanjoin(outptr, pp, len); + commajoin(outptr, p); + ares_free(p); + p = NULL; } - ares_free(p); - p = NULL; + if (get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p)) + { + commajoin(outptr, p); + ares_free(p); + p = NULL; + } + if (get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p)) + { + commajoin(outptr, p); + ares_free(p); + p = NULL; + } + RegCloseKey(hKeyEnum); } - RegCloseKey(hKeyEnum); + RegCloseKey(hKey); } - RegCloseKey(hKey); - if (*outptr) - replace_comma_by_space(*outptr); + return *outptr != NULL; } @@ -1628,6 +1546,7 @@ static int init_by_resolv_conf(ares_channel channel) char propname[PROP_NAME_MAX]; char propvalue[PROP_VALUE_MAX]=""; char **dns_servers; + char *domains; size_t num_servers; /* Use the Android connectivity manager to get a list @@ -1652,6 +1571,12 @@ static int init_by_resolv_conf(ares_channel channel) } ares_free(dns_servers); } + if (channel->ndomains == -1) + { + domains = ares_get_android_search_domains_list(); + set_search(channel, domains); + ares_free(domains); + } # ifdef HAVE___SYSTEM_PROPERTY_GET /* Old way using the system property still in place as @@ -1740,6 +1665,7 @@ static int init_by_resolv_conf(ares_channel channel) size_t linesize; int error; int update_domains; + const char *resolvconf_path; /* Don't read resolv.conf and friends if we don't have to */ if (ARES_CONFIG_CHECK(channel)) @@ -1748,7 +1674,14 @@ static int init_by_resolv_conf(ares_channel channel) /* Only update search domains if they're not already specified */ update_domains = (channel->ndomains == -1); - fp = fopen(PATH_RESOLV_CONF, "r"); + /* Support path for resolvconf filename set by ares_init_options */ + if(channel->resolvconf_path) { + resolvconf_path = channel->resolvconf_path; + } else { + resolvconf_path = PATH_RESOLV_CONF; + } + + fp = fopen(resolvconf_path, "r"); if (fp) { while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) { @@ -1759,10 +1692,10 @@ static int init_by_resolv_conf(ares_channel channel) else if ((p = try_config(line, "search", ';')) && update_domains) status = set_search(channel, p); else if ((p = try_config(line, "nameserver", ';')) && - channel->nservers == -1) + channel->nservers == -1) status = config_nameserver(&servers, &nservers, p); else if ((p = try_config(line, "sortlist", ';')) && - channel->nsort == -1) + channel->nsort == -1) status = config_sortlist(&sortlist, &nsort, p); else if ((p = try_config(line, "options", ';'))) status = set_options(channel, p); @@ -1782,7 +1715,7 @@ static int init_by_resolv_conf(ares_channel channel) break; default: DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", - error, strerror(error))); + error, strerror(error))); DEBUGF(fprintf(stderr, "Error opening file: %s\n", PATH_RESOLV_CONF)); status = ARES_EFILE; } @@ -2050,6 +1983,11 @@ static int init_by_defaults(ares_channel channel) ares_free(channel->lookups); channel->lookups = NULL; } + + if(channel->resolvconf_path) { + ares_free(channel->resolvconf_path); + channel->resolvconf_path = NULL; + } } if(hostname) @@ -2114,6 +2052,76 @@ static int config_lookup(ares_channel channel, const char *str, #endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ & !CARES_USE_LIBRESOLV */ #ifndef WATT32 +/* Validate that the ip address matches the subnet (network base and network + * mask) specified. Addresses are specified in standard Network Byte Order as + * 16 bytes, and the netmask is 0 to 128 (bits). + */ +static int ares_ipv6_subnet_matches(const unsigned char netbase[16], + unsigned char netmask, + const unsigned char ipaddr[16]) +{ + unsigned char mask[16] = { 0 }; + unsigned char i; + + /* Misuse */ + if (netmask > 128) + return 0; + + /* Quickly set whole bytes */ + memset(mask, 0xFF, netmask / 8); + + /* Set remaining bits */ + if(netmask % 8) { + mask[netmask / 8] = (unsigned char)(0xff << (8 - (netmask % 8))); + } + + for (i=0; i<16; i++) { + if ((netbase[i] & mask[i]) != (ipaddr[i] & mask[i])) + return 0; + } + + return 1; +} + +/* Return true iff the IPv6 ipaddr is blacklisted. */ +static int ares_ipv6_server_blacklisted(const unsigned char ipaddr[16]) +{ + /* A list of blacklisted IPv6 subnets. */ + const struct { + const unsigned char netbase[16]; + unsigned char netmask; + } blacklist[] = { + /* fec0::/10 was deprecated by [RFC3879] in September 2004. Formerly a + * Site-Local scoped address prefix. These are never valid DNS servers, + * but are known to be returned at least sometimes on Windows and Android. + */ + { + { + 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + 10 + } + }; + size_t i; + + /* See if ipaddr matches any of the entries in the blacklist. */ + for (i = 0; i < sizeof(blacklist) / sizeof(blacklist[0]); ++i) { + if (ares_ipv6_subnet_matches( + blacklist[i].netbase, blacklist[i].netmask, ipaddr)) + return 1; + } + return 0; +} + +/* Add the IPv4 or IPv6 nameservers in str (separated by commas) to the + * servers list, updating servers and nservers as required. + * + * This will silently ignore blacklisted IPv6 nameservers as detected by + * ares_ipv6_server_blacklisted(). + * + * Returns an error code on failure, else ARES_SUCCESS. + */ static int config_nameserver(struct server_state **servers, int *nservers, char *str) { @@ -2148,7 +2156,10 @@ static int config_nameserver(struct server_state **servers, int *nservers, /* Convert textual address to binary format. */ if (ares_inet_pton(AF_INET, txtaddr, &host.addrV4) == 1) host.family = AF_INET; - else if (ares_inet_pton(AF_INET6, txtaddr, &host.addrV6) == 1) + else if (ares_inet_pton(AF_INET6, txtaddr, &host.addrV6) == 1 + /* Silently skip blacklisted IPv6 servers. */ + && !ares_ipv6_server_blacklisted( + (const unsigned char *)&host.addrV6)) host.family = AF_INET6; else continue; @@ -2271,61 +2282,22 @@ static int config_sortlist(struct apattern **sortlist, int *nsort, static int set_search(ares_channel channel, const char *str) { - int n; - const char *p, *q; + size_t cnt; if(channel->ndomains != -1) { /* LCOV_EXCL_START: all callers check ndomains == -1 */ /* if we already have some domains present, free them first */ - for(n=0; n < channel->ndomains; n++) - ares_free(channel->domains[n]); - ares_free(channel->domains); + ares_strsplit_free(channel->domains, channel->ndomains); channel->domains = NULL; channel->ndomains = -1; } /* LCOV_EXCL_STOP */ - /* Count the domains given. */ - n = 0; - p = str; - while (*p) - { - while (*p && !ISSPACE(*p)) - p++; - while (ISSPACE(*p)) - p++; - n++; - } - - if (!n) - { - channel->ndomains = 0; - return ARES_SUCCESS; - } - - channel->domains = ares_malloc(n * sizeof(char *)); - if (!channel->domains) - return ARES_ENOMEM; - - /* Now copy the domains. */ - n = 0; - p = str; - while (*p) - { - channel->ndomains = n; - q = p; - while (*q && !ISSPACE(*q)) - q++; - channel->domains[n] = ares_malloc(q - p + 1); - if (!channel->domains[n]) - return ARES_ENOMEM; - memcpy(channel->domains[n], p, q - p); - channel->domains[n][q - p] = 0; - p = q; - while (ISSPACE(*p)) - p++; - n++; - } - channel->ndomains = n; + channel->domains = ares_strsplit(str, ", ", 1, &cnt); + channel->ndomains = (int)cnt; + if (channel->domains == NULL || channel->ndomains == 0) { + channel->domains = NULL; + channel->ndomains = -1; + } return ARES_SUCCESS; } diff --git a/deps/cares/src/ares_library_init.c b/deps/cares/src/ares_library_init.c index 88e7a537480813..67563499bec276 100644 --- a/deps/cares/src/ares_library_init.c +++ b/deps/cares/src/ares_library_init.c @@ -40,9 +40,19 @@ static unsigned int ares_initialized; static int ares_init_flags; /* library-private global vars with visibility across the whole library */ -void *(*ares_malloc)(size_t size) = malloc; -void *(*ares_realloc)(void *ptr, size_t size) = realloc; -void (*ares_free)(void *ptr) = free; +#if defined(WIN32) +/* We need indirections to handle Windows DLL rules. */ +static void *default_malloc(size_t size) { return malloc(size); } +static void *default_realloc(void *p, size_t size) { return realloc(p, size); } +static void default_free(void *p) { free(p); } +#else +# define default_malloc malloc +# define default_realloc realloc +# define default_free free +#endif +void *(*ares_malloc)(size_t size) = default_malloc; +void *(*ares_realloc)(void *ptr, size_t size) = default_realloc; +void (*ares_free)(void *ptr) = default_free; #ifdef USE_WINSOCK static HMODULE hnd_iphlpapi; diff --git a/deps/cares/src/ares_options.c b/deps/cares/src/ares_options.c index c3cbd1df707566..de49de4625996f 100644 --- a/deps/cares/src/ares_options.c +++ b/deps/cares/src/ares_options.c @@ -153,6 +153,9 @@ int ares_set_servers(ares_channel channel, if (!channel) return ARES_ENODATA; + if (!ares__is_list_empty(&channel->all_queries)) + return ARES_ENOTIMP; + ares__destroy_servers_state(channel); for (srvr = servers; srvr; srvr = srvr->next) @@ -202,6 +205,9 @@ int ares_set_servers_ports(ares_channel channel, if (!channel) return ARES_ENODATA; + if (!ares__is_list_empty(&channel->all_queries)) + return ARES_ENOTIMP; + ares__destroy_servers_state(channel); for (srvr = servers; srvr; srvr = srvr->next) @@ -258,8 +264,6 @@ static int set_servers_csv(ares_channel channel, if (!channel) return ARES_ENODATA; - ares__destroy_servers_state(channel); - i = strlen(_csv); if (i == 0) return ARES_SUCCESS; /* blank all servers */ diff --git a/deps/cares/src/ares_parse_ptr_reply.c b/deps/cares/src/ares_parse_ptr_reply.c index 976a5311a24d79..29e22cb17b6bd6 100644 --- a/deps/cares/src/ares_parse_ptr_reply.c +++ b/deps/cares/src/ares_parse_ptr_reply.c @@ -52,6 +52,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, int aliascnt = 0; int alias_alloc = 8; char ** aliases; + size_t rr_data_len; /* Set *host to NULL for all failure cases. */ *host = NULL; @@ -124,14 +125,15 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, if (hostname) ares_free(hostname); hostname = rr_data; - aliases[aliascnt] = ares_malloc((strlen(rr_data)+1) * sizeof(char)); + rr_data_len = strlen(rr_data)+1; + aliases[aliascnt] = ares_malloc(rr_data_len * sizeof(char)); if (!aliases[aliascnt]) { ares_free(rr_name); status = ARES_ENOMEM; break; } - strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1); + strncpy(aliases[aliascnt], rr_data, rr_data_len); aliascnt++; if (aliascnt >= alias_alloc) { char **ptr; diff --git a/deps/cares/src/ares_private.h b/deps/cares/src/ares_private.h index 5d773869c72a97..1990f6902fc75e 100644 --- a/deps/cares/src/ares_private.h +++ b/deps/cares/src/ares_private.h @@ -52,18 +52,19 @@ #if defined(WIN32) && !defined(WATT32) -#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" -#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" -#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" -#define NAMESERVER "NameServer" -#define DHCPNAMESERVER "DhcpNameServer" -#define DATABASEPATH "DatabasePath" -#define WIN_PATH_HOSTS "\\hosts" -#define SEARCHLIST_KEY "SearchList" +#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" +#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" +#define WIN_NT_DNSCLIENT "Software\\Policies\\Microsoft\\Windows NT\\DNSClient" +#define NAMESERVER "NameServer" +#define DHCPNAMESERVER "DhcpNameServer" +#define DATABASEPATH "DatabasePath" +#define WIN_PATH_HOSTS "\\hosts" +#define SEARCHLIST_KEY "SearchList" #define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix" -#define INTERFACES_KEY "Interfaces" -#define DOMAIN_KEY "Domain" -#define DHCPDOMAIN_KEY "DhcpDomain" +#define INTERFACES_KEY "Interfaces" +#define DOMAIN_KEY "Domain" +#define DHCPDOMAIN_KEY "DhcpDomain" #elif defined(WATT32) @@ -100,6 +101,7 @@ #endif #include "ares_strdup.h" +#include "ares_strsplit.h" #ifndef HAVE_STRCASECMP # include "ares_strcasecmp.h" @@ -323,8 +325,14 @@ struct ares_channeldata { const struct ares_socket_functions * sock_funcs; void *sock_func_cb_data; + + /* Path for resolv.conf file, configurable via ares_options */ + char *resolvconf_path; }; +/* Does the domain end in ".onion" or ".onion."? Case-insensitive. */ +int ares__is_onion_domain(const char *name); + /* Memory management functions */ extern void *(*ares_malloc)(size_t size); extern void *(*ares_realloc)(void *ptr, size_t size); diff --git a/deps/cares/src/ares_process.c b/deps/cares/src/ares_process.c index df85524f624cfd..df9f290bb133a6 100644 --- a/deps/cares/src/ares_process.c +++ b/deps/cares/src/ares_process.c @@ -53,6 +53,7 @@ #include #include +#include #include "ares.h" #include "ares_dns.h" @@ -871,8 +872,32 @@ void ares__send_query(ares_channel channel, struct query *query, return; } } - timeplus = channel->timeout << (query->try_count / channel->nservers); - timeplus = (timeplus * (9 + (rand () & 7))) / 16; + + /* For each trip through the entire server list, double the channel's + * assigned timeout, avoiding overflow. If channel->timeout is negative, + * leave it as-is, even though that should be impossible here. + */ + timeplus = channel->timeout; + { + /* How many times do we want to double it? Presume sane values here. */ + const int shift = query->try_count / channel->nservers; + + /* Is there enough room to shift timeplus left that many times? + * + * To find out, confirm that all of the bits we'll shift away are zero. + * Stop considering a shift if we get to the point where we could shift + * a 1 into the sign bit (i.e. when shift is within two of the bit + * count). + * + * This has the side benefit of leaving negative numbers unchanged. + */ + if(shift <= (int)(sizeof(int) * CHAR_BIT - 1) + && (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0) + { + timeplus <<= shift; + } + } + query->timeout = *now; timeadd(&query->timeout, timeplus); /* Keep track of queries bucketed by timeout, so we can process diff --git a/deps/cares/src/ares_search.c b/deps/cares/src/ares_search.c index 68e852574f0909..001c3482a7dd5d 100644 --- a/deps/cares/src/ares_search.c +++ b/deps/cares/src/ares_search.c @@ -54,6 +54,13 @@ void ares_search(ares_channel channel, const char *name, int dnsclass, const char *p; int status, ndots; + /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */ + if (ares__is_onion_domain(name)) + { + callback(arg, ARES_ENOTFOUND, 0, NULL, 0); + return; + } + /* If name only yields one domain to search, then we don't have * to keep extra state, so just do an ares_query(). */ diff --git a/deps/cares/src/ares_send.c b/deps/cares/src/ares_send.c index 88c0035520c504..f4f1f951197de8 100644 --- a/deps/cares/src/ares_send.c +++ b/deps/cares/src/ares_send.c @@ -60,6 +60,12 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, callback(arg, ARES_ENOMEM, 0, NULL, 0); return; } + if (channel->nservers < 1) + { + ares_free(query); + callback(arg, ARES_ESERVFAIL, 0, NULL, 0); + return; + } query->server_info = ares_malloc(channel->nservers * sizeof(query->server_info[0])); if (!query->server_info) diff --git a/deps/cares/src/ares_strsplit.c b/deps/cares/src/ares_strsplit.c new file mode 100644 index 00000000000000..b57a30f2a99c35 --- /dev/null +++ b/deps/cares/src/ares_strsplit.c @@ -0,0 +1,174 @@ +/* Copyright (C) 2018 by John Schember + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" +#include "ares_strsplit.h" +#include "ares.h" +#include "ares_private.h" + +static int list_contains(char * const *list, size_t num_elem, const char *str, int insensitive) +{ + size_t len; + size_t i; + + len = strlen(str); + for (i=0; i + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + */ + +#include "ares_setup.h" + +/* Split a string on delem skipping empty elements. + * + * param in String to split. + * param delims String of characters to treat as a delimitor. + * Each character in the string is a delimitor so + * there can be multiple delimitors to split on. + * E.g. ", " will split on all comma's and spaces. + * param make_set Have the list be a Set where there are no + * duplicate entries. 1 for true, 0 or false. + * param num_elm Return parameter of the number of elements + * in the result array. + * + * returns an allocated array of allocated string elements. + * + */ +char **ares_strsplit(const char *in, const char *delms, int make_set, size_t *num_elm); + +/* Frees the result returned from ares_strsplit(). */ +void ares_strsplit_free(char **elms, size_t num_elm); + + +#endif /* HEADER_CARES_STRSPLIT_H */ diff --git a/deps/cares/src/inet_ntop.c b/deps/cares/src/inet_ntop.c index ce3ce588d3c0bd..1935a871cede6d 100644 --- a/deps/cares/src/inet_ntop.c +++ b/deps/cares/src/inet_ntop.c @@ -180,8 +180,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size) tp += sprintf(tp, "%x", words[i]); } /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == - (NS_IN6ADDRSZ / NS_INT16SZ)) + if (best.base != -1 && (best.base + best.len) == (NS_IN6ADDRSZ / NS_INT16SZ)) *tp++ = ':'; *tp++ = '\0'; diff --git a/deps/v8/gypfiles/d8.gyp b/deps/v8/gypfiles/d8.gyp index f593a2b044ee4a..9611dfccf8aff0 100644 --- a/deps/v8/gypfiles/d8.gyp +++ b/deps/v8/gypfiles/d8.gyp @@ -23,6 +23,7 @@ 'include_dirs+': [ '..', '<(DEPTH)', + '<(SHARED_INTERMEDIATE_DIR)', ], 'sources': [ '../src/d8.h', diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 55ad7c8cf220cc..a5aaf2d6842dde 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -1019,9 +1019,9 @@ class V8_EXPORT PrimitiveArray { public: static Local New(Isolate* isolate, int length); int Length() const; - V8_DEPRECATED("Use Isolate* version", + V8_DEPRECATE_SOON("Use Isolate* version", void Set(int index, Local item)); - V8_DEPRECATED("Use Isolate* version", + V8_DEPRECATE_SOON("Use Isolate* version", Local Get(int index)); void Set(Isolate* isolate, int index, Local item); Local Get(Isolate* isolate, int index); @@ -1739,8 +1739,8 @@ class V8_EXPORT StackTrace { /** * Returns a StackFrame at a particular index. */ - V8_DEPRECATED("Use Isolate version", - Local GetFrame(uint32_t index) const); + V8_DEPRECATE_SOON("Use Isolate version", + Local GetFrame(uint32_t index) const); Local GetFrame(Isolate* isolate, uint32_t index) const; /** @@ -2451,7 +2451,7 @@ class V8_EXPORT Value : public Data { inline V8_DEPRECATED("Use maybe version", Local ToBoolean() const); - inline V8_DEPRECATED("Use maybe version", Local ToString() const); + inline V8_DEPRECATE_SOON("Use maybe version", Local ToString() const); inline V8_DEPRECATED("Use maybe version", Local ToObject() const); inline V8_DEPRECATED("Use maybe version", Local ToInteger() const); @@ -2471,7 +2471,7 @@ class V8_EXPORT Value : public Data { Local context) const; V8_WARN_UNUSED_RESULT Maybe Int32Value(Local context) const; - V8_DEPRECATED("Use maybe version", bool BooleanValue() const); + V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue() const); V8_DEPRECATED("Use maybe version", double NumberValue() const); V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const); V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const); @@ -2584,7 +2584,7 @@ class V8_EXPORT String : public Name { * Returns the number of bytes in the UTF-8 encoded * representation of this string. */ - V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const); + V8_DEPRECATE_SOON("Use Isolate version instead", int Utf8Length() const); int Utf8Length(Isolate* isolate) const; @@ -2642,23 +2642,23 @@ class V8_EXPORT String : public Name { // 16-bit character codes. int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, int options = NO_OPTIONS) const; - V8_DEPRECATED("Use Isolate* version", - int Write(uint16_t* buffer, int start = 0, int length = -1, - int options = NO_OPTIONS) const); + V8_DEPRECATE_SOON("Use Isolate* version", + int Write(uint16_t* buffer, int start = 0, int length = -1, + int options = NO_OPTIONS) const); // One byte characters. int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0, int length = -1, int options = NO_OPTIONS) const; - V8_DEPRECATED("Use Isolate* version", - int WriteOneByte(uint8_t* buffer, int start = 0, - int length = -1, int options = NO_OPTIONS) + V8_DEPRECATE_SOON("Use Isolate* version", + int WriteOneByte(uint8_t* buffer, int start = 0, + int length = -1, int options = NO_OPTIONS) const); // UTF-8 encoded characters. int WriteUtf8(Isolate* isolate, char* buffer, int length = -1, int* nchars_ref = NULL, int options = NO_OPTIONS) const; - V8_DEPRECATED("Use Isolate* version", - int WriteUtf8(char* buffer, int length = -1, - int* nchars_ref = NULL, - int options = NO_OPTIONS) const); + V8_DEPRECATE_SOON("Use Isolate* version", + int WriteUtf8(char* buffer, int length = -1, + int* nchars_ref = NULL, + int options = NO_OPTIONS) const); /** * A zero length string. @@ -2822,9 +2822,9 @@ class V8_EXPORT String : public Name { */ static Local Concat(Isolate* isolate, Local left, Local right); - static V8_DEPRECATED("Use Isolate* version", - Local Concat(Local left, - Local right)); + static V8_DEPRECATE_SOON("Use Isolate* version", + Local Concat(Local left, + Local right)); /** * Creates a new external string using the data defined in the given @@ -5049,8 +5049,8 @@ class V8_EXPORT BooleanObject : public Object { class V8_EXPORT StringObject : public Object { public: static Local New(Isolate* isolate, Local value); - V8_DEPRECATED("Use Isolate* version", - static Local New(Local value)); + V8_DEPRECATE_SOON("Use Isolate* version", + static Local New(Local value)); Local ValueOf() const; diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index 23b00624557606..f863cedee87e5a 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -30,15 +30,27 @@ 'ppc.debug': 'default_debug_ppc', 'ppc.optdebug': 'default_optdebug_ppc', 'ppc.release': 'default_release_ppc', + 'ppc.debug.sim': 'default_debug_ppc_sim', + 'ppc.optdebug.sim': 'default_optdebug_ppc_sim', + 'ppc.release.sim': 'default_release_ppc_sim', 'ppc64.debug': 'default_debug_ppc64', 'ppc64.optdebug': 'default_optdebug_ppc64', 'ppc64.release': 'default_release_ppc64', + 'ppc64.debug.sim': 'default_debug_ppc64_sim', + 'ppc64.optdebug.sim': 'default_optdebug_ppc64_sim', + 'ppc64.release.sim': 'default_release_ppc64_sim', 's390.debug': 'default_debug_s390', 's390.optdebug': 'default_optdebug_s390', 's390.release': 'default_release_s390', + 's390.debug.sim': 'default_debug_s390_sim', + 's390.optdebug.sim': 'default_optdebug_s390_sim', + 's390.release.sim': 'default_release_s390_sim', 's390x.debug': 'default_debug_s390x', 's390x.optdebug': 'default_optdebug_s390x', 's390x.release': 'default_release_s390x', + 's390x.debug.sim': 'default_debug_s390x_sim', + 's390x.optdebug.sim': 'default_optdebug_s390x_sim', + 's390x.release.sim': 'default_release_s390x_sim', 'x64.debug': 'default_debug_x64', 'x64.optdebug': 'default_optdebug_x64', 'x64.release': 'default_release_x64', @@ -285,28 +297,52 @@ 'default_release_mips64el': [ 'release', 'simulate_mips64el'], 'default_debug_ppc': [ - 'debug', 'simulate_ppc', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'debug', 'ppc', 'v8_enable_slow_dchecks', 'v8_full_debug'], 'default_optdebug_ppc': [ - 'debug', 'simulate_ppc', 'v8_enable_slow_dchecks'], + 'debug', 'ppc', 'v8_enable_slow_dchecks'], 'default_release_ppc': [ + 'release', 'ppc'], + 'default_debug_ppc_sim': [ + 'debug', 'simulate_ppc', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'default_optdebug_ppc_sim': [ + 'debug', 'simulate_ppc', 'v8_enable_slow_dchecks'], + 'default_release_ppc_sim': [ 'release', 'simulate_ppc'], 'default_debug_ppc64': [ - 'debug', 'simulate_ppc64', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'debug', 'ppc64', 'gcc', 'v8_enable_slow_dchecks', 'v8_full_debug'], 'default_optdebug_ppc64': [ - 'debug', 'simulate_ppc64', 'v8_enable_slow_dchecks'], + 'debug', 'ppc64', 'gcc', 'v8_enable_slow_dchecks'], 'default_release_ppc64': [ + 'release', 'ppc64', 'gcc'], + 'default_debug_ppc64_sim': [ + 'debug', 'simulate_ppc64', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'default_optdebug_ppc64_sim': [ + 'debug', 'simulate_ppc64', 'v8_enable_slow_dchecks'], + 'default_release_ppc64_sim': [ 'release', 'simulate_ppc64'], 'default_debug_s390': [ - 'debug', 'simulate_s390', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'debug', 's390', 'v8_enable_slow_dchecks', 'v8_full_debug'], 'default_optdebug_s390': [ - 'debug', 'simulate_s390', 'v8_enable_slow_dchecks'], + 'debug', 's390', 'v8_enable_slow_dchecks'], 'default_release_s390': [ + 'release', 's390'], + 'default_debug_s390_sim': [ + 'debug', 'simulate_s390', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'default_optdebug_s390_sim': [ + 'debug', 'simulate_s390', 'v8_enable_slow_dchecks'], + 'default_release_s390_sim': [ 'release', 'simulate_s390'], 'default_debug_s390x': [ - 'debug', 'simulate_s390x', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'debug', 's390x', 'v8_enable_slow_dchecks', 'v8_full_debug'], 'default_optdebug_s390x': [ - 'debug', 'simulate_s390x', 'v8_enable_slow_dchecks'], + 'debug', 's390x', 'v8_enable_slow_dchecks'], 'default_release_s390x': [ + 'release', 's390x'], + 'default_debug_s390x_sim': [ + 'debug', 'simulate_s390x', 'v8_enable_slow_dchecks', 'v8_full_debug'], + 'default_optdebug_s390x_sim': [ + 'debug', 'simulate_s390x', 'v8_enable_slow_dchecks'], + 'default_release_s390x_sim': [ 'release', 'simulate_s390x'], 'default_debug_x64': [ 'debug', 'x64', 'v8_enable_slow_dchecks', 'v8_full_debug'], @@ -816,6 +852,22 @@ 'gn_args': 'v8_enable_verify_csa=true', }, + 's390': { + 'gn_args': 'target_cpu="s390x" v8_target_cpu="s390"', + }, + + 's390x': { + 'gn_args': 'target_cpu="s390x" v8_target_cpu="s390x"', + }, + + 'ppc': { + 'gn_args': 'target_cpu="ppc"', + }, + + 'ppc64': { + 'gn_args': 'target_cpu="ppc64" use_custom_libcxx=false', + }, + 'x64': { 'gn_args': 'target_cpu="x64"', }, @@ -823,5 +875,6 @@ 'x86': { 'gn_args': 'target_cpu="x86"', }, + }, } diff --git a/deps/v8/src/compiler/bytecode-graph-builder.cc b/deps/v8/src/compiler/bytecode-graph-builder.cc index ade917de476ef7..8a60d680332e61 100644 --- a/deps/v8/src/compiler/bytecode-graph-builder.cc +++ b/deps/v8/src/compiler/bytecode-graph-builder.cc @@ -514,7 +514,7 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint( BytecodeGraphBuilder::BytecodeGraphBuilder( Zone* local_zone, Handle shared_info, Handle feedback_vector, BailoutId osr_offset, - JSGraph* jsgraph, CallFrequency invocation_frequency, + JSGraph* jsgraph, CallFrequency& invocation_frequency, SourcePositionTable* source_positions, Handle native_context, int inlining_id, JSTypeHintLowering::Flags flags, bool stack_check, bool analyze_environment_liveness) diff --git a/deps/v8/src/compiler/bytecode-graph-builder.h b/deps/v8/src/compiler/bytecode-graph-builder.h index 9025d477d57fe3..15eef5d844e140 100644 --- a/deps/v8/src/compiler/bytecode-graph-builder.h +++ b/deps/v8/src/compiler/bytecode-graph-builder.h @@ -31,7 +31,7 @@ class BytecodeGraphBuilder { BytecodeGraphBuilder( Zone* local_zone, Handle shared, Handle feedback_vector, BailoutId osr_offset, - JSGraph* jsgraph, CallFrequency invocation_frequency, + JSGraph* jsgraph, CallFrequency& invocation_frequency, SourcePositionTable* source_positions, Handle native_context, int inlining_id = SourcePosition::kNotInlined, JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags, diff --git a/deps/v8/src/compiler/js-inlining.cc b/deps/v8/src/compiler/js-inlining.cc index 08917ab78bd93d..075155c2496ba7 100644 --- a/deps/v8/src/compiler/js-inlining.cc +++ b/deps/v8/src/compiler/js-inlining.cc @@ -484,9 +484,10 @@ Reduction JSInliner::ReduceJSCall(Node* node) { if (info_->is_bailout_on_uninitialized()) { flags |= JSTypeHintLowering::kBailoutOnUninitialized; } + CallFrequency frequency = call.frequency(); BytecodeGraphBuilder graph_builder( zone(), shared_info, feedback_vector, BailoutId::None(), jsgraph(), - call.frequency(), source_positions_, native_context(), inlining_id, + frequency, source_positions_, native_context(), inlining_id, flags, false, info_->is_analyze_environment_liveness()); graph_builder.CreateGraph(); diff --git a/deps/v8/src/compiler/js-operator.cc b/deps/v8/src/compiler/js-operator.cc index 8fe10bb36a83d7..04feec6827aad0 100644 --- a/deps/v8/src/compiler/js-operator.cc +++ b/deps/v8/src/compiler/js-operator.cc @@ -794,7 +794,8 @@ const Operator* JSOperatorBuilder::CallForwardVarargs(size_t arity, parameters); // parameter } -const Operator* JSOperatorBuilder::Call(size_t arity, CallFrequency frequency, +const Operator* JSOperatorBuilder::Call(size_t arity, + CallFrequency const& frequency, VectorSlotPair const& feedback, ConvertReceiverMode convert_mode, SpeculationMode speculation_mode) { @@ -818,8 +819,8 @@ const Operator* JSOperatorBuilder::CallWithArrayLike(CallFrequency frequency) { } const Operator* JSOperatorBuilder::CallWithSpread( - uint32_t arity, CallFrequency frequency, VectorSlotPair const& feedback, - SpeculationMode speculation_mode) { + uint32_t arity, CallFrequency const& frequency, + VectorSlotPair const& feedback, SpeculationMode speculation_mode) { DCHECK_IMPLIES(speculation_mode == SpeculationMode::kAllowSpeculation, feedback.IsValid()); CallParameters parameters(arity, frequency, feedback, diff --git a/deps/v8/src/compiler/js-operator.h b/deps/v8/src/compiler/js-operator.h index 6d89e5ac09a9de..ac09ed229bd7b2 100644 --- a/deps/v8/src/compiler/js-operator.h +++ b/deps/v8/src/compiler/js-operator.h @@ -160,7 +160,7 @@ CallForwardVarargsParameters const& CallForwardVarargsParametersOf( // used as a parameter by JSCall and JSCallWithSpread operators. class CallParameters final { public: - CallParameters(size_t arity, CallFrequency frequency, + CallParameters(size_t arity, CallFrequency const& frequency, VectorSlotPair const& feedback, ConvertReceiverMode convert_mode, SpeculationMode speculation_mode) @@ -171,7 +171,7 @@ class CallParameters final { feedback_(feedback) {} size_t arity() const { return ArityField::decode(bit_field_); } - CallFrequency frequency() const { return frequency_; } + CallFrequency const& frequency() const { return frequency_; } ConvertReceiverMode convert_mode() const { return ConvertReceiverModeField::decode(bit_field_); } @@ -721,13 +721,13 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final const Operator* CallForwardVarargs(size_t arity, uint32_t start_index); const Operator* Call( - size_t arity, CallFrequency frequency = CallFrequency(), + size_t arity, CallFrequency const& frequency = CallFrequency(), VectorSlotPair const& feedback = VectorSlotPair(), ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation); const Operator* CallWithArrayLike(CallFrequency frequency); const Operator* CallWithSpread( - uint32_t arity, CallFrequency frequency = CallFrequency(), + uint32_t arity, CallFrequency const& frequency = CallFrequency(), VectorSlotPair const& feedback = VectorSlotPair(), SpeculationMode speculation_mode = SpeculationMode::kDisallowSpeculation); const Operator* CallRuntime(Runtime::FunctionId id); diff --git a/deps/v8/src/compiler/pipeline.cc b/deps/v8/src/compiler/pipeline.cc index 779457bcf76c34..0bc4bdd41428e2 100644 --- a/deps/v8/src/compiler/pipeline.cc +++ b/deps/v8/src/compiler/pipeline.cc @@ -1059,10 +1059,11 @@ struct GraphBuilderPhase { if (data->info()->is_bailout_on_uninitialized()) { flags |= JSTypeHintLowering::kBailoutOnUninitialized; } + CallFrequency frequency = CallFrequency(1.0f); BytecodeGraphBuilder graph_builder( temp_zone, data->info()->shared_info(), handle(data->info()->closure()->feedback_vector()), - data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f), + data->info()->osr_offset(), data->jsgraph(), frequency, data->source_positions(), data->native_context(), SourcePosition::kNotInlined, flags, true, data->info()->is_analyze_environment_liveness()); diff --git a/deps/v8/src/profiler/cpu-profiler.cc b/deps/v8/src/profiler/cpu-profiler.cc index 79606dc812ebda..ff510c040e86cf 100644 --- a/deps/v8/src/profiler/cpu-profiler.cc +++ b/deps/v8/src/profiler/cpu-profiler.cc @@ -368,8 +368,11 @@ void CpuProfiler::StartProcessorIfNotStarted() { // Disable logging when using the new implementation. saved_is_logging_ = logger->is_logging_; logger->is_logging_ = false; + + bool codemap_needs_initialization = false; if (!generator_) { generator_.reset(new ProfileGenerator(profiles_.get())); + codemap_needs_initialization = true; CreateEntriesForRuntimeCallStats(); } processor_.reset(new ProfilerEventsProcessor(isolate_, generator_.get(), @@ -382,12 +385,14 @@ void CpuProfiler::StartProcessorIfNotStarted() { isolate_->set_is_profiling(true); // Enumerate stuff we already have in the heap. DCHECK(isolate_->heap()->HasBeenSetUp()); - if (!FLAG_prof_browser_mode) { - logger->LogCodeObjects(); + if (codemap_needs_initialization) { + if (!FLAG_prof_browser_mode) { + logger->LogCodeObjects(); + } + logger->LogCompiledFunctions(); + logger->LogAccessorCallbacks(); + LogBuiltins(); } - logger->LogCompiledFunctions(); - logger->LogAccessorCallbacks(); - LogBuiltins(); // Enable stack sampling. processor_->AddCurrentStack(isolate_); processor_->StartSynchronously(); diff --git a/deps/v8/src/torque/file-visitor.h b/deps/v8/src/torque/file-visitor.h index 5aac1bad46d6a4..45820c5b6bf8ef 100644 --- a/deps/v8/src/torque/file-visitor.h +++ b/deps/v8/src/torque/file-visitor.h @@ -21,6 +21,10 @@ namespace torque { class FileVisitor { public: +#if defined(__GNUC__) && V8_OS_AIX + // prevent non-virtual-dtor gcc error on Aix + virtual ~FileVisitor() = default; +#endif explicit FileVisitor(GlobalContext& global_context) : global_context_(global_context), declarations_(global_context.declarations()), diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index da069e0a269386..85e2554f5ec77f 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -390,6 +390,7 @@ # TODO(ppc): Implement load/store reverse byte instructions 'test-run-wasm-simd/RunWasmCompiled_SimdLoadStoreLoad': [SKIP], 'test-run-wasm-simd/RunWasm_SimdLoadStoreLoad': [SKIP], + 'test-run-wasm-simd/RunWasm_SimdLoadStoreLoad_turbofan': [SKIP], }], # 'system == aix or (arch == ppc64 and byteorder == big)' diff --git a/deps/v8/third_party/antlr4/BUILD.gn b/deps/v8/third_party/antlr4/BUILD.gn index bd58a1804d1558..8d3d98a399f0f6 100644 --- a/deps/v8/third_party/antlr4/BUILD.gn +++ b/deps/v8/third_party/antlr4/BUILD.gn @@ -9,6 +9,9 @@ config("antlr-compatibility") { "-Wno-unused-but-set-variable", ] } + if (current_os == "aix") { + cflags += [ "-fdollars-in-identifiers" ] + } } source_set("antlr4") { diff --git a/deps/v8/tools/mb/mb.py b/deps/v8/tools/mb/mb.py index b2ae0c763f6a15..cbb5b5dd6d5bd6 100755 --- a/deps/v8/tools/mb/mb.py +++ b/deps/v8/tools/mb/mb.py @@ -835,7 +835,13 @@ def GNCmd(self, subcommand, path, *args): else: subdir, exe = 'win', 'gn.exe' - gn_path = self.PathJoin(self.chromium_src_dir, 'buildtools', subdir, exe) + arch = platform.machine() + if (arch.startswith('s390') or arch.startswith('ppc') or + self.platform.startswith('aix')): + # use gn in PATH + gn_path = 'gn' + else: + gn_path = self.PathJoin(self.chromium_src_dir, 'buildtools', subdir, exe) return [gn_path, subcommand, path] + list(args) diff --git a/deps/v8/tools/profile.js b/deps/v8/tools/profile.js index cddadaaf53121a..74b4b3bf663f66 100644 --- a/deps/v8/tools/profile.js +++ b/deps/v8/tools/profile.js @@ -1002,33 +1002,10 @@ JsonProfile.prototype.addSourcePositions = function( }; }; -function unescapeString(s) { - s = s.split("\\"); - for (var i = 1; i < s.length; i++) { - if (s[i] === "") { - // Double backslash. - s[i] = "\\"; - } else if (i > 0 && s[i].startsWith("x")) { - // Escaped Ascii character. - s[i] = String.fromCharCode(parseInt(s[i].substring(1, 3), 16)) + - s[i].substring(3); - } else if (i > 0 && s[i].startsWith("u")) { - // Escaped unicode character. - s[i] = String.fromCharCode(parseInt(s[i].substring(1, 5), 16)) + - s[i].substring(5); - } else { - if (i > 0 && s[i - 1] !== "\\") { - printErr("Malformed source string"); - } - } - } - return s.join(""); -} - JsonProfile.prototype.addScriptSource = function(script, url, source) { this.scripts_[script] = { - name : unescapeString(url), - source : unescapeString(source) + name : url, + source : source }; }; diff --git a/doc/STYLE_GUIDE.md b/doc/STYLE_GUIDE.md index 5d0f4f14eb2a22..c274f6023ede02 100644 --- a/doc/STYLE_GUIDE.md +++ b/doc/STYLE_GUIDE.md @@ -24,8 +24,6 @@ clause — a subject, verb, and an object. * Outside of the wrapping element if the wrapping element contains only a fragment of a clause. -* Place end-of-sentence punctuation inside wrapping elements — periods go - inside parentheses and quotes, not after. * Documents must start with a level-one heading. * Prefer affixing links to inlining links — prefer `[a link][]` to `[a link](http://example.com)`. @@ -53,10 +51,6 @@ * References to constructor instances should use camelCase. * References to methods should be used with parentheses: for example, `socket.end()` instead of `socket.end`. -* To draw special attention to a note, adhere to the following guidelines: - * Make the "Note:" label italic, i.e. `*Note*:`. - * Use a capital letter after the "Note:" label. - * Preferably, make the note a new paragraph for better visual distinction. * Function arguments or object properties should use the following format: * ``` * `name` {type|type2} Optional description. **Default:** `value`. ``` @@ -71,6 +65,8 @@ * NOT OK: Javascript, Google's v8 +* Use _Node.js_ and not _Node_, _NodeJS_, or similar variants. + * When referring to the executable, _`node`_ is acceptable. See also API documentation structure overview in [doctools README][]. diff --git a/doc/api/addons.md b/doc/api/addons.md index b2c52d5128b5bc..757f24c5194271 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -587,6 +587,7 @@ property `msg` that echoes the string passed to `createObject()`: namespace demo { +using v8::Context; using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; @@ -596,9 +597,11 @@ using v8::Value; void CreateObject(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); Local obj = Object::New(isolate); - obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString(isolate)); + obj->Set(String::NewFromUtf8(isolate, "msg"), + args[0]->ToString(context).ToLocalChecked()); args.GetReturnValue().Set(obj); } @@ -1078,6 +1081,7 @@ that can take two `MyObject` objects as input arguments: namespace demo { +using v8::Context; using v8::FunctionCallbackInfo; using v8::Isolate; using v8::Local; @@ -1092,11 +1096,12 @@ void CreateObject(const FunctionCallbackInfo& args) { void Add(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); + Local context = isolate->GetCurrentContext(); MyObject* obj1 = node::ObjectWrap::Unwrap( - args[0]->ToObject(isolate)); + args[0]->ToObject(context).ToLocalChecked()); MyObject* obj2 = node::ObjectWrap::Unwrap( - args[1]->ToObject(isolate)); + args[1]->ToObject(context).ToLocalChecked()); double sum = obj1->value() + obj2->value(); args.GetReturnValue().Set(Number::New(isolate, sum)); diff --git a/doc/api/assert.md b/doc/api/assert.md index 4800bed4e8239d..50519b831c9a2c 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -418,10 +418,10 @@ the function does not return a promise, `assert.doesNotReject()` will return a rejected `Promise` with an [`ERR_INVALID_RETURN_VALUE`][] error. In both cases the error handler is skipped. -Please note: Using `assert.doesNotReject()` is actually not useful because there -is little benefit by catching a rejection and then rejecting it again. Instead, -consider adding a comment next to the specific code path that should not reject -and keep error messages as expressive as possible. +Using `assert.doesNotReject()` is actually not useful because there is little +benefit in catching a rejection and then rejecting it again. Instead, consider +adding a comment next to the specific code path that should not reject and keep +error messages as expressive as possible. If specified, `error` can be a [`Class`][], [`RegExp`][] or a validation function. See [`assert.throws()`][] for more details. @@ -464,8 +464,8 @@ changes: Asserts that the function `fn` does not throw an error. -Please note: Using `assert.doesNotThrow()` is actually not useful because there -is no benefit by catching an error and then rethrowing it. Instead, consider +Using `assert.doesNotThrow()` is actually not useful because there +is no benefit in catching an error and then rethrowing it. Instead, consider adding a comment next to the specific code path that should not throw and keep error messages as expressive as possible. diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 252ded2ca41b2c..f0752a5892c362 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -704,6 +704,8 @@ alternative. #### asyncResource.emitDestroy() +* Returns: {AsyncResource} A reference to `asyncResource`. + Call all `destroy` hooks. This should only ever be called once. An error will be thrown if it is called more than once. This **must** be manually called. If the resource is left to be collected by the GC then the `destroy` hooks will diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 56999a1955d0a1..897512ae000805 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1933,6 +1933,14 @@ buf2.swap16(); // Throws ERR_INVALID_BUFFER_SIZE ``` +One convenient use of `buf.swap16()` is to perform a fast in-place conversion +between UTF-16 little-endian and UTF-16 big-endian: + +```js +const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); +buf.swap16(); // Convert to big-endian UTF-16 text. +``` + ### buf.swap32() @@ -525,6 +544,9 @@ malformed, but any errors are otherwise ignored. Note that neither the well known nor extra certificates are used when the `ca` options property is explicitly specified for a TLS or HTTPS client or server. +This environment variable is ignored when `node` runs as setuid root or +has Linux file capabilities set. + ### `NODE_ICU_DATA=file` +> Stability: 0 - Deprecated + The default encoding to use for functions that can take either strings or [buffers][`Buffer`]. The default value is `'buffer'`, which makes methods default to [`Buffer`][] objects. @@ -1315,6 +1317,8 @@ added: v6.0.0 deprecated: v10.0.0 --> +> Stability: 0 - Deprecated + Property for checking and controlling whether a FIPS compliant crypto provider is currently in use. Setting to true requires a FIPS build of Node.js. @@ -1551,6 +1555,7 @@ changes: * `generator` {number | string | Buffer | TypedArray | DataView} **Default:** `2` * `generatorEncoding` {string} +* Returns: {DiffieHellman} Creates a `DiffieHellman` key exchange object using the supplied `prime` and an optional specific `generator`. @@ -1574,6 +1579,7 @@ added: v0.5.0 * `primeLength` {number} * `generator` {number | string | Buffer | TypedArray | DataView} **Default:** `2` +* Returns: {DiffieHellman} Creates a `DiffieHellman` key exchange object and generates a prime of `primeLength` bits using an optional specific numeric `generator`. @@ -1584,6 +1590,7 @@ If `generator` is not specified, the value `2` is used. added: v0.11.14 --> * `curveName` {string} +* Returns: {ECDH} Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a predefined curve specified by the `curveName` string. Use @@ -1836,7 +1843,7 @@ console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] added: v0.7.5 --> * `groupName` {string} -* Returns: {Object} +* Returns: {DiffieHellman} Creates a predefined `DiffieHellman` key exchange object. The supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 01e6afeeb261cd..22f40da01c4fe1 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -321,7 +321,7 @@ changes: Type: End-of-Life Calling an asynchronous function without a callback throws a `TypeError` -in Node.js 10.0.0 onwards. (See https://github.com/nodejs/node/pull/12562.) +in Node.js 10.0.0 onwards. (See .) ### DEP0014: fs.read legacy String interface @@ -1697,7 +1697,7 @@ changes: Type: End-of-Life The AsyncHooks Sensitive API was never documented and had various minor issues. -(See https://github.com/nodejs/node/issues/15572.) Use the `AsyncResource` +(See .) Use the `AsyncResource` API instead. @@ -1717,8 +1717,8 @@ changes: Type: End-of-Life `runInAsyncIdScope` doesn't emit the `'before'` or `'after'` event and can thus -cause a lot of issues. See https://github.com/nodejs/node/issues/14328 for more -details. +cause a lot of issues. See for +more details. ### DEP0089: require('assert') @@ -1875,7 +1875,7 @@ to unrecoverable errors. Use [`asyncResource.runInAsyncScope()`][] API instead which provides a much safer, and more convenient, alternative. See -https://github.com/nodejs/node/pull/18513 for more details. + for more details. ### DEP0099: async context-unaware node::MakeCallback C++ APIs diff --git a/doc/api/dgram.md b/doc/api/dgram.md index fd99401868d54e..7db8cdf3650342 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -95,6 +95,24 @@ Tells the kernel to join a multicast group at the given `multicastAddress` and one interface and will add membership to it. To add membership to every available interface, call `addMembership` multiple times, once per interface. +When sharing a UDP socket across multiple `cluster` workers, the +`socket.addMembership()` function must be called only once or an +`EADDRINUSE` error will occur: + +```js +const cluster = require('cluster'); +const dgram = require('dgram'); +if (cluster.isMaster) { + cluster.fork(); // Works ok. + cluster.fork(); // Fails with EADDRINUSE. +} else { + const s = dgram.createSocket('udp4'); + s.bind(1234, () => { + s.addMembership('224.0.0.114'); + }); +} +``` + ### socket.address() + + + +* {Object} + +The object that acts as the namespace for all W3C +[WebAssembly][webassembly-org] related functionality. See the +[Mozilla Developer Network][webassembly-mdn] for usage and compatibility. + [`__dirname`]: modules.html#modules_dirname [`__filename`]: modules.html#modules_filename [`clearImmediate`]: timers.html#timers_clearimmediate_immediate @@ -175,3 +188,5 @@ The WHATWG `URLSearchParams` class. See the [`URLSearchParams`][] section. [built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects [module system documentation]: modules.html [timers]: timers.html +[webassembly-mdn]: https://developer.mozilla.org/en-US/docs/WebAssembly +[webassembly-org]: https://webassembly.org diff --git a/doc/api/http.md b/doc/api/http.md index c19fff4916bffd..9a9e5c939ddff2 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -599,13 +599,13 @@ The type of the return value depends on the arguments provided to ```js request.setHeader('content-type', 'text/html'); request.setHeader('Content-Length', Buffer.byteLength(body)); -request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); +request.setHeader('Cookie', ['type=ninja', 'language=javascript']); const contentType = request.getHeader('Content-Type'); // contentType is 'text/html' const contentLength = request.getHeader('Content-Length'); // contentLength is of type number -const setCookie = request.getHeader('set-cookie'); -// setCookie is of type string[] +const cookie = request.getHeader('Cookie'); +// cookie is of type string[] ``` ### request.maxHeadersCount @@ -649,7 +649,7 @@ request.setHeader('Content-Type', 'application/json'); or ```js -request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); +request.setHeader('Cookie', ['type=ninja', 'language=javascript']); ``` ### request.setNoDelay([noDelay]) @@ -1516,6 +1516,34 @@ added: v10.1.0 The `message.aborted` property will be `true` if the request has been aborted. +### message.complete + + +* {boolean} + +The `message.complete` property will be `true` if a complete HTTP message has +been received and successfully parsed. + +This property is particularly useful as a means of determining if a client or +server fully transmitted a message before a connection was terminated: + +```js +const req = http.request({ + host: '127.0.0.1', + port: 8080, + method: 'POST' +}, (res) => { + res.resume(); + res.on('end', () => { + if (!res.complete) + console.error( + 'The connection was terminated while the message was still being sent'); + }); +}); +``` + ### message.destroy([error]) * `callback` {Function} +* Returns: {https.Server} See [`server.close()`][`http.close()`] from the HTTP module for details. @@ -55,6 +56,7 @@ added: v0.11.2 --> * `msecs` {number} **Default:** `120000` (2 minutes) * `callback` {Function} +* Returns: {https.Server} See [`http.Server#setTimeout()`][]. @@ -81,6 +83,7 @@ added: v0.3.4 * `options` {Object} Accepts `options` from [`tls.createServer()`][], [`tls.createSecureContext()`][] and [`http.createServer()`][]. * `requestListener` {Function} A listener to be added to the `'request'` event. +* Returns: {https.Server} ```js // curl -k https://localhost:8000/ diff --git a/doc/api/index.md b/doc/api/index.md index 5ba0da6a7fb5aa..4262191327ce60 100644 --- a/doc/api/index.md +++ b/doc/api/index.md @@ -61,4 +61,3 @@
* [GitHub Repo & Issue Tracker](https://github.com/nodejs/node) -* [Mailing List](https://groups.google.com/forum/#!forum/nodejs) diff --git a/doc/api/inspector.md b/doc/api/inspector.md index 92fcb0e03f89e4..7406e36e73ce7e 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -43,6 +43,9 @@ started. If wait is `true`, will block until a client has connected to the inspect port and flow control has been passed to the debugger client. +See the [security warning](cli.html#inspector_security) regarding the `host` +parameter usage. + ## inspector.url() * Returns: {string|undefined} @@ -144,7 +147,7 @@ session.post('Runtime.evaluate', { expression: '2 + 2' }, The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer][]. -Node inspector supports all the Chrome DevTools Protocol domains declared +Node.js inspector supports all the Chrome DevTools Protocol domains declared by V8. Chrome DevTools Protocol domain provides an interface for interacting with one of the runtime agents used to inspect the application state and listen to the run-time events. diff --git a/doc/api/modules.md b/doc/api/modules.md index 59c589e83ac233..c7d9d4b59c7726 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -376,8 +376,9 @@ Error: Cannot find module 'some-library' If the module identifier passed to `require()` is not a [core](#modules_core_modules) module, and does not begin with `'/'`, `'../'`, or `'./'`, then Node.js starts at the parent directory of the current module, and -adds `/node_modules`, and attempts to load the module from that location. Node -will not append `node_modules` to a path already ending in `node_modules`. +adds `/node_modules`, and attempts to load the module from that location. +Node.js will not append `node_modules` to a path already ending in +`node_modules`. If it is not found there, then it moves to the parent directory, and so on, until the root of the file system is reached. @@ -552,7 +553,22 @@ added: v0.1.13 * {Function} -To require modules. +Used to import modules, `JSON`, and local files. Modules can be imported +from `node_modules`. Local modules and JSON files can be imported using +a relative path (e.g. `./`, `./foo`, `./bar/baz`, `../foo`) that will be +resolved against the directory named by [`__dirname`][] (if defined) or +the current working directory. + +```js +// Importing a local module: +const myLocalModule = require('./path/myLocalModule'); + +// Importing a JSON file: +const jsonData = require('./path/filename.json'); + +// Importing a module from node_modules or Node.js built-in module: +const crypto = require('crypto'); +``` #### require.cache -If `true` - +If `true`, [`socket.connect(options[, connectListener])`][`socket.connect(options)`] -was called and haven't yet finished. Will be set to `false` before emitting +was called and has not yet finished. Will be set to `true` before emitting `'connect'` event and/or calling [`socket.connect(options[, connectListener])`][`socket.connect(options)`]'s callback. @@ -684,13 +684,14 @@ listeners for that event will receive `exception` as an argument. * {boolean} Indicates if the connection is destroyed or not. Once a connection is destroyed no further data can be transferred using it. -### socket.end([data][, encoding]) +### socket.end([data][, encoding][, callback]) * `data` {string|Buffer|Uint8Array} * `encoding` {string} Only used when data is `string`. **Default:** `'utf8'`. +* `callback` {Function} Optional callback for when the socket is finished. * Returns: {net.Socket} The socket itself. Half-closes the socket. i.e., it sends a FIN packet. It is possible the @@ -885,6 +886,7 @@ added: v0.7.0 --> * `options` {Object} * `connectListener` {Function} + Alias to [`net.createConnection(options[, connectListener])`][`net.createConnection(options)`]. @@ -1027,10 +1029,6 @@ then returns the `net.Socket` that starts the connection. -* `options` {Object} -* `connectionListener` {Function} - -Creates a new TCP or [IPC][] server. * `options` {Object} * `allowHalfOpen` {boolean} Indicates whether half-opened TCP @@ -1041,6 +1039,8 @@ Creates a new TCP or [IPC][] server. [`'connection'`][] event. * Returns: {net.Server} +Creates a new TCP or [IPC][] server. + If `allowHalfOpen` is set to `true`, when the other end of the socket sends a FIN packet, the server will only send a FIN packet back when [`socket.end()`][] is explicitly called, until then the connection is @@ -1168,7 +1168,7 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`. [`socket.connect(path)`]: #net_socket_connect_path_connectlistener [`socket.connect(port, host)`]: #net_socket_connect_port_host_connectlistener [`socket.destroy()`]: #net_socket_destroy_exception -[`socket.end()`]: #net_socket_end_data_encoding +[`socket.end()`]: #net_socket_end_data_encoding_callback [`socket.pause()`]: #net_socket_pause [`socket.resume()`]: #net_socket_resume [`socket.setEncoding()`]: #net_socket_setencoding_encoding diff --git a/doc/api/path.md b/doc/api/path.md index 2a1f06028ee6f4..4cfa4fa8ae37d5 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -18,9 +18,7 @@ on which a Node.js application is running. Specifically, when running on a Windows operating system, the `path` module will assume that Windows-style paths are being used. -For example, using the `path.basename()` function with the Windows file path -`C:\temp\myfile.html`, will yield different results when running on POSIX than -when run on Windows: +So using `path.basename()` might yield different results on POSIX and Windows: On POSIX: @@ -56,7 +54,7 @@ path.posix.basename('/tmp/myfile.html'); // Returns: 'myfile.html' ``` -*Note:* On Windows Node.js follows the concept of per-drive working directory. +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 @@ -290,7 +288,7 @@ added: v0.1.16 * Returns: {string} The `path.join()` method joins all given `path` segments together using the -platform specific separator as a delimiter, then normalizes the resulting path. +platform-specific separator as a delimiter, then normalizes the resulting path. Zero-length `path` segments are ignored. If the joined path string is a zero-length string then `'.'` will be returned, representing the current @@ -319,7 +317,7 @@ The `path.normalize()` method normalizes the given `path`, resolving `'..'` and When multiple, sequential path segment separation characters are found (e.g. `/` on POSIX and either `\` or `/` on Windows), they are replaced by a single -instance of the platform specific path segment separator (`/` on POSIX and +instance of the platform-specific path segment separator (`/` on POSIX and `\` on Windows). Trailing separators are preserved. If the `path` is a zero-length string, `'.'` is returned, representing the @@ -545,7 +543,7 @@ On Windows systems only, returns an equivalent [namespace-prefixed path][] for the given `path`. If `path` is not a string, `path` will be returned without modifications. -This method is meaningful only on Windows system. On posix systems, the +This method is meaningful only on Windows system. On POSIX systems, the method is non-operational and always returns `path` without modifications. ## path.win32 diff --git a/doc/api/process.md b/doc/api/process.md index 5139ad95d88d21..2eac1160586af1 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -114,7 +114,7 @@ The `'multipleResolves'` event is emitted whenever a `Promise` has been either: * Rejected after resolve. * Resolved after reject. -This is useful for tracking errors in your application while using the promise +This is useful for tracking errors in an application while using the promise constructor. Otherwise such mistakes are silently swallowed due to being in a dead zone. @@ -207,9 +207,9 @@ exception bubbles all the way back to the event loop. By default, Node.js handles such exceptions by printing the stack trace to `stderr` and exiting with code 1, overriding any previously set [`process.exitCode`][]. Adding a handler for the `'uncaughtException'` event overrides this default -behavior. You may also change the [`process.exitCode`][] in -`'uncaughtException'` handler which will result in process exiting with -provided exit code, otherwise in the presence of such handler the process will +behavior. Alternatively, change the [`process.exitCode`][] in the +`'uncaughtException'` handler which will result in the process exiting with the +provided exit code. Otherwise, in the presence of such handler the process will exit with 0. The listener function is called with the `Error` object passed as the only diff --git a/doc/api/repl.md b/doc/api/repl.md index 98c3f66839da83..09fe9ebcbece61 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -453,7 +453,7 @@ Returns `true` if `keyword` is a valid keyword, otherwise `false`. added: v0.1.91 changes: - version: v10.0.0 - pr-url: https://github.com/nodejs/node/pull/v10.0.0 + pr-url: https://github.com/nodejs/node/pull/19187 description: The `REPL_MAGIC_MODE` `replMode` was removed. - version: v5.8.0 pr-url: https://github.com/nodejs/node/pull/5388 @@ -499,6 +499,7 @@ changes: * `breakEvalOnSigint` - Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together with a custom `eval` function. **Default:** `false`. +* Returns: {repl.REPLServer} The `repl.start()` method creates and starts a [`repl.REPLServer`][] instance. @@ -619,10 +620,10 @@ possible to connect to a long-running Node.js process without restarting it. For an example of running a "full-featured" (`terminal`) REPL over a `net.Server` and `net.Socket` instance, see: -[https://gist.github.com/TooTallNate/2209310](https://gist.github.com/TooTallNate/2209310). +. For an example of running a REPL instance over [curl(1)][], see: -[https://gist.github.com/TooTallNate/2053342](https://gist.github.com/TooTallNate/2053342). +. [`'uncaughtException'`]: process.html#process_event_uncaughtexception [`--experimental-repl-await`]: cli.html#cli_experimental_repl_await diff --git a/doc/api/stream.md b/doc/api/stream.md index bcec902afb6228..fbb8ad78facf70 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -46,7 +46,7 @@ There are four fundamental stream types within Node.js: * [`Transform`][] - `Duplex` streams that can modify or transform the data as it is written and read (for example, [`zlib.createDeflate()`][]). -Additionally this module includes the utility functions [pipeline][] and +Additionally, this module includes the utility functions [pipeline][] and [finished][]. ### Object Mode @@ -97,7 +97,7 @@ is to limit the buffering of data to acceptable levels such that sources and destinations of differing speeds will not overwhelm the available memory. Because [`Duplex`][] and [`Transform`][] streams are both `Readable` and -`Writable`, each maintain *two* separate internal buffers used for reading and +`Writable`, each maintains *two* separate internal buffers used for reading and writing, allowing each side to operate independently of the other while maintaining an appropriate and efficient flow of data. For example, [`net.Socket`][] instances are [`Duplex`][] streams whose `Readable` side allows @@ -388,7 +388,7 @@ changes: not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any JavaScript value other than `null`. -* `encoding` {string} The encoding, if `chunk` is a string +* `encoding` {string} The encoding if `chunk` is a string * `callback` {Function} Optional callback for when the stream is finished * Returns: {this} @@ -531,7 +531,7 @@ not draining may lead to a remotely exploitable vulnerability. Writing data while the stream is not draining is particularly problematic for a [`Transform`][], because the `Transform` streams are paused -by default until they are piped or an `'data'` or `'readable'` event handler +by default until they are piped or a `'data'` or `'readable'` event handler is added. If the data to be written can be generated or fetched on demand, it is @@ -610,7 +610,7 @@ until a mechanism for either consuming or ignoring that data is provided. If the consuming mechanism is disabled or taken away, the `Readable` will *attempt* to stop generating the data. -For backwards compatibility reasons, removing [`'data'`][] event handlers will +For backward compatibility reasons, removing [`'data'`][] event handlers will **not** automatically pause the stream. Also, if there are piped destinations, then calling [`stream.pause()`][stream-pause] will not guarantee that the stream will *remain* paused once those destinations drain and ask for more data. @@ -1342,7 +1342,7 @@ Especially useful in error handling scenarios where a stream is destroyed prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`. -The `finished` API is promisify'able as well; +The `finished` API is promisify-able as well; ```js const finished = util.promisify(stream.finished); @@ -1394,7 +1394,7 @@ pipeline( ); ``` -The `pipeline` API is promisify'able as well: +The `pipeline` API is promisify-able as well: ```js const pipeline = util.promisify(stream.pipeline); @@ -1866,7 +1866,7 @@ changes: any JavaScript value. * `encoding` {string} Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. -* Returns: {boolean} `true` if additional chunks of data may continued to be +* Returns: {boolean} `true` if additional chunks of data may continue to be pushed; `false` otherwise. When `chunk` is a `Buffer`, `Uint8Array` or `string`, the `chunk` of data will @@ -2279,7 +2279,7 @@ The `callback` function must be called only when the current chunk is completely consumed. The first argument passed to the `callback` must be an `Error` object if an error occurred while processing the input or `null` otherwise. If a second argument is passed to the `callback`, it will be forwarded on to the -`readable.push()` method. In other words the following are equivalent: +`readable.push()` method. In other words, the following are equivalent: ```js transform.prototype._transform = function(data, encoding, callback) { @@ -2326,7 +2326,7 @@ less powerful and less useful. guaranteed. This meant that it was still necessary to be prepared to receive [`'data'`][] events *even when the stream was in a paused state*. -In Node.js 0.10, the [`Readable`][] class was added. For backwards +In Node.js 0.10, the [`Readable`][] class was added. For backward compatibility with older Node.js programs, `Readable` streams switch into "flowing mode" when a [`'data'`][] event handler is added, or when the [`stream.resume()`][stream-resume] method is called. The effect is that, even diff --git a/doc/api/synopsis.md b/doc/api/synopsis.md index d22d684bfb0b8f..efbbf54a1a7fed 100644 --- a/doc/api/synopsis.md +++ b/doc/api/synopsis.md @@ -14,7 +14,7 @@ An example of a [web server][] written with Node.js which responds with Commands displayed in this document are shown starting with `$` or `>` to replicate how they would appear in a user's terminal. -Do not include the `$` and `>` character they are there to +Do not include the `$` and `>` characters. They are there to indicate the start of each command. There are many tutorials and examples that follow this @@ -27,8 +27,8 @@ the output of the previous command. Firstly, make sure to have downloaded and installed Node.js. See [this guide][] for further install information. -Now, create an empty project folder called `projects`, navigate into it: -Project folder can be named base on user's current project title but +Now, create an empty project folder called `projects`, then navigate into it. +The project folder can be named based on the user's current project title, but this example will use `projects` as the project folder. Linux and Mac: @@ -60,7 +60,7 @@ hyphens (`-`) or underscores (`_`) to separate multiple words in filenames. Open `hello-world.js` in any preferred text editor and -paste in the following content. +paste in the following content: ```js const http = require('http'); diff --git a/doc/api/tls.md b/doc/api/tls.md index fe8bfa27ef6ca2..30dfb9c31e01fe 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -378,6 +378,7 @@ added: v0.3.2 * `callback` {Function} A listener callback that will be registered to listen for the server instance's `'close'` event. +* Returns: {tls.Server} The `server.close()` method stops the server from accepting new connections. @@ -566,7 +567,7 @@ field which always contains the value `'TLSv1/SSLv3'`. For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }`. See `SSL_CIPHER_get_name()` in -https://www.openssl.org/docs/man1.1.0/ssl/SSL_CIPHER_get_name.html for more + for more information. ### tlsSocket.getEphemeralKeyInfo() @@ -677,13 +678,12 @@ be returned for server sockets or disconnected client sockets. Example responses include: -* `SSLv3` * `TLSv1` * `TLSv1.1` * `TLSv1.2` * `unknown` -See https://www.openssl.org/docs/man1.1.0/ssl/SSL_get_version.html for more +See for more information. ### tlsSocket.getSession() @@ -891,7 +891,7 @@ changes: first byte is the length of the next protocol name. Passing an array is usually much simpler, e.g. `['hello', 'world']`. * `servername`: {string} Server name for the SNI (Server Name Indication) TLS - extension. + extension. It must be a host name, and not an IP address. * `checkServerIdentity(servername, cert)` {Function} A callback function to be used (instead of the builtin `tls.checkServerIdentity()` function) when checking the server's hostname (or the provided `servername` when @@ -912,6 +912,7 @@ changes: * ...: [`tls.createSecureContext()`][] options that are used if the `secureContext` option is missing, otherwise they are ignored. * `callback` {Function} +* Returns: {tls.TLSSocket} The `callback` function, if specified, will be added as a listener for the [`'secureConnect'`][] event. @@ -986,6 +987,7 @@ added: v0.11.3 * `path` {string} Default value for `options.path`. * `options` {Object} See [`tls.connect()`][]. * `callback` {Function} See [`tls.connect()`][]. +* Returns: {tls.TLSSocket} Same as [`tls.connect()`][] except that `path` can be provided as an argument instead of an option. @@ -1001,6 +1003,7 @@ added: v0.11.3 * `host` {string} Default value for `options.host`. * `options` {Object} See [`tls.connect()`][]. * `callback` {Function} See [`tls.connect()`][]. +* Returns: {tls.TLSSocket} Same as [`tls.connect()`][] except that `port` and `host` can be provided as arguments instead of options. @@ -1173,6 +1176,7 @@ changes: * ...: Any [`tls.createSecureContext()`][] option can be provided. For servers, the identity options (`pfx` or `key`/`cert`) are usually required. * `secureConnectionListener` {Function} +* Returns: {tls.Server} Creates a new [`tls.Server`][]. The `secureConnectionListener`, if provided, is automatically set as a listener for the [`'secureConnection'`][] event. diff --git a/doc/api/url.md b/doc/api/url.md index cd817bf304b19e..84f9b3684ff0b2 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -26,31 +26,31 @@ backwards compatibility with existing applications. New application code should use the WHATWG API. A comparison between the WHATWG and Legacy APIs is provided below. Above the URL -`'http://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'`, properties of -an object returned by the legacy `url.parse()` are shown. Below it are +`'http://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash'`, properties +of an object returned by the legacy `url.parse()` are shown. Below it are properties of a WHATWG `URL` object. WHATWG URL's `origin` property includes `protocol` and `host`, but not `username` or `password`. ```txt -┌─────────────────────────────────────────────────────────────────────────────────────────────┐ -│ href │ -├──────────┬──┬─────────────────────┬─────────────────────┬───────────────────────────┬───────┤ -│ protocol │ │ auth │ host │ path │ hash │ -│ │ │ ├──────────────┬──────┼──────────┬────────────────┤ │ -│ │ │ │ hostname │ port │ pathname │ search │ │ -│ │ │ │ │ │ ├─┬──────────────┤ │ -│ │ │ │ │ │ │ │ query │ │ -" https: // user : pass @ sub.host.com : 8080 /p/a/t/h ? query=string #hash " -│ │ │ │ │ hostname │ port │ │ │ │ -│ │ │ │ ├──────────────┴──────┤ │ │ │ -│ protocol │ │ username │ password │ host │ │ │ │ -├──────────┴──┼──────────┴──────────┼─────────────────────┤ │ │ │ -│ origin │ │ origin │ pathname │ search │ hash │ -├─────────────┴─────────────────────┴─────────────────────┴──────────┴────────────────┴───────┤ -│ href │ -└─────────────────────────────────────────────────────────────────────────────────────────────┘ +┌────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ href │ +├──────────┬──┬─────────────────────┬────────────────────────┬───────────────────────────┬───────┤ +│ protocol │ │ auth │ host │ path │ hash │ +│ │ │ ├─────────────────┬──────┼──────────┬────────────────┤ │ +│ │ │ │ hostname │ port │ pathname │ search │ │ +│ │ │ │ │ │ ├─┬──────────────┤ │ +│ │ │ │ │ │ │ │ query │ │ +" https: // user : pass @ sub.example.com : 8080 /p/a/t/h ? query=string #hash " +│ │ │ │ │ hostname │ port │ │ │ │ +│ │ │ │ ├─────────────────┴──────┤ │ │ │ +│ protocol │ │ username │ password │ host │ │ │ │ +├──────────┴──┼──────────┴──────────┼────────────────────────┤ │ │ │ +│ origin │ │ origin │ pathname │ search │ hash │ +├─────────────┴─────────────────────┴────────────────────────┴──────────┴────────────────┴───────┤ +│ href │ +└────────────────────────────────────────────────────────────────────────────────────────────────┘ (all spaces in the "" line should be ignored — they are purely for formatting) ``` @@ -58,7 +58,7 @@ Parsing the URL string using the WHATWG API: ```js const myURL = - new URL('https://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'); + new URL('https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash'); ``` Parsing the URL string using the Legacy API: @@ -66,7 +66,7 @@ Parsing the URL string using the Legacy API: ```js const url = require('url'); const myURL = - url.parse('https://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'); + url.parse('https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash'); ``` ## The WHATWG URL API @@ -120,8 +120,8 @@ Unicode characters appearing within the hostname of `input` will be automatically converted to ASCII using the [Punycode][] algorithm. ```js -const myURL = new URL('https://你好你好'); -// https://xn--6qqa088eba/ +const myURL = new URL('https://測試'); +// https://xn--g6w251d/ ``` This feature is only available if the `node` executable was compiled with @@ -132,23 +132,23 @@ and a `base` is provided, it is advised to validate that the `origin` of the `URL` object is what is expected. ```js -let myURL = new URL('http://anotherExample.org/', 'https://example.org/'); -// http://anotherexample.org/ +let myURL = new URL('http://Example.com/', 'https://example.org/'); +// http://example.com/ -myURL = new URL('https://anotherExample.org/', 'https://example.org/'); -// https://anotherexample.org/ +myURL = new URL('https://Example.com/', 'https://example.org/'); +// https://example.com/ -myURL = new URL('foo://anotherExample.org/', 'https://example.org/'); -// foo://anotherExample.org/ +myURL = new URL('foo://Example.com/', 'https://example.org/'); +// foo://Example.com/ -myURL = new URL('http:anotherExample.org/', 'https://example.org/'); -// http://anotherexample.org/ +myURL = new URL('http:Example.com/', 'https://example.org/'); +// http://example.com/ -myURL = new URL('https:anotherExample.org/', 'https://example.org/'); -// https://example.org/anotherExample.org/ +myURL = new URL('https:Example.com/', 'https://example.org/'); +// https://example.org/Example.com/ -myURL = new URL('foo:anotherExample.org/', 'https://example.org/'); -// foo:anotherExample.org/ +myURL = new URL('foo:Example.com/', 'https://example.org/'); +// foo:Example.com/ ``` #### url.hash @@ -249,12 +249,12 @@ console.log(myURL.origin); ``` ```js -const idnURL = new URL('https://你好你好'); +const idnURL = new URL('https://測試'); console.log(idnURL.origin); -// Prints https://xn--6qqa088eba +// Prints https://xn--g6w251d console.log(idnURL.hostname); -// Prints xn--6qqa088eba +// Prints xn--g6w251d ``` #### url.password @@ -929,16 +929,16 @@ any way. The `url.format(URL[, options])` method allows for basic customization of the output. ```js -const myURL = new URL('https://a:b@你好你好?abc#foo'); +const myURL = new URL('https://a:b@測試?abc#foo'); console.log(myURL.href); -// Prints https://a:b@xn--6qqa088eba/?abc#foo +// Prints https://a:b@xn--g6w251d/?abc#foo console.log(myURL.toString()); -// Prints https://a:b@xn--6qqa088eba/?abc#foo +// Prints https://a:b@xn--g6w251d/?abc#foo console.log(url.format(myURL, { fragment: false, unicode: true, auth: false })); -// Prints 'https://你好你好/?abc' +// Prints 'https://測試/?abc' ``` ### url.pathToFileURL(path) @@ -991,21 +991,21 @@ For example: `'#hash'`. The `host` property is the full lower-cased host portion of the URL, including the `port` if specified. -For example: `'sub.host.com:8080'`. +For example: `'sub.example.com:8080'`. #### urlObject.hostname The `hostname` property is the lower-cased host name portion of the `host` component *without* the `port` included. -For example: `'sub.host.com'`. +For example: `'sub.example.com'`. #### urlObject.href The `href` property is the full URL string that was parsed with both the `protocol` and `host` components converted to lower-case. -For example: `'http://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'`. +For example: `'http://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash'`. #### urlObject.path @@ -1265,11 +1265,11 @@ using the [Punycode][] algorithm. Note, however, that a hostname *may* contain *both* Punycode encoded and percent-encoded characters: ```js -const myURL = new URL('https://%CF%80.com/foo'); +const myURL = new URL('https://%CF%80.example.com/foo'); console.log(myURL.href); -// Prints https://xn--1xa.com/foo +// Prints https://xn--1xa.example.com/foo console.log(myURL.origin); -// Prints https://π.com +// Prints https://xn--1xa.example.com ``` [`Error`]: errors.html#errors_class_error diff --git a/doc/api/vm.md b/doc/api/vm.md index 6259b9b2ffd3f5..892f7b97c39a30 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -7,7 +7,7 @@ The `vm` module provides APIs for compiling and running code within V8 Virtual -Machine contexts. **Note that the `vm` module is not a security mechanism. Do +Machine contexts. **The `vm` module is not a security mechanism. Do not use it to run untrusted code**. The term "sandbox" is used throughout these docs simply to refer to a separate context, and does not confer any security guarantees. @@ -237,9 +237,9 @@ in the ECMAScript specification. ### module.evaluate([options]) * `options` {Object} - * `timeout` {number} Specifies the number of milliseconds to evaluate + * `timeout` {integer} Specifies the number of milliseconds to evaluate before terminating execution. If execution is interrupted, an [`Error`][] - will be thrown. + will be thrown. This value must be a strictly positive integer. * `breakOnSigint` {boolean} If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script @@ -489,9 +489,9 @@ changes: * `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * `timeout` {number} Specifies the number of milliseconds to execute `code` + * `timeout` {integer} Specifies the number of milliseconds to execute `code` before terminating execution. If execution is terminated, an [`Error`][] - will be thrown. + will be thrown. This value must be a strictly positive integer. * `breakOnSigint`: if `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled @@ -552,9 +552,9 @@ changes: * `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * `timeout` {number} Specifies the number of milliseconds to execute `code` + * `timeout` {integer} Specifies the number of milliseconds to execute `code` before terminating execution. If execution is terminated, an [`Error`][] - will be thrown. + will be thrown. This value must be a strictly positive integer. * `contextName` {string} Human-readable name of the newly created context. **Default:** `'VM Context i'`, where `i` is an ascending numerical index of the created context. @@ -610,9 +610,9 @@ added: v0.3.1 * `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * `timeout` {number} Specifies the number of milliseconds to execute `code` + * `timeout` {integer} Specifies the number of milliseconds to execute `code` before terminating execution. If execution is terminated, an [`Error`][] - will be thrown. + will be thrown. This value must be a strictly positive integer. Runs the compiled code contained by the `vm.Script` within the context of the current `global` object. Running code does not have access to local scope, but @@ -655,8 +655,8 @@ added: v10.10.0 data for the supplied source. * `produceCachedData` {boolean} Specifies whether to produce new cache data. **Default:** `false`. - * `parsingContext` {Object} The sandbox/context in which the said function - should be compiled in. + * `parsingContext` {Object} The [contextified][] sandbox in which the said + function should be compiled in. * `contextExtensions` {Object[]} An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling. **Default:** `[]`. @@ -757,9 +757,9 @@ Returns `true` if the given `sandbox` object has been [contextified][] using * `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * `timeout` {number} Specifies the number of milliseconds to execute `code` + * `timeout` {integer} Specifies the number of milliseconds to execute `code` before terminating execution. If execution is terminated, an [`Error`][] - will be thrown. + will be thrown. This value must be a strictly positive integer. The `vm.runInContext()` method compiles `code`, runs it within the context of the `contextifiedSandbox`, then returns the result. Running code does not have @@ -804,9 +804,9 @@ added: v0.3.1 * `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * `timeout` {number} Specifies the number of milliseconds to execute `code` + * `timeout` {integer} Specifies the number of milliseconds to execute `code` before terminating execution. If execution is terminated, an [`Error`][] - will be thrown. + will be thrown. This value must be a strictly positive integer. * `contextName` {string} Human-readable name of the newly created context. **Default:** `'VM Context i'`, where `i` is an ascending numerical index of the created context. @@ -858,9 +858,9 @@ added: v0.3.1 * `displayErrors` {boolean} When `true`, if an [`Error`][] error occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * `timeout` {number} Specifies the number of milliseconds to execute `code` + * `timeout` {integer} Specifies the number of milliseconds to execute `code` before terminating execution. If execution is terminated, an [`Error`][] - will be thrown. + will be thrown. This value must be a strictly positive integer. `vm.runInThisContext()` compiles `code`, runs it within the context of the current `global` and returns the result. Running code does not have access to diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 37751c21bbb44d..b73787174cdc96 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -154,8 +154,8 @@ added: v10.5.0 --> Disables further sending of messages on either side of the connection. -This method can be called once you know that no further communication -will happen over this `MessagePort`. +This method can be called when no further communication will happen over this +`MessagePort`. ### port.postMessage(value[, transferList]) ` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3)\n this.skipSpace()\n return this.nextToken()\n }\n return this.finishOp(tt.incDec, 2)\n }\n if (next === 61) return this.finishOp(tt.assign, 2)\n return this.finishOp(tt.plusMin, 1)\n}\n\npp.readToken_lt_gt = function(code) { // '<>'\n let next = this.input.charCodeAt(this.pos + 1)\n let size = 1\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2\n if (this.input.charCodeAt(this.pos + size) === 61) return this.finishOp(tt.assign, size + 1)\n return this.finishOp(tt.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // ` >=1.2.0 <1.3.0 // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes(comp, loose) { +function replaceTildes(comp, options) { return comp.trim().split(/\s+/).map(function(comp) { - return replaceTilde(comp, loose); + return replaceTilde(comp, options); }).join(' '); } -function replaceTilde(comp, loose) { - var r = loose ? re[TILDELOOSE] : re[TILDE]; +function replaceTilde(comp, options) { + if (!options || typeof options !== 'object') + options = { loose: !!options, includePrerelease: false } + var r = options.loose ? re[TILDELOOSE] : re[TILDE]; return comp.replace(r, function(_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr); var ret; @@ -936,15 +957,17 @@ function replaceTilde(comp, loose) { // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 // ^1.2.3 --> >=1.2.3 <2.0.0 // ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets(comp, loose) { +function replaceCarets(comp, options) { return comp.trim().split(/\s+/).map(function(comp) { - return replaceCaret(comp, loose); + return replaceCaret(comp, options); }).join(' '); } -function replaceCaret(comp, loose) { - debug('caret', comp, loose); - var r = loose ? re[CARETLOOSE] : re[CARET]; +function replaceCaret(comp, options) { + debug('caret', comp, options); + if (!options || typeof options !== 'object') + options = { loose: !!options, includePrerelease: false } + var r = options.loose ? re[CARETLOOSE] : re[CARET]; return comp.replace(r, function(_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr); var ret; @@ -991,16 +1014,18 @@ function replaceCaret(comp, loose) { }); } -function replaceXRanges(comp, loose) { - debug('replaceXRanges', comp, loose); +function replaceXRanges(comp, options) { + debug('replaceXRanges', comp, options); return comp.split(/\s+/).map(function(comp) { - return replaceXRange(comp, loose); + return replaceXRange(comp, options); }).join(' '); } -function replaceXRange(comp, loose) { +function replaceXRange(comp, options) { comp = comp.trim(); - var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + if (!options || typeof options !== 'object') + options = { loose: !!options, includePrerelease: false } + var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]; return comp.replace(r, function(ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr); var xM = isX(M); @@ -1064,8 +1089,8 @@ function replaceXRange(comp, loose) { // Because * is AND-ed with everything else in the comparator, // and '' means "any version", just remove the *s entirely. -function replaceStars(comp, loose) { - debug('replaceStars', comp, loose); +function replaceStars(comp, options) { + debug('replaceStars', comp, options); // Looseness is ignored here. star is always as loose as it gets! return comp.trim().replace(re[STAR], ''); } @@ -1109,22 +1134,25 @@ Range.prototype.test = function(version) { return false; if (typeof version === 'string') - version = new SemVer(version, this.loose); + version = new SemVer(version, this.options); for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version)) + if (testSet(this.set[i], version, this.options)) return true; } return false; }; -function testSet(set, version) { +function testSet(set, version, options) { for (var i = 0; i < set.length; i++) { if (!set[i].test(version)) return false; } - if (version.prerelease.length) { + if (!options) + options = {} + + if (version.prerelease.length && !options.includePrerelease) { // Find the set of versions that are allowed to have prereleases // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 // That should allow `1.2.3-pr.2` to pass. @@ -1152,9 +1180,9 @@ function testSet(set, version) { } exports.satisfies = satisfies; -function satisfies(version, range, loose) { +function satisfies(version, range, options) { try { - range = new Range(range, loose); + range = new Range(range, options); } catch (er) { return false; } @@ -1162,19 +1190,19 @@ function satisfies(version, range, loose) { } exports.maxSatisfying = maxSatisfying; -function maxSatisfying(versions, range, loose) { +function maxSatisfying(versions, range, options) { var max = null; var maxSV = null; try { - var rangeObj = new Range(range, loose); + var rangeObj = new Range(range, options); } catch (er) { return null; } versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, loose) + if (rangeObj.test(v)) { // satisfies(v, range, options) if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) max = v; - maxSV = new SemVer(max, loose); + maxSV = new SemVer(max, options); } } }) @@ -1182,19 +1210,19 @@ function maxSatisfying(versions, range, loose) { } exports.minSatisfying = minSatisfying; -function minSatisfying(versions, range, loose) { +function minSatisfying(versions, range, options) { var min = null; var minSV = null; try { - var rangeObj = new Range(range, loose); + var rangeObj = new Range(range, options); } catch (er) { return null; } versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, loose) + if (rangeObj.test(v)) { // satisfies(v, range, options) if (!min || minSV.compare(v) === 1) { // compare(min, v, true) min = v; - minSV = new SemVer(min, loose); + minSV = new SemVer(min, options); } } }) @@ -1202,11 +1230,11 @@ function minSatisfying(versions, range, loose) { } exports.validRange = validRange; -function validRange(range, loose) { +function validRange(range, options) { try { // Return '*' instead of '' so that truthiness works. // This will throw if it's invalid anyway - return new Range(range, loose).range || '*'; + return new Range(range, options).range || '*'; } catch (er) { return null; } @@ -1214,20 +1242,20 @@ function validRange(range, loose) { // Determine if version is less than all the versions possible in the range exports.ltr = ltr; -function ltr(version, range, loose) { - return outside(version, range, '<', loose); +function ltr(version, range, options) { + return outside(version, range, '<', options); } // Determine if version is greater than all the versions possible in the range. exports.gtr = gtr; -function gtr(version, range, loose) { - return outside(version, range, '>', loose); +function gtr(version, range, options) { + return outside(version, range, '>', options); } exports.outside = outside; -function outside(version, range, hilo, loose) { - version = new SemVer(version, loose); - range = new Range(range, loose); +function outside(version, range, hilo, options) { + version = new SemVer(version, options); + range = new Range(range, options); var gtfn, ltefn, ltfn, comp, ecomp; switch (hilo) { @@ -1250,7 +1278,7 @@ function outside(version, range, hilo, loose) { } // If it satisifes the range it is not outside - if (satisfies(version, range, loose)) { + if (satisfies(version, range, options)) { return false; } @@ -1269,9 +1297,9 @@ function outside(version, range, hilo, loose) { } high = high || comparator; low = low || comparator; - if (gtfn(comparator.semver, high.semver, loose)) { + if (gtfn(comparator.semver, high.semver, options)) { high = comparator; - } else if (ltfn(comparator.semver, low.semver, loose)) { + } else if (ltfn(comparator.semver, low.semver, options)) { low = comparator; } }); @@ -1295,15 +1323,15 @@ function outside(version, range, hilo, loose) { } exports.prerelease = prerelease; -function prerelease(version, loose) { - var parsed = parse(version, loose); +function prerelease(version, options) { + var parsed = parse(version, options); return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; } exports.intersects = intersects; -function intersects(r1, r2, loose) { - r1 = new Range(r1, loose) - r2 = new Range(r2, loose) +function intersects(r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) return r1.intersects(r2) } diff --git a/tools/node_modules/eslint/node_modules/table/LICENSE b/tools/node_modules/eslint/node_modules/table/LICENSE index 7e84ea3afc0677..6c41d45cd765c2 100644 --- a/tools/node_modules/eslint/node_modules/table/LICENSE +++ b/tools/node_modules/eslint/node_modules/table/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016, Gajus Kuizinas (http://gajus.com/) +Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/) All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/tools/node_modules/eslint/node_modules/table/README.md b/tools/node_modules/eslint/node_modules/table/README.md index 14e3934ea52efe..1e47185c170563 100644 --- a/tools/node_modules/eslint/node_modules/table/README.md +++ b/tools/node_modules/eslint/node_modules/table/README.md @@ -1,9 +1,11 @@ # Table -[![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat)](https://travis-ci.org/gajus/table) -[![NPM version](http://img.shields.io/npm/v/table.svg?style=flat)](https://www.npmjs.com/package/table) -[![js-canonical-style](https://img.shields.io/badge/code%20style-canonical-brightgreen.svg?style=flat)](https://github.com/gajus/canonical) +[![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat-square)](https://travis-ci.org/gajus/table) +[![Coveralls](https://img.shields.io/coveralls/gajus/table.svg?style=flat-square)](https://coveralls.io/github/gajus/table) +[![NPM version](http://img.shields.io/npm/v/table.svg?style=flat-square)](https://www.npmjs.org/package/table) +[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical) +[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social&label=Follow)](https://twitter.com/kuizinas) * [Table](#table) * [Features](#table-features) @@ -96,7 +98,7 @@ data = [ * Used to dynamically tell table whether to draw a line separating rows or not. * The default behavior is to always return true. * - * @typedef {function} drawJoin + * @typedef {function} drawHorizontalLine * @param {number} index * @param {number} size * @return {boolean} @@ -107,7 +109,7 @@ data = [ * @property {table~border} border * @property {table~columns[]} columns Column specific configuration. * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values. - * @property {table~drawJoin} drawHorizontalLine + * @property {table~drawHorizontalLine} drawHorizontalLine */ /** @@ -296,7 +298,7 @@ data = [ options = { /** - * @typedef {function} drawJoin + * @typedef {function} drawHorizontalLine * @param {number} index * @param {number} size * @return {boolean} @@ -309,6 +311,7 @@ options = { output = table(data, options); console.log(output); + ``` ``` @@ -321,6 +324,7 @@ console.log(output); ╟────┼────┼────╢ ║ 4A │ 4B │ 4C ║ ╚════╧════╧════╝ + ``` diff --git a/tools/node_modules/eslint/node_modules/table/dist/alignString.js b/tools/node_modules/eslint/node_modules/table/dist/alignString.js index 3a948d3afd69c7..a599ce8f9b5e1a 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/alignString.js +++ b/tools/node_modules/eslint/node_modules/table/dist/alignString.js @@ -1,58 +1,54 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); +var _lodash = _interopRequireDefault(require("lodash")); -var _lodash2 = _interopRequireDefault(_lodash); - -var _stringWidth = require('string-width'); - -var _stringWidth2 = _interopRequireDefault(_stringWidth); +var _stringWidth = _interopRequireDefault(require("string-width")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const alignments = ['left', 'right', 'center']; - /** * @param {string} subject * @param {number} width * @returns {string} */ + const alignLeft = (subject, width) => { return subject + ' '.repeat(width); }; - /** * @param {string} subject * @param {number} width * @returns {string} */ + + const alignRight = (subject, width) => { return ' '.repeat(width) + subject; }; - /** * @param {string} subject * @param {number} width * @returns {string} */ + + const alignCenter = (subject, width) => { let halfWidth; - halfWidth = width / 2; if (halfWidth % 2 === 0) { return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth); } else { halfWidth = Math.floor(halfWidth); - return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1); } }; - /** * Pads a string to the left and/or right to position the subject * text in a desired alignment within a container. @@ -63,24 +59,24 @@ const alignCenter = (subject, width) => { * @returns {string} */ -exports.default = (subject, containerWidth, alignment) => { - if (!_lodash2.default.isString(subject)) { + +const alignString = (subject, containerWidth, alignment) => { + if (!_lodash.default.isString(subject)) { throw new TypeError('Subject parameter value must be a string.'); } - if (!_lodash2.default.isNumber(containerWidth)) { + if (!_lodash.default.isNumber(containerWidth)) { throw new TypeError('Container width parameter value must be a number.'); } - const subjectWidth = (0, _stringWidth2.default)(subject); + const subjectWidth = (0, _stringWidth.default)(subject); if (subjectWidth > containerWidth) { // console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject); - throw new Error('Subject parameter value width cannot be greater than the container width.'); } - if (!_lodash2.default.isString(alignment)) { + if (!_lodash.default.isString(alignment)) { throw new TypeError('Alignment parameter value must be a string.'); } @@ -103,4 +99,8 @@ exports.default = (subject, containerWidth, alignment) => { } return alignCenter(subject, availableWidth); -}; \ No newline at end of file +}; + +var _default = alignString; +exports.default = _default; +//# sourceMappingURL=alignString.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/alignString.js.flow b/tools/node_modules/eslint/node_modules/table/dist/alignString.js.flow new file mode 100644 index 00000000000000..16936a44c14dcf --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/alignString.js.flow @@ -0,0 +1,96 @@ +import _ from 'lodash'; +import stringWidth from 'string-width'; + +const alignments = [ + 'left', + 'right', + 'center' +]; + +/** + * @param {string} subject + * @param {number} width + * @returns {string} + */ +const alignLeft = (subject, width) => { + return subject + ' '.repeat(width); +}; + +/** + * @param {string} subject + * @param {number} width + * @returns {string} + */ +const alignRight = (subject, width) => { + return ' '.repeat(width) + subject; +}; + +/** + * @param {string} subject + * @param {number} width + * @returns {string} + */ +const alignCenter = (subject, width) => { + let halfWidth; + + halfWidth = width / 2; + + if (halfWidth % 2 === 0) { + return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth); + } else { + halfWidth = Math.floor(halfWidth); + + return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1); + } +}; + +/** + * Pads a string to the left and/or right to position the subject + * text in a desired alignment within a container. + * + * @param {string} subject + * @param {number} containerWidth + * @param {string} alignment One of the valid options (left, right, center). + * @returns {string} + */ +export default (subject, containerWidth, alignment) => { + if (!_.isString(subject)) { + throw new TypeError('Subject parameter value must be a string.'); + } + + if (!_.isNumber(containerWidth)) { + throw new TypeError('Container width parameter value must be a number.'); + } + + const subjectWidth = stringWidth(subject); + + if (subjectWidth > containerWidth) { + // console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject); + + throw new Error('Subject parameter value width cannot be greater than the container width.'); + } + + if (!_.isString(alignment)) { + throw new TypeError('Alignment parameter value must be a string.'); + } + + if (alignments.indexOf(alignment) === -1) { + throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).'); + } + + if (subjectWidth === 0) { + return ' '.repeat(containerWidth); + } + + const availableWidth = containerWidth - subjectWidth; + + if (alignment === 'left') { + return alignLeft(subject, availableWidth); + } + + if (alignment === 'right') { + return alignRight(subject, availableWidth); + } + + return alignCenter(subject, availableWidth); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/alignString.js.map b/tools/node_modules/eslint/node_modules/table/dist/alignString.js.map new file mode 100644 index 00000000000000..8420a3b3f31543 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/alignString.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/alignString.js"],"names":["alignments","alignLeft","subject","width","repeat","alignRight","alignCenter","halfWidth","Math","floor","containerWidth","alignment","_","isString","TypeError","isNumber","subjectWidth","Error","indexOf","availableWidth"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,MADiB,EAEjB,OAFiB,EAGjB,QAHiB,CAAnB;AAMA;;;;;;AAKA,MAAMC,SAAS,GAAG,CAACC,OAAD,EAAUC,KAAV,KAAoB;AACpC,SAAOD,OAAO,GAAG,IAAIE,MAAJ,CAAWD,KAAX,CAAjB;AACD,CAFD;AAIA;;;;;;;AAKA,MAAME,UAAU,GAAG,CAACH,OAAD,EAAUC,KAAV,KAAoB;AACrC,SAAO,IAAIC,MAAJ,CAAWD,KAAX,IAAoBD,OAA3B;AACD,CAFD;AAIA;;;;;;;AAKA,MAAMI,WAAW,GAAG,CAACJ,OAAD,EAAUC,KAAV,KAAoB;AACtC,MAAII,SAAJ;AAEAA,EAAAA,SAAS,GAAGJ,KAAK,GAAG,CAApB;;AAEA,MAAII,SAAS,GAAG,CAAZ,KAAkB,CAAtB,EAAyB;AACvB,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAX,CAAzC;AACD,GAFD,MAEO;AACLA,IAAAA,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWF,SAAX,CAAZ;AAEA,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAS,GAAG,CAAvB,CAAzC;AACD;AACF,CAZD;AAcA;;;;;;;;;;;qBASgBL,O,EAASQ,c,EAAgBC,S,KAAc;AACrD,MAAI,CAACC,gBAAEC,QAAF,CAAWX,OAAX,CAAL,EAA0B;AACxB,UAAM,IAAIY,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAED,MAAI,CAACF,gBAAEG,QAAF,CAAWL,cAAX,CAAL,EAAiC;AAC/B,UAAM,IAAII,SAAJ,CAAc,mDAAd,CAAN;AACD;;AAED,QAAME,YAAY,GAAG,0BAAYd,OAAZ,CAArB;;AAEA,MAAIc,YAAY,GAAGN,cAAnB,EAAmC;AACjC;AAEA,UAAM,IAAIO,KAAJ,CAAU,2EAAV,CAAN;AACD;;AAED,MAAI,CAACL,gBAAEC,QAAF,CAAWF,SAAX,CAAL,EAA4B;AAC1B,UAAM,IAAIG,SAAJ,CAAc,6CAAd,CAAN;AACD;;AAED,MAAId,UAAU,CAACkB,OAAX,CAAmBP,SAAnB,MAAkC,CAAC,CAAvC,EAA0C;AACxC,UAAM,IAAIM,KAAJ,CAAU,4FAAV,CAAN;AACD;;AAED,MAAID,YAAY,KAAK,CAArB,EAAwB;AACtB,WAAO,IAAIZ,MAAJ,CAAWM,cAAX,CAAP;AACD;;AAED,QAAMS,cAAc,GAAGT,cAAc,GAAGM,YAAxC;;AAEA,MAAIL,SAAS,KAAK,MAAlB,EAA0B;AACxB,WAAOV,SAAS,CAACC,OAAD,EAAUiB,cAAV,CAAhB;AACD;;AAED,MAAIR,SAAS,KAAK,OAAlB,EAA2B;AACzB,WAAON,UAAU,CAACH,OAAD,EAAUiB,cAAV,CAAjB;AACD;;AAED,SAAOb,WAAW,CAACJ,OAAD,EAAUiB,cAAV,CAAlB;AACD,C","sourcesContent":["import _ from 'lodash';\nimport stringWidth from 'string-width';\n\nconst alignments = [\n 'left',\n 'right',\n 'center'\n];\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignLeft = (subject, width) => {\n return subject + ' '.repeat(width);\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignRight = (subject, width) => {\n return ' '.repeat(width) + subject;\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignCenter = (subject, width) => {\n let halfWidth;\n\n halfWidth = width / 2;\n\n if (halfWidth % 2 === 0) {\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);\n } else {\n halfWidth = Math.floor(halfWidth);\n\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);\n }\n};\n\n/**\n * Pads a string to the left and/or right to position the subject\n * text in a desired alignment within a container.\n *\n * @param {string} subject\n * @param {number} containerWidth\n * @param {string} alignment One of the valid options (left, right, center).\n * @returns {string}\n */\nexport default (subject, containerWidth, alignment) => {\n if (!_.isString(subject)) {\n throw new TypeError('Subject parameter value must be a string.');\n }\n\n if (!_.isNumber(containerWidth)) {\n throw new TypeError('Container width parameter value must be a number.');\n }\n\n const subjectWidth = stringWidth(subject);\n\n if (subjectWidth > containerWidth) {\n // console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);\n\n throw new Error('Subject parameter value width cannot be greater than the container width.');\n }\n\n if (!_.isString(alignment)) {\n throw new TypeError('Alignment parameter value must be a string.');\n }\n\n if (alignments.indexOf(alignment) === -1) {\n throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');\n }\n\n if (subjectWidth === 0) {\n return ' '.repeat(containerWidth);\n }\n\n const availableWidth = containerWidth - subjectWidth;\n\n if (alignment === 'left') {\n return alignLeft(subject, availableWidth);\n }\n\n if (alignment === 'right') {\n return alignRight(subject, availableWidth);\n }\n\n return alignCenter(subject, availableWidth);\n};\n"],"file":"alignString.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js index eb4078455355d6..e01bd552610836 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js @@ -1,16 +1,13 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _stringWidth = require('string-width'); +var _stringWidth = _interopRequireDefault(require("string-width")); -var _stringWidth2 = _interopRequireDefault(_stringWidth); - -var _alignString = require('./alignString'); - -var _alignString2 = _interopRequireDefault(_alignString); +var _alignString = _interopRequireDefault(require("./alignString")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -19,16 +16,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Object} config * @returns {table~row[]} */ -exports.default = (rows, config) => { +const alignTableData = (rows, config) => { return rows.map(cells => { return cells.map((value, index1) => { const column = config.columns[index1]; - if ((0, _stringWidth2.default)(value) === column.width) { + if ((0, _stringWidth.default)(value) === column.width) { return value; } else { - return (0, _alignString2.default)(value, column.width, column.alignment); + return (0, _alignString.default)(value, column.width, column.alignment); } }); }); -}; \ No newline at end of file +}; + +var _default = alignTableData; +exports.default = _default; +//# sourceMappingURL=alignTableData.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.flow b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.flow new file mode 100644 index 00000000000000..8a7be7a7e7cf5c --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.flow @@ -0,0 +1,21 @@ +import stringWidth from 'string-width'; +import alignString from './alignString'; + +/** + * @param {table~row[]} rows + * @param {Object} config + * @returns {table~row[]} + */ +export default (rows, config) => { + return rows.map((cells) => { + return cells.map((value, index1) => { + const column = config.columns[index1]; + + if (stringWidth(value) === column.width) { + return value; + } else { + return alignString(value, column.width, column.alignment); + } + }); + }); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.map b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.map new file mode 100644 index 00000000000000..183240f8a43d24 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/alignTableData.js"],"names":["rows","config","map","cells","value","index1","column","columns","width","alignment"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;wBAKgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,KAAD,EAAQC,MAAR,KAAmB;AAClC,YAAMC,MAAM,GAAGL,MAAM,CAACM,OAAP,CAAeF,MAAf,CAAf;;AAEA,UAAI,0BAAYD,KAAZ,MAAuBE,MAAM,CAACE,KAAlC,EAAyC;AACvC,eAAOJ,KAAP;AACD,OAFD,MAEO;AACL,eAAO,0BAAYA,KAAZ,EAAmBE,MAAM,CAACE,KAA1B,EAAiCF,MAAM,CAACG,SAAxC,CAAP;AACD;AACF,KARM,CAAP;AASD,GAVM,CAAP;AAWD,C","sourcesContent":["import stringWidth from 'string-width';\nimport alignString from './alignString';\n\n/**\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((value, index1) => {\n const column = config.columns[index1];\n\n if (stringWidth(value) === column.width) {\n return value;\n } else {\n return alignString(value, column.width, column.alignment);\n }\n });\n });\n};\n"],"file":"alignTableData.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js index 7a8973808149b1..2725ee009ea43d 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js @@ -1,20 +1,15 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); +var _lodash = _interopRequireDefault(require("lodash")); -var _lodash2 = _interopRequireDefault(_lodash); +var _stringWidth = _interopRequireDefault(require("string-width")); -var _stringWidth = require('string-width'); - -var _stringWidth2 = _interopRequireDefault(_stringWidth); - -var _wrapWord = require('./wrapWord'); - -var _wrapWord2 = _interopRequireDefault(_wrapWord); +var _wrapWord = _interopRequireDefault(require("./wrapWord")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -24,10 +19,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {boolean} useWrapWord * @returns {number} */ -exports.default = function (value, columnWidth) { - let useWrapWord = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - if (!_lodash2.default.isString(value)) { +const calculateCellHeight = (value, columnWidth, useWrapWord = false) => { + if (!_lodash.default.isString(value)) { throw new TypeError('Value must be a string.'); } @@ -40,8 +33,12 @@ exports.default = function (value, columnWidth) { } if (useWrapWord) { - return (0, _wrapWord2.default)(value, columnWidth).length; + return (0, _wrapWord.default)(value, columnWidth).length; } - return Math.ceil((0, _stringWidth2.default)(value) / columnWidth); -}; \ No newline at end of file + return Math.ceil((0, _stringWidth.default)(value) / columnWidth); +}; + +var _default = calculateCellHeight; +exports.default = _default; +//# sourceMappingURL=calculateCellHeight.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.flow b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.flow new file mode 100644 index 00000000000000..94afd3742140e1 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.flow @@ -0,0 +1,29 @@ +import _ from 'lodash'; +import stringWidth from 'string-width'; +import wrapWord from './wrapWord'; + +/** + * @param {string} value + * @param {number} columnWidth + * @param {boolean} useWrapWord + * @returns {number} + */ +export default (value, columnWidth, useWrapWord = false) => { + if (!_.isString(value)) { + throw new TypeError('Value must be a string.'); + } + + if (!Number.isInteger(columnWidth)) { + throw new TypeError('Column width must be an integer.'); + } + + if (columnWidth < 1) { + throw new Error('Column width must be greater than 0.'); + } + + if (useWrapWord) { + return wrapWord(value, columnWidth).length; + } + + return Math.ceil(stringWidth(value) / columnWidth); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.map b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.map new file mode 100644 index 00000000000000..43ec44038f1408 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/calculateCellHeight.js"],"names":["value","columnWidth","useWrapWord","_","isString","TypeError","Number","isInteger","Error","length","Math","ceil"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA;;;;;;6BAMgBA,K,EAAOC,W,EAAaC,WAAW,GAAG,K,KAAU;AAC1D,MAAI,CAACC,gBAAEC,QAAF,CAAWJ,KAAX,CAAL,EAAwB;AACtB,UAAM,IAAIK,SAAJ,CAAc,yBAAd,CAAN;AACD;;AAED,MAAI,CAACC,MAAM,CAACC,SAAP,CAAiBN,WAAjB,CAAL,EAAoC;AAClC,UAAM,IAAII,SAAJ,CAAc,kCAAd,CAAN;AACD;;AAED,MAAIJ,WAAW,GAAG,CAAlB,EAAqB;AACnB,UAAM,IAAIO,KAAJ,CAAU,sCAAV,CAAN;AACD;;AAED,MAAIN,WAAJ,EAAiB;AACf,WAAO,uBAASF,KAAT,EAAgBC,WAAhB,EAA6BQ,MAApC;AACD;;AAED,SAAOC,IAAI,CAACC,IAAL,CAAU,0BAAYX,KAAZ,IAAqBC,WAA/B,CAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport stringWidth from 'string-width';\nimport wrapWord from './wrapWord';\n\n/**\n * @param {string} value\n * @param {number} columnWidth\n * @param {boolean} useWrapWord\n * @returns {number}\n */\nexport default (value, columnWidth, useWrapWord = false) => {\n if (!_.isString(value)) {\n throw new TypeError('Value must be a string.');\n }\n\n if (!Number.isInteger(columnWidth)) {\n throw new TypeError('Column width must be an integer.');\n }\n\n if (columnWidth < 1) {\n throw new Error('Column width must be greater than 0.');\n }\n\n if (useWrapWord) {\n return wrapWord(value, columnWidth).length;\n }\n\n return Math.ceil(stringWidth(value) / columnWidth);\n};\n"],"file":"calculateCellHeight.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js b/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js index e6bf927edb7975..82b406015b8288 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js @@ -1,12 +1,11 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _stringWidth = require('string-width'); - -var _stringWidth2 = _interopRequireDefault(_stringWidth); +var _stringWidth = _interopRequireDefault(require("string-width")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -16,8 +15,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {string[]} cells * @returns {number[]} */ -exports.default = cells => { +const calculateCellWidthIndex = cells => { return cells.map(value => { - return (0, _stringWidth2.default)(value); + return (0, _stringWidth.default)(value); }); -}; \ No newline at end of file +}; + +var _default = calculateCellWidthIndex; +exports.default = _default; +//# sourceMappingURL=calculateCellWidthIndex.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.flow b/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.flow new file mode 100644 index 00000000000000..f6b90dd8c09b89 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.flow @@ -0,0 +1,13 @@ +import stringWidth from 'string-width'; + +/** + * Calculates width of each cell contents. + * + * @param {string[]} cells + * @returns {number[]} + */ +export default (cells) => { + return cells.map((value) => { + return stringWidth(value); + }); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.map b/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.map new file mode 100644 index 00000000000000..99d1f7798da891 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/calculateCellWidthIndex.js"],"names":["cells","map","value"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;gCAMgBA,K,IAAU;AACxB,SAAOA,KAAK,CAACC,GAAN,CAAWC,KAAD,IAAW;AAC1B,WAAO,0BAAYA,KAAZ,CAAP;AACD,GAFM,CAAP;AAGD,C","sourcesContent":["import stringWidth from 'string-width';\n\n/**\n * Calculates width of each cell contents.\n *\n * @param {string[]} cells\n * @returns {number[]}\n */\nexport default (cells) => {\n return cells.map((value) => {\n return stringWidth(value);\n });\n};\n"],"file":"calculateCellWidthIndex.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js b/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js index da366c1423c79a..ea5d4b9a4bab4d 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js @@ -1,12 +1,11 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _calculateCellWidthIndex = require('./calculateCellWidthIndex'); - -var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex); +var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -16,22 +15,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Array[]} rows * @returns {number[]} */ -exports.default = rows => { +const calculateMaximumColumnWidthIndex = rows => { if (!rows[0]) { throw new Error('Dataset must have at least one row.'); } - const columns = Array(rows[0].length).fill(0); - + const columns = new Array(rows[0].length).fill(0); rows.forEach(row => { - const columnWidthIndex = (0, _calculateCellWidthIndex2.default)(row); - + const columnWidthIndex = (0, _calculateCellWidthIndex.default)(row); columnWidthIndex.forEach((valueWidth, index0) => { if (columns[index0] < valueWidth) { columns[index0] = valueWidth; } }); }); - return columns; -}; \ No newline at end of file +}; + +var _default = calculateMaximumColumnWidthIndex; +exports.default = _default; +//# sourceMappingURL=calculateMaximumColumnWidthIndex.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow b/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow new file mode 100644 index 00000000000000..5c8c10981cc63b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow @@ -0,0 +1,27 @@ +import calculateCellWidthIndex from './calculateCellWidthIndex'; + +/** + * Produces an array of values that describe the largest value length (width) in every column. + * + * @param {Array[]} rows + * @returns {number[]} + */ +export default (rows) => { + if (!rows[0]) { + throw new Error('Dataset must have at least one row.'); + } + + const columns = new Array(rows[0].length).fill(0); + + rows.forEach((row) => { + const columnWidthIndex = calculateCellWidthIndex(row); + + columnWidthIndex.forEach((valueWidth, index0) => { + if (columns[index0] < valueWidth) { + columns[index0] = valueWidth; + } + }); + }); + + return columns; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.map b/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.map new file mode 100644 index 00000000000000..c30f4ceecd2782 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/calculateMaximumColumnWidthIndex.js"],"names":["rows","Error","columns","Array","length","fill","forEach","row","columnWidthIndex","valueWidth","index0"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;yCAMgBA,I,IAAS;AACvB,MAAI,CAACA,IAAI,CAAC,CAAD,CAAT,EAAc;AACZ,UAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;AACD;;AAED,QAAMC,OAAO,GAAG,IAAIC,KAAJ,CAAUH,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAlB,EAA0BC,IAA1B,CAA+B,CAA/B,CAAhB;AAEAL,EAAAA,IAAI,CAACM,OAAL,CAAcC,GAAD,IAAS;AACpB,UAAMC,gBAAgB,GAAG,sCAAwBD,GAAxB,CAAzB;AAEAC,IAAAA,gBAAgB,CAACF,OAAjB,CAAyB,CAACG,UAAD,EAAaC,MAAb,KAAwB;AAC/C,UAAIR,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAtB,EAAkC;AAChCP,QAAAA,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAlB;AACD;AACF,KAJD;AAKD,GARD;AAUA,SAAOP,OAAP;AACD,C","sourcesContent":["import calculateCellWidthIndex from './calculateCellWidthIndex';\n\n/**\n * Produces an array of values that describe the largest value length (width) in every column.\n *\n * @param {Array[]} rows\n * @returns {number[]}\n */\nexport default (rows) => {\n if (!rows[0]) {\n throw new Error('Dataset must have at least one row.');\n }\n\n const columns = new Array(rows[0].length).fill(0);\n\n rows.forEach((row) => {\n const columnWidthIndex = calculateCellWidthIndex(row);\n\n columnWidthIndex.forEach((valueWidth, index0) => {\n if (columns[index0] < valueWidth) {\n columns[index0] = valueWidth;\n }\n });\n });\n\n return columns;\n};\n"],"file":"calculateMaximumColumnWidthIndex.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js index 2976ec43344c67..ad98db4040048c 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js @@ -1,16 +1,13 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); +var _lodash = _interopRequireDefault(require("lodash")); -var _lodash2 = _interopRequireDefault(_lodash); - -var _calculateCellHeight = require('./calculateCellHeight'); - -var _calculateCellHeight2 = _interopRequireDefault(_calculateCellHeight); +var _calculateCellHeight = _interopRequireDefault(require("./calculateCellHeight")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -21,28 +18,27 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Object} config * @returns {number[]} */ -exports.default = (rows, config) => { +const calculateRowHeightIndex = (rows, config) => { const tableWidth = rows[0].length; - const rowSpanIndex = []; - rows.forEach(cells => { - const cellHeightIndex = Array(tableWidth).fill(1); - + const cellHeightIndex = new Array(tableWidth).fill(1); cells.forEach((value, index1) => { - if (!_lodash2.default.isNumber(config.columns[index1].width)) { + if (!_lodash.default.isNumber(config.columns[index1].width)) { throw new TypeError('column[index].width must be a number.'); } - if (!_lodash2.default.isBoolean(config.columns[index1].wrapWord)) { + if (!_lodash.default.isBoolean(config.columns[index1].wrapWord)) { throw new TypeError('column[index].wrapWord must be a boolean.'); } - cellHeightIndex[index1] = (0, _calculateCellHeight2.default)(value, config.columns[index1].width, config.columns[index1].wrapWord); + cellHeightIndex[index1] = (0, _calculateCellHeight.default)(value, config.columns[index1].width, config.columns[index1].wrapWord); }); - - rowSpanIndex.push(_lodash2.default.max(cellHeightIndex)); + rowSpanIndex.push(_lodash.default.max(cellHeightIndex)); }); - return rowSpanIndex; -}; \ No newline at end of file +}; + +var _default = calculateRowHeightIndex; +exports.default = _default; +//# sourceMappingURL=calculateRowHeightIndex.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.flow b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.flow new file mode 100644 index 00000000000000..268790264860e6 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.flow @@ -0,0 +1,35 @@ +import _ from 'lodash'; +import calculateCellHeight from './calculateCellHeight'; + +/** + * Calculates the vertical row span index. + * + * @param {Array[]} rows + * @param {Object} config + * @returns {number[]} + */ +export default (rows, config) => { + const tableWidth = rows[0].length; + + const rowSpanIndex = []; + + rows.forEach((cells) => { + const cellHeightIndex = new Array(tableWidth).fill(1); + + cells.forEach((value, index1) => { + if (!_.isNumber(config.columns[index1].width)) { + throw new TypeError('column[index].width must be a number.'); + } + + if (!_.isBoolean(config.columns[index1].wrapWord)) { + throw new TypeError('column[index].wrapWord must be a boolean.'); + } + + cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord); + }); + + rowSpanIndex.push(_.max(cellHeightIndex)); + }); + + return rowSpanIndex; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.map b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.map new file mode 100644 index 00000000000000..bcd21c8e5e4354 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/calculateRowHeightIndex.js"],"names":["rows","config","tableWidth","length","rowSpanIndex","forEach","cells","cellHeightIndex","Array","fill","value","index1","_","isNumber","columns","width","TypeError","isBoolean","wrapWord","push","max"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;;;iCAOgBA,I,EAAMC,M,KAAW;AAC/B,QAAMC,UAAU,GAAGF,IAAI,CAAC,CAAD,CAAJ,CAAQG,MAA3B;AAEA,QAAMC,YAAY,GAAG,EAArB;AAEAJ,EAAAA,IAAI,CAACK,OAAL,CAAcC,KAAD,IAAW;AACtB,UAAMC,eAAe,GAAG,IAAIC,KAAJ,CAAUN,UAAV,EAAsBO,IAAtB,CAA2B,CAA3B,CAAxB;AAEAH,IAAAA,KAAK,CAACD,OAAN,CAAc,CAACK,KAAD,EAAQC,MAAR,KAAmB;AAC/B,UAAI,CAACC,gBAAEC,QAAF,CAAWZ,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBI,KAAlC,CAAL,EAA+C;AAC7C,cAAM,IAAIC,SAAJ,CAAc,uCAAd,CAAN;AACD;;AAED,UAAI,CAACJ,gBAAEK,SAAF,CAAYhB,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBO,QAAnC,CAAL,EAAmD;AACjD,cAAM,IAAIF,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAEDT,MAAAA,eAAe,CAACI,MAAD,CAAf,GAA0B,kCAAoBD,KAApB,EAA2BT,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBI,KAAlD,EAAyDd,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBO,QAAhF,CAA1B;AACD,KAVD;AAYAd,IAAAA,YAAY,CAACe,IAAb,CAAkBP,gBAAEQ,GAAF,CAAMb,eAAN,CAAlB;AACD,GAhBD;AAkBA,SAAOH,YAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport calculateCellHeight from './calculateCellHeight';\n\n/**\n * Calculates the vertical row span index.\n *\n * @param {Array[]} rows\n * @param {Object} config\n * @returns {number[]}\n */\nexport default (rows, config) => {\n const tableWidth = rows[0].length;\n\n const rowSpanIndex = [];\n\n rows.forEach((cells) => {\n const cellHeightIndex = new Array(tableWidth).fill(1);\n\n cells.forEach((value, index1) => {\n if (!_.isNumber(config.columns[index1].width)) {\n throw new TypeError('column[index].width must be a number.');\n }\n\n if (!_.isBoolean(config.columns[index1].wrapWord)) {\n throw new TypeError('column[index].wrapWord must be a boolean.');\n }\n\n cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord);\n });\n\n rowSpanIndex.push(_.max(cellHeightIndex));\n });\n\n return rowSpanIndex;\n};\n"],"file":"calculateRowHeightIndex.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/createStream.js b/tools/node_modules/eslint/node_modules/table/dist/createStream.js index 83698f0e036e27..f1eb06106e4ca1 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/createStream.js +++ b/tools/node_modules/eslint/node_modules/table/dist/createStream.js @@ -1,46 +1,29 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); +var _lodash = _interopRequireDefault(require("lodash")); -var _lodash2 = _interopRequireDefault(_lodash); +var _makeStreamConfig = _interopRequireDefault(require("./makeStreamConfig")); -var _makeStreamConfig = require('./makeStreamConfig'); +var _drawRow = _interopRequireDefault(require("./drawRow")); -var _makeStreamConfig2 = _interopRequireDefault(_makeStreamConfig); +var _drawBorder = require("./drawBorder"); -var _drawRow = require('./drawRow'); +var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData")); -var _drawRow2 = _interopRequireDefault(_drawRow); +var _truncateTableData = _interopRequireDefault(require("./truncateTableData")); -var _drawBorder = require('./drawBorder'); +var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex")); -var _stringifyTableData = require('./stringifyTableData'); +var _alignTableData = _interopRequireDefault(require("./alignTableData")); -var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData); +var _padTableData = _interopRequireDefault(require("./padTableData")); -var _truncateTableData = require('./truncateTableData'); - -var _truncateTableData2 = _interopRequireDefault(_truncateTableData); - -var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex'); - -var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex); - -var _alignTableData = require('./alignTableData'); - -var _alignTableData2 = _interopRequireDefault(_alignTableData); - -var _padTableData = require('./padTableData'); - -var _padTableData2 = _interopRequireDefault(_padTableData); - -var _calculateRowHeightIndex = require('./calculateRowHeightIndex'); - -var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex); +var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -51,90 +34,71 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de */ const prepareData = (data, config) => { let rows; - - rows = (0, _stringifyTableData2.default)(data); - - rows = (0, _truncateTableData2.default)(data, config); - - const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config); - - rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config); - rows = (0, _alignTableData2.default)(rows, config); - rows = (0, _padTableData2.default)(rows, config); - + rows = (0, _stringifyTableData.default)(data); + rows = (0, _truncateTableData.default)(data, config); + const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config); + rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config); + rows = (0, _alignTableData.default)(rows, config); + rows = (0, _padTableData.default)(rows, config); return rows; }; - /** * @param {string[]} row * @param {number[]} columnWidthIndex * @param {Object} config * @returns {undefined} */ + + const create = (row, columnWidthIndex, config) => { const rows = prepareData([row], config); - const body = rows.map(literalRow => { - return (0, _drawRow2.default)(literalRow, config.border); + return (0, _drawRow.default)(literalRow, config.border); }).join(''); - let output; - output = ''; - output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config.border); output += body; output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border); - - output = _lodash2.default.trimEnd(output); - + output = _lodash.default.trimEnd(output); process.stdout.write(output); }; - /** * @param {string[]} row * @param {number[]} columnWidthIndex * @param {Object} config * @returns {undefined} */ + + const append = (row, columnWidthIndex, config) => { const rows = prepareData([row], config); - const body = rows.map(literalRow => { - return (0, _drawRow2.default)(literalRow, config.border); + return (0, _drawRow.default)(literalRow, config.border); }).join(''); - let output; - output = '\r\u001B[K'; - output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border); output += body; output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border); - - output = _lodash2.default.trimEnd(output); - + output = _lodash.default.trimEnd(output); process.stdout.write(output); }; - /** * @param {Object} userConfig * @returns {Object} */ -exports.default = function () { - let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - const config = (0, _makeStreamConfig2.default)(userConfig); +const createStream = (userConfig = {}) => { + const config = (0, _makeStreamConfig.default)(userConfig); // @todo Use 'Object.values' when Node.js v6 support is dropped. - const columnWidthIndex = _lodash2.default.mapValues(config.columns, column => { + const columnWidthIndex = _lodash.default.values(_lodash.default.mapValues(config.columns, column => { return column.width + column.paddingLeft + column.paddingRight; - }); + })); let empty; - empty = true; - return { /** * @param {string[]} row @@ -147,11 +111,14 @@ exports.default = function () { if (empty) { empty = false; - return create(row, columnWidthIndex, config); } else { return append(row, columnWidthIndex, config); } } }; -}; \ No newline at end of file +}; + +var _default = createStream; +exports.default = _default; +//# sourceMappingURL=createStream.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/createStream.js.flow b/tools/node_modules/eslint/node_modules/table/dist/createStream.js.flow new file mode 100644 index 00000000000000..1d7d00e399c4a3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/createStream.js.flow @@ -0,0 +1,124 @@ +import _ from 'lodash'; +import makeStreamConfig from './makeStreamConfig'; +import drawRow from './drawRow'; +import { + drawBorderBottom, + drawBorderJoin, + drawBorderTop +} from './drawBorder'; +import stringifyTableData from './stringifyTableData'; +import truncateTableData from './truncateTableData'; +import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex'; +import alignTableData from './alignTableData'; +import padTableData from './padTableData'; +import calculateRowHeightIndex from './calculateRowHeightIndex'; + +/** + * @param {Array} data + * @param {Object} config + * @returns {Array} + */ +const prepareData = (data, config) => { + let rows; + + rows = stringifyTableData(data); + + rows = truncateTableData(data, config); + + const rowHeightIndex = calculateRowHeightIndex(rows, config); + + rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config); + rows = alignTableData(rows, config); + rows = padTableData(rows, config); + + return rows; +}; + +/** + * @param {string[]} row + * @param {number[]} columnWidthIndex + * @param {Object} config + * @returns {undefined} + */ +const create = (row, columnWidthIndex, config) => { + const rows = prepareData([row], config); + + const body = rows.map((literalRow) => { + return drawRow(literalRow, config.border); + }).join(''); + + let output; + + output = ''; + + output += drawBorderTop(columnWidthIndex, config.border); + output += body; + output += drawBorderBottom(columnWidthIndex, config.border); + + output = _.trimEnd(output); + + process.stdout.write(output); +}; + +/** + * @param {string[]} row + * @param {number[]} columnWidthIndex + * @param {Object} config + * @returns {undefined} + */ +const append = (row, columnWidthIndex, config) => { + const rows = prepareData([row], config); + + const body = rows.map((literalRow) => { + return drawRow(literalRow, config.border); + }).join(''); + + let output; + + output = '\r\u001B[K'; + + output += drawBorderJoin(columnWidthIndex, config.border); + output += body; + output += drawBorderBottom(columnWidthIndex, config.border); + + output = _.trimEnd(output); + + process.stdout.write(output); +}; + +/** + * @param {Object} userConfig + * @returns {Object} + */ +export default (userConfig = {}) => { + const config = makeStreamConfig(userConfig); + + // @todo Use 'Object.values' when Node.js v6 support is dropped. + const columnWidthIndex = _.values(_.mapValues(config.columns, (column) => { + return column.width + column.paddingLeft + column.paddingRight; + })); + + let empty; + + empty = true; + + return { + /** + * @param {string[]} row + * @returns {undefined} + */ + write: (row) => { + if (row.length !== config.columnCount) { + throw new Error('Row cell count does not match the config.columnCount.'); + } + + if (empty) { + empty = false; + + return create(row, columnWidthIndex, config); + } else { + return append(row, columnWidthIndex, config); + } + } + }; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/createStream.js.map b/tools/node_modules/eslint/node_modules/table/dist/createStream.js.map new file mode 100644 index 00000000000000..92cf88794cefc2 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/createStream.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/createStream.js"],"names":["prepareData","data","config","rows","rowHeightIndex","create","row","columnWidthIndex","body","map","literalRow","border","join","output","_","trimEnd","process","stdout","write","append","userConfig","values","mapValues","columns","column","width","paddingLeft","paddingRight","empty","length","columnCount","Error"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;;;;;AAKA,MAAMA,WAAW,GAAG,CAACC,IAAD,EAAOC,MAAP,KAAkB;AACpC,MAAIC,IAAJ;AAEAA,EAAAA,IAAI,GAAG,iCAAmBF,IAAnB,CAAP;AAEAE,EAAAA,IAAI,GAAG,gCAAkBF,IAAlB,EAAwBC,MAAxB,CAAP;AAEA,QAAME,cAAc,GAAG,sCAAwBD,IAAxB,EAA8BD,MAA9B,CAAvB;AAEAC,EAAAA,IAAI,GAAG,yCAA2BA,IAA3B,EAAiCC,cAAjC,EAAiDF,MAAjD,CAAP;AACAC,EAAAA,IAAI,GAAG,6BAAeA,IAAf,EAAqBD,MAArB,CAAP;AACAC,EAAAA,IAAI,GAAG,2BAAaA,IAAb,EAAmBD,MAAnB,CAAP;AAEA,SAAOC,IAAP;AACD,CAdD;AAgBA;;;;;;;;AAMA,MAAME,MAAM,GAAG,CAACC,GAAD,EAAMC,gBAAN,EAAwBL,MAAxB,KAAmC;AAChD,QAAMC,IAAI,GAAGH,WAAW,CAAC,CAACM,GAAD,CAAD,EAAQJ,MAAR,CAAxB;AAEA,QAAMM,IAAI,GAAGL,IAAI,CAACM,GAAL,CAAUC,UAAD,IAAgB;AACpC,WAAO,sBAAQA,UAAR,EAAoBR,MAAM,CAACS,MAA3B,CAAP;AACD,GAFY,EAEVC,IAFU,CAEL,EAFK,CAAb;AAIA,MAAIC,MAAJ;AAEAA,EAAAA,MAAM,GAAG,EAAT;AAEAA,EAAAA,MAAM,IAAI,+BAAcN,gBAAd,EAAgCL,MAAM,CAACS,MAAvC,CAAV;AACAE,EAAAA,MAAM,IAAIL,IAAV;AACAK,EAAAA,MAAM,IAAI,kCAAiBN,gBAAjB,EAAmCL,MAAM,CAACS,MAA1C,CAAV;AAEAE,EAAAA,MAAM,GAAGC,gBAAEC,OAAF,CAAUF,MAAV,CAAT;AAEAG,EAAAA,OAAO,CAACC,MAAR,CAAeC,KAAf,CAAqBL,MAArB;AACD,CAlBD;AAoBA;;;;;;;;AAMA,MAAMM,MAAM,GAAG,CAACb,GAAD,EAAMC,gBAAN,EAAwBL,MAAxB,KAAmC;AAChD,QAAMC,IAAI,GAAGH,WAAW,CAAC,CAACM,GAAD,CAAD,EAAQJ,MAAR,CAAxB;AAEA,QAAMM,IAAI,GAAGL,IAAI,CAACM,GAAL,CAAUC,UAAD,IAAgB;AACpC,WAAO,sBAAQA,UAAR,EAAoBR,MAAM,CAACS,MAA3B,CAAP;AACD,GAFY,EAEVC,IAFU,CAEL,EAFK,CAAb;AAIA,MAAIC,MAAJ;AAEAA,EAAAA,MAAM,GAAG,YAAT;AAEAA,EAAAA,MAAM,IAAI,gCAAeN,gBAAf,EAAiCL,MAAM,CAACS,MAAxC,CAAV;AACAE,EAAAA,MAAM,IAAIL,IAAV;AACAK,EAAAA,MAAM,IAAI,kCAAiBN,gBAAjB,EAAmCL,MAAM,CAACS,MAA1C,CAAV;AAEAE,EAAAA,MAAM,GAAGC,gBAAEC,OAAF,CAAUF,MAAV,CAAT;AAEAG,EAAAA,OAAO,CAACC,MAAR,CAAeC,KAAf,CAAqBL,MAArB;AACD,CAlBD;AAoBA;;;;;;sBAIgBO,UAAU,GAAG,E,KAAO;AAClC,QAAMlB,MAAM,GAAG,+BAAiBkB,UAAjB,CAAf,CADkC,CAGlC;;AACA,QAAMb,gBAAgB,GAAGO,gBAAEO,MAAF,CAASP,gBAAEQ,SAAF,CAAYpB,MAAM,CAACqB,OAAnB,EAA6BC,MAAD,IAAY;AACxE,WAAOA,MAAM,CAACC,KAAP,GAAeD,MAAM,CAACE,WAAtB,GAAoCF,MAAM,CAACG,YAAlD;AACD,GAFiC,CAAT,CAAzB;;AAIA,MAAIC,KAAJ;AAEAA,EAAAA,KAAK,GAAG,IAAR;AAEA,SAAO;AACL;;;;AAIAV,IAAAA,KAAK,EAAGZ,GAAD,IAAS;AACd,UAAIA,GAAG,CAACuB,MAAJ,KAAe3B,MAAM,CAAC4B,WAA1B,EAAuC;AACrC,cAAM,IAAIC,KAAJ,CAAU,uDAAV,CAAN;AACD;;AAED,UAAIH,KAAJ,EAAW;AACTA,QAAAA,KAAK,GAAG,KAAR;AAEA,eAAOvB,MAAM,CAACC,GAAD,EAAMC,gBAAN,EAAwBL,MAAxB,CAAb;AACD,OAJD,MAIO;AACL,eAAOiB,MAAM,CAACb,GAAD,EAAMC,gBAAN,EAAwBL,MAAxB,CAAb;AACD;AACF;AAjBI,GAAP;AAmBD,C","sourcesContent":["import _ from 'lodash';\nimport makeStreamConfig from './makeStreamConfig';\nimport drawRow from './drawRow';\nimport {\n drawBorderBottom,\n drawBorderJoin,\n drawBorderTop\n} from './drawBorder';\nimport stringifyTableData from './stringifyTableData';\nimport truncateTableData from './truncateTableData';\nimport mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';\nimport alignTableData from './alignTableData';\nimport padTableData from './padTableData';\nimport calculateRowHeightIndex from './calculateRowHeightIndex';\n\n/**\n * @param {Array} data\n * @param {Object} config\n * @returns {Array}\n */\nconst prepareData = (data, config) => {\n let rows;\n\n rows = stringifyTableData(data);\n\n rows = truncateTableData(data, config);\n\n const rowHeightIndex = calculateRowHeightIndex(rows, config);\n\n rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);\n rows = alignTableData(rows, config);\n rows = padTableData(rows, config);\n\n return rows;\n};\n\n/**\n * @param {string[]} row\n * @param {number[]} columnWidthIndex\n * @param {Object} config\n * @returns {undefined}\n */\nconst create = (row, columnWidthIndex, config) => {\n const rows = prepareData([row], config);\n\n const body = rows.map((literalRow) => {\n return drawRow(literalRow, config.border);\n }).join('');\n\n let output;\n\n output = '';\n\n output += drawBorderTop(columnWidthIndex, config.border);\n output += body;\n output += drawBorderBottom(columnWidthIndex, config.border);\n\n output = _.trimEnd(output);\n\n process.stdout.write(output);\n};\n\n/**\n * @param {string[]} row\n * @param {number[]} columnWidthIndex\n * @param {Object} config\n * @returns {undefined}\n */\nconst append = (row, columnWidthIndex, config) => {\n const rows = prepareData([row], config);\n\n const body = rows.map((literalRow) => {\n return drawRow(literalRow, config.border);\n }).join('');\n\n let output;\n\n output = '\\r\\u001B[K';\n\n output += drawBorderJoin(columnWidthIndex, config.border);\n output += body;\n output += drawBorderBottom(columnWidthIndex, config.border);\n\n output = _.trimEnd(output);\n\n process.stdout.write(output);\n};\n\n/**\n * @param {Object} userConfig\n * @returns {Object}\n */\nexport default (userConfig = {}) => {\n const config = makeStreamConfig(userConfig);\n\n // @todo Use 'Object.values' when Node.js v6 support is dropped.\n const columnWidthIndex = _.values(_.mapValues(config.columns, (column) => {\n return column.width + column.paddingLeft + column.paddingRight;\n }));\n\n let empty;\n\n empty = true;\n\n return {\n /**\n * @param {string[]} row\n * @returns {undefined}\n */\n write: (row) => {\n if (row.length !== config.columnCount) {\n throw new Error('Row cell count does not match the config.columnCount.');\n }\n\n if (empty) {\n empty = false;\n\n return create(row, columnWidthIndex, config);\n } else {\n return append(row, columnWidthIndex, config);\n }\n }\n };\n};\n"],"file":"createStream.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js index beae57f1a2885f..cb7c54077a3fd1 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js +++ b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js @@ -1,8 +1,10 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = void 0; + /** * @typedef drawBorder~parts * @property {string} left @@ -20,10 +22,8 @@ const drawBorder = (columnSizeIndex, parts) => { const columns = columnSizeIndex.map(size => { return parts.body.repeat(size); }).join(parts.join); - return parts.left + columns + parts.right + '\n'; }; - /** * @typedef drawBorderTop~parts * @property {string} topLeft @@ -37,6 +37,10 @@ const drawBorder = (columnSizeIndex, parts) => { * @param {drawBorderTop~parts} parts * @returns {string} */ + + +exports.drawBorder = drawBorder; + const drawBorderTop = (columnSizeIndex, parts) => { return drawBorder(columnSizeIndex, { body: parts.topBody, @@ -45,7 +49,6 @@ const drawBorderTop = (columnSizeIndex, parts) => { right: parts.topRight }); }; - /** * @typedef drawBorderJoin~parts * @property {string} joinLeft @@ -59,6 +62,10 @@ const drawBorderTop = (columnSizeIndex, parts) => { * @param {drawBorderJoin~parts} parts * @returns {string} */ + + +exports.drawBorderTop = drawBorderTop; + const drawBorderJoin = (columnSizeIndex, parts) => { return drawBorder(columnSizeIndex, { body: parts.joinBody, @@ -67,7 +74,6 @@ const drawBorderJoin = (columnSizeIndex, parts) => { right: parts.joinRight }); }; - /** * @typedef drawBorderBottom~parts * @property {string} topLeft @@ -81,6 +87,10 @@ const drawBorderJoin = (columnSizeIndex, parts) => { * @param {drawBorderBottom~parts} parts * @returns {string} */ + + +exports.drawBorderJoin = drawBorderJoin; + const drawBorderBottom = (columnSizeIndex, parts) => { return drawBorder(columnSizeIndex, { body: parts.bottomBody, @@ -90,7 +100,5 @@ const drawBorderBottom = (columnSizeIndex, parts) => { }); }; -exports.drawBorder = drawBorder; exports.drawBorderBottom = drawBorderBottom; -exports.drawBorderJoin = drawBorderJoin; -exports.drawBorderTop = drawBorderTop; \ No newline at end of file +//# sourceMappingURL=drawBorder.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.flow b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.flow new file mode 100644 index 00000000000000..5d5f5d9ac2e90f --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.flow @@ -0,0 +1,95 @@ +/** + * @typedef drawBorder~parts + * @property {string} left + * @property {string} right + * @property {string} body + * @property {string} join + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorder~parts} parts + * @returns {string} + */ +const drawBorder = (columnSizeIndex, parts) => { + const columns = columnSizeIndex + .map((size) => { + return parts.body.repeat(size); + }) + .join(parts.join); + + return parts.left + columns + parts.right + '\n'; +}; + +/** + * @typedef drawBorderTop~parts + * @property {string} topLeft + * @property {string} topRight + * @property {string} topBody + * @property {string} topJoin + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorderTop~parts} parts + * @returns {string} + */ +const drawBorderTop = (columnSizeIndex, parts) => { + return drawBorder(columnSizeIndex, { + body: parts.topBody, + join: parts.topJoin, + left: parts.topLeft, + right: parts.topRight + }); +}; + +/** + * @typedef drawBorderJoin~parts + * @property {string} joinLeft + * @property {string} joinRight + * @property {string} joinBody + * @property {string} joinJoin + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorderJoin~parts} parts + * @returns {string} + */ +const drawBorderJoin = (columnSizeIndex, parts) => { + return drawBorder(columnSizeIndex, { + body: parts.joinBody, + join: parts.joinJoin, + left: parts.joinLeft, + right: parts.joinRight + }); +}; + +/** + * @typedef drawBorderBottom~parts + * @property {string} topLeft + * @property {string} topRight + * @property {string} topBody + * @property {string} topJoin + */ + +/** + * @param {number[]} columnSizeIndex + * @param {drawBorderBottom~parts} parts + * @returns {string} + */ +const drawBorderBottom = (columnSizeIndex, parts) => { + return drawBorder(columnSizeIndex, { + body: parts.bottomBody, + join: parts.bottomJoin, + left: parts.bottomLeft, + right: parts.bottomRight + }); +}; + +export { + drawBorder, + drawBorderBottom, + drawBorderJoin, + drawBorderTop +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.map b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.map new file mode 100644 index 00000000000000..dfdfccd0f4ee3d --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/drawBorder.js"],"names":["drawBorder","columnSizeIndex","parts","columns","map","size","body","repeat","join","left","right","drawBorderTop","topBody","topJoin","topLeft","topRight","drawBorderJoin","joinBody","joinJoin","joinLeft","joinRight","drawBorderBottom","bottomBody","bottomJoin","bottomLeft","bottomRight"],"mappings":";;;;;;;AAAA;;;;;;;;AAQA;;;;;AAKA,MAAMA,UAAU,GAAG,CAACC,eAAD,EAAkBC,KAAlB,KAA4B;AAC7C,QAAMC,OAAO,GAAGF,eAAe,CAC5BG,GADa,CACRC,IAAD,IAAU;AACb,WAAOH,KAAK,CAACI,IAAN,CAAWC,MAAX,CAAkBF,IAAlB,CAAP;AACD,GAHa,EAIbG,IAJa,CAIRN,KAAK,CAACM,IAJE,CAAhB;AAMA,SAAON,KAAK,CAACO,IAAN,GAAaN,OAAb,GAAuBD,KAAK,CAACQ,KAA7B,GAAqC,IAA5C;AACD,CARD;AAUA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,aAAa,GAAG,CAACV,eAAD,EAAkBC,KAAlB,KAA4B;AAChD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACU,OADqB;AAEjCJ,IAAAA,IAAI,EAAEN,KAAK,CAACW,OAFqB;AAGjCJ,IAAAA,IAAI,EAAEP,KAAK,CAACY,OAHqB;AAIjCJ,IAAAA,KAAK,EAAER,KAAK,CAACa;AAJoB,GAAlB,CAAjB;AAMD,CAPD;AASA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,cAAc,GAAG,CAACf,eAAD,EAAkBC,KAAlB,KAA4B;AACjD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACe,QADqB;AAEjCT,IAAAA,IAAI,EAAEN,KAAK,CAACgB,QAFqB;AAGjCT,IAAAA,IAAI,EAAEP,KAAK,CAACiB,QAHqB;AAIjCT,IAAAA,KAAK,EAAER,KAAK,CAACkB;AAJoB,GAAlB,CAAjB;AAMD,CAPD;AASA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,gBAAgB,GAAG,CAACpB,eAAD,EAAkBC,KAAlB,KAA4B;AACnD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACoB,UADqB;AAEjCd,IAAAA,IAAI,EAAEN,KAAK,CAACqB,UAFqB;AAGjCd,IAAAA,IAAI,EAAEP,KAAK,CAACsB,UAHqB;AAIjCd,IAAAA,KAAK,EAAER,KAAK,CAACuB;AAJoB,GAAlB,CAAjB;AAMD,CAPD","sourcesContent":["/**\n * @typedef drawBorder~parts\n * @property {string} left\n * @property {string} right\n * @property {string} body\n * @property {string} join\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorder~parts} parts\n * @returns {string}\n */\nconst drawBorder = (columnSizeIndex, parts) => {\n const columns = columnSizeIndex\n .map((size) => {\n return parts.body.repeat(size);\n })\n .join(parts.join);\n\n return parts.left + columns + parts.right + '\\n';\n};\n\n/**\n * @typedef drawBorderTop~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderTop~parts} parts\n * @returns {string}\n */\nconst drawBorderTop = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.topBody,\n join: parts.topJoin,\n left: parts.topLeft,\n right: parts.topRight\n });\n};\n\n/**\n * @typedef drawBorderJoin~parts\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinBody\n * @property {string} joinJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderJoin~parts} parts\n * @returns {string}\n */\nconst drawBorderJoin = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.joinBody,\n join: parts.joinJoin,\n left: parts.joinLeft,\n right: parts.joinRight\n });\n};\n\n/**\n * @typedef drawBorderBottom~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderBottom~parts} parts\n * @returns {string}\n */\nconst drawBorderBottom = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.bottomBody,\n join: parts.bottomJoin,\n left: parts.bottomLeft,\n right: parts.bottomRight\n });\n};\n\nexport {\n drawBorder,\n drawBorderBottom,\n drawBorderJoin,\n drawBorderTop\n};\n"],"file":"drawBorder.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawRow.js b/tools/node_modules/eslint/node_modules/table/dist/drawRow.js index 65547fba058caf..800ca25bc3df7e 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/drawRow.js +++ b/tools/node_modules/eslint/node_modules/table/dist/drawRow.js @@ -1,8 +1,9 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; /** * @typedef {Object} drawRow~border @@ -16,6 +17,10 @@ Object.defineProperty(exports, "__esModule", { * @param {drawRow~border} border * @returns {string} */ -exports.default = (columns, border) => { +const drawRow = (columns, border) => { return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n'; -}; \ No newline at end of file +}; + +var _default = drawRow; +exports.default = _default; +//# sourceMappingURL=drawRow.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawRow.js.flow b/tools/node_modules/eslint/node_modules/table/dist/drawRow.js.flow new file mode 100644 index 00000000000000..fdeceefa31880a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/drawRow.js.flow @@ -0,0 +1,15 @@ +/** + * @typedef {Object} drawRow~border + * @property {string} bodyLeft + * @property {string} bodyRight + * @property {string} bodyJoin + */ + +/** + * @param {number[]} columns + * @param {drawRow~border} border + * @returns {string} + */ +export default (columns, border) => { + return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n'; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawRow.js.map b/tools/node_modules/eslint/node_modules/table/dist/drawRow.js.map new file mode 100644 index 00000000000000..4541d1961520d6 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/drawRow.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/drawRow.js"],"names":["columns","border","bodyLeft","join","bodyJoin","bodyRight"],"mappings":";;;;;;;AAAA;;;;;;;AAOA;;;;;iBAKgBA,O,EAASC,M,KAAW;AAClC,SAAOA,MAAM,CAACC,QAAP,GAAkBF,OAAO,CAACG,IAAR,CAAaF,MAAM,CAACG,QAApB,CAAlB,GAAkDH,MAAM,CAACI,SAAzD,GAAqE,IAA5E;AACD,C","sourcesContent":["/**\n * @typedef {Object} drawRow~border\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n */\n\n/**\n * @param {number[]} columns\n * @param {drawRow~border} border\n * @returns {string}\n */\nexport default (columns, border) => {\n return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\\n';\n};\n"],"file":"drawRow.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawTable.js b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js index 01e8c3e14d4af6..5585af888f6612 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/drawTable.js +++ b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js @@ -1,14 +1,13 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _drawBorder = require('./drawBorder'); +var _drawBorder = require("./drawBorder"); -var _drawRow = require('./drawRow'); - -var _drawRow2 = _interopRequireDefault(_drawRow); +var _drawRow = _interopRequireDefault(require("./drawRow")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -20,15 +19,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Function} drawHorizontalLine * @returns {string} */ -exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => { +const drawTable = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => { let output; let realRowIndex; let rowHeight; - const rowCount = rows.length; - realRowIndex = 0; - output = ''; if (drawHorizontalLine(realRowIndex, rowCount)) { @@ -36,11 +32,10 @@ exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLi } rows.forEach((row, index0) => { - output += (0, _drawRow2.default)(row, border); + output += (0, _drawRow.default)(row, border); if (!rowHeight) { rowHeight = rowSpanIndex[realRowIndex]; - realRowIndex++; } @@ -56,4 +51,8 @@ exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLi } return output; -}; \ No newline at end of file +}; + +var _default = drawTable; +exports.default = _default; +//# sourceMappingURL=drawTable.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawTable.js.flow b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js.flow new file mode 100644 index 00000000000000..15ad14cfa2ba12 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js.flow @@ -0,0 +1,52 @@ +import { + drawBorderTop, + drawBorderJoin, + drawBorderBottom +} from './drawBorder'; +import drawRow from './drawRow'; + +/** + * @param {Array} rows + * @param {Object} border + * @param {Array} columnSizeIndex + * @param {Array} rowSpanIndex + * @param {Function} drawHorizontalLine + * @returns {string} + */ +export default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => { + let output; + let realRowIndex; + let rowHeight; + + const rowCount = rows.length; + + realRowIndex = 0; + + output = ''; + + if (drawHorizontalLine(realRowIndex, rowCount)) { + output += drawBorderTop(columnSizeIndex, border); + } + + rows.forEach((row, index0) => { + output += drawRow(row, border); + + if (!rowHeight) { + rowHeight = rowSpanIndex[realRowIndex]; + + realRowIndex++; + } + + rowHeight--; + + if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) { + output += drawBorderJoin(columnSizeIndex, border); + } + }); + + if (drawHorizontalLine(realRowIndex, rowCount)) { + output += drawBorderBottom(columnSizeIndex, border); + } + + return output; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/drawTable.js.map b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js.map new file mode 100644 index 00000000000000..526336ab999159 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/drawTable.js"],"names":["rows","border","columnSizeIndex","rowSpanIndex","drawHorizontalLine","output","realRowIndex","rowHeight","rowCount","length","forEach","row","index0"],"mappings":";;;;;;;AAAA;;AAKA;;;;AAEA;;;;;;;;mBAQgBA,I,EAAMC,M,EAAQC,e,EAAiBC,Y,EAAcC,kB,KAAuB;AAClF,MAAIC,MAAJ;AACA,MAAIC,YAAJ;AACA,MAAIC,SAAJ;AAEA,QAAMC,QAAQ,GAAGR,IAAI,CAACS,MAAtB;AAEAH,EAAAA,YAAY,GAAG,CAAf;AAEAD,EAAAA,MAAM,GAAG,EAAT;;AAEA,MAAID,kBAAkB,CAACE,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,+BAAcH,eAAd,EAA+BD,MAA/B,CAAV;AACD;;AAEDD,EAAAA,IAAI,CAACU,OAAL,CAAa,CAACC,GAAD,EAAMC,MAAN,KAAiB;AAC5BP,IAAAA,MAAM,IAAI,sBAAQM,GAAR,EAAaV,MAAb,CAAV;;AAEA,QAAI,CAACM,SAAL,EAAgB;AACdA,MAAAA,SAAS,GAAGJ,YAAY,CAACG,YAAD,CAAxB;AAEAA,MAAAA,YAAY;AACb;;AAEDC,IAAAA,SAAS;;AAET,QAAIA,SAAS,KAAK,CAAd,IAAmBK,MAAM,KAAKJ,QAAQ,GAAG,CAAzC,IAA8CJ,kBAAkB,CAACE,YAAD,EAAeE,QAAf,CAApE,EAA8F;AAC5FH,MAAAA,MAAM,IAAI,gCAAeH,eAAf,EAAgCD,MAAhC,CAAV;AACD;AACF,GAdD;;AAgBA,MAAIG,kBAAkB,CAACE,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,kCAAiBH,eAAjB,EAAkCD,MAAlC,CAAV;AACD;;AAED,SAAOI,MAAP;AACD,C","sourcesContent":["import {\n drawBorderTop,\n drawBorderJoin,\n drawBorderBottom\n} from './drawBorder';\nimport drawRow from './drawRow';\n\n/**\n * @param {Array} rows\n * @param {Object} border\n * @param {Array} columnSizeIndex\n * @param {Array} rowSpanIndex\n * @param {Function} drawHorizontalLine\n * @returns {string}\n */\nexport default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {\n let output;\n let realRowIndex;\n let rowHeight;\n\n const rowCount = rows.length;\n\n realRowIndex = 0;\n\n output = '';\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderTop(columnSizeIndex, border);\n }\n\n rows.forEach((row, index0) => {\n output += drawRow(row, border);\n\n if (!rowHeight) {\n rowHeight = rowSpanIndex[realRowIndex];\n\n realRowIndex++;\n }\n\n rowHeight--;\n\n if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderJoin(columnSizeIndex, border);\n }\n });\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderBottom(columnSizeIndex, border);\n }\n\n return output;\n};\n"],"file":"drawTable.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js b/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js index 0a0f599ca39242..0b9b5b00e10212 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js +++ b/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js @@ -1,8 +1,9 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; /* eslint-disable sort-keys */ @@ -29,23 +30,20 @@ Object.defineProperty(exports, "__esModule", { * @param {string} name * @returns {border} */ -exports.default = name => { +const getBorderCharacters = name => { if (name === 'honeywell') { return { topBody: '═', topJoin: '╤', topLeft: '╔', topRight: '╗', - bottomBody: '═', bottomJoin: '╧', bottomLeft: '╚', bottomRight: '╝', - bodyLeft: '║', bodyRight: '║', bodyJoin: '│', - joinBody: '─', joinLeft: '╟', joinRight: '╢', @@ -59,16 +57,13 @@ exports.default = name => { topJoin: '┬', topLeft: '┌', topRight: '┐', - bottomBody: '─', bottomJoin: '┴', bottomLeft: '└', bottomRight: '┘', - bodyLeft: '│', bodyRight: '│', bodyJoin: '│', - joinBody: '─', joinLeft: '├', joinRight: '┤', @@ -82,16 +77,13 @@ exports.default = name => { topJoin: '+', topLeft: '+', topRight: '+', - bottomBody: '-', bottomJoin: '+', bottomLeft: '+', bottomRight: '+', - bodyLeft: '|', bodyRight: '|', bodyJoin: '|', - joinBody: '-', joinLeft: '|', joinRight: '|', @@ -105,16 +97,13 @@ exports.default = name => { topJoin: '', topLeft: '', topRight: '', - bottomBody: '', bottomJoin: '', bottomLeft: '', bottomRight: '', - bodyLeft: '', bodyRight: '', bodyJoin: '', - joinBody: '', joinLeft: '', joinRight: '', @@ -123,4 +112,8 @@ exports.default = name => { } throw new Error('Unknown border template "' + name + '".'); -}; \ No newline at end of file +}; + +var _default = getBorderCharacters; +exports.default = _default; +//# sourceMappingURL=getBorderCharacters.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.flow b/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.flow new file mode 100644 index 00000000000000..916b3518f9408e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.flow @@ -0,0 +1,120 @@ +/* eslint-disable sort-keys */ + +/** + * @typedef border + * @property {string} topBody + * @property {string} topJoin + * @property {string} topLeft + * @property {string} topRight + * @property {string} bottomBody + * @property {string} bottomJoin + * @property {string} bottomLeft + * @property {string} bottomRight + * @property {string} bodyLeft + * @property {string} bodyRight + * @property {string} bodyJoin + * @property {string} joinBody + * @property {string} joinLeft + * @property {string} joinRight + * @property {string} joinJoin + */ + +/** + * @param {string} name + * @returns {border} + */ +export default (name) => { + if (name === 'honeywell') { + return { + topBody: '═', + topJoin: '╤', + topLeft: '╔', + topRight: '╗', + + bottomBody: '═', + bottomJoin: '╧', + bottomLeft: '╚', + bottomRight: '╝', + + bodyLeft: '║', + bodyRight: '║', + bodyJoin: '│', + + joinBody: '─', + joinLeft: '╟', + joinRight: '╢', + joinJoin: '┼' + }; + } + + if (name === 'norc') { + return { + topBody: '─', + topJoin: '┬', + topLeft: '┌', + topRight: '┐', + + bottomBody: '─', + bottomJoin: '┴', + bottomLeft: '└', + bottomRight: '┘', + + bodyLeft: '│', + bodyRight: '│', + bodyJoin: '│', + + joinBody: '─', + joinLeft: '├', + joinRight: '┤', + joinJoin: '┼' + }; + } + + if (name === 'ramac') { + return { + topBody: '-', + topJoin: '+', + topLeft: '+', + topRight: '+', + + bottomBody: '-', + bottomJoin: '+', + bottomLeft: '+', + bottomRight: '+', + + bodyLeft: '|', + bodyRight: '|', + bodyJoin: '|', + + joinBody: '-', + joinLeft: '|', + joinRight: '|', + joinJoin: '|' + }; + } + + if (name === 'void') { + return { + topBody: '', + topJoin: '', + topLeft: '', + topRight: '', + + bottomBody: '', + bottomJoin: '', + bottomLeft: '', + bottomRight: '', + + bodyLeft: '', + bodyRight: '', + bodyJoin: '', + + joinBody: '', + joinLeft: '', + joinRight: '', + joinJoin: '' + }; + } + + throw new Error('Unknown border template "' + name + '".'); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.map b/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.map new file mode 100644 index 00000000000000..543426cacf0160 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/getBorderCharacters.js"],"names":["name","topBody","topJoin","topLeft","topRight","bottomBody","bottomJoin","bottomLeft","bottomRight","bodyLeft","bodyRight","bodyJoin","joinBody","joinLeft","joinRight","joinJoin","Error"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;;;;;;;;;AAmBA;;;;4BAIgBA,I,IAAS;AACvB,MAAIA,IAAI,KAAK,WAAb,EAA0B;AACxB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,OAAb,EAAsB;AACpB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,EADJ;AAELC,MAAAA,OAAO,EAAE,EAFJ;AAGLC,MAAAA,OAAO,EAAE,EAHJ;AAILC,MAAAA,QAAQ,EAAE,EAJL;AAMLC,MAAAA,UAAU,EAAE,EANP;AAOLC,MAAAA,UAAU,EAAE,EAPP;AAQLC,MAAAA,UAAU,EAAE,EARP;AASLC,MAAAA,WAAW,EAAE,EATR;AAWLC,MAAAA,QAAQ,EAAE,EAXL;AAYLC,MAAAA,SAAS,EAAE,EAZN;AAaLC,MAAAA,QAAQ,EAAE,EAbL;AAeLC,MAAAA,QAAQ,EAAE,EAfL;AAgBLC,MAAAA,QAAQ,EAAE,EAhBL;AAiBLC,MAAAA,SAAS,EAAE,EAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,QAAM,IAAIC,KAAJ,CAAU,8BAA8BhB,IAA9B,GAAqC,IAA/C,CAAN;AACD,C","sourcesContent":["/* eslint-disable sort-keys */\n\n/**\n * @typedef border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * @param {string} name\n * @returns {border}\n */\nexport default (name) => {\n if (name === 'honeywell') {\n return {\n topBody: '═',\n topJoin: '╤',\n topLeft: '╔',\n topRight: '╗',\n\n bottomBody: '═',\n bottomJoin: '╧',\n bottomLeft: '╚',\n bottomRight: '╝',\n\n bodyLeft: '║',\n bodyRight: '║',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '╟',\n joinRight: '╢',\n joinJoin: '┼'\n };\n }\n\n if (name === 'norc') {\n return {\n topBody: '─',\n topJoin: '┬',\n topLeft: '┌',\n topRight: '┐',\n\n bottomBody: '─',\n bottomJoin: '┴',\n bottomLeft: '└',\n bottomRight: '┘',\n\n bodyLeft: '│',\n bodyRight: '│',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '├',\n joinRight: '┤',\n joinJoin: '┼'\n };\n }\n\n if (name === 'ramac') {\n return {\n topBody: '-',\n topJoin: '+',\n topLeft: '+',\n topRight: '+',\n\n bottomBody: '-',\n bottomJoin: '+',\n bottomLeft: '+',\n bottomRight: '+',\n\n bodyLeft: '|',\n bodyRight: '|',\n bodyJoin: '|',\n\n joinBody: '-',\n joinLeft: '|',\n joinRight: '|',\n joinJoin: '|'\n };\n }\n\n if (name === 'void') {\n return {\n topBody: '',\n topJoin: '',\n topLeft: '',\n topRight: '',\n\n bottomBody: '',\n bottomJoin: '',\n bottomLeft: '',\n bottomRight: '',\n\n bodyLeft: '',\n bodyRight: '',\n bodyJoin: '',\n\n joinBody: '',\n joinLeft: '',\n joinRight: '',\n joinJoin: ''\n };\n }\n\n throw new Error('Unknown border template \"' + name + '\".');\n};\n"],"file":"getBorderCharacters.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/index.js b/tools/node_modules/eslint/node_modules/table/dist/index.js index 169eddf080bfb2..1f40e6628d67af 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/index.js +++ b/tools/node_modules/eslint/node_modules/table/dist/index.js @@ -1,24 +1,32 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getBorderCharacters = exports.createStream = exports.table = undefined; - -var _table = require('./table'); - -var _table2 = _interopRequireDefault(_table); - -var _createStream = require('./createStream'); +Object.defineProperty(exports, "table", { + enumerable: true, + get: function get() { + return _table.default; + } +}); +Object.defineProperty(exports, "createStream", { + enumerable: true, + get: function get() { + return _createStream.default; + } +}); +Object.defineProperty(exports, "getBorderCharacters", { + enumerable: true, + get: function get() { + return _getBorderCharacters.default; + } +}); -var _createStream2 = _interopRequireDefault(_createStream); +var _table = _interopRequireDefault(require("./table")); -var _getBorderCharacters = require('./getBorderCharacters'); +var _createStream = _interopRequireDefault(require("./createStream")); -var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters); +var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.table = _table2.default; -exports.createStream = _createStream2.default; -exports.getBorderCharacters = _getBorderCharacters2.default; \ No newline at end of file +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/index.js.flow b/tools/node_modules/eslint/node_modules/table/dist/index.js.flow new file mode 100644 index 00000000000000..76cd8301a0eac3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/index.js.flow @@ -0,0 +1,9 @@ +import table from './table'; +import createStream from './createStream'; +import getBorderCharacters from './getBorderCharacters'; + +export { + table, + createStream, + getBorderCharacters +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/index.js.map b/tools/node_modules/eslint/node_modules/table/dist/index.js.map new file mode 100644 index 00000000000000..2f59e09a1521bf --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["import table from './table';\nimport createStream from './createStream';\nimport getBorderCharacters from './getBorderCharacters';\n\nexport {\n table,\n createStream,\n getBorderCharacters\n};\n"],"file":"index.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js index 9444ffe0e2bfa6..0ec93b8628161b 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js @@ -1,24 +1,17 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); +var _lodash = _interopRequireDefault(require("lodash")); -var _lodash2 = _interopRequireDefault(_lodash); +var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters")); -var _getBorderCharacters = require('./getBorderCharacters'); +var _validateConfig = _interopRequireDefault(require("./validateConfig")); -var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters); - -var _validateConfig = require('./validateConfig'); - -var _validateConfig2 = _interopRequireDefault(_validateConfig); - -var _calculateMaximumColumnWidthIndex = require('./calculateMaximumColumnWidthIndex'); - -var _calculateMaximumColumnWidthIndex2 = _interopRequireDefault(_calculateMaximumColumnWidthIndex); +var _calculateMaximumColumnWidthIndex = _interopRequireDefault(require("./calculateMaximumColumnWidthIndex")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -28,12 +21,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Object} border * @returns {Object} */ -const makeBorder = function makeBorder() { - let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - return Object.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border); +const makeBorder = (border = {}) => { + return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border); }; - /** * Creates a configuration for every column using default * values for the missing configuration properties. @@ -43,14 +33,13 @@ const makeBorder = function makeBorder() { * @param {Object} columnDefault * @returns {Object} */ -const makeColumns = function makeColumns(rows) { - let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex2.default)(rows); - _lodash2.default.times(rows[0].length, index => { - if (_lodash2.default.isUndefined(columns[index])) { +const makeColumns = (rows, columns = {}, columnDefault = {}) => { + const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex.default)(rows); + + _lodash.default.times(rows[0].length, index => { + if (_lodash.default.isUndefined(columns[index])) { columns[index] = {}; } @@ -66,7 +55,6 @@ const makeColumns = function makeColumns(rows) { return columns; }; - /** * Makes a new configuration object out of the userConfig object * using default values for the missing configuration properties. @@ -76,12 +64,11 @@ const makeColumns = function makeColumns(rows) { * @returns {Object} */ -exports.default = function (rows) { - let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - (0, _validateConfig2.default)('config.json', userConfig); +const makeConfig = (rows, userConfig = {}) => { + (0, _validateConfig.default)('config.json', userConfig); - const config = _lodash2.default.cloneDeep(userConfig); + const config = _lodash.default.cloneDeep(userConfig); config.border = makeBorder(config.border); config.columns = makeColumns(rows, config.columns, config.columnDefault); @@ -96,4 +83,8 @@ exports.default = function (rows) { } return config; -}; \ No newline at end of file +}; + +var _default = makeConfig; +exports.default = _default; +//# sourceMappingURL=makeConfig.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow new file mode 100644 index 00000000000000..9a0ee0afade046 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow @@ -0,0 +1,72 @@ +import _ from 'lodash'; +import getBorderCharacters from './getBorderCharacters'; +import validateConfig from './validateConfig'; +import calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex'; + +/** + * Merges user provided border characters with the default border ("honeywell") characters. + * + * @param {Object} border + * @returns {Object} + */ +const makeBorder = (border = {}) => { + return Object.assign({}, getBorderCharacters('honeywell'), border); +}; + +/** + * Creates a configuration for every column using default + * values for the missing configuration properties. + * + * @param {Array[]} rows + * @param {Object} columns + * @param {Object} columnDefault + * @returns {Object} + */ +const makeColumns = (rows, columns = {}, columnDefault = {}) => { + const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows); + + _.times(rows[0].length, (index) => { + if (_.isUndefined(columns[index])) { + columns[index] = {}; + } + + columns[index] = Object.assign({ + alignment: 'left', + paddingLeft: 1, + paddingRight: 1, + truncate: Infinity, + width: maximumColumnWidthIndex[index], + wrapWord: false + }, columnDefault, columns[index]); + }); + + return columns; +}; + +/** + * Makes a new configuration object out of the userConfig object + * using default values for the missing configuration properties. + * + * @param {Array[]} rows + * @param {Object} userConfig + * @returns {Object} + */ +export default (rows, userConfig = {}) => { + validateConfig('config.json', userConfig); + + const config = _.cloneDeep(userConfig); + + config.border = makeBorder(config.border); + config.columns = makeColumns(rows, config.columns, config.columnDefault); + + if (!config.drawHorizontalLine) { + /** + * @returns {boolean} + */ + config.drawHorizontalLine = () => { + return true; + }; + } + + return config; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.map b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.map new file mode 100644 index 00000000000000..91b0bdeb9a826e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/makeConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","rows","columns","columnDefault","maximumColumnWidthIndex","_","times","length","index","isUndefined","alignment","paddingLeft","paddingRight","truncate","Infinity","width","wrapWord","userConfig","config","cloneDeep","drawHorizontalLine"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA;;;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,MAAM,GAAG,EAAV,KAAiB;AAClC,SAAOC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,kCAAoB,WAApB,CAAlB,EAAoDF,MAApD,CAAP;AACD,CAFD;AAIA;;;;;;;;;;;AASA,MAAMG,WAAW,GAAG,CAACC,IAAD,EAAOC,OAAO,GAAG,EAAjB,EAAqBC,aAAa,GAAG,EAArC,KAA4C;AAC9D,QAAMC,uBAAuB,GAAG,+CAAiCH,IAAjC,CAAhC;;AAEAI,kBAAEC,KAAF,CAAQL,IAAI,CAAC,CAAD,CAAJ,CAAQM,MAAhB,EAAyBC,KAAD,IAAW;AACjC,QAAIH,gBAAEI,WAAF,CAAcP,OAAO,CAACM,KAAD,CAArB,CAAJ,EAAmC;AACjCN,MAAAA,OAAO,CAACM,KAAD,CAAP,GAAiB,EAAjB;AACD;;AAEDN,IAAAA,OAAO,CAACM,KAAD,CAAP,GAAiBV,MAAM,CAACC,MAAP,CAAc;AAC7BW,MAAAA,SAAS,EAAE,MADkB;AAE7BC,MAAAA,WAAW,EAAE,CAFgB;AAG7BC,MAAAA,YAAY,EAAE,CAHe;AAI7BC,MAAAA,QAAQ,EAAEC,QAJmB;AAK7BC,MAAAA,KAAK,EAAEX,uBAAuB,CAACI,KAAD,CALD;AAM7BQ,MAAAA,QAAQ,EAAE;AANmB,KAAd,EAOdb,aAPc,EAOCD,OAAO,CAACM,KAAD,CAPR,CAAjB;AAQD,GAbD;;AAeA,SAAON,OAAP;AACD,CAnBD;AAqBA;;;;;;;;;;oBAQgBD,I,EAAMgB,UAAU,GAAG,E,KAAO;AACxC,+BAAe,aAAf,EAA8BA,UAA9B;;AAEA,QAAMC,MAAM,GAAGb,gBAAEc,SAAF,CAAYF,UAAZ,CAAf;;AAEAC,EAAAA,MAAM,CAACrB,MAAP,GAAgBD,UAAU,CAACsB,MAAM,CAACrB,MAAR,CAA1B;AACAqB,EAAAA,MAAM,CAAChB,OAAP,GAAiBF,WAAW,CAACC,IAAD,EAAOiB,MAAM,CAAChB,OAAd,EAAuBgB,MAAM,CAACf,aAA9B,CAA5B;;AAEA,MAAI,CAACe,MAAM,CAACE,kBAAZ,EAAgC;AAC9B;;;AAGAF,IAAAA,MAAM,CAACE,kBAAP,GAA4B,MAAM;AAChC,aAAO,IAAP;AACD,KAFD;AAGD;;AAED,SAAOF,MAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport getBorderCharacters from './getBorderCharacters';\nimport validateConfig from './validateConfig';\nimport calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';\n\n/**\n * Merges user provided border characters with the default border (\"honeywell\") characters.\n *\n * @param {Object} border\n * @returns {Object}\n */\nconst makeBorder = (border = {}) => {\n return Object.assign({}, getBorderCharacters('honeywell'), border);\n};\n\n/**\n * Creates a configuration for every column using default\n * values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} columns\n * @param {Object} columnDefault\n * @returns {Object}\n */\nconst makeColumns = (rows, columns = {}, columnDefault = {}) => {\n const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);\n\n _.times(rows[0].length, (index) => {\n if (_.isUndefined(columns[index])) {\n columns[index] = {};\n }\n\n columns[index] = Object.assign({\n alignment: 'left',\n paddingLeft: 1,\n paddingRight: 1,\n truncate: Infinity,\n width: maximumColumnWidthIndex[index],\n wrapWord: false\n }, columnDefault, columns[index]);\n });\n\n return columns;\n};\n\n/**\n * Makes a new configuration object out of the userConfig object\n * using default values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} userConfig\n * @returns {Object}\n */\nexport default (rows, userConfig = {}) => {\n validateConfig('config.json', userConfig);\n\n const config = _.cloneDeep(userConfig);\n\n config.border = makeBorder(config.border);\n config.columns = makeColumns(rows, config.columns, config.columnDefault);\n\n if (!config.drawHorizontalLine) {\n /**\n * @returns {boolean}\n */\n config.drawHorizontalLine = () => {\n return true;\n };\n }\n\n return config;\n};\n"],"file":"makeConfig.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js index 479de35a7c9777..131c200c01e712 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js @@ -1,20 +1,15 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); +var _lodash = _interopRequireDefault(require("lodash")); -var _lodash2 = _interopRequireDefault(_lodash); +var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters")); -var _getBorderCharacters = require('./getBorderCharacters'); - -var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters); - -var _validateConfig = require('./validateConfig'); - -var _validateConfig2 = _interopRequireDefault(_validateConfig); +var _validateConfig = _interopRequireDefault(require("./validateConfig")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -24,12 +19,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Object} border * @returns {Object} */ -const makeBorder = function makeBorder() { - let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - return Object.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border); +const makeBorder = (border = {}) => { + return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border); }; - /** * Creates a configuration for every column using default * values for the missing configuration properties. @@ -39,12 +31,11 @@ const makeBorder = function makeBorder() { * @param {Object} columnDefault * @returns {Object} */ -const makeColumns = function makeColumns(columnCount) { - let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - _lodash2.default.times(columnCount, index => { - if (_lodash2.default.isUndefined(columns[index])) { + +const makeColumns = (columnCount, columns = {}, columnDefault = {}) => { + _lodash.default.times(columnCount, index => { + if (_lodash.default.isUndefined(columns[index])) { columns[index] = {}; } @@ -59,7 +50,6 @@ const makeColumns = function makeColumns(columnCount) { return columns; }; - /** * @typedef {Object} columnConfig * @property {string} alignment @@ -85,12 +75,11 @@ const makeColumns = function makeColumns(columnCount) { * @returns {Object} */ -exports.default = function () { - let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - (0, _validateConfig2.default)('streamConfig.json', userConfig); +const makeStreamConfig = (userConfig = {}) => { + (0, _validateConfig.default)('streamConfig.json', userConfig); - const config = _lodash2.default.cloneDeep(userConfig); + const config = _lodash.default.cloneDeep(userConfig); if (!config.columnDefault || !config.columnDefault.width) { throw new Error('Must provide config.columnDefault.width when creating a stream.'); @@ -102,6 +91,9 @@ exports.default = function () { config.border = makeBorder(config.border); config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault); - return config; -}; \ No newline at end of file +}; + +var _default = makeStreamConfig; +exports.default = _default; +//# sourceMappingURL=makeStreamConfig.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow new file mode 100644 index 00000000000000..884625a53bb3a0 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow @@ -0,0 +1,83 @@ +import _ from 'lodash'; +import getBorderCharacters from './getBorderCharacters'; +import validateConfig from './validateConfig'; + +/** + * Merges user provided border characters with the default border ("honeywell") characters. + * + * @param {Object} border + * @returns {Object} + */ +const makeBorder = (border = {}) => { + return Object.assign({}, getBorderCharacters('honeywell'), border); +}; + +/** + * Creates a configuration for every column using default + * values for the missing configuration properties. + * + * @param {number} columnCount + * @param {Object} columns + * @param {Object} columnDefault + * @returns {Object} + */ +const makeColumns = (columnCount, columns = {}, columnDefault = {}) => { + _.times(columnCount, (index) => { + if (_.isUndefined(columns[index])) { + columns[index] = {}; + } + + columns[index] = Object.assign({ + alignment: 'left', + paddingLeft: 1, + paddingRight: 1, + truncate: Infinity, + wrapWord: false + }, columnDefault, columns[index]); + }); + + return columns; +}; + +/** + * @typedef {Object} columnConfig + * @property {string} alignment + * @property {number} width + * @property {number} truncate + * @property {number} paddingLeft + * @property {number} paddingRight + */ + +/** + * @typedef {Object} streamConfig + * @property {columnConfig} columnDefault + * @property {Object} border + * @property {columnConfig[]} + * @property {number} columnCount Number of columns in the table (required). + */ + +/** + * Makes a new configuration object out of the userConfig object + * using default values for the missing configuration properties. + * + * @param {streamConfig} userConfig + * @returns {Object} + */ +export default (userConfig = {}) => { + validateConfig('streamConfig.json', userConfig); + + const config = _.cloneDeep(userConfig); + + if (!config.columnDefault || !config.columnDefault.width) { + throw new Error('Must provide config.columnDefault.width when creating a stream.'); + } + + if (!config.columnCount) { + throw new Error('Must provide config.columnCount.'); + } + + config.border = makeBorder(config.border); + config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault); + + return config; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.map b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.map new file mode 100644 index 00000000000000..a0a52ddae04ae7 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/makeStreamConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","columnCount","columns","columnDefault","_","times","index","isUndefined","alignment","paddingLeft","paddingRight","truncate","Infinity","wrapWord","userConfig","config","cloneDeep","width","Error"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA;;;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,MAAM,GAAG,EAAV,KAAiB;AAClC,SAAOC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,kCAAoB,WAApB,CAAlB,EAAoDF,MAApD,CAAP;AACD,CAFD;AAIA;;;;;;;;;;;AASA,MAAMG,WAAW,GAAG,CAACC,WAAD,EAAcC,OAAO,GAAG,EAAxB,EAA4BC,aAAa,GAAG,EAA5C,KAAmD;AACrEC,kBAAEC,KAAF,CAAQJ,WAAR,EAAsBK,KAAD,IAAW;AAC9B,QAAIF,gBAAEG,WAAF,CAAcL,OAAO,CAACI,KAAD,CAArB,CAAJ,EAAmC;AACjCJ,MAAAA,OAAO,CAACI,KAAD,CAAP,GAAiB,EAAjB;AACD;;AAEDJ,IAAAA,OAAO,CAACI,KAAD,CAAP,GAAiBR,MAAM,CAACC,MAAP,CAAc;AAC7BS,MAAAA,SAAS,EAAE,MADkB;AAE7BC,MAAAA,WAAW,EAAE,CAFgB;AAG7BC,MAAAA,YAAY,EAAE,CAHe;AAI7BC,MAAAA,QAAQ,EAAEC,QAJmB;AAK7BC,MAAAA,QAAQ,EAAE;AALmB,KAAd,EAMdV,aANc,EAMCD,OAAO,CAACI,KAAD,CANR,CAAjB;AAOD,GAZD;;AAcA,SAAOJ,OAAP;AACD,CAhBD;AAkBA;;;;;;;;;AASA;;;;;;;;AAQA;;;;;;;;;0BAOgBY,UAAU,GAAG,E,KAAO;AAClC,+BAAe,mBAAf,EAAoCA,UAApC;;AAEA,QAAMC,MAAM,GAAGX,gBAAEY,SAAF,CAAYF,UAAZ,CAAf;;AAEA,MAAI,CAACC,MAAM,CAACZ,aAAR,IAAyB,CAACY,MAAM,CAACZ,aAAP,CAAqBc,KAAnD,EAA0D;AACxD,UAAM,IAAIC,KAAJ,CAAU,iEAAV,CAAN;AACD;;AAED,MAAI,CAACH,MAAM,CAACd,WAAZ,EAAyB;AACvB,UAAM,IAAIiB,KAAJ,CAAU,kCAAV,CAAN;AACD;;AAEDH,EAAAA,MAAM,CAAClB,MAAP,GAAgBD,UAAU,CAACmB,MAAM,CAAClB,MAAR,CAA1B;AACAkB,EAAAA,MAAM,CAACb,OAAP,GAAiBF,WAAW,CAACe,MAAM,CAACd,WAAR,EAAqBc,MAAM,CAACb,OAA5B,EAAqCa,MAAM,CAACZ,aAA5C,CAA5B;AAEA,SAAOY,MAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport getBorderCharacters from './getBorderCharacters';\nimport validateConfig from './validateConfig';\n\n/**\n * Merges user provided border characters with the default border (\"honeywell\") characters.\n *\n * @param {Object} border\n * @returns {Object}\n */\nconst makeBorder = (border = {}) => {\n return Object.assign({}, getBorderCharacters('honeywell'), border);\n};\n\n/**\n * Creates a configuration for every column using default\n * values for the missing configuration properties.\n *\n * @param {number} columnCount\n * @param {Object} columns\n * @param {Object} columnDefault\n * @returns {Object}\n */\nconst makeColumns = (columnCount, columns = {}, columnDefault = {}) => {\n _.times(columnCount, (index) => {\n if (_.isUndefined(columns[index])) {\n columns[index] = {};\n }\n\n columns[index] = Object.assign({\n alignment: 'left',\n paddingLeft: 1,\n paddingRight: 1,\n truncate: Infinity,\n wrapWord: false\n }, columnDefault, columns[index]);\n });\n\n return columns;\n};\n\n/**\n * @typedef {Object} columnConfig\n * @property {string} alignment\n * @property {number} width\n * @property {number} truncate\n * @property {number} paddingLeft\n * @property {number} paddingRight\n */\n\n/**\n * @typedef {Object} streamConfig\n * @property {columnConfig} columnDefault\n * @property {Object} border\n * @property {columnConfig[]}\n * @property {number} columnCount Number of columns in the table (required).\n */\n\n/**\n * Makes a new configuration object out of the userConfig object\n * using default values for the missing configuration properties.\n *\n * @param {streamConfig} userConfig\n * @returns {Object}\n */\nexport default (userConfig = {}) => {\n validateConfig('streamConfig.json', userConfig);\n\n const config = _.cloneDeep(userConfig);\n\n if (!config.columnDefault || !config.columnDefault.width) {\n throw new Error('Must provide config.columnDefault.width when creating a stream.');\n }\n\n if (!config.columnCount) {\n throw new Error('Must provide config.columnCount.');\n }\n\n config.border = makeBorder(config.border);\n config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);\n\n return config;\n};\n"],"file":"makeStreamConfig.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js index be0aae4e98ad42..8a7a16e2ce2f22 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js @@ -1,20 +1,15 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); +var _lodash = _interopRequireDefault(require("lodash")); -var _lodash2 = _interopRequireDefault(_lodash); +var _wrapString = _interopRequireDefault(require("./wrapString")); -var _wrapString = require('./wrapString'); - -var _wrapString2 = _interopRequireDefault(_wrapString); - -var _wrapWord = require('./wrapWord'); - -var _wrapWord2 = _interopRequireDefault(_wrapWord); +var _wrapWord = _interopRequireDefault(require("./wrapWord")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -24,34 +19,34 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Object} config * @returns {Array} */ -exports.default = (unmappedRows, rowHeightIndex, config) => { +const mapDataUsingRowHeightIndex = (unmappedRows, rowHeightIndex, config) => { const tableWidth = unmappedRows[0].length; - const mappedRows = unmappedRows.map((cells, index0) => { - const rowHeight = _lodash2.default.times(rowHeightIndex[index0], () => { - return Array(tableWidth).fill(''); - }); - - // rowHeight + const rowHeight = _lodash.default.times(rowHeightIndex[index0], () => { + return new Array(tableWidth).fill(''); + }); // rowHeight // [{row index within rowSaw; index2}] // [{cell index within a virtual row; index1}] + cells.forEach((value, index1) => { let chunkedValue; if (config.columns[index1].wrapWord) { - chunkedValue = (0, _wrapWord2.default)(value, config.columns[index1].width); + chunkedValue = (0, _wrapWord.default)(value, config.columns[index1].width); } else { - chunkedValue = (0, _wrapString2.default)(value, config.columns[index1].width); + chunkedValue = (0, _wrapString.default)(value, config.columns[index1].width); } chunkedValue.forEach((part, index2) => { rowHeight[index2][index1] = part; }); }); - return rowHeight; }); + return _lodash.default.flatten(mappedRows); +}; - return _lodash2.default.flatten(mappedRows); -}; \ No newline at end of file +var _default = mapDataUsingRowHeightIndex; +exports.default = _default; +//# sourceMappingURL=mapDataUsingRowHeightIndex.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js.flow b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js.flow new file mode 100644 index 00000000000000..89f1869b5daa8a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js.flow @@ -0,0 +1,41 @@ +import _ from 'lodash'; +import wrapString from './wrapString'; +import wrapWord from './wrapWord'; + +/** + * @param {Array} unmappedRows + * @param {number[]} rowHeightIndex + * @param {Object} config + * @returns {Array} + */ +export default (unmappedRows, rowHeightIndex, config) => { + const tableWidth = unmappedRows[0].length; + + const mappedRows = unmappedRows.map((cells, index0) => { + const rowHeight = _.times(rowHeightIndex[index0], () => { + return new Array(tableWidth).fill(''); + }); + + // rowHeight + // [{row index within rowSaw; index2}] + // [{cell index within a virtual row; index1}] + + cells.forEach((value, index1) => { + let chunkedValue; + + if (config.columns[index1].wrapWord) { + chunkedValue = wrapWord(value, config.columns[index1].width); + } else { + chunkedValue = wrapString(value, config.columns[index1].width); + } + + chunkedValue.forEach((part, index2) => { + rowHeight[index2][index1] = part; + }); + }); + + return rowHeight; + }); + + return _.flatten(mappedRows); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js.map b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js.map new file mode 100644 index 00000000000000..3c1cd9844899ed --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/mapDataUsingRowHeightIndex.js"],"names":["unmappedRows","rowHeightIndex","config","tableWidth","length","mappedRows","map","cells","index0","rowHeight","_","times","Array","fill","forEach","value","index1","chunkedValue","columns","wrapWord","width","part","index2","flatten"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA;;;;;;oCAMgBA,Y,EAAcC,c,EAAgBC,M,KAAW;AACvD,QAAMC,UAAU,GAAGH,YAAY,CAAC,CAAD,CAAZ,CAAgBI,MAAnC;AAEA,QAAMC,UAAU,GAAGL,YAAY,CAACM,GAAb,CAAiB,CAACC,KAAD,EAAQC,MAAR,KAAmB;AACrD,UAAMC,SAAS,GAAGC,gBAAEC,KAAF,CAAQV,cAAc,CAACO,MAAD,CAAtB,EAAgC,MAAM;AACtD,aAAO,IAAII,KAAJ,CAAUT,UAAV,EAAsBU,IAAtB,CAA2B,EAA3B,CAAP;AACD,KAFiB,CAAlB,CADqD,CAKrD;AACA;AACA;;;AAEAN,IAAAA,KAAK,CAACO,OAAN,CAAc,CAACC,KAAD,EAAQC,MAAR,KAAmB;AAC/B,UAAIC,YAAJ;;AAEA,UAAIf,MAAM,CAACgB,OAAP,CAAeF,MAAf,EAAuBG,QAA3B,EAAqC;AACnCF,QAAAA,YAAY,GAAG,uBAASF,KAAT,EAAgBb,MAAM,CAACgB,OAAP,CAAeF,MAAf,EAAuBI,KAAvC,CAAf;AACD,OAFD,MAEO;AACLH,QAAAA,YAAY,GAAG,yBAAWF,KAAX,EAAkBb,MAAM,CAACgB,OAAP,CAAeF,MAAf,EAAuBI,KAAzC,CAAf;AACD;;AAEDH,MAAAA,YAAY,CAACH,OAAb,CAAqB,CAACO,IAAD,EAAOC,MAAP,KAAkB;AACrCb,QAAAA,SAAS,CAACa,MAAD,CAAT,CAAkBN,MAAlB,IAA4BK,IAA5B;AACD,OAFD;AAGD,KAZD;AAcA,WAAOZ,SAAP;AACD,GAxBkB,CAAnB;AA0BA,SAAOC,gBAAEa,OAAF,CAAUlB,UAAV,CAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport wrapString from './wrapString';\nimport wrapWord from './wrapWord';\n\n/**\n * @param {Array} unmappedRows\n * @param {number[]} rowHeightIndex\n * @param {Object} config\n * @returns {Array}\n */\nexport default (unmappedRows, rowHeightIndex, config) => {\n const tableWidth = unmappedRows[0].length;\n\n const mappedRows = unmappedRows.map((cells, index0) => {\n const rowHeight = _.times(rowHeightIndex[index0], () => {\n return new Array(tableWidth).fill('');\n });\n\n // rowHeight\n // [{row index within rowSaw; index2}]\n // [{cell index within a virtual row; index1}]\n\n cells.forEach((value, index1) => {\n let chunkedValue;\n\n if (config.columns[index1].wrapWord) {\n chunkedValue = wrapWord(value, config.columns[index1].width);\n } else {\n chunkedValue = wrapString(value, config.columns[index1].width);\n }\n\n chunkedValue.forEach((part, index2) => {\n rowHeight[index2][index1] = part;\n });\n });\n\n return rowHeight;\n });\n\n return _.flatten(mappedRows);\n};\n"],"file":"mapDataUsingRowHeightIndex.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/padTableData.js b/tools/node_modules/eslint/node_modules/table/dist/padTableData.js index a78ce49bb1b624..81bd5f5d4ea03c 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/padTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/padTableData.js @@ -1,20 +1,24 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; /** * @param {table~row[]} rows * @param {Object} config * @returns {table~row[]} */ -exports.default = (rows, config) => { +const padTableData = (rows, config) => { return rows.map(cells => { return cells.map((value, index1) => { const column = config.columns[index1]; - return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight); }); }); -}; \ No newline at end of file +}; + +var _default = padTableData; +exports.default = _default; +//# sourceMappingURL=padTableData.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/padTableData.js.flow b/tools/node_modules/eslint/node_modules/table/dist/padTableData.js.flow new file mode 100644 index 00000000000000..f23dc021076099 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/padTableData.js.flow @@ -0,0 +1,14 @@ +/** + * @param {table~row[]} rows + * @param {Object} config + * @returns {table~row[]} + */ +export default (rows, config) => { + return rows.map((cells) => { + return cells.map((value, index1) => { + const column = config.columns[index1]; + + return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight); + }); + }); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/padTableData.js.map b/tools/node_modules/eslint/node_modules/table/dist/padTableData.js.map new file mode 100644 index 00000000000000..783f9cc2fb96da --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/padTableData.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/padTableData.js"],"names":["rows","config","map","cells","value","index1","column","columns","repeat","paddingLeft","paddingRight"],"mappings":";;;;;;;AAAA;;;;;sBAKgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,KAAD,EAAQC,MAAR,KAAmB;AAClC,YAAMC,MAAM,GAAGL,MAAM,CAACM,OAAP,CAAeF,MAAf,CAAf;AAEA,aAAO,IAAIG,MAAJ,CAAWF,MAAM,CAACG,WAAlB,IAAiCL,KAAjC,GAAyC,IAAII,MAAJ,CAAWF,MAAM,CAACI,YAAlB,CAAhD;AACD,KAJM,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["/**\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((value, index1) => {\n const column = config.columns[index1];\n\n return ' '.repeat(column.paddingLeft) + value + ' '.repeat(column.paddingRight);\n });\n });\n};\n"],"file":"padTableData.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json b/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json index 36074181494ce1..1a4a9981833029 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json +++ b/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json @@ -1,6 +1,6 @@ { "$id": "config.json", - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "border": { diff --git a/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json b/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json index d8402a6248e2bd..35199844fd433e 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json +++ b/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json @@ -1,6 +1,6 @@ { "$id": "streamConfig.json", - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "border": { diff --git a/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js b/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js index 46a8b94a397633..0217e3b7b1f376 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; /** * Casts all cell values to a string. @@ -10,8 +11,12 @@ Object.defineProperty(exports, "__esModule", { * @param {table~row[]} rows * @returns {table~row[]} */ -exports.default = rows => { +const stringifyTableData = rows => { return rows.map(cells => { return cells.map(String); }); -}; \ No newline at end of file +}; + +var _default = stringifyTableData; +exports.default = _default; +//# sourceMappingURL=stringifyTableData.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js.flow b/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js.flow new file mode 100644 index 00000000000000..a4dffac13d9be6 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js.flow @@ -0,0 +1,11 @@ +/** + * Casts all cell values to a string. + * + * @param {table~row[]} rows + * @returns {table~row[]} + */ +export default (rows) => { + return rows.map((cells) => { + return cells.map(String); + }); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js.map b/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js.map new file mode 100644 index 00000000000000..6cbe5a71f3c427 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/stringifyTableData.js"],"names":["rows","map","cells","String"],"mappings":";;;;;;;AAAA;;;;;;2BAMgBA,I,IAAS;AACvB,SAAOA,IAAI,CAACC,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAUE,MAAV,CAAP;AACD,GAFM,CAAP;AAGD,C","sourcesContent":["/**\n * Casts all cell values to a string.\n *\n * @param {table~row[]} rows\n * @returns {table~row[]}\n */\nexport default (rows) => {\n return rows.map((cells) => {\n return cells.map(String);\n });\n};\n"],"file":"stringifyTableData.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/table.js b/tools/node_modules/eslint/node_modules/table/dist/table.js index fe8c3cfeb1b750..b4aac0167e3deb 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/table.js +++ b/tools/node_modules/eslint/node_modules/table/dist/table.js @@ -1,48 +1,29 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _drawTable = require('./drawTable'); +var _drawTable = _interopRequireDefault(require("./drawTable")); -var _drawTable2 = _interopRequireDefault(_drawTable); +var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex")); -var _calculateCellWidthIndex = require('./calculateCellWidthIndex'); +var _makeConfig = _interopRequireDefault(require("./makeConfig")); -var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex); +var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex")); -var _makeConfig = require('./makeConfig'); +var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex")); -var _makeConfig2 = _interopRequireDefault(_makeConfig); +var _alignTableData = _interopRequireDefault(require("./alignTableData")); -var _calculateRowHeightIndex = require('./calculateRowHeightIndex'); +var _padTableData = _interopRequireDefault(require("./padTableData")); -var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex); +var _validateTableData = _interopRequireDefault(require("./validateTableData")); -var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex'); +var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData")); -var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex); - -var _alignTableData = require('./alignTableData'); - -var _alignTableData2 = _interopRequireDefault(_alignTableData); - -var _padTableData = require('./padTableData'); - -var _padTableData2 = _interopRequireDefault(_padTableData); - -var _validateTableData = require('./validateTableData'); - -var _validateTableData2 = _interopRequireDefault(_validateTableData); - -var _stringifyTableData = require('./stringifyTableData'); - -var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData); - -var _truncateTableData = require('./truncateTableData'); - -var _truncateTableData2 = _interopRequireDefault(_truncateTableData); +var _truncateTableData = _interopRequireDefault(require("./truncateTableData")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -59,6 +40,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left). * @property {number} width Column width (default: auto). * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity). + * @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters * @property {number} paddingLeft Cell content padding width left (default: 1). * @property {number} paddingRight Cell content padding width right (default: 1). */ @@ -108,26 +90,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {table~config} userConfig * @returns {string} */ -exports.default = function (data) { - let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - +const table = (data, userConfig = {}) => { let rows; - - (0, _validateTableData2.default)(data); - - rows = (0, _stringifyTableData2.default)(data); - - const config = (0, _makeConfig2.default)(rows, userConfig); - - rows = (0, _truncateTableData2.default)(data, config); - - const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config); - - rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config); - rows = (0, _alignTableData2.default)(rows, config); - rows = (0, _padTableData2.default)(rows, config); - - const cellWidthIndex = (0, _calculateCellWidthIndex2.default)(rows[0]); - - return (0, _drawTable2.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine); -}; \ No newline at end of file + (0, _validateTableData.default)(data); + rows = (0, _stringifyTableData.default)(data); + const config = (0, _makeConfig.default)(rows, userConfig); + rows = (0, _truncateTableData.default)(data, config); + const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config); + rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config); + rows = (0, _alignTableData.default)(rows, config); + rows = (0, _padTableData.default)(rows, config); + const cellWidthIndex = (0, _calculateCellWidthIndex.default)(rows[0]); + return (0, _drawTable.default)(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine); +}; + +var _default = table; +exports.default = _default; +//# sourceMappingURL=table.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/table.js.flow b/tools/node_modules/eslint/node_modules/table/dist/table.js.flow new file mode 100644 index 00000000000000..1b68a51a29488e --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/table.js.flow @@ -0,0 +1,95 @@ +import drawTable from './drawTable'; +import calculateCellWidthIndex from './calculateCellWidthIndex'; +import makeConfig from './makeConfig'; +import calculateRowHeightIndex from './calculateRowHeightIndex'; +import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex'; +import alignTableData from './alignTableData'; +import padTableData from './padTableData'; +import validateTableData from './validateTableData'; +import stringifyTableData from './stringifyTableData'; +import truncateTableData from './truncateTableData'; + +/** + * @typedef {string} table~cell + */ + +/** + * @typedef {table~cell[]} table~row + */ + +/** + * @typedef {Object} table~columns + * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left). + * @property {number} width Column width (default: auto). + * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity). + * @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters + * @property {number} paddingLeft Cell content padding width left (default: 1). + * @property {number} paddingRight Cell content padding width right (default: 1). + */ + +/** + * @typedef {Object} table~border + * @property {string} topBody + * @property {string} topJoin + * @property {string} topLeft + * @property {string} topRight + * @property {string} bottomBody + * @property {string} bottomJoin + * @property {string} bottomLeft + * @property {string} bottomRight + * @property {string} bodyLeft + * @property {string} bodyRight + * @property {string} bodyJoin + * @property {string} joinBody + * @property {string} joinLeft + * @property {string} joinRight + * @property {string} joinJoin + */ + +/** + * Used to tell whether to draw a horizontal line. + * This callback is called for each non-content line of the table. + * The default behavior is to always return true. + * + * @typedef {Function} drawHorizontalLine + * @param {number} index + * @param {number} size + * @returns {boolean} + */ + +/** + * @typedef {Object} table~config + * @property {table~border} border + * @property {table~columns[]} columns Column specific configuration. + * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values. + * @property {table~drawHorizontalLine} drawHorizontalLine + */ + +/** + * Generates a text table. + * + * @param {table~row[]} data + * @param {table~config} userConfig + * @returns {string} + */ +export default (data, userConfig = {}) => { + let rows; + + validateTableData(data); + + rows = stringifyTableData(data); + + const config = makeConfig(rows, userConfig); + + rows = truncateTableData(data, config); + + const rowHeightIndex = calculateRowHeightIndex(rows, config); + + rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config); + rows = alignTableData(rows, config); + rows = padTableData(rows, config); + + const cellWidthIndex = calculateCellWidthIndex(rows[0]); + + return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/table.js.map b/tools/node_modules/eslint/node_modules/table/dist/table.js.map new file mode 100644 index 00000000000000..5268d98da504b3 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/table.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/table.js"],"names":["data","userConfig","rows","config","rowHeightIndex","cellWidthIndex","border","drawHorizontalLine"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;;;;AAIA;;;;AAIA;;;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;;AAmBA;;;;;;;;;;;AAWA;;;;;;;;AAQA;;;;;;;eAOgBA,I,EAAMC,UAAU,GAAG,E,KAAO;AACxC,MAAIC,IAAJ;AAEA,kCAAkBF,IAAlB;AAEAE,EAAAA,IAAI,GAAG,iCAAmBF,IAAnB,CAAP;AAEA,QAAMG,MAAM,GAAG,yBAAWD,IAAX,EAAiBD,UAAjB,CAAf;AAEAC,EAAAA,IAAI,GAAG,gCAAkBF,IAAlB,EAAwBG,MAAxB,CAAP;AAEA,QAAMC,cAAc,GAAG,sCAAwBF,IAAxB,EAA8BC,MAA9B,CAAvB;AAEAD,EAAAA,IAAI,GAAG,yCAA2BA,IAA3B,EAAiCE,cAAjC,EAAiDD,MAAjD,CAAP;AACAD,EAAAA,IAAI,GAAG,6BAAeA,IAAf,EAAqBC,MAArB,CAAP;AACAD,EAAAA,IAAI,GAAG,2BAAaA,IAAb,EAAmBC,MAAnB,CAAP;AAEA,QAAME,cAAc,GAAG,sCAAwBH,IAAI,CAAC,CAAD,CAA5B,CAAvB;AAEA,SAAO,wBAAUA,IAAV,EAAgBC,MAAM,CAACG,MAAvB,EAA+BD,cAA/B,EAA+CD,cAA/C,EAA+DD,MAAM,CAACI,kBAAtE,CAAP;AACD,C","sourcesContent":["import drawTable from './drawTable';\nimport calculateCellWidthIndex from './calculateCellWidthIndex';\nimport makeConfig from './makeConfig';\nimport calculateRowHeightIndex from './calculateRowHeightIndex';\nimport mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';\nimport alignTableData from './alignTableData';\nimport padTableData from './padTableData';\nimport validateTableData from './validateTableData';\nimport stringifyTableData from './stringifyTableData';\nimport truncateTableData from './truncateTableData';\n\n/**\n * @typedef {string} table~cell\n */\n\n/**\n * @typedef {table~cell[]} table~row\n */\n\n/**\n * @typedef {Object} table~columns\n * @property {string} alignment Cell content alignment (enum: left, center, right) (default: left).\n * @property {number} width Column width (default: auto).\n * @property {number} truncate Number of characters are which the content will be truncated (default: Infinity).\n * @property {boolean} wrapWord When true the text is broken at the nearest space or one of the special characters\n * @property {number} paddingLeft Cell content padding width left (default: 1).\n * @property {number} paddingRight Cell content padding width right (default: 1).\n */\n\n/**\n * @typedef {Object} table~border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * Used to tell whether to draw a horizontal line.\n * This callback is called for each non-content line of the table.\n * The default behavior is to always return true.\n *\n * @typedef {Function} drawHorizontalLine\n * @param {number} index\n * @param {number} size\n * @returns {boolean}\n */\n\n/**\n * @typedef {Object} table~config\n * @property {table~border} border\n * @property {table~columns[]} columns Column specific configuration.\n * @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.\n * @property {table~drawHorizontalLine} drawHorizontalLine\n */\n\n/**\n * Generates a text table.\n *\n * @param {table~row[]} data\n * @param {table~config} userConfig\n * @returns {string}\n */\nexport default (data, userConfig = {}) => {\n let rows;\n\n validateTableData(data);\n\n rows = stringifyTableData(data);\n\n const config = makeConfig(rows, userConfig);\n\n rows = truncateTableData(data, config);\n\n const rowHeightIndex = calculateRowHeightIndex(rows, config);\n\n rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);\n rows = alignTableData(rows, config);\n rows = padTableData(rows, config);\n\n const cellWidthIndex = calculateCellWidthIndex(rows[0]);\n\n return drawTable(rows, config.border, cellWidthIndex, rowHeightIndex, config.drawHorizontalLine);\n};\n"],"file":"table.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js b/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js index 748b41cca7be17..210a124bcbffe2 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js @@ -1,12 +1,11 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _lodash = require('lodash'); - -var _lodash2 = _interopRequireDefault(_lodash); +var _lodash = _interopRequireDefault(require("lodash")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -16,12 +15,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {Object} config * @returns {table~row[]} */ -exports.default = (rows, config) => { +const truncateTableData = (rows, config) => { return rows.map(cells => { return cells.map((content, index) => { - return _lodash2.default.truncate(content, { + return _lodash.default.truncate(content, { length: config.columns[index].truncate }); }); }); -}; \ No newline at end of file +}; + +var _default = truncateTableData; +exports.default = _default; +//# sourceMappingURL=truncateTableData.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js.flow b/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js.flow new file mode 100644 index 00000000000000..1052c92333033b --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js.flow @@ -0,0 +1,17 @@ +import _ from 'lodash'; + +/** + * @todo Make it work with ASCII content. + * @param {table~row[]} rows + * @param {Object} config + * @returns {table~row[]} + */ +export default (rows, config) => { + return rows.map((cells) => { + return cells.map((content, index) => { + return _.truncate(content, { + length: config.columns[index].truncate + }); + }); + }); +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js.map b/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js.map new file mode 100644 index 00000000000000..fbab35ea49bd14 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/truncateTableData.js"],"names":["rows","config","map","cells","content","index","_","truncate","length","columns"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;2BAMgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,OAAD,EAAUC,KAAV,KAAoB;AACnC,aAAOC,gBAAEC,QAAF,CAAWH,OAAX,EAAoB;AACzBI,QAAAA,MAAM,EAAEP,MAAM,CAACQ,OAAP,CAAeJ,KAAf,EAAsBE;AADL,OAApB,CAAP;AAGD,KAJM,CAAP;AAKD,GANM,CAAP;AAOD,C","sourcesContent":["import _ from 'lodash';\n\n/**\n * @todo Make it work with ASCII content.\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((content, index) => {\n return _.truncate(content, {\n length: config.columns[index].truncate\n });\n });\n });\n};\n"],"file":"truncateTableData.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js index 3ea3ddea8ff36d..40d812777b5017 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js @@ -14,7 +14,7 @@ var validate = (function() { var errs__0 = errors; var valid1 = true; for (var key0 in data) { - var isAdditional0 = !(false || validate.schema.properties[key0]); + var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0)); if (isAdditional0) { valid1 = false; var err = { @@ -344,7 +344,7 @@ var validate = (function() { var errs__0 = errors; var valid1 = true; for (var key0 in data) { - var isAdditional0 = !(false || validate.schema.properties[key0]); + var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight'); if (isAdditional0) { valid1 = false; var err = { @@ -385,8 +385,7 @@ var validate = (function() { if (equal(data1, schema1[i1])) { valid1 = true; break; - } - if (!valid1) { + } if (!valid1) { var err = { keyword: 'enum', dataPath: (dataPath || '') + '.alignment', @@ -641,7 +640,7 @@ var validate = (function() { })(); validate.schema = { "$id": "config.json", - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "border": { diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow new file mode 100644 index 00000000000000..14b9710135a17a --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow @@ -0,0 +1,34 @@ +// eslint-disable-next-line import/default +import validateConfig from '../dist/validateConfig'; +// eslint-disable-next-line import/default +import validateStreamConfig from '../dist/validateStreamConfig'; + +const validate = { + 'config.json': validateConfig, + 'streamConfig.json': validateStreamConfig +}; + +/** + * @param {string} schemaId + * @param {formatData~config} config + * @returns {undefined} + */ +export default (schemaId, config = {}) => { + if (!validate[schemaId](config)) { + const errors = validate[schemaId].errors.map((error) => { + return { + dataPath: error.dataPath, + message: error.message, + params: error.params, + schemaPath: error.schemaPath + }; + }); + + /* eslint-disable no-console */ + console.log('config', config); + console.log('errors', errors); + /* eslint-enable no-console */ + + throw new Error('Invalid config.'); + } +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.map b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.map new file mode 100644 index 00000000000000..43bebf7a69b1d1 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/validateConfig.js"],"names":["validate","validateConfig","validateStreamConfig","schemaId","config","errors","map","error","dataPath","message","params","schemaPath","console","log","Error"],"mappings":";;;;;;;AACA;;AAEA;;;;AAHA;AAEA;AAGA,MAAMA,QAAQ,GAAG;AACf,iBAAeC,uBADA;AAEf,uBAAqBC;AAFN,CAAjB;AAKA;;;;;;yBAKgBC,Q,EAAUC,MAAM,GAAG,E,KAAO;AACxC,MAAI,CAACJ,QAAQ,CAACG,QAAD,CAAR,CAAmBC,MAAnB,CAAL,EAAiC;AAC/B,UAAMC,MAAM,GAAGL,QAAQ,CAACG,QAAD,CAAR,CAAmBE,MAAnB,CAA0BC,GAA1B,CAA+BC,KAAD,IAAW;AACtD,aAAO;AACLC,QAAAA,QAAQ,EAAED,KAAK,CAACC,QADX;AAELC,QAAAA,OAAO,EAAEF,KAAK,CAACE,OAFV;AAGLC,QAAAA,MAAM,EAAEH,KAAK,CAACG,MAHT;AAILC,QAAAA,UAAU,EAAEJ,KAAK,CAACI;AAJb,OAAP;AAMD,KAPc,CAAf;AASA;;AACAC,IAAAA,OAAO,CAACC,GAAR,CAAY,QAAZ,EAAsBT,MAAtB;AACAQ,IAAAA,OAAO,CAACC,GAAR,CAAY,QAAZ,EAAsBR,MAAtB;AACA;;AAEA,UAAM,IAAIS,KAAJ,CAAU,iBAAV,CAAN;AACD;AACF,C","sourcesContent":["// eslint-disable-next-line import/default\nimport validateConfig from '../dist/validateConfig';\n// eslint-disable-next-line import/default\nimport validateStreamConfig from '../dist/validateStreamConfig';\n\nconst validate = {\n 'config.json': validateConfig,\n 'streamConfig.json': validateStreamConfig\n};\n\n/**\n * @param {string} schemaId\n * @param {formatData~config} config\n * @returns {undefined}\n */\nexport default (schemaId, config = {}) => {\n if (!validate[schemaId](config)) {\n const errors = validate[schemaId].errors.map((error) => {\n return {\n dataPath: error.dataPath,\n message: error.message,\n params: error.params,\n schemaPath: error.schemaPath\n };\n });\n\n /* eslint-disable no-console */\n console.log('config', config);\n console.log('errors', errors);\n /* eslint-enable no-console */\n\n throw new Error('Invalid config.');\n }\n};\n"],"file":"validateConfig.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateStreamConfig.js b/tools/node_modules/eslint/node_modules/table/dist/validateStreamConfig.js index 05c4b04c6bf835..ff10e5909ff4cd 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validateStreamConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/validateStreamConfig.js @@ -14,7 +14,7 @@ var validate = (function() { var errs__0 = errors; var valid1 = true; for (var key0 in data) { - var isAdditional0 = !(false || validate.schema.properties[key0]); + var isAdditional0 = !(false || validate.schema.properties.hasOwnProperty(key0)); if (isAdditional0) { valid1 = false; var err = { @@ -344,7 +344,7 @@ var validate = (function() { var errs__0 = errors; var valid1 = true; for (var key0 in data) { - var isAdditional0 = !(false || validate.schema.properties[key0]); + var isAdditional0 = !(false || key0 == 'alignment' || key0 == 'width' || key0 == 'wrapWord' || key0 == 'truncate' || key0 == 'paddingLeft' || key0 == 'paddingRight'); if (isAdditional0) { valid1 = false; var err = { @@ -385,8 +385,7 @@ var validate = (function() { if (equal(data1, schema1[i1])) { valid1 = true; break; - } - if (!valid1) { + } if (!valid1) { var err = { keyword: 'enum', dataPath: (dataPath || '') + '.alignment', @@ -628,7 +627,7 @@ var validate = (function() { })(); validate.schema = { "$id": "streamConfig.json", - "$schema": "http://json-schema.org/draft-06/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "border": { diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js index b5e103ce409c4d..124335cbfe794c 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js @@ -1,8 +1,9 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; /** * @typedef {string} cell @@ -16,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { * @param {column[]} rows * @returns {undefined} */ -exports.default = rows => { +const validateTableData = rows => { if (!Array.isArray(rows)) { throw new TypeError('Table data must be an array.'); } @@ -30,22 +31,68 @@ exports.default = rows => { } const columnNumber = rows[0].length; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - for (const cells of rows) { - if (!Array.isArray(cells)) { - throw new TypeError('Table row data must be an array.'); - } + try { + for (var _iterator = rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + const cells = _step.value; - if (cells.length !== columnNumber) { - throw new Error('Table must have a consistent number of cells.'); - } + if (!Array.isArray(cells)) { + throw new TypeError('Table row data must be an array.'); + } + + if (cells.length !== columnNumber) { + throw new Error('Table must have a consistent number of cells.'); + } // @todo Make an exception for newline characters. + // @see https://github.com/gajus/table/issues/9 + + + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; - // @todo Make an exception for newline characters. - // @see https://github.com/gajus/table/issues/9 - for (const cell of cells) { - if (/[\u0001-\u001A]/.test(cell)) { - throw new Error('Table data must not contain control characters.'); + try { + for (var _iterator2 = cells[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + const cell = _step2.value; + + // eslint-disable-next-line no-control-regex + if (/[\u0001-\u001A]/.test(cell)) { + throw new Error('Table data must not contain control characters.'); + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return != null) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; } } } -}; \ No newline at end of file +}; + +var _default = validateTableData; +exports.default = _default; +//# sourceMappingURL=validateTableData.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js.flow b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js.flow new file mode 100644 index 00000000000000..075eaf09249a45 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js.flow @@ -0,0 +1,46 @@ +/** + * @typedef {string} cell + */ + +/** + * @typedef {cell[]} validateData~column + */ + +/** + * @param {column[]} rows + * @returns {undefined} + */ +export default (rows) => { + if (!Array.isArray(rows)) { + throw new TypeError('Table data must be an array.'); + } + + if (rows.length === 0) { + throw new Error('Table must define at least one row.'); + } + + if (rows[0].length === 0) { + throw new Error('Table must define at least one column.'); + } + + const columnNumber = rows[0].length; + + for (const cells of rows) { + if (!Array.isArray(cells)) { + throw new TypeError('Table row data must be an array.'); + } + + if (cells.length !== columnNumber) { + throw new Error('Table must have a consistent number of cells.'); + } + + // @todo Make an exception for newline characters. + // @see https://github.com/gajus/table/issues/9 + for (const cell of cells) { + // eslint-disable-next-line no-control-regex + if (/[\u0001-\u001A]/.test(cell)) { + throw new Error('Table data must not contain control characters.'); + } + } + } +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js.map b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js.map new file mode 100644 index 00000000000000..bd892651ceb068 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/validateTableData.js"],"names":["rows","Array","isArray","TypeError","length","Error","columnNumber","cells","cell","test"],"mappings":";;;;;;;AAAA;;;;AAIA;;;;AAIA;;;;0BAIgBA,I,IAAS;AACvB,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,IAAd,CAAL,EAA0B;AACxB,UAAM,IAAIG,SAAJ,CAAc,8BAAd,CAAN;AACD;;AAED,MAAIH,IAAI,CAACI,MAAL,KAAgB,CAApB,EAAuB;AACrB,UAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;AACD;;AAED,MAAIL,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAR,KAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAIC,KAAJ,CAAU,wCAAV,CAAN;AACD;;AAED,QAAMC,YAAY,GAAGN,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAA7B;AAbuB;AAAA;AAAA;;AAAA;AAevB,yBAAoBJ,IAApB,8HAA0B;AAAA,YAAfO,KAAe;;AACxB,UAAI,CAACN,KAAK,CAACC,OAAN,CAAcK,KAAd,CAAL,EAA2B;AACzB,cAAM,IAAIJ,SAAJ,CAAc,kCAAd,CAAN;AACD;;AAED,UAAII,KAAK,CAACH,MAAN,KAAiBE,YAArB,EAAmC;AACjC,cAAM,IAAID,KAAJ,CAAU,+CAAV,CAAN;AACD,OAPuB,CASxB;AACA;;;AAVwB;AAAA;AAAA;;AAAA;AAWxB,8BAAmBE,KAAnB,mIAA0B;AAAA,gBAAfC,IAAe;;AACxB;AACA,cAAI,kBAAkBC,IAAlB,CAAuBD,IAAvB,CAAJ,EAAkC;AAChC,kBAAM,IAAIH,KAAJ,CAAU,iDAAV,CAAN;AACD;AACF;AAhBuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBzB;AAhCsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCxB,C","sourcesContent":["/**\n * @typedef {string} cell\n */\n\n/**\n * @typedef {cell[]} validateData~column\n */\n\n/**\n * @param {column[]} rows\n * @returns {undefined}\n */\nexport default (rows) => {\n if (!Array.isArray(rows)) {\n throw new TypeError('Table data must be an array.');\n }\n\n if (rows.length === 0) {\n throw new Error('Table must define at least one row.');\n }\n\n if (rows[0].length === 0) {\n throw new Error('Table must define at least one column.');\n }\n\n const columnNumber = rows[0].length;\n\n for (const cells of rows) {\n if (!Array.isArray(cells)) {\n throw new TypeError('Table row data must be an array.');\n }\n\n if (cells.length !== columnNumber) {\n throw new Error('Table must have a consistent number of cells.');\n }\n\n // @todo Make an exception for newline characters.\n // @see https://github.com/gajus/table/issues/9\n for (const cell of cells) {\n // eslint-disable-next-line no-control-regex\n if (/[\\u0001-\\u001A]/.test(cell)) {\n throw new Error('Table data must not contain control characters.');\n }\n }\n }\n};\n"],"file":"validateTableData.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapString.js b/tools/node_modules/eslint/node_modules/table/dist/wrapString.js index eae8ea051d95fc..c0dd8c8d6f7e12 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/wrapString.js +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapString.js @@ -1,16 +1,13 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _sliceAnsi = require('slice-ansi'); +var _sliceAnsi = _interopRequireDefault(require("slice-ansi")); -var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi); - -var _stringWidth = require('string-width'); - -var _stringWidth2 = _interopRequireDefault(_stringWidth); +var _stringWidth = _interopRequireDefault(require("string-width")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -25,18 +22,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {number} size * @returns {Array} */ -exports.default = (subject, size) => { +const wrapString = (subject, size) => { let subjectSlice; - subjectSlice = subject; - const chunks = []; do { - chunks.push((0, _sliceAnsi2.default)(subjectSlice, 0, size)); - - subjectSlice = (0, _sliceAnsi2.default)(subjectSlice, size).trim(); - } while ((0, _stringWidth2.default)(subjectSlice)); + chunks.push((0, _sliceAnsi.default)(subjectSlice, 0, size)); + subjectSlice = (0, _sliceAnsi.default)(subjectSlice, size).trim(); + } while ((0, _stringWidth.default)(subjectSlice)); return chunks; -}; \ No newline at end of file +}; + +var _default = wrapString; +exports.default = _default; +//# sourceMappingURL=wrapString.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapString.js.flow b/tools/node_modules/eslint/node_modules/table/dist/wrapString.js.flow new file mode 100644 index 00000000000000..bbb40721e34f99 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapString.js.flow @@ -0,0 +1,29 @@ +import slice from 'slice-ansi'; +import stringWidth from 'string-width'; + +/** + * Creates an array of strings split into groups the length of size. + * This function works with strings that contain ASCII characters. + * + * wrapText is different from would-be "chunk" implementation + * in that whitespace characters that occur on a chunk size limit are trimmed. + * + * @param {string} subject + * @param {number} size + * @returns {Array} + */ +export default (subject, size) => { + let subjectSlice; + + subjectSlice = subject; + + const chunks = []; + + do { + chunks.push(slice(subjectSlice, 0, size)); + + subjectSlice = slice(subjectSlice, size).trim(); + } while (stringWidth(subjectSlice)); + + return chunks; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapString.js.map b/tools/node_modules/eslint/node_modules/table/dist/wrapString.js.map new file mode 100644 index 00000000000000..3d1d7b3c0825a7 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapString.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/wrapString.js"],"names":["subject","size","subjectSlice","chunks","push","trim"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;;;;;;;oBAWgBA,O,EAASC,I,KAAS;AAChC,MAAIC,YAAJ;AAEAA,EAAAA,YAAY,GAAGF,OAAf;AAEA,QAAMG,MAAM,GAAG,EAAf;;AAEA,KAAG;AACDA,IAAAA,MAAM,CAACC,IAAP,CAAY,wBAAMF,YAAN,EAAoB,CAApB,EAAuBD,IAAvB,CAAZ;AAEAC,IAAAA,YAAY,GAAG,wBAAMA,YAAN,EAAoBD,IAApB,EAA0BI,IAA1B,EAAf;AACD,GAJD,QAIS,0BAAYH,YAAZ,CAJT;;AAMA,SAAOC,MAAP;AACD,C","sourcesContent":["import slice from 'slice-ansi';\nimport stringWidth from 'string-width';\n\n/**\n * Creates an array of strings split into groups the length of size.\n * This function works with strings that contain ASCII characters.\n *\n * wrapText is different from would-be \"chunk\" implementation\n * in that whitespace characters that occur on a chunk size limit are trimmed.\n *\n * @param {string} subject\n * @param {number} size\n * @returns {Array}\n */\nexport default (subject, size) => {\n let subjectSlice;\n\n subjectSlice = subject;\n\n const chunks = [];\n\n do {\n chunks.push(slice(subjectSlice, 0, size));\n\n subjectSlice = slice(subjectSlice, size).trim();\n } while (stringWidth(subjectSlice));\n\n return chunks;\n};\n"],"file":"wrapString.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js index c0dd9df4b05d76..790b20bc00414a 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js @@ -1,16 +1,13 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; -var _sliceAnsi = require('slice-ansi'); +var _sliceAnsi = _interopRequireDefault(require("slice-ansi")); -var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi); - -var _stringWidth = require('string-width'); - -var _stringWidth2 = _interopRequireDefault(_stringWidth); +var _stringWidth = _interopRequireDefault(require("string-width")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -19,34 +16,32 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @param {number} size * @returns {Array} */ -exports.default = (input, size) => { +const wrapWord = (input, size) => { let subject; - subject = input; + const chunks = []; // https://regex101.com/r/gY5kZ1/1 - const chunks = []; - - // https://regex101.com/r/gY5kZ1/1 const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))'); do { let chunk; - chunk = subject.match(re); if (chunk) { chunk = chunk[0]; - - subject = (0, _sliceAnsi2.default)(subject, (0, _stringWidth2.default)(chunk)); - + subject = (0, _sliceAnsi.default)(subject, (0, _stringWidth.default)(chunk)); chunk = chunk.trim(); } else { - chunk = (0, _sliceAnsi2.default)(subject, 0, size); - subject = (0, _sliceAnsi2.default)(subject, size); + chunk = (0, _sliceAnsi.default)(subject, 0, size); + subject = (0, _sliceAnsi.default)(subject, size); } chunks.push(chunk); - } while ((0, _stringWidth2.default)(subject)); + } while ((0, _stringWidth.default)(subject)); return chunks; -}; \ No newline at end of file +}; + +var _default = wrapWord; +exports.default = _default; +//# sourceMappingURL=wrapWord.js.map \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js.flow b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js.flow new file mode 100644 index 00000000000000..02a8d45ea4c9bd --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js.flow @@ -0,0 +1,39 @@ +import slice from 'slice-ansi'; +import stringWidth from 'string-width'; + +/** + * @param {string} input + * @param {number} size + * @returns {Array} + */ +export default (input, size) => { + let subject; + + subject = input; + + const chunks = []; + + // https://regex101.com/r/gY5kZ1/1 + const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))'); + + do { + let chunk; + + chunk = subject.match(re); + + if (chunk) { + chunk = chunk[0]; + + subject = slice(subject, stringWidth(chunk)); + + chunk = chunk.trim(); + } else { + chunk = slice(subject, 0, size); + subject = slice(subject, size); + } + + chunks.push(chunk); + } while (stringWidth(subject)); + + return chunks; +}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js.map b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js.map new file mode 100644 index 00000000000000..5e7aa9ccb73948 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/wrapWord.js"],"names":["input","size","subject","chunks","re","RegExp","chunk","match","trim","push"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;kBAKgBA,K,EAAOC,I,KAAS;AAC9B,MAAIC,OAAJ;AAEAA,EAAAA,OAAO,GAAGF,KAAV;AAEA,QAAMG,MAAM,GAAG,EAAf,CAL8B,CAO9B;;AACA,QAAMC,EAAE,GAAG,IAAIC,MAAJ,CAAW,WAAWJ,IAAX,GAAkB,mBAAlB,IAAyCA,IAAI,GAAG,CAAhD,IAAqD,wBAAhE,CAAX;;AAEA,KAAG;AACD,QAAIK,KAAJ;AAEAA,IAAAA,KAAK,GAAGJ,OAAO,CAACK,KAAR,CAAcH,EAAd,CAAR;;AAEA,QAAIE,KAAJ,EAAW;AACTA,MAAAA,KAAK,GAAGA,KAAK,CAAC,CAAD,CAAb;AAEAJ,MAAAA,OAAO,GAAG,wBAAMA,OAAN,EAAe,0BAAYI,KAAZ,CAAf,CAAV;AAEAA,MAAAA,KAAK,GAAGA,KAAK,CAACE,IAAN,EAAR;AACD,KAND,MAMO;AACLF,MAAAA,KAAK,GAAG,wBAAMJ,OAAN,EAAe,CAAf,EAAkBD,IAAlB,CAAR;AACAC,MAAAA,OAAO,GAAG,wBAAMA,OAAN,EAAeD,IAAf,CAAV;AACD;;AAEDE,IAAAA,MAAM,CAACM,IAAP,CAAYH,KAAZ;AACD,GAjBD,QAiBS,0BAAYJ,OAAZ,CAjBT;;AAmBA,SAAOC,MAAP;AACD,C","sourcesContent":["import slice from 'slice-ansi';\nimport stringWidth from 'string-width';\n\n/**\n * @param {string} input\n * @param {number} size\n * @returns {Array}\n */\nexport default (input, size) => {\n let subject;\n\n subject = input;\n\n const chunks = [];\n\n // https://regex101.com/r/gY5kZ1/1\n const re = new RegExp('(^.{1,' + size + '}(\\\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\\\\\|/|_|\\\\.|,|;|-))');\n\n do {\n let chunk;\n\n chunk = subject.match(re);\n\n if (chunk) {\n chunk = chunk[0];\n\n subject = slice(subject, stringWidth(chunk));\n\n chunk = chunk.trim();\n } else {\n chunk = slice(subject, 0, size);\n subject = slice(subject, size);\n }\n\n chunks.push(chunk);\n } while (stringWidth(subject));\n\n return chunks;\n};\n"],"file":"wrapWord.js"} \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/package.json b/tools/node_modules/eslint/node_modules/table/package.json index a84ae5396b0236..3e6fcb12d1985a 100644 --- a/tools/node_modules/eslint/node_modules/table/package.json +++ b/tools/node_modules/eslint/node_modules/table/package.json @@ -9,36 +9,48 @@ }, "bundleDependencies": false, "dependencies": { - "ajv": "^6.0.1", - "ajv-keywords": "^3.0.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", + "ajv": "^6.5.3", + "lodash": "^4.17.10", "slice-ansi": "1.0.0", "string-width": "^2.1.1" }, "deprecated": false, "description": "Formats data into a string table.", "devDependencies": { + "@babel/cli": "^7.1.2", + "@babel/core": "^7.1.2", + "@babel/node": "^7.0.0", + "@babel/plugin-transform-flow-strip-types": "^7.0.0", + "@babel/preset-env": "^7.1.0", + "@babel/register": "^7.0.0", "ajv-cli": "^3.0.0", - "babel": "^6.23.0", - "babel-cli": "^6.26.0", - "babel-core": "^6.26.0", - "babel-plugin-istanbul": "^4.1.5", - "babel-preset-es2015-node4": "^2.1.1", - "babel-register": "^6.26.0", - "chai": "^4.1.2", - "eslint": "^4.7.2", - "eslint-config-canonical": "^9.3.1", - "gitdown": "^2.5.1", - "husky": "^0.14.3", - "mocha": "^5.0.0", - "nyc": "^11.2.1", - "sinon": "^4.0.0" + "ajv-keywords": "^3.2.0", + "babel-plugin-istanbul": "^5.1.0", + "babel-plugin-transform-export-default-name": "^2.0.4", + "chai": "^4.2.0", + "chalk": "^2.4.1", + "coveralls": "^3.0.2", + "eslint": "^5.6.1", + "eslint-config-canonical": "^13.0.0", + "flow-bin": "^0.81.0", + "flow-copy-source": "^2.0.2", + "gitdown": "^2.5.4", + "husky": "^1.0.1", + "mocha": "^5.2.0", + "nyc": "^13.1.0", + "semantic-release": "^15.9.16", + "sinon": "^6.3.4" }, "engines": { - "node": ">=4.0.0" + "node": ">=6.0.0" }, "homepage": "https://github.com/gajus/table#readme", + "husky": { + "hooks": { + "post-commit": "npm run create-readme && git add README.md && git commit -m 'docs: generate docs' --no-verify", + "pre-commit": "npm run lint && npm run test && npm run build" + } + }, "keywords": [ "ascii", "text", @@ -51,12 +63,14 @@ "name": "table", "nyc": { "include": [ - "src/*.js" + "src/**/*.js" ], "instrument": false, - "lines": 70, + "reporter": [ + "text-lcov" + ], "require": [ - "babel-register" + "@babel/register" ], "sourceMap": false }, @@ -65,13 +79,11 @@ "url": "git+https://github.com/gajus/table.git" }, "scripts": { - "build": "rm -fr ./dist && NODE_ENV=production babel --copy-files ./src --out-dir ./dist && npm run make-validators", - "lint": "npm run build && eslint ./src ./tests", - "make-readme": "gitdown ./.README/README.md --output-file ./README.md", - "make-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -c ajv-keywords/keywords/typeof -o dist/validateConfig.js && ajv compile --all-errors --inline-refs=false -s src/schemas/streamConfig -c ajv-keywords/keywords/typeof -o dist/validateStreamConfig.js", - "precommit": "npm run lint && npm run test", - "prepublish": "NODE_ENV=production npm run build", - "test": "npm run build && nyc --check-coverage mocha" + "build": "rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && npm run create-validators && flow-copy-source src dist", + "create-readme": "gitdown ./.README/README.md --output-file ./README.md", + "create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -c ajv-keywords/keywords/typeof -o dist/validateConfig.js && ajv compile --all-errors --inline-refs=false -s src/schemas/streamConfig -c ajv-keywords/keywords/typeof -o dist/validateStreamConfig.js", + "lint": "npm run build && eslint ./src ./test && flow", + "test": "mocha --require @babel/register" }, - "version": "4.0.3" + "version": "5.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/tslib/CopyrightNotice.txt b/tools/node_modules/eslint/node_modules/tslib/CopyrightNotice.txt index 4d8bc99e360ea5..0f6db1f75f714e 100644 --- a/tools/node_modules/eslint/node_modules/tslib/CopyrightNotice.txt +++ b/tools/node_modules/eslint/node_modules/tslib/CopyrightNotice.txt @@ -1,14 +1,15 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + diff --git a/tools/node_modules/eslint/node_modules/tslib/LICENSE.txt b/tools/node_modules/eslint/node_modules/tslib/LICENSE.txt index 2df8c87fda4e00..8746124b277914 100644 --- a/tools/node_modules/eslint/node_modules/tslib/LICENSE.txt +++ b/tools/node_modules/eslint/node_modules/tslib/LICENSE.txt @@ -1,55 +1,55 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and + +You must cause any modified files to carry prominent notices stating that You changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/tools/node_modules/eslint/node_modules/tslib/README.md b/tools/node_modules/eslint/node_modules/tslib/README.md index c9819aa2cccd26..ae595fe2342253 100644 --- a/tools/node_modules/eslint/node_modules/tslib/README.md +++ b/tools/node_modules/eslint/node_modules/tslib/README.md @@ -1,134 +1,134 @@ -# tslib - -This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions. - -This library is primarily used by the `--importHelpers` flag in TypeScript. -When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: - -```ts -var __assign = (this && this.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; -exports.x = {}; -exports.y = __assign({}, exports.x); - -``` - -will instead be emitted as something like the following: - -```ts -var tslib_1 = require("tslib"); -exports.x = {}; -exports.y = tslib_1.__assign({}, exports.x); -``` - -Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. -For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. - -# Installing - -For the latest stable version, run: - -## npm - -```sh -# TypeScript 2.3.3 or later -npm install --save tslib - -# TypeScript 2.3.2 or earlier -npm install --save tslib@1.6.1 -``` - -## bower - -```sh -# TypeScript 2.3.3 or later -bower install tslib - -# TypeScript 2.3.2 or earlier -bower install tslib@1.6.1 -``` - -## JSPM - -```sh -# TypeScript 2.3.3 or later -jspm install tslib - -# TypeScript 2.3.2 or earlier -jspm install tslib@1.6.1 -``` - -# Usage - -Set the `importHelpers` compiler option on the command line: - -``` -tsc --importHelpers file.ts -``` - -or in your tsconfig.json: - -```json -{ - "compilerOptions": { - "importHelpers": true - } -} -``` - -#### For bower and JSPM users - -You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: - -```json -{ - "compilerOptions": { - "module": "amd", - "importHelpers": true, - "baseUrl": "./", - "paths": { - "tslib" : ["bower_components/tslib/tslib.d.ts"] - } - } -} -``` - -For JSPM users: - -```json -{ - "compilerOptions": { - "module": "system", - "importHelpers": true, - "baseUrl": "./", - "paths": { - "tslib" : ["jspm_packages/npm/tslib@1.9.3/tslib.d.ts"] - } - } -} -``` - - -# Contribute - -There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. - -* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. -* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). -* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). -* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. -* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). -* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)). - -# Documentation - -* [Quick tutorial](http://www.typescriptlang.org/Tutorial) -* [Programming handbook](http://www.typescriptlang.org/Handbook) -* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) -* [Homepage](http://www.typescriptlang.org/) +# tslib + +This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions. + +This library is primarily used by the `--importHelpers` flag in TypeScript. +When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: + +```ts +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +exports.x = {}; +exports.y = __assign({}, exports.x); + +``` + +will instead be emitted as something like the following: + +```ts +var tslib_1 = require("tslib"); +exports.x = {}; +exports.y = tslib_1.__assign({}, exports.x); +``` + +Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. +For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. + +# Installing + +For the latest stable version, run: + +## npm + +```sh +# TypeScript 2.3.3 or later +npm install --save tslib + +# TypeScript 2.3.2 or earlier +npm install --save tslib@1.6.1 +``` + +## bower + +```sh +# TypeScript 2.3.3 or later +bower install tslib + +# TypeScript 2.3.2 or earlier +bower install tslib@1.6.1 +``` + +## JSPM + +```sh +# TypeScript 2.3.3 or later +jspm install tslib + +# TypeScript 2.3.2 or earlier +jspm install tslib@1.6.1 +``` + +# Usage + +Set the `importHelpers` compiler option on the command line: + +``` +tsc --importHelpers file.ts +``` + +or in your tsconfig.json: + +```json +{ + "compilerOptions": { + "importHelpers": true + } +} +``` + +#### For bower and JSPM users + +You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: + +```json +{ + "compilerOptions": { + "module": "amd", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["bower_components/tslib/tslib.d.ts"] + } + } +} +``` + +For JSPM users: + +```json +{ + "compilerOptions": { + "module": "system", + "importHelpers": true, + "baseUrl": "./", + "paths": { + "tslib" : ["jspm_packages/npm/tslib@1.9.3/tslib.d.ts"] + } + } +} +``` + + +# Contribute + +There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. + +* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. +* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). +* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). +* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. +* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). +* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)). + +# Documentation + +* [Quick tutorial](http://www.typescriptlang.org/Tutorial) +* [Programming handbook](http://www.typescriptlang.org/Handbook) +* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) +* [Homepage](http://www.typescriptlang.org/) diff --git a/tools/node_modules/eslint/node_modules/tslib/tslib.d.ts b/tools/node_modules/eslint/node_modules/tslib/tslib.d.ts index 16be0f542deba9..c4a0e11584cd60 100644 --- a/tools/node_modules/eslint/node_modules/tslib/tslib.d.ts +++ b/tools/node_modules/eslint/node_modules/tslib/tslib.d.ts @@ -1,33 +1,33 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -export declare function __extends(d: Function, b: Function): void; -export declare function __assign(t: any, ...sources: any[]): any; -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; -export declare function __param(paramIndex: number, decorator: Function): Function; -export declare function __metadata(metadataKey: any, metadataValue: any): Function; -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; -export declare function __generator(thisArg: any, body: Function): any; -export declare function __exportStar(m: any, exports: any): void; -export declare function __values(o: any): any; -export declare function __read(o: any, n?: number): any[]; -export declare function __spread(...args: any[]): any[]; -export declare function __await(v: any): any; -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; -export declare function __asyncDelegator(o: any): any; -export declare function __asyncValues(o: any): any; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; -export declare function __importStar(mod: T): T; -export declare function __importDefault(mod: T): T | { default: T }; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +export declare function __extends(d: Function, b: Function): void; +export declare function __assign(t: any, ...sources: any[]): any; +export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; +export declare function __param(paramIndex: number, decorator: Function): Function; +export declare function __metadata(metadataKey: any, metadataValue: any): Function; +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; +export declare function __generator(thisArg: any, body: Function): any; +export declare function __exportStar(m: any, exports: any): void; +export declare function __values(o: any): any; +export declare function __read(o: any, n?: number): any[]; +export declare function __spread(...args: any[]): any[]; +export declare function __await(v: any): any; +export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; +export declare function __asyncDelegator(o: any): any; +export declare function __asyncValues(o: any): any; +export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; +export declare function __importStar(mod: T): T; +export declare function __importDefault(mod: T): T | { default: T }; diff --git a/tools/node_modules/eslint/node_modules/tslib/tslib.es6.js b/tools/node_modules/eslint/node_modules/tslib/tslib.es6.js index 45b35893ca4ca1..6da273e26024f1 100644 --- a/tools/node_modules/eslint/node_modules/tslib/tslib.es6.js +++ b/tools/node_modules/eslint/node_modules/tslib/tslib.es6.js @@ -1,186 +1,186 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) - t[p[i]] = s[p[i]]; - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export function __exportStar(m, exports) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -export function __values(o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) return m.call(o); - return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export function __exportStar(m, exports) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} + +export function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result.default = mod; + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} diff --git a/tools/node_modules/eslint/node_modules/tslib/tslib.js b/tools/node_modules/eslint/node_modules/tslib/tslib.js index a74e93b05181c3..b0b1ff3ab8e776 100644 --- a/tools/node_modules/eslint/node_modules/tslib/tslib.js +++ b/tools/node_modules/eslint/node_modules/tslib/tslib.js @@ -1,243 +1,243 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) - t[p[i]] = s[p[i]]; - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function (m, exports) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; - }; - - __values = function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) return m.call(o); - return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); -}); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global global, define, System, Reflect, Promise */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if (typeof module === "object" && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + + __extends = function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function (m, exports) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + }; + + __values = function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + __importStar = function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); +}); diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 09880a0388c598..7b47dbd691f1ce 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -43,12 +43,12 @@ "path-is-inside": "^1.0.2", "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^2.0.0", + "regexpp": "^2.0.1", "require-uncached": "^1.0.3", "semver": "^5.5.1", "strip-ansi": "^4.0.0", "strip-json-comments": "^2.0.1", - "table": "^4.0.3", + "table": "^5.0.2", "text-table": "^0.2.0" }, "deprecated": false, @@ -69,7 +69,7 @@ "eslint-plugin-eslint-plugin": "^1.2.0", "eslint-plugin-node": "^7.0.1", "eslint-plugin-rulesdir": "^0.1.0", - "eslint-release": "^0.11.1", + "eslint-release": "^1.0.0", "eslint-rule-composer": "^0.3.0", "eslump": "^1.6.2", "esprima": "^4.0.1", @@ -120,20 +120,20 @@ "url": "git+https://github.com/eslint/eslint.git" }, "scripts": { - "alpharelease": "node Makefile.js prerelease -- alpha", - "betarelease": "node Makefile.js prerelease -- beta", "browserify": "node Makefile.js browserify", - "ci-release": "node Makefile.js ciRelease", "coveralls": "cat ./coverage/lcov.info | coveralls", "docs": "node Makefile.js docs", "fuzz": "node Makefile.js fuzz", + "generate-alpharelease": "node Makefile.js generatePrerelease -- alpha", + "generate-betarelease": "node Makefile.js generatePrerelease -- beta", + "generate-rcrelease": "node Makefile.js generatePrerelease -- rc", + "generate-release": "node Makefile.js generateRelease", "gensite": "node Makefile.js gensite", "lint": "node Makefile.js lint", "perf": "node Makefile.js perf", "profile": "beefy tests/bench/bench.js --open -- -t brfs -t ./tests/bench/xform-rules.js -r espree", - "rcrelease": "node Makefile.js prerelease -- rc", - "release": "node Makefile.js release", + "publish-release": "node Makefile.js publishRelease", "test": "node Makefile.js test" }, - "version": "5.6.1" + "version": "5.8.0" } \ No newline at end of file diff --git a/tools/pip/.gitignore b/tools/pip/.gitignore new file mode 100644 index 00000000000000..03eb26e01302fd --- /dev/null +++ b/tools/pip/.gitignore @@ -0,0 +1,2 @@ +*.pyc +site-packages \ No newline at end of file diff --git a/tools/pip/sitecustomize.py b/tools/pip/sitecustomize.py new file mode 100644 index 00000000000000..aa8087c8989604 --- /dev/null +++ b/tools/pip/sitecustomize.py @@ -0,0 +1,3 @@ +import os +import site +site.addsitedir(os.path.dirname(os.path.realpath(__file__)) + '/site-packages') diff --git a/tools/test.py b/tools/test.py index c5c9fb53c07626..cd361196653043 100755 --- a/tools/test.py +++ b/tools/test.py @@ -131,7 +131,7 @@ def RunSingle(self, parallel, thread_id): test = self.sequential_queue.get_nowait() except Empty: return - case = test.case + case = test case.thread_id = thread_id self.lock.acquire() self.AboutToRun(case) @@ -780,10 +780,10 @@ def CarCdr(path): class TestConfiguration(object): - - def __init__(self, context, root): + def __init__(self, context, root, section): self.context = context self.root = root + self.section = section def Contains(self, path, file): if len(path) > len(file): @@ -794,7 +794,9 @@ def Contains(self, path, file): return True def GetTestStatus(self, sections, defs): - pass + status_file = join(self.root, '%s.status' % self.section) + if exists(status_file): + ReadConfigurationInto(status_file, sections, defs) class TestSuite(object): @@ -848,15 +850,15 @@ def GetTestStatus(self, context, sections, defs): class LiteralTestSuite(TestSuite): - - def __init__(self, tests): + def __init__(self, tests_repos, test_root): super(LiteralTestSuite, self).__init__('root') - self.tests = tests + self.tests_repos = tests_repos + self.test_root = test_root def GetBuildRequirements(self, path, context): (name, rest) = CarCdr(path) result = [ ] - for test in self.tests: + for test in self.tests_repos: if not name or name.match(test.GetName()): result += test.GetBuildRequirements(rest, context) return result @@ -864,7 +866,7 @@ def GetBuildRequirements(self, path, context): def ListTests(self, current_path, path, context, arch, mode): (name, rest) = CarCdr(path) result = [ ] - for test in self.tests: + for test in self.tests_repos: test_name = test.GetName() if not name or name.match(test_name): full_path = current_path + [test_name] @@ -873,8 +875,11 @@ def ListTests(self, current_path, path, context, arch, mode): return result def GetTestStatus(self, context, sections, defs): - for test in self.tests: - test.GetTestStatus(context, sections, defs) + # Just read the test configuration from root_path/root.status. + root = TestConfiguration(context, self.test_root, 'root') + root.GetTestStatus(sections, defs) + for tests_repos in self.tests_repos: + tests_repos.GetTestStatus(context, sections, defs) TIMEOUT_SCALEFACTOR = { @@ -934,6 +939,7 @@ def RunTestCases(cases_to_run, progress, tasks, flaky_tests_mode): # ------------------------------------------- +RUN = 'run' SKIP = 'skip' FAIL = 'fail' PASS = 'pass' @@ -963,8 +969,8 @@ def __init__(self, name): self.name = name def GetOutcomes(self, env, defs): - if self.name in env: return ListSet([env[self.name]]) - else: return Nothing() + if self.name in env: return set([env[self.name]]) + else: return set() class Outcome(Expression): @@ -976,45 +982,7 @@ def GetOutcomes(self, env, defs): if self.name in defs: return defs[self.name].GetOutcomes(env, defs) else: - return ListSet([self.name]) - - -class Set(object): - pass - - -class ListSet(Set): - - def __init__(self, elms): - self.elms = elms - - def __str__(self): - return "ListSet%s" % str(self.elms) - - def Intersect(self, that): - if not isinstance(that, ListSet): - return that.Intersect(self) - return ListSet([ x for x in self.elms if x in that.elms ]) - - def Union(self, that): - if not isinstance(that, ListSet): - return that.Union(self) - return ListSet(self.elms + [ x for x in that.elms if x not in self.elms ]) - - def IsEmpty(self): - return len(self.elms) == 0 - - -class Nothing(Set): - - def Intersect(self, that): - return self - - def Union(self, that): - return that - - def IsEmpty(self): - return True + return set([self.name]) class Operation(Expression): @@ -1030,21 +998,23 @@ def Evaluate(self, env, defs): elif self.op == 'if': return False elif self.op == '==': - inter = self.left.GetOutcomes(env, defs).Intersect(self.right.GetOutcomes(env, defs)) - return not inter.IsEmpty() + inter = self.left.GetOutcomes(env, defs) & self.right.GetOutcomes(env, defs) + return bool(inter) else: assert self.op == '&&' return self.left.Evaluate(env, defs) and self.right.Evaluate(env, defs) def GetOutcomes(self, env, defs): if self.op == '||' or self.op == ',': - return self.left.GetOutcomes(env, defs).Union(self.right.GetOutcomes(env, defs)) + return self.left.GetOutcomes(env, defs) | self.right.GetOutcomes(env, defs) elif self.op == 'if': - if self.right.Evaluate(env, defs): return self.left.GetOutcomes(env, defs) - else: return Nothing() + if self.right.Evaluate(env, defs): + return self.left.GetOutcomes(env, defs) + else: + return set() else: assert self.op == '&&' - return self.left.GetOutcomes(env, defs).Intersect(self.right.GetOutcomes(env, defs)) + return self.left.GetOutcomes(env, defs) & self.right.GetOutcomes(env, defs) def IsAlpha(str): @@ -1223,15 +1193,6 @@ def ParseCondition(expr): return ast -class ClassifiedTest(object): - - def __init__(self, case, outcomes): - self.case = case - self.outcomes = outcomes - self.parallel = self.case.parallel - self.disable_core_files = self.case.disable_core_files - - class Configuration(object): """The parsed contents of a configuration file""" @@ -1240,23 +1201,18 @@ def __init__(self, sections, defs): self.defs = defs def ClassifyTests(self, cases, env): - sections = [s for s in self.sections if s.condition.Evaluate(env, self.defs)] + sections = [ s for s in self.sections if s.condition.Evaluate(env, self.defs) ] all_rules = reduce(list.__add__, [s.rules for s in sections], []) unused_rules = set(all_rules) - result = [ ] - all_outcomes = set([]) + result = [] for case in cases: matches = [ r for r in all_rules if r.Contains(case.path) ] - outcomes = set([]) - for rule in matches: - outcomes = outcomes.union(rule.GetOutcomes(env, self.defs)) - unused_rules.discard(rule) - if not outcomes: - outcomes = [PASS] - case.outcomes = outcomes - all_outcomes = all_outcomes.union(outcomes) - result.append(ClassifiedTest(case, outcomes)) - return (result, list(unused_rules), all_outcomes) + outcomes_list = [ r.GetOutcomes(env, self.defs) for r in matches ] + outcomes = reduce(set.union, outcomes_list, set()) + unused_rules.difference_update(matches) + case.outcomes = set(outcomes) or set([PASS]) + result.append(case) + return result, unused_rules class Section(object): @@ -1281,9 +1237,7 @@ def __init__(self, raw_path, path, value): self.value = value def GetOutcomes(self, env, defs): - set = self.value.GetOutcomes(env, defs) - assert isinstance(set, ListSet) - return set.elms + return self.value.GetOutcomes(env, defs) def Contains(self, path): if len(self.path) > len(path): @@ -1427,7 +1381,8 @@ def ProcessOptions(options): options.arch = options.arch.split(',') options.mode = options.mode.split(',') options.run = options.run.split(',') - options.skip_tests = options.skip_tests.split(',') + # Split at commas and filter out all the empty strings. + options.skip_tests = filter(bool, options.skip_tests.split(',')) if options.run == [""]: options.run = None elif len(options.run) != 2: @@ -1450,7 +1405,7 @@ def ProcessOptions(options): # tends to exaggerate the number of available cpus/cores. cores = os.environ.get('JOBS') options.j = int(cores) if cores is not None else multiprocessing.cpu_count() - if options.flaky_tests not in ["run", "skip", "dontcare"]: + if options.flaky_tests not in [RUN, SKIP, DONTCARE]: print "Unknown flaky-tests mode %s" % options.flaky_tests return False return True @@ -1464,18 +1419,6 @@ def ProcessOptions(options): * %(fail)4d tests are expected to fail that we should fix\ """ -def PrintReport(cases): - def IsFailOk(o): - return (len(o) == 2) and (FAIL in o) and (OKAY in o) - unskipped = [c for c in cases if not SKIP in c.outcomes] - print REPORT_TEMPLATE % { - 'total': len(cases), - 'skipped': len(cases) - len(unskipped), - 'pass': len([t for t in unskipped if list(t.outcomes) == [PASS]]), - 'fail_ok': len([t for t in unskipped if IsFailOk(t.outcomes)]), - 'fail': len([t for t in unskipped if list(t.outcomes) == [FAIL]]) - } - class Pattern(object): @@ -1534,6 +1477,14 @@ def FormatTime(d): return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis) +def FormatTimedelta(td): + if hasattr(td.total, 'total_seconds'): + d = td.total_seconds() + else: # python2.6 compat + d = td.seconds + (td.microseconds / 10.0**6) + return FormatTime(d) + + def PrintCrashed(code): if utils.IsWindows(): return "CRASHED" @@ -1547,7 +1498,6 @@ def PrintCrashed(code): IGNORED_SUITES = [ 'addons', 'addons-napi', - 'code-cache', 'doctool', 'internet', 'pummel', @@ -1599,7 +1549,7 @@ def Main(): repositories = [TestRepository(join(workspace, 'test', name)) for name in suites] repositories += [TestRepository(a) for a in options.suite] - root = LiteralTestSuite(repositories) + root = LiteralTestSuite(repositories, test_root) paths = ArgsToTestPaths(test_root, args, suites) # Check for --valgrind option. If enabled, we overwrite the special @@ -1670,8 +1620,7 @@ def Main(): } test_list = root.ListTests([], path, context, arch, mode) unclassified_tests += test_list - (cases, unused_rules, _) = ( - config.ClassifyTests(test_list, env)) + cases, unused_rules = config.ClassifyTests(test_list, env) if globally_unused_rules is None: globally_unused_rules = set(unused_rules) else: @@ -1713,25 +1662,32 @@ def Main(): print "Could not create the temporary directory", options.temp_dir sys.exit(1) - if options.report: - PrintReport(all_cases) - - result = None - def DoSkip(case): - # A list of tests that should be skipped can be provided. This is - # useful for tests that fail in some environments, e.g., under coverage. - if options.skip_tests != [""]: - if [ st for st in options.skip_tests if st in case.case.file ]: - return True - if SKIP in case.outcomes or SLOW in case.outcomes: + def should_keep(case): + if any((s in case.file) for s in options.skip_tests): + return False + elif SKIP in case.outcomes: + return False + elif (options.flaky_tests == SKIP) and (set([SLOW, FLAKY]) & case.outcomes): + return False + else: return True - return FLAKY in case.outcomes and options.flaky_tests == SKIP - cases_to_run = [ c for c in all_cases if not DoSkip(c) ] + + cases_to_run = filter(should_keep, all_cases) + + if options.report: + print(REPORT_TEMPLATE % { + 'total': len(all_cases), + 'skipped': len(all_cases) - len(cases_to_run), + 'pass': len([t for t in cases_to_run if PASS in t.outcomes]), + 'fail_ok': len([t for t in cases_to_run if t.outcomes == set([FAIL, OKAY])]), + 'fail': len([t for t in cases_to_run if t.outcomes == set([FAIL])]) + }) + if options.run is not None: # Must ensure the list of tests is sorted before selecting, to avoid # silent errors if this file is changed to list the tests in a way that # can be different in different machines - cases_to_run.sort(key=lambda c: (c.case.arch, c.case.mode, c.case.file)) + cases_to_run.sort(key=lambda c: (c.arch, c.mode, c.file)) cases_to_run = [ cases_to_run[i] for i in xrange(options.run[0], len(cases_to_run), @@ -1756,13 +1712,11 @@ def DoSkip(case): # test output. print sys.stderr.write("--- Total time: %s ---\n" % FormatTime(duration)) - timed_tests = [ t.case for t in cases_to_run if not t.case.duration is None ] + timed_tests = [ t for t in cases_to_run if not t.duration is None ] timed_tests.sort(lambda a, b: a.CompareTime(b)) - index = 1 - for entry in timed_tests[:20]: - t = FormatTime(entry.duration.total_seconds()) - sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) - index += 1 + for i, entry in enumerate(timed_tests[:20], start=1): + t = FormatTimedelta(entry.duration) + sys.stderr.write("%4i (%s) %s\n" % (i, t, entry.GetLabel())) return result