diff --git a/.github/label-pr-config.yml b/.github/label-pr-config.yml new file mode 100644 index 00000000000000..f16b9ba8e51808 --- /dev/null +++ b/.github/label-pr-config.yml @@ -0,0 +1,195 @@ +## Order of entries in this map *does* matter for the resolved labels +## earlier entries override later entries +subSystemLabels: + # src subsystems + /^src\/async-wrap/: c++, async_wrap + /^src\/(?:base64|node_buffer|string_)/: c++, buffer + /^src\/cares/: c++, cares + /^src\/(?:process_wrap|spawn_)/: c++, child_process + /^src\/(?:node_)?crypto/: c++, crypto + /^src\/(?:debug-|node_debug)/: c++, debugger + /^src\/udp_/: c++, dgram + /^src\/(?:fs_|node_file|node_stat_watcher)/: c++, fs + /^src\/node_http_parser/: c++, http_parser + /^src\/node_i18n/: c++, intl + /^src\/uv\./: c++, libuv + /^src\/(?:connect(?:ion)?|pipe|tcp)_/: c++, net + /^src\/node_os/: c++, os + /^src\/(?:node_main|signal_)/: c++, process + /^src\/timer_/: c++, timers + /^src\/(?:CNNICHashWhitelist|node_root_certs|tls_)/: c++, tls + /^src\/tty_/: c++, tty + /^src\/node_url/: c++, url-whatwg + /^src\/node_util/: c++, util + /^src\/(?:node_v8|v8abbr)/: c++, V8 Engine + /^src\/node_contextify/: c++, vm + /^src\/.*win32.*/: c++, windows + /^src\/node_zlib/: c++, zlib + /^src\/tracing/: c++, tracing + /^src\/node_api/: c++, n-api + /^src\/node_http2/: c++, http2, dont-land-on-v6.x + /^src\/node_report/: c++, report + /^src\/node_wasi/: c++, wasi + /^src\/node_worker/: c++, worker + /^src\/quic\/*/: c++, quic, dont-land-on-v14.x, dont-land-on-v12.x + /^src\/node_bob*/: c++, quic, dont-land-on-v14.x, dont-land-on-v12.x + + # don't label python files as c++ + /^src\/.+\.py$/: lib / src, needs-ci + + # properly label changes to v8 inspector integration-related files + /^src\/inspector_/: c++, inspector, needs-ci + + # don't want to label it a c++ update when we're "only" bumping the Node.js version + /^src\/(?!node_version\.h)/: c++ + # BUILDING.md should be marked as 'build' in addition to 'doc' + /^BUILDING\.md$/: build, doc + # meta is a very specific label for things that are policy and or meta-info related + /^([A-Z]+$|CODE_OF_CONDUCT|ROADMAP|WORKING_GROUPS|GOVERNANCE|CHANGELOG|\.mail|\.git.+)/: meta + # things that edit top-level .md files are always a doc change + /^\w+\.md$/: doc + # different variants of *Makefile and build files + /^(tools\/)?(Makefile|BSDmakefile|create_android_makefiles|\.travis\.yml)$/: build, needs-ci + /^tools\/(install\.py|genv8constants\.py|getnodeversion\.py|js2c\.py|utils\.py|configure\.d\/.*)$/: build, needs-ci + /^vcbuild\.bat$/: build, windows, needs-ci + /^(android-)?configure|node\.gyp|common\.gypi$/: build, needs-ci + # more specific tools + /^tools\/gyp/: tools, build, needs-ci + /^tools\/doc\//: tools, doc + /^tools\/icu\//: tools, intl, needs-ci + /^tools\/(?:osx-pkg\.pmdoc|pkgsrc)\//: tools, macos, install + /^tools\/(?:(?:mac)?osx-)/: tools, macos + /^tools\/test-npm/: tools, test, npm + /^tools\/test/: tools, test + /^tools\/(?:certdata|mkssldef|mk-ca-bundle)/: tools, openssl, tls + /^tools\/msvs\//: tools, windows, install, needs-ci + /^tools\/[^/]+\.bat$/: tools, windows, needs-ci + /^tools\/make-v8/: tools, V8 Engine, needs-ci + /^tools\/(code_cache|snapshot|v8_gypfiles)/: needs-ci, + /^tools\/build-addons.js/: needs-ci, + # all other tool changes should be marked as such + /^tools\//: tools + /^\.eslint|\.remark|\.editorconfig/: tools + + ## Dependencies + # libuv needs an explicit mapping, as the ordinary /deps/ mapping below would + # end up as libuv changes labeled with "uv" (which is a non-existing label) + /^deps\/uv\//: libuv + /^deps\/v8\/tools\/gen-postmortem-metadata\.py/: V8 Engine, post-mortem + /^deps\/v8\//: V8 Engine + /^deps\/uvwasi\//: wasi + /^deps\/nghttp2\/nghttp2\.gyp/: build, http2, dont-land-on-v6.x + /^deps\/nghttp2\//: http2, dont-land-on-v6.x + /^deps\/ngtcp2\//: quic, dont-land-on-v14.x, dont-land-on-v12.x + /^deps\/nghttp3\//: quic, dont-land-on-v14.x, dont-land-on-v12.x + /^deps\/([^/]+)/: $1 + + ## JS subsystems + # Oddities first + /^lib\/(punycode|\w+\/freelist|sys\.js)/: '' + /^lib\/constants\.js$/: lib / src + /^lib\/_(debug_agent|debugger)\.js$/: debugger + /^lib(\/\w+)?\/(_)?link(ed)?list/: timers + /^lib\/\w+\/bootstrap_node/: lib / src + /^lib\/\w+\/v8_prof_/: tools + /^lib\/\w+\/socket_list/: net + /^lib\/\w+\/streams$/: stream + /^lib\/.*http2/: http2, dont-land-on-v6.x + /^lib\/worker_threads.js$/: worker + /^lib\/internal\/url\.js$/: url-whatwg + /^lib\/internal\/modules\/esm/: ES Modules + /^lib\/internal\/quic\/*/: quic, dont-land-on-v14.x, dont-land-on-v12.x + + # All other lib/ files map directly + /^lib\/_(\w+)_\w+\.js?$/: $1 # e.g. _(stream)_wrap + /^lib(\/internal)?\/(\w+)\.js?$/: $2 # other .js files + /^lib\/internal\/(\w+)(?:\/|$)/: $1 # internal subfolders + +exlusiveLabels: + # more specific tests + /^test\/addons\//: test, addons + /^test\/debugger\//: test, debugger + /^test\/doctool\//: test, doc, tools + /^test\/timers\//: test, timers + /^test\/pseudo-tty\//: test, tty + /^test\/inspector\//: test, inspector + /^test\/cctest\/test_inspector/: test, inspector + /^test\/cctest\/test_url/: test, url-whatwg + /^test\/addons-napi\//: test, n-api + /^test\/async-hooks\//: test, async_hooks + /^test\/report\//: test, report + /^test\/fixtures\/es-module/: test, ES Modules + /^test\/es-module\//: test, ES Modules + + /^test\//: test + + # specific map for webcrypto.md as it should be labeled 'crypto' + /^doc\/api\/webcrypto.md$/: doc, crypto + # specific map for modules.md as it should be labeled 'module' not 'modules' + /^doc\/api\/modules.md$/: doc, module + # specific map for esm.md as it should be labeled 'ES Modules' not 'esm' + /^doc\/api\/esm.md$/: doc, ES Modules + # n-api is treated separately since it is not a JS core module but is still + # considered a subsystem of sorts + /^doc\/api\/n-api.md$/: doc, n-api + # quic + /^doc\/api\/quic.md$/: doc, quic, dont-land-on-v14.x, dont-land-on-v12.x + # add worker label to PRs that affect doc/api/worker_threads.md + /^doc\/api\/worker_threads.md$/: doc, worker + # automatically tag JS subsystem-specific API doc changes + /^doc\/api\/(\w+)\.md$/: doc, $1 + # add deprecations label to PRs that affect doc/api/deprecations.md + /^doc\/api\/deprecations.md$/: doc, deprecations + + /^doc\//: doc + + # more specific benchmarks + /^benchmark\/buffers\//: benchmark, buffer + /^benchmark\/(?:arrays|es)\//: benchmark, V8 Engine + /^benchmark\/_http/: benchmark, http + /^benchmark\/(?:misc|fixtures)\//: benchmark + /^benchmark\/streams\//: benchmark, stream + /^benchmark\/([^/]+)\//: benchmark, $1 + + /^benchmark\//: benchmark + +allJsSubSystems: + - assert + - async_hooks + - buffer + - child_process + - cluster + - console + - crypto + - debugger + - dgram + - dns + - domain + - events + - esm + - fs + - http + - https + - http2 + - module + - net + - os + - path + - process + - querystring + - quic + - readline + - repl + - report + - stream + - string_decoder + - timers + - tls + - tty + - url + - util + - v8 + - vm + - wasi + - worker + - zlib diff --git a/.github/workflows/comment-labeled.yml b/.github/workflows/comment-labeled.yml new file mode 100644 index 00000000000000..14e48ea8dd37ca --- /dev/null +++ b/.github/workflows/comment-labeled.yml @@ -0,0 +1,29 @@ +name: Comment on issues and PRs when labelled +on: + issues: + types: [labeled] + pull_request_target: + types: [labeled] + +jobs: + staleComment: + if: github.repository == 'nodejs/node' && github.event.label.name == 'stalled' + runs-on: ubuntu-latest + steps: + - name: Post stalled comment + env: + COMMENTS_URL: ${{ github.event.issue.comments_url || github.event.pull_request.comments_url }} + run: | + curl -X POST $COMMENTS_URL \ + -H "Content-Type: application/json" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + --data '{ "body": "This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open." }' + + fastTrack: + if: github.repository == 'nodejs/node' && github.event_name == 'pull_request_target' && github.event.label.name == 'fast-track' + runs-on: ubuntu-latest + steps: + - name: Request Fast-Track + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "Fast-track has been requested by @${{ github.actor }}. Please 👍 to approve." diff --git a/.github/workflows/comment-stalled.yml b/.github/workflows/comment-stalled.yml deleted file mode 100644 index 1c21505c4ad317..00000000000000 --- a/.github/workflows/comment-stalled.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Comment on issues and PRs when labelled stalled -on: - issues: - types: [labeled] - pull_request_target: - types: [labeled] - -jobs: - staleComment: - if: github.repository == 'nodejs/node' - runs-on: ubuntu-latest - steps: - - name: Post comment - if: github.event.label.name == 'stalled' - env: - COMMENTS_URL: ${{ github.event.issue.comments_url || github.event.pull_request.comments_url }} - run: | - curl -X POST $COMMENTS_URL \ - -H "Content-Type: application/json" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - --data '{ "body": "This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open." }' diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml new file mode 100644 index 00000000000000..4e56676e41e5ff --- /dev/null +++ b/.github/workflows/label-pr.yml @@ -0,0 +1,14 @@ +name: Label PRs + +on: + pull_request_target: + types: [opened] + +jobs: + label: + runs-on: ubuntu-latest + + steps: + - uses: nodejs/node-pr-labeler@v1 + with: + configuration-path: .github/label-pr-config.yml diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 65bad59592a452..5f516608c267e4 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -2,6 +2,8 @@ name: test-macOS on: pull_request: + paths-ignore: + - 'doc/**' push: branches: - master diff --git a/BUILDING.md b/BUILDING.md index 2de444e9bd2a31..a84236bc6c84da 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -19,7 +19,7 @@ file a new issue. * [OpenSSL asm support](#openssl-asm-support) * [Previous versions of this document](#previous-versions-of-this-document) * [Building Node.js on supported platforms](#building-nodejs-on-supported-platforms) - * [Note about Python 2 and Python 3](#note-about-python-2-and-python-3) + * [Note about Python](#note-about-python) * [Unix and macOS](#unix-and-macos) * [Unix prerequisites](#unix-prerequisites) * [macOS prerequisites](#macos-prerequisites) @@ -225,29 +225,23 @@ Consult previous versions of this document for older versions of Node.js: ## Building Node.js on supported platforms -### Note about Python 2 and Python 3 - -The Node.js project supports both Python 3 and Python 2 for building. -If both are installed Python 3 will be used. If only Python 2 is available -it will be used instead. When possible we recommend that you build and -test with Python 3. +### Note about Python +The Node.js project supports Python >= 3 for building and testing. ### Unix and macOS #### Unix prerequisites * `gcc` and `g++` >= 8.3 or newer, or * GNU Make 3.81 or newer -* Python (see note above) - * Python 2.7 - * Python 3.5, 3.6, 3.7, and 3.8 +* Python 3.6, 3.7, 3.8, and 3.9 (see note above) Installation via Linux package manager can be achieved with: -* Ubuntu, Debian: `sudo apt-get install python g++ make` -* Fedora: `sudo dnf install python gcc-c++ make` -* CentOS and RHEL: `sudo yum install python gcc-c++ make` -* OpenSUSE: `sudo zypper install python gcc-c++ make` +* Ubuntu, Debian: `sudo apt-get install python3 g++ make` +* Fedora: `sudo dnf install python3 gcc-c++ make` +* CentOS and RHEL: `sudo yum install python3 gcc-c++ make` +* OpenSUSE: `sudo zypper install python3 gcc-c++ make` * Arch Linux, Manjaro: `sudo pacman -S python gcc make` FreeBSD and OpenBSD users may also need to install `libexecinfo`. @@ -257,9 +251,7 @@ Python 3 users may also need to install `python3-distutils`. #### macOS prerequisites * Xcode Command Line Tools >= 11 for macOS -* Python (see note above) - * Python 2.7 - * Python 3.5, 3.6, 3.7, and 3.8 +* Python 3.6, 3.7, 3.8, and 3.9 (see note above) macOS users can install the `Xcode Command Line Tools` by running `xcode-select --install`. Alternatively, if you already have the full Xcode @@ -568,7 +560,7 @@ to run it again before invoking `make -j4`. ##### Option 1: Manual install -* [Python 3.8](https://www.python.org/downloads/) +* [Python 3.9](https://www.microsoft.com/en-us/p/python-39/9p7qfqmjrfp7) * The "Desktop development with C++" workload from [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) or the "Visual C++ build tools" workload from the @@ -606,8 +598,7 @@ packages: * [Git for Windows](https://chocolatey.org/packages/git) with the `git` and Unix tools added to the `PATH` -* [Python 3.x](https://chocolatey.org/packages/python) and - [legacy Python](https://chocolatey.org/packages/python2) +* [Python 3.x](https://chocolatey.org/packages/python) * [Visual Studio 2019 Build Tools](https://chocolatey.org/packages/visualstudio2019buildtools) with [Visual C++ workload](https://chocolatey.org/packages/visualstudio2019-workload-vctools) * [NetWide Assembler](https://chocolatey.org/packages/nasm) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64b9bd67c51bb3..54c481dcae4366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,13 @@ Select a Node.js version below to view the changelog history: +* [Node.js 16](doc/changelogs/CHANGELOG_V16.md) **Current** * [Node.js 15](doc/changelogs/CHANGELOG_V15.md) **Current** * [Node.js 14](doc/changelogs/CHANGELOG_V14.md) **Long Term Support** * [Node.js 13](doc/changelogs/CHANGELOG_V13.md) End-of-Life * [Node.js 12](doc/changelogs/CHANGELOG_V12.md) Long Term Support * [Node.js 11](doc/changelogs/CHANGELOG_V11.md) End-of-Life -* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) Long Term Support +* [Node.js 10](doc/changelogs/CHANGELOG_V10.md) End-of-Life * [Node.js 9](doc/changelogs/CHANGELOG_V9.md) End-of-Life * [Node.js 8](doc/changelogs/CHANGELOG_V8.md) End-of-Life * [Node.js 7](doc/changelogs/CHANGELOG_V7.md) End-of-Life @@ -25,13 +26,16 @@ release. <!--lint disable maximum-line-length--> <table> <tr> + <th title="Current"><a href="doc/changelogs/CHANGELOG_V16.md">16</a><sup>Current</sup></th> <th title="Current"><a href="doc/changelogs/CHANGELOG_V15.md">15</a><sup>Current</sup></th> <th title="LTS Until 2023-04"><a href="doc/changelogs/CHANGELOG_V14.md">14</a><sup>LTS</sup></th> <th title="LTS Until 2022-04"><a href="doc/changelogs/CHANGELOG_V12.md">12</a><sup>LTS</sup></th> - <th title="LTS Until 2021-04"><a href="doc/changelogs/CHANGELOG_V10.md">10</a><sup>LTS</sup></th> </tr> <tr> <td valign="top"> +<b><a href="doc/changelogs/CHANGELOG_V16.md#16.0.0">16.0.0</a></b><br/> + </td> + <td valign="top"> <b><a href="doc/changelogs/CHANGELOG_V15.md#15.14.0">15.14.0</a></b><br/> <a href="doc/changelogs/CHANGELOG_V15.md#15.13.0">15.13.0</a><br/> <a href="doc/changelogs/CHANGELOG_V15.md#15.12.0">15.12.0</a><br/> @@ -120,50 +124,6 @@ release. <a href="doc/changelogs/CHANGELOG_V12.md#12.1.0">12.1.0</a><br/> <a href="doc/changelogs/CHANGELOG_V12.md#12.0.0">12.0.0</a><br/> </td> - <td valign="top"> -<b><a href="doc/changelogs/CHANGELOG_V10.md#10.24.1">10.24.1</a></b><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.24.0">10.24.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.23.3">10.23.3</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.23.2">10.23.2</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.23.1">10.23.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.23.0">10.23.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.22.1">10.22.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.22.0">10.22.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.21.0">10.21.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.20.1">10.20.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.20.0">10.20.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.19.0">10.19.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.18.1">10.18.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.18.0">10.18.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.17.0">10.17.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.16.3">10.16.3</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.16.2">10.16.2</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.16.1">10.16.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.16.0">10.16.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.15.3">10.15.3</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.15.2">10.15.2</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.15.1">10.15.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.15.0">10.15.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.14.2">10.14.2</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.14.1">10.14.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.14.0">10.14.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.13.0">10.13.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.12.0">10.12.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.11.0">10.11.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.10.0">10.10.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.9.0">10.9.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.8.0">10.8.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.7.0">10.7.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.6.0">10.6.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.5.0">10.5.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.4.1">10.4.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.4.0">10.4.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.3.0">10.3.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.2.1">10.2.1</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.2.0">10.2.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.1.0">10.1.0</a><br/> -<a href="doc/changelogs/CHANGELOG_V10.md#10.0.0">10.0.0</a><br/> - </td> </tr> </table> diff --git a/LICENSE b/LICENSE index c6c4f14e2dc193..41f9bc05611a82 100644 --- a/LICENSE +++ b/LICENSE @@ -1333,29 +1333,6 @@ The externally maintained libraries used by Node.js are: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -- node-inspect, located at deps/node-inspect, is licensed as follows: - """ - Copyright Node.js 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. - """ - - large_pages, located at src/large_pages, is licensed as follows: """ Copyright (C) 2018 Intel Corporation diff --git a/Makefile b/Makefile index 26746d94f4ab8c..50d6795bc34903 100644 --- a/Makefile +++ b/Makefile @@ -565,10 +565,6 @@ test-pummel: all test-internet: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) internet -test-node-inspect: $(NODE_EXE) - USE_EMBEDDED_NODE_INSPECT=1 $(NODE) tools/test-npm-package \ - --install deps/node-inspect test - test-benchmark: | bench-addons-build $(PYTHON) tools/test.py $(PARALLEL_ARGS) benchmark diff --git a/README.md b/README.md index 13c1c80a8e1642..37aefac1e77c39 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,8 @@ For information about the governance of the Node.js project, see ### TSC (Technical Steering Committee) <!--lint disable prohibited-strings--> +* [aduh95](https://github.com/aduh95) - +**Antoine du Hamel** <duhamelantoine1995@gmail.com> (he/him) * [apapirovski](https://github.com/apapirovski) - **Anatoli Papirovski** <apapirovski@mac.com> (he/him) * [BethGriggs](https://github.com/BethGriggs) - @@ -169,6 +171,8 @@ For information about the governance of the Node.js project, see **Shelley Vohr** <codebytere@gmail.com> (she/her) * [danbev](https://github.com/danbev) - **Daniel Bevenius** <daniel.bevenius@gmail.com> (he/him) +* [danielleadams](https://github.com/danielleadams) - +**Danielle Adams** <adamzdanielle@gmail.com> (she/her) * [fhinkel](https://github.com/fhinkel) - **Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> (she/her) * [gabrielschulhof](https://github.com/gabrielschulhof) - @@ -187,6 +191,8 @@ For information about the governance of the Node.js project, see **Mary Marchini** <oss@mmarchini.me> (she/her) * [MylesBorins](https://github.com/MylesBorins) - **Myles Borins** <myles.borins@gmail.com> (he/him) +* [ronag](https://github.com/ronag) - +**Robert Nagy** <ronagy@icloud.com> * [targos](https://github.com/targos) - **Michaël Zasso** <targos@protonmail.com> (he/him) * [tniessen](https://github.com/tniessen) - diff --git a/benchmark/common.js b/benchmark/common.js index bdccd6605f365e..3f7abf7363281d 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -12,7 +12,7 @@ class Benchmark { this._ended = false; // Holds process.hrtime value - this._time = [0, 0]; + this._time = 0n; // Use the file name as the name of the benchmark this.name = require.main.filename.slice(__dirname.length + 1); @@ -218,12 +218,12 @@ class Benchmark { throw new Error('Called start more than once in a single benchmark'); } this._started = true; - this._time = process.hrtime(); + this._time = process.hrtime.bigint(); } end(operations) { // Get elapsed time now and do error checking later for accuracy. - const elapsed = process.hrtime(this._time); + const time = process.hrtime.bigint(); if (!this._started) { throw new Error('called end without start'); @@ -237,16 +237,19 @@ class Benchmark { if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED && operations <= 0) { throw new Error('called end() with operation count <= 0'); } - if (elapsed[0] === 0 && elapsed[1] === 0) { + + this._ended = true; + + if (time === this._time) { if (!process.env.NODEJS_BENCHMARK_ZERO_ALLOWED) throw new Error('insufficient clock precision for short benchmark'); // Avoid dividing by zero - elapsed[1] = 1; + this.report(operations && Number.MAX_VALUE, 0n); + return; } - this._ended = true; - const time = elapsed[0] + elapsed[1] / 1e9; - const rate = operations / time; + const elapsed = time - this._time; + const rate = operations / (Number(elapsed) / 1e9); this.report(rate, elapsed); } @@ -255,12 +258,21 @@ class Benchmark { name: this.name, conf: this.config, rate, - time: elapsed[0] + elapsed[1] / 1e9, + time: nanoSecondsToString(elapsed), type: 'report', }); } } +function nanoSecondsToString(bigint) { + const str = bigint.toString(); + const decimalPointIndex = str.length - 9; + if (decimalPointIndex < 0) { + return `0.${'0'.repeat(-decimalPointIndex)}${str}`; + } + return `${str.slice(0, decimalPointIndex)}.${str.slice(decimalPointIndex)}`; +} + function formatResult(data) { // Construct configuration string, " A=a, B=b, ..." let conf = ''; @@ -271,7 +283,7 @@ function formatResult(data) { let rate = data.rate.toString().split('.'); rate[0] = rate[0].replace(/(\d)(?=(?:\d\d\d)+(?!\d))/g, '$1,'); rate = (rate[1] ? rate.join('.') : rate[0]); - return `${data.name}${conf}: ${rate}`; + return `${data.name}${conf}: ${rate}\n`; } function sendResult(data) { @@ -280,7 +292,7 @@ function sendResult(data) { process.send(data); } else { // Otherwise report by stdout - console.log(formatResult(data)); + process.stdout.write(formatResult(data)); } } diff --git a/common.gypi b/common.gypi index c19346bffad434..be7c06d4c81882 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,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.10', + 'v8_embedder_string': '-node.11', ##### V8 defaults for Node.js ##### diff --git a/configure b/configure index ca2cd8aa9e6358..dbe28730902466 100755 --- a/configure +++ b/configure @@ -1,17 +1,14 @@ #!/bin/sh -# Locate an acceptable python interpreter and then re-execute the script. +# Locate an acceptable Python interpreter and then re-execute the script. # Note that the mix of single and double quotes is intentional, # as is the fact that the ] goes on a new line. _=[ 'exec' '/bin/sh' '-c' ''' -test ${FORCE_PYTHON2} && exec python2 "$0" "$@" # workaround for gclient command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" command -v python3.8 >/dev/null && exec python3.8 "$0" "$@" command -v python3.7 >/dev/null && exec python3.7 "$0" "$@" command -v python3.6 >/dev/null && exec python3.6 "$0" "$@" -command -v python3.5 >/dev/null && exec python3.5 "$0" "$@" command -v python3 >/dev/null && exec python3 "$0" "$@" -command -v python2.7 >/dev/null && exec python2.7 "$0" "$@" exec python "$0" "$@" ''' "$0" "$@" ] @@ -20,16 +17,15 @@ del _ import sys from distutils.spawn import find_executable -print('Node.js configure: Found Python {0}.{1}.{2}...'.format(*sys.version_info)) -acceptable_pythons = ((3, 9), (3, 8), (3, 7), (3, 6), (3, 5), (2, 7)) +print('Node.js configure: Found Python {}.{}.{}...'.format(*sys.version_info)) +acceptable_pythons = ((3, 9), (3, 8), (3, 7), (3, 6)) if sys.version_info[:2] in acceptable_pythons: import configure else: - python_cmds = ['python{0}.{1}'.format(*vers) for vers in acceptable_pythons] - sys.stderr.write('Please use {0}.\n'.format(' or '.join(python_cmds))) + python_cmds = ['python{}.{}'.format(*vers) for vers in acceptable_pythons] + sys.stderr.write('Please use {}.\n'.format(' or '.join(python_cmds))) for python_cmd in python_cmds: python_cmd_path = find_executable(python_cmd) if python_cmd_path and 'pyenv/shims' not in python_cmd_path: - sys.stderr.write('\t{0} {1}\n'.format(python_cmd_path, - ' '.join(sys.argv[:1]))) + sys.stderr.write('\t{} {}\n'.format(python_cmd_path, ' '.join(sys.argv[:1]))) sys.exit(1) diff --git a/configure.py b/configure.py index 65fcbc8f28267c..6798b4a445c387 100755 --- a/configure.py +++ b/configure.py @@ -1827,7 +1827,7 @@ def make_bin_override(): if sys.platform == 'win32': raise Exception('make_bin_override should not be called on win32.') # If the system python is not the python we are running (which should be - # python 2), then create a directory with a symlink called `python` to our + # python 3), then create a directory with a symlink called `python` to our # sys.executable. This directory will be prefixed to the PATH, so that # other tools that shell out to `python` will use the appropriate python diff --git a/deps/cjs-module-lexer/CHANGELOG.md b/deps/cjs-module-lexer/CHANGELOG.md index f71631cab5d7ff..d49499aaa2efcc 100644 --- a/deps/cjs-module-lexer/CHANGELOG.md +++ b/deps/cjs-module-lexer/CHANGELOG.md @@ -1,3 +1,10 @@ +1.2.1 +- Support Unicode escapes in strings (https://github.com/guybedford/cjs-module-lexer/pull/55) +- Filter export strings to valid surrogate pairs (https://github.com/guybedford/cjs-module-lexer/pull/56) + +1.2.0 +- Support for non-identifier exports (https://github.com/guybedford/cjs-module-lexer/pull/54, @nicolo-ribaudo) + 1.1.1 - Better support for Babel reexport getter function forms (https://github.com/guybedford/cjs-module-lexer/issues/50) - Support Babel interopRequireWildcard reexports patterns (https://github.com/guybedford/cjs-module-lexer/issues/52) diff --git a/deps/cjs-module-lexer/README.md b/deps/cjs-module-lexer/README.md index 290af176f0885f..3893221beb79c7 100755 --- a/deps/cjs-module-lexer/README.md +++ b/deps/cjs-module-lexer/README.md @@ -70,29 +70,27 @@ IDENTIFIER: As defined by ECMA-262, without support for identifier `\` escapes, STRING_LITERAL: A `"` or `'` bounded ECMA-262 string literal. -IDENTIFIER_STRING: ( `"` IDENTIFIER `"` | `'` IDENTIFIER `'` ) - MODULE_EXPORTS: `module` `.` `exports` EXPORTS_IDENTIFIER: MODULE_EXPORTS_IDENTIFIER | `exports` EXPORTS_DOT_ASSIGN: EXPORTS_IDENTIFIER `.` IDENTIFIER `=` -EXPORTS_LITERAL_COMPUTED_ASSIGN: EXPORTS_IDENTIFIER `[` IDENTIFIER_STRING `]` `=` +EXPORTS_LITERAL_COMPUTED_ASSIGN: EXPORTS_IDENTIFIER `[` STRING_LITERAL `]` `=` -EXPORTS_LITERAL_PROP: (IDENTIFIER (`:` IDENTIFIER)?) | (IDENTIFIER_STRING `:` IDENTIFIER) +EXPORTS_LITERAL_PROP: (IDENTIFIER (`:` IDENTIFIER)?) | (STRING_LITERAL `:` IDENTIFIER) EXPORTS_SPREAD: `...` (IDENTIFIER | REQUIRE) EXPORTS_MEMBER: EXPORTS_DOT_ASSIGN | EXPORTS_LITERAL_COMPUTED_ASSIGN -EXPORTS_DEFINE: `Object` `.` `defineProperty `(` EXPORTS_IDENFITIER `,` IDENTIFIER_STRING +EXPORTS_DEFINE: `Object` `.` `defineProperty `(` EXPORTS_IDENFITIER `,` STRING_LITERAL EXPORTS_DEFINE_VALUE: EXPORTS_DEFINE `, {` (`enumerable: true,`)? ( `value:` | - `get` (`: function` IDENTIFIER? )? `() {` return IDENTIFIER (`.` IDENTIFIER | `[` IDENTIFIER_STRING `]`)? `;`? `}` `,`? + `get` (`: function` IDENTIFIER? )? `() {` return IDENTIFIER (`.` IDENTIFIER | `[` STRING_LITERAL `]`)? `;`? `}` `,`? ) `})` @@ -127,8 +125,8 @@ EXPORT_STAR_LIB: `Object.keys(` IDENTIFIER$1 `).forEach(function (` IDENTIFIER$2 Spacing between tokens is taken to be any ECMA-262 whitespace, ECMA-262 block comment or ECMA-262 line comment. * The returned export names are taken to be the combination of: - 1. All `IDENTIFIER` and `IDENTIFIER_STRING` slots for `EXPORTS_MEMBER` and `EXPORTS_LITERAL` matches. - 2. The first `IDENTIFIER_STRING` slot for all `EXPORTS_DEFINE_VALUE` matches where that same string is not an `EXPORTS_DEFINE` match that is not also an `EXPORTS_DEFINE_VALUE` match. + 1. All `IDENTIFIER` and `STRING_LITERAL` slots for `EXPORTS_MEMBER` and `EXPORTS_LITERAL` matches. + 2. The first `STRING_LITERAL` slot for all `EXPORTS_DEFINE_VALUE` matches where that same string is not an `EXPORTS_DEFINE` match that is not also an `EXPORTS_DEFINE_VALUE` match. * The reexport specifiers are taken to be the combination of: 1. The `REQUIRE` matches of the last matched of either `MODULE_EXPORTS_ASSIGN` or `EXPORTS_LITERAL`. 2. All _top-level_ `EXPORT_STAR` `REQUIRE` matches and `EXPORTS_ASSIGN` matches whose `IDENTIFIER` also matches the first `IDENTIFIER` in `EXPORT_STAR_LIB`. diff --git a/deps/cjs-module-lexer/dist/lexer.js b/deps/cjs-module-lexer/dist/lexer.js index a1466ee81ae77d..4ac468b84952a4 100644 --- a/deps/cjs-module-lexer/dist/lexer.js +++ b/deps/cjs-module-lexer/dist/lexer.js @@ -1 +1 @@ -"use strict";exports.parse=parse;exports.init=init;const A=new Set(["implements","interface","let","package","private","protected","public","static","yield","enum"]);let Q;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(g,I="@"){if(!Q)throw new Error("Not initialized");const D=g.length+1,N=(Q.__heap_base.value||Q.__heap_base)+4*D-Q.memory.buffer.byteLength;N>0&&Q.memory.grow(Math.ceil(N/65536));const k=Q.sa(D);if((B?C:E)(g,new Uint16Array(Q.memory.buffer,k,D)),!Q.parseCJS(k,g.length,0,0,0))throw Object.assign(new Error(`Parse error ${I}${Q.e()}:${g.slice(0,Q.e()).split("\n").length}:${Q.e()-g.lastIndexOf("\n",Q.e()-1)}`),{idx:Q.e()});let o=new Set,K=new Set,w=new Set;for(;Q.rre();)K.add(g.slice(Q.res(),Q.ree()));for(;Q.ru();)w.add(g.slice(Q.us(),Q.ue()));for(;Q.re();){let B=g.slice(Q.es(),Q.ee());A.has(B)||w.has(B)||o.add(B)}return{exports:[...o],reexports:[...K]}}function E(A,Q){const B=A.length;let E=0;for(;E<B;){const B=A.charCodeAt(E);Q[E++]=(255&B)<<8|B>>>8}}function C(A,Q){const B=A.length;let E=0;for(;E<B;)Q[E]=A.charCodeAt(E++)}let g;function init(){return g||(g=(async()=>{const A=await WebAssembly.compile((B="AGFzbQEAAAABrAERYAJ/fwBgAABgAX8Bf2AAAX9gBn9/f39/fwF/YAF/AGAXf39/f39/f39/f39/f39/f39/f39/f38Bf2AIf39/f39/f38Bf2AHf39/f39/fwF/YAN/f38Bf2AFf39/f38Bf2AOf39/f39/f39/f39/f38Bf2AKf39/f39/f39/fwF/YAt/f39/f39/f39/fwF/YAJ/fwF/YAR/f39/AX9gCX9/f39/f39/fwF/A0RDAgMDAwMDAwMDAwMAAAABBAICBQQFAQEBAgICAgEBAQEFAQEGBwECCAMCAgIJCgIBCwIMDQ4EDwgOBwICAgIQAgIDCQQFAXABBQUFAwEAAQYPAn8BQdCYAgt/AEHQmAILB1wOBm1lbW9yeQIAAnNhAAABZQABAmVzAAICZWUAAwNyZXMABANyZWUABQJ1cwAGAnVlAAcCcmUACANycmUACQJydQAKCHBhcnNlQ0pTAA8LX19oZWFwX2Jhc2UDAQkKAQBBAQsECwwNDgqupAFDeAEBf0EAKAKYHyIBIABBAXRqIgBBADsBAEEAIABBAmoiADYC5B9BACAANgLoH0EAQQA2AsAfQQBBADYCyB9BAEEANgLEH0EAQQA2AswfQQBBADYC1B9BAEEANgLQH0EAQQA2AtgfQQBBADYC4B9BAEEANgLcHyABCwgAQQAoAuwfCxUAQQAoAsQfKAIAQQAoApgfa0EBdQsVAEEAKALEHygCBEEAKAKYH2tBAXULFQBBACgC0B8oAgBBACgCmB9rQQF1CxUAQQAoAtAfKAIEQQAoApgfa0EBdQsVAEEAKALcHygCAEEAKAKYH2tBAXULFQBBACgC3B8oAgRBACgCmB9rQQF1CyUBAX9BAEEAKALEHyIAQQhqQcAfIAAbKAIAIgA2AsQfIABBAEcLJQEBf0EAQQAoAtA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0YNACAAQSJHDQMLQQBBACgCvKABIgJBAmoiAzYCvKABIAIvAQIQLkUNAkEAKAK8oAEiAi8BACAARw0CQQAgAkECajYCvKABEChBLEcNAUEAQQAoArygAUECajYCvKABEChB+wBHDQFBAEEAKAK8oAFBAmo2ArygAQJAECgiAEHlAEcNAEEAKAK8oAEiAEECakHuAEH1AEHtAEHlAEHyAEHhAEHiAEHsAEHlABAyRQ0CQQAgAEEUajYCvKABEChBOkcNAkEAQQAoArygAUECajYCvKABEChB9ABHDQJBACgCvKABIgAvAQJB8gBHDQIgAC8BBEH1AEcNAiAALwEGQeUARw0CQQAgAEEIajYCvKABEChBLEcNAkEAQQAoArygAUECajYCvKABECghAAsCQCAAQecARg0AIABB9gBHDQJBACgCvKABIgAvAQJB4QBHDQIgAC8BBEHsAEcNAiAALwEGQfUARw0CIAAvAQhB5QBHDQJBACAAQQpqNgK8oAEQKEE6Rw0CIAMgAkEAKAKcHxEAAEEAIAE2ArygAQ8LQQAoArygASIALwECQeUARw0BIAAvAQRB9ABHDQFBACAAQQZqNgK8oAECQBAoIgBBOkcNAEEAQQAoArygAUECajYCvKABEChB5gBHDQJBACgCvKABIgBBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQJEUNAkEAIABBEGoiADYCvKABAkAQKCIEQShGDQAgAEEAKAK8oAFGDQMgBBAuRQ0DCxAoIQALIABBKEcNAUEAQQAoArygAUECajYCvKABEChBKUcNAUEAQQAoArygAUECajYCvKABEChB+wBHDQFBAEEAKAK8oAFBAmo2ArygARAoQfIARw0BQQAoArygASIAQQJqQeUAQfQAQfUAQfIAQe4AEBNFDQFBACAAQQxqNgK8oAEQKBAuRQ0BAkACQAJAECgiAEHbAEYNACAAQS5HDQJBAEEAKAK8oAFBAmo2ArygARAoEC4NAQwEC0EAQQAoArygAUECajYCvKABAkACQBAoIgBBIkYNACAAQSdHDQUQHQwBCxAVC0EAQQAoArygAUECajYCvKABEChB3QBHDQNBAEEAKAK8oAFBAmo2ArygAQsQKCEACwJAIABBO0cNAEEAQQAoArygAUECajYCvKABECghAAsgAEH9AEcNAUEAQQAoArygAUECajYCvKABAkAQKCIAQSxHDQBBAEEAKAK8oAFBAmo2ArygARAoIQALIABB/QBHDQFBAEEAKAK8oAFBAmo2ArygARAoQSlHDQEgAyACQQAoApwfEQAADwsgAkHrAEcNASAARQ0BQQAoArygASIALwECQeUARw0BIAAvAQRB+QBHDQEgAC8BBkHzAEcNASAAQQZqIQFBACAAQQhqNgK8oAEQKEEoRw0BQQBBACgCvKABQQJqNgK8oAEQKCEAQQAoArygASECIAAQLkUNAUEAKAK8oAEhABAoQSlHDQFBAEEAKAK8oAEiAUECajYCvKABEChBLkcNAUEAQQAoArygAUECajYCvKABEChB5gBHDQFBACgCvKABIgNBAmpB7wBB8gBBxQBB4QBB4wBB6AAQJ0UNAUEAIANBDmo2ArygARAoIQNBACgCvKABIgRBfmohASADQShHDQFBACAEQQJqNgK8oAEQKEHmAEcNAUEAKAK8oAEiA0ECakH1AEHuAEHjAEH0AEHpAEHvAEHuABAkRQ0BQQAgA0EQajYCvKABEChBKEcNAUEAQQAoArygAUECajYCvKABECghA0EAKAK8oAEhBCADEC5FDQFBACgCvKABIQMQKEEpRw0BQQBBACgCvKABQQJqNgK8oAEQKEH7AEcNAUEAQQAoArygAUECajYCvKABEChB6QBHDQFBACgCvKABIgUvAQJB5gBHDQFBACAFQQRqNgK8oAEQKEEoRw0BQQBBACgCvKABQQJqNgK8oAEQKBpBACgCvKABIgUgBCADIARrIgMQQg0BIAAgAmsiBkEBdSEHQQAgBSADQQF1IghBAXRqNgK8oAECQAJAAkAQKCIAQSFGDQAgAEE9Rw0EQQAoArygASIALwECQT1HDQQgAC8BBEE9Rw0EQQAgAEEGajYCvKABAkAQKCIAQSdGDQAgAEEiRw0FC0EAKAK8oAEiBUECakHkAEHlAEHmAEHhAEH1AEHsAEH0ABAkRQ0EQQAgBUEQajYCvKABECggAEcNBEEAQQAoArygAUECajYCvKABEChB/ABHDQRBACg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wBHDQRBAEEAKAK8oAFBAmo2ArygARAoGkEAKAK8oAEiACAEIAMQQg0EQQAgACAIQQF0ajYCvKABEChB3QBHDQRBAEEAKAK8oAFBAmo2ArygARAoIgBBO0cNAkEAQQAoArygAUECajYCvKABDAELIABBzwBHDQNBACgCvKABIgBBAmpB4gBB6gBB5QBB4wBB9AAQE0UNA0EAIABBDGo2ArygARAoQS5HDQNBAEEAKAK8oAFBAmo2ArygARAoQeQARw0DQQAoArygASIAQQJqQeUAQeYAQekAQe4AQeUAQdAAQfIAQe8AQfAAQeUAQfIAQfQAQfkAEDBFDQNBACAAQRxqNgK8oAEQKEEoRw0DQQBBACgCvKABQQJqNgK8oAEQKBAxRQ0DEChBLEcNA0EAQQAoArygAUECajYCvKABECgaQQAoArygASIAIAQgAxBCDQNBACAAIAhBAXRqNgK8oAEQKEEsRw0DQQBBACgCvKABQQJqNgK8oAEQKEH7AEcNA0EAQQAoArygAUECajYCvKABEChB5QBHDQNBACgCvKABIgBBAmpB7gBB9QBB7QBB5QBB8gBB4QBB4gBB7ABB5QAQMkUNA0EAIABBFGo2ArygARAoQTpHDQNBAEEAKAK8oAFBAmo2ArygARAoIQVBACgCvKABIQACQCAFQfQARg0AIAAvAQJB8gBHDQQgAC8BBEH1AEcNBCAALwEGQeUARw0EC0EAIABBCGo2ArygARAoQSxHDQNBAEEAKAK8oAFBAmo2ArygARAoQecARw0DQQAoArygASIALwECQeUARw0DIAAvAQRB9ABHDQNBACAAQQZqNgK8oAECQBAoIgBBOkcNAEEAQQAoArygAUECajYCvKABEChB5gBHDQRBACgCvKABIgBBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQJEUNBEEAIABBEGoiADYCvKABAkAQKCIFQShGDQAgAEEAKAK8oAFGDQUgBRAuRQ0FCxAoIQALIABBKEcNA0EAQQAoArygAUECajYCvKABEChBKUcNA0EAQQAoArygAUECajYCvKABEChB+wBHDQNBAEEAKAK8oAFBAmo2ArygARAoQfIARw0DQQAoArygASIAQQJqQeUAQfQAQfUAQfIAQe4AEBNFDQNBACAAQQxqNgK8oAEQKBpBACgCvKABIgAgAiAGEEINA0EAIAAgB0EBdGo2ArygARAoQdsARw0DQQBBACgCvKABQQJqNgK8oAEQKBpBACgCvKABIgAgBCADEEINA0EAIAAgCEEBdGo2ArygARAoQd0ARw0DQQBBACgCvKABQQJqNgK8oAECQBAoIgBBO0cNAEEAQQAoArygAUECajYCvKABECghAAsgAEH9AEcNA0EAQQAoArygAUECajYCvKABAkAQKCIAQSxHDQBBAEEAKAK8oAFBAmo2ArygARAoIQALIABB/QBHDQNBAEEAKAK8oAFBAmo2ArygARAoQSlHDQNBAEEAKAK8oAFBAmo2ArygARAoIgBBO0cNAUEAQQAoArygAUECajYCvKABCxAoIQALIABB/QBHDQFBAEEAKAK8oAFBAmo2ArygARAoQSlHDQFBACgCtKABIQRBgCAhAANAAkACQCAEIABGDQAgByAAQQxqKAIAIABBCGooAgAiA2tBAXVHDQEgAiADIAYQQg0BIAAoAgAgAEEEaigCAEEAKAKgHxEAAEEAIAE2ArygAQsPCyAAQRBqIQAMAAsLIAMgAkEAKAKkHxEAAAtBACABNgK8oAELlQEBBH9BACgCvKABIQBBACgCwKABIQECQANAIAAiAkECaiEAIAIgAU8NAQJAIAAvAQAiA0HcAEYNAAJAIANBdmoiAkEDTQ0AIANBIkcNAkEAIAA2ArygAQ8LIAIOBAIBAQICCyACQQRqIQAgAi8BBEENRw0AIAJBBmogACACLwEGQQpGGyEADAALC0EAIAA2ArygARAeC1MBBH9BACgCvKABQQJqIQBBACgCwKABIQECQANAIAAiAkF+aiABTw0BIAJBAmohACACLwEAQXZqIgNBA0sNACADDgQBAAABAQsLQQAgAjYCvKABC3wBAn9BAEEAKAK8oAEiAEECajYCvKABIABBBmohAEEAKALAoAEhAQNAAkACQAJAIABBfGogAU8NACAAQX5qLwEAQSpHDQIgAC8BAEEvRw0CQQAgAEF+ajYCvKABDAELIABBfmohAAtBACAANgK8oAEPCyAAQQJqIQAMAAsLd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AAABHAAAABQAAAAIAAAABAAAAAwAAAAMAAAACAAAAAAAAAAIAAAABAAAADQAAAAkAAAB4AAAABgAAAAMAAAAGAAAABAAAAAAAAAAdAAAACQAAACkAAAAGAAAAAgAAAAMAAAAJAAAAAAAAAAoAAAAKAAAALwAAAA8AAACWAQAABwAAAAIAAAAHAAAAEQAAAAkAAAA5AAAAFQAAAAIAAAANAAAAewAAAAUAAAAEAAAAAAAAAAIAAAABAAAAAgAAAAYAAAACAAAAAAAAAAkAAAAJAAAAMQAAAAQAAAACAAAAAQAAAAIAAAAEAAAACQAAAAkAAABKAQAAAwAAAGpLAAAJAAAAhwAAAAQAAAA8AAAABgAAABoAAAAJAAAA9gMAAAAAAAACAAAANgAAAAgAAAADAAAAUgAAAAAAAAAMAAAAAQAAAKxMAAABAAAAxxQAAAQAAAAEAAAABQAAAAkAAAAHAAAAAwAAAAYAAAAfAAAAAwAAAJUAAAACAAAAigUAADEAAAABAgAANgAAAAUAAAAxAAAACQAAAAAAAAAPAAAAAAAAABcAAAAEAAAAAgAAAA4AAABRBQAABgAAAAIAAAAQAAAAAwAAAAYAAAACAAAAAQAAAAIAAAAEAAAABgEAAAYAAAAKAAAACQAAAKMBAAANAAAA1wUAAAYAAABuAAAABgAAAAYAAAAJAAAAlxIAAAkAAAAHBQwA7wAAAABBmB8LHFCMAAABAAAAAgAAAAMAAAAEAAAAAAQAAPAfAAA=","undefined"!=typeof window&&"function"==typeof atob?Uint8Array.from(atob(B),A=>A.charCodeAt(0)):Buffer.from(B,"base64")));var B;const{exports:E}=await WebAssembly.instantiate(A);Q=E})())} \ No newline at end of file +"use strict";exports.parse=parse;exports.init=init;let A;const Q=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(g,I="@"){if(!A)throw new Error("Not initialized");const D=g.length+1,N=(A.__heap_base.value||A.__heap_base)+4*D-A.memory.buffer.byteLength;N>0&&A.memory.grow(Math.ceil(N/65536));const k=A.sa(D);if((Q?C:E)(g,new Uint16Array(A.memory.buffer,k,D)),!A.parseCJS(k,g.length,0,0,0))throw Object.assign(new Error(`Parse error ${I}${A.e()}:${g.slice(0,A.e()).split("\n").length}:${A.e()-g.lastIndexOf("\n",A.e()-1)}`),{idx:A.e()});let w=new Set,J=new Set,K=new Set;for(;A.rre();){const Q=B(g.slice(A.res(),A.ree()));Q&&J.add(Q)}for(;A.ru();)K.add(B(g.slice(A.us(),A.ue())));for(;A.re();){let Q=B(g.slice(A.es(),A.ee()));void 0===Q||K.has(Q)||w.add(Q)}return{exports:[...w],reexports:[...J]}}function B(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const Q=(0,eval)(A);for(let A=0;A<Q.length;A++){const B=64512&Q.charCodeAt(A);if(!(B<55296)){if(55296!==B)return;if(56320!=(64512&Q.charCodeAt(++A)))return}}return Q}catch{}}function E(A,Q){const B=A.length;let E=0;for(;E<B;){const B=A.charCodeAt(E);Q[E++]=(255&B)<<8|B>>>8}}function C(A,Q){const B=A.length;let E=0;for(;E<B;)Q[E]=A.charCodeAt(E++)}let g;function init(){return g||(g=(async()=>{const Q=await WebAssembly.compile((B="AGFzbQEAAAABrAERYAJ/fwBgAABgAX8Bf2AAAX9gBn9/f39/fwF/YAF/AGAXf39/f39/f39/f39/f39/f39/f39/f38Bf2AIf39/f39/f38Bf2AHf39/f39/fwF/YAN/f38Bf2AFf39/f38Bf2AOf39/f39/f39/f39/f38Bf2AKf39/f39/f39/fwF/YAt/f39/f39/f39/fwF/YAJ/fwF/YAR/f39/AX9gCX9/f39/f39/fwF/A0NCAgMDAwMDAwMDAwMAAAABBAICBQQFAQECAgICAQUBAQUBAQYHAQIIAwICAgkKAgELAgwNDgQPCA4HAgICAhACAgMJBAUBcAEFBQUDAQABBg8CfwFB0JgCC38AQdCYAgsHXA4GbWVtb3J5AgACc2EAAAFlAAECZXMAAgJlZQADA3JlcwAEA3JlZQAFAnVzAAYCdWUABwJyZQAIA3JyZQAJAnJ1AAoIcGFyc2VDSlMADwtfX2hlYXBfYmFzZQMB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fIAQe4AEBNFDQFBACADQQxqNgK8oAEQJxAtRQ0BAkACQAJAECciA0HbAEYNACADQS5HDQJBAEEAKAK8oAFBAmo2ArygARAnEC0NAQwEC0EAQQAoArygAUECajYCvKABAkAQJyIDQSdGDQAgA0EiRw0ECyADEBxBAEEAKAK8oAFBAmo2ArygARAnQd0ARw0DQQBBACgCvKABQQJqNgK8oAELECchAwsCQCADQTtHDQBBAEEAKAK8oAFBAmo2ArygARAnIQMLIANB/QBHDQFBAEEAKAK8oAFBAmo2ArygAQJAECciA0EsRw0AQQBBACgCvKABQQJqNgK8oAEQJyEDCyADQf0ARw0BQQBBACgCvKABQQJqNgK8oAEQJ0EpRw0BIAIgAEEAKAKcHxEAAA8LIAJB6wBHDQEgAEUNAUEAKAK8oAEiAC8BAkHlAEcNASAALwEEQfkARw0BIAAvAQZB8wBHDQEgAEEGaiEBQQAgAEEIajYCvKABECdBKEcNAUEAQQAoArygAUECajYCvKABECchAEEAKAK8oAEhAiAAEC1FDQFBACgCvKABIQAQJ0EpRw0BQQBBACgCvKABIgFBAmo2ArygARAnQS5HDQFBAEEAKAK8oAFBAmo2ArygARAnQeYARw0BQQAoArygASIDQQJqQe8AQfIAQcUAQeEAQeMAQegAECZFDQFBACADQQ5qNgK8oAEQJyEDQQAoArygASIEQX5qIQEgA0EoRw0BQQAgBEECajYCvKABECdB5gBHDQFBACgCvKABIgNBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQI0UNAUEAIANBEGo2ArygARAnQShHDQFBAEEAKAK8oAFBAmo2ArygARAnIQNBACgCvKABIQQgAxAtRQ0BQQAoArygASEDECdBKUcNAUEAQQAoArygAUECajYCvKABECdB+wBHDQFBAEEAKAK8oAFBAmo2ArygARAnQekARw0BQQAoArygASIFLwECQeYARw0BQQAgBUEEajYCvKABECdBKEcNAUEAQQAoArygAUECajYCvKABECcaQQAoArygASIFIAQgAyAEayIDEEENASAAIAJrIgZBAXUhB0EAIAUgA0EBdSIIQQF0ajYCvKABAkAC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QQAoArygASIAQQJqQfUAQe4AQeMAQfQAQekAQe8AQe4AECNFDQRBACAAQRBqIgA2ArygAQJAECciBUEoRg0AIABBACgCvKABRg0FIAUQLUUNBQsQJyEACyAAQShHDQNBAEEAKAK8oAFBAmo2ArygARAnQSlHDQNBAEEAKAK8oAFBAmo2ArygARAnQfsARw0DQQBBACgCvKABQQJqNgK8oAEQJ0HyAEcNA0EAKAK8oAEiAEECakHlAEH0AEH1AEHyAEHuABATRQ0DQQAgAEEMajYCvKABECcaQQAoArygASIAIAIgBhBBDQNBACAAIAdBAXRqNgK8oAEQJ0HbAEcNA0EAQQAoArygAUECajYCvKABECcaQQAoArygASIAIAQgAxBBDQNBACAAIAhBAXRqNgK8oAEQJ0HdAEcNA0EAQQAoArygAUECajYCvKABAkAQJyIAQTtHDQBBAEEAKAK8oAFBAmo2ArygARAnIQALIABB/QBHDQNBAEEAKAK8oAFBAmo2ArygAQJAECciAEEsRw0AQQBBACgCvKABQQJqNgK8oAEQJyEACyAAQf0ARw0DQQBBACgCvKABQQJqNgK8oAEQJ0EpRw0DQQBBACgCvKABQQJqNgK8oAEQJyIAQTtHDQFBAEEAKAK8oAFBAmo2ArygAQsQJyEACyAAQf0ARw0BQQBBACgCvKABQQJqNgK8oAEQJ0EpRw0BQQAoArSgASEEQYAgIQADQAJAAkAgBCAARg0AIAcgAEEMaigCACAAQQhqKAIAIgNrQQF1Rw0BIAIgAyAGEEENASAAKAIAIABBBGooAgBBACgCoB8RAABBACABNgK8oAELDwsgAEEQaiEADAALCyACIABBACgCpB8RAAALQQAgATYCvKABC1MBBH9BACgCvKABQQJqIQBBACgCwKABIQECQANAIAAiAkF+aiABTw0BIAJBAmohACACLwEAQXZqIgNBA0sNACADDgQBAAABAQsLQQAgAjYCvKABC3wBAn9BAEEAKAK8oAEiAEECajYCvKABIABBBmohAEEAKALAoAEhAQNAAkACQAJAIABBfGogAU8NACAAQX5qLwEAQSpHDQIgAC8BAEEvRw0CQQAgAEF+ajYCvKABDA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QAoArygASEDAkACQBAnIgBBOkcNAEEAQQAoArygAUECajYCvKABECcQLUUNAUEAKAK8oAEvAQAhAAsgAiADQQAoApwfEQAADAILQQAgATYCvKABDwsCQAJAIABBIkYNACAAQS5GDQEgAEEnRw0EC0EAKAK8oAEhAiAAEBxBAEEAKAK8oAFBAmoiAzYCvKABECciAEE6Rw0BQQBBACgCvKABQQJqNgK8oAECQBAnEC1FDQBBACgCvKABLwEAIQAgAiADQQAoApwfEQAADAILQQAgATYCvKABDwtBACgCvKABIgAvAQJBLkcNAiAALwEEQS5HDQJBACAAQQZqNgK8oAECQAJAAkAgAC8BBiIAQfIARw0AQQEQECEAQQAoArygASECIAANASACLwEAIQALIABB//8DcRAtDQFBACABNgK8oAEPC0EAIAJBAmo2ArygAQsQJyEACyAAQf//A3EiAEEsRg0CIABB/QBGDQBBACABNgK8oAELDwtBACABNgK8oAEPC0EAKAK8oAEhAAwACwuPAQEBf0EAIQ4CQCAALwEAIAFHDQAgAC8BAiACRw0AIAAvAQQgA0cNACAALwEGIARHDQAgAC8BCCAFRw0AIAAvAQogBkcNACAALwEMIAdHDQAgAC8BDiAIRw0AIAAvARAgCUcNACAALwESIApHDQAgAC8BFCALRw0AIAAvARYgDEcNACAALwEYIA1GIQ4LIA4LqAEBAn9BACEBQQAoArygASECAkACQCAAQe0ARw0AIAJBAmpB7wBB5ABB9QBB7ABB5QAQE0UNAUEAIAJBDGo2ArygAQJAECdBLkYNAEEAIQEMAgtBAEEAKAK8oAFBAmo2ArygARAnIQALIABB5QBHDQBBACgCvKABIgBBDmogAiAAQQJqQfgAQfAAQe8AQfIAQfQAQfMAECYiARshAgtBACACNgK8oAEgAQtnAQF/QQAhCgJAIAAvAQAgAUcNACAALwECIAJHDQAgAC8BBCADRw0AIAAvAQYgBEcNACAALwEIIAVHDQAgAC8BCiAGRw0AIAAvAQwgB0cNACAALwEOIAhHDQAgAC8BECAJRiEKCyAKC3EBAX9BACELAkAgAC8BACABRw0AIAAvAQIgAkcNAC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AAAAgAAAAAAAAACAAAAAQAAAA0AAAAJAAAAeAAAAAYAAAADAAAABgAAAAQAAAAAAAAAHQAAAAkAAAApAAAABgAAAAIAAAADAAAACQAAAAAAAAAKAAAACgAAAC8AAAAPAAAAlgEAAAcAAAACAAAABwAAABEAAAAJAAAAOQAAABUAAAACAAAADQAAAHsAAAAFAAAABAAAAAAAAAACAAAAAQAAAAIAAAAGAAAAAgAAAAAAAAAJAAAACQAAADEAAAAEAAAAAgAAAAEAAAACAAAABAAAAAkAAAAJAAAASgEAAAMAAABqSwAACQAAAIcAAAAEAAAAPAAAAAYAAAAaAAAACQAAAPYDAAAAAAAAAgAAADYAAAAIAAAAAwAAAFIAAAAAAAAADAAAAAEAAACsTAAAAQAAAMcUAAAEAAAABAAAAAUAAAAJAAAABwAAAAMAAAAGAAAAHwAAAAMAAACVAAAAAgAAAIoFAAAxAAAAAQIAADYAAAAFAAAAMQAAAAkAAAAAAAAADwAAAAAAAAAXAAAABAAAAAIAAAAOAAAAUQUAAAYAAAACAAAAEAAAAAMAAAAGAAAAAgAAAAEAAAACAAAABAAAAAYBAAAGAAAACgAAAAkAAACjAQAADQAAANcFAAAGAAAAbgAAAAYAAAAGAAAACQAAAJcSAAAJAAAABwUMAO8AAAAAQZgfCxxQjAAAAQAAAAIAAAADAAAABAAAAAAEAADwHwAA","undefined"!=typeof window&&"function"==typeof atob?Uint8Array.from(atob(B),A=>A.charCodeAt(0)):Buffer.from(B,"base64")));var B;const{exports:E}=await WebAssembly.instantiate(Q);A=E})())} \ No newline at end of file diff --git a/deps/cjs-module-lexer/dist/lexer.mjs b/deps/cjs-module-lexer/dist/lexer.mjs index 42c77ef82ae71b..acb87e58e2cb71 100644 --- a/deps/cjs-module-lexer/dist/lexer.mjs +++ b/deps/cjs-module-lexer/dist/lexer.mjs @@ -1,2 +1,2 @@ -/* cjs-module-lexer 1.1.1 */ -const A=new Set(["implements","interface","let","package","private","protected","public","static","yield","enum"]);let Q;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(g,I="@"){if(!Q)throw new Error("Not initialized");const D=g.length+1,N=(Q.__heap_base.value||Q.__heap_base)+4*D-Q.memory.buffer.byteLength;N>0&&Q.memory.grow(Math.ceil(N/65536));const k=Q.sa(D);if((B?C:E)(g,new Uint16Array(Q.memory.buffer,k,D)),!Q.parseCJS(k,g.length,0,0,0))throw Object.assign(new Error(`Parse error ${I}${Q.e()}:${g.slice(0,Q.e()).split("\n").length}:${Q.e()-g.lastIndexOf("\n",Q.e()-1)}`),{idx:Q.e()});let o=new Set,K=new Set,w=new Set;for(;Q.rre();)K.add(g.slice(Q.res(),Q.ree()));for(;Q.ru();)w.add(g.slice(Q.us(),Q.ue()));for(;Q.re();){let B=g.slice(Q.es(),Q.ee());A.has(B)||w.has(B)||o.add(B)}return{exports:[...o],reexports:[...K]}}function E(A,Q){const B=A.length;let E=0;for(;E<B;){const B=A.charCodeAt(E);Q[E++]=(255&B)<<8|B>>>8}}function C(A,Q){const B=A.length;let E=0;for(;E<B;)Q[E]=A.charCodeAt(E++)}let g;export function init(){return g||(g=(async()=>{const A=await WebAssembly.compile((B="AGFzbQEAAAABrAERYAJ/fwBgAABgAX8Bf2AAAX9gBn9/f39/fwF/YAF/AGAXf39/f39/f39/f39/f39/f39/f39/f38Bf2AIf39/f39/f38Bf2AHf39/f39/fwF/YAN/f38Bf2AFf39/f38Bf2AOf39/f39/f39/f39/f38Bf2AKf39/f39/f39/fwF/YAt/f39/f39/f39/fwF/YAJ/fwF/YAR/f39/AX9gCX9/f39/f39/fwF/A0RDAgMDAwMDAwMDAwMAAAABBAICBQQFAQEBAgICAgEBAQEFAQEGBwECCAMCAgIJCgIBCwIMDQ4EDwgOBwICAgIQAgIDCQQFAXABBQUFAwEAAQYPAn8BQdCYAgt/AEHQmAILB1wOBm1lbW9yeQIAAnNhAAABZQABAmVzAAICZWUAAwNyZXMABANyZWUABQJ1cwAGAnVlAAcCcmUACANycmUACQJydQAKCHBhcnNlQ0pTAA8L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gBBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQJEUNAkEAIABBEGoiADYCvKABAkAQKCIEQShGDQAgAEEAKAK8oAFGDQMgBBAuRQ0DCxAoIQALIABBKEcNAUEAQQAoArygAUECajYCvKABEChBKUcNAUEAQQAoArygAUECajYCvKABEChB+wBHDQFBAEEAKAK8oAFBAmo2ArygARAoQfIARw0BQQAoArygASIAQQJqQeUAQfQAQfUAQfIAQe4AEBNFDQFBACAAQQxqNgK8oAEQKBAuRQ0BAkACQAJAECgiAEHbAEYNACAAQS5HDQJBAEEAKAK8oAFBAmo2ArygARAoEC4NAQwEC0EAQQAoArygAUECajYCvKABAkACQBAoIgBBIkYNACAAQSdHDQUQHQwBCxAVC0EAQQAoArygAUECajYCvKABEChB3QBHDQNBAEEAKAK8oAFBAmo2ArygAQsQKCEACwJAIABBO0cNAEEAQQAoArygAUECajYCvKABECghAAsgAEH9AEcNAUEAQQAoArygAUECajYCvKABAkAQKCIAQSxHDQBBAEEAKAK8oAFBAmo2ArygARAoIQALIABB/QBHDQFBAEEAKAK8oAFBAmo2ArygARAoQSlHDQEgAyACQQAoApwfEQAADwsgAkHrAEcNASAARQ0BQQAoArygASIALwECQeUARw0BIAAvAQRB+QBHDQEgAC8BBkHzAEcNASAAQQZqIQFBACAAQQhqNgK8oAEQKEEoRw0BQQBBACgCvKABQQJqNgK8oAEQKCEAQQAoArygASECIAAQLkUNAUEAKAK8oAEhABAoQSlHDQFBAEEAKAK8oAEiAUECajYCvKABEChBLkcNAUEAQQAoArygAUECajYCvKABEChB5gBHDQFBACgCvKABIgNBAmpB7wBB8gBBxQBB4QBB4wBB6AAQJ0UNAUEAIANBDmo2ArygARAoIQNBACgCvKABIgRBfmohASADQShHDQFBACAEQQJqNgK8oAEQKEHmAEcNAUEAKAK8oAEiA0ECakH1AEHuAEHjAEH0AEHpAEHvAEHuABAkRQ0BQQAgA0EQajYCvKABEChBKEcNAUEAQQAoArygAUECajYCvKABECghA0EAKAK8oAEhBC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oIQVBACgCvKABIQACQCAFQfQARg0AIAAvAQJB8gBHDQQgAC8BBEH1AEcNBCAALwEGQeUARw0EC0EAIABBCGo2ArygARAoQSxHDQNBAEEAKAK8oAFBAmo2ArygARAoQecARw0DQQAoArygASIALwECQeUARw0DIAAvAQRB9ABHDQNBACAAQQZqNgK8oAECQBAoIgBBOkcNAEEAQQAoArygAUECajYCvKABEChB5gBHDQRBACgCvKABIgBBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQJEUNBEEAIABBEGoiADYCvKABAkAQKCIFQShGDQAgAEEAKAK8oAFGDQUgBRAuRQ0FCxAoIQALIABBKEcNA0EAQQAoArygAUECajYCvKABEChBKUcNA0EAQQAoArygAUECajYCvKABEChB+wBHDQNBAEEAKAK8oAFBAmo2ArygARAoQfIARw0DQQAoArygASIAQQJqQeUAQfQAQfUAQfIAQe4AEBNFDQNBACAAQQxqNgK8oAEQKBpBACgCvKABIgAgAiAGEEINA0EAIAAgB0EBdGo2ArygARAoQdsARw0DQQBBACgCvKABQQJqNgK8oAEQKBpBACgCvKABIgAgBCADEEINA0EAIAAgCEEBdGo2ArygARAoQd0ARw0DQQBBACgCvKABQQJqNgK8oAECQBAoIgBBO0cNAEEAQQAoArygAUECajYCvKABECghAAsgAEH9AEcNA0EAQQAoArygAUECajYCvKABAkAQKCIAQSxHDQBBAEEAKAK8oAFBAmo2ArygARAoIQALIABB/QBHDQNBAEEAKAK8oAFBAmo2ArygARAoQSlHDQNBAEEAKAK8oAFBAmo2ArygARAoIgBBO0cNAUEAQQAoArygAUECajYCvKABCxAoIQALIABB/QBHDQFBAEEAKAK8oAFBAmo2ArygARAoQSlHDQFBACgCtKABIQRBgCAhAANAAkACQCAEIABGDQAgByAAQQxqKAIAIABBCGooAgAiA2tBAXVHDQEgAiADIAYQQg0BIAAoAgAgAEEEaigCAEEAKAKgHxEAAEEAIAE2ArygAQsPCyAAQRBqIQAMAAsLIAMgAkEAKAKkHxEAAAtBACABNgK8oAELlQEBBH9B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cNACAALwEIIAVHDQAgAC8BCiAGRw0AIAAvAQwgB0cNACAALwEOIAhHDQAgAC8BECAJRw0AIAAvARIgCkcNACAALwEUIAtHDQAgAC8BFiAMRw0AIAAvARggDUYhDgsgDguoAQECf0EAIQFBACgCvKABIQICQAJAIABB7QBHDQAgAkECakHvAEHkAEH1AEHsAEHlABATRQ0BQQAgAkEMajYCvKABAkAQKEEuRg0AQQAhAQwCC0EAQQAoArygAUECajYCvKABECghAAsgAEHlAEcNAEEAKAK8oAEiAEEOaiACIABBAmpB+ABB8ABB7wBB8gBB9ABB8wAQJyIBGyECC0EAIAI2ArygASABC2cBAX9BACEKAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZHDQAgAC8BDCAHRw0AIAAvAQ4gCEcNACAALwEQIAlGIQoLIAoLcQEBf0EAIQsCQCAALwEAIAFHDQAgAC8BAiACRw0AIAAvAQQgA0cNACAALwEGIARHDQAgAC8BCCAFRw0AIAAvAQogBkcNACAALwEMIAdHDQAgAC8BDiAIRw0AIAAvARAgCUcNACAALwESIApGIQsLIAsLgwQBAn9BACECAkAQKEHPAEcNAEEAIQJBACgCvKABIgNBAmpB4gBB6gBB5QBB4wBB9AAQE0UNAEEAIQJBACADQQxqNgK8oAEQKEEuRw0AQQBBACgCvKABQQJqNgK8oAECQBAoIgNB8ABHDQBBACECQQAoArygASIDQQJqQfIAQe8AQfQAQe8AQfQAQfkAQfAAQeUAED5FDQFBACECQQAgA0ESajYCvKABEChBLkcNAUEAQQAoArygAUECajYCvKABECghAwtBACECIANB6ABHDQBBACECQQAoArygASIDQQJqQeEAQfMAQc8AQfcAQe4AQdAAQfIAQe8AQfAAQeUAQfIAQfQAQfkAEDBFDQBBACECQQAgA0EcajYCvKABEChBLkcNAEEAIQJBAEEAKAK8oAFBAmo2ArygARAoQeMARw0AQQAhAkEAKAK8oAEiAy8BAkHhAEcNACADLwEEQewARw0AIAMvAQZB7AB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AAYAAAAKAAAACQAAAKMBAAANAAAA1wUAAAYAAABuAAAABgAAAAYAAAAJAAAAlxIAAAkAAAAHBQwA7wAAAABBmB8LHFCMAAABAAAAAgAAAAMAAAAEAAAAAAQAAPAfAAA=","undefined"!=typeof window&&"function"==typeof atob?Uint8Array.from(atob(B),A=>A.charCodeAt(0)):Buffer.from(B,"base64")));var B;const{exports:E}=await WebAssembly.instantiate(A);Q=E})())} \ No newline at end of file +/* cjs-module-lexer 1.2.1 */ +let A;const Q=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(g,I="@"){if(!A)throw new Error("Not initialized");const D=g.length+1,N=(A.__heap_base.value||A.__heap_base)+4*D-A.memory.buffer.byteLength;N>0&&A.memory.grow(Math.ceil(N/65536));const k=A.sa(D);if((Q?C:E)(g,new Uint16Array(A.memory.buffer,k,D)),!A.parseCJS(k,g.length,0,0,0))throw Object.assign(new Error(`Parse error ${I}${A.e()}:${g.slice(0,A.e()).split("\n").length}:${A.e()-g.lastIndexOf("\n",A.e()-1)}`),{idx:A.e()});let w=new Set,J=new Set,K=new Set;for(;A.rre();){const Q=B(g.slice(A.res(),A.ree()));Q&&J.add(Q)}for(;A.ru();)K.add(B(g.slice(A.us(),A.ue())));for(;A.re();){let Q=B(g.slice(A.es(),A.ee()));void 0===Q||K.has(Q)||w.add(Q)}return{exports:[...w],reexports:[...J]}}function B(A){if('"'!==A[0]&&"'"!==A[0])return A;try{const Q=(0,eval)(A);for(let A=0;A<Q.length;A++){const B=64512&Q.charCodeAt(A);if(!(B<55296)){if(55296!==B)return;if(56320!=(64512&Q.charCodeAt(++A)))return}}return Q}catch{}}function E(A,Q){const B=A.length;let E=0;for(;E<B;){const B=A.charCodeAt(E);Q[E++]=(255&B)<<8|B>>>8}}function C(A,Q){const B=A.length;let E=0;for(;E<B;)Q[E]=A.charCodeAt(E++)}let g;export function init(){return g||(g=(async()=>{const Q=await WebAssembly.compile((B="AGFzbQEAAAABrAERYAJ/fwBgAABgAX8Bf2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AQQRqIQNBACEEAkADQCACECghACACIAFNDQEgAEUNASAAQdwARg0CIAAQKUUNASACQX5BfCAAQYCABEkbaiECIAAQKiEEDAALCyAEQQFxRQ0AIAIvAQBBIEcNAEEAKAK0oAEiBEEAKAKwH0YNACAEIAM2AgwgBCACQQJqNgIIIAJBfmohAEEgIQICQANAIABBAmogAU0NASACQf//A3FBIEcNASAALwEAIQIgAEF+aiEADAALCyACQf//A3FBjn9qIgJBAksNAAJAAkACQCACDgMAAwEACyAAQfYAQeEAECsNAQwCCyAAQewAQeUAECsNACAAQeMAQe8AQe4AQfMAECxFDQELQQAgBEEQajYCtKABCws/AQF/QQAhBgJAIAAvAQAgAUcNACAALwECIAJHDQAgAC8BBCADRw0AIAAvAQYgBEcNACAALwEIIAVGIQYLIAYLliYBCH9BAEEAKAK8oAEiAUEMajYCvKABIAFBCmohAQJAECdBLkcNAEEAQQAoArygAUECajYCvKABAkACQBAnIgJB5ABHDQBBACgCvKABIgBBAmpB5QBB5gBB6QBB7gBB5QBB0ABB8gBB7wBB8ABB5QBB8gBB9ABB+QAQL0UNAkEAIABBHGo2ArygASAAQRpqIQEQJ0EoRw0CQQBBACgCvKABQQJqNgK8oAEQJxAwRQ0CECdBLEcNAkEAQQAoArygAUECajYCvKABAkAQJyIAQSdGDQAgAEEiRw0DC0EAKAK8oAEhAiAAEBxBAEEAKAK8oAFBAmoiADYCvKABECdBLEcNAUEAQQAoArygAUECajYCvKABECdB+wBHDQFBAEEAKAK8oAFBAmo2ArygAQJAECciA0HlAEcNAEEAKAK8oAEiA0ECakHuAEH1AEHtAEHlAEHyAEHhAEHiAEHsAEHlABAxRQ0CQQAgA0EUajYCvKABECdBOkcNAkEAQQAoArygAUECajYCvKABECdB9ABHDQJBACgCvKABIgMvAQJB8gBHDQIgAy8BBEH1AEcNAiADLwEGQeUARw0CQQAgA0EIajYCvKABECdBLEcNAkEAQQAoArygAUECajYCvKABECchAwsCQCADQecARg0AIANB9gBHDQJBACgCvKABIgMvAQJ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oArygASIDQQJqQe8AQfIAQcUAQeEAQeMAQegAECZFDQFBACADQQ5qNgK8oAEQJyEDQQAoArygASIEQX5qIQEgA0EoRw0BQQAgBEECajYCvKABECdB5gBHDQFBACgCvKABIgNBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQI0UNAUEAIANBEGo2ArygARAnQShHDQFBAEEAKAK8oAFBAmo2ArygARAnIQNBACgCvKABIQQgAxAtRQ0BQQAoArygASEDECdBKUcNAUEAQQAoArygAUECajYCvKABECdB+wBHDQFBAEEAKAK8oAFBAmo2ArygARAnQekARw0BQQAoArygASIFLwECQeYARw0BQQAgBUEEajYCvKABECdBKEcNAUEAQQAoArygAUECajYCvKABECcaQQAoArygASIFIAQgAyAEayIDEEENASAAIAJrIgZBAXUhB0EAIAUgA0EBdSIIQQF0ajYCvKABAkACQAJAECciAEEhRg0AIABBPUcNBEEAKAK8oAEiAC8BAkE9Rw0EIAAvAQRBPUcNBEEAIABBBmo2ArygAQJAECciAEEnRg0AIABBIkcNBQtBACgCvKABIgVBAmpB5ABB5QBB5gBB4QBB9QBB7ABB9AAQI0UNBEEAIAVBEGo2ArygARAnIABHDQRBAEEAKAK8oAFBAmo2ArygARAnQfwARw0EQQAoArygASIALwECQfwARw0EQQAgAEEEajYCvKABECcaQQAoArygASIAIAQgAxBBDQRBACAAIAhBAXRqNgK8oAEQJ0E9Rw0EQQAoArygASIALwECQT1HDQQgAC8BBEE9Rw0EQQAgAEEGajYCvKABAkAQJyIAQSdGDQAgAEEiRw0FC0EAKAK8oAEiBUECakHfAEHfAEHlAEHzAEHNAEHvAEHkAEH1AEHsAEHlABAyRQ0EQQAgBUEWajYCvKABECcgAEcNBEEAQQAoArygAUECajYCvKABECdBKUcNBEEAQQAoArygAUECajYCvKABECdB8gBHDQRBACgCvKABIgBBAmpB5QBB9ABB9QBB8gBB7gAQE0UNBEEAIABBDGo2ArygAQJAECdBO0cNAEEAQQAoArygAUECajYCvKABCxAnIgBB6QBHDQJB6QAhAEEA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AGAAAAbgAAAAYAAAAGAAAACQAAAJcSAAAJAAAABwUMAO8AAAAAQZgfCxxQjAAAAQAAAAIAAAADAAAABAAAAAAEAADwHwAA","undefined"!=typeof window&&"function"==typeof atob?Uint8Array.from(atob(B),A=>A.charCodeAt(0)):Buffer.from(B,"base64")));var B;const{exports:E}=await WebAssembly.instantiate(Q);A=E})())} \ No newline at end of file diff --git a/deps/cjs-module-lexer/lexer.js b/deps/cjs-module-lexer/lexer.js index 5e61e8291ea40e..b66e37204b41d6 100755 --- a/deps/cjs-module-lexer/lexer.js +++ b/deps/cjs-module-lexer/lexer.js @@ -37,8 +37,6 @@ const Import = 0; const ExportAssign = 1; const ExportStar = 2; -const strictReserved = new Set(['implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'enum']); - function parseCJS (source, name = '@') { resetState(); try { @@ -49,14 +47,39 @@ function parseCJS (source, name = '@') { e.loc = pos; throw e; } - const result = { exports: [..._exports].filter(expt => !unsafeGetters.has(expt)), reexports: [...reexports] }; + const result = { exports: [..._exports].filter(expt => expt !== undefined && !unsafeGetters.has(expt)), reexports: [...reexports].filter(reexpt => reexpt !== undefined) }; resetState(); return result; } -function addExport (name) { - if (!strictReserved.has(name)) - _exports.add(name); +function decode (str) { + if (str[0] === '"' || str[0] === '\'') { + try { + const decoded = (0, eval)(str); + // Filter to exclude non-matching UTF-16 surrogate strings + for (let i = 0; i < decoded.length; i++) { + const surrogatePrefix = decoded.charCodeAt(i) & 0xFC00; + if (surrogatePrefix < 0xD800) { + // Not a surrogate + continue; + } + else if (surrogatePrefix === 0xD800) { + // Validate surrogate pair + if ((decoded.charCodeAt(++i) & 0xFC00) !== 0xDC00) + return; + } + else { + // Out-of-range surrogate code (above 0xD800) + return; + } + } + return decoded; + } + catch {} + } + else { + return str; + } } function parseSource (cjsSource) { @@ -173,10 +196,8 @@ function parseSource (cjsSource) { // TODO: <!-- XML comment support break; case 39/*'*/: - singleQuoteString(); - break; case 34/*"*/: - doubleQuoteString(); + stringLiteral(ch); break; case 47/*/*/: { const next_ch = source.charCodeAt(pos + 1); @@ -329,11 +350,9 @@ function tryParseObjectDefineOrKeys (keys) { pos++; ch = commentWhitespace(); if (ch !== 39/*'*/ && ch !== 34/*"*/) break; - let quot = ch; - const exportPos = ++pos; - if (!identifier() || source.charCodeAt(pos) !== quot) break; - expt = source.slice(exportPos, pos); - pos++; + const exportPos = pos; + stringLiteral(ch); + expt = source.slice(exportPos, ++pos); ch = commentWhitespace(); if (ch !== 44/*,*/) break; pos++; @@ -360,7 +379,7 @@ function tryParseObjectDefineOrKeys (keys) { pos += 5; ch = commentWhitespace(); if (ch !== 58/*:*/) break; - addExport(expt); + _exports.add(decode(expt)); pos = revertPos; return; } @@ -403,8 +422,7 @@ function tryParseObjectDefineOrKeys (keys) { else if (ch === 91/*[*/) { pos++; ch = commentWhitespace(); - if (ch === 39/*'*/) singleQuoteString(); - else if (ch === 34/*"*/) doubleQuoteString(); + if (ch === 39/*'*/ || ch === 34/*"*/) stringLiteral(ch); else break; pos++; ch = commentWhitespace(); @@ -427,13 +445,13 @@ function tryParseObjectDefineOrKeys (keys) { pos++; ch = commentWhitespace(); if (ch !== 41/*)*/) break; - addExport(expt); + _exports.add(decode(expt)); return; } break; } if (expt) { - unsafeGetters.add(expt); + unsafeGetters.add(decode(expt)); } } else if (keys && ch === 107/*k*/ && source.startsWith('eys', pos + 1)) { @@ -801,7 +819,7 @@ function tryParseObjectDefineOrKeys (keys) { const starExportSpecifier = starExportMap[id]; if (starExportSpecifier) { - reexports.add(starExportSpecifier); + reexports.add(decode(starExportSpecifier)); pos = revertPos; return; } @@ -863,7 +881,7 @@ function tryParseExportsDotAssign (assign) { const endPos = pos; ch = commentWhitespace(); if (ch === 61/*=*/) { - addExport(source.slice(startPos, endPos)); + _exports.add(decode(source.slice(startPos, endPos))); return; } } @@ -874,19 +892,15 @@ function tryParseExportsDotAssign (assign) { pos++; ch = commentWhitespace(); if (ch === 39/*'*/ || ch === 34/*"*/) { - pos++; const startPos = pos; - if (identifier() && source.charCodeAt(pos) === ch) { - const endPos = pos++; - ch = commentWhitespace(); - if (ch !== 93/*]*/) - break; - pos++; - ch = commentWhitespace(); - if (ch !== 61/*=*/) - break; - addExport(source.slice(startPos, endPos)); - } + stringLiteral(ch); + const endPos = ++pos; + ch = commentWhitespace(); + if (ch !== 93/*]*/) break; + pos++; + ch = commentWhitespace(); + if (ch !== 61/*=*/) break; + _exports.add(decode(source.slice(startPos, endPos))); } break; } @@ -921,39 +935,21 @@ function tryParseRequire (requireType) { if (ch === 40/*(*/) { pos++; ch = commentWhitespace(); - const reexportStart = pos + 1; - if (ch === 39/*'*/) { - singleQuoteString(); - const reexportEnd = pos++; - ch = commentWhitespace(); - if (ch === 41/*)*/) { - switch (requireType) { - case ExportAssign: - reexports.add(source.slice(reexportStart, reexportEnd)); - return true; - case ExportStar: - reexports.add(source.slice(reexportStart, reexportEnd)); - return true; - default: - lastStarExportSpecifier = source.slice(reexportStart, reexportEnd); - return true; - } - } - } - else if (ch === 34/*"*/) { - doubleQuoteString(); - const reexportEnd = pos++; + const reexportStart = pos; + if (ch === 39/*'*/ || ch === 34/*"*/) { + stringLiteral(ch); + const reexportEnd = ++pos; ch = commentWhitespace(); if (ch === 41/*)*/) { switch (requireType) { case ExportAssign: - reexports.add(source.slice(reexportStart, reexportEnd)); + reexports.add(decode(source.slice(reexportStart, reexportEnd))); return true; case ExportStar: - reexports.add(source.slice(reexportStart, reexportEnd)); + reexports.add(decode(source.slice(reexportStart, reexportEnd))); return true; default: - lastStarExportSpecifier = source.slice(reexportStart, reexportEnd); + lastStarExportSpecifier = decode(source.slice(reexportStart, reexportEnd)); return true; } } @@ -982,7 +978,7 @@ function tryParseLiteralExports () { } ch = source.charCodeAt(pos); } - addExport(source.slice(startPos, endPos)); + _exports.add(decode(source.slice(startPos, endPos))); } else if (ch === 46/*.*/ && source.startsWith('..', pos + 1)) { pos += 3; @@ -996,21 +992,20 @@ function tryParseLiteralExports () { ch = commentWhitespace(); } else if (ch === 39/*'*/ || ch === 34/*"*/) { - const startPos = ++pos; - if (identifier() && source.charCodeAt(pos) === ch) { - const endPos = pos++; + const startPos = pos; + stringLiteral(ch); + const endPos = ++pos; + ch = commentWhitespace(); + if (ch === 58/*:*/) { + pos++; ch = commentWhitespace(); - if (ch === 58/*:*/) { - pos++; - ch = commentWhitespace(); - // nothing more complex than identifier expressions for now - if (!identifier()) { - pos = revertPos; - return; - } - ch = source.charCodeAt(pos); - addExport(source.slice(startPos, endPos)); + // nothing more complex than identifier expressions for now + if (!identifier()) { + pos = revertPos; + return; } + ch = source.charCodeAt(pos); + _exports.add(decode(source.slice(startPos, endPos))); } } else { @@ -1248,26 +1243,10 @@ function lineComment () { } } -function singleQuoteString () { - while (pos++ < end) { - let ch = source.charCodeAt(pos); - if (ch === 39/*'*/) - return; - if (ch === 92/*\*/) { - ch = source.charCodeAt(++pos); - if (ch === 13/*\r*/ && source.charCodeAt(pos + 1) === 10/*\n*/) - pos++; - } - else if (isBr(ch)) - break; - } - throw new Error('Unterminated string.'); -} - -function doubleQuoteString () { +function stringLiteral (quote) { while (pos++ < end) { let ch = source.charCodeAt(pos); - if (ch === 34/*"*/) + if (ch === quote) return; if (ch === 92/*\*/) { ch = source.charCodeAt(++pos); diff --git a/deps/cjs-module-lexer/package.json b/deps/cjs-module-lexer/package.json index 8860d897ebeeb0..e550ac682ee9bb 100755 --- a/deps/cjs-module-lexer/package.json +++ b/deps/cjs-module-lexer/package.json @@ -1,6 +1,6 @@ { "name": "cjs-module-lexer", - "version": "1.1.1", + "version": "1.2.1", "description": "Lexes CommonJS modules, returning their named exports metadata", "main": "lexer.js", "exports": { diff --git a/deps/llhttp/README.md b/deps/llhttp/README.md index ff72e07f8ba99d..fcbf86c12b6553 100644 --- a/deps/llhttp/README.md +++ b/deps/llhttp/README.md @@ -90,6 +90,7 @@ if (err == HPE_OK) { parser.reason); } ``` +For more information on API usage, please refer to [src/native/api.h](https://github.com/nodejs/llhttp/blob/master/src/native/api.h). --- diff --git a/deps/llhttp/include/llhttp.h b/deps/llhttp/include/llhttp.h index 8f9590d350c749..aa488b0f2f0de8 100644 --- a/deps/llhttp/include/llhttp.h +++ b/deps/llhttp/include/llhttp.h @@ -1,9 +1,9 @@ #ifndef INCLUDE_LLHTTP_H_ #define INCLUDE_LLHTTP_H_ -#define LLHTTP_VERSION_MAJOR 5 -#define LLHTTP_VERSION_MINOR 1 -#define LLHTTP_VERSION_PATCH 0 +#define LLHTTP_VERSION_MAJOR 6 +#define LLHTTP_VERSION_MINOR 0 +#define LLHTTP_VERSION_PATCH 1 #ifndef LLHTTP_STRICT_MODE # define LLHTTP_STRICT_MODE 0 @@ -231,7 +231,12 @@ typedef enum llhttp_method llhttp_method_t; XX(31, LINK, LINK) \ XX(32, UNLINK, UNLINK) \ XX(33, SOURCE, SOURCE) \ - XX(34, PRI, PRI) \ + + +#define RTSP_METHOD_MAP(XX) \ + XX(1, GET, GET) \ + XX(3, POST, POST) \ + XX(6, OPTIONS, OPTIONS) \ XX(35, DESCRIBE, DESCRIBE) \ XX(36, ANNOUNCE, ANNOUNCE) \ XX(37, SETUP, SETUP) \ @@ -245,6 +250,54 @@ typedef enum llhttp_method llhttp_method_t; XX(45, FLUSH, FLUSH) \ +#define HTTP_ALL_METHOD_MAP(XX) \ + XX(0, DELETE, DELETE) \ + XX(1, GET, GET) \ + XX(2, HEAD, HEAD) \ + XX(3, POST, POST) \ + XX(4, PUT, PUT) \ + XX(5, CONNECT, CONNECT) \ + XX(6, OPTIONS, OPTIONS) \ + XX(7, TRACE, TRACE) \ + XX(8, COPY, COPY) \ + XX(9, LOCK, LOCK) \ + XX(10, MKCOL, MKCOL) \ + XX(11, MOVE, MOVE) \ + XX(12, PROPFIND, PROPFIND) \ + XX(13, PROPPATCH, PROPPATCH) \ + XX(14, SEARCH, SEARCH) \ + XX(15, UNLOCK, UNLOCK) \ + XX(16, BIND, BIND) \ + XX(17, REBIND, REBIND) \ + XX(18, UNBIND, UNBIND) \ + XX(19, ACL, ACL) \ + XX(20, REPORT, REPORT) \ + XX(21, MKACTIVITY, MKACTIVITY) \ + XX(22, CHECKOUT, CHECKOUT) \ + XX(23, MERGE, MERGE) \ + XX(24, MSEARCH, M-SEARCH) \ + XX(25, NOTIFY, NOTIFY) \ + XX(26, SUBSCRIBE, SUBSCRIBE) \ + XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ + XX(28, PATCH, PATCH) \ + XX(29, PURGE, PURGE) \ + XX(30, MKCALENDAR, MKCALENDAR) \ + XX(31, LINK, LINK) \ + XX(32, UNLINK, UNLINK) \ + XX(33, SOURCE, SOURCE) \ + XX(34, PRI, PRI) \ + XX(35, DESCRIBE, DESCRIBE) \ + XX(36, ANNOUNCE, ANNOUNCE) \ + XX(37, SETUP, SETUP) \ + XX(38, PLAY, PLAY) \ + XX(39, PAUSE, PAUSE) \ + XX(40, TEARDOWN, TEARDOWN) \ + XX(41, GET_PARAMETER, GET_PARAMETER) \ + XX(42, SET_PARAMETER, SET_PARAMETER) \ + XX(43, REDIRECT, REDIRECT) \ + XX(44, RECORD, RECORD) \ + XX(45, FLUSH, FLUSH) \ + #ifdef __cplusplus } /* extern "C" */ @@ -274,6 +327,7 @@ struct llhttp_settings_s { /* Possible return values 0, -1, `HPE_PAUSED` */ llhttp_cb on_message_begin; + /* Possible return values 0, -1, HPE_USER */ llhttp_data_cb on_url; llhttp_data_cb on_status; llhttp_data_cb on_header_field; @@ -290,6 +344,7 @@ struct llhttp_settings_s { */ llhttp_cb on_headers_complete; + /* Possible return values 0, -1, HPE_USER */ llhttp_data_cb on_body; /* Possible return values 0, -1, `HPE_PAUSED` */ @@ -302,6 +357,7 @@ struct llhttp_settings_s { llhttp_cb on_chunk_header; llhttp_cb on_chunk_complete; + /* Information-only callbacks, return value is ignored */ llhttp_cb on_url_complete; llhttp_cb on_status_complete; llhttp_cb on_header_field_complete; diff --git a/deps/llhttp/src/api.c b/deps/llhttp/src/api.c index 8a4bdd26bb771a..36f42fdc1c7fac 100644 --- a/deps/llhttp/src/api.c +++ b/deps/llhttp/src/api.c @@ -4,7 +4,7 @@ #include "llhttp.h" -#define CALLBACK_MAYBE(PARSER, NAME, ...) \ +#define CALLBACK_MAYBE(PARSER, NAME) \ do { \ const llhttp_settings_t* settings; \ settings = (const llhttp_settings_t*) (PARSER)->settings; \ @@ -12,7 +12,22 @@ err = 0; \ break; \ } \ - err = settings->NAME(__VA_ARGS__); \ + err = settings->NAME((PARSER)); \ + } while (0) + +#define SPAN_CALLBACK_MAYBE(PARSER, NAME, START, LEN) \ + do { \ + const llhttp_settings_t* settings; \ + settings = (const llhttp_settings_t*) (PARSER)->settings; \ + if (settings == NULL || settings->NAME == NULL) { \ + err = 0; \ + break; \ + } \ + err = settings->NAME((PARSER), (START), (LEN)); \ + if (err == -1) { \ + err = HPE_USER; \ + llhttp_set_error_reason((PARSER), "Span callback error in " #NAME); \ + } \ } while (0) void llhttp_init(llhttp_t* parser, llhttp_type_t type, @@ -123,7 +138,7 @@ llhttp_errno_t llhttp_finish(llhttp_t* parser) { switch (parser->finish) { case HTTP_FINISH_SAFE_WITH_CB: - CALLBACK_MAYBE(parser, on_message_complete, parser); + CALLBACK_MAYBE(parser, on_message_complete); if (err != HPE_OK) return err; /* FALLTHROUGH */ @@ -199,7 +214,7 @@ const char* llhttp_errno_name(llhttp_errno_t err) { const char* llhttp_method_name(llhttp_method_t method) { #define HTTP_METHOD_GEN(NUM, NAME, STRING) case HTTP_##NAME: return #STRING; switch (method) { - HTTP_METHOD_MAP(HTTP_METHOD_GEN) + HTTP_ALL_METHOD_MAP(HTTP_METHOD_GEN) default: abort(); } #undef HTTP_METHOD_GEN @@ -237,98 +252,98 @@ void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled) { int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_message_begin, s); + CALLBACK_MAYBE(s, on_message_begin); return err; } int llhttp__on_url(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_url, s, p, endp - p); + SPAN_CALLBACK_MAYBE(s, on_url, p, endp - p); return err; } int llhttp__on_url_complete(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_url_complete, s); + CALLBACK_MAYBE(s, on_url_complete); return err; } int llhttp__on_status(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_status, s, p, endp - p); + SPAN_CALLBACK_MAYBE(s, on_status, p, endp - p); return err; } int llhttp__on_status_complete(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_status_complete, s); + CALLBACK_MAYBE(s, on_status_complete); return err; } int llhttp__on_header_field(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_header_field, s, p, endp - p); + SPAN_CALLBACK_MAYBE(s, on_header_field, p, endp - p); return err; } int llhttp__on_header_field_complete(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_header_field_complete, s); + CALLBACK_MAYBE(s, on_header_field_complete); return err; } int llhttp__on_header_value(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_header_value, s, p, endp - p); + SPAN_CALLBACK_MAYBE(s, on_header_value, p, endp - p); return err; } int llhttp__on_header_value_complete(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_header_value_complete, s); + CALLBACK_MAYBE(s, on_header_value_complete); return err; } int llhttp__on_headers_complete(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_headers_complete, s); + CALLBACK_MAYBE(s, on_headers_complete); return err; } int llhttp__on_message_complete(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_message_complete, s); + CALLBACK_MAYBE(s, on_message_complete); return err; } int llhttp__on_body(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_body, s, p, endp - p); + SPAN_CALLBACK_MAYBE(s, on_body, p, endp - p); return err; } int llhttp__on_chunk_header(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_chunk_header, s); + CALLBACK_MAYBE(s, on_chunk_header); return err; } int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) { int err; - CALLBACK_MAYBE(s, on_chunk_complete, s); + CALLBACK_MAYBE(s, on_chunk_complete); return err; } diff --git a/deps/node-inspect/.editorconfig b/deps/node-inspect/.editorconfig deleted file mode 100644 index beffa3084e7a69..00000000000000 --- a/deps/node-inspect/.editorconfig +++ /dev/null @@ -1,11 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/deps/node-inspect/.eslintrc b/deps/node-inspect/.eslintrc deleted file mode 100644 index b6d45aa499655b..00000000000000 --- a/deps/node-inspect/.eslintrc +++ /dev/null @@ -1,147 +0,0 @@ -root: true - -env: - node: true - es6: true - -parserOptions: - ecmaVersion: 2017 - -rules: - # Possible Errors - # http://eslint.org/docs/rules/#possible-errors - comma-dangle: [2, only-multiline] - no-control-regex: 2 - no-debugger: 2 - no-dupe-args: 2 - no-dupe-keys: 2 - no-duplicate-case: 2 - no-empty-character-class: 2 - no-ex-assign: 2 - no-extra-boolean-cast: 2 - no-extra-parens: [2, functions] - no-extra-semi: 2 - no-func-assign: 2 - no-invalid-regexp: 2 - no-irregular-whitespace: 2 - no-obj-calls: 2 - no-proto: 2 - no-template-curly-in-string: 2 - no-unexpected-multiline: 2 - no-unreachable: 2 - no-unsafe-negation: 2 - use-isnan: 2 - valid-typeof: 2 - - # Best Practices - # http://eslint.org/docs/rules/#best-practices - dot-location: [2, property] - no-fallthrough: 2 - no-global-assign: 2 - no-multi-spaces: 2 - no-octal: 2 - no-redeclare: 2 - no-self-assign: 2 - no-unused-labels: 2 - no-useless-call: 2 - no-useless-escape: 2 - no-void: 2 - no-with: 2 - - # Strict Mode - # http://eslint.org/docs/rules/#strict-mode - strict: [2, global] - - # Variables - # http://eslint.org/docs/rules/#variables - no-delete-var: 2 - no-undef: 2 - no-unused-vars: [2, {args: none}] - - # Node.js and CommonJS - # http://eslint.org/docs/rules/#nodejs-and-commonjs - no-mixed-requires: 2 - no-new-require: 2 - no-path-concat: 2 - no-restricted-modules: [2, sys, _linklist] - no-restricted-properties: [2, { - object: assert, - property: deepEqual, - message: Please use assert.deepStrictEqual(). - }, { - property: __defineGetter__, - message: __defineGetter__ is deprecated. - }, { - property: __defineSetter__, - message: __defineSetter__ is deprecated. - }] - - # Stylistic Issues - # http://eslint.org/docs/rules/#stylistic-issues - brace-style: [2, 1tbs, {allowSingleLine: true}] - comma-spacing: 2 - comma-style: 2 - computed-property-spacing: 2 - eol-last: 2 - func-call-spacing: 2 - func-name-matching: 2 - indent: [2, 2, {SwitchCase: 1, MemberExpression: 1}] - key-spacing: [2, {mode: minimum}] - keyword-spacing: 2 - linebreak-style: [2, unix] - max-len: [2, 80, 2] - new-parens: 2 - no-mixed-spaces-and-tabs: 2 - no-multiple-empty-lines: [2, {max: 2, maxEOF: 0, maxBOF: 0}] - no-tabs: 2 - no-trailing-spaces: 2 - quotes: [2, single, avoid-escape] - semi: 2 - semi-spacing: 2 - space-before-blocks: [2, always] - space-before-function-paren: [2, never] - space-in-parens: [2, never] - space-infix-ops: 2 - space-unary-ops: 2 - - # ECMAScript 6 - # http://eslint.org/docs/rules/#ecmascript-6 - arrow-parens: [2, always] - arrow-spacing: [2, {before: true, after: true}] - constructor-super: 2 - no-class-assign: 2 - no-confusing-arrow: 2 - no-const-assign: 2 - no-dupe-class-members: 2 - no-new-symbol: 2 - no-this-before-super: 2 - prefer-const: [2, {ignoreReadBeforeAssign: true}] - rest-spread-spacing: 2 - template-curly-spacing: 2 - - # Custom rules in tools/eslint-rules - align-function-arguments: 2 - align-multiline-assignment: 2 - assert-fail-single-argument: 2 - new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError] - -# Global scoped method and vars -globals: - COUNTER_HTTP_CLIENT_REQUEST: false - COUNTER_HTTP_CLIENT_RESPONSE: false - COUNTER_HTTP_SERVER_REQUEST: false - COUNTER_HTTP_SERVER_RESPONSE: false - COUNTER_NET_SERVER_CONNECTION: false - COUNTER_NET_SERVER_CONNECTION_CLOSE: false - DTRACE_HTTP_CLIENT_REQUEST: false - DTRACE_HTTP_CLIENT_RESPONSE: false - DTRACE_HTTP_SERVER_REQUEST: false - DTRACE_HTTP_SERVER_RESPONSE: false - DTRACE_NET_SERVER_CONNECTION: false - DTRACE_NET_STREAM_END: false - LTTNG_HTTP_CLIENT_REQUEST: false - LTTNG_HTTP_CLIENT_RESPONSE: false - LTTNG_HTTP_SERVER_REQUEST: false - LTTNG_HTTP_SERVER_RESPONSE: false - LTTNG_NET_SERVER_CONNECTION: false - LTTNG_NET_STREAM_END: false diff --git a/deps/node-inspect/.github/workflows/ci.yml b/deps/node-inspect/.github/workflows/ci.yml deleted file mode 100644 index 968316a34779a5..00000000000000 --- a/deps/node-inspect/.github/workflows/ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Node CI - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - node-version: - # See https://github.com/nodejs/node-inspect/pull/78 - # - 10.x - - 12.x - - 13.x - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: npm install, build, and test - run: | - npm install - npm run build --if-present - npm test - env: - CI: true diff --git a/deps/node-inspect/.gitignore b/deps/node-inspect/.gitignore deleted file mode 100644 index 72e2c8c18012a8..00000000000000 --- a/deps/node-inspect/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -npm-debug.log -/tmp -/.vs diff --git a/deps/node-inspect/.npmrc b/deps/node-inspect/.npmrc deleted file mode 100644 index b7c8444fee52a6..00000000000000 --- a/deps/node-inspect/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -registry=https://registry.npmjs.org -package-lock=false diff --git a/deps/node-inspect/.travis.yml b/deps/node-inspect/.travis.yml deleted file mode 100644 index 07418a91eb7986..00000000000000 --- a/deps/node-inspect/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: node_js -node_js: - - '6.8' -before_deploy: - - git config --global user.email "jan.krems@gmail.com" - - git config --global user.name "Jan Krems" -deploy: - provider: script - script: ./node_modules/.bin/nlm release - skip_cleanup: true - 'on': - branch: master - node: '6.8' diff --git a/deps/node-inspect/CHANGELOG.md b/deps/node-inspect/CHANGELOG.md deleted file mode 100644 index 73aeb4df93fe8b..00000000000000 --- a/deps/node-inspect/CHANGELOG.md +++ /dev/null @@ -1,296 +0,0 @@ -### 1.11.6 - -* fix: replace the deprecated "repl.cli" with "repl" - **[@oyyd](https://github.com/oyyd)** [#66](https://github.com/nodejs/node-inspect/pull/66) - - [`5c1d771`](https://github.com/nodejs/node-inspect/commit/5c1d7716523b73e26f98f4f594ee34b7daa920a0) **fix:** replace the deprecated "repl.cli" with "repl" - see: [26260](Refs: https://github.com/nodejs/node/pull/26260) -* Address regressions due to changes in node - **[@jkrems](https://github.com/jkrems)** [#67](https://github.com/nodejs/node-inspect/pull/67) - - [`5b3511e`](https://github.com/nodejs/node-inspect/commit/5b3511ef21d0eba8304d8b2fed33f33aae22f308) **fix:** Address regressions due to changes in node - - -### 1.11.5 - -* Fix eslint issues - **[@jkrems](https://github.com/jkrems)** [#63](https://github.com/nodejs/node-inspect/pull/63) - - [`2adadbc`](https://github.com/nodejs/node-inspect/commit/2adadbc1086d2e374c425acbf96260a122705db2) **style:** Fix eslint issues - - [`a6d2f88`](https://github.com/nodejs/node-inspect/commit/a6d2f882c026409696a1b063ff40ceba7e1ddb86) **doc:** Remove redundant newline at the end - - -### 1.11.4 - -* Handle blocked port - **[@jkrems](https://github.com/jkrems)** [#62](https://github.com/nodejs/node-inspect/pull/62) - - [`3388969`](https://github.com/nodejs/node-inspect/commit/3388969d0032a78ff0cdb8146f170b978ec13b7b) **chore:** Disable package-lock - - [`d278b23`](https://github.com/nodejs/node-inspect/commit/d278b233ae5e11a2b62d01ccbaae594f39b32a96) **fix:** Stop asking to report a blocked port - see: [#60](https://github.com/nodejs/node-inspect/issues/60) - - -### 1.11.3 - -* [`93caa0f`](https://github.com/nodejs/node-inspect/commit/93caa0f5267c7ab452b258d3b03329a0bb5ac7f7) **docs:** Add missing oc in protocol -* [`2d87cbe`](https://github.com/nodejs/node-inspect/commit/2d87cbe76aa968dfc1ac69d9571af1be81abd8e0) **fix:** Make --inspect-port=0 work -* [`ebfd02e`](https://github.com/nodejs/node-inspect/commit/ebfd02ece9b642586023f7791da71defeb13d746) **chore:** Bump tap to 10.7 -* [`c07adb1`](https://github.com/nodejs/node-inspect/commit/c07adb17b164c1cf3da8d38659ea9f5d7ff42e9c) **test:** Use useful break location -* [`94f0bf9`](https://github.com/nodejs/node-inspect/commit/94f0bf97d24c376baf3ecced2088d81715a73464) **fix:** Fix `takeHeapSnapshot()` truncation bug - - -### 1.11.2 - -* [`42e0cd1`](https://github.com/nodejs/node-inspect/commit/42e0cd111d89ed09faba1c0ec45089b0b44de011) **fix:** look for generic hint text - - -### 1.11.1 - -* Prefer --inspect-brk over --debug-brk - **[@ofrobots](https://github.com/ofrobots)** [#43](https://github.com/nodejs/node-inspect/pull/43) - - [`2c1ed27`](https://github.com/nodejs/node-inspect/commit/2c1ed27ee44d9aebb3c5ac50039abae8166a54e3) **fix:** use --inspect-brk with Node 8+ - - -### 1.11.0 - -* doc: add profile and heap to help - **[@joshgav](https://github.com/joshgav)** [#39](https://github.com/nodejs/node-inspect/pull/39) - - [`f64c920`](https://github.com/nodejs/node-inspect/commit/f64c9205bd8382289660aa677d3ac192a9c81fd5) **doc:** add profile and heap to help -* Update test suite to pass on latest nightly - **[@jkrems](https://github.com/jkrems)** [#36](https://github.com/nodejs/node-inspect/pull/36) - - [`41148d7`](https://github.com/nodejs/node-inspect/commit/41148d74a2d563eea3b7ad5463622b6b9fd4c46e) **test:** Remove outdated test - - [`2c224c5`](https://github.com/nodejs/node-inspect/commit/2c224c551619e386e80fc3154cc14562cac063b9) **test:** Accept any kind of "break" - - [`22bf349`](https://github.com/nodejs/node-inspect/commit/22bf349bc86d7bf6fd449791c9d1e7eaf66c2681) **test:** Adjust for v8 5.7 - - [`6ce8c16`](https://github.com/nodejs/node-inspect/commit/6ce8c165c45a491bea8cfb3c67d2ae80e7c34dcb) **test:** Revert to old assertions -* Verify custom port support - **[@jkrems](https://github.com/jkrems)** [#41](https://github.com/nodejs/node-inspect/pull/41) - - [`e3a489f`](https://github.com/nodejs/node-inspect/commit/e3a489f23b089d3d57a25d5efe40daf06de63e23) **test:** custom port -* Support for debugging a pid - **[@jkrems](https://github.com/jkrems)** [#37](https://github.com/nodejs/node-inspect/pull/37) - - [`4179506`](https://github.com/nodejs/node-inspect/commit/4179506a4d546bac2c93b2a7ff491b1fa4494fd9) **feat:** Support for debugging a pid - - -### 1.10.6 - -* chore: Fix usage text for embedded mode - **[@addaleax](https://github.com/addaleax)** [#20](https://github.com/nodejs/node-inspect/pull/20) - - [`b0779f5`](https://github.com/nodejs/node-inspect/commit/b0779f597104e9ada5681f64d7e714525b753511) **chore:** Fix usage text for embedded mode -* print 'ok' after connection - **[@ofrobots](https://github.com/ofrobots)** [#25](https://github.com/nodejs/node-inspect/pull/25) - - [`2a47125`](https://github.com/nodejs/node-inspect/commit/2a4712577f6996fbb078dcfcd7320c397685d76a) **fix:** print 'ok' after connection -* Make autocompletion in REPL work - **[@aqrln](https://github.com/aqrln)** [#28](https://github.com/nodejs/node-inspect/pull/28) - - [`ccab737`](https://github.com/nodejs/node-inspect/commit/ccab737399249a8c2230ed6adfec579c7d724364) **fix:** Make autocompletion in REPL work -* Remove console.error() statement - **[@aqrln](https://github.com/aqrln)** [#30](https://github.com/nodejs/node-inspect/pull/30) - - [`032b045`](https://github.com/nodejs/node-inspect/commit/032b045d4d73622c77b7ebcc26781c6ad98200b3) **style:** Remove console.error() statement -* Take --debug-port into account - **[@jkrems](https://github.com/jkrems)** [#26](https://github.com/nodejs/node-inspect/pull/26) - - [`054d4b1`](https://github.com/nodejs/node-inspect/commit/054d4b10e65f12a3a4b10b4c0ab2a4768cc5e893) **fix:** Take --debug-port into account -* Delay run until breakpoints are restored - **[@jkrems](https://github.com/jkrems)** [#34](https://github.com/nodejs/node-inspect/pull/34) - - [`802b88c`](https://github.com/nodejs/node-inspect/commit/802b88c8ad0a57608cb9e0cb4bf46ed683bb6344) **fix:** Delay run until breakpoints are restored - - [`2b93173`](https://github.com/nodejs/node-inspect/commit/2b93173d95e7f8b30d85603613cb2ae3b3ec18db) **fix:** Use single string for paused notice - - [`b4d5ee2`](https://github.com/nodejs/node-inspect/commit/b4d5ee2a3d25613b35a2e8e10a0eb75582cc5654) **fix:** Work around inconsistent handling of strict directive - - [`f6ccfc7`](https://github.com/nodejs/node-inspect/commit/f6ccfc7f4d00ad4fdf3b581b677f8d7f1699c44c) **fix:** Only restart after port is free - - [`8b101bf`](https://github.com/nodejs/node-inspect/commit/8b101bf669ca102df4980bfad3e0436ef1c2f1a4) **test:** Skip exact match on AIX -* [`a4e4b6f`](https://github.com/nodejs/node-inspect/commit/a4e4b6feeba4dedfd2c89ef32f39e813314d3bbd) **chore:** Fix repo info in package.json - - -### 1.10.5 - -* docs: minor edits to governance docs - **[@joshgav](https://github.com/joshgav)** [#17](https://github.com/buggerjs/node-inspect/pull/17) - - [`a70fe04`](https://github.com/buggerjs/node-inspect/commit/a70fe04bdde9b7c74588685066291f9b11183328) **docs:** minor edits to governance docs - - -### 1.10.4 - -* [`1c31bf7`](https://github.com/buggerjs/node-inspect/commit/1c31bf7d1b3ea1b424ae0662526596670cb506c9) **chore:** Support embedded mode - - -### 1.10.3 - -* [`7b20379`](https://github.com/buggerjs/node-inspect/commit/7b20379069af692a9038a31a4465f72db9eb532f) **chore:** Mark .eslintrc as root - - -### 1.10.2 - -* Run tests on windows - **[@jkrems](https://github.com/jkrems)** [#16](https://github.com/buggerjs/node-inspect/pull/16) - - [`5a57f98`](https://github.com/buggerjs/node-inspect/commit/5a57f9865e02eef0763c2a7f26236c34a632ccdd) **chore:** Run tests on windows - - [`0a04b50`](https://github.com/buggerjs/node-inspect/commit/0a04b50cc8b4dc6ce868927c635c479d75ce71f4) **chore:** Bump nlm to get rid of postinstall - - [`4a8b27c`](https://github.com/buggerjs/node-inspect/commit/4a8b27cea814a37895effd2a0c1b85dbfee3a7f4) **test:** Remove unix path assumptions - - -### 1.10.1 - -* [`4ba3c72`](https://github.com/buggerjs/node-inspect/commit/4ba3c72270fae9a71343ddca11aa27980678a67c) **refactor:** Undo weird bundling into one file - - -### 1.10.0 - -* [`3e1a66a`](https://github.com/buggerjs/node-inspect/commit/3e1a66a489bef19beaa5f859e99e027274ff43cb) **feat:** Support CPU & heap profiles - - -### 1.9.3 - -* Move back to single file - **[@jkrems](https://github.com/jkrems)** [#15](https://github.com/buggerjs/node-inspect/pull/15) - - [`9877660`](https://github.com/buggerjs/node-inspect/commit/9877660a73ff0ec0885ad7f939ba62020a46b4b6) **refactor:** Wrap client in IIFE - - [`7795c53`](https://github.com/buggerjs/node-inspect/commit/7795c533f0605eb128db610a5874b27e555251ef) **refactor:** Move more code in createRepl scope - - [`be34a39`](https://github.com/buggerjs/node-inspect/commit/be34a398e823612bdf5ac90bad5222af27035a00) **refactor:** Move back to single file - - [`ab45b62`](https://github.com/buggerjs/node-inspect/commit/ab45b6273dc0d3a49d3cf46a80cb48ab79d1caf8) **refactor:** Remove single-use functions - - [`37a711e`](https://github.com/buggerjs/node-inspect/commit/37a711ed5334c06ed4d85f995e567a9f176a68d5) **style:** Stop using `new Buffer` - - [`d669dc5`](https://github.com/buggerjs/node-inspect/commit/d669dc593f5ad5ca7a48f19f0905ef66ec0e540d) **chore:** Switch to node eslint rules - - [`15e7917`](https://github.com/buggerjs/node-inspect/commit/15e79177918d96dcffd2384715faf0308e97a26c) **style:** Use var in classical for loops - - -### 1.9.2 - -* [`c9dc4be`](https://github.com/buggerjs/node-inspect/commit/c9dc4beb08236e33d64f19417682cf5b3f5aeed6) **doc:** Link directly to GOVERNANCE file - - -### 1.9.1 - -* Handle big ws frames correctly - **[@jkrems](https://github.com/jkrems)** [#14](https://github.com/buggerjs/node-inspect/pull/14) - - [`f80100e`](https://github.com/buggerjs/node-inspect/commit/f80100e932710d232d074b239cbf8fefa564c789) **fix:** Handle big ws frames correctly - see: [#10](https://github.com/buggerjs/node-inspect/issues/10) - - -### 1.9.0 - -* Support for low-level agent access - **[@jkrems](https://github.com/jkrems)** [#13](https://github.com/buggerjs/node-inspect/pull/13) - - [`90ed431`](https://github.com/buggerjs/node-inspect/commit/90ed4310c62d130637c12f8ecdb752075c43ac36) **feat:** Support for low-level agent access - - -### 1.8.4 - -* Use proper path for websocket - **[@jkrems](https://github.com/jkrems)** [#12](https://github.com/buggerjs/node-inspect/pull/12) - - [`3405225`](https://github.com/buggerjs/node-inspect/commit/3405225979dfc2058bcc6d1b90f41c060dbd1f92) **fix:** Use proper path for websocket - see: [#11](https://github.com/buggerjs/node-inspect/issues/11) - - -### 1.8.3 - -* [`6f9883d`](https://github.com/buggerjs/node-inspect/commit/6f9883d4b29419831133988981b83e891b19739a) **fix:** Breakpoints & scripts work when not paused -* [`ecb1362`](https://github.com/buggerjs/node-inspect/commit/ecb1362c842e6ed5bc28c091a32bfd540742db75) **chore:** Pin node to 6.8 - - -### 1.8.2 - -* [`4219a98`](https://github.com/buggerjs/node-inspect/commit/4219a98d6514f1068feabce2945c21a0d5ba6561) **refactor:** Decouple source snippet from repl - - -### 1.8.1 - -* [`95402ee`](https://github.com/buggerjs/node-inspect/commit/95402ee5dff04057f074677d39db2f61ec74c151) **refactor:** Move `list` into CallFrame - - -### 1.8.0 - -* [`d0e6499`](https://github.com/buggerjs/node-inspect/commit/d0e6499084f5d656ef0c5fd470d3ab21f2e9a6b4) **feat:** `exec .scope` - - -### 1.7.0 - -* `breakOn{Exception,Uncaught,None}` - **[@jkrems](https://github.com/jkrems)** [#8](https://github.com/buggerjs/node-inspect/pull/8) - - [`fa8c4c7`](https://github.com/buggerjs/node-inspect/commit/fa8c4c7d7bb6972733c92da4d04fdd62c02b0e3b) **feat:** `breakOn{Exception,Uncaught,None}` - see: [#6](https://github.com/buggerjs/node-inspect/issues/6) - - -### 1.6.0 - -* Add `help` command - **[@jkrems](https://github.com/jkrems)** [#7](https://github.com/buggerjs/node-inspect/pull/7) - - [`09b37a0`](https://github.com/buggerjs/node-inspect/commit/09b37a02e04e16a38ce27f69538d3b098548b47c) **feat:** Add `help` command - see: [#5](https://github.com/buggerjs/node-inspect/issues/5) - - -### 1.5.0 - -* [`7e0fd99`](https://github.com/buggerjs/node-inspect/commit/7e0fd99fcfc65d8b647a2259df78f4cabf1d3d63) **feat:** Add `r` shortcut for `run` - - -### 1.4.1 - -* [`484d098`](https://github.com/buggerjs/node-inspect/commit/484d0983f06d6ff9639ab5197ba0a58313f532df) **chore:** Remove old implementation - - -### 1.4.0 - -* Properly tested implementation - **[@jkrems](https://github.com/jkrems)** [#4](https://github.com/buggerjs/node-inspect/pull/4) - - [`ba060d3`](https://github.com/buggerjs/node-inspect/commit/ba060d3ef65ae84df2a3a9b9f16d563f3c4b29be) **feat:** Error handling w/o args - - [`b39b3bc`](https://github.com/buggerjs/node-inspect/commit/b39b3bc07c13adc48fc8bb720889285c51e62548) **feat:** Launch child - - [`481693f`](https://github.com/buggerjs/node-inspect/commit/481693f676ee099b7787cd2426b980858e973602) **feat:** Connect debug client - - [`3bba0f2`](https://github.com/buggerjs/node-inspect/commit/3bba0f2416b2e3b4e6010de675003fcc328b16e8) **chore:** Disable lint for inactive code - - [`cc7bdfc`](https://github.com/buggerjs/node-inspect/commit/cc7bdfcf7f21ef5cd5c32c7800407238b0d4f100) **feat:** Properly fail with invalid host:port - - [`73f34f9`](https://github.com/buggerjs/node-inspect/commit/73f34f902634e9778597e129f46895aa8b643d72) **refactor:** Remove unused field - - [`6a23e0c`](https://github.com/buggerjs/node-inspect/commit/6a23e0cf3179f43ca6fc5a0fa2b1dd18ebc044b5) **refactor:** Better debug output & support node 6.6 - - [`63b0f9b`](https://github.com/buggerjs/node-inspect/commit/63b0f9b6ef8bd9af0f7cb14a5938a45838731fc9) **test:** Add timeout to waitFor(pattern) - - [`cfa197b`](https://github.com/buggerjs/node-inspect/commit/cfa197bf8325a1a4ca1b296f8d6971d368bfbfbb) **refactor:** Move REPL setup into own file - - [`3f46c2c`](https://github.com/buggerjs/node-inspect/commit/3f46c2c43f836e1135b66871087aa74969f6b330) **feat:** Working repl eval - - [`6911eb1`](https://github.com/buggerjs/node-inspect/commit/6911eb1a00b964bc5683506d433fa4f665f5a82c) **feat:** Enter repeats last command - - [`7d20b7d`](https://github.com/buggerjs/node-inspect/commit/7d20b7deadf1b251ea8cf2cc9167c175624932c4) **chore:** Add missing license header - - [`23c62f8`](https://github.com/buggerjs/node-inspect/commit/23c62f8375ca7c8b71d032047e728dace02f4efa) **feat:** Print break context - - [`5dbc83d`](https://github.com/buggerjs/node-inspect/commit/5dbc83df31171f9c38a974c99340bde26f2e24ec) **feat:** Stepping and breakpoints - - [`8deb8cc`](https://github.com/buggerjs/node-inspect/commit/8deb8cc36b9fca432ab8df63a82e9de7ab5adaf0) **feat:** list for printing source - - [`1ed2ec9`](https://github.com/buggerjs/node-inspect/commit/1ed2ec9937070652be611dbb6b11dfb42cb840f8) **chore:** Disable verbose output on CI - - [`625a435`](https://github.com/buggerjs/node-inspect/commit/625a435925dd8fd980bed2dc9e3fd73dd27df4ef) **fix:** Gracefully handle delayed scriptParsed - - [`8823c60`](https://github.com/buggerjs/node-inspect/commit/8823c60d347600b2313cfdd8cb5e96fe02419a8a) **chore:** Run all the tests - - [`00506f7`](https://github.com/buggerjs/node-inspect/commit/00506f763928cc440505a81030167a11b9a84e00) **feat:** backtrace/bt - - [`e1ee02d`](https://github.com/buggerjs/node-inspect/commit/e1ee02d5cc389916489d387d07d5dd161230427a) **refactor:** Leverage util.inspect.custom - - [`5dcc319`](https://github.com/buggerjs/node-inspect/commit/5dcc31922d40f56c7435319d1538390a442e8e4b) **feat:** scripts and scripts(true) - - [`085cd5a`](https://github.com/buggerjs/node-inspect/commit/085cd5a76a961edfcaa342fff5eb09bf2f9c8983) **refactor:** Consistent import style - - [`1c60f91`](https://github.com/buggerjs/node-inspect/commit/1c60f91f233848c05d865617dc7f5aacb36270b6) **feat:** Set breakpoint before file is loaded - - [`bc82ecc`](https://github.com/buggerjs/node-inspect/commit/bc82eccb2a1a7c0f5332371254f6584e748216aa) **feat:** breakpoints to list breakpoints - - [`7f48c95`](https://github.com/buggerjs/node-inspect/commit/7f48c9510696ec400d51afaca8d23a9c292640f8) **feat:** watchers & exec - - [`0f8cd13`](https://github.com/buggerjs/node-inspect/commit/0f8cd13a092e5dbeb395ff04cbe2ed97cb986423) **feat:** clearBreakpoint - - [`0d31560`](https://github.com/buggerjs/node-inspect/commit/0d315603bdcb9f4da42fab24dc569c325151269e) **feat:** version to print v8 version - - [`df6b89d`](https://github.com/buggerjs/node-inspect/commit/df6b89df580a9afcb3b8883b0e4224cbcebb384f) **feat:** Paused & global exec - - [`9e97d73`](https://github.com/buggerjs/node-inspect/commit/9e97d73073ceffd70974d45887c84fadb9159d5c) **feat:** repl to enter exec mode - - [`9ee9f90`](https://github.com/buggerjs/node-inspect/commit/9ee9f903d6202f54ed2b3b3559da4006b65d39b5) **feat:** run & restart -* [`3a752aa`](https://github.com/buggerjs/node-inspect/commit/3a752aaa773968bfe16c5f543bd739feed598bea) **feat:** kill -* [`a67e470`](https://github.com/buggerjs/node-inspect/commit/a67e47018b20d46aeeaa7abd27eb8e7770fd0b8f) **feat:** Restore breakpoints on restart - - -### 1.3.3 - -* [`eb7a54c`](https://github.com/buggerjs/node-inspect/commit/eb7a54c6fa731ed3276072c72034046fc5ffbac6) **chore:** Switch to tap for tests - - -### 1.3.2 - -* Add notes about governance - **[@jkrems](https://github.com/jkrems)** [#3](https://github.com/buggerjs/node-inspect/pull/3) - - [`e94089d`](https://github.com/buggerjs/node-inspect/commit/e94089d93689cacf5c953e94563463d1e174452d) **chore:** Add notes about governance - - -### 1.3.1 - -* [`8767137`](https://github.com/buggerjs/node-inspect/commit/8767137c53a2f6b1d36970074ea95be9871e50e3) **style:** Remove rogue console.log - - -### 1.3.0 - -* [`3ac6232`](https://github.com/buggerjs/node-inspect/commit/3ac623219ba44b0af40ef66826610a26a46c7966) **feat:** Add `version` command - - -### 1.2.0 - -* [`86b5812`](https://github.com/buggerjs/node-inspect/commit/86b581218ccab44e6bde259a17ad1e71645a6137) **feat:** scripts & listScripts(true) - - -### 1.1.1 - -* [`feaea38`](https://github.com/buggerjs/node-inspect/commit/feaea385a981e6b72a8d99277fbf575c54e15fc6) **style:** Typo in comment - - -### 1.1.0 - -* [`c64155f`](https://github.com/buggerjs/node-inspect/commit/c64155faa552f71463842a26330aa5bcbfc31670) **feat:** repl command - - -### 1.0.0 - -* [`44c4c79`](https://github.com/buggerjs/node-inspect/commit/44c4c79af5a228ccfd8906f11409b2a33390b878) **chore:** Initial commit -* [`985873c`](https://github.com/buggerjs/node-inspect/commit/985873cfb97146b38480080f9907219c473f1f6f) **feat:** Launching the example works -* [`3d92d05`](https://github.com/buggerjs/node-inspect/commit/3d92d05cca152a2c2647aa64eefc80432638bc4d) **chore:** Proper license and passing tests -* [`b3f99d9`](https://github.com/buggerjs/node-inspect/commit/b3f99d981038b17663fcfd984d2f5d6d9b51ee18) **feat:** Futile attempts to send a valid ws frame -* [`465cfb7`](https://github.com/buggerjs/node-inspect/commit/465cfb7b295aebb48b285c26f6de9c4657fe590d) **feat:** Working ws connection -* [`da9f011`](https://github.com/buggerjs/node-inspect/commit/da9f01118e2b144f2da8cd370113a608526774a1) **fix:** Fix remote connect -* [`5ef33d7`](https://github.com/buggerjs/node-inspect/commit/5ef33d7892cc49becb4c66098fc7927bc74b014a) **feat:** Working step-by-step -* [`534e1e4`](https://github.com/buggerjs/node-inspect/commit/534e1e46b307d61d51eb4c0aab4a3b17c17aea3d) **chore:** Add bin entry -* [`8cff9cf`](https://github.com/buggerjs/node-inspect/commit/8cff9cfb0138b5ecff0f5f6a7839dbfddc0684fd) **style:** Use simpler key thingy -* [`720ec53`](https://github.com/buggerjs/node-inspect/commit/720ec53a5b251ab3caf27f06b60924efb9e03a92) **doc:** Add instructions -* [`b89ad60`](https://github.com/buggerjs/node-inspect/commit/b89ad601b885a417e6433b1609477d8453f498a1) **doc:** More helpful docs -* [`de9243c`](https://github.com/buggerjs/node-inspect/commit/de9243c95eabe733d05952229340808c3cebf129) **feat:** Watchers -* [`e16978f`](https://github.com/buggerjs/node-inspect/commit/e16978ff8e4b2b2bdccf88fd7d3905f525822981) **docs:** Working usage hints -* [`2dbc204`](https://github.com/buggerjs/node-inspect/commit/2dbc2042145fd97169fc7536186a449715e27810) **refactor:** Use proxies -* [`b8c9b14`](https://github.com/buggerjs/node-inspect/commit/b8c9b147713f63181396d5a7fe4c2f737b733b4c) **style:** Remove unused var -* [`f6b4b20`](https://github.com/buggerjs/node-inspect/commit/f6b4b20a1d28d91cfe452b995f7dbe5f7c749e89) **feat:** Nicer inspect of remote values -* [`36887c6`](https://github.com/buggerjs/node-inspect/commit/36887c66bbf26d540f087f80ddfec38462a33bdf) **fix:** Properly print watchers -* [`7729442`](https://github.com/buggerjs/node-inspect/commit/77294426157a28cc76e339cb13916a205182641e) **feat:** Add pause command -* [`e39a713`](https://github.com/buggerjs/node-inspect/commit/e39a7134873f06da37baaa9b6252cede4ad38d7a) **fix:** Properly format boolean properties -* [`f8f51d7`](https://github.com/buggerjs/node-inspect/commit/f8f51d7a01e8d74023306a08a3d6e2da63d123e1) **fix:** Properly format numeric properties -* [`89e6e08`](https://github.com/buggerjs/node-inspect/commit/89e6e087220f3c3cb628ac7541c44298485a2e04) **feat:** Add backtrace command -* [`82362ac`](https://github.com/buggerjs/node-inspect/commit/82362acfc7ce22b4cccc64889ec136dedc8895ec) **feat:** Add setBreakpoint() -* [`7064cce`](https://github.com/buggerjs/node-inspect/commit/7064ccec3b103683088d532abfe5b4e7c066948b) **feat:** Add `setBreakpoint(line)` -* [`360580e`](https://github.com/buggerjs/node-inspect/commit/360580eba4353e81311e56df018eec0ca233da11) **feat:** Add run/kill/restart -* [`b1b576e`](https://github.com/buggerjs/node-inspect/commit/b1b576e2645723a8575df544e0bfb672d60d9d91) **feat:** Add `help` command -* [`2db4660`](https://github.com/buggerjs/node-inspect/commit/2db46609cd1c8543d31ebd5dc47e4c27ec254841) **feat:** Add remaining sb() variants -* [`f2ad1ae`](https://github.com/buggerjs/node-inspect/commit/f2ad1aeedafb154043d70bb9195b10986d311d26) **fix:** Display breakpoints set into the future -* [`73272f9`](https://github.com/buggerjs/node-inspect/commit/73272f9ace1f8546f8cad1d53627dbffba50bb4e) **refactor:** Make breakpoints more inspect friendly -* [`507a71d`](https://github.com/buggerjs/node-inspect/commit/507a71de345a3de7fe144517e9f5ea264ff993e3) **feat:** Add breakpoints command -* [`5fb3e5d`](https://github.com/buggerjs/node-inspect/commit/5fb3e5d17bbcfd45b264431547b3cf0b781c7640) **docs:** Link to Command Line API docs -* [`81af501`](https://github.com/buggerjs/node-inspect/commit/81af501bbf85397e2078310c7f24a9ac5b7f02dc) **chore:** Fix license field diff --git a/deps/node-inspect/CONTRIBUTING.md b/deps/node-inspect/CONTRIBUTING.md deleted file mode 100644 index 012d29471462de..00000000000000 --- a/deps/node-inspect/CONTRIBUTING.md +++ /dev/null @@ -1,181 +0,0 @@ -# Contributing - -🎉🏅 Thanks for helping us improve this project! 🙏 - -This document outlines some of the practices we care about. -If you have any questions or suggestions about the process, -feel free to [open an issue](#reporting-issues). - -## Code of Conduct - -The [Node.js Code of Conduct][] applies to this repo. - -[Node.js Code of Conduct]: https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md - -## Governance - -This project falls under the governance of the Node.js Diagnostics WG as -described at <https://github.com/nodejs/diagnostics/blob/master/GOVERNANCE.md>. - -## Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -* (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -* (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -* (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - -## How Can I Contribute? - -### Reporting Issues - -If you find any mistakes in the docs or a bug in the code, -please [open an issue in Github](https://github.com/nodejs/node-inspect/issues/new) so we can look into it. -You can also [create a PR](#contributing-code) fixing it yourself of course. - -If you report a bug, please follow these guidelines: - -* Make sure the bug exists in the latest version. -* Include instructions on how to reproduce the issue. - The instructions should be as minimal as possible - and answer the three big questions: - 1. What are the exact steps you took? This includes the exact versions of node, npm, and any packages involved. - 1. What result are you expecting? - 1. What is the actual result? - -### Improving Documentation - -For small documentation changes, you can use [Github's editing feature](https://help.github.com/articles/editing-files-in-another-user-s-repository/). -The only thing to keep in mind is to prefix the commit message with "docs: ". -The default commit message generated by Github will lead to a failing CI build. - -For larger updates to the documentation -it might be better to follow the [instructions for contributing code below](#contributing-code). - -### Contributing Code - -**Note:** If you're planning on making substantial changes, -please [open an issue first to discuss your idea](#reporting-issues). -Otherwise you might end up investing a lot of work -only to discover that it conflicts with plans the maintainers might have. - -The general steps for creating a pull request are: - -1. Create a branch for your change. - Always start your branch from the latest `master`. - We often prefix the branch name with our initials, e.g. `jk-a-change`. -1. Run `npm install` to install the dependencies. -1. If you're fixing a bug, be sure to write a test *first*. - That way you can validate that the test actually catches the bug and doesn't pass. -1. Make your changes to the code. - Remember to update the tests if you add new features or change behavior. -1. Run the tests via `npm test`. This will also run style checks and other validations. - You might see errors about uncommitted files. - This is expected until you commit your changes. -1. Once you're done, `git add .` and `git commit`. - Please follow the [commit message conventions](#commits--commit-messages) described below. -1. Push your branch to Github & create a PR. - -#### Code Style - -In addition to any linting rules the project might include, -a few general rules of thumb: - -* Try to match the style of the rest of the code. -* We prefer simple code that is easy to understand over terse, expressive code. -* We try to structure projects by semantics instead of role. - E.g. we'd rather have a `tree.js` module that contains tree traversal-related helpers - than a `helpers.js` module. -* Actually, if you create helpers you might want to put those into a separate package. - That way it's easier to reuse them. - -#### Commits & Commit Messages - -Please follow the [angular commit message conventions](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#-git-commit-guidelines). -We use an automated tool for generating releases -that depends on the conventions to determine the next version and the content of the changelog. -Commit messages that don't follow the conventions will cause `npm test` (and thus CI) to fail. - -The short summary - a commit message should look like this: - -``` -<type>: <subject> - -<body> - -<references> - -<footer> -``` - -Everything but the first line is optional. -The empty lines between the different parts are required. - -* `<type>`: One of the following: - - **feat:** Introduces a new feature. This will cause the minor version to go up. - - **fix:** A bug fix. Causes a patch version bump. - - **docs:** Changes to the documentation. - This will also cause an increase of the patch version so that the changes show up in the npm registry. - - **style:** Cleanup & lint rule fixes. - Note that often it's better to just amend the previous commit if it introduced lint errors. - - **refactor:** Changes to the code structure without fixing bugs or adding features. - - **perf:** Performance optimizations. - - **test:** Fixing existing tests or adding missing ones. - Just like with **style**, if you add tests to a feature you just introduced in the previous commit, - consider keeping the tests and the feature in the same commit instead. - - **chore:** Changes to the project setup and tools, dependency bumps, house-keeping. -* `<subject>`: A [good git commit message subject](http://chris.beams.io/posts/git-commit/#limit-50). - - Keep it brief. If possible the whole first line should have at most 50 characters. - - Use imperative mood. "Create" instead of "creates" or "created". - - No period (".") at the end. -* `<body>`: Motivation for the change and any context required for understanding the choices made. - Just like the subject, it should use imperative mood. -* `<references>`: Any URLs relevant to the PR go here. - Use one line per URL and prefix it with the kind of relationship, e.g. "Closes: " or "See: ". - If you are referencing an issue in your commit body or PR description, - never use `#123` but the full URL to the issue or PR you are referencing. - That way the reference is easy to resolve from the git history without having to "guess" the correct link - even if the commit got cherry-picked or merged into a different project. -* `<footer>`: This part only applies if your commit introduces a breaking change. - It's important this is present, otherwise the major version will not increase. - See below for an example. - -##### Examples - -A feature that introduces a breaking change: - -``` -feat: Support --yes CLI option - -For existing projects all prompts can be inferred automatically. -Manual confirmation for each default provides no value in that case. - -Closes https://github.com/my/project/issues/123 - -BREAKING CHANGE: This removes support for interactive password entry. -Users will have to login beforehand. -``` - -A simple bug fix: - -``` -fix: Handle multi-byte characters in search logic -``` diff --git a/deps/node-inspect/GOVERNANCE.md b/deps/node-inspect/GOVERNANCE.md deleted file mode 100644 index 20e333a247cbfd..00000000000000 --- a/deps/node-inspect/GOVERNANCE.md +++ /dev/null @@ -1,4 +0,0 @@ -# node-inspect Project Governance - -The node-inspect project is governed by the Node.js Diagnostics WG as described -at <https://github.com/nodejs/diagnostics/blob/master/GOVERNANCE.md>. diff --git a/deps/node-inspect/LICENSE b/deps/node-inspect/LICENSE deleted file mode 100644 index d8d7f9437dbf5a..00000000000000 --- a/deps/node-inspect/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright Node.js 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. diff --git a/deps/node-inspect/README.md b/deps/node-inspect/README.md deleted file mode 100644 index b52cc188a62f5b..00000000000000 --- a/deps/node-inspect/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# `node-inspect` - -```bash -npm install --global node-inspect -``` - -For the old V8 debugger protocol, -node has two options: - -1. `node --debug <file>`: Start `file` with remote debugging enabled. -2. `node debug <file>`: Start an interactive CLI debugger for `<file>`. - -But for the Chrome inspector protocol, -there's only one: `node --inspect <file>`. - -This project tries to provide the missing second option -by re-implementing `node debug` against the new protocol. - -``` -Usage: node-inspect script.js - node-inspect <host>:<port> -``` - -#### References - -* [Debugger Documentation](https://nodejs.org/api/debugger.html) -* [EPS: `node inspect` CLI debugger](https://github.com/nodejs/node-eps/pull/42) -* [Debugger Protocol Viewer](https://chromedevtools.github.io/debugger-protocol-viewer/) -* [Command Line API](https://developers.google.com/web/tools/chrome-devtools/debug/command-line/command-line-reference?hl=en) diff --git a/deps/node-inspect/appveyor.yml b/deps/node-inspect/appveyor.yml deleted file mode 100644 index c25a2d013aadbf..00000000000000 --- a/deps/node-inspect/appveyor.yml +++ /dev/null @@ -1,13 +0,0 @@ -environment: - nodejs_version: "6" - -install: -- ps: Install-Product node $env:nodejs_version -- npm install - -test_script: -- node --version -- npm --version -- npm test - -build: off diff --git a/deps/node-inspect/cli.js b/deps/node-inspect/cli.js deleted file mode 100755 index 4856fd706c45c2..00000000000000 --- a/deps/node-inspect/cli.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('./lib/cli.js'); diff --git a/deps/node-inspect/lib/cli.js b/deps/node-inspect/lib/cli.js deleted file mode 100644 index a4880df2d56be8..00000000000000 --- a/deps/node-inspect/lib/cli.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright Node.js 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. - */ -'use strict'; -// ~= NativeModule.require('_debugger').start(); -require('./_inspect').start(); diff --git a/deps/node-inspect/package.json b/deps/node-inspect/package.json deleted file mode 100644 index 925fb03f21a53d..00000000000000 --- a/deps/node-inspect/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "node-inspect", - "version": "2.0.0", - "description": "Node Inspect", - "license": "MIT", - "main": "lib/_inspect.js", - "bin": "cli.js", - "homepage": "https://github.com/nodejs/node-inspect", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/nodejs/node-inspect" - }, - "bugs": { - "url": "https://github.com/nodejs/node-inspect/issues" - }, - "scripts": { - "pretest": "eslint --rulesdir=tools/eslint-rules lib test", - "test": "tap test", - "posttest": "nlm verify" - }, - "nlm": { - "license": { - "files": [ - "lib" - ] - } - }, - "dependencies": {}, - "devDependencies": { - "eslint": "^6.8.0", - "nlm": "^3.0.0", - "tap": "^10.7.0" - }, - "author": { - "name": "Jan Krems", - "email": "jan.krems@gmail.com" - }, - "files": [ - "*.js", - "lib" - ], - "publishConfig": { - "registry": "https://registry.npmjs.org" - } -} diff --git a/deps/node-inspect/test/cli/backtrace.test.js b/deps/node-inspect/test/cli/backtrace.test.js deleted file mode 100644 index 127ea56bf85302..00000000000000 --- a/deps/node-inspect/test/cli/backtrace.test.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -const Path = require('path'); - -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -test('display and navigate backtrace', (t) => { - const script = Path.join('examples', 'backtrace.js'); - const cli = startCLI([script]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.stepCommand('c')) - .then(() => cli.command('bt')) - .then(() => { - t.match(cli.output, `#0 topFn ${script}:7:2`); - }) - .then(() => cli.command('backtrace')) - .then(() => { - t.match(cli.output, `#0 topFn ${script}:7:2`); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); diff --git a/deps/node-inspect/test/cli/break.test.js b/deps/node-inspect/test/cli/break.test.js deleted file mode 100644 index ff71a364815717..00000000000000 --- a/deps/node-inspect/test/cli/break.test.js +++ /dev/null @@ -1,195 +0,0 @@ -'use strict'; -const Path = require('path'); - -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -test('stepping through breakpoints', (t) => { - const script = Path.join('examples', 'break.js'); - const cli = startCLI([script]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { - t.match( - cli.breakInfo, - { filename: script, line: 1 }, - 'pauses in the first line of the script'); - t.match( - cli.output, - /> 1 (?:\(function \([^)]+\) \{ )?const x = 10;/, - 'shows the source and marks the current line'); - }) - .then(() => cli.stepCommand('n')) - .then(() => { - t.match( - cli.output, - `break in ${script}:2`, - 'pauses in next line of the script'); - t.match( - cli.output, - '> 2 let name = \'World\';', - 'marks the 2nd line'); - }) - .then(() => cli.stepCommand('next')) - .then(() => { - t.match( - cli.output, - `break in ${script}:3`, - 'pauses in next line of the script'); - t.match( - cli.output, - '> 3 name = \'Robin\';', - 'marks the 3nd line'); - }) - .then(() => cli.stepCommand('cont')) - .then(() => { - t.match( - cli.output, - `break in ${script}:10`, - 'pauses on the next breakpoint'); - t.match( - cli.output, - '>10 debugger;', - 'marks the debugger line'); - }) - - // Prepare additional breakpoints - .then(() => cli.command('sb("break.js", 6)')) - .then(() => t.notMatch(cli.output, 'Could not resolve breakpoint')) - .then(() => cli.command('sb("otherFunction()")')) - .then(() => cli.command('sb(16)')) - .then(() => t.notMatch(cli.output, 'Could not resolve breakpoint')) - .then(() => cli.command('breakpoints')) - .then(() => { - t.match(cli.output, `#0 ${script}:6`); - t.match(cli.output, `#1 ${script}:16`); - }) - - .then(() => cli.command('list()')) - .then(() => { - t.match(cli.output, '>10 debugger;', 'prints and marks current line'); - t.strictDeepEqual( - cli.parseSourceLines(), - [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], - 'prints 5 lines before and after'); - }) - .then(() => cli.command('list(2)')) - .then(() => { - t.match(cli.output, '>10 debugger;', 'prints and marks current line'); - t.strictDeepEqual( - cli.parseSourceLines(), - [8, 9, 10, 11, 12], - 'prints 2 lines before and after'); - }) - - .then(() => cli.stepCommand('s')) - .then(() => cli.stepCommand('')) - .then(() => { - t.match( - cli.output, - 'break in timers.js', - 'entered timers.js'); - }) - .then(() => cli.stepCommand('cont')) - .then(() => { - t.match( - cli.output, - `break in ${script}:16`, - 'found breakpoint we set above w/ line number only'); - }) - .then(() => cli.stepCommand('cont')) - .then(() => { - t.match( - cli.output, - `break in ${script}:6`, - 'found breakpoint we set above w/ line number & script'); - }) - .then(() => cli.stepCommand('')) - .then(() => { - t.match( - cli.output, - `debugCommand in ${script}:14`, - 'found function breakpoint we set above'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); - -test('sb before loading file', (t) => { - const script = Path.join('examples', 'cjs', 'index.js'); - const otherScript = Path.join('examples', 'cjs', 'other.js'); - const cli = startCLI([script]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('sb("other.js", 2)')) - .then(() => { - t.match( - cli.output, - 'not loaded yet', - 'warns that the script was not loaded yet'); - }) - .then(() => cli.stepCommand('cont')) - .then(() => { - t.match( - cli.output, - `break in ${otherScript}:2`, - 'found breakpoint in file that was not loaded yet'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); - -test('clearBreakpoint', (t) => { - const script = Path.join('examples', 'break.js'); - const cli = startCLI([script]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('sb("break.js", 3)')) - .then(() => cli.command('sb("break.js", 9)')) - .then(() => cli.command('breakpoints')) - .then(() => { - t.match(cli.output, `#0 ${script}:3`); - t.match(cli.output, `#1 ${script}:9`); - }) - .then(() => cli.command('clearBreakpoint("break.js", 4)')) - .then(() => { - t.match(cli.output, 'Could not find breakpoint'); - }) - .then(() => cli.command('clearBreakpoint("not-such-script.js", 3)')) - .then(() => { - t.match(cli.output, 'Could not find breakpoint'); - }) - .then(() => cli.command('clearBreakpoint("break.js", 3)')) - .then(() => cli.command('breakpoints')) - .then(() => { - t.match(cli.output, `#0 ${script}:9`); - }) - .then(() => cli.stepCommand('cont')) - .then(() => { - t.match( - cli.output, - `break in ${script}:9`, - 'hits the 2nd breakpoint because the 1st was cleared'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); diff --git a/deps/node-inspect/test/cli/exec.test.js b/deps/node-inspect/test/cli/exec.test.js deleted file mode 100644 index acfd6e34abb279..00000000000000 --- a/deps/node-inspect/test/cli/exec.test.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -test('examples/alive.js', (t) => { - const cli = startCLI(['examples/alive.js']); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('exec [typeof heartbeat, typeof process.exit]')) - .then(() => { - t.match(cli.output, '[ \'function\', \'function\' ]', 'works w/o paren'); - }) - .then(() => cli.command('repl')) - .then(() => { - t.match( - cli.output, - 'Press Ctrl + C to leave debug repl\n> ', - 'shows hint for how to leave repl'); - t.notMatch(cli.output, 'debug>', 'changes the repl style'); - }) - .then(() => cli.command('[typeof heartbeat, typeof process.exit]')) - .then(() => cli.waitFor(/function/)) - .then(() => cli.waitForPrompt()) - .then(() => { - t.match( - cli.output, - '[ \'function\', \'function\' ]', 'can evaluate in the repl'); - t.match(cli.output, /> $/); - }) - .then(() => cli.ctrlC()) - .then(() => cli.waitFor(/debug> $/)) - .then(() => cli.command('exec("[typeof heartbeat, typeof process.exit]")')) - .then(() => { - t.match(cli.output, '[ \'function\', \'function\' ]', 'works w/ paren'); - }) - .then(() => cli.command('cont')) - .then(() => cli.command('exec [typeof heartbeat, typeof process.exit]')) - .then(() => { - t.match( - cli.output, - '[ \'undefined\', \'function\' ]', - 'non-paused exec can see global but not module-scope values'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); - -test('exec .scope', (t) => { - const cli = startCLI(['examples/backtrace.js']); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.stepCommand('c')) - .then(() => cli.command('exec .scope')) - .then(() => { - t.match( - cli.output, - '\'moduleScoped\'', 'displays closure from module body'); - t.match(cli.output, '\'a\'', 'displays local / function arg'); - t.match(cli.output, '\'l1\'', 'displays local scope'); - t.notMatch(cli.output, '\'encodeURIComponent\'', 'omits global scope'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); diff --git a/deps/node-inspect/test/cli/heap-profiler.test.js b/deps/node-inspect/test/cli/heap-profiler.test.js deleted file mode 100644 index ebd734e03cb06d..00000000000000 --- a/deps/node-inspect/test/cli/heap-profiler.test.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; -const { test } = require('tap'); -const { readFileSync, unlinkSync } = require('fs'); - -const startCLI = require('./start-cli'); -const filename = 'node.heapsnapshot'; - -function cleanup() { - try { - unlinkSync(filename); - } catch (_) { - // Ignore. - } -} - -cleanup(); - -test('Heap profiler take snapshot', (t) => { - const cli = startCLI(['examples/empty.js']); - - function onFatal(error) { - cli.quit(); - throw error; - } - - // Check that the snapshot is valid JSON. - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('takeHeapSnapshot()')) - .then(() => JSON.parse(readFileSync(filename, 'utf8'))) - .then(() => cleanup()) - .then(() => cli.quit()) - .then(null, onFatal); -}); diff --git a/deps/node-inspect/test/cli/help.test.js b/deps/node-inspect/test/cli/help.test.js deleted file mode 100644 index 9f0c081bdee39a..00000000000000 --- a/deps/node-inspect/test/cli/help.test.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -test('examples/empty.js', (t) => { - const cli = startCLI(['examples/empty.js']); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('help')) - .then(() => { - t.match(cli.output, /run, restart, r\s+/m); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); diff --git a/deps/node-inspect/test/cli/invalid-args.test.js b/deps/node-inspect/test/cli/invalid-args.test.js deleted file mode 100644 index 86428a3ec27030..00000000000000 --- a/deps/node-inspect/test/cli/invalid-args.test.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; -const Path = require('path'); -const { createServer } = require('net'); - -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -test('launch CLI w/o args', (t) => { - const cli = startCLI([]); - return cli.quit() - .then((code) => { - t.equal(code, 1, 'exits with non-zero exit code'); - t.match(cli.output, /^Usage:/, 'Prints usage info'); - }); -}); - -test('launch w/ invalid host:port', (t) => { - const cli = startCLI(['localhost:914']); - return cli.quit() - .then((code) => { - t.match( - cli.output, - 'failed to connect', - 'Tells the user that the connection failed'); - t.equal(code, 1, 'exits with non-zero exit code'); - }); -}); - -test('launch w/ unavailable port', async(t) => { - const blocker = createServer((socket) => socket.end()); - const port = await new Promise((resolve, reject) => { - blocker.on('error', reject); - blocker.listen(0, '127.0.0.1', () => resolve(blocker.address().port)); - }); - - try { - const script = Path.join('examples', 'three-lines.js'); - const cli = startCLI([`--port=${port}`, script]); - const code = await cli.quit(); - - t.notMatch( - cli.output, - 'report this bug', - 'Omits message about reporting this as a bug'); - t.match( - cli.output, - `waiting for 127.0.0.1:${port} to be free`, - 'Tells the user that the port wasn\'t available'); - t.equal(code, 1, 'exits with non-zero exit code'); - } finally { - blocker.close(); - } -}); diff --git a/deps/node-inspect/test/cli/launch.test.js b/deps/node-inspect/test/cli/launch.test.js deleted file mode 100644 index c4ff3d855a82bc..00000000000000 --- a/deps/node-inspect/test/cli/launch.test.js +++ /dev/null @@ -1,196 +0,0 @@ -'use strict'; -const Path = require('path'); - -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -test('custom port', (t) => { - const CUSTOM_PORT = '9230'; - const script = Path.join('examples', 'three-lines.js'); - - const cli = startCLI([`--port=${CUSTOM_PORT}`, script]); - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { - t.match(cli.output, 'debug>', 'prints a prompt'); - t.match( - cli.output, - new RegExp(`< Debugger listening on [^\n]*${CUSTOM_PORT}`), - 'forwards child output'); - }) - .then(() => cli.quit()) - .then((code) => { - t.equal(code, 0, 'exits with success'); - }); -}); - -test('random port', (t) => { - const script = Path.join('examples', 'three-lines.js'); - - const cli = startCLI(['--port=0', script]); - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { - t.match(cli.output, 'debug>', 'prints a prompt'); - t.match( - cli.output, - /< Debugger listening on /, - 'forwards child output'); - }) - .then(() => cli.quit()) - .then((code) => { - t.equal(code, 0, 'exits with success'); - }); -}); - -test('random port with --inspect-port=0', (t) => { - const script = Path.join('examples', 'three-lines.js'); - - const cli = startCLI([script], ['--inspect-port=0']); - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { - t.match(cli.output, 'debug>', 'prints a prompt'); - t.match( - cli.output, - /< Debugger listening on /, - 'forwards child output'); - }) - .then(() => cli.quit()) - .then((code) => { - t.equal(code, 0, 'exits with success'); - }); -}); - -test('examples/three-lines.js', (t) => { - const script = Path.join('examples', 'three-lines.js'); - const cli = startCLI([script]); - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { - t.match(cli.output, 'debug>', 'prints a prompt'); - t.match( - cli.output, - /< Debugger listening on [^\n]*9229/, - 'forwards child output'); - }) - .then(() => cli.command('["hello", "world"].join(" ")')) - .then(() => { - t.match(cli.output, 'hello world', 'prints the result'); - }) - .then(() => cli.command('')) - .then(() => { - t.match(cli.output, 'hello world', 'repeats the last command on <enter>'); - }) - .then(() => cli.command('version')) - .then(() => { - t.match(cli.output, process.versions.v8, 'version prints the v8 version'); - }) - .then(() => cli.quit()) - .then((code) => { - t.equal(code, 0, 'exits with success'); - }); -}); - -test('run after quit / restart', (t) => { - const script = Path.join('examples', 'three-lines.js'); - const cli = startCLI([script]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.stepCommand('n')) - .then(() => { - t.match( - cli.output, - `break in ${script}:2`, - 'steps to the 2nd line'); - }) - .then(() => cli.command('cont')) - .then(() => cli.waitFor(/disconnect/)) - .then(() => { - t.match( - cli.output, - 'Waiting for the debugger to disconnect', - 'the child was done'); - }) - .then(() => { - // On windows the socket won't close by itself - return cli.command('kill'); - }) - .then(() => cli.command('cont')) - .then(() => cli.waitFor(/start the app/)) - .then(() => { - t.match(cli.output, 'Use `run` to start the app again'); - }) - .then(() => cli.stepCommand('run')) - .then(() => cli.waitForInitialBreak()) - .then(() => cli.waitForPrompt()) - .then(() => { - t.match( - cli.breakInfo, - { filename: script, line: 1 }, - 'is back at the beginning'); - }) - .then(() => cli.stepCommand('n')) - .then(() => { - t.match( - cli.breakInfo, - { filename: script, line: 2 }, - 'steps to the 2nd line'); - }) - .then(() => cli.stepCommand('restart')) - .then(() => cli.waitForInitialBreak()) - .then(() => { - t.match( - cli.breakInfo, - { filename: script, line: 1 }, - 'is back at the beginning'); - }) - .then(() => cli.command('kill')) - .then(() => cli.command('cont')) - .then(() => cli.waitFor(/start the app/)) - .then(() => { - t.match(cli.output, 'Use `run` to start the app again'); - }) - .then(() => cli.stepCommand('run')) - .then(() => cli.waitForInitialBreak()) - .then(() => cli.waitForPrompt()) - .then(() => { - t.match( - cli.breakInfo, - { filename: script, line: 1 }, - 'is back at the beginning'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); - -test('auto-resume on start if the environment variable is defined', (t) => { - const script = Path.join('examples', 'break.js'); - - const cli = startCLI([script], [], { - env: { NODE_INSPECT_RESUME_ON_START: '1' } - }); - - return cli.waitForInitialBreak() - .then(() => { - t.match( - cli.breakInfo, - { filename: script, line: 10 }, - 'skips to the first breakpoint'); - }) - .then(() => cli.quit()) - .then((code) => { - t.equal(code, 0, 'exits with success'); - }); -}); diff --git a/deps/node-inspect/test/cli/pid.test.js b/deps/node-inspect/test/cli/pid.test.js deleted file mode 100644 index 15d7fdeaa5f49b..00000000000000 --- a/deps/node-inspect/test/cli/pid.test.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; -const { spawn } = require('child_process'); -const Path = require('path'); - -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -function launchTarget(...args) { - const childProc = spawn(process.execPath, args); - return Promise.resolve(childProc); -} - -// process.debugPort is our proxy for "the version of node used to run this -// test suite doesn't support SIGUSR1 for enabling --inspect for a process". -const defaultsToOldProtocol = process.debugPort === 5858; - -test('examples/alive.js', { skip: defaultsToOldProtocol }, (t) => { - const script = Path.join('examples', 'alive.js'); - let cli = null; - let target = null; - - function cleanup(error) { - if (cli) { - cli.quit(); - cli = null; - } - if (target) { - target.kill(); - target = null; - } - if (error) throw error; - } - - return launchTarget(script) - .then((childProc) => { - target = childProc; - cli = startCLI(['-p', `${target.pid}`]); - return cli.waitForPrompt(); - }) - .then(() => cli.command('sb("alive.js", 3)')) - .then(() => cli.waitFor(/break/)) - .then(() => cli.waitForPrompt()) - .then(() => { - t.match( - cli.output, - '> 3 ++x;', - 'marks the 3rd line'); - }) - .then(() => cleanup()) - .then(null, cleanup); -}); diff --git a/deps/node-inspect/test/cli/preserve-breaks.test.js b/deps/node-inspect/test/cli/preserve-breaks.test.js deleted file mode 100644 index affa3ad975c915..00000000000000 --- a/deps/node-inspect/test/cli/preserve-breaks.test.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; -const Path = require('path'); - -const { test } = require('tap'); - -const startCLI = require('./start-cli'); - -test('run after quit / restart', (t) => { - const script = Path.join('examples', 'three-lines.js'); - const cli = startCLI([script]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('breakpoints')) - .then(() => { - t.match(cli.output, 'No breakpoints yet'); - }) - .then(() => cli.command('sb(2)')) - .then(() => cli.command('sb(3)')) - .then(() => cli.command('breakpoints')) - .then(() => { - t.match(cli.output, `#0 ${script}:2`); - t.match(cli.output, `#1 ${script}:3`); - }) - .then(() => cli.stepCommand('c')) // hit line 2 - .then(() => cli.stepCommand('c')) // hit line 3 - .then(() => { - t.match(cli.breakInfo, { filename: script, line: 3 }); - }) - .then(() => cli.command('restart')) - .then(() => cli.waitForInitialBreak()) - .then(() => { - t.match(cli.breakInfo, { filename: script, line: 1 }); - }) - .then(() => cli.stepCommand('c')) - .then(() => { - t.match(cli.breakInfo, { filename: script, line: 2 }); - }) - .then(() => cli.stepCommand('c')) - .then(() => { - t.match(cli.breakInfo, { filename: script, line: 3 }); - }) - .then(() => cli.command('breakpoints')) - .then(() => { - if (process.platform === 'aix') { - // TODO: There is a known issue on AIX where the breakpoints aren't - // properly resolved yet when we reach this point. - // Eventually that should be figured out but for now we don't want - // to fail builds because of it. - t.match(cli.output, /#0 [^\n]+three-lines\.js\$?:2/); - t.match(cli.output, /#1 [^\n]+three-lines\.js\$?:3/); - } else { - t.match(cli.output, `#0 ${script}:2`); - t.match(cli.output, `#1 ${script}:3`); - } - }) - .then(() => cli.quit()) - .then(null, onFatal); -}); diff --git a/deps/node-inspect/tools/eslint-rules/align-function-arguments.js b/deps/node-inspect/tools/eslint-rules/align-function-arguments.js deleted file mode 100644 index 015552489a9d44..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/align-function-arguments.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @fileoverview Align arguments in multiline function calls - * @author Rich Trott - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -function checkArgumentAlignment(context, node) { - - function isNodeFirstInLine(node, byEndLocation) { - const firstToken = byEndLocation === true ? context.getLastToken(node, 1) : - context.getTokenBefore(node); - const startLine = byEndLocation === true ? node.loc.end.line : - node.loc.start.line; - const endLine = firstToken ? firstToken.loc.end.line : -1; - - return startLine !== endLine; - } - - if (node.arguments.length === 0) - return; - - var msg = ''; - const first = node.arguments[0]; - var currentLine = first.loc.start.line; - const firstColumn = first.loc.start.column; - - const ignoreTypes = [ - 'ArrowFunctionExpression', - 'FunctionExpression', - 'ObjectExpression', - ]; - - const args = node.arguments; - - // For now, don't bother trying to validate potentially complicating things - // like closures. Different people will have very different ideas and it's - // probably best to implement configuration options. - if (args.some((node) => { return ignoreTypes.indexOf(node.type) !== -1; })) { - return; - } - - if (!isNodeFirstInLine(node)) { - return; - } - - var misaligned; - - args.slice(1).forEach((argument) => { - if (!misaligned) { - if (argument.loc.start.line === currentLine + 1) { - if (argument.loc.start.column !== firstColumn) { - if (isNodeFirstInLine(argument)) { - msg = 'Function argument in column ' + - `${argument.loc.start.column + 1}, ` + - `expected in ${firstColumn + 1}`; - misaligned = argument; - } - } - } - } - currentLine = argument.loc.start.line; - }); - - if (msg) - context.report(misaligned, msg); -} - -module.exports = function(context) { - return { - 'CallExpression': (node) => checkArgumentAlignment(context, node) - }; -}; diff --git a/deps/node-inspect/tools/eslint-rules/align-multiline-assignment.js b/deps/node-inspect/tools/eslint-rules/align-multiline-assignment.js deleted file mode 100644 index 80896b5e96296d..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/align-multiline-assignment.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @fileoverview Align multiline variable assignments - * @author Rich Trott - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -function getBinaryExpressionStarts(binaryExpression, starts) { - function getStartsFromOneSide(side, starts) { - starts.push(side.loc.start); - if (side.type === 'BinaryExpression') { - starts = getBinaryExpressionStarts(side, starts); - } - return starts; - } - - starts = getStartsFromOneSide(binaryExpression.left, starts); - starts = getStartsFromOneSide(binaryExpression.right, starts); - return starts; -} - -function checkExpressionAlignment(expression) { - if (!expression) - return; - - var msg = ''; - - switch (expression.type) { - case 'BinaryExpression': - var starts = getBinaryExpressionStarts(expression, []); - var startLine = starts[0].line; - const startColumn = starts[0].column; - starts.forEach((loc) => { - if (loc.line > startLine) { - startLine = loc.line; - if (loc.column !== startColumn) { - msg = 'Misaligned multiline assignment'; - } - } - }); - break; - } - return msg; -} - -function testAssignment(context, node) { - const msg = checkExpressionAlignment(node.right); - if (msg) - context.report(node, msg); -} - -function testDeclaration(context, node) { - node.declarations.forEach((declaration) => { - const msg = checkExpressionAlignment(declaration.init); - // const start = declaration.init.loc.start; - if (msg) - context.report(node, msg); - }); -} - -module.exports = function(context) { - return { - 'AssignmentExpression': (node) => testAssignment(context, node), - 'VariableDeclaration': (node) => testDeclaration(context, node) - }; -}; diff --git a/deps/node-inspect/tools/eslint-rules/assert-fail-single-argument.js b/deps/node-inspect/tools/eslint-rules/assert-fail-single-argument.js deleted file mode 100644 index 4ce790238181cc..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/assert-fail-single-argument.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @fileoverview Prohibit use of a single argument only in `assert.fail()`. It - * is almost always an error. - * @author Rich Trott - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const msg = 'assert.fail() message should be third argument'; - -function isAssert(node) { - return node.callee.object && node.callee.object.name === 'assert'; -} - -function isFail(node) { - return node.callee.property && node.callee.property.name === 'fail'; -} - -module.exports = function(context) { - return { - 'CallExpression': function(node) { - if (isAssert(node) && isFail(node) && node.arguments.length === 1) { - context.report(node, msg); - } - } - }; -}; diff --git a/deps/node-inspect/tools/eslint-rules/buffer-constructor.js b/deps/node-inspect/tools/eslint-rules/buffer-constructor.js deleted file mode 100644 index 938598e8dbf618..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/buffer-constructor.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @fileoverview Require use of new Buffer constructor methods in lib - * @author James M Snell - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -const msg = 'Use of the Buffer() constructor has been deprecated. ' + - 'Please use either Buffer.alloc(), Buffer.allocUnsafe(), ' + - 'or Buffer.from()'; - -function test(context, node) { - if (node.callee.name === 'Buffer') { - context.report(node, msg); - } -} - -module.exports = function(context) { - return { - 'NewExpression': (node) => test(context, node), - 'CallExpression': (node) => test(context, node) - }; -}; diff --git a/deps/node-inspect/tools/eslint-rules/new-with-error.js b/deps/node-inspect/tools/eslint-rules/new-with-error.js deleted file mode 100644 index 655f34bf080956..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/new-with-error.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @fileoverview Require `throw new Error()` rather than `throw Error()` - * @author Rich Trott - */ -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - - var errorList = context.options.length !== 0 ? context.options : ['Error']; - - return { - 'ThrowStatement': function(node) { - if (node.argument.type === 'CallExpression' && - errorList.indexOf(node.argument.callee.name) !== -1) { - context.report(node, 'Use new keyword when throwing.'); - } - } - }; -}; - -module.exports.schema = { - 'type': 'array', - 'additionalItems': { - 'type': 'string' - }, - 'uniqueItems': true -}; diff --git a/deps/node-inspect/tools/eslint-rules/no-let-in-for-declaration.js b/deps/node-inspect/tools/eslint-rules/no-let-in-for-declaration.js deleted file mode 100644 index 8b1a6783e0773d..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/no-let-in-for-declaration.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @fileoverview Prohibit the use of `let` as the loop variable - * in the initialization of for, and the left-hand - * iterator in forIn and forOf loops. - * - * @author Jessica Quynh Tran - */ - -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = { - create(context) { - - const msg = 'Use of `let` as the loop variable in a for-loop is ' + - 'not recommended. Please use `var` instead.'; - - /** - * Report function to test if the for-loop is declared using `let`. - */ - function testForLoop(node) { - if (node.init && node.init.kind === 'let') { - context.report(node.init, msg); - } - } - - /** - * Report function to test if the for-in or for-of loop - * is declared using `let`. - */ - function testForInOfLoop(node) { - if (node.left && node.left.kind === 'let') { - context.report(node.left, msg); - } - } - - return { - 'ForStatement': testForLoop, - 'ForInStatement': testForInOfLoop, - 'ForOfStatement': testForInOfLoop - }; - } -}; diff --git a/deps/node-inspect/tools/eslint-rules/prefer-assert-methods.js b/deps/node-inspect/tools/eslint-rules/prefer-assert-methods.js deleted file mode 100644 index fa345eb7c3fc33..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/prefer-assert-methods.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -function isAssert(node) { - return node.expression && - node.expression.type === 'CallExpression' && - node.expression.callee && - node.expression.callee.name === 'assert'; -} - -function getFirstArg(expression) { - return expression.arguments && expression.arguments[0]; -} - -function parseError(method, op) { - return `'assert.${method}' should be used instead of '${op}'`; -} - -const preferedAssertMethod = { - '===': 'strictEqual', - '!==': 'notStrictEqual', - '==': 'equal', - '!=': 'notEqual' -}; - -module.exports = function(context) { - return { - ExpressionStatement(node) { - if (isAssert(node)) { - const arg = getFirstArg(node.expression); - if (arg && arg.type === 'BinaryExpression') { - const assertMethod = preferedAssertMethod[arg.operator]; - if (assertMethod) { - context.report(node, parseError(assertMethod, arg.operator)); - } - } - } - } - }; -}; diff --git a/deps/node-inspect/tools/eslint-rules/require-buffer.js b/deps/node-inspect/tools/eslint-rules/require-buffer.js deleted file mode 100644 index c9818cb758f7bd..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/require-buffer.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -module.exports = function(context) { - function flagIt(reference) { - const msg = 'Use const Buffer = require(\'buffer\').Buffer; ' + - 'at the beginning of this file'; - context.report(reference.identifier, msg); - } - - return { - 'Program:exit': function() { - const globalScope = context.getScope(); - const variable = globalScope.set.get('Buffer'); - if (variable) { - variable.references.forEach(flagIt); - } - } - }; -}; diff --git a/deps/node-inspect/tools/eslint-rules/required-modules.js b/deps/node-inspect/tools/eslint-rules/required-modules.js deleted file mode 100644 index 3e4a8e8aadfc82..00000000000000 --- a/deps/node-inspect/tools/eslint-rules/required-modules.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @fileoverview Require usage of specified node modules. - * @author Rich Trott - */ -'use strict'; - -var path = require('path'); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - // trim required module names - var requiredModules = context.options; - - var foundModules = []; - - // if no modules are required we don't need to check the CallExpressions - if (requiredModules.length === 0) { - return {}; - } - - /** - * Function to check if a node is a string literal. - * @param {ASTNode} node The node to check. - * @returns {boolean} If the node is a string literal. - */ - function isString(node) { - return node && node.type === 'Literal' && typeof node.value === 'string'; - } - - /** - * Function to check if a node is a require call. - * @param {ASTNode} node The node to check. - * @returns {boolean} If the node is a require call. - */ - function isRequireCall(node) { - return node.callee.type === 'Identifier' && node.callee.name === 'require'; - } - - /** - * Function to check if a node has an argument that is a required module and - * return its name. - * @param {ASTNode} node The node to check - * @returns {undefined|String} required module name or undefined - */ - function getRequiredModuleName(node) { - var moduleName; - - // node has arguments and first argument is string - if (node.arguments.length && isString(node.arguments[0])) { - var argValue = path.basename(node.arguments[0].value.trim()); - - // check if value is in required modules array - if (requiredModules.indexOf(argValue) !== -1) { - moduleName = argValue; - } - } - - return moduleName; - } - - return { - 'CallExpression': function(node) { - if (isRequireCall(node)) { - var requiredModuleName = getRequiredModuleName(node); - - if (requiredModuleName) { - foundModules.push(requiredModuleName); - } - } - }, - 'Program:exit': function(node) { - if (foundModules.length < requiredModules.length) { - var missingModules = requiredModules.filter( - function(module) { - return foundModules.indexOf(module === -1); - } - ); - missingModules.forEach(function(moduleName) { - context.report( - node, - 'Mandatory module "{{moduleName}}" must be loaded.', - { moduleName: moduleName } - ); - }); - } - } - }; -}; - -module.exports.schema = { - 'type': 'array', - 'additionalItems': { - 'type': 'string' - }, - 'uniqueItems': true -}; diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index a257559bbf593f..2b3e48e7651636 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -770,3 +770,5 @@ Yash Singh <saiansh2525@gmail.com> Danielle Church <dani.church@gmail.com> Seth Thomas <seth@emailseth.com> Andreas <andreas@bielk.se> +Felipe Santos <felipecassiors@gmail.com> +Luigi Pinca <luigipinca@gmail.com> diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 8155d019159f5b..ce79e9368a6e58 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,158 @@ +## v7.11.2 (2021-04-29) + +### BUG FIXES + +* [`c371f183e`](https://github.com/npm/cli/commit/c371f183ebe833c2439e98b679f14e7a59f22c34) + [#3137](https://github.com/npm/cli/issues/3137) + [#3140](https://github.com/npm/cli/issues/3140) + fix(ls): do not warn on missing optional deps + ([@isaacs](https://github.com/isaacs)) +* [`861f606c7`](https://github.com/npm/cli/commit/861f606c7609d177c644814a171581afbb72f6db) + [#3156](https://github.com/npm/cli/issues/3156) + fix(build): make prune rule work on case-sensitive file systems + ([@lpinca](https://github.com/lpinca)) + +### DEPENDENCIES + +* [`fb79d89a0`](https://github.com/npm/cli/commit/fb79d89a07ef03e76633db275463f701d3dae42f) + `tap@15.0.6` +* [`ce3820043`](https://github.com/npm/cli/commit/ce38200437e9ed527df973794909b2699909bc9b) + `@npmcli/arborist@2.4.1` + * fix: prevent and eliminate unnecessary duplicates + * fix: support resolvable partial intersecting peerSets + +### DOCUMENTATION + +* [`e479f1dac`](https://github.com/npm/cli/commit/e479f1dac9a7639304d20116583034861635b2b1) + [#3146](https://github.com/npm/cli/issues/3146) + mention `directories.bin` in `bin` + ([@felipecrs](https://github.com/felipecrs)) + +## v7.11.1 (2021-04-23) + +### DEPENDENCIES + +* [`7925cca24`](https://github.com/npm/cli/commit/7925cca24543d9e1a8297844b3e53e11057643ef) + `pacote@11.3.3`: + * fix(registry): normalize manfest +* [`b61eac693`](https://github.com/npm/cli/commit/b61eac693df82c52b955e6c18ec4dcf4cedea8a3) + [#3130](https://github.com/npm/cli/issues/3130) + `@npmcli/config@2.2.0` +* [`c74e67fc6`](https://github.com/npm/cli/commit/c74e67fc6572bb001d74c7486c05d211a0e03de8) + [#3130](https://github.com/npm/cli/issues/3130) + `npm-registry-fetch@10.1.1` + +### DOCUMENTATION + +* [`efdd7dd44`](https://github.com/npm/cli/commit/efdd7dd4427a0ee856c18aab1df2d3d30a307997) + Remove unused and incorrectly documented `--always-auth` config definition + ([@isaacs](https://github.com/isaacs)) + +## v7.11.0 (2021-04-22) + +### FEATURES + +* [`4c1f16d2c`](https://github.com/npm/cli/commit/4c1f16d2c29a7a56c19b97f2820e6305a6075083) + [#3095](https://github.com/npm/cli/issues/3095) + feat(init): add workspaces support + ([@ruyadorno](https://github.com/ruyadorno)) + +### BUG FIXES + +* [`42ca59eee`](https://github.com/npm/cli/commit/42ca59eeedd3e402aa1c606941f7f52864e6039b) + [#3086](https://github.com/npm/cli/issues/3086) + fix(ls): do not exit with error when all problems are extraneous deps + ([@nlf](https://github.com/nlf)) +* [`2aecec591`](https://github.com/npm/cli/commit/2aecec591df6866e27d0b17dc49cef8f7d738d77) + [#2724](https://github.com/npm/cli/issues/2724) + [#3119](https://github.com/npm/cli/issues/3119) + fix(ls): make --long work when missing deps + ([@ruyadorno](https://github.com/ruyadorno)) +* [`42e0587a9`](https://github.com/npm/cli/commit/42e0587a9ea6940a5d5be5903370ad1113feef21) + [#3115](https://github.com/npm/cli/issues/3115) + fix(pack): refuse to pack invalid packument + ([@wraithgar](https://github.com/wraithgar)) +* [`1c4eff7b5`](https://github.com/npm/cli/commit/1c4eff7b513b8e84876818ede014d3ab19d203c6) + [#3126](https://github.com/npm/cli/issues/3126) + fix(logout): use isBasicAuth attribute + ([@wraithgar](https://github.com/wraithgar)) +### DOCUMENTATION + + +* [`c93f1c39e`](https://github.com/npm/cli/commit/c93f1c39e326feff0857712a10ef6183fbafe1ab) + [#3101](https://github.com/npm/cli/issues/3101) + chore(docs): update view docs + ([@wraithgar](https://github.com/wraithgar)) +* [`c4ff4bc11`](https://github.com/npm/cli/commit/c4ff4bc113c3a5b6ee5d74ab0b1adee95169ed32) + [npm/statusboard#313](https://github.com/npm/statusboard/issues/313) + [#3109](https://github.com/npm/cli/issues/3109) + fix(usage): fix refs to ws shorthand + ([@ruyadorno](https://github.com/ruyadorno)) + + +### DEPENDENCIES + +* [`83166ebcc`](https://github.com/npm/cli/commit/83166ebcc4ba5e3bf215f08151437d96637f4f33) + `npm-registry-fetch@10.1.0` + * feat(auth): set isBasicAuth +* [`e02bda6da`](https://github.com/npm/cli/commit/e02bda6da68b8e8f490bf270cb5d6adec81685ea) + `npm-registry-fetch@10.0.0` + * feat(auth) load/send based on URI, not registry +* [`a0382deba`](https://github.com/npm/cli/commit/a0382deba346b09834e75db89e1fd4527f1f07dd) + `@npmcli/run-script@1.8.5` + * fix: windows ComSpec env variable name +* [`7f82ef5a8`](https://github.com/npm/cli/commit/7f82ef5a84d70e28983ed43ba1d8aced0fb4ba45) + `pacote@11.3.2` +* [`35e49b94f`](https://github.com/npm/cli/commit/35e49b94fba478a63df6cc9b62816eafe5f1fbdd) + `@npmcli/arborist@2.4.0` +* [`95faf8ce6`](https://github.com/npm/cli/commit/95faf8ce6c007082a02c160977da194c08ee9d82) + `libnpmaccess@4.0.2` +* [`17fffc0e4`](https://github.com/npm/cli/commit/17fffc0e42b2a9e7b84691093e45ba511906cbfa) + `libnpmhook@6.0.2` +* [`1b5a213aa`](https://github.com/npm/cli/commit/1b5a213aaf39652661ba72ba2e8751f049b170fb) + `libnpmorg@2.0.2` +* [`9f83e6484`](https://github.com/npm/cli/commit/9f83e6484aa163d066f318df42ec89c8234b614e) + `libnpmpublish@4.0.1` +* [`251f788c5`](https://github.com/npm/cli/commit/251f788c554a198ab42682453fa5504f8abe93fe) + `libnpmsearch@3.1.1` +* [`35873a989`](https://github.com/npm/cli/commit/35873a989fe67041ddcf30a0a278ed77ace5ee3c) + `libnpmteam@2.0.3` +* [`23e12b4d8`](https://github.com/npm/cli/commit/23e12b4d8f63d765a48036e7bb08f53319c73304) + `npm-profile@5.0.3` + +## v7.10.0 (2021-04-15) + +### FEATURES + +* [`f9b639eb6`](https://github.com/npm/cli/commit/f9b639eb6c504ded6cdd59e83e26a392bfe81e5d) + [#3052](https://github.com/npm/cli/issues/3052) + feat(bugs): fall back to email if provided + ([@Yash-Singh1](https://github.com/Yash-Singh1)) +* [`8c9e24778`](https://github.com/npm/cli/commit/8c9e24778db867cb3148bc247c7e321639aa9f58) + [#3055](https://github.com/npm/cli/issues/3055) + feat(version): add workspace support + ([@wraithgar](https://github.com/wraithgar)) + +### DEPENDENCIES + +* [`f1e6743a6`](https://github.com/npm/cli/commit/f1e6743a6e8e32ddad6d1964eb05d17e6c50a456) + `libnpmversion@1.2.0` + * feat(retrieve-tag): retrieve unannotated git tags + * fix(retrieve-tag): use semver to look for semver +* [`3b476a24c`](https://github.com/npm/cli/commit/3b476a24cf0b2823fdf92505b84bddde4fcc8b14) + `@npmcl/git@2.0.8` + * fix(git): do not use shell when calling git +* [`dfcd0c1e2`](https://github.com/npm/cli/commit/dfcd0c1e2331c1f4b6573466b50505772eddaf22) + [#3069](https://github.com/npm/cli/issues/3069) + `tap@15.0.2` + +### DOCUMENTATION + +* [`90b61eda9`](https://github.com/npm/cli/commit/90b61eda9b41af108ed69fc0c43a522a92745047) + [#3053](https://github.com/npm/cli/issues/3053) + fix(contributing.md): explicitely outline dep updates + ([@darcyclarke](https://github.com/darcyclarke)) + ## v7.9.0 (2021-04-08) ### FEATURES diff --git a/deps/npm/CONTRIBUTING.md b/deps/npm/CONTRIBUTING.md index 4116f4e71d057c..6821da895b3b51 100644 --- a/deps/npm/CONTRIBUTING.md +++ b/deps/npm/CONTRIBUTING.md @@ -51,6 +51,10 @@ We've set up an automated [benchmark](https://github.com/npm/benchmarks) integra You can learn more about this tool, including how to run & configure it manually, [here](https://github.com/npm/benchmarks) +## Dependency Updates + +It should be noted that our team does not accept third-party dependency updates/PRs. We have a [release process](https://github.com/npm/cli/wiki/Release-Process) that includes checks to ensure dependencies are staying up-to-date & will ship security patches for CVEs as they occur. If you submit a PR trying to update our dependencies we will close it with or without a reference to these contribution guidelines. + ## Reporting Bugs When submitting a new bug report, please first [search](https://github.com/npm/cli/issues) for an existing or similar report & then use one of our existing [issue templates](https://github.com/npm/cli/issues/new/choose) if you believe you've come across a unique problem. Duplicate issues, or issues that don't use one of our templates may get closed without a response. diff --git a/deps/npm/docs/content/commands/npm-adduser.md b/deps/npm/docs/content/commands/npm-adduser.md index d0ddd68c2529a4..9ad4c27c6d8e54 100644 --- a/deps/npm/docs/content/commands/npm-adduser.md +++ b/deps/npm/docs/content/commands/npm-adduser.md @@ -7,7 +7,7 @@ description: Add a registry user account ### Synopsis ```bash -npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=legacy] +npm adduser [--registry=url] [--scope=@orgname] [--auth-type=legacy] aliases: login, add-user ``` @@ -58,23 +58,6 @@ npm adduser --registry=http://myregistry.example.com --scope=@myco This will set a registry for the given scope and login or create a user for that registry at the same time. -#### always-auth - -Default: false - -If specified, save configuration indicating that all requests to the given -registry should include authorization information. Useful for private -registries. Can be used with `--registry` and / or `--scope`, e.g. - -```bash -npm adduser --registry=http://private-registry.example.com --always-auth -``` - -This will ensure that all requests to that registry (including for tarballs) -include an authorization header. This setting may be necessary for use with -private registries where metadata and package tarballs are stored on hosts with -different hostnames. See `always-auth` in [`config`](/using-npm/config) for more details on always-auth. Registry-specific configuration of `always-auth` takes precedence over any global configuration. - #### auth-type * Default: `'legacy'` diff --git a/deps/npm/docs/content/commands/npm-bugs.md b/deps/npm/docs/content/commands/npm-bugs.md index dd1ab299f9c550..714db4440cdf25 100644 --- a/deps/npm/docs/content/commands/npm-bugs.md +++ b/deps/npm/docs/content/commands/npm-bugs.md @@ -15,9 +15,9 @@ aliases: issues ### Description This command tries to guess at the likely location of a package's bug -tracker URL, and then tries to open it using the `--browser` config param. -If no package name is provided, it will search for a `package.json` in the -current folder and use the `name` property. +tracker URL or the `mailto` URL of the support email, and then tries to +open it using the `--browser` config param. If no package name is provided, it +will search for a `package.json` in the current folder and use the `name` property. ### Configuration diff --git a/deps/npm/docs/content/commands/npm-exec.md b/deps/npm/docs/content/commands/npm-exec.md index 88b98e3bce466a..2364da32c76de9 100644 --- a/deps/npm/docs/content/commands/npm-exec.md +++ b/deps/npm/docs/content/commands/npm-exec.md @@ -11,7 +11,7 @@ npm exec -- <pkg>[@<version>] [args...] npm exec --package=<pkg>[@<version>] -- <cmd> [args...] npm exec -c '<cmd> [args...]' npm exec --package=foo -c '<cmd> [args...]' -npm exec [-ws] [-w <workspace-name] [args...] +npm exec [--ws] [-w <workspace-name] [args...] npx <pkg>[@<specifier>] [args...] npx -p <pkg>[@<specifier>] <cmd> [args...] @@ -184,7 +184,7 @@ in this example we're using **eslint** to lint any js file found within each workspace folder: ``` -npm exec -ws -- eslint ./*.js +npm exec --ws -- eslint ./*.js ``` #### Filtering workspaces @@ -275,7 +275,7 @@ children workspaces) #### workspaces -* Alias: `-ws` +* Alias: `--ws` * Type: Boolean * Default: `false` @@ -291,3 +291,4 @@ project. * [npm restart](/commands/npm-restart) * [npm stop](/commands/npm-stop) * [npm config](/commands/npm-config) +* [npm workspaces](/using-npm/workspaces) diff --git a/deps/npm/docs/content/commands/npm-init.md b/deps/npm/docs/content/commands/npm-init.md index 4b0b8c4c43e73e..8288034a3f19a2 100644 --- a/deps/npm/docs/content/commands/npm-init.md +++ b/deps/npm/docs/content/commands/npm-init.md @@ -8,8 +8,9 @@ description: Create a package.json file ```bash npm init [--force|-f|--yes|-y|--scope] -npm init <@scope> (same as `npx <@scope>/create`) -npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`) +npm init <@scope> (same as `npm exec <@scope>/create`) +npm init [<@scope>/]<name> (same as `npm exec [<@scope>/]create-<name>`) +npm init [-w <dir>] [args...] ``` ### Description @@ -18,19 +19,16 @@ npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`) package. `initializer` in this case is an npm package named `create-<initializer>`, -which will be installed by [`npx`](https://npm.im/npx), and then have its +which will be installed by [`npm-exec`](/commands/npm-exec), and then have its main bin executed -- presumably creating or updating `package.json` and running any other initialization-related operations. -The init command is transformed to a corresponding `npx` operation as +The init command is transformed to a corresponding `npm exec` operation as follows: -* `npm init foo` -> `npx create-foo` -* `npm init @usr/foo` -> `npx @usr/create-foo` -* `npm init @usr` -> `npx @usr/create` - -Any additional options will be passed directly to the command, so `npm init -foo -- --hello` will map to `npx create-foo --hello`. +* `npm init foo` -> `npm exec create-foo` +* `npm init @usr/foo` -> `npm exec @usr/create-foo` +* `npm init @usr` -> `npm exec @usr/create` If the initializer is omitted (by just calling `npm init`), init will fall back to legacy init behavior. It will ask you a bunch of questions, and @@ -40,6 +38,18 @@ strictly additive, so it will keep any fields and values that were already set. You can also use `-y`/`--yes` to skip the questionnaire altogether. If you pass `--scope`, it will create a scoped package. +#### Forwarding additional options + +Any additional options will be passed directly to the command, so `npm init +foo -- --hello` will map to `npm exec -- create-foo --hello`. + +To better illustrate how options are forwarded, here's a more evolved +example showing options passed to both the **npm cli** and a create package, +both following commands are equivalent: + +- `npm init foo -y --registry=<url> -- --hello -a` +- `npm exec -y --registry=<url> -- create-foo --hello -a` + ### Examples Create a new React-based project using @@ -71,6 +81,68 @@ Generate it without having it ask any questions: $ npm init -y ``` +### Workspaces support + +It's possible to create a new workspace within your project by using the +`workspace` config option. When using `npm init -w <dir>` the cli will +create the folders and boilerplate expected while also adding a reference +to your project `package.json` `"workspaces": []` property in order to make +sure that new generated **workspace** is properly set up as such. + +Given a project with no workspaces, e.g: + +``` +. ++-- package.json +``` + +You may generate a new workspace using the legacy init: + +```bash +$ npm init -w packages/a +``` + +That will generate a new folder and `package.json` file, while also updating +your top-level `package.json` to add the reference to this new workspace: + +``` +. ++-- package.json +`-- packages + `-- a + `-- package.json +``` + +The workspaces init also supports the `npm init <initializer> -w <dir>` +syntax, following the same set of rules explained earlier in the initial +**Description** section of this page. Similar to the previous example of +creating a new React-based project using +[`create-react-app`](https://npm.im/create-react-app), the following syntax +will make sure to create the new react app as a nested **workspace** within your +project and configure your `package.json` to recognize it as such: + +```bash +npm init -w packages/my-react-app react-app . +``` + +This will make sure to generate your react app as expected, one important +consideration to have in mind is that `npm exec` is going to be run in the +context of the newly created folder for that workspace, and that's the reason +why in this example the initializer uses the initializer name followed with a +dot to represent the current directory in that context, e.g: `react-app .`: + +``` +. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- my-react-app + +-- README + +-- package.json + `-- ... +``` + ### A note on caching The npm cli utilizes its internal package cache when using the package @@ -93,6 +165,33 @@ requested from the server. To force full offline mode, use `offline`. Forces full offline mode. Any packages not locally cached will result in an error. +#### workspace + +* Alias: `-w` +* Type: Array +* Default: `[]` + +Enable running `npm init` in the context of workspaces, creating any missing +folders, generating files and adding/updating the `"workspaces"` property of +the project `package.json`. + +the provided names or paths provided. + +Valid values for the `workspace` config are either: +- Workspace names +- Path to a workspace directory +- Path to a parent workspace directory (will result to selecting all of the +children workspaces) + +#### workspaces + +* Alias: `-ws` +* Type: Boolean +* Default: `false` + +Run `npm init` in the context of all configured workspaces for the +current project. + ### See Also * [init-package-json module](http://npm.im/init-package-json) @@ -100,3 +199,4 @@ an error. * [npm version](/commands/npm-version) * [npm scope](/using-npm/scope) * [npm exec](/commands/npm-exec) +* [npm workspaces](/using-npm/workspaces) diff --git a/deps/npm/docs/content/commands/npm-run-script.md b/deps/npm/docs/content/commands/npm-run-script.md index 076dfd7addcc35..6786312e0bf84a 100644 --- a/deps/npm/docs/content/commands/npm-run-script.md +++ b/deps/npm/docs/content/commands/npm-run-script.md @@ -189,7 +189,7 @@ children workspaces) #### workspaces -* Alias: `-ws` +* Alias: `--ws` * Type: Boolean * Default: `false` @@ -204,3 +204,4 @@ project. * [npm restart](/commands/npm-restart) * [npm stop](/commands/npm-stop) * [npm config](/commands/npm-config) +* [npm workspaces](/using-npm/workspaces) diff --git a/deps/npm/docs/content/commands/npm-version.md b/deps/npm/docs/content/commands/npm-version.md index 0eb814b9899b0f..cdf0f977f503d0 100644 --- a/deps/npm/docs/content/commands/npm-version.md +++ b/deps/npm/docs/content/commands/npm-version.md @@ -14,6 +14,56 @@ npm version [<newversion> | major | minor | patch | premajor | preminor | prepat 'npm ls' to inspect current package/dependency versions ``` +### Configuration + +#### `allow-same-version` + +* Default: `false` +* Type: Boolean + +Prevents throwing an error when `npm version` is used to set the new version +to the same value as the current version. + +#### `git-tag-version` + +* Default: `true` +* Type: Boolean + +Commit and tag the version change. + +#### `commit-hooks` + +* Default: `true` +* Type: Boolean + +Run git commit hooks when committing the version change. + +#### `sign-git-tag` + +* Default: `false` +* Type: Boolean + +Pass the `-s` flag to git to sign the tag. + +Note that you must have a default GPG key set up in your git config for this to work properly. + +#### workspaces + +* Default: `false` +* Type: Boolean + +Enables workspaces context and includes workspaces in reported output +when getting versions. When setting a new version *only the workspaces +will be changed*. + +#### workspace + +* Default: [] +* Type: Array + +Enables workspaces context and limits results to only those specified by +this config item. + ### Description Run this in a package directory to bump the version and write the new @@ -87,39 +137,6 @@ This runs all your tests and proceeds only if they pass. Then runs your `build` adds everything in the `dist` directory to the commit. After the commit, it pushes the new commit and tag up to the server, and deletes the `build/temp` directory. -### Configuration - -#### `allow-same-version` - -* Default: `false` -* Type: Boolean - -Prevents throwing an error when `npm version` is used to set the new version -to the same value as the current version. - -#### `git-tag-version` - -* Default: `true` -* Type: Boolean - -Commit and tag the version change. - -#### `commit-hooks` - -* Default: `true` -* Type: Boolean - -Run git commit hooks when committing the version change. - -#### `sign-git-tag` - -* Default: `false` -* Type: Boolean - -Pass the `-s` flag to git to sign the tag. - -Note that you must have a default GPG key set up in your git config for this to work properly. - ### See Also * [npm init](/commands/npm-init) diff --git a/deps/npm/docs/content/commands/npm-view.md b/deps/npm/docs/content/commands/npm-view.md index 90d5218856c8e9..8f7e886ed192a4 100644 --- a/deps/npm/docs/content/commands/npm-view.md +++ b/deps/npm/docs/content/commands/npm-view.md @@ -94,6 +94,25 @@ this: npm view connect versions ``` +### Configuration + +#### json + +Show information in JSON format. See [`Output`](#output) below. + +#### workspaces + +Enables workspaces context while searching the `package.json` in the +current folder. Information about packages named in each workspace will +be viewed. + +#### workspace + +Enables workspaces context and limits results to only those specified by +this config item. Only the information about packages named in the +workspaces given here will be viewed. + + ### Output If only a single string field for a single version is output, then it diff --git a/deps/npm/docs/content/configuring-npm/package-json.md b/deps/npm/docs/content/configuring-npm/package-json.md index f3a186f436e029..f5519f62bb32ef 100644 --- a/deps/npm/docs/content/configuring-npm/package-json.md +++ b/deps/npm/docs/content/configuring-npm/package-json.md @@ -386,6 +386,8 @@ Please make sure that your file(s) referenced in `bin` starts with `#!/usr/bin/env node`, otherwise the scripts are started without the node executable! +Note that you can also set the executable files using [directories.bin](#directoriesbin). + ### man Specify either a single file or an array of filenames to put in place for diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index b2e8baf014977d..76ac4192f1351e 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -165,14 +165,6 @@ upon by the current project. Prevents throwing an error when `npm version` is used to set the new version to the same value as the current version. -#### `always-auth` - -* Default: false -* Type: Boolean - -Force npm to always require authentication when accessing the registry, even -for `GET` requests. - #### `audit` * Default: true @@ -1087,7 +1079,8 @@ installation of packages specified according to the pattern * Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows * Type: null or String -The shell to use for scripts run with the `npm run` command. +The shell to use for scripts run with the `npm exec`, `npm run` and `npm +init <pkg>` commands. #### `searchexclude` diff --git a/deps/npm/docs/output/commands/npm-adduser.html b/deps/npm/docs/output/commands/npm-adduser.html index a079dfed71e291..494844708146c8 100644 --- a/deps/npm/docs/output/commands/npm-adduser.html +++ b/deps/npm/docs/output/commands/npm-adduser.html @@ -141,11 +141,11 @@ <h1 id="npm-adduser">npm-adduser</h1> <section id="table_of_contents"> <h2 id="table-of-contents">Table of contents</h2> -<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#registry">registry</a></li><li><a href="#scope">scope</a></li><li><a href="#always-auth">always-auth</a></li><li><a href="#auth-type">auth-type</a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> +<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#registry">registry</a></li><li><a href="#scope">scope</a></li><li><a href="#auth-type">auth-type</a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> </section> <div id="_content"><h3 id="synopsis">Synopsis</h3> -<pre lang="bash"><code>npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=legacy] +<pre lang="bash"><code>npm adduser [--registry=url] [--scope=@orgname] [--auth-type=legacy] aliases: login, add-user </code></pre> @@ -177,17 +177,6 @@ <h4 id="scope">scope</h4> </code></pre> <p>This will set a registry for the given scope and login or create a user for that registry at the same time.</p> -<h4 id="always-auth">always-auth</h4> -<p>Default: false</p> -<p>If specified, save configuration indicating that all requests to the given -registry should include authorization information. Useful for private -registries. Can be used with <code>--registry</code> and / or <code>--scope</code>, e.g.</p> -<pre lang="bash"><code>npm adduser --registry=http://private-registry.example.com --always-auth -</code></pre> -<p>This will ensure that all requests to that registry (including for tarballs) -include an authorization header. This setting may be necessary for use with -private registries where metadata and package tarballs are stored on hosts with -different hostnames. See <code>always-auth</code> in <a href="../using-npm/config.html"><code>config</code></a> for more details on always-auth. Registry-specific configuration of <code>always-auth</code> takes precedence over any global configuration.</p> <h4 id="auth-type">auth-type</h4> <ul> <li>Default: <code>'legacy'</code></li> diff --git a/deps/npm/docs/output/commands/npm-bugs.html b/deps/npm/docs/output/commands/npm-bugs.html index 4fdde0a0c6c988..66789ca40b62a3 100644 --- a/deps/npm/docs/output/commands/npm-bugs.html +++ b/deps/npm/docs/output/commands/npm-bugs.html @@ -151,9 +151,9 @@ <h2 id="table-of-contents">Table of contents</h2> </code></pre> <h3 id="description">Description</h3> <p>This command tries to guess at the likely location of a package’s bug -tracker URL, and then tries to open it using the <code>--browser</code> config param. -If no package name is provided, it will search for a <code>package.json</code> in the -current folder and use the <code>name</code> property.</p> +tracker URL or the <code>mailto</code> URL of the support email, and then tries to +open it using the <code>--browser</code> config param. If no package name is provided, it +will search for a <code>package.json</code> in the current folder and use the <code>name</code> property.</p> <h3 id="configuration">Configuration</h3> <h4 id="browser">browser</h4> <ul> diff --git a/deps/npm/docs/output/commands/npm-exec.html b/deps/npm/docs/output/commands/npm-exec.html index f8f882a2c54a48..528f5a571cfef4 100644 --- a/deps/npm/docs/output/commands/npm-exec.html +++ b/deps/npm/docs/output/commands/npm-exec.html @@ -149,7 +149,7 @@ <h2 id="table-of-contents">Table of contents</h2> npm exec --package=<pkg>[@<version>] -- <cmd> [args...] npm exec -c '<cmd> [args...]' npm exec --package=foo -c '<cmd> [args...]' -npm exec [-ws] [-w <workspace-name] [args...] +npm exec [--ws] [-w <workspace-name] [args...] npx <pkg>[@<specifier>] [args...] npx -p <pkg>[@<specifier>] <cmd> [args...] @@ -276,7 +276,7 @@ <h3 id="workspaces-support">Workspaces support</h3> the configured workspaces when using the <code>workspaces</code> configuration options, in this example we’re using <strong>eslint</strong> to lint any js file found within each workspace folder:</p> -<pre><code>npm exec -ws -- eslint ./*.js +<pre><code>npm exec --ws -- eslint ./*.js </code></pre> <h4 id="filtering-workspaces">Filtering workspaces</h4> <p>It’s also possible to execute a command in a single workspace using the @@ -348,7 +348,7 @@ <h4 id="workspace">workspace</h4> </ul> <h4 id="workspaces">workspaces</h4> <ul> -<li>Alias: <code>-ws</code></li> +<li>Alias: <code>--ws</code></li> <li>Type: Boolean</li> <li>Default: <code>false</code></li> </ul> @@ -363,6 +363,7 @@ <h3 id="see-also">See Also</h3> <li><a href="../commands/npm-restart.html">npm restart</a></li> <li><a href="../commands/npm-stop.html">npm stop</a></li> <li><a href="../commands/npm-config.html">npm config</a></li> +<li><a href="../using-npm/workspaces.html">npm workspaces</a></li> </ul> </div> diff --git a/deps/npm/docs/output/commands/npm-init.html b/deps/npm/docs/output/commands/npm-init.html index 62dc20093b2e94..1aa0408baff8f5 100644 --- a/deps/npm/docs/output/commands/npm-init.html +++ b/deps/npm/docs/output/commands/npm-init.html @@ -141,29 +141,29 @@ <h1 id="npm-init">npm-init</h1> <section id="table_of_contents"> <h2 id="table-of-contents">Table of contents</h2> -<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#examples">Examples</a></li><li><a href="#a-note-on-caching">A note on caching</a></li><ul><li><a href="#prefer-online">prefer-online</a></li><li><a href="#prefer-offline">prefer-offline</a></li><li><a href="#offline">offline</a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> +<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><ul><li><a href="#forwarding-additional-options">Forwarding additional options</a></li></ul><li><a href="#examples">Examples</a></li><li><a href="#workspaces-support">Workspaces support</a></li><li><a href="#a-note-on-caching">A note on caching</a></li><ul><li><a href="#prefer-online">prefer-online</a></li><li><a href="#prefer-offline">prefer-offline</a></li><li><a href="#offline">offline</a></li><li><a href="#workspace">workspace</a></li><li><a href="#workspaces">workspaces</a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> </section> <div id="_content"><h3 id="synopsis">Synopsis</h3> <pre lang="bash"><code>npm init [--force|-f|--yes|-y|--scope] -npm init <@scope> (same as `npx <@scope>/create`) -npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`) +npm init <@scope> (same as `npm exec <@scope>/create`) +npm init [<@scope>/]<name> (same as `npm exec [<@scope>/]create-<name>`) +npm init [-w <dir>] [args...] </code></pre> <h3 id="description">Description</h3> <p><code>npm init <initializer></code> can be used to set up a new or existing npm package.</p> <p><code>initializer</code> in this case is an npm package named <code>create-<initializer></code>, -which will be installed by <a href="https://npm.im/npx"><code>npx</code></a>, and then have its +which will be installed by <a href="../commands/npm-exec.html"><code>npm-exec</code></a>, and then have its main bin executed – presumably creating or updating <code>package.json</code> and running any other initialization-related operations.</p> -<p>The init command is transformed to a corresponding <code>npx</code> operation as +<p>The init command is transformed to a corresponding <code>npm exec</code> operation as follows:</p> <ul> -<li><code>npm init foo</code> -> <code>npx create-foo</code></li> -<li><code>npm init @usr/foo</code> -> <code>npx @usr/create-foo</code></li> -<li><code>npm init @usr</code> -> <code>npx @usr/create</code></li> +<li><code>npm init foo</code> -> <code>npm exec create-foo</code></li> +<li><code>npm init @usr/foo</code> -> <code>npm exec @usr/create-foo</code></li> +<li><code>npm init @usr</code> -> <code>npm exec @usr/create</code></li> </ul> -<p>Any additional options will be passed directly to the command, so <code>npm init foo -- --hello</code> will map to <code>npx create-foo --hello</code>.</p> <p>If the initializer is omitted (by just calling <code>npm init</code>), init will fall back to legacy init behavior. It will ask you a bunch of questions, and then write a package.json for you. It will attempt to make reasonable @@ -171,6 +171,15 @@ <h3 id="description">Description</h3> strictly additive, so it will keep any fields and values that were already set. You can also use <code>-y</code>/<code>--yes</code> to skip the questionnaire altogether. If you pass <code>--scope</code>, it will create a scoped package.</p> +<h4 id="forwarding-additional-options">Forwarding additional options</h4> +<p>Any additional options will be passed directly to the command, so <code>npm init foo -- --hello</code> will map to <code>npm exec -- create-foo --hello</code>.</p> +<p>To better illustrate how options are forwarded, here’s a more evolved +example showing options passed to both the <strong>npm cli</strong> and a create package, +both following commands are equivalent:</p> +<ul> +<li><code>npm init foo -y --registry=<url> -- --hello -a</code></li> +<li><code>npm exec -y --registry=<url> -- create-foo --hello -a</code></li> +</ul> <h3 id="examples">Examples</h3> <p>Create a new React-based project using <a href="https://npm.im/create-react-app"><code>create-react-app</code></a>:</p> @@ -189,6 +198,51 @@ <h3 id="examples">Examples</h3> <p>Generate it without having it ask any questions:</p> <pre lang="bash"><code>$ npm init -y </code></pre> +<h3 id="workspaces-support">Workspaces support</h3> +<p>It’s possible to create a new workspace within your project by using the +<code>workspace</code> config option. When using <code>npm init -w <dir></code> the cli will +create the folders and boilerplate expected while also adding a reference +to your project <code>package.json</code> <code>"workspaces": []</code> property in order to make +sure that new generated <strong>workspace</strong> is properly set up as such.</p> +<p>Given a project with no workspaces, e.g:</p> +<pre><code>. ++-- package.json +</code></pre> +<p>You may generate a new workspace using the legacy init:</p> +<pre lang="bash"><code>$ npm init -w packages/a +</code></pre> +<p>That will generate a new folder and <code>package.json</code> file, while also updating +your top-level <code>package.json</code> to add the reference to this new workspace:</p> +<pre><code>. ++-- package.json +`-- packages + `-- a + `-- package.json +</code></pre> +<p>The workspaces init also supports the <code>npm init <initializer> -w <dir></code> +syntax, following the same set of rules explained earlier in the initial +<strong>Description</strong> section of this page. Similar to the previous example of +creating a new React-based project using +<a href="https://npm.im/create-react-app"><code>create-react-app</code></a>, the following syntax +will make sure to create the new react app as a nested <strong>workspace</strong> within your +project and configure your <code>package.json</code> to recognize it as such:</p> +<pre lang="bash"><code>npm init -w packages/my-react-app react-app . +</code></pre> +<p>This will make sure to generate your react app as expected, one important +consideration to have in mind is that <code>npm exec</code> is going to be run in the +context of the newly created folder for that workspace, and that’s the reason +why in this example the initializer uses the initializer name followed with a +dot to represent the current directory in that context, e.g: <code>react-app .</code>:</p> +<pre><code>. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- my-react-app + +-- README + +-- package.json + `-- ... +</code></pre> <h3 id="a-note-on-caching">A note on caching</h3> <p>The npm cli utilizes its internal package cache when using the package name specified. You can use the following to change how and when the @@ -203,6 +257,31 @@ <h4 id="prefer-offline">prefer-offline</h4> <h4 id="offline">offline</h4> <p>Forces full offline mode. Any packages not locally cached will result in an error.</p> +<h4 id="workspace">workspace</h4> +<ul> +<li>Alias: <code>-w</code></li> +<li>Type: Array</li> +<li>Default: <code>[]</code></li> +</ul> +<p>Enable running <code>npm init</code> in the context of workspaces, creating any missing +folders, generating files and adding/updating the <code>"workspaces"</code> property of +the project <code>package.json</code>.</p> +<p>the provided names or paths provided.</p> +<p>Valid values for the <code>workspace</code> config are either:</p> +<ul> +<li>Workspace names</li> +<li>Path to a workspace directory</li> +<li>Path to a parent workspace directory (will result to selecting all of the +children workspaces)</li> +</ul> +<h4 id="workspaces">workspaces</h4> +<ul> +<li>Alias: <code>-ws</code></li> +<li>Type: Boolean</li> +<li>Default: <code>false</code></li> +</ul> +<p>Run <code>npm init</code> in the context of all configured workspaces for the +current project.</p> <h3 id="see-also">See Also</h3> <ul> <li><a href="http://npm.im/init-package-json">init-package-json module</a></li> @@ -210,6 +289,7 @@ <h3 id="see-also">See Also</h3> <li><a href="../commands/npm-version.html">npm version</a></li> <li><a href="../using-npm/scope.html">npm scope</a></li> <li><a href="../commands/npm-exec.html">npm exec</a></li> +<li><a href="../using-npm/workspaces.html">npm workspaces</a></li> </ul> </div> diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 25a2850561a253..ede5cb042907a6 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,7 @@ <h3 id="description">Description</h3> the results to only the paths to the packages named. Note that nested packages will <em>also</em> show the paths to the specified packages. For example, running <code>npm ls promzard</code> in npm’s source tree will show:</p> -<pre lang="bash"><code>npm@7.9.0 /path/to/npm +<pre lang="bash"><code>npm@7.11.2 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 </code></pre> diff --git a/deps/npm/docs/output/commands/npm-run-script.html b/deps/npm/docs/output/commands/npm-run-script.html index 6fc343dfbaf5f9..1e47bfec108529 100644 --- a/deps/npm/docs/output/commands/npm-run-script.html +++ b/deps/npm/docs/output/commands/npm-run-script.html @@ -282,7 +282,7 @@ <h4 id="workspace">workspace</h4> </ul> <h4 id="workspaces">workspaces</h4> <ul> -<li>Alias: <code>-ws</code></li> +<li>Alias: <code>--ws</code></li> <li>Type: Boolean</li> <li>Default: <code>false</code></li> </ul> @@ -296,6 +296,7 @@ <h3 id="see-also">See Also</h3> <li><a href="../commands/npm-restart.html">npm restart</a></li> <li><a href="../commands/npm-stop.html">npm stop</a></li> <li><a href="../commands/npm-config.html">npm config</a></li> +<li><a href="../using-npm/workspaces.html">npm workspaces</a></li> </ul> </div> diff --git a/deps/npm/docs/output/commands/npm-version.html b/deps/npm/docs/output/commands/npm-version.html index f5832a2d2fdc2b..db78d2c970dbf1 100644 --- a/deps/npm/docs/output/commands/npm-version.html +++ b/deps/npm/docs/output/commands/npm-version.html @@ -141,7 +141,7 @@ <h1 id="npm-version">npm-version</h1> <section id="table_of_contents"> <h2 id="table-of-contents">Table of contents</h2> -<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div> +<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#workspaces">workspaces</a></li><li><a href="#workspace">workspace</a></li></ul><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div> </section> <div id="_content"><h3 id="synopsis">Synopsis</h3> @@ -151,6 +151,48 @@ <h2 id="table-of-contents">Table of contents</h2> 'npm view <pkg> version' to view a package's published version 'npm ls' to inspect current package/dependency versions </code></pre> +<h3 id="configuration">Configuration</h3> +<h4 id="allow-same-version"><code>allow-same-version</code></h4> +<ul> +<li>Default: <code>false</code></li> +<li>Type: Boolean</li> +</ul> +<p>Prevents throwing an error when <code>npm version</code> is used to set the new version +to the same value as the current version.</p> +<h4 id="git-tag-version"><code>git-tag-version</code></h4> +<ul> +<li>Default: <code>true</code></li> +<li>Type: Boolean</li> +</ul> +<p>Commit and tag the version change.</p> +<h4 id="commit-hooks"><code>commit-hooks</code></h4> +<ul> +<li>Default: <code>true</code></li> +<li>Type: Boolean</li> +</ul> +<p>Run git commit hooks when committing the version change.</p> +<h4 id="sign-git-tag"><code>sign-git-tag</code></h4> +<ul> +<li>Default: <code>false</code></li> +<li>Type: Boolean</li> +</ul> +<p>Pass the <code>-s</code> flag to git to sign the tag.</p> +<p>Note that you must have a default GPG key set up in your git config for this to work properly.</p> +<h4 id="workspaces">workspaces</h4> +<ul> +<li>Default: <code>false</code></li> +<li>Type: Boolean</li> +</ul> +<p>Enables workspaces context and includes workspaces in reported output +when getting versions. When setting a new version <em>only the workspaces +will be changed</em>.</p> +<h4 id="workspace">workspace</h4> +<ul> +<li>Default: []</li> +<li>Type: Array</li> +</ul> +<p>Enables workspaces context and limits results to only those specified by +this config item.</p> <h3 id="description">Description</h3> <p>Run this in a package directory to bump the version and write the new data back to <code>package.json</code>, <code>package-lock.json</code>, and, if present, <code>npm-shrinkwrap.json</code>.</p> @@ -210,33 +252,6 @@ <h3 id="description">Description</h3> <p>This runs all your tests and proceeds only if they pass. Then runs your <code>build</code> script, and adds everything in the <code>dist</code> directory to the commit. After the commit, it pushes the new commit and tag up to the server, and deletes the <code>build/temp</code> directory.</p> -<h3 id="configuration">Configuration</h3> -<h4 id="allow-same-version"><code>allow-same-version</code></h4> -<ul> -<li>Default: <code>false</code></li> -<li>Type: Boolean</li> -</ul> -<p>Prevents throwing an error when <code>npm version</code> is used to set the new version -to the same value as the current version.</p> -<h4 id="git-tag-version"><code>git-tag-version</code></h4> -<ul> -<li>Default: <code>true</code></li> -<li>Type: Boolean</li> -</ul> -<p>Commit and tag the version change.</p> -<h4 id="commit-hooks"><code>commit-hooks</code></h4> -<ul> -<li>Default: <code>true</code></li> -<li>Type: Boolean</li> -</ul> -<p>Run git commit hooks when committing the version change.</p> -<h4 id="sign-git-tag"><code>sign-git-tag</code></h4> -<ul> -<li>Default: <code>false</code></li> -<li>Type: Boolean</li> -</ul> -<p>Pass the <code>-s</code> flag to git to sign the tag.</p> -<p>Note that you must have a default GPG key set up in your git config for this to work properly.</p> <h3 id="see-also">See Also</h3> <ul> <li><a href="../commands/npm-init.html">npm init</a></li> diff --git a/deps/npm/docs/output/commands/npm-view.html b/deps/npm/docs/output/commands/npm-view.html index d3a1251673c2b6..7489b17b1cd009 100644 --- a/deps/npm/docs/output/commands/npm-view.html +++ b/deps/npm/docs/output/commands/npm-view.html @@ -141,7 +141,7 @@ <h1 id="npm-view">npm-view</h1> <section id="table_of_contents"> <h2 id="table-of-contents">Table of contents</h2> -<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#output">Output</a></li><li><a href="#see-also">See Also</a></li></ul></div> +<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#json">json</a></li><li><a href="#workspaces">workspaces</a></li><li><a href="#workspace">workspace</a></li></ul><li><a href="#output">Output</a></li><li><a href="#see-also">See Also</a></li></ul></div> </section> <div id="_content"><h3 id="synopsis">Synopsis</h3> @@ -198,6 +198,17 @@ <h3 id="description">Description</h3> this:</p> <pre lang="bash"><code>npm view connect versions </code></pre> +<h3 id="configuration">Configuration</h3> +<h4 id="json">json</h4> +<p>Show information in JSON format. See <a href="#output"><code>Output</code></a> below.</p> +<h4 id="workspaces">workspaces</h4> +<p>Enables workspaces context while searching the <code>package.json</code> in the +current folder. Information about packages named in each workspace will +be viewed.</p> +<h4 id="workspace">workspace</h4> +<p>Enables workspaces context and limits results to only those specified by +this config item. Only the information about packages named in the +workspaces given here will be viewed.</p> <h3 id="output">Output</h3> <p>If only a single string field for a single version is output, then it will not be colorized or quoted, to enable piping the output to diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 7290e4f8ef6138..311c581f681df4 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2> <pre lang="bash"><code>npm <command> [args] </code></pre> <h3 id="version">Version</h3> -<p>7.9.0</p> +<p>7.11.2</p> <h3 id="description">Description</h3> <p>npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html index 9c58ebf85f6a59..84956dede7d296 100644 --- a/deps/npm/docs/output/configuring-npm/package-json.html +++ b/deps/npm/docs/output/configuring-npm/package-json.html @@ -435,6 +435,7 @@ <h3 id="bin">bin</h3> <p>Please make sure that your file(s) referenced in <code>bin</code> starts with <code>#!/usr/bin/env node</code>, otherwise the scripts are started without the node executable!</p> +<p>Note that you can also set the executable files using <a href="#directoriesbin">directories.bin</a>.</p> <h3 id="man">man</h3> <p>Specify either a single file or an array of filenames to put in place for the <code>man</code> program to find.</p> diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index 5599777347b3a1..4435ce53bbaaca 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -141,7 +141,7 @@ <h1 id="config">config</h1> <section id="table_of_contents"> <h2 id="table-of-contents">Table of contents</h2> -<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><ul><li><a href="#command-line-flags">Command Line Flags</a></li><li><a href="#environment-variables">Environment Variables</a></li><li><a href="#npmrc-files">npmrc Files</a></li><li><a href="#default-configs">Default Configs</a></li></ul><li><a href="#shorthands-and-other-cli-niceties">Shorthands and Other CLI Niceties</a></li><li><a href="#config-settings">Config Settings</a></li><ul><li><a href="#auth"><code>_auth</code></a></li><li><a href="#access"><code>access</code></a></li><li><a href="#all"><code>all</code></a></li><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#always-auth"><code>always-auth</code></a></li><li><a href="#audit"><code>audit</code></a></li><li><a href="#audit-level"><code>audit-level</code></a></li><li><a href="#before"><code>before</code></a></li><li><a href="#bin-links"><code>bin-links</code></a></li><li><a href="#browser"><code>browser</code></a></li><li><a href="#ca"><code>ca</code></a></li><li><a href="#cache"><code>cache</code></a></li><li><a href="#cafile"><code>cafile</code></a></li><li><a href="#call"><code>call</code></a></li><li><a href="#cert"><code>cert</code></a></li><li><a href="#ci-name"><code>ci-name</code></a></li><li><a href="#cidr"><code>cidr</code></a></li><li><a href="#color"><code>color</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#depth"><code>depth</code></a></li><li><a href="#description2"><code>description</code></a></li><li><a href="#diff"><code>diff</code></a></li><li><a href="#diff-dst-prefix"><code>diff-dst-prefix</code></a></li><li><a href="#diff-ignore-all-space"><code>diff-ignore-all-space</code></a></li><li><a href="#diff-name-only"><code>diff-name-only</code></a></li><li><a href="#diff-no-prefix"><code>diff-no-prefix</code></a></li><li><a href="#diff-src-prefix"><code>diff-src-prefix</code></a></li><li><a href="#diff-text"><code>diff-text</code></a></li><li><a href="#diff-unified"><code>diff-unified</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#editor"><code>editor</code></a></li><li><a href="#engine-strict"><code>engine-strict</code></a></li><li><a href="#fetch-retries"><code>fetch-retries</code></a></li><li><a href="#fetch-retry-factor"><code>fetch-retry-factor</code></a></li><li><a href="#fetch-retry-maxtimeout"><code>fetch-retry-maxtimeout</code></a></li><li><a href="#fetch-retry-mintimeout"><code>fetch-retry-mintimeout</code></a></li><li><a href="#fetch-timeout"><code>fetch-timeout</code></a></li><li><a href="#force"><code>force</code></a></li><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li><li><a href="#format-package-lock"><code>format-package-lock</code></a></li><li><a href="#fund"><code>fund</code></a></li><li><a href="#git"><code>git</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#global"><code>global</code></a></li><li><a href="#global-style"><code>global-style</code></a></li><li><a href="#globalconfig"><code>globalconfig</code></a></li><li><a href="#heading"><code>heading</code></a></li><li><a href="#https-proxy"><code>https-proxy</code></a></li><li><a href="#if-present"><code>if-present</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#include"><code>include</code></a></li><li><a href="#include-staged"><code>include-staged</code></a></li><li><a href="#init-author-email"><code>init-author-email</code></a></li><li><a href="#init-author-name"><code>init-author-name</code></a></li><li><a href="#init-author-url"><code>init-author-url</code></a></li><li><a href="#init-license"><code>init-license</code></a></li><li><a href="#init-module"><code>init-module</code></a></li><li><a href="#init-version"><code>init-version</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#key"><code>key</code></a></li><li><a href="#legacy-bundling"><code>legacy-bundling</code></a></li><li><a href="#legacy-peer-deps"><code>legacy-peer-deps</code></a></li><li><a href="#link"><code>link</code></a></li><li><a href="#local-address"><code>local-address</code></a></li><li><a href="#loglevel"><code>loglevel</code></a></li><li><a href="#logs-max"><code>logs-max</code></a></li><li><a href="#long"><code>long</code></a></li><li><a href="#maxsockets"><code>maxsockets</code></a></li><li><a href="#message"><code>message</code></a></li><li><a href="#node-options"><code>node-options</code></a></li><li><a href="#node-version"><code>node-version</code></a></li><li><a href="#noproxy"><code>noproxy</code></a></li><li><a href="#npm-version"><code>npm-version</code></a></li><li><a href="#offline"><code>offline</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#otp"><code>otp</code></a></li><li><a href="#package"><code>package</code></a></li><li><a href="#package-lock"><code>package-lock</code></a></li><li><a href="#package-lock-only"><code>package-lock-only</code></a></li><li><a href="#parseable"><code>parseable</code></a></li><li><a href="#prefer-offline"><code>prefer-offline</code></a></li><li><a href="#prefer-online"><code>prefer-online</code></a></li><li><a href="#prefix"><code>prefix</code></a></li><li><a href="#preid"><code>preid</code></a></li><li><a href="#progress"><code>progress</code></a></li><li><a href="#proxy"><code>proxy</code></a></li><li><a href="#read-only"><code>read-only</code></a></li><li><a href="#rebuild-bundle"><code>rebuild-bundle</code></a></li><li><a href="#registry"><code>registry</code></a></li><li><a href="#save"><code>save</code></a></li><li><a href="#save-bundle"><code>save-bundle</code></a></li><li><a href="#save-dev"><code>save-dev</code></a></li><li><a href="#save-exact"><code>save-exact</code></a></li><li><a href="#save-optional"><code>save-optional</code></a></li><li><a href="#save-peer"><code>save-peer</code></a></li><li><a href="#save-prefix"><code>save-prefix</code></a></li><li><a href="#save-prod"><code>save-prod</code></a></li><li><a href="#scope"><code>scope</code></a></li><li><a href="#script-shell"><code>script-shell</code></a></li><li><a href="#searchexclude"><code>searchexclude</code></a></li><li><a href="#searchlimit"><code>searchlimit</code></a></li><li><a href="#searchopts"><code>searchopts</code></a></li><li><a href="#searchstaleness"><code>searchstaleness</code></a></li><li><a href="#shell"><code>shell</code></a></li><li><a href="#sign-git-commit"><code>sign-git-commit</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#strict-peer-deps"><code>strict-peer-deps</code></a></li><li><a href="#strict-ssl"><code>strict-ssl</code></a></li><li><a href="#tag"><code>tag</code></a></li><li><a href="#tag-version-prefix"><code>tag-version-prefix</code></a></li><li><a href="#timing"><code>timing</code></a></li><li><a href="#umask"><code>umask</code></a></li><li><a href="#unicode"><code>unicode</code></a></li><li><a href="#update-notifier"><code>update-notifier</code></a></li><li><a href="#usage"><code>usage</code></a></li><li><a href="#user-agent"><code>user-agent</code></a></li><li><a href="#userconfig"><code>userconfig</code></a></li><li><a href="#version"><code>version</code></a></li><li><a href="#versions"><code>versions</code></a></li><li><a href="#viewer"><code>viewer</code></a></li><li><a href="#which"><code>which</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#yes"><code>yes</code></a></li><li><a href="#also"><code>also</code></a></li><li><a href="#auth-type"><code>auth-type</code></a></li><li><a href="#cache-max"><code>cache-max</code></a></li><li><a href="#cache-min"><code>cache-min</code></a></li><li><a href="#dev"><code>dev</code></a></li><li><a href="#initauthoremail"><code>init.author.email</code></a></li><li><a href="#initauthorname"><code>init.author.name</code></a></li><li><a href="#initauthorurl"><code>init.author.url</code></a></li><li><a href="#initlicense"><code>init.license</code></a></li><li><a href="#initmodule"><code>init.module</code></a></li><li><a href="#initversion"><code>init.version</code></a></li><li><a href="#only"><code>only</code></a></li><li><a href="#optional"><code>optional</code></a></li><li><a href="#production"><code>production</code></a></li><li><a href="#shrinkwrap"><code>shrinkwrap</code></a></li><li><a href="#sso-poll-frequency"><code>sso-poll-frequency</code></a></li><li><a href="#sso-type"><code>sso-type</code></a></li><li><a href="#tmp"><code>tmp</code></a></li></ul><li><a href="#see-also">See also</a></li></ul></div> +<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><ul><li><a href="#command-line-flags">Command Line Flags</a></li><li><a href="#environment-variables">Environment Variables</a></li><li><a href="#npmrc-files">npmrc Files</a></li><li><a href="#default-configs">Default Configs</a></li></ul><li><a href="#shorthands-and-other-cli-niceties">Shorthands and Other CLI Niceties</a></li><li><a href="#config-settings">Config Settings</a></li><ul><li><a href="#auth"><code>_auth</code></a></li><li><a href="#access"><code>access</code></a></li><li><a href="#all"><code>all</code></a></li><li><a href="#allow-same-version"><code>allow-same-version</code></a></li><li><a href="#audit"><code>audit</code></a></li><li><a href="#audit-level"><code>audit-level</code></a></li><li><a href="#before"><code>before</code></a></li><li><a href="#bin-links"><code>bin-links</code></a></li><li><a href="#browser"><code>browser</code></a></li><li><a href="#ca"><code>ca</code></a></li><li><a href="#cache"><code>cache</code></a></li><li><a href="#cafile"><code>cafile</code></a></li><li><a href="#call"><code>call</code></a></li><li><a href="#cert"><code>cert</code></a></li><li><a href="#ci-name"><code>ci-name</code></a></li><li><a href="#cidr"><code>cidr</code></a></li><li><a href="#color"><code>color</code></a></li><li><a href="#commit-hooks"><code>commit-hooks</code></a></li><li><a href="#depth"><code>depth</code></a></li><li><a href="#description2"><code>description</code></a></li><li><a href="#diff"><code>diff</code></a></li><li><a href="#diff-dst-prefix"><code>diff-dst-prefix</code></a></li><li><a href="#diff-ignore-all-space"><code>diff-ignore-all-space</code></a></li><li><a href="#diff-name-only"><code>diff-name-only</code></a></li><li><a href="#diff-no-prefix"><code>diff-no-prefix</code></a></li><li><a href="#diff-src-prefix"><code>diff-src-prefix</code></a></li><li><a href="#diff-text"><code>diff-text</code></a></li><li><a href="#diff-unified"><code>diff-unified</code></a></li><li><a href="#dry-run"><code>dry-run</code></a></li><li><a href="#editor"><code>editor</code></a></li><li><a href="#engine-strict"><code>engine-strict</code></a></li><li><a href="#fetch-retries"><code>fetch-retries</code></a></li><li><a href="#fetch-retry-factor"><code>fetch-retry-factor</code></a></li><li><a href="#fetch-retry-maxtimeout"><code>fetch-retry-maxtimeout</code></a></li><li><a href="#fetch-retry-mintimeout"><code>fetch-retry-mintimeout</code></a></li><li><a href="#fetch-timeout"><code>fetch-timeout</code></a></li><li><a href="#force"><code>force</code></a></li><li><a href="#foreground-scripts"><code>foreground-scripts</code></a></li><li><a href="#format-package-lock"><code>format-package-lock</code></a></li><li><a href="#fund"><code>fund</code></a></li><li><a href="#git"><code>git</code></a></li><li><a href="#git-tag-version"><code>git-tag-version</code></a></li><li><a href="#global"><code>global</code></a></li><li><a href="#global-style"><code>global-style</code></a></li><li><a href="#globalconfig"><code>globalconfig</code></a></li><li><a href="#heading"><code>heading</code></a></li><li><a href="#https-proxy"><code>https-proxy</code></a></li><li><a href="#if-present"><code>if-present</code></a></li><li><a href="#ignore-scripts"><code>ignore-scripts</code></a></li><li><a href="#include"><code>include</code></a></li><li><a href="#include-staged"><code>include-staged</code></a></li><li><a href="#init-author-email"><code>init-author-email</code></a></li><li><a href="#init-author-name"><code>init-author-name</code></a></li><li><a href="#init-author-url"><code>init-author-url</code></a></li><li><a href="#init-license"><code>init-license</code></a></li><li><a href="#init-module"><code>init-module</code></a></li><li><a href="#init-version"><code>init-version</code></a></li><li><a href="#json"><code>json</code></a></li><li><a href="#key"><code>key</code></a></li><li><a href="#legacy-bundling"><code>legacy-bundling</code></a></li><li><a href="#legacy-peer-deps"><code>legacy-peer-deps</code></a></li><li><a href="#link"><code>link</code></a></li><li><a href="#local-address"><code>local-address</code></a></li><li><a href="#loglevel"><code>loglevel</code></a></li><li><a href="#logs-max"><code>logs-max</code></a></li><li><a href="#long"><code>long</code></a></li><li><a href="#maxsockets"><code>maxsockets</code></a></li><li><a href="#message"><code>message</code></a></li><li><a href="#node-options"><code>node-options</code></a></li><li><a href="#node-version"><code>node-version</code></a></li><li><a href="#noproxy"><code>noproxy</code></a></li><li><a href="#npm-version"><code>npm-version</code></a></li><li><a href="#offline"><code>offline</code></a></li><li><a href="#omit"><code>omit</code></a></li><li><a href="#otp"><code>otp</code></a></li><li><a href="#package"><code>package</code></a></li><li><a href="#package-lock"><code>package-lock</code></a></li><li><a href="#package-lock-only"><code>package-lock-only</code></a></li><li><a href="#parseable"><code>parseable</code></a></li><li><a href="#prefer-offline"><code>prefer-offline</code></a></li><li><a href="#prefer-online"><code>prefer-online</code></a></li><li><a href="#prefix"><code>prefix</code></a></li><li><a href="#preid"><code>preid</code></a></li><li><a href="#progress"><code>progress</code></a></li><li><a href="#proxy"><code>proxy</code></a></li><li><a href="#read-only"><code>read-only</code></a></li><li><a href="#rebuild-bundle"><code>rebuild-bundle</code></a></li><li><a href="#registry"><code>registry</code></a></li><li><a href="#save"><code>save</code></a></li><li><a href="#save-bundle"><code>save-bundle</code></a></li><li><a href="#save-dev"><code>save-dev</code></a></li><li><a href="#save-exact"><code>save-exact</code></a></li><li><a href="#save-optional"><code>save-optional</code></a></li><li><a href="#save-peer"><code>save-peer</code></a></li><li><a href="#save-prefix"><code>save-prefix</code></a></li><li><a href="#save-prod"><code>save-prod</code></a></li><li><a href="#scope"><code>scope</code></a></li><li><a href="#script-shell"><code>script-shell</code></a></li><li><a href="#searchexclude"><code>searchexclude</code></a></li><li><a href="#searchlimit"><code>searchlimit</code></a></li><li><a href="#searchopts"><code>searchopts</code></a></li><li><a href="#searchstaleness"><code>searchstaleness</code></a></li><li><a href="#shell"><code>shell</code></a></li><li><a href="#sign-git-commit"><code>sign-git-commit</code></a></li><li><a href="#sign-git-tag"><code>sign-git-tag</code></a></li><li><a href="#strict-peer-deps"><code>strict-peer-deps</code></a></li><li><a href="#strict-ssl"><code>strict-ssl</code></a></li><li><a href="#tag"><code>tag</code></a></li><li><a href="#tag-version-prefix"><code>tag-version-prefix</code></a></li><li><a href="#timing"><code>timing</code></a></li><li><a href="#umask"><code>umask</code></a></li><li><a href="#unicode"><code>unicode</code></a></li><li><a href="#update-notifier"><code>update-notifier</code></a></li><li><a href="#usage"><code>usage</code></a></li><li><a href="#user-agent"><code>user-agent</code></a></li><li><a href="#userconfig"><code>userconfig</code></a></li><li><a href="#version"><code>version</code></a></li><li><a href="#versions"><code>versions</code></a></li><li><a href="#viewer"><code>viewer</code></a></li><li><a href="#which"><code>which</code></a></li><li><a href="#workspace"><code>workspace</code></a></li><li><a href="#workspaces"><code>workspaces</code></a></li><li><a href="#yes"><code>yes</code></a></li><li><a href="#also"><code>also</code></a></li><li><a href="#auth-type"><code>auth-type</code></a></li><li><a href="#cache-max"><code>cache-max</code></a></li><li><a href="#cache-min"><code>cache-min</code></a></li><li><a href="#dev"><code>dev</code></a></li><li><a href="#initauthoremail"><code>init.author.email</code></a></li><li><a href="#initauthorname"><code>init.author.name</code></a></li><li><a href="#initauthorurl"><code>init.author.url</code></a></li><li><a href="#initlicense"><code>init.license</code></a></li><li><a href="#initmodule"><code>init.module</code></a></li><li><a href="#initversion"><code>init.version</code></a></li><li><a href="#only"><code>only</code></a></li><li><a href="#optional"><code>optional</code></a></li><li><a href="#production"><code>production</code></a></li><li><a href="#shrinkwrap"><code>shrinkwrap</code></a></li><li><a href="#sso-poll-frequency"><code>sso-poll-frequency</code></a></li><li><a href="#sso-type"><code>sso-type</code></a></li><li><a href="#tmp"><code>tmp</code></a></li></ul><li><a href="#see-also">See also</a></li></ul></div> </section> <div id="_content"><h3 id="description">Description</h3> @@ -279,13 +279,6 @@ <h4 id="allow-same-version"><code>allow-same-version</code></h4> </ul> <p>Prevents throwing an error when <code>npm version</code> is used to set the new version to the same value as the current version.</p> -<h4 id="always-auth"><code>always-auth</code></h4> -<ul> -<li>Default: false</li> -<li>Type: Boolean</li> -</ul> -<p>Force npm to always require authentication when accessing the registry, even -for <code>GET</code> requests.</p> <h4 id="audit"><code>audit</code></h4> <ul> <li>Default: true</li> @@ -1055,7 +1048,7 @@ <h4 id="script-shell"><code>script-shell</code></h4> <li>Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows</li> <li>Type: null or String</li> </ul> -<p>The shell to use for scripts run with the <code>npm run</code> command.</p> +<p>The shell to use for scripts run with the <code>npm exec</code>, <code>npm run</code> and <code>npm init <pkg></code> commands.</p> <h4 id="searchexclude"><code>searchexclude</code></h4> <ul> <li>Default: “”</li> diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js index f35b9829fe946e..fb1e323512b6d0 100644 --- a/deps/npm/lib/adduser.js +++ b/deps/npm/lib/adduser.js @@ -21,7 +21,6 @@ class AddUser extends BaseCommand { return [ 'registry', 'scope', - 'always-auth', ] } diff --git a/deps/npm/lib/base-command.js b/deps/npm/lib/base-command.js index 91c7c5357c9a03..322fd8963a2032 100644 --- a/deps/npm/lib/base-command.js +++ b/deps/npm/lib/base-command.js @@ -4,6 +4,7 @@ const ConfigDefinitions = require('./utils/config/definitions.js') class BaseCommand { constructor (npm) { + this.wrapWidth = 80 this.npm = npm } @@ -27,8 +28,7 @@ class BaseCommand { usage = `${usage}${this.constructor.usage.map(u => `npm ${this.constructor.name} ${u}`).join('\n')}` if (this.constructor.params) - // TODO word wrap this along params boundaries - usage = `${usage}\n\nOptions:\n[${this.constructor.params.map(p => ConfigDefinitions[p].usage).join('] [')}]` + usage = `${usage}\n\nOptions:\n${this.wrappedParams}` // Mostly this just appends aliases, this could be more clear usage = usageUtil(this.constructor.name, usage) @@ -36,6 +36,22 @@ class BaseCommand { return usage } + get wrappedParams () { + let results = '' + let line = '' + + for (const param of this.constructor.params) { + const usage = `[${ConfigDefinitions[param].usage}]` + if (line.length && (line.length + usage.length) > this.wrapWidth) { + results = [results, line].filter(Boolean).join('\n') + line = '' + } + line = [line, usage].filter(Boolean).join(' ') + } + results = [results, line].filter(Boolean).join('\n') + return results + } + usageError (msg) { if (!msg) { return Object.assign(new Error(`\nUsage: ${this.usage}`), { diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js index a0cef4c5ec4faf..5085a25b4a64a3 100644 --- a/deps/npm/lib/bugs.js +++ b/deps/npm/lib/bugs.js @@ -43,6 +43,9 @@ class Bugs extends BaseCommand { if (typeof mani.bugs === 'object' && mani.bugs.url) return mani.bugs.url + + if (typeof mani.bugs === 'object' && mani.bugs.email) + return `mailto:${mani.bugs.email}` } // try to get it from the repo, if possible diff --git a/deps/npm/lib/exec.js b/deps/npm/lib/exec.js index f8c76eeed4c515..3da672f9915fdd 100644 --- a/deps/npm/lib/exec.js +++ b/deps/npm/lib/exec.js @@ -1,18 +1,6 @@ -const { promisify } = require('util') -const read = promisify(require('read')) -const chalk = require('chalk') -const mkdirp = require('mkdirp-infer-owner') -const readPackageJson = require('read-package-json-fast') -const Arborist = require('@npmcli/arborist') -const runScript = require('@npmcli/run-script') -const { resolve, delimiter } = require('path') -const ciDetect = require('@npmcli/ci-detect') -const crypto = require('crypto') -const pacote = require('pacote') -const npa = require('npm-package-arg') -const fileExists = require('./utils/file-exists.js') -const PATH = require('./utils/path.js') +const libexec = require('libnpmexec') const BaseCommand = require('./base-command.js') +const getLocationMsg = require('./exec/get-workspace-location-msg.js') const getWorkspaces = require('./workspaces/get-workspaces.js') // it's like this: @@ -40,13 +28,6 @@ const getWorkspaces = require('./workspaces/get-workspaces.js') // runScript({ pkg, event: 'npx', ... }) // process.env.npm_lifecycle_event = 'npx' -const nocolor = { - reset: s => s, - bold: s => s, - dim: s => s, - green: s => s, -} - class Exec extends BaseCommand { /* istanbul ignore next - see test/lib/load-all-commands.js */ static get description () { @@ -86,276 +67,50 @@ class Exec extends BaseCommand { // When commands go async and we can dump the boilerplate exec methods this // can be named correctly async _exec (_args, { locationMsg, path, runPath }) { + const args = [..._args] + const cache = this.npm.config.get('cache') const call = this.npm.config.get('call') - const shell = this.npm.config.get('shell') - // dereferenced because we manipulate it later - const packages = [...this.npm.config.get('package')] + const color = this.npm.config.get('color') + const { + flatOptions, + localBin, + log, + globalBin, + output, + } = this.npm + const scriptShell = this.npm.config.get('script-shell') || undefined + const packages = this.npm.config.get('package') + const yes = this.npm.config.get('yes') if (call && _args.length) throw this.usage - const args = [..._args] - const pathArr = [...PATH] - - // nothing to maybe install, skip the arborist dance - if (!call && !args.length && !packages.length) { - return await this.run({ - args, - call, - locationMsg, - shell, - path, - pathArr, - runPath, - }) - } - - const needPackageCommandSwap = args.length && !packages.length - // if there's an argument and no package has been explicitly asked for - // check the local and global bin paths for a binary named the same as - // the argument and run it if it exists, otherwise fall through to - // the behavior of treating the single argument as a package name - if (needPackageCommandSwap) { - let binExists = false - if (await fileExists(`${this.npm.localBin}/${args[0]}`)) { - pathArr.unshift(this.npm.localBin) - binExists = true - } else if (await fileExists(`${this.npm.globalBin}/${args[0]}`)) { - pathArr.unshift(this.npm.globalBin) - binExists = true - } - - if (binExists) { - return await this.run({ - args, - call, - locationMsg, - path, - pathArr, - runPath, - shell, - }) - } - - packages.push(args[0]) - } - - // If we do `npm exec foo`, and have a `foo` locally, then we'll - // always use that, so we don't really need to fetch the manifest. - // So: run npa on each packages entry, and if it is a name with a - // rawSpec==='', then try to readPackageJson at - // node_modules/${name}/package.json, and only pacote fetch if - // that fails. - const manis = await Promise.all(packages.map(async p => { - const spec = npa(p, path) - if (spec.type === 'tag' && spec.rawSpec === '') { - // fall through to the pacote.manifest() approach - try { - const pj = resolve(path, 'node_modules', spec.name) - return await readPackageJson(pj) - } catch (er) {} - } - // Force preferOnline to true so we are making sure to pull in the latest - // This is especially useful if the user didn't give us a version, and - // they expect to be running @latest - return await pacote.manifest(p, { - ...this.npm.flatOptions, - preferOnline: true, - }) - })) - - if (needPackageCommandSwap) - args[0] = this.getBinFromManifest(manis[0]) - - // figure out whether we need to install stuff, or if local is fine - const localArb = new Arborist({ - ...this.npm.flatOptions, - path, - }) - const tree = await localArb.loadActual() - - // do we have all the packages in manifest list? - const needInstall = manis.some(mani => this.manifestMissing(tree, mani)) - - if (needInstall) { - const installDir = this.cacheInstallDir(packages) - await mkdirp(installDir) - const arb = new Arborist({ - ...this.npm.flatOptions, - log: this.npm.log, - path: installDir, - }) - const tree = await arb.loadActual() - - // at this point, we have to ensure that we get the exact same - // version, because it's something that has only ever been installed - // by npm exec in the cache install directory - const add = manis.filter(mani => this.manifestMissing(tree, { - ...mani, - _from: `${mani.name}@${mani.version}`, - })) - .map(mani => mani._from) - .sort((a, b) => a.localeCompare(b)) - - // no need to install if already present - if (add.length) { - if (!this.npm.config.get('yes')) { - // set -n to always say no - if (this.npm.config.get('yes') === false) - throw new Error('canceled') - - if (!process.stdin.isTTY || ciDetect()) { - this.npm.log.warn('exec', `The following package${ - add.length === 1 ? ' was' : 's were' - } not found and will be installed: ${ - add.map((pkg) => pkg.replace(/@$/, '')).join(', ') - }`) - } else { - const addList = add.map(a => ` ${a.replace(/@$/, '')}`) - .join('\n') + '\n' - const prompt = `Need to install the following packages:\n${ - addList - }Ok to proceed? ` - const confirm = await read({ prompt, default: 'y' }) - if (confirm.trim().toLowerCase().charAt(0) !== 'y') - throw new Error('canceled') - } - } - await arb.reify({ - ...this.npm.flatOptions, - log: this.npm.log, - add, - }) - } - pathArr.unshift(resolve(installDir, 'node_modules/.bin')) - } - - return await this.run({ + return libexec({ + ...flatOptions, args, call, + cache, + color, + localBin, locationMsg, + log, + globalBin, + output, + packages, path, - pathArr, runPath, - shell, + scriptShell, + yes, }) } - async run ({ args, call, locationMsg, path, pathArr, runPath, shell }) { - // turn list of args into command string - const script = call || args.shift() || shell - - // do the fakey runScript dance - // still should work if no package.json in cwd - const realPkg = await readPackageJson(`${path}/package.json`) - .catch(() => ({})) - const pkg = { - ...realPkg, - scripts: { - ...(realPkg.scripts || {}), - npx: script, - }, - } - - this.npm.log.disableProgress() - try { - if (script === shell) { - if (process.stdin.isTTY) { - if (ciDetect()) - return this.npm.log.warn('exec', 'Interactive mode disabled in CI environment') - - const color = this.npm.config.get('color') - const colorize = color ? chalk : nocolor - - locationMsg = locationMsg || ` at location:\n${colorize.dim(runPath)}` - - this.npm.output(`${ - colorize.reset('\nEntering npm script environment') - }${ - colorize.reset(locationMsg) - }${ - colorize.bold('\nType \'exit\' or ^D when finished\n') - }`) - } - } - return await runScript({ - ...this.npm.flatOptions, - pkg, - banner: false, - // we always run in cwd, not --prefix - path: runPath, - stdioString: true, - event: 'npx', - args, - env: { - PATH: pathArr.join(delimiter), - }, - stdio: 'inherit', - }) - } finally { - this.npm.log.enableProgress() - } - } - - manifestMissing (tree, mani) { - // if the tree doesn't have a child by that name/version, return true - // true means we need to install it - const child = tree.children.get(mani.name) - // if no child, we have to load it - if (!child) - return true - - // if no version/tag specified, allow whatever's there - if (mani._from === `${mani.name}@`) - return false - - // otherwise the version has to match what we WOULD get - return child.version !== mani.version - } - - getBinFromManifest (mani) { - // if we have a bin matching (unscoped portion of) packagename, use that - // otherwise if there's 1 bin or all bin value is the same (alias), use - // that, otherwise fail - const bin = mani.bin || {} - if (new Set(Object.values(bin)).size === 1) - return Object.keys(bin)[0] - - // XXX probably a util to parse this better? - const name = mani.name.replace(/^@[^/]+\//, '') - if (bin[name]) - return name - - // XXX need better error message - throw Object.assign(new Error('could not determine executable to run'), { - pkgid: mani._id, - }) - } - - cacheInstallDir (packages) { - // only packages not found in ${prefix}/node_modules - return resolve(this.npm.config.get('cache'), '_npx', this.getHash(packages)) - } - - getHash (packages) { - return crypto.createHash('sha512') - .update(packages.sort((a, b) => a.localeCompare(b)).join('\n')) - .digest('hex') - .slice(0, 16) - } - async _execWorkspaces (args, filters) { const workspaces = await getWorkspaces(filters, { path: this.npm.localPrefix }) - const getLocationMsg = async path => { - const color = this.npm.config.get('color') - const colorize = color ? chalk : nocolor - const { _id } = await readPackageJson(`${path}/package.json`) - return ` in workspace ${colorize.green(_id)} at location:\n${colorize.dim(path)}` - } + const color = this.npm.config.get('color') for (const workspacePath of workspaces.values()) { - const locationMsg = await getLocationMsg(workspacePath) + const locationMsg = await getLocationMsg({ color, path: workspacePath }) await this._exec(args, { locationMsg, path: workspacePath, @@ -364,4 +119,5 @@ class Exec extends BaseCommand { } } } + module.exports = Exec diff --git a/deps/npm/lib/exec/get-workspace-location-msg.js b/deps/npm/lib/exec/get-workspace-location-msg.js new file mode 100644 index 00000000000000..813b11e7892223 --- /dev/null +++ b/deps/npm/lib/exec/get-workspace-location-msg.js @@ -0,0 +1,25 @@ +const chalk = require('chalk') +const readPackageJson = require('read-package-json-fast') + +const nocolor = { + dim: s => s, + green: s => s, +} + +const getLocationMsg = async ({ color, path }) => { + const colorize = color ? chalk : nocolor + const { _id } = + await readPackageJson(`${path}/package.json`) + .catch(() => ({})) + + const workspaceMsg = _id + ? ` in workspace ${colorize.green(_id)}` + : ` in a ${colorize.green('new')} workspace` + const locationMsg = ` at location:\n${ + colorize.dim(path) + }` + + return `${workspaceMsg}${locationMsg}` +} + +module.exports = getLocationMsg diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js index 81c6733885a68e..7d7f6bab37668f 100644 --- a/deps/npm/lib/init.js +++ b/deps/npm/lib/init.js @@ -1,6 +1,14 @@ +const fs = require('fs') +const { relative, resolve } = require('path') +const mkdirp = require('mkdirp-infer-owner') const initJson = require('init-package-json') const npa = require('npm-package-arg') +const rpj = require('read-package-json-fast') +const libexec = require('libnpmexec') +const parseJSON = require('json-parse-even-better-errors') +const mapWorkspaces = require('@npmcli/map-workspaces') +const getLocationMsg = require('./exec/get-workspace-location-msg.js') const BaseCommand = require('./base-command.js') class Init extends BaseCommand { @@ -9,6 +17,11 @@ class Init extends BaseCommand { return 'Create a package.json file' } + /* istanbul ignore next - see test/lib/load-all-commands.js */ + static get params () { + return ['workspace', 'workspaces'] + } + /* istanbul ignore next - see test/lib/load-all-commands.js */ static get name () { return 'init' @@ -27,42 +40,107 @@ class Init extends BaseCommand { this.init(args).then(() => cb()).catch(cb) } + execWorkspaces (args, filters, cb) { + this.initWorkspaces(args, filters).then(() => cb()).catch(cb) + } + async init (args) { - // the new npx style way + // npm exec style + if (args.length) + return (await this.execCreate({ args, path: process.cwd() })) + + // no args, uses classic init-package-json boilerplate + await this.template() + } + + async initWorkspaces (args, filters) { + // reads package.json for the top-level folder first, by doing this we + // ensure the command throw if no package.json is found before trying + // to create a workspace package.json file or its folders + const pkg = await rpj(resolve(this.npm.localPrefix, 'package.json')) + const wPath = filterArg => resolve(this.npm.localPrefix, filterArg) + + // npm-exec style, runs in the context of each workspace filter if (args.length) { - const initerName = args[0] - let packageName = initerName - if (/^@[^/]+$/.test(initerName)) - packageName = initerName + '/create' - else { - const req = npa(initerName) - if (req.type === 'git' && req.hosted) { - const { user, project } = req.hosted - packageName = initerName - .replace(user + '/' + project, user + '/create-' + project) - } else if (req.registry) { - packageName = req.name.replace(/^(@[^/]+\/)?/, '$1create-') - if (req.rawSpec) - packageName += '@' + req.rawSpec - } else { - throw Object.assign(new Error( - 'Unrecognized initializer: ' + initerName + - '\nFor more package binary executing power check out `npx`:' + - '\nhttps://www.npmjs.com/package/npx' - ), { code: 'EUNSUPPORTED' }) - } + for (const filterArg of filters) { + const path = wPath(filterArg) + await mkdirp(path) + await this.execCreate({ args, path }) + await this.setWorkspace({ pkg, workspacePath: path }) + } + return + } + + // no args, uses classic init-package-json boilerplate + for (const filterArg of filters) { + const path = wPath(filterArg) + await mkdirp(path) + await this.template(path) + await this.setWorkspace({ pkg, workspacePath: path }) + } + } + + async execCreate ({ args, path }) { + const [initerName, ...otherArgs] = args + let packageName = initerName + + if (/^@[^/]+$/.test(initerName)) + packageName = initerName + '/create' + else { + const req = npa(initerName) + if (req.type === 'git' && req.hosted) { + const { user, project } = req.hosted + packageName = initerName + .replace(user + '/' + project, user + '/create-' + project) + } else if (req.registry) { + packageName = req.name.replace(/^(@[^/]+\/)?/, '$1create-') + if (req.rawSpec) + packageName += '@' + req.rawSpec + } else { + throw Object.assign(new Error( + 'Unrecognized initializer: ' + initerName + + '\nFor more package binary executing power check out `npx`:' + + '\nhttps://www.npmjs.com/package/npx' + ), { code: 'EUNSUPPORTED' }) } - this.npm.config.set('package', []) - const newArgs = [packageName, ...args.slice(1)] - return new Promise((res, rej) => { - this.npm.commands.exec(newArgs, er => er ? rej(er) : res()) - }) } - // the old way - const dir = process.cwd() + const newArgs = [packageName, ...otherArgs] + const cache = this.npm.config.get('cache') + const { color } = this.npm.flatOptions + const { + flatOptions, + localBin, + log, + globalBin, + output, + } = this.npm + const locationMsg = await getLocationMsg({ color, path }) + const runPath = path + const scriptShell = this.npm.config.get('script-shell') || undefined + const yes = this.npm.config.get('yes') + + await libexec({ + ...flatOptions, + args: newArgs, + cache, + color, + localBin, + locationMsg, + log, + globalBin, + output, + path, + runPath, + scriptShell, + yes, + }) + } + + async template (path = process.cwd()) { this.npm.log.pause() this.npm.log.disableProgress() + const initFile = this.npm.config.get('init-module') if (!this.npm.config.get('yes') && !this.npm.config.get('force')) { this.npm.output([ @@ -78,9 +156,10 @@ class Init extends BaseCommand { 'Press ^C at any time to quit.', ].join('\n')) } + // XXX promisify init-package-json await new Promise((res, rej) => { - initJson(dir, initFile, this.npm.config, (er, data) => { + initJson(path, initFile, this.npm.config, (er, data) => { this.npm.log.resume() this.npm.log.enableProgress() this.npm.log.silly('package data', data) @@ -97,5 +176,56 @@ class Init extends BaseCommand { }) }) } + + async setWorkspace ({ pkg, workspacePath }) { + const workspaces = await mapWorkspaces({ cwd: this.npm.localPrefix, pkg }) + + // skip setting workspace if current package.json glob already satisfies it + for (const wPath of workspaces.values()) { + if (wPath === workspacePath) + return + } + + // if a create-pkg didn't generate a package.json at the workspace + // folder level, it might not be recognized as a workspace by + // mapWorkspaces, so we're just going to avoid touching the + // top-level package.json + try { + fs.statSync(resolve(workspacePath, 'package.json')) + } catch (err) { + return + } + + let manifest + try { + manifest = + fs.readFileSync(resolve(this.npm.localPrefix, 'package.json'), 'utf-8') + } catch (error) { + throw new Error('package.json not found') + } + + try { + manifest = parseJSON(manifest) + } catch (error) { + throw new Error(`Invalid package.json: ${error}`) + } + + if (!manifest.workspaces) + manifest.workspaces = [] + + manifest.workspaces.push(relative(this.npm.localPrefix, workspacePath)) + + // format content + const { + [Symbol.for('indent')]: indent, + [Symbol.for('newline')]: newline, + } = manifest + + const content = (JSON.stringify(manifest, null, indent) + '\n') + .replace(/\n/g, newline) + + fs.writeFileSync(resolve(this.npm.localPrefix, 'package.json'), content) + } } + module.exports = Init diff --git a/deps/npm/lib/logout.js b/deps/npm/lib/logout.js index adc19a923af9ab..0887ec397bf1ae 100644 --- a/deps/npm/lib/logout.js +++ b/deps/npm/lib/logout.js @@ -41,7 +41,7 @@ class Logout extends BaseCommand { method: 'DELETE', ignoreBody: true, }) - } else if (auth.username || auth.password) + } else if (auth.isBasicAuth) log.verbose('logout', `clearing user credentials for ${reg}`) else { const msg = `not logged in to ${reg}, so can't log out!` diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js index 65b3ddfe7611b7..ccd8b2ff9dea71 100644 --- a/deps/npm/lib/ls.js +++ b/deps/npm/lib/ls.js @@ -166,7 +166,10 @@ class LS extends BaseCommand { ) } - if (problems.size) { + const shouldThrow = problems.size && + ![...problems].every(problem => problem.startsWith('extraneous:')) + + if (shouldThrow) { throw Object.assign( new Error([...problems].join(EOL)), { code: 'ELSPROBLEMS' } @@ -302,7 +305,7 @@ const getJsonOutputItem = (node, { global, long }) => { if (node.isRoot && hasPackageJson) item.name = node.package.name || node.name - if (long) { + if (long && !node[_missing]) { item.name = item[_name] const { dependencies, ...packageInfo } = node.package Object.assign(item, packageInfo) @@ -411,9 +414,11 @@ const augmentNodesWithMetadata = ({ path: node.path, isLink: node.isLink, realpath: node.realpath, + [_type]: node[_type], [_invalid]: node[_invalid], [_missing]: node[_missing], - [_dedupe]: true, + // if it's missing, it's not deduped, it's just missing + [_dedupe]: !node[_missing], } } else { // keeps track of already seen nodes in order to check for dedupes diff --git a/deps/npm/lib/pack.js b/deps/npm/lib/pack.js index 8e61efabb36e4d..5c0da6be7b6e04 100644 --- a/deps/npm/lib/pack.js +++ b/deps/npm/lib/pack.js @@ -45,22 +45,34 @@ class Pack extends BaseCommand { args = ['.'] const unicode = this.npm.config.get('unicode') + const dryRun = this.npm.config.get('dry-run') - // clone the opts because pacote mutates it with resolved/integrity - const tarballs = await Promise.all(args.map(async (arg) => { + // Get the manifests and filenames first so we can bail early on manifest + // errors before making any tarballs + const manifests = [] + for (const arg of args) { const spec = npa(arg) - const dryRun = this.npm.config.get('dry-run') const manifest = await pacote.manifest(spec, this.npm.flatOptions) + if (!manifest._id) + throw new Error('Invalid package, must have name and version') + const filename = `${manifest.name}-${manifest.version}.tgz` .replace(/^@/, '').replace(/\//, '-') + manifests.push({ arg, filename, manifest }) + } + + // Load tarball names up for printing afterward to isolate from the + // noise generated during packing + const tarballs = [] + for (const { arg, filename, manifest } of manifests) { const tarballData = await libpack(arg, this.npm.flatOptions) const pkgContents = await getContents(manifest, tarballData) if (!dryRun) await writeFile(filename, tarballData) - return pkgContents - })) + tarballs.push(pkgContents) + } for (const tar of tarballs) { logTar(tar, { log, unicode }) diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index d87c43ddade500..3a50175d5db649 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -199,16 +199,6 @@ define('also', { }, }) -define('always-auth', { - default: false, - type: Boolean, - description: ` - Force npm to always require authentication when accessing the registry, - even for \`GET\` requests. - `, - flatten, -}) - define('audit', { default: true, type: Boolean, @@ -1389,6 +1379,7 @@ define('prefix', { define('preid', { default: '', + hint: 'prerelease-id', type: String, description: ` The "prerelease identifier" to use as a prefix for the "prerelease" part @@ -1659,7 +1650,8 @@ define('script-shell', { `, type: [null, String], description: ` - The shell to use for scripts run with the \`npm run\` command. + The shell to use for scripts run with the \`npm exec\`, + \`npm run\` and \`npm init <pkg>\` commands. `, flatten (key, obj, flatOptions) { flatOptions.scriptShell = obj[key] || undefined diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js index 18b7d7d6c5d840..3ef3801e74e810 100644 --- a/deps/npm/lib/version.js +++ b/deps/npm/lib/version.js @@ -1,6 +1,11 @@ -const libversion = require('libnpmversion') +const libnpmversion = require('libnpmversion') +const { resolve } = require('path') +const { promisify } = require('util') +const readFile = promisify(require('fs').readFile) +const getWorkspaces = require('./workspaces/get-workspaces.js') const BaseCommand = require('./base-command.js') + class Version extends BaseCommand { static get description () { return 'Bump a package version' @@ -11,9 +16,23 @@ class Version extends BaseCommand { return 'version' } + /* istanbul ignore next - see test/lib/load-all-commands.js */ + static get params () { + return [ + 'allow-same-version', + 'commit-hooks', + 'git-tag-version', + 'json', + 'preid', + 'sign-git-tag', + 'workspace', + 'workspaces', + ] + } + /* istanbul ignore next - see test/lib/load-all-commands.js */ static get usage () { - return ['[<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]'] + return ['[<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]'] } async completion (opts) { @@ -37,6 +56,10 @@ class Version extends BaseCommand { return this.version(args).then(() => cb()).catch(cb) } + execWorkspaces (args, filters, cb) { + this.versionWorkspaces(args, filters).then(() => cb()).catch(cb) + } + async version (args) { switch (args.length) { case 0: @@ -48,20 +71,42 @@ class Version extends BaseCommand { } } + async versionWorkspaces (args, filters) { + switch (args.length) { + case 0: + return this.listWorkspaces(filters) + case 1: + return this.changeWorkspaces(args, filters) + default: + throw this.usage + } + } + async change (args) { const prefix = this.npm.config.get('tag-version-prefix') - const version = await libversion(args[0], { + const version = await libnpmversion(args[0], { ...this.npm.flatOptions, path: this.npm.prefix, }) return this.npm.output(`${prefix}${version}`) } - async list () { - const results = {} - const { promisify } = require('util') - const { resolve } = require('path') - const readFile = promisify(require('fs').readFile) + async changeWorkspaces (args, filters) { + const prefix = this.npm.config.get('tag-version-prefix') + const workspaces = + await getWorkspaces(filters, { path: this.npm.localPrefix }) + for (const [name, path] of workspaces) { + this.npm.output(name) + const version = await libnpmversion(args[0], { + ...this.npm.flatOptions, + 'git-tag-version': false, + path, + }) + this.npm.output(`${prefix}${version}`) + } + } + + async list (results = {}) { const pj = resolve(this.npm.prefix, 'package.json') const pkg = await readFile(pj, 'utf8') @@ -80,5 +125,22 @@ class Version extends BaseCommand { else this.npm.output(results) } + + async listWorkspaces (filters) { + const results = {} + const workspaces = + await getWorkspaces(filters, { path: this.npm.localPrefix }) + for (const [, path] of workspaces) { + const pj = resolve(path, 'package.json') + // getWorkspaces has already parsed this so we know it won't error + const pkg = await readFile(pj, 'utf8') + .then(data => JSON.parse(data)) + + if (pkg.name && pkg.version) + results[pkg.name] = pkg.version + } + return this.list(results) + } } + module.exports = Version diff --git a/deps/npm/lib/workspaces/get-workspaces.js b/deps/npm/lib/workspaces/get-workspaces.js index 64812d5403576c..91b0074556ae79 100644 --- a/deps/npm/lib/workspaces/get-workspaces.js +++ b/deps/npm/lib/workspaces/get-workspaces.js @@ -3,7 +3,10 @@ const mapWorkspaces = require('@npmcli/map-workspaces') const minimatch = require('minimatch') const rpj = require('read-package-json-fast') +// Returns an Map of paths to workspaces indexed by workspace name +// { foo => '/path/to/foo' } const getWorkspaces = async (filters, { path }) => { + // TODO we need a better error to be bubbled up here if this rpj call fails const pkg = await rpj(resolve(path, 'package.json')) const workspaces = await mapWorkspaces({ cwd: path, pkg }) const res = filters.length ? new Map() : workspaces diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 9daa39292d4fc7..aa7d0e5e527a51 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -5,7 +5,7 @@ .P .RS 2 .nf -npm adduser [\-\-registry=url] [\-\-scope=@orgname] [\-\-always\-auth] [\-\-auth\-type=legacy] +npm adduser [\-\-registry=url] [\-\-scope=@orgname] [\-\-auth\-type=legacy] aliases: login, add\-user .fi @@ -54,24 +54,6 @@ npm adduser \-\-registry=http://myregistry\.example\.com \-\-scope=@myco .P This will set a registry for the given scope and login or create a user for that registry at the same time\. -.SS always\-auth -.P -Default: false -.P -If specified, save configuration indicating that all requests to the given -registry should include authorization information\. Useful for private -registries\. Can be used with \fB\-\-registry\fP and / or \fB\-\-scope\fP, e\.g\. -.P -.RS 2 -.nf -npm adduser \-\-registry=http://private\-registry\.example\.com \-\-always\-auth -.fi -.RE -.P -This will ensure that all requests to that registry (including for tarballs) -include an authorization header\. This setting may be necessary for use with -private registries where metadata and package tarballs are stored on hosts with -different hostnames\. See \fBalways\-auth\fP in npm help \fBconfig\fP for more details on always\-auth\. Registry\-specific configuration of \fBalways\-auth\fP takes precedence over any global configuration\. .SS auth\-type .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 40a4cadbb3951f..9d453b825b9f92 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -13,9 +13,9 @@ aliases: issues .SS Description .P This command tries to guess at the likely location of a package's bug -tracker URL, and then tries to open it using the \fB\-\-browser\fP config param\. -If no package name is provided, it will search for a \fBpackage\.json\fP in the -current folder and use the \fBname\fP property\. +tracker URL or the \fBmailto\fP URL of the support email, and then tries to +open it using the \fB\-\-browser\fP config param\. If no package name is provided, it +will search for a \fBpackage\.json\fP in the current folder and use the \fBname\fP property\. .SS Configuration .SS browser .RS 0 diff --git a/deps/npm/man/man1/npm-exec.1 b/deps/npm/man/man1/npm-exec.1 index 3711534c58e912..1ac663ff18ef50 100644 --- a/deps/npm/man/man1/npm-exec.1 +++ b/deps/npm/man/man1/npm-exec.1 @@ -9,7 +9,7 @@ npm exec \-\- <pkg>[@<version>] [args\.\.\.] npm exec \-\-package=<pkg>[@<version>] \-\- <cmd> [args\.\.\.] npm exec \-c '<cmd> [args\.\.\.]' npm exec \-\-package=foo \-c '<cmd> [args\.\.\.]' -npm exec [\-ws] [\-w <workspace\-name] [args\.\.\.] +npm exec [\-\-ws] [\-w <workspace\-name] [args\.\.\.] npx <pkg>[@<specifier>] [args\.\.\.] npx \-p <pkg>[@<specifier>] <cmd> [args\.\.\.] @@ -205,7 +205,7 @@ workspace folder: .P .RS 2 .nf -npm exec \-ws \-\- eslint \./*\.js +npm exec \-\-ws \-\- eslint \./*\.js .fi .RE .SS Filtering workspaces @@ -317,7 +317,7 @@ children workspaces) .SS workspaces .RS 0 .IP \(bu 2 -Alias: \fB\-ws\fP +Alias: \fB\-\-ws\fP .IP \(bu 2 Type: Boolean .IP \(bu 2 @@ -343,5 +343,7 @@ npm help restart npm help stop .IP \(bu 2 npm help config +.IP \(bu 2 +npm help workspaces .RE diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index b3be3f35e6f6c2..b4b09e598d247b 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -6,8 +6,9 @@ .RS 2 .nf npm init [\-\-force|\-f|\-\-yes|\-y|\-\-scope] -npm init <@scope> (same as `npx <@scope>/create`) -npm init [<@scope>/]<name> (same as `npx [<@scope>/]create\-<name>`) +npm init <@scope> (same as `npm exec <@scope>/create`) +npm init [<@scope>/]<name> (same as `npm exec [<@scope>/]create\-<name>`) +npm init [\-w <dir>] [args\.\.\.] .fi .RE .SS Description @@ -16,25 +17,22 @@ npm init [<@scope>/]<name> (same as `npx [<@scope>/]create\-<name>`) package\. .P \fBinitializer\fP in this case is an npm package named \fBcreate\-<initializer>\fP, -which will be installed by \fBnpx\fP \fIhttps://npm\.im/npx\fR, and then have its +which will be installed by npm help \fBnpm\-exec\fP, and then have its main bin executed \-\- presumably creating or updating \fBpackage\.json\fP and running any other initialization\-related operations\. .P -The init command is transformed to a corresponding \fBnpx\fP operation as +The init command is transformed to a corresponding \fBnpm exec\fP operation as follows: .RS 0 .IP \(bu 2 -\fBnpm init foo\fP \-> \fBnpx create\-foo\fP +\fBnpm init foo\fP \-> \fBnpm exec create\-foo\fP .IP \(bu 2 -\fBnpm init @usr/foo\fP \-> \fBnpx @usr/create\-foo\fP +\fBnpm init @usr/foo\fP \-> \fBnpm exec @usr/create\-foo\fP .IP \(bu 2 -\fBnpm init @usr\fP \-> \fBnpx @usr/create\fP +\fBnpm init @usr\fP \-> \fBnpm exec @usr/create\fP .RE .P -Any additional options will be passed directly to the command, so \fBnpm init -foo \-\- \-\-hello\fP will map to \fBnpx create\-foo \-\-hello\fP\|\. -.P If the initializer is omitted (by just calling \fBnpm init\fP), init will fall back to legacy init behavior\. It will ask you a bunch of questions, and then write a package\.json for you\. It will attempt to make reasonable @@ -42,6 +40,21 @@ guesses based on existing fields, dependencies, and options selected\. It is strictly additive, so it will keep any fields and values that were already set\. You can also use \fB\-y\fP/\fB\-\-yes\fP to skip the questionnaire altogether\. If you pass \fB\-\-scope\fP, it will create a scoped package\. +.SS Forwarding additional options +.P +Any additional options will be passed directly to the command, so \fBnpm init +foo \-\- \-\-hello\fP will map to \fBnpm exec \-\- create\-foo \-\-hello\fP\|\. +.P +To better illustrate how options are forwarded, here's a more evolved +example showing options passed to both the \fBnpm cli\fR and a create package, +both following commands are equivalent: +.RS 0 +.IP \(bu 2 +\fBnpm init foo \-y \-\-registry=<url> \-\- \-\-hello \-a\fP +.IP \(bu 2 +\fBnpm exec \-y \-\-registry=<url> \-\- create\-foo \-\-hello \-a\fP + +.RE .SS Examples .P Create a new React\-based project using @@ -80,6 +93,77 @@ Generate it without having it ask any questions: $ npm init \-y .fi .RE +.SS Workspaces support +.P +It's possible to create a new workspace within your project by using the +\fBworkspace\fP config option\. When using \fBnpm init \-w <dir>\fP the cli will +create the folders and boilerplate expected while also adding a reference +to your project \fBpackage\.json\fP \fB"workspaces": []\fP property in order to make +sure that new generated \fBworkspace\fR is properly set up as such\. +.P +Given a project with no workspaces, e\.g: +.P +.RS 2 +.nf +\|\. ++\-\- package\.json +.fi +.RE +.P +You may generate a new workspace using the legacy init: +.P +.RS 2 +.nf +$ npm init \-w packages/a +.fi +.RE +.P +That will generate a new folder and \fBpackage\.json\fP file, while also updating +your top\-level \fBpackage\.json\fP to add the reference to this new workspace: +.P +.RS 2 +.nf +\|\. ++\-\- package\.json +`\-\- packages + `\-\- a + `\-\- package\.json +.fi +.RE +.P +The workspaces init also supports the \fBnpm init <initializer> \-w <dir>\fP +syntax, following the same set of rules explained earlier in the initial +\fBDescription\fR section of this page\. Similar to the previous example of +creating a new React\-based project using +\fBcreate\-react\-app\fP \fIhttps://npm\.im/create\-react\-app\fR, the following syntax +will make sure to create the new react app as a nested \fBworkspace\fR within your +project and configure your \fBpackage\.json\fP to recognize it as such: +.P +.RS 2 +.nf +npm init \-w packages/my\-react\-app react\-app \. +.fi +.RE +.P +This will make sure to generate your react app as expected, one important +consideration to have in mind is that \fBnpm exec\fP is going to be run in the +context of the newly created folder for that workspace, and that's the reason +why in this example the initializer uses the initializer name followed with a +dot to represent the current directory in that context, e\.g: \fBreact\-app \.\fP: +.P +.RS 2 +.nf +\|\. ++\-\- package\.json +`\-\- packages + +\-\- a + | `\-\- package\.json + `\-\- my\-react\-app + +\-\- README + +\-\- package\.json + `\-\- \.\.\. +.fi +.RE .SS A note on caching .P The npm cli utilizes its internal package cache when using the package @@ -98,6 +182,47 @@ requested from the server\. To force full offline mode, use \fBoffline\fP\|\. .P Forces full offline mode\. Any packages not locally cached will result in an error\. +.SS workspace +.RS 0 +.IP \(bu 2 +Alias: \fB\-w\fP +.IP \(bu 2 +Type: Array +.IP \(bu 2 +Default: \fB[]\fP + +.RE +.P +Enable running \fBnpm init\fP in the context of workspaces, creating any missing +folders, generating files and adding/updating the \fB"workspaces"\fP property of +the project \fBpackage\.json\fP\|\. +.P +the provided names or paths provided\. +.P +Valid values for the \fBworkspace\fP config are either: +.RS 0 +.IP \(bu 2 +Workspace names +.IP \(bu 2 +Path to a workspace directory +.IP \(bu 2 +Path to a parent workspace directory (will result to selecting all of the +children workspaces) + +.RE +.SS workspaces +.RS 0 +.IP \(bu 2 +Alias: \fB\-ws\fP +.IP \(bu 2 +Type: Boolean +.IP \(bu 2 +Default: \fBfalse\fP + +.RE +.P +Run \fBnpm init\fP in the context of all configured workspaces for the +current project\. .SS See Also .RS 0 .IP \(bu 2 @@ -110,5 +235,7 @@ npm help version npm help scope .IP \(bu 2 npm help exec +.IP \(bu 2 +npm help workspaces .RE diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 67cd6f1b1618b1..2d4720ad8a4a97 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@7\.9\.0 /path/to/npm +npm@7\.11\.2 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index b108b5491feedc..53b88e6fab99fd 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -221,7 +221,7 @@ children workspaces) .SS workspaces .RS 0 .IP \(bu 2 -Alias: \fB\-ws\fP +Alias: \fB\-\-ws\fP .IP \(bu 2 Type: Boolean .IP \(bu 2 @@ -245,5 +245,7 @@ npm help restart npm help stop .IP \(bu 2 npm help config +.IP \(bu 2 +npm help workspaces .RE diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 2bfb2556863b96..d926c9e5282eee 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -12,6 +12,73 @@ npm version [<newversion> | major | minor | patch | premajor | preminor | prepat \|'npm ls' to inspect current package/dependency versions .fi .RE +.SS Configuration +.SS \fBallow\-same\-version\fP +.RS 0 +.IP \(bu 2 +Default: \fBfalse\fP +.IP \(bu 2 +Type: Boolean + +.RE +.P +Prevents throwing an error when \fBnpm version\fP is used to set the new version +to the same value as the current version\. +.SS \fBgit\-tag\-version\fP +.RS 0 +.IP \(bu 2 +Default: \fBtrue\fP +.IP \(bu 2 +Type: Boolean + +.RE +.P +Commit and tag the version change\. +.SS \fBcommit\-hooks\fP +.RS 0 +.IP \(bu 2 +Default: \fBtrue\fP +.IP \(bu 2 +Type: Boolean + +.RE +.P +Run git commit hooks when committing the version change\. +.SS \fBsign\-git\-tag\fP +.RS 0 +.IP \(bu 2 +Default: \fBfalse\fP +.IP \(bu 2 +Type: Boolean + +.RE +.P +Pass the \fB\-s\fP flag to git to sign the tag\. +.P +Note that you must have a default GPG key set up in your git config for this to work properly\. +.SS workspaces +.RS 0 +.IP \(bu 2 +Default: \fBfalse\fP +.IP \(bu 2 +Type: Boolean + +.RE +.P +Enables workspaces context and includes workspaces in reported output +when getting versions\. When setting a new version \fIonly the workspaces +will be changed\fR\|\. +.SS workspace +.RS 0 +.IP \(bu 2 +Default: [] +.IP \(bu 2 +Type: Array + +.RE +.P +Enables workspaces context and limits results to only those specified by +this config item\. .SS Description .P Run this in a package directory to bump the version and write the new @@ -99,50 +166,6 @@ Take the following example: This runs all your tests and proceeds only if they pass\. Then runs your \fBbuild\fP script, and adds everything in the \fBdist\fP directory to the commit\. After the commit, it pushes the new commit and tag up to the server, and deletes the \fBbuild/temp\fP directory\. -.SS Configuration -.SS \fBallow\-same\-version\fP -.RS 0 -.IP \(bu 2 -Default: \fBfalse\fP -.IP \(bu 2 -Type: Boolean - -.RE -.P -Prevents throwing an error when \fBnpm version\fP is used to set the new version -to the same value as the current version\. -.SS \fBgit\-tag\-version\fP -.RS 0 -.IP \(bu 2 -Default: \fBtrue\fP -.IP \(bu 2 -Type: Boolean - -.RE -.P -Commit and tag the version change\. -.SS \fBcommit\-hooks\fP -.RS 0 -.IP \(bu 2 -Default: \fBtrue\fP -.IP \(bu 2 -Type: Boolean - -.RE -.P -Run git commit hooks when committing the version change\. -.SS \fBsign\-git\-tag\fP -.RS 0 -.IP \(bu 2 -Default: \fBfalse\fP -.IP \(bu 2 -Type: Boolean - -.RE -.P -Pass the \fB\-s\fP flag to git to sign the tag\. -.P -Note that you must have a default GPG key set up in your git config for this to work properly\. .SS See Also .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 5ecf79851399a9..498821fbb6ba9a 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -111,6 +111,20 @@ this: npm view connect versions .fi .RE +.SS Configuration +.SS json +.P +Show information in JSON format\. See \fBOutput\fP \fI#output\fR below\. +.SS workspaces +.P +Enables workspaces context while searching the \fBpackage\.json\fP in the +current folder\. Information about packages named in each workspace will +be viewed\. +.SS workspace +.P +Enables workspaces context and limits results to only those specified by +this config item\. Only the information about packages named in the +workspaces given here will be viewed\. .SS Output .P If only a single string field for a single version is output, then it diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 94bca15adbf3f8..8dbeca5362bba8 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -10,7 +10,7 @@ npm <command> [args] .RE .SS Version .P -7\.9\.0 +7\.11\.2 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index 9943296b25c353..a882e445ca0031 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -437,6 +437,8 @@ would be the same as this: Please make sure that your file(s) referenced in \fBbin\fP starts with \fB#!/usr/bin/env node\fP, otherwise the scripts are started without the node executable! +.P +Note that you can also set the executable files using directories\.bin \fI#directoriesbin\fR\|\. .SS man .P Specify either a single file or an array of filenames to put in place for diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index 211651fed6412f..522e974fc07089 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -217,17 +217,6 @@ Type: Boolean .P Prevents throwing an error when \fBnpm version\fP is used to set the new version to the same value as the current version\. -.SS \fBalways\-auth\fP -.RS 0 -.IP \(bu 2 -Default: false -.IP \(bu 2 -Type: Boolean - -.RE -.P -Force npm to always require authentication when accessing the registry, even -for \fBGET\fP requests\. .SS \fBaudit\fP .RS 0 .IP \(bu 2 @@ -1455,7 +1444,8 @@ Type: null or String .RE .P -The shell to use for scripts run with the \fBnpm run\fP command\. +The shell to use for scripts run with the \fBnpm exec\fP, \fBnpm run\fP and \fBnpm +init <pkg>\fP commands\. .SS \fBsearchexclude\fP .RS 0 .IP \(bu 2 diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js index a7d20a1f536470..9420bca3c320cd 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js @@ -20,13 +20,21 @@ const levelMap = new Map(levels.reduce((set, level, index) => { }, [])) const { inspect, format } = require('util') +const colors = process.stderr.isTTY +const magenta = colors ? msg => `\x1B[35m${msg}\x1B[39m` : m => m if (loglevel !== 'silent') { process.on('log', (level, ...args) => { if (levelMap.get(level) < levelMap.get(loglevel)) return - const pref = `${process.pid} ${level} ` + const pref = `${process.pid} ${magenta(level)} ` if (level === 'warn' && args[0] === 'ERESOLVE') - args[2] = inspect(args[2], { depth: 10 }) + args[2] = inspect(args[2], { depth: 10, colors }) + else { + args = args.map(a => { + return typeof a === 'string' ? a + : inspect(a, { depth: 10, colors }) + }) + } const msg = pref + format(...args).trim().split('\n').join(`\n${pref}`) console.error(msg) }) diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js index 3b73c0bf6ddd32..e72217c1e4ed9c 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js @@ -1,4 +1,5 @@ const timers = Object.create(null) +const { format } = require('util') process.on('time', name => { if (timers[name]) @@ -6,17 +7,20 @@ process.on('time', name => { timers[name] = process.hrtime() }) +const dim = process.stderr.isTTY ? msg => `\x1B[2m${msg}\x1B[22m` : m => m +const red = process.stderr.isTTY ? msg => `\x1B[31m${msg}\x1B[39m` : m => m process.on('timeEnd', name => { if (!timers[name]) throw new Error('timer not started! ' + name) const res = process.hrtime(timers[name]) delete timers[name] - console.error(`${process.pid} ${name}`, res[0] * 1e3 + res[1] / 1e6) + const msg = format(`${process.pid} ${name}`, res[0] * 1e3 + res[1] / 1e6) + console.error(dim(msg)) }) process.on('exit', () => { for (const name of Object.keys(timers)) { - console.error('Dangling timer: ', name) + console.error(red('Dangling timer:'), name) process.exitCode = 1 } }) diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js b/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js index 7f90f20cf38176..3352802c2de873 100644 --- a/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js +++ b/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js @@ -8,7 +8,8 @@ require('./lib/timers.js') const start = process.hrtime() new Arborist(options).loadVirtual().then(tree => { const end = process.hrtime(start) - print(tree) + if (!options.quiet) + print(tree) if (options.save) tree.meta.save() console.error(`read ${tree.inventory.size} deps in ${end[0] * 1000 + end[1] / 1e6}ms`) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js index f836fc04d8826f..7ee8dae35be1b5 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -47,6 +47,7 @@ const _flagsSuspect = Symbol.for('flagsSuspect') const _workspaces = Symbol.for('workspaces') const _prune = Symbol('prune') const _preferDedupe = Symbol('preferDedupe') +const _pruneDedupable = Symbol('pruneDedupable') const _legacyBundling = Symbol('legacyBundling') const _parseSettings = Symbol('parseSettings') const _initTree = Symbol('initTree') @@ -1188,6 +1189,16 @@ This is a one-time fix-up, please be patient... } } + // There is something present already, and we're not happy about it + // See if the thing we WOULD be happy with is also going to satisfy + // the other dependents on the current node. + const current = edge.to + const dep = await this[_nodeFromEdge](edge, null, null, required) + if (dep.canReplace(current)) { + await this[_nodeFromEdge](edge, node.parent, null, required) + continue + } + // at this point we know that there is a dep there, and // we don't like it. always fail strictly, always allow forcibly or // in non-strict mode if it's not our fault. don't warn here, because @@ -1332,6 +1343,21 @@ This is a one-time fix-up, please be patient... // this is an overridden peer dep this[_warnPeerConflict](edge) } + + // if we get a KEEP in a update scenario, then we MAY have something + // already duplicating this unnecessarily! For example: + // ``` + // root + // +-- x (dep: y@1.x) + // | +-- y@1.0.0 + // +-- y@1.1.0 + // ``` + // Now say we do `reify({update:['y']})`, and the latest version is + // 1.1.0, which we already have in the root. We'll try to place y@1.1.0 + // first in x, then in the root, ending with KEEP, because we already + // have it. In that case, we ought to REMOVE the nm/x/nm/y node, because + // it is an unnecessary duplicate. + this[_pruneDedupable](target, true) return [] } @@ -1387,8 +1413,8 @@ This is a one-time fix-up, please be patient... // MAY end up putting a better/identical node further up the tree in // a way that causes an unnecessary duplication. If so, remove the // now-unnecessary node. - if (edge.valid && edge.to.parent !== target && newDep.canReplace(edge.to)) - edge.to.parent = null + if (edge.valid && edge.to && edge.to !== newDep) + this[_pruneDedupable](edge.to, false) // visit any dependents who are upset by this change // if it's an angry overridden peer edge, however, make sure we @@ -1404,30 +1430,8 @@ This is a one-time fix-up, please be patient... // prune anything deeper in the tree that can be replaced by this if (this.idealTree) { for (const node of this.idealTree.inventory.query('name', newDep.name)) { - if (node !== newDep && - node.isDescendantOf(target) && - !node.inShrinkwrap && - !node.inBundle && - node.canReplaceWith(newDep)) { - // don't prune if the dupe is necessary! - // root (a, d) - // +-- a (b, c2) - // | +-- b (c2) <-- place c2 for b, lands at root - // +-- d (e) - // +-- e (c1, d) - // +-- c1 - // +-- f (c2) - // +-- c2 <-- pruning this would be bad - - const mask = node.parent !== target && - node.parent && - node.parent.parent && - node.parent.parent !== target && - node.parent.parent.resolve(newDep.name) - - if (!mask || mask === newDep || node.canReplaceWith(mask)) - node.parent = null - } + if (node.isDescendantOf(target)) + this[_pruneDedupable](node, false) } } @@ -1460,6 +1464,21 @@ This is a one-time fix-up, please be patient... return placed } + // prune all the nodes in a branch of the tree that can be safely removed + // This is only the most basic duplication detection; it finds if there + // is another satisfying node further up the tree, and if so, dedupes. + // Even in legacyBundling mode, we do this amount of deduplication. + [_pruneDedupable] (node, descend = true) { + if (node.canDedupe(this[_preferDedupe])) { + node.root = null + return + } + if (descend) { + for (const child of node.children.values()) + this[_pruneDedupable](child) + } + } + [_pruneForReplacement] (node, oldDeps) { // gather up all the invalid edgesOut, and any now-extraneous // deps that the new node doesn't depend on but the old one did. @@ -1612,32 +1631,137 @@ This is a one-time fix-up, please be patient... // placed here as well. the virtualRoot already has the appropriate // overrides applied. if (peerEntryEdge) { - const peerSet = getPeerSet(current) - OUTER: for (const p of peerSet) { - // if any have a non-peer dep from the target, or a peer dep if - // the target is root, then cannot safely replace and dupe deeper. + const currentPeerSet = getPeerSet(current) + + // We are effectively replacing currentPeerSet with newPeerSet + // If there are any non-peer deps coming into the currentPeerSet, + // which are currently valid, and are from the target, then that + // means that we have to ensure that they're not going to be made + // invalid by putting the newPeerSet in place. + // If the edge comes from somewhere deeper than the target, then + // that's fine, because we'll create an invalid edge, detect it, + // and duplicate the node further into the tree. + // loop through the currentPeerSet checking for valid edges on + // the members of the peer set which will be made invalid. + const targetEdges = new Set() + for (const p of currentPeerSet) { for (const edge of p.edgesIn) { - if (peerSet.has(edge.from)) + // edge from within the peerSet, ignore + if (currentPeerSet.has(edge.from)) continue + // only care about valid edges from target. + // edges from elsewhere can dupe if offended, invalid edges + // are already being fixed or will be later. + if (edge.from !== target || !edge.valid) + continue + targetEdges.add(edge) + } + } - // only respect valid edges, however, since we're likely trying - // to fix the very one that's currently broken! If the virtual - // root's replacement is ok, and doesn't have any invalid edges - // indicating that it was an overridden peer, then ignore the - // conflict and continue. If it WAS an override, then we need - // to get the conflict here so that we can decide whether to - // accept the current dep node, clobber it, or fail the install. - if (edge.from === target && edge.valid) { - const rep = dep.parent.children.get(edge.name) - const override = rep && ([...rep.edgesIn].some(e => !e.valid)) - if (!rep || !rep.satisfies(edge) || override) { + for (const edge of targetEdges) { + // see if we intend to replace this one anyway + const rep = dep.parent.children.get(edge.name) + const current = edge.to + if (!rep) { + // this isn't one we're replacing. but it WAS included in the + // peerSet for some reason, so make sure that it's still + // ok with the replacements in the new peerSet + for (const curEdge of current.edgesOut.values()) { + const newRepDep = dep.parent.children.get(curEdge.name) + if (curEdge.valid && newRepDep && !newRepDep.satisfies(curEdge)) { canReplace = false - break OUTER + break } } + continue + } + + // was this replacement already an override of some sort? + const override = [...rep.edgesIn].some(e => !e.valid) + // if we have a rep, and it's ok to put in this location, and + // it's not already part of an override in the peerSet, then + // we can continue with it. + if (rep.satisfies(edge) && !override) + continue + // Otherwise, we cannot replace. + canReplace = false + break + } + // if we're going to be replacing the peerSet, we have to remove + // and re-resolve any members of the old peerSet that are not + // present in the new one, and which will have invalid edges. + // We know that they're not depended upon by the target, or else + // they would have caused a conflict, so they'll get landed deeper + // in the tree, if possible. + if (canReplace) { + let needNesting = false + OUTER: for (const node of currentPeerSet) { + const rep = dep.parent.children.get(node.name) + // has a replacement, already addressed above + if (rep) + continue + + // ok, it has been placed here to dedupe, see if it needs to go + // back deeper within the tree. + for (const edge of node.edgesOut.values()) { + const repDep = dep.parent.children.get(edge.name) + // not in new peerSet, maybe fine. + if (!repDep) + continue + + // new thing will be fine, no worries + if (repDep.satisfies(edge)) + continue + + // uhoh, we'll have to nest them. + needNesting = true + break OUTER + } + } + + // to nest, just delete everything without a target dep + // that's in the current peerSet, and add their dependants + // to the _depsQueue for evaluation. Some of these MAY end + // up in the same location again, and that's fine. + if (needNesting) { + // avoid mutating the tree while we're examining it + const dependants = new Set() + const reresolve = new Set() + OUTER: for (const node of currentPeerSet) { + const rep = dep.parent.children.get(node.name) + if (rep) + continue + // create a separate set for each one, so we can skip any + // that might somehow have an incoming target edge + const deps = new Set() + for (const edge of node.edgesIn) { + // a target dep, skip this dep entirely, already addressed + // ignoring for coverage, because it really ought to be + // impossible, but I can't prove it yet, so this is here + // for safety. + /* istanbul ignore if - should be impossible */ + if (edge.from === target) + continue OUTER + // ignore this edge, it'll either be replaced or re-resolved + if (currentPeerSet.has(edge.from)) + continue + // ok, we care about this one. + deps.add(edge.from) + } + reresolve.add(node) + for (const d of deps) + dependants.add(d) + } + for (const dependant of dependants) { + this[_depsQueue].push(dependant) + this[_depsSeen].delete(dependant) + } + for (const node of reresolve) + node.root = null } } } + if (canReplace) { const ret = this[_canPlacePeers](dep, target, edge, REPLACE, peerEntryEdge, peerPath, isSource) /* istanbul ignore else - extremely rare that the peer set would diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js index 09a6f700547f21..93b9aa38298208 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js @@ -54,7 +54,7 @@ class Arborist extends Base { ...options, path: options.path || '.', cache: options.cache || `${homedir()}/.npm/_cacache`, - packumentCache: new Map(), + packumentCache: options.packumentCache || new Map(), log: options.log || procLog, } this.cache = resolve(this.options.cache) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js index 3a38905b77433d..2a222249d7a482 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js @@ -93,7 +93,8 @@ module.exports = cls => class VirtualLoader extends cls { this.virtualTree = root const {links, nodes} = this[resolveNodes](s, root) await this[resolveLinks](links, nodes) - this[assignBundles](nodes) + if (!(s.originalLockfileVersion >= 2)) + this[assignBundles](nodes) if (this[flagsSuspect]) this[reCalcDepFlags](nodes.values()) return root @@ -220,22 +221,24 @@ module.exports = cls => class VirtualLoader extends cls { [assignBundles] (nodes) { for (const [location, node] of nodes) { // Skip assignment of parentage for the root package - if (!location) + if (!location || node.target && !node.target.location) continue const { name, parent, package: { inBundle }} = node + if (!parent) continue // read inBundle from package because 'package' here is // actually a v2 lockfile metadata entry. - // If the *parent* is also bundled, though, then we assume - // that it's being pulled in just by virtue of that. + // If the *parent* is also bundled, though, or if the parent has + // no dependency on it, then we assume that it's being pulled in + // just by virtue of its parent or a transitive dep being bundled. const { package: ppkg } = parent const { inBundle: parentBundled } = ppkg - if (inBundle && !parentBundled) { + if (inBundle && !parentBundled && parent.edgesOut.has(node.name)) { if (!ppkg.bundleDependencies) ppkg.bundleDependencies = [name] - else if (!ppkg.bundleDependencies.includes(name)) + else ppkg.bundleDependencies.push(name) } } diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js index 9c52d009d6fd8d..390d3ce42aecd2 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js @@ -115,10 +115,6 @@ module.exports = cls => class Builder extends cls { await this[_runScripts]('preinstall') if (this[_binLinks] && type !== 'links') await this[_linkAllBins]() - if (!this[_ignoreScripts]) { - await this[_runScripts]('install') - await this[_runScripts]('postinstall') - } // links should also run prepare scripts and only link bins after that if (type === 'links') { @@ -128,6 +124,11 @@ module.exports = cls => class Builder extends cls { await this[_linkAllBins]() } + if (!this[_ignoreScripts]) { + await this[_runScripts]('install') + await this[_runScripts]('postinstall') + } + process.emit('timeEnd', `build:${type}`) } diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js index aaaa3d61c862b9..64f08756263c72 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -49,7 +49,8 @@ const _loadTrees = Symbol.for('loadTrees') const _diffTrees = Symbol.for('diffTrees') const _createSparseTree = Symbol.for('createSparseTree') const _loadShrinkwrapsAndUpdateTrees = Symbol.for('loadShrinkwrapsAndUpdateTrees') -const _shrinkwrapUnpacked = Symbol('shrinkwrapUnpacked') +const _shrinkwrapInflated = Symbol('shrinkwrapInflated') +const _bundleUnpacked = Symbol('bundleUnpacked') const _reifyNode = Symbol.for('reifyNode') const _extractOrLink = Symbol('extractOrLink') // defined by rebuild mixin @@ -108,7 +109,7 @@ module.exports = cls => class Reifier extends cls { this.diff = null this[_retiredPaths] = {} - this[_shrinkwrapUnpacked] = new Set() + this[_shrinkwrapInflated] = new Set() this[_retiredUnchanged] = {} this[_sparseTreeDirs] = new Set() this[_sparseTreeRoots] = new Set() @@ -316,6 +317,7 @@ module.exports = cls => class Reifier extends cls { // find all the nodes that need to change between the actual // and ideal trees. this.diff = Diff.calculate({ + shrinkwrapInflated: this[_shrinkwrapInflated], filterNodes, actual: this.actualTree, ideal: this.idealTree, @@ -423,7 +425,8 @@ module.exports = cls => class Reifier extends cls { const dirs = this.diff.leaves .filter(diff => { return (diff.action === 'ADD' || diff.action === 'CHANGE') && - !this[_sparseTreeDirs].has(diff.ideal.path) + !this[_sparseTreeDirs].has(diff.ideal.path) && + !diff.ideal.isLink }) .map(diff => diff.ideal.path) @@ -457,9 +460,9 @@ module.exports = cls => class Reifier extends cls { // we need to unpack them, read that shrinkwrap file, and then update // the tree by calling loadVirtual with the node as the root. [_loadShrinkwrapsAndUpdateTrees] () { - const seen = this[_shrinkwrapUnpacked] + const seen = this[_shrinkwrapInflated] const shrinkwraps = this.diff.leaves - .filter(d => (d.action === 'CHANGE' || d.action === 'ADD') && + .filter(d => (d.action === 'CHANGE' || d.action === 'ADD' || !d.action) && d.ideal.hasShrinkwrap && !seen.has(d.ideal) && !this[_trashList].has(d.ideal.path)) @@ -472,7 +475,7 @@ module.exports = cls => class Reifier extends cls { return promiseAllRejectLate(shrinkwraps.map(diff => { const node = diff.ideal seen.add(node) - return this[_reifyNode](node) + return diff.action ? this[_reifyNode](node) : node })) .then(nodes => promiseAllRejectLate(nodes.map(node => new Arborist({ ...this.options, @@ -503,7 +506,7 @@ module.exports = cls => class Reifier extends cls { const { npmVersion, nodeVersion } = this.options const p = Promise.resolve() - .then(() => { + .then(async () => { // when we reify an optional node, check the engine and platform // first. be sure to ignore the --force and --engine-strict flags, // since we always want to skip any optional packages we can't install. @@ -513,11 +516,11 @@ module.exports = cls => class Reifier extends cls { checkEngine(node.package, npmVersion, nodeVersion, false) checkPlatform(node.package, false) } + await this[_checkBins](node) + await this[_extractOrLink](node) + await this[_warnDeprecated](node) + await this[_loadAncientPackageDetails](node) }) - .then(() => this[_checkBins](node)) - .then(() => this[_extractOrLink](node)) - .then(() => this[_warnDeprecated](node)) - .then(() => this[_loadAncientPackageDetails](node)) return this[_handleOptionalFailure](node, p) .then(() => { @@ -563,10 +566,11 @@ module.exports = cls => class Reifier extends cls { }) } - [_symlink] (node) { + async [_symlink] (node) { const dir = dirname(node.path) const target = node.realpath const rel = relative(dir, target) + await mkdirp(dir) return symlink(rel, node.path, 'junction') } @@ -633,8 +637,10 @@ module.exports = cls => class Reifier extends cls { [_loadBundlesAndUpdateTrees] ( depth = 0, bundlesByDepth = this[_getBundlesByDepth]() ) { - if (depth === 0) + if (depth === 0) { + this[_bundleUnpacked] = new Set() process.emit('time', 'reify:loadBundles') + } const maxBundleDepth = bundlesByDepth.get('maxBundleDepth') if (depth > maxBundleDepth) { // if we did something, then prune the tree and update the diffs @@ -650,13 +656,17 @@ module.exports = cls => class Reifier extends cls { // shallower bundle overwriting them with a bundled meta-dep. const set = (bundlesByDepth.get(depth) || []) .filter(node => node.root === this.idealTree && + node.target !== node.root && !this[_trashList].has(node.path)) if (!set.length) return this[_loadBundlesAndUpdateTrees](depth + 1, bundlesByDepth) // extract all the nodes with bundles - return promiseAllRejectLate(set.map(node => this[_reifyNode](node))) + return promiseAllRejectLate(set.map(node => { + this[_bundleUnpacked].add(node) + return this[_reifyNode](node) + })) // then load their unpacked children and move into the ideal tree .then(nodes => promiseAllRejectLate(nodes.map(node => new this.constructor({ @@ -678,8 +688,13 @@ module.exports = cls => class Reifier extends cls { tree: this.diff, visit: diff => { const node = diff.ideal - if (node && !node.isProjectRoot && node.package.bundleDependencies && - node.package.bundleDependencies.length) { + if (!node) + return + if (node.isProjectRoot || (node.target && node.target.isProjectRoot)) + return + + const { bundleDependencies } = node.package + if (bundleDependencies && bundleDependencies.length) { maxBundleDepth = Math.max(maxBundleDepth, node.depth) if (!bundlesByDepth.has(node.depth)) bundlesByDepth.set(node.depth, [node]) @@ -784,14 +799,14 @@ module.exports = cls => class Reifier extends cls { return const node = diff.ideal - const bd = node.package.bundleDependencies - const sw = this[_shrinkwrapUnpacked].has(node) + const bd = this[_bundleUnpacked].has(node) + const sw = this[_shrinkwrapInflated].has(node) // check whether we still need to unpack this one. // test the inDepBundle last, since that's potentially a tree walk. const doUnpack = node && // can't unpack if removed! !node.isRoot && // root node already exists - !(bd && bd.length) && // already unpacked to read bundle + !bd && // already unpacked to read bundle !sw && // already unpacked to read sw !node.inDepBundle // already unpacked by another dep's bundle diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/debug.js b/deps/npm/node_modules/@npmcli/arborist/lib/debug.js index 5acacee69e2232..aeda7229d5e8cb 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/debug.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/debug.js @@ -12,6 +12,7 @@ // run in debug mode if explicitly requested, running arborist tests, // or working in the arborist project directory. + const debug = process.env.ARBORIST_DEBUG !== '0' && ( process.env.ARBORIST_DEBUG === '1' || /\barborist\b/.test(process.env.NODE_DEBUG || '') || @@ -21,4 +22,10 @@ const debug = process.env.ARBORIST_DEBUG !== '0' && ( ) module.exports = debug ? fn => fn() : () => {} -module.exports.log = (...msg) => module.exports(() => console.error(...msg)) +const red = process.stderr.isTTY ? msg => `\x1B[31m${msg}\x1B[39m` : m => m +module.exports.log = (...msg) => module.exports(() => { + const { format } = require('util') + const prefix = `\n${process.pid} ${red(format(msg.shift()))} ` + msg = (prefix + format(...msg).trim().split('\n').join(prefix)).trim() + console.error(msg) +}) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/diff.js b/deps/npm/node_modules/@npmcli/arborist/lib/diff.js index 84a8bae412f54d..ff58ea76ee7849 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/diff.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/diff.js @@ -11,8 +11,9 @@ const {existsSync} = require('fs') const ssri = require('ssri') class Diff { - constructor ({actual, ideal, filterSet}) { + constructor ({actual, ideal, filterSet, shrinkwrapInflated}) { this.filterSet = filterSet + this.shrinkwrapInflated = shrinkwrapInflated this.children = [] this.actual = actual this.ideal = ideal @@ -30,7 +31,7 @@ class Diff { this.removed = [] } - static calculate ({actual, ideal, filterNodes = []}) { + static calculate ({actual, ideal, filterNodes = [], shrinkwrapInflated = new Set()}) { // if there's a filterNode, then: // - get the path from the root to the filterNode. The root or // root.target should have an edge either to the filterNode or @@ -77,7 +78,7 @@ class Diff { } return depth({ - tree: new Diff({actual, ideal, filterSet}), + tree: new Diff({actual, ideal, filterSet, shrinkwrapInflated}), getChildren, leave, }) @@ -135,7 +136,7 @@ const allChildren = node => { // to create the diff tree const getChildren = diff => { const children = [] - const {actual, ideal, unchanged, removed, filterSet} = diff + const {actual, ideal, unchanged, removed, filterSet, shrinkwrapInflated} = diff // Note: we DON'T diff fsChildren themselves, because they are either // included in the package contents, or part of some other project, and @@ -144,11 +145,20 @@ const getChildren = diff => { // responsible for installing. const actualKids = allChildren(actual) const idealKids = allChildren(ideal) + + if (ideal && ideal.hasShrinkwrap && !shrinkwrapInflated.has(ideal)) { + // Guaranteed to get a diff.leaves here, because we always + // be called with a proper Diff object when ideal has a shrinkwrap + // that has not been inflated. + diff.leaves.push(diff) + return children + } + const paths = new Set([...actualKids.keys(), ...idealKids.keys()]) for (const path of paths) { const actual = actualKids.get(path) const ideal = idealKids.get(path) - diffNode(actual, ideal, children, unchanged, removed, filterSet) + diffNode(actual, ideal, children, unchanged, removed, filterSet, shrinkwrapInflated) } if (diff.leaves && !children.length) @@ -157,7 +167,7 @@ const getChildren = diff => { return children } -const diffNode = (actual, ideal, children, unchanged, removed, filterSet) => { +const diffNode = (actual, ideal, children, unchanged, removed, filterSet, shrinkwrapInflated) => { if (filterSet.size && !(filterSet.has(ideal) || filterSet.has(actual))) return @@ -165,10 +175,10 @@ const diffNode = (actual, ideal, children, unchanged, removed, filterSet) => { // if it's a match, then get its children // otherwise, this is the child diff node - if (action) { + if (action || (!shrinkwrapInflated.has(ideal) && ideal.hasShrinkwrap)) { if (action === 'REMOVE') removed.push(actual) - children.push(new Diff({actual, ideal, filterSet})) + children.push(new Diff({actual, ideal, filterSet, shrinkwrapInflated})) } else { unchanged.push(ideal) // !*! Weird dirty hack warning !*! @@ -199,7 +209,7 @@ const diffNode = (actual, ideal, children, unchanged, removed, filterSet) => { for (const node of bundledChildren) node.parent = ideal } - children.push(...getChildren({actual, ideal, unchanged, removed, filterSet})) + children.push(...getChildren({actual, ideal, unchanged, removed, filterSet, shrinkwrapInflated})) } } diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/index.js index fd7d8817258ed6..c7b07ce28e4df0 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/index.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/index.js @@ -3,5 +3,6 @@ module.exports.Arborist = module.exports module.exports.Node = require('./node.js') module.exports.Link = require('./link.js') module.exports.Edge = require('./edge.js') +module.exports.Shrinkwrap = require('./shrinkwrap.js') // XXX export the other classes, too. shrinkwrap, diff, etc. // they're handy! diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/node.js b/deps/npm/node_modules/@npmcli/arborist/lib/node.js index 197804e0ce0e3f..a54f76afcdf3b3 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/node.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/node.js @@ -28,6 +28,7 @@ // where we need to quickly find all instances of a given package name within a // tree. +const semver = require('semver') const nameFromFolder = require('@npmcli/name-from-folder') const Edge = require('./edge.js') const Inventory = require('./inventory.js') @@ -885,6 +886,43 @@ class Node { return node.canReplaceWith(this) } + // return true if it's safe to remove this node, because anything that + // is depending on it would be fine with the thing that they would resolve + // to if it was removed, or nothing is depending on it in the first place. + canDedupe (preferDedupe = false) { + // not allowed to mess with shrinkwraps or bundles + if (this.inDepBundle || this.inShrinkwrap) + return false + + // it's a top level pkg, or a dep of one + if (!this.parent || !this.parent.parent) + return false + + // no one wants it, remove it + if (this.edgesIn.size === 0) + return true + + const other = this.parent.parent.resolve(this.name) + + // nothing else, need this one + if (!other) + return false + + // if it's the same thing, then always fine to remove + if (other.matches(this)) + return true + + // if the other thing can't replace this, then skip it + if (!other.canReplace(this)) + return false + + // if we prefer dedupe, or if the version is greater/equal, take the other + if (preferDedupe || semver.gte(other.version, this.version)) + return true + + return false + } + satisfies (requested) { if (requested instanceof Edge) return this.name === requested.name && requested.satisfiedBy(this) diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/printable.js b/deps/npm/node_modules/@npmcli/arborist/lib/printable.js index 169984fcf17ea1..79f46a9e93c4a6 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/printable.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/printable.js @@ -29,6 +29,15 @@ class ArboristNode { this.peer = true if (tree.inBundle) this.bundled = true + if (tree.inDepBundle) + this.bundler = tree.getBundler().location + const bd = tree.package && tree.package.bundleDependencies + if (bd && bd.length) + this.bundleDependencies = bd + if (tree.inShrinkwrap) + this.inShrinkwrap = true + else if (tree.hasShrinkwrap) + this.hasShrinkwrap = true if (tree.error) this.error = treeError(tree.error) if (tree.errors && tree.errors.length) diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index d08102ce0cf12d..e7ac932e08d8f3 100644 --- a/deps/npm/node_modules/@npmcli/arborist/package.json +++ b/deps/npm/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "2.3.0", + "version": "2.4.1", "description": "Manage node_modules trees", "dependencies": { "@npmcli/installed-package-contents": "^1.0.7", @@ -19,7 +19,7 @@ "npm-install-checks": "^4.0.0", "npm-package-arg": "^8.1.0", "npm-pick-manifest": "^6.1.0", - "npm-registry-fetch": "^9.0.0", + "npm-registry-fetch": "^10.0.0", "pacote": "^11.2.6", "parse-conflict-json": "^1.1.1", "promise-all-reject-late": "^1.0.0", @@ -41,8 +41,7 @@ "eslint-plugin-standard": "^4.0.1", "minify-registry-metadata": "^2.1.0", "mutate-fs": "^2.1.1", - "require-inject": "^1.4.4", - "tap": "^14.11.0", + "tap": "^15.0.4", "tcompare": "^3.0.4" }, "scripts": { @@ -76,10 +75,8 @@ "arborist": "bin/index.js" }, "tap": { - "100": true, "after": "test/fixtures/cleanup.js", "coverage-map": "map.js", - "esm": false, "test-env": [ "NODE_OPTIONS=--no-warnings" ], @@ -87,6 +84,6 @@ "--no-warnings", "--no-deprecation" ], - "timeout": "120" + "timeout": "240" } } diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js index 21a37ded48e7c3..f947896f0ba348 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/index.js +++ b/deps/npm/node_modules/@npmcli/config/lib/index.js @@ -197,11 +197,6 @@ class Config { throw new Error('call config.load() before setting values') if (!confTypes.has(where)) throw new Error('invalid config location param: ' + where) - if (key === '_auth') { - const { email } = this.getCredentialsByURI(this.get('registry')) - if (!email) - throw new Error('Cannot set _auth without first setting email') - } this[_checkDeprecated](key) const { data } = this.data.get(where) data[key] = val @@ -282,6 +277,14 @@ class Config { // symbols, as that module also does a bunch of get operations this[_loaded] = true + process.emit('time', 'config:load:credentials') + const reg = this.get('registry') + const creds = this.getCredentialsByURI(reg) + // ignore this error because a failed set will strip out anything that + // might be a security hazard, which was the intention. + try { this.setCredentialsByURI(reg, creds) } catch (_) {} + process.emit('timeEnd', 'config:load:credentials') + // set proper globalPrefix now that everything is loaded this.globalPrefix = this.get('prefix') @@ -588,14 +591,17 @@ class Config { const nerfed = nerfDart(uri) const def = nerfDart(this.get('registry')) if (def === nerfed) { + // do not delete email, that shouldn't be nerfed any more. + // just delete the nerfed copy, if one exists. this.delete(`-authtoken`, 'user') this.delete(`_authToken`, 'user') + this.delete(`_authtoken`, 'user') this.delete(`_auth`, 'user') this.delete(`_password`, 'user') this.delete(`username`, 'user') - this.delete(`email`, 'user') } this.delete(`${nerfed}:-authtoken`, 'user') + this.delete(`${nerfed}:_authtoken`, 'user') this.delete(`${nerfed}:_authToken`, 'user') this.delete(`${nerfed}:_auth`, 'user') this.delete(`${nerfed}:_password`, 'user') @@ -603,7 +609,7 @@ class Config { this.delete(`${nerfed}:email`, 'user') } - setCredentialsByURI (uri, { token, username, password, email, alwaysAuth }) { + setCredentialsByURI (uri, { token, username, password, email }) { const nerfed = nerfDart(uri) const def = nerfDart(this.get('registry')) @@ -611,41 +617,45 @@ class Config { // remove old style auth info not limited to a single registry this.delete('_password', 'user') this.delete('username', 'user') - this.delete('email', 'user') this.delete('_auth', 'user') this.delete('_authtoken', 'user') + this.delete('-authtoken', 'user') this.delete('_authToken', 'user') } - this.delete(`${nerfed}:-authtoken`) + // email used to be nerfed always. if we're using the default + // registry, de-nerf it. + if (nerfed === def) { + email = email || + this.get('email', 'user') || + this.get(`${nerfed}:email`, 'user') + if (email) + this.set('email', email, 'user') + } + + // field that hasn't been used as documented for a LONG time, + // and as of npm 7.10.0, isn't used at all. We just always + // send auth if we have it, only to the URIs under the nerf dart. + this.delete(`${nerfed}:always-auth`, 'user') + + this.delete(`${nerfed}:-authtoken`, 'user') + this.delete(`${nerfed}:_authtoken`, 'user') + this.delete(`${nerfed}:email`, 'user') if (token) { this.set(`${nerfed}:_authToken`, token, 'user') this.delete(`${nerfed}:_password`, 'user') this.delete(`${nerfed}:username`, 'user') - this.delete(`${nerfed}:email`, 'user') - this.delete(`${nerfed}:always-auth`, 'user') - } else if (username || password || email) { - if (username || password) { - if (!username) - throw new Error('must include username') - if (!password) - throw new Error('must include password') - } - if (!email) - throw new Error('must include email') + } else if (username || password) { + if (!username) + throw new Error('must include username') + if (!password) + throw new Error('must include password') this.delete(`${nerfed}:_authToken`, 'user') - if (username || password) { - this.set(`${nerfed}:username`, username, 'user') - // note: not encrypted, no idea why we bothered to do this, but oh well - // protects against shoulder-hacks if password is memorable, I guess? - const encoded = Buffer.from(password, 'utf8').toString('base64') - this.set(`${nerfed}:_password`, encoded, 'user') - } - this.set(`${nerfed}:email`, email, 'user') - if (alwaysAuth !== undefined) - this.set(`${nerfed}:always-auth`, alwaysAuth, 'user') - else - this.delete(`${nerfed}:always-auth`, 'user') + this.set(`${nerfed}:username`, username, 'user') + // note: not encrypted, no idea why we bothered to do this, but oh well + // protects against shoulder-hacks if password is memorable, I guess? + const encoded = Buffer.from(password, 'utf8').toString('base64') + this.set(`${nerfed}:_password`, encoded, 'user') } else { throw new Error('No credentials to set.') } @@ -656,18 +666,12 @@ class Config { const nerfed = nerfDart(uri) const creds = {} - // you can set always-auth for a single registry, or as a default - const alwaysAuthReg = this.get(`${nerfed}:always-auth`) - if (alwaysAuthReg !== undefined) - creds.alwaysAuth = !!alwaysAuthReg - else - creds.alwaysAuth = this.get('always-auth') - const email = this.get(`${nerfed}:email`) || this.get('email') if (email) creds.email = email const tokenReg = this.get(`${nerfed}:_authToken`) || + this.get(`${nerfed}:_authtoken`) || this.get(`${nerfed}:-authtoken`) || nerfed === nerfDart(this.get('registry')) && this.get('_authToken') @@ -686,6 +690,16 @@ class Config { return creds } + const authReg = this.get(`${nerfed}:_auth`) + if (authReg) { + const authDecode = Buffer.from(authReg, 'base64').toString('utf8') + const authSplit = authDecode.split(':') + creds.username = authSplit.shift() + creds.password = authSplit.join(':') + creds.auth = authReg + return creds + } + // at this point, we can only use the values if the URI is the // default registry. const defaultNerf = nerfDart(this.get('registry')) diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json index 767718a9d61c75..f80669640ebd4e 100644 --- a/deps/npm/node_modules/@npmcli/config/package.json +++ b/deps/npm/node_modules/@npmcli/config/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/config", - "version": "2.1.0", + "version": "2.2.0", "files": [ "lib" ], @@ -24,7 +24,7 @@ "coverage-map": "map.js" }, "devDependencies": { - "tap": "^14.10.8" + "tap": "^15.0.4" }, "dependencies": { "ini": "^2.0.0", diff --git a/deps/npm/node_modules/@npmcli/git/lib/clone.js b/deps/npm/node_modules/@npmcli/git/lib/clone.js index 3c50a05cf1aec1..1fea5acc846211 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/clone.js +++ b/deps/npm/node_modules/@npmcli/git/lib/clone.js @@ -15,16 +15,18 @@ const shallowHosts = new Set([ 'gist.github.com', 'gitlab.com', 'bitbucket.com', - 'bitbucket.org', + 'bitbucket.org' ]) -const { parse } = require('url') +// we have to use url.parse until we add the same shim that hosted-git-info has +// to handle scp:// urls +const { parse } = require('url') // eslint-disable-line node/no-deprecated-api const { basename, resolve } = require('path') const revs = require('./revs.js') const spawn = require('./spawn.js') +const { isWindows } = require('./utils.js') const pickManifest = require('npm-pick-manifest') -const { promisify } = require('util') const fs = require('fs') const mkdirp = require('mkdirp') @@ -38,38 +40,56 @@ module.exports = (repo, ref = 'HEAD', target = null, /* istanbul ignore next */ opts )) -const maybeShallow = (repo, opts) => - opts.gitShallow === false || opts.gitShallow ? opts.gitShallow - : shallowHosts.has(parse(repo).host) - -const isWindows = opts => (opts.fakePlatform || process.platform) === 'win32' +const maybeShallow = (repo, opts) => { + if (opts.gitShallow === false || opts.gitShallow) { + return opts.gitShallow + } + return shallowHosts.has(parse(repo).host) +} const defaultTarget = (repo, /* istanbul ignore next */ cwd = process.cwd()) => - resolve(cwd, basename(repo.replace(/[\/\\]?\.git$/, ''))) - -const clone = (repo, revs, ref, revDoc, target, opts) => - !revDoc ? unresolved(repo, ref, target, opts) - : revDoc.sha === revs.refs.HEAD.sha ? plain(repo, revDoc, target, opts) - : revDoc.type === 'tag' || revDoc.type === 'branch' - ? branch(repo, revDoc, target, opts) - : other(repo, revDoc, target, opts) + resolve(cwd, basename(repo.replace(/[/\\]?\.git$/, ''))) + +const clone = (repo, revs, ref, revDoc, target, opts) => { + if (!revDoc) { + return unresolved(repo, ref, target, opts) + } + if (revDoc.sha === revs.refs.HEAD.sha) { + return plain(repo, revDoc, target, opts) + } + if (revDoc.type === 'tag' || revDoc.type === 'branch') { + return branch(repo, revDoc, target, opts) + } + return other(repo, revDoc, target, opts) +} const resolveRef = (revs, ref, opts) => { const { spec = {} } = opts ref = spec.gitCommittish || ref - return !revs ? /* istanbul ignore next - will fail anyway, can't pull */ null - : spec.gitRange ? pickManifest(revs, spec.gitRange, opts) - : !ref ? revs.refs.HEAD - : revs.refs[ref] ? revs.refs[ref] - : revs.shas[ref] ? revs.refs[revs.shas[ref][0]] - : null + /* istanbul ignore next - will fail anyway, can't pull */ + if (!revs) { + return null + } + if (spec.gitRange) { + return pickManifest(revs, spec.gitRange, opts) + } + if (!ref) { + return revs.refs.HEAD + } + if (revs.refs[ref]) { + return revs.refs[ref] + } + if (revs.shas[ref]) { + return revs.refs[revs.shas[ref][0]] + } + return null } // pull request or some other kind of advertised ref const other = (repo, revDoc, target, opts) => { const shallow = maybeShallow(repo, opts) - const fetchOrigin = [ 'fetch', 'origin', revDoc.rawRef ] + const fetchOrigin = ['fetch', 'origin', revDoc.rawRef] .concat(shallow ? ['--depth=1'] : []) const git = (args) => spawn(args, { ...opts, cwd: target }) @@ -93,12 +113,10 @@ const branch = (repo, revDoc, target, opts) => { revDoc.ref, repo, target, - '--recurse-submodules', + '--recurse-submodules' ] - if (maybeShallow(repo, opts)) - args.push('--depth=1') - if (isWindows(opts)) - args.push('--config', 'core.longpaths=true') + if (maybeShallow(repo, opts)) { args.push('--depth=1') } + if (isWindows(opts)) { args.push('--config', 'core.longpaths=true') } return spawn(args, opts).then(() => revDoc.sha) } @@ -110,22 +128,24 @@ const plain = (repo, revDoc, target, opts) => { target, '--recurse-submodules' ] - if (maybeShallow(repo, opts)) - args.push('--depth=1') - if (isWindows(opts)) - args.push('--config', 'core.longpaths=true') + if (maybeShallow(repo, opts)) { args.push('--depth=1') } + if (isWindows(opts)) { args.push('--config', 'core.longpaths=true') } return spawn(args, opts).then(() => revDoc.sha) } -const updateSubmodules = (target, opts) => new Promise(res => - fs.stat(target + '/.gitmodules', er => res(er ? null - : spawn([ +const updateSubmodules = (target, opts) => new Promise(resolve => + fs.stat(target + '/.gitmodules', er => { + if (er) { + return resolve(null) + } + return resolve(spawn([ 'submodule', 'update', '-q', '--init', '--recursive' - ], { ...opts, cwd: target })))) + ], { ...opts, cwd: target })) + })) const unresolved = (repo, ref, target, opts) => { // can't do this one shallowly, because the ref isn't advertised @@ -139,5 +159,5 @@ const unresolved = (repo, ref, target, opts) => { .then(() => git(['checkout', ref])) .then(() => updateSubmodules(target, opts)) .then(() => git(['rev-parse', '--revs-only', 'HEAD'])) - .then(({stdout}) => stdout.trim()) + .then(({ stdout }) => stdout.trim()) } diff --git a/deps/npm/node_modules/@npmcli/git/lib/env.js b/deps/npm/node_modules/@npmcli/git/lib/env.js deleted file mode 100644 index 87787cdbebe670..00000000000000 --- a/deps/npm/node_modules/@npmcli/git/lib/env.js +++ /dev/null @@ -1,33 +0,0 @@ -const uniqueFilename = require('unique-filename') -const { join } = require('path') -const {tmpdir} = require('os') - -const goodEnvVars = new Set([ - 'GIT_ASKPASS', - 'GIT_EXEC_PATH', - 'GIT_PROXY_COMMAND', - 'GIT_SSH', - 'GIT_SSH_COMMAND', - 'GIT_SSL_CAINFO', - 'GIT_SSL_NO_VERIFY' -]) - -// memoize -let gitEnv - -module.exports = () => { - if (gitEnv) - return gitEnv - - // we set the template dir to an empty folder to give git less to do - const tmpDir = join(tmpdir(), 'npmcli-git-template-tmp') - const tmpName = uniqueFilename(tmpDir, 'git-clone') - return gitEnv = Object.keys(process.env).reduce((gitEnv, k) => { - if (goodEnvVars.has(k) || !k.startsWith('GIT_')) - gitEnv[k] = process.env[k] - return gitEnv - }, { - GIT_ASKPASS: 'echo', - GIT_TEMPLATE_DIR: tmpName - }) -} diff --git a/deps/npm/node_modules/@npmcli/git/lib/find.js b/deps/npm/node_modules/@npmcli/git/lib/find.js index 2d2ad308665de1..d58f01dbcc16ff 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/find.js +++ b/deps/npm/node_modules/@npmcli/git/lib/find.js @@ -1,7 +1,15 @@ const is = require('./is.js') const { dirname } = require('path') -const check = (cwd, prev) => is({ cwd }).then(isGit => - isGit ? cwd - : cwd === prev ? null - : check(dirname(cwd), cwd)) -module.exports = ({ cwd = process.cwd() } = {}) => check(cwd) + +module.exports = async ({ cwd = process.cwd() } = {}) => { + if (await is({ cwd })) { + return cwd + } + while (cwd !== dirname(cwd)) { + cwd = dirname(cwd) + if (await is({ cwd })) { + return cwd + } + } + return null +} diff --git a/deps/npm/node_modules/@npmcli/git/lib/index.js b/deps/npm/node_modules/@npmcli/git/lib/index.js index 7088792a1fc6e3..50fd889b89b5ad 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/index.js +++ b/deps/npm/node_modules/@npmcli/git/lib/index.js @@ -4,5 +4,5 @@ module.exports = { spawn: require('./spawn.js'), is: require('./is.js'), find: require('./find.js'), - isClean: require('./is-clean.js'), + isClean: require('./is-clean.js') } diff --git a/deps/npm/node_modules/@npmcli/git/lib/is-clean.js b/deps/npm/node_modules/@npmcli/git/lib/is-clean.js index 19f8049e0fb145..182373be941935 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/is-clean.js +++ b/deps/npm/node_modules/@npmcli/git/lib/is-clean.js @@ -1,6 +1,6 @@ const spawn = require('./spawn.js') module.exports = (opts = {}) => - spawn([ 'status', '--porcelain=v1', '-uno' ], opts) - .then(res => res.stdout.trim().split(/\r?\n+/) - .map(l => l.trim()).filter(l => l).length ? false : true) + spawn(['status', '--porcelain=v1', '-uno'], opts) + .then(res => !res.stdout.trim().split(/\r?\n+/) + .map(l => l.trim()).filter(l => l).length) diff --git a/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js b/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js index 524e672431ea4b..9f879ca2475f59 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js +++ b/deps/npm/node_modules/@npmcli/git/lib/lines-to-revs.js @@ -7,7 +7,7 @@ module.exports = lines => finish(lines.reduce(linesToRevsReducer, { versions: {}, 'dist-tags': {}, refs: {}, - shas: {}, + shas: {} })) const finish = revs => distTags(shaList(peelTags(revs))) @@ -15,16 +15,16 @@ const finish = revs => distTags(shaList(peelTags(revs))) // We can check out shallow clones on specific SHAs if we have a ref const shaList = revs => { Object.keys(revs.refs).forEach(ref => { - doc = revs.refs[ref] - if (revs.shas[doc.sha]) - revs.shas[doc.sha].push(ref) - else + const doc = revs.refs[ref] + if (!revs.shas[doc.sha]) { revs.shas[doc.sha] = [ref] + } else { + revs.shas[doc.sha].push(ref) + } }) return revs } - // Replace any tags with their ^{} counterparts, if those exist const peelTags = revs => { Object.keys(revs.refs).filter(ref => ref.endsWith('^{}')).forEach(ref => { @@ -48,30 +48,38 @@ const distTags = revs => { // 'latest' branch if one exists and is a version, // or HEAD if not. const ver = revs.versions[v] - if (revs.refs.latest && ver.sha === revs.refs.latest.sha) + if (revs.refs.latest && ver.sha === revs.refs.latest.sha) { revs['dist-tags'].latest = v - else if (ver.sha === HEAD.sha) { + } else if (ver.sha === HEAD.sha) { revs['dist-tags'].HEAD = v - if (!revs.refs.latest) - revs['dist-tags'].latest = v + if (!revs.refs.latest) { revs['dist-tags'].latest = v } } }) return revs } -const refType = ref => - ref.startsWith('refs/tags/') ? 'tag' - : ref.startsWith('refs/heads/') ? 'branch' - : ref.startsWith('refs/pull/') ? 'pull' - : ref === 'HEAD' ? 'head' - // Could be anything, ignore for now - : /* istanbul ignore next */ 'other' +const refType = ref => { + if (ref.startsWith('refs/tags/')) { + return 'tag' + } + if (ref.startsWith('refs/heads/')) { + return 'branch' + } + if (ref.startsWith('refs/pull/')) { + return 'pull' + } + if (ref === 'HEAD') { + return 'head' + } + // Could be anything, ignore for now + /* istanbul ignore next */ + return 'other' +} // return the doc, or null if we should ignore it. const lineToRevDoc = line => { const split = line.trim().split(/\s+/, 2) - if (split.length < 2) - return null + if (split.length < 2) { return null } const sha = split[0].trim() const rawRef = split[1].trim() @@ -114,8 +122,7 @@ const lineToRevDoc = line => { const linesToRevsReducer = (revs, line) => { const doc = lineToRevDoc(line) - if (!doc) - return revs + if (!doc) { return revs } revs.refs[doc.ref] = doc revs.refs[doc.rawRef] = doc @@ -125,8 +132,9 @@ const linesToRevsReducer = (revs, line) => { // which is a pretty common pattern. const match = !doc.ref.endsWith('^{}') && doc.ref.match(/v?(\d+\.\d+\.\d+(?:[-+].+)?)$/) - if (match && semver.valid(match[1], true)) + if (match && semver.valid(match[1], true)) { revs.versions[semver.clean(match[1], true)] = doc + } } return revs diff --git a/deps/npm/node_modules/@npmcli/git/lib/opts.js b/deps/npm/node_modules/@npmcli/git/lib/opts.js index 7da4801a6aae05..144e0a3aaf03f4 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/opts.js +++ b/deps/npm/node_modules/@npmcli/git/lib/opts.js @@ -1,6 +1,12 @@ -const gitEnv = require('./env.js') +// Values we want to set if they're not already defined by the end user +// This defaults to accepting new ssh host key fingerprints +const gitEnv = { + GIT_ASKPASS: 'echo', + GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new' +} module.exports = (opts = {}) => ({ stdioString: true, ...opts, - env: opts.env || gitEnv(), + shell: false, + env: opts.env || { ...gitEnv, ...process.env } }) diff --git a/deps/npm/node_modules/@npmcli/git/lib/revs.js b/deps/npm/node_modules/@npmcli/git/lib/revs.js index 5744731872231f..81059594f7aee9 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/revs.js +++ b/deps/npm/node_modules/@npmcli/git/lib/revs.js @@ -4,21 +4,25 @@ const LRU = require('lru-cache') const revsCache = new LRU({ max: 100, - maxAge: 5 * 60 * 1000, + maxAge: 5 * 60 * 1000 }) const linesToRevs = require('./lines-to-revs.js') -module.exports = (repo, opts = {}) => { +module.exports = async (repo, opts = {}) => { if (!opts.noGitRevCache) { const cached = revsCache.get(repo) - if (cached) - return Promise.resolve(cached) + if (cached) { + return cached + } } return pinflight(`ls-remote:${repo}`, () => spawn(['ls-remote', repo], opts) - .then(({stdout}) => linesToRevs(stdout.trim().split('\n'))) - .then(revs => (revsCache.set(repo, revs), revs)) + .then(({ stdout }) => linesToRevs(stdout.trim().split('\n'))) + .then(revs => { + revsCache.set(repo, revs) + return revs + }) ) } diff --git a/deps/npm/node_modules/@npmcli/git/lib/spawn.js b/deps/npm/node_modules/@npmcli/git/lib/spawn.js index 3c3a943fe9f0d3..cee3a7baf40788 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/spawn.js +++ b/deps/npm/node_modules/@npmcli/git/lib/spawn.js @@ -8,26 +8,30 @@ const procLog = require('./proc-log.js') module.exports = (gitArgs, opts = {}) => { const gitPath = whichGit(opts) - if (gitPath instanceof Error) - return Promise.reject(gitPath) + if (gitPath instanceof Error) { return Promise.reject(gitPath) } const log = opts.log || procLog + let retry = opts.retry + if (retry === null || retry === undefined) { + retry = { + retries: opts.fetchRetries || 2, + factor: opts.fetchRetryFactor || 10, + maxTimeout: opts.fetchRetryMaxtimeout || 60000, + minTimeout: opts.fetchRetryMintimeout || 1000 + } + } return promiseRetry((retry, number) => { - if (number !== 1) + if (number !== 1) { log.silly('pacote', `Retrying git command: ${ gitArgs.join(' ')} attempt # ${number}`) + } return spawn(gitPath, gitArgs, makeOpts(opts)) .catch(er => { - if (shouldRetry(er.stderr, number)) - retry(er) - else + if (!shouldRetry(er.stderr, number)) { throw er + } + retry(er) }) - }, opts.retry !== null && opts.retry !== undefined ? opts.retry : { - retries: opts.fetchRetries || 2, - factor: opts.fetchRetryFactor || 10, - maxTimeout: opts.fetchRetryMaxtimeout || 60000, - minTimeout: opts.fetchRetryMintimeout || 1000, - }) + }, retry) } diff --git a/deps/npm/node_modules/@npmcli/git/lib/utils.js b/deps/npm/node_modules/@npmcli/git/lib/utils.js new file mode 100644 index 00000000000000..fcd9578a19597d --- /dev/null +++ b/deps/npm/node_modules/@npmcli/git/lib/utils.js @@ -0,0 +1,3 @@ +const isWindows = opts => (opts.fakePlatform || process.platform) === 'win32' + +exports.isWindows = isWindows diff --git a/deps/npm/node_modules/@npmcli/git/lib/which.js b/deps/npm/node_modules/@npmcli/git/lib/which.js index 9e82d391aadedb..a2f690e1bce80c 100644 --- a/deps/npm/node_modules/@npmcli/git/lib/which.js +++ b/deps/npm/node_modules/@npmcli/git/lib/which.js @@ -5,7 +5,12 @@ try { gitPath = which.sync('git') } catch (e) {} -module.exports = (opts = {}) => - opts.git || - opts.git !== false && gitPath || - Object.assign(new Error('No git binary found in $PATH'), { code: 'ENOGIT' }) +module.exports = (opts = {}) => { + if (opts.git) { + return opts.git + } + if (!gitPath || opts.git === false) { + return Object.assign(new Error('No git binary found in $PATH'), { code: 'ENOGIT' }) + } + return gitPath +} diff --git a/deps/npm/node_modules/@npmcli/git/package.json b/deps/npm/node_modules/@npmcli/git/package.json index 0e01efaf2fbce9..9b368c31e262db 100644 --- a/deps/npm/node_modules/@npmcli/git/package.json +++ b/deps/npm/node_modules/@npmcli/git/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/git", - "version": "2.0.6", + "version": "2.0.8", "main": "lib/index.js", "files": [ "lib/*.js" @@ -13,11 +13,14 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", "license": "ISC", "scripts": { - "test": "tap", - "snap": "tap", - "preversion": "npm test", + "lint": "standard", + "lint:fix": "standard --fix", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "preversion": "npm test", + "snap": "tap", + "test": "tap", + "posttest": "npm run lint" }, "tap": { "check-coverage": true, @@ -25,17 +28,17 @@ }, "devDependencies": { "slash": "^3.0.0", - "tap": "^14.10.6" + "standard": "^16.0.3", + "tap": "^14.11.0" }, "dependencies": { - "@npmcli/promise-spawn": "^1.1.0", + "@npmcli/promise-spawn": "^1.3.2", "lru-cache": "^6.0.0", - "mkdirp": "^1.0.3", - "npm-pick-manifest": "^6.0.0", + "mkdirp": "^1.0.4", + "npm-pick-manifest": "^6.1.1", "promise-inflight": "^1.0.1", "promise-retry": "^2.0.1", - "semver": "^7.3.2", - "unique-filename": "^1.1.1", + "semver": "^7.3.5", "which": "^2.0.2" } } diff --git a/deps/npm/node_modules/@npmcli/run-script/README.md b/deps/npm/node_modules/@npmcli/run-script/README.md index 59b473d94706c5..ff8f5d354718c3 100644 --- a/deps/npm/node_modules/@npmcli/run-script/README.md +++ b/deps/npm/node_modules/@npmcli/run-script/README.md @@ -103,7 +103,7 @@ terminal, then it is up to the user to end it, of course. - The `package.json` fields described in [RFC183](https://github.com/npm/rfcs/pull/183/files). - `scriptShell` Optional, defaults to `/bin/sh` on Unix, defaults to - `env.comspec` or `cmd` on Windows. Custom script to use to execute the + `env.ComSpec` or `cmd` on Windows. Custom script to use to execute the command. - `stdio` Optional, defaults to `'pipe'`. The same as the `stdio` argument passed to `child_process` functions in Node.js. Note that if a stdio diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js b/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js index 8ee24c06daf7b1..8f299954a7a801 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js @@ -8,7 +8,7 @@ const makeSpawnArgs = options => { const { event, path, - scriptShell = isWindows ? process.env.comspec || 'cmd' : 'sh', + scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh', env = {}, stdio, cmd, diff --git a/deps/npm/node_modules/@npmcli/run-script/package.json b/deps/npm/node_modules/@npmcli/run-script/package.json index 7e0e5255de4105..756f87f1d4d380 100644 --- a/deps/npm/node_modules/@npmcli/run-script/package.json +++ b/deps/npm/node_modules/@npmcli/run-script/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/run-script", - "version": "1.8.4", + "version": "1.8.5", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", "license": "ISC", @@ -25,7 +25,7 @@ "eslint-plugin-standard": "^5.0.0", "minipass": "^3.1.1", "require-inject": "^1.4.4", - "tap": "^14.11.0" + "tap": "^15.0.4" }, "dependencies": { "@npmcli/node-gyp": "^1.0.2", diff --git a/deps/npm/node_modules/balanced-match/.github/FUNDING.yml b/deps/npm/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 00000000000000..cea8b16e9edc40 --- /dev/null +++ b/deps/npm/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/deps/npm/node_modules/balanced-match/.npmignore b/deps/npm/node_modules/balanced-match/.npmignore deleted file mode 100644 index ae5d8c36ac6522..00000000000000 --- a/deps/npm/node_modules/balanced-match/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -test -.gitignore -.travis.yml -Makefile -example.js diff --git a/deps/npm/node_modules/balanced-match/README.md b/deps/npm/node_modules/balanced-match/README.md index 08e918c0db9a62..d2a48b6b49f2cf 100644 --- a/deps/npm/node_modules/balanced-match/README.md +++ b/deps/npm/node_modules/balanced-match/README.md @@ -66,6 +66,12 @@ With [npm](https://npmjs.org) do: npm install balanced-match ``` +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + ## License (MIT) diff --git a/deps/npm/node_modules/balanced-match/index.js b/deps/npm/node_modules/balanced-match/index.js index 1685a762932558..c67a64608df7f4 100644 --- a/deps/npm/node_modules/balanced-match/index.js +++ b/deps/npm/node_modules/balanced-match/index.js @@ -28,6 +28,9 @@ function range(a, b, str) { var i = ai; if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } begs = []; left = str.length; diff --git a/deps/npm/node_modules/balanced-match/package.json b/deps/npm/node_modules/balanced-match/package.json index 61349c6edad627..ce6073e0403b5a 100644 --- a/deps/npm/node_modules/balanced-match/package.json +++ b/deps/npm/node_modules/balanced-match/package.json @@ -1,7 +1,7 @@ { "name": "balanced-match", "description": "Match balanced character pairs, like \"{\" and \"}\"", - "version": "1.0.0", + "version": "1.0.2", "repository": { "type": "git", "url": "git://github.com/juliangruber/balanced-match.git" @@ -9,10 +9,9 @@ "homepage": "https://github.com/juliangruber/balanced-match", "main": "index.js", "scripts": { - "test": "make test", - "bench": "make bench" + "test": "tape test/test.js", + "bench": "matcha test/bench.js" }, - "dependencies": {}, "devDependencies": { "matcha": "^0.7.0", "tape": "^4.6.0" diff --git a/deps/npm/node_modules/chalk/package.json b/deps/npm/node_modules/chalk/package.json index 0d99f0f28621f2..c2d63f67e5e955 100644 --- a/deps/npm/node_modules/chalk/package.json +++ b/deps/npm/node_modules/chalk/package.json @@ -1,6 +1,6 @@ { "name": "chalk", - "version": "4.1.0", + "version": "4.1.1", "description": "Terminal string styling done right", "license": "MIT", "repository": "chalk/chalk", diff --git a/deps/npm/node_modules/chalk/readme.md b/deps/npm/node_modules/chalk/readme.md index 338f42cb8b525b..851259216bc193 100644 --- a/deps/npm/node_modules/chalk/readme.md +++ b/deps/npm/node_modules/chalk/readme.md @@ -13,6 +13,48 @@ <img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900"> +<br> + +--- + +<div align="center"> + <p> + <p> + <sup> + Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a> + </sup> + </p> + <sup>Special thanks to:</sup> + <br> + <br> + <a href="https://standardresume.co/tech"> + <img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/> + </a> + <br> + <br> + <a href="https://retool.com/?utm_campaign=sindresorhus"> + <img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="210"/> + </a> + <br> + <br> + <a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github"> + <div> + <img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler"> + </div> + <b>All your environment variables, in one place</b> + <div> + <span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span> + <br> + <span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span> + </div> + </a> + </p> +</div> + +--- + +<br> + ## Highlights - Expressive API diff --git a/deps/npm/node_modules/init-package-json/default-input.js b/deps/npm/node_modules/init-package-json/default-input.js index 8e9fe0b573ea5f..d1f65841d6c5a3 100644 --- a/deps/npm/node_modules/init-package-json/default-input.js +++ b/deps/npm/node_modules/init-package-json/default-input.js @@ -12,7 +12,7 @@ function isTestPkg (p) { } function niceName (n) { - return n.replace(/^node-|[.-]js$/g, '').replace(' ', '-').toLowerCase() + return n.replace(/^node-|[.-]js$/g, '').replace(/\s+/g, ' ').replace(/ /g, '-').toLowerCase() } function readDeps (test, excluded) { return function (cb) { @@ -45,7 +45,7 @@ function readDeps (test, excluded) { return function (cb) { }) }} -var name = package.name || basename +var name = niceName(package.name || basename) var spec try { spec = npa(name) @@ -61,7 +61,7 @@ if (scope) { name = scope + '/' + name } } -exports.name = yes ? name : prompt('package name', niceName(name), function (data) { +exports.name = yes ? name : prompt('package name', name, function (data) { var its = validateName(data) if (its.validForNewPackages) return data var errors = (its.errors || []).concat(its.warnings || []) diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json index 91c6bfba82049d..584e313b4c2c7c 100644 --- a/deps/npm/node_modules/init-package-json/package.json +++ b/deps/npm/node_modules/init-package-json/package.json @@ -1,6 +1,6 @@ { "name": "init-package-json", - "version": "2.0.2", + "version": "2.0.3", "main": "init-package-json.js", "scripts": { "test": "tap", @@ -17,19 +17,19 @@ "description": "A node module to get your node module started", "dependencies": { "glob": "^7.1.1", - "npm-package-arg": "^8.1.0", + "npm-package-arg": "^8.1.2", "promzard": "^0.3.0", "read": "~1.0.1", - "read-package-json": "^3.0.0", - "semver": "^7.3.2", + "read-package-json": "^3.0.1", + "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^3.0.0" }, "devDependencies": { - "@npmcli/config": "^1.2.1", + "@npmcli/config": "^2.1.0", "mkdirp": "^1.0.4", "rimraf": "^3.0.2", - "tap": "^14.10.8" + "tap": "^14.11.0" }, "engines": { "node": ">=10" diff --git a/deps/npm/node_modules/just-diff/index.d.ts b/deps/npm/node_modules/just-diff/index.d.ts new file mode 100644 index 00000000000000..cd3126daeb3aed --- /dev/null +++ b/deps/npm/node_modules/just-diff/index.d.ts @@ -0,0 +1,20 @@ +// Definitions by: Cameron Hunter <https://github.com/cameronhunter> +// Modified by: Angus Croll <https://github.com/angus-c> +type Operation = "add" | "replace" | "remove"; + +type JSONPatchPathConverter<OUTPUT> = ( + arrayPath: Array<string | number> +) => OUTPUT; + +export function diff( + a: object | Array<any>, + b: object | Array<any>, +): Array<{ op: Operation; path: Array<string | number>; value: any }>; + +export function diff<PATH>( + a: object | Array<any>, + b: object | Array<any>, + jsonPatchPathConverter: JSONPatchPathConverter<PATH> +): Array<{ op: Operation; path: PATH; value: any }>; + +export const jsonPatchPathConverter: JSONPatchPathConverter<string>; \ No newline at end of file diff --git a/deps/npm/node_modules/just-diff/index.tests.ts b/deps/npm/node_modules/just-diff/index.tests.ts new file mode 100644 index 00000000000000..4cfd55ec78b7de --- /dev/null +++ b/deps/npm/node_modules/just-diff/index.tests.ts @@ -0,0 +1,64 @@ +import diffObj = require('./index'); + +const {diff, jsonPatchPathConverter} = diffObj; +const obj1 = {a: 2, b: 3}; +const obj2 = {a: 2, c: 1}; +const arr1 = [1, 'bee']; +const arr2 = [2, 'bee']; + + +//OK +diff(obj1, obj2); +diff(arr1, arr2); +diff(obj1, arr1); +diff(obj2, arr2); +diff(/yes/, arr1); +diff(new Date(), arr2); + + +diff(obj1, obj2, jsonPatchPathConverter); +diff(arr1, arr2, jsonPatchPathConverter); +diff(obj1, arr1, jsonPatchPathConverter); +diff(obj2, arr2, jsonPatchPathConverter); + +// not OK +// @ts-expect-error +diff(obj1); +// @ts-expect-error +diff(arr2); +// @ts-expect-error +diff('a'); +// @ts-expect-error +diff(true); + +// @ts-expect-error +diff(obj1, 1); +// @ts-expect-error +diff(3, arr2); +// @ts-expect-error +diff(obj1, 'a'); +// @ts-expect-error +diff('b', arr2); + +// @ts-expect-error +diff('a', jsonPatchPathConverter); +// @ts-expect-error +diff(true, jsonPatchPathConverter); + +// @ts-expect-error +diff(obj1, 1, jsonPatchPathConverter); +// @ts-expect-error +diff(3, arr2, jsonPatchPathConverter); +// @ts-expect-error +diff(obj1, 'a', jsonPatchPathConverter); +// @ts-expect-error +diff('b', arr2, jsonPatchPathConverter); + +// @ts-expect-error +diff(obj1, obj2, 'a'); +// @ts-expect-error +diff(arr1, arr2, 1); +// @ts-expect-error +diff(obj1, arr1, 'bee'); +// @ts-expect-error +diff(obj2, arr2, 'nope'); diff --git a/deps/npm/node_modules/just-diff/package.json b/deps/npm/node_modules/just-diff/package.json index dbe3aa2ba9ceab..00be1d50fddbcb 100644 --- a/deps/npm/node_modules/just-diff/package.json +++ b/deps/npm/node_modules/just-diff/package.json @@ -1,8 +1,9 @@ { "name": "just-diff", - "version": "3.0.2", + "version": "3.1.1", "description": "Return an object representing the diffs between two objects. Supports jsonPatch protocol", "main": "index.js", + "types": "index.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, @@ -19,4 +20,4 @@ "bugs": { "url": "https://github.com/angus-c/just/issues" } -} +} \ No newline at end of file diff --git a/deps/npm/node_modules/libnpmaccess/package.json b/deps/npm/node_modules/libnpmaccess/package.json index 2b522e090a89b5..69b7a0dc25fe49 100644 --- a/deps/npm/node_modules/libnpmaccess/package.json +++ b/deps/npm/node_modules/libnpmaccess/package.json @@ -1,6 +1,6 @@ { "name": "libnpmaccess", - "version": "4.0.1", + "version": "4.0.2", "description": "programmatic library for `npm access` commands", "author": "Kat Marchán <kzm@sykosomatic.org>", "license": "ISC", @@ -14,7 +14,7 @@ "devDependencies": { "nock": "^12.0.1", "standard": "^14.3.0", - "tap": "^14.10.6" + "tap": "^14.11.0" }, "repository": { "type": "git", @@ -25,8 +25,8 @@ "dependencies": { "aproba": "^2.0.0", "minipass": "^3.1.1", - "npm-package-arg": "^8.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-package-arg": "^8.1.2", + "npm-registry-fetch": "^10.0.0" }, "engines": { "node": ">=10" diff --git a/deps/npm/node_modules/libnpmexec/CHANGELOG.md b/deps/npm/node_modules/libnpmexec/CHANGELOG.md new file mode 100644 index 00000000000000..9de3013f0ad9d8 --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## v1.0.0 + +- Initial implementation, moves the code that used to live in the **npm cli**, +ref: https://github.com/npm/cli/blob/release/v7.10.0/lib/exec.js into this +separate module, providing a programmatic API to the **npm exec** functionality. diff --git a/deps/npm/node_modules/libnpmexec/LICENSE b/deps/npm/node_modules/libnpmexec/LICENSE new file mode 100644 index 00000000000000..d3a1cdfd217b64 --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) GitHub Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/libnpmexec/README.md b/deps/npm/node_modules/libnpmexec/README.md new file mode 100644 index 00000000000000..a436c9a5a2bc1a --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/README.md @@ -0,0 +1,48 @@ +# libnpmexec + +[![npm version](https://img.shields.io/npm/v/libnpmexec.svg)](https://npm.im/libnpmexec) +[![license](https://img.shields.io/npm/l/libnpmexec.svg)](https://npm.im/libnpmexec) +[![GitHub Actions](https://github.com/npm/libnpmexec/workflows/node-ci/badge.svg)](https://github.com/npm/libnpmexec/actions?query=workflow%3Anode-ci) +[![Coverage Status](https://coveralls.io/repos/github/npm/libnpmexec/badge.svg?branch=main)](https://coveralls.io/github/npm/libnpmexec?branch=main) + +The `npm exec` (`npx`) Programmatic API + +## Install + +`npm install libnpmexec` + +## Usage: + +```js +const libexec = require('libnpmexec') +await libexec({ + args: ['yosay', 'Bom dia!'], + cache: '~/.npm', + yes: true, +}) +``` + +## API: + +### `libexec(opts)` + +- `opts`: + - `args`: List of pkgs to execute **Array<String>**, defaults to `[]` + - `call`: An alternative command to run when using `packages` option **String**, defaults to empty string. + - `cache`: The path location to where the npm cache folder is placed **String** + - `color`: Output should use color? **Boolean**, defaults to `false` + - `localBin`: Location to the `node_modules/.bin` folder of the local project **String**, defaults to empty string. + - `locationMsg`: Overrides "at location" message when entering interactive mode **String** + - `log`: Sets an optional logger **Object**, defaults to `proc-log` module usage. + - `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string. + - `output`: A function to print output to **Function** + - `packages`: A list of packages to be used (possibly fetch from the registry) **Array<String>**, defaults to `[]` + - `path`: Location to where to read local project info (`package.json`) **String**, defaults to `.` + - `runPath`: Location to where to execute the script **String**, defaults to `.` + - `scriptShell`: Default shell to be used **String** + - `yes`: Should skip download confirmation prompt when fetching missing packages from the registry? **Boolean** + - `registry`, `cache`, and more options that are forwarded to [@npmcli/arborist](https://github.com/npm/arborist/) and [pacote](https://github.com/npm/pacote/#options) **Object** + +## LICENSE + +[ISC](./LICENSE) diff --git a/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js b/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js new file mode 100644 index 00000000000000..1bee28989bf76d --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js @@ -0,0 +1,19 @@ +const crypto = require('crypto') + +const { resolve } = require('path') + +const cacheInstallDir = ({ cache, packages }) => { + if (!cache) + throw new Error('Must provide a valid cache path') + + // only packages not found in ${prefix}/node_modules + return resolve(cache, '_npx', getHash(packages)) +} + +const getHash = (packages) => + crypto.createHash('sha512') + .update(packages.sort((a, b) => a.localeCompare(b)).join('\n')) + .digest('hex') + .slice(0, 16) + +module.exports = cacheInstallDir diff --git a/deps/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js b/deps/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js new file mode 100644 index 00000000000000..038095b5023007 --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js @@ -0,0 +1,20 @@ +const getBinFromManifest = (mani) => { + // if we have a bin matching (unscoped portion of) packagename, use that + // otherwise if there's 1 bin or all bin value is the same (alias), use + // that, otherwise fail + const bin = mani.bin || {} + if (new Set(Object.values(bin)).size === 1) + return Object.keys(bin)[0] + + // XXX probably a util to parse this better? + const name = mani.name.replace(/^@[^/]+\//, '') + if (bin[name]) + return name + + // XXX need better error message + throw Object.assign(new Error('could not determine executable to run'), { + pkgid: mani._id, + }) +} + +module.exports = getBinFromManifest diff --git a/deps/npm/node_modules/libnpmexec/lib/index.js b/deps/npm/node_modules/libnpmexec/lib/index.js new file mode 100644 index 00000000000000..906a0b5407c13a --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/lib/index.js @@ -0,0 +1,185 @@ +const { delimiter, resolve } = require('path') +const { promisify } = require('util') +const read = promisify(require('read')) +const stat = promisify(require('fs').stat) + +const Arborist = require('@npmcli/arborist') +const ciDetect = require('@npmcli/ci-detect') +const logger = require('proc-log') +const mkdirp = require('mkdirp-infer-owner') +const npa = require('npm-package-arg') +const pacote = require('pacote') +const readPackageJson = require('read-package-json-fast') + +const cacheInstallDir = require('./cache-install-dir.js') +const getBinFromManifest = require('./get-bin-from-manifest.js') +const manifestMissing = require('./manifest-missing.js') +const noTTY = require('./no-tty.js') +const runScript = require('./run-script.js') + +const fileExists = (file) => stat(file) + .then((stat) => stat.isFile()) + .catch(() => false) + +/* istanbul ignore next */ +const PATH = ( + process.env.PATH || process.env.Path || process.env.path +).split(delimiter) + +const exec = async (opts) => { + const { + args = [], + call = '', + color = false, + localBin = '', + locationMsg = undefined, + globalBin = '', + output, + packages: _packages = [], + path = '.', + runPath = '.', + scriptShell = undefined, + yes = undefined, + ...flatOptions + } = opts + const log = flatOptions.log || logger + + // dereferences values because we manipulate it later + const packages = [..._packages] + const pathArr = [...PATH] + const _run = () => runScript({ + args, + call, + color, + flatOptions, + locationMsg, + log, + output, + path, + pathArr, + runPath, + scriptShell, + }) + + // nothing to maybe install, skip the arborist dance + if (!call && !args.length && !packages.length) + return await _run() + + const needPackageCommandSwap = args.length && !packages.length + // if there's an argument and no package has been explicitly asked for + // check the local and global bin paths for a binary named the same as + // the argument and run it if it exists, otherwise fall through to + // the behavior of treating the single argument as a package name + if (needPackageCommandSwap) { + let binExists = false + if (await fileExists(`${localBin}/${args[0]}`)) { + pathArr.unshift(localBin) + binExists = true + } else if (await fileExists(`${globalBin}/${args[0]}`)) { + pathArr.unshift(globalBin) + binExists = true + } + + if (binExists) + return await _run() + + packages.push(args[0]) + } + + // If we do `npm exec foo`, and have a `foo` locally, then we'll + // always use that, so we don't really need to fetch the manifest. + // So: run npa on each packages entry, and if it is a name with a + // rawSpec==='', then try to readPackageJson at + // node_modules/${name}/package.json, and only pacote fetch if + // that fails. + const manis = await Promise.all(packages.map(async p => { + const spec = npa(p, path) + if (spec.type === 'tag' && spec.rawSpec === '') { + // fall through to the pacote.manifest() approach + try { + const pj = resolve(path, 'node_modules', spec.name, 'package.json') + return await readPackageJson(pj) + } catch (er) {} + } + // Force preferOnline to true so we are making sure to pull in the latest + // This is especially useful if the user didn't give us a version, and + // they expect to be running @latest + return await pacote.manifest(p, { + ...flatOptions, + preferOnline: true, + }) + })) + + if (needPackageCommandSwap) + args[0] = getBinFromManifest(manis[0]) + + // figure out whether we need to install stuff, or if local is fine + const localArb = new Arborist({ + ...flatOptions, + path, + }) + const tree = await localArb.loadActual() + + // do we have all the packages in manifest list? + const needInstall = + manis.some(manifest => manifestMissing({ tree, manifest })) + + if (needInstall) { + const { cache } = flatOptions + const installDir = cacheInstallDir({ cache, packages }) + await mkdirp(installDir) + const arb = new Arborist({ + ...flatOptions, + path: installDir, + }) + const tree = await arb.loadActual() + + // at this point, we have to ensure that we get the exact same + // version, because it's something that has only ever been installed + // by npm exec in the cache install directory + const add = manis.filter(mani => manifestMissing({ + tree, + manifest: { + ...mani, + _from: `${mani.name}@${mani.version}`, + }, + })) + .map(mani => mani._from) + .sort((a, b) => a.localeCompare(b)) + + // no need to install if already present + if (add.length) { + if (!yes) { + // set -n to always say no + if (yes === false) + throw new Error('canceled') + + if (noTTY() || ciDetect()) { + log.warn('exec', `The following package${ + add.length === 1 ? ' was' : 's were' + } not found and will be installed: ${ + add.map((pkg) => pkg.replace(/@$/, '')).join(', ') + }`) + } else { + const addList = add.map(a => ` ${a.replace(/@$/, '')}`) + .join('\n') + '\n' + const prompt = `Need to install the following packages:\n${ + addList + }Ok to proceed? ` + const confirm = await read({ prompt, default: 'y' }) + if (confirm.trim().toLowerCase().charAt(0) !== 'y') + throw new Error('canceled') + } + } + await arb.reify({ + ...flatOptions, + add, + }) + } + pathArr.unshift(resolve(installDir, 'node_modules/.bin')) + } + + return await _run() +} + +module.exports = exec diff --git a/deps/npm/node_modules/libnpmexec/lib/manifest-missing.js b/deps/npm/node_modules/libnpmexec/lib/manifest-missing.js new file mode 100644 index 00000000000000..47146809609923 --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/lib/manifest-missing.js @@ -0,0 +1,17 @@ +const manifestMissing = ({ tree, manifest }) => { + // if the tree doesn't have a child by that name/version, return true + // true means we need to install it + const child = tree.children.get(manifest.name) + // if no child, we have to load it + if (!child) + return true + + // if no version/tag specified, allow whatever's there + if (manifest._from === `${manifest.name}@`) + return false + + // otherwise the version has to match what we WOULD get + return child.version !== manifest.version +} + +module.exports = manifestMissing diff --git a/deps/npm/node_modules/libnpmexec/lib/no-tty.js b/deps/npm/node_modules/libnpmexec/lib/no-tty.js new file mode 100644 index 00000000000000..601798d25cc77b --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/lib/no-tty.js @@ -0,0 +1 @@ +module.exports = () => !process.stdin.isTTY diff --git a/deps/npm/node_modules/libnpmexec/lib/run-script.js b/deps/npm/node_modules/libnpmexec/lib/run-script.js new file mode 100644 index 00000000000000..819dacb8baee86 --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/lib/run-script.js @@ -0,0 +1,86 @@ +const { delimiter } = require('path') + +const chalk = require('chalk') +const ciDetect = require('@npmcli/ci-detect') +const runScript = require('@npmcli/run-script') +const readPackageJson = require('read-package-json-fast') +const noTTY = require('./no-tty.js') + +const nocolor = { + reset: s => s, + bold: s => s, + dim: s => s, +} + +const run = async ({ + args, + call, + color, + flatOptions, + locationMsg, + log, + output = () => {}, + path, + pathArr, + runPath, + scriptShell, +}) => { + // turn list of args into command string + const script = call || args.shift() || scriptShell + const colorize = color ? chalk : nocolor + + // do the fakey runScript dance + // still should work if no package.json in cwd + const realPkg = await readPackageJson(`${path}/package.json`) + .catch(() => ({})) + const pkg = { + ...realPkg, + scripts: { + ...(realPkg.scripts || {}), + npx: script, + }, + } + + if (log && log.disableProgress) + log.disableProgress() + + try { + if (script === scriptShell) { + const isTTY = !noTTY() + + if (isTTY) { + if (ciDetect()) + return log.warn('exec', 'Interactive mode disabled in CI environment') + + locationMsg = locationMsg || ` at location:\n${colorize.dim(runPath)}` + + output(`${ + colorize.reset('\nEntering npm script environment') + }${ + colorize.reset(locationMsg) + }${ + colorize.bold('\nType \'exit\' or ^D when finished\n') + }`) + } + } + return await runScript({ + ...flatOptions, + pkg, + banner: false, + // we always run in cwd, not --prefix + path: runPath, + stdioString: true, + event: 'npx', + args, + env: { + PATH: pathArr.join(delimiter), + }, + stdio: 'inherit', + }) + } finally { + if (log && log.enableProgress) + log.enableProgress() + } +} + +module.exports = run diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json new file mode 100644 index 00000000000000..1b7d24103be7af --- /dev/null +++ b/deps/npm/node_modules/libnpmexec/package.json @@ -0,0 +1,63 @@ +{ + "name": "libnpmexec", + "version": "1.0.1", + "files": [ + "lib" + ], + "main": "lib/index.js", + "engines": { + "node": ">=10" + }, + "description": "npm exec (npx) programmatic API", + "repository": "https://github.com/npm/libnpmexec", + "keywords": [ + "npm", + "npmcli", + "libnpm", + "cli", + "workspaces", + "libnpmexec" + ], + "author": "GitHub Inc.", + "contributors": [ + { + "name": "Ruy Adorno", + "url": "https://ruyadorno.com", + "twitter": "ruyadorno" + } + ], + "license": "ISC", + "scripts": { + "lint": "eslint lib/*.js", + "pretest": "npm run lint", + "test": "tap test/*.js", + "snap": "tap test/*.js", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "tap": { + "check-coverage": true + }, + "devDependencies": { + "bin-links": "^2.2.1", + "eslint": "^7.24.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-standard": "^5.0.0", + "tap": "^15.0.2" + }, + "dependencies": { + "@npmcli/arborist": "^2.3.0", + "@npmcli/ci-detect": "^1.3.0", + "@npmcli/run-script": "^1.8.4", + "chalk": "^4.1.0", + "mkdirp-infer-owner": "^2.0.0", + "npm-package-arg": "^8.1.2", + "pacote": "^11.3.1", + "proc-log": "^1.0.0", + "read": "^1.0.7", + "read-package-json-fast": "^2.0.2" + } +} diff --git a/deps/npm/node_modules/libnpmhook/package.json b/deps/npm/node_modules/libnpmhook/package.json index abdac88e2c45fc..c2a3b2a3b8795c 100644 --- a/deps/npm/node_modules/libnpmhook/package.json +++ b/deps/npm/node_modules/libnpmhook/package.json @@ -1,6 +1,6 @@ { "name": "libnpmhook", - "version": "6.0.1", + "version": "6.0.2", "description": "programmatic API for managing npm registry hooks", "main": "index.js", "files": [ @@ -28,7 +28,7 @@ "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^10.0.0" }, "devDependencies": { "nock": "^9.6.1", diff --git a/deps/npm/node_modules/libnpmorg/package.json b/deps/npm/node_modules/libnpmorg/package.json index b6074ed8e4a7ce..d7e76f1d326808 100644 --- a/deps/npm/node_modules/libnpmorg/package.json +++ b/deps/npm/node_modules/libnpmorg/package.json @@ -1,6 +1,6 @@ { "name": "libnpmorg", - "version": "2.0.1", + "version": "2.0.2", "description": "Programmatic api for `npm org` commands", "author": "Kat Marchán <kzm@sykosomatic.org>", "keywords": [ @@ -40,7 +40,7 @@ "homepage": "https://npmjs.com/package/libnpmorg", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^10.0.0" }, "engines": { "node": ">=10" diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index 8476717a1c8e66..30bc4fda2530cf 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpublish", - "version": "4.0.0", + "version": "4.0.1", "description": "Programmatic API for the bits behind npm publish and unpublish", "author": "npm Inc. <support@npmjs.com>", "contributors": [ @@ -44,11 +44,11 @@ "bugs": "https://github.com/npm/libnpmpublish/issues", "homepage": "https://npmjs.com/package/libnpmpublish", "dependencies": { - "normalize-package-data": "^3.0.0", - "npm-package-arg": "^8.1.0", - "npm-registry-fetch": "^9.0.0", + "normalize-package-data": "^3.0.2", + "npm-package-arg": "^8.1.2", + "npm-registry-fetch": "^10.0.0", "semver": "^7.1.3", - "ssri": "^8.0.0" + "ssri": "^8.0.1" }, "engines": { "node": ">=10" diff --git a/deps/npm/node_modules/libnpmsearch/package.json b/deps/npm/node_modules/libnpmsearch/package.json index a32a194ae6a102..35e4a055572a12 100644 --- a/deps/npm/node_modules/libnpmsearch/package.json +++ b/deps/npm/node_modules/libnpmsearch/package.json @@ -1,6 +1,6 @@ { "name": "libnpmsearch", - "version": "3.1.0", + "version": "3.1.1", "description": "Programmatic API for searching in npm and compatible registries.", "author": "Kat Marchán <kzm@sykosomatic.org>", "files": [ @@ -36,7 +36,7 @@ "bugs": "https://github.com/npm/libnpmsearch/issues", "homepage": "https://npmjs.com/package/libnpmsearch", "dependencies": { - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^10.0.0" }, "engines": { "node": ">=10" diff --git a/deps/npm/node_modules/libnpmteam/package.json b/deps/npm/node_modules/libnpmteam/package.json index fc3bf5b3392d6f..b51f60a327a2ad 100644 --- a/deps/npm/node_modules/libnpmteam/package.json +++ b/deps/npm/node_modules/libnpmteam/package.json @@ -1,7 +1,7 @@ { "name": "libnpmteam", "description": "npm Team management APIs", - "version": "2.0.2", + "version": "2.0.3", "author": "Kat Marchán <kzm@zkat.tech>", "license": "ISC", "scripts": { @@ -27,7 +27,7 @@ "homepage": "https://npmjs.com/package/libnpmteam", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^10.0.0" }, "engines": { "node": ">=10" diff --git a/deps/npm/node_modules/libnpmversion/lib/commit.js b/deps/npm/node_modules/libnpmversion/lib/commit.js index bd621acb4393de..dec6edbec98c3d 100644 --- a/deps/npm/node_modules/libnpmversion/lib/commit.js +++ b/deps/npm/node_modules/libnpmversion/lib/commit.js @@ -1,14 +1,17 @@ const git = require('@npmcli/git') module.exports = (version, opts) => { - const {commitHooks, allowSameVersion, signGitCommit, message} = opts + const { commitHooks, allowSameVersion, signGitCommit, message } = opts const args = ['commit'] - if (commitHooks === false) + if (commitHooks === false) { args.push('-n') - if (allowSameVersion) + } + if (allowSameVersion) { args.push('--allow-empty') - if (signGitCommit) + } + if (signGitCommit) { args.push('-S') + } args.push('-m') return git.spawn([...args, message.replace(/%s/g, version)], opts) } diff --git a/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js b/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js index 980419ffb43d87..6103da9bd96af4 100644 --- a/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js +++ b/deps/npm/node_modules/libnpmversion/lib/enforce-clean.js @@ -15,17 +15,16 @@ module.exports = async opts => { hadError = true // how can merges be real if our git isn't real? return true - } else + } else { throw er + } }) if (!clean) { - if (!force) + if (!force) { throw new Error('Git working directory not clean.') - log.warn( - 'version', - 'Git working directory not clean, proceeding forcefully.' - ) + } + log.warn('version', 'Git working directory not clean, proceeding forcefully.') } return !hadError diff --git a/deps/npm/node_modules/libnpmversion/lib/index.js b/deps/npm/node_modules/libnpmversion/lib/index.js index 683941cdea4f35..b10b3e6ba4123a 100644 --- a/deps/npm/node_modules/libnpmversion/lib/index.js +++ b/deps/npm/node_modules/libnpmversion/lib/index.js @@ -16,7 +16,7 @@ module.exports = async (newversion, opts = {}) => { scriptShell = undefined, preid = null, log = proclog, - message = 'v%s', + message = 'v%s' } = opts const pkg = opts.pkg || await readJson(path + '/package.json') @@ -36,6 +36,6 @@ module.exports = async (newversion, opts = {}) => { preid, pkg, log, - message, + message }) } diff --git a/deps/npm/node_modules/libnpmversion/lib/read-json.js b/deps/npm/node_modules/libnpmversion/lib/read-json.js index 0a1f64f2f70e7e..2dd0f7aa4902e8 100644 --- a/deps/npm/node_modules/libnpmversion/lib/read-json.js +++ b/deps/npm/node_modules/libnpmversion/lib/read-json.js @@ -1,6 +1,6 @@ // can't use read-package-json-fast, because we want to ensure // that we make as few changes as possible, even for safety issues. -const {promisify} = require('util') +const { promisify } = require('util') const readFile = promisify(require('fs').readFile) const parse = require('json-parse-even-better-errors') diff --git a/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js b/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js index b657561b861e76..7aa2abfda86516 100644 --- a/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js +++ b/deps/npm/node_modules/libnpmversion/lib/retrieve-tag.js @@ -1,11 +1,11 @@ -const {spawn} = require('@npmcli/git') +const { spawn } = require('@npmcli/git') const semver = require('semver') module.exports = async opts => { - const tag = (await spawn(['describe', '--abbrev=0'], opts)).stdout.trim() - const match = tag.match(/v?(\d+\.\d+\.\d+(?:[-+].+)?)/) - const ver = match && semver.clean(match[1], { loose: true }) - if (ver) - return ver + const tag = (await spawn(['describe', '--tags', '--abbrev=0', '--match=\'*.*.*\''], opts)).stdout.trim() + const ver = semver.coerce(tag, { loose: true }) + if (ver) { + return ver.version + } throw new Error(`Tag is not a valid version: ${JSON.stringify(tag)}`) } diff --git a/deps/npm/node_modules/libnpmversion/lib/tag.js b/deps/npm/node_modules/libnpmversion/lib/tag.js index bd6c803a384998..73134dd25e6fe3 100644 --- a/deps/npm/node_modules/libnpmversion/lib/tag.js +++ b/deps/npm/node_modules/libnpmversion/lib/tag.js @@ -1,20 +1,30 @@ const git = require('@npmcli/git') module.exports = async (version, opts) => { - const { signGitTag, allowSameVersion, tagVersionPrefix, message } = opts - const tag = `${tagVersionPrefix}${version}` + const { + signGitTag, + allowSameVersion, + tagVersionPrefix, + message + } = opts + const tag = `${tagVersionPrefix}${version}` const flags = ['-'] - if (signGitTag) + + if (signGitTag) { flags.push('s') - if (allowSameVersion) + } + + if (allowSameVersion) { flags.push('f') + } + flags.push('m') return git.spawn([ 'tag', flags.join(''), message.replace(/%s/g, version), - tag, + tag ], opts) } diff --git a/deps/npm/node_modules/libnpmversion/lib/version.js b/deps/npm/node_modules/libnpmversion/lib/version.js index 0fe1ea6213fc6f..2ef79173fca765 100644 --- a/deps/npm/node_modules/libnpmversion/lib/version.js +++ b/deps/npm/node_modules/libnpmversion/lib/version.js @@ -15,31 +15,30 @@ module.exports = async (newversion, opts) => { const { path, allowSameVersion, - tagVersionPrefix, - commitHooks, gitTagVersion, - signGitCommit, - signGitTag, - force, ignoreScripts, preid, pkg, - log, - message, + log } = opts const { valid, clean, inc } = semver const current = pkg.version || '0.0.0' const currentClean = clean(current) - const newV = valid(newversion, { loose: true }) ? clean(newversion, { loose: true }) - : newversion === 'from-git' ? await retrieveTag(opts) - : inc(currentClean, newversion, { loose: true }, preid) + let newV + if (valid(newversion, { loose: true })) { + newV = clean(newversion, { loose: true }) + } else if (newversion === 'from-git') { + newV = await retrieveTag(opts) + } else { + newV = inc(currentClean, newversion, { loose: true }, preid) + } if (!newV) { throw Object.assign(new Error('Invalid version: ' + newversion), { current, - requested: newversion, + requested: newversion }) } @@ -47,7 +46,7 @@ module.exports = async (newversion, opts) => { throw Object.assign(new Error('Version not changed'), { current, requested: newversion, - newVersion: newV, + newVersion: newV }) } @@ -68,8 +67,8 @@ module.exports = async (newversion, opts) => { banner: log.level !== 'silent', env: { npm_old_version: current, - npm_new_version: newV, - }, + npm_new_version: newV + } }) } @@ -102,8 +101,8 @@ module.exports = async (newversion, opts) => { banner: log.level !== 'silent', env: { npm_old_version: current, - npm_new_version: newV, - }, + npm_new_version: newV + } }) } @@ -116,8 +115,7 @@ module.exports = async (newversion, opts) => { } await commit(newV, opts) await tag(newV, opts) - } else - log.verbose('version', 'Not tagging: not in a git repo or no git cmd') + } else { log.verbose('version', 'Not tagging: not in a git repo or no git cmd') } if (!ignoreScripts) { await runScript({ @@ -128,8 +126,8 @@ module.exports = async (newversion, opts) => { banner: log.level !== 'silent', env: { npm_old_version: current, - npm_new_version: newV, - }, + npm_new_version: newV + } }) } diff --git a/deps/npm/node_modules/libnpmversion/lib/write-json.js b/deps/npm/node_modules/libnpmversion/lib/write-json.js index 30ca1af0f19edc..813bb7ffc279b6 100644 --- a/deps/npm/node_modules/libnpmversion/lib/write-json.js +++ b/deps/npm/node_modules/libnpmversion/lib/write-json.js @@ -1,5 +1,5 @@ // write the json back, preserving the line breaks and indent -const {promisify} = require('util') +const { promisify } = require('util') const writeFile = promisify(require('fs').writeFile) const kIndent = Symbol.for('indent') const kNewline = Symbol.for('newline') @@ -7,7 +7,7 @@ const kNewline = Symbol.for('newline') module.exports = async (path, pkg) => { const { [kIndent]: indent = 2, - [kNewline]: newline = '\n', + [kNewline]: newline = '\n' } = pkg delete pkg._id const raw = JSON.stringify(pkg, null, indent) + '\n' diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index 30d94c7a14699e..ebc88a1fc57543 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,6 +1,6 @@ { "name": "libnpmversion", - "version": "1.1.0", + "version": "1.2.0", "main": "lib/index.js", "files": [ "lib/*.js" @@ -13,25 +13,34 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", "license": "ISC", "scripts": { + "lint": "standard", + "lint:fix": "standard --fix", "test": "tap", + "posttest": "npm run lint", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags" }, + "standard": { + "ignore": [ + "tap-snapshots" + ] + }, "tap": { "coverage-map": "map.js", "check-coverage": true }, "devDependencies": { "require-inject": "^1.4.4", + "standard": "^16.0.3", "tap": "^14.11.0" }, "dependencies": { - "@npmcli/git": "^2.0.6", - "@npmcli/run-script": "^1.8.3", + "@npmcli/git": "^2.0.7", + "@npmcli/run-script": "^1.8.4", "json-parse-even-better-errors": "^2.3.1", - "semver": "^7.3.4", + "semver": "^7.3.5", "stringify-package": "^1.0.1" } } diff --git a/deps/npm/node_modules/mime-db/HISTORY.md b/deps/npm/node_modules/mime-db/HISTORY.md index aff74740dc55e5..1555055e8a7956 100644 --- a/deps/npm/node_modules/mime-db/HISTORY.md +++ b/deps/npm/node_modules/mime-db/HISTORY.md @@ -1,3 +1,10 @@ +1.47.0 / 2021-04-01 +=================== + + * Add new upstream MIME types + * Remove ambigious extensions from IANA for `application/*+xml` types + * Update primary extension to `.es` for `application/ecmascript` + 1.46.0 / 2021-02-13 =================== diff --git a/deps/npm/node_modules/mime-db/README.md b/deps/npm/node_modules/mime-db/README.md index 8f1d8c4e53ffd7..41c696a30dfa15 100644 --- a/deps/npm/node_modules/mime-db/README.md +++ b/deps/npm/node_modules/mime-db/README.md @@ -34,8 +34,6 @@ https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json ## Usage -<!-- eslint-disable no-unused-vars --> - ```js var db = require('mime-db') diff --git a/deps/npm/node_modules/mime-db/db.json b/deps/npm/node_modules/mime-db/db.json index 4871607a58a980..63c189ea2687ba 100644 --- a/deps/npm/node_modules/mime-db/db.json +++ b/deps/npm/node_modules/mime-db/db.json @@ -389,7 +389,7 @@ "application/ecmascript": { "source": "iana", "compressible": true, - "extensions": ["ecma","es"] + "extensions": ["es","ecma"] }, "application/edi-consent": { "source": "iana" @@ -934,13 +934,11 @@ }, "application/mrb-consumer+xml": { "source": "iana", - "compressible": true, - "extensions": ["xdf"] + "compressible": true }, "application/mrb-publish+xml": { "source": "iana", - "compressible": true, - "extensions": ["xdf"] + "compressible": true }, "application/msc-ivr+xml": { "source": "iana", @@ -2321,6 +2319,9 @@ "application/vnd.crypto-shade-file": { "source": "iana" }, + "application/vnd.cryptomator.encrypted": { + "source": "iana" + }, "application/vnd.ctc-posml": { "source": "iana", "extensions": ["pml"] @@ -3786,6 +3787,9 @@ "source": "iana", "compressible": true }, + "application/vnd.nebumind.line": { + "source": "iana" + }, "application/vnd.nervana": { "source": "iana" }, @@ -6071,8 +6075,7 @@ }, "application/xcap-error+xml": { "source": "iana", - "compressible": true, - "extensions": ["xer"] + "compressible": true }, "application/xcap-ns+xml": { "source": "iana", @@ -7400,6 +7403,10 @@ "model/vnd.rosette.annotated-data-model": { "source": "iana" }, + "model/vnd.sap.vds": { + "source": "iana", + "extensions": ["vds"] + }, "model/vnd.usdz+zip": { "source": "iana", "compressible": false, @@ -7980,6 +7987,9 @@ "video/encaprtp": { "source": "iana" }, + "video/ffv1": { + "source": "iana" + }, "video/flexfec": { "source": "iana" }, diff --git a/deps/npm/node_modules/mime-db/package.json b/deps/npm/node_modules/mime-db/package.json index ec0328404d9490..bd6403fb68f9f1 100644 --- a/deps/npm/node_modules/mime-db/package.json +++ b/deps/npm/node_modules/mime-db/package.json @@ -1,7 +1,7 @@ { "name": "mime-db", "description": "Media Type Database", - "version": "1.46.0", + "version": "1.47.0", "contributors": [ "Douglas Christopher Wilson <doug@somethingdoug.com>", "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", @@ -22,16 +22,16 @@ "bluebird": "3.7.2", "co": "4.6.0", "cogent": "1.0.1", - "csv-parse": "4.15.1", - "eslint": "7.20.0", + "csv-parse": "4.15.3", + "eslint": "7.23.0", "eslint-config-standard": "15.0.1", "eslint-plugin-import": "2.22.1", - "eslint-plugin-markdown": "1.0.2", + "eslint-plugin-markdown": "2.0.0", "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "4.3.1", "eslint-plugin-standard": "4.1.0", "gnode": "0.1.2", - "mocha": "8.3.0", + "mocha": "8.3.2", "nyc": "15.1.0", "raw-body": "2.4.1", "stream-to-array": "2.3.0" @@ -49,7 +49,7 @@ "scripts": { "build": "node scripts/build", "fetch": "node scripts/fetch-apache && gnode scripts/fetch-iana && node scripts/fetch-nginx", - "lint": "eslint --plugin markdown --ext js,md .", + "lint": "eslint .", "test": "mocha --reporter spec --bail --check-leaks test/", "test-ci": "nyc --reporter=lcov --reporter=text npm test", "test-cov": "nyc --reporter=html --reporter=text npm test", diff --git a/deps/npm/node_modules/mime-types/HISTORY.md b/deps/npm/node_modules/mime-types/HISTORY.md index 2e50fc84a4d883..38472bee131e46 100644 --- a/deps/npm/node_modules/mime-types/HISTORY.md +++ b/deps/npm/node_modules/mime-types/HISTORY.md @@ -1,3 +1,11 @@ +2.1.30 / 2021-04-02 +=================== + + * deps: mime-db@1.47.0 + - Add extension `.amr` to `audio/amr` + - Remove ambigious extensions from IANA for `application/*+xml` types + - Update primary extension to `.es` for `application/ecmascript` + 2.1.29 / 2021-02-17 =================== diff --git a/deps/npm/node_modules/mime-types/package.json b/deps/npm/node_modules/mime-types/package.json index 9ed59e843e7261..ea53dd22aa1d38 100644 --- a/deps/npm/node_modules/mime-types/package.json +++ b/deps/npm/node_modules/mime-types/package.json @@ -1,7 +1,7 @@ { "name": "mime-types", "description": "The ultimate javascript content-type utility.", - "version": "2.1.29", + "version": "2.1.30", "contributors": [ "Douglas Christopher Wilson <doug@somethingdoug.com>", "Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)", @@ -14,17 +14,17 @@ ], "repository": "jshttp/mime-types", "dependencies": { - "mime-db": "1.46.0" + "mime-db": "1.47.0" }, "devDependencies": { - "eslint": "7.20.0", + "eslint": "7.23.0", "eslint-config-standard": "14.1.1", "eslint-plugin-import": "2.22.1", "eslint-plugin-markdown": "2.0.0", "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "4.3.1", "eslint-plugin-standard": "4.1.0", - "mocha": "8.3.0", + "mocha": "8.3.2", "nyc": "15.1.0" }, "files": [ diff --git a/deps/npm/node_modules/npm-bundled/index.js b/deps/npm/node_modules/npm-bundled/index.js index 197a1bcb99a153..378ddc4c5ddb2b 100644 --- a/deps/npm/node_modules/npm-bundled/index.js +++ b/deps/npm/node_modules/npm-bundled/index.js @@ -135,9 +135,11 @@ class BundleWalker extends EE { } childDep (dep) { - if (this.node_modules.indexOf(dep) !== -1 && !this.seen.has(dep)) { - this.seen.add(dep) - this.child(dep) + if (this.node_modules.indexOf(dep) !== -1) { + if (!this.seen.has(dep)) { + this.seen.add(dep) + this.child(dep) + } } else if (this.parent) { this.parent.childDep(dep) } diff --git a/deps/npm/node_modules/npm-bundled/package.json b/deps/npm/node_modules/npm-bundled/package.json index 2ce536e673ee3c..cf20e297b0b639 100644 --- a/deps/npm/node_modules/npm-bundled/package.json +++ b/deps/npm/node_modules/npm-bundled/package.json @@ -1,6 +1,6 @@ { "name": "npm-bundled", - "version": "1.1.1", + "version": "1.1.2", "description": "list things in node_modules that are bundledDependencies, or transitive dependencies thereof", "main": "index.js", "repository": { diff --git a/deps/npm/node_modules/npm-profile/package.json b/deps/npm/node_modules/npm-profile/package.json index 233381a38ec7b6..7e2acc4d075255 100644 --- a/deps/npm/node_modules/npm-profile/package.json +++ b/deps/npm/node_modules/npm-profile/package.json @@ -1,12 +1,12 @@ { "name": "npm-profile", - "version": "5.0.2", + "version": "5.0.3", "description": "Library for updating an npmjs.com profile", "keywords": [], "author": "Rebecca Turner <me@re-becca.org> (http://re-becca.org/)", "license": "ISC", "dependencies": { - "npm-registry-fetch": "^9.0.0" + "npm-registry-fetch": "^10.0.0" }, "main": "index.js", "repository": { diff --git a/deps/npm/node_modules/npm-registry-fetch/README.md b/deps/npm/node_modules/npm-registry-fetch/README.md index f5ae9cac31a03e..5ce9770c604cf7 100644 --- a/deps/npm/node_modules/npm-registry-fetch/README.md +++ b/deps/npm/node_modules/npm-registry-fetch/README.md @@ -309,13 +309,6 @@ previously-generated integrity hash for the saved request information, so `EINTEGRITY` errors can happen if [`opts.cache`](#opts-cache) is used, even if `opts.integrity` is not passed in. -##### <a name='opts-isFromCI'></a> `opts.isFromCI` - -* Type: Boolean -* Default: Based on environment variables - -This is used to populate the `npm-in-ci` request header sent to the registry. - ##### <a name="opts-key"></a> `opts.key` * Type: String @@ -425,6 +418,19 @@ This is a one-time password from a two-factor authenticator. It is required for certain registry interactions when two-factor auth is enabled for a user account. +##### <a name="opts-otpPrompt"></a> `opts.otpPrompt` + +* Type: Function +* Default: null + +This is a method which will be called to provide an OTP if the server +responds with a 401 response indicating that a one-time-password is +required. + +It may return a promise, which must resolve to the OTP value to be used. +If the method fails to provide an OTP value, then the fetch will fail with +the auth error that indicated an OTP was needed. + ##### <a name="opts-password"></a> `opts.password` * Alias: `_password` diff --git a/deps/npm/node_modules/npm-registry-fetch/auth.js b/deps/npm/node_modules/npm-registry-fetch/auth.js index e096a6f98f9a43..80aed9cac7e6c9 100644 --- a/deps/npm/node_modules/npm-registry-fetch/auth.js +++ b/deps/npm/node_modules/npm-registry-fetch/auth.js @@ -1,55 +1,111 @@ 'use strict' +const npa = require('npm-package-arg') -const defaultOpts = require('./default-opts.js') -const url = require('url') +// Find the longest registry key that is used for some kind of auth +// in the options. +const regKeyFromURI = (uri, opts) => { + const parsed = new URL(uri) + // try to find a config key indicating we have auth for this registry + // can be one of :_authToken, :_auth, or :_password and :username + // We walk up the "path" until we're left with just //<host>[:<port>], + // stopping when we reach '//'. + let regKey = `//${parsed.host}${parsed.pathname}` + while (regKey.length > '//'.length) { + // got some auth for this URI + if (hasAuth(regKey, opts)) + return regKey -module.exports = getAuth -function getAuth (registry, opts_ = {}) { - if (!registry) - throw new Error('registry is required') - const opts = opts_.forceAuth ? opts_.forceAuth : { ...defaultOpts, ...opts_ } - const AUTH = {} - const regKey = registry && registryKey(registry) - const doKey = (key, alias) => addKey(opts, AUTH, regKey, key, alias) - doKey('token') - doKey('_authToken', 'token') - doKey('username') - doKey('password') - doKey('_password', 'password') - doKey('email') - doKey('_auth') - doKey('otp') - doKey('always-auth', 'alwaysAuth') - if (AUTH.password) - AUTH.password = Buffer.from(AUTH.password, 'base64').toString('utf8') - - if (AUTH._auth && !(AUTH.username && AUTH.password)) { - let auth = Buffer.from(AUTH._auth, 'base64').toString() - auth = auth.split(':') - AUTH.username = auth.shift() - AUTH.password = auth.join(':') + // can be either //host/some/path/:_auth or //host/some/path:_auth + // walk up by removing EITHER what's after the slash OR the slash itself + regKey = regKey.replace(/([^/]+|\/)$/, '') } - AUTH.alwaysAuth = AUTH.alwaysAuth === 'false' ? false : !!AUTH.alwaysAuth - return AUTH } -function addKey (opts, obj, scope, key, objKey) { - if (opts[key]) - obj[objKey || key] = opts[key] +const hasAuth = (regKey, opts) => ( + opts[`${regKey}:_authToken`] || + opts[`${regKey}:_auth`] || + opts[`${regKey}:username`] && opts[`${regKey}:_password`] +) + +const sameHost = (a, b) => { + const parsedA = new URL(a) + const parsedB = new URL(b) + return parsedA.host === parsedB.host +} - if (scope && opts[`${scope}:${key}`]) - obj[objKey || key] = opts[`${scope}:${key}`] +const getRegistry = opts => { + const { spec } = opts + const { scope: specScope, subSpec } = spec ? npa(spec) : {} + const subSpecScope = subSpec && subSpec.scope + const scope = subSpec ? subSpecScope : specScope + const scopeReg = scope && opts[`${scope}:registry`] + return scopeReg || opts.registry } -// Called a nerf dart in the main codebase. Used as a "safe" -// key when fetching registry info from config. -function registryKey (registry) { - const parsed = new url.URL(registry) - const formatted = url.format({ - protocol: parsed.protocol, - host: parsed.host, - pathname: parsed.pathname, - slashes: true, +const getAuth = (uri, opts = {}) => { + const { forceAuth } = opts + if (!uri) + throw new Error('URI is required') + const regKey = regKeyFromURI(uri, forceAuth || opts) + + // we are only allowed to use what's in forceAuth if specified + if (forceAuth && !regKey) { + return new Auth({ + scopeAuthKey: null, + token: forceAuth._authToken, + username: forceAuth.username, + password: forceAuth._password || forceAuth.password, + auth: forceAuth._auth || forceAuth.auth, + }) + } + + // no auth for this URI, but might have it for the registry + if (!regKey) { + const registry = getRegistry(opts) + if (registry && uri !== registry && sameHost(uri, registry)) + return getAuth(registry, opts) + else if (registry !== opts.registry) { + // If making a tarball request to a different base URI than the + // registry where we logged in, but the same auth SHOULD be sent + // to that artifact host, then we track where it was coming in from, + // and warn the user if we get a 4xx error on it. + const scopeAuthKey = regKeyFromURI(registry, opts) + return new Auth({ scopeAuthKey }) + } + } + + const { + [`${regKey}:_authToken`]: token, + [`${regKey}:username`]: username, + [`${regKey}:_password`]: password, + [`${regKey}:_auth`]: auth, + } = opts + + return new Auth({ + scopeAuthKey: null, + token, + auth, + username, + password, }) - return url.format(new url.URL('.', formatted)).replace(/^[^:]+:/, '') } + +class Auth { + constructor ({ token, auth, username, password, scopeAuthKey }) { + this.scopeAuthKey = scopeAuthKey + this.token = null + this.auth = null + this.isBasicAuth = false + if (token) + this.token = token + else if (auth) + this.auth = auth + else if (username && password) { + const p = Buffer.from(password, 'base64').toString('utf8') + this.auth = Buffer.from(`${username}:${p}`, 'utf8').toString('base64') + this.isBasicAuth = true + } + } +} + +module.exports = getAuth diff --git a/deps/npm/node_modules/npm-registry-fetch/check-response.js b/deps/npm/node_modules/npm-registry-fetch/check-response.js index 5154da5349f76e..7610e0d7a7ad2e 100644 --- a/deps/npm/node_modules/npm-registry-fetch/check-response.js +++ b/deps/npm/node_modules/npm-registry-fetch/check-response.js @@ -5,15 +5,25 @@ const LRU = require('lru-cache') const { Response } = require('minipass-fetch') const defaultOpts = require('./default-opts.js') -module.exports = checkResponse -function checkResponse (method, res, registry, startTime, opts_ = {}) { - const opts = { ...defaultOpts, ...opts_ } +const checkResponse = async ({ method, uri, res, registry, startTime, auth, opts }) => { + opts = { ...defaultOpts, ...opts } if (res.headers.has('npm-notice') && !res.headers.has('x-local-cache')) opts.log.notice('', res.headers.get('npm-notice')) checkWarnings(res, registry, opts) if (res.status >= 400) { logRequest(method, res, startTime, opts) + if (auth && auth.scopeAuthKey && !auth.token && !auth.auth) { + // we didn't have auth for THIS request, but we do have auth for + // requests to the registry indicated by the spec's scope value. + // Warn the user. + opts.log.warn('registry', `No auth for URI, but auth present for scoped registry. + +URI: ${uri} +Scoped Registry Key: ${auth.scopeAuthKey} + +More info here: https://github.com/npm/cli/wiki/No-auth-for-URI,-but-auth-present-for-scoped-registry`) + } return checkErrors(method, res, startTime, opts) } else { res.body.on('end', () => logRequest(method, res, startTime, opts)) @@ -24,6 +34,7 @@ function checkResponse (method, res, registry, startTime, opts_ = {}) { return res } } +module.exports = checkResponse function logRequest (method, res, startTime, opts) { const elapsedTime = Date.now() - startTime diff --git a/deps/npm/node_modules/npm-registry-fetch/default-opts.js b/deps/npm/node_modules/npm-registry-fetch/default-opts.js index fb8021d6b742ff..9ca3f97d0352e9 100644 --- a/deps/npm/node_modules/npm-registry-fetch/default-opts.js +++ b/deps/npm/node_modules/npm-registry-fetch/default-opts.js @@ -1,7 +1,5 @@ const pkg = require('./package.json') -const ciDetect = require('@npmcli/ci-detect') module.exports = { - isFromCI: ciDetect(), log: require('./silentlog.js'), maxSockets: 12, method: 'GET', diff --git a/deps/npm/node_modules/npm-registry-fetch/errors.js b/deps/npm/node_modules/npm-registry-fetch/errors.js index 69671551dc6190..e65e5fbd80ddaf 100644 --- a/deps/npm/node_modules/npm-registry-fetch/errors.js +++ b/deps/npm/node_modules/npm-registry-fetch/errors.js @@ -22,6 +22,7 @@ function packageName (href) { class HttpErrorBase extends Error { constructor (method, res, body, spec) { super() + this.name = this.constructor.name this.headers = res.headers.raw() this.statusCode = res.status this.code = `E${res.status}` diff --git a/deps/npm/node_modules/npm-registry-fetch/index.js b/deps/npm/node_modules/npm-registry-fetch/index.js index df3b49eb52969c..5411b51e58abca 100644 --- a/deps/npm/node_modules/npm-registry-fetch/index.js +++ b/deps/npm/node_modules/npm-registry-fetch/index.js @@ -1,5 +1,6 @@ 'use strict' +const { HttpErrorAuthOTP } = require('./errors.js') const checkResponse = require('./check-response.js') const getAuth = require('./auth.js') const fetch = require('make-fetch-happen') @@ -27,26 +28,32 @@ function regFetch (uri, /* istanbul ignore next */ opts_ = {}) { ...defaultOpts, ...opts_, } - const registry = opts.registry = ( - (opts.spec && pickRegistry(opts.spec, opts)) || - opts.registry || - /* istanbul ignore next */ - 'https://registry.npmjs.org/' - ) - - if (!urlIsValid(uri)) { + + // if we did not get a fully qualified URI, then we look at the registry + // config or relevant scope to resolve it. + const uriValid = urlIsValid(uri) + let registry = opts.registry || defaultOpts.registry + if (!uriValid) { + registry = opts.registry = ( + (opts.spec && pickRegistry(opts.spec, opts)) || + opts.registry || + registry + ) uri = `${ registry.trim().replace(/\/?$/g, '') }/${ uri.trim().replace(/^\//, '') }` + // asserts that this is now valid + new url.URL(uri) } const method = opts.method || 'GET' // through that takes into account the scope, the prefix of `uri`, etc const startTime = Date.now() - const headers = getHeaders(registry, uri, opts) + const auth = getAuth(uri, opts) + const headers = getHeaders(uri, auth, opts) let body = opts.body const bodyIsStream = Minipass.isStream(body) const bodyIsPromise = body && @@ -92,34 +99,57 @@ function regFetch (uri, /* istanbul ignore next */ opts_ = {}) { opts.preferOnline = true } - const doFetch = (body) => fetch(uri, { - agent: opts.agent, - algorithms: opts.algorithms, - body, - cache: getCacheMode(opts), - cacheManager: opts.cache, - ca: opts.ca, - cert: opts.cert, - headers, - integrity: opts.integrity, - key: opts.key, - localAddress: opts.localAddress, - maxSockets: opts.maxSockets, - memoize: opts.memoize, - method: method, - noProxy: opts.noProxy, - proxy: opts.httpsProxy || opts.proxy, - retry: opts.retry ? opts.retry : { - retries: opts.fetchRetries, - factor: opts.fetchRetryFactor, - minTimeout: opts.fetchRetryMintimeout, - maxTimeout: opts.fetchRetryMaxtimeout, - }, - strictSSL: opts.strictSSL, - timeout: opts.timeout || 30 * 1000, - }).then(res => checkResponse( - method, res, registry, startTime, opts - )) + const doFetch = async body => { + const p = fetch(uri, { + agent: opts.agent, + algorithms: opts.algorithms, + body, + cache: getCacheMode(opts), + cacheManager: opts.cache, + ca: opts.ca, + cert: opts.cert, + headers, + integrity: opts.integrity, + key: opts.key, + localAddress: opts.localAddress, + maxSockets: opts.maxSockets, + memoize: opts.memoize, + method: method, + noProxy: opts.noProxy, + proxy: opts.httpsProxy || opts.proxy, + retry: opts.retry ? opts.retry : { + retries: opts.fetchRetries, + factor: opts.fetchRetryFactor, + minTimeout: opts.fetchRetryMintimeout, + maxTimeout: opts.fetchRetryMaxtimeout, + }, + strictSSL: opts.strictSSL, + timeout: opts.timeout || 30 * 1000, + }).then(res => checkResponse({ + method, + uri, + res, + registry, + startTime, + auth, + opts, + })) + + if (typeof opts.otpPrompt === 'function') { + return p.catch(async er => { + if (er instanceof HttpErrorAuthOTP) { + // if otp fails to complete, we fail with that failure + const otp = await opts.otpPrompt() + // if no otp provided, throw the original HTTP error + if (!otp) + throw er + return regFetch(uri, { ...opts, otp }) + } + throw er + }) + } else + return p + } return Promise.resolve(body).then(doFetch) } @@ -151,7 +181,7 @@ function pickRegistry (spec, opts = {}) { registry = opts[opts.scope.replace(/^@?/, '@') + ':registry'] if (!registry) - registry = opts.registry || 'https://registry.npmjs.org/' + registry = opts.registry || defaultOpts.registry return registry } @@ -163,9 +193,8 @@ function getCacheMode (opts) { : 'default' } -function getHeaders (registry, uri, opts) { +function getHeaders (uri, auth, opts) { const headers = Object.assign({ - 'npm-in-ci': !!opts.isFromCI, 'user-agent': opts.userAgent, }, opts.headers || {}) @@ -178,25 +207,15 @@ function getHeaders (registry, uri, opts) { if (opts.npmCommand) headers['npm-command'] = opts.npmCommand - const auth = getAuth(registry, opts) // If a tarball is hosted on a different place than the manifest, only send // credentials on `alwaysAuth` - const shouldAuth = ( - auth.alwaysAuth || - new url.URL(uri).host === new url.URL(registry).host - ) - if (shouldAuth && auth.token) + if (auth.token) headers.authorization = `Bearer ${auth.token}` - else if (shouldAuth && auth.username && auth.password) { - const encoded = Buffer.from( - `${auth.username}:${auth.password}`, 'utf8' - ).toString('base64') - headers.authorization = `Basic ${encoded}` - } else if (shouldAuth && auth._auth) - headers.authorization = `Basic ${auth._auth}` - - if (shouldAuth && auth.otp) - headers['npm-otp'] = auth.otp + else if (auth.auth) + headers.authorization = `Basic ${auth.auth}` + + if (opts.otp) + headers['npm-otp'] = opts.otp return headers } diff --git a/deps/npm/node_modules/npm-registry-fetch/package.json b/deps/npm/node_modules/npm-registry-fetch/package.json index 40e0067b4aedb9..8afda92595fbef 100644 --- a/deps/npm/node_modules/npm-registry-fetch/package.json +++ b/deps/npm/node_modules/npm-registry-fetch/package.json @@ -1,6 +1,6 @@ { "name": "npm-registry-fetch", - "version": "9.0.0", + "version": "10.1.1", "description": "Fetch-based http client for use with npm registry APIs", "main": "index.js", "files": [ @@ -29,7 +29,6 @@ }, "license": "ISC", "dependencies": { - "@npmcli/ci-detect": "^1.0.0", "lru-cache": "^6.0.0", "make-fetch-happen": "^8.0.9", "minipass": "^3.1.3", @@ -51,7 +50,7 @@ "require-inject": "^1.4.4", "rimraf": "^2.6.2", "ssri": "^8.0.0", - "tap": "^14.10.7" + "tap": "^15.0.4" }, "tap": { "check-coverage": true, diff --git a/deps/npm/node_modules/pacote/lib/fetcher.js b/deps/npm/node_modules/pacote/lib/fetcher.js index c9a3201f0ae4ab..d488e88ff72369 100644 --- a/deps/npm/node_modules/pacote/lib/fetcher.js +++ b/deps/npm/node_modules/pacote/lib/fetcher.js @@ -40,6 +40,7 @@ const _istream = Symbol('_istream') const _assertType = Symbol('_assertType') const _tarballFromCache = Symbol('_tarballFromCache') const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') +const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches') class FetcherBase { constructor (spec, opts) { @@ -166,25 +167,19 @@ class FetcherBase { } // private, should be overridden. - // Note that they should *not* calculate or check integrity, but *just* - // return the raw tarball data stream. + // Note that they should *not* calculate or check integrity or cache, + // but *just* return the raw tarball data stream. [_tarballFromResolved] () { throw this.notImplementedError } // public, should not be overridden tarball () { - return this.tarballStream(stream => new Promise((res, rej) => { - const buf = [] - stream.on('error', er => rej(er)) - stream.on('end', () => { - const data = Buffer.concat(buf) - data.integrity = this.integrity && String(this.integrity) - data.resolved = this.resolved - data.from = this.from - return res(data) - }) - stream.on('data', d => buf.push(d)) + return this.tarballStream(stream => stream.concat().then(data => { + data.integrity = this.integrity && String(this.integrity) + data.resolved = this.resolved + data.from = this.from + return data })) } @@ -194,6 +189,10 @@ class FetcherBase { return cacache.get.stream.byDigest(this.cache, this.integrity, this.opts) } + get [_cacheFetches] () { + return true + } + [_istream] (stream) { // everyone will need one of these, either for verifying or calculating // We always set it, because we have might only have a weak legacy hex @@ -203,7 +202,31 @@ class FetcherBase { // gets to the point of re-setting the integrity. const istream = ssri.integrityStream(this.opts) istream.on('integrity', i => this.integrity = i) - return stream.on('error', er => istream.emit('error', er)).pipe(istream) + stream.on('error', er => istream.emit('error', er)) + + // if not caching this, just pipe through to the istream and return it + if (!this.opts.cache || !this[_cacheFetches]) + return stream.pipe(istream) + + // we have to return a stream that gets ALL the data, and proxies errors, + // but then pipe from the original tarball stream into the cache as well. + // To do this without losing any data, and since the cacache put stream + // is not a passthrough, we have to pipe from the original stream into + // the cache AFTER we pipe into the istream. Since the cache stream + // has an asynchronous flush to write its contents to disk, we need to + // defer the istream end until the cache stream ends. + stream.pipe(istream, { end: false }) + const cstream = cacache.put.stream( + this.opts.cache, + `pacote:tarball:${this.from}`, + this.opts + ) + stream.pipe(cstream) + // defer istream end until after cstream + // cache write errors should not crash the fetch, this is best-effort. + cstream.promise().catch(() => {}).then(() => istream.end()) + + return istream } pickIntegrityAlgorithm () { @@ -232,7 +255,9 @@ class FetcherBase { // An ENOENT trying to read a tgz file, for example, is Right Out. isRetriableError (er) { // TODO: check error class, once those are rolled out to our deps - return this.isDataCorruptionError(er) || er.code === 'ENOENT' + return this.isDataCorruptionError(er) || + er.code === 'ENOENT' || + er.code === 'EISDIR' } // Mostly internal, but has some uses diff --git a/deps/npm/node_modules/pacote/lib/registry.js b/deps/npm/node_modules/pacote/lib/registry.js index 537610d2990d09..e0a310717420d4 100644 --- a/deps/npm/node_modules/pacote/lib/registry.js +++ b/deps/npm/node_modules/pacote/lib/registry.js @@ -3,6 +3,7 @@ const RemoteFetcher = require('./remote.js') const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') const pacoteVersion = require('../package.json').version const npa = require('npm-package-arg') +const rpj = require('read-package-json-fast') const pickManifest = require('npm-pick-manifest') const ssri = require('ssri') const Minipass = require('minipass') @@ -156,7 +157,8 @@ class RegistryFetcher extends Fetcher { } if (this.integrity) mani._integrity = String(this.integrity) - return this.package = mani + this.package = rpj.normalize(mani) + return this.package }) } diff --git a/deps/npm/node_modules/pacote/lib/remote.js b/deps/npm/node_modules/pacote/lib/remote.js index 91f6eb59daa6f9..727a8bfc8e608d 100644 --- a/deps/npm/node_modules/pacote/lib/remote.js +++ b/deps/npm/node_modules/pacote/lib/remote.js @@ -8,6 +8,7 @@ const Minipass = require('minipass') // The default registry URL is a string of great magic. const magic = /^https?:\/\/registry\.npmjs\.org\// +const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches') const _headers = Symbol('_headers') class RemoteFetcher extends Fetcher { constructor (spec, opts) { @@ -21,6 +22,12 @@ class RemoteFetcher extends Fetcher { this.pkgid = opts.pkgid ? opts.pkgid : `remote:${nameat}${this.resolved}` } + // Don't need to cache tarball fetches in pacote, because make-fetch-happen + // will write into cacache anyway. + get [_cacheFetches] () { + return false + } + [_tarballFromResolved] () { const stream = new Minipass() const fetchOpts = { diff --git a/deps/npm/node_modules/pacote/package.json b/deps/npm/node_modules/pacote/package.json index dd6bf9400c6ea3..2461b055bfd13c 100644 --- a/deps/npm/node_modules/pacote/package.json +++ b/deps/npm/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "11.3.1", + "version": "11.3.3", "description": "JavaScript package downloader", "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", "bin": { @@ -17,15 +17,12 @@ }, "tap": { "timeout": 300, - "check-coverage": true, - "coverage-map": "map.js", - "esm": false + "coverage-map": "map.js" }, "devDependencies": { "mutate-fs": "^2.1.1", "npm-registry-mock": "^1.3.1", - "require-inject": "^1.4.4", - "tap": "^14.11.0" + "tap": "^15.0.4" }, "files": [ "lib/**/*.js" @@ -49,7 +46,7 @@ "npm-package-arg": "^8.0.1", "npm-packlist": "^2.1.4", "npm-pick-manifest": "^6.0.0", - "npm-registry-fetch": "^9.0.0", + "npm-registry-fetch": "^10.0.0", "promise-retry": "^2.0.1", "read-package-json-fast": "^2.0.1", "rimraf": "^3.0.2", diff --git a/deps/npm/node_modules/proc-log/LICENSE b/deps/npm/node_modules/proc-log/LICENSE new file mode 100644 index 00000000000000..83837797202b70 --- /dev/null +++ b/deps/npm/node_modules/proc-log/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) GitHub, Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/proc-log/README.md b/deps/npm/node_modules/proc-log/README.md new file mode 100644 index 00000000000000..1adc2a65849dda --- /dev/null +++ b/deps/npm/node_modules/proc-log/README.md @@ -0,0 +1,33 @@ +# proc-log + +Emits 'log' events on the process object which a log output listener can +consume and print to the terminal. + +This is used by various modules within the npm CLI stack in order to send +log events that [`npmlog`](http://npm.im/npmlog) can consume and print. + +## API + +* `log.error(...args)` calls `process.emit('log', 'error', ...args)` + The highest log level. For printing extremely serious errors that + indicate something went wrong. +* `log.warn(...args)` calls `process.emit('log', 'warn', ...args)` + A fairly high log level. Things that the user needs to be aware of, but + which won't necessarily cause improper functioning of the system. +* `log.notice(...args)` calls `process.emit('log', 'notice', ...args)` + Notices which are important, but not necessarily dangerous or a cause for + excess concern. +* `log.info(...args)` calls `process.emit('log', 'info', ...args)` + Informative messages that may benefit the user, but aren't particularly + important. +* `log.verbose(...args)` calls `process.emit('log', 'verbose', ...args)` + Noisy output that is more detail that most users will care about. +* `log.silly(...args)` calls `process.emit('log', 'silly', ...args)` + Extremely noisy excessive logging messages that are typically only useful + for debugging. +* `log.http(...args)` calls `process.emit('log', 'http', ...args)` + Information about HTTP requests made and/or completed. +* `log.pause(...args)` calls `process.emit('log', 'pause')` Used to tell + the consumer to stop printing messages. +* `log.resume(...args)` calls `process.emit('log', 'resume', ...args)` + Used to tell the consumer that it is ok to print messages again. diff --git a/deps/npm/node_modules/proc-log/index.js b/deps/npm/node_modules/proc-log/index.js new file mode 100644 index 00000000000000..9b58713ff3f853 --- /dev/null +++ b/deps/npm/node_modules/proc-log/index.js @@ -0,0 +1,22 @@ +// emits 'log' events on the process +const LEVELS = [ + 'notice', + 'error', + 'warn', + 'info', + 'verbose', + 'http', + 'silly', + 'pause', + 'resume', +] + +const log = level => (...args) => process.emit('log', level, ...args) + +const logger = {} +for (const level of LEVELS) + logger[level] = log(level) + +logger.LEVELS = LEVELS + +module.exports = logger diff --git a/deps/npm/node_modules/proc-log/package.json b/deps/npm/node_modules/proc-log/package.json new file mode 100644 index 00000000000000..178009f61b8d23 --- /dev/null +++ b/deps/npm/node_modules/proc-log/package.json @@ -0,0 +1,28 @@ +{ + "name": "proc-log", + "version": "1.0.0", + "files": [ + "index.js" + ], + "description": "just emit 'log' events on the process object", + "repository": "https://github.com/npm/proc-log", + "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "posttest": "eslint index.js test/*.js", + "postsnap": "eslint index.js test/*.js --fix", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "devDependencies": { + "eslint": "^7.9.0", + "eslint-plugin-import": "^2.22.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-standard": "^4.0.1", + "tap": "^15.0.2" + } +} diff --git a/deps/npm/node_modules/socks/README.md b/deps/npm/node_modules/socks/README.md index f05ac0acf0de7d..f5a7244e9f2421 100644 --- a/deps/npm/node_modules/socks/README.md +++ b/deps/npm/node_modules/socks/README.md @@ -409,7 +409,7 @@ Note: When using 4a please specify type: 4, and when using 5h please specify typ | --- | :---: | :---: | :---: | :---: | :---: | | SOCKS v4 | ✅ | ❌ | ✅ | ❌ | ❌ | | SOCKS v4a | ✅ | ❌ | ✅ | ❌ | ✅ | -| SOCKS v5 (includes 5hh) | ✅ | ✅ | ✅ | ✅ | ✅ | +| SOCKS v5 (includes v5h) | ✅ | ✅ | ✅ | ✅ | ✅ | ### new SocksClient(options) diff --git a/deps/npm/node_modules/socks/build/client/socksclient.js b/deps/npm/node_modules/socks/build/client/socksclient.js index fba45c6cc34319..8bda6f7e06c5d4 100644 --- a/deps/npm/node_modules/socks/build/client/socksclient.js +++ b/deps/npm/node_modules/socks/build/client/socksclient.js @@ -690,7 +690,7 @@ class SocksClient extends events_1.EventEmitter { if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.connect) { this.setState(constants_1.SocksClientState.Established); this.removeInternalSocketHandlers(); - this.emit('established', { socket: this.socket }); + this.emit('established', { remoteHost, socket: this.socket }); } else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { /* If using BIND, the Socks client is now in BoundWaitingForConnection state. diff --git a/deps/npm/node_modules/socks/build/client/socksclient.js.map b/deps/npm/node_modules/socks/build/client/socksclient.js.map index b44af183897de7..25843ac0ef21fa 100644 --- a/deps/npm/node_modules/socks/build/client/socksclient.js.map +++ b/deps/npm/node_modules/socks/build/client/socksclient.js.map @@ -1 +1 @@ -{"version":3,"file":"socksclient.js","sourceRoot":"","sources":["../../src/client/socksclient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAoC;AACpC,2BAA2B;AAC3B,yBAAyB;AACzB,+CAAyC;AACzC,mDAkB6B;AAC7B,+CAG2B;AAC3B,2DAAsD;AACtD,yCAA8D;AA86B5D,iGA96BM,uBAAgB,OA86BN;AAp5BlB,MAAM,WAAY,SAAQ,qBAAY;IAgBpC,YAAY,OAA2B;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,qBACP,OAAO,CACX,CAAC;QAEF,8BAA8B;QAC9B,oCAA0B,CAAC,OAAO,CAAC,CAAC;QAEpC,gBAAgB;QAChB,IAAI,CAAC,QAAQ,CAAC,4BAAgB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,gBAAgB,CACrB,OAA2B,EAC3B,QAAmB;QAEnB,OAAO,IAAI,OAAO,CAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAClE,8BAA8B;YAC9B,IAAI;gBACF,oCAA0B,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;aAClD;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;oBAClC,QAAQ,CAAC,GAAG,CAAC,CAAC;oBACd,OAAO,OAAO,CAAC,GAAU,CAAC,CAAC,CAAC,oDAAoD;iBACjF;qBAAM;oBACL,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;iBACpB;aACF;YAED,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;YACxC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,e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AAC,YAAY,EAAE;iBAC1B,CAAC;gBACF,OAAO;aACR;iBAAM,IAAI,WAAW,KAAK,0BAAc,CAAC,IAAI,EAAE;gBAC9C,8BAA8B;gBAC9B,MAAM,UAAU,GAAG,uCAA2B,CAAC,kBAAkB,CAAC;gBAClE,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE;oBAC1C,IAAI,CAAC,4BAA4B,GAAG,UAAU,CAAC;oBAC/C,OAAO;iBACR;gBAED,IAAI,GAAG,0BAAW,CAAC,UAAU,CAC3B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAC5C,CAAC;gBAEF,UAAU,GAAG;oBACX,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBACtC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE;iBAC1B,CAAC;aACH;YAED,IAAI,CAAC,QAAQ,CAAC,4BAAgB,CAAC,WAAW,CAAC,CAAC;YAC5C,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;SAC7D;IACH,CAAC;IAED,IAAI,kBAAkB;QACpB,yBACK,IAAI,CAAC,OAAO,EACf;IACJ,CAAC;CACF;AAGC,kCAAW"} \ No newline at end of file +{"version":3,"file":"socksclient.js","sourceRoot":"","sources":["../../src/client/socksclient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAoC;AACpC,2BAA2B;AAC3B,yBAAyB;AACzB,+CAAyC;AACzC,mDAkB6B;AAC7B,+CAG2B;AAC3B,2DAAsD;AACtD,yCAA8D;AA86B5D,iGA96BM,uBAAgB,OA86BN;AAp5BlB,MAAM,WAAY,SAAQ,qBAAY;IAgBpC,YAAY,OAA2B;QACrC,KAAK,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AAU,GAAG;oBACX,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBACtC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE;iBAC1B,CAAC;aACH;YAED,IAAI,CAAC,QAAQ,CAAC,4BAAgB,CAAC,WAAW,CAAC,CAAC;YAC5C,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC;SAC7D;IACH,CAAC;IAED,IAAI,kBAAkB;QACpB,yBACK,IAAI,CAAC,OAAO,EACf;IACJ,CAAC;CACF;AAGC,kCAAW"} \ No newline at end of file diff --git a/deps/npm/node_modules/socks/package.json b/deps/npm/node_modules/socks/package.json index d6fb6d64c042b7..c518b1ef7cf064 100644 --- a/deps/npm/node_modules/socks/package.json +++ b/deps/npm/node_modules/socks/package.json @@ -1,7 +1,7 @@ { "name": "socks", "private": false, - "version": "2.6.0", + "version": "2.6.1", "description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.", "main": "build/index.js", "typings": "typings/index.d.ts", @@ -34,8 +34,8 @@ "readmeFilename": "README.md", "devDependencies": { "@types/ip": "1.1.0", - "@types/mocha": "^8.2.1", - "@types/node": "^14.14.35", + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.41", "coveralls": "3.1.0", "mocha": "^8.3.2", "nyc": "15.1.0", @@ -44,7 +44,7 @@ "ts-node": "^9.1.1", "tslint": "^6.1.3", "tslint-config-airbnb": "^5.11.2", - "typescript": "^4.2.3" + "typescript": "^4.2.4" }, "dependencies": { "ip": "^1.1.5", diff --git a/deps/npm/package.json b/deps/npm/package.json index 965f029aaab1ab..19326a9aa59df1 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "7.9.0", + "version": "7.11.2", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -42,10 +42,10 @@ "./package.json": "./package.json" }, "dependencies": { - "@npmcli/arborist": "^2.3.0", + "@npmcli/arborist": "^2.4.1", "@npmcli/ci-detect": "^1.2.0", - "@npmcli/config": "^2.1.0", - "@npmcli/run-script": "^1.8.4", + "@npmcli/config": "^2.2.0", + "@npmcli/run-script": "^1.8.5", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", @@ -61,20 +61,21 @@ "graceful-fs": "^4.2.6", "hosted-git-info": "^4.0.2", "ini": "^2.0.0", - "init-package-json": "^2.0.2", + "init-package-json": "^2.0.3", "is-cidr": "^4.0.2", "json-parse-even-better-errors": "^2.3.1", "leven": "^3.1.0", - "libnpmaccess": "^4.0.1", + "libnpmaccess": "^4.0.2", "libnpmdiff": "^2.0.4", + "libnpmexec": "^1.0.1", "libnpmfund": "^1.0.2", - "libnpmhook": "^6.0.1", - "libnpmorg": "^2.0.1", + "libnpmhook": "^6.0.2", + "libnpmorg": "^2.0.2", "libnpmpack": "^2.0.1", - "libnpmpublish": "^4.0.0", - "libnpmsearch": "^3.1.0", - "libnpmteam": "^2.0.2", - "libnpmversion": "^1.1.0", + "libnpmpublish": "^4.0.1", + "libnpmsearch": "^3.1.1", + "libnpmteam": "^2.0.3", + "libnpmversion": "^1.2.0", "make-fetch-happen": "^8.0.14", "minipass": "^3.1.3", "minipass-pipeline": "^1.2.4", @@ -86,12 +87,12 @@ "npm-audit-report": "^2.1.4", "npm-package-arg": "^8.1.2", "npm-pick-manifest": "^6.1.1", - "npm-profile": "^5.0.2", - "npm-registry-fetch": "^9.0.0", + "npm-profile": "^5.0.3", + "npm-registry-fetch": "^10.1.1", "npm-user-validate": "^1.0.1", "npmlog": "~4.1.2", "opener": "^1.5.2", - "pacote": "^11.3.1", + "pacote": "^11.3.3", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", @@ -135,6 +136,7 @@ "leven", "libnpmaccess", "libnpmdiff", + "libnpmexec", "libnpmfund", "libnpmhook", "libnpmorg", @@ -188,8 +190,7 @@ "jsdom": "^16.5.2", "licensee": "^8.1.0", "marked-man": "^0.7.0", - "require-inject": "^1.4.4", - "tap": "^14.11.0", + "tap": "^15.0.6", "yaml": "^1.10.2" }, "scripts": { @@ -219,7 +220,6 @@ "files": "test/{lib,bin}", "coverage-map": "test/coverage-map.js", "check-coverage": true, - "esm": false, "timeout": 600 }, "license": "Artistic-2.0", diff --git a/deps/npm/tap-snapshots/smoke-tests-index.js-TAP.test.js b/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs similarity index 98% rename from deps/npm/tap-snapshots/smoke-tests-index.js-TAP.test.js rename to deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs index 5c3fb8231114db..7337728a5aff70 100644 --- a/deps/npm/tap-snapshots/smoke-tests-index.js-TAP.test.js +++ b/deps/npm/tap-snapshots/smoke-tests/index.js.test.cjs @@ -32,7 +32,7 @@ All commands: unstar, update, version, view, whoami Specify configs in the ini-formatted file: - {CWD}/smoke-tests/index/.npmrc + {CWD}/smoke-tests/tap-testdir-index/.npmrc or on the command line via: npm <command> --key=value More configuration info: npm help config @@ -313,7 +313,7 @@ project@1.0.0 ` exports[`smoke-tests/index.js TAP npm init > should have successful npm init result 1`] = ` -Wrote to {CWD}/smoke-tests/index/project/package.json: +Wrote to {CWD}/smoke-tests/tap-testdir-index/project/package.json: { "name": "project", @@ -469,7 +469,7 @@ exports[`smoke-tests/index.js TAP npm install prodDep@version > should have expe ` exports[`smoke-tests/index.js TAP npm ls > should have expected ls output 1`] = ` -project@1.0.0 {CWD}/smoke-tests/index/project +project@1.0.0 {CWD}/smoke-tests/tap-testdir-index/project +-- abbrev@1.0.4 \`-- promise-all-reject-late@1.0.1 @@ -483,7 +483,7 @@ abbrev 1.0.4 1.1.1 1.1.1 node_modules/abbrev project ` exports[`smoke-tests/index.js TAP npm prefix > should have expected prefix output 1`] = ` -{CWD}/smoke-tests/index/project +{CWD}/smoke-tests/tap-testdir-index/project ` diff --git a/deps/npm/tap-snapshots/test-lib-init.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-init.js-TAP.test.js deleted file mode 100644 index 25015aab65cb68..00000000000000 --- a/deps/npm/tap-snapshots/test-lib-init.js-TAP.test.js +++ /dev/null @@ -1,19 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports[`test/lib/init.js TAP classic npm init no args > should print helper info 1`] = ` -This utility will walk you through creating a package.json file. -It only covers the most common items, and tries to guess sensible defaults. - -See \`npm help init\` for definitive documentation on these fields -and exactly what they do. - -Use \`npm install <pkg>\` afterwards to install a package and -save it as a dependency in the package.json file. - -Press ^C at any time to quit. -` diff --git a/deps/npm/tap-snapshots/test-lib-link.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-link.js-TAP.test.js deleted file mode 100644 index ab1d5c6b830fbe..00000000000000 --- a/deps/npm/tap-snapshots/test-lib-link.js-TAP.test.js +++ /dev/null @@ -1,30 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports[`test/lib/link.js TAP link global linked pkg to local nm when using args > should create a local symlink to global pkg 1`] = ` -{CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/@myscope/bar -> {CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/global-prefix/lib/node_modules/@myscope/bar -{CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/scoped-linked -{CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/a -> {CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/global-prefix/lib/node_modules/a -{CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/link-me-too -> {CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/link-me-too -{CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/test-pkg-link -> {CWD}/test/lib/link-link-global-linked-pkg-to-local-nm-when-using-args/test-pkg-link - -` - -exports[`test/lib/link.js TAP link pkg already in global space > should create a local symlink to global pkg 1`] = ` -{CWD}/test/lib/link-link-pkg-already-in-global-space/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/link-link-pkg-already-in-global-space/scoped-linked - -` - -exports[`test/lib/link.js TAP link pkg already in global space when prefix is a symlink > should create a local symlink to global pkg 1`] = ` -{CWD}/test/lib/link-link-pkg-already-in-global-space-when-prefix-is-a-symlink/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/link-link-pkg-already-in-global-space-when-prefix-is-a-symlink/scoped-linked - -` - -exports[`test/lib/link.js TAP link to globalDir when in current working dir of pkg and no args > should create a global link to current pkg 1`] = ` -{CWD}/test/lib/link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/global-prefix/lib/node_modules/test-pkg-link -> {CWD}/test/lib/link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/test-pkg-link - -` diff --git a/deps/npm/tap-snapshots/test-lib-ls.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-ls.js-TAP.test.js deleted file mode 100644 index 120a65baffae93..00000000000000 --- a/deps/npm/tap-snapshots/test-lib-ls.js-TAP.test.js +++ /dev/null @@ -1,602 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports[`test/lib/ls.js TAP ls --depth=0 > should output tree containing only top-level dependencies 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls--depth-0 -+-- foo@1.0.0 -\`-- lorem@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls --depth=1 > should output tree containing top-level deps and their deps only 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls--depth-1 -+-- a@1.0.0 -| \`-- b@1.0.0 -\`-- e@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls --dev > should output tree containing dev deps 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls--dev -\`-- dev-dep@1.0.0 - \`-- foo@1.0.0 - \`-- bar@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls --link > should output tree containing linked deps 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls--link -\`-- linked-dep@1.0.0 -> {CWD}/ls-ls--link/linked-dep - -` - -exports[`test/lib/ls.js TAP ls --long --depth=0 > should output tree containing top-level deps with descriptions 1`] = ` -test-npm-ls@1.0.0 -| {CWD}/ls-ls--long-depth-0 -| -+-- dev-dep@1.0.0 -| A DEV dep kind of dep -+-- lorem@1.0.0 -| -+-- optional-dep@1.0.0 -| Maybe a dep? -+-- peer-dep@1.0.0 -| Peer-dep description here -\`-- prod-dep@1.0.0 - A PROD dep kind of dep - -` - -exports[`test/lib/ls.js TAP ls --long > should output tree info with descriptions 1`] = ` -test-npm-ls@1.0.0 -| {CWD}/ls-ls--long -| -+-- dev-dep@1.0.0 -| | A DEV dep kind of dep -| \`-- foo@1.0.0 -| | -| \`-- bar@1.0.0 -| -+-- lorem@1.0.0 -| -+-- optional-dep@1.0.0 -| Maybe a dep? -+-- peer-dep@1.0.0 -| Peer-dep description here -\`-- prod-dep@1.0.0 - | A PROD dep kind of dep - \`-- bar@2.0.0 - A dep that bars - -` - -exports[`test/lib/ls.js TAP ls --only=development > should output tree containing only development deps 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls--only-development -\`-- dev-dep@1.0.0 - \`-- foo@1.0.0 - \`-- bar@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls --only=prod > should output tree containing only prod deps 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls--only-prod -+-- lorem@1.0.0 -+-- optional-dep@1.0.0 -\`-- prod-dep@1.0.0 - \`-- bar@2.0.0 - -` - -exports[`test/lib/ls.js TAP ls --parseable --depth=0 > should output tree containing only top-level dependencies 1`] = ` -{CWD}/ls-ls-parseable--depth-0 -{CWD}/ls-ls-parseable--depth-0/node_modules/foo -{CWD}/ls-ls-parseable--depth-0/node_modules/lorem -` - -exports[`test/lib/ls.js TAP ls --parseable --depth=1 > should output parseable containing top-level deps and their deps only 1`] = ` -{CWD}/ls-ls-parseable--depth-1 -{CWD}/ls-ls-parseable--depth-1/node_modules/foo -{CWD}/ls-ls-parseable--depth-1/node_modules/lorem -{CWD}/ls-ls-parseable--depth-1/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable --dev > should output tree containing dev deps 1`] = ` -{CWD}/ls-ls-parseable--dev -{CWD}/ls-ls-parseable--dev/node_modules/dev-dep -{CWD}/ls-ls-parseable--dev/node_modules/foo -{CWD}/ls-ls-parseable--dev/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable --link > should output tree containing linked deps 1`] = ` -{CWD}/ls-ls-parseable--link -{CWD}/ls-ls-parseable--link/node_modules/linked-dep -` - -exports[`test/lib/ls.js TAP ls --parseable --long --depth=0 > should output tree containing top-level deps with descriptions 1`] = ` -{CWD}/ls-ls-parseable--long-depth-0:test-npm-ls@1.0.0 -{CWD}/ls-ls-parseable--long-depth-0/node_modules/dev-dep:dev-dep@1.0.0 -{CWD}/ls-ls-parseable--long-depth-0/node_modules/lorem:lorem@1.0.0 -{CWD}/ls-ls-parseable--long-depth-0/node_modules/optional-dep:optional-dep@1.0.0 -{CWD}/ls-ls-parseable--long-depth-0/node_modules/peer-dep:peer-dep@1.0.0 -{CWD}/ls-ls-parseable--long-depth-0/node_modules/prod-dep:prod-dep@1.0.0 -` - -exports[`test/lib/ls.js TAP ls --parseable --long > should output tree info with descriptions 1`] = ` -{CWD}/ls-ls-parseable--long:test-npm-ls@1.0.0 -{CWD}/ls-ls-parseable--long/node_modules/dev-dep:dev-dep@1.0.0 -{CWD}/ls-ls-parseable--long/node_modules/lorem:lorem@1.0.0 -{CWD}/ls-ls-parseable--long/node_modules/optional-dep:optional-dep@1.0.0 -{CWD}/ls-ls-parseable--long/node_modules/peer-dep:peer-dep@1.0.0 -{CWD}/ls-ls-parseable--long/node_modules/prod-dep:prod-dep@1.0.0 -{CWD}/ls-ls-parseable--long/node_modules/foo:foo@1.0.0 -{CWD}/ls-ls-parseable--long/node_modules/prod-dep/node_modules/bar:bar@2.0.0 -{CWD}/ls-ls-parseable--long/node_modules/bar:bar@1.0.0 -` - -exports[`test/lib/ls.js TAP ls --parseable --long missing/invalid/extraneous > should output parseable result containing EXTRANEOUS/INVALID labels 1`] = ` -{CWD}/ls-ls-parseable--long-missing-invalid-extraneous:test-npm-ls@1.0.0 -{CWD}/ls-ls-parseable--long-missing-invalid-extraneous/node_modules/foo:foo@1.0.0:INVALID -{CWD}/ls-ls-parseable--long-missing-invalid-extraneous/node_modules/lorem:lorem@1.0.0:EXTRANEOUS -{CWD}/ls-ls-parseable--long-missing-invalid-extraneous/node_modules/bar:bar@1.0.0 -` - -exports[`test/lib/ls.js TAP ls --parseable --long print symlink target location > should output parseable results with symlink targets 1`] = ` -{CWD}/ls-ls-parseable--long-print-symlink-target-location:test-npm-ls@1.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/dev-dep:dev-dep@1.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/linked-dep:linked-dep@1.0.0:{CWD}/ls-ls-parseable--long-print-symlink-target-location/linked-dep -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/lorem:lorem@1.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/optional-dep:optional-dep@1.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/peer-dep:peer-dep@1.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/prod-dep:prod-dep@1.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/foo:foo@1.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/prod-dep/node_modules/bar:bar@2.0.0 -{CWD}/ls-ls-parseable--long-print-symlink-target-location/node_modules/bar:bar@1.0.0 -` - -exports[`test/lib/ls.js TAP ls --parseable --long with extraneous deps > should output long parseable output with extraneous info 1`] = ` -{CWD}/ls-ls-parseable--long-with-extraneous-deps:test-npm-ls@1.0.0 -{CWD}/ls-ls-parseable--long-with-extraneous-deps/node_modules/foo:foo@1.0.0 -{CWD}/ls-ls-parseable--long-with-extraneous-deps/node_modules/lorem:lorem@1.0.0:EXTRANEOUS -{CWD}/ls-ls-parseable--long-with-extraneous-deps/node_modules/bar:bar@1.0.0 -` - -exports[`test/lib/ls.js TAP ls --parseable --only=development > should output tree containing only development deps 1`] = ` -{CWD}/ls-ls-parseable--only-development -{CWD}/ls-ls-parseable--only-development/node_modules/dev-dep -{CWD}/ls-ls-parseable--only-development/node_modules/foo -{CWD}/ls-ls-parseable--only-development/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable --only=prod > should output tree containing only prod deps 1`] = ` -{CWD}/ls-ls-parseable--only-prod -{CWD}/ls-ls-parseable--only-prod/node_modules/lorem -{CWD}/ls-ls-parseable--only-prod/node_modules/optional-dep -{CWD}/ls-ls-parseable--only-prod/node_modules/prod-dep -{CWD}/ls-ls-parseable--only-prod/node_modules/prod-dep/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable --production > should output tree containing production deps 1`] = ` -{CWD}/ls-ls-parseable--production -{CWD}/ls-ls-parseable--production/node_modules/lorem -{CWD}/ls-ls-parseable--production/node_modules/optional-dep -{CWD}/ls-ls-parseable--production/node_modules/prod-dep -{CWD}/ls-ls-parseable--production/node_modules/prod-dep/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable cycle deps > should print tree output omitting deduped ref 1`] = ` -{CWD}/ls-ls-parseable-cycle-deps -{CWD}/ls-ls-parseable-cycle-deps/node_modules/a -{CWD}/ls-ls-parseable-cycle-deps/node_modules/b -` - -exports[`test/lib/ls.js TAP ls --parseable default --depth value should be 0 > should output parseable output containing only top-level dependencies 1`] = ` -{CWD}/ls-ls-parseable-default-depth-value-should-be-0 -{CWD}/ls-ls-parseable-default-depth-value-should-be-0/node_modules/foo -{CWD}/ls-ls-parseable-default-depth-value-should-be-0/node_modules/lorem -` - -exports[`test/lib/ls.js TAP ls --parseable empty location > should print empty result 1`] = ` -{CWD}/ls-ls-parseable-empty-location -` - -exports[`test/lib/ls.js TAP ls --parseable extraneous deps > should output containing problems info 1`] = ` -{CWD}/ls-ls-parseable-extraneous-deps -{CWD}/ls-ls-parseable-extraneous-deps/node_modules/foo -{CWD}/ls-ls-parseable-extraneous-deps/node_modules/lorem -{CWD}/ls-ls-parseable-extraneous-deps/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable from and resolved properties > should not be printed in tree output 1`] = ` -{CWD}/ls-ls-parseable-from-and-resolved-properties -{CWD}/ls-ls-parseable-from-and-resolved-properties/node_modules/simple-output -` - -exports[`test/lib/ls.js TAP ls --parseable global > should print parseable output for global deps 1`] = ` -{CWD}/ls-ls-parseable-global -{CWD}/ls-ls-parseable-global/node_modules/a -{CWD}/ls-ls-parseable-global/node_modules/b -{CWD}/ls-ls-parseable-global/node_modules/b/node_modules/c -` - -exports[`test/lib/ls.js TAP ls --parseable json read problems > should print empty result 1`] = ` -{CWD}/ls-ls-parseable-json-read-problems -` - -exports[`test/lib/ls.js TAP ls --parseable missing package.json > should log all extraneous deps on error msg 1`] = ` -extraneous: bar@1.0.0 {CWD}/ls-ls-parseable-missing-package-json/node_modules/bar -extraneous: foo@1.0.0 {CWD}/ls-ls-parseable-missing-package-json/node_modules/foo -extraneous: lorem@1.0.0 {CWD}/ls-ls-parseable-missing-package-json/node_modules/lorem -` - -exports[`test/lib/ls.js TAP ls --parseable missing package.json > should output parseable missing name/version of top-level package 1`] = ` -{CWD}/ls-ls-parseable-missing-package-json -{CWD}/ls-ls-parseable-missing-package-json/node_modules/bar -{CWD}/ls-ls-parseable-missing-package-json/node_modules/foo -{CWD}/ls-ls-parseable-missing-package-json/node_modules/lorem -` - -exports[`test/lib/ls.js TAP ls --parseable missing/invalid/extraneous > should output parseable containing top-level deps and their deps only 1`] = ` -{CWD}/ls-ls-parseable-missing-invalid-extraneous -{CWD}/ls-ls-parseable-missing-invalid-extraneous/node_modules/foo -{CWD}/ls-ls-parseable-missing-invalid-extraneous/node_modules/lorem -{CWD}/ls-ls-parseable-missing-invalid-extraneous/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable no args > should output parseable representation of dependencies structure 1`] = ` -{CWD}/ls-ls-parseable-no-args -{CWD}/ls-ls-parseable-no-args/node_modules/foo -{CWD}/ls-ls-parseable-no-args/node_modules/lorem -{CWD}/ls-ls-parseable-no-args/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable resolved points to git ref > should output tree containing git refs 1`] = ` -{CWD}/ls-ls-parseable-resolved-points-to-git-ref -{CWD}/ls-ls-parseable-resolved-points-to-git-ref/node_modules/abbrev -` - -exports[`test/lib/ls.js TAP ls --parseable unmet optional dep > should output parseable with empty entry for missing optional deps 1`] = ` -{CWD}/ls-ls-parseable-unmet-optional-dep -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/dev-dep -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/lorem -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/optional-dep -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/peer-dep -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/prod-dep -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/foo -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/prod-dep/node_modules/bar -{CWD}/ls-ls-parseable-unmet-optional-dep/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable unmet peer dep > should output parseable signaling missing peer dep in problems 1`] = ` -{CWD}/ls-ls-parseable-unmet-peer-dep -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/dev-dep -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/lorem -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/optional-dep -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/peer-dep -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/prod-dep -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/foo -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/prod-dep/node_modules/bar -{CWD}/ls-ls-parseable-unmet-peer-dep/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable using aliases > should output tree containing aliases 1`] = ` -{CWD}/ls-ls-parseable-using-aliases -{CWD}/ls-ls-parseable-using-aliases/node_modules/a -` - -exports[`test/lib/ls.js TAP ls --parseable with filter arg > should output parseable contaning only occurrences of filtered by package 1`] = ` -{CWD}/ls-ls-parseable-with-filter-arg/node_modules/lorem -` - -exports[`test/lib/ls.js TAP ls --parseable with filter arg nested dep > should output parseable contaning only occurrences of filtered package 1`] = ` -{CWD}/ls-ls-parseable-with-filter-arg-nested-dep/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --parseable with missing filter arg > should output parseable output containing no dependencies info 1`] = ` - -` - -exports[`test/lib/ls.js TAP ls --parseable with multiple filter args > should output parseable contaning only occurrences of multiple filtered packages and their ancestors 1`] = ` -{CWD}/ls-ls-parseable-with-multiple-filter-args/node_modules/lorem -{CWD}/ls-ls-parseable-with-multiple-filter-args/node_modules/bar -` - -exports[`test/lib/ls.js TAP ls --production > should output tree containing production deps 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls--production -+-- lorem@1.0.0 -+-- optional-dep@1.0.0 -\`-- prod-dep@1.0.0 - \`-- bar@2.0.0 - -` - -exports[`test/lib/ls.js TAP ls broken resolved field > should NOT print git refs in output tree 1`] = ` -npm-broken-resolved-field-test@1.0.0 {CWD}/ls-ls-broken-resolved-field -\`-- a@1.0.1 - -` - -exports[`test/lib/ls.js TAP ls colored output > should output tree containing color info 1`] = ` -[0mtest-npm-ls@1.0.0 {CWD}/ls-ls-colored-output[0m -[0m+-- foo@1.0.0 [31m[40minvalid[49m[39m[0m -[0m| \`-- bar@1.0.0[0m -[0m+-- [31m[40mUNMET DEPENDENCY[49m[39m ipsum@^1.0.0[0m -[0m\`-- lorem@1.0.0 [32m[40mextraneous[49m[39m[0m -[0m[0m -` - -exports[`test/lib/ls.js TAP ls cycle deps > should print tree output containing deduped ref 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-cycle-deps -\`-- a@1.0.0 - \`-- b@1.0.0 - \`-- a@1.0.0 deduped - -` - -exports[`test/lib/ls.js TAP ls cycle deps with filter args > should print tree output containing deduped ref 1`] = ` -[0mtest-npm-ls@1.0.0 {CWD}/ls-ls-cycle-deps-with-filter-args[0m -[0m\`-- [33m[40ma@1.0.0[49m[39m[0m -[0m \`-- b@1.0.0[0m -[0m \`-- [33m[40ma@1.0.0[49m[39m [90mdeduped[39m[0m -[0m[0m -` - -exports[`test/lib/ls.js TAP ls deduped missing dep > should output parseable signaling missing peer dep in problems 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-deduped-missing-dep -+-- a@1.0.0 -| \`-- UNMET DEPENDENCY b@^1.0.0 deduped -\`-- UNMET DEPENDENCY b@^1.0.0 - -` - -exports[`test/lib/ls.js TAP ls default --depth value should be 0 > should output tree containing only top-level dependencies 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-default-depth-value-should-be-0 -+-- foo@1.0.0 -\`-- lorem@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls empty location > should print empty result 1`] = ` -{CWD}/ls-ls-empty-location -\`-- (empty) - -` - -exports[`test/lib/ls.js TAP ls extraneous deps > should output containing problems info 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-extraneous-deps -+-- foo@1.0.0 -| \`-- bar@1.0.0 -\`-- lorem@1.0.0 extraneous - -` - -exports[`test/lib/ls.js TAP ls filter pkg arg using depth option > should list a in top-level only 1`] = ` -test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/ls-ls-filter-pkg-arg-using-depth-option -\`-- a@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls filter pkg arg using depth option > should print empty results msg 1`] = ` -test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/ls-ls-filter-pkg-arg-using-depth-option -\`-- (empty) - -` - -exports[`test/lib/ls.js TAP ls filter pkg arg using depth option > should print expected result 1`] = ` -test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/ls-ls-filter-pkg-arg-using-depth-option -\`-- b@1.0.0 - \`-- c@1.0.0 - \`-- d@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls filtering by child of missing dep > should print tree and not duplicate child of missing items 1`] = ` -filter-by-child-of-missing-dep@1.0.0 {CWD}/ls-ls-filtering-by-child-of-missing-dep -+-- b@1.0.0 extraneous -| \`-- c@1.0.0 deduped -+-- c@1.0.0 extraneous -\`-- d@1.0.0 extraneous - \`-- c@2.0.0 extraneous - -` - -exports[`test/lib/ls.js TAP ls from and resolved properties > should not be printed in tree output 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-from-and-resolved-properties -\`-- simple-output@2.1.1 - -` - -exports[`test/lib/ls.js TAP ls global > should print tree and not mark top-level items extraneous 1`] = ` -{CWD}/ls-ls-global -+-- a@1.0.0 -\`-- b@1.0.0 - \`-- c@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls invalid deduped dep > should output tree signaling mismatching peer dep in problems 1`] = ` -[0minvalid-deduped-dep@1.0.0 {CWD}/ls-ls-invalid-deduped-dep[0m -[0m+-- a@1.0.0[0m -[0m| \`-- b@1.0.0 [90mdeduped[39m [31m[40minvalid[49m[39m[0m -[0m\`-- b@1.0.0 [31m[40minvalid[49m[39m[0m -[0m[0m -` - -exports[`test/lib/ls.js TAP ls invalid peer dep > should output tree signaling mismatching peer dep in problems 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-invalid-peer-dep -+-- dev-dep@1.0.0 -| \`-- foo@1.0.0 -| \`-- bar@1.0.0 -+-- lorem@1.0.0 -+-- optional-dep@1.0.0 -+-- peer-dep@1.0.0 invalid -\`-- prod-dep@1.0.0 - \`-- bar@2.0.0 - -` - -exports[`test/lib/ls.js TAP ls json read problems > should print empty result 1`] = ` -{CWD}/ls-ls-json-read-problems -\`-- (empty) - -` - -exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should filter single workspace 1`] = ` -filter-by-child-of-missing-dep@1.0.0 {CWD}/ls-ls-loading-a-tree-containing-workspaces -\`-- a@1.0.0 -> {CWD}/ls-ls-loading-a-tree-containing-workspaces/a - -` - -exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should list workspaces properly 1`] = ` -filter-by-child-of-missing-dep@1.0.0 {CWD}/ls-ls-loading-a-tree-containing-workspaces -+-- a@1.0.0 -> {CWD}/ls-ls-loading-a-tree-containing-workspaces/a -| \`-- c@1.0.0 -\`-- b@1.0.0 -> {CWD}/ls-ls-loading-a-tree-containing-workspaces/b - -` - -exports[`test/lib/ls.js TAP ls missing package.json > should log all extraneous deps on error msg 1`] = ` -extraneous: bar@1.0.0 {CWD}/ls-ls-missing-package-json/node_modules/bar -extraneous: foo@1.0.0 {CWD}/ls-ls-missing-package-json/node_modules/foo -extraneous: lorem@1.0.0 {CWD}/ls-ls-missing-package-json/node_modules/lorem -` - -exports[`test/lib/ls.js TAP ls missing package.json > should output tree missing name/version of top-level package 1`] = ` -{CWD}/ls-ls-missing-package-json -+-- bar@1.0.0 extraneous -+-- foo@1.0.0 extraneous -| \`-- bar@1.0.0 deduped -\`-- lorem@1.0.0 extraneous - -` - -exports[`test/lib/ls.js TAP ls missing/invalid/extraneous > should output tree containing missing, invalid, extraneous labels 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-missing-invalid-extraneous -+-- foo@1.0.0 invalid -| \`-- bar@1.0.0 -+-- UNMET DEPENDENCY ipsum@^1.0.0 -\`-- lorem@1.0.0 extraneous - -` - -exports[`test/lib/ls.js TAP ls no args > should output tree representation of dependencies structure 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-no-args -+-- foo@1.0.0 -| \`-- bar@1.0.0 -\`-- lorem@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls print deduped symlinks > should output tree containing linked deps 1`] = ` -print-deduped-symlinks@1.0.0 {CWD}/ls-ls-print-deduped-symlinks -+-- a@1.0.0 -| \`-- b@1.0.0 deduped -> {CWD}/ls-ls-print-deduped-symlinks/b -\`-- b@1.0.0 -> {CWD}/ls-ls-print-deduped-symlinks/b - -` - -exports[`test/lib/ls.js TAP ls resolved points to git ref > should output tree containing git refs 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-resolved-points-to-git-ref -\`-- abbrev@1.1.1 (git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c) - -` - -exports[`test/lib/ls.js TAP ls unmet optional dep > should output tree with empty entry for missing optional deps 1`] = ` -[0mtest-npm-ls@1.0.0 {CWD}/ls-ls-unmet-optional-dep[0m -[0m+-- dev-dep@1.0.0[0m -[0m| \`-- foo@1.0.0[0m -[0m| \`-- bar@1.0.0[0m -[0m+-- lorem@1.0.0[0m -[0m+-- [33m[40mUNMET OPTIONAL DEPENDENCY[49m[39m missing-optional-dep@^1.0.0[0m -[0m+-- optional-dep@1.0.0 [31m[40minvalid[49m[39m[0m -[0m+-- peer-dep@1.0.0[0m -[0m\`-- prod-dep@1.0.0[0m -[0m \`-- bar@2.0.0[0m -[0m[0m -` - -exports[`test/lib/ls.js TAP ls unmet peer dep > should output tree signaling missing peer dep in problems 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-unmet-peer-dep -\`-- UNMET DEPENDENCY peer-dep@* - -` - -exports[`test/lib/ls.js TAP ls using aliases > should output tree containing aliases 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-using-aliases -\`-- a@npm:b@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls with args and dedupe entries > should print tree output containing deduped ref 1`] = ` -[0mdedupe-entries@1.0.0 {CWD}/ls-ls-with-args-and-dedupe-entries[0m -[0m+-- @npmcli/a@1.0.0[0m -[0m| \`-- [33m[40m@npmcli/b@1.1.2[49m[39m [90mdeduped[39m[0m -[0m+-- [33m[40m@npmcli/b@1.1.2[49m[39m[0m -[0m\`-- @npmcli/c@1.0.0[0m -[0m \`-- [33m[40m@npmcli/b@1.1.2[49m[39m [90mdeduped[39m[0m -[0m[0m -` - -exports[`test/lib/ls.js TAP ls with args and different order of items > should print tree output containing deduped ref 1`] = ` -dedupe-entries@1.0.0 {CWD}/ls-ls-with-args-and-different-order-of-items -+-- @npmcli/a@1.0.0 -| \`-- @npmcli/c@1.0.0 deduped -+-- @npmcli/b@1.1.2 -| \`-- @npmcli/c@1.0.0 deduped -\`-- @npmcli/c@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls with dot filter arg > should output tree contaning only occurrences of filtered by package and colored output 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-with-dot-filter-arg -\`-- (empty) - -` - -exports[`test/lib/ls.js TAP ls with filter arg > should output tree contaning only occurrences of filtered by package and colored output 1`] = ` -[0mtest-npm-ls@1.0.0 {CWD}/ls-ls-with-filter-arg[0m -[0m\`-- [33m[40mlorem@1.0.0[49m[39m[0m -[0m[0m -` - -exports[`test/lib/ls.js TAP ls with filter arg nested dep > should output tree contaning only occurrences of filtered package and its ancestors 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-with-filter-arg-nested-dep -\`-- foo@1.0.0 - \`-- bar@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls with missing filter arg > should output tree containing no dependencies info 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-with-missing-filter-arg -\`-- (empty) - -` - -exports[`test/lib/ls.js TAP ls with multiple filter args > should output tree contaning only occurrences of multiple filtered packages and their ancestors 1`] = ` -test-npm-ls@1.0.0 {CWD}/ls-ls-with-multiple-filter-args -+-- foo@1.0.0 -| \`-- bar@1.0.0 -\`-- lorem@1.0.0 - -` - -exports[`test/lib/ls.js TAP ls with no args dedupe entries > should print tree output containing deduped ref 1`] = ` -dedupe-entries@1.0.0 {CWD}/ls-ls-with-no-args-dedupe-entries -+-- @npmcli/a@1.0.0 -| \`-- @npmcli/b@1.1.2 deduped -+-- @npmcli/b@1.1.2 -\`-- @npmcli/c@1.0.0 - \`-- @npmcli/b@1.1.2 deduped - -` - -exports[`test/lib/ls.js TAP ls with no args dedupe entries and not displaying all > should print tree output containing deduped ref 1`] = ` -dedupe-entries@1.0.0 {CWD}/ls-ls-with-no-args-dedupe-entries-and-not-displaying-all -+-- @npmcli/a@1.0.0 -+-- @npmcli/b@1.1.2 -\`-- @npmcli/c@1.0.0 - -` diff --git a/deps/npm/tap-snapshots/test-lib-outdated.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-outdated.js-TAP.test.js deleted file mode 100644 index 7f245b09ed9200..00000000000000 --- a/deps/npm/tap-snapshots/test-lib-outdated.js-TAP.test.js +++ /dev/null @@ -1,154 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports[`test/lib/outdated.js TAP should display outdated deps outdated --all > must match snapshot 1`] = ` - -Package Current Wanted Latest Location Depended by -alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha outdated-should-display-outdated-deps -beta 1.0.0 1.0.1 1.0.1 node_modules/beta outdated-should-display-outdated-deps -gamma 1.0.1 1.0.1 2.0.0 node_modules/gamma outdated-should-display-outdated-deps -theta MISSING 1.0.1 1.0.1 - outdated-should-display-outdated-deps -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --json --long > must match snapshot 1`] = ` - -{ - "alpha": { - "current": "1.0.0", - "wanted": "1.0.1", - "latest": "1.0.1", - "dependent": "outdated-should-display-outdated-deps", - "location": "{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/alpha", - "type": "dependencies" - }, - "beta": { - "current": "1.0.0", - "wanted": "1.0.1", - "latest": "1.0.1", - "dependent": "outdated-should-display-outdated-deps", - "location": "{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/beta", - "type": "peerDependencies" - }, - "gamma": { - "current": "1.0.1", - "wanted": "1.0.1", - "latest": "2.0.0", - "dependent": "outdated-should-display-outdated-deps", - "location": "{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/gamma", - "type": "dependencies" - }, - "theta": { - "wanted": "1.0.1", - "latest": "1.0.1", - "dependent": "outdated-should-display-outdated-deps", - "type": "dependencies" - } -} -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --json > must match snapshot 1`] = ` - -{ - "alpha": { - "current": "1.0.0", - "wanted": "1.0.1", - "latest": "1.0.1", - "dependent": "outdated-should-display-outdated-deps", - "location": "{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/alpha" - }, - "beta": { - "current": "1.0.0", - "wanted": "1.0.1", - "latest": "1.0.1", - "dependent": "outdated-should-display-outdated-deps", - "location": "{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/beta" - }, - "gamma": { - "current": "1.0.1", - "wanted": "1.0.1", - "latest": "2.0.0", - "dependent": "outdated-should-display-outdated-deps", - "location": "{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/gamma" - }, - "theta": { - "wanted": "1.0.1", - "latest": "1.0.1", - "dependent": "outdated-should-display-outdated-deps" - } -} -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --long > must match snapshot 1`] = ` - -Package Current Wanted Latest Location Depended by Package Type Homepage -alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha outdated-should-display-outdated-deps dependencies -beta 1.0.0 1.0.1 1.0.1 node_modules/beta outdated-should-display-outdated-deps peerDependencies -gamma 1.0.1 1.0.1 2.0.0 node_modules/gamma outdated-should-display-outdated-deps dependencies -theta MISSING 1.0.1 1.0.1 - outdated-should-display-outdated-deps dependencies -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=dev --omit=peer > must match snapshot 1`] = ` - -[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m -[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha outdated-should-display-outdated-deps -[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma outdated-should-display-outdated-deps -[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - outdated-should-display-outdated-deps -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=dev > must match snapshot 1`] = ` - -[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m -[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha outdated-should-display-outdated-deps -[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta outdated-should-display-outdated-deps -[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma outdated-should-display-outdated-deps -[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - outdated-should-display-outdated-deps -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=prod > must match snapshot 1`] = ` - -[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m -[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha outdated-should-display-outdated-deps -[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta outdated-should-display-outdated-deps -[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma outdated-should-display-outdated-deps -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --parseable --long > must match snapshot 1`] = ` - -{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/alpha:alpha@1.0.1:alpha@1.0.0:alpha@1.0.1:outdated-should-display-outdated-deps:dependencies: -{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/beta:beta@1.0.1:beta@1.0.0:beta@1.0.1:outdated-should-display-outdated-deps:peerDependencies: -{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/gamma:gamma@1.0.1:gamma@1.0.1:gamma@2.0.0:outdated-should-display-outdated-deps:dependencies: -:theta@1.0.1:MISSING:theta@1.0.1:outdated-should-display-outdated-deps:dependencies: -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated --parseable > must match snapshot 1`] = ` - -{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/alpha:alpha@1.0.1:alpha@1.0.0:alpha@1.0.1:outdated-should-display-outdated-deps -{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/beta:beta@1.0.1:beta@1.0.0:beta@1.0.1:outdated-should-display-outdated-deps -{CWD}/test/lib/outdated-should-display-outdated-deps/node_modules/gamma:gamma@1.0.1:gamma@1.0.1:gamma@2.0.0:outdated-should-display-outdated-deps -:theta@1.0.1:MISSING:theta@1.0.1:outdated-should-display-outdated-deps -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated > must match snapshot 1`] = ` - -[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m -[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha outdated-should-display-outdated-deps -[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta outdated-should-display-outdated-deps -[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma outdated-should-display-outdated-deps -[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - outdated-should-display-outdated-deps -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated global > must match snapshot 1`] = ` - -Package Current Wanted Latest Location Depended by -alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha global -` - -exports[`test/lib/outdated.js TAP should display outdated deps outdated specific dep > must match snapshot 1`] = ` - -Package Current Wanted Latest Location Depended by -alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha outdated-should-display-outdated-deps -` diff --git a/deps/npm/tap-snapshots/test-tap-repo.js-TAP.test.js b/deps/npm/tap-snapshots/test-tap-repo.js-TAP.test.js deleted file mode 100644 index 3fba79edb8d42b..00000000000000 --- a/deps/npm/tap-snapshots/test-tap-repo.js-TAP.test.js +++ /dev/null @@ -1,21 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports[`test/tap/repo.js TAP npm repo underscore --json > should print json result 1`] = ` -{ - "title": "repository available at the following URL", - "url": "https://github.com/jashkenas/underscore" -} - -` - -exports[`test/tap/repo.js TAP npm repo underscore --no-browser > should print alternative msg 1`] = ` -repository available at the following URL: - -https://github.com/jashkenas/underscore - -` diff --git a/deps/npm/tap-snapshots/test-lib-config.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/config.js.test.cjs similarity index 90% rename from deps/npm/tap-snapshots/test-lib-config.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/config.js.test.cjs index d62969145d1d98..68c50d699a430c 100644 --- a/deps/npm/tap-snapshots/test-lib-config.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/config.js.test.cjs @@ -88,10 +88,10 @@ exports[`test/lib/config.js TAP config edit > should write config file 2`] = ` exports[`test/lib/config.js TAP config get no args > should list configs on config get no args 1`] = ` ; "cli" config from command line options -editor = "vi" -global = false -json = false -long = false +editor = "vi" +global = false +json = false +long = false ; node bin location = /path/to/node ; cwd = {CWD} @@ -102,26 +102,26 @@ long = false exports[`test/lib/config.js TAP config list --long > should list all configs 1`] = ` ; "default" config from default values -init-author-name = "" -init-version = "1.0.0" -init.author.name = "" -init.version = "1.0.0" +init-author-name = "" +init-version = "1.0.0" +init.author.name = "" +init.version = "1.0.0" ; "cli" config from command line options -editor = "vi" -global = false -json = false +editor = "vi" +global = false +json = false long = true ` exports[`test/lib/config.js TAP config list > should list configs 1`] = ` ; "cli" config from command line options -editor = "vi" -global = false -json = false -long = false +editor = "vi" +global = false +json = false +long = false ; node bin location = /path/to/node ; cwd = {CWD} @@ -132,11 +132,11 @@ long = false exports[`test/lib/config.js TAP config list overrides > should list overridden configs 1`] = ` ; "cli" config from command line options -editor = "vi" -global = false -init.author.name = "Bar" -json = false -long = false +editor = "vi" +global = false +init.author.name = "Bar" +json = false +long = false ; "user" config from ~/.npmrc diff --git a/deps/npm/tap-snapshots/test-lib-dist-tag.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/dist-tag.js.test.cjs similarity index 92% rename from deps/npm/tap-snapshots/test-lib-dist-tag.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/dist-tag.js.test.cjs index ea25b568b06626..34fbba89d987ab 100644 --- a/deps/npm/tap-snapshots/test-lib-dist-tag.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/dist-tag.js.test.cjs @@ -16,7 +16,8 @@ npm dist-tag rm <pkg> <tag> npm dist-tag ls [<pkg>] Options: -[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] alias: dist-tags @@ -34,7 +35,8 @@ npm dist-tag rm <pkg> <tag> npm dist-tag ls [<pkg>] Options: -[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] alias: dist-tags @@ -46,7 +48,7 @@ exports[`test/lib/dist-tag.js TAP add new tag > should return success msg 1`] = ` exports[`test/lib/dist-tag.js TAP add using valid semver range as name > should return success msg 1`] = ` -dist-tag add 1.0.0 to @scoped/another@7.7.7 +dist-tag add 1.0.0 to @scoped/another@7.7.7 ` @@ -61,7 +63,8 @@ npm dist-tag rm <pkg> <tag> npm dist-tag ls [<pkg>] Options: -[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] alias: dist-tags @@ -85,7 +88,8 @@ npm dist-tag rm <pkg> <tag> npm dist-tag ls [<pkg>] Options: -[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] alias: dist-tags @@ -93,7 +97,7 @@ Run "npm help dist-tag" for more info ` exports[`test/lib/dist-tag.js TAP ls on missing package > should log no dist-tag found msg 1`] = ` -dist-tag ls Couldn't get dist-tag data for foo@latest +dist-tag ls Couldn't get dist-tag data for foo@latest ` @@ -120,7 +124,7 @@ latest: 2.0.0 ` exports[`test/lib/dist-tag.js TAP remove existing tag > should log remove info 1`] = ` -dist-tag del c from @scoped/another +dist-tag del c from @scoped/another ` @@ -139,7 +143,8 @@ npm dist-tag rm <pkg> <tag> npm dist-tag ls [<pkg>] Options: -[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] alias: dist-tags @@ -147,14 +152,14 @@ Run "npm help dist-tag" for more info ` exports[`test/lib/dist-tag.js TAP remove non-existing tag > should log error msg 1`] = ` -dist-tag del nonexistent from @scoped/another -dist-tag del nonexistent is not a dist-tag on @scoped/another +dist-tag del nonexistent from @scoped/another +dist-tag del nonexistent is not a dist-tag on @scoped/another ` exports[`test/lib/dist-tag.js TAP set existing version > should log warn msg 1`] = ` -dist-tag add b to @scoped/another@0.6.0 -dist-tag add b is already set to version 0.6.0 +dist-tag add b to @scoped/another@0.6.0 +dist-tag add b is already set to version 0.6.0 ` diff --git a/deps/npm/tap-snapshots/test-lib-fund.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/fund.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-fund.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/fund.js.test.cjs diff --git a/deps/npm/tap-snapshots/test/lib/init.js.test.cjs b/deps/npm/tap-snapshots/test/lib/init.js.test.cjs new file mode 100644 index 00000000000000..043d8b641dcce1 --- /dev/null +++ b/deps/npm/tap-snapshots/test/lib/init.js.test.cjs @@ -0,0 +1,18 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/init.js TAP workspaces no args > should print helper info 1`] = ` + +` + +exports[`test/lib/init.js TAP workspaces no args, existing folder > should print helper info 1`] = ` + +` + +exports[`test/lib/init.js TAP workspaces with arg but missing workspace folder > should print helper info 1`] = ` + +` diff --git a/deps/npm/tap-snapshots/test/lib/link.js.test.cjs b/deps/npm/tap-snapshots/test/lib/link.js.test.cjs new file mode 100644 index 00000000000000..d6dd376593b4df --- /dev/null +++ b/deps/npm/tap-snapshots/test/lib/link.js.test.cjs @@ -0,0 +1,30 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/link.js TAP link global linked pkg to local nm when using args > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/@myscope/bar -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/global-prefix/lib/node_modules/@myscope/bar +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/scoped-linked +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/a -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/global-prefix/lib/node_modules/a +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/link-me-too -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/link-me-too +{CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/test-pkg-link -> {CWD}/test/lib/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/test-pkg-link + +` + +exports[`test/lib/link.js TAP link pkg already in global space > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/tap-testdir-link-link-pkg-already-in-global-space/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/tap-testdir-link-link-pkg-already-in-global-space/scoped-linked + +` + +exports[`test/lib/link.js TAP link pkg already in global space when prefix is a symlink > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/tap-testdir-link-link-pkg-already-in-global-space-when-prefix-is-a-symlink/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/tap-testdir-link-link-pkg-already-in-global-space-when-prefix-is-a-symlink/scoped-linked + +` + +exports[`test/lib/link.js TAP link to globalDir when in current working dir of pkg and no args > should create a global link to current pkg 1`] = ` +{CWD}/test/lib/tap-testdir-link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/global-prefix/lib/node_modules/test-pkg-link -> {CWD}/test/lib/tap-testdir-link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/test-pkg-link + +` diff --git a/deps/npm/tap-snapshots/test/lib/ls.js.test.cjs b/deps/npm/tap-snapshots/test/lib/ls.js.test.cjs new file mode 100644 index 00000000000000..0278f6af1f2e4c --- /dev/null +++ b/deps/npm/tap-snapshots/test/lib/ls.js.test.cjs @@ -0,0 +1,630 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/ls.js TAP ignore missing optional deps --json > ls --json problems 1`] = ` +Array [ + "invalid: optional-wrong@3.2.1 {project}/node_modules/optional-wrong", + "missing: peer-missing@1, required by test-npm-ls-ignore-missing-optional@1.2.3", + "invalid: peer-optional-wrong@3.2.1 {project}/node_modules/peer-optional-wrong", + "invalid: peer-wrong@3.2.1 {project}/node_modules/peer-wrong", + "missing: prod-missing@1, required by test-npm-ls-ignore-missing-optional@1.2.3", + "invalid: prod-wrong@3.2.1 {project}/node_modules/prod-wrong", +] +` + +exports[`test/lib/ls.js TAP ignore missing optional deps --parseable > ls --parseable result 1`] = ` +{project} +{project}/node_modules/optional-ok +{project}/node_modules/optional-wrong +{project}/node_modules/peer-ok +{project}/node_modules/peer-optional-ok +{project}/node_modules/peer-optional-wrong +{project}/node_modules/peer-wrong +{project}/node_modules/prod-ok +{project}/node_modules/prod-wrong +` + +exports[`test/lib/ls.js TAP ignore missing optional deps human output > ls result 1`] = ` +test-npm-ls-ignore-missing-optional@1.2.3 {project} ++-- unmet optional dependency optional-missing@1 ++-- optional-ok@1.2.3 ++-- optional-wrong@3.2.1 invalid ++-- unmet dependency peer-missing@1 ++-- peer-ok@1.2.3 ++-- unmet optional dependency peer-optional-missing@1 ++-- peer-optional-ok@1.2.3 ++-- peer-optional-wrong@3.2.1 invalid ++-- peer-wrong@3.2.1 invalid ++-- unmet dependency prod-missing@1 ++-- prod-ok@1.2.3 +\`-- prod-wrong@3.2.1 invalid + +` + +exports[`test/lib/ls.js TAP ls --depth=0 > should output tree containing only top-level dependencies 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---depth-0 ++-- foo@1.0.0 +\`-- lorem@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls --depth=1 > should output tree containing top-level deps and their deps only 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---depth-1 ++-- a@1.0.0 +| \`-- b@1.0.0 +\`-- e@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls --dev > should output tree containing dev deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---dev +\`-- dev-dep@1.0.0 + \`-- foo@1.0.0 + \`-- bar@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls --link > should output tree containing linked deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---link +\`-- linked-dep@1.0.0 -> {CWD}/tap-testdir-ls-ls---link/linked-dep + +` + +exports[`test/lib/ls.js TAP ls --long --depth=0 > should output tree containing top-level deps with descriptions 1`] = ` +test-npm-ls@1.0.0 +| {CWD}/tap-testdir-ls-ls---long---depth-0 +| ++-- dev-dep@1.0.0 +| A DEV dep kind of dep ++-- lorem@1.0.0 +| ++-- optional-dep@1.0.0 +| Maybe a dep? ++-- peer-dep@1.0.0 +| Peer-dep description here +\`-- prod-dep@1.0.0 + A PROD dep kind of dep + +` + +exports[`test/lib/ls.js TAP ls --long > should output tree info with descriptions 1`] = ` +test-npm-ls@1.0.0 +| {CWD}/tap-testdir-ls-ls---long +| ++-- dev-dep@1.0.0 +| | A DEV dep kind of dep +| \`-- foo@1.0.0 +| | +| \`-- bar@1.0.0 +| ++-- lorem@1.0.0 +| ++-- optional-dep@1.0.0 +| Maybe a dep? ++-- peer-dep@1.0.0 +| Peer-dep description here +\`-- prod-dep@1.0.0 + | A PROD dep kind of dep + \`-- bar@2.0.0 + A dep that bars + +` + +exports[`test/lib/ls.js TAP ls --only=development > should output tree containing only development deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-development +\`-- dev-dep@1.0.0 + \`-- foo@1.0.0 + \`-- bar@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls --only=prod > should output tree containing only prod deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-prod ++-- lorem@1.0.0 ++-- optional-dep@1.0.0 +\`-- prod-dep@1.0.0 + \`-- bar@2.0.0 + +` + +exports[`test/lib/ls.js TAP ls --parseable --depth=0 > should output tree containing only top-level dependencies 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---depth-0 +{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/lorem +` + +exports[`test/lib/ls.js TAP ls --parseable --depth=1 > should output parseable containing top-level deps and their deps only 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---depth-1 +{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable --dev > should output tree containing dev deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---dev +{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable --link > should output tree containing linked deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---link +{CWD}/tap-testdir-ls-ls---parseable---link/node_modules/linked-dep +` + +exports[`test/lib/ls.js TAP ls --parseable --long --depth=0 > should output tree containing top-level deps with descriptions 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/dev-dep:dev-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/lorem:lorem@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/optional-dep:optional-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/peer-dep:peer-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/prod-dep:prod-dep@1.0.0 +` + +exports[`test/lib/ls.js TAP ls --parseable --long > should output tree info with descriptions 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/dev-dep:dev-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/lorem:lorem@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/optional-dep:optional-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/peer-dep:peer-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/prod-dep:prod-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/foo:foo@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/prod-dep/node_modules/bar:bar@2.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/bar:bar@1.0.0 +` + +exports[`test/lib/ls.js TAP ls --parseable --long missing/invalid/extraneous > should output parseable result containing EXTRANEOUS/INVALID labels 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/foo:foo@1.0.0:INVALID +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/lorem:lorem@1.0.0:EXTRANEOUS +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/bar:bar@1.0.0 +` + +exports[`test/lib/ls.js TAP ls --parseable --long print symlink target location > should output parseable results with symlink targets 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/dev-dep:dev-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/linked-dep:linked-dep@1.0.0:{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/linked-dep +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/lorem:lorem@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/optional-dep:optional-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/peer-dep:peer-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/prod-dep:prod-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/foo:foo@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/prod-dep/node_modules/bar:bar@2.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/bar:bar@1.0.0 +` + +exports[`test/lib/ls.js TAP ls --parseable --long with extraneous deps > should output long parseable output with extraneous info 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/foo:foo@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/lorem:lorem@1.0.0:EXTRANEOUS +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/bar:bar@1.0.0 +` + +exports[`test/lib/ls.js TAP ls --parseable --only=development > should output tree containing only development deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---only-development +{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable --only=prod > should output tree containing only prod deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---only-prod +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable --production > should output tree containing production deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---production +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/prod-dep/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable cycle deps > should print tree output omitting deduped ref 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-cycle-deps +{CWD}/tap-testdir-ls-ls---parseable-cycle-deps/node_modules/a +{CWD}/tap-testdir-ls-ls---parseable-cycle-deps/node_modules/b +` + +exports[`test/lib/ls.js TAP ls --parseable default --depth value should be 0 > should output parseable output containing only top-level dependencies 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0 +{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0/node_modules/lorem +` + +exports[`test/lib/ls.js TAP ls --parseable empty location > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-empty-location +` + +exports[`test/lib/ls.js TAP ls --parseable extraneous deps > should output containing problems info 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable from and resolved properties > should not be printed in tree output 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-from-and-resolved-properties +{CWD}/tap-testdir-ls-ls---parseable-from-and-resolved-properties/node_modules/simple-output +` + +exports[`test/lib/ls.js TAP ls --parseable global > should print parseable output for global deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-global +{CWD}/tap-testdir-ls-ls---parseable-global/node_modules/a +{CWD}/tap-testdir-ls-ls---parseable-global/node_modules/b +{CWD}/tap-testdir-ls-ls---parseable-global/node_modules/b/node_modules/c +` + +exports[`test/lib/ls.js TAP ls --parseable json read problems > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-json-read-problems +` + +exports[`test/lib/ls.js TAP ls --parseable missing package.json > should output parseable missing name/version of top-level package 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/bar +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/lorem +` + +exports[`test/lib/ls.js TAP ls --parseable missing/invalid/extraneous > should output parseable containing top-level deps and their deps only 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable no args > should output parseable representation of dependencies structure 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-no-args +{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable resolved points to git ref > should output tree containing git refs 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-resolved-points-to-git-ref +{CWD}/tap-testdir-ls-ls---parseable-resolved-points-to-git-ref/node_modules/abbrev +` + +exports[`test/lib/ls.js TAP ls --parseable unmet optional dep > should output parseable with empty entry for missing optional deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/peer-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/prod-dep/node_modules/bar +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable unmet peer dep > should output parseable signaling missing peer dep in problems 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/peer-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/prod-dep/node_modules/bar +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable using aliases > should output tree containing aliases 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-using-aliases +{CWD}/tap-testdir-ls-ls---parseable-using-aliases/node_modules/a +` + +exports[`test/lib/ls.js TAP ls --parseable with filter arg > should output parseable contaning only occurrences of filtered by package 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg/node_modules/lorem +` + +exports[`test/lib/ls.js TAP ls --parseable with filter arg nested dep > should output parseable contaning only occurrences of filtered package 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg-nested-dep/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --parseable with missing filter arg > should output parseable output containing no dependencies info 1`] = ` + +` + +exports[`test/lib/ls.js TAP ls --parseable with multiple filter args > should output parseable contaning only occurrences of multiple filtered packages and their ancestors 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/lorem +{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/bar +` + +exports[`test/lib/ls.js TAP ls --production > should output tree containing production deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---production ++-- lorem@1.0.0 ++-- optional-dep@1.0.0 +\`-- prod-dep@1.0.0 + \`-- bar@2.0.0 + +` + +exports[`test/lib/ls.js TAP ls broken resolved field > should NOT print git refs in output tree 1`] = ` +npm-broken-resolved-field-test@1.0.0 {CWD}/tap-testdir-ls-ls-broken-resolved-field +\`-- a@1.0.1 + +` + +exports[`test/lib/ls.js TAP ls colored output > should output tree containing color info 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-colored-output[0m +[0m+-- foo@1.0.0 [31m[40minvalid[49m[39m[0m +[0m| \`-- bar@1.0.0[0m +[0m+-- [31m[40mUNMET DEPENDENCY[49m[39m ipsum@^1.0.0[0m +[0m\`-- lorem@1.0.0 [32m[40mextraneous[49m[39m[0m +[0m[0m +` + +exports[`test/lib/ls.js TAP ls cycle deps > should print tree output containing deduped ref 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-cycle-deps +\`-- a@1.0.0 + \`-- b@1.0.0 + \`-- a@1.0.0 deduped + +` + +exports[`test/lib/ls.js TAP ls cycle deps with filter args > should print tree output containing deduped ref 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-cycle-deps-with-filter-args[0m +[0m\`-- [33m[40ma@1.0.0[49m[39m[0m +[0m \`-- b@1.0.0[0m +[0m \`-- [33m[40ma@1.0.0[49m[39m [90mdeduped[39m[0m +[0m[0m +` + +exports[`test/lib/ls.js TAP ls deduped missing dep > should output parseable signaling missing peer dep in problems 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-deduped-missing-dep ++-- a@1.0.0 +| \`-- UNMET DEPENDENCY b@^1.0.0 +\`-- UNMET DEPENDENCY b@^1.0.0 + +` + +exports[`test/lib/ls.js TAP ls default --depth value should be 0 > should output tree containing only top-level dependencies 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-default---depth-value-should-be-0 ++-- foo@1.0.0 +\`-- lorem@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls empty location > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls-empty-location +\`-- (empty) + +` + +exports[`test/lib/ls.js TAP ls extraneous deps > should output containing problems info 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-extraneous-deps ++-- foo@1.0.0 +| \`-- bar@1.0.0 +\`-- lorem@1.0.0 extraneous + +` + +exports[`test/lib/ls.js TAP ls filter pkg arg using depth option > should list a in top-level only 1`] = ` +test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/tap-testdir-ls-ls-filter-pkg-arg-using-depth-option +\`-- a@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls filter pkg arg using depth option > should print empty results msg 1`] = ` +test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/tap-testdir-ls-ls-filter-pkg-arg-using-depth-option +\`-- (empty) + +` + +exports[`test/lib/ls.js TAP ls filter pkg arg using depth option > should print expected result 1`] = ` +test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/tap-testdir-ls-ls-filter-pkg-arg-using-depth-option +\`-- b@1.0.0 + \`-- c@1.0.0 + \`-- d@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls filtering by child of missing dep > should print tree and not duplicate child of missing items 1`] = ` +filter-by-child-of-missing-dep@1.0.0 {CWD}/tap-testdir-ls-ls-filtering-by-child-of-missing-dep ++-- b@1.0.0 extraneous +| \`-- c@1.0.0 deduped ++-- c@1.0.0 extraneous +\`-- d@1.0.0 extraneous + \`-- c@2.0.0 extraneous + +` + +exports[`test/lib/ls.js TAP ls from and resolved properties > should not be printed in tree output 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-from-and-resolved-properties +\`-- simple-output@2.1.1 + +` + +exports[`test/lib/ls.js TAP ls global > should print tree and not mark top-level items extraneous 1`] = ` +{CWD}/tap-testdir-ls-ls-global ++-- a@1.0.0 +\`-- b@1.0.0 + \`-- c@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls invalid deduped dep > should output tree signaling mismatching peer dep in problems 1`] = ` +[0minvalid-deduped-dep@1.0.0 {CWD}/tap-testdir-ls-ls-invalid-deduped-dep[0m +[0m+-- a@1.0.0[0m +[0m| \`-- b@1.0.0 [90mdeduped[39m [31m[40minvalid[49m[39m[0m +[0m\`-- b@1.0.0 [31m[40minvalid[49m[39m[0m +[0m[0m +` + +exports[`test/lib/ls.js TAP ls invalid peer dep > should output tree signaling mismatching peer dep in problems 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-invalid-peer-dep ++-- dev-dep@1.0.0 +| \`-- foo@1.0.0 +| \`-- bar@1.0.0 ++-- lorem@1.0.0 ++-- optional-dep@1.0.0 ++-- peer-dep@1.0.0 invalid +\`-- prod-dep@1.0.0 + \`-- bar@2.0.0 + +` + +exports[`test/lib/ls.js TAP ls json read problems > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls-json-read-problems +\`-- (empty) + +` + +exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should filter single workspace 1`] = ` +filter-by-child-of-missing-dep@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces +\`-- a@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/a + +` + +exports[`test/lib/ls.js TAP ls loading a tree containing workspaces > should list workspaces properly 1`] = ` +filter-by-child-of-missing-dep@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces ++-- a@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/a +| \`-- c@1.0.0 +\`-- b@1.0.0 -> {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces/b + +` + +exports[`test/lib/ls.js TAP ls missing package.json > should output tree missing name/version of top-level package 1`] = ` +{CWD}/tap-testdir-ls-ls-missing-package.json ++-- bar@1.0.0 extraneous ++-- foo@1.0.0 extraneous +| \`-- bar@1.0.0 deduped +\`-- lorem@1.0.0 extraneous + +` + +exports[`test/lib/ls.js TAP ls missing/invalid/extraneous > should output tree containing missing, invalid, extraneous labels 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous ++-- foo@1.0.0 invalid +| \`-- bar@1.0.0 ++-- UNMET DEPENDENCY ipsum@^1.0.0 +\`-- lorem@1.0.0 extraneous + +` + +exports[`test/lib/ls.js TAP ls no args > should output tree representation of dependencies structure 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-no-args ++-- foo@1.0.0 +| \`-- bar@1.0.0 +\`-- lorem@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls print deduped symlinks > should output tree containing linked deps 1`] = ` +print-deduped-symlinks@1.0.0 {CWD}/tap-testdir-ls-ls-print-deduped-symlinks ++-- a@1.0.0 +| \`-- b@1.0.0 deduped -> {CWD}/tap-testdir-ls-ls-print-deduped-symlinks/b +\`-- b@1.0.0 -> {CWD}/tap-testdir-ls-ls-print-deduped-symlinks/b + +` + +exports[`test/lib/ls.js TAP ls resolved points to git ref > should output tree containing git refs 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-resolved-points-to-git-ref +\`-- abbrev@1.1.1 (git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c) + +` + +exports[`test/lib/ls.js TAP ls unmet optional dep > should output tree with empty entry for missing optional deps 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-unmet-optional-dep[0m +[0m+-- dev-dep@1.0.0[0m +[0m| \`-- foo@1.0.0[0m +[0m| \`-- bar@1.0.0[0m +[0m+-- lorem@1.0.0[0m +[0m+-- [33m[40mUNMET OPTIONAL DEPENDENCY[49m[39m missing-optional-dep@^1.0.0[0m +[0m+-- optional-dep@1.0.0 [31m[40minvalid[49m[39m[0m +[0m+-- peer-dep@1.0.0[0m +[0m\`-- prod-dep@1.0.0[0m +[0m \`-- bar@2.0.0[0m +[0m[0m +` + +exports[`test/lib/ls.js TAP ls unmet peer dep > should output tree signaling missing peer dep in problems 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-unmet-peer-dep +\`-- UNMET DEPENDENCY peer-dep@* + +` + +exports[`test/lib/ls.js TAP ls using aliases > should output tree containing aliases 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-using-aliases +\`-- a@npm:b@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls with args and dedupe entries > should print tree output containing deduped ref 1`] = ` +[0mdedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-args-and-dedupe-entries[0m +[0m+-- @npmcli/a@1.0.0[0m +[0m| \`-- [33m[40m@npmcli/b@1.1.2[49m[39m [90mdeduped[39m[0m +[0m+-- [33m[40m@npmcli/b@1.1.2[49m[39m[0m +[0m\`-- @npmcli/c@1.0.0[0m +[0m \`-- [33m[40m@npmcli/b@1.1.2[49m[39m [90mdeduped[39m[0m +[0m[0m +` + +exports[`test/lib/ls.js TAP ls with args and different order of items > should print tree output containing deduped ref 1`] = ` +dedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-args-and-different-order-of-items ++-- @npmcli/a@1.0.0 +| \`-- @npmcli/c@1.0.0 deduped ++-- @npmcli/b@1.1.2 +| \`-- @npmcli/c@1.0.0 deduped +\`-- @npmcli/c@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls with dot filter arg > should output tree contaning only occurrences of filtered by package and colored output 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-dot-filter-arg +\`-- (empty) + +` + +exports[`test/lib/ls.js TAP ls with filter arg > should output tree contaning only occurrences of filtered by package and colored output 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-filter-arg[0m +[0m\`-- [33m[40mlorem@1.0.0[49m[39m[0m +[0m[0m +` + +exports[`test/lib/ls.js TAP ls with filter arg nested dep > should output tree contaning only occurrences of filtered package and its ancestors 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-filter-arg-nested-dep +\`-- foo@1.0.0 + \`-- bar@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls with missing filter arg > should output tree containing no dependencies info 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-missing-filter-arg +\`-- (empty) + +` + +exports[`test/lib/ls.js TAP ls with multiple filter args > should output tree contaning only occurrences of multiple filtered packages and their ancestors 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-multiple-filter-args ++-- foo@1.0.0 +| \`-- bar@1.0.0 +\`-- lorem@1.0.0 + +` + +exports[`test/lib/ls.js TAP ls with no args dedupe entries > should print tree output containing deduped ref 1`] = ` +dedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-no-args-dedupe-entries ++-- @npmcli/a@1.0.0 +| \`-- @npmcli/b@1.1.2 deduped ++-- @npmcli/b@1.1.2 +\`-- @npmcli/c@1.0.0 + \`-- @npmcli/b@1.1.2 deduped + +` + +exports[`test/lib/ls.js TAP ls with no args dedupe entries and not displaying all > should print tree output containing deduped ref 1`] = ` +dedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-no-args-dedupe-entries-and-not-displaying-all ++-- @npmcli/a@1.0.0 ++-- @npmcli/b@1.1.2 +\`-- @npmcli/c@1.0.0 + +` diff --git a/deps/npm/tap-snapshots/test/lib/outdated.js.test.cjs b/deps/npm/tap-snapshots/test/lib/outdated.js.test.cjs new file mode 100644 index 00000000000000..e57d7110b2275a --- /dev/null +++ b/deps/npm/tap-snapshots/test/lib/outdated.js.test.cjs @@ -0,0 +1,154 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/outdated.js TAP should display outdated deps outdated --all > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by +alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha tap-testdir-outdated-should-display-outdated-deps +beta 1.0.0 1.0.1 1.0.1 node_modules/beta tap-testdir-outdated-should-display-outdated-deps +gamma 1.0.1 1.0.1 2.0.0 node_modules/gamma tap-testdir-outdated-should-display-outdated-deps +theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --json --long > must match snapshot 1`] = ` + +{ + "alpha": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha", + "type": "dependencies" + }, + "beta": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta", + "type": "peerDependencies" + }, + "gamma": { + "current": "1.0.1", + "wanted": "1.0.1", + "latest": "2.0.0", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma", + "type": "dependencies" + }, + "theta": { + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "type": "dependencies" + } +} +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --json > must match snapshot 1`] = ` + +{ + "alpha": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha" + }, + "beta": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta" + }, + "gamma": { + "current": "1.0.1", + "wanted": "1.0.1", + "latest": "2.0.0", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma" + }, + "theta": { + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps" + } +} +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --long > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by Package Type Homepage +alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha tap-testdir-outdated-should-display-outdated-deps dependencies +beta 1.0.0 1.0.1 1.0.1 node_modules/beta tap-testdir-outdated-should-display-outdated-deps peerDependencies +gamma 1.0.1 1.0.1 2.0.0 node_modules/gamma tap-testdir-outdated-should-display-outdated-deps dependencies +theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps dependencies +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=dev --omit=peer > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps +[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps +[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=dev > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps +[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta tap-testdir-outdated-should-display-outdated-deps +[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps +[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=prod > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps +[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta tap-testdir-outdated-should-display-outdated-deps +[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --parseable --long > must match snapshot 1`] = ` + +{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha:alpha@1.0.1:alpha@1.0.0:alpha@1.0.1:tap-testdir-outdated-should-display-outdated-deps:dependencies: +{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta:beta@1.0.1:beta@1.0.0:beta@1.0.1:tap-testdir-outdated-should-display-outdated-deps:peerDependencies: +{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma:gamma@1.0.1:gamma@1.0.1:gamma@2.0.0:tap-testdir-outdated-should-display-outdated-deps:dependencies: +:theta@1.0.1:MISSING:theta@1.0.1:tap-testdir-outdated-should-display-outdated-deps:dependencies: +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated --parseable > must match snapshot 1`] = ` + +{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha:alpha@1.0.1:alpha@1.0.0:alpha@1.0.1:tap-testdir-outdated-should-display-outdated-deps +{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta:beta@1.0.1:beta@1.0.0:beta@1.0.1:tap-testdir-outdated-should-display-outdated-deps +{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma:gamma@1.0.1:gamma@1.0.1:gamma@2.0.0:tap-testdir-outdated-should-display-outdated-deps +:theta@1.0.1:MISSING:theta@1.0.1:tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps +[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta tap-testdir-outdated-should-display-outdated-deps +[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps +[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated global > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by +alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha global +` + +exports[`test/lib/outdated.js TAP should display outdated deps outdated specific dep > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by +alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha tap-testdir-outdated-should-display-outdated-deps +` diff --git a/deps/npm/tap-snapshots/test-lib-owner.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/owner.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-owner.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/owner.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-profile.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/profile.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-profile.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/profile.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-publish.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/publish.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-publish.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/publish.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-search.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/search.js.test.cjs similarity index 95% rename from deps/npm/tap-snapshots/test-lib-search.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/search.js.test.cjs index 4b4dc75ea3e896..6544426ed5795f 100644 --- a/deps/npm/tap-snapshots/test-lib-search.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/search.js.test.cjs @@ -11,10 +11,10 @@ No matches found for "foo" exports[`test/lib/search.js TAP search <name> --searchexclude --searchopts > should have filtered expected search results 1`] = ` NAME | AUTHOR | DATE | VERSION | KEYWORDS -foo | =foo | prehistoric | 1.0.0 | +foo | =foo | prehistoric | 1.0.0 | ` exports[`test/lib/search.js TAP search <name> > should have expected search results 1`] = ` -NAME | AUTHOR | DATE | VERSION | KEYWORDS -libnpm | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager liblibnpmaccess | =nlf… | 2020-11-03 | 4.0.1 | @evocateur/libnpmaccess | =evocateur | 2019-07-16 | 3.1.2 | @evocateur/libnpmpublish | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teamslibnpmsearch | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpmlibnpmteam | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm apilibnpmpublish | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund@npmcli/map-workspaces | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaceslibnpmversion | =nlf… | 2020-11-04 | 1.0.7 | @types/libnpmsearch | =types | 2019-09-26 | 2.0.1 | +NAME | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager liblibnpmaccess | =nlf… | 2020-11-03 | 4.0.1 | @evocateur/libnpmaccess | =evocateur | 2019-07-16 | 3.1.2 | @evocateur/libnpmpublish | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teamslibnpmsearch | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpmlibnpmteam | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm apilibnpmpublish | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund@npmcli/map-workspaces | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaceslibnpmversion | =nlf… | 2020-11-04 | 1.0.7 | @types/libnpmsearch | =types | 2019-09-26 | 2.0.1 | ` diff --git a/deps/npm/tap-snapshots/test-lib-stars.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/stars.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-stars.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/stars.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-team.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/team.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-team.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/team.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-config-definition.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/config/definition.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-config-definition.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/config/definition.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-config-definitions.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs similarity index 99% rename from deps/npm/tap-snapshots/test-lib-utils-config-definitions.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index b3d920a0ca2845..32443c57af35ba 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-config-definitions.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -12,7 +12,6 @@ Array [ "all", "allow-same-version", "also", - "always-auth", "audit", "audit-level", "auth-type", diff --git a/deps/npm/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs similarity index 99% rename from deps/npm/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs index 6c265906261157..d6761ea30c74b5 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs @@ -44,14 +44,6 @@ upon by the current project. Prevents throwing an error when \`npm version\` is used to set the new version to the same value as the current version. -#### \`always-auth\` - -* Default: false -* Type: Boolean - -Force npm to always require authentication when accessing the registry, even -for \`GET\` requests. - #### \`audit\` * Default: true @@ -966,7 +958,8 @@ installation of packages specified according to the pattern * Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows * Type: null or String -The shell to use for scripts run with the \`npm run\` command. +The shell to use for scripts run with the \`npm exec\`, \`npm run\` and \`npm +init <pkg>\` commands. #### \`searchexclude\` diff --git a/deps/npm/tap-snapshots/test-lib-utils-config-index.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/config/index.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-config-index.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/config/index.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-error-handler.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/error-handler.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-error-handler.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/error-handler.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-error-message.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs similarity index 67% rename from deps/npm/tap-snapshots/test-lib-utils-error-message.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs index bcf5144499f244..18101f67b7374f 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-error-message.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/utils/error-message.js.test.cjs @@ -28,7 +28,10 @@ Object { ], Array [ "404", - "\\nNote that you can also install from a", + String( + + Note that you can also install from a + ), ], Array [ "404", @@ -67,7 +70,10 @@ Object { ], Array [ "404", - "\\nNote that you can also install from a", + String( + + Note that you can also install from a + ), ], Array [ "404", @@ -113,7 +119,10 @@ Object { ], Array [ "404", - "\\nNote that you can also install from a", + String( + + Note that you can also install from a + ), ], Array [ "404", @@ -134,7 +143,11 @@ Object { "detail": Array [ Array [ "notsup", - "Not compatible with your version of node/npm: some@package\\nRequired: undefined\\nActual: {\\"npm\\":\\"123.69.420-npm\\",\\"node\\":\\"99.99.99\\"}", + String( + Not compatible with your version of node/npm: some@package + Required: undefined + Actual: {"npm":"123.69.420-npm","node":"99.99.99"} + ), ], ], "summary": Array [ @@ -155,7 +168,12 @@ Object { "detail": Array [ Array [ "notsup", - "Valid OS: !yours,mine\\nValid Arch: x420,x69\\nActual OS: posix\\nActual Arch: x64", + String( + Valid OS: !yours,mine + Valid Arch: x420,x69 + Actual OS: posix + Actual Arch: x64 + ), ], ], "summary": Array [ @@ -172,7 +190,12 @@ Object { "detail": Array [ Array [ "notsup", - "Valid OS: !yours\\nValid Arch: x420\\nActual OS: posix\\nActual Arch: x64", + String( + Valid OS: !yours + Valid Arch: x420 + Actual OS: posix + Actual Arch: x64 + ), ], ], "summary": Array [ @@ -246,7 +269,15 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt is likely you do not have the permissions to access this file as the current user\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It is likely you do not have the permissions to access this file as the current user + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -271,7 +302,15 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt is likely you do not have the permissions to access this file as the current user\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It is likely you do not have the permissions to access this file as the current user + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -296,7 +335,15 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt is likely you do not have the permissions to access this file as the current user\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It is likely you do not have the permissions to access this file as the current user + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -321,7 +368,15 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt is likely you do not have the permissions to access this file as the current user\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It is likely you do not have the permissions to access this file as the current user + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -346,7 +401,15 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt is likely you do not have the permissions to access this file as the current user\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It is likely you do not have the permissions to access this file as the current user + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -372,7 +435,14 @@ Object { "summary": Array [ Array [ "", - "\\nYour cache folder contains root-owned files, due to a bug in\\nprevious versions of npm which has since been addressed.\\n\\nTo permanently fix this problem, please run:\\n sudo chown -R 69:420 \\"/some/cache/dir\\"", + String( + + Your cache folder contains root-owned files, due to a bug in + previous versions of npm which has since been addressed. + + To permanently fix this problem, please run: + sudo chown -R 69:420 "/some/cache/dir" + ), ], ], } @@ -392,7 +462,14 @@ Object { "summary": Array [ Array [ "", - "\\nYour cache folder contains root-owned files, due to a bug in\\nprevious versions of npm which has since been addressed.\\n\\nTo permanently fix this problem, please run:\\n sudo chown -R 69:420 \\"/some/cache/dir\\"", + String( + + Your cache folder contains root-owned files, due to a bug in + previous versions of npm which has since been addressed. + + To permanently fix this problem, please run: + sudo chown -R 69:420 "/some/cache/dir" + ), ], ], } @@ -412,7 +489,14 @@ Object { "summary": Array [ Array [ "", - "\\nYour cache folder contains root-owned files, due to a bug in\\nprevious versions of npm which has since been addressed.\\n\\nTo permanently fix this problem, please run:\\n sudo chown -R 69:420 \\"/some/cache/dir\\"", + String( + + Your cache folder contains root-owned files, due to a bug in + previous versions of npm which has since been addressed. + + To permanently fix this problem, please run: + sudo chown -R 69:420 "/some/cache/dir" + ), ], ], } @@ -431,7 +515,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -456,7 +549,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -481,7 +583,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -506,7 +617,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -531,7 +651,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -556,7 +685,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -581,7 +719,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -606,7 +753,16 @@ Object { "detail": Array [ Array [ "", - "\\nThe operation was rejected by your operating system.\\nIt's possible that the file was already in use (by a text editor or antivirus),\\nor that you lack permissions to access it.\\n\\nIf you believe this might be a permissions issue, please double-check the\\npermissions of the file and its containing directories, or try running\\nthe command again as root/Administrator.", + String( + + The operation was rejected by your operating system. + It's possible that the file was already in use (by a text editor or antivirus), + or that you lack permissions to access it. + + If you believe this might be a permissions issue, please double-check the + permissions of the file and its containing directories, or try running + the command again as root/Administrator. + ), ], ], "summary": Array [ @@ -695,7 +851,11 @@ Object { "detail": Array [ Array [ "", - "You can provide a one-time password by passing --otp=<code> to the command you ran.\\nIf you already provided a one-time password then it is likely that you either typoed\\nit, or it timed out. Please try again.", + String( + You can provide a one-time password by passing --otp=<code> to the command you ran. + If you already provided a one-time password then it is likely that you either typoed + it, or it timed out. Please try again. + ), ], ], "summary": Array [ @@ -712,7 +872,11 @@ Object { "detail": Array [ Array [ "", - "You can provide a one-time password by passing --otp=<code> to the command you ran.\\nIf you already provided a one-time password then it is likely that you either typoed\\nit, or it timed out. Please try again.", + String( + You can provide a one-time password by passing --otp=<code> to the command you ran. + If you already provided a one-time password then it is likely that you either typoed + it, or it timed out. Please try again. + ), ], ], "summary": Array [ @@ -729,7 +893,17 @@ Object { "detail": Array [ Array [ "", - "If you were trying to login, change your password, create an\\nauthentication token or enable two-factor authentication then\\nthat means you likely typed your password in incorrectly.\\nPlease try again, or recover your password at:\\n https://www.npmjs.com/forgot\\n\\nIf you were doing some other operation then your saved credentials are\\nprobably out of date. To correct this please try logging in again with:\\n npm login", + String( + If you were trying to login, change your password, create an + authentication token or enable two-factor authentication then + that means you likely typed your password in incorrectly. + Please try again, or recover your password at: + https://www.npmjs.com/forgot + + If you were doing some other operation then your saved credentials are + probably out of date. To correct this please try logging in again with: + npm login + ), ], ], "summary": Array [ @@ -746,7 +920,10 @@ Object { "detail": Array [ Array [ "", - "To correct this please trying logging in again with:\\n npm login", + String( + To correct this please trying logging in again with: + npm login + ), ], ], "summary": Array [ @@ -820,7 +997,13 @@ Object { "detail": Array [ Array [ "network", - "This is a problem related to network connectivity.\\nIn most cases you are behind a proxy or have bad network settings.\\n\\nIf you are behind a proxy, please make sure that the\\n'proxy' config is set properly. See: 'npm help config'", + String( + This is a problem related to network connectivity. + In most cases you are behind a proxy or have bad network settings. + + If you are behind a proxy, please make sure that the + 'proxy' config is set properly. See: 'npm help config' + ), ], ], "summary": Array [ @@ -837,7 +1020,13 @@ Object { "detail": Array [ Array [ "network", - "This is a problem related to network connectivity.\\nIn most cases you are behind a proxy or have bad network settings.\\n\\nIf you are behind a proxy, please make sure that the\\n'proxy' config is set properly. See: 'npm help config'", + String( + This is a problem related to network connectivity. + In most cases you are behind a proxy or have bad network settings. + + If you are behind a proxy, please make sure that the + 'proxy' config is set properly. See: 'npm help config' + ), ], ], "summary": Array [ @@ -854,7 +1043,13 @@ Object { "detail": Array [ Array [ "network", - "This is a problem related to network connectivity.\\nIn most cases you are behind a proxy or have bad network settings.\\n\\nIf you are behind a proxy, please make sure that the\\n'proxy' config is set properly. See: 'npm help config'", + String( + This is a problem related to network connectivity. + In most cases you are behind a proxy or have bad network settings. + + If you are behind a proxy, please make sure that the + 'proxy' config is set properly. See: 'npm help config' + ), ], ], "summary": Array [ @@ -871,7 +1066,11 @@ Object { "detail": Array [ Array [ "notsup", - "Not compatible with your version of node/npm: some@package\\nRequired: undefined\\nActual: {\\"npm\\":\\"123.69.420-npm\\",\\"node\\":\\"123.69.420-node\\"}", + String( + Not compatible with your version of node/npm: some@package + Required: undefined + Actual: {"npm":"123.69.420-npm","node":"123.69.420-node"} + ), ], ], "summary": Array [ @@ -892,7 +1091,10 @@ Object { "detail": Array [ Array [ "nospc", - "There appears to be insufficient space on your system to finish.\\nClear up some disk space and try again.", + String( + There appears to be insufficient space on your system to finish. + Clear up some disk space and try again. + ), ], ], "summary": Array [ @@ -909,7 +1111,10 @@ Object { "detail": Array [ Array [ "rofs", - "Often virtualized file systems, or other file systems\\nthat don't support symlinks, give this error.", + String( + Often virtualized file systems, or other file systems + that don't support symlinks, give this error. + ), ], ], "summary": Array [ @@ -926,7 +1131,11 @@ Object { "detail": Array [ Array [ "enoent", - "This is related to npm not being able to find a file.\\n\\nCheck if the file '/some/file' is present.", + String( + This is related to npm not being able to find a file. + + Check if the file '/some/file' is present. + ), ], ], "summary": Array [ @@ -943,7 +1152,10 @@ Object { "detail": Array [ Array [ "typeerror", - "This is an error with npm itself. Please report this error at:\\n https://github.com/npm/cli/issues", + String( + This is an error with npm itself. Please report this error at: + https://github.com/npm/cli/issues + ), ], ], "summary": Array [ @@ -960,7 +1172,10 @@ Object { "detail": Array [ Array [ "typeerror", - "This is an error with npm itself. Please report this error at:\\n https://github.com/npm/cli/issues", + String( + This is an error with npm itself. Please report this error at: + https://github.com/npm/cli/issues + ), ], ], "summary": Array [ @@ -977,7 +1192,10 @@ Object { "detail": Array [ Array [ "typeerror", - "This is an error with npm itself. Please report this error at:\\n https://github.com/npm/cli/issues", + String( + This is an error with npm itself. Please report this error at: + https://github.com/npm/cli/issues + ), ], ], "summary": Array [ @@ -1015,7 +1233,10 @@ Object { "detail": Array [ Array [ "typeerror", - "This is an error with npm itself. Please report this error at:\\n https://github.com/npm/cli/issues", + String( + This is an error with npm itself. Please report this error at: + https://github.com/npm/cli/issues + ), ], ], "summary": Array [ @@ -1032,7 +1253,10 @@ Object { "detail": Array [ Array [ "notarget", - "In most cases you or one of your dependencies are requesting\\na package version that doesn't exist.", + String( + In most cases you or one of your dependencies are requesting + a package version that doesn't exist. + ), ], ], "summary": Array [ @@ -1049,7 +1273,11 @@ Object { "detail": Array [ Array [ "403", - "In most cases, you or one of your dependencies are requesting\\na package version that is forbidden by your security policy, or\\non a server you do not have access to.", + String( + In most cases, you or one of your dependencies are requesting + a package version that is forbidden by your security policy, or + on a server you do not have access to. + ), ], ], "summary": Array [ @@ -1066,7 +1294,11 @@ Object { "detail": Array [ Array [ "", - "\\nIf you are behind a proxy, please make sure that the\\n'proxy' config is set properly. See: 'npm help config'", + String( + + If you are behind a proxy, please make sure that the + 'proxy' config is set properly. See: 'npm help config' + ), ], ], "summary": Array [ @@ -1088,7 +1320,11 @@ Object { "detail": Array [ Array [ "", - "\\nFailed using git.\\nPlease check if you have git installed and in your PATH.", + String( + + Failed using git. + Please check if you have git installed and in your PATH. + ), ], ], "summary": Array [ @@ -1134,7 +1370,10 @@ Object { "detail": Array [ Array [ "git", - "Refusing to remove it. Update manually,\\nor move it out of the way first.", + String( + Refusing to remove it. Update manually, + or move it out of the way first. + ), ], ], "summary": Array [ @@ -1197,7 +1436,13 @@ Object { "detail": Array [ Array [ "network", - "This is a problem related to network connectivity.\\nIn most cases you are behind a proxy or have bad network settings.\\n\\nIf you are behind a proxy, please make sure that the\\n'proxy' config is set properly. See: 'npm help config'", + String( + This is a problem related to network connectivity. + In most cases you are behind a proxy or have bad network settings. + + If you are behind a proxy, please make sure that the + 'proxy' config is set properly. See: 'npm help config' + ), ], ], "summary": Array [ @@ -1226,7 +1471,10 @@ Object { "detail": Array [ Array [ "JSON.parse", - "Failed to parse JSON data.\\nNote: package.json must be actual JSON, not just JavaScript.", + String( + Failed to parse JSON data. + Note: package.json must be actual JSON, not just JavaScript. + ), ], ], "summary": Array [ @@ -1243,7 +1491,10 @@ Object { "detail": Array [ Array [ "JSON.parse", - "Failed to parse JSON data.\\nNote: package.json must be actual JSON, not just JavaScript.", + String( + Failed to parse JSON data. + Note: package.json must be actual JSON, not just JavaScript. + ), ], ], "summary": Array [ @@ -1260,7 +1511,13 @@ Object { "detail": Array [ Array [ "", - "Merge conflict detected in your package.json.\\n\\nPlease resolve the package.json conflict and retry the command:\\n\\n$ arg v", + String( + Merge conflict detected in your package.json. + + Please resolve the package.json conflict and retry the command: + + $ arg v + ), ], ], "summary": Array [], diff --git a/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/explain-dep.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/explain-dep.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-explain-eresolve.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/explain-eresolve.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-explain-eresolve.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/explain-eresolve.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs similarity index 81% rename from deps/npm/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index 2f5a479dbc4700..c0cb3241d93c68 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -166,9 +166,9 @@ npm help npm more involved overview All commands: access npm access - + Set access level on published packages - + Usage: npm access public [<package>] npm access restricted [<package>] @@ -179,62 +179,63 @@ All commands: npm access ls-packages [<user>|<scope>|<scope:team>] npm access ls-collaborators [<package> [<user>]] npm access edit [<package>] - + Run "npm help access" for more info adduser npm adduser - + Add a registry user account - + Usage: npm adduser - + Options: - [--registry <registry>] [--scope <@scope>] [--always-auth] - + [--registry <registry>] [--scope <@scope>] + aliases: login, add-user - + Run "npm help adduser" for more info audit npm audit - + Run a security audit - + Usage: npm audit [fix] - + Options: - [--audit-level <info|low|moderate|high|critical|none>] [--dry-run] [-f|--force] [--json] [--package-lock-only] [--production] - + [--audit-level <info|low|moderate|high|critical|none>] [--dry-run] [-f|--force] + [--json] [--package-lock-only] [--production] + Run "npm help audit" for more info bin npm bin - + Display npm bin folder - + Usage: npm bin - + Options: [-g|--global] - + Run "npm help bin" for more info bugs npm bugs - + Report bugs for a package in a web browser - + Usage: npm bugs [<pkgname>] - + alias: issues - + Run "npm help bugs" for more info cache npm cache - + Manipulates packages cache - + Usage: npm cache add <tarball file> npm cache add <folder> @@ -243,232 +244,241 @@ All commands: npm cache add <name>@<version> npm cache clean npm cache verify - + Run "npm help cache" for more info ci npm ci - + Install a project with a clean slate - + Usage: npm ci - + aliases: clean-install, ic, install-clean, isntall-clean - + Run "npm help ci" for more info completion npm completion - + Tab Completion for npm - + Usage: npm completion - + Run "npm help completion" for more info config npm config - + Manage the npm configuration files - + Usage: npm config set <key>=<value> [<key>=<value> ...] npm config get [<key> [<key> ...]] npm config delete <key> [<key> ...] npm config list [--json] npm config edit - + alias: c - + Run "npm help config" for more info dedupe npm dedupe - + Reduce duplication in the package tree - + Usage: npm dedupe - + alias: ddp - + Run "npm help dedupe" for more info deprecate npm deprecate - + Deprecate a version of a package - + Usage: npm deprecate <pkg>[@<version>] <message> - + Run "npm help deprecate" for more info diff npm diff - + The registry diff command - + Usage: npm diff [...<paths>] npm diff --diff=<pkg-name> [...<paths>] npm diff --diff=<version-a> [--diff=<version-b>] [...<paths>] npm diff --diff=<spec-a> [--diff=<spec-b>] [...<paths>] npm diff [--diff-ignore-all-space] [--diff-name-only] [...<paths>] [...<paths>] - + Run "npm help diff" for more info dist-tag npm dist-tag - + Modify package distribution tags - + Usage: npm dist-tag add <pkg>@<version> [<tag>] npm dist-tag rm <pkg> <tag> npm dist-tag ls [<pkg>] - + Options: - [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] alias: dist-tags - + Run "npm help dist-tag" for more info docs npm docs - + Open documentation for a package in a web browser - + Usage: npm docs [<pkgname> [<pkgname> ...]] - + Options: - [--browser|--browser <browser>] [--registry <registry>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] + [--browser|--browser <browser>] [--registry <registry>] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] alias: home - + Run "npm help docs" for more info doctor npm doctor - + Check your npm environment - + Usage: npm doctor - + Run "npm help doctor" for more info edit npm edit - + Edit an installed package - + Usage: npm edit <pkg>[/<subpkg>...] - + Run "npm help edit" for more info exec npm exec - + Run a command from a local or remote npm package - + Usage: npm exec -- <pkg>[@<version>] [args...] npm exec --package=<pkg>[@<version>] -- <cmd> [args...] npm exec -c '<cmd> [args...]' npm exec --package=foo -c '<cmd> [args...]' - + Options: - [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] alias: x - + Run "npm help exec" for more info explain npm explain - + Explain installed packages - + Usage: npm explain <folder | specifier> - + alias: why - + Run "npm help explain" for more info explore npm explore - + Browse an installed package - + Usage: npm explore <pkg> [ -- <command>] - + Run "npm help explore" for more info find-dupes npm find-dupes - + Find duplication in the package tree - + Usage: npm find-dupes - + Run "npm help find-dupes" for more info fund npm fund - + Retrieve funding information - + Usage: npm fund [[<@scope>/]<pkg>] - + Options: - [--json] [--browser|--browser <browser>] [--unicode] [--which <fundingSourceNumber>] - + [--json] [--browser|--browser <browser>] [--unicode] + [--which <fundingSourceNumber>] + Run "npm help fund" for more info get npm get - + Get a value from the npm configuration - + Usage: npm get [<key> ...] (See \`npm config\`) - + Run "npm help get" for more info help npm help - + Get help on npm - + Usage: npm help <term> [<terms..>] - + alias: hlep - + Run "npm help help" for more info hook npm hook - + Manage registry hooks - + Usage: npm hook add <pkg> <url> <secret> [--type=<type>] npm hook ls [pkg] npm hook rm <id> npm hook update <id> <url> <secret> - + Run "npm help hook" for more info init npm init - + Create a package.json file - + Usage: npm init [--force|-f|--yes|-y|--scope] npm init <@scope> (same as \`npx <@scope>/create\`) npm init [<@scope>/]<name> (same as \`npx [<@scope>/]create-<name>\`) - + + Options: + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] + aliases: create, innit - + Run "npm help init" for more info install npm install - + Install a package - + Usage: npm install [<@scope>/]<pkg> npm install [<@scope>/]<pkg>@<tag> @@ -480,29 +490,30 @@ All commands: npm install <tarball url> npm install <git:// url> npm install <github username>/<github project> - + Options: - [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] - + [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] + [-E|--save-exact] + aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, add - + Run "npm help install" for more info install-ci-test npm install-ci-test - + Install a project with a clean slate and run tests - + Usage: npm install-ci-test - + alias: cit - + Run "npm help install-ci-test" for more info install-test npm install-test - + Install package(s) and run tests - + Usage: npm install-test [<@scope>/]<pkg> npm install-test [<@scope>/]<pkg>@<tag> @@ -514,432 +525,446 @@ All commands: npm install-test <tarball url> npm install-test <git:// url> npm install-test <github username>/<github project> - + Options: - [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] [-E|--save-exact] - + [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] + [-E|--save-exact] + alias: it - + Run "npm help install-test" for more info link npm link - + Symlink a package folder - + Usage: npm link (in package dir) npm link [<@scope>/]<pkg>[@<version>] - + alias: ln - + Run "npm help link" for more info ll npm ll - + List installed packages - + Usage: npm ll [[<@scope>/]<pkg> ...] - + alias: la - + Run "npm help ll" for more info login npm adduser - + Add a registry user account - + Usage: npm adduser - + Options: - [--registry <registry>] [--scope <@scope>] [--always-auth] - + [--registry <registry>] [--scope <@scope>] + aliases: login, add-user - + Run "npm help adduser" for more info logout npm logout - + Log out of the registry - + Usage: npm logout - + Options: [--registry <registry>] [--scope <@scope>] - + Run "npm help logout" for more info ls npm ls - + List installed packages - + Usage: npm ls npm ls [[<@scope>/]<pkg> ...] - + alias: list - + Run "npm help ls" for more info org npm org - + Manage orgs - + Usage: npm org set orgname username [developer | admin | owner] npm org rm orgname username npm org ls orgname [<username>] - + alias: ogr - + Run "npm help org" for more info outdated npm outdated - + Check for outdated packages - + Usage: npm outdated [[<@scope>/]<pkg> ...] - + Run "npm help outdated" for more info owner npm owner - + Manage package owners - + Usage: npm owner add <user> [<@scope>/]<pkg> npm owner rm <user> [<@scope>/]<pkg> npm owner ls [<@scope>/]<pkg> - + alias: author - + Run "npm help owner" for more info pack npm pack - + Create a tarball from a package - + Usage: npm pack [[<@scope>/]<pkg>...] - + Options: - [--dry-run] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] - + [--dry-run] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] + Run "npm help pack" for more info ping npm ping - + Ping npm registry - + Usage: npm ping - + Options: [--registry <registry>] - + Run "npm help ping" for more info prefix npm prefix - + Display prefix - + Usage: npm prefix [-g] - + Run "npm help prefix" for more info profile npm profile - + Change settings on your registry profile - + Usage: npm profile enable-2fa [auth-only|auth-and-writes] npm profile disable-2fa npm profile get [<key>] npm profile set <key> <value> - + Run "npm help profile" for more info prune npm prune - + Remove extraneous packages - + Usage: npm prune [[<@scope>/]<pkg>...] - + Options: [--production] - + Run "npm help prune" for more info publish npm publish - + Publish a package - + Usage: npm publish [<folder>] - + Options: [--tag <tag>] [--access <restricted|public>] [--dry-run] - + Run "npm help publish" for more info rebuild npm rebuild - + Rebuild a package - + Usage: npm rebuild [[<@scope>/]<name>[@<version>] ...] - + alias: rb - + Run "npm help rebuild" for more info repo npm repo - + Open package repository page in the browser - + Usage: npm repo [<pkgname> [<pkgname> ...]] - + Options: - [--browser|--browser <browser>] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] + [--browser|--browser <browser>] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] Run "npm help repo" for more info restart npm restart - + Restart a package - + Usage: npm restart [-- <args>] - + Run "npm help restart" for more info root npm root - + Display npm root - + Usage: npm root - + Options: [-g|--global] - + Run "npm help root" for more info run-script npm run-script - + Run arbitrary package scripts - + Usage: npm run-script <command> [-- <args>] - + Options: - [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] aliases: run, rum, urn - + Run "npm help run-script" for more info search npm search - + Search for pacakges - + Usage: npm search [search terms ...] - + Options: [-l|--long] [--json] [-p|--parseable] [--no-description] - + aliases: s, se, find - + Run "npm help search" for more info set npm set - + Set a value in the npm configuration - + Usage: npm set <key>=<value> [<key>=<value> ...] (See \`npm config\`) - + Run "npm help set" for more info set-script npm set-script - + Set tasks in the scripts section of package.json - + Usage: npm set-script [<script>] [<command>] - + Options: - [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] Run "npm help set-script" for more info shrinkwrap npm shrinkwrap - + Lock down dependency versions for publication - + Usage: npm shrinkwrap - + Run "npm help shrinkwrap" for more info star npm star - + Mark your favorite packages - + Usage: npm star [<pkg>...] - + Run "npm help star" for more info stars npm stars - + View packages marked as favorites - + Usage: npm stars [<user>] - + Run "npm help stars" for more info start npm start - + Start a package - + Usage: npm start [-- <args>] - + Run "npm help start" for more info stop npm stop - + Stop a package - + Usage: npm stop [-- <args>] - + Run "npm help stop" for more info team npm team - + Manage organization teams and team memberships - + Usage: npm team create <scope:team> [--otp <otpcode>] npm team destroy <scope:team> [--otp <otpcode>] npm team add <scope:team> <user> [--otp <otpcode>] npm team rm <scope:team> <user> [--otp <otpcode>] npm team ls <scope>|<scope:team> - + Run "npm help team" for more info test npm test - + Test a package - + Usage: npm test [-- <args>] - + aliases: tst, t - + Run "npm help test" for more info token npm token - + Manage your authentication tokens - + Usage: npm token list npm token revoke <id|token> npm token create [--read-only] [--cidr=list] - + Run "npm help token" for more info uninstall npm uninstall - + Remove a package - + Usage: npm uninstall [<@scope>/]<pkg>... - + Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer] - + aliases: un, unlink, remove, rm, r - + Run "npm help uninstall" for more info unpublish npm unpublish - + Remove a package from the registry - + Usage: npm unpublish [<@scope>/]<pkg>[@<version>] - + Run "npm help unpublish" for more info unstar npm unstar - + Remove an item from your favorite packages - + Usage: npm unstar [<pkg>...] - + Run "npm help unstar" for more info update npm update - + Update packages - + Usage: npm update [<pkg>...] - + Options: [-g|--global] - + aliases: up, upgrade, udpate - + Run "npm help update" for more info version npm version - + Bump a package version - + Usage: - npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git] - + npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] + + Options: + [--allow-same-version] [--commit-hooks] [--git-tag-version] [--json] + [--preid prerelease-id] [--sign-git-tag] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] + alias: verison - + Run "npm help version" for more info view npm view - + View registry info - + Usage: npm view [<@scope>/]<pkg>[@<version>] [<field>[.subfield]...] - + Options: - [--json] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] [-ws|--workspaces] + [--json] [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] aliases: v, info, show - + Run "npm help view" for more info whoami npm whoami - + Display npm username - + Usage: npm whoami - + Options: [--registry <registry>] - + Run "npm help whoami" for more info Specify configs in the ini-formatted file: diff --git a/deps/npm/tap-snapshots/test-lib-utils-open-url.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/open-url.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-open-url.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/open-url.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-reify-finish.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/reify-finish.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-reify-finish.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/reify-finish.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-reify-output.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/reify-output.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-reify-output.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/reify-output.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-utils-tar.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/tar.js.test.cjs similarity index 55% rename from deps/npm/tap-snapshots/test-lib-utils-tar.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/tar.js.test.cjs index 5c3813dd8db43b..e117b38def9b23 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-tar.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test/lib/utils/tar.js.test.cjs @@ -17,17 +17,17 @@ package: my-cool-pkg@1.0.0 bundle-dep === Tarball Details === -name: my-cool-pkg -version: 1.0.0 -filename: my-cool-pkg-1.0.0.tgz -package size: 216 B -unpacked size: 101 B +name: my-cool-pkg +version: 1.0.0 +filename: my-cool-pkg-1.0.0.tgz +package size: 216 B +unpacked size: 101 B shasum: a604258e06adecec0b18f48e901c5802f19f7dab integrity: sha512-fnN6NmI8DerTt[...]6rH17jx7OIFig== -bundled deps: 1 -bundled files: 0 -own files: 2 -total files: 2 +bundled deps: 1 +bundled files: 0 +own files: 2 +total files: 2 ` diff --git a/deps/npm/tap-snapshots/test-lib-utils-update-notifier.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/utils/update-notifier.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-utils-update-notifier.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/utils/update-notifier.js.test.cjs diff --git a/deps/npm/tap-snapshots/test-lib-view.js-TAP.test.js b/deps/npm/tap-snapshots/test/lib/view.js.test.cjs similarity index 100% rename from deps/npm/tap-snapshots/test-lib-view.js-TAP.test.js rename to deps/npm/tap-snapshots/test/lib/view.js.test.cjs diff --git a/deps/npm/test/bin/npm-cli.js b/deps/npm/test/bin/npm-cli.js index bcca99c8c8fe1f..7b4b619e2b7712 100644 --- a/deps/npm/test/bin/npm-cli.js +++ b/deps/npm/test/bin/npm-cli.js @@ -1,7 +1,6 @@ const t = require('tap') -const requireInject = require('require-inject') t.test('loading the bin calls the implementation', t => { - requireInject('../../bin/npm-cli.js', { + t.mock('../../bin/npm-cli.js', { '../../lib/cli.js': proc => { t.equal(proc, process, 'called implementation with process object') t.end() diff --git a/deps/npm/test/bin/npx-cli.js b/deps/npm/test/bin/npx-cli.js index 2b7b488297cab2..5eeee301843635 100644 --- a/deps/npm/test/bin/npx-cli.js +++ b/deps/npm/test/bin/npx-cli.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const npx = require.resolve('../../bin/npx-cli.js') const cli = require.resolve('../../lib/cli.js') const npm = require.resolve('../../bin/npm-cli.js') @@ -7,42 +6,39 @@ const npm = require.resolve('../../bin/npm-cli.js') const logs = [] console.error = (...msg) => logs.push(msg) -t.afterEach(cb => { - logs.length = 0 - cb() -}) +t.afterEach(() => logs.length = 0) t.test('npx foo -> npm exec -- foo', t => { process.argv = ['node', npx, 'foo'] - requireInject(npx, { [cli]: () => {} }) + t.mock(npx, { [cli]: () => {} }) t.strictSame(process.argv, ['node', npm, 'exec', '--', 'foo']) t.end() }) t.test('npx -- foo -> npm exec -- foo', t => { process.argv = ['node', npx, '--', 'foo'] - requireInject(npx, { [cli]: () => {} }) + t.mock(npx, { [cli]: () => {} }) t.strictSame(process.argv, ['node', npm, 'exec', '--', 'foo']) t.end() }) t.test('npx -x y foo -z -> npm exec -x y -- foo -z', t => { process.argv = ['node', npx, '-x', 'y', 'foo', '-z'] - requireInject(npx, { [cli]: () => {} }) + t.mock(npx, { [cli]: () => {} }) t.strictSame(process.argv, ['node', npm, 'exec', '-x', 'y', '--', 'foo', '-z']) t.end() }) t.test('npx --x=y --no-install foo -z -> npm exec --x=y -- foo -z', t => { process.argv = ['node', npx, '--x=y', '--no-install', 'foo', '-z'] - requireInject(npx, { [cli]: () => {} }) + t.mock(npx, { [cli]: () => {} }) t.strictSame(process.argv, ['node', npm, 'exec', '--x=y', '--yes=false', '--', 'foo', '-z']) t.end() }) t.test('transform renamed options into proper values', t => { process.argv = ['node', npx, '-y', '--shell=bash', '-p', 'foo', '-c', 'asdf'] - requireInject(npx, { [cli]: () => {} }) + t.mock(npx, { [cli]: () => {} }) t.strictSame(process.argv, ['node', npm, 'exec', '--yes', '--script-shell=bash', '--package', 'foo', '--call', 'asdf']) t.end() }) @@ -80,7 +76,7 @@ t.test('use a bunch of deprecated switches and options', t => { '--', 'foobar', ] - requireInject(npx, { [cli]: () => {} }) + t.mock(npx, { [cli]: () => {} }) t.strictSame(process.argv, expect) t.strictSame(logs, [ ['npx: the --npm argument has been removed.'], diff --git a/deps/npm/test/lib/access.js b/deps/npm/test/lib/access.js index a8e28c8eb9065f..5fd170bab484aa 100644 --- a/deps/npm/test/lib/access.js +++ b/deps/npm/test/lib/access.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const Access = require('../../lib/access.js') @@ -7,7 +6,7 @@ const npm = { output: () => null, } -test('completion', t => { +t.test('completion', t => { const access = new Access({ flatOptions: {} }) const testComp = (argv, expect) => { const res = access.completion({conf: {argv: {remain: argv}}}) @@ -38,7 +37,7 @@ test('completion', t => { t.end() }) -test('subcommand required', t => { +t.test('subcommand required', t => { const access = new Access({ flatOptions: {} }) access.exec([], (err) => { t.match(err, access.usageError('Subcommand is required.')) @@ -46,7 +45,7 @@ test('subcommand required', t => { }) }) -test('unrecognized subcommand', (t) => { +t.test('unrecognized subcommand', (t) => { const access = new Access({ flatOptions: {} }) access.exec(['blerg'], (err) => { t.match( @@ -58,7 +57,7 @@ test('unrecognized subcommand', (t) => { }) }) -test('edit', (t) => { +t.test('edit', (t) => { const access = new Access({ flatOptions: {} }) access.exec([ 'edit', @@ -73,7 +72,7 @@ test('edit', (t) => { }) }) -test('access public on unscoped package', (t) => { +t.test('access public on unscoped package', (t) => { const prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'npm-access-public-pkg', @@ -92,13 +91,13 @@ test('access public on unscoped package', (t) => { }) }) -test('access public on scoped package', (t) => { +t.test('access public on scoped package', (t) => { t.plan(4) const name = '@scoped/npm-access-public-pkg' const prefix = t.testdir({ 'package.json': JSON.stringify({ name }), }) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { public: (pkg, { registry }) => { t.equal(pkg, name, 'should use pkg name ref') @@ -118,12 +117,12 @@ test('access public on scoped package', (t) => { access.exec([ 'public', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access public on scoped package') }) }) -test('access public on missing package.json', (t) => { +t.test('access public on missing package.json', (t) => { const prefix = t.testdir({ node_modules: {}, }) @@ -140,7 +139,7 @@ test('access public on missing package.json', (t) => { }) }) -test('access public on invalid package.json', (t) => { +t.test('access public on invalid package.json', (t) => { const prefix = t.testdir({ 'package.json': '{\n', node_modules: {}, @@ -158,7 +157,7 @@ test('access public on invalid package.json', (t) => { }) }) -test('access restricted on unscoped package', (t) => { +t.test('access restricted on unscoped package', (t) => { const prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'npm-access-restricted-pkg', @@ -177,13 +176,13 @@ test('access restricted on unscoped package', (t) => { }) }) -test('access restricted on scoped package', (t) => { +t.test('access restricted on scoped package', (t) => { t.plan(4) const name = '@scoped/npm-access-restricted-pkg' const prefix = t.testdir({ 'package.json': JSON.stringify({ name }), }) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { restricted: (pkg, { registry }) => { t.equal(pkg, name, 'should use pkg name ref') @@ -203,12 +202,12 @@ test('access restricted on scoped package', (t) => { access.exec([ 'restricted', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access restricted on scoped package') }) }) -test('access restricted on missing package.json', (t) => { +t.test('access restricted on missing package.json', (t) => { const prefix = t.testdir({ node_modules: {}, }) @@ -225,7 +224,7 @@ test('access restricted on missing package.json', (t) => { }) }) -test('access restricted on invalid package.json', (t) => { +t.test('access restricted on invalid package.json', (t) => { const prefix = t.testdir({ 'package.json': '{\n', node_modules: {}, @@ -243,9 +242,9 @@ test('access restricted on invalid package.json', (t) => { }) }) -test('access grant read-only', (t) => { +t.test('access grant read-only', (t) => { t.plan(5) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { grant: (spec, team, permissions) => { t.equal(spec, '@scoped/another', 'should use expected spec') @@ -262,14 +261,14 @@ test('access grant read-only', (t) => { 'myorg:myteam', '@scoped/another', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access grant read-only') }) }) -test('access grant read-write', (t) => { +t.test('access grant read-write', (t) => { t.plan(5) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { grant: (spec, team, permissions) => { t.equal(spec, '@scoped/another', 'should use expected spec') @@ -286,19 +285,19 @@ test('access grant read-write', (t) => { 'myorg:myteam', '@scoped/another', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access grant read-write') }) }) -test('access grant current cwd', (t) => { +t.test('access grant current cwd', (t) => { t.plan(5) const prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'yargs', }), }) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { grant: (spec, team, permissions) => { t.equal(spec, 'yargs', 'should use expected spec') @@ -314,12 +313,12 @@ test('access grant current cwd', (t) => { 'read-write', 'myorg:myteam', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access grant current cwd') }) }) -test('access grant others', (t) => { +t.test('access grant others', (t) => { const access = new Access({ flatOptions: {} }) access.exec([ 'grant', @@ -336,7 +335,7 @@ test('access grant others', (t) => { }) }) -test('access grant missing team args', (t) => { +t.test('access grant missing team args', (t) => { const access = new Access({ flatOptions: {} }) access.exec([ 'grant', @@ -353,7 +352,7 @@ test('access grant missing team args', (t) => { }) }) -test('access grant malformed team arg', (t) => { +t.test('access grant malformed team arg', (t) => { const access = new Access({ flatOptions: {} }) access.exec([ 'grant', @@ -370,9 +369,9 @@ test('access grant malformed team arg', (t) => { }) }) -test('access 2fa-required/2fa-not-required', t => { +t.test('access 2fa-required/2fa-not-required', t => { t.plan(2) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { tfaRequired: (spec) => { t.equal(spec, '@scope/pkg', 'should use expected spec') @@ -397,9 +396,9 @@ test('access 2fa-required/2fa-not-required', t => { }) }) -test('access revoke', (t) => { +t.test('access revoke', (t) => { t.plan(4) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { revoke: (spec, team) => { t.equal(spec, '@scoped/another', 'should use expected spec') @@ -414,12 +413,12 @@ test('access revoke', (t) => { 'myorg:myteam', '@scoped/another', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access revoke') }) }) -test('access revoke missing team args', (t) => { +t.test('access revoke missing team args', (t) => { const access = new Access({ flatOptions: {} }) access.exec([ 'revoke', @@ -435,7 +434,7 @@ test('access revoke missing team args', (t) => { }) }) -test('access revoke malformed team arg', (t) => { +t.test('access revoke malformed team arg', (t) => { const access = new Access({ flatOptions: {} }) access.exec([ 'revoke', @@ -451,9 +450,9 @@ test('access revoke malformed team arg', (t) => { }) }) -test('npm access ls-packages with no team', (t) => { +t.test('npm access ls-packages with no team', (t) => { t.plan(3) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { lsPackages: (entity) => { t.equal(entity, 'foo', 'should use expected entity') @@ -466,14 +465,14 @@ test('npm access ls-packages with no team', (t) => { access.exec([ 'ls-packages', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access ls-packages with no team') }) }) -test('access ls-packages on team', (t) => { +t.test('access ls-packages on team', (t) => { t.plan(3) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { lsPackages: (entity) => { t.equal(entity, 'myorg:myteam', 'should use expected entity') @@ -486,19 +485,19 @@ test('access ls-packages on team', (t) => { 'ls-packages', 'myorg:myteam', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access ls-packages on team') }) }) -test('access ls-collaborators on current', (t) => { +t.test('access ls-collaborators on current', (t) => { t.plan(3) const prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'yargs', }), }) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { lsCollaborators: (spec) => { t.equal(spec, 'yargs', 'should use expected spec') @@ -510,14 +509,14 @@ test('access ls-collaborators on current', (t) => { access.exec([ 'ls-collaborators', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access ls-collaborators on current') }) }) -test('access ls-collaborators on spec', (t) => { +t.test('access ls-collaborators on spec', (t) => { t.plan(3) - const Access = requireInject('../../lib/access.js', { + const Access = t.mock('../../lib/access.js', { libnpmaccess: { lsCollaborators: (spec) => { t.equal(spec, 'yargs', 'should use expected spec') @@ -530,7 +529,7 @@ test('access ls-collaborators on spec', (t) => { 'ls-collaborators', 'yargs', ], (err) => { - t.ifError(err, 'npm access') + t.error(err, 'npm access') t.ok('should successfully access ls-packages with no team') }) }) diff --git a/deps/npm/test/lib/adduser.js b/deps/npm/test/lib/adduser.js index d9106e1bda8e5b..a66623e6682827 100644 --- a/deps/npm/test/lib/adduser.js +++ b/deps/npm/test/lib/adduser.js @@ -1,5 +1,4 @@ -const requireInject = require('require-inject') -const { test } = require('tap') +const t = require('tap') const { getCredentialsByURI, setCredentialsByURI } = require('@npmcli/config').prototype @@ -26,7 +25,6 @@ const authDummy = (npm, options) => { username: 'u', password: 'p', email: 'u@npmjs.org', - alwaysAuth: false, }, }) } @@ -66,7 +64,7 @@ const npm = { }, } -const AddUser = requireInject('../../lib/adduser.js', { +const AddUser = t.mock('../../lib/adduser.js', { npmlog: { disableProgress: () => null, notice: (_, msg) => { @@ -78,13 +76,13 @@ const AddUser = requireInject('../../lib/adduser.js', { const adduser = new AddUser(npm) -test('usage', (t) => { +t.test('usage', (t) => { t.match(adduser.usage, 'adduser', 'usage has command name in it') t.end() }) -test('simple login', (t) => { +t.test('simple login', (t) => { adduser.exec([], (err) => { - t.ifError(err, 'npm adduser') + t.error(err, 'npm adduser') t.equal( registryOutput, @@ -92,29 +90,31 @@ test('simple login', (t) => { 'should have correct message result' ) - t.deepEqual( + t.same( deletedConfig, { _token: 'user', _password: 'user', username: 'user', - email: 'user', _auth: 'user', _authtoken: 'user', + '-authtoken': 'user', _authToken: 'user', - '//registry.npmjs.org/:-authtoken': undefined, + '//registry.npmjs.org/:-authtoken': 'user', '//registry.npmjs.org/:_authToken': 'user', + '//registry.npmjs.org/:_authtoken': 'user', + '//registry.npmjs.org/:always-auth': 'user', + '//registry.npmjs.org/:email': 'user', }, 'should delete token in user config' ) - t.deepEqual( + t.same( setConfig, { '//registry.npmjs.org/:_password': { value: 'cA==', where: 'user' }, '//registry.npmjs.org/:username': { value: 'u', where: 'user' }, - '//registry.npmjs.org/:email': { value: 'u@npmjs.org', where: 'user' }, - '//registry.npmjs.org/:always-auth': { value: false, where: 'user' }, + email: { value: 'u@npmjs.org', where: 'user' }, }, 'should set expected user configs' ) @@ -133,7 +133,7 @@ test('simple login', (t) => { }) }) -test('bad auth type', (t) => { +t.test('bad auth type', (t) => { _flatOptions.authType = 'foo' adduser.exec([], (err) => { @@ -151,13 +151,13 @@ test('bad auth type', (t) => { }) }) -test('scoped login', (t) => { +t.test('scoped login', (t) => { _flatOptions.scope = '@myscope' adduser.exec([], (err) => { - t.ifError(err, 'npm adduser') + t.error(err, 'npm adduser') - t.deepEqual( + t.same( setConfig['@myscope:registry'], { value: 'https://registry.npmjs.org/', where: 'user' }, 'should set scoped registry config' @@ -171,14 +171,14 @@ test('scoped login', (t) => { }) }) -test('scoped login with valid scoped registry config', (t) => { +t.test('scoped login with valid scoped registry config', (t) => { _flatOptions['@myscope:registry'] = 'https://diff-registry.npmjs.com/' _flatOptions.scope = '@myscope' adduser.exec([], (err) => { - t.ifError(err, 'npm adduser') + t.error(err, 'npm adduser') - t.deepEqual( + t.same( setConfig['@myscope:registry'], { value: 'https://diff-registry.npmjs.com/', where: 'user' }, 'should keep scoped registry config' @@ -193,7 +193,7 @@ test('scoped login with valid scoped registry config', (t) => { }) }) -test('save config failure', (t) => { +t.test('save config failure', (t) => { failSave = true adduser.exec([], (err) => { diff --git a/deps/npm/test/lib/audit.js b/deps/npm/test/lib/audit.js index a25e6b0e277404..bb6f06debc51f7 100644 --- a/deps/npm/test/lib/audit.js +++ b/deps/npm/test/lib/audit.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') t.test('should audit using Arborist', t => { @@ -19,7 +18,7 @@ t.test('should audit using Arborist', t => { OUTPUT_CALLED = true }, }) - const Audit = requireInject('../../lib/audit.js', { + const Audit = t.mock('../../lib/audit.js', { 'npm-audit-report': () => { AUDIT_REPORT_CALLED = true return { @@ -74,7 +73,7 @@ t.test('should audit - json', t => { output: () => {}, }) - const Audit = requireInject('../../lib/audit.js', { + const Audit = t.mock('../../lib/audit.js', { 'npm-audit-report': () => ({ report: 'there are vulnerabilities', exitCode: 0, @@ -115,7 +114,7 @@ t.test('report endpoint error', t => { OUTPUT.push(msg) }, }) - const Audit = requireInject('../../lib/audit.js', { + const Audit = t.mock('../../lib/audit.js', { 'npm-audit-report': () => { throw new Error('should not call audit report when there are errors') }, diff --git a/deps/npm/test/lib/auth/legacy.js b/deps/npm/test/lib/auth/legacy.js index f5297c58179c65..d06f9535742fb6 100644 --- a/deps/npm/test/lib/auth/legacy.js +++ b/deps/npm/test/lib/auth/legacy.js @@ -1,12 +1,11 @@ -const requireInject = require('require-inject') -const { test } = require('tap') +const t = require('tap') let log = '' const token = '24528a24f240' const profile = {} const read = {} -const legacy = requireInject('../../../lib/auth/legacy.js', { +const legacy = t.mock('../../../lib/auth/legacy.js', { npmlog: { info: (...msgs) => { log += msgs.join(' ') @@ -26,7 +25,7 @@ const npm = { }, } -test('login using username/password with token result', async (t) => { +t.test('login using username/password with token result', async (t) => { profile.login = () => { return { token } } @@ -57,7 +56,7 @@ test('login using username/password with token result', async (t) => { 'should have correct message result' ) - t.deepEqual( + t.same( newCreds, { token }, 'should return expected obj from profile.login' @@ -67,7 +66,7 @@ test('login using username/password with token result', async (t) => { delete profile.login }) -test('login using username/password with user info result', async (t) => { +t.test('login using username/password with user info result', async (t) => { profile.login = () => { return null } @@ -92,7 +91,7 @@ test('login using username/password with user info result', async (t) => { 'should have correct message result' ) - t.deepEqual( + t.same( newCreds, { username: 'u', @@ -107,7 +106,7 @@ test('login using username/password with user info result', async (t) => { delete profile.login }) -test('login otp requested', async (t) => { +t.test('login otp requested', async (t) => { t.plan(5) profile.login = () => Promise.reject(Object.assign( @@ -143,7 +142,7 @@ test('login otp requested', async (t) => { 'should have correct message result' ) - t.deepEqual( + t.same( newCreds, { token }, 'should return token from loginCouch result' @@ -155,7 +154,7 @@ test('login otp requested', async (t) => { delete read.otp }) -test('login missing basic credential info', async (t) => { +t.test('login missing basic credential info', async (t) => { profile.login = () => Promise.reject(Object.assign( new Error('missing info'), { code: 'ERROR' } @@ -178,7 +177,7 @@ test('login missing basic credential info', async (t) => { delete profile.login }) -test('create new user when user not found', async (t) => { +t.test('create new user when user not found', async (t) => { t.plan(6) profile.login = () => Promise.reject(Object.assign( @@ -219,7 +218,7 @@ test('create new user when user not found', async (t) => { 'should have correct message result' ) - t.deepEqual( + t.same( newCreds, { token }, 'should return expected obj from profile.login' @@ -230,7 +229,7 @@ test('create new user when user not found', async (t) => { delete profile.login }) -test('prompts for user info if required', async (t) => { +t.test('prompts for user info if required', async (t) => { t.plan(4) profile.login = async (opener, prompt, opts) => { @@ -266,7 +265,7 @@ test('prompts for user info if required', async (t) => { 'should have correct message result' ) - t.deepEqual( + t.same( newCreds, { username: 'foo', @@ -284,7 +283,7 @@ test('prompts for user info if required', async (t) => { delete read.email }) -test('request otp when creating new user', async (t) => { +t.test('request otp when creating new user', async (t) => { t.plan(3) profile.login = () => Promise.reject(Object.assign( @@ -322,7 +321,7 @@ test('request otp when creating new user', async (t) => { delete read.otp }) -test('unknown error during user creation', async (t) => { +t.test('unknown error during user creation', async (t) => { profile.login = () => Promise.reject(Object.assign( new Error('missing info'), { code: 'ERROR' } @@ -352,7 +351,7 @@ test('unknown error during user creation', async (t) => { delete profile.login }) -test('open url error', async (t) => { +t.test('open url error', async (t) => { profile.login = async (opener, prompt, opts) => { await opener() } @@ -374,7 +373,7 @@ test('open url error', async (t) => { delete profile.login }) -test('login no credentials provided', async (t) => { +t.test('login no credentials provided', async (t) => { profile.login = () => ({ token }) await legacy(npm, { @@ -398,7 +397,7 @@ test('login no credentials provided', async (t) => { delete profile.login }) -test('scoped login', async (t) => { +t.test('scoped login', async (t) => { profile.login = () => ({ token }) const { message } = await legacy(npm, { diff --git a/deps/npm/test/lib/auth/oauth.js b/deps/npm/test/lib/auth/oauth.js index c2f4c3443a2342..0c317fb9a130e3 100644 --- a/deps/npm/test/lib/auth/oauth.js +++ b/deps/npm/test/lib/auth/oauth.js @@ -1,7 +1,6 @@ -const requireInject = require('require-inject') -const { test } = require('tap') +const t = require('tap') -test('oauth login', (t) => { +t.test('oauth login', (t) => { t.plan(3) const oauthOpts = { creds: {}, @@ -17,7 +16,7 @@ test('oauth login', (t) => { }, }, } - const oauth = requireInject('../../../lib/auth/oauth.js', { + const oauth = t.mock('../../../lib/auth/oauth.js', { '../../../lib/auth/sso.js': (npm, opts) => { t.equal(opts, oauthOpts, 'should forward opts') }, diff --git a/deps/npm/test/lib/auth/saml.js b/deps/npm/test/lib/auth/saml.js index b8c21f649edc09..1558e0db8eb29c 100644 --- a/deps/npm/test/lib/auth/saml.js +++ b/deps/npm/test/lib/auth/saml.js @@ -1,7 +1,6 @@ -const requireInject = require('require-inject') -const { test } = require('tap') +const t = require('tap') -test('saml login', (t) => { +t.test('saml login', (t) => { t.plan(3) const samlOpts = { creds: {}, @@ -17,7 +16,7 @@ test('saml login', (t) => { }, }, } - const saml = requireInject('../../../lib/auth/saml.js', { + const saml = t.mock('../../../lib/auth/saml.js', { '../../../lib/auth/sso.js': (npm, opts) => { t.equal(opts, samlOpts, 'should forward opts') }, diff --git a/deps/npm/test/lib/auth/sso.js b/deps/npm/test/lib/auth/sso.js index 6f3d981a6fff78..11be002aee345d 100644 --- a/deps/npm/test/lib/auth/sso.js +++ b/deps/npm/test/lib/auth/sso.js @@ -1,5 +1,4 @@ -const requireInject = require('require-inject') -const { test } = require('tap') +const t = require('tap') let log = '' let warn = '' @@ -11,7 +10,7 @@ const token = '24528a24f240' const SSO_URL = 'https://registry.npmjs.org/{SSO_URL}' const profile = {} const npmFetch = {} -const sso = requireInject('../../../lib/auth/sso.js', { +const sso = t.mock('../../../lib/auth/sso.js', { npmlog: { info: (...msgs) => { log += msgs.join(' ') + '\n' @@ -46,7 +45,7 @@ const npm = { flatOptions: _flatOptions, } -test('empty login', async (t) => { +t.test('empty login', async (t) => { _flatOptions.ssoType = false await t.rejects( @@ -66,13 +65,13 @@ test('empty login', async (t) => { warn = '' }) -test('simple login', async (t) => { +t.test('simple login', async (t) => { t.plan(6) profile.loginCouch = (username, password, opts) => { t.equal(username, 'npm_oauth_auth_dummy_user', 'should use dummy user') t.equal(password, 'placeholder', 'should use dummy password') - t.deepEqual( + t.same( opts, { creds: {}, @@ -109,7 +108,7 @@ test('simple login', async (t) => { 'should have correct logged info msg' ) - t.deepEqual( + t.same( newCreds, { token }, 'should return expected resulting credentials' @@ -121,7 +120,7 @@ test('simple login', async (t) => { delete npmFetch.json }) -test('polling retry', async (t) => { +t.test('polling retry', async (t) => { t.plan(3) profile.loginCouch = () => ({ token, sso: SSO_URL }) @@ -168,7 +167,7 @@ test('polling retry', async (t) => { delete npmFetch.json }) -test('polling error', async (t) => { +t.test('polling error', async (t) => { profile.loginCouch = () => ({ token, sso: SSO_URL }) npmFetch.json = () => Promise.reject(Object.assign( new Error('unknown error'), @@ -191,7 +190,7 @@ test('polling error', async (t) => { delete npmFetch.json }) -test('no token retrieved from loginCouch', async (t) => { +t.test('no token retrieved from loginCouch', async (t) => { profile.loginCouch = () => ({}) await t.rejects( @@ -209,7 +208,7 @@ test('no token retrieved from loginCouch', async (t) => { delete profile.loginCouch }) -test('no sso url retrieved from loginCouch', async (t) => { +t.test('no sso url retrieved from loginCouch', async (t) => { profile.loginCouch = () => Promise.resolve({ token }) await t.rejects( @@ -227,7 +226,7 @@ test('no sso url retrieved from loginCouch', async (t) => { delete profile.loginCouch }) -test('scoped login', async (t) => { +t.test('scoped login', async (t) => { profile.loginCouch = () => ({ token, sso: SSO_URL }) npmFetch.json = () => Promise.resolve({ username: 'foo' }) @@ -252,7 +251,7 @@ test('scoped login', async (t) => { 'should have correct logged info msg' ) - t.deepEqual( + t.same( newCreds, { token }, 'should return expected resulting credentials' diff --git a/deps/npm/test/lib/bin.js b/deps/npm/test/lib/bin.js index 1d9341169be154..898e7ba439b88e 100644 --- a/deps/npm/test/lib/bin.js +++ b/deps/npm/test/lib/bin.js @@ -1,8 +1,7 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const mockNpm = require('../fixtures/mock-npm') -test('bin', (t) => { +t.test('bin', (t) => { t.plan(4) const dir = '/bin/dir' @@ -19,15 +18,15 @@ test('bin', (t) => { t.match(bin.usage, 'bin', 'usage has command name in it') bin.exec([], (err) => { - t.ifError(err, 'npm bin') + t.error(err, 'npm bin') t.ok('should have printed directory') }) }) -test('bin -g', (t) => { +t.test('bin -g', (t) => { t.plan(3) const consoleError = console.error - t.tearDown(() => { + t.teardown(() => { console.error = consoleError }) @@ -36,7 +35,7 @@ test('bin -g', (t) => { } const dir = '/bin/dir' - const Bin = requireInject('../../lib/bin.js', { + const Bin = t.mock('../../lib/bin.js', { '../../lib/utils/path.js': [dir], }) @@ -50,15 +49,15 @@ test('bin -g', (t) => { const bin = new Bin(npm) bin.exec([], (err) => { - t.ifError(err, 'npm bin') + t.error(err, 'npm bin') t.ok('should have printed directory') }) }) -test('bin -g (not in path)', (t) => { +t.test('bin -g (not in path)', (t) => { t.plan(4) const consoleError = console.error - t.tearDown(() => { + t.teardown(() => { console.error = consoleError }) @@ -67,7 +66,7 @@ test('bin -g (not in path)', (t) => { } const dir = '/bin/dir' - const Bin = requireInject('../../lib/bin.js', { + const Bin = t.mock('../../lib/bin.js', { '../../lib/utils/path.js': ['/not/my/dir'], }) const npm = mockNpm({ @@ -80,7 +79,7 @@ test('bin -g (not in path)', (t) => { const bin = new Bin(npm) bin.exec([], (err) => { - t.ifError(err, 'npm bin') + t.error(err, 'npm bin') t.ok('should have printed directory') }) }) diff --git a/deps/npm/test/lib/bugs.js b/deps/npm/test/lib/bugs.js index 21b1a98411ec66..e5b238ffcea131 100644 --- a/deps/npm/test/lib/bugs.js +++ b/deps/npm/test/lib/bugs.js @@ -1,6 +1,5 @@ const t = require('tap') -const requireInject = require('require-inject') const pacote = { manifest: async (spec, options) => { return spec === 'nobugs' ? { @@ -32,6 +31,16 @@ const pacote = { version: '1.2.3', repository: { url: 'https://github.com/foo/repoobj' }, } + : spec === 'mailtest' ? { + name: 'mailtest', + version: '3.7.4', + bugs: { email: 'hello@example.com' }, + } + : spec === 'secondmailtest' ? { + name: 'secondmailtest', + version: '0.1.1', + bugs: { email: 'ABC432abc@a.b.example.net' }, + } : spec === '.' ? { name: 'thispkg', version: '1.2.3', @@ -48,7 +57,7 @@ const openUrl = async (npm, url, errMsg) => { opened[url]++ } -const Bugs = requireInject('../../lib/bugs.js', { +const Bugs = t.mock('../../lib/bugs.js', { pacote, '../../lib/utils/open-url.js': openUrl, }) @@ -60,7 +69,7 @@ t.test('usage', (t) => { t.end() }) -t.test('open bugs urls', t => { +t.test('open bugs urls & emails', t => { const expect = { nobugs: 'https://www.npmjs.com/package/nobugs', 'bugsobj-nourl': 'https://www.npmjs.com/package/bugsobj-nourl', @@ -68,6 +77,8 @@ t.test('open bugs urls', t => { bugsobj: 'https://bugzilla.localhost/bugsobj', repourl: 'https://github.com/foo/repourl/issues', repoobj: 'https://github.com/foo/repoobj/issues', + mailtest: 'mailto:hello@example.com', + secondmailtest: 'mailto:ABC432abc@a.b.example.net', '.': 'https://example.com', } const keys = Object.keys(expect) diff --git a/deps/npm/test/lib/cache.js b/deps/npm/test/lib/cache.js index 0fdf7685684799..bbebae8894babe 100644 --- a/deps/npm/test/lib/cache.js +++ b/deps/npm/test/lib/cache.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const path = require('path') @@ -47,7 +46,7 @@ const cacache = { }, } -const Cache = requireInject('../../lib/cache.js', { +const Cache = t.mock('../../lib/cache.js', { cacache, npmlog, pacote, @@ -89,7 +88,7 @@ t.test('cache clean (force)', t => { }) cache.exec(['clear'], err => { - t.ifError(err) + t.error(err) t.equal(rimrafPath, path.join(npm.cache, '_cacache')) t.end() }) @@ -124,7 +123,7 @@ t.test('cache add pkg only', t => { }) cache.exec(['add', 'mypkg'], err => { - t.ifError(err) + t.error(err) t.strictSame(logOutput, [ ['silly', 'cache add', 'args', ['mypkg']], ['silly', 'cache add', 'spec', 'mypkg'], @@ -143,7 +142,7 @@ t.test('cache add pkg w/ spec modifier', t => { }) cache.exec(['add', 'mypkg', 'latest'], err => { - t.ifError(err) + t.error(err) t.strictSame(logOutput, [ ['silly', 'cache add', 'args', ['mypkg', 'latest']], ['silly', 'cache add', 'spec', 'mypkg@latest'], @@ -160,7 +159,7 @@ t.test('cache verify', t => { }) cache.exec(['verify'], err => { - t.ifError(err) + t.error(err) t.match(outputOutput, [ `Cache verified and compressed (${path.join(npm.cache, '_cacache')})`, 'Content verified: 1 (100 bytes)', @@ -187,7 +186,7 @@ t.test('cache verify w/ extra output', t => { }) cache.exec(['check'], err => { - t.ifError(err) + t.error(err) t.match(outputOutput, [ `Cache verified and compressed (~${path.join('/fake/path', '_cacache')})`, 'Content verified: 1 (100 bytes)', diff --git a/deps/npm/test/lib/ci.js b/deps/npm/test/lib/ci.js index 7f06a6cebcbc12..b60375c2898427 100644 --- a/deps/npm/test/lib/ci.js +++ b/deps/npm/test/lib/ci.js @@ -2,15 +2,14 @@ const fs = require('fs') const util = require('util') const readdir = util.promisify(fs.readdir) -const { test } = require('tap') +const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') -test('should ignore scripts with --ignore-scripts', (t) => { +t.test('should ignore scripts with --ignore-scripts', (t) => { const SCRIPTS = [] let REIFY_CALLED = false - const CI = requireInject('../../lib/ci.js', { + const CI = t.mock('../../lib/ci.js', { '../../lib/utils/reify-finish.js': async () => {}, '@npmcli/run-script': ({ event }) => { SCRIPTS.push(event) @@ -42,7 +41,7 @@ test('should ignore scripts with --ignore-scripts', (t) => { }) }) -test('should use Arborist and run-script', (t) => { +t.test('should use Arborist and run-script', (t) => { const scripts = [ 'preinstall', 'install', @@ -88,7 +87,7 @@ test('should use Arborist and run-script', (t) => { const expectRimrafs = 3 let actualRimrafs = 0 - const CI = requireInject('../../lib/ci.js', { + const CI = t.mock('../../lib/ci.js', { '../../lib/utils/reify-finish.js': async () => {}, '@npmcli/run-script': opts => { t.match(opts, { event: scripts.shift() }) @@ -134,8 +133,8 @@ test('should use Arborist and run-script', (t) => { }) }) -test('should pass flatOptions to Arborist.reify', (t) => { - const CI = requireInject('../../lib/ci.js', { +t.test('should pass flatOptions to Arborist.reify', (t) => { + const CI = t.mock('../../lib/ci.js', { '../../lib/utils/reify-finish.js': async () => {}, '@npmcli/run-script': opts => {}, '@npmcli/arborist': function () { @@ -159,13 +158,13 @@ test('should pass flatOptions to Arborist.reify', (t) => { }) }) -test('should throw if package-lock.json or npm-shrinkwrap missing', (t) => { +t.test('should throw if package-lock.json or npm-shrinkwrap missing', (t) => { const testDir = t.testdir({ 'index.js': 'some contents', 'package.json': 'some info', }) - const CI = requireInject('../../lib/ci.js', { + const CI = t.mock('../../lib/ci.js', { '@npmcli/run-script': opts => {}, '../../lib/utils/reify-finish.js': async () => {}, npmlog: { @@ -188,8 +187,8 @@ test('should throw if package-lock.json or npm-shrinkwrap missing', (t) => { }) }) -test('should throw ECIGLOBAL', (t) => { - const CI = requireInject('../../lib/ci.js', { +t.test('should throw ECIGLOBAL', (t) => { + const CI = t.mock('../../lib/ci.js', { '@npmcli/run-script': opts => {}, '../../lib/utils/reify-finish.js': async () => {}, }) @@ -201,20 +200,20 @@ test('should throw ECIGLOBAL', (t) => { }) const ci = new CI(npm) ci.exec(null, (err, res) => { - t.equals(err.code, 'ECIGLOBAL', 'throws error with global packages') + t.equal(err.code, 'ECIGLOBAL', 'throws error with global packages') t.notOk(res) t.end() }) }) -test('should remove existing node_modules before installing', (t) => { +t.test('should remove existing node_modules before installing', (t) => { const testDir = t.testdir({ node_modules: { 'some-file': 'some contents', }, }) - const CI = requireInject('../../lib/ci.js', { + const CI = t.mock('../../lib/ci.js', { '@npmcli/run-script': opts => {}, '../../lib/utils/reify-finish.js': async () => {}, '@npmcli/arborist': function () { diff --git a/deps/npm/test/lib/cli.js b/deps/npm/test/lib/cli.js index 28e44394e16dcf..f491c6174b85e2 100644 --- a/deps/npm/test/lib/cli.js +++ b/deps/npm/test/lib/cli.js @@ -43,8 +43,7 @@ const npmlogMock = { info: (...msg) => logs.push(['info', ...msg]), } -const requireInject = require('require-inject') -const cli = requireInject.installGlobally('../../lib/cli.js', { +const cli = t.mock('../../lib/cli.js', { '../../lib/npm.js': npmock, '../../lib/utils/did-you-mean.js': () => '\ntest did you mean', '../../lib/utils/unsupported.js': unsupportedMock, diff --git a/deps/npm/test/lib/completion.js b/deps/npm/test/lib/completion.js index c6ef901a7ed7d3..4f7d4a5fd6e388 100644 --- a/deps/npm/test/lib/completion.js +++ b/deps/npm/test/lib/completion.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const fs = require('fs') const path = require('path') @@ -81,7 +80,7 @@ const deref = (cmd) => { return cmd } -const Completion = requireInject('../../lib/completion.js', { +const Completion = t.mock('../../lib/completion.js', { '../../lib/utils/cmd-list.js': cmdList, '../../lib/utils/config/index.js': config, '../../lib/utils/deref-command.js': deref, @@ -89,7 +88,7 @@ const Completion = requireInject('../../lib/completion.js', { }) const completion = new Completion(npm) -test('completion completion', async t => { +t.test('completion completion', async t => { const home = process.env.HOME t.teardown(() => { process.env.HOME = home @@ -108,7 +107,7 @@ test('completion completion', async t => { t.end() }) -test('completion completion no known shells', async t => { +t.test('completion completion no known shells', async t => { const home = process.env.HOME t.teardown(() => { process.env.HOME = home @@ -121,14 +120,14 @@ test('completion completion no known shells', async t => { t.end() }) -test('completion completion wrong word count', async t => { +t.test('completion completion wrong word count', async t => { const res = await completion.completion({ w: 3 }) t.strictSame(res, undefined, 'no responses') t.end() }) -test('completion errors in windows without bash', t => { - const Compl = requireInject('../../lib/completion.js', { +t.test('completion errors in windows without bash', t => { + const Compl = t.mock('../../lib/completion.js', { '../../lib/utils/is-windows-shell.js': true, }) @@ -143,7 +142,7 @@ test('completion errors in windows without bash', t => { }) }) -test('dump script when completion is not being attempted', t => { +t.test('dump script when completion is not being attempted', t => { const _write = process.stdout.write const _on = process.stdout.on t.teardown(() => { @@ -176,7 +175,7 @@ test('dump script when completion is not being attempted', t => { }) }) -test('dump script exits correctly when EPIPE is emitted on stdout', t => { +t.test('dump script exits correctly when EPIPE is emitted on stdout', t => { const _write = process.stdout.write const _on = process.stdout.on t.teardown(() => { @@ -209,7 +208,7 @@ test('dump script exits correctly when EPIPE is emitted on stdout', t => { }) }) -test('non EPIPE errors cause failures', t => { +t.test('non EPIPE errors cause failures', t => { const _write = process.stdout.write const _on = process.stdout.on t.teardown(() => { @@ -240,7 +239,7 @@ test('non EPIPE errors cause failures', t => { }) }) -test('completion completes single command name', t => { +t.test('completion completes single command name', t => { process.env.COMP_CWORD = 1 process.env.COMP_LINE = 'npm c' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -262,7 +261,7 @@ test('completion completes single command name', t => { }) }) -test('completion completes command names', t => { +t.test('completion completes command names', t => { process.env.COMP_CWORD = 1 process.env.COMP_LINE = 'npm a' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -284,7 +283,7 @@ test('completion completes command names', t => { }) }) -test('completion of invalid command name does nothing', t => { +t.test('completion of invalid command name does nothing', t => { process.env.COMP_CWORD = 1 process.env.COMP_LINE = 'npm compute' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -306,7 +305,7 @@ test('completion of invalid command name does nothing', t => { }) }) -test('handles async completion function', t => { +t.test('handles async completion function', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm promise' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -335,7 +334,7 @@ test('handles async completion function', t => { }) }) -test('completion triggers command completions', t => { +t.test('completion triggers command completions', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm access ' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -364,7 +363,7 @@ test('completion triggers command completions', t => { }) }) -test('completion triggers filtered command completions', t => { +t.test('completion triggers filtered command completions', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm access p' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -393,7 +392,7 @@ test('completion triggers filtered command completions', t => { }) }) -test('completions for commands that return nested arrays are joined', t => { +t.test('completions for commands that return nested arrays are joined', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm completion ' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -422,7 +421,7 @@ test('completions for commands that return nested arrays are joined', t => { }) }) -test('completions for commands that return nothing work correctly', t => { +t.test('completions for commands that return nothing work correctly', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm donothing ' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -451,7 +450,7 @@ test('completions for commands that return nothing work correctly', t => { }) }) -test('completions for commands that return a single item work correctly', t => { +t.test('completions for commands that return a single item work correctly', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm driveaboat ' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -480,7 +479,7 @@ test('completions for commands that return a single item work correctly', t => { }) }) -test('command completion for commands with no completion return no results', t => { +t.test('command completion for commands with no completion return no results', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm adduser ' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -510,7 +509,7 @@ test('command completion for commands with no completion return no results', t = }) }) -test('command completion errors propagate', t => { +t.test('command completion errors propagate', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm access ' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -539,7 +538,7 @@ test('command completion errors propagate', t => { }) }) -test('completion can complete flags', t => { +t.test('completion can complete flags', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm install --' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -562,7 +561,7 @@ test('completion can complete flags', t => { }) }) -test('double dashes escape from flag completion', t => { +t.test('double dashes escape from flag completion', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm -- install --' process.env.COMP_POINT = process.env.COMP_LINE.length @@ -585,7 +584,7 @@ test('double dashes escape from flag completion', t => { }) }) -test('completion cannot complete options that take a value in mid-command', t => { +t.test('completion cannot complete options that take a value in mid-command', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm --registry install' process.env.COMP_POINT = process.env.COMP_LINE.length diff --git a/deps/npm/test/lib/config.js b/deps/npm/test/lib/config.js index 074db976517e51..155ad0bcfb1b45 100644 --- a/deps/npm/test/lib/config.js +++ b/deps/npm/test/lib/config.js @@ -1,6 +1,5 @@ const t = require('tap') -const requireInject = require('require-inject') const { EventEmitter } = require('events') const redactCwd = (path) => { @@ -84,7 +83,7 @@ const mocks = { '../../lib/utils/usage.js': usageUtil, } -const Config = requireInject('../../lib/config.js', mocks) +const Config = t.mock('../../lib/config.js', mocks) const config = new Config(npm) t.test('config no args', t => { @@ -121,7 +120,7 @@ t.test('config list', t => { }) config.exec(['list'], (err) => { - t.ifError(err, 'npm config list') + t.error(err, 'npm config list') t.matchSnapshot(result, 'should list configs') }) }) @@ -147,7 +146,7 @@ t.test('config list overrides', t => { }) config.exec(['list'], (err) => { - t.ifError(err, 'npm config list') + t.error(err, 'npm config list') t.matchSnapshot(result, 'should list overridden configs') }) }) @@ -165,7 +164,7 @@ t.test('config list --long', t => { }) config.exec(['list'], (err) => { - t.ifError(err, 'npm config list --long') + t.error(err, 'npm config list --long') t.matchSnapshot(result, 'should list all configs') }) }) @@ -190,8 +189,8 @@ t.test('config list --json', t => { }) config.exec(['list'], (err) => { - t.ifError(err, 'npm config list --json') - t.deepEqual( + t.error(err, 'npm config list --json') + t.same( JSON.parse(result), { editor: 'vi', @@ -224,7 +223,7 @@ t.test('config delete key', t => { } config.exec(['delete', 'foo'], (err) => { - t.ifError(err, 'npm config delete key') + t.error(err, 'npm config delete key') }) t.teardown(() => { @@ -251,7 +250,7 @@ t.test('config delete multiple key', t => { } config.exec(['delete', 'foo', 'bar'], (err) => { - t.ifError(err, 'npm config delete keys') + t.error(err, 'npm config delete keys') }) t.teardown(() => { @@ -274,7 +273,7 @@ t.test('config delete key --global', t => { cliConfig.global = true config.exec(['delete', 'foo'], (err) => { - t.ifError(err, 'npm config delete key --global') + t.error(err, 'npm config delete key --global') }) t.teardown(() => { @@ -305,7 +304,7 @@ t.test('config set key', t => { } config.exec(['set', 'foo', 'bar'], (err) => { - t.ifError(err, 'npm config set key') + t.error(err, 'npm config set key') }) t.teardown(() => { @@ -328,7 +327,7 @@ t.test('config set key=val', t => { } config.exec(['set', 'foo=bar'], (err) => { - t.ifError(err, 'npm config set key') + t.error(err, 'npm config set key') }) t.teardown(() => { @@ -359,7 +358,7 @@ t.test('config set multiple keys', t => { } config.exec(['set', ...args], (err) => { - t.ifError(err, 'npm config set key') + t.error(err, 'npm config set key') }) t.teardown(() => { @@ -382,7 +381,7 @@ t.test('config set key to empty value', t => { } config.exec(['set', 'foo'], (err) => { - t.ifError(err, 'npm config set key to empty value') + t.error(err, 'npm config set key to empty value') }) t.teardown(() => { @@ -410,7 +409,7 @@ t.test('config set invalid key', t => { }) config.exec(['set', 'foo', 'bar'], (err) => { - t.ifError(err, 'npm config set invalid key') + t.error(err, 'npm config set invalid key') }) }) @@ -429,7 +428,7 @@ t.test('config set key --global', t => { cliConfig.global = true config.exec(['set', 'foo', 'bar'], (err) => { - t.ifError(err, 'npm config set key --global') + t.error(err, 'npm config set key --global') }) t.teardown(() => { @@ -450,7 +449,7 @@ t.test('config get no args', t => { }) config.exec(['get'], (err) => { - t.ifError(err, 'npm config get no args') + t.error(err, 'npm config get no args') t.matchSnapshot(result, 'should list configs on config get no args') }) }) @@ -469,7 +468,7 @@ t.test('config get key', t => { } config.exec(['get', 'foo'], (err) => { - t.ifError(err, 'npm config get key') + t.error(err, 'npm config get key') }) t.teardown(() => { @@ -497,7 +496,7 @@ t.test('config get multiple keys', t => { } config.exec(['get', 'foo', 'bar'], (err) => { - t.ifError(err, 'npm config get multiple keys') + t.error(err, 'npm config get multiple keys') t.equal(result, 'foo=asdf\nbar=asdf') }) @@ -555,20 +554,20 @@ sign-git-commit=true` }, }, } - const Config = requireInject('../../lib/config.js', editMocks) + const Config = t.mock('../../lib/config.js', editMocks) const config = new Config(npm) config.exec(['edit'], (err) => { - t.ifError(err, 'npm config edit') + t.error(err, 'npm config edit') // test no config file result editMocks.fs.readFile = (p, e, cb) => { cb(new Error('ERR')) } - const Config = requireInject('../../lib/config.js', editMocks) + const Config = t.mock('../../lib/config.js', editMocks) const config = new Config(npm) config.exec(['edit'], (err) => { - t.ifError(err, 'npm config edit') + t.error(err, 'npm config edit') }) }) @@ -614,7 +613,7 @@ t.test('config edit --global', t => { }, }, } - const Config = requireInject('../../lib/config.js', editMocks) + const Config = t.mock('../../lib/config.js', editMocks) const config = new Config(npm) config.exec(['edit'], (err) => { t.match(err, /exited with code: 137/, 'propagated exit code from editor') diff --git a/deps/npm/test/lib/dedupe.js b/deps/npm/test/lib/dedupe.js index 851163f935e271..801e3c96de3cf3 100644 --- a/deps/npm/test/lib/dedupe.js +++ b/deps/npm/test/lib/dedupe.js @@ -1,9 +1,8 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const mockNpm = require('../fixtures/mock-npm') -test('should throw in global mode', (t) => { - const Dedupe = requireInject('../../lib/dedupe.js') +t.test('should throw in global mode', (t) => { + const Dedupe = t.mock('../../lib/dedupe.js') const npm = mockNpm({ config: { 'dry-run': false, global: true }, }) @@ -15,8 +14,8 @@ test('should throw in global mode', (t) => { }) }) -test('should remove dupes using Arborist', (t) => { - const Dedupe = requireInject('../../lib/dedupe.js', { +t.test('should remove dupes using Arborist', (t) => { + const Dedupe = t.mock('../../lib/dedupe.js', { '@npmcli/arborist': function (args) { t.ok(args, 'gets options object') t.ok(args.path, 'gets path option') @@ -44,8 +43,8 @@ test('should remove dupes using Arborist', (t) => { }) }) -test('should remove dupes using Arborist - no arguments', (t) => { - const Dedupe = requireInject('../../lib/dedupe.js', { +t.test('should remove dupes using Arborist - no arguments', (t) => { + const Dedupe = t.mock('../../lib/dedupe.js', { '@npmcli/arborist': function (args) { t.ok(args.dryRun, 'gets dryRun from config') this.dedupe = () => {} diff --git a/deps/npm/test/lib/deprecate.js b/deps/npm/test/lib/deprecate.js index e278a3e3ca7c79..c358fde2479551 100644 --- a/deps/npm/test/lib/deprecate.js +++ b/deps/npm/test/lib/deprecate.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') let getIdentityImpl = () => 'someperson' let npmFetchBody = null @@ -18,7 +17,7 @@ npmFetch.json = async (uri, opts) => { } } -const Deprecate = requireInject('../../lib/deprecate.js', { +const Deprecate = t.mock('../../lib/deprecate.js', { '../../lib/utils/get-identity.js': async () => getIdentityImpl(), '../../lib/utils/otplease.js': async (opts, fn) => fn(opts), libnpmaccess: { @@ -31,7 +30,7 @@ const deprecate = new Deprecate({ flatOptions: { registry: 'https://registry.npmjs.org' }, }) -test('completion', async t => { +t.test('completion', async t => { const defaultIdentityImpl = getIdentityImpl t.teardown(() => { getIdentityImpl = defaultIdentityImpl @@ -58,28 +57,28 @@ test('completion', async t => { t.rejects(testComp([], []), { message: 'deprecate test failure' }) }) -test('no args', t => { +t.test('no args', t => { deprecate.exec([], (err) => { t.match(err, 'Usage:', 'logs usage') t.end() }) }) -test('only one arg', t => { +t.test('only one arg', t => { deprecate.exec(['foo'], (err) => { t.match(err, 'Usage:', 'logs usage') t.end() }) }) -test('invalid semver range', t => { +t.test('invalid semver range', t => { deprecate.exec(['foo@notaversion', 'this will fail'], (err) => { t.match(err, /invalid version range/, 'logs semver error') t.end() }) }) -test('deprecates given range', t => { +t.test('deprecates given range', t => { t.teardown(() => { npmFetchBody = null }) @@ -105,7 +104,7 @@ test('deprecates given range', t => { }) }) -test('deprecates all versions when no range is specified', t => { +t.test('deprecates all versions when no range is specified', t => { t.teardown(() => { npmFetchBody = null }) diff --git a/deps/npm/test/lib/diff.js b/deps/npm/test/lib/diff.js index 08761c64c86b4e..355095c95786ec 100644 --- a/deps/npm/test/lib/diff.js +++ b/deps/npm/test/lib/diff.js @@ -1,6 +1,5 @@ const { resolve } = require('path') const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const noop = () => null @@ -38,7 +37,7 @@ const mocks = { '../../lib/utils/usage.js': () => 'usage instructions', } -t.afterEach(cb => { +t.afterEach(() => { config.global = false config.tag = 'latest' config.diff = [] @@ -54,10 +53,9 @@ t.afterEach(cb => { npm.prefix = '..' libnpmdiff = noop rlp = () => 'foo' - cb() }) -const Diff = requireInject('../../lib/diff.js', mocks) +const Diff = t.mock('../../lib/diff.js', mocks) const diff = new Diff(npm) t.test('no args', t => { @@ -314,7 +312,7 @@ t.test('single arg', t => { config.diff = ['bar'] npm.prefix = path - const Diff = requireInject('../../lib/diff.js', { + const Diff = t.mock('../../lib/diff.js', { ...mocks, pacote: { packument: (spec) => { @@ -378,7 +376,7 @@ t.test('single arg', t => { npm.prefix = resolve(path, 'project') npm.globalDir = resolve(path, 'globalDir/lib/node_modules') - const Diff = requireInject('../../lib/diff.js', { + const Diff = t.mock('../../lib/diff.js', { ...mocks, pacote: { packument: (spec) => { @@ -465,7 +463,7 @@ t.test('single arg', t => { }), }) - const Diff = requireInject('../../lib/diff.js', { + const Diff = t.mock('../../lib/diff.js', { ...mocks, '../../lib/utils/read-local-package.js': async () => 'my-project', pacote: { @@ -502,7 +500,7 @@ t.test('single arg', t => { }), }) - const Diff = requireInject('../../lib/diff.js', { + const Diff = t.mock('../../lib/diff.js', { ...mocks, '../../lib/utils/read-local-package.js': async () => 'my-project', '@npmcli/arborist': class { @@ -940,7 +938,7 @@ t.test('first arg is a valid semver range', t => { }), }) - const Diff = requireInject('../../lib/diff.js', { + const Diff = t.mock('../../lib/diff.js', { ...mocks, '../../lib/utils/read-local-package.js': async () => 'my-project', '@npmcli/arborist': class { diff --git a/deps/npm/test/lib/dist-tag.js b/deps/npm/test/lib/dist-tag.js index 5e54c8f991cfdb..701bdc6e48c35b 100644 --- a/deps/npm/test/lib/dist-tag.js +++ b/deps/npm/test/lib/dist-tag.js @@ -1,14 +1,12 @@ -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') -const { afterEach, test } = require('tap') +const t = require('tap') let result = '' let log = '' -afterEach((cb) => { +t.afterEach(() => { result = '' log = '' - cb() }) const routeMap = { @@ -58,7 +56,7 @@ const logger = (...msgs) => { log += '\n' } -const DistTag = requireInject('../../lib/dist-tag.js', { +const DistTag = t.mock('../../lib/dist-tag.js', { npmlog: { error: logger, info: logger, @@ -80,14 +78,14 @@ const npm = mockNpm({ }) const distTag = new DistTag(npm) -test('ls in current package', (t) => { +t.test('ls in current package', (t) => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: '@scoped/pkg', }), }) distTag.exec(['ls'], (err) => { - t.ifError(err, 'npm dist-tags ls') + t.error(err, 'npm dist-tags ls') t.matchSnapshot( result, 'should list available tags for current package' @@ -96,14 +94,14 @@ test('ls in current package', (t) => { }) }) -test('no args in current package', (t) => { +t.test('no args in current package', (t) => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: '@scoped/pkg', }), }) distTag.exec([], (err) => { - t.ifError(err, 'npm dist-tags ls') + t.error(err, 'npm dist-tags ls') t.matchSnapshot( result, 'should default to listing available tags for current package' @@ -112,7 +110,7 @@ test('no args in current package', (t) => { }) }) -test('borked cmd usage', (t) => { +t.test('borked cmd usage', (t) => { npm.prefix = t.testdir({}) distTag.exec(['borked', '@scoped/pkg'], (err) => { t.matchSnapshot(err, 'should show usage error') @@ -120,10 +118,10 @@ test('borked cmd usage', (t) => { }) }) -test('ls on named package', (t) => { +t.test('ls on named package', (t) => { npm.prefix = t.testdir({}) distTag.exec(['ls', '@scoped/another'], (err) => { - t.ifError(err, 'npm dist-tags ls') + t.error(err, 'npm dist-tags ls') t.matchSnapshot( result, 'should list tags for the specified package' @@ -132,7 +130,7 @@ test('ls on named package', (t) => { }) }) -test('ls on missing package', (t) => { +t.test('ls on missing package', (t) => { npm.prefix = t.testdir({}) distTag.exec(['ls', 'foo'], (err) => { t.matchSnapshot( @@ -147,7 +145,7 @@ test('ls on missing package', (t) => { }) }) -test('ls on missing name in current package', (t) => { +t.test('ls on missing name in current package', (t) => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ version: '1.0.0', @@ -162,10 +160,10 @@ test('ls on missing name in current package', (t) => { }) }) -test('only named package arg', (t) => { +t.test('only named package arg', (t) => { npm.prefix = t.testdir({}) distTag.exec(['@scoped/another'], (err) => { - t.ifError(err, 'npm dist-tags ls') + t.error(err, 'npm dist-tags ls') t.matchSnapshot( result, 'should default to listing tags for the specified package' @@ -174,7 +172,7 @@ test('only named package arg', (t) => { }) }) -test('workspaces', (t) => { +t.test('workspaces', (t) => { npm.localPrefix = t.testdir({ 'package.json': JSON.stringify({ name: 'root', @@ -203,7 +201,7 @@ test('workspaces', (t) => { t.test('no args', t => { distTag.execWorkspaces([], [], (err) => { - t.ifError(err) + t.error(err) t.matchSnapshot(result, 'printed the expected output') t.end() }) @@ -211,7 +209,7 @@ test('workspaces', (t) => { t.test('no args, one workspace', t => { distTag.execWorkspaces([], ['workspace-a'], (err) => { - t.ifError(err) + t.error(err) t.matchSnapshot(result, 'printed the expected output') t.end() }) @@ -219,7 +217,7 @@ test('workspaces', (t) => { t.test('one arg -- .', t => { distTag.execWorkspaces(['.'], [], (err) => { - t.ifError(err) + t.error(err) t.matchSnapshot(result, 'printed the expected output') t.end() }) @@ -227,7 +225,7 @@ test('workspaces', (t) => { t.test('one arg -- .@1, ignores version spec', t => { distTag.execWorkspaces(['.@'], [], (err) => { - t.ifError(err) + t.error(err) t.matchSnapshot(result, 'printed the expected output') t.end() }) @@ -235,7 +233,7 @@ test('workspaces', (t) => { t.test('one arg -- list', t => { distTag.execWorkspaces(['list'], [], (err) => { - t.ifError(err) + t.error(err) t.matchSnapshot(result, 'printed the expected output') t.end() }) @@ -243,7 +241,7 @@ test('workspaces', (t) => { t.test('two args -- list, .', t => { distTag.execWorkspaces(['list', '.'], [], (err) => { - t.ifError(err) + t.error(err) t.matchSnapshot(result, 'printed the expected output') t.end() }) @@ -251,7 +249,7 @@ test('workspaces', (t) => { t.test('two args -- list, .@1, ignores version spec', t => { distTag.execWorkspaces(['list', '.@'], [], (err) => { - t.ifError(err) + t.error(err) t.matchSnapshot(result, 'printed the expected output') t.end() }) @@ -259,7 +257,7 @@ test('workspaces', (t) => { t.test('two args -- list, @scoped/pkg, logs a warning and ignores workspaces', t => { distTag.execWorkspaces(['list', '@scoped/pkg'], [], (err) => { - t.ifError(err) + t.error(err) t.match(log, 'Ignoring workspaces for specified package', 'logs a warning') t.matchSnapshot(result, 'printed the expected output') t.end() @@ -300,7 +298,7 @@ test('workspaces', (t) => { }) distTag.execWorkspaces([], [], (err) => { - t.ifError(err) + t.error(err) t.equal(process.exitCode, 1, 'set the error status') process.exitCode = 0 t.match(log, 'dist-tag ls Couldn\'t get dist-tag data for workspace-d@latest', 'logs the error') @@ -312,7 +310,7 @@ test('workspaces', (t) => { t.end() }) -test('add new tag', (t) => { +t.test('add new tag', (t) => { const _nrf = npmRegistryFetchMock t.teardown(() => { npmRegistryFetchMock = _nrf @@ -324,7 +322,7 @@ test('add new tag', (t) => { } npm.prefix = t.testdir({}) distTag.exec(['add', '@scoped/another@7.7.7', 'c'], (err) => { - t.ifError(err, 'npm dist-tags add') + t.error(err, 'npm dist-tags add') t.matchSnapshot( result, 'should return success msg' @@ -333,7 +331,7 @@ test('add new tag', (t) => { }) }) -test('add using valid semver range as name', (t) => { +t.test('add using valid semver range as name', (t) => { npm.prefix = t.testdir({}) distTag.exec(['add', '@scoped/another@7.7.7', '1.0.0'], (err) => { t.match( @@ -349,7 +347,7 @@ test('add using valid semver range as name', (t) => { }) }) -test('add missing args', (t) => { +t.test('add missing args', (t) => { npm.prefix = t.testdir({}) distTag.exec(['add', '@scoped/another@7.7.7'], (err) => { t.matchSnapshot(err, 'should exit usage error message') @@ -357,7 +355,7 @@ test('add missing args', (t) => { }) }) -test('add missing pkg name', (t) => { +t.test('add missing pkg name', (t) => { npm.prefix = t.testdir({}) distTag.exec(['add', null], (err) => { t.matchSnapshot(err, 'should exit usage error message') @@ -365,10 +363,10 @@ test('add missing pkg name', (t) => { }) }) -test('set existing version', (t) => { +t.test('set existing version', (t) => { npm.prefix = t.testdir({}) distTag.exec(['set', '@scoped/another@0.6.0', 'b'], (err) => { - t.ifError(err, 'npm dist-tags set') + t.error(err, 'npm dist-tags set') t.matchSnapshot( log, 'should log warn msg' @@ -377,7 +375,7 @@ test('set existing version', (t) => { }) }) -test('remove existing tag', (t) => { +t.test('remove existing tag', (t) => { const _nrf = npmRegistryFetchMock t.teardown(() => { npmRegistryFetchMock = _nrf @@ -388,14 +386,14 @@ test('remove existing tag', (t) => { } npm.prefix = t.testdir({}) distTag.exec(['rm', '@scoped/another', 'c'], (err) => { - t.ifError(err, 'npm dist-tags rm') + t.error(err, 'npm dist-tags rm') t.matchSnapshot(log, 'should log remove info') t.matchSnapshot(result, 'should return success msg') t.end() }) }) -test('remove non-existing tag', (t) => { +t.test('remove non-existing tag', (t) => { npm.prefix = t.testdir({}) distTag.exec(['rm', '@scoped/another', 'nonexistent'], (err) => { t.match( @@ -408,7 +406,7 @@ test('remove non-existing tag', (t) => { }) }) -test('remove missing pkg name', (t) => { +t.test('remove missing pkg name', (t) => { npm.prefix = t.testdir({}) distTag.exec(['rm', null], (err) => { t.matchSnapshot(err, 'should exit usage error message') @@ -416,7 +414,7 @@ test('remove missing pkg name', (t) => { }) }) -test('completion', t => { +t.test('completion', t => { const { completion } = distTag t.plan(2) diff --git a/deps/npm/test/lib/docs.js b/deps/npm/test/lib/docs.js index e8176eb47bdf99..0da070d9a7d137 100644 --- a/deps/npm/test/lib/docs.js +++ b/deps/npm/test/lib/docs.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm.js') const { join, sep } = require('path') @@ -72,16 +71,14 @@ const openUrl = async (npm, url, errMsg) => { opened[url]++ } -const Docs = requireInject('../../lib/docs.js', { +const Docs = t.mock('../../lib/docs.js', { '../../lib/utils/open-url.js': openUrl, }) const flatOptions = {} const npm = mockNpm({ flatOptions }) const docs = new Docs(npm) -t.afterEach(async () => { - opened = {} -}) +t.afterEach(() => opened = {}) t.test('open docs urls', t => { // XXX It is very odd that `where` is how pacote knows to look anywhere other diff --git a/deps/npm/test/lib/doctor.js b/deps/npm/test/lib/doctor.js index 56bbdf974491d2..0ceb670c150546 100644 --- a/deps/npm/test/lib/doctor.js +++ b/deps/npm/test/lib/doctor.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const { join } = require('path') const fs = require('fs') @@ -123,7 +122,7 @@ const cacache = { }, } -const Doctor = requireInject('../../lib/doctor.js', { +const Doctor = t.mock('../../lib/doctor.js', { '../../lib/utils/is-windows.js': false, '../../lib/utils/ping.js': ping, cacache, @@ -134,7 +133,7 @@ const Doctor = requireInject('../../lib/doctor.js', { const doctor = new Doctor(npm) const origVersion = process.version -test('node versions', t => { +t.test('node versions', t => { t.plan(nodeVersions.length) nodeVersions.forEach(({ version }) => { @@ -276,13 +275,13 @@ test('node versions', t => { st.match(output, /local bin folder.*ok/, 'local bin is ok') st.match(output, /global bin folder.*ok/, 'global bin is ok') st.match(output, /cache contents.*ok/, 'cache contents is ok') - st.notEqual(output[0], ansiTrim(output[0]), 'output should contain color codes') + st.not(output[0], ansiTrim(output[0]), 'output should contain color codes') st.end() }) }) vt.test('npm doctor skips some tests in windows', st => { - const WinDoctor = requireInject('../../lib/doctor.js', { + const WinDoctor = t.mock('../../lib/doctor.js', { '../../lib/utils/is-windows.js': true, '../../lib/utils/ping.js': ping, cacache, @@ -560,7 +559,7 @@ test('node versions', t => { } } - const Doctor = requireInject('../../lib/doctor.js', { + const Doctor = t.mock('../../lib/doctor.js', { '../../lib/utils/is-windows.js': false, '../../lib/utils/ping.js': ping, cacache, @@ -903,7 +902,7 @@ test('node versions', t => { }) }) -test('outdated node version', vt => { +t.test('outdated node version', vt => { vt.plan(1) const version = 'v10.0.0' diff --git a/deps/npm/test/lib/edit.js b/deps/npm/test/lib/edit.js index acf03fa438c3cf..09908165d77222 100644 --- a/deps/npm/test/lib/edit.js +++ b/deps/npm/test/lib/edit.js @@ -1,6 +1,5 @@ -const { test } = require('tap') +const t = require('tap') const { resolve } = require('path') -const requireInject = require('require-inject') const { EventEmitter } = require('events') let editorBin = null @@ -39,13 +38,13 @@ const npm = { } const gracefulFs = require('graceful-fs') -const Edit = requireInject('../../lib/edit.js', { +const Edit = t.mock('../../lib/edit.js', { child_process: childProcess, 'graceful-fs': gracefulFs, }) const edit = new Edit(npm) -test('npm edit', t => { +t.test('npm edit', t => { t.teardown(() => { rebuildArgs = null editorBin = null @@ -66,7 +65,7 @@ test('npm edit', t => { }) }) -test('rebuild fails', t => { +t.test('rebuild fails', t => { t.teardown(() => { rebuildFail = null rebuildArgs = null @@ -87,7 +86,7 @@ test('rebuild fails', t => { }) }) -test('npm edit editor has flags', t => { +t.test('npm edit editor has flags', t => { EDITOR = 'code -w' t.teardown(() => { rebuildArgs = null @@ -110,14 +109,14 @@ test('npm edit editor has flags', t => { }) }) -test('npm edit no args', t => { +t.test('npm edit no args', t => { return edit.exec([], (err) => { t.match(err, /npm edit/, 'throws usage error') t.end() }) }) -test('npm edit lstat error propagates', t => { +t.test('npm edit lstat error propagates', t => { const _lstat = gracefulFs.lstat gracefulFs.lstat = (dir, cb) => { return cb(new Error('lstat failed')) @@ -132,7 +131,7 @@ test('npm edit lstat error propagates', t => { }) }) -test('npm edit editor exit code error propagates', t => { +t.test('npm edit editor exit code error propagates', t => { EDITOR_CODE = 137 t.teardown(() => { EDITOR_CODE = 0 diff --git a/deps/npm/test/lib/exec.js b/deps/npm/test/lib/exec.js index bcfe75577ce27d..5ecc73274876a6 100644 --- a/deps/npm/test/lib/exec.js +++ b/deps/npm/test/lib/exec.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const { resolve, delimiter } = require('path') const OUTPUT = [] @@ -35,7 +34,7 @@ const config = { yes: true, call: '', package: [], - shell: 'shell-cmd', + 'script-shell': 'shell-cmd', } const npm = mockNpm({ flatOptions, @@ -87,17 +86,19 @@ const PATH = require('../../lib/utils/path.js') let CI_NAME = 'travis-ci' const mocks = { - '@npmcli/arborist': Arborist, - '@npmcli/run-script': runScript, - '@npmcli/ci-detect': () => CI_NAME, - pacote, - read, - 'mkdirp-infer-owner': mkdirp, + libnpmexec: t.mock('libnpmexec', { + '@npmcli/arborist': Arborist, + '@npmcli/run-script': runScript, + '@npmcli/ci-detect': () => CI_NAME, + pacote, + read, + 'mkdirp-infer-owner': mkdirp, + }), } -const Exec = requireInject('../../lib/exec.js', mocks) +const Exec = t.mock('../../lib/exec.js', mocks) const exec = new Exec(npm) -t.afterEach(cb => { +t.afterEach(() => { MKDIRPS.length = 0 ARB_CTOR.length = 0 ARB_REIFY.length = 0 @@ -109,13 +110,13 @@ t.afterEach(cb => { PROGRESS_IGNORED = false flatOptions.legacyPeerDeps = false config.color = false + config['script-shell'] = 'shell-cmd' config.package = [] flatOptions.package = [] config.call = '' config.yes = true npm.localBin = 'local-bin' npm.globalBin = 'global-bin' - cb() }) t.test('npx foo, bin already exists locally', t => { @@ -127,7 +128,7 @@ t.test('npx foo, bin already exists locally', t => { npm.localBin = path exec.exec(['foo', 'one arg', 'two arg'], er => { - t.ifError(er, 'npm exec') + t.error(er, 'npm exec') t.match(RUN_SCRIPTS, [{ pkg: { scripts: { npx: 'foo' }}, args: ['one arg', 'two arg'], @@ -153,7 +154,7 @@ t.test('npx foo, bin already exists globally', t => { npm.globalBin = path exec.exec(['foo', 'one arg', 'two arg'], er => { - t.ifError(er, 'npm exec') + t.error(er, 'npm exec') t.match(RUN_SCRIPTS, [{ pkg: { scripts: { npx: 'foo' }}, args: ['one arg', 'two arg'], @@ -290,6 +291,29 @@ t.test('npm exec <noargs>, run interactive shell', t => { }) }) + t.test('not defined script-shell config value', t => { + CI_NAME = null + process.stdin.isTTY = true + config['script-shell'] = undefined + + exec.exec([], er => { + if (er) + throw er + + t.match(RUN_SCRIPTS, [{ + pkg: { scripts: { npx: undefined } }, + }]) + + LOG_WARN.length = 0 + ARB_CTOR.length = 0 + MKDIRPS.length = 0 + ARB_REIFY.length = 0 + OUTPUT.length = 0 + RUN_SCRIPTS.length = 0 + t.end() + }) + }) + t.end() }) @@ -1067,7 +1091,7 @@ t.test('abort if -n provided', t => { t.equal(PROGRESS_ENABLED, true, 'progress re-enabled') t.strictSame(RUN_SCRIPTS, []) t.strictSame(READ, []) - t.done() + t.end() }) }) @@ -1095,7 +1119,7 @@ t.test('forward legacyPeerDeps opt', t => { if (er) throw er t.match(ARB_REIFY, [{add: ['foo@'], legacyPeerDeps: true}], 'need to install foo@ using legacyPeerDeps opt') - t.done() + t.end() }) }) diff --git a/deps/npm/test/lib/explain.js b/deps/npm/test/lib/explain.js index 2e82928d89d194..7e4ec8bd37bff3 100644 --- a/deps/npm/test/lib/explain.js +++ b/deps/npm/test/lib/explain.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const npm = { prefix: null, color: true, @@ -12,7 +11,7 @@ const { resolve } = require('path') const OUTPUT = [] -const Explain = requireInject('../../lib/explain.js', { +const Explain = t.mock('../../lib/explain.js', { // keep the snapshots pared down a bit, since this has its own tests. '../../lib/utils/explain-dep.js': { @@ -27,7 +26,7 @@ t.test('no args throws usage', t => { t.plan(1) explain.exec([], er => { t.equal(er, explain.usage) - t.done() + t.end() }) }) @@ -49,10 +48,9 @@ t.test('invalid package name throws not found', t => { }) t.test('explain some nodes', t => { - t.afterEach((cb) => { + t.afterEach(() => { OUTPUT.length = 0 npm.flatOptions.json = false - cb() }) npm.prefix = t.testdir({ @@ -172,7 +170,7 @@ t.test('explain some nodes', t => { t.plan(1) explain.exec(['asdf/foo/bar', 'quux@1.x'], er => { t.equal(er, 'No dependencies found matching asdf/foo/bar, quux@1.x') - t.done() + t.end() }) }) t.end() diff --git a/deps/npm/test/lib/explore.js b/deps/npm/test/lib/explore.js index a0655380e55832..b49c885cbcb269 100644 --- a/deps/npm/test/lib/explore.js +++ b/deps/npm/test/lib/explore.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') let RPJ_ERROR = null let RPJ_CALLED = '' @@ -47,7 +46,7 @@ const output = [] let ERROR_HANDLER_CALLED = null const logs = [] const getExplore = (windows) => { - const Explore = requireInject('../../lib/explore.js', { + const Explore = t.mock('../../lib/explore.js', { '../../lib/utils/is-windows.js': windows, path: require('path')[windows ? 'win32' : 'posix'], '../../lib/utils/error-handler.js': er => { @@ -77,10 +76,7 @@ const windowsExplore = getExplore(true) const posixExplore = getExplore(false) t.test('basic interactive', t => { - t.afterEach((cb) => { - output.length = 0 - cb() - }) + t.afterEach(() => output.length = 0) t.test('windows', t => windowsExplore.exec(['pkg'], er => { if (er) @@ -125,16 +121,14 @@ t.test('basic interactive', t => { t.test('interactive tracks exit code', t => { const { exitCode } = process - t.beforeEach((cb) => { + t.beforeEach(() => { process.exitCode = exitCode RUN_SCRIPT_EXIT_CODE = 99 - cb() }) - t.afterEach((cb) => { + t.afterEach(() => { RUN_SCRIPT_EXIT_CODE = 0 output.length = 0 process.exitCode = exitCode - cb() }) t.test('windows', t => windowsExplore.exec(['pkg'], er => { @@ -223,10 +217,7 @@ t.test('interactive tracks exit code', t => { }) t.test('basic non-interactive', t => { - t.afterEach((cb) => { - output.length = 0 - cb() - }) + t.afterEach(() => output.length = 0) t.test('windows', t => windowsExplore.exec(['pkg', 'ls'], er => { if (er) @@ -267,22 +258,17 @@ t.test('basic non-interactive', t => { t.test('signal fails non-interactive', t => { const { exitCode } = process - t.afterEach((cb) => { + t.afterEach(() => { output.length = 0 logs.length = 0 - cb() }) - t.beforeEach(cb => { + t.beforeEach(() => { RUN_SCRIPT_SIGNAL = 'SIGPROBLEM' RUN_SCRIPT_EXIT_CODE = null process.exitCode = exitCode - cb() - }) - t.afterEach(cb => { - process.exitCode = exitCode - cb() }) + t.afterEach(() => process.exitCode = exitCode) t.test('windows', t => windowsExplore.exec(['pkg', 'ls'], er => { t.match(er, { diff --git a/deps/npm/test/lib/fund.js b/deps/npm/test/lib/fund.js index 8c10007844f0ac..41754d51f35894 100644 --- a/deps/npm/test/lib/fund.js +++ b/deps/npm/test/lib/fund.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const mockNpm = require('../fixtures/mock-npm') const version = '1.0.0' @@ -200,7 +199,7 @@ const openUrl = async (npm, url, msg) => { } else printUrl = `${msg}:\n ${url}` } -const Fund = requireInject('../../lib/fund.js', { +const Fund = t.mock('../../lib/fund.js', { '../../lib/utils/open-url.js': openUrl, pacote: { manifest: (arg) => arg.name === 'ntl' @@ -218,7 +217,7 @@ const npm = mockNpm({ }) const fund = new Fund(npm) -test('fund with no package containing funding', t => { +t.test('fund with no package containing funding', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'no-funding-package', @@ -227,31 +226,31 @@ test('fund with no package containing funding', t => { }) fund.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(result, 'should print empty funding info') result = '' t.end() }) }) -test('fund in which same maintainer owns all its deps', t => { +t.test('fund in which same maintainer owns all its deps', t => { npm.prefix = t.testdir(maintainerOwnsAllDeps) fund.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(result, 'should print stack packages together') result = '' t.end() }) }) -test('fund in which same maintainer owns all its deps, using --json option', t => { +t.test('fund in which same maintainer owns all its deps, using --json option', t => { config.json = true npm.prefix = t.testdir(maintainerOwnsAllDeps) fund.exec([], (err) => { - t.ifError(err, 'should not error out') - t.deepEqual( + t.error(err, 'should not error out') + t.same( JSON.parse(result), { length: 3, @@ -284,11 +283,11 @@ test('fund in which same maintainer owns all its deps, using --json option', t = }) }) -test('fund containing multi-level nested deps with no funding', t => { +t.test('fund containing multi-level nested deps with no funding', t => { npm.prefix = t.testdir(nestedNoFundingPackages) fund.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot( result, 'should omit dependencies with no funding declared' @@ -299,13 +298,13 @@ test('fund containing multi-level nested deps with no funding', t => { }) }) -test('fund containing multi-level nested deps with no funding, using --json option', t => { +t.test('fund containing multi-level nested deps with no funding, using --json option', t => { npm.prefix = t.testdir(nestedNoFundingPackages) config.json = true fund.exec([], (err) => { - t.ifError(err, 'should not error out') - t.deepEqual( + t.error(err, 'should not error out') + t.same( JSON.parse(result), { length: 2, @@ -331,13 +330,13 @@ test('fund containing multi-level nested deps with no funding, using --json opti }) }) -test('fund containing multi-level nested deps with no funding, using --json option', t => { +t.test('fund containing multi-level nested deps with no funding, using --json option', t => { npm.prefix = t.testdir(nestedMultipleFundingPackages) config.json = true fund.exec([], (err) => { - t.ifError(err, 'should not error out') - t.deepEqual( + t.error(err, 'should not error out') + t.same( JSON.parse(result), { length: 2, @@ -388,7 +387,7 @@ test('fund containing multi-level nested deps with no funding, using --json opti }) }) -test('fund does not support global', t => { +t.test('fund does not support global', t => { npm.prefix = t.testdir({}) config.global = true @@ -401,11 +400,11 @@ test('fund does not support global', t => { }) }) -test('fund using package argument', t => { +t.test('fund using package argument', t => { npm.prefix = t.testdir(maintainerOwnsAllDeps) fund.exec(['.'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(printUrl, 'should open funding url') printUrl = '' @@ -413,7 +412,7 @@ test('fund using package argument', t => { }) }) -test('fund does not support global, using --json option', t => { +t.test('fund does not support global, using --json option', t => { npm.prefix = t.testdir({}) config.global = true config.json = true @@ -432,7 +431,7 @@ test('fund does not support global, using --json option', t => { }) }) -test('fund using string shorthand', t => { +t.test('fund using string shorthand', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'funding-string-shorthand', @@ -442,7 +441,7 @@ test('fund using string shorthand', t => { }) fund.exec(['.'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(printUrl, 'should open string-only url') printUrl = '' @@ -450,11 +449,11 @@ test('fund using string shorthand', t => { }) }) -test('fund using nested packages with multiple sources', t => { +t.test('fund using nested packages with multiple sources', t => { npm.prefix = t.testdir(nestedMultipleFundingPackages) fund.exec(['.'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(result, 'should prompt with all available URLs') result = '' @@ -462,7 +461,7 @@ test('fund using nested packages with multiple sources', t => { }) }) -test('fund using symlink ref', t => { +t.test('fund using symlink ref', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'using-symlink-ref', @@ -482,7 +481,7 @@ test('fund using symlink ref', t => { // using symlinked ref fund.exec(['./node_modules/a'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.match( printUrl, 'http://example.com/a', @@ -493,7 +492,7 @@ test('fund using symlink ref', t => { // using target ref fund.exec(['./a'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.match( printUrl, @@ -508,7 +507,7 @@ test('fund using symlink ref', t => { }) }) -test('fund using data from actual tree', t => { +t.test('fund using data from actual tree', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'using-actual-tree', @@ -543,7 +542,7 @@ test('fund using data from actual tree', t => { // using symlinked ref fund.exec(['a'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.match( printUrl, 'http://example.com/_AAA', @@ -555,12 +554,12 @@ test('fund using data from actual tree', t => { }) }) -test('fund using nested packages with multiple sources, with a source number', t => { +t.test('fund using nested packages with multiple sources, with a source number', t => { npm.prefix = t.testdir(nestedMultipleFundingPackages) config.which = '1' fund.exec(['.'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(printUrl, 'should open the numbered URL') config.which = null @@ -569,12 +568,12 @@ test('fund using nested packages with multiple sources, with a source number', t }) }) -test('fund using pkg name while having conflicting versions', t => { +t.test('fund using pkg name while having conflicting versions', t => { npm.prefix = t.testdir(conflictingFundingPackages) config.which = '1' fund.exec(['foo'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(printUrl, 'should open greatest version') printUrl = '' @@ -582,13 +581,13 @@ test('fund using pkg name while having conflicting versions', t => { }) }) -test('fund using package argument with no browser, using --json option', t => { +t.test('fund using package argument with no browser, using --json option', t => { npm.prefix = t.testdir(maintainerOwnsAllDeps) config.json = true fund.exec(['.'], (err) => { - t.ifError(err, 'should not error out') - t.deepEqual( + t.error(err, 'should not error out') + t.same( JSON.parse(printUrl), { title: 'individual funding available at the following URL', @@ -603,11 +602,11 @@ test('fund using package argument with no browser, using --json option', t => { }) }) -test('fund using package info fetch from registry', t => { +t.test('fund using package info fetch from registry', t => { npm.prefix = t.testdir({}) fund.exec(['ntl'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.match( printUrl, /http:\/\/example.com\/pacote/, @@ -619,7 +618,7 @@ test('fund using package info fetch from registry', t => { }) }) -test('fund tries to use package info fetch from registry but registry has nothing', t => { +t.test('fund tries to use package info fetch from registry but registry has nothing', t => { npm.prefix = t.testdir({}) fund.exec(['foo'], (err) => { @@ -635,7 +634,7 @@ test('fund tries to use package info fetch from registry but registry has nothin }) }) -test('fund but target module has no funding info', t => { +t.test('fund but target module has no funding info', t => { npm.prefix = t.testdir(nestedNoFundingPackages) fund.exec(['foo'], (err) => { @@ -651,7 +650,7 @@ test('fund but target module has no funding info', t => { }) }) -test('fund using bad which value', t => { +t.test('fund using bad which value', t => { npm.prefix = t.testdir(nestedMultipleFundingPackages) config.which = 3 @@ -669,7 +668,7 @@ test('fund using bad which value', t => { }) }) -test('fund pkg missing version number', t => { +t.test('fund pkg missing version number', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'foo', @@ -678,14 +677,14 @@ test('fund pkg missing version number', t => { }) fund.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(result, 'should print name only') result = '' t.end() }) }) -test('fund a package throws on openUrl', t => { +t.test('fund a package throws on openUrl', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'foo', @@ -701,7 +700,7 @@ test('fund a package throws on openUrl', t => { }) }) -test('fund a package with type and multiple sources', t => { +t.test('fund a package with type and multiple sources', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'foo', @@ -719,7 +718,7 @@ test('fund a package with type and multiple sources', t => { }) fund.exec(['.'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(result, 'should print prompt select message') result = '' @@ -727,7 +726,7 @@ test('fund a package with type and multiple sources', t => { }) }) -test('fund colors', t => { +t.test('fund colors', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-fund-colors', @@ -783,7 +782,7 @@ test('fund colors', t => { npm.color = true fund.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(result, 'should print output with color info') result = '' @@ -792,7 +791,7 @@ test('fund colors', t => { }) }) -test('sub dep with fund info and a parent with no funding info', t => { +t.test('sub dep with fund info and a parent with no funding info', t => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'test-multiple-funding-sources', @@ -833,7 +832,7 @@ test('sub dep with fund info and a parent with no funding info', t => { }) fund.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') t.matchSnapshot(result, 'should nest sub dep as child of root') result = '' diff --git a/deps/npm/test/lib/get.js b/deps/npm/test/lib/get.js index a11597d2682db0..9b77fbba3e6f40 100644 --- a/deps/npm/test/lib/get.js +++ b/deps/npm/test/lib/get.js @@ -1,8 +1,7 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') -test('should retrieve values from npm.commands.config', (t) => { - const Get = requireInject('../../lib/get.js') +t.test('should retrieve values from npm.commands.config', (t) => { + const Get = t.mock('../../lib/get.js') const get = new Get({ commands: { config: ([action, arg]) => { diff --git a/deps/npm/test/lib/help-search.js b/deps/npm/test/lib/help-search.js index 567097a2eb183f..845b3873e3cf9d 100644 --- a/deps/npm/test/lib/help-search.js +++ b/deps/npm/test/lib/help-search.js @@ -1,6 +1,5 @@ -const { test } = require('tap') +const t = require('tap') const { join } = require('path') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const ansicolors = require('ansicolors') @@ -43,12 +42,12 @@ const globDir = { const glob = (p, cb) => cb(null, Object.keys(globDir).map((file) => join(globRoot, file))) -const HelpSearch = requireInject('../../lib/help-search.js', { +const HelpSearch = t.mock('../../lib/help-search.js', { glob, }) const helpSearch = new HelpSearch(npm) -test('npm help-search', t => { +t.test('npm help-search', t => { globRoot = t.testdir(globDir) t.teardown(() => { OUTPUT.length = 0 @@ -64,7 +63,7 @@ test('npm help-search', t => { }) }) -test('npm help-search multiple terms', t => { +t.test('npm help-search multiple terms', t => { globRoot = t.testdir(globDir) t.teardown(() => { OUTPUT.length = 0 @@ -81,7 +80,7 @@ test('npm help-search multiple terms', t => { }) }) -test('npm help-search long output', t => { +t.test('npm help-search long output', t => { globRoot = t.testdir(globDir) config.long = true t.teardown(() => { @@ -99,7 +98,7 @@ test('npm help-search long output', t => { }) }) -test('npm help-search long output with color', t => { +t.test('npm help-search long output with color', t => { globRoot = t.testdir(globDir) config.long = true npm.color = true @@ -120,7 +119,7 @@ test('npm help-search long output with color', t => { }) }) -test('npm help-search no args', t => { +t.test('npm help-search no args', t => { return helpSearch.exec([], (err) => { t.notOk(err) t.match(OUTPUT, /npm help-search/, 'outputs usage') @@ -128,7 +127,7 @@ test('npm help-search no args', t => { }) }) -test('npm help-search no matches', t => { +t.test('npm help-search no matches', t => { globRoot = t.testdir(globDir) t.teardown(() => { OUTPUT.length = 0 diff --git a/deps/npm/test/lib/help.js b/deps/npm/test/lib/help.js index b5fe297b5c4307..44ba5b1cabc3c1 100644 --- a/deps/npm/test/lib/help.js +++ b/deps/npm/test/lib/help.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const { EventEmitter } = require('events') const npmConfig = { @@ -68,7 +67,7 @@ const openUrl = async (npm, url, msg) => { openUrlArg = url } -const Help = requireInject('../../lib/help.js', { +const Help = t.mock('../../lib/help.js', { '../../lib/utils/open-url.js': openUrl, child_process: { spawn, @@ -77,7 +76,7 @@ const Help = requireInject('../../lib/help.js', { }) const help = new Help(npm) -test('npm help', t => { +t.test('npm help', t => { return help.exec([], (err) => { if (err) throw err @@ -87,7 +86,7 @@ test('npm help', t => { }) }) -test('npm help completion', async t => { +t.test('npm help completion', async t => { t.teardown(() => { globErr = null }) @@ -100,7 +99,7 @@ test('npm help completion', async t => { t.rejects(help.completion({ conf: { argv: { remain: [] } } }), /glob failed/, 'glob errors propagate') }) -test('npm help multiple args calls search', t => { +t.test('npm help multiple args calls search', t => { t.teardown(() => { helpSearchArgs = null }) @@ -114,7 +113,7 @@ test('npm help multiple args calls search', t => { }) }) -test('npm help no matches calls search', t => { +t.test('npm help no matches calls search', t => { globResult = [] t.teardown(() => { helpSearchArgs = null @@ -130,7 +129,7 @@ test('npm help no matches calls search', t => { }) }) -test('npm help glob errors propagate', t => { +t.test('npm help glob errors propagate', t => { globErr = new Error('glob failed') t.teardown(() => { globErr = null @@ -144,7 +143,7 @@ test('npm help glob errors propagate', t => { }) }) -test('npm help whoami', t => { +t.test('npm help whoami', t => { globResult = ['/root/man/man1/npm-whoami.1.xz'] t.teardown(() => { globResult = globDefaults @@ -162,7 +161,7 @@ test('npm help whoami', t => { }) }) -test('npm help 1 install', t => { +t.test('npm help 1 install', t => { npmConfig.viewer = 'browser' globResult = [ '/root/man/man5/install.5', @@ -185,7 +184,7 @@ test('npm help 1 install', t => { }) }) -test('npm help 5 install', t => { +t.test('npm help 5 install', t => { npmConfig.viewer = 'browser' globResult = [ '/root/man/man5/install.5', @@ -209,7 +208,7 @@ test('npm help 5 install', t => { }) }) -test('npm help 7 config', t => { +t.test('npm help 7 config', t => { npmConfig.viewer = 'browser' globResult = [ '/root/man/man7/config.7', @@ -232,7 +231,7 @@ test('npm help 7 config', t => { }) }) -test('npm help package.json redirects to package-json', t => { +t.test('npm help package.json redirects to package-json', t => { globResult = ['/root/man/man5/package-json.5'] t.teardown(() => { globResult = globDefaults @@ -251,7 +250,7 @@ test('npm help package.json redirects to package-json', t => { }) }) -test('npm help ?(un)star', t => { +t.test('npm help ?(un)star', t => { npmConfig.viewer = 'woman' globResult = [ '/root/man/man1/npm-star.1', @@ -274,7 +273,7 @@ test('npm help ?(un)star', t => { }) }) -test('npm help - woman viewer propagates errors', t => { +t.test('npm help - woman viewer propagates errors', t => { npmConfig.viewer = 'woman' spawnCode = 1 globResult = [ @@ -297,7 +296,7 @@ test('npm help - woman viewer propagates errors', t => { }) }) -test('npm help un*', t => { +t.test('npm help un*', t => { globResult = [ '/root/man/man1/npm-unstar.1', '/root/man/man1/npm-uninstall.1', @@ -319,7 +318,7 @@ test('npm help un*', t => { }) }) -test('npm help - man viewer propagates errors', t => { +t.test('npm help - man viewer propagates errors', t => { spawnCode = 1 globResult = [ '/root/man/man1/npm-unstar.1', @@ -341,7 +340,7 @@ test('npm help - man viewer propagates errors', t => { }) }) -test('npm help with complex installation path finds proper help file', t => { +t.test('npm help with complex installation path finds proper help file', t => { npmConfig.viewer = 'browser' globResult = [ 'C:/Program Files/node-v14.15.5-win-x64/node_modules/npm/man/man1/npm-install.1', diff --git a/deps/npm/test/lib/hook.js b/deps/npm/test/lib/hook.js index 3e012d94ee74ff..2419f160417482 100644 --- a/deps/npm/test/lib/hook.js +++ b/deps/npm/test/lib/hook.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const output = [] const npm = { @@ -55,20 +54,20 @@ const libnpmhook = { }, } -const Hook = requireInject('../../lib/hook.js', { +const Hook = t.mock('../../lib/hook.js', { '../../lib/utils/otplease.js': async (opts, fn) => fn(opts), libnpmhook, }) const hook = new Hook(npm) -test('npm hook no args', t => { +t.test('npm hook no args', t => { return hook.exec([], (err) => { t.match(err, /npm hook add/, 'throws usage with no arguments') t.end() }) }) -test('npm hook add', t => { +t.test('npm hook add', t => { t.teardown(() => { hookArgs = null output.length = 0 @@ -89,7 +88,7 @@ test('npm hook add', t => { }) }) -test('npm hook add - unicode output', t => { +t.test('npm hook add - unicode output', t => { npm.flatOptions.unicode = true t.teardown(() => { npm.flatOptions.unicode = false @@ -112,7 +111,7 @@ test('npm hook add - unicode output', t => { }) }) -test('npm hook add - json output', t => { +t.test('npm hook add - json output', t => { npm.flatOptions.json = true t.teardown(() => { npm.flatOptions.json = false @@ -140,7 +139,7 @@ test('npm hook add - json output', t => { }) }) -test('npm hook add - parseable output', t => { +t.test('npm hook add - parseable output', t => { npm.flatOptions.parseable = true t.teardown(() => { npm.flatOptions.parseable = false @@ -168,7 +167,7 @@ test('npm hook add - parseable output', t => { }) }) -test('npm hook add - silent output', t => { +t.test('npm hook add - silent output', t => { npm.flatOptions.silent = true t.teardown(() => { npm.flatOptions.silent = false @@ -191,7 +190,7 @@ test('npm hook add - silent output', t => { }) }) -test('npm hook ls', t => { +t.test('npm hook ls', t => { t.teardown(() => { hookArgs = null output.length = 0 @@ -214,7 +213,7 @@ test('npm hook ls', t => { }) }) -test('npm hook ls, no results', t => { +t.test('npm hook ls, no results', t => { hookResponse = [] t.teardown(() => { hookResponse = null @@ -235,7 +234,7 @@ test('npm hook ls, no results', t => { }) }) -test('npm hook ls, single result', t => { +t.test('npm hook ls, single result', t => { hookResponse = [{ id: 1, name: 'semver', @@ -264,7 +263,7 @@ test('npm hook ls, single result', t => { }) }) -test('npm hook ls - json output', t => { +t.test('npm hook ls - json output', t => { npm.flatOptions.json = true t.teardown(() => { npm.flatOptions.json = false @@ -301,7 +300,7 @@ test('npm hook ls - json output', t => { }) }) -test('npm hook ls - parseable output', t => { +t.test('npm hook ls - parseable output', t => { npm.flatOptions.parseable = true t.teardown(() => { npm.flatOptions.parseable = false @@ -327,7 +326,7 @@ test('npm hook ls - parseable output', t => { }) }) -test('npm hook ls - silent output', t => { +t.test('npm hook ls - silent output', t => { npm.flatOptions.silent = true t.teardown(() => { npm.flatOptions.silent = false @@ -348,7 +347,7 @@ test('npm hook ls - silent output', t => { }) }) -test('npm hook rm', t => { +t.test('npm hook rm', t => { t.teardown(() => { hookArgs = null output.length = 0 @@ -369,7 +368,7 @@ test('npm hook rm', t => { }) }) -test('npm hook rm - unicode output', t => { +t.test('npm hook rm - unicode output', t => { npm.flatOptions.unicode = true t.teardown(() => { npm.flatOptions.unicode = false @@ -392,7 +391,7 @@ test('npm hook rm - unicode output', t => { }) }) -test('npm hook rm - silent output', t => { +t.test('npm hook rm - silent output', t => { npm.flatOptions.silent = true t.teardown(() => { npm.flatOptions.silent = false @@ -413,7 +412,7 @@ test('npm hook rm - silent output', t => { }) }) -test('npm hook rm - json output', t => { +t.test('npm hook rm - json output', t => { npm.flatOptions.json = true t.teardown(() => { npm.flatOptions.json = false @@ -439,7 +438,7 @@ test('npm hook rm - json output', t => { }) }) -test('npm hook rm - parseable output', t => { +t.test('npm hook rm - parseable output', t => { npm.flatOptions.parseable = true t.teardown(() => { npm.flatOptions.parseable = false @@ -463,7 +462,7 @@ test('npm hook rm - parseable output', t => { }) }) -test('npm hook update', t => { +t.test('npm hook update', t => { t.teardown(() => { hookArgs = null output.length = 0 @@ -486,7 +485,7 @@ test('npm hook update', t => { }) }) -test('npm hook update - unicode', t => { +t.test('npm hook update - unicode', t => { npm.flatOptions.unicode = true t.teardown(() => { npm.flatOptions.unicode = false @@ -511,7 +510,7 @@ test('npm hook update - unicode', t => { }) }) -test('npm hook update - json output', t => { +t.test('npm hook update - json output', t => { npm.flatOptions.json = true t.teardown(() => { npm.flatOptions.json = false @@ -539,7 +538,7 @@ test('npm hook update - json output', t => { }) }) -test('npm hook update - parseable output', t => { +t.test('npm hook update - parseable output', t => { npm.flatOptions.parseable = true t.teardown(() => { npm.flatOptions.parseable = false @@ -565,7 +564,7 @@ test('npm hook update - parseable output', t => { }) }) -test('npm hook update - silent output', t => { +t.test('npm hook update - silent output', t => { npm.flatOptions.silent = true t.teardown(() => { npm.flatOptions.silent = false diff --git a/deps/npm/test/lib/init.js b/deps/npm/test/lib/init.js index 2b212f4a159e8a..0964bb5cedde69 100644 --- a/deps/npm/test/lib/init.js +++ b/deps/npm/test/lib/init.js @@ -1,5 +1,6 @@ +const fs = require('fs') +const { resolve } = require('path') const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') let result = '' @@ -13,122 +14,195 @@ const npmLog = { } const config = { 'init-module': '~/.npm-init.js', + yes: true, } const npm = mockNpm({ config, log: npmLog, - commands: {}, output: (...msg) => { result += msg.join('\n') }, }) const mocks = { - 'init-package-json': (dir, initFile, config, cb) => cb(null, 'data'), '../../lib/utils/usage.js': () => 'usage instructions', } -const Init = requireInject('../../lib/init.js', mocks) +const Init = t.mock('../../lib/init.js', mocks) const init = new Init(npm) +const _cwd = process.cwd() +const _consolelog = console.log +const noop = () => {} -t.afterEach(cb => { +t.afterEach(() => { result = '' + config.yes = true config.package = undefined - npm.commands = {} npm.log = npmLog - cb() + process.chdir(_cwd) + console.log = _consolelog }) -t.test('classic npm init no args', t => { +t.test('classic npm init -y', t => { + npm.localPrefix = t.testdir({}) + + // init-package-json prints directly to console.log + // this avoids poluting test output with those logs + console.log = noop + + process.chdir(npm.localPrefix) init.exec([], err => { - t.ifError(err, 'npm init no args') - t.matchSnapshot(result, 'should print helper info') + if (err) + throw err + + const pkg = require(resolve(npm.localPrefix, 'package.json')) + t.equal(pkg.version, '1.0.0') + t.equal(pkg.license, 'ISC') t.end() }) }) -t.test('classic npm init -y', t => { - t.plan(7) - config.yes = true - Object.defineProperty(npm, 'flatOptions', { value: { yes: true} }) - npm.log = { ...npm.log } - npm.log.silly = (title, msg) => { - t.equal(title, 'package data', 'should print title') - t.equal(msg, 'data', 'should print pkg data info') - } - npm.log.resume = () => { - t.ok('should resume logs') - } - npm.log.info = (title, msg) => { - t.equal(title, 'init', 'should print title') - t.equal(msg, 'written successfully', 'should print done info') - } +t.test('classic interactive npm init', t => { + npm.localPrefix = t.testdir({}) + config.yes = undefined + + const Init = t.mock('../../lib/init.js', { + ...mocks, + 'init-package-json': (path, initFile, config, cb) => { + t.equal( + path, + resolve(npm.localPrefix), + 'should start init package.json in expected path' + ) + cb() + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec([], err => { - t.ifError(err, 'npm init -y') - t.equal(result, '') + if (err) + throw err + + t.end() }) }) t.test('npm init <arg>', t => { - t.plan(3) - npm.commands.exec = (arr, cb) => { - t.deepEqual(config.package, [], 'should set empty array value') - t.deepEqual( - arr, - ['create-react-app'], - 'should npx with listed packages' - ) - cb() - } + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['create-react-app'], + 'should npx with listed packages' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec(['react-app'], err => { - t.ifError(err, 'npm init react-app') + if (err) + throw err }) }) +t.test('npm init <arg> -- other-args', t => { + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['create-react-app', 'my-path', '--some-option', 'some-value'], + 'should npm exec with expected args' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) + init.exec( + ['react-app', 'my-path', '--some-option', 'some-value'], + err => { + if (err) + throw err + } + ) +}) + t.test('npm init @scope/name', t => { - t.plan(2) - npm.commands.exec = (arr, cb) => { - t.deepEqual( - arr, - ['@npmcli/create-something'], - 'should npx with scoped packages' - ) - cb() - } + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['@npmcli/create-something'], + 'should npx with scoped packages' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec(['@npmcli/something'], err => { - t.ifError(err, 'npm init init @scope/name') + if (err) + throw err }) }) t.test('npm init git spec', t => { - t.plan(2) - npm.commands.exec = (arr, cb) => { - t.deepEqual( - arr, - ['npm/create-something'], - 'should npx with git-spec packages' - ) - cb() - } + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['npm/create-something'], + 'should npx with git-spec packages' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec(['npm/something'], err => { - t.ifError(err, 'npm init init @scope/name') + if (err) + throw err }) }) t.test('npm init @scope', t => { - t.plan(2) - npm.commands.exec = (arr, cb) => { - t.deepEqual( - arr, - ['@npmcli/create'], - 'should npx with @scope/create pkgs' - ) - cb() - } + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['@npmcli/create'], + 'should npx with @scope/create pkgs' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec(['@npmcli'], err => { - t.ifError(err, 'npm init init @scope/create') + if (err) + throw err }) }) t.test('npm init tgz', t => { + npm.localPrefix = t.testdir({}) + + process.chdir(npm.localPrefix) init.exec(['something.tgz'], err => { t.match( err, @@ -140,24 +214,38 @@ t.test('npm init tgz', t => { }) t.test('npm init <arg>@next', t => { - t.plan(2) - npm.commands.exec = (arr, cb) => { - t.deepEqual( - arr, - ['create-something@next'], - 'should npx with something@next' - ) - cb() - } + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: ({ args }) => { + t.same( + args, + ['create-something@next'], + 'should npx with something@next' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec(['something@next'], err => { - t.ifError(err, 'npm init init something@next') + if (err) + throw err }) }) t.test('npm init exec error', t => { - npm.commands.exec = (arr, cb) => { - cb(new Error('ERROR')) - } + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: async ({ args }) => { + throw new Error('ERROR') + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec(['something@next'], err => { t.match( err, @@ -169,24 +257,32 @@ t.test('npm init exec error', t => { }) t.test('should not rewrite flatOptions', t => { - t.plan(3) - npm.commands.exec = (arr, cb) => { - t.deepEqual(config.package, [], 'should set empty array value') - t.deepEqual( - arr, - ['create-react-app', 'my-app'], - 'should npx with extra args' - ) - cb() - } + t.plan(1) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { + libnpmexec: async ({ args }) => { + t.same( + args, + ['create-react-app', 'my-app'], + 'should npx with extra args' + ) + }, + }) + const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec(['react-app', 'my-app'], err => { - t.ifError(err, 'npm init react-app') + if (err) + throw err }) }) t.test('npm init cancel', t => { - t.plan(3) - const Init = requireInject('../../lib/init.js', { + t.plan(2) + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { ...mocks, 'init-package-json': (dir, initFile, config, cb) => cb( new Error('canceled') @@ -198,21 +294,222 @@ t.test('npm init cancel', t => { t.equal(title, 'init', 'should have init title') t.equal(msg, 'canceled', 'should log canceled') } + + process.chdir(npm.localPrefix) init.exec([], err => { - t.ifError(err, 'npm init cancel') + if (err) + throw err }) }) t.test('npm init error', t => { - const Init = requireInject('../../lib/init.js', { + npm.localPrefix = t.testdir({}) + + const Init = t.mock('../../lib/init.js', { ...mocks, 'init-package-json': (dir, initFile, config, cb) => cb( new Error('Unknown Error') ), }) const init = new Init(npm) + + process.chdir(npm.localPrefix) init.exec([], err => { t.match(err, /Unknown Error/, 'should throw error') t.end() }) }) + +t.test('workspaces', t => { + t.test('no args', t => { + npm.localPrefix = t.testdir({ + 'package.json': JSON.stringify({ + name: 'top-level', + }), + }) + + const Init = t.mock('../../lib/init.js', { + ...mocks, + 'init-package-json': (dir, initFile, config, cb) => { + t.equal(dir, resolve(npm.localPrefix, 'a'), 'should use the ws path') + cb() + }, + }) + const init = new Init(npm) + init.execWorkspaces([], ['a'], err => { + if (err) + throw err + + t.matchSnapshot(result, 'should print helper info') + t.end() + }) + }) + + t.test('no args, existing folder', t => { + // init-package-json prints directly to console.log + // this avoids poluting test output with those logs + console.log = noop + + npm.localPrefix = t.testdir({ + packages: { + a: { + 'package.json': JSON.stringify({ + name: 'a', + version: '1.0.0', + }), + }, + }, + 'package.json': JSON.stringify({ + name: 'top-level', + workspaces: ['packages/a'], + }), + }) + + init.execWorkspaces([], ['packages/a'], err => { + if (err) + throw err + + t.matchSnapshot(result, 'should print helper info') + t.end() + }) + }) + + t.test('with arg but missing workspace folder', t => { + // init-package-json prints directly to console.log + // this avoids poluting test output with those logs + console.log = noop + + npm.localPrefix = t.testdir({ + node_modules: { + a: t.fixture('symlink', '../a'), + 'create-index': { + 'index.js': ``, + }, + }, + a: { + 'package.json': JSON.stringify({ + name: 'a', + version: '1.0.0', + }), + }, + 'package.json': JSON.stringify({ + name: 'top-level', + }), + }) + + init.execWorkspaces([], ['packages/a'], err => { + if (err) + throw err + + t.matchSnapshot(result, 'should print helper info') + t.end() + }) + }) + + t.test('fail parsing top-level package.json to set workspace', t => { + // init-package-json prints directly to console.log + // this avoids poluting test output with those logs + console.log = noop + + npm.localPrefix = t.testdir({ + 'package.json': JSON.stringify({ + name: 'top-level', + }), + }) + + const Init = t.mock('../../lib/init.js', { + ...mocks, + 'json-parse-even-better-errors': () => { + throw new Error('ERR') + }, + }) + const init = new Init(npm) + + init.execWorkspaces([], ['a'], err => { + t.match( + err, + /Invalid package.json: Error: ERR/, + 'should exit with error' + ) + t.end() + }) + }) + + t.test('missing top-level package.json when settting workspace', t => { + // init-package-json prints directly to console.log + // this avoids poluting test output with those logs + console.log = noop + + npm.localPrefix = t.testdir({ + 'package.json': JSON.stringify({ + name: 'top-level', + }), + }) + + const Init = t.mock('../../lib/init.js', { + ...mocks, + fs: { + statSync () { + return true + }, + readFileSync () { + throw new Error('ERR') + }, + }, + }) + const init = new Init(npm) + + init.execWorkspaces([], ['a'], err => { + t.match( + err, + /package.json not found/, + 'should exit with error' + ) + t.end() + }) + }) + + t.test('using args', t => { + npm.localPrefix = t.testdir({ + b: { + 'package.json': JSON.stringify({ + name: 'b', + }), + }, + 'package.json': JSON.stringify({ + name: 'top-level', + workspaces: ['b'], + }), + }) + + const Init = t.mock('../../lib/init.js', { + ...mocks, + libnpmexec: ({ args, path }) => { + t.same( + args, + ['create-react-app'], + 'should npx with listed packages' + ) + t.same( + path, + resolve(npm.localPrefix, 'a'), + 'should use workspace path' + ) + fs.writeFileSync( + resolve(npm.localPrefix, 'a/package.json'), + JSON.stringify({ name: 'a' }) + ) + }, + }) + + const init = new Init(npm) + init.execWorkspaces(['react-app'], ['a'], err => { + if (err) + throw err + + t.end() + }) + }) + + t.end() +}) diff --git a/deps/npm/test/lib/install-ci-test.js b/deps/npm/test/lib/install-ci-test.js index 5f30efcabf2597..2695e0f13decb3 100644 --- a/deps/npm/test/lib/install-ci-test.js +++ b/deps/npm/test/lib/install-ci-test.js @@ -24,13 +24,12 @@ const installCITest = new InstallCITest({ }) t.test('the install-ci-test command', t => { - t.afterEach(cb => { + t.afterEach(() => { ciArgs = null ciCalled = false testArgs = null testCalled = false ciError = null - cb() }) t.test('ci and test', t => { diff --git a/deps/npm/test/lib/install-test.js b/deps/npm/test/lib/install-test.js index 0c52bd5e3c0124..adec91b6199230 100644 --- a/deps/npm/test/lib/install-test.js +++ b/deps/npm/test/lib/install-test.js @@ -24,13 +24,12 @@ const installTest = new InstallTest({ }) t.test('the install-test command', t => { - t.afterEach(cb => { + t.afterEach(() => { installArgs = null installCalled = false testArgs = null testCalled = false installError = null - cb() }) t.test('install and test', t => { diff --git a/deps/npm/test/lib/install.js b/deps/npm/test/lib/install.js index 619f0bb346984f..b7929bddafdba3 100644 --- a/deps/npm/test/lib/install.js +++ b/deps/npm/test/lib/install.js @@ -1,16 +1,15 @@ -const { test } = require('tap') +const t = require('tap') const Install = require('../../lib/install.js') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') -test('should install using Arborist', (t) => { +t.test('should install using Arborist', (t) => { const SCRIPTS = [] let ARB_ARGS = null let REIFY_CALLED = false let ARB_OBJ = null - const Install = requireInject('../../lib/install.js', { + const Install = t.mock('../../lib/install.js', { '@npmcli/run-script': ({ event }) => { SCRIPTS.push(event) }, @@ -73,10 +72,10 @@ test('should install using Arborist', (t) => { t.end() }) -test('should ignore scripts with --ignore-scripts', (t) => { +t.test('should ignore scripts with --ignore-scripts', (t) => { const SCRIPTS = [] let REIFY_CALLED = false - const Install = requireInject('../../lib/install.js', { + const Install = t.mock('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, '@npmcli/run-script': ({ event }) => { SCRIPTS.push(event) @@ -106,8 +105,8 @@ test('should ignore scripts with --ignore-scripts', (t) => { }) }) -test('should install globally using Arborist', (t) => { - const Install = requireInject('../../lib/install.js', { +t.test('should install globally using Arborist', (t) => { + const Install = t.mock('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, '@npmcli/arborist': function () { this.reify = () => {} @@ -127,8 +126,8 @@ test('should install globally using Arborist', (t) => { }) }) -test('completion to folder', async t => { - const Install = requireInject('../../lib/install.js', { +t.test('completion to folder', async t => { + const Install = t.mock('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { promisify: (fn) => fn, @@ -149,8 +148,8 @@ test('completion to folder', async t => { t.end() }) -test('completion to folder - invalid dir', async t => { - const Install = requireInject('../../lib/install.js', { +t.test('completion to folder - invalid dir', async t => { + const Install = t.mock('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { promisify: (fn) => fn, @@ -167,8 +166,8 @@ test('completion to folder - invalid dir', async t => { t.end() }) -test('completion to folder - no matches', async t => { - const Install = requireInject('../../lib/install.js', { +t.test('completion to folder - no matches', async t => { + const Install = t.mock('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { promisify: (fn) => fn, @@ -185,8 +184,8 @@ test('completion to folder - no matches', async t => { t.end() }) -test('completion to folder - match is not a package', async t => { - const Install = requireInject('../../lib/install.js', { +t.test('completion to folder - match is not a package', async t => { + const Install = t.mock('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { promisify: (fn) => fn, @@ -206,14 +205,14 @@ test('completion to folder - match is not a package', async t => { t.end() }) -test('completion to url', async t => { +t.test('completion to url', async t => { const install = new Install({}) const res = await install.completion({ partialWord: 'http://path/to/url' }) t.strictSame(res, []) t.end() }) -test('completion', async t => { +t.test('completion', async t => { const install = new Install({}) const res = await install.completion({ partialWord: 'toto' }) t.notOk(res) diff --git a/deps/npm/test/lib/link.js b/deps/npm/test/lib/link.js index 0d96ba0bcd6847..34c533fb72cd58 100644 --- a/deps/npm/test/lib/link.js +++ b/deps/npm/test/lib/link.js @@ -2,7 +2,6 @@ const { resolve } = require('path') const Arborist = require('@npmcli/arborist') const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const redactCwd = (path) => { @@ -40,7 +39,7 @@ const mocks = { '../../lib/utils/reify-output.js': () => reifyOutput(), } -const Link = requireInject('../../lib/link.js', mocks) +const Link = t.mock('../../lib/link.js', mocks) const link = new Link(npm) t.test('link to globalDir when in current working dir of pkg and no args', (t) => { @@ -81,7 +80,7 @@ t.test('link to globalDir when in current working dir of pkg and no args', (t) = } link.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') }) }) @@ -189,7 +188,7 @@ t.test('link global linked pkg to local nm when using args', (t) => { 'a', 'file:../link-me-too', ], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') }) }) @@ -252,7 +251,7 @@ t.test('link pkg already in global space', (t) => { // - a: prev installed package available in globalDir // - file:./link-me-too: pkg that needs to be reified in globalDir first link.exec(['@myscope/linked'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') }) }) @@ -310,7 +309,7 @@ t.test('link pkg already in global space when prefix is a symlink', (t) => { } link.exec(['@myscope/linked'], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') }) }) @@ -330,7 +329,7 @@ t.test('completion', async t => { npm.globalDir = resolve(testdir, 'global-prefix', 'lib', 'node_modules') const words = await link.completion({}) - t.deepEqual( + t.same( words, ['bar', 'foo', 'ipsum', 'lorem'], 'should list all package names available in globalDir' diff --git a/deps/npm/test/lib/ll.js b/deps/npm/test/lib/ll.js index 45eb4ec95b88fb..28a3ab12c6a5fe 100644 --- a/deps/npm/test/lib/ll.js +++ b/deps/npm/test/lib/ll.js @@ -1,4 +1,3 @@ -const requireInject = require('require-inject') const t = require('tap') t.test('ll', t => { @@ -10,12 +9,12 @@ t.test('ll', t => { } exec (args, cb) { - t.deepEqual(args, ['pkg'], 'should forward args') + t.same(args, ['pkg'], 'should forward args') cb() } } - const LL = requireInject('../../lib/ll.js', { + const LL = t.mock('../../lib/ll.js', { '../../lib/ls.js': LS, }) const ll = new LL({ diff --git a/deps/npm/test/lib/load-all-commands.js b/deps/npm/test/lib/load-all-commands.js index cb3aefb1f88425..8267cd5437ec86 100644 --- a/deps/npm/test/lib/load-all-commands.js +++ b/deps/npm/test/lib/load-all-commands.js @@ -2,9 +2,8 @@ // It does ensure that every command has a usage that renders, contains its // name, a description, and if it has completion it is a function. That it // renders also ensures that any params we've defined in our commands work. -const requireInject = require('require-inject') -const npm = requireInject('../../lib/npm.js') const t = require('tap') +const npm = t.mock('../../lib/npm.js') const { cmdList } = require('../../lib/utils/cmd-list.js') let npmOutput = [] @@ -20,8 +19,8 @@ t.test('load each command', t => { t.test(cmd, t => { const impl = npm.commands[cmd] if (impl.completion) - t.isa(impl.completion, 'function', 'completion, if present, is a function') - t.isa(impl, 'function', 'implementation is a function') + t.type(impl.completion, 'function', 'completion, if present, is a function') + t.type(impl, 'function', 'implementation is a function') t.ok(impl.description, 'implementation has a description') t.ok(impl.name, 'implementation has a name') t.match(impl.usage, cmd, 'usage contains the command') diff --git a/deps/npm/test/lib/logout.js b/deps/npm/test/lib/logout.js index bae797f9693215..b130d439c88ca6 100644 --- a/deps/npm/test/lib/logout.js +++ b/deps/npm/test/lib/logout.js @@ -1,6 +1,5 @@ -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') -const { test } = require('tap') +const t = require('tap') const config = { registry: 'https://registry.npmjs.org/', @@ -24,13 +23,13 @@ const mocks = { 'npm-registry-fetch': npmFetch, } -const Logout = requireInject('../../lib/logout.js', mocks) +const Logout = t.mock('../../lib/logout.js', mocks) const logout = new Logout(npm) -test('token logout', async (t) => { +t.test('token logout', async (t) => { t.plan(6) - flatOptions.token = '@foo/' + flatOptions['//registry.npmjs.org/:_authToken'] = '@foo/' npmlog.verbose = (title, msg) => { t.equal(title, 'logout', 'should have correcct log prefix') @@ -55,16 +54,16 @@ test('token logout', async (t) => { await new Promise((res, rej) => { logout.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') - t.deepEqual( + t.same( result, { url: '/-/user/token/%40foo%2F', opts: { registry: 'https://registry.npmjs.org/', scope: '', - token: '@foo/', + '//registry.npmjs.org/:_authToken': '@foo/', method: 'DELETE', ignoreBody: true, }, @@ -85,10 +84,11 @@ test('token logout', async (t) => { }) }) -test('token scoped logout', async (t) => { +t.test('token scoped logout', async (t) => { t.plan(8) - flatOptions.token = '@foo/' + flatOptions['//diff-registry.npmjs.com/:_authToken'] = '@bar/' + flatOptions['//registry.npmjs.org/:_authToken'] = '@foo/' config.scope = '@myscope' config['@myscope:registry'] = 'https://diff-registry.npmjs.com/' flatOptions.scope = '@myscope' @@ -126,17 +126,18 @@ test('token scoped logout', async (t) => { await new Promise((res, rej) => { logout.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') - t.deepEqual( + t.same( result, { - url: '/-/user/token/%40foo%2F', + url: '/-/user/token/%40bar%2F', opts: { registry: 'https://registry.npmjs.org/', '@myscope:registry': 'https://diff-registry.npmjs.com/', scope: '@myscope', - token: '@foo/', + '//registry.npmjs.org/:_authToken': '@foo/', // <- removed by npm-registry-fetch + '//diff-registry.npmjs.com/:_authToken': '@bar/', method: 'DELETE', ignoreBody: true, }, @@ -145,8 +146,10 @@ test('token scoped logout', async (t) => { ) config.scope = '' + delete flatOptions['//diff-registry.npmjs.com/:_authToken'] + delete flatOptions['//registry.npmjs.org/:_authToken'] delete config['@myscope:registry'] - delete flatOptions.token + delete flatOptions.scope result = null mocks['npm-registry-fetch'] = null config.clearCredentialsByURI = null @@ -159,14 +162,14 @@ test('token scoped logout', async (t) => { }) }) -test('user/pass logout', async (t) => { +t.test('user/pass logout', async (t) => { t.plan(3) - flatOptions.username = 'foo' - flatOptions.password = 'bar' + flatOptions['//registry.npmjs.org/:username'] = 'foo' + flatOptions['//registry.npmjs.org/:_password'] = 'bar' npmlog.verbose = (title, msg) => { - t.equal(title, 'logout', 'should have correcct log prefix') + t.equal(title, 'logout', 'should have correct log prefix') t.equal( msg, 'clearing user credentials for https://registry.npmjs.org/', @@ -179,10 +182,10 @@ test('user/pass logout', async (t) => { await new Promise((res, rej) => { logout.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') - delete flatOptions.username - delete flatOptions.password + delete flatOptions['//registry.npmjs.org/:username'] + delete flatOptions['//registry.npmjs.org/:_password'] npm.config.clearCredentialsByURI = null npm.config.save = null npmlog.verbose = null @@ -192,7 +195,7 @@ test('user/pass logout', async (t) => { }) }) -test('missing credentials', (t) => { +t.test('missing credentials', (t) => { logout.exec([], (err) => { t.match( err.message, @@ -204,10 +207,10 @@ test('missing credentials', (t) => { }) }) -test('ignore invalid scoped registry config', async (t) => { +t.test('ignore invalid scoped registry config', async (t) => { t.plan(5) - flatOptions.token = '@foo/' + flatOptions['//registry.npmjs.org/:_authToken'] = '@foo/' config.scope = '@myscope' flatOptions['@myscope:registry'] = '' @@ -233,17 +236,16 @@ test('ignore invalid scoped registry config', async (t) => { await new Promise((res, rej) => { logout.exec([], (err) => { - t.ifError(err, 'should not error out') + t.error(err, 'should not error out') - t.deepEqual( + t.same( result, { url: '/-/user/token/%40foo%2F', opts: { + '//registry.npmjs.org/:_authToken': '@foo/', registry: 'https://registry.npmjs.org/', - scope: '@myscope', '@myscope:registry': '', - token: '@foo/', method: 'DELETE', ignoreBody: true, }, diff --git a/deps/npm/test/lib/ls.js b/deps/npm/test/lib/ls.js index 5367dec688658d..6eeaf0ad671bc6 100644 --- a/deps/npm/test/lib/ls.js +++ b/deps/npm/test/lib/ls.js @@ -1,3 +1,7 @@ +// TODO(isaacs): This test has a lot of very large objects pasted inline. +// Consider using t.matchSnapshot on these instead, especially since many +// of them contain the tap testdir folders, which are auto-generated and +// may change when node-tap is updated. const t = require('tap') const mockNpm = require('../fixtures/mock-npm') @@ -115,10 +119,7 @@ const redactCwd = res => const jsonParse = res => JSON.parse(redactCwd(res)) -const cleanUpResult = (done, t) => { - result = '' - done() -} +const cleanUpResult = () => result = '' t.test('ls', (t) => { t.beforeEach(cleanUpResult) @@ -137,7 +138,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree representation of dependencies structure') t.end() }) @@ -148,11 +149,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code') - t.matchSnapshot( - redactCwd(err.message), - 'should log all extraneous deps on error msg' - ) + t.error(err) // should not error for extraneous t.matchSnapshot(redactCwd(result), 'should output tree missing name/version of top-level package') t.end() }) @@ -170,12 +167,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.equal(err.code, 'ELSPROBLEMS', 'should have error code') - t.equal( - redactCwd(err.message), - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-extraneous-deps/node_modules/lorem', - 'should log extraneous dep as error' - ) + t.error(err) // should not error for extraneous t.matchSnapshot(redactCwd(result), 'should output containing problems info') t.end() }) @@ -195,7 +187,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec(['lorem'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered by package and colored output') npm.color = false t.end() @@ -217,7 +209,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec(['.'], (err) => { - t.ifError(err, 'should not throw on missing dep above current level') + t.error(err, 'should not throw on missing dep above current level') t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered by package and colored output') config.all = true config.depth = Infinity @@ -238,7 +230,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec(['bar'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered package and its ancestors') t.end() }) @@ -266,7 +258,7 @@ t.test('ls', (t) => { }, }) ls.exec(['bar@*', 'lorem@1.0.0'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of multiple filtered packages and their ancestors') t.end() }) @@ -285,7 +277,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec(['notadep'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing no dependencies info') t.equal( process.exitCode, @@ -312,7 +304,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing only top-level dependencies') config.all = true config.depth = Infinity @@ -335,7 +327,7 @@ t.test('ls', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing only top-level dependencies') config.all = true config.depth = Infinity @@ -396,7 +388,7 @@ t.test('ls', (t) => { }, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing top-level deps and their deps only') config.all = true config.depth = Infinity @@ -420,9 +412,9 @@ t.test('ls', (t) => { t.equal(err.code, 'ELSPROBLEMS', 'should have error code') t.equal( redactCwd(err.message).replace(/\r\n/g, '\n'), - 'invalid: foo@1.0.0 {CWD}/ls-ls-missing-invalid-extraneous/node_modules/foo\n' + + 'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous/node_modules/foo\n' + 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0\n' + - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-missing-invalid-extraneous/node_modules/lorem', + 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous/node_modules/lorem', 'should log missing/invalid/extraneous errors' ) t.matchSnapshot(redactCwd(result), 'should output tree containing missing, invalid, extraneous labels') @@ -718,7 +710,7 @@ t.test('ls', (t) => { t.test('empty location', (t) => { npm.prefix = t.testdir({}) ls.exec([], (err) => { - t.ifError(err, 'should not error out on empty locations') + t.error(err, 'should not error out on empty locations') t.matchSnapshot(redactCwd(result), 'should print empty result') t.end() }) @@ -898,7 +890,7 @@ t.test('ls', (t) => { }, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should print tree output containing deduped ref') t.end() }) @@ -936,7 +928,7 @@ t.test('ls', (t) => { }, }) ls.exec(['a'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should print tree output containing deduped ref') npm.color = false t.end() @@ -984,7 +976,7 @@ t.test('ls', (t) => { }, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should print tree output containing deduped ref') t.end() }) @@ -1033,7 +1025,7 @@ t.test('ls', (t) => { }, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should print tree output containing deduped ref') config.all = true config.depth = Infinity @@ -1083,7 +1075,7 @@ t.test('ls', (t) => { }, }) ls.exec(['@npmcli/b'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should print tree output containing deduped ref') npm.color = false t.end() @@ -1131,7 +1123,7 @@ t.test('ls', (t) => { }, }) ls.exec(['@npmcli/c'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should print tree output containing deduped ref') t.end() }) @@ -1221,7 +1213,7 @@ t.test('ls', (t) => { }) touchHiddenPackageLock(npm.prefix) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing git refs') t.end() }) @@ -1265,7 +1257,7 @@ t.test('ls', (t) => { }), }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should NOT print git refs in output tree') t.end() }) @@ -1409,7 +1401,7 @@ t.test('ls', (t) => { }) ls.exec(['c'], (err) => { - t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code') + t.error(err) // should not error for extraneous t.matchSnapshot(redactCwd(result), 'should print tree and not duplicate child of missing items') t.end() }) @@ -1453,12 +1445,12 @@ t.test('ls', (t) => { }) ls.exec([], (err) => { - t.ifError(err, 'should NOT have ELSPROBLEMS error code') + t.error(err, 'should NOT have ELSPROBLEMS error code') t.matchSnapshot(redactCwd(result), 'should list workspaces properly') // should also be able to filter out one of the workspaces ls.exec(['a'], (err) => { - t.ifError(err, 'should NOT have ELSPROBLEMS error code when filter') + t.error(err, 'should NOT have ELSPROBLEMS error code when filter') t.matchSnapshot(redactCwd(result), 'should filter single workspace') t.end() @@ -1516,17 +1508,17 @@ t.test('ls', (t) => { t.plan(6) ls.exec(['a'], (err) => { - t.ifError(err, 'should NOT have ELSPROBLEMS error code') + t.error(err, 'should NOT have ELSPROBLEMS error code') t.matchSnapshot(redactCwd(result), 'should list a in top-level only') ls.exec(['d'], (err) => { - t.ifError(err, 'should NOT have ELSPROBLEMS error code when filter') + t.error(err, 'should NOT have ELSPROBLEMS error code when filter') t.matchSnapshot(redactCwd(result), 'should print empty results msg') // if no --depth config is defined, should print path to dep config.depth = null // default config value ls.exec(['d'], (err) => { - t.ifError(err, 'should NOT have ELSPROBLEMS error code when filter') + t.error(err, 'should NOT have ELSPROBLEMS error code when filter') t.matchSnapshot(redactCwd(result), 'should print expected result') }) }) @@ -1558,7 +1550,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable representation of dependencies structure') t.end() }) @@ -1569,11 +1561,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code') - t.matchSnapshot( - redactCwd(err.message), - 'should log all extraneous deps on error msg' - ) + t.error(err) // should not error for extraneous t.matchSnapshot(redactCwd(result), 'should output parseable missing name/version of top-level package') t.end() }) @@ -1591,7 +1579,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.equal(err.code, 'ELSPROBLEMS', 'should have error code') + t.error(err) // should not error for extraneous t.matchSnapshot(redactCwd(result), 'should output containing problems info') t.end() }) @@ -1610,7 +1598,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec(['lorem'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of filtered by package') t.end() }) @@ -1629,7 +1617,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec(['bar'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of filtered package') t.end() }) @@ -1657,7 +1645,7 @@ t.test('ls --parseable', (t) => { }, }) ls.exec(['bar@*', 'lorem@1.0.0'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of multiple filtered packages and their ancestors') t.end() }) @@ -1676,7 +1664,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec(['notadep'], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable output containing no dependencies info') t.equal( process.exitCode, @@ -1703,7 +1691,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable output containing only top-level dependencies') config.all = true config.depth = Infinity @@ -1726,7 +1714,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing only top-level dependencies') config.all = true config.depth = Infinity @@ -1749,7 +1737,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable containing top-level deps and their deps only') config.all = true config.depth = Infinity @@ -1972,8 +1960,7 @@ t.test('ls --parseable', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.equal(err.code, 'ELSPROBLEMS', 'should have error code') - t.match(redactCwd(err.message), 'extraneous: lorem@1.0.0 {CWD}/ls-ls-parseable--long-with-extraneous-deps/node_modules/lorem', 'should have error code') + t.error(err) // should not error for extraneous t.matchSnapshot(redactCwd(result), 'should output long parseable output with extraneous info') t.end() }) @@ -2033,7 +2020,7 @@ t.test('ls --parseable', (t) => { }, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') + t.error(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output parseable results with symlink targets') config.long = false t.end() @@ -2087,7 +2074,7 @@ t.test('ls --parseable', (t) => { t.test('empty location', (t) => { npm.prefix = t.testdir({}) ls.exec([], (err) => { - t.ifError(err, 'should not error out on empty locations') + t.error(err, 'should not error out on empty locations') t.matchSnapshot(redactCwd(result), 'should print empty result') t.end() }) @@ -2365,6 +2352,106 @@ t.test('ls --parseable', (t) => { t.end() }) +t.test('ignore missing optional deps', async t => { + t.beforeEach(cleanUpResult) + npm.prefix = t.testdir({ + 'package.json': JSON.stringify({ + name: 'test-npm-ls-ignore-missing-optional', + version: '1.2.3', + peerDependencies: { + 'peer-ok': '1', + 'peer-missing': '1', + 'peer-wrong': '1', + 'peer-optional-ok': '1', + 'peer-optional-missing': '1', + 'peer-optional-wrong': '1', + }, + peerDependenciesMeta: { + 'peer-optional-ok': { + optional: true, + }, + 'peer-optional-missing': { + optional: true, + }, + 'peer-optional-wrong': { + optional: true, + }, + }, + optionalDependencies: { + 'optional-ok': '1', + 'optional-missing': '1', + 'optional-wrong': '1', + }, + dependencies: { + 'prod-ok': '1', + 'prod-missing': '1', + 'prod-wrong': '1', + }, + }), + node_modules: { + 'prod-ok': { + 'package.json': JSON.stringify({name: 'prod-ok', version: '1.2.3' }), + }, + 'prod-wrong': { + 'package.json': JSON.stringify({name: 'prod-wrong', version: '3.2.1' }), + }, + 'optional-ok': { + 'package.json': JSON.stringify({name: 'optional-ok', version: '1.2.3' }), + }, + 'optional-wrong': { + 'package.json': JSON.stringify({name: 'optional-wrong', version: '3.2.1' }), + }, + 'peer-optional-ok': { + 'package.json': JSON.stringify({name: 'peer-optional-ok', version: '1.2.3' }), + }, + 'peer-optional-wrong': { + 'package.json': JSON.stringify({name: 'peer-optional-wrong', version: '3.2.1' }), + }, + 'peer-ok': { + 'package.json': JSON.stringify({name: 'peer-ok', version: '1.2.3' }), + }, + 'peer-wrong': { + 'package.json': JSON.stringify({name: 'peer-wrong', version: '3.2.1' }), + }, + }, + }) + + config.all = true + const prefix = npm.prefix.toLowerCase().replace(/\\/g, '/') + const cleanupPaths = str => + str.toLowerCase().replace(/\\/g, '/').split(prefix).join('{project}') + + t.test('--json', t => { + config.json = true + config.parseable = false + ls.exec([], (err) => { + t.match(err, { code: 'ELSPROBLEMS' }) + result = JSON.parse(result) + const problems = result.problems.map(cleanupPaths) + t.matchSnapshot(problems, 'ls --json problems') + t.end() + }) + }) + t.test('--parseable', t => { + config.json = false + config.parseable = true + ls.exec([], (err) => { + t.match(err, { code: 'ELSPROBLEMS' }) + t.matchSnapshot(cleanupPaths(result), 'ls --parseable result') + t.end() + }) + }) + t.test('human output', t => { + config.json = false + config.parseable = false + ls.exec([], (err) => { + t.match(err, { code: 'ELSPROBLEMS' }) + t.matchSnapshot(cleanupPaths(result), 'ls result') + t.end() + }) + }) +}) + t.test('ls --json', (t) => { t.beforeEach(cleanUpResult) config.json = true @@ -2382,8 +2469,8 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2413,28 +2500,28 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.match(err, { code: 'ELSPROBLEMS' }, 'should list dep problems') - t.deepEqual( + t.error(err) // should not error for extraneous + t.same( jsonParse(result), { problems: [ - 'extraneous: bar@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/bar', - 'extraneous: foo@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/foo', - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/lorem', + 'extraneous: bar@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/bar', + 'extraneous: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/foo', + 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/lorem', ], dependencies: { bar: { version: '1.0.0', extraneous: true, problems: [ - 'extraneous: bar@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/bar', + 'extraneous: bar@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/bar', ], }, foo: { version: '1.0.0', extraneous: true, problems: [ - 'extraneous: foo@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/foo', + 'extraneous: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/foo', ], dependencies: { bar: { @@ -2446,7 +2533,7 @@ t.test('ls --json', (t) => { version: '1.0.0', extraneous: true, problems: [ - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/lorem', + 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/lorem', ], }, }, @@ -2469,23 +2556,14 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.equal( - redactCwd(err.message), - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-extraneous-deps/node_modules/lorem', - 'should log extraneous dep as error' - ) - t.equal( - err.code, - 'ELSPROBLEMS', - 'should have ELSPROBLEMS error code' - ) - t.deepEqual( + t.error(err) // should not error for extraneous + t.same( jsonParse(result), { name: 'test-npm-ls', version: '1.0.0', problems: [ - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-extraneous-deps/node_modules/lorem', + 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/lorem', ], dependencies: { foo: { @@ -2500,7 +2578,7 @@ t.test('ls --json', (t) => { version: '1.0.0', extraneous: true, problems: [ - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-extraneous-deps/node_modules/lorem', + 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/lorem', ], }, }, @@ -2511,6 +2589,48 @@ t.test('ls --json', (t) => { }) }) + t.test('missing deps --long', (t) => { + config.long = true + npm.prefix = t.testdir({ + 'package.json': JSON.stringify({ + name: 'test-npm-ls', + version: '1.0.0', + dependencies: { + foo: '^1.0.0', + bar: '^1.0.0', + lorem: '^1.0.0', + ipsum: '^1.0.0', + }, + }), + ...simpleNmFixture, + }) + ls.exec([], (err) => { + t.equal( + redactCwd(err.message), + 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0', + 'should log missing dep as error' + ) + t.equal( + err.code, + 'ELSPROBLEMS', + 'should have ELSPROBLEMS error code' + ) + t.match( + jsonParse(result), + { + name: 'test-npm-ls', + version: '1.0.0', + problems: [ + 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0', + ], + }, + 'should output json containing problems info' + ) + config.long = false + t.end() + }) + }) + t.test('with filter arg', (t) => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ @@ -2524,8 +2644,8 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec(['lorem'], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2560,8 +2680,8 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec(['bar'], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2605,8 +2725,8 @@ t.test('ls --json', (t) => { }, }) ls.exec(['bar@*', 'lorem@1.0.0'], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { version: '1.0.0', @@ -2644,8 +2764,8 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec(['notadep'], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2678,8 +2798,8 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2716,8 +2836,8 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2754,8 +2874,8 @@ t.test('ls --json', (t) => { ...simpleNmFixture, }) ls.exec([], (err) => { - t.ifError(err, 'npm ls') - t.deepEqual( + t.error(err, 'npm ls') + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2796,22 +2916,22 @@ t.test('ls --json', (t) => { }) ls.exec([], (err) => { t.match(err, { code: 'ELSPROBLEMS' }, 'should list dep problems') - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', version: '1.0.0', problems: [ - 'invalid: foo@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/foo', + 'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/foo', 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0', - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/lorem', + 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/lorem', ], dependencies: { foo: { version: '1.0.0', invalid: true, problems: [ - 'invalid: foo@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/foo', + 'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/foo', ], dependencies: { bar: { @@ -2823,7 +2943,7 @@ t.test('ls --json', (t) => { version: '1.0.0', extraneous: true, problems: [ - 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/lorem', + 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/lorem', ], }, ipsum: { @@ -2864,7 +2984,7 @@ t.test('ls --json', (t) => { ...diffDepTypesNmFixture, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2911,7 +3031,7 @@ t.test('ls --json', (t) => { ...diffDepTypesNmFixture, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -2968,7 +3088,7 @@ t.test('ls --json', (t) => { }, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3010,7 +3130,7 @@ t.test('ls --json', (t) => { ...diffDepTypesNmFixture, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3051,7 +3171,7 @@ t.test('ls --json', (t) => { ...diffDepTypesNmFixture, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3164,7 +3284,7 @@ t.test('ls --json', (t) => { }), }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { version: '1.0.0', @@ -3178,7 +3298,7 @@ t.test('ls --json', (t) => { resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz', extraneous: true, problems: [ - 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/ls-ls-json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b', + 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/tap-testdir-ls-ls---json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b', ], }, }, @@ -3189,7 +3309,7 @@ t.test('ls --json', (t) => { }, }, problems: [ - 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/ls-ls-json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b', + 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/tap-testdir-ls-ls---json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b', ], }, 'should output json containing only prod deps' @@ -3221,7 +3341,7 @@ t.test('ls --json', (t) => { ...diffDepTypesNmFixture, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3235,7 +3355,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long/node_modules/peer-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/peer-dep', extraneous: false, }, 'dev-dep': { @@ -3254,7 +3374,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long/node_modules/bar', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/bar', extraneous: false, }, }, @@ -3262,7 +3382,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: { bar: '^1.0.0' }, - path: '{CWD}/ls-ls-json--long/node_modules/foo', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/foo', extraneous: false, }, }, @@ -3270,7 +3390,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: { foo: '^1.0.0' }, - path: '{CWD}/ls-ls-json--long/node_modules/dev-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/dev-dep', extraneous: false, }, lorem: { @@ -3280,7 +3400,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long/node_modules/lorem', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/lorem', extraneous: false, }, 'optional-dep': { @@ -3291,7 +3411,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long/node_modules/optional-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/optional-dep', extraneous: false, }, 'prod-dep': { @@ -3307,7 +3427,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long/node_modules/prod-dep/node_modules/bar', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/prod-dep/node_modules/bar', extraneous: false, }, }, @@ -3315,7 +3435,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: { bar: '^2.0.0' }, - path: '{CWD}/ls-ls-json--long/node_modules/prod-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/prod-dep', extraneous: false, }, }, @@ -3324,7 +3444,7 @@ t.test('ls --json', (t) => { peerDependencies: { 'peer-dep': '^1.0.0' }, _id: 'test-npm-ls@1.0.0', _dependencies: { 'prod-dep': '^1.0.0', lorem: '^1.0.0', 'optional-dep': '^1.0.0' }, - path: '{CWD}/ls-ls-json--long', + path: '{CWD}/tap-testdir-ls-ls---json---long', extraneous: false, }, 'should output long json info' @@ -3359,7 +3479,7 @@ t.test('ls --json', (t) => { ...diffDepTypesNmFixture, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3373,7 +3493,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long-depth-0/node_modules/peer-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/peer-dep', extraneous: false, }, 'dev-dep': { @@ -3384,7 +3504,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: { foo: '^1.0.0' }, - path: '{CWD}/ls-ls-json--long-depth-0/node_modules/dev-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/dev-dep', extraneous: false, }, lorem: { @@ -3394,7 +3514,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long-depth-0/node_modules/lorem', + path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/lorem', extraneous: false, }, 'optional-dep': { @@ -3405,7 +3525,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: {}, - path: '{CWD}/ls-ls-json--long-depth-0/node_modules/optional-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/optional-dep', extraneous: false, }, 'prod-dep': { @@ -3416,7 +3536,7 @@ t.test('ls --json', (t) => { devDependencies: {}, peerDependencies: {}, _dependencies: { bar: '^2.0.0' }, - path: '{CWD}/ls-ls-json--long-depth-0/node_modules/prod-dep', + path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/prod-dep', extraneous: false, }, }, @@ -3425,7 +3545,7 @@ t.test('ls --json', (t) => { peerDependencies: { 'peer-dep': '^1.0.0' }, _id: 'test-npm-ls@1.0.0', _dependencies: { 'prod-dep': '^1.0.0', lorem: '^1.0.0', 'optional-dep': '^1.0.0' }, - path: '{CWD}/ls-ls-json--long-depth-0', + path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0', extraneous: false, }, 'should output json containing top-level deps in long format' @@ -3444,12 +3564,12 @@ t.test('ls --json', (t) => { ls.exec([], (err) => { t.match(err.message, 'Failed to parse root package.json', 'should have missin root package.json msg') t.match(err.code, 'EJSONPARSE', 'should have EJSONPARSE error code') - t.deepEqual( + t.same( jsonParse(result), { invalid: true, problems: [ - 'error in {CWD}/ls-ls-json-json-read-problems: Failed to parse root package.json', + 'error in {CWD}/tap-testdir-ls-ls---json-json-read-problems: Failed to parse root package.json', ], }, 'should print empty json result' @@ -3461,8 +3581,8 @@ t.test('ls --json', (t) => { t.test('empty location', (t) => { npm.prefix = t.testdir({}) ls.exec([], (err) => { - t.ifError(err, 'should not error out on empty locations') - t.deepEqual( + t.error(err, 'should not error out on empty locations') + t.same( jsonParse(result), {}, 'should print empty json result' @@ -3494,20 +3614,20 @@ t.test('ls --json', (t) => { }) ls.exec([], (err) => { t.match(err.code, 'ELSPROBLEMS', 'Should have ELSPROBLEMS error code') - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', version: '1.0.0', problems: [ - 'invalid: peer-dep@1.0.0 {CWD}/ls-ls-json-unmet-peer-dep/node_modules/peer-dep', + 'invalid: peer-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-peer-dep/node_modules/peer-dep', ], dependencies: { 'peer-dep': { version: '1.0.0', invalid: true, problems: [ - 'invalid: peer-dep@1.0.0 {CWD}/ls-ls-json-unmet-peer-dep/node_modules/peer-dep', + 'invalid: peer-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-peer-dep/node_modules/peer-dep', ], }, 'dev-dep': { @@ -3555,20 +3675,20 @@ t.test('ls --json', (t) => { ls.exec([], (err) => { t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code') t.match(err.message, /invalid: optional-dep@1.0.0/, 'should have invalid dep error msg') - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', version: '1.0.0', problems: [ - 'invalid: optional-dep@1.0.0 {CWD}/ls-ls-json-unmet-optional-dep/node_modules/optional-dep', // mismatching optional deps get flagged in problems + 'invalid: optional-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-optional-dep/node_modules/optional-dep', // mismatching optional deps get flagged in problems ], dependencies: { 'optional-dep': { version: '1.0.0', invalid: true, problems: [ - 'invalid: optional-dep@1.0.0 {CWD}/ls-ls-json-unmet-optional-dep/node_modules/optional-dep', + 'invalid: optional-dep@1.0.0 {CWD}/tap-testdir-ls-ls---json-unmet-optional-dep/node_modules/optional-dep', ], }, 'peer-dep': { @@ -3625,7 +3745,7 @@ t.test('ls --json', (t) => { }, }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3683,7 +3803,7 @@ t.test('ls --json', (t) => { }) touchHiddenPackageLock(npm.prefix) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3743,7 +3863,7 @@ t.test('ls --json', (t) => { }) touchHiddenPackageLock(npm.prefix) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3827,7 +3947,7 @@ t.test('ls --json', (t) => { }) touchHiddenPackageLock(npm.prefix) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { name: 'test-npm-ls', @@ -3852,11 +3972,11 @@ t.test('ls --json', (t) => { }), }) ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { version: '1.0.0', - name: 'ls-ls-json-node-name-fallback-if-missing-root-package-name', + name: 'tap-testdir-ls-ls---json-node.name-fallback-if-missing-root-package-name', }, 'should use node.name as key in json result obj' ) @@ -3895,10 +4015,10 @@ t.test('ls --json', (t) => { npm.globalDir = resolve(fixtures, 'node_modules') ls.exec([], () => { - t.deepEqual( + t.same( jsonParse(result), { - name: 'ls-ls-json-global', + name: 'tap-testdir-ls-ls---json-global', dependencies: { a: { version: '1.0.0', diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js index 4d40792af8f38f..6f8f8936d3f739 100644 --- a/deps/npm/test/lib/npm.js +++ b/deps/npm/test/lib/npm.js @@ -174,34 +174,34 @@ t.test('npm.load', t => { t.equal(npm.log, npmlog, 'npmlog getter') t.equal(npm.lockfileVersion, 2, 'lockfileVersion getter') t.equal(npm.prefix, npm.localPrefix, 'prefix is local prefix') - t.notEqual(npm.prefix, npm.globalPrefix, 'prefix is not global prefix') + t.not(npm.prefix, npm.globalPrefix, 'prefix is not global prefix') npm.globalPrefix = npm.prefix t.equal(npm.prefix, npm.globalPrefix, 'globalPrefix setter') npm.localPrefix = dir + '/extra/prefix' t.equal(npm.prefix, npm.localPrefix, 'prefix is local prefix after localPrefix setter') - t.notEqual(npm.prefix, npm.globalPrefix, 'prefix is not global prefix after localPrefix setter') + t.not(npm.prefix, npm.globalPrefix, 'prefix is not global prefix after localPrefix setter') npm.prefix = dir + '/some/prefix' t.equal(npm.prefix, npm.localPrefix, 'prefix is local prefix after prefix setter') - t.notEqual(npm.prefix, npm.globalPrefix, 'prefix is not global prefix after prefix setter') + t.not(npm.prefix, npm.globalPrefix, 'prefix is not global prefix after prefix setter') t.equal(npm.bin, npm.localBin, 'bin is local bin after prefix setter') - t.notEqual(npm.bin, npm.globalBin, 'bin is not global bin after prefix setter') + t.not(npm.bin, npm.globalBin, 'bin is not global bin after prefix setter') t.equal(npm.dir, npm.localDir, 'dir is local dir after prefix setter') - t.notEqual(npm.dir, npm.globalDir, 'dir is not global dir after prefix setter') + t.not(npm.dir, npm.globalDir, 'dir is not global dir after prefix setter') npm.config.set('global', true) t.equal(npm.prefix, npm.globalPrefix, 'prefix is global prefix after setting global') - t.notEqual(npm.prefix, npm.localPrefix, 'prefix is not local prefix after setting global') + t.not(npm.prefix, npm.localPrefix, 'prefix is not local prefix after setting global') t.equal(npm.bin, npm.globalBin, 'bin is global bin after setting global') - t.notEqual(npm.bin, npm.localBin, 'bin is not local bin after setting global') + t.not(npm.bin, npm.localBin, 'bin is not local bin after setting global') t.equal(npm.dir, npm.globalDir, 'dir is global dir after setting global') - t.notEqual(npm.dir, npm.localDir, 'dir is not local dir after setting global') + t.not(npm.dir, npm.localDir, 'dir is not local dir after setting global') npm.prefix = dir + '/new/global/prefix' t.equal(npm.prefix, npm.globalPrefix, 'prefix is global prefix after prefix setter') - t.notEqual(npm.prefix, npm.localPrefix, 'prefix is not local prefix after prefix setter') + t.not(npm.prefix, npm.localPrefix, 'prefix is not local prefix after prefix setter') t.equal(npm.bin, npm.globalBin, 'bin is global bin after prefix setter') - t.notEqual(npm.bin, npm.localBin, 'bin is not local bin after prefix setter') + t.not(npm.bin, npm.localBin, 'bin is not local bin after prefix setter') beWindows() t.equal(npm.bin, npm.globalBin, 'bin is global bin in windows mode') @@ -215,7 +215,7 @@ t.test('npm.load', t => { t.equal(npm.loaded, false, 'not loaded yet') t.equal(npm.loading, true, 'working on it tho') - t.isa(p, Promise, 'npm.load() returned a Promise first time') + t.type(p, Promise, 'npm.load() returned a Promise first time') t.equal(npm.load(second), undefined, 'npm.load() returns nothing second time') @@ -477,10 +477,7 @@ t.test('set process.title', t => { freshConfig() }) - t.afterEach(cb => { - consoleLogs.length = 0 - cb() - }) + t.afterEach(() => consoleLogs.length = 0) t.test('basic title setting', async t => { freshConfig({ diff --git a/deps/npm/test/lib/org.js b/deps/npm/test/lib/org.js index 4ffbf0af411a60..156232ac22a5db 100644 --- a/deps/npm/test/lib/org.js +++ b/deps/npm/test/lib/org.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const ansiTrim = require('../../lib/utils/ansi-trim.js') const output = [] @@ -41,13 +40,13 @@ const libnpmorg = { }, } -const Org = requireInject('../../lib/org.js', { +const Org = t.mock('../../lib/org.js', { '../../lib/utils/otplease.js': async (opts, fn) => fn(opts), libnpmorg, }) const org = new Org(npm) -test('completion', async t => { +t.test('completion', async t => { const completion = (argv) => org.completion({ conf: { argv: { remain: argv } } }) @@ -65,14 +64,14 @@ test('completion', async t => { t.rejects(completion(['npm', 'org', 'flurb']), /flurb not recognized/, 'errors for unknown subcommand') }) -test('npm org - invalid subcommand', t => { +t.test('npm org - invalid subcommand', t => { org.exec(['foo'], (err) => { t.match(err, /npm org set/, 'prints usage information') t.end() }) }) -test('npm org add', t => { +t.test('npm org add', t => { t.teardown(() => { orgSetArgs = null output.length = 0 @@ -93,7 +92,7 @@ test('npm org add', t => { }) }) -test('npm org add - no org', t => { +t.test('npm org add - no org', t => { t.teardown(() => { orgSetArgs = null output.length = 0 @@ -105,7 +104,7 @@ test('npm org add - no org', t => { }) }) -test('npm org add - no user', t => { +t.test('npm org add - no user', t => { t.teardown(() => { orgSetArgs = null output.length = 0 @@ -117,7 +116,7 @@ test('npm org add - no user', t => { }) }) -test('npm org add - invalid role', t => { +t.test('npm org add - invalid role', t => { t.teardown(() => { orgSetArgs = null output.length = 0 @@ -129,7 +128,7 @@ test('npm org add - invalid role', t => { }) }) -test('npm org add - more users', t => { +t.test('npm org add - more users', t => { orgSize = 5 t.teardown(() => { orgSize = 1 @@ -152,7 +151,7 @@ test('npm org add - more users', t => { }) }) -test('npm org add - json output', t => { +t.test('npm org add - json output', t => { npm.flatOptions.json = true t.teardown(() => { npm.flatOptions.json = false @@ -182,7 +181,7 @@ test('npm org add - json output', t => { }) }) -test('npm org add - parseable output', t => { +t.test('npm org add - parseable output', t => { npm.flatOptions.parseable = true t.teardown(() => { npm.flatOptions.parseable = false @@ -208,7 +207,7 @@ test('npm org add - parseable output', t => { }) }) -test('npm org add - silent output', t => { +t.test('npm org add - silent output', t => { npm.flatOptions.silent = true t.teardown(() => { npm.flatOptions.silent = false @@ -231,7 +230,7 @@ test('npm org add - silent output', t => { }) }) -test('npm org rm', t => { +t.test('npm org rm', t => { t.teardown(() => { orgRmArgs = null orgLsArgs = null @@ -256,7 +255,7 @@ test('npm org rm', t => { }) }) -test('npm org rm - no org', t => { +t.test('npm org rm - no org', t => { t.teardown(() => { orgRmArgs = null orgLsArgs = null @@ -269,7 +268,7 @@ test('npm org rm - no org', t => { }) }) -test('npm org rm - no user', t => { +t.test('npm org rm - no user', t => { t.teardown(() => { orgRmArgs = null orgLsArgs = null @@ -282,7 +281,7 @@ test('npm org rm - no user', t => { }) }) -test('npm org rm - one user left', t => { +t.test('npm org rm - one user left', t => { orgList = { one: 'developer', } @@ -312,7 +311,7 @@ test('npm org rm - one user left', t => { }) }) -test('npm org rm - json output', t => { +t.test('npm org rm - json output', t => { npm.flatOptions.json = true t.teardown(() => { npm.flatOptions.json = false @@ -344,7 +343,7 @@ test('npm org rm - json output', t => { }) }) -test('npm org rm - parseable output', t => { +t.test('npm org rm - parseable output', t => { npm.flatOptions.parseable = true t.teardown(() => { npm.flatOptions.parseable = false @@ -374,7 +373,7 @@ test('npm org rm - parseable output', t => { }) }) -test('npm org rm - silent output', t => { +t.test('npm org rm - silent output', t => { npm.flatOptions.silent = true t.teardown(() => { npm.flatOptions.silent = false @@ -401,7 +400,7 @@ test('npm org rm - silent output', t => { }) }) -test('npm org ls', t => { +t.test('npm org ls', t => { orgList = { one: 'developer', two: 'admin', @@ -429,7 +428,7 @@ test('npm org ls', t => { }) }) -test('npm org ls - user filter', t => { +t.test('npm org ls - user filter', t => { orgList = { username: 'admin', missing: 'admin', @@ -455,7 +454,7 @@ test('npm org ls - user filter', t => { }) }) -test('npm org ls - user filter, missing user', t => { +t.test('npm org ls - user filter, missing user', t => { orgList = { missing: 'admin', } @@ -480,7 +479,7 @@ test('npm org ls - user filter, missing user', t => { }) }) -test('npm org ls - no org', t => { +t.test('npm org ls - no org', t => { t.teardown(() => { orgLsArgs = null output.length = 0 @@ -492,7 +491,7 @@ test('npm org ls - no org', t => { }) }) -test('npm org ls - json output', t => { +t.test('npm org ls - json output', t => { npm.flatOptions.json = true orgList = { one: 'developer', @@ -519,7 +518,7 @@ test('npm org ls - json output', t => { }) }) -test('npm org ls - parseable output', t => { +t.test('npm org ls - parseable output', t => { npm.flatOptions.parseable = true orgList = { one: 'developer', @@ -551,7 +550,7 @@ test('npm org ls - parseable output', t => { }) }) -test('npm org ls - silent output', t => { +t.test('npm org ls - silent output', t => { npm.flatOptions.silent = true orgList = { one: 'developer', diff --git a/deps/npm/test/lib/outdated.js b/deps/npm/test/lib/outdated.js index 5aff7c37ac11ad..605853056a000f 100644 --- a/deps/npm/test/lib/outdated.js +++ b/deps/npm/test/lib/outdated.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const packument = spec => { @@ -85,7 +84,7 @@ const globalDir = t.testdir({ }) const outdated = (dir, opts) => { - const Outdated = requireInject('../../lib/outdated.js', { + const Outdated = t.mock('../../lib/outdated.js', { pacote: { packument, }, @@ -99,10 +98,7 @@ const outdated = (dir, opts) => { return new Outdated(npm) } -t.beforeEach((done) => { - logs = '' - done() -}) +t.beforeEach(() => logs = '') const redactCwd = (path) => { const normalizePath = p => p @@ -342,7 +338,7 @@ t.test('should return if no outdated deps', t => { outdated(testDir, { global: false, }).exec([], () => { - t.equals(logs.length, 0, 'no logs') + t.equal(logs.length, 0, 'no logs') t.end() }) }) @@ -369,7 +365,7 @@ t.test('throws if error with a dep', t => { outdated(testDir, { global: false, }).exec([], (err) => { - t.equals(err.message, 'There is an error with this package.') + t.equal(err.message, 'There is an error with this package.') t.end() }) }) @@ -389,7 +385,7 @@ t.test('should skip missing non-prod deps', t => { outdated(testDir, { global: false, }).exec([], () => { - t.equals(logs.length, 0, 'no logs') + t.equal(logs.length, 0, 'no logs') t.end() }) }) @@ -414,7 +410,7 @@ t.test('should skip invalid pkg ranges', t => { }) outdated(testDir, {}).exec([], () => { - t.equals(logs.length, 0, 'no logs') + t.equal(logs.length, 0, 'no logs') t.end() }) }) @@ -439,7 +435,7 @@ t.test('should skip git specs', t => { }) outdated(testDir, {}).exec([], () => { - t.equals(logs.length, 0, 'no logs') + t.equal(logs.length, 0, 'no logs') t.end() }) }) diff --git a/deps/npm/test/lib/owner.js b/deps/npm/test/lib/owner.js index 11aeacb7be710d..4af8d1ebbb8fa0 100644 --- a/deps/npm/test/lib/owner.js +++ b/deps/npm/test/lib/owner.js @@ -1,4 +1,3 @@ -const requireInject = require('require-inject') const t = require('tap') let result = '' @@ -32,7 +31,7 @@ const npmcliMaintainers = [ { email: 'i@izs.me', name: 'isaacs' }, ] -const Owner = requireInject('../../lib/owner.js', mocks) +const Owner = t.mock('../../lib/owner.js', mocks) const owner = new Owner(npm) t.test('owner no args', t => { @@ -72,7 +71,7 @@ t.test('owner ls no args', t => { }) owner.exec(['ls'], err => { - t.ifError(err, 'npm owner ls no args') + t.error(err, 'npm owner ls no args') t.matchSnapshot(result, 'should output owners of cwd package') }) }) @@ -140,7 +139,7 @@ t.test('owner ls <pkg>', t => { }) owner.exec(['ls', '@npmcli/map-workspaces'], err => { - t.ifError(err, 'npm owner ls <pkg>') + t.error(err, 'npm owner ls <pkg>') t.matchSnapshot(result, 'should output owners of <pkg>') }) }) @@ -156,7 +155,7 @@ t.test('owner ls <pkg> no maintainers', t => { }) owner.exec(['ls', '@npmcli/map-workspaces'], err => { - t.ifError(err, 'npm owner ls <pkg> no maintainers') + t.error(err, 'npm owner ls <pkg> no maintainers') t.equal(result, 'no admin found', 'should output no admint found msg') t.end() }) @@ -190,7 +189,7 @@ t.test('owner add <user> <pkg>', t => { name: '@npmcli/map-workspaces', }, }, 'should use expected opts') - t.deepEqual( + t.same( opts.body.maintainers, [ ...npmcliMaintainers, @@ -227,7 +226,7 @@ t.test('owner add <user> <pkg>', t => { }) owner.exec(['add', 'foo', '@npmcli/map-workspaces'], err => { - t.ifError(err, 'npm owner add <user> <pkg>') + t.error(err, 'npm owner add <user> <pkg>') t.equal(result, '+ foo (@npmcli/map-workspaces)', 'should output add result') }) }) @@ -260,7 +259,7 @@ t.test('owner add <user> cwd package', t => { }) owner.exec(['add', 'foo'], err => { - t.ifError(err, 'npm owner add <user> cwd package') + t.error(err, 'npm owner add <user> cwd package') t.equal(result, '+ foo (@npmcli/map-workspaces)', 'should output add result') t.end() }) @@ -303,7 +302,7 @@ t.test('owner add <user> <pkg> already an owner', t => { }) owner.exec(['add', 'ruyadorno', '@npmcli/map-workspaces'], err => { - t.ifError(err, 'npm owner add <user> <pkg> already an owner') + t.error(err, 'npm owner add <user> <pkg> already an owner') }) }) @@ -448,7 +447,7 @@ t.test('owner add <user> <pkg> no previous maintainers property from server', t }) owner.exec(['add', 'foo', '@npmcli/no-owners-pkg'], err => { - t.ifError(err, 'npm owner add <user> <pkg>') + t.error(err, 'npm owner add <user> <pkg>') t.equal(result, '+ foo (@npmcli/no-owners-pkg)', 'should output add result') t.end() }) @@ -505,7 +504,7 @@ t.test('owner rm <user> <pkg>', t => { name: '@npmcli/map-workspaces', }, }, 'should use expected opts') - t.deepEqual( + t.same( opts.body.maintainers, npmcliMaintainers.filter(m => m.name !== 'ruyadorno'), 'should contain expected new owners, removing requested user' @@ -536,7 +535,7 @@ t.test('owner rm <user> <pkg>', t => { }) owner.exec(['rm', 'ruyadorno', '@npmcli/map-workspaces'], err => { - t.ifError(err, 'npm owner rm <user> <pkg>') + t.error(err, 'npm owner rm <user> <pkg>') t.equal(result, '- ruyadorno (@npmcli/map-workspaces)', 'should output rm result') }) }) @@ -576,7 +575,7 @@ t.test('owner rm <user> <pkg> not a current owner', t => { }) owner.exec(['rm', 'foo', '@npmcli/map-workspaces'], err => { - t.ifError(err, 'npm owner rm <user> <pkg> not a current owner') + t.error(err, 'npm owner rm <user> <pkg> not a current owner') }) }) @@ -608,7 +607,7 @@ t.test('owner rm <user> cwd package', t => { }) owner.exec(['rm', 'ruyadorno'], err => { - t.ifError(err, 'npm owner rm <user> cwd package') + t.error(err, 'npm owner rm <user> cwd package') t.equal(result, '- ruyadorno (@npmcli/map-workspaces)', 'should output rm result') t.end() }) diff --git a/deps/npm/test/lib/pack.js b/deps/npm/test/lib/pack.js index 4bcfe8ae3fd9c5..6706042b4c82e7 100644 --- a/deps/npm/test/lib/pack.js +++ b/deps/npm/test/lib/pack.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const pacote = require('pacote') @@ -16,20 +15,19 @@ const mockPacote = { manifest: (spec) => { if (spec.type === 'directory') return pacote.manifest(spec) - return { + const m = { name: spec.name || 'test-package', version: spec.version || '1.0.0-test', } + m._id = `${m.name}@${m.version}` + return m }, } -t.afterEach(cb => { - OUTPUT.length = 0 - cb() -}) +t.afterEach(() => OUTPUT.length = 0) t.test('should pack current directory with no arguments', (t) => { - const Pack = requireInject('../../lib/pack.js', { + const Pack = t.mock('../../lib/pack.js', { libnpmpack, npmlog: { notice: () => {}, @@ -47,9 +45,8 @@ t.test('should pack current directory with no arguments', (t) => { }) const pack = new Pack(npm) - pack.exec([], er => { - if (er) - throw er + pack.exec([], err => { + t.error(err, { bail: true }) const filename = `npm-${require('../../package.json').version}.tgz` t.strictSame(OUTPUT, [[filename]]) @@ -65,7 +62,7 @@ t.test('should pack given directory', (t) => { }, null, 2), }) - const Pack = requireInject('../../lib/pack.js', { + const Pack = t.mock('../../lib/pack.js', { libnpmpack, npmlog: { notice: () => {}, @@ -83,9 +80,8 @@ t.test('should pack given directory', (t) => { }) const pack = new Pack(npm) - pack.exec([testDir], er => { - if (er) - throw er + pack.exec([testDir], err => { + t.error(err, { bail: true }) const filename = 'my-cool-pkg-1.0.0.tgz' t.strictSame(OUTPUT, [[filename]]) @@ -101,7 +97,7 @@ t.test('should pack given directory for scoped package', (t) => { }, null, 2), }) - const Pack = requireInject('../../lib/pack.js', { + const Pack = t.mock('../../lib/pack.js', { libnpmpack, npmlog: { notice: () => {}, @@ -119,9 +115,8 @@ t.test('should pack given directory for scoped package', (t) => { }) const pack = new Pack(npm) - return pack.exec([testDir], er => { - if (er) - throw er + return pack.exec([testDir], err => { + t.error(err, { bail: true }) const filename = 'cool-my-pkg-1.0.0.tgz' t.strictSame(OUTPUT, [[filename]]) @@ -130,7 +125,7 @@ t.test('should pack given directory for scoped package', (t) => { }) t.test('should log pack contents', (t) => { - const Pack = requireInject('../../lib/pack.js', { + const Pack = t.mock('../../lib/pack.js', { '../../lib/utils/tar.js': { ...require('../../lib/utils/tar.js'), logTar: () => { @@ -154,9 +149,8 @@ t.test('should log pack contents', (t) => { }) const pack = new Pack(npm) - pack.exec([], er => { - if (er) - throw er + pack.exec([], err => { + t.error(err, { bail: true }) const filename = `npm-${require('../../package.json').version}.tgz` t.strictSame(OUTPUT, [[filename]]) @@ -164,6 +158,38 @@ t.test('should log pack contents', (t) => { }) }) +t.test('invalid packument', (t) => { + const mockPacote = { + manifest: () => { + return {} + }, + } + const Pack = t.mock('../../lib/pack.js', { + libnpmpack, + pacote: mockPacote, + npmlog: { + notice: () => {}, + showProgress: () => {}, + clearProgress: () => {}, + }, + }) + const npm = mockNpm({ + config: { + unicode: true, + json: true, + 'dry-run': true, + }, + output, + }) + const pack = new Pack(npm) + pack.exec([], err => { + t.match(err, { message: 'Invalid package, must have name and version' }) + + t.strictSame(OUTPUT, []) + t.end() + }) +}) + t.test('workspaces', (t) => { const testDir = t.testdir({ 'package.json': JSON.stringify({ @@ -184,7 +210,7 @@ t.test('workspaces', (t) => { }), }, }) - const Pack = requireInject('../../lib/pack.js', { + const Pack = t.mock('../../lib/pack.js', { libnpmpack, pacote: mockPacote, npmlog: { @@ -205,9 +231,8 @@ t.test('workspaces', (t) => { const pack = new Pack(npm) t.test('all workspaces', (t) => { - pack.execWorkspaces([], [], er => { - if (er) - throw er + pack.execWorkspaces([], [], err => { + t.error(err, { bail: true }) t.strictSame(OUTPUT, [ ['workspace-a-1.0.0.tgz'], @@ -218,9 +243,8 @@ t.test('workspaces', (t) => { }) t.test('all workspaces, `.` first arg', (t) => { - pack.execWorkspaces(['.'], [], er => { - if (er) - throw er + pack.execWorkspaces(['.'], [], err => { + t.error(err, { bail: true }) t.strictSame(OUTPUT, [ ['workspace-a-1.0.0.tgz'], @@ -231,9 +255,8 @@ t.test('workspaces', (t) => { }) t.test('one workspace', (t) => { - pack.execWorkspaces([], ['workspace-a'], er => { - if (er) - throw er + pack.execWorkspaces([], ['workspace-a'], err => { + t.error(err, { bail: true }) t.strictSame(OUTPUT, [ ['workspace-a-1.0.0.tgz'], @@ -243,9 +266,8 @@ t.test('workspaces', (t) => { }) t.test('specific package', (t) => { - pack.execWorkspaces(['abbrev'], [], er => { - if (er) - throw er + pack.execWorkspaces(['abbrev'], [], err => { + t.error(err, { bail: true }) t.strictSame(OUTPUT, [ ['abbrev-1.0.0-test.tgz'], diff --git a/deps/npm/test/lib/ping.js b/deps/npm/test/lib/ping.js index 95361035acb53d..c2d53efef5a7e4 100644 --- a/deps/npm/test/lib/ping.js +++ b/deps/npm/test/lib/ping.js @@ -1,13 +1,12 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const mockNpm = require('../fixtures/mock-npm') -test('pings', (t) => { +t.test('pings', (t) => { t.plan(8) const registry = 'https://registry.npmjs.org' let noticeCalls = 0 - const Ping = requireInject('../../lib/ping.js', { + const Ping = t.mock('../../lib/ping.js', { '../../lib/utils/ping.js': function (spec) { t.equal(spec.registry, registry, 'passes flatOptions') return {} @@ -33,18 +32,18 @@ test('pings', (t) => { ping.exec([], (err) => { t.equal(noticeCalls, 2, 'should have logged 2 lines') - t.ifError(err, 'npm ping') + t.error(err, 'npm ping') t.ok('should be able to ping') }) }) -test('pings and logs details', (t) => { +t.test('pings and logs details', (t) => { t.plan(10) const registry = 'https://registry.npmjs.org' const details = { extra: 'data' } let noticeCalls = 0 - const Ping = requireInject('../../lib/ping.js', { + const Ping = t.mock('../../lib/ping.js', { '../../lib/utils/ping.js': function (spec) { t.equal(spec.registry, registry, 'passes flatOptions') return details @@ -74,18 +73,18 @@ test('pings and logs details', (t) => { ping.exec([], (err) => { t.equal(noticeCalls, 3, 'should have logged 3 lines') - t.ifError(err, 'npm ping') + t.error(err, 'npm ping') t.ok('should be able to ping') }) }) -test('pings and returns json', (t) => { +t.test('pings and returns json', (t) => { t.plan(11) const registry = 'https://registry.npmjs.org' const details = { extra: 'data' } let noticeCalls = 0 - const Ping = requireInject('../../lib/ping.js', { + const Ping = t.mock('../../lib/ping.js', { '../../lib/utils/ping.js': function (spec) { t.equal(spec.registry, registry, 'passes flatOptions') return details @@ -117,7 +116,7 @@ test('pings and returns json', (t) => { ping.exec([], (err) => { t.equal(noticeCalls, 2, 'should have logged 2 lines') - t.ifError(err, 'npm ping') + t.error(err, 'npm ping') t.ok('should be able to ping') }) }) diff --git a/deps/npm/test/lib/prefix.js b/deps/npm/test/lib/prefix.js index 5eb7ddb934d932..526631388e74ff 100644 --- a/deps/npm/test/lib/prefix.js +++ b/deps/npm/test/lib/prefix.js @@ -13,7 +13,7 @@ t.test('prefix', (t) => { }) prefix.exec([], (err) => { - t.ifError(err, 'npm prefix') + t.error(err, 'npm prefix') t.ok('should have printed directory') }) }) diff --git a/deps/npm/test/lib/profile.js b/deps/npm/test/lib/profile.js index 5b1210615aa2f4..17bcf99b9b6539 100644 --- a/deps/npm/test/lib/profile.js +++ b/deps/npm/test/lib/profile.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') let result = '' @@ -67,16 +66,15 @@ const userProfile = { github: 'https://github.com/npm', } -t.afterEach(cb => { +t.afterEach(() => { result = '' flatOptions.otp = '' config.json = false config.parseable = false config.registry = 'https://registry.npmjs.org/' - cb() }) -const Profile = requireInject('../../lib/profile.js', mocks) +const Profile = t.mock('../../lib/profile.js', mocks) const profile = new Profile(npm) t.test('no args', t => { @@ -97,7 +95,7 @@ t.test('profile get no args', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -123,7 +121,7 @@ t.test('profile get no args', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), userProfile, 'should output json profile result' @@ -157,7 +155,7 @@ t.test('profile get no args', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -185,7 +183,7 @@ t.test('profile get no args', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -213,7 +211,7 @@ t.test('profile get no args', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -241,7 +239,7 @@ t.test('profile get <key>', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -268,7 +266,7 @@ t.test('profile get <key>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), userProfile, 'should output json profile result ignoring args filter' @@ -302,7 +300,7 @@ t.test('profile get multiple args', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -328,7 +326,7 @@ t.test('profile get multiple args', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), userProfile, 'should output json profile result and ignore args' @@ -436,7 +434,7 @@ t.test('profile set <key> <value>', t => { t.test('default output', t => { t.plan(2) - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile(t), }) @@ -459,7 +457,7 @@ t.test('profile set <key> <value>', t => { config.json = true - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile(t), }) @@ -469,7 +467,7 @@ t.test('profile set <key> <value>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), { fullname: 'Lorem Ipsum', @@ -484,7 +482,7 @@ t.test('profile set <key> <value>', t => { config.parseable = true - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile(t), }) @@ -531,7 +529,7 @@ t.test('profile set <key> <value>', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -595,7 +593,7 @@ t.test('profile set <key> <value>', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, '../../lib/utils/read-user-info.js': readUserInfo, @@ -663,7 +661,7 @@ t.test('profile set <key> <value>', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, npmlog, 'npm-profile': npmProfile, @@ -754,7 +752,7 @@ t.test('enable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -783,7 +781,7 @@ t.test('enable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -804,7 +802,7 @@ t.test('enable-2fa', t => { t.test('no auth found', t => { npm.config.getCredentialsByURI = () => ({}) - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, }) const profile = new Profile(npm) @@ -883,7 +881,7 @@ t.test('enable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, '../../lib/utils/read-user-info.js': readUserInfo, @@ -985,7 +983,7 @@ t.test('enable-2fa', t => { generate: (url, cb) => cb('qrcode'), } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, 'qrcode-terminal': qrcode, @@ -1037,7 +1035,7 @@ t.test('enable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, '../../lib/utils/read-user-info.js': readUserInfo, @@ -1083,7 +1081,7 @@ t.test('enable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, '../../lib/utils/read-user-info.js': readUserInfo, @@ -1132,7 +1130,7 @@ t.test('enable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, '../../lib/utils/read-user-info.js': readUserInfo, @@ -1181,7 +1179,7 @@ t.test('enable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, '../../lib/utils/read-user-info.js': readUserInfo, @@ -1215,7 +1213,7 @@ t.test('disable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, }) @@ -1240,7 +1238,7 @@ t.test('disable-2fa', t => { return userProfile }, async set (newProfile, conf) { - t.deepEqual( + t.same( newProfile, { tfa: { @@ -1277,7 +1275,7 @@ t.test('disable-2fa', t => { }) t.test('default output', t => { - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile(t), '../../lib/utils/read-user-info.js': readUserInfo(t), @@ -1300,7 +1298,7 @@ t.test('disable-2fa', t => { t.test('--json', t => { config.json = true - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile(t), '../../lib/utils/read-user-info.js': readUserInfo(t), @@ -1311,7 +1309,7 @@ t.test('disable-2fa', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), { tfa: false }, 'should output json already disabled msg' @@ -1323,7 +1321,7 @@ t.test('disable-2fa', t => { t.test('--parseable', t => { config.parseable = true - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile(t), '../../lib/utils/read-user-info.js': readUserInfo(t), @@ -1356,7 +1354,7 @@ t.test('disable-2fa', t => { return userProfile }, async set (newProfile, conf) { - t.deepEqual( + t.same( newProfile, { tfa: { @@ -1386,7 +1384,7 @@ t.test('disable-2fa', t => { }, } - const Profile = requireInject('../../lib/profile.js', { + const Profile = t.mock('../../lib/profile.js', { ...mocks, 'npm-profile': npmProfile, '../../lib/utils/read-user-info.js': readUserInfo, diff --git a/deps/npm/test/lib/prune.js b/deps/npm/test/lib/prune.js index 8cd148806e3520..87bb1370f3a194 100644 --- a/deps/npm/test/lib/prune.js +++ b/deps/npm/test/lib/prune.js @@ -1,8 +1,7 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') -test('should prune using Arborist', (t) => { - const Prune = requireInject('../../lib/prune.js', { +t.test('should prune using Arborist', (t) => { + const Prune = t.mock('../../lib/prune.js', { '@npmcli/arborist': function (args) { t.ok(args, 'gets options object') t.ok(args.path, 'gets path option') diff --git a/deps/npm/test/lib/publish.js b/deps/npm/test/lib/publish.js index f61377b54f9971..57574b22a56eaf 100644 --- a/deps/npm/test/lib/publish.js +++ b/deps/npm/test/lib/publish.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const fs = require('fs') @@ -19,10 +18,7 @@ const defaults = Object.entries(definitions).reduce((defaults, [key, def]) => { const config = defaults -t.afterEach(cb => { - log.level = 'silent' - cb() -}) +t.afterEach(() => log.level = 'silent') t.test('should publish with libnpmpublish, passing through flatOptions and respecting publishConfig.registry', (t) => { t.plan(7) @@ -37,7 +33,7 @@ t.test('should publish with libnpmpublish, passing through flatOptions and respe }, null, 2), }) - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { // verify that we do NOT remove publishConfig if it was there originally // and then removed during the script/pack process libnpmpack: async () => { @@ -50,7 +46,7 @@ t.test('should publish with libnpmpublish, passing through flatOptions and respe libnpmpublish: { publish: (manifest, tarData, opts) => { t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') - t.isa(tarData, Buffer, 'tarData is a buffer') + t.type(tarData, Buffer, 'tarData is a buffer') t.ok(opts, 'gets opts object') t.same(opts.customValue, true, 'flatOptions values are passed through') t.same(opts.registry, registry, 'publishConfig.registry is passed through') @@ -88,7 +84,7 @@ t.test('re-loads publishConfig.registry if added during script process', (t) => }, null, 2), }) - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { libnpmpack: async () => { fs.writeFileSync(`${testDir}/package.json`, JSON.stringify({ name: 'my-cool-pkg', @@ -100,7 +96,7 @@ t.test('re-loads publishConfig.registry if added during script process', (t) => libnpmpublish: { publish: (manifest, tarData, opts) => { t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') - t.isa(tarData, Buffer, 'tarData is a buffer') + t.type(tarData, Buffer, 'tarData is a buffer') t.ok(opts, 'gets opts object') t.same(opts.registry, registry, 'publishConfig.registry is passed through') }, @@ -132,7 +128,7 @@ t.test('if loglevel=info and json, should not output package contents', (t) => { }) log.level = 'info' - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { '../../lib/utils/tar.js': { getContents: () => ({ id: 'someid', @@ -178,7 +174,7 @@ t.test('if loglevel=silent and dry-run, should not output package contents or pu }) log.level = 'silent' - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { '../../lib/utils/tar.js': { getContents: () => ({ id: 'someid', @@ -224,7 +220,7 @@ t.test('if loglevel=info and dry-run, should not publish, should log package con }) log.level = 'info' - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { '../../lib/utils/tar.js': { getContents: () => ({ id: 'someid', @@ -260,7 +256,7 @@ t.test('if loglevel=info and dry-run, should not publish, should log package con t.test('shows usage with wrong set of arguments', (t) => { t.plan(1) - const Publish = requireInject('../../lib/publish.js') + const Publish = t.mock('../../lib/publish.js') const publish = new Publish({}) publish.exec(['a', 'b', 'c'], (er) => { @@ -272,7 +268,7 @@ t.test('shows usage with wrong set of arguments', (t) => { t.test('throws when invalid tag', (t) => { t.plan(1) - const Publish = requireInject('../../lib/publish.js') + const Publish = t.mock('../../lib/publish.js') const npm = mockNpm({ config: { ...config, tag: '0.0.13' }, }) @@ -306,7 +302,7 @@ t.test('can publish a tarball', t => { }, ['package']) const tarFile = fs.readFileSync(`${testDir}/tarball/package.tgz`) - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { libnpmpublish: { publish: (manifest, tarData, opts) => { t.match(manifest, { @@ -334,7 +330,7 @@ t.test('can publish a tarball', t => { t.test('should check auth for default registry', t => { t.plan(2) - const Publish = requireInject('../../lib/publish.js') + const Publish = t.mock('../../lib/publish.js') const npm = mockNpm({ config }) npm.config.getCredentialsByURI = (uri) => { t.same(uri, defaults.registry, 'gets credentials for expected registry') @@ -354,7 +350,7 @@ t.test('should check auth for default registry', t => { t.test('should check auth for configured registry', t => { t.plan(2) const registry = 'https://some.registry' - const Publish = requireInject('../../lib/publish.js') + const Publish = t.mock('../../lib/publish.js') const npm = mockNpm({ config, flatOptions: { registry }, @@ -384,7 +380,7 @@ t.test('should check auth for scope specific registry', t => { }, null, 2), }) - const Publish = requireInject('../../lib/publish.js') + const Publish = t.mock('../../lib/publish.js') const npm = mockNpm({ config, flatOptions: { '@npm:registry': registry }, @@ -414,7 +410,7 @@ t.test('should use auth for scope specific registry', t => { }, null, 2), }) - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { libnpmpublish: { publish: (manifest, tarData, opts) => { t.ok(opts, 'gets opts object') @@ -453,7 +449,7 @@ t.test('read registry only from publishConfig', t => { }, null, 2), }) - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { libnpmpublish: { publish: (manifest, tarData, opts) => { t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') @@ -499,7 +495,7 @@ t.test('able to publish after if encountered multiple configs', t => { })) configList.unshift(Object.assign(Object.create(configList[0]), { tag })) - const Publish = requireInject('../../lib/publish.js', { + const Publish = t.mock('../../lib/publish.js', { libnpmpublish: { publish: (manifest, tarData, opts) => { t.same(opts.defaultTag, tag, 'gets option for expected tag') diff --git a/deps/npm/test/lib/rebuild.js b/deps/npm/test/lib/rebuild.js index 6e144b7e11cc70..e686b6a32ce53a 100644 --- a/deps/npm/test/lib/rebuild.js +++ b/deps/npm/test/lib/rebuild.js @@ -19,12 +19,11 @@ const npm = mockNpm({ const Rebuild = require('../../lib/rebuild.js') const rebuild = new Rebuild(npm) -t.afterEach(cb => { +t.afterEach(() => { npm.prefix = '' config.global = false npm.globalDir = '' result = '' - cb() }) t.test('no args', t => { diff --git a/deps/npm/test/lib/repo.js b/deps/npm/test/lib/repo.js index c05c02d80a885d..0701750b58c63c 100644 --- a/deps/npm/test/lib/repo.js +++ b/deps/npm/test/lib/repo.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm.js') const { join, sep } = require('path') @@ -186,16 +185,14 @@ const openUrl = async (npm, url, errMsg) => { opened[url]++ } -const Repo = requireInject('../../lib/repo.js', { +const Repo = t.mock('../../lib/repo.js', { '../../lib/utils/open-url.js': openUrl, }) const flatOptions = {} const npm = mockNpm({ flatOptions }) const repo = new Repo(npm) -t.afterEach(async () => { - opened = {} -}) +t.afterEach(() => opened = {}) t.test('open repo urls', t => { // XXX It is very odd that `where` is how pacote knows to look anywhere other diff --git a/deps/npm/test/lib/root.js b/deps/npm/test/lib/root.js index 4a1aefa02dceaf..5460f3d4985c22 100644 --- a/deps/npm/test/lib/root.js +++ b/deps/npm/test/lib/root.js @@ -13,7 +13,7 @@ t.test('root', (t) => { }) root.exec([], (err) => { - t.ifError(err, 'npm root') + t.error(err, 'npm root') t.ok('should have printed directory') }) }) diff --git a/deps/npm/test/lib/run-script.js b/deps/npm/test/lib/run-script.js index f7eb46fedf5eb5..897c80817e2549 100644 --- a/deps/npm/test/lib/run-script.js +++ b/deps/npm/test/lib/run-script.js @@ -1,6 +1,5 @@ const { resolve } = require('path') const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const normalizePath = p => p @@ -43,7 +42,7 @@ const npmlog = { error: () => null, } -t.afterEach(cb => { +t.afterEach(() => { npm.color = false npmlog.level = 'warn' npmlog.error = () => null @@ -52,11 +51,10 @@ t.afterEach(cb => { config['if-present'] = false config.json = false config.parseable = false - cb() }) const getRS = windows => { - const RunScript = requireInject('../../lib/run-script.js', { + const RunScript = t.mock('../../lib/run-script.js', { '@npmcli/run-script': Object.assign(async opts => { RUN_SCRIPTS.push(opts) }, { @@ -386,7 +384,7 @@ t.test('skip pre/post hooks when using ignoreScripts', t => { if (er) throw er - t.deepEqual(RUN_SCRIPTS, [ + t.same(RUN_SCRIPTS, [ { path: npm.localPrefix, args: [], @@ -898,27 +896,27 @@ t.test('workspaces', t => { 'Lifecycle script `missing-script` failed with error:', 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: a@1.0.0', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/a', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/a', 'Lifecycle script `missing-script` failed with error:', 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: b@2.0.0', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/b', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/b', 'Lifecycle script `missing-script` failed with error:', 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: c@1.0.0', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/c', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/c', 'Lifecycle script `missing-script` failed with error:', 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: d@1.0.0', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/d', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/d', 'Lifecycle script `missing-script` failed with error:', 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: e', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/e', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/e', 'Lifecycle script `missing-script` failed with error:', 'Error: Missing script: "missing-script"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: noscripts@1.0.0', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/noscripts', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/noscripts', ], 'should log error msgs for each workspace script') t.end() @@ -939,11 +937,11 @@ t.test('workspaces', t => { 'Lifecycle script `test` failed with error:', 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: a@1.0.0', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/a', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/a', 'Lifecycle script `test` failed with error:', 'Error: Missing script: "test"\n\nTo see a list of scripts, run:\n npm run', ' in workspace: b@2.0.0', - ' at location: {CWD}/test/lib/run-script-workspaces/packages/b', + ' at location: {CWD}/test/lib/tap-testdir-run-script-workspaces/packages/b', ], 'should log error msgs for each workspace script') t.end() }) @@ -977,7 +975,7 @@ t.test('workspaces', t => { }) t.test('single failed workspace run', t => { - const RunScript = requireInject('../../lib/run-script.js', { + const RunScript = t.mock('../../lib/run-script.js', { '@npmcli/run-script': () => { throw new Error('err') }, @@ -994,7 +992,7 @@ t.test('workspaces', t => { }) t.test('failed workspace run with succeeded runs', t => { - const RunScript = requireInject('../../lib/run-script.js', { + const RunScript = t.mock('../../lib/run-script.js', { '@npmcli/run-script': async opts => { if (opts.pkg.name === 'a') throw new Error('ERR') diff --git a/deps/npm/test/lib/search.js b/deps/npm/test/lib/search.js index b7b40844219fbc..ac894a9e3369da 100644 --- a/deps/npm/test/lib/search.js +++ b/deps/npm/test/lib/search.js @@ -1,6 +1,5 @@ const Minipass = require('minipass') const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const libnpmsearchResultFixture = require('../fixtures/libnpmsearch-stream-result.js') @@ -37,15 +36,14 @@ const mocks = { '../../lib/utils/usage.js': () => 'usage instructions', } -t.afterEach(cb => { +t.afterEach(() => { result = '' config.json = false config.parseable = false npm.flatOptions = { ...flatOptions } - cb() }) -const Search = requireInject('../../lib/search.js', mocks) +const Search = t.mock('../../lib/search.js', mocks) const search = new Search(npm) t.test('no args', t => { @@ -68,7 +66,7 @@ t.test('search <name>', t => { }, } - const Search = requireInject('../../lib/search.js', { + const Search = t.mock('../../lib/search.js', { ...mocks, libnpmsearch, }) @@ -101,7 +99,7 @@ t.test('search <name> --json', (t) => { }, } - const Search = requireInject('../../lib/search.js', { + const Search = t.mock('../../lib/search.js', { ...mocks, libnpmsearch, }) @@ -146,7 +144,7 @@ t.test('search <name> --searchexclude --searchopts', t => { }, } - const Search = requireInject('../../lib/search.js', { + const Search = t.mock('../../lib/search.js', { ...mocks, libnpmsearch, }) @@ -200,7 +198,7 @@ t.test('empty search results', t => { }, } - const Search = requireInject('../../lib/search.js', { + const Search = t.mock('../../lib/search.js', { ...mocks, libnpmsearch, }) @@ -227,7 +225,7 @@ t.test('search api response error', t => { }, } - const Search = requireInject('../../lib/search.js', { + const Search = t.mock('../../lib/search.js', { ...mocks, libnpmsearch, }) diff --git a/deps/npm/test/lib/set-script.js b/deps/npm/test/lib/set-script.js index 0071fa20f247cd..96b455785c5095 100644 --- a/deps/npm/test/lib/set-script.js +++ b/deps/npm/test/lib/set-script.js @@ -1,5 +1,4 @@ -const test = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const fs = require('fs') const parseJSON = require('json-parse-even-better-errors') const mockNpm = require('../fixtures/mock-npm.js') @@ -10,7 +9,7 @@ const npm = mockNpm(flatOptions) const ERROR_OUTPUT = [] const WARN_OUTPUT = [] -const SetScript = requireInject('../../lib/set-script.js', { +const SetScript = t.mock('../../lib/set-script.js', { npmlog: { error: (...args) => { ERROR_OUTPUT.push(args) @@ -22,7 +21,7 @@ const SetScript = requireInject('../../lib/set-script.js', { }) const setScript = new SetScript(npm) -test.test('completion', t => { +t.test('completion', t => { t.test('already have a script name', async t => { npm.localPrefix = t.testdir({}) const res = await setScript.completion({conf: {argv: {remain: ['npm', 'run', 'x']}}}) @@ -60,14 +59,14 @@ test.test('completion', t => { t.end() }) -test.test('fails on invalid arguments', (t) => { +t.test('fails on invalid arguments', (t) => { t.plan(3) setScript.exec(['arg1'], (fail) => t.match(fail, /Expected 2 arguments: got 1/)) setScript.exec(['arg1', 'arg2', 'arg3'], (fail) => t.match(fail, /Expected 2 arguments: got 3/)) setScript.exec(['arg1', 'arg2', 'arg3', 'arg4'], (fail) => t.match(fail, /Expected 2 arguments: got 4/)) }) -test.test('fails if run in postinstall script', (t) => { +t.test('fails if run in postinstall script', (t) => { const lifecycleEvent = process.env.npm_lifecycle_event t.teardown(() => { process.env.npm_lifecycle_event = lifecycleEvent @@ -78,12 +77,12 @@ test.test('fails if run in postinstall script', (t) => { setScript.exec(['arg1', 'arg2'], (fail) => t.equal(fail.toString(), 'Error: Scripts can’t set from the postinstall script')) }) -test.test('fails when package.json not found', (t) => { +t.test('fails when package.json not found', (t) => { t.plan(1) setScript.exec(['arg1', 'arg2'], (fail) => t.match(fail, /package.json not found/)) }) -test.test('fails on invalid JSON', (t) => { +t.test('fails on invalid JSON', (t) => { npm.localPrefix = t.testdir({ 'package.json': 'iamnotjson', }) @@ -92,7 +91,7 @@ test.test('fails on invalid JSON', (t) => { setScript.exec(['arg1', 'arg2'], (fail) => t.match(fail, /Invalid package.json: JSONParseError/)) }) -test.test('creates scripts object', (t) => { +t.test('creates scripts object', (t) => { npm.localPrefix = t.testdir({ 'package.json': '{}', }) @@ -101,11 +100,11 @@ test.test('creates scripts object', (t) => { setScript.exec(['arg1', 'arg2'], (error) => { t.equal(error, undefined) const contents = fs.readFileSync(resolve(npm.localPrefix, 'package.json')) - t.assert(parseJSON(contents), {scripts: {arg1: 'arg2'}}) + t.ok(parseJSON(contents), {scripts: {arg1: 'arg2'}}) }) }) -test.test('warns when overwriting', (t) => { +t.test('warns when overwriting', (t) => { WARN_OUTPUT.length = 0 npm.localPrefix = t.testdir({ 'package.json': JSON.stringify({ @@ -122,7 +121,7 @@ test.test('warns when overwriting', (t) => { }) }) -test.test('provided indentation and eol is used', (t) => { +t.test('provided indentation and eol is used', (t) => { npm.localPrefix = t.testdir({ 'package.json': JSON.stringify({ name: 'foo', @@ -141,7 +140,7 @@ test.test('provided indentation and eol is used', (t) => { }) }) -test.test('workspaces', (t) => { +t.test('workspaces', (t) => { ERROR_OUTPUT.length = 0 WARN_OUTPUT.length = 0 npm.localPrefix = t.testdir({ diff --git a/deps/npm/test/lib/set.js b/deps/npm/test/lib/set.js index 3b38fdc276ce24..f51065a4b293db 100644 --- a/deps/npm/test/lib/set.js +++ b/deps/npm/test/lib/set.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') let configArgs = null const npm = { @@ -11,7 +10,7 @@ const npm = { }, } -const Set = requireInject('../../lib/set.js') +const Set = t.mock('../../lib/set.js') const set = new Set(npm) t.test('npm set - no args', t => { diff --git a/deps/npm/test/lib/shrinkwrap.js b/deps/npm/test/lib/shrinkwrap.js index faf452ea702f20..8bd18f7fbd7c64 100644 --- a/deps/npm/test/lib/shrinkwrap.js +++ b/deps/npm/test/lib/shrinkwrap.js @@ -1,6 +1,5 @@ const t = require('tap') const fs = require('fs') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const config = { @@ -40,11 +39,10 @@ const mocks = { '../../lib/utils/config/definitions.js': {}, } -t.afterEach(cb => { +t.afterEach(() => { npm.prefix = '' config.global = false npm.globalDir = '' - cb() }) t.test('no args', t => { @@ -54,7 +52,7 @@ t.test('no args', t => { class Arborist { constructor (args) { - t.deepEqual( + t.same( args, { ...flatOptions, path: npm.prefix }, 'should call arborist constructor with expected args' @@ -85,7 +83,7 @@ t.test('no args', t => { }, } - const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', { + const Shrinkwrap = t.mock('../../lib/shrinkwrap.js', { ...mocks, npmlog, '@npmcli/arborist': Arborist, @@ -105,7 +103,7 @@ t.test('no virtual tree', t => { class Arborist { constructor (args) { - t.deepEqual( + t.same( args, { ...flatOptions, path: npm.prefix }, 'should call arborist constructor with expected args' @@ -140,7 +138,7 @@ t.test('no virtual tree', t => { }, } - const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', { + const Shrinkwrap = t.mock('../../lib/shrinkwrap.js', { ...mocks, npmlog, '@npmcli/arborist': Arborist, @@ -160,7 +158,7 @@ t.test('existing package-json file', t => { class Arborist { constructor (args) { - t.deepEqual( + t.same( args, { ...flatOptions, path: npm.prefix }, 'should call arborist constructor with expected args' @@ -201,7 +199,7 @@ t.test('existing package-json file', t => { }, } - const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', { + const Shrinkwrap = t.mock('../../lib/shrinkwrap.js', { ...mocks, fs, npmlog, @@ -222,7 +220,7 @@ t.test('update shrinkwrap file version', t => { class Arborist { constructor (args) { - t.deepEqual( + t.same( args, { ...flatOptions, path: npm.prefix }, 'should call arborist constructor with expected args' @@ -256,7 +254,7 @@ t.test('update shrinkwrap file version', t => { }, } - const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', { + const Shrinkwrap = t.mock('../../lib/shrinkwrap.js', { ...mocks, npmlog, '@npmcli/arborist': Arborist, @@ -276,7 +274,7 @@ t.test('update to date shrinkwrap file', t => { class Arborist { constructor (args) { - t.deepEqual( + t.same( args, { ...flatOptions, path: npm.prefix }, 'should call arborist constructor with expected args' @@ -310,7 +308,7 @@ t.test('update to date shrinkwrap file', t => { }, } - const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', { + const Shrinkwrap = t.mock('../../lib/shrinkwrap.js', { ...mocks, npmlog, '@npmcli/arborist': Arborist, @@ -324,7 +322,7 @@ t.test('update to date shrinkwrap file', t => { }) t.test('shrinkwrap --global', t => { - const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', mocks) + const Shrinkwrap = t.mock('../../lib/shrinkwrap.js', mocks) config.global = true const shrinkwrap = new Shrinkwrap(npm) @@ -342,7 +340,7 @@ t.test('shrinkwrap --global', t => { t.test('works without fs.promises', async t => { t.doesNotThrow(() => { - const Shrinkwrap = requireInject('../../lib/shrinkwrap.js', { + const Shrinkwrap = t.mock('../../lib/shrinkwrap.js', { ...mocks, fs: { ...fs, promises: null }, }) diff --git a/deps/npm/test/lib/star.js b/deps/npm/test/lib/star.js index fa75d210577acd..0c584e4a3f0cf8 100644 --- a/deps/npm/test/lib/star.js +++ b/deps/npm/test/lib/star.js @@ -1,4 +1,3 @@ -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const t = require('tap') @@ -24,15 +23,14 @@ const mocks = { '../../lib/utils/usage.js': () => 'usage instructions', } -const Star = requireInject('../../lib/star.js', mocks) +const Star = t.mock('../../lib/star.js', mocks) const star = new Star(npm) -t.afterEach(cb => { +t.afterEach(() => { config.unicode = false config['star.unstar'] = false npmlog.info = noop result = '' - cb() }) t.test('no args', t => { @@ -136,7 +134,7 @@ t.test('unicode', async t => { }) t.test('logged out user', t => { - const Star = requireInject('../../lib/star.js', { + const Star = t.mock('../../lib/star.js', { ...mocks, '../../lib/utils/get-identity.js': async () => undefined, }) diff --git a/deps/npm/test/lib/stars.js b/deps/npm/test/lib/stars.js index b242a883ad90fa..bf345aeb4cf42d 100644 --- a/deps/npm/test/lib/stars.js +++ b/deps/npm/test/lib/stars.js @@ -1,4 +1,3 @@ -const requireInject = require('require-inject') const t = require('tap') let result = '' @@ -20,14 +19,13 @@ const mocks = { '../../lib/utils/usage.js': () => 'usage instructions', } -const Stars = requireInject('../../lib/stars.js', mocks) +const Stars = t.mock('../../lib/stars.js', mocks) const stars = new Stars(npm) -t.afterEach(cb => { +t.afterEach(() => { npm.config = { get () {} } npmlog.warn = noop result = '' - cb() }) t.test('no args', t => { diff --git a/deps/npm/test/lib/team.js b/deps/npm/test/lib/team.js index 458f8ee6700ce6..68ac28fff36ff8 100644 --- a/deps/npm/test/lib/team.js +++ b/deps/npm/test/lib/team.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') let result = '' const libnpmteam = { @@ -23,13 +22,12 @@ const mocks = { '../../lib/utils/usage.js': () => 'usage instructions', } -t.afterEach(cb => { +t.afterEach(() => { result = '' npm.flatOptions = {} - cb() }) -const Team = requireInject('../../lib/team.js', mocks) +const Team = t.mock('../../lib/team.js', mocks) const team = new Team(npm) t.test('no args', t => { @@ -76,7 +74,7 @@ t.test('team add <scope:team> <user>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), { added: true, @@ -96,7 +94,7 @@ t.test('team add <scope:team> <user>', t => { if (err) throw err - t.deepEqual(result, '', 'should not output success if silent') + t.same(result, '', 'should not output success if silent') t.end() }) }) @@ -137,7 +135,7 @@ t.test('team create <scope:team>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), { created: true, @@ -156,7 +154,7 @@ t.test('team create <scope:team>', t => { if (err) throw err - t.deepEqual(result, '', 'should not output create success if silent') + t.same(result, '', 'should not output create success if silent') t.end() }) }) @@ -194,7 +192,7 @@ t.test('team destroy <scope:team>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), { deleted: true, @@ -213,7 +211,7 @@ t.test('team destroy <scope:team>', t => { if (err) throw err - t.deepEqual(result, '', 'should not output destroy if silent') + t.same(result, '', 'should not output destroy if silent') t.end() }) }) @@ -232,7 +230,7 @@ t.test('team ls <scope>', t => { }, } - const Team = requireInject('../../lib/team.js', { + const Team = t.mock('../../lib/team.js', { ...mocks, libnpmteam, }) @@ -267,7 +265,7 @@ t.test('team ls <scope>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), [ 'npmcli:designers', @@ -287,7 +285,7 @@ t.test('team ls <scope>', t => { if (err) throw err - t.deepEqual(result, '', 'should not list teams if silent') + t.same(result, '', 'should not list teams if silent') t.end() }) }) @@ -299,7 +297,7 @@ t.test('team ls <scope>', t => { }, } - const Team = requireInject('../../lib/team.js', { + const Team = t.mock('../../lib/team.js', { ...mocks, libnpmteam, }) @@ -321,7 +319,7 @@ t.test('team ls <scope>', t => { }, } - const Team = requireInject('../../lib/team.js', { + const Team = t.mock('../../lib/team.js', { ...mocks, libnpmteam, }) @@ -345,7 +343,7 @@ t.test('team ls <scope:team>', t => { return ['nlf', 'ruyadorno', 'darcyclarke', 'isaacs'] }, } - const Team = requireInject('../../lib/team.js', { + const Team = t.mock('../../lib/team.js', { ...mocks, libnpmteam, }) @@ -380,7 +378,7 @@ t.test('team ls <scope:team>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), [ 'darcyclarke', @@ -401,7 +399,7 @@ t.test('team ls <scope:team>', t => { if (err) throw err - t.deepEqual(result, '', 'should not output users if silent') + t.same(result, '', 'should not output users if silent') t.end() }) }) @@ -413,7 +411,7 @@ t.test('team ls <scope:team>', t => { }, } - const Team = requireInject('../../lib/team.js', { + const Team = t.mock('../../lib/team.js', { ...mocks, libnpmteam, }) @@ -435,7 +433,7 @@ t.test('team ls <scope:team>', t => { }, } - const Team = requireInject('../../lib/team.js', { + const Team = t.mock('../../lib/team.js', { ...mocks, libnpmteam, }) @@ -483,7 +481,7 @@ t.test('team rm <scope:team> <user>', t => { if (err) throw err - t.deepEqual( + t.same( JSON.parse(result), { removed: true, @@ -503,7 +501,7 @@ t.test('team rm <scope:team> <user>', t => { if (err) throw err - t.deepEqual(result, '', 'should not output rm result if silent') + t.same(result, '', 'should not output rm result if silent') t.end() }) }) diff --git a/deps/npm/test/lib/test.js b/deps/npm/test/lib/test.js index f6f3d7afb858d6..c151b1e825343f 100644 --- a/deps/npm/test/lib/test.js +++ b/deps/npm/test/lib/test.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') let RUN_ARGS = null const npm = { commands: { @@ -9,7 +8,7 @@ const npm = { }, }, } -const Test = requireInject('../../lib/test.js') +const Test = require('../../lib/test.js') const test = new Test(npm) t.test('run a test', t => { diff --git a/deps/npm/test/lib/token.js b/deps/npm/test/lib/token.js index 3ca44ab5c90c66..94218824d8f744 100644 --- a/deps/npm/test/lib/token.js +++ b/deps/npm/test/lib/token.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const mocks = { profile: {}, @@ -11,7 +10,7 @@ const npm = { output: (...args) => mocks.output(...args), } -const Token = requireInject('../../lib/token.js', { +const Token = t.mock('../../lib/token.js', { '../../lib/utils/otplease.js': (opts, fn) => { return Promise.resolve().then(() => fn(opts)) }, @@ -53,7 +52,7 @@ const tokenWithMocks = (mockRequests) => { return [token, reset] } -test('completion', (t) => { +t.test('completion', (t) => { t.plan(5) const testComp = (argv, expect) => { @@ -71,7 +70,7 @@ test('completion', (t) => { ) }) -test('token foobar', (t) => { +t.test('token foobar', (t) => { t.plan(2) const [, reset] = tokenWithMocks({ @@ -84,14 +83,14 @@ test('token foobar', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['foobar'], (err) => { t.match(err.message, 'foobar is not a recognized subcommand') }) }) -test('token list', (t) => { +t.test('token list', (t) => { t.plan(15) const now = new Date().toISOString() @@ -152,14 +151,14 @@ test('token list', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec([], (err) => { - t.ifError(err, 'npm token list') + t.error(err, 'npm token list') }) }) -test('token list json output', (t) => { +t.test('token list json output', (t) => { t.plan(8) const now = new Date().toISOString() @@ -206,14 +205,14 @@ test('token list json output', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['list'], (err) => { - t.ifError(err, 'npm token list') + t.error(err, 'npm token list') }) }) -test('token list parseable output', (t) => { +t.test('token list parseable output', (t) => { t.plan(12) const now = new Date().toISOString() @@ -274,14 +273,14 @@ test('token list parseable output', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['list'], (err) => { - t.ifError(err, 'npm token list') + t.error(err, 'npm token list') }) }) -test('token revoke', (t) => { +t.test('token revoke', (t) => { t.plan(10) const [token, reset] = tokenWithMocks({ @@ -327,14 +326,14 @@ test('token revoke', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['rm', 'abcd'], (err) => { - t.ifError(err, 'npm token rm') + t.error(err, 'npm token rm') }) }) -test('token revoke multiple tokens', (t) => { +t.test('token revoke multiple tokens', (t) => { t.plan(10) const [token, reset] = tokenWithMocks({ @@ -379,14 +378,14 @@ test('token revoke multiple tokens', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['revoke', 'abcd', 'efgh'], (err) => { - t.ifError(err, 'npm token rm') + t.error(err, 'npm token rm') }) }) -test('token revoke json output', (t) => { +t.test('token revoke json output', (t) => { t.plan(10) const [token, reset] = tokenWithMocks({ @@ -431,14 +430,14 @@ test('token revoke json output', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['delete', 'abcd'], (err) => { - t.ifError(err, 'npm token rm') + t.error(err, 'npm token rm') }) }) -test('token revoke parseable output', (t) => { +t.test('token revoke parseable output', (t) => { t.plan(9) const [token, reset] = tokenWithMocks({ @@ -481,14 +480,14 @@ test('token revoke parseable output', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['remove', 'abcd'], (err) => { - t.ifError(err, 'npm token rm') + t.error(err, 'npm token rm') }) }) -test('token revoke by token', (t) => { +t.test('token revoke by token', (t) => { t.plan(9) const [token, reset] = tokenWithMocks({ @@ -531,14 +530,14 @@ test('token revoke by token', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['rm', 'efgh5678'], (err) => { - t.ifError(err, 'npm token rm') + t.error(err, 'npm token rm') }) }) -test('token revoke requires an id', (t) => { +t.test('token revoke requires an id', (t) => { t.plan(2) const [token, reset] = tokenWithMocks({ @@ -551,14 +550,14 @@ test('token revoke requires an id', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['rm'], (err) => { t.match(err.message, '`<tokenKey>` argument is required') }) }) -test('token revoke ambiguous id errors', (t) => { +t.test('token revoke ambiguous id errors', (t) => { t.plan(7) const [token, reset] = tokenWithMocks({ @@ -596,14 +595,14 @@ test('token revoke ambiguous id errors', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['rm', 'abcd'], (err) => { t.match(err.message, 'Token ID "abcd" was ambiguous') }) }) -test('token revoke unknown id errors', (t) => { +t.test('token revoke unknown id errors', (t) => { t.plan(7) const [token, reset] = tokenWithMocks({ @@ -640,14 +639,14 @@ test('token revoke unknown id errors', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['rm', 'efgh'], (err) => { t.match(err.message, 'Unknown token id or value "efgh".') }) }) -test('token create', (t) => { +t.test('token create', (t) => { t.plan(15) const now = new Date().toISOString() @@ -704,14 +703,14 @@ test('token create', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['create'], (err) => { - t.ifError(err, 'npm token create') + t.error(err, 'npm token create') }) }) -test('token create json output', (t) => { +t.test('token create json output', (t) => { t.plan(10) const now = new Date().toISOString() @@ -763,14 +762,14 @@ test('token create json output', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['create'], (err) => { - t.ifError(err, 'npm token create') + t.error(err, 'npm token create') }) }) -test('token create parseable output', (t) => { +t.test('token create parseable output', (t) => { t.plan(12) const now = new Date().toISOString() @@ -829,14 +828,14 @@ test('token create parseable output', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['create'], (err) => { - t.ifError(err, 'npm token create') + t.error(err, 'npm token create') }) }) -test('token create ipv6 cidr', (t) => { +t.test('token create ipv6 cidr', (t) => { t.plan(4) const password = 'thisisnotreallyapassword' @@ -863,7 +862,7 @@ test('token create ipv6 cidr', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['create'], (err) => { t.equal(err.message, 'CIDR whitelist can only contain IPv4 addresses, ::1/128 is IPv6', 'returns correct error') @@ -871,7 +870,7 @@ test('token create ipv6 cidr', (t) => { }) }) -test('token create invalid cidr', (t) => { +t.test('token create invalid cidr', (t) => { t.plan(4) const password = 'thisisnotreallyapassword' @@ -898,7 +897,7 @@ test('token create invalid cidr', (t) => { }, }) - t.tearDown(reset) + t.teardown(reset) token.exec(['create'], (err) => { t.equal(err.message, 'CIDR whitelist contains invalid CIDR entry: apple/cider', 'returns correct error') diff --git a/deps/npm/test/lib/uninstall.js b/deps/npm/test/lib/uninstall.js index 589191ea28e6bc..8cf35bd428d3b7 100644 --- a/deps/npm/test/lib/uninstall.js +++ b/deps/npm/test/lib/uninstall.js @@ -1,7 +1,6 @@ const fs = require('fs') const { resolve } = require('path') const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const npm = mockNpm({ @@ -16,16 +15,15 @@ const mocks = { '../../lib/utils/reify-finish.js': () => Promise.resolve(), } -const Uninstall = requireInject('../../lib/uninstall.js', mocks) +const Uninstall = t.mock('../../lib/uninstall.js', mocks) const uninstall = new Uninstall(npm) -t.afterEach(cb => { +t.afterEach(() => { npm.globalDir = '' npm.prefix = '' npm.localPrefix = '' npm.flatOptions.global = false npm.flatOptions.prefix = '' - cb() }) t.test('remove single installed lib', t => { @@ -231,7 +229,7 @@ t.test('no args global but no package.json', t => { t.test('unknown error reading from localPrefix package.json', t => { const path = t.testdir({}) - const Uninstall = requireInject('../../lib/uninstall.js', { + const Uninstall = t.mock('../../lib/uninstall.js', { ...mocks, 'read-package-json-fast': () => Promise.reject(new Error('ERR')), }) diff --git a/deps/npm/test/lib/unpublish.js b/deps/npm/test/lib/unpublish.js index ba99b533030733..9af7242f29787c 100644 --- a/deps/npm/test/lib/unpublish.js +++ b/deps/npm/test/lib/unpublish.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') let result = '' @@ -28,12 +27,11 @@ const mocks = { '../../lib/utils/get-identity.js': async () => 'foo', } -t.afterEach(cb => { +t.afterEach(() => { result = '' config.force = false config.loglevel = 'silly' config.silent = false - cb() }) t.test('no args --force', t => { @@ -66,7 +64,7 @@ t.test('no args --force', t => { const libnpmpublish = { unpublish (spec, opts) { t.equal(spec, 'pkg@1.0.0', 'should unpublish expected spec') - t.deepEqual( + t.same( opts, { publishConfig: undefined, @@ -76,7 +74,7 @@ t.test('no args --force', t => { }, } - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, npmlog, libnpmpublish, @@ -103,7 +101,7 @@ t.test('no args --force', t => { t.test('no args --force missing package.json', t => { config.force = true - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, 'read-package-json': (path, cb) => cb(Object.assign( new Error('ENOENT'), @@ -125,7 +123,7 @@ t.test('no args --force missing package.json', t => { t.test('no args --force unknown error reading package.json', t => { config.force = true - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, 'read-package-json': (path, cb) => cb(new Error('ERR')), }) @@ -142,7 +140,7 @@ t.test('no args --force unknown error reading package.json', t => { }) t.test('no args', t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, }) const unpublish = new Unpublish(npm) @@ -158,7 +156,7 @@ t.test('no args', t => { }) t.test('too many args', t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, }) const unpublish = new Unpublish(npm) @@ -197,7 +195,7 @@ t.test('unpublish <pkg>@version', t => { const libnpmpublish = { unpublish (spec, opts) { t.equal(spec, pa, 'should unpublish expected parsed spec') - t.deepEqual( + t.same( opts, {}, 'should unpublish with expected opts' @@ -205,7 +203,7 @@ t.test('unpublish <pkg>@version', t => { }, } - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, npmlog, libnpmpublish, @@ -235,7 +233,7 @@ t.test('no version found in package.json', t => { npa.resolve = () => '' - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, 'npm-package-arg': npa, 'read-package-json': (path, cb) => cb(null, { @@ -260,7 +258,7 @@ t.test('no version found in package.json', t => { t.test('unpublish <pkg> --force no version set', t => { config.force = true - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, 'npm-package-arg': () => ({ name: 'pkg', @@ -294,7 +292,7 @@ t.test('silent', t => { npa.resolve = () => '' - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, 'npm-package-arg': npa, }) @@ -323,7 +321,7 @@ t.test('completion', async t => { } t.test('completing with multiple versions from the registry', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, libnpmaccess: { async lsPackages () { @@ -361,7 +359,7 @@ t.test('completion', async t => { }) t.test('no versions retrieved', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, libnpmaccess: { async lsPackages () { @@ -394,7 +392,7 @@ t.test('completion', async t => { }) t.test('packages starting with same letters', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, libnpmaccess: { async lsPackages () { @@ -422,7 +420,7 @@ t.test('completion', async t => { }) t.test('no packages retrieved', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, libnpmaccess: { async lsPackages () { @@ -442,7 +440,7 @@ t.test('completion', async t => { }) t.test('no pkg name to complete', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, libnpmaccess: { async lsPackages () { @@ -465,7 +463,7 @@ t.test('completion', async t => { }) t.test('no pkg names retrieved from user account', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, libnpmaccess: { async lsPackages () { @@ -485,7 +483,7 @@ t.test('completion', async t => { }) t.test('logged out user', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', { + const Unpublish = t.mock('../../lib/unpublish.js', { ...mocks, '../../lib/utils/get-identity.js': () => Promise.reject(new Error('ERR')), }) @@ -500,7 +498,7 @@ t.test('completion', async t => { }) t.test('too many args', async t => { - const Unpublish = requireInject('../../lib/unpublish.js', mocks) + const Unpublish = t.mock('../../lib/unpublish.js', mocks) const unpublish = new Unpublish(npm) await testComp(t, { diff --git a/deps/npm/test/lib/unstar.js b/deps/npm/test/lib/unstar.js index 3f3487176d9950..8b853230a6c8b4 100644 --- a/deps/npm/test/lib/unstar.js +++ b/deps/npm/test/lib/unstar.js @@ -1,4 +1,3 @@ -const requireInject = require('require-inject') const t = require('tap') t.test('unstar', t => { @@ -10,11 +9,11 @@ t.test('unstar', t => { } exec (args, cb) { - t.deepEqual(args, ['pkg'], 'should forward packages') + t.same(args, ['pkg'], 'should forward packages') cb() } } - const Unstar = requireInject('../../lib/unstar.js', { + const Unstar = t.mock('../../lib/unstar.js', { '../../lib/star.js': Star, }) diff --git a/deps/npm/test/lib/update.js b/deps/npm/test/lib/update.js index 780484afbeb03e..5396397d520cf9 100644 --- a/deps/npm/test/lib/update.js +++ b/deps/npm/test/lib/update.js @@ -1,6 +1,5 @@ const { resolve } = require('path') const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') const config = { @@ -23,11 +22,10 @@ const mocks = { '../../lib/utils/usage.js': () => 'usage instructions', } -t.afterEach(cb => { +t.afterEach(() => { npm.prefix = '' config.global = false npm.globalDir = '' - cb() }) t.test('no args', t => { @@ -37,7 +35,7 @@ t.test('no args', t => { class Arborist { constructor (args) { - t.deepEqual( + t.same( args, { ...npm.flatOptions, path: npm.prefix, log: noop }, 'should call arborist contructor with expected args' @@ -49,10 +47,10 @@ t.test('no args', t => { } } - const Update = requireInject('../../lib/update.js', { + const Update = t.mock('../../lib/update.js', { ...mocks, '../../lib/utils/reify-finish.js': (npm, arb) => { - t.isLike(arb, Arborist, 'should reify-finish with arborist instance') + t.match(arb, Arborist, 'should reify-finish with arborist instance') }, '@npmcli/arborist': Arborist, }) @@ -71,7 +69,7 @@ t.test('with args', t => { class Arborist { constructor (args) { - t.deepEqual( + t.same( args, { ...npm.flatOptions, path: npm.prefix, log: noop }, 'should call arborist contructor with expected args' @@ -79,14 +77,14 @@ t.test('with args', t => { } reify ({ update }) { - t.deepEqual(update, ['ipt'], 'should update listed deps') + t.same(update, ['ipt'], 'should update listed deps') } } - const Update = requireInject('../../lib/update.js', { + const Update = t.mock('../../lib/update.js', { ...mocks, '../../lib/utils/reify-finish.js': (npm, arb) => { - t.isLike(arb, Arborist, 'should reify-finish with arborist instance') + t.match(arb, Arborist, 'should reify-finish with arborist instance') }, '@npmcli/arborist': Arborist, }) @@ -104,7 +102,7 @@ t.test('update --depth=<number>', t => { npm.prefix = '/project/a' config.depth = 1 - const Update = requireInject('../../lib/update.js', { + const Update = t.mock('../../lib/update.js', { ...mocks, npmlog: { warn: (title, msg) => { @@ -139,7 +137,7 @@ t.test('update --global', t => { class Arborist { constructor (args) { const { path, ...opts } = args - t.deepEqual( + t.same( opts, { ...npm.flatOptions, log: noop }, 'should call arborist contructor with expected options' @@ -155,7 +153,7 @@ t.test('update --global', t => { reify () {} } - const Update = requireInject('../../lib/update.js', { + const Update = t.mock('../../lib/update.js', { ...mocks, '@npmcli/arborist': Arborist, }) diff --git a/deps/npm/test/lib/utils/audit-error.js b/deps/npm/test/lib/utils/audit-error.js index d236f4f9e9eaf3..c683053cbf7871 100644 --- a/deps/npm/test/lib/utils/audit-error.js +++ b/deps/npm/test/lib/utils/audit-error.js @@ -13,11 +13,10 @@ const npm = { }, output, } -t.afterEach(cb => { +t.afterEach(() => { npm.flatOptions = {} OUTPUT.length = 0 LOGS.length = 0 - cb() }) t.test('no error, not audit command', t => { diff --git a/deps/npm/test/lib/utils/cleanup-log-files.js b/deps/npm/test/lib/utils/cleanup-log-files.js index 7af0633fe715dd..61240b7b523dea 100644 --- a/deps/npm/test/lib/utils/cleanup-log-files.js +++ b/deps/npm/test/lib/utils/cleanup-log-files.js @@ -1,10 +1,9 @@ const t = require('tap') -const requireInject = require('require-inject') const glob = require('glob') const rimraf = require('rimraf') const mocks = { glob, rimraf } -const cleanup = requireInject('../../../lib/utils/cleanup-log-files.js', { +const cleanup = t.mock('../../../lib/utils/cleanup-log-files.js', { glob: (...args) => mocks.glob(...args), rimraf: (...args) => mocks.rimraf(...args), }) diff --git a/deps/npm/test/lib/utils/completion/installed-deep.js b/deps/npm/test/lib/utils/completion/installed-deep.js index 0e80a5a1983da7..ba14798bbec18f 100644 --- a/deps/npm/test/lib/utils/completion/installed-deep.js +++ b/deps/npm/test/lib/utils/completion/installed-deep.js @@ -1,6 +1,5 @@ const { resolve } = require('path') -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') let prefix let globalDir = 'MISSING_GLOBAL_DIR' @@ -12,7 +11,7 @@ const _flatOptions = { }, } const p = '../../../../lib/utils/completion/installed-deep.js' -const installedDeep = requireInject(p) +const installedDeep = require(p) const npm = { flatOptions: _flatOptions, get prefix () { @@ -144,7 +143,7 @@ const globalFixture = { }, } -test('get list of package names', async t => { +t.test('get list of package names', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -154,7 +153,7 @@ test('get list of package names', async t => { globalDir = resolve(fix, 'global/node_modules') const res = await installedDeep(npm, null) - t.deepEqual( + t.same( res, [ ['bar', '-g'], @@ -169,7 +168,7 @@ test('get list of package names', async t => { t.end() }) -test('get list of package names as global', async t => { +t.test('get list of package names as global', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -181,7 +180,7 @@ test('get list of package names as global', async t => { _flatOptions.global = true const res = await installedDeep(npm, null) - t.deepEqual( + t.same( res, [ 'bar', @@ -194,7 +193,7 @@ test('get list of package names as global', async t => { t.end() }) -test('limit depth', async t => { +t.test('limit depth', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -206,7 +205,7 @@ test('limit depth', async t => { _flatOptions.depth = 0 const res = await installedDeep(npm, null) - t.deepEqual( + t.same( res, [ ['bar', '-g'], @@ -222,7 +221,7 @@ test('limit depth', async t => { t.end() }) -test('limit depth as global', async t => { +t.test('limit depth as global', async t => { const fix = t.testdir({ local: fixture, global: globalFixture, @@ -235,7 +234,7 @@ test('limit depth as global', async t => { _flatOptions.depth = 0 const res = await installedDeep(npm, null) - t.deepEqual( + t.same( res, [ 'bar', diff --git a/deps/npm/test/lib/utils/completion/installed-shallow.js b/deps/npm/test/lib/utils/completion/installed-shallow.js index 1067a50acd4bb5..1445cbf2ffb71a 100644 --- a/deps/npm/test/lib/utils/completion/installed-shallow.js +++ b/deps/npm/test/lib/utils/completion/installed-shallow.js @@ -1,11 +1,10 @@ -const requireInject = require('require-inject') const flatOptions = { global: false } const npm = { flatOptions } const t = require('tap') const { resolve } = require('path') const p = '../../../../lib/utils/completion/installed-shallow.js' -const installed = requireInject(p) +const installed = require(p) t.test('global not set, include globals with -g', async t => { const dir = t.testdir({ diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js index 0b80b34d55771d..f735223655f505 100644 --- a/deps/npm/test/lib/utils/config/definitions.js +++ b/deps/npm/test/lib/utils/config/definitions.js @@ -1,6 +1,5 @@ const t = require('tap') -const requireInject = require('require-inject') const { resolve } = require('path') // have to fake the node version, or else it'll only pass on this one @@ -30,9 +29,9 @@ t.equal(definitions['node-version'].default, process.version, 'node-version defa t.test('basic flattening function camelCases from css-case', t => { const flat = {} - const obj = { 'always-auth': true } - definitions['always-auth'].flatten('always-auth', obj, flat) - t.strictSame(flat, { alwaysAuth: true }) + const obj = { 'prefer-online': true } + definitions['prefer-online'].flatten('prefer-online', obj, flat) + t.strictSame(flat, { preferOnline: true }) t.end() }) @@ -40,25 +39,25 @@ t.test('editor', t => { t.test('has EDITOR and VISUAL, use EDITOR', t => { process.env.EDITOR = 'vim' process.env.VISUAL = 'mate' - const defs = requireInject(defpath) + const defs = t.mock(defpath) t.equal(defs.editor.default, 'vim') t.end() }) t.test('has VISUAL but no EDITOR, use VISUAL', t => { delete process.env.EDITOR process.env.VISUAL = 'mate' - const defs = requireInject(defpath) + const defs = t.mock(defpath) t.equal(defs.editor.default, 'mate') t.end() }) t.test('has neither EDITOR nor VISUAL, system specific', t => { delete process.env.EDITOR delete process.env.VISUAL - const defsWin = requireInject(defpath, { + const defsWin = t.mock(defpath, { [isWin]: true, }) t.equal(defsWin.editor.default, 'notepad.exe') - const defsNix = requireInject(defpath, { + const defsNix = t.mock(defpath, { [isWin]: false, }) t.equal(defsNix.editor.default, 'vi') @@ -70,12 +69,12 @@ t.test('editor', t => { t.test('shell', t => { t.test('windows, env.ComSpec then cmd.exe', t => { process.env.ComSpec = 'command.com' - const defsComSpec = requireInject(defpath, { + const defsComSpec = t.mock(defpath, { [isWin]: true, }) t.equal(defsComSpec.shell.default, 'command.com') delete process.env.ComSpec - const defsNoComSpec = requireInject(defpath, { + const defsNoComSpec = t.mock(defpath, { [isWin]: true, }) t.equal(defsNoComSpec.shell.default, 'cmd') @@ -84,12 +83,12 @@ t.test('shell', t => { t.test('nix, SHELL then sh', t => { process.env.SHELL = '/usr/local/bin/bash' - const defsShell = requireInject(defpath, { + const defsShell = t.mock(defpath, { [isWin]: false, }) t.equal(defsShell.shell.default, '/usr/local/bin/bash') delete process.env.SHELL - const defsNoShell = requireInject(defpath, { + const defsNoShell = t.mock(defpath, { [isWin]: false, }) t.equal(defsNoShell.shell.default, 'sh') @@ -108,7 +107,7 @@ t.test('local-address allowed types', t => { eth69: [{ address: 'no place like home' }], }), } - const defs = requireInject(defpath, { os }) + const defs = t.mock(defpath, { os }) t.same(defs['local-address'].type, [ null, '127.0.0.1', @@ -123,7 +122,7 @@ t.test('local-address allowed types', t => { throw new Error('no network interfaces for some reason') }, } - const defs = requireInject(defpath, { os }) + const defs = t.mock(defpath, { os }) t.same(defs['local-address'].type, [null]) t.end() }) @@ -138,42 +137,42 @@ t.test('unicode allowed?', t => { process.env.LC_CTYPE = 'UTF-8' process.env.LANG = 'Unicode utf-8' - const lcAll = requireInject(defpath) + const lcAll = t.mock(defpath) t.equal(lcAll.unicode.default, true) process.env.LC_ALL = 'no unicode for youUUUU!' - const noLcAll = requireInject(defpath) + const noLcAll = t.mock(defpath) t.equal(noLcAll.unicode.default, false) delete process.env.LC_ALL - const lcCtype = requireInject(defpath) + const lcCtype = t.mock(defpath) t.equal(lcCtype.unicode.default, true) process.env.LC_CTYPE = 'something other than unicode version 8' - const noLcCtype = requireInject(defpath) + const noLcCtype = t.mock(defpath) t.equal(noLcCtype.unicode.default, false) delete process.env.LC_CTYPE - const lang = requireInject(defpath) + const lang = t.mock(defpath) t.equal(lang.unicode.default, true) process.env.LANG = 'ISO-8859-1' - const noLang = requireInject(defpath) + const noLang = t.mock(defpath) t.equal(noLang.unicode.default, false) t.end() }) t.test('cache', t => { process.env.LOCALAPPDATA = 'app/data/local' - const defsWinLocalAppData = requireInject(defpath, { + const defsWinLocalAppData = t.mock(defpath, { [isWin]: true, }) t.equal(defsWinLocalAppData.cache.default, 'app/data/local/npm-cache') delete process.env.LOCALAPPDATA - const defsWinNoLocalAppData = requireInject(defpath, { + const defsWinNoLocalAppData = t.mock(defpath, { [isWin]: true, }) t.equal(defsWinNoLocalAppData.cache.default, '~/npm-cache') - const defsNix = requireInject(defpath, { + const defsNix = t.mock(defpath, { [isWin]: false, }) t.equal(defsNix.cache.default, '~/.npm') @@ -236,7 +235,7 @@ t.test('flatteners that populate flat.omit array', t => { t.strictSame(flat, { omit: ['optional'] }, 'do not omit what is included') process.env.NODE_ENV = 'production' - const defProdEnv = requireInject(defpath) + const defProdEnv = t.mock(defpath) t.strictSame(defProdEnv.omit.default, ['dev'], 'omit dev in production') t.end() }) @@ -388,15 +387,15 @@ t.test('color', t => { t.strictSame(flat, {color: true}, '--color turns on color when stdout is tty') delete process.env.NO_COLOR - const defsAllowColor = requireInject(defpath) + const defsAllowColor = t.mock(defpath) t.equal(defsAllowColor.color.default, true, 'default true when no NO_COLOR env') process.env.NO_COLOR = '0' - const defsNoColor0 = requireInject(defpath) + const defsNoColor0 = t.mock(defpath) t.equal(defsNoColor0.color.default, true, 'default true when no NO_COLOR=0') process.env.NO_COLOR = '1' - const defsNoColor1 = requireInject(defpath) + const defsNoColor1 = t.mock(defpath) t.equal(defsNoColor1.color.default, false, 'default false when no NO_COLOR=1') t.end() @@ -695,7 +694,7 @@ YYYY\r }) t.test('error other than ENOENT gets thrown', t => { const poo = new Error('poo') - const defnReadFileThrows = requireInject(defpath, { + const defnReadFileThrows = t.mock(defpath, { fs: { ...require('fs'), readFileSync: () => { @@ -711,10 +710,10 @@ YYYY\r }) t.test('detect CI', t => { - const defnNoCI = requireInject(defpath, { + const defnNoCI = t.mock(defpath, { '@npmcli/ci-detect': () => false, }) - const defnCIFoo = requireInject(defpath, { + const defnCIFoo = t.mock(defpath, { '@npmcli/ci-detect': () => 'foo', }) t.equal(defnNoCI['ci-name'].default, null, 'null when not in CI') diff --git a/deps/npm/test/lib/utils/did-you-mean.js b/deps/npm/test/lib/utils/did-you-mean.js index 68893a800fda45..15712b665be6eb 100644 --- a/deps/npm/test/lib/utils/did-you-mean.js +++ b/deps/npm/test/lib/utils/did-you-mean.js @@ -1,6 +1,5 @@ const t = require('tap') -const requireInject = require('require-inject') -const npm = requireInject('../../../lib/npm.js') +const npm = require('../../../lib/npm.js') const dym = require('../../../lib/utils/did-you-mean.js') t.test('did-you-mean', t => { diff --git a/deps/npm/test/lib/utils/error-handler.js b/deps/npm/test/lib/utils/error-handler.js index b1d3e2ca7ca1a5..a00bac76e11c2b 100644 --- a/deps/npm/test/lib/utils/error-handler.js +++ b/deps/npm/test/lib/utils/error-handler.js @@ -1,7 +1,6 @@ /* eslint-disable no-extend-native */ /* eslint-disable no-global-assign */ const EventEmitter = require('events') -const requireInject = require('require-inject') const t = require('tap') // NOTE: Although these unit tests may look like the rest on the surface, @@ -105,6 +104,7 @@ process = Object.assign( cb() } }, stderr: { write () {} }, + hrtime: _process.hrtime, } ) // needs to put process back in its place @@ -124,8 +124,7 @@ const mocks = { '../../../lib/utils/cache-file.js': cacheFile, } -requireInject.installGlobally('../../../lib/utils/error-handler.js', mocks) -let errorHandler = require('../../../lib/utils/error-handler.js') +let errorHandler = t.mock('../../../lib/utils/error-handler.js', mocks) t.test('default exit code', (t) => { t.plan(1) @@ -226,7 +225,7 @@ t.test('console.log output using --json', (t) => { const _error = console.error console.error = (jsonOutput) => { - t.deepEqual( + t.same( JSON.parse(jsonOutput), { error: { @@ -258,7 +257,7 @@ t.test('throw a non-error obj', (t) => { const _logError = npmlog.error npmlog.error = (title, err) => { t.equal(title, 'weird error', 'should name it a weird error') - t.deepEqual(err, weirdError, 'should log given weird error') + t.same(err, weirdError, 'should log given weird error') } const _exit = process.exit @@ -282,7 +281,7 @@ t.test('throw a string error', (t) => { const _logError = npmlog.error npmlog.error = (title, err) => { t.equal(title, '', 'should have an empty name ref') - t.deepEqual(err, 'foo bar', 'should log string error') + t.same(err, 'foo bar', 'should log string error') } const _exit = process.exit @@ -372,9 +371,7 @@ t.test('it worked', (t) => { t.test('uses code from errno', (t) => { t.plan(1) - // RESET MODULE INTERNAL VARS AND GLOBAL REFS - requireInject.installGlobally.andClearCache('../../../lib/utils/error-handler.js', mocks) - errorHandler = require('../../../lib/utils/error-handler.js') + errorHandler = t.mock('../../../lib/utils/error-handler.js', mocks) npmlog.level = 'silent' const _exit = process.exit @@ -398,12 +395,7 @@ t.test('uses code from errno', (t) => { t.test('uses exitCode as code if using a number', (t) => { t.plan(1) - // RESET MODULE INTERNAL VARS AND GLOBAL REFS - requireInject.installGlobally.andClearCache( - '../../../lib/utils/error-handler.js', - mocks - ) - errorHandler = require('../../../lib/utils/error-handler.js') + errorHandler = t.mock('../../../lib/utils/error-handler.js', mocks) npmlog.level = 'silent' const _exit = process.exit @@ -427,12 +419,7 @@ t.test('uses exitCode as code if using a number', (t) => { t.test('call errorHandler with no error', (t) => { t.plan(1) - // RESET MODULE INTERNAL VARS AND GLOBAL REFS - requireInject.installGlobally.andClearCache( - '../../../lib/utils/error-handler.js', - mocks - ) - errorHandler = require('../../../lib/utils/error-handler.js') + errorHandler = t.mock('../../../lib/utils/error-handler.js', mocks) const _exit = process.exit process.exit = (code) => { @@ -490,12 +477,7 @@ t.test('defaults to log error msg if stack is missing', (t) => { t.test('set it worked', (t) => { t.plan(1) - // RESET MODULE INTERNAL VARS AND GLOBAL REFS - requireInject.installGlobally.andClearCache( - '../../../lib/utils/error-handler.js', - mocks - ) - errorHandler = require('../../../lib/utils/error-handler.js') + errorHandler = t.mock('../../../lib/utils/error-handler.js', mocks) const _exit = process.exit process.exit = () => { @@ -550,10 +532,7 @@ t.test('do no fancy handling for shellouts', t => { t.equal(code, EXPECT_EXIT, 'got expected exit code') EXPECT_EXIT = 0 } - t.beforeEach((cb) => { - LOG_RECORD.length = 0 - cb() - }) + t.beforeEach(() => LOG_RECORD.length = 0) const loudNoises = () => LOG_RECORD .filter(({ level }) => ['warn', 'error'].includes(level)) diff --git a/deps/npm/test/lib/utils/error-message.js b/deps/npm/test/lib/utils/error-message.js index 86db7c94bad496..7529aac2d4a4b7 100644 --- a/deps/npm/test/lib/utils/error-message.js +++ b/deps/npm/test/lib/utils/error-message.js @@ -10,22 +10,6 @@ Object.defineProperty(process, 'arch', { configurable: true, }) -const beWindows = () => { - Object.defineProperty(process, 'platform', { - value: 'win32', - configurable: true, - }) - delete require.cache[require.resolve('../../../lib/utils/is-windows.js')] -} - -const bePosix = () => { - Object.defineProperty(process, 'platform', { - value: 'posix', - configurable: true, - }) - delete require.cache[require.resolve('../../../lib/utils/is-windows.js')] -} - const { resolve } = require('path') const npm = require('../../../lib/npm.js') const CACHE = '/some/cache/dir' @@ -56,16 +40,36 @@ npmlog.verbose = (...message) => { verboseLogs.push(message) } -const requireInject = require('require-inject') const EXPLAIN_CALLED = [] -const errorMessage = requireInject('../../../lib/utils/error-message.js', { +const mocks = { '../../../lib/utils/explain-eresolve.js': { report: (...args) => { EXPLAIN_CALLED.push(args) return 'explanation' }, }, -}) + '../../../lib/npm.js': require('../../../lib/npm.js'), + get '../../../lib/utils/is-windows.js' () { + return process.platform === 'win32' + }, +} +let errorMessage = t.mock('../../../lib/utils/error-message.js', { ...mocks }) + +const beWindows = () => { + Object.defineProperty(process, 'platform', { + value: 'win32', + configurable: true, + }) + errorMessage = t.mock('../../../lib/utils/error-message.js', { ...mocks }) +} + +const bePosix = () => { + Object.defineProperty(process, 'platform', { + value: 'posix', + configurable: true, + }) + errorMessage = t.mock('../../../lib/utils/error-message.js', { ...mocks }) +} t.test('just simple messages', t => { npm.command = 'audit' diff --git a/deps/npm/test/lib/utils/explain-dep.js b/deps/npm/test/lib/utils/explain-dep.js index 1fee6105081e95..cab4d7b59a3e6f 100644 --- a/deps/npm/test/lib/utils/explain-dep.js +++ b/deps/npm/test/lib/utils/explain-dep.js @@ -1,7 +1,6 @@ const t = require('tap') -const requireInject = require('require-inject') const npm = {} -const { explainNode, printNode } = requireInject('../../../lib/utils/explain-dep.js', { +const { explainNode, printNode } = t.mock('../../../lib/utils/explain-dep.js', { '../../../lib/npm.js': npm, }) diff --git a/deps/npm/test/lib/utils/explain-eresolve.js b/deps/npm/test/lib/utils/explain-eresolve.js index 8dae1b92cd514f..90795bb4470b25 100644 --- a/deps/npm/test/lib/utils/explain-eresolve.js +++ b/deps/npm/test/lib/utils/explain-eresolve.js @@ -1,7 +1,6 @@ const t = require('tap') -const requireInject = require('require-inject') const npm = {} -const { explain, report } = requireInject('../../../lib/utils/explain-eresolve.js', { +const { explain, report } = t.mock('../../../lib/utils/explain-eresolve.js', { '../../../lib/npm.js': npm, }) const { statSync, readFileSync, unlinkSync } = require('fs') diff --git a/deps/npm/test/lib/utils/file-exists.js b/deps/npm/test/lib/utils/file-exists.js index 473a4b050edef2..c8edf4d968a0f2 100644 --- a/deps/npm/test/lib/utils/file-exists.js +++ b/deps/npm/test/lib/utils/file-exists.js @@ -1,7 +1,7 @@ -const { test } = require('tap') +const t = require('tap') const fileExists = require('../../../lib/utils/file-exists.js') -test('returns true when arg is a file', async (t) => { +t.test('returns true when arg is a file', async (t) => { const path = t.testdir({ foo: 'just some file', }) @@ -11,7 +11,7 @@ test('returns true when arg is a file', async (t) => { t.end() }) -test('returns false when arg is not a file', async (t) => { +t.test('returns false when arg is not a file', async (t) => { const path = t.testdir({ foo: {}, }) @@ -21,7 +21,7 @@ test('returns false when arg is not a file', async (t) => { t.end() }) -test('returns false when arg does not exist', async (t) => { +t.test('returns false when arg does not exist', async (t) => { const path = t.testdir() const result = await fileExists(`${path}/foo`) diff --git a/deps/npm/test/lib/utils/get-identity.js b/deps/npm/test/lib/utils/get-identity.js index cc713b3378166d..5e6de9ca9cfee9 100644 --- a/deps/npm/test/lib/utils/get-identity.js +++ b/deps/npm/test/lib/utils/get-identity.js @@ -1,9 +1,8 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') -test('throws ENOREGISTRY when no registry option is provided', async (t) => { +t.test('throws ENOREGISTRY when no registry option is provided', async (t) => { t.plan(2) - const getIdentity = requireInject('../../../lib/utils/get-identity.js') + const getIdentity = t.mock('../../../lib/utils/get-identity.js') try { await getIdentity({}) @@ -13,10 +12,10 @@ test('throws ENOREGISTRY when no registry option is provided', async (t) => { } }) -test('returns username from uri when provided', async (t) => { +t.test('returns username from uri when provided', async (t) => { t.plan(1) - const getIdentity = requireInject('../../../lib/utils/get-identity.js') + const getIdentity = t.mock('../../../lib/utils/get-identity.js') const npm = { config: { getCredentialsByURI: () => { @@ -29,7 +28,7 @@ test('returns username from uri when provided', async (t) => { t.equal(identity, 'foo', 'returns username from uri') }) -test('calls registry whoami when token is provided', async (t) => { +t.test('calls registry whoami when token is provided', async (t) => { t.plan(3) const options = { @@ -37,7 +36,7 @@ test('calls registry whoami when token is provided', async (t) => { token: 'thisisnotreallyatoken', } - const getIdentity = requireInject('../../../lib/utils/get-identity.js', { + const getIdentity = t.mock('../../../lib/utils/get-identity.js', { 'npm-registry-fetch': { json: (path, opts) => { t.equal(path, '/-/whoami', 'calls whoami') @@ -56,7 +55,7 @@ test('calls registry whoami when token is provided', async (t) => { t.equal(identity, 'foo', 'fetched username from registry') }) -test('throws ENEEDAUTH when response does not include a username', async (t) => { +t.test('throws ENEEDAUTH when response does not include a username', async (t) => { t.plan(3) const options = { @@ -64,7 +63,7 @@ test('throws ENEEDAUTH when response does not include a username', async (t) => token: 'thisisnotreallyatoken', } - const getIdentity = requireInject('../../../lib/utils/get-identity.js', { + const getIdentity = t.mock('../../../lib/utils/get-identity.js', { 'npm-registry-fetch': { json: (path, opts) => { t.equal(path, '/-/whoami', 'calls whoami') @@ -86,9 +85,9 @@ test('throws ENEEDAUTH when response does not include a username', async (t) => } }) -test('throws ENEEDAUTH when neither username nor token is configured', async (t) => { +t.test('throws ENEEDAUTH when neither username nor token is configured', async (t) => { t.plan(1) - const getIdentity = requireInject('../../../lib/utils/get-identity.js', { + const getIdentity = t.mock('../../../lib/utils/get-identity.js', { }) const npm = { config: { diff --git a/deps/npm/test/lib/utils/npm-usage.js b/deps/npm/test/lib/utils/npm-usage.js index ebf637ae1cfb71..f846a01109d2f2 100644 --- a/deps/npm/test/lib/utils/npm-usage.js +++ b/deps/npm/test/lib/utils/npm-usage.js @@ -2,11 +2,10 @@ const t = require('tap') const npm = require('../../../lib/npm.js') t.test('usage', t => { - t.afterEach((cb) => { + t.afterEach(() => { npm.config.set('viewer', null) npm.config.set('long', false) npm.config.set('userconfig', '/some/config/file/.npmrc') - cb() }) const { dirname } = require('path') const basedir = dirname(dirname(dirname(__dirname))) diff --git a/deps/npm/test/lib/utils/open-url.js b/deps/npm/test/lib/utils/open-url.js index 781b70d3e8d313..a31a8cb6867dfd 100644 --- a/deps/npm/test/lib/utils/open-url.js +++ b/deps/npm/test/lib/utils/open-url.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const OUTPUT = [] const output = (...args) => OUTPUT.push(args) @@ -26,11 +25,11 @@ const opener = (url, opts, cb) => { return cb(openerResult) } -const openUrl = requireInject('../../../lib/utils/open-url.js', { +const openUrl = t.mock('../../../lib/utils/open-url.js', { opener, }) -test('opens a url', async (t) => { +t.test('opens a url', async (t) => { t.teardown(() => { openerUrl = null openerOpts = null @@ -42,7 +41,7 @@ test('opens a url', async (t) => { t.same(OUTPUT, [], 'printed no output') }) -test('returns error for non-https and non-file url', async (t) => { +t.test('returns error for non-https and non-file url', async (t) => { t.teardown(() => { openerUrl = null openerOpts = null @@ -52,10 +51,10 @@ test('returns error for non-https and non-file url', async (t) => { t.equal(openerUrl, null, 'did not open') t.same(openerOpts, null, 'did not open') t.same(OUTPUT, [], 'printed no output') - t.done() + t.end() }) -test('returns error for non-parseable url', async (t) => { +t.test('returns error for non-parseable url', async (t) => { t.teardown(() => { openerUrl = null openerOpts = null @@ -65,10 +64,10 @@ test('returns error for non-parseable url', async (t) => { t.equal(openerUrl, null, 'did not open') t.same(openerOpts, null, 'did not open') t.same(OUTPUT, [], 'printed no output') - t.done() + t.end() }) -test('opens a url with the given browser', async (t) => { +t.test('opens a url with the given browser', async (t) => { npm.config.set('browser', 'chrome') t.teardown(() => { openerUrl = null @@ -80,10 +79,10 @@ test('opens a url with the given browser', async (t) => { t.equal(openerUrl, 'https://www.npmjs.com', 'opened the given url') t.same(openerOpts, { command: 'chrome' }, 'passed the given browser as command') t.same(OUTPUT, [], 'printed no output') - t.done() + t.end() }) -test('prints where to go when browser is disabled', async (t) => { +t.test('prints where to go when browser is disabled', async (t) => { npm.config.set('browser', false) t.teardown(() => { openerUrl = null @@ -97,10 +96,10 @@ test('prints where to go when browser is disabled', async (t) => { t.equal(OUTPUT.length, 1, 'got one logged message') t.equal(OUTPUT[0].length, 1, 'logged message had one value') t.matchSnapshot(OUTPUT[0][0], 'printed expected message') - t.done() + t.end() }) -test('prints where to go when browser is disabled and json is enabled', async (t) => { +t.test('prints where to go when browser is disabled and json is enabled', async (t) => { npm.config.set('browser', false) npm.config.set('json', true) t.teardown(() => { @@ -116,10 +115,10 @@ test('prints where to go when browser is disabled and json is enabled', async (t t.equal(OUTPUT.length, 1, 'got one logged message') t.equal(OUTPUT[0].length, 1, 'logged message had one value') t.matchSnapshot(OUTPUT[0][0], 'printed expected message') - t.done() + t.end() }) -test('prints where to go when given browser does not exist', async (t) => { +t.test('prints where to go when given browser does not exist', async (t) => { npm.config.set('browser', 'firefox') openerResult = Object.assign(new Error('failed'), { code: 'ENOENT' }) t.teardown(() => { @@ -134,10 +133,10 @@ test('prints where to go when given browser does not exist', async (t) => { t.equal(OUTPUT.length, 1, 'got one logged message') t.equal(OUTPUT[0].length, 1, 'logged message had one value') t.matchSnapshot(OUTPUT[0][0], 'printed expected message') - t.done() + t.end() }) -test('handles unknown opener error', async (t) => { +t.test('handles unknown opener error', async (t) => { npm.config.set('browser', 'firefox') openerResult = Object.assign(new Error('failed'), { code: 'ENOBRIAN' }) t.teardown(() => { @@ -147,5 +146,5 @@ test('handles unknown opener error', async (t) => { npm.config.set('browser', true) }) t.rejects(openUrl(npm, 'https://www.npmjs.com', 'npm home'), 'failed', 'got the correct error') - t.done() + t.end() }) diff --git a/deps/npm/test/lib/utils/otplease.js b/deps/npm/test/lib/utils/otplease.js index 048856b4857707..fb9476120e2df3 100644 --- a/deps/npm/test/lib/utils/otplease.js +++ b/deps/npm/test/lib/utils/otplease.js @@ -1,15 +1,14 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const readUserInfo = { otp: async () => '1234', } -const otplease = requireInject('../../../lib/utils/otplease.js', { +const otplease = t.mock('../../../lib/utils/otplease.js', { '../../../lib/utils/read-user-info.js': readUserInfo, }) -test('prompts for otp for EOTP', async (t) => { +t.test('prompts for otp for EOTP', async (t) => { const stdinTTY = process.stdin.isTTY const stdoutTTY = process.stdout.isTTY process.stdin.isTTY = true @@ -26,13 +25,13 @@ test('prompts for otp for EOTP', async (t) => { t.equal(opts.some, 'prop', 'carried original options') t.equal(opts.otp, '1234', 'received the otp') - t.done() + t.end() } await otplease({ some: 'prop' }, fn) }) -test('prompts for otp for 401', async (t) => { +t.test('prompts for otp for 401', async (t) => { const stdinTTY = process.stdin.isTTY const stdoutTTY = process.stdout.isTTY process.stdin.isTTY = true @@ -53,13 +52,13 @@ test('prompts for otp for 401', async (t) => { t.equal(opts.some, 'prop', 'carried original options') t.equal(opts.otp, '1234', 'received the otp') - t.done() + t.end() } await otplease({ some: 'prop' }, fn) }) -test('does not prompt for non-otp errors', async (t) => { +t.test('does not prompt for non-otp errors', async (t) => { const stdinTTY = process.stdin.isTTY const stdoutTTY = process.stdout.isTTY process.stdin.isTTY = true @@ -76,7 +75,7 @@ test('does not prompt for non-otp errors', async (t) => { t.rejects(otplease({ some: 'prop' }, fn), { message: 'nope' }, 'rejects with the original error') }) -test('does not prompt if stdin or stdout is not a tty', async (t) => { +t.test('does not prompt if stdin or stdout is not a tty', async (t) => { const stdinTTY = process.stdin.isTTY const stdoutTTY = process.stdout.isTTY process.stdin.isTTY = false diff --git a/deps/npm/test/lib/utils/path.js b/deps/npm/test/lib/utils/path.js index 74fb93462f7553..0a7846d94bc67c 100644 --- a/deps/npm/test/lib/utils/path.js +++ b/deps/npm/test/lib/utils/path.js @@ -1,13 +1,12 @@ const t = require('tap') -const requireInject = require('require-inject') const mod = '../../../lib/utils/path.js' const delim = require('../../../lib/utils/is-windows.js') ? ';' : ':' Object.defineProperty(process, 'env', { value: {}, }) process.env.path = ['foo', 'bar', 'baz'].join(delim) -t.strictSame(requireInject(mod), ['foo', 'bar', 'baz']) +t.strictSame(t.mock(mod), ['foo', 'bar', 'baz']) process.env.Path = ['a', 'b', 'c'].join(delim) -t.strictSame(requireInject(mod), ['a', 'b', 'c']) +t.strictSame(t.mock(mod), ['a', 'b', 'c']) process.env.PATH = ['x', 'y', 'z'].join(delim) -t.strictSame(requireInject(mod), ['x', 'y', 'z']) +t.strictSame(t.mock(mod), ['x', 'y', 'z']) diff --git a/deps/npm/test/lib/utils/ping.js b/deps/npm/test/lib/utils/ping.js index 6e0451538f9fac..1bebfa69d2b78d 100644 --- a/deps/npm/test/lib/utils/ping.js +++ b/deps/npm/test/lib/utils/ping.js @@ -1,12 +1,11 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') -test('pings', async (t) => { +t.test('pings', async (t) => { t.plan(3) const options = { fake: 'options' } const response = { some: 'details' } - const ping = requireInject('../../../lib/utils/ping.js', { + const ping = t.mock('../../../lib/utils/ping.js', { 'npm-registry-fetch': (url, opts) => { t.equal(url, '/-/ping?write=true', 'calls the correct url') t.equal(opts, options, 'passes through options') @@ -18,12 +17,12 @@ test('pings', async (t) => { t.match(res, response, 'returns json response') }) -test('catches errors and returns empty json', async (t) => { +t.test('catches errors and returns empty json', async (t) => { t.plan(3) const options = { fake: 'options' } const response = { some: 'details' } - const ping = requireInject('../../../lib/utils/ping.js', { + const ping = t.mock('../../../lib/utils/ping.js', { 'npm-registry-fetch': (url, opts) => { t.equal(url, '/-/ping?write=true', 'calls the correct url') t.equal(opts, options, 'passes through options') diff --git a/deps/npm/test/lib/utils/proc-log-listener.js b/deps/npm/test/lib/utils/proc-log-listener.js index 2c1009503762d5..d580defa8a98f2 100644 --- a/deps/npm/test/lib/utils/proc-log-listener.js +++ b/deps/npm/test/lib/utils/proc-log-listener.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const { inspect } = require('util') const logs = [] @@ -8,7 +7,7 @@ const npmlog = { verbose: (...args) => logs.push(['verbose', ...args]), } -requireInject('../../../lib/utils/proc-log-listener.js', { +t.mock('../../../lib/utils/proc-log-listener.js', { npmlog, })() diff --git a/deps/npm/test/lib/utils/pulse-till-done.js b/deps/npm/test/lib/utils/pulse-till-done.js index 16c2d521dad082..c1d7902c0684a9 100644 --- a/deps/npm/test/lib/utils/pulse-till-done.js +++ b/deps/npm/test/lib/utils/pulse-till-done.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') let pulseStarted = null const npmlog = { @@ -11,11 +10,11 @@ const npmlog = { }, } -const pulseTillDone = requireInject('../../../lib/utils/pulse-till-done.js', { +const pulseTillDone = t.mock('../../../lib/utils/pulse-till-done.js', { npmlog, }) -test('pulses (with promise)', async (t) => { +t.test('pulses (with promise)', async (t) => { t.teardown(() => { pulseStarted = null }) diff --git a/deps/npm/test/lib/utils/read-local-package.js b/deps/npm/test/lib/utils/read-local-package.js index 4b693afb48b8ea..966e74a7ab7f4c 100644 --- a/deps/npm/test/lib/utils/read-local-package.js +++ b/deps/npm/test/lib/utils/read-local-package.js @@ -1,5 +1,4 @@ -const requireInject = require('require-inject') -const { test } = require('tap') +const t = require('tap') const mockNpm = require('../../fixtures/mock-npm') const config = { @@ -8,9 +7,9 @@ const config = { } const npm = mockNpm({ config }) -const readLocalPackageName = requireInject('../../../lib/utils/read-local-package.js') +const readLocalPackageName = require('../../../lib/utils/read-local-package.js') -test('read local package.json', async (t) => { +t.test('read local package.json', async (t) => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: 'my-local-package', @@ -25,7 +24,7 @@ test('read local package.json', async (t) => { ) }) -test('read local scoped-package.json', async (t) => { +t.test('read local scoped-package.json', async (t) => { npm.prefix = t.testdir({ 'package.json': JSON.stringify({ name: '@my-scope/my-local-package', @@ -40,7 +39,7 @@ test('read local scoped-package.json', async (t) => { ) }) -test('read using --global', async (t) => { +t.test('read using --global', async (t) => { npm.prefix = t.testdir({}) config.global = true const packageName = await readLocalPackageName(npm) diff --git a/deps/npm/test/lib/utils/read-user-info.js b/deps/npm/test/lib/utils/read-user-info.js index 99d85d66c4feb6..5d937ff78a551c 100644 --- a/deps/npm/test/lib/utils/read-user-info.js +++ b/deps/npm/test/lib/utils/read-user-info.js @@ -1,5 +1,4 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') let readOpts = null let readResult = null @@ -28,13 +27,13 @@ const npmUserValidate = { }, } -const readUserInfo = requireInject('../../../lib/utils/read-user-info.js', { +const readUserInfo = t.mock('../../../lib/utils/read-user-info.js', { read, npmlog, 'npm-user-validate': npmUserValidate, }) -test('otp', async (t) => { +t.test('otp', async (t) => { readResult = '1234' t.teardown(() => { readResult = null @@ -44,7 +43,7 @@ test('otp', async (t) => { t.equal(result, '1234', 'received the otp') }) -test('password', async (t) => { +t.test('password', async (t) => { readResult = 'password' t.teardown(() => { readResult = null @@ -57,7 +56,7 @@ test('password', async (t) => { }, 'got the correct options') }) -test('username', async (t) => { +t.test('username', async (t) => { readResult = 'username' t.teardown(() => { readResult = null @@ -67,7 +66,7 @@ test('username', async (t) => { t.equal(result, 'username', 'received the username') }) -test('username - invalid warns and retries', async (t) => { +t.test('username - invalid warns and retries', async (t) => { readResult = 'invalid' t.teardown(() => { readResult = null @@ -87,7 +86,7 @@ test('username - invalid warns and retries', async (t) => { t.equal(logMsg, 'invalid username') }) -test('email', async (t) => { +t.test('email', async (t) => { readResult = 'foo@bar.baz' t.teardown(() => { readResult = null @@ -97,7 +96,7 @@ test('email', async (t) => { t.equal(result, 'foo@bar.baz', 'received the email') }) -test('email - invalid warns and retries', async (t) => { +t.test('email - invalid warns and retries', async (t) => { readResult = 'invalid@bar.baz' t.teardown(() => { readResult = null diff --git a/deps/npm/test/lib/utils/reify-finish.js b/deps/npm/test/lib/utils/reify-finish.js index 7ff5146a6bdbf6..bbe8a3d99021d4 100644 --- a/deps/npm/test/lib/utils/reify-finish.js +++ b/deps/npm/test/lib/utils/reify-finish.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') const npm = { config: { @@ -30,7 +29,7 @@ const fs = { }, } -const reifyFinish = requireInject('../../../lib/utils/reify-finish.js', { +const reifyFinish = t.mock('../../../lib/utils/reify-finish.js', { fs, '../../../lib/utils/reify-output.js': reifyOutput, }) @@ -79,7 +78,7 @@ t.test('should write if everything above passes', async t => { }) t.test('works without fs.promises', async t => { - t.doesNotThrow(() => requireInject('../../../lib/utils/reify-finish.js', { + t.doesNotThrow(() => t.mock('../../../lib/utils/reify-finish.js', { fs: { ...fs, promises: null }, '../../../lib/npm.js': npm, '../../../lib/utils/reify-output.js': reifyOutput, diff --git a/deps/npm/test/lib/utils/reify-output.js b/deps/npm/test/lib/utils/reify-output.js index e4f58b4668e050..2142566b90dea6 100644 --- a/deps/npm/test/lib/utils/reify-output.js +++ b/deps/npm/test/lib/utils/reify-output.js @@ -15,7 +15,7 @@ const npm = { const reifyOutput = require('../../../lib/utils/reify-output.js') t.test('missing info', (t) => { t.plan(1) - npm.output = out => t.doesNotHave( + npm.output = out => t.notMatch( out, 'looking for funding', 'should not print fund message if missing info' @@ -33,7 +33,7 @@ t.test('missing info', (t) => { t.test('even more missing info', t => { t.plan(1) - npm.output = out => t.doesNotHave( + npm.output = out => t.notMatch( out, 'looking for funding', 'should not print fund message if missing info' diff --git a/deps/npm/test/lib/utils/replace-info.js b/deps/npm/test/lib/utils/replace-info.js index ea9f06520d0a77..e4b83783a55a70 100644 --- a/deps/npm/test/lib/utils/replace-info.js +++ b/deps/npm/test/lib/utils/replace-info.js @@ -49,7 +49,7 @@ t.equal( 'should replace single item within a phrase' ) -t.deepEqual( +t.same( replaceInfo([ 'Something https://user:pass@registry.npmjs.org/ foo bar', 'http://foo:bar@registry.npmjs.org', @@ -63,7 +63,7 @@ t.deepEqual( 'should replace single item within a phrase' ) -t.deepEqual( +t.same( replaceInfo([ 'Something https://user:pass@registry.npmjs.org/ foo bar', null, diff --git a/deps/npm/test/lib/utils/setup-log.js b/deps/npm/test/lib/utils/setup-log.js index 4398200abe22c0..3daf3b8a52f53c 100644 --- a/deps/npm/test/lib/utils/setup-log.js +++ b/deps/npm/test/lib/utils/setup-log.js @@ -1,14 +1,12 @@ const t = require('tap') -const requireInject = require('require-inject') const settings = { level: 'warn', } -t.afterEach(cb => { +t.afterEach(() => { Object.keys(settings).forEach(k => { delete settings[k] }) - cb() }) const WARN_CALLED = [] @@ -61,7 +59,7 @@ const npmlog = { } const EXPLAIN_CALLED = [] -const setupLog = requireInject('../../../lib/utils/setup-log.js', { +const setupLog = t.mock('../../../lib/utils/setup-log.js', { '../../../lib/utils/explain-eresolve.js': { explain: (...args) => { EXPLAIN_CALLED.push(args) diff --git a/deps/npm/test/lib/utils/split-package-names.js b/deps/npm/test/lib/utils/split-package-names.js index c69bb2a3dab8cb..82b8f5578397ff 100644 --- a/deps/npm/test/lib/utils/split-package-names.js +++ b/deps/npm/test/lib/utils/split-package-names.js @@ -1,9 +1,9 @@ 'use strict' -const { test } = require('tap') +const t = require('tap') const splitPackageNames = require('../../../lib/utils/split-package-names.js') -test('splitPackageNames', t => { +t.test('splitPackageNames', t => { const assertions = [ ['semver', 'semver'], ['read-pkg/semver', 'read-pkg/node_modules/semver'], diff --git a/deps/npm/test/lib/utils/tar.js b/deps/npm/test/lib/utils/tar.js index d9b8c5584a61b8..5758442fcb6f69 100644 --- a/deps/npm/test/lib/utils/tar.js +++ b/deps/npm/test/lib/utils/tar.js @@ -1,7 +1,6 @@ -const { test } = require('tap') +const t = require('tap') const pack = require('libnpmpack') const ssri = require('ssri') -const requireInject = require('require-inject') const { logTar, getContents } = require('../../../lib/utils/tar.js') @@ -18,7 +17,7 @@ const printLogs = (tarball, unicode) => { return logs.join('\n') } -test('should log tarball contents', async (t) => { +t.test('should log tarball contents', async (t) => { const testDir = t.testdir({ 'package.json': JSON.stringify({ name: 'my-cool-pkg', @@ -42,8 +41,8 @@ test('should log tarball contents', async (t) => { t.matchSnapshot(printLogs(tarballContents, false)) }) -test('should log tarball contents with unicode', async (t) => { - const { logTar } = requireInject('../../../lib/utils/tar.js', { +t.test('should log tarball contents with unicode', async (t) => { + const { logTar } = t.mock('../../../lib/utils/tar.js', { npmlog: { notice: (str) => { t.ok(true, 'defaults to npmlog') @@ -60,8 +59,8 @@ test('should log tarball contents with unicode', async (t) => { t.end() }) -test('should default to npmlog', async (t) => { - const { logTar } = requireInject('../../../lib/utils/tar.js', { +t.test('should default to npmlog', async (t) => { + const { logTar } = t.mock('../../../lib/utils/tar.js', { npmlog: { notice: (str) => { t.ok(true, 'defaults to npmlog') @@ -78,7 +77,7 @@ test('should default to npmlog', async (t) => { t.end() }) -test('should getContents of a tarball', async (t) => { +t.test('should getContents of a tarball', async (t) => { const testDir = t.testdir({ 'package.json': JSON.stringify({ name: 'my-cool-pkg', diff --git a/deps/npm/test/lib/utils/unsupported.js b/deps/npm/test/lib/utils/unsupported.js index f14cba9b744adb..3a05d906660257 100644 --- a/deps/npm/test/lib/utils/unsupported.js +++ b/deps/npm/test/lib/utils/unsupported.js @@ -1,4 +1,4 @@ -const test = require('tap').test +const t = require('tap') const unsupported = require('../../../lib/utils/unsupported.js') const versions = [ @@ -33,20 +33,20 @@ const versions = [ ['v13.0.0-0', false, false], ] -test('versions', function (t) { +t.test('versions', function (t) { t.plan(versions.length * 2) versions.forEach(function (verinfo) { const version = verinfo[0] const broken = verinfo[1] const unsupp = verinfo[2] const nodejs = unsupported.checkVersion(version) - t.is(nodejs.broken, broken, version + ' ' + (broken ? '' : 'not ') + 'broken') - t.is(nodejs.unsupported, unsupp, version + ' ' + (unsupp ? 'unsupported' : 'supported')) + t.equal(nodejs.broken, broken, version + ' ' + (broken ? '' : 'not ') + 'broken') + t.equal(nodejs.unsupported, unsupp, version + ' ' + (unsupp ? 'unsupported' : 'supported')) }) - t.done() + t.end() }) -test('checkForBrokenNode', t => { +t.test('checkForBrokenNode', t => { // run it once to not fail unsupported.checkForBrokenNode() @@ -77,7 +77,7 @@ test('checkForBrokenNode', t => { unsupported.checkForBrokenNode() }) -test('checkForUnsupportedNode', t => { +t.test('checkForUnsupportedNode', t => { const npmlog = require('npmlog') const { warn } = npmlog const versionPropDesc = Object.getOwnPropertyDescriptor(process, 'version') diff --git a/deps/npm/test/lib/utils/update-notifier.js b/deps/npm/test/lib/utils/update-notifier.js index 99c9dfc26626f1..1735b31057b146 100644 --- a/deps/npm/test/lib/utils/update-notifier.js +++ b/deps/npm/test/lib/utils/update-notifier.js @@ -1,5 +1,4 @@ const t = require('tap') -const requireInject = require('require-inject') let ciMock = null const flatOptions = { global: false, cache: t.testdir() + '/_cacache' } @@ -52,6 +51,7 @@ let STAT_ERROR = null let STAT_MTIME = null let WRITE_ERROR = null const fs = { + ...require('fs'), stat: (path, cb) => { if (basename(path) !== '_update-notifier-last-checked') { console.error(new Error('should only write to notifier last checked file')) @@ -72,19 +72,18 @@ const fs = { }, } -const updateNotifier = requireInject('../../../lib/utils/update-notifier.js', { +const updateNotifier = t.mock('../../../lib/utils/update-notifier.js', { '@npmcli/ci-detect': () => ciMock, pacote, fs, }) -t.afterEach(cb => { +t.afterEach(() => { MANIFEST_REQUEST.length = 0 STAT_ERROR = null PACOTE_ERROR = null STAT_MTIME = null WRITE_ERROR = null - cb() }) t.test('situations in which we do not notify', t => { diff --git a/deps/npm/test/lib/version.js b/deps/npm/test/lib/version.js index 35d3d92cd2beeb..6a83375b0025c9 100644 --- a/deps/npm/test/lib/version.js +++ b/deps/npm/test/lib/version.js @@ -1,11 +1,11 @@ const t = require('tap') -const requireInject = require('require-inject') const mockNpm = require('../fixtures/mock-npm') let result = [] const noop = () => null const config = { + 'git-tag-version': true, 'tag-version-prefix': 'v', json: false, } @@ -22,16 +22,15 @@ const mocks = { libnpmversion: noop, } -const Version = requireInject('../../lib/version.js', mocks) +const Version = t.mock('../../lib/version.js', mocks) const version = new Version(npm) const _processVersions = process.versions -t.afterEach(cb => { +t.afterEach(() => { config.json = false npm.prefix = '' process.versions = _processVersions result = [] - cb() }) t.test('no args', t => { @@ -48,7 +47,7 @@ t.test('no args', t => { if (err) throw err - t.deepEqual( + t.same( result, [{ 'test-version-no-args': '3.2.1', @@ -103,7 +102,7 @@ t.test('failure reading package.json', t => { if (err) throw err - t.deepEqual( + t.same( result, [{ npm: '1.0.0', @@ -125,7 +124,7 @@ t.test('--json option', t => { version.exec([], err => { if (err) throw err - t.deepEqual( + t.same( result, ['{\n "npm": "1.0.0"\n}'], 'should return json stringified result' @@ -135,11 +134,11 @@ t.test('--json option', t => { }) t.test('with one arg', t => { - const Version = requireInject('../../lib/version.js', { + const Version = t.mock('../../lib/version.js', { ...mocks, libnpmversion: (arg, opts) => { t.equal(arg, 'major', 'should forward expected value') - t.deepEqual( + t.same( opts, { path: '', @@ -158,3 +157,174 @@ t.test('with one arg', t => { t.end() }) }) + +t.test('workspaces', t => { + t.teardown(() => { + npm.localPrefix = '' + npm.prefix = '' + }) + + t.test('no args, all workspaces', t => { + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: 'workspaces-test', + version: '1.0.0', + workspaces: ['workspace-a', 'workspace-b'], + }, null, 2), + 'workspace-a': { + 'package.json': JSON.stringify({ + name: 'workspace-a', + version: '1.0.0', + }), + }, + 'workspace-b': { + 'package.json': JSON.stringify({ + name: 'workspace-b', + version: '1.0.0', + }), + }, + }) + npm.localPrefix = testDir + npm.prefix = testDir + const version = new Version(npm) + version.execWorkspaces([], [], err => { + if (err) + throw err + t.same(result, [{ + 'workspaces-test': '1.0.0', + 'workspace-a': '1.0.0', + 'workspace-b': '1.0.0', + npm: '1.0.0', + }], 'outputs includes main package and workspace versions') + t.end() + }) + }) + + t.test('no args, single workspaces', t => { + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: 'workspaces-test', + version: '1.0.0', + workspaces: ['workspace-a', 'workspace-b'], + }, null, 2), + 'workspace-a': { + 'package.json': JSON.stringify({ + name: 'workspace-a', + version: '1.0.0', + }), + }, + 'workspace-b': { + 'package.json': JSON.stringify({ + name: 'workspace-b', + version: '1.0.0', + }), + }, + }) + npm.localPrefix = testDir + npm.prefix = testDir + const version = new Version(npm) + version.execWorkspaces([], ['workspace-a'], err => { + if (err) + throw err + t.same(result, [{ + 'workspaces-test': '1.0.0', + 'workspace-a': '1.0.0', + npm: '1.0.0', + }], 'outputs includes main package and requested workspace versions') + t.end() + }) + }) + + t.test('no args, all workspaces, workspace with missing name or version', t => { + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: 'workspaces-test', + version: '1.0.0', + workspaces: ['workspace-a', 'workspace-b', 'workspace-c'], + }, null, 2), + 'workspace-a': { + 'package.json': JSON.stringify({ + name: 'workspace-a', + version: '1.0.0', + }), + }, + 'workspace-b': { + 'package.json': JSON.stringify({ + name: 'workspace-b', + }), + }, + 'workspace-c': { + 'package.json': JSON.stringify({ + version: '1.0.0', + }), + }, + }) + npm.localPrefix = testDir + npm.prefix = testDir + const version = new Version(npm) + version.execWorkspaces([], [], err => { + if (err) + throw err + t.same(result, [{ + 'workspaces-test': '1.0.0', + 'workspace-a': '1.0.0', + npm: '1.0.0', + }], 'outputs includes main package and valid workspace versions') + t.end() + }) + }) + + t.test('with one arg, all workspaces', t => { + const libNpmVersionArgs = [] + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: 'workspaces-test', + version: '1.0.0', + workspaces: ['workspace-a', 'workspace-b'], + }, null, 2), + 'workspace-a': { + 'package.json': JSON.stringify({ + name: 'workspace-a', + version: '1.0.0', + }), + }, + 'workspace-b': { + 'package.json': JSON.stringify({ + name: 'workspace-b', + version: '1.0.0', + }), + }, + }) + const Version = t.mock('../../lib/version.js', { + ...mocks, + libnpmversion: (arg, opts) => { + libNpmVersionArgs.push([arg, opts]) + return '2.0.0' + }, + }) + npm.localPrefix = testDir + npm.prefix = testDir + const version = new Version(npm) + + version.execWorkspaces(['major'], [], err => { + if (err) + throw err + t.same(result, ['workspace-a', 'v2.0.0', 'workspace-b', 'v2.0.0'], 'outputs the new version for only the workspaces prefixed by the tagVersionPrefix') + t.end() + }) + }) + + t.test('too many args', t => { + version.execWorkspaces(['foo', 'bar'], [], err => { + t.match( + err, + 'npm version', + 'should throw usage instructions error' + ) + + t.end() + }) + }) + + t.end() +}) diff --git a/deps/npm/test/lib/view.js b/deps/npm/test/lib/view.js index 91ce18786b2186..eb2beb9ff5864b 100644 --- a/deps/npm/test/lib/view.js +++ b/deps/npm/test/lib/view.js @@ -1,16 +1,18 @@ const t = require('tap') -const requireInject = require('require-inject') + +// run the same as tap does when running directly with node +process.stdout.columns = undefined + const mockNpm = require('../fixtures/mock-npm') let logs -const cleanLogs = (done) => { +const cleanLogs = () => { logs = '' const fn = (...args) => { logs += '\n' args.map(el => logs += el) } console.log = fn - done() } const packument = (nv, opts) => { @@ -240,7 +242,7 @@ const packument = (nv, opts) => { t.beforeEach(cleanLogs) t.test('should log package info', t => { - const View = requireInject('../../lib/view.js', { + const View = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -250,7 +252,7 @@ t.test('should log package info', t => { }) const view = new View(npm) - const ViewJson = requireInject('../../lib/view.js', { + const ViewJson = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -260,7 +262,7 @@ t.test('should log package info', t => { }) const viewJson = new ViewJson(jsonNpm) - const ViewUnicode = requireInject('../../lib/view.js', { + const ViewUnicode = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -303,7 +305,7 @@ t.test('should log package info', t => { t.test('package with no versions', t => { view.exec(['brown'], () => { - t.equals(logs, '', 'no info to display') + t.equal(logs, '', 'no info to display') t.end() }) }) @@ -331,7 +333,7 @@ t.test('should log package info', t => { t.test('package with --json and no versions', t => { viewJson.exec(['brown'], () => { - t.equals(logs, '', 'no info to display') + t.equal(logs, '', 'no info to display') t.end() }) }) @@ -347,7 +349,7 @@ t.test('should log info of package in current working dir', t => { }, null, 2), }) - const View = requireInject('../../lib/view.js', { + const View = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -379,7 +381,7 @@ t.test('should log info of package in current working dir', t => { }) t.test('should log info by field name', t => { - const ViewJson = requireInject('../../lib/view.js', { + const ViewJson = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -393,7 +395,7 @@ t.test('should log info by field name', t => { const viewJson = new ViewJson(jsonNpm) - const View = requireInject('../../lib/view.js', { + const View = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -447,7 +449,7 @@ t.test('should log info by field name', t => { t.test('unknown nested field ', t => { view.exec(['yellow@1.0.0', 'dist.foobar'], () => { - t.equals(logs, '', 'no info to display') + t.equal(logs, '', 'no info to display') t.end() }) }) @@ -470,13 +472,13 @@ t.test('should log info by field name', t => { }) t.test('throw error if global mode', (t) => { - const View = requireInject('../../lib/view.js') + const View = t.mock('../../lib/view.js') const npm = mockNpm({ config: { global: true }, }) const view = new View(npm) view.exec([], (err) => { - t.equals(err.message, 'Cannot use view command in global mode.') + t.equal(err.message, 'Cannot use view command in global mode.') t.end() }) }) @@ -484,7 +486,7 @@ t.test('throw error if global mode', (t) => { t.test('throw ENOENT error if package.json misisng', (t) => { const testDir = t.testdir({}) - const View = requireInject('../../lib/view.js') + const View = t.mock('../../lib/view.js') const npm = mockNpm({ prefix: testDir, config: { global: false }, @@ -501,7 +503,7 @@ t.test('throw EJSONPARSE error if package.json not json', (t) => { 'package.json': 'not json, nope, not even a little bit!', }) - const View = requireInject('../../lib/view.js') + const View = t.mock('../../lib/view.js') const npm = mockNpm({ prefix: testDir, config: { global: false }, @@ -518,20 +520,20 @@ t.test('throw error if package.json has no name', (t) => { 'package.json': '{}', }) - const View = requireInject('../../lib/view.js') + const View = t.mock('../../lib/view.js') const npm = mockNpm({ prefix: testDir, config: { global: false }, }) const view = new View(npm) view.exec([], (err) => { - t.equals(err.message, 'Invalid package.json, no "name" field') + t.equal(err.message, 'Invalid package.json, no "name" field') t.end() }) }) t.test('throws when unpublished', (t) => { - const View = requireInject('../../lib/view.js', { + const View = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -544,16 +546,15 @@ t.test('throws when unpublished', (t) => { }) const view = new View(npm) view.exec(['red'], (err) => { - t.equals(err.code, 'E404') + t.equal(err.code, 'E404') t.end() }) }) t.test('workspaces', t => { - t.beforeEach((done) => { + t.beforeEach(() => { warnMsg = undefined config.json = false - done() }) const testDir = t.testdir({ 'package.json': JSON.stringify({ @@ -574,7 +575,7 @@ t.test('workspaces', t => { }), }, }) - const View = requireInject('../../lib/view.js', { + const View = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -675,7 +676,7 @@ t.test('workspaces', t => { }) t.test('completion', async t => { - const View = requireInject('../../lib/view.js', { + const View = t.mock('../../lib/view.js', { pacote: { packument, }, @@ -695,7 +696,7 @@ t.test('completion', async t => { }) t.test('no registry completion', async t => { - const View = requireInject('../../lib/view.js') + const View = t.mock('../../lib/view.js') const npm = mockNpm({ config: { tag: '1.0.1', diff --git a/deps/npm/test/lib/whoami.js b/deps/npm/test/lib/whoami.js index b242ea89414787..5e350a32ebfb4c 100644 --- a/deps/npm/test/lib/whoami.js +++ b/deps/npm/test/lib/whoami.js @@ -1,10 +1,9 @@ -const { test } = require('tap') -const requireInject = require('require-inject') +const t = require('tap') const mockNpm = require('../fixtures/mock-npm') -test('whoami', (t) => { +t.test('whoami', (t) => { t.plan(3) - const Whoami = requireInject('../../lib/whoami.js', { + const Whoami = t.mock('../../lib/whoami.js', { '../../lib/utils/get-identity.js': () => Promise.resolve('foo'), }) const npm = mockNpm({ @@ -17,14 +16,14 @@ test('whoami', (t) => { const whoami = new Whoami(npm) whoami.exec([], (err) => { - t.ifError(err, 'npm whoami') + t.error(err, 'npm whoami') t.ok('should successfully print username') }) }) -test('whoami json', (t) => { +t.test('whoami json', (t) => { t.plan(3) - const Whoami = requireInject('../../lib/whoami.js', { + const Whoami = t.mock('../../lib/whoami.js', { '../../lib/utils/get-identity.js': () => Promise.resolve('foo'), }) const npm = mockNpm({ @@ -36,7 +35,7 @@ test('whoami json', (t) => { const whoami = new Whoami(npm) whoami.exec([], (err) => { - t.ifError(err, 'npm whoami') + t.error(err, 'npm whoami') t.ok('should successfully print username as json') }) }) diff --git a/deps/npm/test/lib/workspaces/get-workspaces.js b/deps/npm/test/lib/workspaces/get-workspaces.js index ebed9dd35c519e..4ea055e02f8f23 100644 --- a/deps/npm/test/lib/workspaces/get-workspaces.js +++ b/deps/npm/test/lib/workspaces/get-workspaces.js @@ -77,7 +77,7 @@ t.test('get-workspaces', async t => { let workspaces workspaces = await getWorkspaces(['a', 'b'], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ a: '{PATH}/packages/a', @@ -87,7 +87,7 @@ t.test('get-workspaces', async t => { ) workspaces = await getWorkspaces(['./packages/c'], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ c: '{PATH}/packages/c', @@ -96,7 +96,7 @@ t.test('get-workspaces', async t => { ) workspaces = await getWorkspaces(['packages/c'], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ c: '{PATH}/packages/c', @@ -105,7 +105,7 @@ t.test('get-workspaces', async t => { ) workspaces = await getWorkspaces([resolve(path, 'packages/c')], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ c: '{PATH}/packages/c', @@ -114,7 +114,7 @@ t.test('get-workspaces', async t => { ) workspaces = await getWorkspaces(['packages'], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ a: '{PATH}/packages/a', @@ -128,7 +128,7 @@ t.test('get-workspaces', async t => { ) workspaces = await getWorkspaces(['./packages/'], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ a: '{PATH}/packages/a', @@ -142,7 +142,7 @@ t.test('get-workspaces', async t => { ) workspaces = await getWorkspaces([resolve(path, './packages')], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ a: '{PATH}/packages/a', @@ -156,7 +156,7 @@ t.test('get-workspaces', async t => { ) workspaces = await getWorkspaces([], { path }) - t.deepEqual( + t.same( clean(workspaces, path), new Map(Object.entries({ a: '{PATH}/packages/a', diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 42a9f29d89aa93..aa6d32302b3954 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -69,6 +69,7 @@ Ben Newman <ben@meteor.com> Ben Noordhuis <info@bnoordhuis.nl> Benjamin Tan <demoneaux@gmail.com> Bert Belder <bertbelder@gmail.com> +Brendon Tiszka <btiszka@gmail.com> Brice Dobry <brice.dobry@futurewei.com> Burcu Dogan <burcujdogan@gmail.com> Caitlin Potter <caitpotter88@gmail.com> diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 4826580f7b16aa..11a6c54ad72d0f 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 9 #define V8_MINOR_VERSION 0 #define V8_BUILD_NUMBER 257 -#define V8_PATCH_LEVEL 17 +#define V8_PATCH_LEVEL 24 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/ast/ast.cc b/deps/v8/src/ast/ast.cc index 9eddb14e613efe..fcc60f5f1337d1 100644 --- a/deps/v8/src/ast/ast.cc +++ b/deps/v8/src/ast/ast.cc @@ -935,6 +935,22 @@ Call::CallType Call::GetCallType() const { return OTHER_CALL; } +void Call::ComputeSpreadPosition() { + int arguments_length = arguments_.length(); + int first_spread_index = 0; + for (; first_spread_index < arguments_length; first_spread_index++) { + if (arguments_.at(first_spread_index)->IsSpread()) break; + } + SpreadPosition position; + if (first_spread_index == arguments_length - 1) { + position = kHasFinalSpread; + } else { + DCHECK_LT(first_spread_index, arguments_length - 1); + position = kHasNonFinalSpread; + } + bit_field_ |= SpreadPositionField::encode(position); +} + CaseClause::CaseClause(Zone* zone, Expression* label, const ScopedPtrList<Statement>& statements) : label_(label), statements_(statements.ToConstVector(), zone) {} diff --git a/deps/v8/src/ast/ast.h b/deps/v8/src/ast/ast.h index 50a0c55d4d7a04..e9744471acde56 100644 --- a/deps/v8/src/ast/ast.h +++ b/deps/v8/src/ast/ast.h @@ -1635,6 +1635,12 @@ class Call final : public Expression { return IsOptionalChainLinkField::decode(bit_field_); } + enum SpreadPosition { kNoSpread, kHasFinalSpread, kHasNonFinalSpread }; + SpreadPosition spread_position() const { + return SpreadPositionField::decode(bit_field_); + } + + // TODO(syg): Remove this and its users. bool only_last_arg_is_spread() { return !arguments_.is_empty() && arguments_.last()->IsSpread(); } @@ -1669,7 +1675,7 @@ class Call final : public Expression { friend Zone; Call(Zone* zone, Expression* expression, - const ScopedPtrList<Expression>& arguments, int pos, + const ScopedPtrList<Expression>& arguments, int pos, bool has_spread, PossiblyEval possibly_eval, bool optional_chain) : Expression(pos, kCall), expression_(expression), @@ -1677,7 +1683,9 @@ class Call final : public Expression { bit_field_ |= IsPossiblyEvalField::encode(possibly_eval == IS_POSSIBLY_EVAL) | IsTaggedTemplateField::encode(false) | - IsOptionalChainLinkField::encode(optional_chain); + IsOptionalChainLinkField::encode(optional_chain) | + SpreadPositionField::encode(kNoSpread); + if (has_spread) ComputeSpreadPosition(); } Call(Zone* zone, Expression* expression, @@ -1688,12 +1696,17 @@ class Call final : public Expression { arguments_(arguments.ToConstVector(), zone) { bit_field_ |= IsPossiblyEvalField::encode(false) | IsTaggedTemplateField::encode(true) | - IsOptionalChainLinkField::encode(false); + IsOptionalChainLinkField::encode(false) | + SpreadPositionField::encode(kNoSpread); } + // Only valid to be called if there is a spread in arguments_. + void ComputeSpreadPosition(); + using IsPossiblyEvalField = Expression::NextBitField<bool, 1>; using IsTaggedTemplateField = IsPossiblyEvalField::Next<bool, 1>; using IsOptionalChainLinkField = IsTaggedTemplateField::Next<bool, 1>; + using SpreadPositionField = IsOptionalChainLinkField::Next<SpreadPosition, 2>; Expression* expression_; ZonePtrList<Expression> arguments_; @@ -3064,11 +3077,12 @@ class AstNodeFactory final { Call* NewCall(Expression* expression, const ScopedPtrList<Expression>& arguments, int pos, + bool has_spread, Call::PossiblyEval possibly_eval = Call::NOT_EVAL, bool optional_chain = false) { DCHECK_IMPLIES(possibly_eval == Call::IS_POSSIBLY_EVAL, !optional_chain); - return zone_->New<Call>(zone_, expression, arguments, pos, possibly_eval, - optional_chain); + return zone_->New<Call>(zone_, expression, arguments, pos, has_spread, + possibly_eval, optional_chain); } Call* NewTaggedTemplate(Expression* expression, diff --git a/deps/v8/src/builtins/builtins-array.cc b/deps/v8/src/builtins/builtins-array.cc index 0c3707cee4bbb5..ea21a19a86f3bb 100644 --- a/deps/v8/src/builtins/builtins-array.cc +++ b/deps/v8/src/builtins/builtins-array.cc @@ -650,11 +650,14 @@ class ArrayConcatVisitor { index_offset_(0u), bit_field_(FastElementsField::encode(fast_elements) | ExceedsLimitField::encode(false) | - IsFixedArrayField::encode(storage->IsFixedArray()) | + IsFixedArrayField::encode(storage->IsFixedArray(isolate)) | HasSimpleElementsField::encode( - storage->IsFixedArray() || - !storage->map().IsCustomElementsReceiverMap())) { - DCHECK(!(this->fast_elements() && !is_fixed_array())); + storage->IsFixedArray(isolate) || + // Don't take fast path for storages that might have + // side effects when storing to them. + (!storage->map(isolate).IsCustomElementsReceiverMap() && + !storage->IsJSTypedArray(isolate)))) { + DCHECK_IMPLIES(this->fast_elements(), is_fixed_array()); } ~ArrayConcatVisitor() { clear_storage(); } @@ -1065,8 +1068,8 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver, return IterateElementsSlow(isolate, receiver, length, visitor); } - if (!HasOnlySimpleElements(isolate, *receiver) || - !visitor->has_simple_elements()) { + if (!visitor->has_simple_elements() || + !HasOnlySimpleElements(isolate, *receiver)) { return IterateElementsSlow(isolate, receiver, length, visitor); } Handle<JSObject> array = Handle<JSObject>::cast(receiver); @@ -1082,6 +1085,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver, case HOLEY_SEALED_ELEMENTS: case HOLEY_NONEXTENSIBLE_ELEMENTS: case HOLEY_ELEMENTS: { + // Disallow execution so the cached elements won't change mid execution. + DisallowJavascriptExecution no_js(isolate); + // Run through the elements FixedArray and use HasElement and GetElement // to check the prototype for missing elements. Handle<FixedArray> elements(FixedArray::cast(array->elements()), isolate); @@ -1108,6 +1114,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver, } case HOLEY_DOUBLE_ELEMENTS: case PACKED_DOUBLE_ELEMENTS: { + // Disallow execution so the cached elements won't change mid execution. + DisallowJavascriptExecution no_js(isolate); + // Empty array is FixedArray but not FixedDoubleArray. if (length == 0) break; // Run through the elements FixedArray and use HasElement and GetElement @@ -1144,6 +1153,9 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver, } case DICTIONARY_ELEMENTS: { + // Disallow execution so the cached dictionary won't change mid execution. + DisallowJavascriptExecution no_js(isolate); + Handle<NumberDictionary> dict(array->element_dictionary(), isolate); std::vector<uint32_t> indices; indices.reserve(dict->Capacity() / 2); diff --git a/deps/v8/src/compiler/js-call-reducer.cc b/deps/v8/src/compiler/js-call-reducer.cc index 4bca26bbe0801a..b1405938ffe5c5 100644 --- a/deps/v8/src/compiler/js-call-reducer.cc +++ b/deps/v8/src/compiler/js-call-reducer.cc @@ -5380,24 +5380,31 @@ Reduction JSCallReducer::ReduceArrayPrototypePop(Node* node) { } // Compute the new {length}. - length = graph()->NewNode(simplified()->NumberSubtract(), length, - jsgraph()->OneConstant()); + Node* new_length = graph()->NewNode(simplified()->NumberSubtract(), + length, jsgraph()->OneConstant()); + + // This extra check exists solely to break an exploitation technique + // that abuses typer mismatches. + new_length = efalse = graph()->NewNode( + simplified()->CheckBounds(p.feedback(), + CheckBoundsFlag::kAbortOnOutOfBounds), + new_length, length, efalse, if_false); // Store the new {length} to the {receiver}. efalse = graph()->NewNode( simplified()->StoreField(AccessBuilder::ForJSArrayLength(kind)), - receiver, length, efalse, if_false); + receiver, new_length, efalse, if_false); // Load the last entry from the {elements}. vfalse = efalse = graph()->NewNode( simplified()->LoadElement(AccessBuilder::ForFixedArrayElement(kind)), - elements, length, efalse, if_false); + elements, new_length, efalse, if_false); // Store a hole to the element we just removed from the {receiver}. efalse = graph()->NewNode( simplified()->StoreElement( AccessBuilder::ForFixedArrayElement(GetHoleyElementsKind(kind))), - elements, length, jsgraph()->TheHoleConstant(), efalse, if_false); + elements, new_length, jsgraph()->TheHoleConstant(), efalse, if_false); } control = graph()->NewNode(common()->Merge(2), if_true, if_false); @@ -5573,19 +5580,27 @@ Reduction JSCallReducer::ReduceArrayPrototypeShift(Node* node) { } // Compute the new {length}. - length = graph()->NewNode(simplified()->NumberSubtract(), length, - jsgraph()->OneConstant()); + Node* new_length = graph()->NewNode(simplified()->NumberSubtract(), + length, jsgraph()->OneConstant()); + + // This extra check exists solely to break an exploitation technique + // that abuses typer mismatches. + new_length = etrue1 = graph()->NewNode( + simplified()->CheckBounds(p.feedback(), + CheckBoundsFlag::kAbortOnOutOfBounds), + new_length, length, etrue1, if_true1); // Store the new {length} to the {receiver}. etrue1 = graph()->NewNode( simplified()->StoreField(AccessBuilder::ForJSArrayLength(kind)), - receiver, length, etrue1, if_true1); + receiver, new_length, etrue1, if_true1); // Store a hole to the element we just removed from the {receiver}. etrue1 = graph()->NewNode( simplified()->StoreElement(AccessBuilder::ForFixedArrayElement( GetHoleyElementsKind(kind))), - elements, length, jsgraph()->TheHoleConstant(), etrue1, if_true1); + elements, new_length, jsgraph()->TheHoleConstant(), etrue1, + if_true1); } Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); diff --git a/deps/v8/src/compiler/representation-change.cc b/deps/v8/src/compiler/representation-change.cc index 64b274cdccddf4..4bfaa1cceea98a 100644 --- a/deps/v8/src/compiler/representation-change.cc +++ b/deps/v8/src/compiler/representation-change.cc @@ -211,7 +211,10 @@ Node* RepresentationChanger::GetRepresentationFor( return GetFloat32RepresentationFor(node, output_rep, output_type, use_info.truncation()); case MachineRepresentation::kFloat64: - DCHECK_NE(TypeCheckKind::kBigInt, use_info.type_check()); + DCHECK(use_info.type_check() == TypeCheckKind::kNone || + use_info.type_check() == TypeCheckKind::kNumber || + use_info.type_check() == TypeCheckKind::kNumberOrBoolean || + use_info.type_check() == TypeCheckKind::kNumberOrOddball); return GetFloat64RepresentationFor(node, output_rep, output_type, use_node, use_info); case MachineRepresentation::kBit: @@ -727,15 +730,22 @@ Node* RepresentationChanger::GetFloat64RepresentationFor( } } else if (IsAnyTagged(output_rep)) { if (output_type.Is(Type::Undefined())) { - if (use_info.type_check() == TypeCheckKind::kNumberOrBoolean) { + if (use_info.type_check() == TypeCheckKind::kNumberOrOddball || + (use_info.type_check() == TypeCheckKind::kNone && + use_info.truncation().TruncatesOddballAndBigIntToNumber())) { + return jsgraph()->Float64Constant( + std::numeric_limits<double>::quiet_NaN()); + } else { + DCHECK(use_info.type_check() == TypeCheckKind::kNone || + use_info.type_check() == TypeCheckKind::kNumber || + use_info.type_check() == TypeCheckKind::kNumberOrBoolean); Node* unreachable = InsertUnconditionalDeopt( - use_node, DeoptimizeReason::kNotANumberOrBoolean); + use_node, use_info.type_check() == TypeCheckKind::kNumber + ? DeoptimizeReason::kNotANumber + : DeoptimizeReason::kNotANumberOrBoolean); return jsgraph()->graph()->NewNode( jsgraph()->common()->DeadValue(MachineRepresentation::kFloat64), unreachable); - } else { - return jsgraph()->Float64Constant( - std::numeric_limits<double>::quiet_NaN()); } } else if (output_rep == MachineRepresentation::kTaggedSigned) { node = InsertChangeTaggedSignedToInt32(node); @@ -747,12 +757,13 @@ Node* RepresentationChanger::GetFloat64RepresentationFor( output_type.Is(Type::NumberOrHole())) { // JavaScript 'null' is an Oddball that results in +0 when truncated to // Number. In a context like -0 == null, which must evaluate to false, - // this truncation must not happen. For this reason we restrict this case - // to when either the user explicitly requested a float (and thus wants - // +0 if null is the input) or we know from the types that the input can - // only be Number | Hole. The latter is necessary to handle the operator - // CheckFloat64Hole. We did not put in the type (Number | Oddball \ Null) - // to discover more bugs related to this conversion via crashes. + // this truncation must not happen. For this reason we restrict this + // case to when either the user explicitly requested a float (and thus + // wants +0 if null is the input) or we know from the types that the + // input can only be Number | Hole. The latter is necessary to handle + // the operator CheckFloat64Hole. We did not put in the type (Number | + // Oddball \ Null) to discover more bugs related to this conversion via + // crashes. op = simplified()->TruncateTaggedToFloat64(); } else if (use_info.type_check() == TypeCheckKind::kNumber || (use_info.type_check() == TypeCheckKind::kNumberOrOddball && @@ -949,10 +960,10 @@ Node* RepresentationChanger::GetWord32RepresentationFor( return node; } else if (output_rep == MachineRepresentation::kWord64) { if (output_type.Is(Type::Signed32()) || - output_type.Is(Type::Unsigned32())) { - op = machine()->TruncateInt64ToInt32(); - } else if (output_type.Is(cache_->kSafeInteger) && - use_info.truncation().IsUsedAsWord32()) { + (output_type.Is(Type::Unsigned32()) && + use_info.type_check() == TypeCheckKind::kNone) || + (output_type.Is(cache_->kSafeInteger) && + use_info.truncation().IsUsedAsWord32())) { op = machine()->TruncateInt64ToInt32(); } else if (use_info.type_check() == TypeCheckKind::kSignedSmall || use_info.type_check() == TypeCheckKind::kSigned32 || diff --git a/deps/v8/src/compiler/simplified-lowering.cc b/deps/v8/src/compiler/simplified-lowering.cc index 49df06a0ec2ce0..73c3e57c216d67 100644 --- a/deps/v8/src/compiler/simplified-lowering.cc +++ b/deps/v8/src/compiler/simplified-lowering.cc @@ -1420,17 +1420,31 @@ class RepresentationSelector { return jsgraph_->simplified(); } - void LowerToCheckedInt32Mul(Node* node, Truncation truncation, - Type input0_type, Type input1_type) { - // If one of the inputs is positive and/or truncation is being applied, - // there is no need to return -0. - CheckForMinusZeroMode mz_mode = - truncation.IdentifiesZeroAndMinusZero() || - IsSomePositiveOrderedNumber(input0_type) || - IsSomePositiveOrderedNumber(input1_type) - ? CheckForMinusZeroMode::kDontCheckForMinusZero - : CheckForMinusZeroMode::kCheckForMinusZero; - ChangeOp(node, simplified()->CheckedInt32Mul(mz_mode)); + template <Phase T> + void VisitForCheckedInt32Mul(Node* node, Truncation truncation, + Type input0_type, Type input1_type, + UseInfo input_use) { + DCHECK_EQ(node->opcode(), IrOpcode::kSpeculativeNumberMultiply); + // A -0 input is impossible or will cause a deopt. + DCHECK(BothInputsAre(node, Type::Signed32()) || + !input_use.truncation().IdentifiesZeroAndMinusZero()); + + CheckForMinusZeroMode mz_mode; + Type restriction; + if (IsSomePositiveOrderedNumber(input0_type) || + IsSomePositiveOrderedNumber(input1_type)) { + mz_mode = CheckForMinusZeroMode::kDontCheckForMinusZero; + restriction = Type::Signed32(); + } else if (truncation.IdentifiesZeroAndMinusZero()) { + mz_mode = CheckForMinusZeroMode::kDontCheckForMinusZero; + restriction = Type::Signed32OrMinusZero(); + } else { + mz_mode = CheckForMinusZeroMode::kCheckForMinusZero; + restriction = Type::Signed32(); + } + + VisitBinop<T>(node, input_use, MachineRepresentation::kWord32, restriction); + if (lower<T>()) ChangeOp(node, simplified()->CheckedInt32Mul(mz_mode)); } void ChangeToInt32OverflowOp(Node* node) { @@ -1474,10 +1488,15 @@ class RepresentationSelector { Type right_feedback_type = TypeOf(node->InputAt(1)); // Using Signed32 as restriction type amounts to promising there won't be - // signed overflow. This is incompatible with relying on a Word32 - // truncation in order to skip the overflow check. + // signed overflow. This is incompatible with relying on a Word32 truncation + // in order to skip the overflow check. Similarly, we must not drop -0 from + // the result type unless we deopt for -0 inputs. Type const restriction = - truncation.IsUsedAsWord32() ? Type::Any() : Type::Signed32(); + truncation.IsUsedAsWord32() + ? Type::Any() + : (truncation.identify_zeros() == kIdentifyZeros) + ? Type::Signed32OrMinusZero() + : Type::Signed32(); // Handle the case when no int32 checks on inputs are necessary (but // an overflow check is needed on the output). Note that we do not @@ -1613,12 +1632,22 @@ class RepresentationSelector { VisitBinop<T>(node, lhs_use, rhs_use, MachineRepresentation::kWord32); if (lower<T>()) DeferReplacement(node, lowering->Int32Mod(node)); } else if (BothInputsAre(node, Type::Unsigned32OrMinusZeroOrNaN())) { + Type const restriction = + truncation.IdentifiesZeroAndMinusZero() && + TypeOf(node->InputAt(0)).Maybe(Type::MinusZero()) + ? Type::Unsigned32OrMinusZero() + : Type::Unsigned32(); VisitBinop<T>(node, lhs_use, rhs_use, MachineRepresentation::kWord32, - Type::Unsigned32()); + restriction); if (lower<T>()) ChangeToUint32OverflowOp(node); } else { + Type const restriction = + truncation.IdentifiesZeroAndMinusZero() && + TypeOf(node->InputAt(0)).Maybe(Type::MinusZero()) + ? Type::Signed32OrMinusZero() + : Type::Signed32(); VisitBinop<T>(node, lhs_use, rhs_use, MachineRepresentation::kWord32, - Type::Signed32()); + restriction); if (lower<T>()) ChangeToInt32OverflowOp(node); } return; @@ -2249,22 +2278,16 @@ class RepresentationSelector { if (BothInputsAre(node, Type::Signed32())) { // If both inputs and feedback are int32, use the overflow op. if (hint == NumberOperationHint::kSignedSmall) { - VisitBinop<T>(node, UseInfo::TruncatingWord32(), - MachineRepresentation::kWord32, Type::Signed32()); - if (lower<T>()) { - LowerToCheckedInt32Mul(node, truncation, input0_type, - input1_type); - } + VisitForCheckedInt32Mul<T>(node, truncation, input0_type, + input1_type, + UseInfo::TruncatingWord32()); return; } } if (hint == NumberOperationHint::kSignedSmall) { - VisitBinop<T>(node, CheckedUseInfoAsWord32FromHint(hint), - MachineRepresentation::kWord32, Type::Signed32()); - if (lower<T>()) { - LowerToCheckedInt32Mul(node, truncation, input0_type, input1_type); - } + VisitForCheckedInt32Mul<T>(node, truncation, input0_type, input1_type, + CheckedUseInfoAsWord32FromHint(hint)); return; } @@ -3997,7 +4020,6 @@ template <> void RepresentationSelector::SetOutput<RETYPE>( Node* node, MachineRepresentation representation, Type restriction_type) { NodeInfo* const info = GetInfo(node); - DCHECK(info->restriction_type().Is(restriction_type)); DCHECK(restriction_type.Is(info->restriction_type())); info->set_output(representation); } @@ -4007,7 +4029,6 @@ void RepresentationSelector::SetOutput<LOWER>( Node* node, MachineRepresentation representation, Type restriction_type) { NodeInfo* const info = GetInfo(node); DCHECK_EQ(info->representation(), representation); - DCHECK(info->restriction_type().Is(restriction_type)); DCHECK(restriction_type.Is(info->restriction_type())); USE(info); } diff --git a/deps/v8/src/compiler/type-cache.h b/deps/v8/src/compiler/type-cache.h index ada95a37219fc0..2ade5f68a3b1d9 100644 --- a/deps/v8/src/compiler/type-cache.h +++ b/deps/v8/src/compiler/type-cache.h @@ -80,7 +80,7 @@ class V8_EXPORT_PRIVATE TypeCache final { Type::Union(kPositiveIntegerOrMinusZero, Type::NaN(), zone()); Type const kAdditiveSafeInteger = - CreateRange(-4503599627370496.0, 4503599627370496.0); + CreateRange(-4503599627370495.0, 4503599627370495.0); Type const kSafeInteger = CreateRange(-kMaxSafeInteger, kMaxSafeInteger); Type const kAdditiveSafeIntegerOrMinusZero = Type::Union(kAdditiveSafeInteger, Type::MinusZero(), zone()); diff --git a/deps/v8/src/deoptimizer/deoptimize-reason.h b/deps/v8/src/deoptimizer/deoptimize-reason.h index 3dc0f0599b21b3..4ad302ed6c6439 100644 --- a/deps/v8/src/deoptimizer/deoptimize-reason.h +++ b/deps/v8/src/deoptimizer/deoptimize-reason.h @@ -44,6 +44,7 @@ namespace internal { V(NotAJavaScriptObject, "not a JavaScript object") \ V(NotAJavaScriptObjectOrNullOrUndefined, \ "not a JavaScript object, Null or Undefined") \ + V(NotANumber, "not a Number") \ V(NotANumberOrBoolean, "not a Number or Boolean") \ V(NotANumberOrOddball, "not a Number or Oddball") \ V(NotAnArrayIndex, "not an array index") \ diff --git a/deps/v8/src/interpreter/bytecode-generator.cc b/deps/v8/src/interpreter/bytecode-generator.cc index 233ad6d4e0da1b..2d1c3704a393f3 100644 --- a/deps/v8/src/interpreter/bytecode-generator.cc +++ b/deps/v8/src/interpreter/bytecode-generator.cc @@ -3106,6 +3106,8 @@ void BytecodeGenerator::BuildCreateArrayLiteral( .StoreAccumulatorInRegister(index); } } else { + // TODO(v8:11582): Support allocating boilerplates here. + // In other cases, we prepare an empty array to be filled in below. DCHECK(!elements->is_empty()); int literal_index = feedback_index(feedback_spec()->AddLiteralSlot()); @@ -5022,17 +5024,30 @@ void BytecodeGenerator::VisitCall(Call* expr) { return VisitCallSuper(expr); } + // We compile the call differently depending on the presence of spreads and + // their positions. + // + // If there is only one spread and it is the final argument, there is a + // special CallWithSpread bytecode. + // + // If there is a non-final spread, we rewrite calls like + // callee(1, ...x, 2) + // to + // %reflect_apply(callee, receiver, [1, ...x, 2]) + const Call::SpreadPosition spread_position = expr->spread_position(); + // Grow the args list as we visit receiver / arguments to avoid allocating all // the registers up-front. Otherwise these registers are unavailable during // receiver / argument visiting and we can end up with memory leaks due to // registers keeping objects alive. - Register callee = register_allocator()->NewRegister(); RegisterList args = register_allocator()->NewGrowableRegisterList(); + // The callee is the first register in args for ease of calling %reflect_apply + // if we have a non-final spread. For all other cases it is popped from args + // before emitting the call below. + Register callee = register_allocator()->GrowRegisterList(&args); + bool implicit_undefined_receiver = false; - // When a call contains a spread, a Call AST node is only created if there is - // exactly one spread, and it is the last argument. - bool is_spread_call = expr->only_last_arg_is_spread(); bool optimize_as_one_shot = ShouldOptimizeAsOneShot(); // TODO(petermarshall): We have a lot of call bytecodes that are very similar, @@ -5052,7 +5067,7 @@ void BytecodeGenerator::VisitCall(Call* expr) { } case Call::GLOBAL_CALL: { // Receiver is undefined for global calls. - if (!is_spread_call && !optimize_as_one_shot) { + if (spread_position == Call::kNoSpread && !optimize_as_one_shot) { implicit_undefined_receiver = true; } else { // TODO(leszeks): There's no special bytecode for tail calls or spread @@ -5088,7 +5103,7 @@ void BytecodeGenerator::VisitCall(Call* expr) { } case Call::OTHER_CALL: { // Receiver is undefined for other calls. - if (!is_spread_call && !optimize_as_one_shot) { + if (spread_position == Call::kNoSpread && !optimize_as_one_shot) { implicit_undefined_receiver = true; } else { // TODO(leszeks): There's no special bytecode for tail calls or spread @@ -5137,25 +5152,51 @@ void BytecodeGenerator::VisitCall(Call* expr) { BuildIncrementBlockCoverageCounterIfEnabled(right_range); } - // Evaluate all arguments to the function call and store in sequential args - // registers. - VisitArguments(expr->arguments(), &args); - int receiver_arg_count = implicit_undefined_receiver ? 0 : 1; - CHECK_EQ(receiver_arg_count + expr->arguments()->length(), - args.register_count()); + int receiver_arg_count = -1; + if (spread_position == Call::kHasNonFinalSpread) { + // If we're building %reflect_apply, build the array literal and put it in + // the 3rd argument. + DCHECK(!implicit_undefined_receiver); + DCHECK_EQ(args.register_count(), 2); + BuildCreateArrayLiteral(expr->arguments(), nullptr); + builder()->StoreAccumulatorInRegister( + register_allocator()->GrowRegisterList(&args)); + } else { + // If we're not building %reflect_apply and don't need to build an array + // literal, pop the callee and evaluate all arguments to the function call + // and store in sequential args registers. + args = args.PopLeft(); + VisitArguments(expr->arguments(), &args); + receiver_arg_count = implicit_undefined_receiver ? 0 : 1; + CHECK_EQ(receiver_arg_count + expr->arguments()->length(), + args.register_count()); + } // Resolve callee for a potential direct eval call. This block will mutate the // callee value. if (expr->is_possibly_eval() && expr->arguments()->length() > 0) { RegisterAllocationScope inner_register_scope(this); + RegisterList runtime_call_args = register_allocator()->NewRegisterList(6); // Set up arguments for ResolvePossiblyDirectEval by copying callee, source // strings and function closure, and loading language and // position. - Register first_arg = args[receiver_arg_count]; - RegisterList runtime_call_args = register_allocator()->NewRegisterList(6); + + // Move the first arg. + if (spread_position == Call::kHasNonFinalSpread) { + int feedback_slot_index = + feedback_index(feedback_spec()->AddKeyedLoadICSlot()); + Register args_array = args[2]; + builder() + ->LoadLiteral(Smi::FromInt(0)) + .LoadKeyedProperty(args_array, feedback_slot_index) + .StoreAccumulatorInRegister(runtime_call_args[1]); + } else { + // FIXME(v8:5690): Support final spreads for eval. + DCHECK_GE(receiver_arg_count, 0); + builder()->MoveRegister(args[receiver_arg_count], runtime_call_args[1]); + } builder() ->MoveRegister(callee, runtime_call_args[0]) - .MoveRegister(first_arg, runtime_call_args[1]) .MoveRegister(Register::function_closure(), runtime_call_args[2]) .LoadLiteral(Smi::FromEnum(language_mode())) .StoreAccumulatorInRegister(runtime_call_args[3]) @@ -5172,10 +5213,12 @@ void BytecodeGenerator::VisitCall(Call* expr) { builder()->SetExpressionPosition(expr); - if (is_spread_call) { + if (spread_position == Call::kHasFinalSpread) { DCHECK(!implicit_undefined_receiver); builder()->CallWithSpread(callee, args, feedback_index(feedback_spec()->AddCallICSlot())); + } else if (spread_position == Call::kHasNonFinalSpread) { + builder()->CallJSRuntime(Context::REFLECT_APPLY_INDEX, args); } else if (optimize_as_one_shot) { DCHECK(!implicit_undefined_receiver); builder()->CallNoFeedback(callee, args); @@ -5198,10 +5241,20 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) { SuperCallReference* super = expr->expression()->AsSuperCallReference(); const ZonePtrList<Expression>* args = expr->arguments(); - int first_spread_index = 0; - for (; first_spread_index < args->length(); first_spread_index++) { - if (args->at(first_spread_index)->IsSpread()) break; - } + // We compile the super call differently depending on the presence of spreads + // and their positions. + // + // If there is only one spread and it is the final argument, there is a + // special ConstructWithSpread bytecode. + // + // It there is a non-final spread, we rewrite something like + // super(1, ...x, 2) + // to + // %reflect_construct(constructor, [1, ...x, 2], new_target) + // + // That is, we implement (non-last-arg) spreads in super calls via our + // mechanism for spreads in array literals. + const Call::SpreadPosition spread_position = expr->spread_position(); // Prepare the constructor to the super call. Register this_function = VisitForRegisterValue(super->this_function_var()); @@ -5210,14 +5263,7 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) { ->LoadAccumulatorWithRegister(this_function) .GetSuperConstructor(constructor); - if (first_spread_index < expr->arguments()->length() - 1) { - // We rewrite something like - // super(1, ...x, 2) - // to - // %reflect_construct(constructor, [1, ...x, 2], new_target) - // That is, we implement (non-last-arg) spreads in super calls via our - // mechanism for spreads in array literals. - + if (spread_position == Call::kHasNonFinalSpread) { // First generate the array containing all arguments. BuildCreateArrayLiteral(args, nullptr); @@ -5244,11 +5290,11 @@ void BytecodeGenerator::VisitCallSuper(Call* expr) { int feedback_slot_index = feedback_index(feedback_spec()->AddCallICSlot()); - if (first_spread_index == expr->arguments()->length() - 1) { + if (spread_position == Call::kHasFinalSpread) { builder()->ConstructWithSpread(constructor, args_regs, feedback_slot_index); } else { - DCHECK_EQ(first_spread_index, expr->arguments()->length()); + DCHECK_EQ(spread_position, Call::kNoSpread); // Call construct. // TODO(turbofan): For now we do gather feedback on super constructor // calls, utilizing the existing machinery to inline the actual call diff --git a/deps/v8/src/objects/fixed-array-inl.h b/deps/v8/src/objects/fixed-array-inl.h index b743d15ad898b9..bfd7d9563bc424 100644 --- a/deps/v8/src/objects/fixed-array-inl.h +++ b/deps/v8/src/objects/fixed-array-inl.h @@ -368,7 +368,7 @@ int Search(T* array, Name name, int valid_entries, int* out_insertion_index, double FixedDoubleArray::get_scalar(int index) { DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() && map() != GetReadOnlyRoots().fixed_array_map()); - DCHECK(index >= 0 && index < this->length()); + DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length())); DCHECK(!is_the_hole(index)); return ReadField<double>(kHeaderSize + index * kDoubleSize); } @@ -376,7 +376,7 @@ double FixedDoubleArray::get_scalar(int index) { uint64_t FixedDoubleArray::get_representation(int index) { DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() && map() != GetReadOnlyRoots().fixed_array_map()); - DCHECK(index >= 0 && index < this->length()); + DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length())); int offset = kHeaderSize + index * kDoubleSize; // Bug(v8:8875): Doubles may be unaligned. return base::ReadUnalignedValue<uint64_t>(field_address(offset)); @@ -394,6 +394,7 @@ Handle<Object> FixedDoubleArray::get(FixedDoubleArray array, int index, void FixedDoubleArray::set(int index, double value) { DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() && map() != GetReadOnlyRoots().fixed_array_map()); + DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length())); int offset = kHeaderSize + index * kDoubleSize; if (std::isnan(value)) { WriteField<double>(offset, std::numeric_limits<double>::quiet_NaN()); @@ -410,6 +411,7 @@ void FixedDoubleArray::set_the_hole(Isolate* isolate, int index) { void FixedDoubleArray::set_the_hole(int index) { DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() && map() != GetReadOnlyRoots().fixed_array_map()); + DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length())); int offset = kHeaderSize + index * kDoubleSize; base::WriteUnalignedValue<uint64_t>(field_address(offset), kHoleNanInt64); } diff --git a/deps/v8/src/objects/map-updater.cc b/deps/v8/src/objects/map-updater.cc index 95b435085e2d28..31841992dec18e 100644 --- a/deps/v8/src/objects/map-updater.cc +++ b/deps/v8/src/objects/map-updater.cc @@ -139,11 +139,20 @@ Handle<Map> MapUpdater::ReconfigureToDataField(InternalIndex descriptor, if (old_details.constness() == PropertyConstness::kConst && old_details.location() == kField && old_details.attributes() != new_attributes_) { + // Ensure we'll be updating constness of the up-to-date version of old_map_. + Handle<Map> old_map = Map::Update(isolate_, old_map_); + PropertyDetails details = + old_map->instance_descriptors(kRelaxedLoad).GetDetails(descriptor); Handle<FieldType> field_type( - old_descriptors_->GetFieldType(modified_descriptor_), isolate_); - Map::GeneralizeField(isolate_, old_map_, descriptor, - PropertyConstness::kMutable, - old_details.representation(), field_type); + old_map->instance_descriptors(kRelaxedLoad).GetFieldType(descriptor), + isolate_); + Map::GeneralizeField(isolate_, old_map, descriptor, + PropertyConstness::kMutable, details.representation(), + field_type); + DCHECK_EQ(PropertyConstness::kMutable, + old_map->instance_descriptors(kRelaxedLoad) + .GetDetails(descriptor) + .constness()); // The old_map_'s property must become mutable. // Note, that the {old_map_} and {old_descriptors_} are not expected to be // updated by the generalization if the map is already deprecated. diff --git a/deps/v8/src/parsing/parser-base.h b/deps/v8/src/parsing/parser-base.h index ec615c9c4fcd8d..be96f61eeb97de 100644 --- a/deps/v8/src/parsing/parser-base.h +++ b/deps/v8/src/parsing/parser-base.h @@ -1186,6 +1186,7 @@ class ParserBase { BlockT ParseClassStaticBlock(ClassInfo* class_info); ObjectLiteralPropertyT ParseObjectPropertyDefinition( ParsePropertyInfo* prop_info, bool* has_seen_proto); + // TODO(syg): Remove has_spread once SpreadCallNew is removed. void ParseArguments( ExpressionListT* args, bool* has_spread, ParsingArrowHeadFlag maybe_arrow = kCertainlyNotArrowHead); @@ -3392,11 +3393,7 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) { return result; } - if (has_spread) { - result = impl()->SpreadCall(result, args, pos, Call::NOT_EVAL, false); - } else { - result = factory()->NewCall(result, args, pos, Call::NOT_EVAL); - } + result = factory()->NewCall(result, args, pos, has_spread); maybe_arrow.ValidateExpression(); @@ -3490,13 +3487,8 @@ ParserBase<Impl>::ParseLeftHandSideContinuation(ExpressionT result) { Call::PossiblyEval is_possibly_eval = CheckPossibleEvalCall(result, is_optional, scope()); - if (has_spread) { - result = impl()->SpreadCall(result, args, pos, is_possibly_eval, - is_optional); - } else { - result = factory()->NewCall(result, args, pos, is_possibly_eval, - is_optional); - } + result = factory()->NewCall(result, args, pos, has_spread, + is_possibly_eval, is_optional); fni_.RemoveLastFunction(); break; diff --git a/deps/v8/src/parsing/parser.cc b/deps/v8/src/parsing/parser.cc index 9366d195f3a5b9..4e9428c1c3805d 100644 --- a/deps/v8/src/parsing/parser.cc +++ b/deps/v8/src/parsing/parser.cc @@ -69,7 +69,8 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name, args.Add(spread_args); Expression* super_call_ref = NewSuperCallReference(pos); - call = factory()->NewCall(super_call_ref, args, pos); + constexpr bool has_spread = true; + call = factory()->NewCall(super_call_ref, args, pos, has_spread); } body.Add(factory()->NewReturnStatement(call, pos)); } @@ -3371,47 +3372,10 @@ ArrayLiteral* Parser::ArrayLiteralFromListWithSpread( return factory()->NewArrayLiteral(list, first_spread, kNoSourcePosition); } -Expression* Parser::SpreadCall(Expression* function, - const ScopedPtrList<Expression>& args_list, - int pos, Call::PossiblyEval is_possibly_eval, - bool optional_chain) { - // Handle this case in BytecodeGenerator. - if (OnlyLastArgIsSpread(args_list) || function->IsSuperCallReference()) { - return factory()->NewCall(function, args_list, pos, Call::NOT_EVAL, - optional_chain); - } - - ScopedPtrList<Expression> args(pointer_buffer()); - if (function->IsProperty()) { - // Method calls - if (function->AsProperty()->IsSuperAccess()) { - Expression* home = ThisExpression(); - args.Add(function); - args.Add(home); - } else { - Variable* temp = NewTemporary(ast_value_factory()->empty_string()); - VariableProxy* obj = factory()->NewVariableProxy(temp); - Assignment* assign_obj = factory()->NewAssignment( - Token::ASSIGN, obj, function->AsProperty()->obj(), kNoSourcePosition); - function = - factory()->NewProperty(assign_obj, function->AsProperty()->key(), - kNoSourcePosition, optional_chain); - args.Add(function); - obj = factory()->NewVariableProxy(temp); - args.Add(obj); - } - } else { - // Non-method calls - args.Add(function); - args.Add(factory()->NewUndefinedLiteral(kNoSourcePosition)); - } - args.Add(ArrayLiteralFromListWithSpread(args_list)); - return factory()->NewCallRuntime(Context::REFLECT_APPLY_INDEX, args, pos); -} - Expression* Parser::SpreadCallNew(Expression* function, const ScopedPtrList<Expression>& args_list, int pos) { + // TODO(syg): Handle all spread cases in BytecodeGenerator. if (OnlyLastArgIsSpread(args_list)) { // Handle in BytecodeGenerator. return factory()->NewCallNew(function, args_list, pos); diff --git a/deps/v8/src/parsing/parser.h b/deps/v8/src/parsing/parser.h index db7d5aed0ef6a0..027867584b6ba7 100644 --- a/deps/v8/src/parsing/parser.h +++ b/deps/v8/src/parsing/parser.h @@ -493,10 +493,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ArrayLiteral* ArrayLiteralFromListWithSpread( const ScopedPtrList<Expression>& list); - Expression* SpreadCall(Expression* function, - const ScopedPtrList<Expression>& args, int pos, - Call::PossiblyEval is_possibly_eval, - bool optional_chain); Expression* SpreadCallNew(Expression* function, const ScopedPtrList<Expression>& args, int pos); Expression* RewriteSuperCall(Expression* call_expression); diff --git a/deps/v8/src/parsing/preparser.h b/deps/v8/src/parsing/preparser.h index 3c8b01eb0266d1..cee84c1944a392 100644 --- a/deps/v8/src/parsing/preparser.h +++ b/deps/v8/src/parsing/preparser.h @@ -645,6 +645,7 @@ class PreParserFactory { } PreParserExpression NewCall(PreParserExpression expression, const PreParserExpressionList& arguments, int pos, + bool has_spread, Call::PossiblyEval possibly_eval = Call::NOT_EVAL, bool optional_chain = false) { if (possibly_eval == Call::IS_POSSIBLY_EVAL) { @@ -1049,11 +1050,6 @@ class PreParser : public ParserBase<PreParser> { } V8_INLINE void SetAsmModule() {} - V8_INLINE PreParserExpression SpreadCall(const PreParserExpression& function, - const PreParserExpressionList& args, - int pos, - Call::PossiblyEval possibly_eval, - bool optional_chain); V8_INLINE PreParserExpression SpreadCallNew(const PreParserExpression& function, const PreParserExpressionList& args, int pos); @@ -1682,14 +1678,6 @@ class PreParser : public ParserBase<PreParser> { std::vector<void*> preparse_data_builder_buffer_; }; -PreParserExpression PreParser::SpreadCall(const PreParserExpression& function, - const PreParserExpressionList& args, - int pos, - Call::PossiblyEval possibly_eval, - bool optional_chain) { - return factory()->NewCall(function, args, pos, possibly_eval, optional_chain); -} - PreParserExpression PreParser::SpreadCallNew( const PreParserExpression& function, const PreParserExpressionList& args, int pos) { diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden index cec066fdb74d2d..7cbcc9199922f1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallAndSpread.golden @@ -63,43 +63,47 @@ handlers: [ snippet: " Math.max(0, ...[1, 2, 3], 4); " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 91 +bytecode array length: 95 bytecodes: [ /* 34 S> */ B(LdaGlobal), U8(0), U8(0), - B(Star0), - B(LdaNamedProperty), R(0), U8(1), U8(2), B(Star1), - B(CreateArrayLiteral), U8(2), U8(4), U8(37), - B(Star4), - B(LdaSmi), I8(1), + /* 39 E> */ B(LdaNamedProperty), R(1), U8(1), U8(2), + B(Star0), + B(CreateEmptyArrayLiteral), U8(4), B(Star3), - /* 49 S> */ B(CreateArrayLiteral), U8(3), U8(5), U8(37), - B(Star7), - /* 49 E> */ B(GetIterator), R(7), U8(6), U8(8), - B(Mov), R(0), R(2), + B(LdaZero), + B(Star2), + B(LdaZero), + B(StaInArrayLiteral), R(3), R(2), U8(5), + B(Ldar), R(2), + B(Inc), U8(7), + B(Star2), + /* 49 S> */ B(CreateArrayLiteral), U8(2), U8(8), U8(37), + B(Star6), + /* 49 E> */ B(GetIterator), R(6), U8(9), U8(11), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), - B(Star6), - B(LdaNamedProperty), R(6), U8(4), U8(10), B(Star5), - B(CallProperty0), R(5), R(6), U8(19), - B(Star7), + B(LdaNamedProperty), R(5), U8(3), U8(13), + B(Star4), + B(CallProperty0), R(4), R(5), U8(19), + B(Star6), B(JumpIfJSReceiver), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), - B(LdaNamedProperty), R(7), U8(5), U8(21), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(LdaNamedProperty), R(6), U8(4), U8(21), B(JumpIfToBooleanTrue), U8(18), - B(LdaNamedProperty), R(7), U8(6), U8(12), - B(StaInArrayLiteral), R(4), R(3), U8(17), - B(Ldar), R(3), - B(Inc), U8(16), - B(Star3), + B(LdaNamedProperty), R(6), U8(5), U8(15), + B(StaInArrayLiteral), R(3), R(2), U8(5), + B(Ldar), R(2), + B(Inc), U8(7), + B(Star2), B(JumpLoop), U8(31), I8(0), B(LdaSmi), I8(4), - B(StaInArrayLiteral), R(4), R(3), U8(17), - B(Mov), R(4), R(3), - B(CallJSRuntime), U8(%reflect_apply), R(1), U8(3), + B(StaInArrayLiteral), R(3), R(2), U8(5), + B(Mov), R(3), R(2), + /* 39 E> */ B(CallJSRuntime), U8(%reflect_apply), R(0), U8(3), B(LdaUndefined), /* 64 S> */ B(Return), ] @@ -107,7 +111,6 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["Math"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["max"], ARRAY_BOILERPLATE_DESCRIPTION_TYPE, - ARRAY_BOILERPLATE_DESCRIPTION_TYPE, ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], diff --git a/deps/v8/test/mjsunit/compiler/regress-1195777.js b/deps/v8/test/mjsunit/compiler/regress-1195777.js new file mode 100644 index 00000000000000..b122f4f0169af5 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-1195777.js @@ -0,0 +1,62 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + + +(function() { + function foo(b) { + let y = (new Date(42)).getMilliseconds(); + let x = -1; + if (b) x = 0xFFFF_FFFF; + return y < Math.max(1 << y, x, 1 + y); + } + assertTrue(foo(true)); + %PrepareFunctionForOptimization(foo); + assertTrue(foo(false)); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(true)); +})(); + + +(function() { + function foo(b) { + let x = 0; + if (b) x = -1; + return x == Math.max(-1, x >>> Infinity); + } + assertFalse(foo(true)); + %PrepareFunctionForOptimization(foo); + assertTrue(foo(false)); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(true)); +})(); + + +(function() { + function foo(b) { + let x = -1; + if (b) x = 0xFFFF_FFFF; + return -1 < Math.max(0, x, -1); + } + assertTrue(foo(true)); + %PrepareFunctionForOptimization(foo); + assertTrue(foo(false)); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(true)); +})(); + + +(function() { + function foo(b) { + let x = 0x7FFF_FFFF; + if (b) x = 0; + return 0 < (Math.max(-5 >>> x, -5) % -5); + } + assertTrue(foo(true)); + %PrepareFunctionForOptimization(foo); + assertTrue(foo(false)); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(true)); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-11558.js b/deps/v8/test/mjsunit/regress/regress-11558.js new file mode 100644 index 00000000000000..285bef0d21ba28 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-11558.js @@ -0,0 +1,17 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Spread calls get rewritten to CallRuntime, which should be aware of optional +// chaining. + +for (let nullish of [undefined, null]) { + const fn = nullish; + const n = nullish; + const o = {}; + + assertEquals(fn?.(...[], 1), undefined); + assertEquals(fn?.(...[], ...[]), undefined); + assertEquals(o.method?.(...[], 1), undefined); + assertEquals(n?.method(...[], 1), undefined); +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-1195331.js b/deps/v8/test/mjsunit/regress/regress-crbug-1195331.js new file mode 100644 index 00000000000000..1bced5623e4f9a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-1195331.js @@ -0,0 +1,36 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +let o1 = { a: 1, b: 0 }; +let o2 = { a: 2, b: 0 }; +assertTrue(%HaveSameMap(o1, o2)); +assertTrue(%HasOwnConstDataProperty(o1, "a")); +assertTrue(%HasOwnConstDataProperty(o1, "b")); + +Object.defineProperty(o1, "b", { + value: 4.2, enumerable: true, configurable: true, writable: true, +}); +assertFalse(%HaveSameMap(o1, o2)); +assertTrue(%HasOwnConstDataProperty(o1, "a")); +assertFalse(%HasOwnConstDataProperty(o1, "b")); +assertTrue(%HasOwnConstDataProperty(o2, "a")); +assertTrue(%HasOwnConstDataProperty(o2, "b")); + +let o3 = { a: "foo", b: 0 }; +assertFalse(%HaveSameMap(o2, o3)); +assertTrue(%HasOwnConstDataProperty(o3, "a")); +assertFalse(%HasOwnConstDataProperty(o3, "b")); + +Object.defineProperty(o2, "a", { + value:2, enumerable: false, configurable: true, writable: true, +}); +assertFalse(%HasOwnConstDataProperty(o1, "a")); +assertFalse(%HasOwnConstDataProperty(o1, "b")); +assertFalse(%HasOwnConstDataProperty(o3, "a")); +assertFalse(%HasOwnConstDataProperty(o3, "b")); + +assertFalse(%HasOwnConstDataProperty(o2, "a")); +assertTrue(%HasOwnConstDataProperty(o2, "b")); diff --git a/deps/v8/test/test262/test262.status b/deps/v8/test/test262/test262.status index d94b2caa9896f2..f31091f3d06142 100644 --- a/deps/v8/test/test262/test262.status +++ b/deps/v8/test/test262/test262.status @@ -493,8 +493,6 @@ # https://bugs.chromium.org/p/v8/issues/detail?id=5690 'language/expressions/call/eval-spread': [FAIL], - 'language/expressions/call/eval-spread-empty-leading': [FAIL], - 'language/expressions/call/eval-spread-empty-trailing': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=7472 'intl402/NumberFormat/currency-digits': [FAIL], diff --git a/doc/abi_version_registry.json b/doc/abi_version_registry.json index b6fcd37300cd07..0f67dddd2df7eb 100644 --- a/doc/abi_version_registry.json +++ b/doc/abi_version_registry.json @@ -1,6 +1,6 @@ { "NODE_MODULE_VERSION": [ - { "modules": 93, "runtime": "node", "variant": "v8_9.0", "versions": "16.0.0-pre" }, + { "modules": 93, "runtime": "node", "variant": "v8_9.0", "versions": "16.0.0" }, { "modules": 92, "runtime": "node", "variant": "v8_8.9", "versions": "16.0.0-pre" }, { "modules": 91, "runtime": "node", "variant": "v8_8.8", "versions": "16.0.0-pre" }, { "modules": 90, "runtime": "node", "variant": "v8_8.7", "versions": "16.0.0-pre" }, diff --git a/doc/api/assert.md b/doc/api/assert.md index 4e098e0bbc56f9..7eb952ace7be71 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -455,7 +455,7 @@ An alias of [`assert.ok()`][]. <!-- YAML added: v0.1.21 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/38113 description: In Legacy assertion mode, changed status from Deprecated to Legacy. @@ -881,7 +881,7 @@ added: - v13.6.0 - v12.16.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/38111 description: This API is no longer experimental. --> @@ -1126,7 +1126,7 @@ assert.doesNotThrow( <!-- YAML added: v0.1.21 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/38113 description: In Legacy assertion mode, changed status from Deprecated to Legacy. @@ -1406,7 +1406,7 @@ added: - v13.6.0 - v12.16.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/38111 description: This API is no longer experimental. --> @@ -1454,7 +1454,7 @@ instance of an [`Error`][] then it will be thrown instead of the <!-- YAML added: v0.1.21 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/38113 description: In Legacy assertion mode, changed status from Deprecated to Legacy. @@ -1634,7 +1634,7 @@ instead of the [`AssertionError`][]. <!-- YAML added: v0.1.21 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/38113 description: In Legacy assertion mode, changed status from Deprecated to Legacy. diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 36aa464a1426db..55cc0542561334 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -271,16 +271,18 @@ created, while `triggerAsyncId` shows *why* a resource was created. The following is a simple demonstration of `triggerAsyncId`: ```js +const { fd } = process.stdout; + async_hooks.createHook({ init(asyncId, type, triggerAsyncId) { const eid = async_hooks.executionAsyncId(); fs.writeSync( - process.stdout.fd, + fd, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); } }).enable(); -require('net').createServer((conn) => {}).listen(8080); +net.createServer((conn) => {}).listen(8080); ``` Output when hitting the server with `nc localhost 8080`: @@ -322,33 +324,35 @@ callback to `listen()` will look like. The output formatting is slightly more elaborate to make calling context easier to see. ```js +const { fd } = process.stdout; + let indent = 0; async_hooks.createHook({ init(asyncId, type, triggerAsyncId) { const eid = async_hooks.executionAsyncId(); const indentStr = ' '.repeat(indent); fs.writeSync( - process.stdout.fd, + fd, `${indentStr}${type}(${asyncId}):` + ` trigger: ${triggerAsyncId} execution: ${eid}\n`); }, before(asyncId) { const indentStr = ' '.repeat(indent); - fs.writeSync(process.stdout.fd, `${indentStr}before: ${asyncId}\n`); + fs.writeSync(fd, `${indentStr}before: ${asyncId}\n`); indent += 2; }, after(asyncId) { indent -= 2; const indentStr = ' '.repeat(indent); - fs.writeSync(process.stdout.fd, `${indentStr}after: ${asyncId}\n`); + fs.writeSync(fd, `${indentStr}after: ${asyncId}\n`); }, destroy(asyncId) { const indentStr = ' '.repeat(indent); - fs.writeSync(process.stdout.fd, `${indentStr}destroy: ${asyncId}\n`); + fs.writeSync(fd, `${indentStr}destroy: ${asyncId}\n`); }, }).enable(); -require('net').createServer(() => {}).listen(8080, () => { +net.createServer(() => {}).listen(8080, () => { // Let's wait 10ms before logging the server started. setTimeout(() => { console.log('>>>', async_hooks.executionAsyncId()); @@ -738,7 +742,7 @@ added: - v14.8.0 - v12.19.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36782 description: Added optional thisArg. --> @@ -759,7 +763,7 @@ added: - v14.8.0 - v12.19.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36782 description: Added optional thisArg. --> diff --git a/doc/api/buffer.md b/doc/api/buffer.md index e7183121b6daa3..3c8dc975e4248b 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -176,12 +176,12 @@ however, subtle incompatibilities between the `Buffer` API and the In particular: -* While [`TypedArray#slice()`][] creates a copy of part of the `TypedArray`, - [`Buffer#slice()`][`buf.slice()`] creates a view over the existing `Buffer` +* While [`TypedArray.prototype.slice()`][] creates a copy of part of the `TypedArray`, + [`Buffer.prototype.slice()`][`buf.slice()`] creates a view over the existing `Buffer` without copying. This behavior can be surprising, and only exists for legacy - compatibility. [`TypedArray#subarray()`][] can be used to achieve the behavior - of [`Buffer#slice()`][`buf.slice()`] on both `Buffer`s and other - `TypedArray`s. + compatibility. [`TypedArray.prototype.subarray()`][] can be used to achieve + the behavior of [`Buffer.prototype.slice()`][`buf.slice()`] on both `Buffer`s + and other `TypedArray`s. * [`buf.toString()`][] is incompatible with its `TypedArray` equivalent. * A number of methods, e.g. [`buf.indexOf()`][], support additional arguments. @@ -205,7 +205,7 @@ console.log(uint32array); ```js const buf = Buffer.from('hello', 'utf16le'); -const uint16arr = new Uint16Array( +const uint16array = new Uint16Array( buf.buffer, buf.byteOffset, buf.length / Uint16Array.BYTES_PER_ELEMENT); @@ -350,7 +350,7 @@ added: v15.7.0 * `type` {string} The content-type for the new `Blob` Creates and returns a new `Blob` containing a subset of this `Blob` objects -data. The original `Blob` is not alterered. +data. The original `Blob` is not altered. ### `blob.text()` <!-- YAML @@ -1086,9 +1086,9 @@ added: v0.1.90 Copies data from a region of `buf` to a region in `target`, even if the `target` memory region overlaps with `buf`. -[`TypedArray#set()`][] performs the same operation, and is available for all -TypedArrays, including Node.js `Buffer`s, although it takes different -function arguments. +[`TypedArray.prototype.set()`][] performs the same operation, and is available +for all TypedArrays, including Node.js `Buffer`s, although it takes +different function arguments. ```js // Create two `Buffer` instances. @@ -1349,7 +1349,7 @@ an integer between 0 and 255. If `byteOffset` is not a number, it will be coerced to a number. If the result of coercion is `NaN` or `0`, then the entire buffer will be searched. This -behavior matches [`String#indexOf()`][]. +behavior matches [`String.prototype.indexOf()`][]. ```js const b = Buffer.from('abcdef'); @@ -1449,7 +1449,7 @@ an integer between 0 and 255. If `byteOffset` is not a number, it will be coerced to a number. Any arguments that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer. -This behavior matches [`String#lastIndexOf()`][]. +This behavior matches [`String.prototype.lastIndexOf()`][]. ```js const b = Buffer.from('abcdef'); @@ -2136,7 +2136,7 @@ offset and cropped by the `start` and `end` indices. Specifying `end` greater than [`buf.length`][] will return the same result as that of `end` equal to [`buf.length`][]. -This method is inherited from [`TypedArray#subarray()`][]. +This method is inherited from [`TypedArray.prototype.subarray()`][]. Modifying the new `Buffer` slice will modify the memory in the original `Buffer` because the allocated memory of the two objects overlap. @@ -3574,13 +3574,13 @@ introducing security vulnerabilities into an application. [`ERR_OUT_OF_RANGE`]: errors.md#ERR_OUT_OF_RANGE [`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer -[`String#indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf -[`String#lastIndexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf +[`String.prototype.indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf +[`String.prototype.lastIndexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf [`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length -[`TypedArray#set()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set -[`TypedArray#slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice -[`TypedArray#subarray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray [`TypedArray.from()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from +[`TypedArray.prototype.set()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set +[`TypedArray.prototype.slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice +[`TypedArray.prototype.subarray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray [`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray [`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array [`buf.buffer`]: #buffer_buf_buffer diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 2a59b1dd537ba0..d12c1f12d256d8 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -688,7 +688,7 @@ This can only be called from the primary process. ## `cluster.isMaster` <!-- YAML added: v0.8.1 -deprecated: REPLACEME +deprecated: v16.0.0 --> Deprecated alias for [`cluster.isPrimary`][]. @@ -696,7 +696,7 @@ details. ## `cluster.isPrimary` <!-- YAML -added: REPLACEME +added: v16.0.0 --> * {boolean} @@ -789,7 +789,7 @@ This object is not intended to be changed or set manually. ## `cluster.setupMaster([settings])` <!-- YAML added: v0.7.1 -deprecated: REPLACEME +deprecated: v16.0.0 changes: - version: v6.4.0 pr-url: https://github.com/nodejs/node/pull/7838 @@ -800,7 +800,7 @@ Deprecated alias for [`.setupPrimary()`][]. ## `cluster.setupPrimary([settings])` <!-- YAML -added: REPLACEME +added: v16.0.0 --> * `settings` {Object} See [`cluster.settings`][]. diff --git a/doc/api/debugger.md b/doc/api/debugger.md index f17750ac116302..66a97f36ec5ee9 100644 --- a/doc/api/debugger.md +++ b/doc/api/debugger.md @@ -67,7 +67,7 @@ break in myscript.js:4 5 }, 1000); 6 console.log('hello'); debug> repl -Press Ctrl + C to leave debug repl +Press Ctrl+C to leave debug repl > x 5 > 2 + 2 diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 5d2127063d96b8..a0140b16e9b7cc 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -831,12 +831,15 @@ The [`require.extensions`][] property is deprecated. ### DEP0040: `punycode` module <!-- YAML changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/38444 + description: Added support for `--pending-deprecation`. - version: v7.0.0 pr-url: https://github.com/nodejs/node/pull/7941 description: Documentation-only deprecation. --> -Type: Documentation-only +Type: Documentation-only (supports [`--pending-deprecation`][]) The [`punycode`][] module is deprecated. Please use a userland alternative instead. @@ -2052,7 +2055,7 @@ expose values under these names. ### DEP0109: `http`, `https`, and `tls` support for invalid URLs <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36853 description: End-of-Life. - version: v11.0.0 @@ -2354,7 +2357,7 @@ with no performance impact since Node.js 10. ### DEP0128: modules with an invalid `main` entry and an `index.js` file <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37204 description: Runtime deprecation. - version: v12.0.0 @@ -2389,7 +2392,7 @@ instead. ### DEP0130: `Module.createRequireFromPath()` <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37201 description: End-of-life. - version: v13.0.0 @@ -2678,7 +2681,7 @@ The [`crypto.Certificate()` constructor][] is deprecated. Use ### DEP0147: `fs.rmdir(path, { recursive: true })` <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37302 description: Runtime deprecation. - version: v15.0.0 @@ -2701,7 +2704,7 @@ Use `fs.rm(path, { recursive: true, force: true })`, ### DEP0148: Folder mappings in `"exports"` (trailing `"/"`) <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37215 description: Runtime deprecation. - version: v15.1.0 @@ -2721,7 +2724,7 @@ Using a trailing `"/"` to define ### DEP0149: `http.IncomingMessage#connection` <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/33768 description: Documentation-only deprecation. --> @@ -2733,7 +2736,7 @@ Prefer [`message.socket`][] over [`message.connection`][]. ### DEP0150: Changing the value of `process.config` <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36902 description: Runtime deprecation. --> @@ -2748,7 +2751,7 @@ change the value has been deprecated and will be disabled in the future. ### DEP0151: Main index lookup and extension searching <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37206 description: Runtime deprecation. - version: v15.8.0 @@ -2768,7 +2771,7 @@ an explicit [`"exports"` or `"main"` entry][] with the exact file extension. ### DEP0152: Extension PerformanceEntry properties <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37136 description: Runtime deprecation. --> diff --git a/doc/api/esm.md b/doc/api/esm.md index 98b26bc7c36acd..4787dfc74da92d 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -206,7 +206,7 @@ added: - v14.13.1 - v12.20.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37246 description: Added `node:` import support to `require(...)`. --> @@ -1336,7 +1336,7 @@ success! [`transformSource` hook]: #esm_transformsource_source_context_defaulttransformsource [`string`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String [`util.TextDecoder`]: util.md#util_class_util_textdecoder -[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/1.1.1 +[cjs-module-lexer]: https://github.com/guybedford/cjs-module-lexer/tree/1.2.1 [custom https loader]: #esm_https_loader [special scheme]: https://url.spec.whatwg.org/#special-scheme [the official standard format]: https://tc39.github.io/ecma262/#sec-modules diff --git a/doc/api/events.md b/doc/api/events.md index 9bd7b28e244c7a..ca2ae7e6c84af9 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1141,7 +1141,7 @@ setMaxListeners(5, target, emitter); <!-- YAML added: v14.5.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37237 description: changed EventTarget error handling. - version: v15.4.0 diff --git a/doc/api/fs.md b/doc/api/fs.md index dc31bced554cd9..11e5b2c39fb785 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -285,7 +285,7 @@ Reads data from the file and stores that in the given buffer. If the file is not modified concurrently, the end-of-file is reached when the number of bytes read is zero. -#### `filehandle.read(options)` +#### `filehandle.read([options])` <!-- YAML added: - v13.11.0 @@ -901,6 +901,9 @@ try { } ``` +When using the async iterator, the {fs.Dir} object will be automatically +closed after the iterator exits. + ### `fsPromises.readdir(path[, options])` <!-- YAML added: v10.0.0 @@ -932,7 +935,7 @@ import { readdir } from 'fs/promises'; try { const files = await readdir(path); - for await (const file of files) + for (const file of files) console.log(file); } catch (err) { console.error(err); @@ -1049,17 +1052,17 @@ Renames `oldPath` to `newPath`. <!-- YAML added: v10.0.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37216 description: "Using `fsPromises.rmdir(path, { recursive: true })` on a `path` that is a file is no longer permitted and results in an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX." - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37216 description: "Using `fsPromises.rmdir(path, { recursive: true })` on a `path` that does not exist is no longer permitted and results in a `ENOENT` error." - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37302 description: The `recursive` option is deprecated, using it triggers a deprecation warning. @@ -2346,7 +2349,7 @@ descriptor. See [`fs.utimes()`][]. <!-- YAML deprecated: v0.4.7 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37460 description: The error returned may be an `AggregateError` if more than one error is returned. @@ -2481,7 +2484,7 @@ changes: * `stats` {fs.Stats} Retrieves the {fs.Stats} for the symbolic link referred to by the path. -The callback gets two arguments `(err, stats)` where `stats` is a {`fs.Stats} +The callback gets two arguments `(err, stats)` where `stats` is a {fs.Stats} object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic link, then the link itself is stat-ed, not the file that it refers to. @@ -2828,7 +2831,7 @@ If `options.withFileTypes` is set to `true`, the `files` array will contain <!-- YAML added: v0.1.29 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37460 description: The error returned may be an `AggregateError` if more than one error is returned. @@ -3158,17 +3161,17 @@ rename('oldFile.txt', 'newFile.txt', (err) => { <!-- YAML added: v0.0.2 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37216 description: "Using `fs.rmdir(path, { recursive: true })` on a `path` that is a file is no longer permitted and results in an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX." - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37216 description: "Using `fs.rmdir(path, { recursive: true })` on a `path` that does not exist is no longer permitted and results in a `ENOENT` error." - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37302 description: The `recursive` option is deprecated, using it triggers a deprecation warning. @@ -3418,7 +3421,7 @@ example/ <!-- YAML added: v0.8.6 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37460 description: The error returned may be an `AggregateError` if more than one error is returned. @@ -3875,7 +3878,7 @@ details. <!-- YAML added: v0.1.29 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37460 description: The error returned may be an `AggregateError` if more than one error is returned. @@ -4797,17 +4800,17 @@ See the POSIX rename(2) documentation for more details. <!-- YAML added: v0.1.21 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37216 description: "Using `fs.rmdirSync(path, { recursive: true })` on a `path` that is a file is no longer permitted and results in an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX." - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37216 description: "Using `fs.rmdirSync(path, { recursive: true })` on a `path` that does not exist is no longer permitted and results in a `ENOENT` error." - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37302 description: The `recursive` option is deprecated, using it triggers a deprecation warning. @@ -5119,6 +5122,9 @@ try { } ``` +When using the async iterator, the {fs.Dir} object will be automatically +closed after the iterator exits. + #### `dir.close()` <!-- YAML added: v12.12.0 diff --git a/doc/api/globals.md b/doc/api/globals.md index 13e7f63d01b713..ea764a20fb30e2 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -18,7 +18,7 @@ that are part of the JavaScript language itself, which are also globally accessible. ## Class: `AbortController` -<!--YAML +<!-- YAML added: v15.0.0 changes: - version: v15.4.0 @@ -148,7 +148,7 @@ This variable may appear to be global but is not. See [`__filename`][]. ## `atob(data)` <!-- YAML -added: REPLACEME +added: v16.0.0 --> > Stability: 3 - Legacy. Use `Buffer.from(data, 'base64')` instead. @@ -157,7 +157,7 @@ Global alias for [`buffer.atob()`][]. ## `btoa(data)` <!-- YAML -added: REPLACEME +added: v16.0.0 --> > Stability: 3 - Legacy. Use `buf.toString('base64')` instead. diff --git a/doc/api/http.md b/doc/api/http.md index d3f773f048a18b..e93e2a5d1ba323 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -272,7 +272,7 @@ terminates them. <!-- YAML added: v0.11.4 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36409 description: The property now has a `null` prototype. --> @@ -342,7 +342,7 @@ can have open. Unlike `maxSockets`, this parameter applies across all origins. <!-- YAML added: v0.5.9 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36409 description: The property now has a `null` prototype. --> @@ -356,7 +356,7 @@ sockets. Do not modify. <!-- YAML added: v0.3.6 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36409 description: The property now has a `null` prototype. --> @@ -2020,7 +2020,7 @@ const req = http.request({ ### `message.connection` <!-- YAML added: v0.1.90 -deprecated: REPLACEME +deprecated: v16.0.0 --> > Stability: 0 - Deprecated. Use [`message.socket`][]. diff --git a/doc/api/http2.md b/doc/api/http2.md index fa7c666e87436b..7956e8e82d236e 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1669,10 +1669,17 @@ server.on('stream', (stream) => { } function onError(err) { - if (err.code === 'ENOENT') { - stream.respond({ ':status': 404 }); - } else { - stream.respond({ ':status': 500 }); + // stream.respond() can throw if the stream has been destroyed by + // the other side. + try { + if (err.code === 'ENOENT') { + stream.respond({ ':status': 404 }); + } else { + stream.respond({ ':status': 500 }); + } + } catch (err) { + // Perform actual error handling. + console.log(err); } stream.end(); } @@ -1815,9 +1822,17 @@ an `Http2Session` object associated with the `Http2Server`. added: v8.4.0 --> +* `stream` {Http2Stream} A reference to the stream +* `headers` {HTTP/2 Headers Object} An object describing the headers +* `flags` {number} The associated numeric flags +* `rawHeaders` {Array} An array containing the raw header names followed by + their respective values. + The `'stream'` event is emitted when a `'stream'` event has been emitted by an `Http2Session` associated with the server. +See also [`Http2Session`'s `'stream'` event][]. + ```js const http2 = require('http2'); const { @@ -2003,9 +2018,17 @@ an `Http2Session` object associated with the `Http2SecureServer`. added: v8.4.0 --> +* `stream` {Http2Stream} A reference to the stream +* `headers` {HTTP/2 Headers Object} An object describing the headers +* `flags` {number} The associated numeric flags +* `rawHeaders` {Array} An array containing the raw header names followed by + their respective values. + The `'stream'` event is emitted when a `'stream'` event has been emitted by an `Http2Session` associated with the server. +See also [`Http2Session`'s `'stream'` event][]. + ```js const http2 = require('http2'); const { @@ -3838,6 +3861,7 @@ you need to implement any fall-back behaviour yourself. [`Http2ServerRequest`]: #http2_class_http2_http2serverrequest [`Http2ServerResponse`]: #http2_class_http2_http2serverresponse [`Http2Session` and Sockets]: #http2_http2session_and_sockets +[`Http2Session`'s `'stream'` event]: #http2_event_stream [`Http2Stream`]: #http2_class_http2stream [`ServerHttp2Stream`]: #http2_class_serverhttp2stream [`TypeError`]: errors.md#errors_class_typeerror diff --git a/doc/api/modules.md b/doc/api/modules.md index 6d7f4077fe08ac..a28be94e536e49 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -282,7 +282,7 @@ irrespective of whether or not `./foo` and `./FOO` are the same file. <!--type=misc--> <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37246 description: Added `node:` import support to `require(...)`. --> diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 01e365ac050183..3e31c638cece40 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -286,12 +286,14 @@ listed as supporting a later version. <th scope="col">5</th> <th scope="col">6</th> <th scope="col">7</th> + <th scope="col">8</th> </tr> <tr> <th scope="row">v10.x</th> <td>v10.16.0</td> <td>v10.17.0</td> <td>v10.20.0</td> + <td>v10.23.0</td> <td></td> </tr> <tr> @@ -300,6 +302,7 @@ listed as supporting a later version. <td></td> <td></td> <td></td> + <td></td> </tr> <tr> <th scope="row">v12.x</th> @@ -307,6 +310,7 @@ listed as supporting a later version. <td>v12.11.0</td> <td>v12.17.0</td> <td>v12.19.0</td> + <td>v12.22.0</td> </tr> <tr> <th scope="row">v13.x</th> @@ -314,6 +318,7 @@ listed as supporting a later version. <td>v13.0.0</td> <td></td> <td></td> + <td></td> </tr> <tr> <th scope="row">v14.x</th> @@ -321,6 +326,23 @@ listed as supporting a later version. <td>v14.0.0</td> <td>v14.0.0</td> <td>v14.12.0</td> + <td></td> + </tr> + <tr> + <th scope="row">v15.x</th> + <td>v15.0.0</td> + <td>v15.0.0</td> + <td>v15.0.0</td> + <td>v15.0.0</td> + <td>v15.12.0</td> + </tr> + <tr> + <th scope="row">v16.x</th> + <td>v16.0.0</td> + <td>v16.0.0</td> + <td>v16.0.0</td> + <td>v16.0.0</td> + <td>v16.0.0</td> </tr> </table> diff --git a/doc/api/net.md b/doc/api/net.md index 699b1ba4d573b8..5066179046c8c1 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -551,9 +551,10 @@ changes: * `options` {Object} Available options are: * `fd` {number} If specified, wrap around an existing socket with the given file descriptor, otherwise a new socket will be created. - * `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections - are allowed. See [`net.createServer()`][] and the [`'end'`][] event - for details. **Default:** `false`. + * `allowHalfOpen` {boolean} If set to `false`, then the socket will + automatically end the writable side when the readable side ends. See + [`net.createServer()`][] and the [`'end'`][] event for details. **Default:** + `false`. * `readable` {boolean} Allow reads on the socket when an `fd` is passed, otherwise ignored. **Default:** `false`. * `writable` {boolean} Allow writes on the socket when an `fd` is passed, @@ -612,14 +613,14 @@ See also: the return values of `socket.write()`. added: v0.1.90 --> -Emitted when the other end of the socket sends a FIN packet, thus ending the -readable side of the socket. +Emitted when the other end of the socket signals the end of transmission, thus +ending the readable side of the socket. -By default (`allowHalfOpen` is `false`) the socket will send a FIN packet -back and destroy its file descriptor once it has written out its pending -write queue. However, if `allowHalfOpen` is set to `true`, the socket will -not automatically [`end()`][`socket.end()`] its writable side, allowing the -user to write arbitrary amounts of data. The user must call +By default (`allowHalfOpen` is `false`) the socket will send an end of +transmission packet back and destroy its file descriptor once it has written out +its pending write queue. However, if `allowHalfOpen` is set to `true`, the +socket will not automatically [`end()`][`socket.end()`] its writable side, +allowing the user to write arbitrary amounts of data. The user must call [`end()`][`socket.end()`] explicitly to close the connection (i.e. sending a FIN packet back). @@ -1006,6 +1007,12 @@ Set the encoding for the socket as a [Readable Stream][]. See ### `socket.setKeepAlive([enable][, initialDelay])` <!-- YAML added: v0.1.92 +changes: + - version: + - v13.12.0 + - v12.17.0 + pr-url: https://github.com/nodejs/node/pull/32204 + description: New defaults for `TCP_KEEPCNT` and `TCP_KEEPINTVL` socket options were added. --> * `enable` {boolean} **Default:** `false` @@ -1020,6 +1027,12 @@ data packet received and the first keepalive probe. Setting `0` for `initialDelay` will leave the value unchanged from the default (or previous) setting. +Enabling the keep-alive functionality will set the following socket options: +* `SO_KEEPALIVE=1` +* `TCP_KEEPIDLE=initialDelay` +* `TCP_KEEPCNT=10` +* `TCP_KEEPINTVL=1` + ### `socket.setNoDelay([noDelay])` <!-- YAML added: v0.1.90 @@ -1295,8 +1308,9 @@ added: v0.5.0 --> * `options` {Object} - * `allowHalfOpen` {boolean} Indicates whether half-opened TCP - connections are allowed. **Default:** `false`. + * `allowHalfOpen` {boolean} If set to `false`, then the socket will + automatically end the writable side when the readable side ends. + **Default:** `false`. * `pauseOnConnect` {boolean} Indicates whether the socket should be paused on incoming connections. **Default:** `false`. * `connectionListener` {Function} Automatically set as a listener for the @@ -1306,10 +1320,12 @@ added: v0.5.0 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 -half-closed (non-readable but still writable). See [`'end'`][] event -and [RFC 1122][half-closed] (section 4.2.2.13) for more information. +signals the end of transmission, the server will only send back the end of +transmission when [`socket.end()`][] is explicitly called. For example, in the +context of TCP, when a FIN packed is received, a FIN packed is sent +back only when [`socket.end()`][] is explicitly called. Until then the +connection is half-closed (non-readable but still writable). See [`'end'`][] +event and [RFC 1122][half-closed] (section 4.2.2.13) for more information. If `pauseOnConnect` is set to `true`, then the socket associated with each incoming connection will be paused, and no data will be read from its handle. diff --git a/doc/api/packages.md b/doc/api/packages.md index f14770e34d90aa..f91184208af43e 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -291,7 +291,7 @@ import submodule from 'es-module-package/private-module.js'; ``` ### Subpath imports -<!--YAML +<!-- YAML added: - v14.6.0 - v12.19.0 @@ -333,10 +333,10 @@ The resolution rules for the imports field are otherwise analogous to the exports field. ### Subpath patterns -<!--YAML +<!-- YAML added: - v14.13.0 - - v12.19.0 + - v12.20.0 --> For packages with a small number of exports or imports, we recommend @@ -386,7 +386,7 @@ targets, this expansion is dependent on only the files of the package itself. ### Subpath folder mappings <!-- YAML changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37215 description: Runtime deprecation. - version: v15.1.0 @@ -428,7 +428,7 @@ The benefit of patterns over folder exports is that packages can always be imported by consumers without subpath file extensions being necessary. ### Exports sugar -<!--YAML +<!-- YAML added: v12.11.0 --> @@ -455,7 +455,7 @@ can be written: ``` ### Conditional exports -<!--YAML +<!-- YAML added: - v13.2.0 - v12.16.0 @@ -630,7 +630,7 @@ The above definitions may be moved to a dedicated conditions registry in due course. ### Self-referencing a package using its name -<!--YAML +<!-- YAML added: - v13.1.0 - v12.16.0 @@ -1076,6 +1076,7 @@ added: v12.7.0 changes: - version: - v14.13.0 + - v12.20.0 pr-url: https://github.com/nodejs/node/pull/34718 description: Add support for `"exports"` patterns. - version: @@ -1118,7 +1119,9 @@ All paths defined in the `"exports"` must be relative file URLs starting with ### `"imports"` <!-- YAML -added: v14.6.0 +added: + - v14.6.0 + - v12.19.0 --> * Type: {Object} diff --git a/doc/api/path.md b/doc/api/path.md index ca62e2f3628bfe..839c45da906677 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -203,7 +203,7 @@ A [`TypeError`][] is thrown if `path` is not a string. added: v0.11.15 --> -* `pathObject` {Object} +* `pathObject` {Object} Any JavaScript object having the following properties: * `dir` {string} * `root` {string} * `base` {string} diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index 4822ca331ee9ce..3609ddfc042bf0 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -119,7 +119,7 @@ are not guaranteed to reflect any correct state of the event loop. <!-- YAML added: v8.5.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37136 description: Updated to conform to the User Timing Level 3 specification. --> @@ -140,7 +140,7 @@ to mark specific significant moments in the Performance Timeline. <!-- YAML added: v8.5.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37136 description: Updated to conform to the User Timing Level 3 specification. - version: @@ -214,10 +214,10 @@ which the current `node` process began, measured in Unix time. <!-- YAML added: v8.5.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37475 description: Added the histogram option. - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37136 description: Re-implemented to use pure-JavaScript and the ability to time async functions. @@ -261,6 +261,14 @@ If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported once the finally handler is invoked. +### `performance.toJSON()` +<!-- YAML +added: REPLACEME +--> + +An object which is JSON representation of the `performance` object. It +is similar to [`window.performance.toJSON`][] in browsers. + ## Class: `PerformanceEntry` <!-- YAML added: v8.5.0 @@ -268,7 +276,7 @@ added: v8.5.0 ### `performanceEntry.details` <!-- YAML -added: REPLACEME +added: v16.0.0 --> * {any} @@ -308,7 +316,7 @@ added: - v13.9.0 - v12.17.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37136 description: Runtime deprecated. Now moved to the detail property when entryType is 'gc'. @@ -343,7 +351,7 @@ The name of the performance entry. <!-- YAML added: v8.5.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37136 description: Runtime deprecated. Now moved to the detail property when entryType is 'gc'. @@ -577,7 +585,7 @@ Disconnects the `PerformanceObserver` instance from all notifications. <!-- YAML added: v8.5.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/37136 description: Updated to conform to User Timing Level 3. The buffered option has been removed. @@ -1025,4 +1033,5 @@ require('some-module'); [`child_process.spawnSync()`]: child_process.md#child_process_child_process_spawnsync_command_args_options [`process.hrtime()`]: process.md#process_process_hrtime_time [`timeOrigin`]: https://w3c.github.io/hr-time/#dom-performance-timeorigin +[`window.performance.toJSON`]: https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON [`window.performance`]: https://developer.mozilla.org/en-US/docs/Web/API/Window/performance diff --git a/doc/api/process.md b/doc/api/process.md index 938f348b21959b..95dd6a87855954 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -760,7 +760,7 @@ This feature is not available in [`Worker`][] threads. <!-- YAML added: v0.7.7 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/36902 description: Modifying process.config has been deprecated. --> @@ -1415,6 +1415,8 @@ Indicates whether a callback has been set using added: v0.7.6 --> +> Stability: 3 - Legacy. Use [`process.hrtime.bigint()`][] instead. + * `time` {integer[]} The result of a previous call to `process.hrtime()` * Returns: {integer[]} diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 2b8755df413914..4b7db7afc3b948 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -2,7 +2,7 @@ <!--introduced_in=v0.1.25--> -> Stability: 2 - Stable +> Stability: 3 - Legacy <!--name=querystring--> @@ -15,6 +15,9 @@ query strings. It can be accessed using: const querystring = require('querystring'); ``` +The `querystring` API is considered Legacy. While it is still maintained, +new code should use the {URLSearchParams} API instead. + ## `querystring.decode()` <!-- YAML added: v0.1.99 diff --git a/doc/api/repl.md b/doc/api/repl.md index bf5ee1efef3fee..075fa91581c428 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -233,6 +233,23 @@ undefined undefined ``` +One known limitation of using the `await` keyword in the REPL is that +it will invalidate the lexical scoping of the `const` and `let` +keywords. + +For example: + +```console +> const m = await Promise.resolve(123) +undefined +> m +123 +> const m = await Promise.resolve(234) +undefined +> m +234 +``` + ### Reverse-i-search <!-- YAML added: @@ -245,7 +262,7 @@ triggered with <kbd>Ctrl</kbd>+<kbd>R</kbd> to search backward and <kbd>Ctrl</kbd>+<kbd>S</kbd> to search forwards. -Duplicated history entires will be skipped. +Duplicated history entries will be skipped. Entries are accepted as soon as any key is pressed that doesn't correspond with the reverse search. Cancelling is possible by pressing <kbd>Esc</kbd> or diff --git a/doc/api/timers.md b/doc/api/timers.md index 65453a4576b40e..8f6144e9445478 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -324,7 +324,7 @@ Cancels a `Timeout` object created by [`setTimeout()`][]. <!-- YAML added: v15.0.0 changes: - - version: REPLACEME + - version: v16.0.0 pr-url: https://github.com/nodejs/node/pull/38112 description: Graduated from experimental. --> diff --git a/doc/api/tls.md b/doc/api/tls.md index 0b8795661b1002..b82de483f9b825 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -730,7 +730,8 @@ existing server. Existing connections to the server are not interrupted. added: v3.0.0 --> -* `keys` {Buffer} A 48-byte buffer containing the session ticket keys. +* `keys` {Buffer|TypedArray|DataView} A 48-byte buffer containing the session + ticket keys. Sets the session ticket keys. @@ -849,6 +850,9 @@ determine if the server certificate was signed by one of the specified CAs. If `tlsSocket.alpnProtocol` property can be checked to determine the negotiated protocol. +The `'secureConnect'` event is not emitted when a {tls.TLSSocket} is created +using the `new tls.TLSSocket()` constructor. + ### Event: `'session'` <!-- YAML added: v11.10.0 @@ -1472,10 +1476,10 @@ changes: Connection/disconnection/destruction of `socket` is the user's responsibility; calling `tls.connect()` will not cause `net.connect()` to be called. - * `allowHalfOpen` {boolean} If the `socket` option is missing, indicates - whether or not to allow the internally created socket to be half-open, - otherwise the option is ignored. See the `allowHalfOpen` option of - [`net.Socket`][] for details. **Default:** `false`. + * `allowHalfOpen` {boolean} If set to `false`, then the socket will + automatically end the writable side when the readable side ends. If the + `socket` option is set, this option has no effect. See the `allowHalfOpen` + option of [`net.Socket`][] for details. **Default:** `false`. * `rejectUnauthorized` {boolean} If not `false`, the server certificate is verified against the list of supplied CAs. An `'error'` event is emitted if verification fails; `err.code` contains the OpenSSL error code. **Default:** diff --git a/doc/api/util.md b/doc/api/util.md index 94d41cd22bf92c..4f3ff2e7358df9 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -378,7 +378,7 @@ fs.access('file/that/does/not/exist', (err) => { ## `util.getSystemErrorMap()` <!-- YAML -added: REPLACEME +added: v16.0.0 --> * Returns: {Map} @@ -576,12 +576,11 @@ changes: (in combination with `compact` set to `true` or any number >= `1`). **Default:** `80`. * `compact` {boolean|integer} Setting this to `false` causes each object key - to be displayed on a new line. It will also add new lines to text that is + to be displayed on a new line. It will break on new lines in text that is longer than `breakLength`. If set to a number, the most `n` inner elements are united on a single line as long as all properties fit into - `breakLength`. Short array elements are also grouped together. No - text will be reduced below 16 characters, no matter the `breakLength` size. - For more information, see the example below. **Default:** `3`. + `breakLength`. Short array elements are also grouped together. For more + information, see the example below. **Default:** `3`. * `sorted` {boolean|Function} If set to `true` or a function, all properties of an object, and `Set` and `Map` entries are sorted in the resulting string. If set to `true` the [default sort][] is used. If set to a function, @@ -649,8 +648,8 @@ const util = require('util'); const o = { a: [1, 2, [[ - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ' + - 'eiusmod tempor incididunt ut labore et dolore magna aliqua.', + 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + + 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', 'test', 'foo']], 4], b: new Map([['za', 1], ['zb', 'test']]) @@ -660,13 +659,13 @@ console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); // { a: // [ 1, // 2, -// [ [ 'Lorem ipsum dolor sit amet, consectetur [...]', // A long line +// [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line // 'test', // 'foo' ] ], // 4 ], // b: Map(2) { 'za' => 1, 'zb' => 'test' } } -// Setting `compact` to false changes the output to be more reader friendly. +// Setting `compact` to false or an integer creates more reader friendly output. console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); // { @@ -675,10 +674,9 @@ console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); // 2, // [ // [ -// 'Lorem ipsum dolor sit amet, consectetur ' + -// 'adipiscing elit, sed do eiusmod tempor ' + -// 'incididunt ut labore et dolore magna ' + -// 'aliqua., +// 'Lorem ipsum dolor sit amet,\n' + +// 'consectetur adipiscing elit, sed do eiusmod \n' + +// 'tempor incididunt ut labore et dolore magna aliqua.', // 'test', // 'foo' // ] @@ -693,8 +691,6 @@ console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a // single line. -// Reducing the `breakLength` will split the "Lorem ipsum" text in smaller -// chunks. ``` The `showHidden` option allows [`WeakMap`][] and [`WeakSet`][] entries to be diff --git a/doc/api/vm.md b/doc/api/vm.md index cad26d9f306a4f..8177a7b38556be 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -1061,7 +1061,7 @@ added: v0.11.7 * `object` {Object} * Returns: {boolean} -Returns `true` if the given `oject` object has been [contextified][] using +Returns `true` if the given `object` object has been [contextified][] using [`vm.createContext()`][]. ## `vm.runInContext(code, contextifiedObject[, options])` diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 48066b9532728c..5d0781751ca6b2 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -279,7 +279,7 @@ new Worker('process.env.SET_IN_WORKER = "foo"', { eval: true, env: SHARE_ENV }) ``` ## `worker.setEnvironmentData(key[, value])` -<!--YAML +<!-- YAML added: v15.12.0 --> @@ -666,7 +666,7 @@ Depending on how a `Buffer` instance was created, it may or may not own its underlying `ArrayBuffer`. An `ArrayBuffer` must not be transferred unless it is known that the `Buffer` instance owns it. In particular, for `Buffer`s created from the internal -`Buffer` pool (using, for instance `Buffer.from()` or `Buffer.alloc()`), +`Buffer` pool (using, for instance `Buffer.from()` or `Buffer.allocUnsafe()`), transferring them is not possible and they are always cloned, which sends a copy of the entire `Buffer` pool. This behavior may come with unintended higher memory diff --git a/doc/changelogs/CHANGELOG_V010.md b/doc/changelogs/CHANGELOG_V010.md index 50ad492c21bd06..5d375fa17ffba3 100644 --- a/doc/changelogs/CHANGELOG_V010.md +++ b/doc/changelogs/CHANGELOG_V010.md @@ -66,6 +66,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V012.md b/doc/changelogs/CHANGELOG_V012.md index d518019b97db57..3b2d19692ca8ce 100644 --- a/doc/changelogs/CHANGELOG_V012.md +++ b/doc/changelogs/CHANGELOG_V012.md @@ -34,6 +34,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V10.md b/doc/changelogs/CHANGELOG_V10.md index dc28db6b39c98c..21711f018e2151 100644 --- a/doc/changelogs/CHANGELOG_V10.md +++ b/doc/changelogs/CHANGELOG_V10.md @@ -60,6 +60,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V11.md b/doc/changelogs/CHANGELOG_V11.md index 8264af62cf2e0c..8ff4527f81f9f8 100644 --- a/doc/changelogs/CHANGELOG_V11.md +++ b/doc/changelogs/CHANGELOG_V11.md @@ -32,6 +32,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V12.md b/doc/changelogs/CHANGELOG_V12.md index b4b834c996f61d..44511609490f22 100644 --- a/doc/changelogs/CHANGELOG_V12.md +++ b/doc/changelogs/CHANGELOG_V12.md @@ -58,6 +58,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V13.md b/doc/changelogs/CHANGELOG_V13.md index c26fd235d48f68..412824b14d2f65 100644 --- a/doc/changelogs/CHANGELOG_V13.md +++ b/doc/changelogs/CHANGELOG_V13.md @@ -32,6 +32,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [12.x](CHANGELOG_V12.md) diff --git a/doc/changelogs/CHANGELOG_V14.md b/doc/changelogs/CHANGELOG_V14.md index 00f1edde582bf9..294d37e2f8759c 100644 --- a/doc/changelogs/CHANGELOG_V14.md +++ b/doc/changelogs/CHANGELOG_V14.md @@ -43,6 +43,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [13.x](CHANGELOG_V13.md) * [12.x](CHANGELOG_V12.md) diff --git a/doc/changelogs/CHANGELOG_V15.md b/doc/changelogs/CHANGELOG_V15.md index 513d3d2068a018..1855da132b18f6 100644 --- a/doc/changelogs/CHANGELOG_V15.md +++ b/doc/changelogs/CHANGELOG_V15.md @@ -33,6 +33,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) * [12.x](CHANGELOG_V12.md) diff --git a/doc/changelogs/CHANGELOG_V16.md b/doc/changelogs/CHANGELOG_V16.md new file mode 100644 index 00000000000000..a198d504fe49ed --- /dev/null +++ b/doc/changelogs/CHANGELOG_V16.md @@ -0,0 +1,389 @@ +# Node.js 16 ChangeLog + +<!--lint disable prohibited-strings--> +<!--lint disable maximum-line-length--> +<!--lint disable no-literal-urls--> + +<table> +<tr> +<th>Current</th> +</tr> +<tr> +<td> +<a href="#16.0.0">16.0.0</a><br/> +</td> +</tr> +</table> + +* Other Versions + * [15.x](CHANGELOG_V15.md) + * [14.x](CHANGELOG_V14.md) + * [13.x](CHANGELOG_V13.md) + * [12.x](CHANGELOG_V12.md) + * [11.x](CHANGELOG_V11.md) + * [10.x](CHANGELOG_V10.md) + * [9.x](CHANGELOG_V9.md) + * [8.x](CHANGELOG_V8.md) + * [7.x](CHANGELOG_V7.md) + * [6.x](CHANGELOG_V6.md) + * [5.x](CHANGELOG_V5.md) + * [4.x](CHANGELOG_V4.md) + * [0.12.x](CHANGELOG_V012.md) + * [0.10.x](CHANGELOG_V010.md) + * [io.js](CHANGELOG_IOJS.md) + * [Archive](CHANGELOG_ARCHIVE.md) + +<a id="16.0.0"></a> +## 2021-04-20, Version 16.0.0 (Current), @BethGriggs + +### Notable Changes + +#### Deprecations and Removals + +* **(SEMVER-MAJOR)** **fs**: remove permissive rmdir recursive (Antoine du Hamel) [#37216](https://github.com/nodejs/node/pull/37216) +* **(SEMVER-MAJOR)** **fs**: runtime deprecate rmdir recursive option (Antoine du Hamel) [#37302](https://github.com/nodejs/node/pull/37302) +* **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('http\_parser') (James M Snell) [#37813](https://github.com/nodejs/node/pull/37813) +* **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('url') (James M Snell) [#37799](https://github.com/nodejs/node/pull/37799) +* **(SEMVER-MAJOR)** **lib**: make process.binding('util') return only type checkers (Anna Henningsen) [#37819](https://github.com/nodejs/node/pull/37819) +* **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('crypto') (James M Snell) [#37790](https://github.com/nodejs/node/pull/37790) +* **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('signal\_wrap') (James M Snell) [#37800](https://github.com/nodejs/node/pull/37800) +* **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('v8') (James M Snell) [#37789](https://github.com/nodejs/node/pull/37789) +* **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('async\_wrap') (James M Snell) [#37576](https://github.com/nodejs/node/pull/37576) +* **(SEMVER-MAJOR)** **module**: remove module.createRequireFromPath (Antoine du Hamel) [#37201](https://github.com/nodejs/node/pull/37201) +* **(SEMVER-MAJOR)** **module**: runtime deprecate subpath folder mappings (Antoine du Hamel) [#37215](https://github.com/nodejs/node/pull/37215) +* **(SEMVER-MAJOR)** **module**: runtime deprecate "main" index and extension lookups (Antoine du Hamel) [#37206](https://github.com/nodejs/node/pull/37206) +* **(SEMVER-MAJOR)** **module**: runtime deprecate invalid package.json main entries (Antoine du Hamel) [#37204](https://github.com/nodejs/node/pull/37204) +* **(SEMVER-MAJOR)** **process**: runtime deprecate changing process.config (James M Snell) [#36902](https://github.com/nodejs/node/pull/36902) + +#### Stable Timers Promises API + +The Timers Promises API provides an alternative set of timer functions that return Promise objects. Added in Node.js v15.0.0, in this release they graduate from experimental status to stable. + +Contributed by James Snell - [#38112](https://github.com/nodejs/node/pull/38112) + +#### Toolchain and Compiler Upgrades + +Node.js v16.0.0 will be the first release where we ship prebuilt binaries for Apple Silicon. While we’ll be providing separate tarballs for the Intel (`darwin-x64`) and ARM (`darwin-arm64`) architectures the macOS installer (`.pkg`) will be shipped as a ‘fat’ (multi-architecture) binary. + +* **(SEMVER-MAJOR)** **build**: remove support for Python 2 (Christian Clauss) [#36691](https://github.com/nodejs/node/pull/36691) +* **(SEMVER-MAJOR)** **build**: default PYTHON to python3 in Makefile (Michaël Zasso) [#37764](https://github.com/nodejs/node/pull/37764) +* **build**: update Makefile to support fat binary (Ash Cripps) [#37861](https://github.com/nodejs/node/pull/37861) +* **(SEMVER-MAJOR)** **build**: enable ASLR (PIE) on OS X (woodfairy) [#35704](https://github.com/nodejs/node/pull/35704) +* **build**: warn for gcc versions earlier than 8.3.0 (Richard Lau) [#37935](https://github.com/nodejs/node/pull/37935) +* **(SEMVER-MAJOR)** **doc**: update minimum supported Xcode to 11 (Michaël Zasso) [#37872](https://github.com/nodejs/node/pull/37872) +* **(SEMVER-MAJOR)** **doc**: update minimum supported GCC to 8.3 (Michaël Zasso) [#37871](https://github.com/nodejs/node/pull/37871) +* **(SEMVER-MAJOR)** **doc**: update AIX to GCC8 for v16.x (Ash Cripps) [#37677](https://github.com/nodejs/node/pull/37677) +* **tools**: set arch in Distribution.xml (Ash Cripps) [#38261](https://github.com/nodejs/node/pull/38261) + +#### V8 9.0 + +The V8 JavaScript engine is updated to V8 9.0, including performance tweaks and improvements. + +This update also brings the ECMAScript RegExp Match Indices, which provide the start and end indices of the captured string. The indices array is available via the `.indices` property on match objects when the regular expression has the `/d` flag. + +Contributed by Michaël Zasso - [#37587](https://github.com/nodejs/node/pull/37587) + +#### Other Notable Changes + +* **(SEMVER-MINOR)** **assert**: graduate assert.match and assert.doesNotMatch (James M Snell) [#38111](https://github.com/nodejs/node/pull/38111) +* **(SEMVER-MAJOR)** **buffer**: expose btoa and atob as globals (James M Snell) [#37786](https://github.com/nodejs/node/pull/37786) +* **(SEMVER-MAJOR)** **deps**: bump minimum ICU version to 68 (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* **deps**: update ICU to 69.1 (Michaël Zasso) [#38178](https://github.com/nodejs/node/pull/38178) +* **deps**: update llhttp to 6.0.0 (Fedor Indutny) [#38277](https://github.com/nodejs/node/pull/38277) +* **deps**: upgrade npm to 7.10.0 (Ruy Adorno) [#38254](https://github.com/nodejs/node/pull/38254) +* **(SEMVER-MINOR)** **http**: add http.ClientRequest.getRawHeaderNames() (simov) [#37660](https://github.com/nodejs/node/pull/37660) +* **(SEMVER-MAJOR)** **lib,src**: update cluster to use Parent (Michael Dawson) [#36478](https://github.com/nodejs/node/pull/36478) +* **(SEMVER-MINOR)** **module**: add support for `node:`‑prefixed `require(…)` calls (ExE Boss) [#37246](https://github.com/nodejs/node/pull/37246) +* **(SEMVER-MINOR)** **perf_hooks**: add histogram option to timerify (James M Snell) [#37475](https://github.com/nodejs/node/pull/37475) +* **(SEMVER-MINOR)** **repl**: add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) [#37246](https://github.com/nodejs/node/pull/37246) +* **(SEMVER-MINOR)** **util**: add getSystemErrorMap() impl (eladkeyshawn) [#38101](https://github.com/nodejs/node/pull/38101) + +### Semver-Major Commits + +* [[`324a6c235a`](https://github.com/nodejs/node/commit/324a6c235a)] - **(SEMVER-MAJOR)** **async_hooks**: add thisArg to AsyncResource.bind (James M Snell) [#36782](https://github.com/nodejs/node/pull/36782) +* [[`d1e2184c8e`](https://github.com/nodejs/node/commit/d1e2184c8e)] - **(SEMVER-MAJOR)** **buffer**: expose btoa and atob as globals (James M Snell) [#37786](https://github.com/nodejs/node/pull/37786) +* [[`4268fae04a`](https://github.com/nodejs/node/commit/4268fae04a)] - **(SEMVER-MAJOR)** **build**: remove support for Python 2 (Christian Clauss) [#36691](https://github.com/nodejs/node/pull/36691) +* [[`c3a5e15ebe`](https://github.com/nodejs/node/commit/c3a5e15ebe)] - **(SEMVER-MAJOR)** **build**: default PYTHON to python3 in Makefile (Michaël Zasso) [#37764](https://github.com/nodejs/node/pull/37764) +* [[`1d8c022544`](https://github.com/nodejs/node/commit/1d8c022544)] - **(SEMVER-MAJOR)** **build**: update Makefile to support fat binary (Ash Cripps) [#37861](https://github.com/nodejs/node/pull/37861) +* [[`38f32386c1`](https://github.com/nodejs/node/commit/38f32386c1)] - **(SEMVER-MAJOR)** **build**: include minimal V8 headers in distribution (Michaël Zasso) [#37570](https://github.com/nodejs/node/pull/37570) +* [[`a19af5ee71`](https://github.com/nodejs/node/commit/a19af5ee71)] - **(SEMVER-MAJOR)** **build**: use C++11 ABI with libstdc++ (Anna Henningsen) [#36634](https://github.com/nodejs/node/pull/36634) +* [[`8d6b74d347`](https://github.com/nodejs/node/commit/8d6b74d347)] - **(SEMVER-MAJOR)** **build**: enable ASLR (PIE) on OS X (woodfairy) [#35704](https://github.com/nodejs/node/pull/35704) +* [[`732ad99e47`](https://github.com/nodejs/node/commit/732ad99e47)] - **(SEMVER-MAJOR)** **deps**: update V8 to 9.0.257.11 (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`43cc8e4b2e`](https://github.com/nodejs/node/commit/43cc8e4b2e)] - **(SEMVER-MAJOR)** **deps**: bump minimum ICU version to 68 (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`c5ff019a4e`](https://github.com/nodejs/node/commit/c5ff019a4e)] - **(SEMVER-MAJOR)** **deps**: update V8 to 8.9.255.19 (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`c7b3292251`](https://github.com/nodejs/node/commit/c7b3292251)] - **(SEMVER-MAJOR)** **deps**: update V8 to 8.8.278.17 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`48db20f6f5`](https://github.com/nodejs/node/commit/48db20f6f5)] - **(SEMVER-MAJOR)** **deps**: update V8 to 8.7.220 (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`d85e1f0703`](https://github.com/nodejs/node/commit/d85e1f0703)] - **(SEMVER-MAJOR)** **dns**: use url module instead of punycode for IDNA (Antoine du Hamel) [#35091](https://github.com/nodejs/node/pull/35091) +* [[`290c158018`](https://github.com/nodejs/node/commit/290c158018)] - **(SEMVER-MAJOR)** **doc**: update minimum supported Xcode to 11 (Michaël Zasso) [#37872](https://github.com/nodejs/node/pull/37872) +* [[`1ff2918d80`](https://github.com/nodejs/node/commit/1ff2918d80)] - **(SEMVER-MAJOR)** **doc**: update minimum supported GCC to 8.3 (Michaël Zasso) [#37871](https://github.com/nodejs/node/pull/37871) +* [[`2706e67116`](https://github.com/nodejs/node/commit/2706e67116)] - **(SEMVER-MAJOR)** **doc**: update AIX to GCC8 for v16.x (Ash Cripps) [#37677](https://github.com/nodejs/node/pull/37677) +* [[`5ae5ca90ef`](https://github.com/nodejs/node/commit/5ae5ca90ef)] - **(SEMVER-MAJOR)** **doc**: add http.IncomingMessage#connection (Pranshu Srivastava) [#33768](https://github.com/nodejs/node/pull/33768) +* [[`83d6e63aee`](https://github.com/nodejs/node/commit/83d6e63aee)] - **(SEMVER-MAJOR)** **events**: change EventTarget handler exception behavior (Nitzan Uziely) [#37237](https://github.com/nodejs/node/pull/37237) +* [[`9948036ee0`](https://github.com/nodejs/node/commit/9948036ee0)] - **(SEMVER-MAJOR)** **fs**: remove permissive rmdir recursive (Antoine du Hamel) [#37216](https://github.com/nodejs/node/pull/37216) +* [[`d4693ff430`](https://github.com/nodejs/node/commit/d4693ff430)] - **(SEMVER-MAJOR)** **fs**: add validation for fd and path (Dylan Elliott) [#35187](https://github.com/nodejs/node/pull/35187) +* [[`0ddd75bcd8`](https://github.com/nodejs/node/commit/0ddd75bcd8)] - **(SEMVER-MAJOR)** **fs**: runtime deprecate rmdir recursive option (Antoine du Hamel) [#37302](https://github.com/nodejs/node/pull/37302) +* [[`da217d0773`](https://github.com/nodejs/node/commit/da217d0773)] - **(SEMVER-MAJOR)** **fs**: fix flag and mode validation (James M Snell) [#37480](https://github.com/nodejs/node/pull/37480) +* [[`2ef9a76ece`](https://github.com/nodejs/node/commit/2ef9a76ece)] - **(SEMVER-MAJOR)** **http**: use objects with null prototype in Agent (Michaël Zasso) [#36409](https://github.com/nodejs/node/pull/36409) +* [[`25e30005b8`](https://github.com/nodejs/node/commit/25e30005b8)] - **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('http\_parser') (James M Snell) [#37813](https://github.com/nodejs/node/pull/37813) +* [[`8bb4e048af`](https://github.com/nodejs/node/commit/8bb4e048af)] - **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('url') (James M Snell) [#37799](https://github.com/nodejs/node/pull/37799) +* [[`fe73e4d578`](https://github.com/nodejs/node/commit/fe73e4d578)] - **(SEMVER-MAJOR)** **lib**: make process.binding('util') return only type checkers (Anna Henningsen) [#37819](https://github.com/nodejs/node/pull/37819) +* [[`3bee6d8aad`](https://github.com/nodejs/node/commit/3bee6d8aad)] - **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('crypto') (James M Snell) [#37790](https://github.com/nodejs/node/pull/37790) +* [[`ac00df112e`](https://github.com/nodejs/node/commit/ac00df112e)] - **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('signal\_wrap') (James M Snell) [#37800](https://github.com/nodejs/node/pull/37800) +* [[`ae595d76e3`](https://github.com/nodejs/node/commit/ae595d76e3)] - **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('v8') (James M Snell) [#37789](https://github.com/nodejs/node/pull/37789) +* [[`104dac79cc`](https://github.com/nodejs/node/commit/104dac79cc)] - **(SEMVER-MAJOR)** **lib**: aggregate errors to avoid error swallowing (Antoine du Hamel) [#37460](https://github.com/nodejs/node/pull/37460) +* [[`1468c9ff7c`](https://github.com/nodejs/node/commit/1468c9ff7c)] - **(SEMVER-MAJOR)** **lib**: runtime deprecate access to process.binding('async\_wrap') (James M Snell) [#37576](https://github.com/nodejs/node/pull/37576) +* [[`295e766c27`](https://github.com/nodejs/node/commit/295e766c27)] - **(SEMVER-MAJOR)** **lib**: remove usage of url.parse (raisinten) [#36853](https://github.com/nodejs/node/pull/36853) +* [[`cb3020d824`](https://github.com/nodejs/node/commit/cb3020d824)] - **(SEMVER-MAJOR)** **lib**: add error handling for input stream (rexagod) [#31603](https://github.com/nodejs/node/pull/31603) +* [[`15164cebce`](https://github.com/nodejs/node/commit/15164cebce)] - **(SEMVER-MAJOR)** **lib,src**: update cluster to use Parent (Michael Dawson) [#36478](https://github.com/nodejs/node/pull/36478) +* [[`3cc9aec988`](https://github.com/nodejs/node/commit/3cc9aec988)] - **(SEMVER-MAJOR)** **module**: runtime deprecate subpath folder mappings (Antoine du Hamel) [#37215](https://github.com/nodejs/node/pull/37215) +* [[`9fab73c73b`](https://github.com/nodejs/node/commit/9fab73c73b)] - **(SEMVER-MAJOR)** **module**: runtime deprecate "main" index and extension lookups (Antoine du Hamel) [#37206](https://github.com/nodejs/node/pull/37206) +* [[`76a073b67e`](https://github.com/nodejs/node/commit/76a073b67e)] - **(SEMVER-MAJOR)** **module**: runtime deprecate invalid package.json main entries (Antoine du Hamel) [#37204](https://github.com/nodejs/node/pull/37204) +* [[`674614b3f5`](https://github.com/nodejs/node/commit/674614b3f5)] - **(SEMVER-MAJOR)** **module**: remove module.createRequireFromPath (Antoine du Hamel) [#37201](https://github.com/nodejs/node/pull/37201) +* [[`aecd5ebf49`](https://github.com/nodejs/node/commit/aecd5ebf49)] - **(SEMVER-MAJOR)** **module**: only set cache when finding module succeeds (Yongsheng Zhang) [#36642](https://github.com/nodejs/node/pull/36642) +* [[`f0bf373176`](https://github.com/nodejs/node/commit/f0bf373176)] - **(SEMVER-MAJOR)** **perf_hooks**: make performance a global (James M Snell) [#37970](https://github.com/nodejs/node/pull/37970) +* [[`f3eb224c83`](https://github.com/nodejs/node/commit/f3eb224c83)] - **(SEMVER-MAJOR)** **perf_hooks**: complete overhaul of the implementation (James M Snell) [#37136](https://github.com/nodejs/node/pull/37136) +* [[`f1753d4c76`](https://github.com/nodejs/node/commit/f1753d4c76)] - **(SEMVER-MAJOR)** **process**: disallow adding options to process.allowedNodeEnvironmentFlags (Antoine du Hamel) [#36660](https://github.com/nodejs/node/pull/36660) +* [[`96f3977ded`](https://github.com/nodejs/node/commit/96f3977ded)] - **(SEMVER-MAJOR)** **process**: runtime deprecate changing process.config (James M Snell) [#36902](https://github.com/nodejs/node/pull/36902) +* [[`45dbcbef90`](https://github.com/nodejs/node/commit/45dbcbef90)] - **(SEMVER-MAJOR)** **readline**: cursorTo throw error on NaN (Zijian Liu) [#36379](https://github.com/nodejs/node/pull/36379) +* [[`bf79987433`](https://github.com/nodejs/node/commit/bf79987433)] - **(SEMVER-MAJOR)** **src**: mark internally exported functions as explicitly internal (Tyler Ang-Wanek) [#37000](https://github.com/nodejs/node/pull/37000) +* [[`1fe571aa0c`](https://github.com/nodejs/node/commit/1fe571aa0c)] - **(SEMVER-MAJOR)** **src**: inline AsyncCleanupHookHandle in headers (Tyler Ang-Wanek) [#37000](https://github.com/nodejs/node/pull/37000) +* [[`dfc288e7fd`](https://github.com/nodejs/node/commit/dfc288e7fd)] - **(SEMVER-MAJOR)** **src**: clean up embedder API (Anna Henningsen) [#35897](https://github.com/nodejs/node/pull/35897) +* [[`65e8864fa3`](https://github.com/nodejs/node/commit/65e8864fa3)] - **(SEMVER-MAJOR)** **worker**: send correct error status for worker init (Yash Ladha) [#36242](https://github.com/nodejs/node/pull/36242) + +### Semver-Minor Commits + +* [[`944a956087`](https://github.com/nodejs/node/commit/944a956087)] - **(SEMVER-MINOR)** **assert**: graduate assert.match and assert.doesNotMatch (James M Snell) [#38111](https://github.com/nodejs/node/pull/38111) +* [[`6a1986d50a`](https://github.com/nodejs/node/commit/6a1986d50a)] - **(SEMVER-MINOR)** **deps**: update llhttp to 5.1.0 (Fedor Indutny) [#38146](https://github.com/nodejs/node/pull/38146) +* [[`069b5df4f6`](https://github.com/nodejs/node/commit/069b5df4f6)] - **(SEMVER-MINOR)** **module**: add support for `node:`‑prefixed `require(…)` calls (ExE Boss) [#37246](https://github.com/nodejs/node/pull/37246) +* [[`b803bca4fa`](https://github.com/nodejs/node/commit/b803bca4fa)] - **(SEMVER-MINOR)** **perf_hooks**: add histogram option to timerify (James M Snell) [#37475](https://github.com/nodejs/node/pull/37475) +* [[`95391fe689`](https://github.com/nodejs/node/commit/95391fe689)] - **(SEMVER-MINOR)** **repl**: add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) [#37246](https://github.com/nodejs/node/pull/37246) +* [[`15b8e6b1c4`](https://github.com/nodejs/node/commit/15b8e6b1c4)] - **(SEMVER-MINOR)** **timers**: graduate awaitable timers and improve docs (James M Snell) [#38112](https://github.com/nodejs/node/pull/38112) +* [[`802171057f`](https://github.com/nodejs/node/commit/802171057f)] - **(SEMVER-MINOR)** **util**: add getSystemErrorMap() impl (eladkeyshawn) [#38101](https://github.com/nodejs/node/pull/38101) + +### Semver-Patch Commits + +* [[`8930eba199`](https://github.com/nodejs/node/commit/8930eba199)] - **assert**: change status of legacy asserts (James M Snell) [#38113](https://github.com/nodejs/node/pull/38113) +* [[`0180fc5b9b`](https://github.com/nodejs/node/commit/0180fc5b9b)] - **benchmark**: improve compare.R output (Brian White) [#38118](https://github.com/nodejs/node/pull/38118) +* [[`8d9d8236b7`](https://github.com/nodejs/node/commit/8d9d8236b7)] - **bootstrap**: mksnapshot should show JS error (Bradley Meck) [#38174](https://github.com/nodejs/node/pull/38174) +* [[`6cb314bbe5`](https://github.com/nodejs/node/commit/6cb314bbe5)] - **bootstrap**: print information for snapshot at environment exit in debug (Joyee Cheung) [#37967](https://github.com/nodejs/node/pull/37967) +* [[`14aed60941`](https://github.com/nodejs/node/commit/14aed60941)] - **buffer,errors**: add missing n literal in range error string (Cactysman) [#37750](https://github.com/nodejs/node/pull/37750) +* [[`049b703a28`](https://github.com/nodejs/node/commit/049b703a28)] - **build**: sync generation of `v8\_build\_config.json` (Richard Lau) [#38263](https://github.com/nodejs/node/pull/38263) +* [[`1d21a8d140`](https://github.com/nodejs/node/commit/1d21a8d140)] - **build**: add riscv64 configure (luyahan) [#37980](https://github.com/nodejs/node/pull/37980) +* [[`f5eea1744d`](https://github.com/nodejs/node/commit/f5eea1744d)] - **build**: don't run test workflow on doc dir on macOS (ycjcl868) [#37999](https://github.com/nodejs/node/pull/37999) +* [[`2853b76e20`](https://github.com/nodejs/node/commit/2853b76e20)] - **build**: add pummel tests to ci runs (Rich Trott) [#34289](https://github.com/nodejs/node/pull/34289) +* [[`24426cd8c4`](https://github.com/nodejs/node/commit/24426cd8c4)] - **build**: prepare Windows coverage GitHub Action for pummel tests (Rich Trott) [#34289](https://github.com/nodejs/node/pull/34289) +* [[`7df0fc5c5c`](https://github.com/nodejs/node/commit/7df0fc5c5c)] - **build**: move OPENSSL\_API\_COMPAT to else clause (Daniel Bevenius) [#38126](https://github.com/nodejs/node/pull/38126) +* [[`9cfb418e1f`](https://github.com/nodejs/node/commit/9cfb418e1f)] - **build**: package release changelog for releases (Richard Lau) [#38033](https://github.com/nodejs/node/pull/38033) +* [[`558d1e6c22`](https://github.com/nodejs/node/commit/558d1e6c22)] - **build**: warn for gcc versions earlier than 8.3.0 (Richard Lau) [#37935](https://github.com/nodejs/node/pull/37935) +* [[`a572a4e34e`](https://github.com/nodejs/node/commit/a572a4e34e)] - **build**: reset embedder string to "-node.0" (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`f3c7078245`](https://github.com/nodejs/node/commit/f3c7078245)] - **build**: reset embedder string to "-node.0" (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`842389839b`](https://github.com/nodejs/node/commit/842389839b)] - **build**: reset embedder string to "-node.0" (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`98d1ae47cf`](https://github.com/nodejs/node/commit/98d1ae47cf)] - **build**: reset embedder string to "-node.0" (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`993ed19f9c`](https://github.com/nodejs/node/commit/993ed19f9c)] - **crypto**: reduce range of size to int max (Qingyu Deng) [#38096](https://github.com/nodejs/node/pull/38096) +* [[`896dc39951`](https://github.com/nodejs/node/commit/896dc39951)] - **crypto**: fix webcrypto derive(Bits|Key) resolve values and docs (Filip Skokan) [#38148](https://github.com/nodejs/node/pull/38148) +* [[`d2f116c6bb`](https://github.com/nodejs/node/commit/d2f116c6bb)] - **crypto**: fixup randomFill size and offset handling (James M Snell) [#38138](https://github.com/nodejs/node/pull/38138) +* [[`dfe3f952a3`](https://github.com/nodejs/node/commit/dfe3f952a3)] - **crypto**: fix crash in CCM mode without data (Tobias Nießen) [#38102](https://github.com/nodejs/node/pull/38102) +* [[`e8cb6446ef`](https://github.com/nodejs/node/commit/e8cb6446ef)] - **crypto**: reconcile oneshot sign/verify sync and async implementations (Filip Skokan) [#37816](https://github.com/nodejs/node/pull/37816) +* [[`1e4a2bcbee`](https://github.com/nodejs/node/commit/1e4a2bcbee)] - **crypto**: remove check for condition that is always true (Rich Trott) [#38072](https://github.com/nodejs/node/pull/38072) +* [[`64d5be25ab`](https://github.com/nodejs/node/commit/64d5be25ab)] - **deps**: V8: cherry-pick 1648e050cade (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`621b544909`](https://github.com/nodejs/node/commit/621b544909)] - **deps**: silence irrelevant V8 warnings (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`0d78bc3101`](https://github.com/nodejs/node/commit/0d78bc3101)] - **deps**: fix V8 build issue with inline methods (Jiawen Geng) [#35415](https://github.com/nodejs/node/pull/35415) +* [[`5214918856`](https://github.com/nodejs/node/commit/5214918856)] - **deps**: make v8.h compatible with VS2015 (Joao Reis) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`6b3caf77b2`](https://github.com/nodejs/node/commit/6b3caf77b2)] - **deps**: V8: forward declaration of `Rtl\*FunctionTable` (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`d0a032fafb`](https://github.com/nodejs/node/commit/d0a032fafb)] - **deps**: V8: patch register-arm64.h (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`c8b2fa642e`](https://github.com/nodejs/node/commit/c8b2fa642e)] - **deps**: V8: un-cherry-pick bd019bd (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`8eeecc19ae`](https://github.com/nodejs/node/commit/8eeecc19ae)] - **deps**: V8: cherry-pick 8957d4677aa7 (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`b186142a0b`](https://github.com/nodejs/node/commit/b186142a0b)] - **deps**: V8: backport a11395433dbd (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`290f2d8d3e`](https://github.com/nodejs/node/commit/290f2d8d3e)] - **deps**: V8: cherry-pick deb0813166f3 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`63ed0b8bfe`](https://github.com/nodejs/node/commit/63ed0b8bfe)] - **deps**: V8: cherry-pick 9a6a22874c81 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`47f1c5257a`](https://github.com/nodejs/node/commit/47f1c5257a)] - **deps**: silence irrelevant V8 warning (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`19d975241f`](https://github.com/nodejs/node/commit/19d975241f)] - **deps**: workaround stod() limitations on SmartOS (Colin Ihrig) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`70f928c6a6`](https://github.com/nodejs/node/commit/70f928c6a6)] - **deps**: fix V8 build issue with inline methods (Jiawen Geng) [#35415](https://github.com/nodejs/node/pull/35415) +* [[`b045e39513`](https://github.com/nodejs/node/commit/b045e39513)] - **deps**: patch V8 to run on Xcode 8 (Mary Marchini) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`32725d2224`](https://github.com/nodejs/node/commit/32725d2224)] - **deps**: make v8.h compatible with VS2015 (Joao Reis) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`fe3cee7b37`](https://github.com/nodejs/node/commit/fe3cee7b37)] - **deps**: V8: forward declaration of `Rtl\*FunctionTable` (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`b2d05f7349`](https://github.com/nodejs/node/commit/b2d05f7349)] - **deps**: V8: patch register-arm64.h (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`c7a0ab4e3d`](https://github.com/nodejs/node/commit/c7a0ab4e3d)] - **deps**: patch V8 to run on older XCode versions (Ujjwal Sharma) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`60b623ee90`](https://github.com/nodejs/node/commit/60b623ee90)] - **deps**: V8: un-cherry-pick bd019bd (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`577ff9fee5`](https://github.com/nodejs/node/commit/577ff9fee5)] - **deps**: V8: cherry-pick deb0813166f3 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`00e1c7ea83`](https://github.com/nodejs/node/commit/00e1c7ea83)] - **deps**: V8: cherry-pick 9a6a22874c81 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`ee01d6b7fc`](https://github.com/nodejs/node/commit/ee01d6b7fc)] - **deps**: V8: cherry-pick 2059ee813359 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`2dad8d43cc`](https://github.com/nodejs/node/commit/2dad8d43cc)] - **deps**: V8: cherry-pick bde7ee5473d6 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`3046131ea0`](https://github.com/nodejs/node/commit/3046131ea0)] - **deps**: V8: cherry-pick 9a712984025e (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`d178d0738f`](https://github.com/nodejs/node/commit/d178d0738f)] - **deps**: V8: cherry-pick 0b96e5b0bfb2 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`5c71ea151a`](https://github.com/nodejs/node/commit/5c71ea151a)] - **deps**: V8: cherry-pick fbb28902e049 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`c8e15cd2c6`](https://github.com/nodejs/node/commit/c8e15cd2c6)] - **deps**: V8: cherry-pick 821fb3883a8e (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`b0d67426af`](https://github.com/nodejs/node/commit/b0d67426af)] - **deps**: workaround stod() limitations on SmartOS (Colin Ihrig) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`c8a658ac53`](https://github.com/nodejs/node/commit/c8a658ac53)] - **deps**: fix V8 build issue with inline methods (Jiawen Geng) [#35415](https://github.com/nodejs/node/pull/35415) +* [[`153b8cea36`](https://github.com/nodejs/node/commit/153b8cea36)] - **deps**: patch V8 to run on Xcode 8 (Mary Marchini) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`a785984133`](https://github.com/nodejs/node/commit/a785984133)] - **deps**: V8: silence irrelevant warnings (Michaël Zasso) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`246c9b8c31`](https://github.com/nodejs/node/commit/246c9b8c31)] - **deps**: make v8.h compatible with VS2015 (Joao Reis) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`96a567f9e9`](https://github.com/nodejs/node/commit/96a567f9e9)] - **deps**: V8: forward declaration of `Rtl\*FunctionTable` (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`e74383cecb`](https://github.com/nodejs/node/commit/e74383cecb)] - **deps**: V8: patch register-arm64.h (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`732847f1eb`](https://github.com/nodejs/node/commit/732847f1eb)] - **deps**: patch V8 to run on older XCode versions (Ujjwal Sharma) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`70171d186f`](https://github.com/nodejs/node/commit/70171d186f)] - **deps**: V8: un-cherry-pick bd019bd (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`15c91c6dd5`](https://github.com/nodejs/node/commit/15c91c6dd5)] - **deps**: V8: cherry-pick 821fb3883a8e (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`40b2fa4832`](https://github.com/nodejs/node/commit/40b2fa4832)] - **deps**: V8: cherry-pick 45e49775f5a3 (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`cd91ab5865`](https://github.com/nodejs/node/commit/cd91ab5865)] - **deps**: V8: cherry-pick 7b3a27b7ae65 (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`f4fc099080`](https://github.com/nodejs/node/commit/f4fc099080)] - **deps**: V8: cherry-pick d76abfed3512 (Michaël Zasso) [#35415](https://github.com/nodejs/node/pull/35415) +* [[`6200176ef0`](https://github.com/nodejs/node/commit/6200176ef0)] - **deps**: fix V8 build issue with inline methods (Jiawen Geng) [#35415](https://github.com/nodejs/node/pull/35415) +* [[`bd5642deb9`](https://github.com/nodejs/node/commit/bd5642deb9)] - **deps**: update V8 postmortem metadata script (Colin Ihrig) [#35415](https://github.com/nodejs/node/pull/35415) +* [[`9ae7159216`](https://github.com/nodejs/node/commit/9ae7159216)] - **deps**: update V8 postmortem metadata script (Colin Ihrig) [#33579](https://github.com/nodejs/node/pull/33579) +* [[`f4b4e21b2f`](https://github.com/nodejs/node/commit/f4b4e21b2f)] - **deps**: patch V8 to run on Xcode 8 (Mary Marchini) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`f6a84540d8`](https://github.com/nodejs/node/commit/f6a84540d8)] - **deps**: V8: silence irrelevant warnings (Michaël Zasso) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`bbc3f46572`](https://github.com/nodejs/node/commit/bbc3f46572)] - **deps**: make v8.h compatible with VS2015 (Joao Reis) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`0c988642dc`](https://github.com/nodejs/node/commit/0c988642dc)] - **deps**: V8: forward declaration of `Rtl\*FunctionTable` (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`703bf933d4`](https://github.com/nodejs/node/commit/703bf933d4)] - **deps**: V8: patch register-arm64.h (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`5451975b18`](https://github.com/nodejs/node/commit/5451975b18)] - **deps**: patch V8 to run on older XCode versions (Ujjwal Sharma) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`c460f7af4d`](https://github.com/nodejs/node/commit/c460f7af4d)] - **deps**: V8: un-cherry-pick bd019bd (Refael Ackermann) [#32116](https://github.com/nodejs/node/pull/32116) +* [[`bfee9daaa5`](https://github.com/nodejs/node/commit/bfee9daaa5)] - **deps**: update llhttp to 6.0.0 (Fedor Indutny) [#38277](https://github.com/nodejs/node/pull/38277) +* [[`94405650ae`](https://github.com/nodejs/node/commit/94405650ae)] - **deps**: upgrade npm to 7.10.0 (Ruy Adorno) [#38254](https://github.com/nodejs/node/pull/38254) +* [[`8e80fc7ff8`](https://github.com/nodejs/node/commit/8e80fc7ff8)] - **deps**: patch V8 to 9.0.257.17 (Michaël Zasso) [#38237](https://github.com/nodejs/node/pull/38237) +* [[`5b358d57e1`](https://github.com/nodejs/node/commit/5b358d57e1)] - **deps**: patch V8 to 9.0.257.16 (Michaël Zasso) [#38218](https://github.com/nodejs/node/pull/38218) +* [[`ee669a0d29`](https://github.com/nodejs/node/commit/ee669a0d29)] - **deps**: update ICU to 69.1 (Michaël Zasso) [#38178](https://github.com/nodejs/node/pull/38178) +* [[`2468e4ed3e`](https://github.com/nodejs/node/commit/2468e4ed3e)] - **deps**: V8: backport d59db06bf542 (Antoine du Hamel) [#38162](https://github.com/nodejs/node/pull/38162) +* [[`c748668704`](https://github.com/nodejs/node/commit/c748668704)] - **deps**: upgrade npm to 7.9.0 (Ruy Adorno) [#38156](https://github.com/nodejs/node/pull/38156) +* [[`ca13f7aaf3`](https://github.com/nodejs/node/commit/ca13f7aaf3)] - **deps**: V8: cherry-pick 501482cbc704 (Colin Ihrig) [#38121](https://github.com/nodejs/node/pull/38121) +* [[`bc531d1860`](https://github.com/nodejs/node/commit/bc531d1860)] - **deps**: upgrade npm to 7.8.0 (Darcy Clarke) [#38030](https://github.com/nodejs/node/pull/38030) +* [[`d639321acd`](https://github.com/nodejs/node/commit/d639321acd)] - **deps**: patch V8 to 9.0.257.13 (Michaël Zasso) [#37830](https://github.com/nodejs/node/pull/37830) +* [[`bc31dc0e0f`](https://github.com/nodejs/node/commit/bc31dc0e0f)] - **dns**: refactor cares\_wrap internals (James M Snell) [#38172](https://github.com/nodejs/node/pull/38172) +* [[`36decec87f`](https://github.com/nodejs/node/commit/36decec87f)] - **doc**: remove superfluous await from fsPromises.readdir example (Michael Rommel) [#38293](https://github.com/nodejs/node/pull/38293) +* [[`ac2c8c530d`](https://github.com/nodejs/node/commit/ac2c8c530d)] - **doc**: fixup http.IncomingMessage deprecation code (Guy Bedford) [#36917](https://github.com/nodejs/node/pull/36917) +* [[`767643fc19`](https://github.com/nodejs/node/commit/767643fc19)] - **doc**: restore minimum Xcode version for macOS (Richard Lau) [#38266](https://github.com/nodejs/node/pull/38266) +* [[`e541032276`](https://github.com/nodejs/node/commit/e541032276)] - **doc**: fix typo in repl.md (Arkerone) [#38244](https://github.com/nodejs/node/pull/38244) +* [[`fb93b71307`](https://github.com/nodejs/node/commit/fb93b71307)] - **doc**: fix typo in buffer.md (Arkerone) [#38243](https://github.com/nodejs/node/pull/38243) +* [[`7d688d4b36`](https://github.com/nodejs/node/commit/7d688d4b36)] - **doc**: fix missing backtick in fs.md (Siddharth) [#38260](https://github.com/nodejs/node/pull/38260) +* [[`6d04cc6849`](https://github.com/nodejs/node/commit/6d04cc6849)] - **doc**: change "oject" to "object" (Arkerone) [#38256](https://github.com/nodejs/node/pull/38256) +* [[`b4363f726c`](https://github.com/nodejs/node/commit/b4363f726c)] - **doc**: revise TLS minVersion/maxVersion text (Rich Trott) [#38202](https://github.com/nodejs/node/pull/38202) +* [[`98c2067f13`](https://github.com/nodejs/node/commit/98c2067f13)] - **doc**: update BUILDING.md for Apple Silicon (Ash Cripps) [#38227](https://github.com/nodejs/node/pull/38227) +* [[`4def7c4418`](https://github.com/nodejs/node/commit/4def7c4418)] - **doc**: standardize on pseudorandom (Rich Trott) [#38196](https://github.com/nodejs/node/pull/38196) +* [[`f1027ecf29`](https://github.com/nodejs/node/commit/f1027ecf29)] - **doc**: standardize command flag notes (Ferdi) [#38199](https://github.com/nodejs/node/pull/38199) +* [[`756d2e48d8`](https://github.com/nodejs/node/commit/756d2e48d8)] - **doc**: update `buffer.constants.MAX\_LENGTH` (Qingyu Deng) [#38109](https://github.com/nodejs/node/pull/38109) +* [[`474fbb5f6e`](https://github.com/nodejs/node/commit/474fbb5f6e)] - **doc**: clarify child\_process close event (Nitzan Uziely) [#38181](https://github.com/nodejs/node/pull/38181) +* [[`eee2c331ef`](https://github.com/nodejs/node/commit/eee2c331ef)] - **doc**: add command flag to import.meta.resolve (Ferdi) [#38171](https://github.com/nodejs/node/pull/38171) +* [[`f46d29360c`](https://github.com/nodejs/node/commit/f46d29360c)] - **doc**: advise against using randomFill on floats (Tobias Nießen) [#38150](https://github.com/nodejs/node/pull/38150) +* [[`5823fc79ba`](https://github.com/nodejs/node/commit/5823fc79ba)] - **doc**: update links in ICU guide (Michaël Zasso) [#38177](https://github.com/nodejs/node/pull/38177) +* [[`993a1da47c`](https://github.com/nodejs/node/commit/993a1da47c)] - **doc**: mention cryptographic prng in description of randomUUID (Serkan Özel) [#38074](https://github.com/nodejs/node/pull/38074) +* [[`5ba5cc8619`](https://github.com/nodejs/node/commit/5ba5cc8619)] - **doc**: fix typos in doc/api/cli.md (Arkerone) [#38163](https://github.com/nodejs/node/pull/38163) +* [[`6a2314acd7`](https://github.com/nodejs/node/commit/6a2314acd7)] - **doc**: add link to V8 (Voltrex) [#38144](https://github.com/nodejs/node/pull/38144) +* [[`093b527b25`](https://github.com/nodejs/node/commit/093b527b25)] - **doc**: fix typo in assert.md (Arkerone) [#38152](https://github.com/nodejs/node/pull/38152) +* [[`0fa579ac2a`](https://github.com/nodejs/node/commit/0fa579ac2a)] - **doc**: add missing comma in crypto doc (Tobias Nießen) [#38142](https://github.com/nodejs/node/pull/38142) +* [[`4bc8f7542f`](https://github.com/nodejs/node/commit/4bc8f7542f)] - **doc**: fix typo in crypto (Arkerone) [#38130](https://github.com/nodejs/node/pull/38130) +* [[`005ebafbd1`](https://github.com/nodejs/node/commit/005ebafbd1)] - **doc**: improve security text in collaborators guide (Rich Trott) [#38107](https://github.com/nodejs/node/pull/38107) +* [[`54322b8d8b`](https://github.com/nodejs/node/commit/54322b8d8b)] - **doc**: apply consistent punctuation to header contributing guide (Akhil Marsonya) [#38047](https://github.com/nodejs/node/pull/38047) +* [[`0d34767c4c`](https://github.com/nodejs/node/commit/0d34767c4c)] - **doc**: sending http request to localhost to avoid https redirect (Hassaan Pasha) [#38036](https://github.com/nodejs/node/pull/38036) +* [[`f851efd2e1`](https://github.com/nodejs/node/commit/f851efd2e1)] - **doc**: apply sentence case to backporting-to-release-lines.md headers (marsonya) [#37617](https://github.com/nodejs/node/pull/37617) +* [[`36bc8b905c`](https://github.com/nodejs/node/commit/36bc8b905c)] - **doc**: fix typo in fs.md (Antoine du Hamel) [#38100](https://github.com/nodejs/node/pull/38100) +* [[`f52c92134c`](https://github.com/nodejs/node/commit/f52c92134c)] - **doc**: internal/test/binding for testing (Bradley Meck) [#38026](https://github.com/nodejs/node/pull/38026) +* [[`ab42ef3930`](https://github.com/nodejs/node/commit/ab42ef3930)] - **doc**: add parentheses to function and move reference (Rich Trott) [#38066](https://github.com/nodejs/node/pull/38066) +* [[`2861778ecd`](https://github.com/nodejs/node/commit/2861778ecd)] - **doc**: change wording in doc/api/domain.md comment (Akhil Marsonya) [#38044](https://github.com/nodejs/node/pull/38044) +* [[`361632dab1`](https://github.com/nodejs/node/commit/361632dab1)] - **doc**: fix lint error in modules.md (Rich Trott) [#37811](https://github.com/nodejs/node/pull/37811) +* [[`b3f35e2c70`](https://github.com/nodejs/node/commit/b3f35e2c70)] - **doc,lib**: add missing deprecation code (Colin Ihrig) [#37541](https://github.com/nodejs/node/pull/37541) +* [[`cbe3b27166`](https://github.com/nodejs/node/commit/cbe3b27166)] - **doc,tools**: allow stability table to be updated (Richard Lau) [#38048](https://github.com/nodejs/node/pull/38048) +* [[`8dd06850ae`](https://github.com/nodejs/node/commit/8dd06850ae)] - **esm**: use correct URL for error decoration (Bradley Meck) [#37854](https://github.com/nodejs/node/pull/37854) +* [[`6bbe28552c`](https://github.com/nodejs/node/commit/6bbe28552c)] - **fs**: use byteLength to handle ArrayBuffer views (Michaël Zasso) [#38187](https://github.com/nodejs/node/pull/38187) +* [[`8e76397fab`](https://github.com/nodejs/node/commit/8e76397fab)] - **fs**: validate encoding to binding.writeString() (Colin Ihrig) [#38183](https://github.com/nodejs/node/pull/38183) +* [[`24fd791184`](https://github.com/nodejs/node/commit/24fd791184)] - **fs**: move constants to internal/fs/utils.js (Darshan Sen) [#38061](https://github.com/nodejs/node/pull/38061) +* [[`40ace47396`](https://github.com/nodejs/node/commit/40ace47396)] - **http**: fixup perf regression (James M Snell) [#38110](https://github.com/nodejs/node/pull/38110) +* [[`f4d3d12327`](https://github.com/nodejs/node/commit/f4d3d12327)] - **http**: use CRLF conistently in \_http\_outgoing.js (Daniel Bevenius) [#37851](https://github.com/nodejs/node/pull/37851) +* [[`ee9e2a2eb6`](https://github.com/nodejs/node/commit/ee9e2a2eb6)] - **lib**: revert primordials in a hot path (Antoine du Hamel) [#38248](https://github.com/nodejs/node/pull/38248) +* [[`d756d2b99c`](https://github.com/nodejs/node/commit/d756d2b99c)] - **lib**: enforce using `primordials.globalThis` instead of `global` (Antoine du Hamel) [#38230](https://github.com/nodejs/node/pull/38230) +* [[`09c9e5dea4`](https://github.com/nodejs/node/commit/09c9e5dea4)] - **lib**: avoid mutating `Error.stackTraceLimit` when it is not writable (Antoine du Hamel) [#38215](https://github.com/nodejs/node/pull/38215) +* [[`23d2c54bab`](https://github.com/nodejs/node/commit/23d2c54bab)] - **lib**: add `globalThis` to primordials (Antoine du Hamel) [#38211](https://github.com/nodejs/node/pull/38211) +* [[`78343bbdc5`](https://github.com/nodejs/node/commit/78343bbdc5)] - **lib**: add `WeakRef` and `FinalizationRegistry` to `primordials` (ExE Boss) [#37263](https://github.com/nodejs/node/pull/37263) +* [[`656fb4657a`](https://github.com/nodejs/node/commit/656fb4657a)] - **lib**: add tsconfig for code completions (Bradley Meck) [#38042](https://github.com/nodejs/node/pull/38042) +* [[`d86132488d`](https://github.com/nodejs/node/commit/d86132488d)] - **lib**: properly process JavaScript exceptions on async\_hooks fatal error (legendecas) [#38106](https://github.com/nodejs/node/pull/38106) +* [[`a9332e84bf`](https://github.com/nodejs/node/commit/a9332e84bf)] - **lib**: refactor to use primordials in lib/internal/cli\_table (Akhil Marsonya) [#38046](https://github.com/nodejs/node/pull/38046) +* [[`8d78d9ef27`](https://github.com/nodejs/node/commit/8d78d9ef27)] - **lib**: load v8\_prof\_processor dependencies as ESM (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`7b2bad4005`](https://github.com/nodejs/node/commit/7b2bad4005)] - **module**: clarify CJS global-like variables not defined error message (Antoine du Hamel) [#37852](https://github.com/nodejs/node/pull/37852) +* [[`7869761c2e`](https://github.com/nodejs/node/commit/7869761c2e)] - **net**: fix typo (Luigi Pinca) [#38127](https://github.com/nodejs/node/pull/38127) +* [[`4afcd55274`](https://github.com/nodejs/node/commit/4afcd55274)] - **node-api**: make reference weak parameter an indirect link to references (Chengzhong Wu) [#38000](https://github.com/nodejs/node/pull/38000) +* [[`e38d62a8c9`](https://github.com/nodejs/node/commit/e38d62a8c9)] - **path**: fix POSIX path.resolve() perf regression (Brian White) [#38064](https://github.com/nodejs/node/pull/38064) +* [[`b0d5e036d8`](https://github.com/nodejs/node/commit/b0d5e036d8)] - **path**: fix posix.relative() on Windows (Rich Trott) [#37747](https://github.com/nodejs/node/pull/37747) +* [[`548cbf0625`](https://github.com/nodejs/node/commit/548cbf0625)] - **perf_hooks**: fix loop delay resolution validation (Antoine du Hamel) [#38166](https://github.com/nodejs/node/pull/38166) +* [[`13c931a9dc`](https://github.com/nodejs/node/commit/13c931a9dc)] - **process**: add range validation to debugPort (Colin Ihrig) [#38205](https://github.com/nodejs/node/pull/38205) +* [[`8dd5dd8a4b`](https://github.com/nodejs/node/commit/8dd5dd8a4b)] - **process**: do not lazily load AsyncResource (Michaël Zasso) [#38041](https://github.com/nodejs/node/pull/38041) +* [[`4e833b6059`](https://github.com/nodejs/node/commit/4e833b6059)] - **process,doc**: add missing deprecation code (Colin Ihrig) [#37091](https://github.com/nodejs/node/pull/37091) +* [[`d6669645c0`](https://github.com/nodejs/node/commit/d6669645c0)] - **repl**: fix declaring a variable with the name `util` (eladkeyshawn) [#38141](https://github.com/nodejs/node/pull/38141) +* [[`e7391967c2`](https://github.com/nodejs/node/commit/e7391967c2)] - **repl**: fix error message printing (Anna Henningsen) [#38209](https://github.com/nodejs/node/pull/38209) +* [[`4e9212bb7b`](https://github.com/nodejs/node/commit/4e9212bb7b)] - **src**: cache some context in locals (Khaidi Chu) [#37473](https://github.com/nodejs/node/pull/37473) +* [[`fc20e833ca`](https://github.com/nodejs/node/commit/fc20e833ca)] - **src**: fix finalization crash (James M Snell) [#38250](https://github.com/nodejs/node/pull/38250) +* [[`6c9b19a7af`](https://github.com/nodejs/node/commit/6c9b19a7af)] - **src**: refactor SecureContext Initialization (James M Snell) [#38116](https://github.com/nodejs/node/pull/38116) +* [[`8d63aa828e`](https://github.com/nodejs/node/commit/8d63aa828e)] - **src**: fix typo for initialization (Yash Ladha) [#37974](https://github.com/nodejs/node/pull/37974) +* [[`66c8f76c2c`](https://github.com/nodejs/node/commit/66c8f76c2c)] - **src**: remove KeyObjectData::CreateSecret overload (Tobias Nießen) [#38067](https://github.com/nodejs/node/pull/38067) +* [[`87dc152229`](https://github.com/nodejs/node/commit/87dc152229)] - **src**: fix node version (Richard Lau) [#36460](https://github.com/nodejs/node/pull/36460) +* [[`e929d1f2c8`](https://github.com/nodejs/node/commit/e929d1f2c8)] - **src**: fix node version (Brian White) [#36385](https://github.com/nodejs/node/pull/36385) +* [[`8e8dea36cc`](https://github.com/nodejs/node/commit/8e8dea36cc)] - **src**: use non-deprecated GetCreationContext from V8 (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`b1c1c4695c`](https://github.com/nodejs/node/commit/b1c1c4695c)] - **src**: remove V8\_FT\_ADAPTOR for V8 update (Colin Ihrig) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`8f5cce6862`](https://github.com/nodejs/node/commit/8f5cce6862)] - **src**: use non-deprecated V8 module APIs (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`497f6ca5b4`](https://github.com/nodejs/node/commit/497f6ca5b4)] - **src**: update NODE\_MODULE\_VERSION to 93 (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`001dc16cf1`](https://github.com/nodejs/node/commit/001dc16cf1)] - **src**: use non-deprecated V8 module and script APIs (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`47a90d9f37`](https://github.com/nodejs/node/commit/47a90d9f37)] - **src**: update NODE\_MODULE\_VERSION to 92 (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`5259d17309`](https://github.com/nodejs/node/commit/5259d17309)] - **src**: update NODE\_MODULE\_VERSION to 91 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`6f9cbcf6a6`](https://github.com/nodejs/node/commit/6f9cbcf6a6)] - **src**: fix v8 api deprecation (Jiawen Geng) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`9d4d55bd94`](https://github.com/nodejs/node/commit/9d4d55bd94)] - **src**: update NODE\_MODULE\_VERSION to 90 (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`369f239503`](https://github.com/nodejs/node/commit/369f239503)] - **stream**: fix multiple Writable.destroy() calls (Robert Nagy) [#38221](https://github.com/nodejs/node/pull/38221) +* [[`4ad46e2fef`](https://github.com/nodejs/node/commit/4ad46e2fef)] - **stream**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#37126](https://github.com/nodejs/node/pull/37126) +* [[`419686cdfb`](https://github.com/nodejs/node/commit/419686cdfb)] - **stream**: refactor to use more primordials (Antoine du Hamel) [#36346](https://github.com/nodejs/node/pull/36346) +* [[`c704faa0f9`](https://github.com/nodejs/node/commit/c704faa0f9)] - **test**: fix flaky test-dns and test-dns-lookup (Rich Trott) [#38282](https://github.com/nodejs/node/pull/38282) +* [[`5e588c1c7c`](https://github.com/nodejs/node/commit/5e588c1c7c)] - **test**: fixup failing test/internet/test-dns.js (James M Snell) [#38241](https://github.com/nodejs/node/pull/38241) +* [[`18c9913ce1`](https://github.com/nodejs/node/commit/18c9913ce1)] - **test**: add tests for missing https agent options (Rich Trott) [#38202](https://github.com/nodejs/node/pull/38202) +* [[`4ad8e83a3d`](https://github.com/nodejs/node/commit/4ad8e83a3d)] - **test**: fix test-https-agent-additional-options.js (Rich Trott) [#38202](https://github.com/nodejs/node/pull/38202) +* [[`05df701e70`](https://github.com/nodejs/node/commit/05df701e70)] - **test**: remove common.disableCrashOnUnhandledRejection (Michaël Zasso) [#38210](https://github.com/nodejs/node/pull/38210) +* [[`8f4850d5c7`](https://github.com/nodejs/node/commit/8f4850d5c7)] - **test**: fix typo in comment in binding.c (Tobias Nießen) [#38220](https://github.com/nodejs/node/pull/38220) +* [[`9498e97015`](https://github.com/nodejs/node/commit/9498e97015)] - **test**: fix typo in gtest-all.cc (Ikko Ashimine) [#38224](https://github.com/nodejs/node/pull/38224) +* [[`c8bbd83ab2`](https://github.com/nodejs/node/commit/c8bbd83ab2)] - **test**: add undefined fatalException exit code test (Nitzan Uziely) [#38119](https://github.com/nodejs/node/pull/38119) +* [[`db9cf52dcf`](https://github.com/nodejs/node/commit/db9cf52dcf)] - **test**: check the different error code on IBM i (Xu Meng) [#38159](https://github.com/nodejs/node/pull/38159) +* [[`95ca351fd8`](https://github.com/nodejs/node/commit/95ca351fd8)] - **test**: skip fs.watch() test on IBMi (Rich Trott) [#38192](https://github.com/nodejs/node/pull/38192) +* [[`8cee28465c`](https://github.com/nodejs/node/commit/8cee28465c)] - **test**: fix test-dh-regr for OpenSSL 3 (Rich Trott) [#34289](https://github.com/nodejs/node/pull/34289) +* [[`213ae4f4c6`](https://github.com/nodejs/node/commit/213ae4f4c6)] - **test**: skip test-vm-memleak in ASAN (Rich Trott) [#34289](https://github.com/nodejs/node/pull/34289) +* [[`50208915a0`](https://github.com/nodejs/node/commit/50208915a0)] - **test**: skip test-hash-seed on armv6 and armv7 (Rich Trott) [#34289](https://github.com/nodejs/node/pull/34289) +* [[`7216eb67df`](https://github.com/nodejs/node/commit/7216eb67df)] - **test**: update OpenSSL 3.x expected error message (Daniel Bevenius) [#38164](https://github.com/nodejs/node/pull/38164) +* [[`7e516aaac0`](https://github.com/nodejs/node/commit/7e516aaac0)] - **test**: remove unneeded m flag on regular expressions (Rich Trott) [#38124](https://github.com/nodejs/node/pull/38124) +* [[`269f5132cc`](https://github.com/nodejs/node/commit/269f5132cc)] - **test**: skip different params test for OpenSSL 3.x (Daniel Bevenius) [#38165](https://github.com/nodejs/node/pull/38165) +* [[`f96dffb7ae`](https://github.com/nodejs/node/commit/f96dffb7ae)] - **test**: fix flaky test-zlib-unused-weak.js (Ouyang Yadong) [#38149](https://github.com/nodejs/node/pull/38149) +* [[`e96773b94b`](https://github.com/nodejs/node/commit/e96773b94b)] - **test**: add regression test for serdes readDouble() (Colin Ihrig) [#38121](https://github.com/nodejs/node/pull/38121) +* [[`cc4ee6cba8`](https://github.com/nodejs/node/commit/cc4ee6cba8)] - **test**: deflake test-http-many-ended-pipelines (Luigi Pinca) [#38018](https://github.com/nodejs/node/pull/38018) +* [[`098a4d6551`](https://github.com/nodejs/node/commit/098a4d6551)] - **test**: skip test-crypto-dh-keys on armv6 and armv7 (Rich Trott) [#38076](https://github.com/nodejs/node/pull/38076) +* [[`f9b63b8530`](https://github.com/nodejs/node/commit/f9b63b8530)] - **test**: update parallel/test-crypto-keygen for OpenSSL 3 (Richard Lau) [#38136](https://github.com/nodejs/node/pull/38136) +* [[`6a6cdfad03`](https://github.com/nodejs/node/commit/6a6cdfad03)] - **test**: fix skip message for test-macos-app-sandbox (Tobias Nießen) [#38114](https://github.com/nodejs/node/pull/38114) +* [[`e155b1f2f7`](https://github.com/nodejs/node/commit/e155b1f2f7)] - **test**: correct test comment (Evan Lucas) [#38095](https://github.com/nodejs/node/pull/38095) +* [[`d61977f03e`](https://github.com/nodejs/node/commit/d61977f03e)] - **test**: remove dead code (Luigi Pinca) [#38016](https://github.com/nodejs/node/pull/38016) +* [[`8b05e32519`](https://github.com/nodejs/node/commit/8b05e32519)] - **test**: fix flaky test-net-timeout (Rich Trott) [#38060](https://github.com/nodejs/node/pull/38060) +* [[`a0492ba391`](https://github.com/nodejs/node/commit/a0492ba391)] - **test**: fix test-vm-memleak for high baseline platforms (Rich Trott) [#38062](https://github.com/nodejs/node/pull/38062) +* [[`30d7f05fef`](https://github.com/nodejs/node/commit/30d7f05fef)] - **test**: improve code coverage in webcrypto API (Juan José Arboleda) [#38052](https://github.com/nodejs/node/pull/38052) +* [[`d75543d8b5`](https://github.com/nodejs/node/commit/d75543d8b5)] - **test**: fix flaky timeout-delayed-body and headers tests (Nitzan Uziely) [#38045](https://github.com/nodejs/node/pull/38045) +* [[`4f387c25cb`](https://github.com/nodejs/node/commit/4f387c25cb)] - **test**: fix flaky test-vm-memleak (Rich Trott) [#38054](https://github.com/nodejs/node/pull/38054) +* [[`330f25ef82`](https://github.com/nodejs/node/commit/330f25ef82)] - **test**: prepare for consistent comma-dangle lint rule (Rich Trott) [#37930](https://github.com/nodejs/node/pull/37930) +* [[`31fe3b215f`](https://github.com/nodejs/node/commit/31fe3b215f)] - **test**: make sure http pipelining does not emit a warning (Matteo Collina) [#37964](https://github.com/nodejs/node/pull/37964) +* [[`978bbf987c`](https://github.com/nodejs/node/commit/978bbf987c)] - **test**: fix flaky test-http2-pack-end-stream-flag (James M Snell) [#37814](https://github.com/nodejs/node/pull/37814) +* [[`ecc584251e`](https://github.com/nodejs/node/commit/ecc584251e)] - **test**: fixup flaky test-performance-function-async test (James M Snell) [#37493](https://github.com/nodejs/node/pull/37493) +* [[`32482a828b`](https://github.com/nodejs/node/commit/32482a828b)] - **test**: remove FLAKY for test-domain-error-types (Rich Trott) [#37458](https://github.com/nodejs/node/pull/37458) +* [[`501ae0e6e3`](https://github.com/nodejs/node/commit/501ae0e6e3)] - **test**: remove outdated V8 flag (Michaël Zasso) [#37151](https://github.com/nodejs/node/pull/37151) +* [[`fa3997d75a`](https://github.com/nodejs/node/commit/fa3997d75a)] - **test**: mark test-return-on-exit as flaky (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`896ae96a15`](https://github.com/nodejs/node/commit/896ae96a15)] - **test**: mark WASI's test-return-on-exit as flaky (Colin Ihrig) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`0da7a11e54`](https://github.com/nodejs/node/commit/0da7a11e54)] - **test,http**: check that http server is robust from handler abuse (Rich Trott) [#37958](https://github.com/nodejs/node/pull/37958) +* [[`a0261d231c`](https://github.com/nodejs/node/commit/a0261d231c)] - ***Revert*** "**timers**: refactor to use optional chaining" (Matteo Collina) [#38245](https://github.com/nodejs/node/pull/38245) +* [[`3da003cc1c`](https://github.com/nodejs/node/commit/3da003cc1c)] - **tls**: fix session and keylog add listener segfault (Nitzan Uziely) [#38180](https://github.com/nodejs/node/pull/38180) +* [[`eb20447407`](https://github.com/nodejs/node/commit/eb20447407)] - **tls**: extract out SecureContext configuration (James M Snell) [#38116](https://github.com/nodejs/node/pull/38116) +* [[`b16e79e05b`](https://github.com/nodejs/node/commit/b16e79e05b)] - **tls**: fix typo (Arkerone) [#38129](https://github.com/nodejs/node/pull/38129) +* [[`d4f33f109e`](https://github.com/nodejs/node/commit/d4f33f109e)] - **tools**: skip macOS GitHub Actions test on doc-only changes (Rich Trott) [#38296](https://github.com/nodejs/node/pull/38296) +* [[`13d0de5954`](https://github.com/nodejs/node/commit/13d0de5954)] - **tools**: set arch in Distribution.xml (Ash Cripps) [#38261](https://github.com/nodejs/node/pull/38261) +* [[`28bca33f28`](https://github.com/nodejs/node/commit/28bca33f28)] - **tools**: update ESLint to 7.24.0 (Colin Ihrig) [#38179](https://github.com/nodejs/node/pull/38179) +* [[`038608d401`](https://github.com/nodejs/node/commit/038608d401)] - **tools**: relax max-len lint rule for template strings (Rich Trott) [#38097](https://github.com/nodejs/node/pull/38097) +* [[`e67fb569f4`](https://github.com/nodejs/node/commit/e67fb569f4)] - **tools**: apply consistent comma-dangle lint rule (Rich Trott) [#37930](https://github.com/nodejs/node/pull/37930) +* [[`9843361c07`](https://github.com/nodejs/node/commit/9843361c07)] - **tools**: update V8 gypfiles for 9.0 (Michaël Zasso) [#37587](https://github.com/nodejs/node/pull/37587) +* [[`017661768a`](https://github.com/nodejs/node/commit/017661768a)] - **tools**: update V8 gypfiles for 8.9 (Michaël Zasso) [#37330](https://github.com/nodejs/node/pull/37330) +* [[`79da253473`](https://github.com/nodejs/node/commit/79da253473)] - **tools**: update V8 gypfiles for 8.8 (Michaël Zasso) [#36139](https://github.com/nodejs/node/pull/36139) +* [[`770d9e2542`](https://github.com/nodejs/node/commit/770d9e2542)] - **tools**: update V8 gypfiles for 8.7 (Michaël Zasso) [#35700](https://github.com/nodejs/node/pull/35700) +* [[`b87f1be92d`](https://github.com/nodejs/node/commit/b87f1be92d)] - **typings**: add types for "http\_parser" and "options" bindings (Michaël Zasso) [#38239](https://github.com/nodejs/node/pull/38239) +* [[`1c8b2956d1`](https://github.com/nodejs/node/commit/1c8b2956d1)] - **typings**: add types for internalBinding('serdes') (Michaël Zasso) [#38204](https://github.com/nodejs/node/pull/38204) +* [[`d97787fccc`](https://github.com/nodejs/node/commit/d97787fccc)] - **typings**: add JSDoc to os module functions (David Brownman) [#38197](https://github.com/nodejs/node/pull/38197) +* [[`8acfe5c2a4`](https://github.com/nodejs/node/commit/8acfe5c2a4)] - **typings**: add JSDoc Types to lib/querystring (Simon Knott) [#38185](https://github.com/nodejs/node/pull/38185) +* [[`d3162da8dd`](https://github.com/nodejs/node/commit/d3162da8dd)] - **typings**: add JSDoc typings for http (Voltrex) [#38191](https://github.com/nodejs/node/pull/38191) +* [[`82d59882b1`](https://github.com/nodejs/node/commit/82d59882b1)] - **typings**: add JSDoc typings for assert (Voltrex) [#38188](https://github.com/nodejs/node/pull/38188) +* [[`f1a21e5c91`](https://github.com/nodejs/node/commit/f1a21e5c91)] - **typings**: add JSDoc types to lib/path (Simon Knott) [#38186](https://github.com/nodejs/node/pull/38186) +* [[`3377eb9641`](https://github.com/nodejs/node/commit/3377eb9641)] - **typings**: add types for internalBinding('util') (Michaël Zasso) [#38200](https://github.com/nodejs/node/pull/38200) +* [[`cb2bdc632a`](https://github.com/nodejs/node/commit/cb2bdc632a)] - **typings**: add types for internalBinding('fs') (Michaël Zasso) [#38198](https://github.com/nodejs/node/pull/38198) +* [[`26eed3e0ed`](https://github.com/nodejs/node/commit/26eed3e0ed)] - **vm**: add import assertion support (Gus Caplan) [#37176](https://github.com/nodejs/node/pull/37176) +* [[`6986fa07eb`](https://github.com/nodejs/node/commit/6986fa07eb)] - **worker**: fix exit code for error thrown in handler (Nitzan Uziely) [#38012](https://github.com/nodejs/node/pull/38012) diff --git a/doc/changelogs/CHANGELOG_V4.md b/doc/changelogs/CHANGELOG_V4.md index 64a452f8b91231..089bc23f9d5125 100644 --- a/doc/changelogs/CHANGELOG_V4.md +++ b/doc/changelogs/CHANGELOG_V4.md @@ -58,6 +58,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V5.md b/doc/changelogs/CHANGELOG_V5.md index 00735a73982265..79c92d09418fca 100644 --- a/doc/changelogs/CHANGELOG_V5.md +++ b/doc/changelogs/CHANGELOG_V5.md @@ -34,6 +34,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V6.md b/doc/changelogs/CHANGELOG_V6.md index 6444d9c46b8b20..68d243d03f6707 100644 --- a/doc/changelogs/CHANGELOG_V6.md +++ b/doc/changelogs/CHANGELOG_V6.md @@ -63,6 +63,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V7.md b/doc/changelogs/CHANGELOG_V7.md index e094ddedc2fe98..9f5581129c1fc6 100644 --- a/doc/changelogs/CHANGELOG_V7.md +++ b/doc/changelogs/CHANGELOG_V7.md @@ -32,6 +32,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V8.md b/doc/changelogs/CHANGELOG_V8.md index 536e1a58476918..f64372f41b44e3 100644 --- a/doc/changelogs/CHANGELOG_V8.md +++ b/doc/changelogs/CHANGELOG_V8.md @@ -54,6 +54,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/changelogs/CHANGELOG_V9.md b/doc/changelogs/CHANGELOG_V9.md index dc5bfe086e81f9..6721296dd422d9 100644 --- a/doc/changelogs/CHANGELOG_V9.md +++ b/doc/changelogs/CHANGELOG_V9.md @@ -33,6 +33,7 @@ </table> * Other Versions + * [16.x](CHANGELOG_V16.md) * [15.x](CHANGELOG_V15.md) * [14.x](CHANGELOG_V14.md) * [13.x](CHANGELOG_V13.md) diff --git a/doc/guides/maintaining-V8.md b/doc/guides/maintaining-V8.md index 730244bc065d1f..da940758a25d94 100644 --- a/doc/guides/maintaining-V8.md +++ b/doc/guides/maintaining-V8.md @@ -229,7 +229,7 @@ to be cherry-picked in the Node.js repository and V8-CI must test the change. * Run the Node.js [V8 CI][] in addition to the [Node.js CI][]. The CI uses the `test-v8` target in the `Makefile`, which uses `tools/make-v8.sh` to reconstruct a git tree in the `deps/v8` directory to - run V8 tests. + run V8 tests<sup>2</sup>. The [`git-node`][] tool can be used to simplify this task. Run `git node v8 backport <sha>` to cherry-pick a commit. @@ -414,6 +414,11 @@ This would require some tooling to: <sup>1</sup>Node.js 0.12 and older are intentionally omitted from this document as their support has ended. +<sup>2</sup>The V8 tests still require Python 2. To run these tests locally, +you can run `PYTHON2 ./configure.py` before running `make test-v8`, in the root +of this repository. On macOS, this also requires a full Xcode install, +not just the "command line tools" for Xcode. + [ChromiumReleaseCalendar]: https://www.chromium.org/developers/calendar [Node.js CI]: https://ci.nodejs.org/job/node-test-pull-request/ [Node.js `canary` branch]: https://github.com/nodejs/node-v8/tree/canary diff --git a/doc/guides/maintaining-the-build-files.md b/doc/guides/maintaining-the-build-files.md index 548441dc0126ca..67c86281c63ed4 100644 --- a/doc/guides/maintaining-the-build-files.md +++ b/doc/guides/maintaining-the-build-files.md @@ -8,7 +8,7 @@ On how to build the Node.js core, see [Building Node.js](../../BUILDING.md). There are three main build files that may be directly run when building Node.js: -* `configure`: A Python 2 script that detects system capabilities and runs +* `configure`: A Python script that detects system capabilities and runs [GYP][]. It generates `config.gypi` which includes parameters used by GYP to create platform-dependent build files. Its output is usually in one of these formats: Makefile, MSbuild, ninja, or XCode project files (the main diff --git a/doc/guides/releases.md b/doc/guides/releases.md index 2309460e3d1b3a..eac14469a09a2f 100644 --- a/doc/guides/releases.md +++ b/doc/guides/releases.md @@ -896,9 +896,20 @@ test, or doc-related are to be listed as notable changes. Some SEMVER-MINOR commits may be listed as notable changes on a case-by-case basis. Use your judgment there. +### Snap + +The Node.js [Snap][] package has a "default" for installs where the user hasn't +specified a release line ("track" in Snap terminology). This should be updated +to point to the most recently activated LTS. A member of the Node.js Build +Infrastructure team is able to perform the switch of the default. An issue +should be opened on the [Node.js Snap management repository][] requesting this +take place once a new LTS line has been released. + [Build issue tracker]: https://github.com/nodejs/build/issues/new [CI lockdown procedure]: https://github.com/nodejs/build/blob/HEAD/doc/jenkins-guide.md#restricting-access-for-security-releases +[Node.js Snap management repository]: https://github.com/nodejs/snap [Partner Communities]: https://github.com/nodejs/community-committee/blob/HEAD/governance/PARTNER_COMMUNITIES.md +[Snap]: https://snapcraft.io/node [nodejs.org release-post.js script]: https://github.com/nodejs/nodejs.org/blob/HEAD/scripts/release-post.js [nodejs.org repository]: https://github.com/nodejs/nodejs.org [webchat.freenode.net]: https://webchat.freenode.net/ diff --git a/doc/guides/security-release-process.md b/doc/guides/security-release-process.md index 5609e40739d3fb..10465c57501328 100644 --- a/doc/guides/security-release-process.md +++ b/doc/guides/security-release-process.md @@ -38,6 +38,12 @@ information described. * Described in the pre/post announcements * [ ] Pre-release announcement [email][]: ***LINK TO EMAIL*** + ```text + Security updates for all active release lines, Month Year + + The Node.js project will release new versions of all supported release lines on or shortly after Day of week, Month Day of Month, Year + For more information see: https://nodejs.org/en/blog/vulnerability/month-year-security-releases/ + ``` (Get access from existing manager: Ben Noordhuis, Rod Vagg, Michael Dawson) * [ ] Pre-release announcement to nodejs.org blog: ***LINK TO BLOG*** @@ -64,6 +70,12 @@ information described. * [ ] [Unlock CI](https://github.com/nodejs/build/blob/HEAD/doc/jenkins-guide.md#after-the-release) * [ ] Post-release announcement in reply [email][]: ***LINK TO EMAIL*** + ```text + Security updates for all active release lines, Month Year + + The Node.js project has now released new versions of all supported release lines. + For more information see: https://nodejs.org/en/blog/vulnerability/month-year-security-releases/ + ``` * [ ] Post-release announcement to Nodejs.org blog: ***LINK TO BLOG POST*** * (Re-PR the pre-approved branch from nodejs-private/nodejs.org-private to diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 3911b421be1356..38ca7683247b8c 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -27,14 +27,65 @@ rules: message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'." no-restricted-globals: - error + - name: AbortController + message: "Use `const { AbortController } = require('internal/abort_controller');` instead of the global." + - name: AbortSignal + message: "Use `const { AbortSignal } = require('internal/abort_controller');` instead of the global." + # Atomics is not available in primordials because it can be + # disabled with --no-harmony-atomics CLI flag. + - name: Atomics + message: "Use `const { Atomics } = globalThis;` instead of the global." + - name: Buffer + message: "Use `const { Buffer } = require('buffer');` instead of the global." + - name: Event + message: "Use `const { Event } = require('internal/event_target');` instead of the global." + - name: EventTarget + message: "Use `const { EventTarget } = require('internal/event_target');` instead of the global." + # Intl is not available in primordials because it can be + # disabled with --without-intl build flag. + - name: Intl + message: "Use `const { Intl } = globalThis;` instead of the global." + - name: MessageChannel + message: "Use `const { MessageChannel } = require('internal/worker/io');` instead of the global." + - name: MessageEvent + message: "Use `const { MessageEvent } = require('internal/worker/io');` instead of the global." + - name: MessagePort + message: "Use `const { MessagePort } = require('internal/worker/io');` instead of the global." + # SharedArrayBuffer is not available in primordials because it can be + # disabled with --no-harmony-sharedarraybuffer CLI flag. + - name: SharedArrayBuffer + message: "Use `const { SharedArrayBuffer } = globalThis;` instead of the global." + - name: TextDecoder + message: "Use `const { TextDecoder } = require('internal/encoding');` instead of the global." + - name: TextEncoder + message: "Use `const { TextEncoder } = require('internal/encoding');` instead of the global." + - name: URL + message: "Use `const { URL } = require('internal/url');` instead of the global." + - name: URLSearchParams + message: "Use `const { URLSearchParams } = require('internal/url');` instead of the global." + # WebAssembly is not available in primordials because it can be + # disabled with --jitless CLI flag. + - name: WebAssembly + message: "Use `const { WebAssembly } = globalThis;` instead of the global." + - name: atob + message: "Use `const { atob } = require('buffer');` instead of the global." + - name: btoa + message: "Use `const { btoa } = require('buffer');` instead of the global." + - name: global + message: "Use `const { globalThis } = primordials;` instead of `global`." - name: globalThis message: "Use `const { globalThis } = primordials;` instead of the global." + - name: performance + message: "Use `const { performance } = require('perf_hooks');` instead of the global." + - name: queueMicrotask + message: "Use `const { queueMicrotask } = require('internal/process/task_queues');` instead of the global." # Custom rules in tools/eslint-rules node-core/lowercase-name-for-primitive: error node-core/non-ascii-character: error node-core/no-array-destructuring: error node-core/prefer-primordials: - error + - name: AggregateError - name: Array - name: ArrayBuffer - name: BigInt @@ -74,6 +125,7 @@ rules: into: Number - name: parseInt into: Number + - name: Proxy - name: Promise - name: RangeError - name: ReferenceError diff --git a/lib/_http_common.js b/lib/_http_common.js index 229353ec735288..e3e732a8a180c6 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -22,11 +22,9 @@ 'use strict'; const { - ArrayPrototypePushApply, MathMin, Symbol, RegExpPrototypeTest, - TypedArrayPrototypeSlice, } = primordials; const { setImmediate } = require('timers'); @@ -66,7 +64,7 @@ function parserOnHeaders(headers, url) { // Once we exceeded headers limit - stop collecting them if (this.maxHeaderPairs <= 0 || this._headers.length < this.maxHeaderPairs) { - ArrayPrototypePushApply(this._headers, headers); + this._headers.push(...headers); } this._url += url; } @@ -138,7 +136,7 @@ function parserOnBody(b, start, len) { // Pretend this was the result of a stream._read call. if (len > 0 && !stream._dumped) { - const slice = TypedArrayPrototypeSlice(b, start, start + len); + const slice = b.slice(start, start + len); const ret = stream.push(slice); if (!ret) readStop(this.socket); diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index d09683c9a8f1b1..e0f1354e6c969c 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -22,8 +22,6 @@ 'use strict'; const { - ArrayPrototypePush, - FunctionPrototypeCall, ObjectDefineProperty, ObjectSetPrototypeOf, StringPrototypeCharCodeAt, @@ -59,7 +57,7 @@ function IncomingMessage(socket) { }; } - FunctionPrototypeCall(Readable, this, streamOptions); + Readable.call(this, streamOptions); this._readableState.readingMore = true; @@ -350,7 +348,7 @@ function _addHeaderLine(field, value, dest) { } else if (flag === 1) { // Array header -- only Set-Cookie at the moment if (dest['set-cookie'] !== undefined) { - ArrayPrototypePush(dest['set-cookie'], value); + dest['set-cookie'].push(value); } else { dest['set-cookie'] = [value]; } diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index b627608a527201..4d3b58cc84d00c 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -24,13 +24,7 @@ const { Array, ArrayIsArray, - ArrayPrototypeForEach, ArrayPrototypeJoin, - ArrayPrototypePush, - ArrayPrototypeUnshift, - FunctionPrototype, - FunctionPrototypeBind, - FunctionPrototypeCall, MathFloor, NumberPrototypeToString, ObjectCreate, @@ -88,7 +82,7 @@ const { CRLF } = common; const kCorked = Symbol('corked'); -const nop = FunctionPrototype; +const nop = () => {}; const RE_CONN_CLOSE = /(?:^|\W)close(?:$|\W)/i; const RE_TE_CHUNKED = common.chunkExpression; @@ -101,7 +95,7 @@ function isCookieField(s) { } function OutgoingMessage() { - FunctionPrototypeCall(Stream, this); + Stream.call(this); // Queue that holds all currently pending data, until the response will be // assigned to the socket (until it will its turn in the HTTP pipeline). @@ -331,7 +325,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback) { data = this._header + data; } else { const header = this._header; - ArrayPrototypeUnshift(this.outputData, { + this.outputData.unshift({ data: header, encoding: 'latin1', callback: null @@ -368,7 +362,7 @@ function _writeRaw(data, encoding, callback) { return conn.write(data, encoding, callback); } // Buffer, as long as we're not destroyed. - ArrayPrototypePush(this.outputData, { data, encoding, callback }); + this.outputData.push({ data, encoding, callback }); this.outputSize += data.length; this._onPendingData(data.length); return this.outputSize < HIGH_WATER_MARK; @@ -397,9 +391,10 @@ function _storeHeader(firstLine, headers) { } } else if (ArrayIsArray(headers)) { if (headers.length && ArrayIsArray(headers[0])) { - ArrayPrototypeForEach(headers, (entry) => - processHeader(this, state, entry[0], entry[1], true) - ); + for (let i = 0; i < headers.length; i++) { + const entry = headers[i]; + processHeader(this, state, entry[0], entry[1], true); + } } else { if (headers.length % 2 !== 0) { throw new ERR_INVALID_ARG_VALUE('headers', headers); @@ -877,7 +872,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) { if (typeof callback === 'function') this.once('finish', callback); - const finish = FunctionPrototypeBind(onFinish, undefined, this); + const finish = onFinish.bind(undefined, this); if (this._hasBody && this.chunkedEncoding) { this._send('0\r\n' + this._trailer + '\r\n', 'latin1', finish); diff --git a/lib/_http_server.js b/lib/_http_server.js index 8ada9e8cfe987a..97df58a007daba 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -23,20 +23,12 @@ const { ArrayIsArray, - ArrayPrototypeForEach, - ArrayPrototypePush, - ArrayPrototypeShift, Error, - FunctionPrototype, - FunctionPrototypeBind, - FunctionPrototypeCall, ObjectKeys, ObjectSetPrototypeOf, - ReflectApply, RegExpPrototypeTest, Symbol, SymbolFor, - TypedArrayPrototypeSlice, } = primordials; const net = require('net'); @@ -185,7 +177,7 @@ class HTTPServerAsyncResource { } function ServerResponse(req) { - FunctionPrototypeCall(OutgoingMessage, this); + OutgoingMessage.call(this); if (req.method === 'HEAD') this._hasBody = false; @@ -212,7 +204,7 @@ ObjectSetPrototypeOf(ServerResponse, OutgoingMessage); ServerResponse.prototype._finish = function _finish() { DTRACE_HTTP_SERVER_RESPONSE(this.socket); emitStatistics(this[kServerResponseStatistics]); - FunctionPrototypeCall(OutgoingMessage.prototype._finish, this); + OutgoingMessage.prototype._finish.call(this); }; @@ -386,7 +378,7 @@ function Server(options, requestListener) { validateBoolean(insecureHTTPParser, 'options.insecureHTTPParser'); this.insecureHTTPParser = insecureHTTPParser; - FunctionPrototypeCall(net.Server, this, { allowHalfOpen: true }); + net.Server.call(this, { allowHalfOpen: true }); if (requestListener) { this.on('request', requestListener); @@ -422,8 +414,10 @@ Server.prototype[EE.captureRejectionSymbol] = function(err, event, ...args) { const { 1: res } = args; if (!res.headersSent && !res.writableEnded) { // Don't leak headers. - ArrayPrototypeForEach(res.getHeaderNames(), - (name) => res.removeHeader(name)); + const names = res.getHeaderNames(); + for (let i = 0; i < names.length; i++) { + res.removeHeader(names[i]); + } res.statusCode = 500; res.end(STATUS_CODES[500]); } else { @@ -431,8 +425,8 @@ Server.prototype[EE.captureRejectionSymbol] = function(err, event, ...args) { } break; default: - ReflectApply(net.Server.prototype[SymbolFor('nodejs.rejection')], - this, arguments); + net.Server.prototype[SymbolFor('nodejs.rejection')] + .apply(this, arguments); } }; @@ -493,20 +487,20 @@ function connectionListenerInternal(server, socket) { outgoingData: 0, keepAliveTimeoutSet: false }; - state.onData = FunctionPrototypeBind(socketOnData, undefined, - server, socket, parser, state); - state.onEnd = FunctionPrototypeBind(socketOnEnd, undefined, - server, socket, parser, state); - state.onClose = FunctionPrototypeBind(socketOnClose, undefined, - socket, state); - state.onDrain = FunctionPrototypeBind(socketOnDrain, undefined, - socket, state); + state.onData = socketOnData.bind(undefined, + server, socket, parser, state); + state.onEnd = socketOnEnd.bind(undefined, + server, socket, parser, state); + state.onClose = socketOnClose.bind(undefined, + socket, state); + state.onDrain = socketOnDrain.bind(undefined, + socket, state); socket.on('data', state.onData); socket.on('error', socketOnError); socket.on('end', state.onEnd); socket.on('close', state.onClose); socket.on('drain', state.onDrain); - parser.onIncoming = FunctionPrototypeBind(parserOnIncoming, undefined, + parser.onIncoming = parserOnIncoming.bind(undefined, server, socket, state); // We are consuming socket, so it won't get any actual data @@ -527,18 +521,18 @@ function connectionListenerInternal(server, socket) { parser.consume(socket._handle); } parser[kOnExecute] = - FunctionPrototypeBind(onParserExecute, undefined, - server, socket, parser, state); + onParserExecute.bind(undefined, + server, socket, parser, state); parser[kOnTimeout] = - FunctionPrototypeBind(onParserTimeout, undefined, - server, socket); + onParserTimeout.bind(undefined, + server, socket); // When receiving new requests on the same socket (pipelining or keep alive) // make sure the requestTimeout is active. parser[kOnMessageBegin] = - FunctionPrototypeBind(setRequestTimeout, undefined, - server, socket); + setRequestTimeout.bind(undefined, + server, socket); // This protects from DOS attack where an attacker establish the connection // without sending any data on applications where server.timeout is left to @@ -594,7 +588,7 @@ function socketOnClose(socket, state) { function abortIncoming(incoming) { while (incoming.length) { - const req = ArrayPrototypeShift(incoming); + const req = incoming.shift(); req.destroy(connResetException('aborted')); } // Abort socket._httpMessage ? @@ -606,7 +600,7 @@ function socketOnEnd(server, socket, parser, state) { if (ret instanceof Error) { debug('parse error'); // socketOnError has additional logic and will call socket.destroy(err). - FunctionPrototypeCall(socketOnError, socket, ret); + socketOnError.call(socket, ret); } else if (!server.httpAllowHalfOpen) { socket.end(); } else if (state.outgoing.length) { @@ -629,7 +623,7 @@ function socketOnData(server, socket, parser, state, d) { function onRequestTimeout(socket) { socket[kRequestTimeout] = undefined; // socketOnError has additional logic and will call socket.destroy(err). - ReflectApply(socketOnError, socket, [new ERR_HTTP_REQUEST_TIMEOUT()]); + socketOnError.call(socket, new ERR_HTTP_REQUEST_TIMEOUT()); } function onParserExecute(server, socket, parser, state, ret) { @@ -649,7 +643,7 @@ function onParserTimeout(server, socket) { socket.destroy(); } -const noop = FunctionPrototype; +const noop = () => {}; const badRequestResponse = Buffer.from( `HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}` + `Connection: close${CRLF}${CRLF}`, 'ascii' @@ -696,7 +690,7 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { prepareError(ret, parser, d); ret.rawPacket = d || parser.getCurrentBuffer(); debug('parse error', ret); - FunctionPrototypeCall(socketOnError, socket, ret); + socketOnError.call(socket, ret); } else if (parser.incoming && parser.incoming.upgrade) { // Upgrade or CONNECT const req = parser.incoming; @@ -719,7 +713,7 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { const eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade'; if (eventName === 'upgrade' || server.listenerCount(eventName) > 0) { debug('SERVER have listener for %s', eventName); - const bodyHead = TypedArrayPrototypeSlice(d, ret, d.length); + const bodyHead = d.slice(ret, d.length); socket.readableFlowing = null; @@ -738,7 +732,7 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { // When receiving new requests on the same socket (pipelining or keep alive) // make sure the requestTimeout is active. parser[kOnMessageBegin] = - FunctionPrototypeBind(setRequestTimeout, undefined, server, socket); + setRequestTimeout.bind(undefined, server, socket); } if (socket._paused && socket.parser) { @@ -802,7 +796,7 @@ function resOnFinish(req, res, socket, state, server) { // array will be empty. assert(state.incoming.length === 0 || state.incoming[0] === req); - ArrayPrototypeShift(state.incoming); + state.incoming.shift(); // If the user never called req.read(), and didn't pipe() or // .resume() or .on('data'), then we call req._dump() so that the @@ -835,7 +829,7 @@ function resOnFinish(req, res, socket, state, server) { } } else { // Start sending the next message - const m = ArrayPrototypeShift(state.outgoing); + const m = state.outgoing.shift(); if (m) { m.assignSocket(socket); } @@ -861,7 +855,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { return 2; } - ArrayPrototypePush(state.incoming, req); + state.incoming.push(req); // If the writable end isn't consuming, then stop reading // so that we don't become overwhelmed by a flood of @@ -879,8 +873,8 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { const res = new server[kServerResponse](req); res._keepAliveTimeout = server.keepAliveTimeout; - res._onPendingData = FunctionPrototypeBind(updateOutgoingData, undefined, - socket, state); + res._onPendingData = updateOutgoingData.bind(undefined, + socket, state); res.shouldKeepAlive = keepAlive; DTRACE_HTTP_SERVER_REQUEST(req, socket); @@ -896,7 +890,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { if (socket._httpMessage) { // There are already pending outgoing res, append. - ArrayPrototypePush(state.outgoing, res); + state.outgoing.push(res); } else { res.assignSocket(socket); } @@ -904,8 +898,8 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { // When we're finished writing the response, check if this is the last // response, if so destroy the socket. res.on('finish', - FunctionPrototypeBind(resOnFinish, undefined, - req, res, socket, state, server)); + resOnFinish.bind(undefined, + req, res, socket, state, server)); if (req.headers.expect !== undefined && (req.httpVersionMajor === 1 && req.httpVersionMinor === 1)) { @@ -977,8 +971,8 @@ function unconsume(parser, socket) { function generateSocketListenerWrapper(originalFnName) { return function socketListenerWrap(ev, fn) { - const res = ReflectApply(net.Socket.prototype[originalFnName], this, - [ev, fn]); + const res = net.Socket.prototype[originalFnName].call(this, + ev, fn); if (!this.parser) { this.on = net.Socket.prototype.on; this.addListener = net.Socket.prototype.addListener; diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 9ecd92021de17f..66ebc7b77869f7 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -86,9 +86,10 @@ const { const { validateBuffer, validateCallback, + validateInt32, validateObject, validateString, - validateUint32 + validateUint32, } = require('internal/validators'); const { InternalX509Certificate @@ -893,6 +894,7 @@ TLSSocket.prototype.exportKeyingMaterial = function(length, label, context) { }; TLSSocket.prototype.setMaxSendFragment = function setMaxSendFragment(size) { + validateInt32(size, 'size'); return this._handle.setMaxSendFragment(size) === 1; }; @@ -1394,6 +1396,9 @@ Server.prototype.getTicketKeys = function getTicketKeys() { Server.prototype.setTicketKeys = function setTicketKeys(keys) { + validateBuffer(keys); + assert(keys.byteLength === 48, + 'Session ticket keys must be a 48-byte buffer'); this._sharedCreds.context.setTicketKeys(keys); }; diff --git a/lib/events.js b/lib/events.js index 15c69c30271aa6..cc29b3358e0ce2 100644 --- a/lib/events.js +++ b/lib/events.js @@ -22,13 +22,10 @@ 'use strict'; const { - ArrayPrototypeForEach, - ArrayPrototypePush, ArrayPrototypeSlice, Boolean, Error, ErrorCaptureStackTrace, - FunctionPrototypeCall, MathMin, NumberIsNaN, ObjectCreate, @@ -39,7 +36,6 @@ const { Promise, PromiseReject, PromiseResolve, - ReflectApply, ReflectOwnKeys, String, Symbol, @@ -76,7 +72,7 @@ const kMaxEventTargetListenersWarned = Symbol('events.maxEventTargetListenersWarned'); function EventEmitter(opts) { - FunctionPrototypeCall(EventEmitter.init, this, opts); + EventEmitter.init.call(this, opts); } module.exports = EventEmitter; module.exports.once = once; @@ -165,8 +161,8 @@ EventEmitter.setMaxListeners = if (isEventTarget === undefined) isEventTarget = require('internal/event_target').isEventTarget; - // Performance for forEach is now comparable with regular for-loop - ArrayPrototypeForEach(eventTargets, (target) => { + for (let i = 0; i < eventTargets.length; i++) { + const target = eventTargets[i]; if (isEventTarget(target)) { target[kMaxEventTargetListeners] = n; target[kMaxEventTargetListenersWarned] = false; @@ -178,7 +174,7 @@ EventEmitter.setMaxListeners = ['EventEmitter', 'EventTarget'], target); } - }); + } } }; @@ -217,7 +213,7 @@ function addCatch(that, promise, type, args) { const then = promise.then; if (typeof then === 'function') { - FunctionPrototypeCall(then, promise, undefined, function(err) { + then.call(promise, undefined, function(err) { // The callback is called with nextTick to avoid a follow-up // rejection from this promise. process.nextTick(emitUnhandledRejectionOrErr, that, err, type, args); @@ -366,7 +362,7 @@ EventEmitter.prototype.emit = function emit(type, ...args) { return false; if (typeof handler === 'function') { - const result = ReflectApply(handler, this, args); + const result = handler.apply(this, args); // We check if result is undefined first because that // is the most common case so we do not pay any perf @@ -378,7 +374,7 @@ EventEmitter.prototype.emit = function emit(type, ...args) { const len = handler.length; const listeners = arrayClone(handler); for (let i = 0; i < len; ++i) { - const result = ReflectApply(listeners[i], this, args); + const result = listeners[i].apply(this, args); // We check if result is undefined first because that // is the most common case so we do not pay any perf @@ -690,7 +686,7 @@ function getEventListeners(emitterOrTarget, type) { while (handler?.listener !== undefined) { const listener = handler.listener?.deref ? handler.listener.deref() : handler.listener; - ArrayPrototypePush(listeners, listener); + listeners.push(listener); handler = handler.next; } return listeners; @@ -807,7 +803,7 @@ function on(emitter, event, options) { // Wait until an event happens return new Promise(function(resolve, reject) { - ArrayPrototypePush(unconsumedPromises, { resolve, reject }); + unconsumedPromises.push({ resolve, reject }); }); }, @@ -871,7 +867,7 @@ function on(emitter, event, options) { if (promise) { promise.resolve(createIterResult(args, false)); } else { - ArrayPrototypePush(unconsumedEvents, args); + unconsumedEvents.push(args); } } diff --git a/lib/fs.js b/lib/fs.js index e6cf8527e8720d..310397bbed39e1 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -207,6 +207,14 @@ function isFileType(stats, fileType) { return (mode & S_IFMT) === fileType; } +/** + * Tests a user's permissions for the file or directory + * specified by `path`. + * @param {string | Buffer | URL} path + * @param {number} [mode] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function access(path, mode, callback) { if (typeof mode === 'function') { callback = mode; @@ -222,6 +230,13 @@ function access(path, mode, callback) { binding.access(pathModule.toNamespacedPath(path), mode, req); } +/** + * Synchronously tests a user's permissions for the file or + * directory specified by `path`. + * @param {string | Buffer | URL} path + * @param {number} [mode] + * @returns {void | never} + */ function accessSync(path, mode) { path = getValidatedPath(path); mode = getValidMode(mode, 'access'); @@ -231,6 +246,12 @@ function accessSync(path, mode) { handleErrorFromBinding(ctx); } +/** + * Tests whether or not the given path exists. + * @param {string | Buffer | URL} path + * @param {(exists?: boolean) => any} callback + * @returns {void} + */ function exists(path, callback) { maybeCallback(callback); @@ -257,6 +278,11 @@ ObjectDefineProperty(exists, internalUtil.promisify.custom, { // fs.existsSync(), would only get a false in return, so we cannot signal // validation errors to users properly out of compatibility concerns. // TODO(joyeecheung): deprecate the never-throw-on-invalid-arguments behavior +/** + * Synchronously tests whether or not the given path exists. + * @param {string | Buffer | URL} path + * @returns {boolean} + */ function existsSync(path) { try { path = getValidatedPath(path); @@ -326,6 +352,20 @@ function checkAborted(signal, callback) { return false; } +/** + * Asynchronously reads the entire contents of a file. + * @param {string | Buffer | URL | number} path + * @param {{ + * encoding?: string | null; + * flag?: string; + * signal?: AbortSignal; + * } | string} [options] + * @param {( + * err?: Error, + * data?: string | Buffer + * ) => any} callback + * @returns {void} + */ function readFile(path, options, callback) { callback = maybeCallback(callback || options); options = getOptions(options, { flag: 'r' }); @@ -396,6 +436,15 @@ function tryReadSync(fd, isUserFd, buffer, pos, len) { return bytesRead; } +/** + * Synchronously reads the entire contents of a file. + * @param {string | Buffer | URL | number} path + * @param {{ + * encoding?: string | null; + * flag?: string; + * }} [options] + * @returns {string | Buffer} + */ function readFileSync(path, options) { options = getOptions(options, { flag: 'r' }); const isUserFd = isFd(path); // File descriptor ownership @@ -451,6 +500,12 @@ function defaultCloseCallback(err) { if (err != null) throw err; } +/** + * Closes the file descriptor. + * @param {number} fd + * @param {(err?: Error) => any} [callback] + * @returns {void} + */ function close(fd, callback = defaultCloseCallback) { fd = getValidatedFd(fd); if (callback !== defaultCloseCallback) @@ -461,6 +516,11 @@ function close(fd, callback = defaultCloseCallback) { binding.close(fd, req); } +/** + * Synchronously closes the file descriptor. + * @param {number} fd + * @returns {void} + */ function closeSync(fd) { fd = getValidatedFd(fd); @@ -469,6 +529,17 @@ function closeSync(fd) { handleErrorFromBinding(ctx); } +/** + * Asynchronously opens a file. + * @param {string | Buffer | URL} path + * @param {string | number} [flags] + * @param {string | number} [mode] + * @param {( + * err?: Error, + * fd?: number + * ) => any} callback + * @returns {void} + */ function open(path, flags, mode, callback) { path = getValidatedPath(path); if (arguments.length < 3) { @@ -493,7 +564,13 @@ function open(path, flags, mode, callback) { req); } - +/** + * Synchronously opens a file. + * @param {string | Buffer | URL} path + * @param {string | number} [flags] + * @param {string | number} [mode] + * @returns {number} + */ function openSync(path, flags, mode) { path = getValidatedPath(path); const flagsNumber = stringToFlags(flags); @@ -507,10 +584,20 @@ function openSync(path, flags, mode) { return result; } -// usage: -// fs.read(fd, buffer, offset, length, position, callback); -// OR -// fs.read(fd, {}, callback) +/** + * Reads file from the specified `fd` (file descriptor). + * @param {number} fd + * @param {Buffer | TypedArray | DataView} buffer + * @param {number} offset + * @param {number} length + * @param {number | bigint} position + * @param {( + * err?: Error, + * bytesRead?: number, + * buffer?: Buffer + * ) => any} callback + * @returns {void} + */ function read(fd, buffer, offset, length, position, callback) { fd = getValidatedFd(fd); @@ -543,7 +630,7 @@ function read(fd, buffer, offset, length, position, callback) { if (offset == null) { offset = 0; } else { - validateInteger(offset, 'offset'); + validateInteger(offset, 'offset', 0); } length |= 0; @@ -580,10 +667,18 @@ function read(fd, buffer, offset, length, position, callback) { ObjectDefineProperty(read, internalUtil.customPromisifyArgs, { value: ['bytesRead', 'buffer'], enumerable: false }); -// usage: -// fs.readSync(fd, buffer, offset, length, position); -// OR -// fs.readSync(fd, buffer, {}) or fs.readSync(fd, buffer) +/** + * Synchronously reads the file from the + * specified `fd` (file descriptor). + * @param {number} fd + * @param {Buffer | TypedArray | DataView} buffer + * @param {{ + * offset?: number; + * length?: number; + * position?: number | bigint; + * }} [offset] + * @returns {number} + */ function readSync(fd, buffer, offset, length, position) { fd = getValidatedFd(fd); @@ -599,7 +694,7 @@ function readSync(fd, buffer, offset, length, position) { if (offset == null) { offset = 0; } else { - validateInteger(offset, 'offset'); + validateInteger(offset, 'offset', 0); } length |= 0; @@ -627,6 +722,19 @@ function readSync(fd, buffer, offset, length, position) { return result; } +/** + * Reads file from the specified `fd` (file descriptor) + * and writes to an array of `ArrayBufferView`s. + * @param {number} fd + * @param {ArrayBufferView[]} buffers + * @param {number} [position] + * @param {( + * err?: Error, + * bytesRead?: number, + * buffers?: ArrayBufferView[]; + * ) => any} callback + * @returns {void} + */ function readv(fd, buffers, position, callback) { function wrapper(err, read) { callback(err, read || 0, buffers); @@ -648,6 +756,15 @@ function readv(fd, buffers, position, callback) { ObjectDefineProperty(readv, internalUtil.customPromisifyArgs, { value: ['bytesRead', 'buffers'], enumerable: false }); +/** + * Synchronously reads file from the + * specified `fd` (file descriptor) and writes to an array + * of `ArrayBufferView`s. + * @param {number} fd + * @param {ArrayBufferView[]} buffers + * @param {number} [position] + * @returns {number} + */ function readvSync(fd, buffers, position) { fd = getValidatedFd(fd); validateBufferArray(buffers); @@ -662,10 +779,20 @@ function readvSync(fd, buffers, position) { return result; } -// usage: -// fs.write(fd, buffer[, offset[, length[, position]]], callback); -// OR -// fs.write(fd, string[, position[, encoding]], callback); +/** + * Writes `buffer` to the specified `fd` (file descriptor). + * @param {number} fd + * @param {Buffer | TypedArray | DataView | string | Object} buffer + * @param {number} [offset] + * @param {number} [length] + * @param {number} [position] + * @param {( + * err?: Error, + * bytesWritten?: number; + * buffer?: Buffer | TypedArray | DataView + * ) => any} callback + * @returns {void} + */ function write(fd, buffer, offset, length, position, callback) { function wrapper(err, written) { // Retain a reference to buffer so that it can't be GC'ed too soon. @@ -679,7 +806,7 @@ function write(fd, buffer, offset, length, position, callback) { if (offset == null || typeof offset === 'function') { offset = 0; } else { - validateInteger(offset, 'offset'); + validateInteger(offset, 'offset', 0); } if (typeof length !== 'number') length = buffer.byteLength - offset; @@ -716,10 +843,16 @@ function write(fd, buffer, offset, length, position, callback) { ObjectDefineProperty(write, internalUtil.customPromisifyArgs, { value: ['bytesWritten', 'buffer'], enumerable: false }); -// Usage: -// fs.writeSync(fd, buffer[, offset[, length[, position]]]); -// OR -// fs.writeSync(fd, string[, position[, encoding]]); +/** + * Synchronously writes `buffer` to the + * specified `fd` (file descriptor). + * @param {number} fd + * @param {Buffer | TypedArray | DataView | string | Object} buffer + * @param {number} [offset] + * @param {number} [length] + * @param {number} [position] + * @returns {number} + */ function writeSync(fd, buffer, offset, length, position) { fd = getValidatedFd(fd); const ctx = {}; @@ -730,7 +863,7 @@ function writeSync(fd, buffer, offset, length, position) { if (offset == null) { offset = 0; } else { - validateInteger(offset, 'offset'); + validateInteger(offset, 'offset', 0); } if (typeof length !== 'number') length = buffer.byteLength - offset; @@ -750,8 +883,19 @@ function writeSync(fd, buffer, offset, length, position) { return result; } -// usage: -// fs.writev(fd, buffers[, position], callback); +/** + * Writes an array of `ArrayBufferView`s to the + * specified `fd` (file descriptor). + * @param {number} fd + * @param {ArrayBufferView[]} buffers + * @param {number} [position] + * @param {( + * err?: Error, + * bytesWritten?: number, + * buffers?: ArrayBufferView[] + * ) => any} callback + * @returns {void} + */ function writev(fd, buffers, position, callback) { function wrapper(err, written) { callback(err, written || 0, buffers); @@ -775,6 +919,14 @@ ObjectDefineProperty(writev, internalUtil.customPromisifyArgs, { enumerable: false }); +/** + * Synchronously writes an array of `ArrayBufferView`s + * to the specified `fd` (file descriptor). + * @param {number} fd + * @param {ArrayBufferView[]} buffers + * @param {number} [position] + * @returns {number} + */ function writevSync(fd, buffers, position) { fd = getValidatedFd(fd); validateBufferArray(buffers); @@ -790,6 +942,14 @@ function writevSync(fd, buffers, position) { return result; } +/** + * Asynchronously renames file at `oldPath` to + * the pathname provided as `newPath`. + * @param {string | Buffer | URL} oldPath + * @param {string | Buffer | URL} newPath + * @param {(err?: Error) => any} callback + * @returns {void} + */ function rename(oldPath, newPath, callback) { callback = makeCallback(callback); oldPath = getValidatedPath(oldPath, 'oldPath'); @@ -801,6 +961,14 @@ function rename(oldPath, newPath, callback) { req); } + +/** + * Synchronously renames file at `oldPath` to + * the pathname provided as `newPath`. + * @param {string | Buffer | URL} oldPath + * @param {string | Buffer | URL} newPath + * @returns {void} + */ function renameSync(oldPath, newPath) { oldPath = getValidatedPath(oldPath, 'oldPath'); newPath = getValidatedPath(newPath, 'newPath'); @@ -810,6 +978,13 @@ function renameSync(oldPath, newPath) { handleErrorFromBinding(ctx); } +/** + * Truncates the file. + * @param {string | Buffer | URL} path + * @param {number} [len] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function truncate(path, len, callback) { if (typeof path === 'number') { showTruncateDeprecation(); @@ -837,6 +1012,12 @@ function truncate(path, len, callback) { }); } +/** + * Synchronously truncates the file. + * @param {string | Buffer | URL} path + * @param {number} [len] + * @returns {void} + */ function truncateSync(path, len) { if (typeof path === 'number') { // legacy @@ -858,6 +1039,13 @@ function truncateSync(path, len) { return ret; } +/** + * Truncates the file descriptor. + * @param {number} fd + * @param {number} [len] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function ftruncate(fd, len = 0, callback) { if (typeof len === 'function') { callback = len; @@ -873,6 +1061,12 @@ function ftruncate(fd, len = 0, callback) { binding.ftruncate(fd, len, req); } +/** + * Synchronously truncates the file descriptor. + * @param {number} fd + * @param {number} [len] + * @returns {void} + */ function ftruncateSync(fd, len = 0) { fd = getValidatedFd(fd); validateInteger(len, 'len'); @@ -888,6 +1082,17 @@ function lazyLoadRimraf() { ({ rimraf, rimrafSync } = require('internal/fs/rimraf')); } +/** + * Asynchronously removes a directory. + * @param {string | Buffer | URL} path + * @param {{ + * maxRetries?: number; + * recursive?: boolean; + * retryDelay?: number; + * }} [options] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function rmdir(path, options, callback) { if (typeof options === 'function') { callback = options; @@ -924,6 +1129,16 @@ function rmdir(path, options, callback) { } } +/** + * Synchronously removes a directory. + * @param {string | Buffer | URL} path + * @param {{ + * maxRetries?: number; + * recursive?: boolean; + * retryDelay?: number; + * }} [options] + * @returns {void} + */ function rmdirSync(path, options) { path = getValidatedPath(path); @@ -943,6 +1158,19 @@ function rmdirSync(path, options) { return handleErrorFromBinding(ctx); } +/** + * Asynchronously removes files and + * directories (modeled on the standard POSIX `rm` utility). + * @param {string | Buffer | URL} path + * @param {{ + * force?: boolean; + * maxRetries?: number; + * recursive?: boolean; + * retryDelay?: number; + * }} [options] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function rm(path, options, callback) { if (typeof options === 'function') { callback = options; @@ -958,6 +1186,18 @@ function rm(path, options, callback) { }); } +/** + * Synchronously removes files and + * directories (modeled on the standard POSIX `rm` utility). + * @param {string | Buffer | URL} path + * @param {{ + * force?: boolean; + * maxRetries?: number; + * recursive?: boolean; + * retryDelay?: number; + * }} [options] + * @returns {void} + */ function rmSync(path, options) { options = validateRmOptionsSync(path, options, false); @@ -965,6 +1205,14 @@ function rmSync(path, options) { return rimrafSync(pathModule.toNamespacedPath(path), options); } +/** + * Forces all currently queued I/O operations associated + * with the file to the operating system's synchronized + * I/O completion state. + * @param {number} fd + * @param {(err?: Error) => any} callback + * @returns {void} + */ function fdatasync(fd, callback) { fd = getValidatedFd(fd); const req = new FSReqCallback(); @@ -972,6 +1220,13 @@ function fdatasync(fd, callback) { binding.fdatasync(fd, req); } +/** + * Synchronously forces all currently queued I/O operations + * associated with the file to the operating + * system's synchronized I/O completion state. + * @param {number} fd + * @returns {void} + */ function fdatasyncSync(fd) { fd = getValidatedFd(fd); const ctx = {}; @@ -979,6 +1234,13 @@ function fdatasyncSync(fd) { handleErrorFromBinding(ctx); } +/** + * Requests for all data for the open file descriptor + * to be flushed to the storage device. + * @param {number} fd + * @param {(err?: Error) => any} callback + * @returns {void} + */ function fsync(fd, callback) { fd = getValidatedFd(fd); const req = new FSReqCallback(); @@ -986,6 +1248,12 @@ function fsync(fd, callback) { binding.fsync(fd, req); } +/** + * Synchronously requests for all data for the open + * file descriptor to be flushed to the storage device. + * @param {number} fd + * @returns {void} + */ function fsyncSync(fd) { fd = getValidatedFd(fd); const ctx = {}; @@ -993,6 +1261,16 @@ function fsyncSync(fd) { handleErrorFromBinding(ctx); } +/** + * Asynchronously creates a directory. + * @param {string | Buffer | URL} path + * @param {{ + * recursive?: boolean; + * mode?: string | number; + * } | number} [options] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function mkdir(path, options, callback) { let mode = 0o777; let recursive = false; @@ -1017,6 +1295,15 @@ function mkdir(path, options, callback) { parseFileMode(mode, 'mode'), recursive, req); } +/** + * Synchronously creates a directory. + * @param {string | Buffer | URL} path + * @param {{ + * recursive?: boolean; + * mode?: string | number; + * } | number} [options] + * @returns {string | void} + */ function mkdirSync(path, options) { let mode = 0o777; let recursive = false; @@ -1041,6 +1328,19 @@ function mkdirSync(path, options) { } } +/** + * Reads the contents of a directory. + * @param {string | Buffer | URL} path + * @param {string | { + * encoding?: string; + * withFileTypes?: boolean; + * }} [options] + * @param {( + * err?: Error, + * files?: string[] | Buffer[] | Direct[]; + * ) => any} callback + * @returns {void} + */ function readdir(path, options, callback) { callback = makeCallback(typeof options === 'function' ? options : callback); options = getOptions(options, {}); @@ -1062,6 +1362,15 @@ function readdir(path, options, callback) { !!options.withFileTypes, req); } +/** + * Synchronously reads the contents of a directory. + * @param {string | Buffer | URL} path + * @param {string | { + * encoding?: string; + * withFileTypes?: boolean; + * }} [options] + * @returns {string | Buffer[] | Dirent[]} + */ function readdirSync(path, options) { options = getOptions(options, {}); path = getValidatedPath(path); @@ -1073,6 +1382,17 @@ function readdirSync(path, options) { return options.withFileTypes ? getDirents(path, result) : result; } +/** + * Invokes the callback with the `fs.Stats` + * for the file descriptor. + * @param {number} fd + * @param {{ bigint?: boolean; }} [options] + * @param {( + * err?: Error, + * stats?: Stats + * ) => any} callback + * @returns {void} + */ function fstat(fd, options = { bigint: false }, callback) { if (typeof options === 'function') { callback = options; @@ -1086,6 +1406,17 @@ function fstat(fd, options = { bigint: false }, callback) { binding.fstat(fd, options.bigint, req); } +/** + * Retrieves the `fs.Stats` for the symbolic link + * referred to by the `path`. + * @param {string | Buffer | URL} path + * @param {{ bigint?: boolean; }} [options] + * @param {( + * err?: Error, + * stats?: Stats + * ) => any} callback + * @returns {void} + */ function lstat(path, options = { bigint: false }, callback) { if (typeof options === 'function') { callback = options; @@ -1099,6 +1430,16 @@ function lstat(path, options = { bigint: false }, callback) { binding.lstat(pathModule.toNamespacedPath(path), options.bigint, req); } +/** + * Asynchronously gets the stats of a file. + * @param {string | Buffer | URL} path + * @param {{ bigint?: boolean; }} [options] + * @param {( + * err?: Error, + * stats?: Stats + * ) => any} callback + * @returns {void} + */ function stat(path, options = { bigint: false }, callback) { if (typeof options === 'function') { callback = options; @@ -1125,6 +1466,16 @@ function hasNoEntryError(ctx) { return false; } +/** + * Synchronously retrieves the `fs.Stats` for + * the file descriptor. + * @param {number} fd + * @param {{ + * bigint?: boolean; + * throwIfNoEntry?: boolean; + * }} [options] + * @returns {Stats} + */ function fstatSync(fd, options = { bigint: false, throwIfNoEntry: true }) { fd = getValidatedFd(fd); const ctx = { fd }; @@ -1133,6 +1484,16 @@ function fstatSync(fd, options = { bigint: false, throwIfNoEntry: true }) { return getStatsFromBinding(stats); } +/** + * Synchronously retrieves the `fs.Stats` for + * the symbolic link referred to by the `path`. + * @param {string | Buffer | URL} path + * @param {{ + * bigint?: boolean; + * throwIfNoEntry?: boolean; + * }} [options] + * @returns {Stats} + */ function lstatSync(path, options = { bigint: false, throwIfNoEntry: true }) { path = getValidatedPath(path); const ctx = { path }; @@ -1145,6 +1506,16 @@ function lstatSync(path, options = { bigint: false, throwIfNoEntry: true }) { return getStatsFromBinding(stats); } +/** + * Synchronously retrieves the `fs.Stats` + * for the `path`. + * @param {string | Buffer | URL} path + * @param {{ + * bigint?: boolean; + * throwIfNoEntry?: boolean; + * }} [options] + * @returns {Stats} + */ function statSync(path, options = { bigint: false, throwIfNoEntry: true }) { path = getValidatedPath(path); const ctx = { path }; @@ -1157,6 +1528,17 @@ function statSync(path, options = { bigint: false, throwIfNoEntry: true }) { return getStatsFromBinding(stats); } +/** + * Reads the contents of a symbolic link + * referred to by `path`. + * @param {string | Buffer | URL} path + * @param {{ encoding?: string; } | string} [options] + * @param {( + * err?: Error, + * linkString?: string | Buffer + * ) => any} callback + * @returns {void} + */ function readlink(path, options, callback) { callback = makeCallback(typeof options === 'function' ? options : callback); options = getOptions(options, {}); @@ -1166,6 +1548,13 @@ function readlink(path, options, callback) { binding.readlink(pathModule.toNamespacedPath(path), options.encoding, req); } +/** + * Synchronously reads the contents of a symbolic link + * referred to by `path`. + * @param {string | Buffer | URL} path + * @param {{ encoding?: string; } | string} [options] + * @returns {string | Buffer} + */ function readlinkSync(path, options) { options = getOptions(options, {}); path = getValidatedPath(path, 'oldPath'); @@ -1176,6 +1565,14 @@ function readlinkSync(path, options) { return result; } +/** + * Creates the link called `path` pointing to `target`. + * @param {string | Buffer | URL} target + * @param {string | Buffer | URL} path + * @param {string} [type_] + * @param {(err?: Error) => any} callback_ + * @returns {void} + */ function symlink(target, path, type_, callback_) { const type = (typeof type_ === 'string' ? type_ : null); const callback = makeCallback(arguments[arguments.length - 1]); @@ -1218,6 +1615,14 @@ function symlink(target, path, type_, callback_) { binding.symlink(destination, pathModule.toNamespacedPath(path), flags, req); } +/** + * Synchronously creates the link called `path` + * pointing to `target`. + * @param {string | Buffer | URL} target + * @param {string | Buffer | URL} path + * @param {string} [type] + * @returns {void} + */ function symlinkSync(target, path, type) { type = (typeof type === 'string' ? type : null); if (isWindows && type === null) { @@ -1237,6 +1642,14 @@ function symlinkSync(target, path, type) { handleErrorFromBinding(ctx); } +/** + * Creates a new link from the `existingPath` + * to the `newPath`. + * @param {string | Buffer | URL} existingPath + * @param {string | Buffer | URL} newPath + * @param {(err?: Error) => any} callback + * @returns {void} + */ function link(existingPath, newPath, callback) { callback = makeCallback(callback); @@ -1251,6 +1664,13 @@ function link(existingPath, newPath, callback) { req); } +/** + * Synchronously creates a new link from the `existingPath` + * to the `newPath`. + * @param {string | Buffer | URL} existingPath + * @param {string | Buffer | URL} newPath + * @returns {void} + */ function linkSync(existingPath, newPath) { existingPath = getValidatedPath(existingPath, 'existingPath'); newPath = getValidatedPath(newPath, 'newPath'); @@ -1263,6 +1683,12 @@ function linkSync(existingPath, newPath) { return result; } +/** + * Asynchronously removes a file or symbolic link. + * @param {string | Buffer | URL} path + * @param {(err?: Error) => any} callback + * @returns {void} + */ function unlink(path, callback) { callback = makeCallback(callback); path = getValidatedPath(path); @@ -1271,6 +1697,11 @@ function unlink(path, callback) { binding.unlink(pathModule.toNamespacedPath(path), req); } +/** + * Synchronously removes a file or symbolic link. + * @param {string | Buffer | URL} path + * @returns {void} + */ function unlinkSync(path) { path = getValidatedPath(path); const ctx = { path }; @@ -1278,6 +1709,13 @@ function unlinkSync(path) { handleErrorFromBinding(ctx); } +/** + * Sets the permissions on the file. + * @param {number} fd + * @param {string | number} mode + * @param {(err?: Error) => any} callback + * @returns {void} + */ function fchmod(fd, mode, callback) { fd = getValidatedFd(fd); mode = parseFileMode(mode, 'mode'); @@ -1288,6 +1726,12 @@ function fchmod(fd, mode, callback) { binding.fchmod(fd, mode, req); } +/** + * Synchronously sets the permissions on the file. + * @param {number} fd + * @param {string | number} mode + * @returns {void} + */ function fchmodSync(fd, mode) { fd = getValidatedFd(fd); mode = parseFileMode(mode, 'mode'); @@ -1296,6 +1740,13 @@ function fchmodSync(fd, mode) { handleErrorFromBinding(ctx); } +/** + * Changes the permissions on a symbolic link. + * @param {string | Buffer | URL} path + * @param {number} mode + * @param {(err?: Error) => any} callback + * @returns {void} + */ function lchmod(path, mode, callback) { callback = maybeCallback(callback); mode = parseFileMode(mode, 'mode'); @@ -1314,6 +1765,12 @@ function lchmod(path, mode, callback) { }); } +/** + * Synchronously changes the permissions on a symbolic link. + * @param {string | Buffer | URL} path + * @param {number} mode + * @returns {void} + */ function lchmodSync(path, mode) { const fd = fs.openSync(path, O_WRONLY | O_SYMLINK); @@ -1328,7 +1785,13 @@ function lchmodSync(path, mode) { return ret; } - +/** + * Asynchronously changes the permissions of a file. + * @param {string | Buffer | URL} path + * @param {string | number} mode + * @param {(err?: Error) => any} callback + * @returns {void} + */ function chmod(path, mode, callback) { path = getValidatedPath(path); mode = parseFileMode(mode, 'mode'); @@ -1339,6 +1802,12 @@ function chmod(path, mode, callback) { binding.chmod(pathModule.toNamespacedPath(path), mode, req); } +/** + * Synchronously changes the permissions of a file. + * @param {string | Buffer | URL} path + * @param {string | number} mode + * @returns {void} + */ function chmodSync(path, mode) { path = getValidatedPath(path); mode = parseFileMode(mode, 'mode'); @@ -1348,6 +1817,14 @@ function chmodSync(path, mode) { handleErrorFromBinding(ctx); } +/** + * Sets the owner of the symbolic link. + * @param {string | Buffer | URL} path + * @param {number} uid + * @param {number} gid + * @param {(err?: Error) => any} callback + * @returns {void} + */ function lchown(path, uid, gid, callback) { callback = makeCallback(callback); path = getValidatedPath(path); @@ -1358,6 +1835,13 @@ function lchown(path, uid, gid, callback) { binding.lchown(pathModule.toNamespacedPath(path), uid, gid, req); } +/** + * Synchronously sets the owner of the symbolic link. + * @param {string | Buffer | URL} path + * @param {number} uid + * @param {number} gid + * @returns {void} + */ function lchownSync(path, uid, gid) { path = getValidatedPath(path); validateInteger(uid, 'uid', -1, kMaxUserId); @@ -1367,6 +1851,14 @@ function lchownSync(path, uid, gid) { handleErrorFromBinding(ctx); } +/** + * Sets the owner of the file. + * @param {number} fd + * @param {number} uid + * @param {number} gid + * @param {(err?: Error) => any} callback + * @returns {void} + */ function fchown(fd, uid, gid, callback) { fd = getValidatedFd(fd); validateInteger(uid, 'uid', -1, kMaxUserId); @@ -1378,6 +1870,13 @@ function fchown(fd, uid, gid, callback) { binding.fchown(fd, uid, gid, req); } +/** + * Synchronously sets the owner of the file. + * @param {number} fd + * @param {number} uid + * @param {number} gid + * @returns {void} + */ function fchownSync(fd, uid, gid) { fd = getValidatedFd(fd); validateInteger(uid, 'uid', -1, kMaxUserId); @@ -1388,6 +1887,15 @@ function fchownSync(fd, uid, gid) { handleErrorFromBinding(ctx); } +/** + * Asynchronously changes the owner and group + * of a file. + * @param {string | Buffer | URL} path + * @param {number} uid + * @param {number} gid + * @param {(err?: Error) => any} callback + * @returns {void} + */ function chown(path, uid, gid, callback) { callback = makeCallback(callback); path = getValidatedPath(path); @@ -1399,6 +1907,14 @@ function chown(path, uid, gid, callback) { binding.chown(pathModule.toNamespacedPath(path), uid, gid, req); } +/** + * Synchronously changes the owner and group + * of a file. + * @param {string | Buffer | URL} path + * @param {number} uid + * @param {number} gid + * @returns {void} + */ function chownSync(path, uid, gid) { path = getValidatedPath(path); validateInteger(uid, 'uid', -1, kMaxUserId); @@ -1408,6 +1924,15 @@ function chownSync(path, uid, gid) { handleErrorFromBinding(ctx); } +/** + * Changes the file system timestamps of the object + * referenced by `path`. + * @param {string | Buffer | URL} path + * @param {number | string | Date} atime + * @param {number | string | Date} mtime + * @param {(err?: Error) => any} callback + * @returns {void} + */ function utimes(path, atime, mtime, callback) { callback = makeCallback(callback); path = getValidatedPath(path); @@ -1420,6 +1945,14 @@ function utimes(path, atime, mtime, callback) { req); } +/** + * Synchronously changes the file system timestamps + * of the object referenced by `path`. + * @param {string | Buffer | URL} path + * @param {number | string | Date} atime + * @param {number | string | Date} mtime + * @returns {void} + */ function utimesSync(path, atime, mtime) { path = getValidatedPath(path); const ctx = { path }; @@ -1429,6 +1962,15 @@ function utimesSync(path, atime, mtime) { handleErrorFromBinding(ctx); } +/** + * Changes the file system timestamps of the object + * referenced by the supplied `fd` (file descriptor). + * @param {number} fd + * @param {number | string | Date} atime + * @param {number | string | Date} mtime + * @param {(err?: Error) => any} callback + * @returns {void} + */ function futimes(fd, atime, mtime, callback) { fd = getValidatedFd(fd); atime = toUnixTimestamp(atime, 'atime'); @@ -1440,6 +1982,15 @@ function futimes(fd, atime, mtime, callback) { binding.futimes(fd, atime, mtime, req); } +/** + * Synchronously changes the file system timestamps + * of the object referenced by the + * supplied `fd` (file descriptor). + * @param {number} fd + * @param {number | string | Date} atime + * @param {number | string | Date} mtime + * @returns {void} + */ function futimesSync(fd, atime, mtime) { fd = getValidatedFd(fd); atime = toUnixTimestamp(atime, 'atime'); @@ -1449,6 +2000,15 @@ function futimesSync(fd, atime, mtime) { handleErrorFromBinding(ctx); } +/** + * Changes the access and modification times of + * a file in the same way as `fs.utimes()`. + * @param {string | Buffer | URL} path + * @param {number | string | Date} atime + * @param {number | string | Date} mtime + * @param {(err?: Error) => any} callback + * @returns {void} + */ function lutimes(path, atime, mtime, callback) { callback = makeCallback(callback); path = getValidatedPath(path); @@ -1461,6 +2021,14 @@ function lutimes(path, atime, mtime, callback) { req); } +/** + * Synchronously changes the access and modification + * times of a file in the same way as `fs.utimesSync()`. + * @param {string | Buffer | URL} path + * @param {number | string | Date} atime + * @param {number | string | Date} mtime + * @returns {void} + */ function lutimesSync(path, atime, mtime) { path = getValidatedPath(path); const ctx = { path }; @@ -1507,6 +2075,19 @@ function writeAll(fd, isUserFd, buffer, offset, length, signal, callback) { }); } +/** + * Asynchronously writes data to the file. + * @param {string | Buffer | URL | number} path + * @param {string | Buffer | TypedArray | DataView | Object} data + * @param {{ + * encoding?: string | null; + * mode?: number; + * flag?: string; + * signal?: AbortSignal; + * } | string} [options] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function writeFile(path, data, options, callback) { callback = maybeCallback(callback || options); options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'w' }); @@ -1538,6 +2119,17 @@ function writeFile(path, data, options, callback) { }); } +/** + * Synchronously writes data to the file. + * @param {string | Buffer | URL | number} path + * @param {string | Buffer | TypedArray | DataView | Object} data + * @param {{ + * encoding?: string | null; + * mode?: number; + * flag?: string; + * } | string} [options] + * @returns {void} + */ function writeFileSync(path, data, options) { options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'w' }); @@ -1564,6 +2156,18 @@ function writeFileSync(path, data, options) { } } +/** + * Asynchronously appends data to a file. + * @param {string | Buffer | URL | number} path + * @param {string | Buffer} data + * @param {{ + * encoding?: string | null; + * mode?: number; + * flag?: string; + * } | string} [options] + * @param {(err?: Error) => any} callback + * @returns {void} + */ function appendFile(path, data, options, callback) { callback = maybeCallback(callback || options); options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'a' }); @@ -1578,6 +2182,17 @@ function appendFile(path, data, options, callback) { fs.writeFile(path, data, options, callback); } +/** + * Synchronously appends data to a file. + * @param {string | Buffer | URL | number} path + * @param {string | Buffer} data + * @param {{ + * encoding?: string | null; + * mode?: number; + * flag?: string; + * } | string} [options] + * @returns {void} + */ function appendFileSync(path, data, options) { options = getOptions(options, { encoding: 'utf8', mode: 0o666, flag: 'a' }); @@ -1591,6 +2206,21 @@ function appendFileSync(path, data, options) { fs.writeFileSync(path, data, options); } +/** + * Watches for the changes on `filename`. + * @param {string | Buffer | URL} filename + * @param {string | { + * persistent?: boolean; + * recursive?: boolean; + * encoding?: string; + * signal?: AbortSignal; + * }} [options] + * @param {( + * eventType?: string, + * filename?: string | Buffer + * ) => any} [listener] + * @returns {watchers.FSWatcher} + */ function watch(filename, options, listener) { if (typeof options === 'function') { listener = options; @@ -1633,6 +2263,20 @@ function watch(filename, options, listener) { const statWatchers = new SafeMap(); +/** + * Watches for changes on `filename`. + * @param {string | Buffer | URL} filename + * @param {{ + * bigint?: boolean; + * persistent?: boolean; + * interval?: number; + * }} [options] + * @param {( + * current?: Stats, + * previous?: Stats + * ) => any} listener + * @returns {watchers.StatWatcher} + */ function watchFile(filename, options, listener) { filename = getValidatedPath(filename); filename = pathModule.resolve(filename); @@ -1671,6 +2315,12 @@ function watchFile(filename, options, listener) { return stat; } +/** + * Stops watching for changes on `filename`. + * @param {string | Buffer | URL} filename + * @param {() => any} [listener] + * @returns {void} + */ function unwatchFile(filename, listener) { filename = getValidatedPath(filename); filename = pathModule.resolve(filename); @@ -1743,6 +2393,13 @@ if (isWindows) { } const emptyObj = ObjectCreate(null); + +/** + * Returns the resolved pathname. + * @param {string | Buffer | URL} p + * @param {string | { encoding?: string | null; }} [options] + * @returns {string | Buffer} + */ function realpathSync(p, options) { options = getOptions(options, emptyObj); p = toPathIfFileURL(p); @@ -1874,7 +2531,12 @@ function realpathSync(p, options) { return encodeRealpathResult(p, options); } - +/** + * Returns the resolved pathname. + * @param {string | Buffer | URL} p + * @param {string | { encoding?: string; }} [options] + * @returns {string | Buffer} + */ realpathSync.native = (path, options) => { options = getOptions(options, {}); path = getValidatedPath(path); @@ -1884,7 +2546,17 @@ realpathSync.native = (path, options) => { return result; }; - +/** + * Asynchronously computes the canonical pathname by + * resolving `.`, `..` and symbolic links. + * @param {string | Buffer | URL} p + * @param {string | { encoding?: string; }} [options] + * @param {( + * err?: Error, + * resolvedPath?: string | Buffer + * ) => any} callback + * @returns {void} + */ function realpath(p, options, callback) { callback = typeof options === 'function' ? options : maybeCallback(callback); options = getOptions(options, {}); @@ -2012,7 +2684,17 @@ function realpath(p, options, callback) { } } - +/** + * Asynchronously computes the canonical pathname by + * resolving `.`, `..` and symbolic links. + * @param {string | Buffer | URL} p + * @param {string | { encoding?: string; }} [options] + * @param {( + * err?: Error, + * resolvedPath?: string | Buffer + * ) => any} callback + * @returns {void} + */ realpath.native = (path, options, callback) => { callback = makeCallback(callback || options); options = getOptions(options, {}); @@ -2022,6 +2704,16 @@ realpath.native = (path, options, callback) => { return binding.realpath(path, options.encoding, req); }; +/** + * Creates a unique temporary directory. + * @param {string} prefix + * @param {string | { encoding?: string; }} [options] + * @param {( + * err?: Error, + * directory?: string + * ) => any} callback + * @returns {void} + */ function mkdtemp(prefix, options, callback) { callback = makeCallback(typeof options === 'function' ? options : callback); options = getOptions(options, {}); @@ -2035,7 +2727,12 @@ function mkdtemp(prefix, options, callback) { binding.mkdtemp(`${prefix}XXXXXX`, options.encoding, req); } - +/** + * Synchronously creates a unique temporary directory. + * @param {string} prefix + * @param {string | { encoding?: string; }} [options] + * @returns {string} + */ function mkdtempSync(prefix, options) { options = getOptions(options, {}); if (!prefix || typeof prefix !== 'string') { @@ -2051,7 +2748,15 @@ function mkdtempSync(prefix, options) { return result; } - +/** + * Asynchronously copies `src` to `dest`. By + * default, `dest` is overwritten if it already exists. + * @param {string | Buffer | URL} src + * @param {string | Buffer | URL} dest + * @param {number} [mode] + * @param {() => any} callback + * @returns {void} + */ function copyFile(src, dest, mode, callback) { if (typeof mode === 'function') { callback = mode; @@ -2071,7 +2776,14 @@ function copyFile(src, dest, mode, callback) { binding.copyFile(src, dest, mode, req); } - +/** + * Synchronously copies `src` to `dest`. By + * default, `dest` is overwritten if it already exists. + * @param {string | Buffer | URL} src + * @param {string | Buffer | URL} dest + * @param {number} [mode] + * @returns {void} + */ function copyFileSync(src, dest, mode) { src = getValidatedPath(src, 'src'); dest = getValidatedPath(dest, 'dest'); @@ -2093,11 +2805,44 @@ function lazyLoadStreams() { } } +/** + * Creates a readable stream with a default `highWaterMark` + * of 64 kb. + * @param {string | Buffer | URL} path + * @param {string | { + * flags?: string; + * encoding?: string; + * fd?: number | FileHandle; + * mode?: number; + * autoClose?: boolean; + * emitClose?: boolean; + * start: number; + * end?: number; + * highWaterMark?: number; + * fs?: Object | null; + * }} [options] + * @returns {ReadStream} + */ function createReadStream(path, options) { lazyLoadStreams(); return new ReadStream(path, options); } +/** + * Creates a write stream. + * @param {string | Buffer | URL} path + * @param {string | { + * flags?: string; + * encoding?: string; + * fd?: number | FileHandle; + * mode?: number; + * autoClose?: boolean; + * emitClose?: boolean; + * start: number; + * fs?: Object | null; + * }} [options] + * @returns {WriteStream} + */ function createWriteStream(path, options) { lazyLoadStreams(); return new WriteStream(path, options); diff --git a/lib/http.js b/lib/http.js index 491162f9c4a172..38f1297be7921f 100644 --- a/lib/http.js +++ b/lib/http.js @@ -44,14 +44,65 @@ const { } = require('_http_server'); let maxHeaderSize; +/** + * Returns a new instance of `http.Server`. + * @param {{ + * IncomingMessage?: IncomingMessage; + * ServerResponse?: ServerResponse; + * insecureHTTPParser?: boolean; + * maxHeaderSize?: number; + * }} [opts] + * @param {Function} [requestListener] + * @returns {Server} + */ function createServer(opts, requestListener) { return new Server(opts, requestListener); } +/** + * @typedef {Object} HTTPRequestOptions + * @property {httpAgent.Agent | boolean} [agent] + * @property {string} [auth] + * @property {Function} [createConnection] + * @property {number} [defaultPort] + * @property {number} [family] + * @property {Object} [headers] + * @property {number} [hints] + * @property {string} [host] + * @property {string} [hostname] + * @property {boolean} [insecureHTTPParser] + * @property {string} [localAddress] + * @property {number} [localPort] + * @property {Function} [lookup] + * @property {number} [maxHeaderSize] + * @property {string} [method] + * @property {string} [path] + * @property {number} [port] + * @property {string} [protocol] + * @property {boolean} [setHost] + * @property {string} [socketPath] + * @property {number} [timeout] + * @property {AbortSignal} [signal] + */ + +/** + * Makes an HTTP request. + * @param {string | URL} url + * @param {HTTPRequestOptions} [options] + * @param {Function} [cb] + * @returns {ClientRequest} + */ function request(url, options, cb) { return new ClientRequest(url, options, cb); } +/** + * Makes a `GET` HTTP request. + * @param {string | URL} url + * @param {HTTPRequestOptions} [options] + * @param {Function} [cb] + * @returns {ClientRequest} + */ function get(url, options, cb) { const req = request(url, options, cb); req.end(); diff --git a/lib/internal/async_hooks.js b/lib/internal/async_hooks.js index 69ca8d6db987ed..b8955f644d15d7 100644 --- a/lib/internal/async_hooks.js +++ b/lib/internal/async_hooks.js @@ -1,15 +1,11 @@ 'use strict'; const { - ArrayPrototypePop, ArrayPrototypeSlice, - ArrayPrototypeUnshift, ErrorCaptureStackTrace, - FunctionPrototypeBind, ObjectPrototypeHasOwnProperty, ObjectDefineProperty, Promise, - ReflectApply, Symbol, } = primordials; @@ -129,16 +125,16 @@ function callbackTrampoline(asyncId, resource, cb, ...args) { let result; if (asyncId === 0 && typeof domain_cb === 'function') { - ArrayPrototypeUnshift(args, cb); - result = ReflectApply(domain_cb, this, args); + args.unshift(cb); + result = domain_cb.apply(this, args); } else { - result = ReflectApply(cb, this, args); + result = cb.apply(this, args); } if (asyncId !== 0 && hasHooks(kAfter)) emitAfterNative(asyncId); - ArrayPrototypePop(execution_async_resources); + execution_async_resources.pop(); return result; } @@ -256,7 +252,7 @@ function emitHook(symbol, asyncId) { } function emitHookFactory(symbol, name) { - const fn = FunctionPrototypeBind(emitHook, undefined, symbol); + const fn = emitHook.bind(undefined, symbol); // Set the name property of the function as it looks good in the stack trace. ObjectDefineProperty(fn, 'name', { @@ -429,14 +425,14 @@ function clearDefaultTriggerAsyncId() { function defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) { if (triggerAsyncId === undefined) - return ReflectApply(block, null, args); + return block.apply(null, args); // CHECK(NumberIsSafeInteger(triggerAsyncId)) // CHECK(triggerAsyncId > 0) const oldDefaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId]; async_id_fields[kDefaultTriggerAsyncId] = triggerAsyncId; try { - return ReflectApply(block, null, args); + return block.apply(null, args); } finally { async_id_fields[kDefaultTriggerAsyncId] = oldDefaultTriggerAsyncId; } @@ -533,7 +529,7 @@ function popAsyncContext(asyncId) { const offset = stackLength - 1; async_id_fields[kExecutionAsyncId] = async_wrap.async_ids_stack[2 * offset]; async_id_fields[kTriggerAsyncId] = async_wrap.async_ids_stack[2 * offset + 1]; - ArrayPrototypePop(execution_async_resources); + execution_async_resources.pop(); async_hook_fields[kStackLength] = offset; return offset > 0; } diff --git a/lib/internal/blob.js b/lib/internal/blob.js index b767426dcb2b7d..927b9f54046bf2 100644 --- a/lib/internal/blob.js +++ b/lib/internal/blob.js @@ -20,6 +20,8 @@ const { FixedSizeBlobCopyJob, } = internalBinding('buffer'); +const { TextDecoder } = require('internal/encoding'); + const { JSTransferable, kClone, diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 2c195a6b8547d4..81a9547b9071bc 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -49,6 +49,7 @@ const { ReflectGet, ReflectSet, SymbolToStringTag, + globalThis, } = primordials; const config = internalBinding('config'); const { deprecate } = require('internal/util'); @@ -106,8 +107,10 @@ const deprecationHandler = { get(target, key, receiver) { const val = ReflectGet(target, key, receiver); - if (val != null && typeof val === 'object') + if (val != null && typeof val === 'object') { + // eslint-disable-next-line node-core/prefer-primordials return new Proxy(val, deprecationHandler); + } return val; }, @@ -117,6 +120,7 @@ const deprecationHandler = { } }; +// eslint-disable-next-line node-core/prefer-primordials let processConfig = new Proxy( JSONParse(nativeModule.config), deprecationHandler); @@ -189,61 +193,62 @@ if (!config.noBrowserGlobals) { // Override global console from the one provided by the VM // to the one implemented by Node.js // https://console.spec.whatwg.org/#console-namespace - exposeNamespace(global, 'console', createGlobalConsole(global.console)); + exposeNamespace(globalThis, 'console', + createGlobalConsole(globalThis.console)); const { URL, URLSearchParams } = require('internal/url'); // https://url.spec.whatwg.org/#url - exposeInterface(global, 'URL', URL); + exposeInterface(globalThis, 'URL', URL); // https://url.spec.whatwg.org/#urlsearchparams - exposeInterface(global, 'URLSearchParams', URLSearchParams); + exposeInterface(globalThis, 'URLSearchParams', URLSearchParams); const { TextEncoder, TextDecoder } = require('internal/encoding'); // https://encoding.spec.whatwg.org/#textencoder - exposeInterface(global, 'TextEncoder', TextEncoder); + exposeInterface(globalThis, 'TextEncoder', TextEncoder); // https://encoding.spec.whatwg.org/#textdecoder - exposeInterface(global, 'TextDecoder', TextDecoder); + exposeInterface(globalThis, 'TextDecoder', TextDecoder); const { AbortController, AbortSignal, } = require('internal/abort_controller'); - exposeInterface(global, 'AbortController', AbortController); - exposeInterface(global, 'AbortSignal', AbortSignal); + exposeInterface(globalThis, 'AbortController', AbortController); + exposeInterface(globalThis, 'AbortSignal', AbortSignal); const { EventTarget, Event, } = require('internal/event_target'); - exposeInterface(global, 'EventTarget', EventTarget); - exposeInterface(global, 'Event', Event); + exposeInterface(globalThis, 'EventTarget', EventTarget); + exposeInterface(globalThis, 'Event', Event); const { MessageChannel, MessagePort, MessageEvent, } = require('internal/worker/io'); - exposeInterface(global, 'MessageChannel', MessageChannel); - exposeInterface(global, 'MessagePort', MessagePort); - exposeInterface(global, 'MessageEvent', MessageEvent); + exposeInterface(globalThis, 'MessageChannel', MessageChannel); + exposeInterface(globalThis, 'MessagePort', MessagePort); + exposeInterface(globalThis, 'MessageEvent', MessageEvent); // https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope const timers = require('timers'); - defineOperation(global, 'clearInterval', timers.clearInterval); - defineOperation(global, 'clearTimeout', timers.clearTimeout); - defineOperation(global, 'setInterval', timers.setInterval); - defineOperation(global, 'setTimeout', timers.setTimeout); + defineOperation(globalThis, 'clearInterval', timers.clearInterval); + defineOperation(globalThis, 'clearTimeout', timers.clearTimeout); + defineOperation(globalThis, 'setInterval', timers.setInterval); + defineOperation(globalThis, 'setTimeout', timers.setTimeout); - defineOperation(global, 'queueMicrotask', queueMicrotask); + defineOperation(globalThis, 'queueMicrotask', queueMicrotask); - defineLazyGlobal(global, 'performance', () => { + defineLazyGlobal(globalThis, 'performance', () => { const { performance } = require('perf_hooks'); return performance; }); // Non-standard extensions: - defineOperation(global, 'clearImmediate', timers.clearImmediate); - defineOperation(global, 'setImmediate', timers.setImmediate); + defineOperation(globalThis, 'clearImmediate', timers.clearImmediate); + defineOperation(globalThis, 'setImmediate', timers.setImmediate); } // Set the per-Environment callback that will be called @@ -388,7 +393,7 @@ function setupProcessObject() { value: 'process' }); // Make process globally available to users by putting it on the global proxy - ObjectDefineProperty(global, 'process', { + ObjectDefineProperty(globalThis, 'process', { value: process, enumerable: false, writable: true, @@ -397,7 +402,7 @@ function setupProcessObject() { } function setupGlobalProxy() { - ObjectDefineProperty(global, SymbolToStringTag, { + ObjectDefineProperty(globalThis, SymbolToStringTag, { value: 'global', writable: false, enumerable: false, @@ -418,7 +423,7 @@ function setupBuffer() { delete bufferBinding.setBufferPrototype; delete bufferBinding.zeroFill; - ObjectDefineProperties(global, { + ObjectDefineProperties(globalThis, { 'Buffer': { value: Buffer, enumerable: false, diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index 694ef44c325331..e52da0868e1ad2 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -6,6 +6,7 @@ const { SafeMap, SafeWeakMap, StringPrototypeStartsWith, + globalThis, } = primordials; const { @@ -302,7 +303,7 @@ function initializeDeprecations() { // deprecation path for these in ES Modules. // See https://github.com/nodejs/node/pull/26334. let _process = process; - ObjectDefineProperty(global, 'process', { + ObjectDefineProperty(globalThis, 'process', { get() { return _process; }, @@ -314,7 +315,7 @@ function initializeDeprecations() { }); let _Buffer = Buffer; - ObjectDefineProperty(global, 'Buffer', { + ObjectDefineProperty(globalThis, 'Buffer', { get() { return _Buffer; }, diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index b20b8c6ae76448..bd38cf48a7fc6e 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -63,8 +63,8 @@ function checkInt(value, min, max, buf, offset, byteLength) { if (min === 0 || min === 0n) { range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; } else { - range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + - `${(byteLength + 1) * 8 - 1}${n}`; + range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and ` + + `< 2${n} ** ${(byteLength + 1) * 8 - 1}${n}`; } } else { range = `>= ${min}${n} and <= ${max}${n}`; diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index c3716a8acda8b5..22b84e5e42b956 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -429,7 +429,10 @@ const consoleMethods = { if (this._stdout.isTTY && process.env.TERM !== 'dumb') { // The require is here intentionally to avoid readline being // required too early when console is first loaded. - const { cursorTo, clearScreenDown } = require('readline'); + const { + cursorTo, + clearScreenDown, + } = require('internal/readline/callbacks'); cursorTo(this._stdout, 0, 0); clearScreenDown(this._stdout); } diff --git a/lib/internal/crypto/diffiehellman.js b/lib/internal/crypto/diffiehellman.js index e2106b211ba01b..2e38e95ea1d774 100644 --- a/lib/internal/crypto/diffiehellman.js +++ b/lib/internal/crypto/diffiehellman.js @@ -122,9 +122,9 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) { generator = DH_GENERATOR; } else if (typeof generator === 'number') { validateInt32(generator, 'generator'); - } else if (generator !== true) { + } else if (typeof generator === 'string') { generator = toBuf(generator, genEncoding); - } else { + } else if (!isArrayBufferView(generator) && !isAnyArrayBuffer(generator)) { throw new ERR_INVALID_ARG_TYPE( 'generator', ['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'], diff --git a/lib/internal/crypto/keygen.js b/lib/internal/crypto/keygen.js index 6fc06936a4fb03..06490e24a9c24f 100644 --- a/lib/internal/crypto/keygen.js +++ b/lib/internal/crypto/keygen.js @@ -40,6 +40,7 @@ const { const { customPromisifyArgs } = require('internal/util'); const { + isInt32, isUint32, validateCallback, validateString, @@ -194,7 +195,7 @@ function createJob(mode, type, options) { throw new ERR_INVALID_ARG_VALUE('options.hash', hash); if (mgf1Hash !== undefined && typeof mgf1Hash !== 'string') throw new ERR_INVALID_ARG_VALUE('options.mgf1Hash', mgf1Hash); - if (saltLength !== undefined && !isUint32(saltLength)) + if (saltLength !== undefined && (!isInt32(saltLength) || saltLength < 0)) throw new ERR_INVALID_ARG_VALUE('options.saltLength', saltLength); return new RsaKeyPairGenJob( @@ -217,7 +218,7 @@ function createJob(mode, type, options) { let { divisorLength } = options; if (divisorLength == null) { divisorLength = -1; - } else if (!isUint32(divisorLength)) { + } else if (!isInt32(divisorLength) || divisorLength < 0) { throw new ERR_INVALID_ARG_VALUE('options.divisorLength', divisorLength); } @@ -292,7 +293,7 @@ function createJob(mode, type, options) { if (!isArrayBufferView(prime)) throw new ERR_INVALID_ARG_VALUE('options.prime', prime); } else if (primeLength != null) { - if (!isUint32(primeLength)) + if (!isInt32(primeLength) || primeLength < 0) throw new ERR_INVALID_ARG_VALUE('options.primeLength', primeLength); } else { throw new ERR_MISSING_OPTION( @@ -300,7 +301,7 @@ function createJob(mode, type, options) { } if (generator != null) { - if (!isUint32(generator)) + if (!isInt32(generator) || generator < 0) throw new ERR_INVALID_ARG_VALUE('options.generator', generator); } return new DhKeyPairGenJob( diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js index 458723df28ffca..45a04905bfd447 100644 --- a/lib/internal/crypto/scrypt.js +++ b/lib/internal/crypto/scrypt.js @@ -16,6 +16,7 @@ const { const { validateCallback, validateInteger, + validateInt32, validateUint32, } = require('internal/validators'); @@ -90,7 +91,7 @@ function check(password, salt, keylen, options) { password = getArrayBufferOrView(password, 'password'); salt = getArrayBufferOrView(salt, 'salt'); - validateUint32(keylen, 'keylen'); + validateInt32(keylen, 'keylen', 0); let { N, r, p, maxmem } = defaults; if (options && options !== defaults) { diff --git a/lib/internal/crypto/webcrypto.js b/lib/internal/crypto/webcrypto.js index 47c34b9ca0d665..b28ee9b8167be5 100644 --- a/lib/internal/crypto/webcrypto.js +++ b/lib/internal/crypto/webcrypto.js @@ -26,7 +26,7 @@ const { validateString, } = require('internal/validators'); -const { TextDecoder } = require('internal/encoding'); +const { TextDecoder, TextEncoder } = require('internal/encoding'); const { codes: { diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index e7282588551929..9dd21af4025094 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -19,13 +19,16 @@ // https://github.com/google/caja/blob/master/src/com/google/caja/ses/repairES5.js // https://github.com/tc39/proposal-ses/blob/e5271cc42a257a05dcae2fd94713ed2f46c08620/shim/src/freeze.js -/* global WebAssembly, SharedArrayBuffer, console */ +/* global console */ 'use strict'; const { + AggregateError, + AggregateErrorPrototype, Array, ArrayBuffer, ArrayBufferPrototype, + ArrayIteratorPrototype, ArrayPrototype, ArrayPrototypeForEach, ArrayPrototypePush, @@ -45,6 +48,8 @@ const { ErrorPrototype, EvalError, EvalErrorPrototype, + FinalizationRegistry, + FinalizationRegistryPrototype, Float32Array, Float32ArrayPrototype, Float64Array, @@ -73,6 +78,7 @@ const { ObjectPrototypeHasOwnProperty, Promise, PromisePrototype, + Proxy, RangeError, RangeErrorPrototype, ReferenceError, @@ -84,9 +90,12 @@ const { Set, SetPrototype, String, + StringIteratorPrototype, StringPrototype, Symbol, SymbolIterator, + SymbolMatchAll, + SymbolPrototype, SyntaxError, SyntaxErrorPrototype, TypeError, @@ -105,14 +114,24 @@ const { URIErrorPrototype, WeakMap, WeakMapPrototype, + WeakRef, + WeakRefPrototype, WeakSet, WeakSetPrototype, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, + globalThis, } = primordials; +const { + Atomics, + Intl, + SharedArrayBuffer, + WebAssembly +} = globalThis; + module.exports = function() { const { clearImmediate, @@ -124,34 +143,14 @@ module.exports = function() { } = require('timers'); const intrinsicPrototypes = [ - // Anonymous Intrinsics - // IteratorPrototype - ObjectGetPrototypeOf( - ObjectGetPrototypeOf(new Array()[SymbolIterator]()) - ), - // ArrayIteratorPrototype - ObjectGetPrototypeOf(new Array()[SymbolIterator]()), - // StringIteratorPrototype - ObjectGetPrototypeOf(new String()[SymbolIterator]()), - // MapIteratorPrototype - ObjectGetPrototypeOf(new Map()[SymbolIterator]()), - // SetIteratorPrototype - ObjectGetPrototypeOf(new Set()[SymbolIterator]()), - // GeneratorFunction - ObjectGetPrototypeOf(function* () {}), - // AsyncFunction - ObjectGetPrototypeOf(async function() {}), - // AsyncGeneratorFunction - ObjectGetPrototypeOf(async function* () {}), - // TypedArray - TypedArrayPrototype, - - // 19 Fundamental Objects - ObjectPrototype, // 19.1 - FunctionPrototype, // 19.2 - BooleanPrototype, // 19.3 - - ErrorPrototype, // 19.5 + // 20 Fundamental Objects + ObjectPrototype, // 20.1 + FunctionPrototype, // 20.2 + BooleanPrototype, // 20.3 + SymbolPrototype, // 20.4 + + ErrorPrototype, // 20.5 + AggregateErrorPrototype, EvalErrorPrototype, RangeErrorPrototype, ReferenceErrorPrototype, @@ -159,17 +158,23 @@ module.exports = function() { TypeErrorPrototype, URIErrorPrototype, - // 20 Numbers and Dates - NumberPrototype, // 20.1 - DatePrototype, // 20.3 + // 21 Numbers and Dates + NumberPrototype, // 21.1 + BigIntPrototype, // 21.2 + DatePrototype, // 21.4 - // 21 Text Processing - StringPrototype, // 21.1 - RegExpPrototype, // 21.2 + // 22 Text Processing + StringPrototype, // 22.1 + StringIteratorPrototype, // 22.1.5 + RegExpPrototype, // 22.2 + // 22.2.7 RegExpStringIteratorPrototype + ObjectGetPrototypeOf(/e/[SymbolMatchAll]()), - // 22 Indexed Collections - ArrayPrototype, // 22.1 + // 23 Indexed Collections + ArrayPrototype, // 23.1 + ArrayIteratorPrototype, // 23.1.5 + TypedArrayPrototype, // 23.2 Int8ArrayPrototype, Uint8ArrayPrototype, Uint8ClampedArrayPrototype, @@ -182,20 +187,36 @@ module.exports = function() { BigInt64ArrayPrototype, BigUint64ArrayPrototype, - // 23 Keyed Collections - MapPrototype, // 23.1 - SetPrototype, // 23.2 - WeakMapPrototype, // 23.3 - WeakSetPrototype, // 23.4 - - // 24 Structured Data - ArrayBufferPrototype, // 24.1 - DataViewPrototype, // 24.3 - PromisePrototype, // 25.4 + // 24 Keyed Collections + MapPrototype, // 24.1 + // 24.1.5 MapIteratorPrototype + ObjectGetPrototypeOf(new Map()[SymbolIterator]()), + SetPrototype, // 24.2 + // 24.2.5 SetIteratorPrototype + ObjectGetPrototypeOf(new Set()[SymbolIterator]()), + WeakMapPrototype, // 24.3 + WeakSetPrototype, // 24.4 + + // 25 Structured Data + ArrayBufferPrototype, // 25.1 + SharedArrayBuffer.prototype, // 25.2 + DataViewPrototype, // 25.3 + + // 26 Managing Memory + WeakRefPrototype, // 26.1 + FinalizationRegistryPrototype, // 26.2 + + // 27 Control Abstraction Objects + // 27.1 Iteration + ObjectGetPrototypeOf(ArrayIteratorPrototype), // 27.1.2 IteratorPrototype + // 27.1.3 AsyncIteratorPrototype + ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf( + (async function*() {})() + ))), + PromisePrototype, // 27.2 // Other APIs / Web Compatibility console.Console.prototype, - BigIntPrototype, WebAssembly.Module.prototype, WebAssembly.Instance.prototype, WebAssembly.Table.prototype, @@ -203,34 +224,13 @@ module.exports = function() { WebAssembly.CompileError.prototype, WebAssembly.LinkError.prototype, WebAssembly.RuntimeError.prototype, - SharedArrayBuffer.prototype, ]; const intrinsics = [ - // Anonymous Intrinsics - // ThrowTypeError + // 10.2.4.1 ThrowTypeError ObjectGetOwnPropertyDescriptor(FunctionPrototype, 'caller').get, - // IteratorPrototype - ObjectGetPrototypeOf( - ObjectGetPrototypeOf(new Array()[SymbolIterator]()) - ), - // ArrayIteratorPrototype - ObjectGetPrototypeOf(new Array()[SymbolIterator]()), - // StringIteratorPrototype - ObjectGetPrototypeOf(new String()[SymbolIterator]()), - // MapIteratorPrototype - ObjectGetPrototypeOf(new Map()[SymbolIterator]()), - // SetIteratorPrototype - ObjectGetPrototypeOf(new Set()[SymbolIterator]()), - // GeneratorFunction - ObjectGetPrototypeOf(function* () {}), - // AsyncFunction - ObjectGetPrototypeOf(async function() {}), - // AsyncGeneratorFunction - ObjectGetPrototypeOf(async function* () {}), - // TypedArray - TypedArray, - // 18 The Global Object + // 19 The Global Object + // 19.2 Function Properties of the Global Object eval, // eslint-disable-next-line node-core/prefer-primordials isFinite, @@ -240,18 +240,20 @@ module.exports = function() { parseFloat, // eslint-disable-next-line node-core/prefer-primordials parseInt, + // 19.2.6 URI Handling Functions decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, - // 19 Fundamental Objects - Object, // 19.1 - Function, // 19.2 - Boolean, // 19.3 - Symbol, // 19.4 + // 20 Fundamental Objects + Object, // 20.1 + Function, // 20.2 + Boolean, // 20.3 + Symbol, // 20.4 - Error, // 19.5 + Error, // 20.5 + AggregateError, EvalError, RangeError, ReferenceError, @@ -259,19 +261,25 @@ module.exports = function() { TypeError, URIError, - // 20 Numbers and Dates - Number, // 20.1 + // 21 Numbers and Dates + Number, // 21.1 + BigInt, // 21.2 // eslint-disable-next-line node-core/prefer-primordials - Math, // 20.2 - Date, // 20.3 - - // 21 Text Processing - String, // 21.1 - RegExp, // 21.2 - - // 22 Indexed Collections - Array, // 22.1 - + Math, // 21.3 + Date, // 21.4 + + // 22 Text Processing + String, // 22.1 + StringIteratorPrototype, // 22.1.5 + RegExp, // 22.2 + // 22.2.7 RegExpStringIteratorPrototype + ObjectGetPrototypeOf(/e/[SymbolMatchAll]()), + + // 23 Indexed Collections + Array, // 23.1 + ArrayIteratorPrototype, // 23.1.5 + // 23.2 TypedArray + TypedArray, Int8Array, Uint8Array, Uint8ClampedArray, @@ -284,23 +292,47 @@ module.exports = function() { BigInt64Array, BigUint64Array, - // 23 Keyed Collections - Map, // 23.1 - Set, // 23.2 - WeakMap, // 23.3 - WeakSet, // 23.4 - - // 24 Structured Data - ArrayBuffer, // 24.1 - DataView, // 24.3 + // 24 Keyed Collections + Map, // 24.1 + // 24.1.5 MapIteratorPrototype + ObjectGetPrototypeOf(new Map()[SymbolIterator]()), + Set, // 24.2 + // 24.2.5 SetIteratorPrototype + ObjectGetPrototypeOf(new Set()[SymbolIterator]()), + WeakMap, // 24.3 + WeakSet, // 24.4 + + // 25 Structured Data + ArrayBuffer, // 25.1 + SharedArrayBuffer, // 25.2 + DataView, // 25.3 + Atomics, // 25.4 // eslint-disable-next-line node-core/prefer-primordials - JSON, // 24.5 - Promise, // 25.4 + JSON, // 25.5 + + // 26 Managing Memory + WeakRef, // 26.1 + FinalizationRegistry, // 26.2 + + // 27 Control Abstraction Objects + // 27.1 Iteration + ObjectGetPrototypeOf(ArrayIteratorPrototype), // 27.1.2 IteratorPrototype + // 27.1.3 AsyncIteratorPrototype + ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf( + (async function*() {})() + ))), + Promise, // 27.2 + // 27.3 GeneratorFunction + ObjectGetPrototypeOf(function* () {}), + // 27.4 AsyncGeneratorFunction + ObjectGetPrototypeOf(async function* () {}), + // 27.7 AsyncFunction + ObjectGetPrototypeOf(async function() {}), - // 26 Reflection + // 28 Reflection // eslint-disable-next-line node-core/prefer-primordials - Reflect, // 26.1 - Proxy, // 26.2 + Reflect, // 28.1 + Proxy, // 28.2 // B.2.1 escape, @@ -314,10 +346,7 @@ module.exports = function() { setInterval, setTimeout, console, - BigInt, - Atomics, WebAssembly, - SharedArrayBuffer, ]; if (typeof Intl !== 'undefined') { @@ -337,6 +366,13 @@ module.exports = function() { const frozenSet = new WeakSet(); ArrayPrototypeForEach(intrinsics, deepFreeze); + // 19.1 Value Properties of the Global Object + ObjectDefineProperty(globalThis, 'globalThis', { + configurable: false, + writable: false, + value: globalThis, + }); + // Objects that are deeply frozen. function deepFreeze(root) { /** diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 5d51248c8417b9..e7f38219178952 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -10,6 +10,7 @@ const { PromisePrototypeFinally, PromisePrototypeThen, PromiseResolve, + PromiseReject, SafeArrayIterator, Symbol, Uint8Array, @@ -33,6 +34,7 @@ const { ERR_METHOD_NOT_IMPLEMENTED, }, AbortError, + aggregateTwoErrors, } = require('internal/errors'); const { isArrayBufferView } = require('internal/util/types'); const { rimrafPromises } = require('internal/fs/rimraf'); @@ -250,6 +252,19 @@ class FileHandle extends EventEmitterMixin(JSTransferable) { } } +async function handleFdClose(fileOpPromise, closeFunc) { + return PromisePrototypeThen( + fileOpPromise, + (result) => PromisePrototypeThen(closeFunc(), () => result), + (opError) => + PromisePrototypeThen( + closeFunc(), + () => PromiseReject(opError), + (closeError) => PromiseReject(aggregateTwoErrors(closeError, opError)) + ) + ); +} + async function fsCall(fn, handle, ...args) { if (handle[kRefs] === undefined) { throw new ERR_INVALID_ARG_TYPE('filehandle', 'FileHandle', handle); @@ -400,6 +415,9 @@ async function open(path, flags, mode) { async function read(handle, bufferOrOptions, offset, length, position) { let buffer = bufferOrOptions; if (!isArrayBufferView(buffer)) { + if (bufferOrOptions === undefined) { + bufferOrOptions = {}; + } if (bufferOrOptions.buffer) { buffer = bufferOrOptions.buffer; validateBuffer(buffer); @@ -414,7 +432,7 @@ async function read(handle, bufferOrOptions, offset, length, position) { if (offset == null) { offset = 0; } else { - validateInteger(offset, 'offset'); + validateInteger(offset, 'offset', 0); } length |= 0; @@ -457,7 +475,7 @@ async function write(handle, buffer, offset, length, position) { if (offset == null) { offset = 0; } else { - validateInteger(offset, 'offset'); + validateInteger(offset, 'offset', 0); } if (typeof length !== 'number') length = buffer.byteLength - offset; @@ -498,7 +516,7 @@ async function rename(oldPath, newPath) { async function truncate(path, len = 0) { const fd = await open(path, 'r+'); - return PromisePrototypeFinally(ftruncate(fd, len), fd.close); + return handleFdClose(ftruncate(fd, len), fd.close); } async function ftruncate(handle, len = 0) { @@ -629,7 +647,7 @@ async function lchmod(path, mode) { throw new ERR_METHOD_NOT_IMPLEMENTED('lchmod()'); const fd = await open(path, O_WRONLY | O_SYMLINK); - return PromisePrototypeFinally(fchmod(fd, mode), fd.close); + return handleFdClose(fchmod(fd, mode), fd.close); } async function lchown(path, uid, gid) { @@ -708,7 +726,7 @@ async function writeFile(path, data, options) { checkAborted(options.signal); const fd = await open(path, flag, options.mode); - return PromisePrototypeFinally( + return handleFdClose( writeFileHandle(fd, data, options.signal, options.encoding), fd.close); } @@ -733,7 +751,7 @@ async function readFile(path, options) { checkAborted(options.signal); const fd = await open(path, flag, 0o666); - return PromisePrototypeFinally(readFileHandle(fd, options), fd.close); + return handleFdClose(readFileHandle(fd, options), fd.close); } module.exports = { diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js index bf4d8457531c0b..3b7754292821f3 100644 --- a/lib/internal/fs/utils.js +++ b/lib/internal/fs/utils.js @@ -655,6 +655,10 @@ const validateOffsetLengthWrite = hideStackFrames( if (length > byteLength - offset) { throw new ERR_OUT_OF_RANGE('length', `<= ${byteLength - offset}`, length); } + + if (length < 0) { + throw new ERR_OUT_OF_RANGE('length', '>= 0', length); + } } ); diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 4795e59581d993..a1ee6cdbbc7777 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -9,6 +9,7 @@ const { ObjectCreate, ObjectKeys, ObjectPrototypeHasOwnProperty, + Proxy, ReflectApply, ReflectGetPrototypeOf, StringPrototypeIncludes, diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 5427f74a5f2b59..1654f2460cdd5a 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -18,6 +18,7 @@ const { ObjectPrototypeHasOwnProperty, Promise, PromisePrototypeCatch, + Proxy, ReflectApply, ReflectGet, ReflectGetPrototypeOf, diff --git a/deps/node-inspect/lib/_inspect.js b/lib/internal/inspector/_inspect.js similarity index 81% rename from deps/node-inspect/lib/_inspect.js rename to lib/internal/inspector/_inspect.js index aac278db0a891e..487c8837752e8e 100644 --- a/deps/node-inspect/lib/_inspect.js +++ b/lib/internal/inspector/_inspect.js @@ -19,25 +19,20 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ + +// TODO(trott): enable ESLint +/* eslint-disable */ + 'use strict'; const { spawn } = require('child_process'); const { EventEmitter } = require('events'); const net = require('net'); const util = require('util'); -const runAsStandalone = typeof __dirname !== 'undefined'; - -const [ InspectClient, createRepl ] = - runAsStandalone ? - // This copy of node-inspect is on-disk, relative paths make sense. +const { 0: InspectClient, 1: createRepl } = [ - require('./internal/inspect_client'), - require('./internal/inspect_repl') - ] : - // This copy of node-inspect is built into the node executable. - [ - require('node-inspect/lib/internal/inspect_client'), - require('node-inspect/lib/internal/inspect_repl') + require('internal/inspector/inspect_client'), + require('internal/inspector/inspect_repl'), ]; const debuglog = util.debuglog('inspect'); @@ -102,8 +97,8 @@ function runScript(script, scriptArgs, inspectHost, inspectPort, childPrint) { const child = spawn(process.execPath, args); child.stdout.setEncoding('utf8'); child.stderr.setEncoding('utf8'); - child.stdout.on('data', childPrint); - child.stderr.on('data', childPrint); + child.stdout.on('data', (chunk) => childPrint(chunk, 'stdout')); + child.stderr.on('data', (chunk) => childPrint(chunk, 'stderr')); let output = ''; function waitForListenHint(text) { @@ -154,11 +149,11 @@ class NodeInspector { if (options.script) { this._runScript = runScript.bind(null, - options.script, - options.scriptArgs, - options.host, - options.port, - this.childPrint.bind(this)); + options.script, + options.scriptArgs, + options.host, + options.port, + this.childPrint.bind(this)); } else { this._runScript = () => Promise.resolve([null, options.port, options.host]); @@ -171,7 +166,7 @@ class NodeInspector { this[domain] = createAgentProxy(domain, this.client); }); this.handleDebugEvent = (fullName, params) => { - const [domain, name] = fullName.split('.'); + const { 0: domain, 1: name } = fullName.split('.'); if (domain in this) { this[domain].emit(name, params); } @@ -225,7 +220,7 @@ class NodeInspector { run() { this.killChild(); - return this._runScript().then(([child, port, host]) => { + return this._runScript().then(({ 0: child, 1: port, 2: host }) => { this.child = child; let connectionAttempts = 0; @@ -236,21 +231,21 @@ class NodeInspector { return this.client.connect(port, host) .then(() => { debuglog('connection established'); - this.stdout.write(' ok'); + this.stdout.write(' ok\n'); }, (error) => { debuglog('connect failed', error); - // If it's failed to connect 10 times then print failed message - if (connectionAttempts >= 10) { + // If it's failed to connect 5 times then print failed message + if (connectionAttempts >= 5) { this.stdout.write(' failed to connect, please retry\n'); process.exit(1); } - return new Promise((resolve) => setTimeout(resolve, 500)) + return new Promise((resolve) => setTimeout(resolve, 1000)) .then(attemptConnect); }); }; - this.print(`connecting to ${host}:${port} ..`, true); + this.print(`connecting to ${host}:${port} ..`, false); return attemptConnect(); }); } @@ -264,23 +259,32 @@ class NodeInspector { } } - print(text, oneline = false) { + print(text, appendNewline = false) { this.clearLine(); - this.stdout.write(oneline ? text : `${text}\n`); + this.stdout.write(appendNewline ? `${text}\n` : text); } - childPrint(text) { - this.print( - text.toString() - .split(/\r\n|\r|\n/g) - .filter((chunk) => !!chunk) - .map((chunk) => `< ${chunk}`) - .join('\n') - ); - if (!this.paused) { - this.repl.displayPrompt(true); + #stdioBuffers = { stdout: '', stderr: '' }; + childPrint(text, which) { + const lines = (this.#stdioBuffers[which] + text) + .split(/\r\n|\r|\n/g); + + this.#stdioBuffers[which] = ''; + + if (lines[lines.length - 1] !== '') { + this.#stdioBuffers[which] = lines.pop(); } - if (/Waiting for the debugger to disconnect\.\.\.\n$/.test(text)) { + + const textToPrint = lines.map((chunk) => `< ${chunk}`).join('\n'); + + if (lines.length) { + this.print(textToPrint, true); + if (!this.paused) { + this.repl.displayPrompt(true); + } + } + + if (textToPrint.endsWith('Waiting for the debugger to disconnect...\n')) { this.killChild(); } } @@ -298,14 +302,12 @@ function parseArgv([target, ...args]) { if (hostMatch) { // Connecting to remote debugger - // `node-inspect localhost:9229` host = hostMatch[1]; port = parseInt(hostMatch[2], 10); isRemote = true; script = null; } else if (portMatch) { - // start debugee on custom port - // `node inspect --port=9230 script.js` + // Start on custom port port = parseInt(portMatch[1], 10); script = args[0]; scriptArgs = args.slice(1); @@ -316,9 +318,7 @@ function parseArgv([target, ...args]) { process._debugProcess(pid); } catch (e) { if (e.code === 'ESRCH') { - /* eslint-disable no-console */ console.error(`Target process: ${pid} doesn't exist.`); - /* eslint-enable no-console */ process.exit(1); } throw e; @@ -333,16 +333,14 @@ function parseArgv([target, ...args]) { } function startInspect(argv = process.argv.slice(2), - stdin = process.stdin, - stdout = process.stdout) { - /* eslint-disable no-console */ + stdin = process.stdin, + stdout = process.stdout) { if (argv.length < 1) { - const invokedAs = runAsStandalone ? - 'node-inspect' : - `${process.argv0} ${process.argv[1]}`; + const invokedAs = `${process.argv0} ${process.argv[1]}`; console.error(`Usage: ${invokedAs} script.js`); console.error(` ${invokedAs} <host>:<port>`); + console.error(` ${invokedAs} --port=<port>`); console.error(` ${invokedAs} -p <pid>`); process.exit(1); } @@ -354,7 +352,7 @@ function startInspect(argv = process.argv.slice(2), function handleUnexpectedError(e) { if (!(e instanceof StartupError)) { - console.error('There was an internal error in node-inspect. ' + + console.error('There was an internal error in Node.js. ' + 'Please report this bug.'); console.error(e.message); console.error(e.stack); @@ -366,6 +364,5 @@ function startInspect(argv = process.argv.slice(2), } process.on('uncaughtException', handleUnexpectedError); - /* eslint-enable no-console */ } exports.start = startInspect; diff --git a/deps/node-inspect/lib/internal/inspect_client.js b/lib/internal/inspector/inspect_client.js similarity index 96% rename from deps/node-inspect/lib/internal/inspect_client.js rename to lib/internal/inspector/inspect_client.js index 9b8529de21aae2..831a7fda1cdff1 100644 --- a/deps/node-inspect/lib/internal/inspect_client.js +++ b/lib/internal/inspector/inspect_client.js @@ -19,9 +19,12 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ + +// TODO(trott): enable ESLint +/* eslint-disable */ + 'use strict'; const Buffer = require('buffer').Buffer; -const crypto = require('crypto'); const { EventEmitter } = require('events'); const http = require('http'); const URL = require('url'); @@ -189,7 +192,7 @@ class Client extends EventEmitter { this.reset(); return; } - if (payloadBuffer === null) break; + if (payloadBuffer === null || payloadBuffer.length === 0) break; const payloadStr = payloadBuffer.toString(); debuglog('< %s', payloadStr); @@ -225,6 +228,9 @@ class Client extends EventEmitter { if (this._http) { this._http.destroy(); } + if (this._socket) { + this._socket.destroy(); + } this._http = null; this._lastId = 0; this._socket = null; @@ -270,7 +276,7 @@ class Client extends EventEmitter { resolve(JSON.parse(resBody)); } catch (parseError) { reject(new Error(`Response didn't contain JSON: ${resBody}`)); - return; + } } @@ -293,14 +299,14 @@ class Client extends EventEmitter { _discoverWebsocketPath() { return this._fetchJSON('/json') - .then(([{ webSocketDebuggerUrl }]) => + .then(({ 0: { webSocketDebuggerUrl } }) => URL.parse(webSocketDebuggerUrl).path); } _connectWebsocket(urlPath) { this.reset(); - const key1 = crypto.randomBytes(16).toString('base64'); + const key1 = require('crypto').randomBytes(16).toString('base64'); debuglog('request websocket', key1); const httpReq = this._http = http.request({ @@ -308,8 +314,8 @@ class Client extends EventEmitter { port: this._port, path: urlPath, headers: { - Connection: 'Upgrade', - Upgrade: 'websocket', + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', 'Sec-WebSocket-Key': key1, 'Sec-WebSocket-Version': '13', }, diff --git a/deps/node-inspect/lib/internal/inspect_repl.js b/lib/internal/inspector/inspect_repl.js similarity index 94% rename from deps/node-inspect/lib/internal/inspect_repl.js rename to lib/internal/inspector/inspect_repl.js index bfbedf66a71b79..ab75abddd408db 100644 --- a/deps/node-inspect/lib/internal/inspect_repl.js +++ b/lib/internal/inspector/inspect_repl.js @@ -19,6 +19,10 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ + +// TODO(trott): enable ESLint +/* eslint-disable */ + 'use strict'; const FS = require('fs'); const Path = require('path'); @@ -86,11 +90,11 @@ function extractFunctionName(description) { } const PUBLIC_BUILTINS = require('module').builtinModules; -const NATIVES = PUBLIC_BUILTINS ? process.binding('natives') : {}; +const NATIVES = PUBLIC_BUILTINS ? internalBinding('natives') : {}; function isNativeUrl(url) { url = url.replace(/\.js$/, ''); if (PUBLIC_BUILTINS) { - if (url.startsWith('internal/') || PUBLIC_BUILTINS.includes(url)) + if (url.startsWith('node:internal/') || PUBLIC_BUILTINS.includes(url)) return true; } @@ -286,7 +290,7 @@ function aliasProperties(target, mapping) { function createRepl(inspector) { const { Debugger, HeapProfiler, Profiler, Runtime } = inspector; - let repl; // eslint-disable-line prefer-const + let repl; // Things we want to keep around const history = { control: [], debug: [] }; @@ -316,9 +320,9 @@ function createRepl(inspector) { return util.inspect(value, INSPECT_OPTIONS); } - function print(value, oneline = false) { + function print(value, addNewline = true) { const text = typeof value === 'string' ? value : inspect(value); - return inspector.print(text, oneline); + return inspector.print(text, addNewline); } function getCurrentLocation() { @@ -349,6 +353,7 @@ function createRepl(inspector) { }) .join('\n'); } + function listScripts(displayNatives = false) { print(formatScripts(displayNatives)); } @@ -398,9 +403,9 @@ function createRepl(inspector) { const i = start + offset; const isCurrent = i === (lineNumber + 1); - const markedLine = isCurrent - ? markSourceColumn(lineText, columnNumber, options.colors) - : lineText; + const markedLine = isCurrent ? + markSourceColumn(lineText, columnNumber, options.colors) : + lineText; let isBreakpoint = false; knownBreakpoints.forEach(({ location }) => { @@ -484,7 +489,7 @@ function createRepl(inspector) { function prepareControlCode(input) { if (input === '\n') return lastCommand; - // exec process.title => exec("process.title"); + // Add parentheses: exec process.title => exec("process.title"); const match = input.match(/^\s*exec\s+([^\n]*)/); if (match) { lastCommand = `exec(${JSON.stringify(match[1])})`; @@ -577,7 +582,7 @@ function createRepl(inspector) { const lines = watchedExpressions .map((expr, idx) => { const prefix = `${leftPad(idx, ' ', lastIndex)}: ${expr} =`; - const value = inspect(values[idx], { colors: true }); + const value = inspect(values[idx]); if (value.indexOf('\n') === -1) { return `${prefix} ${value}`; } @@ -674,13 +679,13 @@ function createRepl(inspector) { // setBreakpoint('fn()'): Break when a function is called if (script.endsWith('()')) { const debugExpr = `debug(${script.slice(0, -2)})`; - const debugCall = selectedFrame - ? Debugger.evaluateOnCallFrame({ + const debugCall = selectedFrame ? + Debugger.evaluateOnCallFrame({ callFrameId: selectedFrame.callFrameId, expression: debugExpr, includeCommandLineAPI: true, - }) - : Runtime.evaluate({ + }) : + Runtime.evaluate({ expression: debugExpr, includeCommandLineAPI: true, }); @@ -803,7 +808,7 @@ function createRepl(inspector) { inspector.suspendReplWhile(() => Promise.all([formatWatchers(true), selectedFrame.list(2)]) - .then(([watcherList, context]) => { + .then(({ 0: watcherList, 1: context }) => { if (watcherList) { return `${watcherList}\n${inspect(context)}`; } @@ -825,9 +830,7 @@ function createRepl(inspector) { Debugger.on('scriptParsed', (script) => { const { scriptId, url } = script; if (url) { - knownScripts[scriptId] = Object.assign({ - isNative: isNativeUrl(url), - }, script); + knownScripts[scriptId] = { isNative: isNativeUrl(url), ...script }; } }); @@ -835,7 +838,7 @@ function createRepl(inspector) { Profile.createAndRegister({ profile }); print([ 'Captured new CPU profile.', - `Access it with profiles[${profiles.length - 1}]` + `Access it with profiles[${profiles.length - 1}]`, ].join('\n')); }); @@ -924,14 +927,16 @@ function createRepl(inspector) { if (finished) { print('Heap snaphost prepared.'); } else { - print(`Heap snapshot: ${done}/${total}`, true); + print(`Heap snapshot: ${done}/${total}`, false); } } + function onChunk({ chunk }) { sizeWritten += chunk.length; writer.write(chunk); - print(`Writing snapshot: ${sizeWritten}`, true); + print(`Writing snapshot: ${sizeWritten}`, false); } + function onResolve() { writer.end(() => { teardown(); @@ -939,10 +944,12 @@ function createRepl(inspector) { resolve(); }); } + function onReject(error) { teardown(); reject(error); } + function teardown() { HeapProfiler.removeListener( 'reportHeapSnapshotProgress', onProgress); @@ -952,7 +959,7 @@ function createRepl(inspector) { HeapProfiler.on('reportHeapSnapshotProgress', onProgress); HeapProfiler.on('addHeapSnapshotChunk', onChunk); - print('Heap snapshot: 0/0', true); + print('Heap snapshot: 0/0', false); HeapProfiler.takeHeapSnapshot({ reportProgress: true }) .then(onResolve, onReject); }); @@ -1023,7 +1030,7 @@ function createRepl(inspector) { repl.setPrompt('> '); - print('Press Ctrl + C to leave debug repl'); + print('Press Ctrl+C to leave debug repl'); repl.displayPrompt(); }, @@ -1058,19 +1065,16 @@ function createRepl(inspector) { } function initAfterStart() { - const setupTasks = [ - Runtime.enable(), - Profiler.enable(), - Profiler.setSamplingInterval({ interval: 100 }), - Debugger.enable(), - Debugger.setPauseOnExceptions({ state: 'none' }), - Debugger.setAsyncCallStackDepth({ maxDepth: 0 }), - Debugger.setBlackboxPatterns({ patterns: [] }), - Debugger.setPauseOnExceptions({ state: pauseOnExceptionState }), - restoreBreakpoints(), - Runtime.runIfWaitingForDebugger(), - ]; - return Promise.all(setupTasks); + return Runtime.enable() + .then(() => Profiler.enable()) + .then(() => Profiler.setSamplingInterval({ interval: 100 })) + .then(() => Debugger.enable()) + .then(() => Debugger.setPauseOnExceptions({ state: 'none' })) + .then(() => Debugger.setAsyncCallStackDepth({ maxDepth: 0 })) + .then(() => Debugger.setBlackboxPatterns({ patterns: [] })) + .then(() => Debugger.setPauseOnExceptions({ state: pauseOnExceptionState })) + .then(() => restoreBreakpoints()) + .then(() => Runtime.runIfWaitingForDebugger()); } return function startRepl() { @@ -1090,12 +1094,12 @@ function createRepl(inspector) { ignoreUndefined: true, }; - repl = Repl.start(replOptions); // eslint-disable-line prefer-const + repl = Repl.start(replOptions); initializeContext(repl.context); repl.on('reset', initializeContext); repl.defineCommand('interrupt', () => { - // We want this for testing purposes where sending CTRL-C can be tricky. + // We want this for testing purposes where sending Ctrl+C can be tricky. repl.emit('SIGINT'); }); diff --git a/lib/internal/main/eval_string.js b/lib/internal/main/eval_string.js index 124e4842308c55..ad068b935dfee0 100644 --- a/lib/internal/main/eval_string.js +++ b/lib/internal/main/eval_string.js @@ -3,6 +3,10 @@ // User passed `-e` or `--eval` arguments to Node without `-i` or // `--interactive`. +const { + globalThis, +} = primordials; + const { prepareMainThreadExecution } = require('internal/bootstrap/pre_execution'); @@ -12,7 +16,7 @@ const { addBuiltinLibsToObject } = require('internal/modules/cjs/helpers'); const { getOptionValue } = require('internal/options'); prepareMainThreadExecution(); -addBuiltinLibsToObject(global); +addBuiltinLibsToObject(globalThis); markBootstrapComplete(); const source = getOptionValue('--eval'); diff --git a/lib/internal/main/inspect.js b/lib/internal/main/inspect.js index 4873683048cc79..d9dab0dc92b118 100644 --- a/lib/internal/main/inspect.js +++ b/lib/internal/main/inspect.js @@ -13,5 +13,5 @@ markBootstrapComplete(); // Start the debugger agent. process.nextTick(() => { - require('internal/deps/node-inspect/lib/_inspect').start(); + require('internal/inspector/_inspect').start(); }); diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js index cd092381eaef73..e22fd17fa2d214 100644 --- a/lib/internal/main/worker_thread.js +++ b/lib/internal/main/worker_thread.js @@ -9,6 +9,7 @@ const { ArrayPrototypeSplice, ObjectDefineProperty, PromisePrototypeCatch, + globalThis: { Atomics }, } = primordials; const { diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 61f6e9cb786e94..fbfc17ba6d1885 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -45,6 +45,7 @@ const { ObjectPrototype, ObjectPrototypeHasOwnProperty, ObjectSetPrototypeOf, + Proxy, ReflectApply, ReflectSet, RegExpPrototypeTest, diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 43cc31c633c169..6d295089e42c70 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -1,7 +1,5 @@ 'use strict'; -/* global WebAssembly */ - const { ArrayPrototypeForEach, ArrayPrototypeMap, @@ -21,6 +19,7 @@ const { StringPrototypeSplit, StringPrototypeStartsWith, SyntaxErrorPrototype, + globalThis: { WebAssembly }, } = primordials; let _TYPES = null; @@ -63,6 +62,7 @@ const experimentalImportMetaResolve = getOptionValue('--experimental-import-meta-resolve'); const asyncESM = require('internal/process/esm_loader'); const { emitWarningSync } = require('internal/process/warning'); +const { TextDecoder } = require('internal/encoding'); let cjsParse; async function initCJSParse() { diff --git a/lib/internal/per_context/primordials.js b/lib/internal/per_context/primordials.js index a1e9f3ae305e32..78f778b65703c5 100644 --- a/lib/internal/per_context/primordials.js +++ b/lib/internal/per_context/primordials.js @@ -6,6 +6,10 @@ // so that Node.js's builtin modules do not need to later look these up from // the global proxy, which can be mutated by users. +// Use of primordials have sometimes a dramatic impact on performance, please +// benchmark all changes made in performance-sensitive areas of the codebase. +// See: https://github.com/nodejs/node/pull/38248 + const { defineProperty: ReflectDefineProperty, getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor, @@ -133,6 +137,7 @@ function copyPrototype(src, dest, prefix) { // Create copies of configurable value properties of the global object [ + 'Proxy', 'globalThis', ].forEach((name) => { // eslint-disable-next-line no-restricted-globals @@ -153,8 +158,10 @@ function copyPrototype(src, dest, prefix) { [ 'JSON', 'Math', + 'Proxy', 'Reflect', ].forEach((name) => { + // eslint-disable-next-line no-restricted-globals copyPropsRenamed(global[name], primordials, name); }); @@ -198,6 +205,7 @@ function copyPrototype(src, dest, prefix) { 'WeakRef', 'WeakSet', ].forEach((name) => { + // eslint-disable-next-line no-restricted-globals const original = global[name]; primordials[name] = original; copyPropsRenamed(original, primordials, name); @@ -210,6 +218,7 @@ function copyPrototype(src, dest, prefix) { [ 'Promise', ].forEach((name) => { + // eslint-disable-next-line no-restricted-globals const original = global[name]; primordials[name] = original; copyPropsRenamedBound(original, primordials, name); diff --git a/lib/internal/perf/observe.js b/lib/internal/perf/observe.js index 4d71666882a3ba..c96925c723f64e 100644 --- a/lib/internal/perf/observe.js +++ b/lib/internal/perf/observe.js @@ -72,6 +72,8 @@ const kDeprecationMessage = const kTypeSingle = 0; const kTypeMultiple = 1; +let gcTrackingInstalled = false; + const kSupportedEntryTypes = ObjectFreeze([ 'function', 'gc', @@ -124,8 +126,11 @@ function maybeIncrementObserverCount(type) { if (observerType !== undefined) { observerCounts[observerType]++; - if (observerType === NODE_PERFORMANCE_ENTRY_TYPE_GC) + if (!gcTrackingInstalled && + observerType === NODE_PERFORMANCE_ENTRY_TYPE_GC) { installGarbageCollectionTracking(); + gcTrackingInstalled = true; + } } } diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index e370770643ca6f..e2d9898012d2d7 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -152,10 +152,13 @@ function createOnGlobalUncaughtException() { try { const report = internalBinding('report'); if (report != null && report.shouldReportOnUncaughtException()) { - report.writeReport(er ? er.message : 'Exception', - 'Exception', - null, - er ? er : {}); + report.writeReport( + typeof er?.message === 'string' ? + er.message : + 'Exception', + 'Exception', + null, + er ? er : {}); } } catch {} // Ignore the exception. Diagnostic reporting is unavailable. } diff --git a/lib/internal/querystring.js b/lib/internal/querystring.js index f1390420558ed2..68f52c90c27237 100644 --- a/lib/internal/querystring.js +++ b/lib/internal/querystring.js @@ -36,6 +36,12 @@ const isHexTable = new Int8Array([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ... 256 ]); +/** + * @param {string} str + * @param {Int8Array} noEscapeTable + * @param {string[]} hexTable + * @returns {string} + */ function encodeStr(str, noEscapeTable, hexTable) { const len = str.length; if (len === 0) diff --git a/lib/internal/readline/callbacks.js b/lib/internal/readline/callbacks.js new file mode 100644 index 00000000000000..ae7cf0c07dda0b --- /dev/null +++ b/lib/internal/readline/callbacks.js @@ -0,0 +1,132 @@ +'use strict'; + +const { + NumberIsNaN, +} = primordials; + +const { + codes: { + ERR_INVALID_ARG_VALUE, + ERR_INVALID_CURSOR_POS, + }, +} = require('internal/errors'); + +const { + validateCallback, +} = require('internal/validators'); +const { + CSI, +} = require('internal/readline/utils'); + +const { + kClearLine, + kClearScreenDown, + kClearToLineBeginning, + kClearToLineEnd, +} = CSI; + + +/** + * moves the cursor to the x and y coordinate on the given stream + */ + +function cursorTo(stream, x, y, callback) { + if (callback !== undefined) { + validateCallback(callback); + } + + if (typeof y === 'function') { + callback = y; + y = undefined; + } + + if (NumberIsNaN(x)) throw new ERR_INVALID_ARG_VALUE('x', x); + if (NumberIsNaN(y)) throw new ERR_INVALID_ARG_VALUE('y', y); + + if (stream == null || (typeof x !== 'number' && typeof y !== 'number')) { + if (typeof callback === 'function') process.nextTick(callback, null); + return true; + } + + if (typeof x !== 'number') throw new ERR_INVALID_CURSOR_POS(); + + const data = typeof y !== 'number' ? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`; + return stream.write(data, callback); +} + +/** + * moves the cursor relative to its current location + */ + +function moveCursor(stream, dx, dy, callback) { + if (callback !== undefined) { + validateCallback(callback); + } + + if (stream == null || !(dx || dy)) { + if (typeof callback === 'function') process.nextTick(callback, null); + return true; + } + + let data = ''; + + if (dx < 0) { + data += CSI`${-dx}D`; + } else if (dx > 0) { + data += CSI`${dx}C`; + } + + if (dy < 0) { + data += CSI`${-dy}A`; + } else if (dy > 0) { + data += CSI`${dy}B`; + } + + return stream.write(data, callback); +} + +/** + * clears the current line the cursor is on: + * -1 for left of the cursor + * +1 for right of the cursor + * 0 for the entire line + */ + +function clearLine(stream, dir, callback) { + if (callback !== undefined) { + validateCallback(callback); + } + + if (stream === null || stream === undefined) { + if (typeof callback === 'function') process.nextTick(callback, null); + return true; + } + + const type = + dir < 0 ? kClearToLineBeginning : dir > 0 ? kClearToLineEnd : kClearLine; + return stream.write(type, callback); +} + +/** + * clears the screen from the current position of the cursor down + */ + +function clearScreenDown(stream, callback) { + if (callback !== undefined) { + validateCallback(callback); + } + + if (stream === null || stream === undefined) { + if (typeof callback === 'function') process.nextTick(callback, null); + return true; + } + + return stream.write(kClearScreenDown, callback); +} + +module.exports = { + clearLine, + clearScreenDown, + cursorTo, + moveCursor, +}; diff --git a/lib/internal/readline/emitKeypressEvents.js b/lib/internal/readline/emitKeypressEvents.js new file mode 100644 index 00000000000000..9c5a2554de9d22 --- /dev/null +++ b/lib/internal/readline/emitKeypressEvents.js @@ -0,0 +1,96 @@ +'use strict'; + +const { + SafeStringIterator, + Symbol, +} = primordials; + +const { + charLengthAt, + CSI, + emitKeys, +} = require('internal/readline/utils'); + +const { clearTimeout, setTimeout } = require('timers'); +const { + kEscape, +} = CSI; + +const { StringDecoder } = require('string_decoder'); + +const KEYPRESS_DECODER = Symbol('keypress-decoder'); +const ESCAPE_DECODER = Symbol('escape-decoder'); + +// GNU readline library - keyseq-timeout is 500ms (default) +const ESCAPE_CODE_TIMEOUT = 500; + +/** + * accepts a readable Stream instance and makes it emit "keypress" events + */ + +function emitKeypressEvents(stream, iface = {}) { + if (stream[KEYPRESS_DECODER]) return; + + stream[KEYPRESS_DECODER] = new StringDecoder('utf8'); + + stream[ESCAPE_DECODER] = emitKeys(stream); + stream[ESCAPE_DECODER].next(); + + const triggerEscape = () => stream[ESCAPE_DECODER].next(''); + const { escapeCodeTimeout = ESCAPE_CODE_TIMEOUT } = iface; + let timeoutId; + + function onData(input) { + if (stream.listenerCount('keypress') > 0) { + const string = stream[KEYPRESS_DECODER].write(input); + if (string) { + clearTimeout(timeoutId); + + // This supports characters of length 2. + iface._sawKeyPress = charLengthAt(string, 0) === string.length; + iface.isCompletionEnabled = false; + + let length = 0; + for (const character of new SafeStringIterator(string)) { + length += character.length; + if (length === string.length) { + iface.isCompletionEnabled = true; + } + + try { + stream[ESCAPE_DECODER].next(character); + // Escape letter at the tail position + if (length === string.length && character === kEscape) { + timeoutId = setTimeout(triggerEscape, escapeCodeTimeout); + } + } catch (err) { + // If the generator throws (it could happen in the `keypress` + // event), we need to restart it. + stream[ESCAPE_DECODER] = emitKeys(stream); + stream[ESCAPE_DECODER].next(); + throw err; + } + } + } + } else { + // Nobody's watching anyway + stream.removeListener('data', onData); + stream.on('newListener', onNewListener); + } + } + + function onNewListener(event) { + if (event === 'keypress') { + stream.on('data', onData); + stream.removeListener('newListener', onNewListener); + } + } + + if (stream.listenerCount('keypress') > 0) { + stream.on('data', onData); + } else { + stream.on('newListener', onNewListener); + } +} + +module.exports = emitKeypressEvents; diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index a1c7ef8a81a5a1..aff7dafe16e95a 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -41,7 +41,7 @@ const { clearScreenDown, cursorTo, moveCursor, -} = require('readline'); +} = require('internal/readline/callbacks'); const { commonPrefix, @@ -351,7 +351,11 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { breakLength: Infinity }, previewOptions); session.post('Runtime.callFunctionOn', { - functionDeclaration: `(v) => util.inspect(v, ${inspectOptions})`, + functionDeclaration: + `(v) => + Reflect + .getOwnPropertyDescriptor(globalThis, 'util') + .get().inspect(v, ${inspectOptions})`, objectId: result.objectId, arguments: [result] }, (error, preview) => { @@ -394,7 +398,7 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { } const inputPreviewCallback = (error, inspected) => { - if (inspected === null) { + if (inspected == null) { return; } diff --git a/lib/internal/streams/destroy.js b/lib/internal/streams/destroy.js index 467275c2edac35..a2892c67a0fcfa 100644 --- a/lib/internal/streams/destroy.js +++ b/lib/internal/streams/destroy.js @@ -7,7 +7,6 @@ const { }, } = require('internal/errors'); const { - FunctionPrototypeCall, Symbol, } = primordials; @@ -99,8 +98,7 @@ function _destroy(self, err, cb) { try { const then = result.then; if (typeof then === 'function') { - FunctionPrototypeCall( - then, + then.call( result, function() { if (called) @@ -318,8 +316,7 @@ function constructNT(stream) { try { const then = result.then; if (typeof then === 'function') { - FunctionPrototypeCall( - then, + then.call( result, function() { // If the callback was invoked, do nothing further. diff --git a/lib/internal/streams/end-of-stream.js b/lib/internal/streams/end-of-stream.js index da48831a405dbe..318ab4c2e6a8b7 100644 --- a/lib/internal/streams/end-of-stream.js +++ b/lib/internal/streams/end-of-stream.js @@ -3,11 +3,6 @@ 'use strict'; -const { - FunctionPrototype, - FunctionPrototypeCall, - ReflectApply, -} = primordials; const { AbortError, codes, @@ -55,7 +50,7 @@ function isWritableFinished(stream) { return wState.finished || (wState.ended && wState.length === 0); } -const nop = FunctionPrototype; +const nop = () => {}; function isReadableEnded(stream) { if (stream.readableEnded) return true; @@ -113,7 +108,7 @@ function eos(stream, options, callback) { if (stream.destroyed) willEmitClose = false; if (willEmitClose && (!stream.readable || readable)) return; - if (!readable || readableEnded) FunctionPrototypeCall(callback, stream); + if (!readable || readableEnded) callback.call(stream); }; let readableEnded = stream.readableEnded || @@ -126,25 +121,25 @@ function eos(stream, options, callback) { if (stream.destroyed) willEmitClose = false; if (willEmitClose && (!stream.writable || writable)) return; - if (!writable || writableFinished) FunctionPrototypeCall(callback, stream); + if (!writable || writableFinished) callback.call(stream); }; const onerror = (err) => { - FunctionPrototypeCall(callback, stream, err); + callback.call(stream, err); }; const onclose = () => { if (readable && !readableEnded) { if (!isReadableEnded(stream)) - return FunctionPrototypeCall(callback, stream, - new ERR_STREAM_PREMATURE_CLOSE()); + return callback.call(stream, + new ERR_STREAM_PREMATURE_CLOSE()); } if (writable && !writableFinished) { if (!isWritableFinished(stream)) - return FunctionPrototypeCall(callback, stream, - new ERR_STREAM_PREMATURE_CLOSE()); + return callback.call(stream, + new ERR_STREAM_PREMATURE_CLOSE()); } - FunctionPrototypeCall(callback, stream); + callback.call(stream); }; const onrequest = () => { @@ -218,7 +213,7 @@ function eos(stream, options, callback) { // Keep it because cleanup removes it. const endCallback = callback; cleanup(); - FunctionPrototypeCall(endCallback, stream, new AbortError()); + endCallback.call(stream, new AbortError()); }; if (options.signal.aborted) { process.nextTick(abort); @@ -226,7 +221,7 @@ function eos(stream, options, callback) { const originalCallback = callback; callback = once((...args) => { options.signal.removeEventListener('abort', abort); - ReflectApply(originalCallback, stream, args); + originalCallback.apply(stream, args); }); options.signal.addEventListener('abort', abort); } diff --git a/lib/internal/streams/lazy_transform.js b/lib/internal/streams/lazy_transform.js index ad072e3474b3e1..555e6430e33588 100644 --- a/lib/internal/streams/lazy_transform.js +++ b/lib/internal/streams/lazy_transform.js @@ -4,7 +4,6 @@ 'use strict'; const { - FunctionPrototypeCall, ObjectDefineProperties, ObjectDefineProperty, ObjectSetPrototypeOf, @@ -26,7 +25,7 @@ ObjectSetPrototypeOf(LazyTransform, stream.Transform); function makeGetter(name) { return function() { - FunctionPrototypeCall(stream.Transform, this, this._options); + stream.Transform.call(this, this._options); this._writableState.decodeStrings = false; if (!this._options || !this._options.defaultEncoding) { diff --git a/lib/internal/streams/legacy.js b/lib/internal/streams/legacy.js index d08df00259033b..0a0d0571c46378 100644 --- a/lib/internal/streams/legacy.js +++ b/lib/internal/streams/legacy.js @@ -2,15 +2,13 @@ const { ArrayIsArray, - ArrayPrototypeUnshift, - FunctionPrototypeCall, ObjectSetPrototypeOf, } = primordials; const EE = require('events'); function Stream(opts) { - FunctionPrototypeCall(EE, this, opts); + EE.call(this, opts); } ObjectSetPrototypeOf(Stream.prototype, EE.prototype); ObjectSetPrototypeOf(Stream, EE); @@ -108,7 +106,7 @@ function prependListener(emitter, event, fn) { if (!emitter._events || !emitter._events[event]) emitter.on(event, fn); else if (ArrayIsArray(emitter._events[event])) - ArrayPrototypeUnshift(emitter._events[event], fn); + emitter._events[event].unshift(fn); else emitter._events[event] = [fn, emitter._events[event]]; } diff --git a/lib/internal/streams/passthrough.js b/lib/internal/streams/passthrough.js index acc1a148a7d7c1..d37f9caf0116b5 100644 --- a/lib/internal/streams/passthrough.js +++ b/lib/internal/streams/passthrough.js @@ -26,7 +26,6 @@ 'use strict'; const { - FunctionPrototypeCall, ObjectSetPrototypeOf, } = primordials; @@ -40,7 +39,7 @@ function PassThrough(options) { if (!(this instanceof PassThrough)) return new PassThrough(options); - FunctionPrototypeCall(Transform, this, options); + Transform.call(this, options); } PassThrough.prototype._transform = function(chunk, encoding, cb) { diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index 5215d986ef1f1c..441fcb471858bc 100644 --- a/lib/internal/streams/pipeline.js +++ b/lib/internal/streams/pipeline.js @@ -5,11 +5,6 @@ const { ArrayIsArray, - ArrayPrototypePop, - ArrayPrototypePush, - ArrayPrototypeShift, - FunctionPrototypeCall, - ReflectApply, SymbolAsyncIterator, } = primordials; @@ -84,7 +79,7 @@ function popCallback(streams) { // a single stream. Therefore optimize for the average case instead of // checking for length === 0 as well. validateCallback(streams[streams.length - 1]); - return ArrayPrototypePop(streams); + return streams.pop(); } function makeAsyncIterable(val) { @@ -103,7 +98,7 @@ async function* fromReadable(val) { Readable = require('internal/streams/readable'); } - yield* FunctionPrototypeCall(Readable.prototype[SymbolAsyncIterator], val); + yield* Readable.prototype[SymbolAsyncIterator].call(val); } async function pump(iterable, writable, finish) { @@ -160,7 +155,7 @@ function pipeline(...streams) { } while (destroys.length) { - ArrayPrototypeShift(destroys)(error); + destroys.shift()(error); } if (final) { @@ -176,7 +171,7 @@ function pipeline(...streams) { if (isStream(stream)) { finishCount++; - ArrayPrototypePush(destroys, destroyer(stream, reading, writing, finish)); + destroys.push(destroyer(stream, reading, writing, finish)); } if (i === 0) { @@ -220,14 +215,14 @@ function pipeline(...streams) { // second use. const then = ret?.then; if (typeof then === 'function') { - ReflectApply(then, ret, [ - (val) => { - value = val; - pt.end(val); - }, (err) => { - pt.destroy(err); - }, - ]); + then.call(ret, + (val) => { + value = val; + pt.end(val); + }, (err) => { + pt.destroy(err); + }, + ); } else if (isIterable(ret, true)) { finishCount++; pump(ret, pt, finish); @@ -239,7 +234,7 @@ function pipeline(...streams) { ret = pt; finishCount++; - ArrayPrototypePush(destroys, destroyer(ret, false, true, finish)); + destroys.push(destroyer(ret, false, true, finish)); } } else if (isStream(stream)) { if (isReadable(ret)) { diff --git a/lib/internal/streams/readable.js b/lib/internal/streams/readable.js index cc3f5e93fd0201..aa0f5f94886427 100644 --- a/lib/internal/streams/readable.js +++ b/lib/internal/streams/readable.js @@ -22,13 +22,7 @@ 'use strict'; const { - ArrayPrototypeForEach, ArrayPrototypeIndexOf, - ArrayPrototypePush, - ArrayPrototypeSplice, - FunctionPrototype, - FunctionPrototypeBind, - FunctionPrototypeCall, NumberIsInteger, NumberIsNaN, NumberParseInt, @@ -36,7 +30,6 @@ const { ObjectKeys, ObjectSetPrototypeOf, Promise, - ReflectApply, SafeSet, SymbolAsyncIterator, Symbol @@ -78,7 +71,7 @@ let from; ObjectSetPrototypeOf(Readable.prototype, Stream.prototype); ObjectSetPrototypeOf(Readable, Stream); -const nop = FunctionPrototype; +const nop = () => {}; const { errorOrDestroy } = destroyImpl; @@ -208,7 +201,7 @@ function Readable(options) { addAbortSignalNoValidate(options.signal, this); } - FunctionPrototypeCall(Stream, this, options); + Stream.call(this, options); destroyImpl.construct(this, () => { if (this._readableState.needReadable) { @@ -668,7 +661,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { } } - ArrayPrototypePush(state.pipes, dest); + state.pipes.push(dest); debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts); const doEnd = (!pipeOpts || pipeOpts.end !== false) && @@ -855,8 +848,8 @@ Readable.prototype.unpipe = function(dest) { state.pipes = []; this.pause(); - ArrayPrototypeForEach(dests, (dest) => - dest.emit('unpipe', this, { hasUnpiped: false })); + for (let i = 0; i < dests.length; i++) + dests[i].emit('unpipe', this, { hasUnpiped: false }); return this; } @@ -865,7 +858,7 @@ Readable.prototype.unpipe = function(dest) { if (index === -1) return this; - ArrayPrototypeSplice(state.pipes, index, 1); + state.pipes.splice(index, 1); if (state.pipes.length === 0) this.pause(); @@ -877,7 +870,7 @@ Readable.prototype.unpipe = function(dest) { // Set up data events if they are asked for // Ensure readable listeners eventually get something. Readable.prototype.on = function(ev, fn) { - const res = FunctionPrototypeCall(Stream.prototype.on, this, ev, fn); + const res = Stream.prototype.on.call(this, ev, fn); const state = this._readableState; if (ev === 'data') { @@ -907,8 +900,8 @@ Readable.prototype.on = function(ev, fn) { Readable.prototype.addListener = Readable.prototype.on; Readable.prototype.removeListener = function(ev, fn) { - const res = FunctionPrototypeCall(Stream.prototype.removeListener, this, - ev, fn); + const res = Stream.prototype.removeListener.call(this, + ev, fn); if (ev === 'readable') { // We need to check if there is someone still listening to @@ -925,8 +918,8 @@ Readable.prototype.removeListener = function(ev, fn) { Readable.prototype.off = Readable.prototype.removeListener; Readable.prototype.removeAllListeners = function(ev) { - const res = ReflectApply(Stream.prototype.removeAllListeners, this, - arguments); + const res = Stream.prototype.removeAllListeners.apply(this, + arguments); if (ev === 'readable' || ev === undefined) { // We need to check if there is someone still listening to @@ -1057,11 +1050,13 @@ Readable.prototype.wrap = function(stream) { }; // Proxy all the other methods. Important when wrapping filters and duplexes. - ArrayPrototypeForEach(ObjectKeys(stream), (i) => { + const streamKeys = ObjectKeys(stream); + for (let j = 1; j < streamKeys.length; j++) { + const i = streamKeys[j]; if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = FunctionPrototypeBind(stream[i], stream); + this[i] = stream[i].bind(stream); } - }); + } return this; }; @@ -1110,15 +1105,15 @@ async function* createAsyncIterator(stream) { .on('error', function(err) { error = err; errorEmitted = true; - FunctionPrototypeCall(next, this); + next.call(this); }) .on('end', function() { endEmitted = true; - FunctionPrototypeCall(next, this); + next.call(this); }) .on('close', function() { closeEmitted = true; - FunctionPrototypeCall(next, this); + next.call(this); }); try { diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 971bf5126f250d..26e0b07c2956c8 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -64,7 +64,6 @@ 'use strict'; const { - FunctionPrototypeCall, ObjectSetPrototypeOf, Symbol } = primordials; @@ -133,8 +132,7 @@ function final(cb) { try { const then = result.then; if (typeof then === 'function') { - FunctionPrototypeCall( - then, + then.call( result, (data) => { if (called) @@ -167,7 +165,7 @@ function final(cb) { function prefinish() { if (this._final !== final) { - FunctionPrototypeCall(final, this); + final.call(this); } } @@ -209,8 +207,7 @@ Transform.prototype._write = function(chunk, encoding, callback) { try { const then = result.then; if (typeof then === 'function') { - FunctionPrototypeCall( - then, + then.call( result, (val) => { if (called) diff --git a/lib/internal/streams/writable.js b/lib/internal/streams/writable.js index 2fe811236a27e8..03f63b16bd04ff 100644 --- a/lib/internal/streams/writable.js +++ b/lib/internal/streams/writable.js @@ -26,12 +26,8 @@ 'use strict'; const { - ArrayPrototypeForEach, - ArrayPrototypePush, ArrayPrototypeSlice, - ArrayPrototypeSplice, Error, - FunctionPrototypeCall, FunctionPrototypeSymbolHasInstance, ObjectDefineProperty, ObjectDefineProperties, @@ -57,7 +53,6 @@ const { getHighWaterMark, getDefaultHighWaterMark } = require('internal/streams/state'); -const assert = require('internal/assert'); const { ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED, @@ -258,7 +253,7 @@ function Writable(options) { addAbortSignalNoValidate(options.signal, this); } - FunctionPrototypeCall(Stream, this, options); + Stream.call(this, options); destroyImpl.construct(this, () => { const state = this._writableState; @@ -522,10 +517,10 @@ function errorBuffer(state) { callback(new ERR_STREAM_DESTROYED('write')); } - ArrayPrototypeForEach( - ArrayPrototypeSplice(state[kOnFinished], 0), - (callback) => callback(new ERR_STREAM_DESTROYED('end')) - ); + const onfinishCallbacks = state[kOnFinished].splice(0); + for (let i = 0; i < onfinishCallbacks.length; i++) { + onfinishCallbacks[i](new ERR_STREAM_DESTROYED('end')); + } resetBuffer(state); } @@ -577,7 +572,7 @@ function clearBuffer(stream, state) { if (i === buffered.length) { resetBuffer(state); } else if (i > 256) { - ArrayPrototypeSplice(buffered, 0, i); + buffered.splice(0, i); state.bufferedIndex = 0; } else { state.bufferedIndex = i; @@ -645,7 +640,7 @@ Writable.prototype.end = function(chunk, encoding, cb) { if (err || state.finished) { process.nextTick(cb, err); } else { - ArrayPrototypePush(state[kOnFinished], cb); + state[kOnFinished].push(cb); } } @@ -668,8 +663,9 @@ function callFinal(stream, state) { const result = stream._final((err) => { state.pendingcb--; if (err) { - for (const callback of ArrayPrototypeSplice(state[kOnFinished], 0)) { - callback(err); + const onfinishCallbacks = state[kOnFinished].splice(0); + for (let i = 0; i < onfinishCallbacks.length; i++) { + onfinishCallbacks[i](err); } errorOrDestroy(stream, err, state.sync); } else if (needFinish(state)) { @@ -686,8 +682,7 @@ function callFinal(stream, state) { try { const then = result.then; if (typeof then === 'function') { - FunctionPrototypeCall( - then, + then.call( result, function() { if (state.prefinished) @@ -698,8 +693,9 @@ function callFinal(stream, state) { process.nextTick(finish, stream, state); }, function(err) { - for (const cb of ArrayPrototypeSplice(state[kOnFinished], 0)) { - process.nextTick(cb, err); + const onfinishCallbacks = state[kOnFinished].splice(0); + for (let i = 0; i < onfinishCallbacks.length; i++) { + process.nextTick(onfinishCallbacks[i], err); } process.nextTick(errorOrDestroy, stream, err, state.sync); }); @@ -745,8 +741,10 @@ function finish(stream, state) { state.finished = true; - ArrayPrototypeForEach(ArrayPrototypeSplice(state[kOnFinished], 0), - (callback) => callback()); + const onfinishCallbacks = state[kOnFinished].splice(0); + for (let i = 0; i < onfinishCallbacks.length; i++) { + onfinishCallbacks[i](); + } stream.emit('finish'); @@ -854,15 +852,13 @@ Writable.prototype.destroy = function(err, cb) { const state = this._writableState; // Invoke pending callbacks. - if ( - state.bufferedIndex < state.buffered.length || - state[kOnFinished].length - ) { - assert(!state.destroyed); + if (!state.destroyed && + (state.bufferedIndex < state.buffered.length || + state[kOnFinished].length)) { process.nextTick(errorBuffer, state); } - FunctionPrototypeCall(destroy, this, err, cb); + destroy.call(this, err, cb); return this; }; diff --git a/lib/internal/test/transfer.js b/lib/internal/test/transfer.js new file mode 100644 index 00000000000000..b814c37fe6dc6d --- /dev/null +++ b/lib/internal/test/transfer.js @@ -0,0 +1,42 @@ +'use strict'; + +const { + makeTransferable, + kClone, + kDeserialize, +} = require('internal/worker/js_transferable'); + +process.emitWarning( + 'These APIs are for internal testing only. Do not use them.', + 'internal/test/transfer'); + +// Used as part of parallel/test-messaging-maketransferable. +// This has to exist within the lib/internal/ path in order +// for deserialization to work. + +class E { + constructor(b) { + this.b = b; + } +} + +class F extends E { + constructor(b) { + super(b); + /* eslint-disable-next-line no-constructor-return */ + return makeTransferable(this); + } + + [kClone]() { + return { + data: { b: this.b }, + deserializeInfo: 'internal/test/transfer:F' + }; + } + + [kDeserialize]({ b }) { + this.b = b; + } +} + +module.exports = { E, F }; diff --git a/lib/internal/timers.js b/lib/internal/timers.js index 9521c343038b4f..9a07fe3348f65e 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -78,8 +78,8 @@ const { NumberIsFinite, NumberMIN_SAFE_INTEGER, ObjectCreate, - Symbol, ReflectApply, + Symbol, } = primordials; const { diff --git a/lib/internal/util.js b/lib/internal/util.js index 4756459f4c5960..f77f1fc43368c4 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -3,7 +3,6 @@ const { ArrayFrom, ArrayIsArray, - ArrayPrototypePop, ArrayPrototypePush, ArrayPrototypeSlice, ArrayPrototypeSort, @@ -148,13 +147,13 @@ function slowCases(enc) { case 4: if (enc === 'UTF8') return 'utf8'; if (enc === 'ucs2' || enc === 'UCS2') return 'utf16le'; - enc = StringPrototypeToLowerCase(`${enc}`); + enc = `${enc}`.toLowerCase(); if (enc === 'utf8') return 'utf8'; if (enc === 'ucs2') return 'utf16le'; break; case 3: if (enc === 'hex' || enc === 'HEX' || - StringPrototypeToLowerCase(`${enc}`) === 'hex') + `${enc}`.toLowerCase() === 'hex') return 'hex'; break; case 5: @@ -163,7 +162,7 @@ function slowCases(enc) { if (enc === 'UTF-8') return 'utf8'; if (enc === 'ASCII') return 'ascii'; if (enc === 'UCS-2') return 'utf16le'; - enc = StringPrototypeToLowerCase(`${enc}`); + enc = `${enc}`.toLowerCase(); if (enc === 'utf-8') return 'utf8'; if (enc === 'ascii') return 'ascii'; if (enc === 'ucs-2') return 'utf16le'; @@ -173,23 +172,23 @@ function slowCases(enc) { if (enc === 'latin1' || enc === 'binary') return 'latin1'; if (enc === 'BASE64') return 'base64'; if (enc === 'LATIN1' || enc === 'BINARY') return 'latin1'; - enc = StringPrototypeToLowerCase(`${enc}`); + enc = `${enc}`.toLowerCase(); if (enc === 'base64') return 'base64'; if (enc === 'latin1' || enc === 'binary') return 'latin1'; break; case 7: if (enc === 'utf16le' || enc === 'UTF16LE' || - StringPrototypeToLowerCase(`${enc}`) === 'utf16le') + `${enc}`.toLowerCase() === 'utf16le') return 'utf16le'; break; case 8: if (enc === 'utf-16le' || enc === 'UTF-16LE' || - StringPrototypeToLowerCase(`${enc}`) === 'utf-16le') + `${enc}`.toLowerCase() === 'utf-16le') return 'utf16le'; break; case 9: if (enc === 'base64url' || enc === 'BASE64URL' || - StringPrototypeToLowerCase(`${enc}`) === 'base64url') + `${enc}`.toLowerCase() === 'base64url') return 'base64url'; break; default: @@ -370,7 +369,7 @@ function join(output, separator) { function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; - ArrayPrototypePop(list); + list.pop(); } const kNodeModulesRE = /^(.*)[\\/]node_modules[\\/]/; diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js index 3dc7a5157d5e65..b1f82b957b162a 100644 --- a/lib/internal/util/debuglog.js +++ b/lib/internal/util/debuglog.js @@ -1,7 +1,6 @@ 'use strict'; const { - FunctionPrototype, FunctionPrototypeBind, ObjectCreate, ObjectDefineProperty, @@ -45,7 +44,7 @@ function emitWarningIfNeeded(set) { } } -const noop = FunctionPrototype; +const noop = () => {}; function debuglogImpl(enabled, set) { if (debugImpls[set] === undefined) { @@ -81,7 +80,12 @@ function debuglog(set, cb) { debug = debuglogImpl(enabled, set); if (typeof cb === 'function') cb(debug); - debug(...new SafeArrayIterator(args)); + switch (args.length) { + case 0: return debug(); + case 1: return debug(args[0]); + case 2: return debug(args[0], args[1]); + default: return debug(...new SafeArrayIterator(args)); + } }; let enabled; let test = () => { @@ -89,7 +93,14 @@ function debuglog(set, cb) { test = () => enabled; return enabled; }; - const logger = (...args) => debug(...new SafeArrayIterator(args)); + const logger = (...args) => { + switch (args.length) { + case 0: return debug(); + case 1: return debug(args[0]); + case 2: return debug(args[0], args[1]); + default: return debug(...new SafeArrayIterator(args)); + } + }; ObjectDefineProperty(logger, 'enabled', { get() { return test(); diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 21699fe2d8e038..73cac2caa51b8d 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -5,6 +5,7 @@ const { ArrayIsArray, ArrayPrototypeFilter, ArrayPrototypeForEach, + ArrayPrototypePop, ArrayPrototypePush, ArrayPrototypePushApply, ArrayPrototypeSort, @@ -74,6 +75,7 @@ const { TypedArrayPrototypeGetLength, TypedArrayPrototypeGetSymbolToStringTag, Uint8Array, + globalThis, uncurryThis, } = primordials; @@ -144,7 +146,7 @@ let hexSlice; const builtInObjects = new SafeSet( ArrayPrototypeFilter( - ObjectGetOwnPropertyNames(global), + ObjectGetOwnPropertyNames(globalThis), (e) => RegExpPrototypeTest(/^[A-Z][a-zA-Z0-9]+$/, e) ) ); @@ -619,6 +621,7 @@ function addPrototypeProperties(ctx, main, obj, recurseTimes, output) { } // Get all own property names and symbols. keys = ReflectOwnKeys(obj); + ArrayPrototypePush(ctx.seen, main); for (const key of keys) { // Ignore the `constructor` property and keys that exist on layers above. if (key === 'constructor' || @@ -639,6 +642,7 @@ function addPrototypeProperties(ctx, main, obj, recurseTimes, output) { ArrayPrototypePush(output, value); } } + ArrayPrototypePop(ctx.seen); // Limit the inspection to up to three prototype layers. Using `recurseTimes` // is not a good choice here, because it's as if the properties are declared // on the current object from the users perspective. diff --git a/lib/internal/v8_prof_polyfill.js b/lib/internal/v8_prof_polyfill.js index 2b6b90c58d1147..21d9b932c10f4b 100644 --- a/lib/internal/v8_prof_polyfill.js +++ b/lib/internal/v8_prof_polyfill.js @@ -28,7 +28,7 @@ 'use strict'; /* eslint-disable node-core/prefer-primordials */ -/* global Buffer, console */ +/* global console */ module.exports = { versionCheck }; @@ -40,6 +40,7 @@ if (module.id === 'internal/v8_prof_polyfill') return; // Node polyfill const fs = require('fs'); const cp = require('child_process'); +const { Buffer } = require('buffer'); const os = { system: function(name, args) { if (process.platform === 'linux' && name === 'nm') { diff --git a/lib/internal/worker.js b/lib/internal/worker.js index 0d60235395d9c0..f1da0d4ded4cea 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -1,7 +1,5 @@ 'use strict'; -/* global SharedArrayBuffer */ - const { ArrayIsArray, ArrayPrototypeForEach, @@ -24,6 +22,7 @@ const { SymbolFor, TypedArrayPrototypeFill, Uint32Array, + globalThis: { Atomics, SharedArrayBuffer }, } = primordials; const EventEmitter = require('events'); diff --git a/lib/internal/worker/io.js b/lib/internal/worker/io.js index fdfbe10b5fefcf..adacdd913c6693 100644 --- a/lib/internal/worker/io.js +++ b/lib/internal/worker/io.js @@ -41,6 +41,7 @@ const { const { Readable, Writable } = require('stream'); const { Event, + EventTarget, NodeEventTarget, defineEventHandler, initNodeEventTarget, diff --git a/lib/internal/worker/js_transferable.js b/lib/internal/worker/js_transferable.js index ce95cf64e21987..7bd6c8cafc32e2 100644 --- a/lib/internal/worker/js_transferable.js +++ b/lib/internal/worker/js_transferable.js @@ -1,6 +1,11 @@ 'use strict'; const { Error, + ObjectDefineProperties, + ObjectGetOwnPropertyDescriptors, + ObjectGetPrototypeOf, + ObjectSetPrototypeOf, + ReflectConstruct, StringPrototypeSplit, } = primordials; const { @@ -22,21 +27,30 @@ function setup() { const { 0: module, 1: ctor } = StringPrototypeSplit(deserializeInfo, ':'); const Ctor = require(module)[ctor]; if (typeof Ctor !== 'function' || - !(Ctor.prototype instanceof JSTransferable)) { + typeof Ctor.prototype[messaging_deserialize_symbol] !== 'function') { // Not one of the official errors because one should not be able to get // here without messing with Node.js internals. // eslint-disable-next-line no-restricted-syntax throw new Error(`Unknown deserialize spec ${deserializeInfo}`); } + return new Ctor(); }); } +function makeTransferable(obj) { + const inst = ReflectConstruct(JSTransferable, [], obj.constructor); + ObjectDefineProperties(inst, ObjectGetOwnPropertyDescriptors(obj)); + ObjectSetPrototypeOf(inst, ObjectGetPrototypeOf(obj)); + return inst; +} + module.exports = { + makeTransferable, setup, JSTransferable, kClone: messaging_clone_symbol, kDeserialize: messaging_deserialize_symbol, kTransfer: messaging_transfer_symbol, - kTransferList: messaging_transfer_list_symbol + kTransferList: messaging_transfer_list_symbol, }; diff --git a/lib/net.js b/lib/net.js index 826cffd234852d..4b55366f87dae0 100644 --- a/lib/net.js +++ b/lib/net.js @@ -24,18 +24,13 @@ const { ArrayIsArray, ArrayPrototypeIndexOf, - ArrayPrototypePush, - ArrayPrototypeSplice, Boolean, Error, - FunctionPrototype, - FunctionPrototypeCall, Number, NumberIsNaN, NumberParseInt, ObjectDefineProperty, ObjectSetPrototypeOf, - ReflectApply, Symbol, } = primordials; @@ -132,7 +127,7 @@ const DEFAULT_IPV6_ADDR = '::'; const isWindows = process.platform === 'win32'; -const noop = FunctionPrototype; +const noop = () => {}; function getFlags(ipv6Only) { return ipv6Only === true ? TCPConstants.UV_TCP_IPV6ONLY : 0; @@ -305,7 +300,7 @@ function Socket(options) { options.autoDestroy = true; // Handle strings directly. options.decodeStrings = false; - ReflectApply(stream.Duplex, this, [options]); + stream.Duplex.call(this, options); if (options.handle) { this._handle = options.handle; // private @@ -441,8 +436,7 @@ function afterShutdown() { // is overly vague, and makes it seem like the user's code is to blame. function writeAfterFIN(chunk, encoding, cb) { if (!this.writableEnded) { - return ReflectApply( - stream.Duplex.prototype.write, this, [chunk, encoding, cb]); + return stream.Duplex.prototype.write.call(this, chunk, encoding, cb); } if (typeof encoding === 'function') { @@ -586,7 +580,8 @@ Socket.prototype._read = function(n) { Socket.prototype.end = function(data, encoding, callback) { - ReflectApply(stream.Duplex.prototype.end, this, [data, encoding, callback]); + stream.Duplex.prototype.end.call(this, + data, encoding, callback); DTRACE_NET_STREAM_END(this); return this; }; @@ -602,7 +597,7 @@ Socket.prototype.pause = function() { this.destroy(errnoException(err, 'read')); } } - return FunctionPrototypeCall(stream.Duplex.prototype.pause, this); + return stream.Duplex.prototype.pause.call(this); }; @@ -611,7 +606,7 @@ Socket.prototype.resume = function() { !this._handle.reading) { tryReadStart(this); } - return FunctionPrototypeCall(stream.Duplex.prototype.resume, this); + return stream.Duplex.prototype.resume.call(this); }; @@ -620,7 +615,7 @@ Socket.prototype.read = function(n) { !this._handle.reading) { tryReadStart(this); } - return ReflectApply(stream.Duplex.prototype.read, this, [n]); + return stream.Duplex.prototype.read.call(this, n); }; @@ -1169,7 +1164,7 @@ function Server(options, connectionListener) { if (!(this instanceof Server)) return new Server(options, connectionListener); - FunctionPrototypeCall(EventEmitter, this); + EventEmitter.call(this); if (typeof options === 'function') { connectionListener = options; @@ -1681,10 +1676,10 @@ ObjectDefineProperty(Socket.prototype, '_handle', { Server.prototype._setupWorker = function(socketList) { this._usingWorkers = true; - ArrayPrototypePush(this._workers, socketList); + this._workers.push(socketList); socketList.once('exit', (socketList) => { const index = ArrayPrototypeIndexOf(this._workers, socketList); - ArrayPrototypeSplice(this._workers, index, 1); + this._workers.splice(index, 1); }); }; diff --git a/lib/os.js b/lib/os.js index 19f784fc2667b2..4396fcefd533c4 100644 --- a/lib/os.js +++ b/lib/os.js @@ -80,8 +80,17 @@ const { const getHomeDirectory = getCheckedFunction(_getHomeDirectory); const getHostname = getCheckedFunction(_getHostname); const getInterfaceAddresses = getCheckedFunction(_getInterfaceAddresses); +/** + * @returns {string} + */ const getOSRelease = () => release; +/** + * @returns {string} + */ const getOSType = () => type; +/** + * @returns {string} + */ const getOSVersion = () => version; getFreeMem[SymbolToPrimitive] = () => getFreeMem(); @@ -97,11 +106,30 @@ const kEndianness = isBigEndian ? 'BE' : 'LE'; const avgValues = new Float64Array(3); +/** + * @returns {[number, number, number]} + */ function loadavg() { getLoadAvg(avgValues); return [avgValues[0], avgValues[1], avgValues[2]]; } +/** + * Returns an array of objects containing information about each + * logical CPU core. + * + * @returns {Array<{ + * model: string + * speed: number + * times: { + * user: number + * nice: number + * sys: number + * idle: number + * irq: number + * } + * }>} + */ function cpus() { // [] is a bugfix for a regression introduced in 51cea61 const data = getCPUs() || []; @@ -123,16 +151,25 @@ function cpus() { return result; } +/** + * @returns {string} + */ function arch() { return process.arch; } arch[SymbolToPrimitive] = () => process.arch; +/** + * @returns {string} + */ function platform() { return process.platform; } platform[SymbolToPrimitive] = () => process.platform; +/** + * @returns {string} + */ function tmpdir() { var path; if (isWindows) { @@ -155,6 +192,9 @@ function tmpdir() { } tmpdir[SymbolToPrimitive] = () => tmpdir(); +/** + * @returns {'BE' | 'LE'} + */ function endianness() { return kEndianness; } @@ -204,6 +244,17 @@ function getCIDR(address, netmask, family) { return `${address}/${ones}`; } +/** + * @returns {Record<string, Array<{ + * address: string + * netmask: string + * family: 'IPv4' | 'IPv6' + * mac: string + * internal: boolean + * scopeid: number + * cidr: string | null + * }>>} + */ function networkInterfaces() { const data = getInterfaceAddresses(); const result = {}; @@ -234,6 +285,11 @@ function networkInterfaces() { return result; } +/** + * @param {number} [pid=0] + * @param {number} priority + * @returns {void} + */ function setPriority(pid, priority) { if (priority === undefined) { priority = pid; @@ -249,6 +305,10 @@ function setPriority(pid, priority) { throw new ERR_SYSTEM_ERROR(ctx); } +/** + * @param {number} [pid=0] + * @returns {number} + */ function getPriority(pid) { if (pid === undefined) pid = 0; @@ -264,6 +324,18 @@ function getPriority(pid) { return priority; } +/** + * @param {{ encoding?: string }} [options=utf8] If `encoding` is set to + * `'buffer'`, the `username`, `shell`, and `homedir` values will + * be `Buffer` instances. + * @returns {{ + * uid: number + * gid: number + * username: string + * homedir: string + * shell: string | null + * }} + */ function userInfo(options) { if (typeof options !== 'object') options = null; diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 1f9a665a3ca006..a92a040f2de839 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -59,6 +59,15 @@ class Performance extends EventTarget { timeOrigin: this.timeOrigin, }, opts)}`; } + +} + +function toJSON() { + return { + nodeTiming: this.nodeTiming, + timeOrigin: this.timeOrigin, + eventLoopUtilization: this.eventLoopUtilization() + }; } class InternalPerformance extends EventTarget {} @@ -105,6 +114,11 @@ ObjectDefineProperties(Performance.prototype, { configurable: true, enumerable: true, value: timeOriginTimestamp, + }, + toJSON: { + configurable: true, + enumerable: true, + value: toJSON, } }); diff --git a/lib/punycode.js b/lib/punycode.js index 67905e3d7670e1..3483fd667bf40a 100644 --- a/lib/punycode.js +++ b/lib/punycode.js @@ -1,5 +1,15 @@ 'use strict'; +const { getOptionValue } = require('internal/options'); +if (getOptionValue('--pending-deprecation')){ + process.emitWarning( + 'The `punycode` module is deprecated. Please use a userland ' + + 'alternative instead.', + 'DeprecationWarning', + 'DEP0040', + ); +} + /** Highest positive signed 32-bit float value */ const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 diff --git a/lib/querystring.js b/lib/querystring.js index a6e780d6e9c71d..5bcfa13a6a5b13 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -76,7 +76,12 @@ const unhexTable = new Int8Array([ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 255 ]); -// A safe fast alternative to decodeURIComponent +/** + * A safe fast alternative to decodeURIComponent + * @param {string} s + * @param {boolean} decodeSpaces + * @returns {string} + */ function unescapeBuffer(s, decodeSpaces) { const out = Buffer.allocUnsafe(s.length); let index = 0; @@ -119,7 +124,11 @@ function unescapeBuffer(s, decodeSpaces) { return hasHex ? out.slice(0, outIndex) : out; } - +/** + * @param {string} s + * @param {boolean} decodeSpaces + * @returns {string} + */ function qsUnescape(s, decodeSpaces) { try { return decodeURIComponent(s); @@ -145,8 +154,13 @@ const noEscape = new Int8Array([ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, // 112 - 127 ]); -// QueryString.escape() replaces encodeURIComponent() -// https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4 + +/** + * QueryString.escape() replaces encodeURIComponent() + * @see https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4 + * @param {any} str + * @returns {string} + */ function qsEscape(str) { if (typeof str !== 'string') { if (typeof str === 'object') @@ -158,6 +172,10 @@ function qsEscape(str) { return encodeStr(str, noEscape, hexTable); } +/** + * @param {string | number | bigint | boolean | symbol | undefined | null} v + * @returns {string} + */ function stringifyPrimitive(v) { if (typeof v === 'string') return v; @@ -170,7 +188,11 @@ function stringifyPrimitive(v) { return ''; } - +/** + * @param {string | number | bigint | boolean} v + * @param {(v: string) => string} encode + * @returns + */ function encodeStringified(v, encode) { if (typeof v === 'string') return (v.length ? encode(v) : ''); @@ -186,12 +208,23 @@ function encodeStringified(v, encode) { return ''; } - +/** + * @param {string | number | boolean | null} v + * @param {(v: string) => string} encode + * @returns {string} + */ function encodeStringifiedCustom(v, encode) { return encode(stringifyPrimitive(v)); } - +/** + * @param {Record<string, string | number | boolean + * | ReadonlyArray<string | number | boolean> | null>} obj + * @param {string} [sep] + * @param {string} [eq] + * @param {{ encodeURIComponent?: (v: string) => string }} [options] + * @returns {string} + */ function stringify(obj, sep, eq, options) { sep = sep || '&'; eq = eq || '='; @@ -236,6 +269,10 @@ function stringify(obj, sep, eq, options) { return ''; } +/** + * @param {string} str + * @returns {number[]} + */ function charCodes(str) { if (str.length === 0) return []; if (str.length === 1) return [StringPrototypeCharCodeAt(str, 0)]; @@ -267,7 +304,17 @@ function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) { } } -// Parse a key/val string. +/** + * Parse a key/val string. + * @param {string} qs + * @param {string} sep + * @param {string} eq + * @param {{ + * maxKeys?: number; + * decodeURIComponent?(v: string): string; + * }} [options] + * @returns {Record<string, string | string[]>} + */ function parse(qs, sep, eq, options) { const obj = ObjectCreate(null); @@ -421,9 +468,14 @@ function parse(qs, sep, eq, options) { } -// v8 does not optimize functions with try-catch blocks, so we isolate them here -// to minimize the damage (Note: no longer true as of V8 5.4 -- but still will -// not be inlined). +/** + * V8 does not optimize functions with try-catch blocks, so we isolate them here + * to minimize the damage (Note: no longer true as of V8 5.4 -- but still will + * not be inlined). + * @param {string} s + * @param {(v: string) => string} decoder + * @returns {string} + */ function decodeStr(s, decoder) { try { return decoder(s); diff --git a/lib/readline.js b/lib/readline.js index 55faa12955358d..b40c8019746120 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -65,6 +65,14 @@ const { SafeStringIterator, } = primordials; +const { + clearLine, + clearScreenDown, + cursorTo, + moveCursor, +} = require('internal/readline/callbacks'); +const emitKeypressEvents = require('internal/readline/emitKeypressEvents'); + const { AbortError, codes @@ -72,12 +80,10 @@ const { const { ERR_INVALID_ARG_VALUE, - ERR_INVALID_CURSOR_POS, } = codes; const { validateAbortSignal, validateArray, - validateCallback, validateString, validateUint32, } = require('internal/validators'); @@ -91,23 +97,11 @@ const { charLengthAt, charLengthLeft, commonPrefix, - CSI, - emitKeys, kSubstringSearch, } = require('internal/readline/utils'); const { promisify } = require('internal/util'); -const { clearTimeout, setTimeout } = require('timers'); -const { - kEscape, - kClearToLineBeginning, - kClearToLineEnd, - kClearLine, - kClearScreenDown -} = CSI; - - const { StringDecoder } = require('string_decoder'); // Lazy load Readable for startup performance. @@ -126,9 +120,6 @@ const lineEnding = /\r?\n|\r(?!\n)/; const kLineObjectStream = Symbol('line object stream'); const kQuestionCancel = Symbol('kQuestionCancel'); -const KEYPRESS_DECODER = Symbol('keypress-decoder'); -const ESCAPE_DECODER = Symbol('escape-decoder'); - // GNU readline library - keyseq-timeout is 500ms (default) const ESCAPE_CODE_TIMEOUT = 500; @@ -1320,203 +1311,6 @@ Interface.prototype[SymbolAsyncIterator] = function() { return this[kLineObjectStream][SymbolAsyncIterator](); }; -/** - * Causes the given `Readable` stream to begin emitting `keypress` - * events corresponding to recieved input. - * @param {Readable} stream - * @param {Interface} [iface] - * @returns {void} - */ -function emitKeypressEvents(stream, iface = {}) { - if (stream[KEYPRESS_DECODER]) return; - - stream[KEYPRESS_DECODER] = new StringDecoder('utf8'); - - stream[ESCAPE_DECODER] = emitKeys(stream); - stream[ESCAPE_DECODER].next(); - - const triggerEscape = () => stream[ESCAPE_DECODER].next(''); - const { escapeCodeTimeout = ESCAPE_CODE_TIMEOUT } = iface; - let timeoutId; - - function onData(input) { - if (stream.listenerCount('keypress') > 0) { - const string = stream[KEYPRESS_DECODER].write(input); - if (string) { - clearTimeout(timeoutId); - - // This supports characters of length 2. - iface._sawKeyPress = charLengthAt(string, 0) === string.length; - iface.isCompletionEnabled = false; - - let length = 0; - for (const character of new SafeStringIterator(string)) { - length += character.length; - if (length === string.length) { - iface.isCompletionEnabled = true; - } - - try { - stream[ESCAPE_DECODER].next(character); - // Escape letter at the tail position - if (length === string.length && character === kEscape) { - timeoutId = setTimeout(triggerEscape, escapeCodeTimeout); - } - } catch (err) { - // If the generator throws (it could happen in the `keypress` - // event), we need to restart it. - stream[ESCAPE_DECODER] = emitKeys(stream); - stream[ESCAPE_DECODER].next(); - throw err; - } - } - } - } else { - // Nobody's watching anyway - stream.removeListener('data', onData); - stream.on('newListener', onNewListener); - } - } - - function onNewListener(event) { - if (event === 'keypress') { - stream.on('data', onData); - stream.removeListener('newListener', onNewListener); - } - } - - if (stream.listenerCount('keypress') > 0) { - stream.on('data', onData); - } else { - stream.on('newListener', onNewListener); - } -} - -/** - * Moves cursor to the specified position in - * a given `TTY` stream. - * @param {Writable} stream - * @param {number} x - * @param {number} [y] - * @param {Function} [callback] - * @returns {boolean} - */ -function cursorTo(stream, x, y, callback) { - if (callback !== undefined) { - validateCallback(callback); - } - - if (typeof y === 'function') { - callback = y; - y = undefined; - } - - if (NumberIsNaN(x)) - throw new ERR_INVALID_ARG_VALUE('x', x); - if (NumberIsNaN(y)) - throw new ERR_INVALID_ARG_VALUE('y', y); - - if (stream == null || (typeof x !== 'number' && typeof y !== 'number')) { - if (typeof callback === 'function') - process.nextTick(callback, null); - return true; - } - - if (typeof x !== 'number') - throw new ERR_INVALID_CURSOR_POS(); - - const data = typeof y !== 'number' ? CSI`${x + 1}G` : CSI`${y + 1};${x + 1}H`; - return stream.write(data, callback); -} - -/** - * Moves the cursor relative to its current position - * in a given `TTY` stream. - * @param {Writable} stream - * @param {number} dx - * @param {number} dy - * @param {Function} [callback] - * @returns {boolean} - */ -function moveCursor(stream, dx, dy, callback) { - if (callback !== undefined) { - validateCallback(callback); - } - - if (stream == null || !(dx || dy)) { - if (typeof callback === 'function') - process.nextTick(callback, null); - return true; - } - - let data = ''; - - if (dx < 0) { - data += CSI`${-dx}D`; - } else if (dx > 0) { - data += CSI`${dx}C`; - } - - if (dy < 0) { - data += CSI`${-dy}A`; - } else if (dy > 0) { - data += CSI`${dy}B`; - } - - return stream.write(data, callback); -} - -/** - * Clears current line of given `TTY` stream in a specified - * direction identified by `dir`. - * (dir: -1 to the left from cursor, - * 1 to the right from cursor and - * 0 for the entire line) - * @param {Writable} stream - * @param {number} dir - * @param {Function} [callback] - * @returns {boolean} - */ -function clearLine(stream, dir, callback) { - if (callback !== undefined) { - validateCallback(callback); - } - - if (stream === null || stream === undefined) { - if (typeof callback === 'function') - process.nextTick(callback, null); - return true; - } - - const type = dir < 0 ? - kClearToLineBeginning : - dir > 0 ? - kClearToLineEnd : - kClearLine; - return stream.write(type, callback); -} - -/** - * Clears the given `TTY` stream from the current - * position of the cursor down. - * @param {Writable} stream - * @param {Function} [callback] - * @returns {boolean} - */ -function clearScreenDown(stream, callback) { - if (callback !== undefined) { - validateCallback(callback); - } - - if (stream === null || stream === undefined) { - if (typeof callback === 'function') - process.nextTick(callback, null); - return true; - } - - return stream.write(kClearScreenDown, callback); -} - module.exports = { Interface, clearLine, diff --git a/lib/repl.js b/lib/repl.js index 68808297041164..cf544fb224a446 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -98,6 +98,7 @@ const { Symbol, SyntaxError, SyntaxErrorPrototype, + globalThis, } = primordials; const { @@ -888,8 +889,11 @@ function REPLServer(prompt, self.output.write(self.writer(ret) + '\n'); } - // Display prompt again - self.displayPrompt(); + // Display prompt again (unless we already did by emitting the 'error' + // event on the domain instance). + if (!e) { + self.displayPrompt(); + } } }); @@ -1009,7 +1013,7 @@ REPLServer.prototype.close = function close() { REPLServer.prototype.createContext = function() { let context; if (this.useGlobal) { - context = global; + context = globalThis; } else { sendInspectorCommand((session) => { session.post('Runtime.enable'); @@ -1021,11 +1025,11 @@ REPLServer.prototype.createContext = function() { }, () => { context = vm.createContext(); }); - ArrayPrototypeForEach(ObjectGetOwnPropertyNames(global), (name) => { + ArrayPrototypeForEach(ObjectGetOwnPropertyNames(globalThis), (name) => { // Only set properties that do not already exist as a global builtin. if (!globalBuiltins.has(name)) { ObjectDefineProperty(context, name, - ObjectGetOwnPropertyDescriptor(global, name)); + ObjectGetOwnPropertyDescriptor(globalThis, name)); } }); context.global = context; diff --git a/lib/timers.js b/lib/timers.js index 73844fdbcc7613..485f577d29f2f0 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -171,7 +171,7 @@ ObjectDefineProperty(setTimeout, customPromisify, { }); function clearTimeout(timer) { - if (timer?._onTimeout) { + if (timer && timer._onTimeout) { timer._onTimeout = null; unenroll(timer); return; diff --git a/lib/timers/promises.js b/lib/timers/promises.js index cc2d264d987e20..1f245580f86ab5 100644 --- a/lib/timers/promises.js +++ b/lib/timers/promises.js @@ -53,13 +53,15 @@ function setTimeout(after, value, options = {}) { 'boolean', ref)); } - if (signal?.aborted) { + // TODO(@jasnell): If a decision is made that this cannot be backported + // to 12.x, then this can be converted to use optional chaining to + // simplify the check. + if (signal && signal.aborted) { return PromiseReject(new AbortError()); } let oncancel; const ret = new Promise((resolve, reject) => { - const timeout = new Timeout(resolve, after, args, false, true); - if (!ref) timeout.unref(); + const timeout = new Timeout(resolve, after, args, false, ref); insert(timeout, timeout._idleTimeout); if (signal) { oncancel = FunctionPrototypeBind(cancelListenerHandler, @@ -95,7 +97,10 @@ function setImmediate(value, options = {}) { 'boolean', ref)); } - if (signal?.aborted) { + // TODO(@jasnell): If a decision is made that this cannot be backported + // to 12.x, then this can be converted to use optional chaining to + // simplify the check. + if (signal && signal.aborted) { return PromiseReject(new AbortError()); } let oncancel; @@ -135,8 +140,7 @@ async function* setInterval(after, value, options = {}) { callback(); callback = undefined; } - }, after, undefined, true, true); - if (!ref) interval.unref(); + }, after, undefined, true, ref); insert(interval, interval._idleTimeout); if (signal) { onCancel = () => { diff --git a/lib/util.js b/lib/util.js index f3c10bb7720e58..bcb1c81933c0c0 100644 --- a/lib/util.js +++ b/lib/util.js @@ -74,51 +74,109 @@ const { let internalDeepEqual; +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is boolean} + */ function isBoolean(arg) { return typeof arg === 'boolean'; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is null} + */ function isNull(arg) { return arg === null; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is (null | undefined)} + */ function isNullOrUndefined(arg) { return arg === null || arg === undefined; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is number} + */ function isNumber(arg) { return typeof arg === 'number'; } +/** + * @param {any} arg + * @returns {arg is string} + */ function isString(arg) { return typeof arg === 'string'; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is symbol} + */ function isSymbol(arg) { return typeof arg === 'symbol'; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is undefined} + */ function isUndefined(arg) { return arg === undefined; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {a is NonNullable<object>} + */ function isObject(arg) { return arg !== null && typeof arg === 'object'; } +/** + * @deprecated since v4.0.0 + * @param {any} e + * @returns {arg is Error} + */ function isError(e) { return ObjectPrototypeToString(e) === '[object Error]' || e instanceof Error; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is Function} + */ function isFunction(arg) { return typeof arg === 'function'; } +/** + * @deprecated since v4.0.0 + * @param {any} arg + * @returns {arg is (boolean | null | number | string | symbol | undefined)} + */ function isPrimitive(arg) { return arg === null || (typeof arg !== 'object' && typeof arg !== 'function'); } +/** + * @param {number} n + * @returns {string} + */ function pad(n) { return StringPrototypePadStart(n.toString(), 2, '0'); } @@ -126,7 +184,9 @@ function pad(n) { const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; -// 26 Feb 16:19:34 +/** + * @returns {string} 26 Feb 16:19:34 + */ function timestamp() { const d = new Date(); const t = ArrayPrototypeJoin([ @@ -138,7 +198,11 @@ function timestamp() { } let console; -// Log is just a thin wrapper to console.log that prepends a timestamp +/** + * Log is just a thin wrapper to console.log that prepends a timestamp + * @deprecated since v6.0.0 + * @type {(...args: any[]) => void} + */ function log(...args) { if (!console) { console = require('internal/console/global'); @@ -155,9 +219,9 @@ function log(...args) { * functions as prototype setup using normal JavaScript does not work as * expected during bootstrapping (see mirror.js in r114903). * - * @param {function} ctor Constructor function which needs to inherit the + * @param {Function} ctor Constructor function which needs to inherit the * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. + * @param {Function} superCtor Constructor function to inherit prototype from. * @throws {TypeError} Will error if either constructor is null, or if * the super constructor lacks a prototype. */ @@ -181,6 +245,14 @@ function inherits(ctor, superCtor) { ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype); } +/** + * @deprecated since v6.0.0 + * @template T + * @template S + * @param {T} target + * @param {S} source + * @returns {S extends null ? T : (T & S)} + */ function _extend(target, source) { // Don't do anything if source isn't an object if (source === null || typeof source !== 'object') return target; @@ -204,6 +276,14 @@ const callbackifyOnRejected = hideStackFrames((reason, cb) => { return cb(reason); }); +/** + * @template {(...args: any[]) => Promise<any>} T + * @param {T} original + * @returns {T extends (...args: infer TArgs) => Promise<infer TReturn> ? + * ((...params: [...TArgs, ((err: Error, ret: TReturn) => any)]) => void) : + * never + * } + */ function callbackify(original) { if (typeof original !== 'function') { throw new ERR_INVALID_ARG_TYPE('original', 'Function', original); @@ -238,6 +318,10 @@ function callbackify(original) { return callbackified; } +/** + * @param {number} err + * @returns {string} + */ function getSystemErrorName(err) { validateNumber(err, 'err'); if (err >= 0 || !NumberIsSafeInteger(err)) { diff --git a/lib/zlib.js b/lib/zlib.js index 5fcd736f6652a1..c0c7f601758224 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -89,7 +89,7 @@ const { BROTLI_DECODE, BROTLI_ENCODE, // Brotli operations (~flush levels) BROTLI_OPERATION_PROCESS, BROTLI_OPERATION_FLUSH, - BROTLI_OPERATION_FINISH + BROTLI_OPERATION_FINISH, BROTLI_OPERATION_EMIT_METADATA, } = constants; // Translation table for return codes. @@ -238,6 +238,13 @@ const checkRangesOrGetDefault = hideStackFrames( } ); +const FLUSH_BOUND = [ + [ Z_NO_FLUSH, Z_BLOCK ], + [ BROTLI_OPERATION_PROCESS, BROTLI_OPERATION_EMIT_METADATA ], +]; +const FLUSH_BOUND_IDX_NORMAL = 0; +const FLUSH_BOUND_IDX_BROTLI = 1; + // The base class for all Zlib-style streams. function ZlibBase(opts, mode, handle, { flush, finishFlush, fullFlush }) { let chunkSize = Z_DEFAULT_CHUNK; @@ -247,6 +254,13 @@ function ZlibBase(opts, mode, handle, { flush, finishFlush, fullFlush }) { assert(typeof mode === 'number'); assert(mode >= DEFLATE && mode <= BROTLI_ENCODE); + let flushBoundIdx; + if (mode !== BROTLI_ENCODE && mode !== BROTLI_DECODE) { + flushBoundIdx = FLUSH_BOUND_IDX_NORMAL; + } else { + flushBoundIdx = FLUSH_BOUND_IDX_BROTLI; + } + if (opts) { chunkSize = opts.chunkSize; if (!checkFiniteNumber(chunkSize, 'options.chunkSize')) { @@ -258,11 +272,12 @@ function ZlibBase(opts, mode, handle, { flush, finishFlush, fullFlush }) { flush = checkRangesOrGetDefault( opts.flush, 'options.flush', - Z_NO_FLUSH, Z_BLOCK, flush); + FLUSH_BOUND[flushBoundIdx][0], FLUSH_BOUND[flushBoundIdx][1], flush); finishFlush = checkRangesOrGetDefault( opts.finishFlush, 'options.finishFlush', - Z_NO_FLUSH, Z_BLOCK, finishFlush); + FLUSH_BOUND[flushBoundIdx][0], FLUSH_BOUND[flushBoundIdx][1], + finishFlush); maxOutputLength = checkRangesOrGetDefault( opts.maxOutputLength, 'options.maxOutputLength', diff --git a/node.gyp b/node.gyp index acae34fa393339..642a9767fb64d8 100644 --- a/node.gyp +++ b/node.gyp @@ -166,6 +166,9 @@ 'lib/internal/heap_utils.js', 'lib/internal/histogram.js', 'lib/internal/idna.js', + 'lib/internal/inspector/_inspect.js', + 'lib/internal/inspector/inspect_client.js', + 'lib/internal/inspector/inspect_repl.js', 'lib/internal/inspector_async_hook.js', 'lib/internal/js_stream_socket.js', 'lib/internal/legacy/processbinding.js', @@ -215,6 +218,8 @@ 'lib/internal/process/signal.js', 'lib/internal/process/task_queues.js', 'lib/internal/querystring.js', + 'lib/internal/readline/callbacks.js', + 'lib/internal/readline/emitKeypressEvents.js', 'lib/internal/readline/utils.js', 'lib/internal/repl.js', 'lib/internal/repl/await.js', @@ -226,6 +231,7 @@ 'lib/internal/source_map/source_map.js', 'lib/internal/source_map/source_map_cache.js', 'lib/internal/test/binding.js', + 'lib/internal/test/transfer.js', 'lib/internal/timers.js', 'lib/internal/tls.js', 'lib/internal/trace_events_async_hooks.js', @@ -277,9 +283,6 @@ 'deps/v8/tools/tickprocessor.mjs', 'deps/v8/tools/sourcemap.mjs', 'deps/v8/tools/tickprocessor-driver.mjs', - 'deps/node-inspect/lib/_inspect.js', - 'deps/node-inspect/lib/internal/inspect_client.js', - 'deps/node-inspect/lib/internal/inspect_repl.js', 'deps/acorn/acorn/dist/acorn.js', 'deps/acorn/acorn-walk/dist/walk.js', 'deps/acorn-plugins/acorn-class-fields/index.js', diff --git a/src/api/environment.cc b/src/api/environment.cc index 46e3360ef9c023..3d061d38a5717a 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -465,7 +465,8 @@ MultiIsolatePlatform* CreatePlatform( MultiIsolatePlatform* CreatePlatform( int thread_pool_size, v8::TracingController* tracing_controller) { - return MultiIsolatePlatform::Create(thread_pool_size, tracing_controller) + return MultiIsolatePlatform::Create(thread_pool_size, + tracing_controller) .release(); } @@ -475,8 +476,11 @@ void FreePlatform(MultiIsolatePlatform* platform) { std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create( int thread_pool_size, - v8::TracingController* tracing_controller) { - return std::make_unique<NodePlatform>(thread_pool_size, tracing_controller); + v8::TracingController* tracing_controller, + v8::PageAllocator* page_allocator) { + return std::make_unique<NodePlatform>(thread_pool_size, + tracing_controller, + page_allocator); } MaybeLocal<Object> GetPerContextExports(Local<Context> context) { diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index bd00cd25624a67..c0368739ff03ef 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -19,17 +19,18 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#define CARES_STATICLIB -#include "ares.h" #include "async_wrap-inl.h" +#include "base_object-inl.h" #include "base64-inl.h" +#include "cares_wrap.h" #include "env-inl.h" #include "memory_tracker-inl.h" #include "node.h" +#include "node_errors.h" #include "req_wrap-inl.h" #include "util-inl.h" +#include "v8.h" #include "uv.h" -#include "node_errors.h" #include <cerrno> #include <cstring> @@ -37,28 +38,6 @@ #include <vector> #include <unordered_set> -#ifdef __POSIX__ -# include <netdb.h> -#endif // __POSIX__ - -#if defined(__ANDROID__) || \ - defined(__MINGW32__) || \ - defined(__OpenBSD__) || \ - defined(_MSC_VER) - -# include <nameser.h> -#else -# include <arpa/nameser.h> -#endif - -#ifndef T_CAA -# define T_CAA 257 /* Certification Authority Authorization */ -#endif - -#if defined(__OpenBSD__) -# define AI_V4MAPPED 0 -#endif - namespace node { namespace cares_wrap { @@ -85,190 +64,8 @@ inline uint16_t cares_get_16bit(const unsigned char* p) { return static_cast<uint32_t>(p[0] << 8U) | (static_cast<uint32_t>(p[1])); } -const int ns_t_cname_or_a = -1; - -#define DNS_ESETSRVPENDING -1000 -inline const char* ToErrorCodeString(int status) { - switch (status) { -#define V(code) case ARES_##code: return #code; - V(EADDRGETNETWORKPARAMS) - V(EBADFAMILY) - V(EBADFLAGS) - V(EBADHINTS) - V(EBADNAME) - V(EBADQUERY) - V(EBADRESP) - V(EBADSTR) - V(ECANCELLED) - V(ECONNREFUSED) - V(EDESTRUCTION) - V(EFILE) - V(EFORMERR) - V(ELOADIPHLPAPI) - V(ENODATA) - V(ENOMEM) - V(ENONAME) - V(ENOTFOUND) - V(ENOTIMP) - V(ENOTINITIALIZED) - V(EOF) - V(EREFUSED) - V(ESERVFAIL) - V(ETIMEOUT) -#undef V - } - - return "UNKNOWN_ARES_ERROR"; -} - -class ChannelWrap; - -struct node_ares_task : public MemoryRetainer { - ChannelWrap* channel; - ares_socket_t sock; - uv_poll_t poll_watcher; - - inline void MemoryInfo(MemoryTracker* tracker) const override; - SET_MEMORY_INFO_NAME(node_ares_task) - SET_SELF_SIZE(node_ares_task) -}; - -struct TaskHash { - size_t operator()(node_ares_task* a) const { - return std::hash<ares_socket_t>()(a->sock); - } -}; - -struct TaskEqual { - inline bool operator()(node_ares_task* a, node_ares_task* b) const { - return a->sock == b->sock; - } -}; - -using node_ares_task_list = - std::unordered_set<node_ares_task*, TaskHash, TaskEqual>; - -class ChannelWrap : public AsyncWrap { - public: - ChannelWrap(Environment* env, Local<Object> object, int timeout); - ~ChannelWrap() override; - - static void New(const FunctionCallbackInfo<Value>& args); - - void Setup(); - void EnsureServers(); - void StartTimer(); - void CloseTimer(); - - void ModifyActivityQueryCount(int count); - - inline uv_timer_t* timer_handle() { return timer_handle_; } - inline ares_channel cares_channel() { return channel_; } - inline void set_query_last_ok(bool ok) { query_last_ok_ = ok; } - inline void set_is_servers_default(bool is_default) { - is_servers_default_ = is_default; - } - inline int active_query_count() { return active_query_count_; } - inline node_ares_task_list* task_list() { return &task_list_; } - - void MemoryInfo(MemoryTracker* tracker) const override { - if (timer_handle_ != nullptr) - tracker->TrackField("timer_handle", *timer_handle_); - tracker->TrackField("task_list", task_list_, "node_ares_task_list"); - } - - SET_MEMORY_INFO_NAME(ChannelWrap) - SET_SELF_SIZE(ChannelWrap) - - static void AresTimeout(uv_timer_t* handle); - - private: - uv_timer_t* timer_handle_; - ares_channel channel_; - bool query_last_ok_; - bool is_servers_default_; - bool library_inited_; - int timeout_; - int active_query_count_; - node_ares_task_list task_list_; -}; - -ChannelWrap::ChannelWrap(Environment* env, - Local<Object> object, - int timeout) - : AsyncWrap(env, object, PROVIDER_DNSCHANNEL), - timer_handle_(nullptr), - channel_(nullptr), - query_last_ok_(true), - is_servers_default_(true), - library_inited_(false), - timeout_(timeout), - active_query_count_(0) { - MakeWeak(); - - Setup(); -} - -void ChannelWrap::New(const FunctionCallbackInfo<Value>& args) { - CHECK(args.IsConstructCall()); - CHECK_EQ(args.Length(), 1); - CHECK(args[0]->IsInt32()); - const int timeout = args[0].As<Int32>()->Value(); - Environment* env = Environment::GetCurrent(args); - new ChannelWrap(env, args.This(), timeout); -} - -class GetAddrInfoReqWrap : public ReqWrap<uv_getaddrinfo_t> { - public: - GetAddrInfoReqWrap(Environment* env, - Local<Object> req_wrap_obj, - bool verbatim); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(GetAddrInfoReqWrap) - SET_SELF_SIZE(GetAddrInfoReqWrap) - - bool verbatim() const { return verbatim_; } - - private: - const bool verbatim_; -}; - -GetAddrInfoReqWrap::GetAddrInfoReqWrap(Environment* env, - Local<Object> req_wrap_obj, - bool verbatim) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) - , verbatim_(verbatim) { -} - - -class GetNameInfoReqWrap : public ReqWrap<uv_getnameinfo_t> { - public: - GetNameInfoReqWrap(Environment* env, Local<Object> req_wrap_obj); - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(GetNameInfoReqWrap) - SET_SELF_SIZE(GetNameInfoReqWrap) -}; - -GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env, - Local<Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) { -} - - -/* This is called once per second by loop->timer. It is used to constantly */ -/* call back into c-ares for possibly processing timeouts. */ -void ChannelWrap::AresTimeout(uv_timer_t* handle) { - ChannelWrap* channel = static_cast<ChannelWrap*>(handle->data); - CHECK_EQ(channel->timer_handle(), handle); - CHECK_EQ(false, channel->task_list()->empty()); - ares_process_fd(channel->cares_channel(), ARES_SOCKET_BAD, ARES_SOCKET_BAD); -} - - void ares_poll_cb(uv_poll_t* watcher, int status, int events) { - node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher, watcher); + NodeAresTask* task = ContainerOf(&NodeAresTask::poll_watcher, watcher); ChannelWrap* channel = task->channel; /* Reset the idle timer */ @@ -289,41 +86,17 @@ void ares_poll_cb(uv_poll_t* watcher, int status, int events) { void ares_poll_close_cb(uv_poll_t* watcher) { - node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher, watcher); - delete task; -} - -void node_ares_task::MemoryInfo(MemoryTracker* tracker) const { - tracker->TrackField("channel", channel); -} - -/* Allocates and returns a new node_ares_task */ -node_ares_task* ares_task_create(ChannelWrap* channel, ares_socket_t sock) { - auto task = new node_ares_task(); - - task->channel = channel; - task->sock = sock; - - if (uv_poll_init_socket(channel->env()->event_loop(), - &task->poll_watcher, sock) < 0) { - /* This should never happen. */ - delete task; - return nullptr; - } - - return task; + std::unique_ptr<NodeAresTask> free_me( + ContainerOf(&NodeAresTask::poll_watcher, watcher)); } /* Callback from ares when socket operation is started */ -void ares_sockstate_cb(void* data, - ares_socket_t sock, - int read, - int write) { +void ares_sockstate_cb(void* data, ares_socket_t sock, int read, int write) { ChannelWrap* channel = static_cast<ChannelWrap*>(data); - node_ares_task* task; + NodeAresTask* task; - node_ares_task lookup_task; + NodeAresTask lookup_task; lookup_task.sock = sock; auto it = channel->task_list()->find(&lookup_task); @@ -334,7 +107,7 @@ void ares_sockstate_cb(void* data, /* New socket */ channel->StartTimer(); - task = ares_task_create(channel, sock); + task = NodeAresTask::Create(channel, sock); if (task == nullptr) { /* This should never happen unless we're out of memory or something */ /* is seriously wrong. The socket won't be polled, but the query will */ @@ -367,414 +140,55 @@ void ares_sockstate_cb(void* data, } } - -Local<Array> HostentToNames(Environment* env, - struct hostent* host, - Local<Array> append_to = Local<Array>()) { +Local<Array> HostentToNames(Environment* env, struct hostent* host) { EscapableHandleScope scope(env->isolate()); - auto context = env->context(); - bool append = !append_to.IsEmpty(); - Local<Array> names = append ? append_to : Array::New(env->isolate()); - size_t offset = names->Length(); - - for (uint32_t i = 0; host->h_aliases[i] != nullptr; ++i) { - Local<String> address = OneByteString(env->isolate(), host->h_aliases[i]); - names->Set(context, i + offset, address).Check(); - } - - return append ? names : scope.Escape(names); -} - -void safe_free_hostent(struct hostent* host) { - int idx; - - if (host->h_addr_list != nullptr) { - idx = 0; - while (host->h_addr_list[idx]) { - free(host->h_addr_list[idx++]); - } - free(host->h_addr_list); - host->h_addr_list = nullptr; - } - - if (host->h_aliases != nullptr) { - idx = 0; - while (host->h_aliases[idx]) { - free(host->h_aliases[idx++]); - } - free(host->h_aliases); - host->h_aliases = nullptr; - } - - free(host->h_name); - free(host); -} -void cares_wrap_hostent_cpy(struct hostent* dest, const struct hostent* src) { - dest->h_addr_list = nullptr; - dest->h_addrtype = 0; - dest->h_aliases = nullptr; - dest->h_length = 0; - dest->h_name = nullptr; + std::vector<Local<Value>> names; - /* copy `h_name` */ - size_t name_size = strlen(src->h_name) + 1; - dest->h_name = node::Malloc<char>(name_size); - memcpy(dest->h_name, src->h_name, name_size); + for (uint32_t i = 0; host->h_aliases[i] != nullptr; ++i) + names.emplace_back(OneByteString(env->isolate(), host->h_aliases[i])); - /* copy `h_aliases` */ - size_t alias_count; - for (alias_count = 0; - src->h_aliases[alias_count] != nullptr; - alias_count++) { - } - - dest->h_aliases = node::Malloc<char*>(alias_count + 1); - for (size_t i = 0; i < alias_count; i++) { - const size_t cur_alias_size = strlen(src->h_aliases[i]) + 1; - dest->h_aliases[i] = node::Malloc(cur_alias_size); - memcpy(dest->h_aliases[i], src->h_aliases[i], cur_alias_size); - } - dest->h_aliases[alias_count] = nullptr; - - /* copy `h_addr_list` */ - size_t list_count; - for (list_count = 0; - src->h_addr_list[list_count] != nullptr; - list_count++) { - } - - dest->h_addr_list = node::Malloc<char*>(list_count + 1); - for (size_t i = 0; i < list_count; i++) { - dest->h_addr_list[i] = node::Malloc(src->h_length); - memcpy(dest->h_addr_list[i], src->h_addr_list[i], src->h_length); - } - dest->h_addr_list[list_count] = nullptr; + Local<Array> ret = Array::New(env->isolate(), names.data(), names.size()); - /* work after work */ - dest->h_length = src->h_length; - dest->h_addrtype = src->h_addrtype; + return scope.Escape(ret); } -class QueryWrap; - -void ChannelWrap::Setup() { - struct ares_options options; - memset(&options, 0, sizeof(options)); - options.flags = ARES_FLAG_NOCHECKRESP; - options.sock_state_cb = ares_sockstate_cb; - options.sock_state_cb_data = this; - options.timeout = timeout_; - - int r; - if (!library_inited_) { - Mutex::ScopedLock lock(ares_library_mutex); - // Multiple calls to ares_library_init() increase a reference counter, - // so this is a no-op except for the first call to it. - r = ares_library_init(ARES_LIB_INIT_ALL); - if (r != ARES_SUCCESS) - return env()->ThrowError(ToErrorCodeString(r)); - } - - /* We do the call to ares_init_option for caller. */ - const int optmask = - ARES_OPT_FLAGS | ARES_OPT_TIMEOUTMS | ARES_OPT_SOCK_STATE_CB; - r = ares_init_options(&channel_, &options, optmask); - - if (r != ARES_SUCCESS) { - Mutex::ScopedLock lock(ares_library_mutex); - ares_library_cleanup(); - return env()->ThrowError(ToErrorCodeString(r)); - } - - library_inited_ = true; -} - -void ChannelWrap::StartTimer() { - if (timer_handle_ == nullptr) { - timer_handle_ = new uv_timer_t(); - timer_handle_->data = static_cast<void*>(this); - uv_timer_init(env()->event_loop(), timer_handle_); - } else if (uv_is_active(reinterpret_cast<uv_handle_t*>(timer_handle_))) { - return; - } - int timeout = timeout_; - if (timeout == 0) timeout = 1; - if (timeout < 0 || timeout > 1000) timeout = 1000; - uv_timer_start(timer_handle_, AresTimeout, timeout, timeout); -} - -void ChannelWrap::CloseTimer() { - if (timer_handle_ == nullptr) - return; - - env()->CloseHandle(timer_handle_, [](uv_timer_t* handle) { delete handle; }); - timer_handle_ = nullptr; -} - -ChannelWrap::~ChannelWrap() { - ares_destroy(channel_); - - if (library_inited_) { - Mutex::ScopedLock lock(ares_library_mutex); - // This decreases the reference counter increased by ares_library_init(). - ares_library_cleanup(); - } - - CloseTimer(); -} - - -void ChannelWrap::ModifyActivityQueryCount(int count) { - active_query_count_ += count; - CHECK_GE(active_query_count_, 0); -} - - -/** - * This function is to check whether current servers are fallback servers - * when cares initialized. - * - * The fallback servers of cares is [ "127.0.0.1" ] with no user additional - * setting. - */ -void ChannelWrap::EnsureServers() { - /* if last query is OK or servers are set by user self, do not check */ - if (query_last_ok_ || !is_servers_default_) { - return; - } - - ares_addr_port_node* servers = nullptr; - - ares_get_servers_ports(channel_, &servers); - - /* if no server or multi-servers, ignore */ - if (servers == nullptr) return; - if (servers->next != nullptr) { - ares_free_data(servers); - is_servers_default_ = false; - return; - } +Local<Array> HostentToNames(Environment* env, + struct hostent* host, + Local<Array> names) { + size_t offset = names->Length(); - /* if the only server is not 127.0.0.1, ignore */ - if (servers[0].family != AF_INET || - servers[0].addr.addr4.s_addr != htonl(INADDR_LOOPBACK) || - servers[0].tcp_port != 0 || - servers[0].udp_port != 0) { - ares_free_data(servers); - is_servers_default_ = false; - return; + for (uint32_t i = 0; host->h_aliases[i] != nullptr; ++i) { + names->Set( + env->context(), + i + offset, + OneByteString(env->isolate(), host->h_aliases[i])).Check(); } - ares_free_data(servers); - servers = nullptr; - - /* destroy channel and reset channel */ - ares_destroy(channel_); - - CloseTimer(); - Setup(); + return names; } - -class QueryWrap : public AsyncWrap { - public: - QueryWrap(ChannelWrap* channel, Local<Object> req_wrap_obj, const char* name) - : AsyncWrap(channel->env(), req_wrap_obj, AsyncWrap::PROVIDER_QUERYWRAP), - channel_(channel), - trace_name_(name) { - } - - ~QueryWrap() override { - CHECK_EQ(false, persistent().IsEmpty()); - - // Let Callback() know that this object no longer exists. - if (callback_ptr_ != nullptr) - *callback_ptr_ = nullptr; - } - - // Subclasses should implement the appropriate Send method. - virtual int Send(const char* name) { - UNREACHABLE(); - return 0; - } - - virtual int Send(const char* name, int family) { - UNREACHABLE(); - return 0; - } - - protected: - void AresQuery(const char* name, - int dnsclass, - int type) { - channel_->EnsureServers(); - TRACE_EVENT_NESTABLE_ASYNC_BEGIN1( - TRACING_CATEGORY_NODE2(dns, native), trace_name_, this, - "name", TRACE_STR_COPY(name)); - ares_query(channel_->cares_channel(), name, dnsclass, type, Callback, - MakeCallbackPointer()); - } - - struct ResponseData { - int status; - bool is_host; - DeleteFnPtr<hostent, safe_free_hostent> host; - MallocedBuffer<unsigned char> buf; - }; - - void AfterResponse() { - CHECK(response_data_); - - const int status = response_data_->status; - - if (status != ARES_SUCCESS) { - ParseError(status); - } else if (!response_data_->is_host) { - Parse(response_data_->buf.data, response_data_->buf.size); - } else { - Parse(response_data_->host.get()); - } - } - - void* MakeCallbackPointer() { - CHECK_NULL(callback_ptr_); - callback_ptr_ = new QueryWrap*(this); - return callback_ptr_; - } - - static QueryWrap* FromCallbackPointer(void* arg) { - std::unique_ptr<QueryWrap*> wrap_ptr { static_cast<QueryWrap**>(arg) }; - QueryWrap* wrap = *wrap_ptr.get(); - if (wrap == nullptr) return nullptr; - wrap->callback_ptr_ = nullptr; - return wrap; - } - - static void Callback(void* arg, int status, int timeouts, - unsigned char* answer_buf, int answer_len) { - QueryWrap* wrap = FromCallbackPointer(arg); - if (wrap == nullptr) return; - - unsigned char* buf_copy = nullptr; - if (status == ARES_SUCCESS) { - buf_copy = node::Malloc<unsigned char>(answer_len); - memcpy(buf_copy, answer_buf, answer_len); - } - - wrap->response_data_ = std::make_unique<ResponseData>(); - ResponseData* data = wrap->response_data_.get(); - data->status = status; - data->is_host = false; - data->buf = MallocedBuffer<unsigned char>(buf_copy, answer_len); - - wrap->QueueResponseCallback(status); - } - - static void Callback(void* arg, int status, int timeouts, - struct hostent* host) { - QueryWrap* wrap = FromCallbackPointer(arg); - if (wrap == nullptr) return; - - struct hostent* host_copy = nullptr; - if (status == ARES_SUCCESS) { - host_copy = node::Malloc<hostent>(1); - cares_wrap_hostent_cpy(host_copy, host); - } - - wrap->response_data_ = std::make_unique<ResponseData>(); - ResponseData* data = wrap->response_data_.get(); - data->status = status; - data->host.reset(host_copy); - data->is_host = true; - - wrap->QueueResponseCallback(status); - } - - void QueueResponseCallback(int status) { - BaseObjectPtr<QueryWrap> strong_ref{this}; - env()->SetImmediate([this, strong_ref](Environment*) { - AfterResponse(); - - // Delete once strong_ref goes out of scope. - Detach(); - }); - - channel_->set_query_last_ok(status != ARES_ECONNREFUSED); - channel_->ModifyActivityQueryCount(-1); - } - - void CallOnComplete(Local<Value> answer, - Local<Value> extra = Local<Value>()) { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); - Local<Value> argv[] = { - Integer::New(env()->isolate(), 0), - answer, - extra - }; - const int argc = arraysize(argv) - extra.IsEmpty(); - TRACE_EVENT_NESTABLE_ASYNC_END0( - TRACING_CATEGORY_NODE2(dns, native), trace_name_, this); - - MakeCallback(env()->oncomplete_string(), argc, argv); - } - - void ParseError(int status) { - CHECK_NE(status, ARES_SUCCESS); - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); - const char* code = ToErrorCodeString(status); - Local<Value> arg = OneByteString(env()->isolate(), code); - TRACE_EVENT_NESTABLE_ASYNC_END1( - TRACING_CATEGORY_NODE2(dns, native), trace_name_, this, - "error", status); - MakeCallback(env()->oncomplete_string(), 1, &arg); - } - - // Subclasses should implement the appropriate Parse method. - virtual void Parse(unsigned char* buf, int len) { - UNREACHABLE(); - } - - virtual void Parse(struct hostent* host) { - UNREACHABLE(); - } - - BaseObjectPtr<ChannelWrap> channel_; - - private: - std::unique_ptr<ResponseData> response_data_; - const char* trace_name_; - // Pointer to pointer to 'this' that can be reset from the destructor, - // in order to let Callback() know that 'this' no longer exists. - QueryWrap** callback_ptr_ = nullptr; -}; - - template <typename T> -Local<Array> AddrTTLToArray(Environment* env, - const T* addrttls, - size_t naddrttls) { - auto isolate = env->isolate(); - +Local<Array> AddrTTLToArray( + Environment* env, + const T* addrttls, + size_t naddrttls) { MaybeStackBuffer<Local<Value>, 8> ttls(naddrttls); for (size_t i = 0; i < naddrttls; i++) - ttls[i] = Integer::NewFromUnsigned(isolate, addrttls[i].ttl); + ttls[i] = Integer::NewFromUnsigned(env->isolate(), addrttls[i].ttl); - return Array::New(isolate, ttls.out(), naddrttls); + return Array::New(env->isolate(), ttls.out(), naddrttls); } - -int ParseGeneralReply(Environment* env, - const unsigned char* buf, - int len, - int* type, - Local<Array> ret, - void* addrttls = nullptr, - int* naddrttls = nullptr) { +int ParseGeneralReply( + Environment* env, + const unsigned char* buf, + int len, + int* type, + Local<Array> ret, + void* addrttls = nullptr, + int* naddrttls = nullptr) { HandleScope handle_scope(env->isolate()); - auto context = env->context(); hostent* host; int status; @@ -809,18 +223,20 @@ int ParseGeneralReply(Environment* env, if (status != ARES_SUCCESS) return status; + CHECK_NOT_NULL(host); + HostEntPointer ptr(host); + /* If it's `CNAME`, return the CNAME value; * And if it's `CNAME_OR_A` and it has value in `h_name` and `h_aliases[0]`, * we consider it's a CNAME record, otherwise we consider it's an A record. */ - if ((*type == ns_t_cname_or_a && host->h_name && host->h_aliases[0]) || + if ((*type == ns_t_cname_or_a && ptr->h_name && ptr->h_aliases[0]) || *type == ns_t_cname) { // A cname lookup always returns a single record but we follow the // common API here. *type = ns_t_cname; - ret->Set(context, + ret->Set(env->context(), ret->Length(), - OneByteString(env->isolate(), host->h_name)).Check(); - ares_free_hostent(host); + OneByteString(env->isolate(), ptr->h_name)).Check(); return ARES_SUCCESS; } @@ -828,116 +244,110 @@ int ParseGeneralReply(Environment* env, *type = ns_t_a; if (*type == ns_t_ns) { - HostentToNames(env, host, ret); + HostentToNames(env, ptr.get(), ret); } else if (*type == ns_t_ptr) { uint32_t offset = ret->Length(); - for (uint32_t i = 0; host->h_aliases[i] != nullptr; i++) { - auto alias = OneByteString(env->isolate(), host->h_aliases[i]); - ret->Set(context, i + offset, alias).Check(); + for (uint32_t i = 0; ptr->h_aliases[i] != nullptr; i++) { + auto alias = OneByteString(env->isolate(), ptr->h_aliases[i]); + ret->Set(env->context(), i + offset, alias).Check(); } } else { uint32_t offset = ret->Length(); char ip[INET6_ADDRSTRLEN]; - for (uint32_t i = 0; host->h_addr_list[i] != nullptr; ++i) { - uv_inet_ntop(host->h_addrtype, host->h_addr_list[i], ip, sizeof(ip)); + for (uint32_t i = 0; ptr->h_addr_list[i] != nullptr; ++i) { + uv_inet_ntop(ptr->h_addrtype, ptr->h_addr_list[i], ip, sizeof(ip)); auto address = OneByteString(env->isolate(), ip); - ret->Set(context, i + offset, address).Check(); + ret->Set(env->context(), i + offset, address).Check(); } } - ares_free_hostent(host); - return ARES_SUCCESS; } - -int ParseMxReply(Environment* env, - const unsigned char* buf, - int len, - Local<Array> ret, - bool need_type = false) { +int ParseMxReply( + Environment* env, + const unsigned char* buf, + int len, + Local<Array> ret, + bool need_type = false) { HandleScope handle_scope(env->isolate()); - auto context = env->context(); struct ares_mx_reply* mx_start; int status = ares_parse_mx_reply(buf, len, &mx_start); - if (status != ARES_SUCCESS) { + if (status != ARES_SUCCESS) return status; - } uint32_t offset = ret->Length(); ares_mx_reply* current = mx_start; for (uint32_t i = 0; current != nullptr; ++i, current = current->next) { Local<Object> mx_record = Object::New(env->isolate()); - mx_record->Set(context, + mx_record->Set(env->context(), env->exchange_string(), OneByteString(env->isolate(), current->host)).Check(); - mx_record->Set(context, + mx_record->Set(env->context(), env->priority_string(), Integer::New(env->isolate(), current->priority)).Check(); if (need_type) - mx_record->Set(context, + mx_record->Set(env->context(), env->type_string(), env->dns_mx_string()).Check(); - ret->Set(context, i + offset, mx_record).Check(); + ret->Set(env->context(), i + offset, mx_record).Check(); } ares_free_data(mx_start); return ARES_SUCCESS; } -int ParseCaaReply(Environment* env, - const unsigned char* buf, - int len, - Local<Array> ret, - bool need_type = false) { +int ParseCaaReply( + Environment* env, + const unsigned char* buf, + int len, + Local<Array> ret, + bool need_type = false) { HandleScope handle_scope(env->isolate()); - auto context = env->context(); struct ares_caa_reply* caa_start; int status = ares_parse_caa_reply(buf, len, &caa_start); - if (status != ARES_SUCCESS) { + if (status != ARES_SUCCESS) return status; - } uint32_t offset = ret->Length(); ares_caa_reply* current = caa_start; for (uint32_t i = 0; current != nullptr; ++i, current = current->next) { Local<Object> caa_record = Object::New(env->isolate()); - caa_record->Set(context, + caa_record->Set(env->context(), env->dns_critical_string(), Integer::New(env->isolate(), current->critical)).Check(); - caa_record->Set(context, + caa_record->Set(env->context(), OneByteString(env->isolate(), current->property), OneByteString(env->isolate(), current->value)).Check(); if (need_type) - caa_record->Set(context, + caa_record->Set(env->context(), env->type_string(), env->dns_caa_string()).Check(); - ret->Set(context, i + offset, caa_record).Check(); + ret->Set(env->context(), i + offset, caa_record).Check(); } ares_free_data(caa_start); return ARES_SUCCESS; } -int ParseTxtReply(Environment* env, - const unsigned char* buf, - int len, - Local<Array> ret, - bool need_type = false) { +int ParseTxtReply( + Environment* env, + const unsigned char* buf, + int len, + Local<Array> ret, + bool need_type = false) { HandleScope handle_scope(env->isolate()); - auto context = env->context(); struct ares_txt_ext* txt_out; int status = ares_parse_txt_reply_ext(buf, len, &txt_out); - if (status != ARES_SUCCESS) { + if (status != ARES_SUCCESS) return status; - } Local<Array> txt_chunk; @@ -953,13 +363,13 @@ int ParseTxtReply(Environment* env, if (!txt_chunk.IsEmpty()) { if (need_type) { Local<Object> elem = Object::New(env->isolate()); - elem->Set(context, env->entries_string(), txt_chunk).Check(); - elem->Set(context, + elem->Set(env->context(), env->entries_string(), txt_chunk).Check(); + elem->Set(env->context(), env->type_string(), env->dns_txt_string()).Check(); - ret->Set(context, offset + i++, elem).Check(); + ret->Set(env->context(), offset + i++, elem).Check(); } else { - ret->Set(context, offset + i++, txt_chunk).Check(); + ret->Set(env->context(), offset + i++, txt_chunk).Check(); } } @@ -967,20 +377,20 @@ int ParseTxtReply(Environment* env, j = 0; } - txt_chunk->Set(context, j++, txt).Check(); + txt_chunk->Set(env->context(), j++, txt).Check(); } // Push last chunk if it isn't empty if (!txt_chunk.IsEmpty()) { if (need_type) { Local<Object> elem = Object::New(env->isolate()); - elem->Set(context, env->entries_string(), txt_chunk).Check(); - elem->Set(context, + elem->Set(env->context(), env->entries_string(), txt_chunk).Check(); + elem->Set(env->context(), env->type_string(), env->dns_txt_string()).Check(); - ret->Set(context, offset + i, elem).Check(); + ret->Set(env->context(), offset + i, elem).Check(); } else { - ret->Set(context, offset + i, txt_chunk).Check(); + ret->Set(env->context(), offset + i, txt_chunk).Check(); } } @@ -989,42 +399,41 @@ int ParseTxtReply(Environment* env, } -int ParseSrvReply(Environment* env, - const unsigned char* buf, - int len, - Local<Array> ret, - bool need_type = false) { +int ParseSrvReply( + Environment* env, + const unsigned char* buf, + int len, + Local<Array> ret, + bool need_type = false) { HandleScope handle_scope(env->isolate()); - auto context = env->context(); struct ares_srv_reply* srv_start; int status = ares_parse_srv_reply(buf, len, &srv_start); - if (status != ARES_SUCCESS) { + if (status != ARES_SUCCESS) return status; - } ares_srv_reply* current = srv_start; int offset = ret->Length(); for (uint32_t i = 0; current != nullptr; ++i, current = current->next) { Local<Object> srv_record = Object::New(env->isolate()); - srv_record->Set(context, + srv_record->Set(env->context(), env->name_string(), OneByteString(env->isolate(), current->host)).Check(); - srv_record->Set(context, + srv_record->Set(env->context(), env->port_string(), Integer::New(env->isolate(), current->port)).Check(); - srv_record->Set(context, + srv_record->Set(env->context(), env->priority_string(), Integer::New(env->isolate(), current->priority)).Check(); - srv_record->Set(context, + srv_record->Set(env->context(), env->weight_string(), Integer::New(env->isolate(), current->weight)).Check(); if (need_type) - srv_record->Set(context, + srv_record->Set(env->context(), env->type_string(), env->dns_srv_string()).Check(); - ret->Set(context, i + offset, srv_record).Check(); + ret->Set(env->context(), i + offset, srv_record).Check(); } ares_free_data(srv_start); @@ -1032,53 +441,52 @@ int ParseSrvReply(Environment* env, } -int ParseNaptrReply(Environment* env, - const unsigned char* buf, - int len, - Local<Array> ret, - bool need_type = false) { +int ParseNaptrReply( + Environment* env, + const unsigned char* buf, + int len, + Local<Array> ret, + bool need_type = false) { HandleScope handle_scope(env->isolate()); - auto context = env->context(); ares_naptr_reply* naptr_start; int status = ares_parse_naptr_reply(buf, len, &naptr_start); - if (status != ARES_SUCCESS) { + if (status != ARES_SUCCESS) return status; - } ares_naptr_reply* current = naptr_start; int offset = ret->Length(); for (uint32_t i = 0; current != nullptr; ++i, current = current->next) { Local<Object> naptr_record = Object::New(env->isolate()); - naptr_record->Set(context, + naptr_record->Set(env->context(), env->flags_string(), OneByteString(env->isolate(), current->flags)).Check(); - naptr_record->Set(context, + naptr_record->Set(env->context(), env->service_string(), OneByteString(env->isolate(), current->service)).Check(); - naptr_record->Set(context, + naptr_record->Set(env->context(), env->regexp_string(), OneByteString(env->isolate(), current->regexp)).Check(); - naptr_record->Set(context, + naptr_record->Set(env->context(), env->replacement_string(), OneByteString(env->isolate(), current->replacement)).Check(); - naptr_record->Set(context, + naptr_record->Set(env->context(), env->order_string(), Integer::New(env->isolate(), current->order)).Check(); - naptr_record->Set(context, + naptr_record->Set(env->context(), env->preference_string(), Integer::New(env->isolate(), current->preference)).Check(); if (need_type) - naptr_record->Set(context, + naptr_record->Set(env->context(), env->type_string(), env->dns_naptr_string()).Check(); - ret->Set(context, i + offset, naptr_record).Check(); + ret->Set(env->context(), i + offset, naptr_record).Check(); } ares_free_data(naptr_start); @@ -1086,12 +494,12 @@ int ParseNaptrReply(Environment* env, } -int ParseSoaReply(Environment* env, - unsigned char* buf, - int len, - Local<Object>* ret) { +int ParseSoaReply( + Environment* env, + unsigned char* buf, + int len, + Local<Object>* ret) { EscapableHandleScope handle_scope(env->isolate()); - auto context = env->context(); // Manage memory using standardard smart pointer std::unique_tr struct AresDeleter { @@ -1172,694 +580,800 @@ int ParseSoaReply(Environment* env, const unsigned int minttl = ReadUint32BE(ptr + 4 * 4); Local<Object> soa_record = Object::New(env->isolate()); - soa_record->Set(context, + soa_record->Set(env->context(), env->nsname_string(), OneByteString(env->isolate(), nsname.get())).Check(); - soa_record->Set(context, + soa_record->Set(env->context(), env->hostmaster_string(), OneByteString(env->isolate(), hostmaster.get())).Check(); - soa_record->Set(context, + soa_record->Set(env->context(), env->serial_string(), Integer::NewFromUnsigned(env->isolate(), serial)).Check(); - soa_record->Set(context, + soa_record->Set(env->context(), env->refresh_string(), Integer::New(env->isolate(), refresh)).Check(); - soa_record->Set(context, + soa_record->Set(env->context(), env->retry_string(), Integer::New(env->isolate(), retry)).Check(); - soa_record->Set(context, + soa_record->Set(env->context(), env->expire_string(), Integer::New(env->isolate(), expire)).Check(); - soa_record->Set(context, + soa_record->Set(env->context(), env->minttl_string(), Integer::NewFromUnsigned(env->isolate(), minttl)).Check(); - soa_record->Set(context, + soa_record->Set(env->context(), env->type_string(), env->dns_soa_string()).Check(); - *ret = handle_scope.Escape(soa_record); - break; - } + *ret = handle_scope.Escape(soa_record); + break; + } + + ptr += rr_len; + } + + return ARES_SUCCESS; +} +} // anonymous namespace + +ChannelWrap::ChannelWrap(Environment* env, Local<Object> object, int timeout) + : AsyncWrap(env, object, PROVIDER_DNSCHANNEL), + timeout_(timeout) { + MakeWeak(); + + Setup(); +} + +void ChannelWrap::MemoryInfo(MemoryTracker* tracker) const { + if (timer_handle_ != nullptr) + tracker->TrackField("timer_handle", *timer_handle_); + tracker->TrackField("task_list", task_list_, "NodeAresTask::List"); +} + +void ChannelWrap::New(const FunctionCallbackInfo<Value>& args) { + CHECK(args.IsConstructCall()); + CHECK_EQ(args.Length(), 1); + CHECK(args[0]->IsInt32()); + const int timeout = args[0].As<Int32>()->Value(); + Environment* env = Environment::GetCurrent(args); + new ChannelWrap(env, args.This(), timeout); +} + +GetAddrInfoReqWrap::GetAddrInfoReqWrap( + Environment* env, + Local<Object> req_wrap_obj, + bool verbatim) + : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP), + verbatim_(verbatim) {} + +GetNameInfoReqWrap::GetNameInfoReqWrap( + Environment* env, + Local<Object> req_wrap_obj) + : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) {} + +/* This is called once per second by loop->timer. It is used to constantly */ +/* call back into c-ares for possibly processing timeouts. */ +void ChannelWrap::AresTimeout(uv_timer_t* handle) { + ChannelWrap* channel = static_cast<ChannelWrap*>(handle->data); + CHECK_EQ(channel->timer_handle(), handle); + CHECK_EQ(false, channel->task_list()->empty()); + ares_process_fd(channel->cares_channel(), ARES_SOCKET_BAD, ARES_SOCKET_BAD); +} + + +void NodeAresTask::MemoryInfo(MemoryTracker* tracker) const { + tracker->TrackField("channel", channel); +} + +/* Allocates and returns a new NodeAresTask */ +NodeAresTask* NodeAresTask::Create(ChannelWrap* channel, ares_socket_t sock) { + auto task = new NodeAresTask(); + + task->channel = channel; + task->sock = sock; + + if (uv_poll_init_socket(channel->env()->event_loop(), + &task->poll_watcher, sock) < 0) { + /* This should never happen. */ + delete task; + return nullptr; + } + + return task; +} + +void ChannelWrap::Setup() { + struct ares_options options; + memset(&options, 0, sizeof(options)); + options.flags = ARES_FLAG_NOCHECKRESP; + options.sock_state_cb = ares_sockstate_cb; + options.sock_state_cb_data = this; + options.timeout = timeout_; + + int r; + if (!library_inited_) { + Mutex::ScopedLock lock(ares_library_mutex); + // Multiple calls to ares_library_init() increase a reference counter, + // so this is a no-op except for the first call to it. + r = ares_library_init(ARES_LIB_INIT_ALL); + if (r != ARES_SUCCESS) + return env()->ThrowError(ToErrorCodeString(r)); + } + + /* We do the call to ares_init_option for caller. */ + const int optmask = + ARES_OPT_FLAGS | ARES_OPT_TIMEOUTMS | ARES_OPT_SOCK_STATE_CB; + r = ares_init_options(&channel_, &options, optmask); + + if (r != ARES_SUCCESS) { + Mutex::ScopedLock lock(ares_library_mutex); + ares_library_cleanup(); + return env()->ThrowError(ToErrorCodeString(r)); + } + + library_inited_ = true; +} + +void ChannelWrap::StartTimer() { + if (timer_handle_ == nullptr) { + timer_handle_ = new uv_timer_t(); + timer_handle_->data = static_cast<void*>(this); + uv_timer_init(env()->event_loop(), timer_handle_); + } else if (uv_is_active(reinterpret_cast<uv_handle_t*>(timer_handle_))) { + return; + } + int timeout = timeout_; + if (timeout == 0) timeout = 1; + if (timeout < 0 || timeout > 1000) timeout = 1000; + uv_timer_start(timer_handle_, AresTimeout, timeout, timeout); +} + +void ChannelWrap::CloseTimer() { + if (timer_handle_ == nullptr) + return; + + env()->CloseHandle(timer_handle_, [](uv_timer_t* handle) { delete handle; }); + timer_handle_ = nullptr; +} + +ChannelWrap::~ChannelWrap() { + ares_destroy(channel_); + + if (library_inited_) { + Mutex::ScopedLock lock(ares_library_mutex); + // This decreases the reference counter increased by ares_library_init(). + ares_library_cleanup(); + } + + CloseTimer(); +} + + +void ChannelWrap::ModifyActivityQueryCount(int count) { + active_query_count_ += count; + CHECK_GE(active_query_count_, 0); +} + + +/** + * This function is to check whether current servers are fallback servers + * when cares initialized. + * + * The fallback servers of cares is [ "127.0.0.1" ] with no user additional + * setting. + */ +void ChannelWrap::EnsureServers() { + /* if last query is OK or servers are set by user self, do not check */ + if (query_last_ok_ || !is_servers_default_) { + return; + } + + ares_addr_port_node* servers = nullptr; + + ares_get_servers_ports(channel_, &servers); + + /* if no server or multi-servers, ignore */ + if (servers == nullptr) return; + if (servers->next != nullptr) { + ares_free_data(servers); + is_servers_default_ = false; + return; + } + + /* if the only server is not 127.0.0.1, ignore */ + if (servers[0].family != AF_INET || + servers[0].addr.addr4.s_addr != htonl(INADDR_LOOPBACK) || + servers[0].tcp_port != 0 || + servers[0].udp_port != 0) { + ares_free_data(servers); + is_servers_default_ = false; + return; + } + + ares_free_data(servers); + servers = nullptr; + + /* destroy channel and reset channel */ + ares_destroy(channel_); + + CloseTimer(); + Setup(); +} + +int AnyTraits::Send(QueryWrap<AnyTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_any); + return 0; +} - ptr += rr_len; - } +int ATraits::Send(QueryWrap<ATraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_a); + return 0; +} - return ARES_SUCCESS; +int AaaaTraits::Send(QueryWrap<AaaaTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_aaaa); + return 0; } +int CaaTraits::Send(QueryWrap<CaaTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, T_CAA); + return 0; +} -class QueryAnyWrap: public QueryWrap { - public: - QueryAnyWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveAny") { - } +int CnameTraits::Send(QueryWrap<CnameTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_cname); + return 0; +} - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_any); - return 0; - } +int MxTraits::Send(QueryWrap<MxTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_mx); + return 0; +} - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryAnyWrap) - SET_SELF_SIZE(QueryAnyWrap) - - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - auto context = env()->context(); - Context::Scope context_scope(context); - - Local<Array> ret = Array::New(env()->isolate()); - int type, status, old_count; - - /* Parse A records or CNAME records */ - ares_addrttl addrttls[256]; - int naddrttls = arraysize(addrttls); - - type = ns_t_cname_or_a; - status = ParseGeneralReply(env(), - buf, - len, - &type, - ret, - addrttls, - &naddrttls); - uint32_t a_count = ret->Length(); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; - } +int NsTraits::Send(QueryWrap<NsTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_ns); + return 0; +} - if (type == ns_t_a) { - CHECK_EQ(static_cast<uint32_t>(naddrttls), a_count); - for (uint32_t i = 0; i < a_count; i++) { - Local<Object> obj = Object::New(env()->isolate()); - obj->Set(context, - env()->address_string(), - ret->Get(context, i).ToLocalChecked()).Check(); - obj->Set(context, - env()->ttl_string(), - Integer::NewFromUnsigned( - env()->isolate(), addrttls[i].ttl)).Check(); - obj->Set(context, - env()->type_string(), - env()->dns_a_string()).Check(); - ret->Set(context, i, obj).Check(); - } - } else { - for (uint32_t i = 0; i < a_count; i++) { - Local<Object> obj = Object::New(env()->isolate()); - obj->Set(context, - env()->value_string(), - ret->Get(context, i).ToLocalChecked()).Check(); - obj->Set(context, - env()->type_string(), - env()->dns_cname_string()).Check(); - ret->Set(context, i, obj).Check(); - } - } +int TxtTraits::Send(QueryWrap<TxtTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_txt); + return 0; +} - /* Parse AAAA records */ - ares_addr6ttl addr6ttls[256]; - int naddr6ttls = arraysize(addr6ttls); - - type = ns_t_aaaa; - status = ParseGeneralReply(env(), - buf, - len, - &type, - ret, - addr6ttls, - &naddr6ttls); - uint32_t aaaa_count = ret->Length() - a_count; - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; - } +int SrvTraits::Send(QueryWrap<SrvTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_srv); + return 0; +} - CHECK_EQ(aaaa_count, static_cast<uint32_t>(naddr6ttls)); - CHECK_EQ(ret->Length(), a_count + aaaa_count); - for (uint32_t i = a_count; i < ret->Length(); i++) { - Local<Object> obj = Object::New(env()->isolate()); - obj->Set(context, - env()->address_string(), - ret->Get(context, i).ToLocalChecked()).Check(); - obj->Set(context, - env()->ttl_string(), - Integer::NewFromUnsigned( - env()->isolate(), addr6ttls[i - a_count].ttl)).Check(); - obj->Set(context, - env()->type_string(), - env()->dns_aaaa_string()).Check(); - ret->Set(context, i, obj).Check(); - } +int PtrTraits::Send(QueryWrap<PtrTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_ptr); + return 0; +} - /* Parse MX records */ - status = ParseMxReply(env(), buf, len, ret, true); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; - } +int NaptrTraits::Send(QueryWrap<NaptrTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_naptr); + return 0; +} - /* Parse NS records */ - type = ns_t_ns; - old_count = ret->Length(); - status = ParseGeneralReply(env(), buf, len, &type, ret); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; - } - for (uint32_t i = old_count; i < ret->Length(); i++) { - Local<Object> obj = Object::New(env()->isolate()); - obj->Set(context, - env()->value_string(), - ret->Get(context, i).ToLocalChecked()).Check(); - obj->Set(context, - env()->type_string(), - env()->dns_ns_string()).Check(); - ret->Set(context, i, obj).Check(); - } +int SoaTraits::Send(QueryWrap<SoaTraits>* wrap, const char* name) { + wrap->AresQuery(name, ns_c_in, ns_t_soa); + return 0; +} - /* Parse TXT records */ - status = ParseTxtReply(env(), buf, len, ret, true); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; - } +int AnyTraits::Parse( + QueryAnyWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - /* Parse SRV records */ - status = ParseSrvReply(env(), buf, len, ret, true); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - return; - } + unsigned char* buf = response->buf.data; + int len = response->buf.size; - /* Parse PTR records */ - type = ns_t_ptr; - old_count = ret->Length(); - status = ParseGeneralReply(env(), buf, len, &type, ret); - for (uint32_t i = old_count; i < ret->Length(); i++) { - Local<Object> obj = Object::New(env()->isolate()); - obj->Set(context, - env()->value_string(), - ret->Get(context, i).ToLocalChecked()).Check(); - obj->Set(context, - env()->type_string(), - env()->dns_ptr_string()).Check(); - ret->Set(context, i, obj).Check(); - } + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - /* Parse NAPTR records */ - status = ParseNaptrReply(env(), buf, len, ret, true); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; - } + Local<Array> ret = Array::New(env->isolate()); + int type, status, old_count; + + /* Parse A records or CNAME records */ + ares_addrttl addrttls[256]; + int naddrttls = arraysize(addrttls); + + type = ns_t_cname_or_a; + status = ParseGeneralReply(env, + buf, + len, + &type, + ret, + addrttls, + &naddrttls); + uint32_t a_count = ret->Length(); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - /* Parse SOA records */ - Local<Object> soa_record = Local<Object>(); - status = ParseSoaReply(env(), buf, len, &soa_record); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; + if (type == ns_t_a) { + CHECK_EQ(static_cast<uint32_t>(naddrttls), a_count); + for (uint32_t i = 0; i < a_count; i++) { + Local<Object> obj = Object::New(env->isolate()); + obj->Set(env->context(), + env->address_string(), + ret->Get(env->context(), i).ToLocalChecked()).Check(); + obj->Set(env->context(), + env->ttl_string(), + Integer::NewFromUnsigned( + env->isolate(), addrttls[i].ttl)).Check(); + obj->Set(env->context(), + env->type_string(), + env->dns_a_string()).Check(); + ret->Set(env->context(), i, obj).Check(); } - if (!soa_record.IsEmpty()) - ret->Set(context, ret->Length(), soa_record).Check(); - - /* Parse CAA records */ - status = ParseCaaReply(env(), buf, len, ret, true); - if (status != ARES_SUCCESS && status != ARES_ENODATA) { - ParseError(status); - return; + } else { + for (uint32_t i = 0; i < a_count; i++) { + Local<Object> obj = Object::New(env->isolate()); + obj->Set(env->context(), + env->value_string(), + ret->Get(env->context(), i).ToLocalChecked()).Check(); + obj->Set(env->context(), + env->type_string(), + env->dns_cname_string()).Check(); + ret->Set(env->context(), i, obj).Check(); } - - CallOnComplete(ret); } -}; + /* Parse AAAA records */ + ares_addr6ttl addr6ttls[256]; + int naddr6ttls = arraysize(addr6ttls); + + type = ns_t_aaaa; + status = ParseGeneralReply(env, + buf, + len, + &type, + ret, + addr6ttls, + &naddr6ttls); + uint32_t aaaa_count = ret->Length() - a_count; + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; -class QueryAWrap: public QueryWrap { - public: - QueryAWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolve4") { - } - - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_a); - return 0; - } - - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryAWrap) - SET_SELF_SIZE(QueryAWrap) - - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); - - ares_addrttl addrttls[256]; - int naddrttls = arraysize(addrttls), status; - Local<Array> ret = Array::New(env()->isolate()); - - int type = ns_t_a; - status = ParseGeneralReply(env(), - buf, - len, - &type, - ret, - addrttls, - &naddrttls); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + CHECK_EQ(aaaa_count, static_cast<uint32_t>(naddr6ttls)); + CHECK_EQ(ret->Length(), a_count + aaaa_count); + for (uint32_t i = a_count; i < ret->Length(); i++) { + Local<Object> obj = Object::New(env->isolate()); + obj->Set(env->context(), + env->address_string(), + ret->Get(env->context(), i).ToLocalChecked()).Check(); + obj->Set(env->context(), + env->ttl_string(), + Integer::NewFromUnsigned( + env->isolate(), addr6ttls[i - a_count].ttl)).Check(); + obj->Set(env->context(), + env->type_string(), + env->dns_aaaa_string()).Check(); + ret->Set(env->context(), i, obj).Check(); + } + + /* Parse MX records */ + status = ParseMxReply(env, buf, len, ret, true); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - Local<Array> ttls = AddrTTLToArray<ares_addrttl>(env(), - addrttls, - naddrttls); + /* Parse NS records */ + type = ns_t_ns; + old_count = ret->Length(); + status = ParseGeneralReply(env, buf, len, &type, ret); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - CallOnComplete(ret, ttls); + for (uint32_t i = old_count; i < ret->Length(); i++) { + Local<Object> obj = Object::New(env->isolate()); + obj->Set(env->context(), + env->value_string(), + ret->Get(env->context(), i).ToLocalChecked()).Check(); + obj->Set(env->context(), + env->type_string(), + env->dns_ns_string()).Check(); + ret->Set(env->context(), i, obj).Check(); } -}; - -class QueryAaaaWrap: public QueryWrap { - public: - QueryAaaaWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolve6") { - } + /* Parse TXT records */ + status = ParseTxtReply(env, buf, len, ret, true); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_aaaa); - return 0; - } + /* Parse SRV records */ + status = ParseSrvReply(env, buf, len, ret, true); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryAaaaWrap) - SET_SELF_SIZE(QueryAaaaWrap) - - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); - - ares_addr6ttl addrttls[256]; - int naddrttls = arraysize(addrttls), status; - Local<Array> ret = Array::New(env()->isolate()); - - int type = ns_t_aaaa; - status = ParseGeneralReply(env(), - buf, - len, - &type, - ret, - addrttls, - &naddrttls); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + /* Parse PTR records */ + type = ns_t_ptr; + old_count = ret->Length(); + status = ParseGeneralReply(env, buf, len, &type, ret); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; + for (uint32_t i = old_count; i < ret->Length(); i++) { + Local<Object> obj = Object::New(env->isolate()); + obj->Set(env->context(), + env->value_string(), + ret->Get(env->context(), i).ToLocalChecked()).Check(); + obj->Set(env->context(), + env->type_string(), + env->dns_ptr_string()).Check(); + ret->Set(env->context(), i, obj).Check(); + } + + /* Parse NAPTR records */ + status = ParseNaptrReply(env, buf, len, ret, true); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - Local<Array> ttls = AddrTTLToArray<ares_addr6ttl>(env(), - addrttls, - naddrttls); + /* Parse SOA records */ + Local<Object> soa_record = Local<Object>(); + status = ParseSoaReply(env, buf, len, &soa_record); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - CallOnComplete(ret, ttls); - } -}; + if (!soa_record.IsEmpty()) + ret->Set(env->context(), ret->Length(), soa_record).Check(); -class QueryCaaWrap: public QueryWrap { - public: - QueryCaaWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveCaa") { - } + /* Parse CAA records */ + status = ParseCaaReply(env, buf, len, ret, true); + if (status != ARES_SUCCESS && status != ARES_ENODATA) + return status; - int Send(const char* name) override { - AresQuery(name, ns_c_in, T_CAA); - return 0; - } + wrap->CallOnComplete(ret); + return 0; +} - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryAaaaWrap) - SET_SELF_SIZE(QueryAaaaWrap) +int ATraits::Parse( + QueryAWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); + unsigned char* buf = response->buf.data; + int len = response->buf.size; - Local<Array> ret = Array::New(env()->isolate()); - int status = ParseCaaReply(env(), buf, len, ret); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - this->CallOnComplete(ret); - } -}; + ares_addrttl addrttls[256]; + int naddrttls = arraysize(addrttls), status; + Local<Array> ret = Array::New(env->isolate()); + + int type = ns_t_a; + status = ParseGeneralReply(env, + buf, + len, + &type, + ret, + addrttls, + &naddrttls); + if (status != ARES_SUCCESS) + return status; -class QueryCnameWrap: public QueryWrap { - public: - QueryCnameWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveCname") { - } + Local<Array> ttls = AddrTTLToArray<ares_addrttl>(env, addrttls, naddrttls); - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_cname); - return 0; - } + wrap->CallOnComplete(ret, ttls); + return 0; +} - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryCnameWrap) - SET_SELF_SIZE(QueryCnameWrap) +int AaaaTraits::Parse( + QueryAaaaWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); + unsigned char* buf = response->buf.data; + int len = response->buf.size; - Local<Array> ret = Array::New(env()->isolate()); - int type = ns_t_cname; - int status = ParseGeneralReply(env(), buf, len, &type, ret); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - this->CallOnComplete(ret); - } -}; + ares_addr6ttl addrttls[256]; + int naddrttls = arraysize(addrttls), status; + Local<Array> ret = Array::New(env->isolate()); + + int type = ns_t_aaaa; + status = ParseGeneralReply(env, + buf, + len, + &type, + ret, + addrttls, + &naddrttls); + if (status != ARES_SUCCESS) + return status; + Local<Array> ttls = AddrTTLToArray<ares_addr6ttl>(env, addrttls, naddrttls); -class QueryMxWrap: public QueryWrap { - public: - QueryMxWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveMx") { - } + wrap->CallOnComplete(ret, ttls); + return 0; +} - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_mx); - return 0; - } +int CaaTraits::Parse( + QueryCaaWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryMxWrap) - SET_SELF_SIZE(QueryMxWrap) + unsigned char* buf = response->buf.data; + int len = response->buf.size; - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - Local<Array> mx_records = Array::New(env()->isolate()); - int status = ParseMxReply(env(), buf, len, mx_records); + Local<Array> ret = Array::New(env->isolate()); + int status = ParseCaaReply(env, buf, len, ret); + if (status != ARES_SUCCESS) + return status; - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + wrap->CallOnComplete(ret); + return 0; +} - this->CallOnComplete(mx_records); - } -}; +int CnameTraits::Parse( + QueryCnameWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; + unsigned char* buf = response->buf.data; + int len = response->buf.size; -class QueryNsWrap: public QueryWrap { - public: - QueryNsWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveNs") { - } + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_ns); - return 0; - } + Local<Array> ret = Array::New(env->isolate()); + int type = ns_t_cname; + int status = ParseGeneralReply(env, buf, len, &type, ret); + if (status != ARES_SUCCESS) + return status; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryNsWrap) - SET_SELF_SIZE(QueryNsWrap) + wrap->CallOnComplete(ret); + return 0; +} - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); +int MxTraits::Parse( + QueryMxWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - int type = ns_t_ns; - Local<Array> names = Array::New(env()->isolate()); - int status = ParseGeneralReply(env(), buf, len, &type, names); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + unsigned char* buf = response->buf.data; + int len = response->buf.size; - this->CallOnComplete(names); - } -}; + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); + Local<Array> mx_records = Array::New(env->isolate()); + int status = ParseMxReply(env, buf, len, mx_records); -class QueryTxtWrap: public QueryWrap { - public: - QueryTxtWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveTxt") { - } + if (status != ARES_SUCCESS) + return status; - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_txt); - return 0; - } + wrap->CallOnComplete(mx_records); + return 0; +} - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryTxtWrap) - SET_SELF_SIZE(QueryTxtWrap) +int NsTraits::Parse( + QueryNsWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); + unsigned char* buf = response->buf.data; + int len = response->buf.size; - Local<Array> txt_records = Array::New(env()->isolate()); - int status = ParseTxtReply(env(), buf, len, txt_records); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - this->CallOnComplete(txt_records); - } -}; + int type = ns_t_ns; + Local<Array> names = Array::New(env->isolate()); + int status = ParseGeneralReply(env, buf, len, &type, names); + if (status != ARES_SUCCESS) + return status; + wrap->CallOnComplete(names); + return 0; +} -class QuerySrvWrap: public QueryWrap { - public: - explicit QuerySrvWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveSrv") { - } +int TxtTraits::Parse( + QueryTxtWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_srv); - return 0; - } + unsigned char* buf = response->buf.data; + int len = response->buf.size; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QuerySrvWrap) - SET_SELF_SIZE(QuerySrvWrap) + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); + Local<Array> txt_records = Array::New(env->isolate()); + int status = ParseTxtReply(env, buf, len, txt_records); + if (status != ARES_SUCCESS) + return status; - Local<Array> srv_records = Array::New(env()->isolate()); - int status = ParseSrvReply(env(), buf, len, srv_records); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + wrap->CallOnComplete(txt_records); + return 0; +} - this->CallOnComplete(srv_records); - } -}; +int SrvTraits::Parse( + QuerySrvWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; -class QueryPtrWrap: public QueryWrap { - public: - explicit QueryPtrWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolvePtr") { - } + unsigned char* buf = response->buf.data; + int len = response->buf.size; - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_ptr); - return 0; - } + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryPtrWrap) - SET_SELF_SIZE(QueryPtrWrap) + Local<Array> srv_records = Array::New(env->isolate()); + int status = ParseSrvReply(env, buf, len, srv_records); + if (status != ARES_SUCCESS) + return status; - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); + wrap->CallOnComplete(srv_records); + return 0; +} - int type = ns_t_ptr; - Local<Array> aliases = Array::New(env()->isolate()); +int PtrTraits::Parse( + QueryPtrWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - int status = ParseGeneralReply(env(), buf, len, &type, aliases); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + unsigned char* buf = response->buf.data; + int len = response->buf.size; - this->CallOnComplete(aliases); - } -}; + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); -class QueryNaptrWrap: public QueryWrap { - public: - explicit QueryNaptrWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveNaptr") { - } + int type = ns_t_ptr; + Local<Array> aliases = Array::New(env->isolate()); - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_naptr); - return 0; - } + int status = ParseGeneralReply(env, buf, len, &type, aliases); + if (status != ARES_SUCCESS) + return status; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QueryNaptrWrap) - SET_SELF_SIZE(QueryNaptrWrap) + wrap->CallOnComplete(aliases); + return 0; +} - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); +int NaptrTraits::Parse( + QueryNaptrWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - Local<Array> naptr_records = Array::New(env()->isolate()); - int status = ParseNaptrReply(env(), buf, len, naptr_records); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + unsigned char* buf = response->buf.data; + int len = response->buf.size; - this->CallOnComplete(naptr_records); - } -}; + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); + Local<Array> naptr_records = Array::New(env->isolate()); + int status = ParseNaptrReply(env, buf, len, naptr_records); + if (status != ARES_SUCCESS) + return status; -class QuerySoaWrap: public QueryWrap { - public: - QuerySoaWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "resolveSoa") { - } + wrap->CallOnComplete(naptr_records); + return 0; +} - int Send(const char* name) override { - AresQuery(name, ns_c_in, ns_t_soa); - return 0; - } +int SoaTraits::Parse( + QuerySoaWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(response->is_host)) + return ARES_EBADRESP; - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(QuerySoaWrap) - SET_SELF_SIZE(QuerySoaWrap) + unsigned char* buf = response->buf.data; + int len = response->buf.size; - protected: - void Parse(unsigned char* buf, int len) override { - HandleScope handle_scope(env()->isolate()); - auto context = env()->context(); - Context::Scope context_scope(context); + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); - ares_soa_reply* soa_out; - int status = ares_parse_soa_reply(buf, len, &soa_out); + ares_soa_reply* soa_out; + int status = ares_parse_soa_reply(buf, len, &soa_out); - if (status != ARES_SUCCESS) { - ParseError(status); - return; - } + if (status != ARES_SUCCESS) + return status; - Local<Object> soa_record = Object::New(env()->isolate()); - - soa_record->Set(context, - env()->nsname_string(), - OneByteString(env()->isolate(), - soa_out->nsname)).Check(); - soa_record->Set(context, - env()->hostmaster_string(), - OneByteString(env()->isolate(), - soa_out->hostmaster)).Check(); - soa_record->Set(context, - env()->serial_string(), - Integer::NewFromUnsigned( - env()->isolate(), soa_out->serial)).Check(); - soa_record->Set(context, - env()->refresh_string(), - Integer::New(env()->isolate(), - soa_out->refresh)).Check(); - soa_record->Set(context, - env()->retry_string(), - Integer::New(env()->isolate(), soa_out->retry)).Check(); - soa_record->Set(context, - env()->expire_string(), - Integer::New(env()->isolate(), soa_out->expire)).Check(); - soa_record->Set(context, - env()->minttl_string(), - Integer::NewFromUnsigned( - env()->isolate(), soa_out->minttl)).Check(); - - ares_free_data(soa_out); - - this->CallOnComplete(soa_record); - } -}; + Local<Object> soa_record = Object::New(env->isolate()); + + soa_record->Set(env->context(), + env->nsname_string(), + OneByteString(env->isolate(), soa_out->nsname)).Check(); + soa_record->Set(env->context(), + env->hostmaster_string(), + OneByteString(env->isolate(), soa_out->hostmaster)).Check(); + soa_record->Set(env->context(), + env->serial_string(), + Integer::NewFromUnsigned( + env->isolate(), soa_out->serial)).Check(); + soa_record->Set(env->context(), + env->refresh_string(), + Integer::New(env->isolate(), soa_out->refresh)).Check(); + soa_record->Set(env->context(), + env->retry_string(), + Integer::New(env->isolate(), soa_out->retry)).Check(); + soa_record->Set(env->context(), + env->expire_string(), + Integer::New(env->isolate(), soa_out->expire)).Check(); + soa_record->Set(env->context(), + env->minttl_string(), + Integer::NewFromUnsigned( + env->isolate(), soa_out->minttl)).Check(); + + ares_free_data(soa_out); + + wrap->CallOnComplete(soa_record); + return 0; +} +int ReverseTraits::Send(GetHostByAddrWrap* wrap, const char* name) { + int length, family; + char address_buffer[sizeof(struct in6_addr)]; -class GetHostByAddrWrap: public QueryWrap { - public: - explicit GetHostByAddrWrap(ChannelWrap* channel, Local<Object> req_wrap_obj) - : QueryWrap(channel, req_wrap_obj, "reverse") { + if (uv_inet_pton(AF_INET, name, &address_buffer) == 0) { + length = sizeof(struct in_addr); + family = AF_INET; + } else if (uv_inet_pton(AF_INET6, name, &address_buffer) == 0) { + length = sizeof(struct in6_addr); + family = AF_INET6; + } else { + return UV_EINVAL; // So errnoException() reports a proper error. } - int Send(const char* name) override { - int length, family; - char address_buffer[sizeof(struct in6_addr)]; - - if (uv_inet_pton(AF_INET, name, &address_buffer) == 0) { - length = sizeof(struct in_addr); - family = AF_INET; - } else if (uv_inet_pton(AF_INET6, name, &address_buffer) == 0) { - length = sizeof(struct in6_addr); - family = AF_INET6; - } else { - return UV_EINVAL; // So errnoException() reports a proper error. - } - - TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( - TRACING_CATEGORY_NODE2(dns, native), "reverse", this, - "name", TRACE_STR_COPY(name), - "family", family == AF_INET ? "ipv4" : "ipv6"); - - ares_gethostbyaddr(channel_->cares_channel(), - address_buffer, - length, - family, - Callback, - MakeCallbackPointer()); - return 0; - } + TRACE_EVENT_NESTABLE_ASYNC_BEGIN2( + TRACING_CATEGORY_NODE2(dns, native), "reverse", wrap, + "name", TRACE_STR_COPY(name), + "family", family == AF_INET ? "ipv4" : "ipv6"); + + ares_gethostbyaddr( + wrap->channel()->cares_channel(), + address_buffer, + length, + family, + GetHostByAddrWrap::Callback, + wrap->MakeCallbackPointer()); + return 0; +} - SET_NO_MEMORY_INFO() - SET_MEMORY_INFO_NAME(GetHostByAddrWrap) - SET_SELF_SIZE(GetHostByAddrWrap) +int ReverseTraits::Parse( + GetHostByAddrWrap* wrap, + const std::unique_ptr<ResponseData>& response) { + if (UNLIKELY(!response->is_host)) + return ARES_EBADRESP; - protected: - void Parse(struct hostent* host) override { - HandleScope handle_scope(env()->isolate()); - Context::Scope context_scope(env()->context()); - this->CallOnComplete(HostentToNames(env(), host)); - } -}; + struct hostent* host = response->host.get(); + Environment* env = wrap->env(); + HandleScope handle_scope(env->isolate()); + Context::Scope context_scope(env->context()); + wrap->CallOnComplete(HostentToNames(env, host)); + return 0; +} +namespace { template <class Wrap> static void Query(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); @@ -2312,6 +1826,32 @@ void StrError(const FunctionCallbackInfo<Value>& args) { args.GetReturnValue().Set(OneByteString(env->isolate(), errmsg)); } +} // namespace + +inline void safe_free_hostent(struct hostent* host) { + int idx; + + if (host->h_addr_list != nullptr) { + idx = 0; + while (host->h_addr_list[idx]) { + free(host->h_addr_list[idx++]); + } + free(host->h_addr_list); + host->h_addr_list = nullptr; + } + + if (host->h_aliases != nullptr) { + idx = 0; + while (host->h_aliases[idx]) { + free(host->h_aliases[idx++]); + } + free(host->h_aliases); + host->h_aliases = nullptr; + } + + free(host->h_name); + free(host); +} void Initialize(Local<Object> target, Local<Value> unused, @@ -2385,7 +1925,6 @@ void Initialize(Local<Object> target, env->SetConstructorFunction(target, "ChannelWrap", channel_wrap); } -} // anonymous namespace } // namespace cares_wrap } // namespace node diff --git a/src/cares_wrap.h b/src/cares_wrap.h new file mode 100644 index 00000000000000..bceafcb8b7f46b --- /dev/null +++ b/src/cares_wrap.h @@ -0,0 +1,534 @@ +#ifndef SRC_CARES_WRAP_H_ +#define SRC_CARES_WRAP_H_ + +#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#define CARES_STATICLIB + +#include "async_wrap.h" +#include "base_object.h" +#include "env.h" +#include "memory_tracker.h" +#include "util.h" +#include "node.h" + +#include "ares.h" +#include "v8.h" +#include "uv.h" + +#include <unordered_set> + +#ifdef __POSIX__ +# include <netdb.h> +#endif // __POSIX__ + +#if defined(__ANDROID__) || \ + defined(__MINGW32__) || \ + defined(__OpenBSD__) || \ + defined(_MSC_VER) + +# include <nameser.h> +#else +# include <arpa/nameser.h> +#endif + +#ifndef T_CAA +# define T_CAA 257 /* Certification Authority Authorization */ +#endif + +#if defined(__OpenBSD__) +# define AI_V4MAPPED 0 +#endif + +namespace node { +namespace cares_wrap { + +constexpr int ns_t_cname_or_a = -1; +constexpr int DNS_ESETSRVPENDING = -1000; + +class ChannelWrap; + +inline void safe_free_hostent(struct hostent* host); + +using HostEntPointer = DeleteFnPtr<hostent, ares_free_hostent>; +using SafeHostEntPointer = DeleteFnPtr<hostent, safe_free_hostent>; + +inline const char* ToErrorCodeString(int status) { + switch (status) { +#define V(code) case ARES_##code: return #code; + V(EADDRGETNETWORKPARAMS) + V(EBADFAMILY) + V(EBADFLAGS) + V(EBADHINTS) + V(EBADNAME) + V(EBADQUERY) + V(EBADRESP) + V(EBADSTR) + V(ECANCELLED) + V(ECONNREFUSED) + V(EDESTRUCTION) + V(EFILE) + V(EFORMERR) + V(ELOADIPHLPAPI) + V(ENODATA) + V(ENOMEM) + V(ENONAME) + V(ENOTFOUND) + V(ENOTIMP) + V(ENOTINITIALIZED) + V(EOF) + V(EREFUSED) + V(ESERVFAIL) + V(ETIMEOUT) +#undef V + } + + return "UNKNOWN_ARES_ERROR"; +} + +inline void cares_wrap_hostent_cpy( + struct hostent* dest, + const struct hostent* src) { + dest->h_addr_list = nullptr; + dest->h_addrtype = 0; + dest->h_aliases = nullptr; + dest->h_length = 0; + dest->h_name = nullptr; + + /* copy `h_name` */ + size_t name_size = strlen(src->h_name) + 1; + dest->h_name = node::Malloc<char>(name_size); + memcpy(dest->h_name, src->h_name, name_size); + + /* copy `h_aliases` */ + size_t alias_count; + for (alias_count = 0; + src->h_aliases[alias_count] != nullptr; + alias_count++) { + } + + dest->h_aliases = node::Malloc<char*>(alias_count + 1); + for (size_t i = 0; i < alias_count; i++) { + const size_t cur_alias_size = strlen(src->h_aliases[i]) + 1; + dest->h_aliases[i] = node::Malloc(cur_alias_size); + memcpy(dest->h_aliases[i], src->h_aliases[i], cur_alias_size); + } + dest->h_aliases[alias_count] = nullptr; + + /* copy `h_addr_list` */ + size_t list_count; + for (list_count = 0; + src->h_addr_list[list_count] != nullptr; + list_count++) { + } + + dest->h_addr_list = node::Malloc<char*>(list_count + 1); + for (size_t i = 0; i < list_count; i++) { + dest->h_addr_list[i] = node::Malloc(src->h_length); + memcpy(dest->h_addr_list[i], src->h_addr_list[i], src->h_length); + } + dest->h_addr_list[list_count] = nullptr; + + /* work after work */ + dest->h_length = src->h_length; + dest->h_addrtype = src->h_addrtype; +} + + +struct NodeAresTask final : public MemoryRetainer { + ChannelWrap* channel; + ares_socket_t sock; + uv_poll_t poll_watcher; + + inline void MemoryInfo(MemoryTracker* trakcer) const override; + SET_MEMORY_INFO_NAME(NodeAresTask); + SET_SELF_SIZE(NodeAresTask); + + struct Hash { + inline size_t operator()(NodeAresTask* a) const { + return std::hash<ares_socket_t>()(a->sock); + } + }; + + struct Equal { + inline bool operator()(NodeAresTask* a, NodeAresTask* b) const { + return a->sock == b->sock; + } + }; + + static NodeAresTask* Create(ChannelWrap* channel, ares_socket_t sock); + + using List = std::unordered_set<NodeAresTask*, Hash, Equal>; +}; + +class ChannelWrap final : public AsyncWrap { + public: + ChannelWrap(Environment* env, v8::Local<v8::Object> object, int timeout); + ~ChannelWrap() override; + + static void New(const v8::FunctionCallbackInfo<v8::Value>& args); + + void Setup(); + void EnsureServers(); + void StartTimer(); + void CloseTimer(); + + void ModifyActivityQueryCount(int count); + + inline uv_timer_t* timer_handle() { return timer_handle_; } + inline ares_channel cares_channel() { return channel_; } + inline void set_query_last_ok(bool ok) { query_last_ok_ = ok; } + inline void set_is_servers_default(bool is_default) { + is_servers_default_ = is_default; + } + inline int active_query_count() { return active_query_count_; } + inline NodeAresTask::List* task_list() { return &task_list_; } + + void MemoryInfo(MemoryTracker* tracker) const override; + SET_MEMORY_INFO_NAME(ChannelWrap) + SET_SELF_SIZE(ChannelWrap) + + static void AresTimeout(uv_timer_t* handle); + + private: + uv_timer_t* timer_handle_ = nullptr; + ares_channel channel_ = nullptr; + bool query_last_ok_ = true; + bool is_servers_default_ = true; + bool library_inited_ = false; + int timeout_; + int active_query_count_ = 0; + NodeAresTask::List task_list_; +}; + +class GetAddrInfoReqWrap final : public ReqWrap<uv_getaddrinfo_t> { + public: + GetAddrInfoReqWrap(Environment* env, + v8::Local<v8::Object> req_wrap_obj, + bool verbatim); + + SET_NO_MEMORY_INFO() + SET_MEMORY_INFO_NAME(GetAddrInfoReqWrap) + SET_SELF_SIZE(GetAddrInfoReqWrap) + + bool verbatim() const { return verbatim_; } + + private: + const bool verbatim_; +}; + +class GetNameInfoReqWrap final : public ReqWrap<uv_getnameinfo_t> { + public: + GetNameInfoReqWrap(Environment* env, v8::Local<v8::Object> req_wrap_obj); + + SET_NO_MEMORY_INFO() + SET_MEMORY_INFO_NAME(GetNameInfoReqWrap) + SET_SELF_SIZE(GetNameInfoReqWrap) +}; + +struct ResponseData final { + int status; + bool is_host; + SafeHostEntPointer host; + MallocedBuffer<unsigned char> buf; +}; + +template <typename Traits> +class QueryWrap final : public AsyncWrap { + public: + QueryWrap(ChannelWrap* channel, v8::Local<v8::Object> req_wrap_obj) + : AsyncWrap(channel->env(), req_wrap_obj, AsyncWrap::PROVIDER_QUERYWRAP), + channel_(channel), + trace_name_(Traits::name) {} + + ~QueryWrap() { + CHECK_EQ(false, persistent().IsEmpty()); + + // Let Callback() know that this object no longer exists. + if (callback_ptr_ != nullptr) + *callback_ptr_ = nullptr; + } + + int Send(const char* name) { + return Traits::Send(this, name); + } + + void AresQuery(const char* name, int dnsclass, int type) { + channel_->EnsureServers(); + TRACE_EVENT_NESTABLE_ASYNC_BEGIN1( + TRACING_CATEGORY_NODE2(dns, native), trace_name_, this, + "name", TRACE_STR_COPY(name)); + ares_query( + channel_->cares_channel(), + name, + dnsclass, + type, + Callback, + MakeCallbackPointer()); + } + + void ParseError(int status) { + CHECK_NE(status, ARES_SUCCESS); + v8::HandleScope handle_scope(env()->isolate()); + v8::Context::Scope context_scope(env()->context()); + const char* code = ToErrorCodeString(status); + v8::Local<v8::Value> arg = OneByteString(env()->isolate(), code); + TRACE_EVENT_NESTABLE_ASYNC_END1( + TRACING_CATEGORY_NODE2(dns, native), trace_name_, this, + "error", status); + MakeCallback(env()->oncomplete_string(), 1, &arg); + } + + const BaseObjectPtr<ChannelWrap>& channel() const { return channel_; } + + void AfterResponse() { + CHECK(response_data_); + + int status = response_data_->status; + + if (status != ARES_SUCCESS) + return ParseError(status); + + status = Traits::Parse(this, response_data_); + + if (status != ARES_SUCCESS) + ParseError(status); + } + + void* MakeCallbackPointer() { + CHECK_NULL(callback_ptr_); + callback_ptr_ = new QueryWrap<Traits>*(this); + return callback_ptr_; + } + + static QueryWrap<Traits>* FromCallbackPointer(void* arg) { + std::unique_ptr<QueryWrap<Traits>*> wrap_ptr { + static_cast<QueryWrap<Traits>**>(arg) + }; + QueryWrap<Traits>* wrap = *wrap_ptr.get(); + if (wrap == nullptr) return nullptr; + wrap->callback_ptr_ = nullptr; + return wrap; + } + + static void Callback( + void* arg, + int status, + int timeouts, + unsigned char* answer_buf, + int answer_len) { + QueryWrap<Traits>* wrap = FromCallbackPointer(arg); + if (wrap == nullptr) return; + + unsigned char* buf_copy = nullptr; + if (status == ARES_SUCCESS) { + buf_copy = node::Malloc<unsigned char>(answer_len); + memcpy(buf_copy, answer_buf, answer_len); + } + + wrap->response_data_ = std::make_unique<ResponseData>(); + ResponseData* data = wrap->response_data_.get(); + data->status = status; + data->is_host = false; + data->buf = MallocedBuffer<unsigned char>(buf_copy, answer_len); + + wrap->QueueResponseCallback(status); + } + + static void Callback( + void* arg, + int status, + int timeouts, + struct hostent* host) { + QueryWrap<Traits>* wrap = FromCallbackPointer(arg); + if (wrap == nullptr) return; + + struct hostent* host_copy = nullptr; + if (status == ARES_SUCCESS) { + host_copy = node::Malloc<hostent>(1); + cares_wrap_hostent_cpy(host_copy, host); + } + + wrap->response_data_ = std::make_unique<ResponseData>(); + ResponseData* data = wrap->response_data_.get(); + data->status = status; + data->host.reset(host_copy); + data->is_host = true; + + wrap->QueueResponseCallback(status); + } + + void QueueResponseCallback(int status) { + BaseObjectPtr<QueryWrap<Traits>> strong_ref{this}; + env()->SetImmediate([this, strong_ref](Environment*) { + AfterResponse(); + + // Delete once strong_ref goes out of scope. + Detach(); + }); + + channel_->set_query_last_ok(status != ARES_ECONNREFUSED); + channel_->ModifyActivityQueryCount(-1); + } + + void CallOnComplete( + v8::Local<v8::Value> answer, + v8::Local<v8::Value> extra = v8::Local<v8::Value>()) { + v8::HandleScope handle_scope(env()->isolate()); + v8::Context::Scope context_scope(env()->context()); + v8::Local<v8::Value> argv[] = { + v8::Integer::New(env()->isolate(), 0), + answer, + extra + }; + const int argc = arraysize(argv) - extra.IsEmpty(); + TRACE_EVENT_NESTABLE_ASYNC_END0( + TRACING_CATEGORY_NODE2(dns, native), trace_name_, this); + + MakeCallback(env()->oncomplete_string(), argc, argv); + } + + void MemoryInfo(MemoryTracker* tracker) const override { + tracker->TrackField("channel", channel_); + if (response_data_) { + tracker->TrackFieldWithSize("response", response_data_->buf.size); + } + } + + SET_MEMORY_INFO_NAME(QueryWrap) + SET_SELF_SIZE(QueryWrap<Traits>) + + private: + BaseObjectPtr<ChannelWrap> channel_; + + std::unique_ptr<ResponseData> response_data_; + const char* trace_name_; + // Pointer to pointer to 'this' that can be reset from the destructor, + // in order to let Callback() know that 'this' no longer exists. + QueryWrap<Traits>** callback_ptr_ = nullptr; +}; + +struct AnyTraits final { + static constexpr const char* name = "resolveAny"; + static int Send(QueryWrap<AnyTraits>* wrap, const char* name); + static int Parse( + QueryWrap<AnyTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct ATraits final { + static constexpr const char* name = "resolve4"; + static int Send(QueryWrap<ATraits>* wrap, const char* name); + static int Parse( + QueryWrap<ATraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct AaaaTraits final { + static constexpr const char* name = "resolve6"; + static int Send(QueryWrap<AaaaTraits>* wrap, const char* name); + static int Parse( + QueryWrap<AaaaTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct CaaTraits final { + static constexpr const char* name = "resolveCaa"; + static int Send(QueryWrap<CaaTraits>* wrap, const char* name); + static int Parse( + QueryWrap<CaaTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct CnameTraits final { + static constexpr const char* name = "resolveCname"; + static int Send(QueryWrap<CnameTraits>* wrap, const char* name); + static int Parse( + QueryWrap<CnameTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct MxTraits final { + static constexpr const char* name = "resolveMx"; + static int Send(QueryWrap<MxTraits>* wrap, const char* name); + static int Parse( + QueryWrap<MxTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct NsTraits final { + static constexpr const char* name = "resolveNs"; + static int Send(QueryWrap<NsTraits>* wrap, const char* name); + static int Parse( + QueryWrap<NsTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct TxtTraits final { + static constexpr const char* name = "resolveTxt"; + static int Send(QueryWrap<TxtTraits>* wrap, const char* name); + static int Parse( + QueryWrap<TxtTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct SrvTraits final { + static constexpr const char* name = "resolveSrv"; + static int Send(QueryWrap<SrvTraits>* wrap, const char* name); + static int Parse( + QueryWrap<SrvTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct PtrTraits final { + static constexpr const char* name = "resolvePtr"; + static int Send(QueryWrap<PtrTraits>* wrap, const char* name); + static int Parse( + QueryWrap<PtrTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct NaptrTraits final { + static constexpr const char* name = "resolveNaptr"; + static int Send(QueryWrap<NaptrTraits>* wrap, const char* name); + static int Parse( + QueryWrap<NaptrTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct SoaTraits final { + static constexpr const char* name = "resolveSoa"; + static int Send(QueryWrap<SoaTraits>* wrap, const char* name); + static int Parse( + QueryWrap<SoaTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +struct ReverseTraits final { + static constexpr const char* name = "reverse"; + static int Send(QueryWrap<ReverseTraits>* wrap, const char* name); + static int Parse( + QueryWrap<ReverseTraits>* wrap, + const std::unique_ptr<ResponseData>& response); +}; + +using QueryAnyWrap = QueryWrap<AnyTraits>; +using QueryAWrap = QueryWrap<ATraits>; +using QueryAaaaWrap = QueryWrap<AaaaTraits>; +using QueryCaaWrap = QueryWrap<CaaTraits>; +using QueryCnameWrap = QueryWrap<CnameTraits>; +using QueryMxWrap = QueryWrap<MxTraits>; +using QueryNsWrap = QueryWrap<NsTraits>; +using QueryTxtWrap = QueryWrap<TxtTraits>; +using QuerySrvWrap = QueryWrap<SrvTraits>; +using QueryPtrWrap = QueryWrap<PtrTraits>; +using QueryNaptrWrap = QueryWrap<NaptrTraits>; +using QuerySoaWrap = QueryWrap<SoaTraits>; +using GetHostByAddrWrap = QueryWrap<ReverseTraits>; + +} // namespace cares_wrap +} // namespace node + +#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS + +#endif // SRC_CARES_WRAP_H_ diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc index b15795b691ea0b..5ce466582823ae 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc @@ -511,10 +511,10 @@ bool CipherBase::InitAuthenticated( if (mode == EVP_CIPH_GCM_MODE) { if (auth_tag_len != kNoAuthTagLength) { if (!IsValidGCMTagLength(auth_tag_len)) { - char msg[50]; - snprintf(msg, sizeof(msg), - "Invalid authentication tag length: %u", auth_tag_len); - THROW_ERR_CRYPTO_INVALID_AUTH_TAG(env(), msg); + THROW_ERR_CRYPTO_INVALID_AUTH_TAG( + env(), + "Invalid authentication tag length: %u", + auth_tag_len); return false; } @@ -523,9 +523,8 @@ bool CipherBase::InitAuthenticated( } } else { if (auth_tag_len == kNoAuthTagLength) { - char msg[128]; - snprintf(msg, sizeof(msg), "authTagLength required for %s", cipher_type); - THROW_ERR_CRYPTO_INVALID_AUTH_TAG(env(), msg); + THROW_ERR_CRYPTO_INVALID_AUTH_TAG( + env(), "authTagLength required for %s", cipher_type); return false; } @@ -633,10 +632,8 @@ void CipherBase::SetAuthTag(const FunctionCallbackInfo<Value>& args) { } if (!is_valid) { - char msg[50]; - snprintf(msg, sizeof(msg), - "Invalid authentication tag length: %u", tag_len); - return THROW_ERR_CRYPTO_INVALID_AUTH_TAG(env, msg); + return THROW_ERR_CRYPTO_INVALID_AUTH_TAG( + env, "Invalid authentication tag length: %u", tag_len); } cipher->auth_tag_len_ = tag_len; diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc index 1b863a1241edb3..f4b7bd3ad8548a 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc @@ -480,8 +480,16 @@ MaybeLocal<Object> GetLastIssuedCert( return MaybeLocal<Object>(); issuer_chain = ca_info; + // Take the value of cert->get() before the call to cert->reset() + // in order to compare it to ca after and provide a way to exit this loop + // in case it gets stuck. + X509* value_before_reset = cert->get(); + // Delete previous cert and continue aggregating issuers. cert->reset(ca); + + if (value_before_reset == ca) + break; } return MaybeLocal<Object>(issuer_chain); } diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc index 6ee8cf7e18c02e..271db427fa8539 100644 --- a/src/crypto/crypto_dsa.cc +++ b/src/crypto/crypto_dsa.cc @@ -84,9 +84,7 @@ Maybe<bool> DsaKeyGenTraits::AdditionalConfig( params->params.modulus_bits = args[*offset].As<Uint32>()->Value(); params->params.divisor_bits = args[*offset + 1].As<Int32>()->Value(); if (params->params.divisor_bits < -1) { - char msg[1024]; - snprintf(msg, sizeof(msg), "invalid value for divisor_bits"); - THROW_ERR_OUT_OF_RANGE(env, msg); + THROW_ERR_OUT_OF_RANGE(env, "invalid value for divisor_bits"); return Nothing<bool>(); } diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc index 664ffb847215af..ba2c52268a23ff 100644 --- a/src/crypto/crypto_hash.cc +++ b/src/crypto/crypto_hash.cc @@ -233,9 +233,7 @@ Maybe<bool> HashTraits::AdditionalConfig( Utf8Value digest(env->isolate(), args[offset]); params->digest = EVP_get_digestbyname(*digest); if (UNLIKELY(params->digest == nullptr)) { - char msg[1024]; - snprintf(msg, sizeof(msg), "Invalid digest: %s", *digest); - THROW_ERR_CRYPTO_INVALID_DIGEST(env); + THROW_ERR_CRYPTO_INVALID_DIGEST(env, "Invalid digest: %s", *digest); return Nothing<bool>(); } diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc index be12022bdb7f1d..21cc988cee6a18 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc @@ -515,9 +515,7 @@ std::shared_ptr<KeyObjectData> ImportJWKAsymmetricKey( return ImportJWKEcKey(env, jwk, args, offset); } - char msg[1024]; - snprintf(msg, sizeof(msg), "%s is not a supported JWK key type", kty); - THROW_ERR_CRYPTO_INVALID_JWK(env, msg); + THROW_ERR_CRYPTO_INVALID_JWK(env, "%s is not a supported JWK key type", kty); return std::shared_ptr<KeyObjectData>(); } diff --git a/src/crypto/crypto_pbkdf2.cc b/src/crypto/crypto_pbkdf2.cc index cc9a0d072ad13c..495722927ab5be 100644 --- a/src/crypto/crypto_pbkdf2.cc +++ b/src/crypto/crypto_pbkdf2.cc @@ -92,26 +92,20 @@ Maybe<bool> PBKDF2Traits::AdditionalConfig( params->iterations = args[offset + 2].As<Int32>()->Value(); if (params->iterations < 0) { - char msg[1024]; - snprintf(msg, sizeof(msg), "iterations must be <= %d", INT_MAX); - THROW_ERR_OUT_OF_RANGE(env, msg); + THROW_ERR_OUT_OF_RANGE(env, "iterations must be <= %d", INT_MAX); return Nothing<bool>(); } params->length = args[offset + 3].As<Int32>()->Value(); if (params->length < 0) { - char msg[1024]; - snprintf(msg, sizeof(msg), "length must be <= %d", INT_MAX); - THROW_ERR_OUT_OF_RANGE(env, msg); + THROW_ERR_OUT_OF_RANGE(env, "length must be <= %d", INT_MAX); return Nothing<bool>(); } Utf8Value name(args.GetIsolate(), args[offset + 4]); params->digest = EVP_get_digestbyname(*name); if (params->digest == nullptr) { - char errmsg[1024]; - snprintf(errmsg, sizeof(errmsg), "Invalid digest: %s", *name); - THROW_ERR_CRYPTO_INVALID_DIGEST(env, errmsg); + THROW_ERR_CRYPTO_INVALID_DIGEST(env, "Invalid digest: %s", *name); return Nothing<bool>(); } diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc index a77ded918ebdda..5fa91cce1a6ad2 100644 --- a/src/crypto/crypto_rsa.cc +++ b/src/crypto/crypto_rsa.cc @@ -138,9 +138,7 @@ Maybe<bool> RsaKeyGenTraits::AdditionalConfig( Utf8Value digest(env->isolate(), args[*offset]); params->params.md = EVP_get_digestbyname(*digest); if (params->params.md == nullptr) { - char msg[1024]; - snprintf(msg, sizeof(msg), "md specifies an invalid digest"); - THROW_ERR_CRYPTO_INVALID_DIGEST(env, msg); + THROW_ERR_CRYPTO_INVALID_DIGEST(env, "md specifies an invalid digest"); return Nothing<bool>(); } } @@ -150,9 +148,8 @@ Maybe<bool> RsaKeyGenTraits::AdditionalConfig( Utf8Value digest(env->isolate(), args[*offset + 1]); params->params.mgf1_md = EVP_get_digestbyname(*digest); if (params->params.mgf1_md == nullptr) { - char msg[1024]; - snprintf(msg, sizeof(msg), "mgf1_md specifies an invalid digest"); - THROW_ERR_CRYPTO_INVALID_DIGEST(env, msg); + THROW_ERR_CRYPTO_INVALID_DIGEST(env, + "mgf1_md specifies an invalid digest"); return Nothing<bool>(); } } @@ -161,9 +158,9 @@ Maybe<bool> RsaKeyGenTraits::AdditionalConfig( CHECK(args[*offset + 2]->IsInt32()); params->params.saltlen = args[*offset + 2].As<Int32>()->Value(); if (params->params.saltlen < 0) { - char msg[1024]; - snprintf(msg, sizeof(msg), "salt length is out of range"); - THROW_ERR_OUT_OF_RANGE(env, msg); + THROW_ERR_OUT_OF_RANGE( + env, + "salt length is out of range"); return Nothing<bool>(); } } diff --git a/src/crypto/crypto_scrypt.cc b/src/crypto/crypto_scrypt.cc index 39d6b3fd0d8d6a..077c26554b2f1f 100644 --- a/src/crypto/crypto_scrypt.cc +++ b/src/crypto/crypto_scrypt.cc @@ -111,9 +111,7 @@ Maybe<bool> ScryptTraits::AdditionalConfig( params->length = args[offset + 6].As<Int32>()->Value(); if (params->length < 0) { - char msg[1024]; - snprintf(msg, sizeof(msg), "length must be <= %d", INT_MAX); - THROW_ERR_OUT_OF_RANGE(env, msg); + THROW_ERR_OUT_OF_RANGE(env, "length must be <= %d", INT_MAX); return Nothing<bool>(); } @@ -151,4 +149,3 @@ bool ScryptTraits::DeriveBits( } // namespace crypto } // namespace node - diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 2226c432839e18..4b30c177bea55c 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -898,13 +898,6 @@ void Agent::ContextCreated(Local<Context> context, const ContextInfo& info) { client_->contextCreated(context, info); } -bool Agent::WillWaitForConnect() { - if (debug_options_.wait_for_connect()) return true; - if (parent_handle_) - return parent_handle_->WaitForConnect(); - return false; -} - bool Agent::IsActive() { if (client_ == nullptr) return false; diff --git a/src/inspector_agent.h b/src/inspector_agent.h index 08b8817f436286..1c8d496ba27a9e 100644 --- a/src/inspector_agent.h +++ b/src/inspector_agent.h @@ -59,8 +59,6 @@ class Agent { // --inspect command line flag) or if inspector JS API had been used. bool IsActive(); - // Option is set to wait for session connection - bool WillWaitForConnect(); // Blocks till frontend connects and sends "runIfWaitingForDebugger" void WaitForConnect(); // Blocks till all the sessions with "WaitForDisconnectOnShutdown" disconnect diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 54bcf2e9715a0a..2aeb96a17a599a 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -314,16 +314,16 @@ class RefBase : protected Finalizer, RefTracker { }; class Reference : public RefBase { + using SecondPassCallParameterRef = Reference*; + protected: template <typename... Args> - Reference(napi_env env, - v8::Local<v8::Value> value, - Args&&... args) + Reference(napi_env env, v8::Local<v8::Value> value, Args&&... args) : RefBase(env, std::forward<Args>(args)...), - _persistent(env->isolate, value) { + _persistent(env->isolate, value), + _secondPassParameter(new SecondPassCallParameterRef(this)) { if (RefCount() == 0) { - _persistent.SetWeak( - this, FinalizeCallback, v8::WeakCallbackType::kParameter); + SetWeak(); } } @@ -344,10 +344,19 @@ class Reference : public RefBase { finalize_hint); } + virtual ~Reference() { + // If the second pass callback is scheduled, it will delete the + // parameter passed to it, otherwise it will never be scheduled + // and we need to delete it here. + if (_secondPassParameter != nullptr) { + delete _secondPassParameter; + } + } + inline uint32_t Ref() { uint32_t refcount = RefBase::Ref(); if (refcount == 1) { - _persistent.ClearWeak(); + ClearWeak(); } return refcount; } @@ -356,8 +365,7 @@ class Reference : public RefBase { uint32_t old_refcount = RefCount(); uint32_t refcount = RefBase::Unref(); if (old_refcount == 1 && refcount == 0) { - _persistent.SetWeak( - this, FinalizeCallback, v8::WeakCallbackType::kParameter); + SetWeak(); } return refcount; } @@ -377,10 +385,11 @@ class Reference : public RefBase { // During env teardown, `~napi_env()` alone is responsible for finalizing. // Thus, we don't want any stray gc passes to trigger a second call to - // `Finalize()`, so let's reset the persistent here if nothing is - // keeping it alive. - if (is_env_teardown && _persistent.IsWeak()) { - _persistent.ClearWeak(); + // `RefBase::Finalize()`. ClearWeak will ensure that even if the + // gc is in progress no Finalization will be run for this Reference + // by the gc. + if (is_env_teardown) { + ClearWeak(); } // Chain up to perform the rest of the finalization. @@ -388,6 +397,35 @@ class Reference : public RefBase { } private: + // ClearWeak is marking the Reference so that the gc should not + // collect it, but it is possible that a second pass callback + // may have been scheduled already if we are in shutdown. We clear + // the secondPassParameter so that even if it has been + // secheduled no Finalization will be run. + inline void ClearWeak() { + if (!_persistent.IsEmpty()) { + _persistent.ClearWeak(); + } + if (_secondPassParameter != nullptr) { + *_secondPassParameter = nullptr; + } + } + + // Mark the reference as weak and eligible for collection + // by the gc. + inline void SetWeak() { + if (_secondPassParameter == nullptr) { + // This means that the Reference has already been processed + // by the second pass calback, so its already been Finalized, do + // nothing + return; + } + _persistent.SetWeak( + _secondPassParameter, FinalizeCallback, + v8::WeakCallbackType::kParameter); + *_secondPassParameter = this; + } + // The N-API finalizer callback may make calls into the engine. V8's heap is // not in a consistent state during the weak callback, and therefore it does // not support calls back into it. However, it provides a mechanism for adding @@ -395,21 +433,47 @@ class Reference : public RefBase { // attach such a second-pass finalizer from the first pass finalizer. Thus, // we do that here to ensure that the N-API finalizer callback is free to call // into the engine. - static void FinalizeCallback(const v8::WeakCallbackInfo<Reference>& data) { - Reference* reference = data.GetParameter(); + static void FinalizeCallback( + const v8::WeakCallbackInfo<SecondPassCallParameterRef>& data) { + SecondPassCallParameterRef* parameter = data.GetParameter(); + Reference* reference = *parameter; + if (reference == nullptr) { + return; + } // The reference must be reset during the first pass. reference->_persistent.Reset(); + // Mark the parameter not delete-able until the second pass callback is + // invoked. + reference->_secondPassParameter = nullptr; data.SetSecondPassCallback(SecondPassCallback); } - static void SecondPassCallback(const v8::WeakCallbackInfo<Reference>& data) { - data.GetParameter()->Finalize(); + // Second pass callbacks are scheduled with platform tasks. At env teardown, + // the tasks may have already be scheduled and we are unable to cancel the + // second pass callback task. We have to make sure that parameter is kept + // alive until the second pass callback is been invoked. In order to do + // this and still allow our code to Finalize/delete the Reference during + // shutdown we have to use a seperately allocated parameter instead + // of a parameter within the Reference object itself. This is what + // is stored in _secondPassParameter and it is alocated in the + // constructor for the Reference. + static void SecondPassCallback( + const v8::WeakCallbackInfo<SecondPassCallParameterRef>& data) { + SecondPassCallParameterRef* parameter = data.GetParameter(); + Reference* reference = *parameter; + delete parameter; + if (reference == nullptr) { + // the reference itself has already been deleted so nothing to do + return; + } + reference->Finalize(); } bool env_teardown_finalize_started_ = false; v8impl::Persistent<v8::Value> _persistent; + SecondPassCallParameterRef* _secondPassParameter; }; enum UnwrapAction { diff --git a/src/large_pages/node_text_start.S b/src/large_pages/node_text_start.S index 3227b62464932c..d27dd39cc236f0 100644 --- a/src/large_pages/node_text_start.S +++ b/src/large_pages/node_text_start.S @@ -1,5 +1,5 @@ #if defined(__ELF__) -.section .note.GNU-stack,"",@progbits +.section .note.GNU-stack,"",%progbits #endif .text .align 0x2000 diff --git a/src/node.h b/src/node.h index 4348dfba5b2be8..066c0eadfb6b05 100644 --- a/src/node.h +++ b/src/node.h @@ -310,7 +310,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { static std::unique_ptr<MultiIsolatePlatform> Create( int thread_pool_size, - v8::TracingController* tracing_controller = nullptr); + v8::TracingController* tracing_controller = nullptr, + v8::PageAllocator* page_allocator = nullptr); }; enum IsolateSettingsFlags { diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 485e273f2fbe9e..9006c1de767533 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -303,28 +303,36 @@ MaybeLocal<Object> New(Isolate* isolate, if (!StringBytes::Size(isolate, string, enc).To(&length)) return Local<Object>(); size_t actual = 0; - char* data = nullptr; + std::unique_ptr<BackingStore> store; if (length > 0) { - data = UncheckedMalloc(length); + store = ArrayBuffer::NewBackingStore(isolate, length); - if (data == nullptr) { + if (UNLIKELY(!store)) { THROW_ERR_MEMORY_ALLOCATION_FAILED(isolate); return Local<Object>(); } - actual = StringBytes::Write(isolate, data, length, string, enc); + actual = StringBytes::Write( + isolate, + static_cast<char*>(store->Data()), + length, + string, + enc); CHECK(actual <= length); - if (actual == 0) { - free(data); - data = nullptr; - } else if (actual < length) { - data = node::Realloc(data, actual); + if (LIKELY(actual > 0)) { + if (actual < length) + store = BackingStore::Reallocate(isolate, std::move(store), actual); + Local<ArrayBuffer> buf = ArrayBuffer::New(isolate, std::move(store)); + Local<Object> obj; + if (UNLIKELY(!New(isolate, buf, 0, actual).ToLocal(&obj))) + return MaybeLocal<Object>(); + return scope.Escape(obj); } } - return scope.EscapeMaybe(New(isolate, data, actual)); + return scope.EscapeMaybe(New(isolate, 0)); } diff --git a/src/node_contextify.cc b/src/node_contextify.cc index ef88707b8982ec..23895382b33c86 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -210,7 +210,8 @@ MaybeLocal<Context> ContextifyContext::CreateV8Context( return MaybeLocal<Context>(); } - ctx->SetSecurityToken(env->context()->GetSecurityToken()); + Local<Context> context = env->context(); + ctx->SetSecurityToken(context->GetSecurityToken()); // We need to tie the lifetime of the sandbox object with the lifetime of // newly created context. We do this by making them hold references to each @@ -219,7 +220,7 @@ MaybeLocal<Context> ContextifyContext::CreateV8Context( // directly in an Object, we instead hold onto the new context's global // object instead (which then has a reference to the context). ctx->SetEmbedderData(ContextEmbedderIndex::kSandboxObject, sandbox_obj); - sandbox_obj->SetPrivate(env->context(), + sandbox_obj->SetPrivate(context, env->contextify_global_private_symbol(), ctx->Global()); @@ -394,16 +395,17 @@ void ContextifyContext::PropertySetterCallback( if (ctx->context_.IsEmpty()) return; + Local<Context> context = ctx->context(); auto attributes = PropertyAttribute::None; bool is_declared_on_global_proxy = ctx->global_proxy() - ->GetRealNamedPropertyAttributes(ctx->context(), property) + ->GetRealNamedPropertyAttributes(context, property) .To(&attributes); bool read_only = static_cast<int>(attributes) & static_cast<int>(PropertyAttribute::ReadOnly); bool is_declared_on_sandbox = ctx->sandbox() - ->GetRealNamedPropertyAttributes(ctx->context(), property) + ->GetRealNamedPropertyAttributes(context, property) .To(&attributes); read_only = read_only || (static_cast<int>(attributes) & @@ -441,7 +443,7 @@ void ContextifyContext::PropertySetterCallback( args.GetReturnValue().Set(false); } - USE(ctx->sandbox()->Set(ctx->context(), property, value)); + USE(ctx->sandbox()->Set(context, property, value)); } // static @@ -482,7 +484,7 @@ void ContextifyContext::PropertyDefinerCallback( auto attributes = PropertyAttribute::None; bool is_declared = - ctx->global_proxy()->GetRealNamedPropertyAttributes(ctx->context(), + ctx->global_proxy()->GetRealNamedPropertyAttributes(context, property) .To(&attributes); bool read_only = @@ -656,8 +658,10 @@ void ContextifyScript::Init(Environment* env, Local<Object> target) { env->SetProtoMethod(script_tmpl, "runInContext", RunInContext); env->SetProtoMethod(script_tmpl, "runInThisContext", RunInThisContext); - target->Set(env->context(), class_name, - script_tmpl->GetFunction(env->context()).ToLocalChecked()).Check(); + Local<Context> context = env->context(); + + target->Set(context, class_name, + script_tmpl->GetFunction(context).ToLocalChecked()).Check(); env->set_script_context_constructor_template(script_tmpl); } @@ -775,9 +779,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) { } contextify_script->script_.Reset(isolate, v8_script.ToLocalChecked()); + Local<Context> env_context = env->context(); if (compile_options == ScriptCompiler::kConsumeCodeCache) { args.This()->Set( - env->context(), + env_context, env->cached_data_rejected_string(), Boolean::New(isolate, source.GetCachedData()->rejected)).Check(); } else if (produce_cached_data) { @@ -789,12 +794,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) { env, reinterpret_cast<const char*>(cached_data->data), cached_data->length); - args.This()->Set(env->context(), + args.This()->Set(env_context, env->cached_data_string(), buf.ToLocalChecked()).Check(); } args.This()->Set( - env->context(), + env_context, env->cached_data_produced_string(), Boolean::New(isolate, cached_data_produced)).Check(); } @@ -884,7 +889,8 @@ void ContextifyScript::RunInContext(const FunctionCallbackInfo<Value>& args) { ContextifyContext::ContextFromContextifiedSandbox(env, sandbox); CHECK_NOT_NULL(contextify_context); - if (contextify_context->context().IsEmpty()) + Local<Context> context = contextify_context->context(); + if (context.IsEmpty()) return; TRACE_EVENT_NESTABLE_ASYNC_BEGIN0( @@ -903,7 +909,7 @@ void ContextifyScript::RunInContext(const FunctionCallbackInfo<Value>& args) { bool break_on_first_line = args[4]->IsTrue(); // Do the eval within the context - Context::Scope context_scope(contextify_context->context()); + Context::Scope context_scope(context); EvalMachine(contextify_context->env(), timeout, display_errors, diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 48f95ceb68d9c1..42e618ac30181f 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -148,8 +148,13 @@ MaybeLocal<Object> Transcode(Environment* env, *status = U_ZERO_ERROR; MaybeLocal<Object> ret; MaybeStackBuffer<char> result; - Converter to(toEncoding, "?"); + Converter to(toEncoding); Converter from(fromEncoding); + + size_t sublen = ucnv_getMinCharSize(to.conv()); + std::string sub(sublen, '?'); + to.set_subst_chars(sub.c_str()); + const uint32_t limit = source_length * to.max_char_size(); result.AllocateSufficientStorage(limit); char* target = *result; @@ -190,7 +195,12 @@ MaybeLocal<Object> TranscodeFromUcs2(Environment* env, *status = U_ZERO_ERROR; MaybeStackBuffer<UChar> sourcebuf; MaybeLocal<Object> ret; - Converter to(toEncoding, "?"); + Converter to(toEncoding); + + size_t sublen = ucnv_getMinCharSize(to.conv()); + std::string sub(sublen, '?'); + to.set_subst_chars(sub.c_str()); + const size_t length_in_chars = source_length / sizeof(UChar); CopySourceBuffer(&sourcebuf, source, source_length, length_in_chars); MaybeStackBuffer<char> destbuf(length_in_chars); diff --git a/src/node_platform.cc b/src/node_platform.cc index eb918bdd559c40..9787cbb3edc2e2 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -324,12 +324,17 @@ void PerIsolatePlatformData::DecreaseHandleCount() { } NodePlatform::NodePlatform(int thread_pool_size, - v8::TracingController* tracing_controller) { + v8::TracingController* tracing_controller, + v8::PageAllocator* page_allocator) { if (tracing_controller != nullptr) { tracing_controller_ = tracing_controller; } else { tracing_controller_ = new v8::TracingController(); } + + // V8 will default to its built in allocator if none is provided. + page_allocator_ = page_allocator; + // TODO(addaleax): It's a bit icky that we use global state here, but we can't // really do anything about it unless V8 starts exposing a way to access the // current v8::Platform instance. @@ -550,6 +555,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() { }; } +v8::PageAllocator* NodePlatform::GetPageAllocator() { + return page_allocator_; +} + template <class T> TaskQueue<T>::TaskQueue() : lock_(), tasks_available_(), tasks_drained_(), diff --git a/src/node_platform.h b/src/node_platform.h index a7139ebdcc28d2..4a05f3bba58c8e 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -138,7 +138,8 @@ class WorkerThreadsTaskRunner { class NodePlatform : public MultiIsolatePlatform { public: NodePlatform(int thread_pool_size, - v8::TracingController* tracing_controller); + v8::TracingController* tracing_controller, + v8::PageAllocator* page_allocator = nullptr); ~NodePlatform() override; void DrainTasks(v8::Isolate* isolate) override; @@ -170,6 +171,7 @@ class NodePlatform : public MultiIsolatePlatform { v8::Isolate* isolate) override; Platform::StackTracePrinter GetStackTracePrinter() override; + v8::PageAllocator* GetPageAllocator() override; private: IsolatePlatformDelegate* ForIsolate(v8::Isolate* isolate); @@ -181,6 +183,7 @@ class NodePlatform : public MultiIsolatePlatform { std::unordered_map<v8::Isolate*, DelegatePair> per_isolate_; v8::TracingController* tracing_controller_; + v8::PageAllocator* page_allocator_; std::shared_ptr<WorkerThreadsTaskRunner> worker_thread_task_runner_; bool has_shut_down_ = false; }; diff --git a/src/node_report.cc b/src/node_report.cc index 13f87b1e52e5d6..0144d22c17d13b 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -39,10 +39,15 @@ using node::TIME_TYPE; using node::worker::Worker; using v8::Array; using v8::Context; +using v8::HandleScope; using v8::HeapSpaceStatistics; using v8::HeapStatistics; using v8::Isolate; +using v8::Just; using v8::Local; +using v8::Maybe; +using v8::MaybeLocal; +using v8::Nothing; using v8::Object; using v8::String; using v8::TryCatch; @@ -58,16 +63,16 @@ static void WriteNodeReport(Isolate* isolate, const char* trigger, const std::string& filename, std::ostream& out, - Local<Object> error, + Local<Value> error, bool compact); static void PrintVersionInformation(JSONWriter* writer); static void PrintJavaScriptErrorStack(JSONWriter* writer, Isolate* isolate, - Local<Object> error, + Local<Value> error, const char* trigger); static void PrintJavaScriptErrorProperties(JSONWriter* writer, Isolate* isolate, - Local<Object> error); + Local<Value> error); static void PrintNativeStack(JSONWriter* writer); static void PrintResourceUsage(JSONWriter* writer); static void PrintGCStatistics(JSONWriter* writer, Isolate* isolate); @@ -84,7 +89,7 @@ std::string TriggerNodeReport(Isolate* isolate, const char* message, const char* trigger, const std::string& name, - Local<Object> error) { + Local<Value> error) { std::string filename; // Determine the required report filename. In order of priority: @@ -169,7 +174,7 @@ void GetNodeReport(Isolate* isolate, Environment* env, const char* message, const char* trigger, - Local<Object> error, + Local<Value> error, std::ostream& out) { WriteNodeReport(isolate, env, message, trigger, "", out, error, false); } @@ -182,7 +187,7 @@ static void WriteNodeReport(Isolate* isolate, const char* trigger, const std::string& filename, std::ostream& out, - Local<Object> error, + Local<Value> error, bool compact) { // Obtain the current time and the pid. TIME_TYPE tm_struct; @@ -474,13 +479,14 @@ static void PrintNetworkInterfaceInfo(JSONWriter* writer) { static void PrintJavaScriptErrorProperties(JSONWriter* writer, Isolate* isolate, - Local<Object> error) { + Local<Value> error) { writer->json_objectstart("errorProperties"); - if (!error.IsEmpty()) { + if (!error.IsEmpty() && error->IsObject()) { TryCatch try_catch(isolate); - Local<Context> context = error->GetIsolate()->GetCurrentContext(); + Local<Object> error_obj = error.As<Object>(); + Local<Context> context = error_obj->GetIsolate()->GetCurrentContext(); Local<Array> keys; - if (!error->GetOwnPropertyNames(context).ToLocal(&keys)) { + if (!error_obj->GetOwnPropertyNames(context).ToLocal(&keys)) { return writer->json_objectend(); // the end of 'errorProperties' } uint32_t keys_length = keys->Length(); @@ -491,7 +497,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer, } Local<Value> value; Local<String> value_string; - if (!error->Get(context, key).ToLocal(&value) || + if (!error_obj->Get(context, key).ToLocal(&value) || !value->ToString(context).ToLocal(&value_string)) { continue; } @@ -505,26 +511,50 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer, writer->json_objectend(); // the end of 'errorProperties' } +static Maybe<std::string> ErrorToString(Isolate* isolate, + Local<Context> context, + Local<Value> error) { + if (error.IsEmpty()) { + return Nothing<std::string>(); + } + + MaybeLocal<String> maybe_str; + // `ToString` is not available to Symbols. + if (error->IsSymbol()) { + maybe_str = error.As<v8::Symbol>()->ToDetailString(context); + } else if (!error->IsObject()) { + maybe_str = error->ToString(context); + } else if (error->IsObject()) { + MaybeLocal<Value> stack = error.As<Object>()->Get( + context, node::FIXED_ONE_BYTE_STRING(isolate, "stack")); + if (!stack.IsEmpty() && stack.ToLocalChecked()->IsString()) { + maybe_str = stack.ToLocalChecked().As<String>(); + } + } + + Local<String> js_str; + if (!maybe_str.ToLocal(&js_str)) { + return Nothing<std::string>(); + } + String::Utf8Value sv(isolate, js_str); + return Just<>(std::string(*sv, sv.length())); +} + // Report the JavaScript stack. static void PrintJavaScriptErrorStack(JSONWriter* writer, - Isolate* isolate, - Local<Object> error, - const char* trigger) { - Local<Value> stackstr; - std::string ss = ""; + Isolate* isolate, + Local<Value> error, + const char* trigger) { TryCatch try_catch(isolate); + HandleScope scope(isolate); + Local<Context> context = isolate->GetCurrentContext(); + std::string ss = ""; if ((!strcmp(trigger, "FatalError")) || - (!strcmp(trigger, "Signal"))) { + (!strcmp(trigger, "Signal")) || + (!ErrorToString(isolate, context, error).To(&ss))) { ss = "No stack.\nUnavailable.\n"; - } else if (!error.IsEmpty() && - error - ->Get(isolate->GetCurrentContext(), - node::FIXED_ONE_BYTE_STRING(isolate, - "stack")) - .ToLocal(&stackstr)) { - String::Utf8Value sv(isolate, stackstr); - ss = std::string(*sv, sv.length()); } + int line = ss.find('\n'); if (line == -1) { writer->json_keyvalue("message", ss); diff --git a/src/node_report.h b/src/node_report.h index f4992f220221ed..a8292eb2dd477d 100644 --- a/src/node_report.h +++ b/src/node_report.h @@ -20,12 +20,12 @@ std::string TriggerNodeReport(v8::Isolate* isolate, const char* message, const char* trigger, const std::string& name, - v8::Local<v8::Object> error); + v8::Local<v8::Value> error); void GetNodeReport(v8::Isolate* isolate, node::Environment* env, const char* message, const char* trigger, - v8::Local<v8::Object> error, + v8::Local<v8::Value> error, std::ostream& out); // Function declarations - utility functions in src/node_report_utils.cc diff --git a/src/node_report_module.cc b/src/node_report_module.cc index 97c6bea3ad5ec5..190755a85b2369 100644 --- a/src/node_report_module.cc +++ b/src/node_report_module.cc @@ -32,7 +32,7 @@ void WriteReport(const FunctionCallbackInfo<Value>& info) { Isolate* isolate = env->isolate(); HandleScope scope(isolate); std::string filename; - Local<Object> error; + Local<Value> error; CHECK_EQ(info.Length(), 4); String::Utf8Value message(isolate, info[0].As<String>()); @@ -40,10 +40,10 @@ void WriteReport(const FunctionCallbackInfo<Value>& info) { if (info[2]->IsString()) filename = *String::Utf8Value(isolate, info[2]); - if (!info[3].IsEmpty() && info[3]->IsObject()) - error = info[3].As<Object>(); + if (!info[3].IsEmpty()) + error = info[3]; else - error = Local<Object>(); + error = Local<Value>(); filename = TriggerNodeReport( isolate, env, *message, *trigger, filename, error); diff --git a/src/node_version.h b/src/node_version.h index 4242b4367edcd9..c01a6450eb0e25 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -22,7 +22,7 @@ #ifndef SRC_NODE_VERSION_H_ #define SRC_NODE_VERSION_H_ -#define NODE_MAJOR_VERSION 16 +#define NODE_MAJOR_VERSION 17 #define NODE_MINOR_VERSION 0 #define NODE_PATCH_VERSION 0 diff --git a/test/README.md b/test/README.md index 834af7dc5896a2..e535605080199a 100644 --- a/test/README.md +++ b/test/README.md @@ -15,7 +15,7 @@ For the tests to run on Windows, be sure to clone Node.js source code with the | Directory | Runs on CI | Purpose | | ---------------- | ---------- | --------------- | -| `abort` | Yes | Tests for when the `--abort-on-uncaught-exception` flag is used. | +| `abort` | Yes | Tests that use `--abort-on-uncaught-exception` and other situations where we want to test something but avoid generating a core file. | | `addons` | Yes | Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon. | | `async-hooks` | Yes | Tests for [async_hooks](https://nodejs.org/api/async_hooks.html) functionality. | | `benchmark` | Yes | Test minimal functionality of benchmarks. | @@ -25,6 +25,7 @@ For the tests to run on Windows, be sure to clone Node.js source code with the | `doctool` | Yes | Tests for the documentation generator. | | `es-module` | Yes | Test ESM module loading. | | `fixtures` | | Test fixtures used in various tests throughout the test suite. | +| `inspector-cli` | Yes | Tests for `node inspect` | | `internet` | No | Tests that make real outbound network connections. Tests for networking related modules may also be present in other directories, but those tests do not make outbound connections. | | `js-native-api` | Yes | Tests for Node.js-agnostic [n-api](https://nodejs.org/api/n-api.html) functionality. | | `known_issues` | Yes | Tests reproducing known issues within the system. All tests inside of this directory are expected to fail. If a test doesn't fail on certain platforms, those should be skipped via `known_issues.status`. | diff --git a/test/pummel/test-abort-fatal-error.js b/test/abort/test-abort-fatal-error.js similarity index 100% rename from test/pummel/test-abort-fatal-error.js rename to test/abort/test-abort-fatal-error.js diff --git a/test/common/README.md b/test/common/README.md index 2f2ee17a0f01e4..9929cd39144add 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -16,6 +16,7 @@ This directory contains modules used to test the Node.js implementation. * [Heap dump checker module](#heap-dump-checker-module) * [hijackstdio module](#hijackstdio-module) * [HTTP2 module](#http2-module) +* [Inspector CLI module](#inspector-cli-module) * [Internet module](#internet-module) * [ongc module](#ongc-module) * [Report module](#report-module) @@ -370,10 +371,12 @@ const { spawn } = require('child_process'); spawn(...common.pwdCommand, { stdio: ['pipe'] }); ``` -### `requireNoPackageJSONAbove()` +### `requireNoPackageJSONAbove([dir])` -Throws an `AssertionError` if a `package.json` file is in any ancestor -directory. Such files may interfere with proper test functionality. +* `dir` [<string>][] default = \_\_dirname + +Throws an `AssertionError` if a `package.json` file exists in any ancestor +directory above `dir`. Such files may interfere with proper test functionality. ### `runWithInvalidFD(func)` @@ -821,6 +824,34 @@ upon initial establishment of a connection. socket.write(http2.kClientMagic); ``` +## Inspector CLI module + +Provides common functionality for tests for `node inspect`. + +### `startCLI(args[[, flags], spawnOpts])` + +* `args` [<string>][] +* `flags` [<string>][] default = [] +* `showOpts` [<Object>][] default = {} +* return [<Object>][] + +Returns a null-prototype object with properties that are functions and getters +used to interact with the `node inspect` CLI. These functions are: + +* `flushOutput()` +* `waitFor()` +* `waitForPrompt()` +* `waitForInitialBreak()` +* `breakInfo` +* `ctrlC()` +* `output` +* `rawOutput` +* `parseSourceLines()` +* `writeLine()` +* `command()` +* `stepCommand()` +* `quit()` + ## Internet Module The `common/internet` module provides utilities for working with diff --git a/test/common/index.js b/test/common/index.js index f0d8c72d4a1017..d67baa5caf0ad1 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -387,10 +387,28 @@ function _mustCallInner(fn, criteria = 1, field) { mustCallChecks.push(context); - return function() { + const _return = function() { // eslint-disable-line func-style context.actual++; return fn.apply(this, arguments); }; + // Function instances have own properties that may be relevant. + // Let's replicate those properties to the returned function. + // Refs: https://tc39.es/ecma262/#sec-function-instances + Object.defineProperties(_return, { + name: { + value: fn.name, + writable: false, + enumerable: false, + configurable: true, + }, + length: { + value: fn.length, + writable: false, + enumerable: false, + configurable: true, + }, + }); + return _return; } function hasMultiLocalhost() { @@ -708,8 +726,8 @@ function gcUntil(name, condition) { }); } -function requireNoPackageJSONAbove() { - let possiblePackage = path.join(__dirname, '..', 'package.json'); +function requireNoPackageJSONAbove(dir = __dirname) { + let possiblePackage = path.join(dir, '..', 'package.json'); let lastPackage = null; while (possiblePackage !== lastPackage) { if (fs.existsSync(possiblePackage)) { diff --git a/deps/node-inspect/test/cli/start-cli.js b/test/common/inspector-cli.js similarity index 67% rename from deps/node-inspect/test/cli/start-cli.js rename to test/common/inspector-cli.js index 32c666c7647c68..36d6328dcc9b39 100644 --- a/deps/node-inspect/test/cli/start-cli.js +++ b/test/common/inspector-cli.js @@ -1,42 +1,33 @@ 'use strict'; +const common = require('../common'); const spawn = require('child_process').spawn; -// This allows us to keep the helper inside of `test/` without tap warning -// about "pending" test files. -const tap = require('tap'); -tap.test('startCLI', (t) => t.end()); - -const CLI = - process.env.USE_EMBEDDED_NODE_INSPECT === '1' ? - 'inspect' : - require.resolve('../../cli.js'); - const BREAK_MESSAGE = new RegExp('(?:' + [ 'assert', 'break', 'break on start', 'debugCommand', 'exception', 'other', 'promiseRejection', ].join('|') + ') in', 'i'); +const TIMEOUT = common.platformTimeout(5000); + function isPreBreak(output) { return /Break on start/.test(output) && /1 \(function \(exports/.test(output); } function startCLI(args, flags = [], spawnOpts = {}) { - const child = spawn(process.execPath, [...flags, CLI, ...args], spawnOpts); - let isFirstStdoutChunk = true; + let stderrOutput = ''; + const child = + spawn(process.execPath, [...flags, 'inspect', ...args], spawnOpts); const outputBuffer = []; function bufferOutput(chunk) { - if (isFirstStdoutChunk) { - isFirstStdoutChunk = false; - outputBuffer.push(chunk.replace(/^debug>\s*/, '')); - } else { - outputBuffer.push(chunk); + if (this === child.stderr) { + stderrOutput += chunk; } + outputBuffer.push(chunk); } function getOutput() { - return outputBuffer.join('').toString() - .replace(/^[^\n]*?[\b]/mg, ''); + return outputBuffer.join('\n').replaceAll('\b', ''); } child.stdout.setEncoding('utf8'); @@ -45,7 +36,7 @@ function startCLI(args, flags = [], spawnOpts = {}) { child.stderr.on('data', bufferOutput); if (process.env.VERBOSE === '1') { - child.stdout.pipe(process.stderr); + child.stdout.pipe(process.stdout); child.stderr.pipe(process.stderr); } @@ -56,7 +47,7 @@ function startCLI(args, flags = [], spawnOpts = {}) { return output; }, - waitFor(pattern, timeout = 2000) { + waitFor(pattern) { function checkPattern(str) { if (Array.isArray(pattern)) { return pattern.every((p) => p.test(str)); @@ -67,47 +58,57 @@ function startCLI(args, flags = [], spawnOpts = {}) { return new Promise((resolve, reject) => { function checkOutput() { if (checkPattern(getOutput())) { - tearDown(); // eslint-disable-line no-use-before-define + tearDown(); resolve(); } } - function onChildExit() { - tearDown(); // eslint-disable-line no-use-before-define - reject(new Error( - `Child quit while waiting for ${pattern}; found: ${this.output}`)); + function onChildClose(code, signal) { + tearDown(); + let message = 'Child exited'; + if (code) { + message += `, code ${code}`; + } + if (signal) { + message += `, signal ${signal}`; + } + message += ` while waiting for ${pattern}; found: ${this.output}`; + if (stderrOutput) { + message += `\n STDERR: ${stderrOutput}`; + } + reject(new Error(message)); } const timer = setTimeout(() => { - tearDown(); // eslint-disable-line no-use-before-define + tearDown(); reject(new Error([ - `Timeout (${timeout}) while waiting for ${pattern}`, + `Timeout (${TIMEOUT}) while waiting for ${pattern}`, `found: ${this.output}`, ].join('; '))); - }, timeout); + }, TIMEOUT); function tearDown() { clearTimeout(timer); child.stdout.removeListener('data', checkOutput); - child.removeListener('exit', onChildExit); + child.removeListener('close', onChildClose); } - child.on('exit', onChildExit); + child.on('close', onChildClose); child.stdout.on('data', checkOutput); checkOutput(); }); }, - waitForPrompt(timeout = 2000) { - return this.waitFor(/>\s+$/, timeout); + waitForPrompt() { + return this.waitFor(/>\s+$/); }, - waitForInitialBreak(timeout = 2000) { - return this.waitFor(/break (?:on start )?in/i, timeout) + waitForInitialBreak() { + return this.waitFor(/break (?:on start )?in/i) .then(() => { if (isPreBreak(this.output)) { return this.command('next', false) - .then(() => this.waitFor(/break in/, timeout)); + .then(() => this.waitFor(/break in/)); } }); }, @@ -169,7 +170,7 @@ function startCLI(args, flags = [], spawnOpts = {}) { quit() { return new Promise((resolve) => { child.stdin.end(); - child.on('exit', resolve); + child.on('close', resolve); }); }, }; diff --git a/test/common/internet.js b/test/common/internet.js index d7ef6af90533cd..accea74969e276 100644 --- a/test/common/internet.js +++ b/test/common/internet.js @@ -22,6 +22,9 @@ const addresses = { INVALID_HOST: 'something.invalid', // A host with MX records registered MX_HOST: 'nodejs.org', + // On some systems, .invalid returns a server failure/try again rather than + // record not found. Use this to guarantee record not found. + NOT_FOUND: 'come.on.fhqwhgads.test', // A host with SRV records registered SRV_HOST: '_jabber._tcp.google.com', // A host with PTR records registered diff --git a/test/fixtures/es-modules/cjs-exports.mjs b/test/fixtures/es-modules/cjs-exports.mjs index ac6f60e6aa9dc1..6001ce06364454 100644 --- a/test/fixtures/es-modules/cjs-exports.mjs +++ b/test/fixtures/es-modules/cjs-exports.mjs @@ -3,11 +3,14 @@ import { strictEqual, deepEqual } from 'assert'; import m, { π } from './exports-cases.js'; import * as ns from './exports-cases.js'; -deepEqual(Object.keys(ns), ['default', 'isObject', 'z', 'π']); +deepEqual(Object.keys(ns), ['?invalid', 'default', 'invalid identifier', 'isObject', 'package', 'z', 'π', '\u{d83c}\u{df10}']); strictEqual(π, 'yes'); strictEqual(typeof m.isObject, 'undefined'); strictEqual(m.π, 'yes'); strictEqual(m.z, 'yes'); +strictEqual(m.package, 10); +strictEqual(m['invalid identifier'], 'yes'); +strictEqual(m['?invalid'], 'yes'); import m2, { __esModule as __esModule2, name as name2 } from './exports-cases2.js'; import * as ns2 from './exports-cases2.js'; diff --git a/test/fixtures/es-modules/exports-cases.js b/test/fixtures/es-modules/exports-cases.js index eec3d31bc7290c..94bbde74d1d40e 100644 --- a/test/fixtures/es-modules/exports-cases.js +++ b/test/fixtures/es-modules/exports-cases.js @@ -1,7 +1,9 @@ if (global.maybe) module.exports = require('../is-object'); -exports['invalid identifier'] = 'no'; -module.exports['?invalid'] = 'no'; +exports['invalid identifier'] = 'yes'; +module.exports['?invalid'] = 'yes'; module.exports['π'] = 'yes'; -exports.package = 10; // reserved word -> not used +exports['\u{D83C}'] = 'no'; +exports['\u{D83C}\u{DF10}'] = 'yes'; +exports.package = 10; // reserved word Object.defineProperty(exports, 'z', { value: 'yes' }); diff --git a/deps/node-inspect/examples/alive.js b/test/fixtures/inspector-cli/alive.js similarity index 100% rename from deps/node-inspect/examples/alive.js rename to test/fixtures/inspector-cli/alive.js diff --git a/deps/node-inspect/examples/backtrace.js b/test/fixtures/inspector-cli/backtrace.js similarity index 100% rename from deps/node-inspect/examples/backtrace.js rename to test/fixtures/inspector-cli/backtrace.js diff --git a/deps/node-inspect/examples/break.js b/test/fixtures/inspector-cli/break.js similarity index 100% rename from deps/node-inspect/examples/break.js rename to test/fixtures/inspector-cli/break.js diff --git a/deps/node-inspect/examples/cjs/index.js b/test/fixtures/inspector-cli/cjs/index.js similarity index 100% rename from deps/node-inspect/examples/cjs/index.js rename to test/fixtures/inspector-cli/cjs/index.js diff --git a/deps/node-inspect/examples/cjs/other.js b/test/fixtures/inspector-cli/cjs/other.js similarity index 100% rename from deps/node-inspect/examples/cjs/other.js rename to test/fixtures/inspector-cli/cjs/other.js diff --git a/deps/node-inspect/examples/empty.js b/test/fixtures/inspector-cli/empty.js similarity index 100% rename from deps/node-inspect/examples/empty.js rename to test/fixtures/inspector-cli/empty.js diff --git a/deps/node-inspect/examples/exceptions.js b/test/fixtures/inspector-cli/exceptions.js similarity index 100% rename from deps/node-inspect/examples/exceptions.js rename to test/fixtures/inspector-cli/exceptions.js diff --git a/deps/node-inspect/examples/three-lines.js b/test/fixtures/inspector-cli/three-lines.js similarity index 100% rename from deps/node-inspect/examples/three-lines.js rename to test/fixtures/inspector-cli/three-lines.js diff --git a/deps/node-inspect/examples/use-strict.js b/test/fixtures/inspector-cli/use-strict.js similarity index 100% rename from deps/node-inspect/examples/use-strict.js rename to test/fixtures/inspector-cli/use-strict.js diff --git a/test/fixtures/keys/selfsigned-no-keycertsign/README.md b/test/fixtures/keys/selfsigned-no-keycertsign/README.md new file mode 100644 index 00000000000000..0dcd69007a9142 --- /dev/null +++ b/test/fixtures/keys/selfsigned-no-keycertsign/README.md @@ -0,0 +1,2 @@ +# Self-signed certificate without keyCertSign bit +The self-signed certificate ([cert.pem](./cert.pem)) and the key ([key.pem](./key.pem)) in this folder are used by the test [test-https-selfsigned-no-keycertsign-no-crash](../../../parallel/test-https-selfsigned-no-keycertsign-no-crash.js). The config ([cert.conf](./cert.conf)) and the file used to generate key and certificate in this folder ([https-renew-cert.sh](./https_renew_cert.sh)) are not used by the test but for reference. diff --git a/test/fixtures/keys/selfsigned-no-keycertsign/cert.conf b/test/fixtures/keys/selfsigned-no-keycertsign/cert.conf new file mode 100644 index 00000000000000..60901bb26d6937 --- /dev/null +++ b/test/fixtures/keys/selfsigned-no-keycertsign/cert.conf @@ -0,0 +1,17 @@ +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +C = DE +CN = localhost + +[v3_req] +keyUsage = digitalSignature, keyEncipherment +extendedKeyUsage = serverAuth +subjectAltName = @alt_names +[alt_names] +DNS.1 = 127.0.0.1 +DNS.2 = localhost +IP.1 = 127.0.0.1 diff --git a/test/fixtures/keys/selfsigned-no-keycertsign/cert.pem b/test/fixtures/keys/selfsigned-no-keycertsign/cert.pem new file mode 100644 index 00000000000000..c0829b82caf8d3 --- /dev/null +++ b/test/fixtures/keys/selfsigned-no-keycertsign/cert.pem @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIC9jCCAd6gAwIBAgIJANHflGRpZM1IMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV +BAMMCWxvY2FsaG9zdDAeFw0yMTAzMTUwOTEzMjdaFw0yMjAzMTUwOTEzMjdaMBQx +EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBANMt6TLw9gIxucRgZBn8owavEIMAddxMTjkHiR7jGfaBrvvVTB8ymsIizw/Q +KTANmu2r3EOqeR9Ht25KZFKxOKCDMd3aKHht38HInXIF6CQe8c5P0xsVKZAWkell +8ohL05EsFpcrJODIdHfaovODrtX8w1WexqDsUoPQdEk7pISJ2HhmXzpf7QmV00Ux +8J+64v2pTg8/C9VgpSgxE4oXlfJEqdSIAzGDT+VX96GWXTh7QqLjiQ9T96QHUJEn +Bx0Sr4rO9mY2lOQG408QuCLR/ng2J+lYx+03SC8Lq7lrtt4M06Ffr8TQRgpDAjkU +0YitbuysD5XgtCeFq0Fi3v1z700CAwEAAaNLMEkwCwYDVR0PBAQDAgWgMBMGA1Ud +JQQMMAoGCCsGAQUFBwMBMCUGA1UdEQQeMByCCTEyNy4wLjAuMYIJbG9jYWxob3N0 +hwR/AAABMA0GCSqGSIb3DQEBCwUAA4IBAQDAUCt/8Le2EO0ONOkQYUcPmSut6Siz +UIQrJ8Lwfs0fb+Zk9ElNGLwYTzooKDgzK8cLQ8g8F2WkolBEPXDsy1Ab+e66WkJH +NH/zAgEyG6cXXRNc+ObM5KbjY0YuDGiajKcndknuuCB+onlC1Pv5oFUSNa3/06+S +sziFloGbg5S0AHT6lYnwZSM6G7Pre8mcRNRxL6Yw1FOOUpQZKPd7juy4GBRlCucn +wmp/Fl0wIBDs91Vprig2TO+U6GvtqJ3n/RKXUz1ykUKETtRneSkqa6hFYjwRzawd +ANpjy/orrVkqXriAbI/1xvBMInWdcMpXNeiOkxQeQdy8TLBk0ZViSJnf +-----END CERTIFICATE----- diff --git a/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh b/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh new file mode 100644 index 00000000000000..092f27a8867cbb --- /dev/null +++ b/test/fixtures/keys/selfsigned-no-keycertsign/https_renew_cert.sh @@ -0,0 +1,6 @@ +#!/bin/bash +openssl genrsa -out rsa.pem 2048 +openssl rsa -in rsa.pem -out key.pem +openssl req -sha256 -new -key key.pem -out csr.pem -subj "/CN=localhost" +openssl x509 -req -extfile cert.conf -extensions v3_req -days 365 -in csr.pem -signkey key.pem -out cert.pem + diff --git a/test/fixtures/keys/selfsigned-no-keycertsign/key.pem b/test/fixtures/keys/selfsigned-no-keycertsign/key.pem new file mode 100644 index 00000000000000..5f0549276a4cae --- /dev/null +++ b/test/fixtures/keys/selfsigned-no-keycertsign/key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEA0y3pMvD2AjG5xGBkGfyjBq8QgwB13ExOOQeJHuMZ9oGu+9VM +HzKawiLPD9ApMA2a7avcQ6p5H0e3bkpkUrE4oIMx3dooeG3fwcidcgXoJB7xzk/T +GxUpkBaR6WXyiEvTkSwWlysk4Mh0d9qi84Ou1fzDV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jDFLHeYcZfQQKBgCCOpdjQT1/gPOsSd4FGzjYjv9wcPdjA1cY7eSJS +JoIruijfqb3G40Ay3DHVmfAR3kk7z68XqHx7Z94Fy/9Zt3ZD6ARybEC1cKChNoCS +lkYHNPMtHhC+QfZWUOhUb72x9r2nkYTAfXGisu6wOD0rZ9TatzkSGkmNPIHluJ9q +qfYpAoGAPJiBBdSt7DC9ZZraQGMEHfRkE5CxEIRbIHJ9+U3Z7LTQT6MJ1y3VfcGs +PetHcWtbU0Cl8blShaSwpxyCI01x3tUPw/b7tXMan/ImzjUgRe7kQXh2sf39V3b/ +fvzKXWBvOvc1lgG0pFgI/2xtGQQGTe74MzX5xFgw6eadRUnJeKI= +-----END RSA PRIVATE KEY----- diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 37d52a069aebc9..fef6bb0fd8c30d 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -21,7 +21,7 @@ Last update: - html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers - interfaces: https://github.com/web-platform-tests/wpt/tree/79fa4cf76e/interfaces - resources: https://github.com/web-platform-tests/wpt/tree/972ca5b669/resources -- url: https://github.com/web-platform-tests/wpt/tree/5eebfdb1f6/url +- url: https://github.com/web-platform-tests/wpt/tree/1439087f27/url [Web Platform Tests]: https://github.com/web-platform-tests/wpt [`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json index dfb226deacde13..bb156f126bf9b6 100644 --- a/test/fixtures/wpt/url/resources/urltestdata.json +++ b/test/fixtures/wpt/url/resources/urltestdata.json @@ -5945,6 +5945,120 @@ "search": "", "hash": "" }, + "# Copy the host from the base URL in the following cases", + { + "input": "C|/", + "base": "file://host/", + "href": "file://host/C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "host", + "hostname": "host", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, + { + "input": "/C:/", + "base": "file://host/", + "href": "file://host/C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "host", + "hostname": "host", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, + { + "input": "file:C:/", + "base": "file://host/", + "href": "file://host/C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "host", + "hostname": "host", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, + { + "input": "file:/C:/", + "base": "file://host/", + "href": "file://host/C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "host", + "hostname": "host", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, + "# Copy the empty host from the input in the following cases", + { + "input": "//C:/", + "base": "file://host/", + "href": "file:///C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, + { + "input": "file://C:/", + "base": "file://host/", + "href": "file:///C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, + { + "input": "///C:/", + "base": "file://host/", + "href": "file:///C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, + { + "input": "file:///C:/", + "base": "file://host/", + "href": "file:///C:/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C:/", + "search": "", + "hash": "" + }, "# Windows drive letter quirk (no host)", { "input": "file:/C|/", diff --git a/test/fixtures/wpt/url/urlsearchparams-stringifier.any.js b/test/fixtures/wpt/url/urlsearchparams-stringifier.any.js index bc7bedd533f58d..6187db64b1747d 100644 --- a/test/fixtures/wpt/url/urlsearchparams-stringifier.any.js +++ b/test/fixtures/wpt/url/urlsearchparams-stringifier.any.js @@ -133,3 +133,13 @@ test(() => { assert_equals(url.toString(), 'http://www.example.com/?a=b%2Cc&x=y'); assert_equals(params.toString(), 'a=b%2Cc&x=y'); }, 'URLSearchParams connected to URL'); + +test(() => { + const url = new URL('http://www.example.com/'); + const params = url.searchParams; + + params.append('a\nb', 'c\rd'); + params.append('e\n\rf', 'g\r\nh'); + + assert_equals(params.toString(), "a%0Ab=c%0Dd&e%0A%0Df=g%0D%0Ah"); +}, 'URLSearchParams must not do newline normalization'); diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index b637bc8a8ab344..67df1aaa931761 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -44,7 +44,7 @@ "path": "resources" }, "url": { - "commit": "5eebfdb1f68059549b3efff380dd190bc6078266", + "commit": "1439087f27135b06deb70ffbf43e65ff64ff1ee6", "path": "url" } } \ No newline at end of file diff --git a/test/inspector-cli/inspector-cli.status b/test/inspector-cli/inspector-cli.status new file mode 100644 index 00000000000000..23a6558541513a --- /dev/null +++ b/test/inspector-cli/inspector-cli.status @@ -0,0 +1,7 @@ +prefix inspector-cli + +# To mark a test as flaky, list the test name in the appropriate section +# below, without ".js", followed by ": PASS,FLAKY". Example: +# sample-test : PASS,FLAKY + +[true] # This section applies to all platforms diff --git a/deps/node-inspect/test/cli/address.test.js b/test/inspector-cli/test-inspector-cli-address.js similarity index 68% rename from deps/node-inspect/test/cli/address.test.js rename to test/inspector-cli/test-inspector-cli-address.js index 1dbe4f37b42175..89c70687c819b8 100644 --- a/deps/node-inspect/test/cli/address.test.js +++ b/test/inspector-cli/test-inspector-cli-address.js @@ -1,9 +1,13 @@ 'use strict'; -const { spawn } = require('child_process'); -const Path = require('path'); -const { test } = require('tap'); +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); -const startCLI = require('./start-cli'); +const assert = require('assert'); +const { spawn } = require('child_process'); // NOTE(oyyd): We might want to import this regexp from "lib/_inspect.js"? const kDebuggerMsgReg = /Debugger listening on ws:\/\/\[?(.+?)\]?:(\d+)\//; @@ -12,11 +16,13 @@ function launchTarget(...args) { const childProc = spawn(process.execPath, args); return new Promise((resolve, reject) => { const onExit = () => { - reject(new Error('Child process exits unexpectly')); + reject(new Error('Child process exits unexpectedly')); }; childProc.on('exit', onExit); childProc.stderr.setEncoding('utf8'); - childProc.stderr.on('data', (data) => { + let data = ''; + childProc.stderr.on('data', (chunk) => { + data += chunk; const ret = kDebuggerMsgReg.exec(data); childProc.removeListener('exit', onExit); if (ret) { @@ -30,12 +36,8 @@ function launchTarget(...args) { }); } -// process.debugPort is our proxy for "the version of node used to run this -// test suite doesn't support SIGUSR1 for enabling --inspect for a process". -const defaultsToOldProtocol = process.debugPort === 5858; - -test('examples/alive.js', { skip: defaultsToOldProtocol }, (t) => { - const script = Path.join('examples', 'alive.js'); +{ + const script = fixtures.path('inspector-cli/alive.js'); let cli = null; let target = null; @@ -48,7 +50,7 @@ test('examples/alive.js', { skip: defaultsToOldProtocol }, (t) => { target.kill(); target = null; } - if (error) throw error; + assert.ifError(error); } return launchTarget('--inspect=0', script) @@ -61,11 +63,11 @@ test('examples/alive.js', { skip: defaultsToOldProtocol }, (t) => { .then(() => cli.waitFor(/break/)) .then(() => cli.waitForPrompt()) .then(() => { - t.match( + assert.match( cli.output, - '> 3 ++x;', + /> 3 \+\+x;/, 'marks the 3rd line'); }) .then(() => cleanup()) .then(null, cleanup); -}); +} diff --git a/test/inspector-cli/test-inspector-cli-auto-resume.js b/test/inspector-cli/test-inspector-cli-auto-resume.js new file mode 100644 index 00000000000000..bd498bc536535d --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-auto-resume.js @@ -0,0 +1,36 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); +const { addLibraryPath } = require('../common/shared-lib-util'); + +const assert = require('assert'); +const path = require('path'); + +addLibraryPath(process.env); + +// Auto-resume on start if the environment variable is defined. +{ + const scriptFullPath = fixtures.path('inspector-cli', 'break.js'); + const script = path.relative(process.cwd(), scriptFullPath); + + const env = { ...process.env }; + env.NODE_INSPECT_RESUME_ON_START = '1'; + + const cli = startCLI([script], [], { env }); + + cli.waitForInitialBreak() + .then(() => { + assert.deepStrictEqual( + cli.breakInfo, + { filename: script, line: 10 }, + ); + }) + .then(() => cli.quit()) + .then((code) => { + assert.strictEqual(code, 0); + }); +} diff --git a/test/inspector-cli/test-inspector-cli-backtrace.js b/test/inspector-cli/test-inspector-cli-backtrace.js new file mode 100644 index 00000000000000..a705efe5fe4270 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-backtrace.js @@ -0,0 +1,36 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const path = require('path'); + +// Display and navigate backtrace. +{ + const scriptFullPath = fixtures.path('inspector-cli', 'backtrace.js'); + const script = path.relative(process.cwd(), scriptFullPath); + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + return cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.stepCommand('c')) + .then(() => cli.command('bt')) + .then(() => { + assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`)); + }) + .then(() => cli.command('backtrace')) + .then(() => { + assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`)); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-break.js b/test/inspector-cli/test-inspector-cli-break.js new file mode 100644 index 00000000000000..50373541854fa1 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-break.js @@ -0,0 +1,131 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const path = require('path'); + +// Stepping through breakpoints. +{ + const scriptFullPath = fixtures.path('inspector-cli', 'break.js'); + const script = path.relative(process.cwd(), scriptFullPath); + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => { + assert.deepStrictEqual( + cli.breakInfo, + { filename: script, line: 1 }, + ); + assert.match( + cli.output, + /> 1 (?:\(function \([^)]+\) \{ )?const x = 10;/, + 'shows the source and marks the current line'); + }) + .then(() => cli.stepCommand('n')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${script}:2`), + 'pauses in next line of the script'); + assert.match( + cli.output, + /> 2 let name = 'World';/, + 'marks the 2nd line'); + }) + .then(() => cli.stepCommand('next')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${script}:3`), + 'pauses in next line of the script'); + assert.match( + cli.output, + /> 3 name = 'Robin';/, + 'marks the 3nd line'); + }) + .then(() => cli.stepCommand('cont')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${script}:10`), + 'pauses on the next breakpoint'); + assert.match( + cli.output, + />10 debugger;/, + 'marks the debugger line'); + }) + + // Prepare additional breakpoints + .then(() => cli.command('sb("break.js", 6)')) + .then(() => assert.doesNotMatch(cli.output, /Could not resolve breakpoint/)) + .then(() => cli.command('sb("otherFunction()")')) + .then(() => cli.command('sb(16)')) + .then(() => assert.doesNotMatch(cli.output, /Could not resolve breakpoint/)) + .then(() => cli.command('breakpoints')) + .then(() => { + assert.ok(cli.output.includes(`#0 ${script}:6`)); + assert.ok(cli.output.includes(`#1 ${script}:16`)); + }) + + .then(() => cli.command('list()')) + .then(() => { + assert.match( + cli.output, + />10 debugger;/, + 'prints and marks current line' + ); + assert.deepStrictEqual( + cli.parseSourceLines(), + [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], + ); + }) + .then(() => cli.command('list(2)')) + .then(() => { + assert.match( + cli.output, + />10 debugger;/, + 'prints and marks current line' + ); + assert.deepStrictEqual( + cli.parseSourceLines(), + [8, 9, 10, 11, 12], + ); + }) + + .then(() => cli.stepCommand('s')) + .then(() => cli.stepCommand('')) + .then(() => { + assert.match( + cli.output, + /break in node:timers/, + 'entered timers.js'); + }) + .then(() => cli.stepCommand('cont')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${script}:16`), + 'found breakpoint we set above w/ line number only'); + }) + .then(() => cli.stepCommand('cont')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${script}:6`), + 'found breakpoint we set above w/ line number & script'); + }) + .then(() => cli.stepCommand('')) + .then(() => { + assert.ok( + cli.output.includes(`debugCommand in ${script}:14`), + 'found function breakpoint we set above'); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-clear-breakpoints.js b/test/inspector-cli/test-inspector-cli-clear-breakpoints.js new file mode 100644 index 00000000000000..f85e33280c6dfd --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-clear-breakpoints.js @@ -0,0 +1,53 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const path = require('path'); + +// clearBreakpoint +{ + const scriptFullPath = fixtures.path('inspector-cli', 'break.js'); + const script = path.relative(process.cwd(), scriptFullPath); + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + return cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('sb("break.js", 3)')) + .then(() => cli.command('sb("break.js", 9)')) + .then(() => cli.command('breakpoints')) + .then(() => { + assert.ok(cli.output.includes(`#0 ${script}:3`)); + assert.ok(cli.output.includes(`#1 ${script}:9`)); + }) + .then(() => cli.command('clearBreakpoint("break.js", 4)')) + .then(() => { + assert.match(cli.output, /Could not find breakpoint/); + }) + .then(() => cli.command('clearBreakpoint("not-such-script.js", 3)')) + .then(() => { + assert.match(cli.output, /Could not find breakpoint/); + }) + .then(() => cli.command('clearBreakpoint("break.js", 3)')) + .then(() => cli.command('breakpoints')) + .then(() => { + assert.ok(cli.output.includes(`#0 ${script}:9`)); + }) + .then(() => cli.stepCommand('cont')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${script}:9`), + 'hits the 2nd breakpoint because the 1st was cleared'); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-custom-port.js b/test/inspector-cli/test-inspector-cli-custom-port.js new file mode 100644 index 00000000000000..4b788a6488169a --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-custom-port.js @@ -0,0 +1,30 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +// Custom port. +{ + const script = fixtures.path('inspector-cli', 'three-lines.js'); + + const cli = startCLI([`--port=${common.PORT}`, script]); + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => { + assert.match(cli.output, /debug>/, 'prints a prompt'); + assert.match( + cli.output, + new RegExp(`< Debugger listening on [^\n]*${common.PORT}`), + 'forwards child output'); + }) + .then(() => cli.quit()) + .then((code) => { + assert.strictEqual(code, 0); + }); +} diff --git a/deps/node-inspect/test/cli/exceptions.test.js b/test/inspector-cli/test-inspector-cli-exceptions.js similarity index 55% rename from deps/node-inspect/test/cli/exceptions.test.js rename to test/inspector-cli/test-inspector-cli-exceptions.js index 69d42d0a25bb1a..324f6f6bde2bf2 100644 --- a/deps/node-inspect/test/cli/exceptions.test.js +++ b/test/inspector-cli/test-inspector-cli-exceptions.js @@ -1,12 +1,18 @@ 'use strict'; -const Path = require('path'); +const common = require('../common'); -const { test } = require('tap'); +common.skipIfInspectorDisabled(); -const startCLI = require('./start-cli'); +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); -test('break on (uncaught) exceptions', (t) => { - const script = Path.join('examples', 'exceptions.js'); +const assert = require('assert'); +const path = require('path'); + +// Break on (uncaught) exceptions. +{ + const scriptFullPath = fixtures.path('inspector-cli', 'exceptions.js'); + const script = path.relative(process.cwd(), scriptFullPath); const cli = startCLI([script]); function onFatal(error) { @@ -14,42 +20,42 @@ test('break on (uncaught) exceptions', (t) => { throw error; } - return cli.waitForInitialBreak() + cli.waitForInitialBreak() .then(() => cli.waitForPrompt()) .then(() => { - t.match(cli.breakInfo, { filename: script, line: 1 }); + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 1 }); }) - // making sure it will die by default: + // Making sure it will die by default: .then(() => cli.command('c')) - // TODO: Remove FATAL ERROR once node doesn't show a FATAL ERROR anymore + // TODO: Remove FATAL ERROR once node doesn't show a FATAL ERROR anymore. .then(() => cli.waitFor(/disconnect|FATAL ERROR/)) - // Next run: With `breakOnException` it pauses in both places + // Next run: With `breakOnException` it pauses in both places. .then(() => cli.stepCommand('r')) .then(() => cli.waitForInitialBreak()) .then(() => { - t.match(cli.breakInfo, { filename: script, line: 1 }); + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 1 }); }) .then(() => cli.command('breakOnException')) .then(() => cli.stepCommand('c')) .then(() => { - t.match(cli.output, `exception in ${script}:3`); + assert.ok(cli.output.includes(`exception in ${script}:3`)); }) .then(() => cli.stepCommand('c')) .then(() => { - t.match(cli.output, `exception in ${script}:9`); + assert.ok(cli.output.includes(`exception in ${script}:9`)); }) - // Next run: With `breakOnUncaught` it only pauses on the 2nd exception + // Next run: With `breakOnUncaught` it only pauses on the 2nd exception. .then(() => cli.command('breakOnUncaught')) - .then(() => cli.stepCommand('r')) // also, the setting survives the restart + .then(() => cli.stepCommand('r')) // Also, the setting survives the restart. .then(() => cli.waitForInitialBreak()) .then(() => { - t.match(cli.breakInfo, { filename: script, line: 1 }); + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 1 }); }) .then(() => cli.stepCommand('c')) .then(() => { - t.match(cli.output, `exception in ${script}:9`); + assert.ok(cli.output.includes(`exception in ${script}:9`)); }) // Next run: Back to the initial state! It should die again. @@ -57,7 +63,7 @@ test('break on (uncaught) exceptions', (t) => { .then(() => cli.stepCommand('r')) .then(() => cli.waitForInitialBreak()) .then(() => { - t.match(cli.breakInfo, { filename: script, line: 1 }); + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 1 }); }) .then(() => cli.command('c')) // TODO: Remove FATAL ERROR once node doesn't show a FATAL ERROR anymore @@ -65,4 +71,4 @@ test('break on (uncaught) exceptions', (t) => { .then(() => cli.quit()) .then(null, onFatal); -}); +} diff --git a/test/inspector-cli/test-inspector-cli-exec-scope.js b/test/inspector-cli/test-inspector-cli-exec-scope.js new file mode 100644 index 00000000000000..ef1455c0b6231e --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-exec-scope.js @@ -0,0 +1,38 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +// exec .scope +{ + const cli = startCLI([fixtures.path('inspector-cli/backtrace.js')]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.stepCommand('c')) + .then(() => cli.command('exec .scope')) + .then(() => { + assert.match( + cli.output, + /'moduleScoped'/, 'displays closure from module body'); + assert.match(cli.output, /'a'/, 'displays local / function arg'); + assert.match(cli.output, /'l1'/, 'displays local scope'); + assert.doesNotMatch( + cli.output, + /'encodeURIComponent'/, + 'omits global scope' + ); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-exec.js b/test/inspector-cli/test-inspector-cli-exec.js new file mode 100644 index 00000000000000..f47eaaa5a6f62d --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-exec.js @@ -0,0 +1,67 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +{ + + const cli = startCLI([fixtures.path('inspector-cli/alive.js')]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('exec [typeof heartbeat, typeof process.exit]')) + .then(() => { + assert.match( + cli.output, + /\[ 'function', 'function' \]/, + 'works w/o paren' + ); + }) + .then(() => cli.command('repl')) + .then(() => { + assert.match( + cli.output, + /Press Ctrl\+C to leave debug repl\n+> /, + 'shows hint for how to leave repl'); + assert.doesNotMatch(cli.output, /debug>/, 'changes the repl style'); + }) + .then(() => cli.command('[typeof heartbeat, typeof process.exit]')) + .then(() => cli.waitFor(/function/)) + .then(() => cli.waitForPrompt()) + .then(() => { + assert.match( + cli.output, + /\[ 'function', 'function' \]/, 'can evaluate in the repl'); + assert.match(cli.output, /> $/); + }) + .then(() => cli.ctrlC()) + .then(() => cli.waitFor(/debug> $/)) + .then(() => cli.command('exec("[typeof heartbeat, typeof process.exit]")')) + .then(() => { + assert.match( + cli.output, + /\[ 'function', 'function' \]/, + 'works w/ paren' + ); + }) + .then(() => cli.command('cont')) + .then(() => cli.command('exec [typeof heartbeat, typeof process.exit]')) + .then(() => { + assert.match( + cli.output, + /\[ 'undefined', 'function' \]/, + 'non-paused exec can see global but not module-scope values'); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-heap-profiler.js b/test/inspector-cli/test-inspector-cli-heap-profiler.js new file mode 100644 index 00000000000000..689604b1c597cb --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-heap-profiler.js @@ -0,0 +1,37 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +if (!common.isMainThread) { + common.skip('process.chdir() is not available in workers'); +} + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); +const tmpdir = require('../common/tmpdir'); + +tmpdir.refresh(); +process.chdir(tmpdir.path); + +const { readFileSync } = require('fs'); + +const filename = 'node.heapsnapshot'; + +// Heap profiler take snapshot. +{ + const cli = startCLI([fixtures.path('inspector-cli/empty.js')]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + // Check that the snapshot is valid JSON. + return cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('takeHeapSnapshot()')) + .then(() => JSON.parse(readFileSync(filename, 'utf8'))) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-help.js b/test/inspector-cli/test-inspector-cli-help.js new file mode 100644 index 00000000000000..f72d4960a75755 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-help.js @@ -0,0 +1,27 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +{ + const cli = startCLI([fixtures.path('inspector-cli/empty.js')]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + return cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('help')) + .then(() => { + assert.match(cli.output, /run, restart, r\s+/m); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-invalid-args.js b/test/inspector-cli/test-inspector-cli-invalid-args.js new file mode 100644 index 00000000000000..841d7a883178d7 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-invalid-args.js @@ -0,0 +1,59 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const { createServer } = require('net'); + +// Launch CLI w/o args. +{ + const cli = startCLI([]); + cli.quit() + .then((code) => { + assert.strictEqual(code, 1); + assert.match(cli.output, /^Usage:/, 'Prints usage info'); + }); +} + +// Launch w/ invalid host:port. +{ + const cli = startCLI(['localhost:914']); + cli.quit() + .then((code) => { + assert.match( + cli.output, + /failed to connect/, + 'Tells the user that the connection failed'); + assert.strictEqual(code, 1); + }); +} + +// Launch w/ unavailable port. +(async () => { + const blocker = createServer((socket) => socket.end()); + const port = await new Promise((resolve, reject) => { + blocker.on('error', reject); + blocker.listen(0, '127.0.0.1', () => resolve(blocker.address().port)); + }); + + try { + const script = fixtures.path('inspector-cli', 'three-lines.js'); + const cli = startCLI([`--port=${port}`, script]); + const code = await cli.quit(); + + assert.doesNotMatch( + cli.output, + /report this bug/, + 'Omits message about reporting this as a bug'); + assert.ok( + cli.output.includes(`waiting for 127.0.0.1:${port} to be free`), + 'Tells the user that the port wasn\'t available'); + assert.strictEqual(code, 1); + } finally { + blocker.close(); + } +})().then(common.mustCall()); diff --git a/test/inspector-cli/test-inspector-cli-launch.js b/test/inspector-cli/test-inspector-cli-launch.js new file mode 100644 index 00000000000000..60f09334b4ef27 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-launch.js @@ -0,0 +1,47 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +{ + const script = fixtures.path('inspector-cli', 'three-lines.js'); + const cli = startCLI([script]); + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => { + assert.match(cli.output, /debug>/, 'prints a prompt'); + assert.match( + cli.output, + /< Debugger listening on [^\n]*9229/, + 'forwards child output'); + }) + .then(() => cli.command('["hello", "world"].join(" ")')) + .then(() => { + assert.match(cli.output, /hello world/, 'prints the result'); + }) + .then(() => cli.command('')) + .then(() => { + assert.match( + cli.output, + /hello world/, + 'repeats the last command on <enter>' + ); + }) + .then(() => cli.command('version')) + .then(() => { + assert.ok( + cli.output.includes(process.versions.v8), + 'version prints the v8 version' + ); + }) + .then(() => cli.quit()) + .then((code) => { + assert.strictEqual(code, 0); + }); +} diff --git a/deps/node-inspect/test/cli/low-level.test.js b/test/inspector-cli/test-inspector-cli-low-level.js similarity index 57% rename from deps/node-inspect/test/cli/low-level.test.js rename to test/inspector-cli/test-inspector-cli-low-level.js index 2a41359825612f..5fafc7c361c33b 100644 --- a/deps/node-inspect/test/cli/low-level.test.js +++ b/test/inspector-cli/test-inspector-cli-low-level.js @@ -1,11 +1,16 @@ 'use strict'; -const { test } = require('tap'); +const common = require('../common'); -const startCLI = require('./start-cli'); +common.skipIfInspectorDisabled(); -test('Debugger agent direct access', (t) => { - const cli = startCLI(['examples/three-lines.js']); - const scriptPattern = /^\* (\d+): examples(?:\/|\\)three-lines.js/; +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); +const assert = require('assert'); + +// Debugger agent direct access. +{ + const cli = startCLI([fixtures.path('inspector-cli/three-lines.js')]); + const scriptPattern = /^\* (\d+): \S+inspector-cli(?:\/|\\)three-lines\.js/m; function onFatal(error) { cli.quit(); @@ -22,13 +27,13 @@ test('Debugger agent direct access', (t) => { ); }) .then(() => { - t.match( + assert.match( cli.output, /scriptSource:[ \n]*'(?:\(function \(|let x = 1)/); - t.match( + assert.match( cli.output, /let x = 1;/); }) .then(() => cli.quit()) .then(null, onFatal); -}); +} diff --git a/test/inspector-cli/test-inspector-cli-pid.js b/test/inspector-cli/test-inspector-cli-pid.js new file mode 100644 index 00000000000000..92c81177650af3 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-pid.js @@ -0,0 +1,61 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const { spawn } = require('child_process'); + + +function launchTarget(...args) { + const childProc = spawn(process.execPath, args); + return Promise.resolve(childProc); +} + +{ + const script = fixtures.path('inspector-cli', 'alive.js'); + let cli = null; + let target = null; + + function cleanup(error) { + if (cli) { + cli.quit(); + cli = null; + } + if (target) { + target.kill(); + target = null; + } + assert.ifError(error); + } + + return launchTarget(script) + .then((childProc) => { + target = childProc; + cli = startCLI(['-p', `${target.pid}`]); + return cli.waitForPrompt(); + }) + .then(() => cli.command('sb("alive.js", 3)')) + .then(() => cli.waitFor(/break/)) + // TODO: There is a known issue on AIX and some other operating systems + // where the breakpoints aren't properly resolved yet when we reach this + // point. Eventually that should be figured out but for now we don't + // want to fail builds because of it. + // What it should be: + // + // .then(() => cli.waitForPrompt()) + // + // What we're diong for now: + .then(() => cli.waitFor(/>\s+(?:\n1 breakpoints restored\.)?$/)) + .then(() => { + assert.match( + cli.output, + /> 3 \+\+x;/, + 'marks the 3rd line'); + }) + .then(() => cleanup()) + .then(null, cleanup); +} diff --git a/test/inspector-cli/test-inspector-cli-preserve-breaks.js b/test/inspector-cli/test-inspector-cli-preserve-breaks.js new file mode 100644 index 00000000000000..fb751016ec7614 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-preserve-breaks.js @@ -0,0 +1,72 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const path = require('path'); + +// Run after quit. +{ + const scriptFullPath = fixtures.path('inspector-cli', 'three-lines.js'); + const script = path.relative(process.cwd(), scriptFullPath); + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + return cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('breakpoints')) + .then(() => { + assert.match(cli.output, /No breakpoints yet/); + }) + .then(() => cli.command('sb(2)')) + .then(() => cli.command('sb(3)')) + .then(() => cli.command('breakpoints')) + .then(() => { + assert.ok(cli.output.includes(`#0 ${script}:2`)); + assert.ok(cli.output.includes(`#1 ${script}:3`)); + }) + .then(() => cli.stepCommand('c')) // hit line 2 + .then(() => cli.stepCommand('c')) // hit line 3 + .then(() => { + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 3 }); + }) + .then(() => cli.command('restart')) + .then(() => cli.waitForInitialBreak()) + .then(() => { + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 1 }); + }) + .then(() => cli.stepCommand('c')) + .then(() => { + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 2 }); + }) + .then(() => cli.stepCommand('c')) + .then(() => { + assert.deepStrictEqual(cli.breakInfo, { filename: script, line: 3 }); + }) + .then(() => cli.command('breakpoints')) + .then(() => { + // TODO: There is a known issue on AIX and some other operating systems + // where the breakpoints aren't properly resolved yet when we reach this + // point. Eventually that should be figured out but for now we don't + // want to fail builds because of it. + // What it should be: + // + // const msg = `SCRIPT: ${script}, OUTPUT: ${cli.output}`; + // assert.ok(cli.output.includes(`#0 ${script}:2`), msg); + // assert.ok(cli.output.includes(`#1 ${script}:3`), msg); + // + // What we're doing for now instead: + assert.match(cli.output, /#0 [^\n]+three-lines\.js\$?:2/); + assert.match(cli.output, /#1 [^\n]+three-lines\.js\$?:3/); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/deps/node-inspect/test/cli/profile.test.js b/test/inspector-cli/test-inspector-cli-profile.js similarity index 52% rename from deps/node-inspect/test/cli/profile.test.js rename to test/inspector-cli/test-inspector-cli-profile.js index 0f900c5a2b06f8..a683d78b06f204 100644 --- a/deps/node-inspect/test/cli/profile.test.js +++ b/test/inspector-cli/test-inspector-cli-profile.js @@ -1,14 +1,20 @@ 'use strict'; -const { test } = require('tap'); +const common = require('../common'); -const startCLI = require('./start-cli'); +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); function delay(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); } -test('profiles', (t) => { - const cli = startCLI(['examples/empty.js']); +// Profiles. +{ + const cli = startCLI([fixtures.path('inspector-cli/empty.js')]); function onFatal(error) { cli.quit(); @@ -19,14 +25,14 @@ test('profiles', (t) => { .then(() => cli.waitForPrompt()) .then(() => cli.command('exec console.profile()')) .then(() => { - t.match(cli.output, 'undefined'); + assert.match(cli.output, /undefined/); }) .then(() => cli.command('exec console.profileEnd()')) .then(() => delay(250)) .then(() => { - t.match(cli.output, 'undefined'); - t.match(cli.output, 'Captured new CPU profile.'); + assert.match(cli.output, /undefined/); + assert.match(cli.output, /Captured new CPU profile\./); }) .then(() => cli.quit()) .then(null, onFatal); -}); +} diff --git a/test/inspector-cli/test-inspector-cli-random-port-with-inspect-port.js b/test/inspector-cli/test-inspector-cli-random-port-with-inspect-port.js new file mode 100644 index 00000000000000..9089f352f4c91b --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-random-port-with-inspect-port.js @@ -0,0 +1,30 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +// Random port with --inspect-port=0. +{ + const script = fixtures.path('inspector-cli', 'three-lines.js'); + + const cli = startCLI(['--inspect-port=0', script]); + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => { + assert.match(cli.output, /debug>/, 'prints a prompt'); + assert.match( + cli.output, + /< Debugger listening on /, + 'forwards child output'); + }) + .then(() => cli.quit()) + .then((code) => { + assert.strictEqual(code, 0); + }); +} diff --git a/test/inspector-cli/test-inspector-cli-random-port.js b/test/inspector-cli/test-inspector-cli-random-port.js new file mode 100644 index 00000000000000..aecadc549ce9c9 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-random-port.js @@ -0,0 +1,30 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +// Random port. +{ + const script = fixtures.path('inspector-cli', 'three-lines.js'); + + const cli = startCLI(['--port=0', script]); + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => { + assert.match(cli.output, /debug>/, 'prints a prompt'); + assert.match( + cli.output, + /< Debugger listening on /, + 'forwards child output'); + }) + .then(() => cli.quit()) + .then((code) => { + assert.strictEqual(code, 0); + }); +} diff --git a/test/inspector-cli/test-inspector-cli-run-after-quit-restart.js b/test/inspector-cli/test-inspector-cli-run-after-quit-restart.js new file mode 100644 index 00000000000000..0e0233d1209d53 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-run-after-quit-restart.js @@ -0,0 +1,90 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const path = require('path'); + +// Run after quit/restart. +{ + const scriptFullPath = fixtures.path('inspector-cli', 'three-lines.js'); + const script = path.relative(process.cwd(), scriptFullPath); + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.stepCommand('n')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${script}:2`), + 'steps to the 2nd line' + ); + }) + .then(() => cli.command('cont')) + .then(() => cli.waitFor(/disconnect/)) + .then(() => { + assert.match( + cli.output, + /Waiting for the debugger to disconnect/, + 'the child was done'); + }) + .then(() => { + // On windows the socket won't close by itself + return cli.command('kill'); + }) + .then(() => cli.command('cont')) + .then(() => cli.waitFor(/start the app/)) + .then(() => { + assert.match(cli.output, /Use `run` to start the app again/); + }) + .then(() => cli.stepCommand('run')) + .then(() => cli.waitForInitialBreak()) + .then(() => cli.waitForPrompt()) + .then(() => { + assert.deepStrictEqual( + cli.breakInfo, + { filename: script, line: 1 }, + ); + }) + .then(() => cli.stepCommand('n')) + .then(() => { + assert.deepStrictEqual( + cli.breakInfo, + { filename: script, line: 2 }, + ); + }) + .then(() => cli.stepCommand('restart')) + .then(() => cli.waitForInitialBreak()) + .then(() => { + assert.deepStrictEqual( + cli.breakInfo, + { filename: script, line: 1 }, + ); + }) + .then(() => cli.command('kill')) + .then(() => cli.command('cont')) + .then(() => cli.waitFor(/start the app/)) + .then(() => { + assert.match(cli.output, /Use `run` to start the app again/); + }) + .then(() => cli.stepCommand('run')) + .then(() => cli.waitForInitialBreak()) + .then(() => cli.waitForPrompt()) + .then(() => { + assert.deepStrictEqual( + cli.breakInfo, + { filename: script, line: 1 }, + ); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/test/inspector-cli/test-inspector-cli-sb-before-load.js b/test/inspector-cli/test-inspector-cli-sb-before-load.js new file mode 100644 index 00000000000000..fe1923f884a1e0 --- /dev/null +++ b/test/inspector-cli/test-inspector-cli-sb-before-load.js @@ -0,0 +1,44 @@ +'use strict'; +const common = require('../common'); + +common.skipIfInspectorDisabled(); + +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); +const path = require('path'); + +// Using sb before loading file. +{ + const scriptFullPath = fixtures.path('inspector-cli', 'cjs', 'index.js'); + const script = path.relative(process.cwd(), scriptFullPath); + + const otherScriptFullPath = fixtures.path('inspector-cli', 'cjs', 'other.js'); + const otherScript = path.relative(process.cwd(), otherScriptFullPath); + + const cli = startCLI([script]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('sb("other.js", 2)')) + .then(() => { + assert.match( + cli.output, + /not loaded yet/, + 'warns that the script was not loaded yet'); + }) + .then(() => cli.stepCommand('cont')) + .then(() => { + assert.ok( + cli.output.includes(`break in ${otherScript}:2`), + 'found breakpoint in file that was not loaded yet'); + }) + .then(() => cli.quit()) + .then(null, onFatal); +} diff --git a/deps/node-inspect/test/cli/scripts.test.js b/test/inspector-cli/test-inspector-cli-scripts.js similarity index 51% rename from deps/node-inspect/test/cli/scripts.test.js rename to test/inspector-cli/test-inspector-cli-scripts.js index f6e3f30dcafce0..3c634e4b80ac83 100644 --- a/deps/node-inspect/test/cli/scripts.test.js +++ b/test/inspector-cli/test-inspector-cli-scripts.js @@ -1,12 +1,16 @@ 'use strict'; -const Path = require('path'); +const common = require('../common'); -const { test } = require('tap'); +common.skipIfInspectorDisabled(); -const startCLI = require('./start-cli'); +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); -test('list scripts', (t) => { - const script = Path.join('examples', 'three-lines.js'); +const assert = require('assert'); + +// List scripts. +{ + const script = fixtures.path('inspector-cli', 'three-lines.js'); const cli = startCLI([script]); function onFatal(error) { @@ -18,26 +22,26 @@ test('list scripts', (t) => { .then(() => cli.waitForPrompt()) .then(() => cli.command('scripts')) .then(() => { - t.match( + assert.match( cli.output, - /^\* \d+: examples(?:\/|\\)three-lines\.js/, + /^\* \d+: \S+inspector-cli(?:\/|\\)three-lines\.js/m, 'lists the user script'); - t.notMatch( + assert.doesNotMatch( cli.output, - /\d+: buffer\.js <native>/, + /\d+: node:internal\/buffer/, 'omits node-internal scripts'); }) .then(() => cli.command('scripts(true)')) .then(() => { - t.match( + assert.match( cli.output, - /\* \d+: examples(?:\/|\\)three-lines\.js/, + /\* \d+: \S+inspector-cli(?:\/|\\)three-lines\.js/, 'lists the user script'); - t.match( + assert.match( cli.output, - /\d+: buffer\.js <native>/, + /\d+: node:internal\/buffer/, 'includes node-internal scripts'); }) .then(() => cli.quit()) .then(null, onFatal); -}); +} diff --git a/deps/node-inspect/test/cli/use-strict.test.js b/test/inspector-cli/test-inspector-cli-use-strict.js similarity index 54% rename from deps/node-inspect/test/cli/use-strict.test.js rename to test/inspector-cli/test-inspector-cli-use-strict.js index c6dc8f31cd82b5..4fb33c9f3e58fa 100644 --- a/deps/node-inspect/test/cli/use-strict.test.js +++ b/test/inspector-cli/test-inspector-cli-use-strict.js @@ -1,12 +1,16 @@ 'use strict'; -const Path = require('path'); +const common = require('../common'); -const { test } = require('tap'); +common.skipIfInspectorDisabled(); -const startCLI = require('./start-cli'); +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); -test('for whiles that starts with strict directive', (t) => { - const script = Path.join('examples', 'use-strict.js'); +const assert = require('assert'); + +// Test for files that start with strict directive. +{ + const script = fixtures.path('inspector-cli', 'use-strict.js'); const cli = startCLI([script]); function onFatal(error) { @@ -18,11 +22,11 @@ test('for whiles that starts with strict directive', (t) => { .then(() => cli.waitForPrompt()) .then(() => { const brk = cli.breakInfo; - t.match( + assert.match( `${brk.line}`, /^(1|2)$/, 'pauses either on strict directive or first "real" line'); }) .then(() => cli.quit()) .then(null, onFatal); -}); +} diff --git a/deps/node-inspect/test/cli/watchers.test.js b/test/inspector-cli/test-inspector-cli-watchers.js similarity index 56% rename from deps/node-inspect/test/cli/watchers.test.js rename to test/inspector-cli/test-inspector-cli-watchers.js index 46bcde19a2a4cf..ab39be6239ec26 100644 --- a/deps/node-inspect/test/cli/watchers.test.js +++ b/test/inspector-cli/test-inspector-cli-watchers.js @@ -1,10 +1,16 @@ 'use strict'; -const { test } = require('tap'); +const common = require('../common'); -const startCLI = require('./start-cli'); +common.skipIfInspectorDisabled(); -test('stepping through breakpoints', (t) => { - const cli = startCLI(['examples/break.js']); +const fixtures = require('../common/fixtures'); +const startCLI = require('../common/inspector-cli'); + +const assert = require('assert'); + +// Stepping through breakpoints. +{ + const cli = startCLI([fixtures.path('inspector-cli/break.js')]); function onFatal(error) { cli.quit(); @@ -22,21 +28,21 @@ test('stepping through breakpoints', (t) => { .then(() => cli.command('watch("process.env")')) .then(() => cli.command('watchers')) .then(() => { - t.match(cli.output, 'x is not defined'); + assert.match(cli.output, /x is not defined/); }) .then(() => cli.command('unwatch("42")')) .then(() => cli.stepCommand('n')) .then(() => { - t.match(cli.output, '0: x = 10'); - t.match(cli.output, '1: "Hello" = \'Hello\''); - t.match(cli.output, '2: NaN = NaN'); - t.match(cli.output, '3: true = true'); - t.match(cli.output, '4: [1, 2] = [ 1, 2 ]'); - t.match( + assert.match(cli.output, /0: x = 10/); + assert.match(cli.output, /1: "Hello" = 'Hello'/); + assert.match(cli.output, /2: NaN = NaN/); + assert.match(cli.output, /3: true = true/); + assert.match(cli.output, /4: \[1, 2\] = \[ 1, 2 \]/); + assert.match( cli.output, /5: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, 'shows "..." for process.env'); }) .then(() => cli.quit()) .then(null, onFatal); -}); +} diff --git a/test/inspector-cli/testcfg.py b/test/inspector-cli/testcfg.py new file mode 100644 index 00000000000000..d45972ac3f1357 --- /dev/null +++ b/test/inspector-cli/testcfg.py @@ -0,0 +1,6 @@ +import sys, os +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +import testpy + +def GetConfiguration(context, root): + return testpy.SimpleTestConfiguration(context, root, 'inspector-cli') diff --git a/test/internet/test-dns-lookup.js b/test/internet/test-dns-lookup.js index df5ccf99a56fc3..6939698d392317 100644 --- a/test/internet/test-dns-lookup.js +++ b/test/internet/test-dns-lookup.js @@ -8,30 +8,30 @@ const { addresses } = require('../common/internet'); const assert = require('assert'); assert.rejects( - dnsPromises.lookup(addresses.INVALID_HOST, { + dnsPromises.lookup(addresses.NOT_FOUND, { hints: 0, family: 0, all: false }), { code: 'ENOTFOUND', - message: `getaddrinfo ENOTFOUND ${addresses.INVALID_HOST}` + message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}` } ); assert.rejects( - dnsPromises.lookup(addresses.INVALID_HOST, { + dnsPromises.lookup(addresses.NOT_FOUND, { hints: 0, family: 0, all: true }), { code: 'ENOTFOUND', - message: `getaddrinfo ENOTFOUND ${addresses.INVALID_HOST}` + message: `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}` } ); -dns.lookup(addresses.INVALID_HOST, { +dns.lookup(addresses.NOT_FOUND, { hints: 0, family: 0, all: true @@ -39,8 +39,8 @@ dns.lookup(addresses.INVALID_HOST, { assert.strictEqual(error.code, 'ENOTFOUND'); assert.strictEqual( error.message, - `getaddrinfo ENOTFOUND ${addresses.INVALID_HOST}` + `getaddrinfo ENOTFOUND ${addresses.NOT_FOUND}` ); assert.strictEqual(error.syscall, 'getaddrinfo'); - assert.strictEqual(error.hostname, addresses.INVALID_HOST); + assert.strictEqual(error.hostname, addresses.NOT_FOUND); })); diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 14a26c873f17fe..363dc92446a5ef 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -91,7 +91,7 @@ TEST(async function test_resolve4_ttl(done) { assert.strictEqual(typeof item, 'object'); assert.strictEqual(typeof item.ttl, 'number'); assert.strictEqual(typeof item.address, 'string'); - assert.ok(item.ttl > 0); + assert.ok(item.ttl >= 0); assert.ok(isIPv4(item.address)); } } @@ -119,7 +119,7 @@ TEST(async function test_resolve6_ttl(done) { assert.strictEqual(typeof item, 'object'); assert.strictEqual(typeof item.ttl, 'number'); assert.strictEqual(typeof item.address, 'string'); - assert.ok(item.ttl > 0); + assert.ok(item.ttl >= 0); assert.ok(isIPv6(item.address)); } } @@ -163,13 +163,13 @@ TEST(async function test_resolveMx(done) { }); TEST(function test_resolveMx_failure(done) { - dnsPromises.resolveMx(addresses.INVALID_HOST) + dnsPromises.resolveMx(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveMx(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveMx(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -203,13 +203,13 @@ TEST(async function test_resolveNs(done) { }); TEST(function test_resolveNs_failure(done) { - dnsPromises.resolveNs(addresses.INVALID_HOST) + dnsPromises.resolveNs(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveNs(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveNs(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -247,13 +247,13 @@ TEST(async function test_resolveSrv(done) { }); TEST(function test_resolveSrv_failure(done) { - dnsPromises.resolveSrv(addresses.INVALID_HOST) + dnsPromises.resolveSrv(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveSrv(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveSrv(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -287,13 +287,13 @@ TEST(async function test_resolvePtr(done) { }); TEST(function test_resolvePtr_failure(done) { - dnsPromises.resolvePtr(addresses.INVALID_HOST) + dnsPromises.resolvePtr(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolvePtr(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolvePtr(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -332,13 +332,13 @@ TEST(async function test_resolveNaptr(done) { }); TEST(function test_resolveNaptr_failure(done) { - dnsPromises.resolveNaptr(addresses.INVALID_HOST) + dnsPromises.resolveNaptr(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveNaptr(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveNaptr(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -381,13 +381,13 @@ TEST(async function test_resolveSoa(done) { }); TEST(function test_resolveSoa_failure(done) { - dnsPromises.resolveSoa(addresses.INVALID_HOST) + dnsPromises.resolveSoa(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveSoa(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveSoa(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -421,13 +421,13 @@ TEST(async function test_resolveCaa(done) { }); TEST(function test_resolveCaa_failure(done) { - dnsPromises.resolveTxt(addresses.INVALID_HOST) + dnsPromises.resolveTxt(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveCaa(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveCaa(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -461,13 +461,13 @@ TEST(async function test_resolveCname(done) { }); TEST(function test_resolveCname_failure(done) { - dnsPromises.resolveCname(addresses.INVALID_HOST) + dnsPromises.resolveCname(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveCname(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveCname(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -499,13 +499,13 @@ TEST(async function test_resolveTxt(done) { }); TEST(function test_resolveTxt_failure(done) { - dnsPromises.resolveTxt(addresses.INVALID_HOST) + dnsPromises.resolveTxt(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.mustCall((err) => { assert.strictEqual(err.code, 'ENOTFOUND'); })); - const req = dns.resolveTxt(addresses.INVALID_HOST, function(err, result) { + const req = dns.resolveTxt(addresses.NOT_FOUND, function(err, result) { assert.ok(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); @@ -519,16 +519,16 @@ TEST(function test_resolveTxt_failure(done) { TEST(function test_lookup_failure(done) { - dnsPromises.lookup(addresses.INVALID_HOST, 4) + dnsPromises.lookup(addresses.NOT_FOUND, 4) .then(common.mustNotCall()) .catch(common.expectsError({ code: dns.NOTFOUND })); - const req = dns.lookup(addresses.INVALID_HOST, 4, (err) => { + const req = dns.lookup(addresses.NOT_FOUND, 4, (err) => { assert.ok(err instanceof Error); assert.strictEqual(err.code, dns.NOTFOUND); assert.strictEqual(err.code, 'ENOTFOUND'); assert.ok(!/ENOENT/.test(err.message)); - assert.ok(err.message.includes(addresses.INVALID_HOST)); + assert.ok(err.message.includes(addresses.NOT_FOUND)); done(); }); @@ -672,18 +672,18 @@ TEST(function test_reverse_failure(done) { TEST(function test_lookup_failure(done) { - dnsPromises.lookup(addresses.INVALID_HOST) + dnsPromises.lookup(addresses.NOT_FOUND) .then(common.mustNotCall()) .catch(common.expectsError({ code: 'ENOTFOUND', - hostname: addresses.INVALID_HOST + hostname: addresses.NOT_FOUND })); - const req = dns.lookup(addresses.INVALID_HOST, (err) => { + const req = dns.lookup(addresses.NOT_FOUND, (err) => { assert(err instanceof Error); assert.strictEqual(err.code, 'ENOTFOUND'); // Silly error code... - assert.strictEqual(err.hostname, addresses.INVALID_HOST); - assert.ok(err.message.includes(addresses.INVALID_HOST)); + assert.strictEqual(err.hostname, addresses.NOT_FOUND); + assert.ok(err.message.includes(addresses.NOT_FOUND)); done(); }); @@ -693,7 +693,7 @@ TEST(function test_lookup_failure(done) { TEST(function test_resolve_failure(done) { - const req = dns.resolve4(addresses.INVALID_HOST, (err) => { + const req = dns.resolve4(addresses.NOT_FOUND, (err) => { assert(err instanceof Error); switch (err.code) { @@ -705,8 +705,8 @@ TEST(function test_resolve_failure(done) { break; } - assert.strictEqual(err.hostname, addresses.INVALID_HOST); - assert.ok(err.message.includes(addresses.INVALID_HOST)); + assert.strictEqual(err.hostname, addresses.NOT_FOUND); + assert.ok(err.message.includes(addresses.NOT_FOUND)); done(); }); diff --git a/test/message/core_line_numbers.out b/test/message/core_line_numbers.out index 215542404be02f..97b017f66e2395 100644 --- a/test/message/core_line_numbers.out +++ b/test/message/core_line_numbers.out @@ -1,9 +1,9 @@ -node:punycode:42 +node:punycode:52 throw new RangeError(errors[type]); ^ RangeError: Invalid input - at error (node:punycode:42:8) + at error (node:punycode:52:8) at Object.decode (node:punycode:*:*) at Object.<anonymous> (*test*message*core_line_numbers.js:*:*) at Module._compile (node:internal/modules/cjs/loader:*:*) diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index e35585e8eb19d1..cae9301517c37c 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -495,3 +495,7 @@ assert.throws( code: 'ERR_INVALID_ARG_TYPE' } ); +[true, Symbol(), {}, () => {}, []].forEach((generator) => assert.throws( + () => crypto.createDiffieHellman('', 'base64', generator), + { code: 'ERR_INVALID_ARG_TYPE' } +)); diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index d7b3f9af83acd9..aa57aaa41f4813 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -66,6 +66,16 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', }); } +{ + assert.throws(() => KeyObject.from('invalid_key'), { + name: 'TypeError', + code: 'ERR_INVALID_ARG_TYPE', + message: + 'The "key" argument must be an instance of CryptoKey. Received type ' + + "string ('invalid_key')" + }); +} + { const keybuf = randomBytes(32); const key = createSecretKey(keybuf); diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index cbf797c0ea2388..a120a3838e2048 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -958,7 +958,7 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); } // Test invalid divisor lengths. - for (const divisorLength of ['a', true, {}, [], 4096.1]) { + for (const divisorLength of ['a', true, {}, [], 4096.1, 2147483648, -1]) { assert.throws(() => generateKeyPair('dsa', { modulusLength: 2048, divisorLength @@ -1081,6 +1081,52 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); message: 'Unknown DH group' }); + assert.throws(() => { + generateKeyPair('dh', { + primeLength: 2147483648 + }, common.mustNotCall()); + }, { + name: 'TypeError', + code: 'ERR_INVALID_ARG_VALUE', + message: "The property 'options.primeLength' is invalid. " + + 'Received 2147483648', + }); + + assert.throws(() => { + generateKeyPair('dh', { + primeLength: -1 + }, common.mustNotCall()); + }, { + name: 'TypeError', + code: 'ERR_INVALID_ARG_VALUE', + message: "The property 'options.primeLength' is invalid. " + + 'Received -1', + }); + + assert.throws(() => { + generateKeyPair('dh', { + primeLength: 2, + generator: 2147483648, + }, common.mustNotCall()); + }, { + name: 'TypeError', + code: 'ERR_INVALID_ARG_VALUE', + message: "The property 'options.generator' is invalid. " + + 'Received 2147483648', + }); + + assert.throws(() => { + generateKeyPair('dh', { + primeLength: 2, + generator: -1, + }, common.mustNotCall()); + }, { + name: 'TypeError', + code: 'ERR_INVALID_ARG_VALUE', + message: "The property 'options.generator' is invalid. " + + 'Received -1', + }); + // Test incompatible options. const allOpts = { group: 'modp5', @@ -1142,6 +1188,35 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); }); } + // too long salt length + assert.throws(() => { + generateKeyPair('rsa-pss', { + modulusLength: 512, + saltLength: 2147483648, + hash: 'sha256', + mgf1Hash: 'sha256' + }, common.mustNotCall()); + }, { + name: 'TypeError', + code: 'ERR_INVALID_ARG_VALUE', + message: "The property 'options.saltLength' is invalid. " + + 'Received 2147483648' + }); + + assert.throws(() => { + generateKeyPair('rsa-pss', { + modulusLength: 512, + saltLength: -1, + hash: 'sha256', + mgf1Hash: 'sha256' + }, common.mustNotCall()); + }, { + name: 'TypeError', + code: 'ERR_INVALID_ARG_VALUE', + message: "The property 'options.saltLength' is invalid. " + + 'Received -1' + }); + // Invalid private key type. for (const type of ['foo', 'spki']) { assert.throws(() => { diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index 260bdd394ce05e..c9ab6a9c48438e 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -231,3 +231,15 @@ if (!common.hasOpenSSL3) { runPBKDF2(new Uint8Array(10), 'salt', 8, 8, hash); }); } + +{ + // This should not crash. + assert.throws( + () => crypto.pbkdf2Sync('1', '2', 1, 1, '%'), + { + code: 'ERR_CRYPTO_INVALID_DIGEST', + name: 'TypeError', + message: 'Invalid digest: %' + } + ); +} diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js index 9db69646bbfb0a..7b695a36f2b5a4 100644 --- a/test/parallel/test-crypto-scrypt.js +++ b/test/parallel/test-crypto-scrypt.js @@ -143,6 +143,10 @@ const badargs = [ args: ['', '', -42], expected: { code: 'ERR_OUT_OF_RANGE', message: /"keylen"/ }, }, + { + args: ['', '', 2147485780], + expected: { code: 'ERR_OUT_OF_RANGE', message: /"keylen"/ }, + }, ]; for (const options of good) { diff --git a/test/parallel/test-eslint-non-ascii-character.js b/test/parallel/test-eslint-non-ascii-character.js new file mode 100644 index 00000000000000..0b4a09f813431b --- /dev/null +++ b/test/parallel/test-eslint-non-ascii-character.js @@ -0,0 +1,26 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +common.skipIfEslintMissing(); + +const RuleTester = require('../../tools/node_modules/eslint').RuleTester; +const rule = require('../../tools/eslint-rules/non-ascii-character'); + +new RuleTester().run('non-ascii-characters', rule, { + valid: [ + { + code: 'console.log("fhqwhgads")', + options: [] + }, + ], + invalid: [ + { + code: 'console.log("μ")', + options: [], + errors: [{ message: "Non-ASCII character 'μ' detected." }], + }, + ] +}); diff --git a/test/parallel/test-freeze-intrinsics.js b/test/parallel/test-freeze-intrinsics.js index 2e9ff5f4fe2fdc..978a6861a517fc 100644 --- a/test/parallel/test-freeze-intrinsics.js +++ b/test/parallel/test-freeze-intrinsics.js @@ -30,3 +30,10 @@ assert.throws( assert.strictEqual(Object.getOwnPropertyDescriptor(o, 'toString').enumerable, true); } + +// Ensure we can not override globalThis +{ + assert.throws(() => { globalThis.globalThis = null; }, + { name: 'TypeError' }); + assert.strictEqual(globalThis.globalThis, globalThis); +} diff --git a/test/parallel/test-fs-promises-file-handle-aggregate-errors.js b/test/parallel/test-fs-promises-file-handle-aggregate-errors.js new file mode 100644 index 00000000000000..d4c3b37d652d12 --- /dev/null +++ b/test/parallel/test-fs-promises-file-handle-aggregate-errors.js @@ -0,0 +1,72 @@ +'use strict'; +// Flags: --expose-internals + +const common = require('../common'); +const tmpdir = require('../common/tmpdir'); + +// The following tests validate aggregate errors are thrown correctly +// when both an operation and close throw. + +const path = require('path'); +const { + readFile, + writeFile, + truncate, + lchmod, +} = require('fs/promises'); +const { + FileHandle, +} = require('internal/fs/promises'); + +const assert = require('assert'); +const originalFd = Object.getOwnPropertyDescriptor(FileHandle.prototype, 'fd'); + +let count = 0; +async function createFile() { + const filePath = path.join(tmpdir.path, `aggregate_errors_${++count}.txt`); + await writeFile(filePath, 'content'); + return filePath; +} + +async function checkAggregateError(op) { + try { + const filePath = await createFile(); + Object.defineProperty(FileHandle.prototype, 'fd', { + get: function() { + // Close is set by using a setter, + // so it needs to be set on the instance. + const originalClose = this.close; + this.close = async () => { + // close the file + await originalClose.call(this); + const closeError = new Error('CLOSE_ERROR'); + closeError.code = 456; + throw closeError; + }; + const opError = new Error('INTERNAL_ERROR'); + opError.code = 123; + throw opError; + } + }); + + await assert.rejects(op(filePath), common.mustCall((err) => { + assert.strictEqual(err.name, 'AggregateError'); + assert.strictEqual(err.code, 123); + assert.strictEqual(err.errors.length, 2); + assert.strictEqual(err.errors[0].message, 'INTERNAL_ERROR'); + assert.strictEqual(err.errors[1].message, 'CLOSE_ERROR'); + return true; + })); + } finally { + Object.defineProperty(FileHandle.prototype, 'fd', originalFd); + } +} +(async function() { + tmpdir.refresh(); + await checkAggregateError((filePath) => truncate(filePath)); + await checkAggregateError((filePath) => readFile(filePath)); + await checkAggregateError((filePath) => writeFile(filePath, '123')); + if (common.isOSX) { + await checkAggregateError((filePath) => lchmod(filePath, 0o777)); + } +})().then(common.mustCall()); diff --git a/test/parallel/test-fs-promises-file-handle-close-errors.js b/test/parallel/test-fs-promises-file-handle-close-errors.js new file mode 100644 index 00000000000000..b975b3f3e1583c --- /dev/null +++ b/test/parallel/test-fs-promises-file-handle-close-errors.js @@ -0,0 +1,67 @@ +'use strict'; +// Flags: --expose-internals + +const common = require('../common'); +const tmpdir = require('../common/tmpdir'); + +// The following tests validate aggregate errors are thrown correctly +// when both an operation and close throw. + +const path = require('path'); +const { + readFile, + writeFile, + truncate, + lchmod, +} = require('fs/promises'); +const { + FileHandle, +} = require('internal/fs/promises'); + +const assert = require('assert'); +const originalFd = Object.getOwnPropertyDescriptor(FileHandle.prototype, 'fd'); + +let count = 0; +async function createFile() { + const filePath = path.join(tmpdir.path, `close_errors_${++count}.txt`); + await writeFile(filePath, 'content'); + return filePath; +} + +async function checkCloseError(op) { + try { + const filePath = await createFile(); + Object.defineProperty(FileHandle.prototype, 'fd', { + get: function() { + // Close is set by using a setter, + // so it needs to be set on the instance. + const originalClose = this.close; + this.close = async () => { + // close the file + await originalClose.call(this); + const closeError = new Error('CLOSE_ERROR'); + closeError.code = 456; + throw closeError; + }; + return originalFd.get.call(this); + } + }); + + await assert.rejects(op(filePath), { + name: 'Error', + message: 'CLOSE_ERROR', + code: 456, + }); + } finally { + Object.defineProperty(FileHandle.prototype, 'fd', originalFd); + } +} +(async function() { + tmpdir.refresh(); + await checkCloseError((filePath) => truncate(filePath)); + await checkCloseError((filePath) => readFile(filePath)); + await checkCloseError((filePath) => writeFile(filePath, '123')); + if (common.isOSX) { + await checkCloseError((filePath) => lchmod(filePath, 0o777)); + } +})().then(common.mustCall()); diff --git a/test/parallel/test-fs-promises-file-handle-op-errors.js b/test/parallel/test-fs-promises-file-handle-op-errors.js new file mode 100644 index 00000000000000..7110b5d9d40467 --- /dev/null +++ b/test/parallel/test-fs-promises-file-handle-op-errors.js @@ -0,0 +1,61 @@ +'use strict'; +// Flags: --expose-internals + +const common = require('../common'); +const tmpdir = require('../common/tmpdir'); + +// The following tests validate aggregate errors are thrown correctly +// when both an operation and close throw. + +const path = require('path'); +const { + readFile, + writeFile, + truncate, + lchmod, +} = require('fs/promises'); +const { + FileHandle, +} = require('internal/fs/promises'); + +const assert = require('assert'); +const originalFd = Object.getOwnPropertyDescriptor(FileHandle.prototype, 'fd'); + +let count = 0; +async function createFile() { + const filePath = path.join(tmpdir.path, `op_errors_${++count}.txt`); + await writeFile(filePath, 'content'); + return filePath; +} + +async function checkOperationError(op) { + try { + const filePath = await createFile(); + Object.defineProperty(FileHandle.prototype, 'fd', { + get: function() { + // Verify that close is called when an error is thrown + this.close = common.mustCall(this.close); + const opError = new Error('INTERNAL_ERROR'); + opError.code = 123; + throw opError; + } + }); + + await assert.rejects(op(filePath), { + name: 'Error', + message: 'INTERNAL_ERROR', + code: 123, + }); + } finally { + Object.defineProperty(FileHandle.prototype, 'fd', originalFd); + } +} +(async function() { + tmpdir.refresh(); + await checkOperationError((filePath) => truncate(filePath)); + await checkOperationError((filePath) => readFile(filePath)); + await checkOperationError((filePath) => writeFile(filePath, '123')); + if (common.isOSX) { + await checkOperationError((filePath) => lchmod(filePath, 0o777)); + } +})().then(common.mustCall()); diff --git a/test/parallel/test-fs-promises-file-handle-read.js b/test/parallel/test-fs-promises-file-handle-read.js index cd2caab9f0273c..44ef2c6b815a3d 100644 --- a/test/parallel/test-fs-promises-file-handle-read.js +++ b/test/parallel/test-fs-promises-file-handle-read.js @@ -61,6 +61,13 @@ async function validateLargeRead(options) { assert.strictEqual(readHandle.bytesRead, 0); } +async function validateReadNoParams() { + const filePath = fixtures.path('x.txt'); + const fileHandle = await open(filePath, 'r'); + // Should not throw + await fileHandle.read(); +} + (async function() { tmpdir.refresh(); @@ -70,4 +77,5 @@ async function validateLargeRead(options) { await validateRead('', 'read-empty-file-conf', { useConf: true }); await validateLargeRead({ useConf: false }); await validateLargeRead({ useConf: true }); + await validateReadNoParams(); })().then(common.mustCall()); diff --git a/test/parallel/test-fs-read-type.js b/test/parallel/test-fs-read-type.js index 81440ab57eb802..2baab18dc9f483 100644 --- a/test/parallel/test-fs-read-type.js +++ b/test/parallel/test-fs-read-type.js @@ -44,8 +44,6 @@ assert.throws(() => { }, { code: 'ERR_OUT_OF_RANGE', name: 'RangeError', - message: 'The value of "offset" is out of range. It must be >= 0. ' + - 'Received -1' }); assert.throws(() => { @@ -157,8 +155,6 @@ assert.throws(() => { }, { code: 'ERR_OUT_OF_RANGE', name: 'RangeError', - message: 'The value of "offset" is out of range. ' + - 'It must be >= 0. Received -1' }); assert.throws(() => { diff --git a/test/parallel/test-fs-write-negativeoffset.js b/test/parallel/test-fs-write-negativeoffset.js new file mode 100644 index 00000000000000..b1c6ed9039b7d7 --- /dev/null +++ b/test/parallel/test-fs-write-negativeoffset.js @@ -0,0 +1,55 @@ +'use strict'; + +// Tests that passing a negative offset does not crash the process + +const common = require('../common'); + +const { + join, +} = require('path'); + +const { + closeSync, + open, + write, + writeSync, +} = require('fs'); + +const assert = require('assert'); + +const tmpdir = require('../common/tmpdir'); +tmpdir.refresh(); + +const filename = join(tmpdir.path, 'test.txt'); + +open(filename, 'w+', common.mustSucceed((fd) => { + assert.throws(() => { + write(fd, Buffer.alloc(0), -1, common.mustNotCall()); + }, { + code: 'ERR_OUT_OF_RANGE', + }); + assert.throws(() => { + writeSync(fd, Buffer.alloc(0), -1); + }, { + code: 'ERR_OUT_OF_RANGE', + }); + closeSync(fd); +})); + +const filename2 = join(tmpdir.path, 'test2.txt'); + +// Make sure negative length's don't cause aborts either + +open(filename2, 'w+', common.mustSucceed((fd) => { + assert.throws(() => { + write(fd, Buffer.alloc(0), 0, -1, common.mustNotCall()); + }, { + code: 'ERR_OUT_OF_RANGE', + }); + assert.throws(() => { + writeSync(fd, Buffer.alloc(0), 0, -1); + }, { + code: 'ERR_OUT_OF_RANGE', + }); + closeSync(fd); +})); diff --git a/test/parallel/test-http-methods.js b/test/parallel/test-http-methods.js index 606126fe74d389..1142c175ecdb20 100644 --- a/test/parallel/test-http-methods.js +++ b/test/parallel/test-http-methods.js @@ -29,16 +29,12 @@ const http = require('http'); const methods = [ 'ACL', - 'ANNOUNCE', 'BIND', 'CHECKOUT', 'CONNECT', 'COPY', 'DELETE', - 'DESCRIBE', - 'FLUSH', 'GET', - 'GET_PARAMETER', 'HEAD', 'LINK', 'LOCK', @@ -51,24 +47,16 @@ const methods = [ 'NOTIFY', 'OPTIONS', 'PATCH', - 'PAUSE', - 'PLAY', 'POST', - 'PRI', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'REBIND', - 'RECORD', - 'REDIRECT', 'REPORT', 'SEARCH', - 'SETUP', - 'SET_PARAMETER', 'SOURCE', 'SUBSCRIBE', - 'TEARDOWN', 'TRACE', 'UNBIND', 'UNLINK', diff --git a/test/parallel/test-https-selfsigned-no-keycertsign-no-crash.js b/test/parallel/test-https-selfsigned-no-keycertsign-no-crash.js new file mode 100644 index 00000000000000..2dd46ac878c5b0 --- /dev/null +++ b/test/parallel/test-https-selfsigned-no-keycertsign-no-crash.js @@ -0,0 +1,63 @@ +'use strict'; +const common = require('../common'); +const fixtures = require('../common/fixtures'); + +// This test starts an https server and tries +// to connect to it using a self-signed certificate. +// This certificate´s keyUsage does not include the keyCertSign +// bit, which used to crash node. The test ensures node +// will not crash. Key and certificate are from #37889. +// Note: This test assumes that the connection will succeed. + +if (!common.hasCrypto) + common.skip('missing crypto'); + +const crypto = require('crypto'); + +// See #37990 for details on why this is problematic with FIPS. +if (process.config.variables.openssl_is_fips) + common.skip('Skipping as test uses non-fips compliant EC curve'); + +// This test will fail for OpenSSL < 1.1.1h +const minOpenSSL = 269488271; + +if (crypto.constants.OPENSSL_VERSION_NUMBER < minOpenSSL) + common.skip('OpenSSL < 1.1.1h'); + +const https = require('https'); +const path = require('path'); + +const key = + fixtures.readKey(path.join('selfsigned-no-keycertsign', 'key.pem')); + +const cert = + fixtures.readKey(path.join('selfsigned-no-keycertsign', 'cert.pem')); + +const serverOptions = { + key: key, + cert: cert +}; + +// Start the server +const httpsServer = https.createServer(serverOptions, (req, res) => { + res.writeHead(200); + res.end('hello world\n'); +}); +httpsServer.listen(0); + +httpsServer.on('listening', () => { + // Once the server started listening, built the client config + // with the server´s used port + const clientOptions = { + hostname: '127.0.0.1', + port: httpsServer.address().port, + ca: cert + }; + // Try to connect + const req = https.request(clientOptions, common.mustCall((res) => { + httpsServer.close(); + })); + + req.on('error', common.mustNotCall()); + req.end(); +}); diff --git a/test/parallel/test-icu-transcode.js b/test/parallel/test-icu-transcode.js index 20ecab7213b292..e9aced128eec21 100644 --- a/test/parallel/test-icu-transcode.js +++ b/test/parallel/test-icu-transcode.js @@ -83,3 +83,8 @@ assert.deepStrictEqual( const dest = buffer.transcode(new Uint8Array(), 'utf8', 'latin1'); assert.strictEqual(dest.length, 0); } + +// Test that it doesn't crash +{ + buffer.transcode(new buffer.SlowBuffer(1), 'utf16le', 'ucs2'); +} diff --git a/test/parallel/test-messaging-maketransferable.js b/test/parallel/test-messaging-maketransferable.js new file mode 100644 index 00000000000000..07b1081045d99f --- /dev/null +++ b/test/parallel/test-messaging-maketransferable.js @@ -0,0 +1,27 @@ +// Flags: --expose-internals +'use strict'; + +const common = require('../common'); + +const assert = require('assert'); +const { + JSTransferable, +} = require('internal/worker/js_transferable'); +const { E, F } = require('internal/test/transfer'); + +// Tests that F is transferable even tho it does not directly, +// observably extend the JSTransferable class. + +const mc = new MessageChannel(); + +mc.port1.onmessageerror = common.mustNotCall(); + +mc.port1.onmessage = common.mustCall(({ data }) => { + assert(!(data instanceof JSTransferable)); + assert(data instanceof F); + assert(data instanceof E); + assert.strictEqual(data.b, 1); + mc.port1.close(); +}); + +mc.port2.postMessage(new F(1)); diff --git a/test/parallel/test-performanceobserver-gc.js b/test/parallel/test-performanceobserver-gc.js new file mode 100644 index 00000000000000..fe9397631c2d42 --- /dev/null +++ b/test/parallel/test-performanceobserver-gc.js @@ -0,0 +1,17 @@ +'use strict'; + +require('../common'); + +// Verifies that setting up two observers to listen +// to gc performance does not crash. + +const { + PerformanceObserver, +} = require('perf_hooks'); + +// We don't actually care if the callback is ever invoked in this test +const obs = new PerformanceObserver(() => {}); +const obs2 = new PerformanceObserver(() => {}); + +obs.observe({ type: 'gc' }); +obs2.observe({ type: 'gc' }); diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index 56e3dc67e6a81c..ab2f217e963261 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -54,7 +54,7 @@ if (common.hasCrypto) { // The following also matches a development version of OpenSSL 3.x which // can be in the format '3.0.0-alpha4-dev'. This can be handy when building // and linking against the main development branch of OpenSSL. - /^\d+\.\d+\.\d+(-[-a-z0-9]+)?$/ : + /^\d+\.\d+\.\d+(?:[-+][a-z0-9]+)*$/ : /^\d+\.\d+\.\d+[a-z]?(\+quic)?(-fips)?$/; assert(versionRegex.test(process.versions.openssl)); } diff --git a/test/parallel/test-punycode.js b/test/parallel/test-punycode.js index 190c0b22b313dc..efd3b92a6e7e50 100644 --- a/test/parallel/test-punycode.js +++ b/test/parallel/test-punycode.js @@ -1,3 +1,5 @@ +// Flags: --pending-deprecation + // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -20,7 +22,13 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); + +const punycodeWarning = + 'The `punycode` module is deprecated. Please use a userland alternative ' + + 'instead.'; +common.expectWarning('DeprecationWarning', punycodeWarning, 'DEP0040'); + const punycode = require('punycode'); const assert = require('assert'); diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index afa9fd33d22c4f..a3020181b3532e 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -277,7 +277,7 @@ function assertCursorRowsAndCols(rli, rows, cols) { const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; // ['foo', 'baz', 'bar', bat']; let callCount = 0; - rli.on('line', function(line) { + rli.on('line', (line) => { assert.strictEqual(line, expectedLines[callCount]); callCount++; }); @@ -353,7 +353,7 @@ function assertCursorRowsAndCols(rli, rows, cols) { }); const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; let callCount = 0; - rli.on('line', function(line) { + rli.on('line', (line) => { assert.strictEqual(line, expectedLines[callCount]); callCount++; }); @@ -380,7 +380,7 @@ function assertCursorRowsAndCols(rli, rows, cols) { const [rli, fi] = getInterface({ terminal: true }); const keys = []; const err = new Error('bad thing happened'); - fi.on('keypress', function(key) { + fi.on('keypress', (key) => { keys.push(key); if (key === 'X') { throw err; @@ -795,7 +795,7 @@ for (let i = 0; i < 12; i++) { assert.strictEqual(isWarned(process.stdout._events), false); } -[true, false].forEach(function(terminal) { +[true, false].forEach((terminal) => { // Disable history { const [rli, fi] = getInterface({ terminal, historySize: 0 }); @@ -890,7 +890,7 @@ for (let i = 0; i < 12; i++) { const buf = Buffer.from('☮', 'utf8'); const [rli, fi] = getInterface({ terminal }); let callCount = 0; - rli.on('line', function(line) { + rli.on('line', (line) => { callCount++; assert.strictEqual(line, buf.toString('utf8')); }); @@ -1004,7 +1004,7 @@ for (let i = 0; i < 12; i++) { rli.setPrompt('ddd> '); rli.prompt(); rli.write("really shouldn't be seeing this"); - rli.question('What do you think of node.js? ', function(answer) { + rli.question('What do you think of node.js? ', (answer) => { console.log('Thank you for your valuable feedback:', answer); rli.close(); }); @@ -1056,7 +1056,7 @@ for (let i = 0; i < 12; i++) { const crlfDelay = 200; const [rli, fi] = getInterface({ terminal, crlfDelay }); let callCount = 0; - rli.on('line', function(line) { + rli.on('line', () => { callCount++; }); fi.emit('data', '\r'); @@ -1078,7 +1078,7 @@ for (let i = 0; i < 12; i++) { const delay = 200; const [rli, fi] = getInterface({ terminal, crlfDelay }); let callCount = 0; - rli.on('line', function(line) { + rli.on('line', () => { callCount++; }); fi.emit('data', '\r'); diff --git a/test/parallel/test-readline-tab-complete.js b/test/parallel/test-readline-tab-complete.js index 7ccdef116492b7..c283d446f9af28 100644 --- a/test/parallel/test-readline-tab-complete.js +++ b/test/parallel/test-readline-tab-complete.js @@ -31,15 +31,15 @@ common.skipIfDumbTerminal(); const width = getStringWidth(char) - 1; class FakeInput extends EventEmitter { - columns = ((width + 1) * 10 + (lineBreak ? 0 : 10)) * 3 + columns = ((width + 1) * 10 + (lineBreak ? 0 : 10)) * 3 - write = common.mustCall((data) => { - output += data; - }, 6) + write = common.mustCall((data) => { + output += data; + }, 6) - resume() {} - pause() {} - end() {} + resume() {} + pause() {} + end() {} } const fi = new FakeInput(); @@ -47,7 +47,7 @@ common.skipIfDumbTerminal(); input: fi, output: fi, terminal: true, - completer: completer + completer: common.mustCallAtLeast(completer), }); const last = '\r\nFirst group\r\n\r\n' + @@ -68,3 +68,35 @@ common.skipIfDumbTerminal(); rli.close(); }); }); + +{ + let output = ''; + class FakeInput extends EventEmitter { + columns = 80 + + write = common.mustCall((data) => { + output += data; + }, 1) + + resume() {} + pause() {} + end() {} + } + + const fi = new FakeInput(); + const rli = new readline.Interface({ + input: fi, + output: fi, + terminal: true, + completer: + common.mustCallAtLeast((_, cb) => cb(new Error('message'))), + }); + + rli.on('line', common.mustNotCall()); + fi.emit('data', '\t'); + queueMicrotask(() => { + assert.match(output, /^Tab completion error: Error: message/); + output = ''; + }); + rli.close(); +} diff --git a/test/parallel/test-repl-history-navigation.js b/test/parallel/test-repl-history-navigation.js index 044c788a16af3f..df4f0390a69c23 100644 --- a/test/parallel/test-repl-history-navigation.js +++ b/test/parallel/test-repl-history-navigation.js @@ -16,6 +16,7 @@ const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); process.throwDeprecation = true; +process.on('warning', common.mustNotCall()); const defaultHistoryPath = path.join(tmpdir.path, '.node_repl_history'); @@ -554,6 +555,42 @@ const tests = [ expected: [], clean: false }, + { + env: { NODE_REPL_HISTORY: defaultHistoryPath }, + test: ['const util = {}', ENTER, + 'ut', RIGHT, ENTER], + expected: common.hasIntl && common.hasCrypto ? [ + prompt, ...'const util = {}', + 'undefined\n', + prompt, ...'ut', ' // il', '\n// {}', + 'il', '\n// {}', + '{}\n', + prompt, + ] : [], + clean: false + }, + { + env: { NODE_REPL_HISTORY: defaultHistoryPath }, + test: [ + 'const utilDesc = Reflect.getOwnPropertyDescriptor(globalThis, "util")', + ENTER, + 'globalThis.util = {}', ENTER, + 'ut', RIGHT, ENTER, + 'Reflect.defineProperty(globalThis, "util", utilDesc)', ENTER], + expected: common.hasIntl && common.hasCrypto ? [ + prompt, ...'const utilDesc = ' + + 'Reflect.getOwnPropertyDescriptor(globalThis, "util")', + 'undefined\n', + prompt, ...'globalThis.util = {}', + '{}\n', + prompt, ...'ut', ' // il', 'il', + '{}\n', + prompt, ...'Reflect.defineProperty(globalThis, "util", utilDesc)', + 'true\n', + prompt, + ] : [], + clean: false + }, ]; const numtests = tests.length; diff --git a/test/parallel/test-repl-uncaught-exception-evalcallback.js b/test/parallel/test-repl-uncaught-exception-evalcallback.js new file mode 100644 index 00000000000000..a6f6e341049d6c --- /dev/null +++ b/test/parallel/test-repl-uncaught-exception-evalcallback.js @@ -0,0 +1,23 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const repl = require('repl'); +const { PassThrough } = require('stream'); +const input = new PassThrough(); +const output = new PassThrough(); + +const r = repl.start({ + input, output, + eval: common.mustCall((code, context, filename, cb) => { + r.setPrompt('prompt! '); + cb(new Error('err')); + }) +}); + +input.end('foo\n'); + +// The output includes exactly one post-error prompt. +const out = output.read().toString(); +assert.match(out, /prompt!/); +assert.doesNotMatch(out, /prompt![\S\s]*prompt!/); +output.on('data', common.mustNotCall()); diff --git a/test/parallel/test-stream-writable-destroy.js b/test/parallel/test-stream-writable-destroy.js index 7cd800b0938138..2e6e1f975a2be1 100644 --- a/test/parallel/test-stream-writable-destroy.js +++ b/test/parallel/test-stream-writable-destroy.js @@ -460,3 +460,14 @@ const assert = require('assert'); assert.strictEqual(write.destroyed, true); })); } + +{ + // Destroy twice + const write = new Writable({ + write(chunk, enc, cb) { cb(); } + }); + + write.end(common.mustCall()); + write.destroy(); + write.destroy(); +} diff --git a/test/parallel/test-tls-max-send-fragment.js b/test/parallel/test-tls-max-send-fragment.js index eca995d66483b5..bbb7849f005bf9 100644 --- a/test/parallel/test-tls-max-send-fragment.js +++ b/test/parallel/test-tls-max-send-fragment.js @@ -33,15 +33,38 @@ const buf = Buffer.allocUnsafe(10000); let received = 0; const maxChunk = 768; +const invalidArgumentError = { + name: 'TypeError', + code: 'ERR_INVALID_ARG_TYPE' +}; + const server = tls.createServer({ key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') }, function(c) { - // Lower and upper limits + + // No size is passed. + assert.throws(() => c.setMaxSendFragment(), invalidArgumentError); + + // Invalid arg is passed. + [null, undefined, '', {}, false, true, []].forEach((arg) => { + assert.throws(() => c.setMaxSendFragment(arg), invalidArgumentError); + }); + + [NaN, Infinity, 2 ** 31].forEach((arg) => { + assert.throws(() => c.setMaxSendFragment(arg), { + name: 'RangeError', + code: 'ERR_OUT_OF_RANGE' + }); + }); + + assert.throws(() => c.setMaxSendFragment(Symbol()), { name: 'TypeError' }); + + // Lower and upper limits. assert(!c.setMaxSendFragment(511)); assert(!c.setMaxSendFragment(16385)); - // Correct fragment size + // Correct fragment size. assert(c.setMaxSendFragment(maxChunk)); c.end(buf); diff --git a/test/parallel/test-tls-ticket-invalid-arg.js b/test/parallel/test-tls-ticket-invalid-arg.js new file mode 100644 index 00000000000000..55143cdca31e77 --- /dev/null +++ b/test/parallel/test-tls-ticket-invalid-arg.js @@ -0,0 +1,24 @@ +'use strict'; +const common = require('../common'); +if (!common.hasCrypto) { + common.skip('missing crypto'); +} + +const assert = require('assert'); +const tls = require('tls'); + +const server = new tls.Server(); + +[null, undefined, 0, 1, 1n, Symbol(), {}, [], true, false, '', () => {}] + .forEach((arg) => + assert.throws( + () => server.setTicketKeys(arg), + { code: 'ERR_INVALID_ARG_TYPE' } + )); + +[new Uint8Array(1), Buffer.from([1]), new DataView(new ArrayBuffer(2))].forEach( + (arg) => + assert.throws(() => { + server.setTicketKeys(arg); + }, /Session ticket keys must be a 48-byte buffer/) +); diff --git a/test/parallel/test-tls-transport-destroy-after-own-gc.js b/test/parallel/test-tls-transport-destroy-after-own-gc.js index 9b9c8353077dfe..819aa0a03d6cb4 100644 --- a/test/parallel/test-tls-transport-destroy-after-own-gc.js +++ b/test/parallel/test-tls-transport-destroy-after-own-gc.js @@ -15,12 +15,12 @@ const makeDuplexPair = require('../common/duplexpair'); let { clientSide } = makeDuplexPair(); let clientTLS = new TLSSocket(clientSide, { isServer: false }); -let clientTLSHandle = clientTLS._handle; +let clientTLSHandle = clientTLS._handle; // eslint-disable-line no-unused-vars setImmediate(() => { clientTLS = null; global.gc(); - clientTLSHandle = null; // eslint-disable-line no-unused-vars + clientTLSHandle = null; global.gc(); setImmediate(() => { clientSide = null; diff --git a/test/parallel/test-tojson-perf_hooks.js b/test/parallel/test-tojson-perf_hooks.js new file mode 100644 index 00000000000000..2a716fc4478c29 --- /dev/null +++ b/test/parallel/test-tojson-perf_hooks.js @@ -0,0 +1,14 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); +const { performance } = require('perf_hooks'); + +// Test toJSON for performance object +{ + assert.strictEqual(typeof performance.toJSON, 'function'); + const jsonObject = performance.toJSON(); + assert.strictEqual(typeof jsonObject, 'object'); + assert.strictEqual(jsonObject.timeOrigin, performance.timeOrigin); + assert.strictEqual(typeof jsonObject.nodeTiming, 'object'); +} diff --git a/test/parallel/test-util-inspect-getters-accessing-this.js b/test/parallel/test-util-inspect-getters-accessing-this.js index 3d185b134e852d..998cd82db8f4b3 100644 --- a/test/parallel/test-util-inspect-getters-accessing-this.js +++ b/test/parallel/test-util-inspect-getters-accessing-this.js @@ -7,24 +7,61 @@ require('../common'); const assert = require('assert'); -const util = require('util'); +const { inspect } = require('util'); -class X { - constructor() { - this._y = 123; - } +{ + class X { + constructor() { + this._y = 123; + } - get y() { - return this._y; + get y() { + return this._y; + } } + + const result = inspect(new X(), { + getters: true, + showHidden: true + }); + + assert.strictEqual( + result, + 'X { _y: 123, [y]: [Getter: 123] }' + ); } -const result = util.inspect(new X(), { - getters: true, - showHidden: true -}); +// Regression test for https://github.com/nodejs/node/issues/37054 +{ + class A { + constructor(B) { + this.B = B; + } + get b() { + return this.B; + } + } + + class B { + constructor() { + this.A = new A(this); + } + get a() { + return this.A; + } + } + + const result = inspect(new B(), { + depth: 1, + getters: true, + showHidden: true + }); -assert.strictEqual( - result, - 'X { _y: 123, [y]: [Getter: 123] }' -); + assert.strictEqual( + result, + '<ref *1> B {\n' + + ' A: A { B: [Circular *1], [b]: [Getter] [Circular *1] },\n' + + ' [a]: [Getter] A { B: [Circular *1], [b]: [Getter] [Circular *1] }\n' + + '}', + ); +} diff --git a/test/parallel/test-zlib-brotli.js b/test/parallel/test-zlib-brotli.js index 772b655177aa18..ef31db3dd64ac4 100644 --- a/test/parallel/test-zlib-brotli.js +++ b/test/parallel/test-zlib-brotli.js @@ -71,3 +71,24 @@ const sampleBuffer = fixtures.readSync('/pss-vectors.json'); message: 'Initialization failed' }); } + +{ + // Test options.flush range + assert.throws(() => { + zlib.brotliCompressSync('', { flush: zlib.constants.Z_FINISH }); + }, { + code: 'ERR_OUT_OF_RANGE', + name: 'RangeError', + message: 'The value of "options.flush" is out of range. It must be >= 0 ' + + 'and <= 3. Received 4', + }); + + assert.throws(() => { + zlib.brotliCompressSync('', { finishFlush: zlib.constants.Z_FINISH }); + }, { + code: 'ERR_OUT_OF_RANGE', + name: 'RangeError', + message: 'The value of "options.finishFlush" is out of range. It must be ' + + '>= 0 and <= 3. Received 4', + }); +} diff --git a/test/pummel/test-crypto-dh-hash-modp18.js b/test/pummel/test-crypto-dh-hash-modp18.js index 288a647bdd321d..06121d1f6dc956 100644 --- a/test/pummel/test-crypto-dh-hash-modp18.js +++ b/test/pummel/test-crypto-dh-hash-modp18.js @@ -21,8 +21,15 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) + +if (!common.hasCrypto) { common.skip('node compiled without OpenSSL.'); +} + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/pummel/test-crypto-dh-hash.js b/test/pummel/test-crypto-dh-hash.js index 7188fbb32b9197..5b7002ce7fe16b 100644 --- a/test/pummel/test-crypto-dh-hash.js +++ b/test/pummel/test-crypto-dh-hash.js @@ -21,8 +21,15 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) + +if (!common.hasCrypto) { common.skip('node compiled without OpenSSL.'); +} + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/pummel/test-crypto-dh-keys.js b/test/pummel/test-crypto-dh-keys.js index 37095135f85174..33c2ed86073045 100644 --- a/test/pummel/test-crypto-dh-keys.js +++ b/test/pummel/test-crypto-dh-keys.js @@ -21,6 +21,7 @@ 'use strict'; const common = require('../common'); + if (!common.hasCrypto) { common.skip('node compiled without OpenSSL.'); } diff --git a/test/pummel/test-crypto-timing-safe-equal-benchmarks.js b/test/pummel/test-crypto-timing-safe-equal-benchmarks.js index b649b071e1e49d..3c6e31e8294cc8 100644 --- a/test/pummel/test-crypto-timing-safe-equal-benchmarks.js +++ b/test/pummel/test-crypto-timing-safe-equal-benchmarks.js @@ -111,7 +111,7 @@ assert( `timingSafeEqual should not leak information from its execution time (t=${t})` ); -// As a sanity check to make sure the statistical tests are working, run the +// As a coherence check to make sure the statistical tests are working, run the // same benchmarks again, this time with an unsafe comparison function. In this // case the t-value should be above the threshold. const unsafeCompare = (bufA, bufB) => bufA.equals(bufB); diff --git a/test/pummel/test-dh-regr.js b/test/pummel/test-dh-regr.js index bb041e4c5d1033..fff20c3ed08816 100644 --- a/test/pummel/test-dh-regr.js +++ b/test/pummel/test-dh-regr.js @@ -21,8 +21,15 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) + +if (!common.hasCrypto) { common.skip('missing crypto'); +} + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} const assert = require('assert'); const crypto = require('crypto'); diff --git a/test/pummel/test-fs-largefile.js b/test/pummel/test-fs-largefile.js index 409d7a2112f027..9c2b26782d9c96 100644 --- a/test/pummel/test-fs-largefile.js +++ b/test/pummel/test-fs-largefile.js @@ -34,7 +34,7 @@ const fd = fs.openSync(filepath, 'w+'); const offset = 5 * 1024 * 1024 * 1024; // 5GB const message = 'Large File'; -fs.truncateSync(fd, offset); +fs.ftruncateSync(fd, offset); assert.strictEqual(fs.statSync(filepath).size, offset); const writeBuf = Buffer.from(message); fs.writeSync(fd, writeBuf, 0, writeBuf.length, offset); diff --git a/test/pummel/test-fs-watch-system-limit.js b/test/pummel/test-fs-watch-system-limit.js index ce390dd3d0bb83..6662986a1a8ee0 100644 --- a/test/pummel/test-fs-watch-system-limit.js +++ b/test/pummel/test-fs-watch-system-limit.js @@ -5,10 +5,18 @@ const child_process = require('child_process'); const fs = require('fs'); const stream = require('stream'); -if (!common.isLinux) +if (!common.isLinux) { common.skip('The fs watch limit is OS-dependent'); -if (!common.enoughTestCpu) +} + +if (!common.enoughTestCpu) { common.skip('This test is resource-intensive'); +} + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} try { // Ensure inotify limit is low enough for the test to actually exercise the diff --git a/test/pummel/test-heapdump-dns.js b/test/pummel/test-heapdump-dns.js index 68ce08d96e3242..675ddc09aca61a 100644 --- a/test/pummel/test-heapdump-dns.js +++ b/test/pummel/test-heapdump-dns.js @@ -10,7 +10,7 @@ dns.resolve('localhost', () => {}); validateSnapshotNodes('Node / ChannelWrap', [ { children: [ - { node_name: 'Node / node_ares_task_list', edge_name: 'task_list' }, + { node_name: 'Node / NodeAresTask::List', edge_name: 'task_list' }, // `Node / ChannelWrap` (C++) -> `ChannelWrap` (JS) { node_name: 'ChannelWrap', edge_name: 'wrapped' }, ] diff --git a/test/parallel/test-heapsnapshot-near-heap-limit-bounded.js b/test/pummel/test-heapsnapshot-near-heap-limit-bounded.js similarity index 82% rename from test/parallel/test-heapsnapshot-near-heap-limit-bounded.js rename to test/pummel/test-heapsnapshot-near-heap-limit-bounded.js index a57b9a8fc4b5e5..0ad6a898d126eb 100644 --- a/test/parallel/test-heapsnapshot-near-heap-limit-bounded.js +++ b/test/pummel/test-heapsnapshot-near-heap-limit-bounded.js @@ -1,6 +1,12 @@ 'use strict'; -require('../common'); +const common = require('../common'); + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} + const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const { spawnSync } = require('child_process'); diff --git a/test/parallel/test-heapsnapshot-near-heap-limit.js b/test/pummel/test-heapsnapshot-near-heap-limit.js similarity index 94% rename from test/parallel/test-heapsnapshot-near-heap-limit.js rename to test/pummel/test-heapsnapshot-near-heap-limit.js index 5743f71a3f568c..6651f2ae9f52d9 100644 --- a/test/parallel/test-heapsnapshot-near-heap-limit.js +++ b/test/pummel/test-heapsnapshot-near-heap-limit.js @@ -1,6 +1,12 @@ 'use strict'; const common = require('../common'); + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} + const tmpdir = require('../common/tmpdir'); const assert = require('assert'); const { spawnSync } = require('child_process'); diff --git a/test/sequential/test-net-bytes-per-incoming-chunk-overhead.js b/test/pummel/test-net-bytes-per-incoming-chunk-overhead.js similarity index 85% rename from test/sequential/test-net-bytes-per-incoming-chunk-overhead.js rename to test/pummel/test-net-bytes-per-incoming-chunk-overhead.js index 7bcdfaa9f6f6aa..fed903c2639d99 100644 --- a/test/sequential/test-net-bytes-per-incoming-chunk-overhead.js +++ b/test/pummel/test-net-bytes-per-incoming-chunk-overhead.js @@ -2,8 +2,15 @@ 'use strict'; const common = require('../common'); -if (process.config.variables.asan) + +if (process.config.variables.asan) { common.skip('ASAN messes with memory measurements'); +} + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} const assert = require('assert'); const net = require('net'); diff --git a/test/pummel/test-next-tick-infinite-calls.js b/test/pummel/test-next-tick-infinite-calls.js index 5ee44076dcc2f3..7ae3b2261358af 100644 --- a/test/pummel/test-next-tick-infinite-calls.js +++ b/test/pummel/test-next-tick-infinite-calls.js @@ -20,7 +20,12 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); +const common = require('../common'); + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} let complete = 0; diff --git a/test/pummel/test-policy-integrity.js b/test/pummel/test-policy-integrity.js index 15124aefd46904..9383f881fbe514 100644 --- a/test/pummel/test-policy-integrity.js +++ b/test/pummel/test-policy-integrity.js @@ -1,7 +1,16 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) common.skip('missing crypto'); + +if (!common.hasCrypto) { + common.skip('missing crypto'); +} + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} + common.requireNoPackageJSONAbove(); const { debuglog } = require('util'); @@ -76,6 +85,7 @@ function newTestId() { return nextTestId++; } tmpdir.refresh(); +common.requireNoPackageJSONAbove(tmpdir.path); let spawned = 0; const toSpawn = []; diff --git a/test/parallel/test-webcrypto-derivebits-pbkdf2.js b/test/pummel/test-webcrypto-derivebits-pbkdf2.js similarity index 99% rename from test/parallel/test-webcrypto-derivebits-pbkdf2.js rename to test/pummel/test-webcrypto-derivebits-pbkdf2.js index ed8279dae134dc..745071f3458aba 100644 --- a/test/parallel/test-webcrypto-derivebits-pbkdf2.js +++ b/test/pummel/test-webcrypto-derivebits-pbkdf2.js @@ -2,8 +2,14 @@ const common = require('../common'); -if (!common.hasCrypto) +if (!common.hasCrypto) { common.skip('missing crypto'); +} + +if ((process.config.variables.arm_version === '6') || + (process.config.variables.arm_version === '7')) { + common.skip('Too slow for armv6 and armv7 bots'); +} const assert = require('assert'); const { subtle } = require('crypto').webcrypto; diff --git a/test/report/test-report-uncaught-exception-primitives.js b/test/report/test-report-uncaught-exception-primitives.js new file mode 100644 index 00000000000000..75a05f335cf2e2 --- /dev/null +++ b/test/report/test-report-uncaught-exception-primitives.js @@ -0,0 +1,25 @@ +// Flags: --report-uncaught-exception +'use strict'; +// Test producing a report on uncaught exception. +const common = require('../common'); +const assert = require('assert'); +const helper = require('../common/report'); +const tmpdir = require('../common/tmpdir'); + +const exception = 1; + +tmpdir.refresh(); +process.report.directory = tmpdir.path; + +process.on('uncaughtException', common.mustCall((err) => { + assert.strictEqual(err, exception); + const reports = helper.findReports(process.pid, tmpdir.path); + assert.strictEqual(reports.length, 1); + console.log(reports[0]); + helper.validate(reports[0], [ + ['header.event', 'Exception'], + ['javascriptStack.message', `${exception}`], + ]); +})); + +throw exception; diff --git a/test/report/test-report-uncaught-exception-symbols.js b/test/report/test-report-uncaught-exception-symbols.js new file mode 100644 index 00000000000000..5997d0e0898ac0 --- /dev/null +++ b/test/report/test-report-uncaught-exception-symbols.js @@ -0,0 +1,25 @@ +// Flags: --report-uncaught-exception +'use strict'; +// Test producing a report on uncaught exception. +const common = require('../common'); +const assert = require('assert'); +const helper = require('../common/report'); +const tmpdir = require('../common/tmpdir'); + +const exception = Symbol('foobar'); + +tmpdir.refresh(); +process.report.directory = tmpdir.path; + +process.on('uncaughtException', common.mustCall((err) => { + assert.strictEqual(err, exception); + const reports = helper.findReports(process.pid, tmpdir.path); + assert.strictEqual(reports.length, 1); + console.log(reports[0]); + helper.validate(reports[0], [ + ['header.event', 'Exception'], + ['javascriptStack.message', 'Symbol(foobar)'], + ]); +})); + +throw exception; diff --git a/tools/doc/generate.js b/tools/doc/generate.js index f49acb6207c9b4..d2f3aea27f25a4 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -43,7 +43,7 @@ let filename = null; let nodeVersion = null; let outputDir = null; let apilinks = {}; -let versions = {}; +let versions = []; async function main() { for (const arg of args) { diff --git a/tools/eslint-rules/non-ascii-character.js b/tools/eslint-rules/non-ascii-character.js index 6588125d33d201..f9ee24273fdcb6 100644 --- a/tools/eslint-rules/non-ascii-character.js +++ b/tools/eslint-rules/non-ascii-character.js @@ -46,12 +46,6 @@ module.exports = (context) => { node, message, loc: sourceCode.getLocFromIndex(offendingCharacterPosition), - fix: (fixer) => { - return fixer.replaceText( - node, - suggestion ? `${suggestion}` : '' - ); - } }); }; @@ -59,7 +53,3 @@ module.exports = (context) => { Program: (node) => reportIfError(node, context.getSourceCode()) }; }; - -module.exports.meta = { - fixable: 'code' -}; diff --git a/tools/license-builder.sh b/tools/license-builder.sh index 05a15471c7e77f..80aaac11b1cade 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -89,9 +89,6 @@ addlicense "gtest" "test/cctest/gtest" "$(cat "${rootdir}"/test/cctest/gtest/LIC # nghttp2 addlicense "nghttp2" "deps/nghttp2" "$(cat "${rootdir}"/deps/nghttp2/COPYING)" -# node-inspect -addlicense "node-inspect" "deps/node-inspect" "$(cat "${rootdir}"/deps/node-inspect/LICENSE)" - # large_pages addlicense "large_pages" "src/large_pages" "$(sed -e '/SPDX-License-Identifier/,$d' -e 's/^\/\///' "${rootdir}"/src/large_pages/node_large_page.h)" diff --git a/tools/lint-md.js b/tools/lint-md.js index 5c2f40abc7b43a..57aeb202322736 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -49667,6 +49667,11 @@ function validateMeta(node, file, meta) { function validateYAMLComments(tree, file) { unistUtilVisit(tree, "html", function visitor(node) { + if (node.value.startsWith("<!--YAML\n")) + file.message( + "Expected `<!-- YAML`, found `<!--YAML`. Please add a space", + node + ); if (!node.value.startsWith("<!-- YAML\n")) return; try { const meta = jsYaml$2.load("#" + node.value.slice(0, -"-->".length)); diff --git a/tools/macos-installer/productbuild/distribution.xml.tmpl b/tools/macos-installer/productbuild/distribution.xml.tmpl index 0b9d84701bb01a..d9b9d00f26c0f3 100644 --- a/tools/macos-installer/productbuild/distribution.xml.tmpl +++ b/tools/macos-installer/productbuild/distribution.xml.tmpl @@ -6,7 +6,7 @@ <background alignment="topleft" file="osx_installer_logo.png"/> <pkg-ref id="org.nodejs.node.pkg" auth="root"/> <pkg-ref id="org.nodejs.npm.pkg" auth="root"/> - <options customize="allow" require-scripts="false"/> + <options customize="allow" require-scripts="false" hostArchitectures="x86_64,arm64"/> <license file="license.rtf"/> <choices-outline> <line choice="org.nodejs.node.pkg" /> diff --git a/tools/make-v8.sh b/tools/make-v8.sh index 5a23432b589001..79ab02af275aa9 100755 --- a/tools/make-v8.sh +++ b/tools/make-v8.sh @@ -36,7 +36,8 @@ if [ "$ARCH" = "s390x" ] || [ "$ARCH" = "ppc64le" ]; then gn gen -v "out.gn/$BUILD_ARCH_TYPE" --args="is_component_build=false is_debug=false use_goma=false goma_dir=\"None\" use_custom_libcxx=false v8_target_cpu=\"$TARGET_ARCH\" target_cpu=\"$TARGET_ARCH\" v8_enable_backtrace=true" ninja -v -C "out.gn/$BUILD_ARCH_TYPE" d8 cctest inspector-test else + DEPOT_TOOLS_DIR="$(cd _depot_tools && pwd)" # shellcheck disable=SC2086 - PATH=~/_depot_tools:$PATH tools/dev/v8gen.py "$BUILD_ARCH_TYPE" --no-goma $V8_BUILD_OPTIONS - PATH=~/_depot_tools:$PATH ninja -C "out.gn/$BUILD_ARCH_TYPE/" d8 cctest inspector-test + PATH="$DEPOT_TOOLS_DIR":$PATH tools/dev/v8gen.py "$BUILD_ARCH_TYPE" --no-goma $V8_BUILD_OPTIONS + PATH="$DEPOT_TOOLS_DIR":$PATH ninja -C "out.gn/$BUILD_ARCH_TYPE/" d8 cctest inspector-test fi diff --git a/tools/node-lint-md-cli-rollup/package-lock.json b/tools/node-lint-md-cli-rollup/package-lock.json index f2e9be4fc61bb5..5fccba999a5ecf 100644 --- a/tools/node-lint-md-cli-rollup/package-lock.json +++ b/tools/node-lint-md-cli-rollup/package-lock.json @@ -2111,9 +2111,9 @@ } }, "node_modules/remark-preset-lint-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-2.1.1.tgz", - "integrity": "sha512-3Cv4kDVaC8V0XsiK/ntdpOEztOx0v8L9DczQ3KRIN7QwyPS3Gjaq2DJ7wNglXVK4z7PekcND0mXK78eLduhwwA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-2.2.0.tgz", + "integrity": "sha512-85wnJs7HyQlY3Ae5HRxPjJx5cFBvAAOSfSpmyNVb6Fs9HYoR9ipimAxWfl2M1gYVT2rBrod8Jzu415dOMukzOw==", "dependencies": { "js-yaml": "^4.0.0", "remark-lint": "^8.0.0", @@ -4226,9 +4226,9 @@ } }, "remark-preset-lint-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-2.1.1.tgz", - "integrity": "sha512-3Cv4kDVaC8V0XsiK/ntdpOEztOx0v8L9DczQ3KRIN7QwyPS3Gjaq2DJ7wNglXVK4z7PekcND0mXK78eLduhwwA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-2.2.0.tgz", + "integrity": "sha512-85wnJs7HyQlY3Ae5HRxPjJx5cFBvAAOSfSpmyNVb6Fs9HYoR9ipimAxWfl2M1gYVT2rBrod8Jzu415dOMukzOw==", "requires": { "js-yaml": "^4.0.0", "remark-lint": "^8.0.0", diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 14ba7e2cb32d9a..1aa25ee3d1d47b 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -283,7 +283,7 @@ The following companies, organizations, and individuals support ESLint's ongoing <p><a href="https://automattic.com"><img src="https://images.opencollective.com/photomatt/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3> <p><a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="96"></a> <a href="https://google.com/chrome"><img src="https://images.opencollective.com/chrome/dc55bd4/logo.png" alt="Chrome's Web Framework & Tools Performance Fund" height="96"></a> <a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/e780cd4/logo.png" alt="Shopify" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://opensource.microsoft.com"><img src="https://avatars.githubusercontent.com/u/6154722?v=4" alt="Microsoft" height="96"></a> <a href="https://substack.com/"><img src="https://avatars.githubusercontent.com/u/53023767?v=4" alt="Substack" height="96"></a></p><h3>Silver Sponsors</h3> <p><a href="https://retool.com/"><img src="https://images.opencollective.com/retool/98ea68e/logo.png" alt="Retool" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a></p><h3>Bronze Sponsors</h3> -<p><a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/b282e39/logo.png" alt="Buy.Fineproxy.Org" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p> +<p><a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/b282e39/logo.png" alt="Buy.Fineproxy.Org" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="null"><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p> <!--sponsorsend--> ## <a name="technology-sponsors"></a>Technology Sponsors diff --git a/tools/node_modules/eslint/lib/linter/linter.js b/tools/node_modules/eslint/lib/linter/linter.js index adb5c215590251..576816b5b7ba6f 100644 --- a/tools/node_modules/eslint/lib/linter/linter.js +++ b/tools/node_modules/eslint/lib/linter/linter.js @@ -1308,9 +1308,9 @@ class Linter { return []; } - // Resolve configuration again if the file extension was changed. - if (configForRecursive && path.extname(blockName) !== originalExtname) { - debug("Resolving configuration again because the file extension was changed."); + // Resolve configuration again if the file content or extension was changed. + if (configForRecursive && (text !== blockText || path.extname(blockName) !== originalExtname)) { + debug("Resolving configuration again because the file content or extension was changed."); return this._verifyWithConfigArray( blockText, configForRecursive, diff --git a/tools/node_modules/eslint/lib/rules/no-unused-vars.js b/tools/node_modules/eslint/lib/rules/no-unused-vars.js index 32589099cf4be7..7619be331fa436 100644 --- a/tools/node_modules/eslint/lib/rules/no-unused-vars.js +++ b/tools/node_modules/eslint/lib/rules/no-unused-vars.js @@ -624,10 +624,18 @@ module.exports = { // Report the first declaration. if (unusedVar.defs.length > 0) { + + // report last write reference, https://github.com/eslint/eslint/issues/14324 + const writeReferences = unusedVar.references.filter(ref => ref.isWrite() && ref.from.variableScope === unusedVar.scope.variableScope); + + let referenceToReport; + + if (writeReferences.length > 0) { + referenceToReport = writeReferences[writeReferences.length - 1]; + } + context.report({ - node: unusedVar.references.length ? unusedVar.references[ - unusedVar.references.length - 1 - ].identifier : unusedVar.identifiers[0], + node: referenceToReport ? referenceToReport.identifier : unusedVar.identifiers[0], messageId: "unusedVar", data: unusedVar.references.some(ref => ref.isWrite()) ? getAssignedMessageData(unusedVar) diff --git a/tools/node_modules/eslint/node_modules/call-bind/LICENSE b/tools/node_modules/eslint/node_modules/call-bind/LICENSE deleted file mode 100644 index 48f05d01d0acae..00000000000000 --- a/tools/node_modules/eslint/node_modules/call-bind/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Jordan Harband - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/call-bind/README.md b/tools/node_modules/eslint/node_modules/call-bind/README.md deleted file mode 100644 index 53649eb4622446..00000000000000 --- a/tools/node_modules/eslint/node_modules/call-bind/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# call-bind -Robustly `.call.bind()` a function. diff --git a/tools/node_modules/eslint/node_modules/call-bind/callBound.js b/tools/node_modules/eslint/node_modules/call-bind/callBound.js deleted file mode 100644 index 8374adfd0549fe..00000000000000 --- a/tools/node_modules/eslint/node_modules/call-bind/callBound.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var callBind = require('./'); - -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - return intrinsic; -}; diff --git a/tools/node_modules/eslint/node_modules/call-bind/index.js b/tools/node_modules/eslint/node_modules/call-bind/index.js deleted file mode 100644 index 6fa3e4af7e19fd..00000000000000 --- a/tools/node_modules/eslint/node_modules/call-bind/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); -var GetIntrinsic = require('get-intrinsic'); - -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, 'length'); - if (desc.configurable) { - // original length, plus the receiver, minus any additional arguments (after the receiver) - $defineProperty( - func, - 'length', - { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } - ); - } - } - return func; -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; -} diff --git a/tools/node_modules/eslint/node_modules/call-bind/package.json b/tools/node_modules/eslint/node_modules/call-bind/package.json deleted file mode 100644 index 4360556a7fa0f1..00000000000000 --- a/tools/node_modules/eslint/node_modules/call-bind/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "call-bind", - "version": "1.0.2", - "description": "Robustly `.call.bind()` a function", - "main": "index.js", - "exports": { - ".": [ - { - "default": "./index.js" - }, - "./index.js" - ], - "./callBound": [ - { - "default": "./callBound.js" - }, - "./callBound.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "prepublish": "safe-publish-latest", - "lint": "eslint --ext=.js,.mjs .", - "pretest": "npm run lint", - "tests-only": "nyc tape 'test/*'", - "test": "npm run tests-only", - "posttest": "aud --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ljharb/call-bind.git" - }, - "keywords": [ - "javascript", - "ecmascript", - "es", - "js", - "callbind", - "callbound", - "call", - "bind", - "bound", - "call-bind", - "call-bound", - "function", - "es-abstract" - ], - "author": "Jordan Harband <ljharb@gmail.com>", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/ljharb/call-bind/issues" - }, - "homepage": "https://github.com/ljharb/call-bind#readme", - "devDependencies": { - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", - "auto-changelog": "^2.2.1", - "eslint": "^7.17.0", - "nyc": "^10.3.2", - "safe-publish-latest": "^1.1.4", - "tape": "^5.1.1" - }, - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - } -} diff --git a/tools/node_modules/eslint/node_modules/chalk/package.json b/tools/node_modules/eslint/node_modules/chalk/package.json index 0d99f0f28621f2..c2d63f67e5e955 100644 --- a/tools/node_modules/eslint/node_modules/chalk/package.json +++ b/tools/node_modules/eslint/node_modules/chalk/package.json @@ -1,6 +1,6 @@ { "name": "chalk", - "version": "4.1.0", + "version": "4.1.1", "description": "Terminal string styling done right", "license": "MIT", "repository": "chalk/chalk", diff --git a/tools/node_modules/eslint/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/chalk/readme.md index 338f42cb8b525b..851259216bc193 100644 --- a/tools/node_modules/eslint/node_modules/chalk/readme.md +++ b/tools/node_modules/eslint/node_modules/chalk/readme.md @@ -13,6 +13,48 @@ <img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900"> +<br> + +--- + +<div align="center"> + <p> + <p> + <sup> + Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a> + </sup> + </p> + <sup>Special thanks to:</sup> + <br> + <br> + <a href="https://standardresume.co/tech"> + <img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/> + </a> + <br> + <br> + <a href="https://retool.com/?utm_campaign=sindresorhus"> + <img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="210"/> + </a> + <br> + <br> + <a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github"> + <div> + <img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler"> + </div> + <b>All your environment variables, in one place</b> + <div> + <span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span> + <br> + <span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span> + </div> + </a> + </p> +</div> + +--- + +<br> + ## Highlights - Expressive API diff --git a/tools/node_modules/eslint/node_modules/function-bind/.jscs.json b/tools/node_modules/eslint/node_modules/function-bind/.jscs.json deleted file mode 100644 index 8c4479480be70d..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/.jscs.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "es3": true, - - "additionalRules": [], - - "requireSemicolons": true, - - "disallowMultipleSpaces": true, - - "disallowIdentifierNames": [], - - "requireCurlyBraces": { - "allExcept": [], - "keywords": ["if", "else", "for", "while", "do", "try", "catch"] - }, - - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], - - "disallowSpaceAfterKeywords": [], - - "disallowSpaceBeforeComma": true, - "disallowSpaceAfterComma": false, - "disallowSpaceBeforeSemicolon": true, - - "disallowNodeTypes": [ - "DebuggerStatement", - "ForInStatement", - "LabeledStatement", - "SwitchCase", - "SwitchStatement", - "WithStatement" - ], - - "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "requireSpaceBetweenArguments": true, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "requireSpaceAfterPrefixUnaryOperators": [], - - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforePostfixUnaryOperators": [], - - "disallowSpaceBeforeBinaryOperators": [], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "disallowSpaceAfterBinaryOperators": [], - - "disallowImplicitTypeConversion": ["binary", "string"], - - "disallowKeywords": ["with", "eval"], - - "requireKeywordsOnNewLine": [], - "disallowKeywordsOnNewLine": ["else"], - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "disallowTrailingComma": true, - - "excludeFiles": ["node_modules/**", "vendor/**"], - - "disallowMultipleLineStrings": true, - - "requireDotNotation": { "allExcept": ["keywords"] }, - - "requireParenthesesAroundIIFE": true, - - "validateLineBreaks": "LF", - - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - - "disallowOperatorBeforeLineBreak": [], - - "requireSpaceBeforeKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "finally", - "while", - "with", - "return" - ], - - "validateAlignedFunctionParameters": { - "lineBreakAfterOpeningBraces": true, - "lineBreakBeforeClosingBraces": true - }, - - "requirePaddingNewLinesBeforeExport": true, - - "validateNewlineAfterArrayElements": { - "maximum": 8 - }, - - "requirePaddingNewLinesAfterUseStrict": true, - - "disallowArrowFunctions": true, - - "disallowMultiLineTernary": true, - - "validateOrderInObjectKeys": "asc-insensitive", - - "disallowIdenticalDestructuringNames": true, - - "disallowNestedTernaries": { "maxLevel": 1 }, - - "requireSpaceAfterComma": { "allExcept": ["trailing"] }, - "requireAlignedMultilineParams": false, - - "requireSpacesInGenerator": { - "afterStar": true - }, - - "disallowSpacesInGenerator": { - "beforeStar": true - }, - - "disallowVar": false, - - "requireArrayDestructuring": false, - - "requireEnhancedObjectLiterals": false, - - "requireObjectDestructuring": false, - - "requireEarlyReturn": false, - - "requireCapitalizedConstructorsNew": { - "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] - }, - - "requireImportAlphabetized": false, - - "requireSpaceBeforeObjectValues": true, - "requireSpaceBeforeDestructuredValues": true, - - "disallowSpacesInsideTemplateStringPlaceholders": true, - - "disallowArrayDestructuringReturn": false, - - "requireNewlineBeforeSingleStatementsInIf": false, - - "disallowUnusedVariables": true, - - "requireSpacesInsideImportedObjectBraces": true, - - "requireUseStrict": true -} - diff --git a/tools/node_modules/eslint/node_modules/function-bind/LICENSE b/tools/node_modules/eslint/node_modules/function-bind/LICENSE deleted file mode 100644 index 62d6d237ff179b..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2013 Raynos. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/tools/node_modules/eslint/node_modules/function-bind/README.md b/tools/node_modules/eslint/node_modules/function-bind/README.md deleted file mode 100644 index 81862a02cb940c..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# function-bind - -<!-- - [![build status][travis-svg]][travis-url] - [![NPM version][npm-badge-svg]][npm-url] - [![Coverage Status][5]][6] - [![gemnasium Dependency Status][7]][8] - [![Dependency status][deps-svg]][deps-url] - [![Dev Dependency status][dev-deps-svg]][dev-deps-url] ---> - -<!-- [![browser support][11]][12] --> - -Implementation of function.prototype.bind - -## Example - -I mainly do this for unit tests I run on phantomjs. -PhantomJS does not have Function.prototype.bind :( - -```js -Function.prototype.bind = require("function-bind") -``` - -## Installation - -`npm install function-bind` - -## Contributors - - - Raynos - -## MIT Licenced - - [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg - [travis-url]: https://travis-ci.org/Raynos/function-bind - [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg - [npm-url]: https://npmjs.org/package/function-bind - [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png - [6]: https://coveralls.io/r/Raynos/function-bind - [7]: https://gemnasium.com/Raynos/function-bind.png - [8]: https://gemnasium.com/Raynos/function-bind - [deps-svg]: https://david-dm.org/Raynos/function-bind.svg - [deps-url]: https://david-dm.org/Raynos/function-bind - [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg - [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies - [11]: https://ci.testling.com/Raynos/function-bind.png - [12]: https://ci.testling.com/Raynos/function-bind diff --git a/tools/node_modules/eslint/node_modules/function-bind/implementation.js b/tools/node_modules/eslint/node_modules/function-bind/implementation.js deleted file mode 100644 index cc4daec1b080a1..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/implementation.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -/* eslint no-invalid-this: 1 */ - -var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; -var slice = Array.prototype.slice; -var toStr = Object.prototype.toString; -var funcType = '[object Function]'; - -module.exports = function bind(that) { - var target = this; - if (typeof target !== 'function' || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - var args = slice.call(arguments, 1); - - var bound; - var binder = function () { - if (this instanceof bound) { - var result = target.apply( - this, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return this; - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - } - }; - - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - for (var i = 0; i < boundLength; i++) { - boundArgs.push('$' + i); - } - - bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); - - if (target.prototype) { - var Empty = function Empty() {}; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - - return bound; -}; diff --git a/tools/node_modules/eslint/node_modules/function-bind/index.js b/tools/node_modules/eslint/node_modules/function-bind/index.js deleted file mode 100644 index 3bb6b9609889f8..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var implementation = require('./implementation'); - -module.exports = Function.prototype.bind || implementation; diff --git a/tools/node_modules/eslint/node_modules/function-bind/package.json b/tools/node_modules/eslint/node_modules/function-bind/package.json deleted file mode 100644 index 20a1727cbf8711..00000000000000 --- a/tools/node_modules/eslint/node_modules/function-bind/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "function-bind", - "version": "1.1.1", - "description": "Implementation of Function.prototype.bind", - "keywords": [ - "function", - "bind", - "shim", - "es5" - ], - "author": "Raynos <raynos2@gmail.com>", - "repository": "git://github.com/Raynos/function-bind.git", - "main": "index", - "homepage": "https://github.com/Raynos/function-bind", - "contributors": [ - { - "name": "Raynos" - }, - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "bugs": { - "url": "https://github.com/Raynos/function-bind/issues", - "email": "raynos2@gmail.com" - }, - "dependencies": {}, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "covert": "^1.1.0", - "eslint": "^4.5.0", - "jscs": "^3.0.7", - "tape": "^4.8.0" - }, - "license": "MIT", - "scripts": { - "pretest": "npm run lint", - "test": "npm run tests-only", - "posttest": "npm run coverage -- --quiet", - "tests-only": "node test", - "coverage": "covert test/*.js", - "lint": "npm run jscs && npm run eslint", - "jscs": "jscs *.js */*.js", - "eslint": "eslint *.js */*.js" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "ie/8..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - } -} diff --git a/tools/node_modules/eslint/node_modules/get-intrinsic/LICENSE b/tools/node_modules/eslint/node_modules/get-intrinsic/LICENSE deleted file mode 100644 index 48f05d01d0acae..00000000000000 --- a/tools/node_modules/eslint/node_modules/get-intrinsic/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Jordan Harband - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/get-intrinsic/README.md b/tools/node_modules/eslint/node_modules/get-intrinsic/README.md deleted file mode 100644 index 335a3b49b2ebe6..00000000000000 --- a/tools/node_modules/eslint/node_modules/get-intrinsic/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# get-intrinsic <sup>[![Version Badge][npm-version-svg]][package-url]</sup> - -[![dependency status][deps-svg]][deps-url] -[![dev dependency status][dev-deps-svg]][dev-deps-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][npm-badge-png]][package-url] - -Get and robustly cache all JS language-level intrinsics at first require time. - -See the syntax described [in the JS spec](https://tc39.es/ecma262/#sec-well-known-intrinsic-objects) for reference. - -## Example - -```js -var GetIntrinsic = require('get-intrinsic'); -var assert = require('assert'); - -// static methods -assert.equal(GetIntrinsic('%Math.pow%'), Math.pow); -assert.equal(Math.pow(2, 3), 8); -assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); -delete Math.pow; -assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); - -// instance methods -var arr = [1]; -assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push); -assert.deepEqual(arr, [1]); - -arr.push(2); -assert.deepEqual(arr, [1, 2]); - -GetIntrinsic('%Array.prototype.push%').call(arr, 3); -assert.deepEqual(arr, [1, 2, 3]); - -delete Array.prototype.push; -GetIntrinsic('%Array.prototype.push%').call(arr, 4); -assert.deepEqual(arr, [1, 2, 3, 4]); - -// missing features -delete JSON.parse; // to simulate a real intrinsic that is missing in the environment -assert.throws(() => GetIntrinsic('%JSON.parse%')); -assert.equal(undefined, GetIntrinsic('%JSON.parse%', true)); -``` - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -## Security - -Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. - -[package-url]: https://npmjs.org/package/get-intrinsic -[npm-version-svg]: http://versionbadg.es/ljharb/get-intrinsic.svg -[deps-svg]: https://david-dm.org/ljharb/get-intrinsic.svg -[deps-url]: https://david-dm.org/ljharb/get-intrinsic -[dev-deps-svg]: https://david-dm.org/ljharb/get-intrinsic/dev-status.svg -[dev-deps-url]: https://david-dm.org/ljharb/get-intrinsic#info=devDependencies -[npm-badge-png]: https://nodei.co/npm/get-intrinsic.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/get-intrinsic.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/get-intrinsic.svg -[downloads-url]: https://npm-stat.com/charts.html?package=get-intrinsic diff --git a/tools/node_modules/eslint/node_modules/get-intrinsic/index.js b/tools/node_modules/eslint/node_modules/get-intrinsic/index.js deleted file mode 100644 index d6c06c281c0ac7..00000000000000 --- a/tools/node_modules/eslint/node_modules/get-intrinsic/index.js +++ /dev/null @@ -1,330 +0,0 @@ -'use strict'; - -var undefined; - -var $SyntaxError = SyntaxError; -var $Function = Function; -var $TypeError = TypeError; - -// eslint-disable-next-line consistent-return -var getEvalledConstructor = function (expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); - } catch (e) {} -}; - -var $gOPD = Object.getOwnPropertyDescriptor; -if ($gOPD) { - try { - $gOPD({}, ''); - } catch (e) { - $gOPD = null; // this is IE 8, which has a broken gOPD - } -} - -var throwTypeError = function () { - throw new $TypeError(); -}; -var ThrowTypeError = $gOPD - ? (function () { - try { - // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties - arguments.callee; // IE 8 does not throw here - return throwTypeError; - } catch (calleeThrows) { - try { - // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') - return $gOPD(arguments, 'callee').get; - } catch (gOPDthrows) { - return throwTypeError; - } - } - }()) - : throwTypeError; - -var hasSymbols = require('has-symbols')(); - -var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto - -var needsEval = {}; - -var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); - -var INTRINSICS = { - '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, - '%Array%': Array, - '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, - '%AsyncFromSyncIteratorPrototype%': undefined, - '%AsyncFunction%': needsEval, - '%AsyncGenerator%': needsEval, - '%AsyncGeneratorFunction%': needsEval, - '%AsyncIteratorPrototype%': needsEval, - '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, - '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, - '%Boolean%': Boolean, - '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, - '%Date%': Date, - '%decodeURI%': decodeURI, - '%decodeURIComponent%': decodeURIComponent, - '%encodeURI%': encodeURI, - '%encodeURIComponent%': encodeURIComponent, - '%Error%': Error, - '%eval%': eval, // eslint-disable-line no-eval - '%EvalError%': EvalError, - '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, - '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, - '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, - '%Function%': $Function, - '%GeneratorFunction%': needsEval, - '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, - '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, - '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, - '%isFinite%': isFinite, - '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, - '%JSON%': typeof JSON === 'object' ? JSON : undefined, - '%Map%': typeof Map === 'undefined' ? undefined : Map, - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), - '%Math%': Math, - '%Number%': Number, - '%Object%': Object, - '%parseFloat%': parseFloat, - '%parseInt%': parseInt, - '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, - '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, - '%RangeError%': RangeError, - '%ReferenceError%': ReferenceError, - '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, - '%RegExp%': RegExp, - '%Set%': typeof Set === 'undefined' ? undefined : Set, - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), - '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, - '%String%': String, - '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, - '%Symbol%': hasSymbols ? Symbol : undefined, - '%SyntaxError%': $SyntaxError, - '%ThrowTypeError%': ThrowTypeError, - '%TypedArray%': TypedArray, - '%TypeError%': $TypeError, - '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, - '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, - '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, - '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, - '%URIError%': URIError, - '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, - '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, - '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet -}; - -var doEval = function doEval(name) { - var value; - if (name === '%AsyncFunction%') { - value = getEvalledConstructor('async function () {}'); - } else if (name === '%GeneratorFunction%') { - value = getEvalledConstructor('function* () {}'); - } else if (name === '%AsyncGeneratorFunction%') { - value = getEvalledConstructor('async function* () {}'); - } else if (name === '%AsyncGenerator%') { - var fn = doEval('%AsyncGeneratorFunction%'); - if (fn) { - value = fn.prototype; - } - } else if (name === '%AsyncIteratorPrototype%') { - var gen = doEval('%AsyncGenerator%'); - if (gen) { - value = getProto(gen.prototype); - } - } - - INTRINSICS[name] = value; - - return value; -}; - -var LEGACY_ALIASES = { - '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], - '%ArrayPrototype%': ['Array', 'prototype'], - '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], - '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], - '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], - '%ArrayProto_values%': ['Array', 'prototype', 'values'], - '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], - '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], - '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], - '%BooleanPrototype%': ['Boolean', 'prototype'], - '%DataViewPrototype%': ['DataView', 'prototype'], - '%DatePrototype%': ['Date', 'prototype'], - '%ErrorPrototype%': ['Error', 'prototype'], - '%EvalErrorPrototype%': ['EvalError', 'prototype'], - '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], - '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], - '%FunctionPrototype%': ['Function', 'prototype'], - '%Generator%': ['GeneratorFunction', 'prototype'], - '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], - '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], - '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], - '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], - '%JSONParse%': ['JSON', 'parse'], - '%JSONStringify%': ['JSON', 'stringify'], - '%MapPrototype%': ['Map', 'prototype'], - '%NumberPrototype%': ['Number', 'prototype'], - '%ObjectPrototype%': ['Object', 'prototype'], - '%ObjProto_toString%': ['Object', 'prototype', 'toString'], - '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], - '%PromisePrototype%': ['Promise', 'prototype'], - '%PromiseProto_then%': ['Promise', 'prototype', 'then'], - '%Promise_all%': ['Promise', 'all'], - '%Promise_reject%': ['Promise', 'reject'], - '%Promise_resolve%': ['Promise', 'resolve'], - '%RangeErrorPrototype%': ['RangeError', 'prototype'], - '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], - '%RegExpPrototype%': ['RegExp', 'prototype'], - '%SetPrototype%': ['Set', 'prototype'], - '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], - '%StringPrototype%': ['String', 'prototype'], - '%SymbolPrototype%': ['Symbol', 'prototype'], - '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], - '%TypedArrayPrototype%': ['TypedArray', 'prototype'], - '%TypeErrorPrototype%': ['TypeError', 'prototype'], - '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], - '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], - '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], - '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], - '%URIErrorPrototype%': ['URIError', 'prototype'], - '%WeakMapPrototype%': ['WeakMap', 'prototype'], - '%WeakSetPrototype%': ['WeakSet', 'prototype'] -}; - -var bind = require('function-bind'); -var hasOwn = require('has'); -var $concat = bind.call(Function.call, Array.prototype.concat); -var $spliceApply = bind.call(Function.apply, Array.prototype.splice); -var $replace = bind.call(Function.call, String.prototype.replace); -var $strSlice = bind.call(Function.call, String.prototype.slice); - -/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ -var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; -var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ -var stringToPath = function stringToPath(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === '%' && last !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); - } else if (last === '%' && first !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); - } - var result = []; - $replace(string, rePropName, function (match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; - }); - return result; -}; -/* end adaptation */ - -var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = '%' + alias[0] + '%'; - } - - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) { - value = doEval(intrinsicName); - } - if (typeof value === 'undefined' && !allowMissing) { - throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); - } - - return { - alias: alias, - name: intrinsicName, - value: value - }; - } - - throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); -}; - -module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== 'string' || name.length === 0) { - throw new $TypeError('intrinsic name must be a non-empty string'); - } - if (arguments.length > 1 && typeof allowMissing !== 'boolean') { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; - - var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ( - ( - (first === '"' || first === "'" || first === '`') - || (last === '"' || last === "'" || last === '`') - ) - && first !== last - ) { - throw new $SyntaxError('property names with quotes must have matching quotes'); - } - if (part === 'constructor' || !isOwn) { - skipFurtherCaching = true; - } - - intrinsicBaseName += '.' + part; - intrinsicRealName = '%' + intrinsicBaseName + '%'; - - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); - } - return void undefined; - } - if ($gOPD && (i + 1) >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - - // By convention, when a data property is converted to an accessor - // property to emulate a data property that does not suffer from - // the override mistake, that accessor's getter is marked with - // an `originalValue` property. Here, when we detect this, we - // uphold the illusion by pretending to see that original data - // property, i.e., returning the value rather than the getter - // itself. - if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { - value = desc.get; - } else { - value = value[part]; - } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; - } - } - } - return value; -}; diff --git a/tools/node_modules/eslint/node_modules/get-intrinsic/package.json b/tools/node_modules/eslint/node_modules/get-intrinsic/package.json deleted file mode 100644 index d34894a0681d27..00000000000000 --- a/tools/node_modules/eslint/node_modules/get-intrinsic/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "get-intrinsic", - "version": "1.1.1", - "description": "Get and robustly cache all JS language-level intrinsics at first require time", - "main": "index.js", - "exports": { - ".": [ - { - "default": "./index.js" - }, - "./index.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "prelint": "evalmd README.md", - "lint": "eslint --ext=.js,.mjs .", - "pretest": "npm run lint", - "tests-only": "nyc tape 'test/**/*.js'", - "test": "npm run tests-only", - "posttest": "aud --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/ljharb/get-intrinsic.git" - }, - "keywords": [ - "javascript", - "ecmascript", - "es", - "js", - "intrinsic", - "getintrinsic", - "es-abstract" - ], - "author": "Jordan Harband <ljharb@gmail.com>", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/ljharb/get-intrinsic/issues" - }, - "homepage": "https://github.com/ljharb/get-intrinsic#readme", - "devDependencies": { - "@ljharb/eslint-config": "^17.5.0", - "aud": "^1.1.3", - "auto-changelog": "^2.2.1", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.0-next.2", - "es-value-fixtures": "^1.0.0", - "eslint": "^7.19.0", - "evalmd": "^0.0.19", - "foreach": "^2.0.5", - "has-bigints": "^1.0.1", - "make-async-function": "^1.0.0", - "make-async-generator-function": "^1.0.0", - "make-generator-function": "^2.0.0", - "nyc": "^10.3.2", - "object-inspect": "^1.9.0", - "tape": "^5.1.1" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } -} diff --git a/tools/node_modules/eslint/node_modules/has-symbols/LICENSE b/tools/node_modules/eslint/node_modules/has-symbols/LICENSE deleted file mode 100644 index df31cbf3c064d0..00000000000000 --- a/tools/node_modules/eslint/node_modules/has-symbols/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Jordan Harband - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/has-symbols/README.md b/tools/node_modules/eslint/node_modules/has-symbols/README.md deleted file mode 100644 index 3875d7e58d7ea9..00000000000000 --- a/tools/node_modules/eslint/node_modules/has-symbols/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# has-symbols <sup>[![Version Badge][2]][1]</sup> - -[![dependency status][5]][6] -[![dev dependency status][7]][8] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][11]][1] - -Determine if the JS environment has Symbol support. Supports spec, or shams. - -## Example - -```js -var hasSymbols = require('has-symbols'); - -hasSymbols() === true; // if the environment has native Symbol support. Not polyfillable, not forgeable. - -var hasSymbolsKinda = require('has-symbols/shams'); -hasSymbolsKinda() === true; // if the environment has a Symbol sham that mostly follows the spec. -``` - -## Supported Symbol shams - - get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols) - - core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js) - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/has-symbols -[2]: https://versionbadg.es/inspect-js/has-symbols.svg -[5]: https://david-dm.org/inspect-js/has-symbols.svg -[6]: https://david-dm.org/inspect-js/has-symbols -[7]: https://david-dm.org/inspect-js/has-symbols/dev-status.svg -[8]: https://david-dm.org/inspect-js/has-symbols#info=devDependencies -[11]: https://nodei.co/npm/has-symbols.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/has-symbols.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/has-symbols.svg -[downloads-url]: https://npm-stat.com/charts.html?package=has-symbols diff --git a/tools/node_modules/eslint/node_modules/has-symbols/index.js b/tools/node_modules/eslint/node_modules/has-symbols/index.js deleted file mode 100644 index 17044fa21daa70..00000000000000 --- a/tools/node_modules/eslint/node_modules/has-symbols/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var origSymbol = typeof Symbol !== 'undefined' && Symbol; -var hasSymbolSham = require('./shams'); - -module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== 'function') { return false; } - if (typeof Symbol !== 'function') { return false; } - if (typeof origSymbol('foo') !== 'symbol') { return false; } - if (typeof Symbol('bar') !== 'symbol') { return false; } - - return hasSymbolSham(); -}; diff --git a/tools/node_modules/eslint/node_modules/has-symbols/package.json b/tools/node_modules/eslint/node_modules/has-symbols/package.json deleted file mode 100644 index 2c2f57278b1747..00000000000000 --- a/tools/node_modules/eslint/node_modules/has-symbols/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "has-symbols", - "version": "1.0.2", - "author": { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "contributors": [ - { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - } - ], - "description": "Determine if the JS environment has Symbol support. Supports spec, or shams.", - "license": "MIT", - "main": "index.js", - "scripts": { - "prepublish": "safe-publish-latest", - "pretest": "npm run --silent lint", - "test": "npm run tests-only", - "posttest": "aud --production", - "tests-only": "npm run test:stock && npm run test:staging && npm run test:shams", - "test:stock": "nyc node test", - "test:staging": "nyc node --harmony --es-staging test", - "test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs", - "test:shams:corejs": "nyc node test/shams/core-js.js", - "test:shams:getownpropertysymbols": "nyc node test/shams/get-own-property-symbols.js", - "lint": "eslint --ext=js,mjs .", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git://github.com/inspect-js/has-symbols.git" - }, - "keywords": [ - "Symbol", - "symbols", - "typeof", - "sham", - "polyfill", - "native", - "core-js", - "ES6" - ], - "devDependencies": { - "@ljharb/eslint-config": "^17.5.1", - "aud": "^1.1.4", - "auto-changelog": "^2.2.1", - "core-js": "^2.6.12", - "eslint": "^7.20.0", - "get-own-property-symbols": "^0.9.5", - "nyc": "^10.3.2", - "safe-publish-latest": "^1.1.4", - "tape": "^5.2.0" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..6.0", - "firefox/15.0..latest", - "firefox/nightly", - "chrome/4.0..10.0", - "chrome/20.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2" - ] - }, - "engines": { - "node": ">= 0.4" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "greenkeeper": { - "ignore": [ - "core-js" - ] - } -} diff --git a/tools/node_modules/eslint/node_modules/has-symbols/shams.js b/tools/node_modules/eslint/node_modules/has-symbols/shams.js deleted file mode 100644 index 1285210ef7ccef..00000000000000 --- a/tools/node_modules/eslint/node_modules/has-symbols/shams.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -/* eslint complexity: [2, 18], max-statements: [2, 33] */ -module.exports = function hasSymbols() { - if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } - if (typeof Symbol.iterator === 'symbol') { return true; } - - var obj = {}; - var sym = Symbol('test'); - var symObj = Object(sym); - if (typeof sym === 'string') { return false; } - - if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } - if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } - - // temp disabled per https://github.com/ljharb/object.assign/issues/17 - // if (sym instanceof Symbol) { return false; } - // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 - // if (!(symObj instanceof Symbol)) { return false; } - - // if (typeof Symbol.prototype.toString !== 'function') { return false; } - // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } - - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop - if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } - - if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } - - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { return false; } - - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } - - if (typeof Object.getOwnPropertyDescriptor === 'function') { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } - } - - return true; -}; diff --git a/tools/node_modules/eslint/node_modules/has/LICENSE-MIT b/tools/node_modules/eslint/node_modules/has/LICENSE-MIT deleted file mode 100644 index ae7014d385df3d..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 Thiago de Arruda - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/has/README.md b/tools/node_modules/eslint/node_modules/has/README.md deleted file mode 100644 index 635e3a4baab00b..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# has - -> Object.prototype.hasOwnProperty.call shortcut - -## Installation - -```sh -npm install --save has -``` - -## Usage - -```js -var has = require('has'); - -has({}, 'hasOwnProperty'); // false -has(Object.prototype, 'hasOwnProperty'); // true -``` diff --git a/tools/node_modules/eslint/node_modules/has/package.json b/tools/node_modules/eslint/node_modules/has/package.json deleted file mode 100644 index 7c4592f16de071..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "has", - "description": "Object.prototype.hasOwnProperty.call shortcut", - "version": "1.0.3", - "homepage": "https://github.com/tarruda/has", - "author": { - "name": "Thiago de Arruda", - "email": "tpadilha84@gmail.com" - }, - "contributors": [ - { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/tarruda/has.git" - }, - "bugs": { - "url": "https://github.com/tarruda/has/issues" - }, - "license": "MIT", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" - } - ], - "main": "./src", - "dependencies": { - "function-bind": "^1.1.1" - }, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "eslint": "^4.19.1", - "tape": "^4.9.0" - }, - "engines": { - "node": ">= 0.4.0" - }, - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "tape test" - } -} diff --git a/tools/node_modules/eslint/node_modules/has/src/index.js b/tools/node_modules/eslint/node_modules/has/src/index.js deleted file mode 100644 index dd92dd9094edb0..00000000000000 --- a/tools/node_modules/eslint/node_modules/has/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/tools/node_modules/eslint/node_modules/is-boolean-object/LICENSE b/tools/node_modules/eslint/node_modules/is-boolean-object/LICENSE deleted file mode 100644 index b43df444e51828..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-boolean-object/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Jordan Harband - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/tools/node_modules/eslint/node_modules/is-boolean-object/README.md b/tools/node_modules/eslint/node_modules/is-boolean-object/README.md deleted file mode 100644 index aeadb7c816c545..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-boolean-object/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# is-boolean-object <sup>[![Version Badge][2]][1]</sup> - -[![Build Status][3]][4] -[![dependency status][5]][6] -[![dev dependency status][7]][8] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][11]][1] - -[![browser support][9]][10] - -Is this value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag. - -## Example - -```js -var isBoolean = require('is-boolean-object'); -var assert = require('assert'); - -assert.notOk(isBoolean(undefined)); -assert.notOk(isBoolean(null)); -assert.notOk(isBoolean('foo')); -assert.notOk(isBoolean(function () {})); -assert.notOk(isBoolean([])); -assert.notOk(isBoolean({})); -assert.notOk(isBoolean(/a/g)); -assert.notOk(isBoolean(new RegExp('a', 'g'))); -assert.notOk(isBoolean(new Date())); -assert.notOk(isBoolean(42)); -assert.notOk(isBoolean(NaN)); -assert.notOk(isBoolean(Infinity)); - -assert.ok(isBoolean(new Boolean(42))); -assert.ok(isBoolean(false)); -assert.ok(isBoolean(Object(false))); -assert.ok(isBoolean(true)); -assert.ok(isBoolean(Object(true))); -``` - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/is-boolean-object -[2]: http://versionbadg.es/ljharb/is-boolean-object.svg -[3]: https://travis-ci.org/ljharb/is-boolean-object.svg -[4]: https://travis-ci.org/ljharb/is-boolean-object -[5]: https://david-dm.org/ljharb/is-boolean-object.svg -[6]: https://david-dm.org/ljharb/is-boolean-object -[7]: https://david-dm.org/ljharb/is-boolean-object/dev-status.svg -[8]: https://david-dm.org/ljharb/is-boolean-object#info=devDependencies -[9]: https://ci.testling.com/ljharb/is-boolean-object.png -[10]: https://ci.testling.com/ljharb/is-boolean-object -[11]: https://nodei.co/npm/is-boolean-object.png?downloads=true&stars=true -[license-image]: http://img.shields.io/npm/l/is-boolean-object.svg -[license-url]: LICENSE -[downloads-image]: http://img.shields.io/npm/dm/is-boolean-object.svg -[downloads-url]: http://npm-stat.com/charts.html?package=is-boolean-object diff --git a/tools/node_modules/eslint/node_modules/is-boolean-object/index.js b/tools/node_modules/eslint/node_modules/is-boolean-object/index.js deleted file mode 100644 index 69864eb56013af..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-boolean-object/index.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -var callBound = require('call-bind/callBound'); -var $boolToStr = callBound('Boolean.prototype.toString'); -var $toString = callBound('Object.prototype.toString'); - -var tryBooleanObject = function booleanBrandCheck(value) { - try { - $boolToStr(value); - return true; - } catch (e) { - return false; - } -}; -var boolClass = '[object Boolean]'; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; - -module.exports = function isBoolean(value) { - if (typeof value === 'boolean') { - return true; - } - if (value === null || typeof value !== 'object') { - return false; - } - return hasToStringTag && Symbol.toStringTag in value ? tryBooleanObject(value) : $toString(value) === boolClass; -}; diff --git a/tools/node_modules/eslint/node_modules/is-boolean-object/package.json b/tools/node_modules/eslint/node_modules/is-boolean-object/package.json deleted file mode 100644 index a2af900f00905b..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-boolean-object/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "is-boolean-object", - "version": "1.1.0", - "author": "Jordan Harband <ljharb@gmail.com>", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "description": "Is this value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", - "license": "MIT", - "main": "index.js", - "scripts": { - "prepublish": "safe-publish-latest", - "pretest": "npm run lint", - "test": "npm run tests-only && npm run test:harmony", - "tests-only": "nyc tape 'test/**/*.js'", - "test:harmony": "node --harmony --es-staging test", - "posttest": "aud --production", - "prelint": "npm run eccheck", - "lint": "eslint --ext=js,mjs .", - "eccheck": "eclint check $(git ls-files)", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git://github.com/ljharb/is-boolean-object.git" - }, - "keywords": [ - "Boolean", - "ES6", - "toStringTag", - "@@toStringTag", - "Boolean object", - "true", - "false", - "is-boolean" - ], - "dependencies": { - "call-bind": "^1.0.0" - }, - "devDependencies": { - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", - "auto-changelog": "^2.2.1", - "eclint": "^2.8.1", - "eslint": "^7.15.0", - "foreach": "^2.0.5", - "indexof": "^0.0.1", - "is": "^3.3.0", - "nyc": "^10.3.2", - "safe-publish-latest": "^1.1.4", - "tape": "^5.0.1" - }, - "testling": { - "files": "test.js", - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..6.0", - "firefox/15.0..latest", - "firefox/nightly", - "chrome/4.0..10.0", - "chrome/20.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2" - ] - }, - "engines": { - "node": ">= 0.4" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - } -} diff --git a/tools/node_modules/eslint/node_modules/is-number-object/LICENSE b/tools/node_modules/eslint/node_modules/is-number-object/LICENSE deleted file mode 100644 index b43df444e51828..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-number-object/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Jordan Harband - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/tools/node_modules/eslint/node_modules/is-number-object/README.md b/tools/node_modules/eslint/node_modules/is-number-object/README.md deleted file mode 100644 index 5617d7ec6bf981..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-number-object/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# is-number-object <sup>[![Version Badge][2]][1]</sup> - -[![Build Status][3]][4] -[![dependency status][5]][6] -[![dev dependency status][7]][8] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][11]][1] - -Is this value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag. - -## Example - -```js -var isNumber = require('is-number-object'); -var assert = require('assert'); - -assert.notOk(isNumber(undefined)); -assert.notOk(isNumber(null)); -assert.notOk(isNumber(false)); -assert.notOk(isNumber(true)); -assert.notOk(isNumber('foo')); -assert.notOk(isNumber(function () {})); -assert.notOk(isNumber([])); -assert.notOk(isNumber({})); -assert.notOk(isNumber(/a/g)); -assert.notOk(isNumber(new RegExp('a', 'g'))); -assert.notOk(isNumber(new Date())); - -assert.ok(isNumber(42)); -assert.ok(isNumber(NaN)); -assert.ok(isNumber(Infinity)); -assert.ok(isNumber(new Number(42))); -``` - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/is-number-object -[2]: http://versionbadg.es/inspect-js/is-number-object.svg -[3]: https://travis-ci.org/inspect-js/is-number-object.svg -[4]: https://travis-ci.org/inspect-js/is-number-object -[5]: https://david-dm.org/inspect-js/is-number-object.svg -[6]: https://david-dm.org/inspect-js/is-number-object -[7]: https://david-dm.org/inspect-js/is-number-object/dev-status.svg -[8]: https://david-dm.org/inspect-js/is-number-object#info=devDependencies -[11]: https://nodei.co/npm/is-number-object.png?downloads=true&stars=true -[license-image]: http://img.shields.io/npm/l/is-number-object.svg -[license-url]: LICENSE -[downloads-image]: http://img.shields.io/npm/dm/is-number-object.svg -[downloads-url]: http://npm-stat.com/charts.html?package=is-number-object diff --git a/tools/node_modules/eslint/node_modules/is-number-object/index.js b/tools/node_modules/eslint/node_modules/is-number-object/index.js deleted file mode 100644 index de303abe1aae6c..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-number-object/index.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -var numToStr = Number.prototype.toString; -var tryNumberObject = function tryNumberObject(value) { - try { - numToStr.call(value); - return true; - } catch (e) { - return false; - } -}; -var toStr = Object.prototype.toString; -var numClass = '[object Number]'; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; - -module.exports = function isNumberObject(value) { - if (typeof value === 'number') { - return true; - } - if (typeof value !== 'object') { - return false; - } - return hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass; -}; diff --git a/tools/node_modules/eslint/node_modules/is-number-object/package.json b/tools/node_modules/eslint/node_modules/is-number-object/package.json deleted file mode 100644 index f6ab725f69a7b5..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-number-object/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "is-number-object", - "version": "1.0.4", - "author": "Jordan Harband <ljharb@gmail.com>", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "description": "Is this value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", - "license": "MIT", - "main": "index.js", - "scripts": { - "prepublish": "safe-publish-latest", - "pretest": "npm run lint", - "tests-only": "node --harmony --es-staging test", - "test": "npm run tests-only", - "posttest": "npx aud", - "coverage": "covert test/index.js", - "lint": "eslint .", - "eccheck": "eclint check *.js **/*.js > /dev/null", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git://github.com/inspect-js/is-number-object.git" - }, - "keywords": [ - "Number", - "ES6", - "toStringTag", - "@@toStringTag", - "Number object" - ], - "dependencies": {}, - "devDependencies": { - "@ljharb/eslint-config": "^15.0.2", - "auto-changelog": "^1.16.2", - "covert": "^1.1.1", - "eclint": "^2.8.1", - "eslint": "^6.7.2", - "foreach": "^2.0.5", - "has-symbols": "^1.0.1", - "indexof": "^0.0.1", - "is": "^3.3.0", - "safe-publish-latest": "^1.1.4", - "tape": "^4.12.0" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..6.0", - "firefox/15.0..latest", - "firefox/nightly", - "chrome/4.0..10.0", - "chrome/20.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2" - ] - }, - "engines": { - "node": ">= 0.4" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false - } -} diff --git a/tools/node_modules/eslint/node_modules/is-string/LICENSE b/tools/node_modules/eslint/node_modules/is-string/LICENSE deleted file mode 100644 index b43df444e51828..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-string/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Jordan Harband - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/tools/node_modules/eslint/node_modules/is-string/README.md b/tools/node_modules/eslint/node_modules/is-string/README.md deleted file mode 100644 index 13895e5f490076..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-string/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# is-string <sup>[![Version Badge][2]][1]</sup> - -[![Build Status][3]][4] -[![dependency status][5]][6] -[![dev dependency status][7]][8] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][11]][1] - -[![browser support][9]][10] - -Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag. - -## Example - -```js -var isString = require('is-string'); -var assert = require('assert'); - -assert.notOk(isString(undefined)); -assert.notOk(isString(null)); -assert.notOk(isString(false)); -assert.notOk(isString(true)); -assert.notOk(isString(function () {})); -assert.notOk(isString([])); -assert.notOk(isString({})); -assert.notOk(isString(/a/g)); -assert.notOk(isString(new RegExp('a', 'g'))); -assert.notOk(isString(new Date())); -assert.notOk(isString(42)); -assert.notOk(isString(NaN)); -assert.notOk(isString(Infinity)); -assert.notOk(isString(new Number(42))); - -assert.ok(isString('foo')); -assert.ok(isString(Object('foo'))); -``` - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/is-string -[2]: http://versionbadg.es/ljharb/is-string.svg -[3]: https://travis-ci.org/ljharb/is-string.svg -[4]: https://travis-ci.org/ljharb/is-string -[5]: https://david-dm.org/ljharb/is-string.svg -[6]: https://david-dm.org/ljharb/is-string -[7]: https://david-dm.org/ljharb/is-string/dev-status.svg -[8]: https://david-dm.org/ljharb/is-string#info=devDependencies -[9]: https://ci.testling.com/ljharb/is-string.png -[10]: https://ci.testling.com/ljharb/is-string -[11]: https://nodei.co/npm/is-string.png?downloads=true&stars=true -[license-image]: http://img.shields.io/npm/l/is-string.svg -[license-url]: LICENSE -[downloads-image]: http://img.shields.io/npm/dm/is-string.svg -[downloads-url]: http://npm-stat.com/charts.html?package=is-string diff --git a/tools/node_modules/eslint/node_modules/is-string/index.js b/tools/node_modules/eslint/node_modules/is-string/index.js deleted file mode 100644 index 95b7050cc68b55..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-string/index.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -var strValue = String.prototype.valueOf; -var tryStringObject = function tryStringObject(value) { - try { - strValue.call(value); - return true; - } catch (e) { - return false; - } -}; -var toStr = Object.prototype.toString; -var strClass = '[object String]'; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; - -module.exports = function isString(value) { - if (typeof value === 'string') { - return true; - } - if (typeof value !== 'object') { - return false; - } - return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; -}; diff --git a/tools/node_modules/eslint/node_modules/is-string/package.json b/tools/node_modules/eslint/node_modules/is-string/package.json deleted file mode 100644 index a0870540424604..00000000000000 --- a/tools/node_modules/eslint/node_modules/is-string/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "is-string", - "version": "1.0.5", - "author": "Jordan Harband <ljharb@gmail.com>", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "description": "Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", - "license": "MIT", - "main": "index.js", - "scripts": { - "prepublish": "safe-publish-latest", - "pretest": "npm run lint", - "tests-only": "node --harmony --es-staging test", - "test": "npm run tests-only", - "posttest": "npx aud", - "coverage": "covert test/index.js", - "lint": "eslint .", - "eccheck": "eclint check *.js **/*.js > /dev/null", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "repository": { - "type": "git", - "url": "git://github.com/ljharb/is-string.git" - }, - "keywords": [ - "String", - "string", - "ES6", - "toStringTag", - "@@toStringTag", - "String object" - ], - "dependencies": {}, - "devDependencies": { - "@ljharb/eslint-config": "^15.0.2", - "auto-changelog": "^1.16.2", - "covert": "^1.1.1", - "eclint": "^2.8.1", - "eslint": "^6.7.2", - "foreach": "^2.0.5", - "indexof": "^0.0.1", - "is": "^3.3.0", - "safe-publish-latest": "^1.1.4", - "tape": "^4.12.0" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..6.0", - "firefox/15.0..latest", - "firefox/nightly", - "chrome/4.0..10.0", - "chrome/20.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2" - ] - }, - "engines": { - "node": ">= 0.4" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false - } -} diff --git a/tools/node_modules/eslint/node_modules/table/README.md b/tools/node_modules/eslint/node_modules/table/README.md index 22a79962a1a2ee..f34656c5021aa7 100644 --- a/tools/node_modules/eslint/node_modules/table/README.md +++ b/tools/node_modules/eslint/node_modules/table/README.md @@ -14,6 +14,7 @@ * [Cell Content Alignment](#table-usage-cell-content-alignment) * [Column Width](#table-usage-column-width) * [Custom Border](#table-usage-custom-border) + * [Draw Vertical Line](#table-usage-draw-vertical-line) * [Draw Horizontal Line](#table-usage-draw-horizontal-line) * [Single Line Mode](#table-usage-single-line-mode) * [Padding Cell Content](#table-usage-padding-cell-content) @@ -292,6 +293,57 @@ console.log(output); └────┴────┴────┘ ``` +<a name="table-usage-draw-vertical-line"></a> +### Draw Vertical Line + +`{function} config.drawVerticalLine` property is a function that is called for every non-content column in the table. The result of the function `{boolean}` determines whether a border is drawn. + +```js +let data, + output, + options; + +data = [ + ['0A', '0B', '0C'], + ['1A', '1B', '1C'], + ['2A', '2B', '2C'], + ['3A', '3B', '3C'], + ['4A', '4B', '4C'] +]; + +options = { + /** + * @typedef {function} drawVerticalLine + * @param {number} index + * @param {number} size + * @return {boolean} + */ + drawVerticalLine: (index, size) => { + return index === 0 || index === size; + } +}; + +output = table(data, options); + +console.log(output); + +``` + +``` +╔════════════╗ +║ 0A 0B 0C ║ +╟────────────╢ +║ 1A 1B 1C ║ +╟────────────╢ +║ 2A 2B 2C ║ +╟────────────╢ +║ 3A 3B 3C ║ +╟────────────╢ +║ 4A 4B 4C ║ +╚════════════╝ + +``` + <a name="table-usage-draw-horizontal-line"></a> ### Draw Horizontal Line @@ -647,7 +699,7 @@ console.log(output); ║ t amet, consectetur ║ ║ adipiscing elit. Pha ║ ║ sellus pulvinar nibh ║ -║ sed mauris conva... ║ +║ sed mauris convall… ║ ╚══════════════════════╝ ``` 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 09412798ec27f0..c3ff7f3d631a7a 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/alignString.js +++ b/tools/node_modules/eslint/node_modules/table/dist/alignString.js @@ -1,107 +1,47 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _isNumberObject = _interopRequireDefault(require("is-number-object")); - -var _isString = _interopRequireDefault(require("is-string")); - -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} - */ - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const string_width_1 = __importDefault(require("string-width")); const alignLeft = (subject, width) => { - return subject + ' '.repeat(width); + return subject + ' '.repeat(width); }; -/** - * @param {string} subject - * @param {number} width - * @returns {string} - */ - - const alignRight = (subject, width) => { - return ' '.repeat(width) + subject; + return ' '.repeat(width) + subject; }; -/** - * @param {string} subject - * @param {number} width - * @returns {string} - */ - - const alignCenter = (subject, width) => { - let halfWidth; - halfWidth = width / 2; - - if (width % 2 === 0) { - return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth); - } else { - halfWidth = Math.floor(halfWidth); - return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1); - } + let halfWidth; + halfWidth = width / 2; + if (width % 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} */ - - -const alignString = (subject, containerWidth, alignment) => { - if (!(0, _isString.default)(subject)) { - throw new TypeError('Subject parameter value must be a string.'); - } - - if (!(0, _isNumberObject.default)(containerWidth)) { - throw new TypeError('Container width parameter value must be a number.'); - } - - 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 (!(0, _isString.default)(alignment)) { - throw new TypeError('Alignment parameter value must be a string.'); - } - - if (!alignments.includes(alignment)) { - 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); +exports.default = (subject, containerWidth, alignment) => { + if (typeof subject !== 'string') { + throw new TypeError('Subject parameter value must be a string.'); + } + const subjectWidth = string_width_1.default(subject); + if (subjectWidth > containerWidth) { + throw new Error('Subject parameter value width cannot be greater than the container width.'); + } + 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); }; - -var _default = alignString; -exports.default = _default; \ 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 deleted file mode 100644 index a3739bc2748df5..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/alignString.js.flow +++ /dev/null @@ -1,97 +0,0 @@ -import isNumber from 'is-number-object'; -import isString from 'is-string'; -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 (width % 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.includes(alignment)) { - 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/alignTableData.js b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js index fc60afe85c1e43..884a26ba5f58dd 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js @@ -1,34 +1,20 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _stringWidth = _interopRequireDefault(require("string-width")); - -var _alignString = _interopRequireDefault(require("./alignString")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @param {table~row[]} rows - * @param {object} config - * @returns {table~row[]} - */ -const alignTableData = (rows, config) => { - return rows.map(cells => { - return cells.map((value, index1) => { - const column = config.columns[index1]; - - if ((0, _stringWidth.default)(value) === column.width) { - return value; - } else { - return (0, _alignString.default)(value, column.width, column.alignment); - } +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const string_width_1 = __importDefault(require("string-width")); +const alignString_1 = __importDefault(require("./alignString")); +exports.default = (rows, config) => { + return rows.map((row) => { + return row.map((cell, index) => { + const column = config.columns[index]; + if (string_width_1.default(cell) === column.width) { + return cell; + } + else { + return alignString_1.default(cell, column.width, column.alignment); + } + }); }); - }); }; - -var _default = alignTableData; -exports.default = _default; \ 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 deleted file mode 100644 index c82c31e261b70b..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.flow +++ /dev/null @@ -1,21 +0,0 @@ -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/calculateCellHeight.js b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js index 8f7ed9fc8b0e2b..fbe9aa9cf424c6 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js @@ -1,37 +1,12 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _isString = _interopRequireDefault(require("is-string")); - -var _wrapCell = _interopRequireDefault(require("./wrapCell")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @param {string} value - * @param {number} columnWidth - * @param {boolean} useWrapWord - * @returns {number} - */ -const calculateCellHeight = (value, columnWidth, useWrapWord = false) => { - if (!(0, _isString.default)(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.'); - } - - return (0, _wrapCell.default)(value, columnWidth, useWrapWord).length; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const wrapCell_1 = __importDefault(require("./wrapCell")); +exports.default = (value, columnWidth, useWrapWord = false) => { + if (typeof value !== 'string') { + throw new TypeError('Value must be a string.'); + } + return wrapCell_1.default(value, columnWidth, useWrapWord).length; }; - -var _default = calculateCellHeight; -exports.default = _default; \ 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 deleted file mode 100644 index 172604390b2ecb..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.flow +++ /dev/null @@ -1,24 +0,0 @@ -import isString from 'is-string'; -import wrapCell from './wrapCell'; - -/** - * @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.'); - } - - return wrapCell(value, columnWidth, useWrapWord).length; -}; 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 c46fb861ddf123..d267e7906d1475 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js @@ -1,27 +1,16 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _stringWidth = _interopRequireDefault(require("string-width")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const string_width_1 = __importDefault(require("string-width")); /** * Calculates width of each cell contents. - * - * @param {string[]} cells - * @returns {number[]} */ -const calculateCellWidthIndex = cells => { - return cells.map(value => { - return Math.max(...value.split('\n').map(line => { - return (0, _stringWidth.default)(line); - })); - }); +exports.default = (cells) => { + return cells.map((value) => { + return Math.max(...value.split('\n').map((line) => { + return string_width_1.default(line); + })); + }); }; - -var _default = calculateCellWidthIndex; -exports.default = _default; \ 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 deleted file mode 100644 index e2539539a5d15d..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.flow +++ /dev/null @@ -1,17 +0,0 @@ -import stringWidth from 'string-width'; - -/** - * Calculates width of each cell contents. - * - * @param {string[]} cells - * @returns {number[]} - */ -export default (cells) => { - return cells.map((value) => { - return Math.max( - ...value.split('\n').map((line) => { - return stringWidth(line); - }), - ); - }); -}; 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 057d0a506d64da..3312f451d876ea 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js @@ -1,36 +1,24 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const calculateCellWidthIndex_1 = __importDefault(require("./calculateCellWidthIndex")); /** * Produces an array of values that describe the largest value length (width) in every column. - * - * @param {Array[]} rows - * @returns {number[]} */ -const calculateMaximumColumnWidthIndex = 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 = (0, _calculateCellWidthIndex.default)(row); - columnWidthIndex.forEach((valueWidth, index0) => { - if (columns[index0] < valueWidth) { - columns[index0] = valueWidth; - } +exports.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_1.default(row); + columnWidthIndex.forEach((valueWidth, index0) => { + if (columns[index0] < valueWidth) { + columns[index0] = valueWidth; + } + }); }); - }); - return columns; + return columns; }; - -var _default = calculateMaximumColumnWidthIndex; -exports.default = _default; \ 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 deleted file mode 100644 index 5c8c10981cc63b..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow +++ /dev/null @@ -1,27 +0,0 @@ -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/calculateRowHeightIndex.js b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js index b8175d65626cde..3db65542cd9bfe 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js @@ -1,45 +1,21 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _isBooleanObject = _interopRequireDefault(require("is-boolean-object")); - -var _isNumberObject = _interopRequireDefault(require("is-number-object")); - -var _calculateCellHeight = _interopRequireDefault(require("./calculateCellHeight")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const calculateCellHeight_1 = __importDefault(require("./calculateCellHeight")); /** * Calculates the vertical row span index. - * - * @param {Array[]} rows - * @param {object} config - * @returns {number[]} */ -const calculateRowHeightIndex = (rows, config) => { - const tableWidth = rows[0].length; - const rowSpanIndex = []; - rows.forEach(cells => { - const cellHeightIndex = new Array(tableWidth).fill(1); - cells.forEach((value, index1) => { - if (!(0, _isNumberObject.default)(config.columns[index1].width)) { - throw new TypeError('column[index].width must be a number.'); - } - - if (!(0, _isBooleanObject.default)(config.columns[index1].wrapWord)) { - throw new TypeError('column[index].wrapWord must be a boolean.'); - } - - cellHeightIndex[index1] = (0, _calculateCellHeight.default)(value, config.columns[index1].width, config.columns[index1].wrapWord); +exports.default = (rows, config) => { + const tableWidth = rows[0].length; + const rowSpanIndex = []; + rows.forEach((cells) => { + const cellHeightIndex = new Array(tableWidth).fill(1); + cells.forEach((value, index1) => { + cellHeightIndex[index1] = calculateCellHeight_1.default(value, config.columns[index1].width, config.columns[index1].wrapWord); + }); + rowSpanIndex.push(Math.max(...cellHeightIndex)); }); - rowSpanIndex.push(Math.max(...cellHeightIndex)); - }); - return rowSpanIndex; + return rowSpanIndex; }; - -var _default = calculateRowHeightIndex; -exports.default = _default; \ 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 deleted file mode 100644 index 04c61b3ea040a3..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.flow +++ /dev/null @@ -1,36 +0,0 @@ -import isBoolean from 'is-boolean-object'; -import isNumber from 'is-number-object'; -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(Math.max(...cellHeightIndex)); - }); - - return rowSpanIndex; -}; 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 731f12035d0511..ffe611f8fb2dc3 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/createStream.js +++ b/tools/node_modules/eslint/node_modules/table/dist/createStream.js @@ -1,124 +1,73 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _alignTableData = _interopRequireDefault(require("./alignTableData")); - -var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex")); - -var _drawBorder = require("./drawBorder"); - -var _drawRow = _interopRequireDefault(require("./drawRow")); - -var _makeStreamConfig = _interopRequireDefault(require("./makeStreamConfig")); - -var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex")); - -var _padTableData = _interopRequireDefault(require("./padTableData")); - -var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData")); - -var _truncateTableData = _interopRequireDefault(require("./truncateTableData")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @param {Array} data - * @param {object} config - * @returns {Array} - */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const alignTableData_1 = __importDefault(require("./alignTableData")); +const calculateRowHeightIndex_1 = __importDefault(require("./calculateRowHeightIndex")); +const drawBorder_1 = require("./drawBorder"); +const drawRow_1 = __importDefault(require("./drawRow")); +const makeStreamConfig_1 = __importDefault(require("./makeStreamConfig")); +const mapDataUsingRowHeightIndex_1 = __importDefault(require("./mapDataUsingRowHeightIndex")); +const padTableData_1 = __importDefault(require("./padTableData")); +const stringifyTableData_1 = __importDefault(require("./stringifyTableData")); +const truncateTableData_1 = __importDefault(require("./truncateTableData")); const prepareData = (data, config) => { - let rows; - 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; + let rows = stringifyTableData_1.default(data); + rows = truncateTableData_1.default(rows, config); + const rowHeightIndex = calculateRowHeightIndex_1.default(rows, config); + rows = mapDataUsingRowHeightIndex_1.default(rows, rowHeightIndex, config); + rows = alignTableData_1.default(rows, config); + rows = padTableData_1.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, _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 = output.trimEnd(); - process.stdout.write(output); + const rows = prepareData([row], config); + const body = rows.map((literalRow) => { + return drawRow_1.default(literalRow, config); + }).join(''); + let output; + output = ''; + output += drawBorder_1.drawBorderTop(columnWidthIndex, config); + output += body; + output += drawBorder_1.drawBorderBottom(columnWidthIndex, config); + output = output.trimEnd(); + 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, _drawRow.default)(literalRow, config.border); - }).join(''); - let output = ''; - const bottom = (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border); - - if (bottom !== '\n') { - output = '\r\u001B[K'; - } - - output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border); - output += body; - output += bottom; - output = output.trimEnd(); - process.stdout.write(output); -}; -/** - * @param {object} userConfig - * @returns {object} - */ - - -const createStream = (userConfig = {}) => { - const config = (0, _makeStreamConfig.default)(userConfig); - const columnWidthIndex = Object.values(config.columns).map(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); - } + const rows = prepareData([row], config); + const body = rows.map((literalRow) => { + return drawRow_1.default(literalRow, config); + }).join(''); + let output = ''; + const bottom = drawBorder_1.drawBorderBottom(columnWidthIndex, config); + if (bottom !== '\n') { + output = '\r\u001B[K'; } - }; + output += drawBorder_1.drawBorderJoin(columnWidthIndex, config); + output += body; + output += bottom; + output = output.trimEnd(); + process.stdout.write(output); +}; +exports.default = (userConfig) => { + const config = makeStreamConfig_1.default(userConfig); + const columnWidthIndex = Object.values(config.columns).map((column) => { + return column.width + column.paddingLeft + column.paddingRight; + }); + let empty = true; + return { + write: (row) => { + if (row.length !== config.columnCount) { + throw new Error('Row cell count does not match the config.columnCount.'); + } + if (empty) { + empty = false; + create(row, columnWidthIndex, config); + } + else { + append(row, columnWidthIndex, config); + } + }, + }; }; - -var _default = createStream; -exports.default = _default; \ 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 deleted file mode 100644 index 747ba6a7595bd4..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/createStream.js.flow +++ /dev/null @@ -1,125 +0,0 @@ -import alignTableData from './alignTableData'; -import calculateRowHeightIndex from './calculateRowHeightIndex'; -import { - drawBorderBottom, - drawBorderJoin, - drawBorderTop, -} from './drawBorder'; -import drawRow from './drawRow'; -import makeStreamConfig from './makeStreamConfig'; -import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex'; -import padTableData from './padTableData'; -import stringifyTableData from './stringifyTableData'; -import truncateTableData from './truncateTableData'; - -/** - * @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 = output.trimEnd(); - - 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 = ''; - const bottom = drawBorderBottom(columnWidthIndex, config.border); - - if (bottom !== '\n') { - output = '\r\u001B[K'; - } - - output += drawBorderJoin(columnWidthIndex, config.border); - output += body; - output += bottom; - - output = output.trimEnd(); - - process.stdout.write(output); -}; - -/** - * @param {object} userConfig - * @returns {object} - */ -export default (userConfig = {}) => { - const config = makeStreamConfig(userConfig); - - const columnWidthIndex = Object.values(config.columns).map((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/drawBorder.js b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js index 965e8539d42749..7620eba3dd5cdf 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js +++ b/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js @@ -1,109 +1,54 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = void 0; - -/** - * @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'; +const drawHorizontalContent_1 = __importDefault(require("./drawHorizontalContent")); +const drawBorder = (columnSizeIndex, config) => { + const columns = columnSizeIndex.map((size) => { + return config.separator.body.repeat(size); + }); + return drawHorizontalContent_1.default(columns, config); }; -/** - * @typedef drawBorderTop~parts - * @property {string} topLeft - * @property {string} topRight - * @property {string} topBody - * @property {string} topJoin - */ - -/** - * @param {number[]} columnSizeIndex - * @param {drawBorderTop~parts} parts - * @returns {string} - */ - - exports.drawBorder = drawBorder; - -const drawBorderTop = (columnSizeIndex, parts) => { - const border = drawBorder(columnSizeIndex, { - body: parts.topBody, - join: parts.topJoin, - left: parts.topLeft, - right: parts.topRight - }); - - if (border === '\n') { - return ''; - } - - return border; +const drawBorderTop = (columnSizeIndex, config) => { + const result = drawBorder(columnSizeIndex, { + ...config, + separator: { + body: config.border.topBody, + join: config.border.topJoin, + left: config.border.topLeft, + right: config.border.topRight, + }, + }); + if (result === '\n') { + return ''; + } + return result; }; -/** - * @typedef drawBorderJoin~parts - * @property {string} joinLeft - * @property {string} joinRight - * @property {string} joinBody - * @property {string} joinJoin - */ - -/** - * @param {number[]} columnSizeIndex - * @param {drawBorderJoin~parts} parts - * @returns {string} - */ - - exports.drawBorderTop = drawBorderTop; - -const drawBorderJoin = (columnSizeIndex, parts) => { - return drawBorder(columnSizeIndex, { - body: parts.joinBody, - join: parts.joinJoin, - left: parts.joinLeft, - right: parts.joinRight - }); +const drawBorderJoin = (columnSizeIndex, config) => { + return drawBorder(columnSizeIndex, { + ...config, + separator: { + body: config.border.joinBody, + join: config.border.joinJoin, + left: config.border.joinLeft, + right: config.border.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} - */ - - exports.drawBorderJoin = drawBorderJoin; - -const drawBorderBottom = (columnSizeIndex, parts) => { - return drawBorder(columnSizeIndex, { - body: parts.bottomBody, - join: parts.bottomJoin, - left: parts.bottomLeft, - right: parts.bottomRight - }); +const drawBorderBottom = (columnSizeIndex, config) => { + return drawBorder(columnSizeIndex, { + ...config, + separator: { + body: config.border.bottomBody, + join: config.border.bottomJoin, + left: config.border.bottomLeft, + right: config.border.bottomRight, + }, + }); }; - -exports.drawBorderBottom = drawBorderBottom; \ No newline at end of file +exports.drawBorderBottom = drawBorderBottom; 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 deleted file mode 100644 index 85de2475e8b294..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.flow +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @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) => { - const border = drawBorder(columnSizeIndex, { - body: parts.topBody, - join: parts.topJoin, - left: parts.topLeft, - right: parts.topRight, - }); - - if (border === '\n') { - return ''; - } - - return border; -}; - -/** - * @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/drawHorizontalContent.js b/tools/node_modules/eslint/node_modules/table/dist/drawHorizontalContent.js new file mode 100644 index 00000000000000..ceee448495f579 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/drawHorizontalContent.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function drawHorizontalContent(contents, config) { + const { separator, drawVerticalLine } = config; + const contentSize = contents.length; + const result = []; + result.push(drawVerticalLine(0, contentSize) ? separator.left : ''); + contents.forEach((content, index) => { + result.push(content); + // Only append the join separator if it is not the last content + if (index + 1 < contentSize) { + result.push(drawVerticalLine(index + 1, contentSize) ? separator.join : ''); + } + }); + result.push(drawVerticalLine(contentSize, contentSize) ? separator.right : ''); + return result.join('') + '\n'; +} +exports.default = drawHorizontalContent; 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 432f5bce1f9cdd..c03fb780b1174e 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/drawRow.js +++ b/tools/node_modules/eslint/node_modules/table/dist/drawRow.js @@ -1,25 +1,16 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** - * @typedef {object} drawRow~border - * @property {string} bodyLeft - * @property {string} bodyRight - * @property {string} bodyJoin - */ - -/** - * @param {number[]} columns - * @param {drawRow~border} border - * @returns {string} - */ -const drawRow = (columns, border) => { - return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n'; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const drawHorizontalContent_1 = __importDefault(require("./drawHorizontalContent")); +exports.default = (row, config) => { + return drawHorizontalContent_1.default(row, { + ...config, + separator: { + join: config.border.bodyJoin, + left: config.border.bodyLeft, + right: config.border.bodyRight, + }, + }); }; - -var _default = drawRow; -exports.default = _default; \ 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 deleted file mode 100644 index 978eab2de19941..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/drawRow.js.flow +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @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/drawTable.js b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js index 4c49d0fff50de8..a7e10193d62d45 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/drawTable.js +++ b/tools/node_modules/eslint/node_modules/table/dist/drawTable.js @@ -1,58 +1,48 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _drawBorder = require("./drawBorder"); - -var _drawRow = _interopRequireDefault(require("./drawRow")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const drawBorder_1 = require("./drawBorder"); +const drawRow_1 = __importDefault(require("./drawRow")); /** - * @param {Array} rows - * @param {object} border - * @param {Array} columnSizeIndex - * @param {Array} rowSpanIndex - * @param {Function} drawHorizontalLine - * @param {boolean} singleLine - * @returns {string} + * Group the array into sub-arrays by sizes. + * + * @example + * chunkBySizes(['a', 'b', 'c', 'd', 'e'], [2, 1, 2]) = [ ['a', 'b'], ['c'], ['d', 'e'] ] */ -const drawTable = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => { - let output; - let realRowIndex; - let rowHeight; - const rowCount = rows.length; - realRowIndex = 0; - output = ''; - - if (drawHorizontalLine(realRowIndex, rowCount)) { - output += (0, _drawBorder.drawBorderTop)(columnSizeIndex, border); - } - - rows.forEach((row, index0) => { - output += (0, _drawRow.default)(row, border); - - if (!rowHeight) { - rowHeight = rowSpanIndex[realRowIndex]; - realRowIndex++; +const groupBySizes = (array, sizes) => { + let startIndex = 0; + return sizes.map((rowHeight) => { + const chunk = array.slice(startIndex, startIndex + rowHeight); + startIndex += rowHeight; + return chunk; + }); +}; +const shouldDrawBorderJoin = (rowIndex, rowCount, config) => { + const { singleLine, drawHorizontalLine } = config; + return !singleLine && rowIndex + 1 < rowCount && drawHorizontalLine(rowIndex + 1, rowCount); +}; +exports.default = (rows, columnWidths, rowHeights, config) => { + const { drawHorizontalLine, } = config; + const groupedRows = groupBySizes(rows, rowHeights).map((group) => { + return group.map((row) => { + return drawRow_1.default(row, config); + }).join(''); + }); + const rowCount = groupedRows.length; + let output = ''; + if (drawHorizontalLine(0, rowCount)) { + output += drawBorder_1.drawBorderTop(columnWidths, config); } - - rowHeight--; - - if (!singleLine && rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) { - output += (0, _drawBorder.drawBorderJoin)(columnSizeIndex, border); + groupedRows.forEach((row, rowIndex) => { + output += row; + if (shouldDrawBorderJoin(rowIndex, rowCount, config)) { + output += drawBorder_1.drawBorderJoin(columnWidths, config); + } + }); + if (drawHorizontalLine(rowCount, rowCount)) { + output += drawBorder_1.drawBorderBottom(columnWidths, config); } - }); - - if (drawHorizontalLine(realRowIndex, rowCount)) { - output += (0, _drawBorder.drawBorderBottom)(columnSizeIndex, border); - } - - return output; + return output; }; - -var _default = drawTable; -exports.default = _default; \ 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 deleted file mode 100644 index 84707caa83d04b..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/drawTable.js.flow +++ /dev/null @@ -1,53 +0,0 @@ -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 - * @param {boolean} singleLine - * @returns {string} - */ -export default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine, singleLine) => { - 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 (!singleLine && 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/validators.js b/tools/node_modules/eslint/node_modules/table/dist/generated/validators.js similarity index 63% rename from tools/node_modules/eslint/node_modules/table/dist/validators.js rename to tools/node_modules/eslint/node_modules/table/dist/generated/validators.js index 51783aa08b8595..99119828de034a 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validators.js +++ b/tools/node_modules/eslint/node_modules/table/dist/generated/validators.js @@ -14,6 +14,9 @@ const schema13 = { "columnDefault": { "$ref": "shared.json#/definitions/column" }, + "drawVerticalLine": { + "typeof": "function" + }, "drawHorizontalLine": { "typeof": "function" }, @@ -78,13 +81,7 @@ const func8 = Object.prototype.hasOwnProperty; const schema16 = { "type": "string" }; - -function validate46(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate46(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (typeof data !== "string") { @@ -99,7 +96,8 @@ function validate46(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -107,13 +105,7 @@ function validate46(data, { validate46.errors = vErrors; return errors === 0; } - -function validate45(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate45(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -130,7 +122,8 @@ function validate45(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -138,170 +131,171 @@ function validate45(data, { } if (data.topBody !== undefined) { if (!(validate46(data.topBody, { - instancePath: instancePath + "/topBody", - parentData: data, - parentDataProperty: "topBody", - rootData - }))) { + instancePath: instancePath + "/topBody", + parentData: data, + parentDataProperty: "topBody", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.topJoin !== undefined) { if (!(validate46(data.topJoin, { - instancePath: instancePath + "/topJoin", - parentData: data, - parentDataProperty: "topJoin", - rootData - }))) { + instancePath: instancePath + "/topJoin", + parentData: data, + parentDataProperty: "topJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.topLeft !== undefined) { if (!(validate46(data.topLeft, { - instancePath: instancePath + "/topLeft", - parentData: data, - parentDataProperty: "topLeft", - rootData - }))) { + instancePath: instancePath + "/topLeft", + parentData: data, + parentDataProperty: "topLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.topRight !== undefined) { if (!(validate46(data.topRight, { - instancePath: instancePath + "/topRight", - parentData: data, - parentDataProperty: "topRight", - rootData - }))) { + instancePath: instancePath + "/topRight", + parentData: data, + parentDataProperty: "topRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomBody !== undefined) { if (!(validate46(data.bottomBody, { - instancePath: instancePath + "/bottomBody", - parentData: data, - parentDataProperty: "bottomBody", - rootData - }))) { + instancePath: instancePath + "/bottomBody", + parentData: data, + parentDataProperty: "bottomBody", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomJoin !== undefined) { if (!(validate46(data.bottomJoin, { - instancePath: instancePath + "/bottomJoin", - parentData: data, - parentDataProperty: "bottomJoin", - rootData - }))) { + instancePath: instancePath + "/bottomJoin", + parentData: data, + parentDataProperty: "bottomJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomLeft !== undefined) { if (!(validate46(data.bottomLeft, { - instancePath: instancePath + "/bottomLeft", - parentData: data, - parentDataProperty: "bottomLeft", - rootData - }))) { + instancePath: instancePath + "/bottomLeft", + parentData: data, + parentDataProperty: "bottomLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomRight !== undefined) { if (!(validate46(data.bottomRight, { - instancePath: instancePath + "/bottomRight", - parentData: data, - parentDataProperty: "bottomRight", - rootData - }))) { + instancePath: instancePath + "/bottomRight", + parentData: data, + parentDataProperty: "bottomRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bodyLeft !== undefined) { if (!(validate46(data.bodyLeft, { - instancePath: instancePath + "/bodyLeft", - parentData: data, - parentDataProperty: "bodyLeft", - rootData - }))) { + instancePath: instancePath + "/bodyLeft", + parentData: data, + parentDataProperty: "bodyLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bodyRight !== undefined) { if (!(validate46(data.bodyRight, { - instancePath: instancePath + "/bodyRight", - parentData: data, - parentDataProperty: "bodyRight", - rootData - }))) { + instancePath: instancePath + "/bodyRight", + parentData: data, + parentDataProperty: "bodyRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bodyJoin !== undefined) { if (!(validate46(data.bodyJoin, { - instancePath: instancePath + "/bodyJoin", - parentData: data, - parentDataProperty: "bodyJoin", - rootData - }))) { + instancePath: instancePath + "/bodyJoin", + parentData: data, + parentDataProperty: "bodyJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinBody !== undefined) { if (!(validate46(data.joinBody, { - instancePath: instancePath + "/joinBody", - parentData: data, - parentDataProperty: "joinBody", - rootData - }))) { + instancePath: instancePath + "/joinBody", + parentData: data, + parentDataProperty: "joinBody", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinLeft !== undefined) { if (!(validate46(data.joinLeft, { - instancePath: instancePath + "/joinLeft", - parentData: data, - parentDataProperty: "joinLeft", - rootData - }))) { + instancePath: instancePath + "/joinLeft", + parentData: data, + parentDataProperty: "joinLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinRight !== undefined) { if (!(validate46(data.joinRight, { - instancePath: instancePath + "/joinRight", - parentData: data, - parentDataProperty: "joinRight", - rootData - }))) { + instancePath: instancePath + "/joinRight", + parentData: data, + parentDataProperty: "joinRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinJoin !== undefined) { if (!(validate46(data.joinJoin, { - instancePath: instancePath + "/joinJoin", - parentData: data, - parentDataProperty: "joinJoin", - rootData - }))) { + instancePath: instancePath + "/joinJoin", + parentData: data, + parentDataProperty: "joinJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } - } else { + } + else { const err1 = { instancePath, schemaPath: "#/type", @@ -313,7 +307,8 @@ function validate45(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; @@ -322,13 +317,20 @@ function validate45(data, { return errors === 0; } const schema17 = { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false + "oneOf": [{ + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, { + "type": "array", + "items": { + "$ref": "#/definitions/column" + } + }] }; const pattern0 = new RegExp("^[0-9]+$", "u"); const schema18 = { @@ -339,7 +341,9 @@ const schema18 = { "enum": ["left", "right", "center"] }, "width": { - "type": "number" + "type": "number", + "minimum": 1, + "multipleOf": 1 }, "wrapWord": { "type": "boolean" @@ -357,13 +361,7 @@ const schema18 = { "additionalProperties": false }; const func0 = require("ajv/dist/runtime/equal").default; - -function validate64(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate64(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -380,7 +378,8 @@ function validate64(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -400,7 +399,8 @@ function validate64(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; @@ -417,7 +417,8 @@ function validate64(data, { }; if (vErrors === null) { vErrors = [err2]; - } else { + } + else { vErrors.push(err2); } errors++; @@ -425,8 +426,48 @@ function validate64(data, { } if (data.width !== undefined) { let data1 = data.width; - if (!((typeof data1 == "number") && (isFinite(data1)))) { - const err3 = { + if ((typeof data1 == "number") && (isFinite(data1))) { + if (data1 < 1 || isNaN(data1)) { + const err3 = { + instancePath: instancePath + "/width", + schemaPath: "#/properties/width/minimum", + keyword: "minimum", + params: { + comparison: ">=", + limit: 1 + }, + message: "must be >= 1" + }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + let res0; + if ((1 === 0 || (res0 = data1 / 1, res0 !== parseInt(res0)))) { + const err4 = { + instancePath: instancePath + "/width", + schemaPath: "#/properties/width/multipleOf", + keyword: "multipleOf", + params: { + multipleOf: 1 + }, + message: "must be multiple of 1" + }; + if (vErrors === null) { + vErrors = [err4]; + } + else { + vErrors.push(err4); + } + errors++; + } + } + else { + const err5 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/type", keyword: "type", @@ -436,16 +477,17 @@ function validate64(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); + vErrors = [err5]; + } + else { + vErrors.push(err5); } errors++; } } if (data.wrapWord !== undefined) { if (typeof data.wrapWord !== "boolean") { - const err4 = { + const err6 = { instancePath: instancePath + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", @@ -455,9 +497,10 @@ function validate64(data, { message: "must be boolean" }; if (vErrors === null) { - vErrors = [err4]; - } else { - vErrors.push(err4); + vErrors = [err6]; + } + else { + vErrors.push(err6); } errors++; } @@ -465,7 +508,7 @@ function validate64(data, { if (data.truncate !== undefined) { let data3 = data.truncate; if (!((typeof data3 == "number") && (isFinite(data3)))) { - const err5 = { + const err7 = { instancePath: instancePath + "/truncate", schemaPath: "#/properties/truncate/type", keyword: "type", @@ -475,9 +518,10 @@ function validate64(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err5]; - } else { - vErrors.push(err5); + vErrors = [err7]; + } + else { + vErrors.push(err7); } errors++; } @@ -485,7 +529,7 @@ function validate64(data, { if (data.paddingLeft !== undefined) { let data4 = data.paddingLeft; if (!((typeof data4 == "number") && (isFinite(data4)))) { - const err6 = { + const err8 = { instancePath: instancePath + "/paddingLeft", schemaPath: "#/properties/paddingLeft/type", keyword: "type", @@ -495,9 +539,10 @@ function validate64(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err6]; - } else { - vErrors.push(err6); + vErrors = [err8]; + } + else { + vErrors.push(err8); } errors++; } @@ -505,7 +550,7 @@ function validate64(data, { if (data.paddingRight !== undefined) { let data5 = data.paddingRight; if (!((typeof data5 == "number") && (isFinite(data5)))) { - const err7 = { + const err9 = { instancePath: instancePath + "/paddingRight", schemaPath: "#/properties/paddingRight/type", keyword: "type", @@ -515,15 +560,17 @@ function validate64(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err7]; - } else { - vErrors.push(err7); + vErrors = [err9]; + } + else { + vErrors.push(err9); } errors++; } } - } else { - const err8 = { + } + else { + const err10 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -533,30 +580,29 @@ function validate64(data, { message: "must be object" }; if (vErrors === null) { - vErrors = [err8]; - } else { - vErrors.push(err8); + vErrors = [err10]; + } + else { + vErrors.push(err10); } errors++; } validate64.errors = vErrors; return errors === 0; } - -function validate63(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate63(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; + const _errs0 = errors; + let valid0 = false; + let passing0 = null; + const _errs1 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { for (const key0 in data) { if (!(pattern0.test(key0))) { const err0 = { instancePath, - schemaPath: "#/additionalProperties", + schemaPath: "#/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 @@ -565,7 +611,8 @@ function validate63(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -574,20 +621,21 @@ function validate63(data, { for (const key1 in data) { if (pattern0.test(key1)) { if (!(validate64(data[key1], { - instancePath: instancePath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), - parentData: data, - parentDataProperty: key1, - rootData - }))) { + instancePath: instancePath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), + parentData: data, + parentDataProperty: key1, + rootData + }))) { vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors); errors = vErrors.length; } } } - } else { + } + else { const err1 = { instancePath, - schemaPath: "#/type", + schemaPath: "#/oneOf/0/type", keyword: "type", params: { type: "object" @@ -596,21 +644,94 @@ function validate63(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; } + var _valid0 = _errs1 === errors; + if (_valid0) { + valid0 = true; + passing0 = 0; + } + const _errs5 = errors; + if (Array.isArray(data)) { + const len0 = data.length; + for (let i0 = 0; i0 < len0; i0++) { + if (!(validate64(data[i0], { + instancePath: instancePath + "/" + i0, + parentData: data, + parentDataProperty: i0, + rootData + }))) { + vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors); + errors = vErrors.length; + } + } + } + else { + const err2 = { + instancePath, + schemaPath: "#/oneOf/1/type", + keyword: "type", + params: { + type: "array" + }, + message: "must be array" + }; + if (vErrors === null) { + vErrors = [err2]; + } + else { + vErrors.push(err2); + } + errors++; + } + var _valid0 = _errs5 === errors; + if (_valid0 && valid0) { + valid0 = false; + passing0 = [passing0, 1]; + } + else { + if (_valid0) { + valid0 = true; + passing0 = 1; + } + } + if (!valid0) { + const err3 = { + instancePath, + schemaPath: "#/oneOf", + keyword: "oneOf", + params: { + passingSchemas: passing0 + }, + message: "must match exactly one schema in oneOf" + }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + else { + errors = _errs0; + if (vErrors !== null) { + if (_errs0) { + vErrors.length = _errs0; + } + else { + vErrors = null; + } + } + } validate63.errors = vErrors; return errors === 0; } - -function validate67(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate68(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -627,7 +748,8 @@ function validate67(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -647,7 +769,8 @@ function validate67(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; @@ -664,7 +787,8 @@ function validate67(data, { }; if (vErrors === null) { vErrors = [err2]; - } else { + } + else { vErrors.push(err2); } errors++; @@ -672,8 +796,48 @@ function validate67(data, { } if (data.width !== undefined) { let data1 = data.width; - if (!((typeof data1 == "number") && (isFinite(data1)))) { - const err3 = { + if ((typeof data1 == "number") && (isFinite(data1))) { + if (data1 < 1 || isNaN(data1)) { + const err3 = { + instancePath: instancePath + "/width", + schemaPath: "#/properties/width/minimum", + keyword: "minimum", + params: { + comparison: ">=", + limit: 1 + }, + message: "must be >= 1" + }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + let res0; + if ((1 === 0 || (res0 = data1 / 1, res0 !== parseInt(res0)))) { + const err4 = { + instancePath: instancePath + "/width", + schemaPath: "#/properties/width/multipleOf", + keyword: "multipleOf", + params: { + multipleOf: 1 + }, + message: "must be multiple of 1" + }; + if (vErrors === null) { + vErrors = [err4]; + } + else { + vErrors.push(err4); + } + errors++; + } + } + else { + const err5 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/type", keyword: "type", @@ -683,16 +847,17 @@ function validate67(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); + vErrors = [err5]; + } + else { + vErrors.push(err5); } errors++; } } if (data.wrapWord !== undefined) { if (typeof data.wrapWord !== "boolean") { - const err4 = { + const err6 = { instancePath: instancePath + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", @@ -702,9 +867,10 @@ function validate67(data, { message: "must be boolean" }; if (vErrors === null) { - vErrors = [err4]; - } else { - vErrors.push(err4); + vErrors = [err6]; + } + else { + vErrors.push(err6); } errors++; } @@ -712,7 +878,7 @@ function validate67(data, { if (data.truncate !== undefined) { let data3 = data.truncate; if (!((typeof data3 == "number") && (isFinite(data3)))) { - const err5 = { + const err7 = { instancePath: instancePath + "/truncate", schemaPath: "#/properties/truncate/type", keyword: "type", @@ -722,9 +888,10 @@ function validate67(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err5]; - } else { - vErrors.push(err5); + vErrors = [err7]; + } + else { + vErrors.push(err7); } errors++; } @@ -732,7 +899,7 @@ function validate67(data, { if (data.paddingLeft !== undefined) { let data4 = data.paddingLeft; if (!((typeof data4 == "number") && (isFinite(data4)))) { - const err6 = { + const err8 = { instancePath: instancePath + "/paddingLeft", schemaPath: "#/properties/paddingLeft/type", keyword: "type", @@ -742,9 +909,10 @@ function validate67(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err6]; - } else { - vErrors.push(err6); + vErrors = [err8]; + } + else { + vErrors.push(err8); } errors++; } @@ -752,7 +920,7 @@ function validate67(data, { if (data.paddingRight !== undefined) { let data5 = data.paddingRight; if (!((typeof data5 == "number") && (isFinite(data5)))) { - const err7 = { + const err9 = { instancePath: instancePath + "/paddingRight", schemaPath: "#/properties/paddingRight/type", keyword: "type", @@ -762,15 +930,17 @@ function validate67(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err7]; - } else { - vErrors.push(err7); + vErrors = [err9]; + } + else { + vErrors.push(err9); } errors++; } } - } else { - const err8 = { + } + else { + const err10 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -780,28 +950,23 @@ function validate67(data, { message: "must be object" }; if (vErrors === null) { - vErrors = [err8]; - } else { - vErrors.push(err8); + vErrors = [err10]; + } + else { + vErrors.push(err10); } errors++; } - validate67.errors = vErrors; + validate68.errors = vErrors; return errors === 0; } - -function validate43(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate43(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { /*# sourceURL="config.json" */ ; let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { for (const key0 in data) { - if (!(((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "drawHorizontalLine")) || (key0 === "singleLine"))) { + if (!((((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "drawVerticalLine")) || (key0 === "drawHorizontalLine")) || (key0 === "singleLine"))) { const err0 = { instancePath, schemaPath: "#/additionalProperties", @@ -813,7 +978,8 @@ function validate43(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -821,40 +987,58 @@ function validate43(data, { } if (data.border !== undefined) { if (!(validate45(data.border, { - instancePath: instancePath + "/border", - parentData: data, - parentDataProperty: "border", - rootData - }))) { + instancePath: instancePath + "/border", + parentData: data, + parentDataProperty: "border", + rootData + }))) { vErrors = vErrors === null ? validate45.errors : vErrors.concat(validate45.errors); errors = vErrors.length; } } if (data.columns !== undefined) { if (!(validate63(data.columns, { - instancePath: instancePath + "/columns", - parentData: data, - parentDataProperty: "columns", - rootData - }))) { + instancePath: instancePath + "/columns", + parentData: data, + parentDataProperty: "columns", + rootData + }))) { vErrors = vErrors === null ? validate63.errors : vErrors.concat(validate63.errors); errors = vErrors.length; } } if (data.columnDefault !== undefined) { - if (!(validate67(data.columnDefault, { - instancePath: instancePath + "/columnDefault", - parentData: data, - parentDataProperty: "columnDefault", - rootData - }))) { - vErrors = vErrors === null ? validate67.errors : vErrors.concat(validate67.errors); + if (!(validate68(data.columnDefault, { + instancePath: instancePath + "/columnDefault", + parentData: data, + parentDataProperty: "columnDefault", + rootData + }))) { + vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors); errors = vErrors.length; } } + if (data.drawVerticalLine !== undefined) { + if (typeof data.drawVerticalLine != "function") { + const err1 = { + instancePath: instancePath + "/drawVerticalLine", + schemaPath: "#/properties/drawVerticalLine/typeof", + keyword: "typeof", + params: {}, + message: "should pass \"typeof\" keyword validation" + }; + if (vErrors === null) { + vErrors = [err1]; + } + else { + vErrors.push(err1); + } + errors++; + } + } if (data.drawHorizontalLine !== undefined) { if (typeof data.drawHorizontalLine != "function") { - const err1 = { + const err2 = { instancePath: instancePath + "/drawHorizontalLine", schemaPath: "#/properties/drawHorizontalLine/typeof", keyword: "typeof", @@ -862,16 +1046,17 @@ function validate43(data, { message: "should pass \"typeof\" keyword validation" }; if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); + vErrors = [err2]; + } + else { + vErrors.push(err2); } errors++; } } if (data.singleLine !== undefined) { if (typeof data.singleLine != "boolean") { - const err2 = { + const err3 = { instancePath: instancePath + "/singleLine", schemaPath: "#/properties/singleLine/typeof", keyword: "typeof", @@ -879,15 +1064,17 @@ function validate43(data, { message: "should pass \"typeof\" keyword validation" }; if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); + vErrors = [err3]; + } + else { + vErrors.push(err3); } errors++; } } - } else { - const err3 = { + } + else { + const err4 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -897,16 +1084,17 @@ function validate43(data, { message: "must be object" }; if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); + vErrors = [err4]; + } + else { + vErrors.push(err4); } errors++; } validate43.errors = vErrors; return errors === 0; } -exports["streamConfig.json"] = validate69; +exports["streamConfig.json"] = validate70; const schema20 = { "$id": "streamConfig.json", "$schema": "http://json-schema.org/draft-07/schema#", @@ -923,17 +1111,14 @@ const schema20 = { }, "columnCount": { "type": "number" + }, + "drawVerticalLine": { + "typeof": "function" } }, "additionalProperties": false }; - -function validate70(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate71(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -950,7 +1135,8 @@ function validate70(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -958,170 +1144,171 @@ function validate70(data, { } if (data.topBody !== undefined) { if (!(validate46(data.topBody, { - instancePath: instancePath + "/topBody", - parentData: data, - parentDataProperty: "topBody", - rootData - }))) { + instancePath: instancePath + "/topBody", + parentData: data, + parentDataProperty: "topBody", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.topJoin !== undefined) { if (!(validate46(data.topJoin, { - instancePath: instancePath + "/topJoin", - parentData: data, - parentDataProperty: "topJoin", - rootData - }))) { + instancePath: instancePath + "/topJoin", + parentData: data, + parentDataProperty: "topJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.topLeft !== undefined) { if (!(validate46(data.topLeft, { - instancePath: instancePath + "/topLeft", - parentData: data, - parentDataProperty: "topLeft", - rootData - }))) { + instancePath: instancePath + "/topLeft", + parentData: data, + parentDataProperty: "topLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.topRight !== undefined) { if (!(validate46(data.topRight, { - instancePath: instancePath + "/topRight", - parentData: data, - parentDataProperty: "topRight", - rootData - }))) { + instancePath: instancePath + "/topRight", + parentData: data, + parentDataProperty: "topRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomBody !== undefined) { if (!(validate46(data.bottomBody, { - instancePath: instancePath + "/bottomBody", - parentData: data, - parentDataProperty: "bottomBody", - rootData - }))) { + instancePath: instancePath + "/bottomBody", + parentData: data, + parentDataProperty: "bottomBody", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomJoin !== undefined) { if (!(validate46(data.bottomJoin, { - instancePath: instancePath + "/bottomJoin", - parentData: data, - parentDataProperty: "bottomJoin", - rootData - }))) { + instancePath: instancePath + "/bottomJoin", + parentData: data, + parentDataProperty: "bottomJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomLeft !== undefined) { if (!(validate46(data.bottomLeft, { - instancePath: instancePath + "/bottomLeft", - parentData: data, - parentDataProperty: "bottomLeft", - rootData - }))) { + instancePath: instancePath + "/bottomLeft", + parentData: data, + parentDataProperty: "bottomLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bottomRight !== undefined) { if (!(validate46(data.bottomRight, { - instancePath: instancePath + "/bottomRight", - parentData: data, - parentDataProperty: "bottomRight", - rootData - }))) { + instancePath: instancePath + "/bottomRight", + parentData: data, + parentDataProperty: "bottomRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bodyLeft !== undefined) { if (!(validate46(data.bodyLeft, { - instancePath: instancePath + "/bodyLeft", - parentData: data, - parentDataProperty: "bodyLeft", - rootData - }))) { + instancePath: instancePath + "/bodyLeft", + parentData: data, + parentDataProperty: "bodyLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bodyRight !== undefined) { if (!(validate46(data.bodyRight, { - instancePath: instancePath + "/bodyRight", - parentData: data, - parentDataProperty: "bodyRight", - rootData - }))) { + instancePath: instancePath + "/bodyRight", + parentData: data, + parentDataProperty: "bodyRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.bodyJoin !== undefined) { if (!(validate46(data.bodyJoin, { - instancePath: instancePath + "/bodyJoin", - parentData: data, - parentDataProperty: "bodyJoin", - rootData - }))) { + instancePath: instancePath + "/bodyJoin", + parentData: data, + parentDataProperty: "bodyJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinBody !== undefined) { if (!(validate46(data.joinBody, { - instancePath: instancePath + "/joinBody", - parentData: data, - parentDataProperty: "joinBody", - rootData - }))) { + instancePath: instancePath + "/joinBody", + parentData: data, + parentDataProperty: "joinBody", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinLeft !== undefined) { if (!(validate46(data.joinLeft, { - instancePath: instancePath + "/joinLeft", - parentData: data, - parentDataProperty: "joinLeft", - rootData - }))) { + instancePath: instancePath + "/joinLeft", + parentData: data, + parentDataProperty: "joinLeft", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinRight !== undefined) { if (!(validate46(data.joinRight, { - instancePath: instancePath + "/joinRight", - parentData: data, - parentDataProperty: "joinRight", - rootData - }))) { + instancePath: instancePath + "/joinRight", + parentData: data, + parentDataProperty: "joinRight", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } if (data.joinJoin !== undefined) { if (!(validate46(data.joinJoin, { - instancePath: instancePath + "/joinJoin", - parentData: data, - parentDataProperty: "joinJoin", - rootData - }))) { + instancePath: instancePath + "/joinJoin", + parentData: data, + parentDataProperty: "joinJoin", + rootData + }))) { vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); errors = vErrors.length; } } - } else { + } + else { const err1 = { instancePath, schemaPath: "#/type", @@ -1133,29 +1320,28 @@ function validate70(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; } - validate70.errors = vErrors; + validate71.errors = vErrors; return errors === 0; } - -function validate87(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate88(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; + const _errs0 = errors; + let valid0 = false; + let passing0 = null; + const _errs1 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { for (const key0 in data) { if (!(pattern0.test(key0))) { const err0 = { instancePath, - schemaPath: "#/additionalProperties", + schemaPath: "#/oneOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 @@ -1164,7 +1350,8 @@ function validate87(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -1173,20 +1360,21 @@ function validate87(data, { for (const key1 in data) { if (pattern0.test(key1)) { if (!(validate64(data[key1], { - instancePath: instancePath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), - parentData: data, - parentDataProperty: key1, - rootData - }))) { + instancePath: instancePath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), + parentData: data, + parentDataProperty: key1, + rootData + }))) { vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors); errors = vErrors.length; } } } - } else { + } + else { const err1 = { instancePath, - schemaPath: "#/type", + schemaPath: "#/oneOf/0/type", keyword: "type", params: { type: "object" @@ -1195,21 +1383,94 @@ function validate87(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; } - validate87.errors = vErrors; + var _valid0 = _errs1 === errors; + if (_valid0) { + valid0 = true; + passing0 = 0; + } + const _errs5 = errors; + if (Array.isArray(data)) { + const len0 = data.length; + for (let i0 = 0; i0 < len0; i0++) { + if (!(validate64(data[i0], { + instancePath: instancePath + "/" + i0, + parentData: data, + parentDataProperty: i0, + rootData + }))) { + vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors); + errors = vErrors.length; + } + } + } + else { + const err2 = { + instancePath, + schemaPath: "#/oneOf/1/type", + keyword: "type", + params: { + type: "array" + }, + message: "must be array" + }; + if (vErrors === null) { + vErrors = [err2]; + } + else { + vErrors.push(err2); + } + errors++; + } + var _valid0 = _errs5 === errors; + if (_valid0 && valid0) { + valid0 = false; + passing0 = [passing0, 1]; + } + else { + if (_valid0) { + valid0 = true; + passing0 = 1; + } + } + if (!valid0) { + const err3 = { + instancePath, + schemaPath: "#/oneOf", + keyword: "oneOf", + params: { + passingSchemas: passing0 + }, + message: "must match exactly one schema in oneOf" + }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + else { + errors = _errs0; + if (vErrors !== null) { + if (_errs0) { + vErrors.length = _errs0; + } + else { + vErrors = null; + } + } + } + validate88.errors = vErrors; return errors === 0; } - -function validate90(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate92(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -1226,7 +1487,8 @@ function validate90(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; @@ -1246,7 +1508,8 @@ function validate90(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; @@ -1263,7 +1526,8 @@ function validate90(data, { }; if (vErrors === null) { vErrors = [err2]; - } else { + } + else { vErrors.push(err2); } errors++; @@ -1271,8 +1535,48 @@ function validate90(data, { } if (data.width !== undefined) { let data1 = data.width; - if (!((typeof data1 == "number") && (isFinite(data1)))) { - const err3 = { + if ((typeof data1 == "number") && (isFinite(data1))) { + if (data1 < 1 || isNaN(data1)) { + const err3 = { + instancePath: instancePath + "/width", + schemaPath: "#/properties/width/minimum", + keyword: "minimum", + params: { + comparison: ">=", + limit: 1 + }, + message: "must be >= 1" + }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + let res0; + if ((1 === 0 || (res0 = data1 / 1, res0 !== parseInt(res0)))) { + const err4 = { + instancePath: instancePath + "/width", + schemaPath: "#/properties/width/multipleOf", + keyword: "multipleOf", + params: { + multipleOf: 1 + }, + message: "must be multiple of 1" + }; + if (vErrors === null) { + vErrors = [err4]; + } + else { + vErrors.push(err4); + } + errors++; + } + } + else { + const err5 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/type", keyword: "type", @@ -1282,16 +1586,17 @@ function validate90(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); + vErrors = [err5]; + } + else { + vErrors.push(err5); } errors++; } } if (data.wrapWord !== undefined) { if (typeof data.wrapWord !== "boolean") { - const err4 = { + const err6 = { instancePath: instancePath + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", @@ -1301,9 +1606,10 @@ function validate90(data, { message: "must be boolean" }; if (vErrors === null) { - vErrors = [err4]; - } else { - vErrors.push(err4); + vErrors = [err6]; + } + else { + vErrors.push(err6); } errors++; } @@ -1311,7 +1617,7 @@ function validate90(data, { if (data.truncate !== undefined) { let data3 = data.truncate; if (!((typeof data3 == "number") && (isFinite(data3)))) { - const err5 = { + const err7 = { instancePath: instancePath + "/truncate", schemaPath: "#/properties/truncate/type", keyword: "type", @@ -1321,9 +1627,10 @@ function validate90(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err5]; - } else { - vErrors.push(err5); + vErrors = [err7]; + } + else { + vErrors.push(err7); } errors++; } @@ -1331,7 +1638,7 @@ function validate90(data, { if (data.paddingLeft !== undefined) { let data4 = data.paddingLeft; if (!((typeof data4 == "number") && (isFinite(data4)))) { - const err6 = { + const err8 = { instancePath: instancePath + "/paddingLeft", schemaPath: "#/properties/paddingLeft/type", keyword: "type", @@ -1341,9 +1648,10 @@ function validate90(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err6]; - } else { - vErrors.push(err6); + vErrors = [err8]; + } + else { + vErrors.push(err8); } errors++; } @@ -1351,7 +1659,7 @@ function validate90(data, { if (data.paddingRight !== undefined) { let data5 = data.paddingRight; if (!((typeof data5 == "number") && (isFinite(data5)))) { - const err7 = { + const err9 = { instancePath: instancePath + "/paddingRight", schemaPath: "#/properties/paddingRight/type", keyword: "type", @@ -1361,15 +1669,17 @@ function validate90(data, { message: "must be number" }; if (vErrors === null) { - vErrors = [err7]; - } else { - vErrors.push(err7); + vErrors = [err9]; + } + else { + vErrors.push(err9); } errors++; } } - } else { - const err8 = { + } + else { + const err10 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -1379,28 +1689,23 @@ function validate90(data, { message: "must be object" }; if (vErrors === null) { - vErrors = [err8]; - } else { - vErrors.push(err8); + vErrors = [err10]; + } + else { + vErrors.push(err10); } errors++; } - validate90.errors = vErrors; + validate92.errors = vErrors; return errors === 0; } - -function validate69(data, { - instancePath = "", - parentData, - parentDataProperty, - rootData = data -} = {}) { +function validate70(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { /*# sourceURL="streamConfig.json" */ ; let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { for (const key0 in data) { - if (!((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "columnCount"))) { + if (!(((((key0 === "border") || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "columnCount")) || (key0 === "drawVerticalLine"))) { const err0 = { instancePath, schemaPath: "#/additionalProperties", @@ -1412,42 +1717,43 @@ function validate69(data, { }; if (vErrors === null) { vErrors = [err0]; - } else { + } + else { vErrors.push(err0); } errors++; } } if (data.border !== undefined) { - if (!(validate70(data.border, { - instancePath: instancePath + "/border", - parentData: data, - parentDataProperty: "border", - rootData - }))) { - vErrors = vErrors === null ? validate70.errors : vErrors.concat(validate70.errors); + if (!(validate71(data.border, { + instancePath: instancePath + "/border", + parentData: data, + parentDataProperty: "border", + rootData + }))) { + vErrors = vErrors === null ? validate71.errors : vErrors.concat(validate71.errors); errors = vErrors.length; } } if (data.columns !== undefined) { - if (!(validate87(data.columns, { - instancePath: instancePath + "/columns", - parentData: data, - parentDataProperty: "columns", - rootData - }))) { - vErrors = vErrors === null ? validate87.errors : vErrors.concat(validate87.errors); + if (!(validate88(data.columns, { + instancePath: instancePath + "/columns", + parentData: data, + parentDataProperty: "columns", + rootData + }))) { + vErrors = vErrors === null ? validate88.errors : vErrors.concat(validate88.errors); errors = vErrors.length; } } if (data.columnDefault !== undefined) { - if (!(validate90(data.columnDefault, { - instancePath: instancePath + "/columnDefault", - parentData: data, - parentDataProperty: "columnDefault", - rootData - }))) { - vErrors = vErrors === null ? validate90.errors : vErrors.concat(validate90.errors); + if (!(validate92(data.columnDefault, { + instancePath: instancePath + "/columnDefault", + parentData: data, + parentDataProperty: "columnDefault", + rootData + }))) { + vErrors = vErrors === null ? validate92.errors : vErrors.concat(validate92.errors); errors = vErrors.length; } } @@ -1465,14 +1771,34 @@ function validate69(data, { }; if (vErrors === null) { vErrors = [err1]; - } else { + } + else { vErrors.push(err1); } errors++; } } - } else { - const err2 = { + if (data.drawVerticalLine !== undefined) { + if (typeof data.drawVerticalLine != "function") { + const err2 = { + instancePath: instancePath + "/drawVerticalLine", + schemaPath: "#/properties/drawVerticalLine/typeof", + keyword: "typeof", + params: {}, + message: "should pass \"typeof\" keyword validation" + }; + if (vErrors === null) { + vErrors = [err2]; + } + else { + vErrors.push(err2); + } + errors++; + } + } + } + else { + const err3 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -1482,12 +1808,13 @@ function validate69(data, { message: "must be object" }; if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); + vErrors = [err3]; + } + else { + vErrors.push(err3); } errors++; } - validate69.errors = vErrors; + validate70.errors = vErrors; return errors === 0; -} \ 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 e7fe968a4b54b1..6d96a0ce29863e 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js +++ b/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js @@ -1,118 +1,82 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - /* eslint-disable sort-keys-fix/sort-keys-fix */ - -/** - * @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} - */ -const getBorderCharacters = 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 + '".'); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.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 + '".'); }; - -var _default = getBorderCharacters; -exports.default = _default; \ 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 deleted file mode 100644 index bc8b0f263a1e07..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.flow +++ /dev/null @@ -1,120 +0,0 @@ -/* eslint-disable sort-keys-fix/sort-keys-fix */ - -/** - * @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/index.js b/tools/node_modules/eslint/node_modules/table/dist/index.js index 069dcccb36ff73..6e93edc0317f71 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/index.js +++ b/tools/node_modules/eslint/node_modules/table/dist/index.js @@ -1,31 +1,23 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "createStream", { - enumerable: true, - get: function () { - return _createStream.default; - } -}); -Object.defineProperty(exports, "getBorderCharacters", { - enumerable: true, - get: function () { - return _getBorderCharacters.default; - } -}); -Object.defineProperty(exports, "table", { - enumerable: true, - get: function () { - return _table.default; - } -}); - -var _createStream = _interopRequireDefault(require("./createStream")); - -var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters")); - -var _table = _interopRequireDefault(require("./table")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getBorderCharacters = exports.createStream = exports.table = void 0; +const createStream_1 = __importDefault(require("./createStream")); +exports.createStream = createStream_1.default; +const getBorderCharacters_1 = __importDefault(require("./getBorderCharacters")); +exports.getBorderCharacters = getBorderCharacters_1.default; +const table_1 = __importDefault(require("./table")); +exports.table = table_1.default; +__exportStar(require("./types/api"), exports); 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 deleted file mode 100644 index 4a47c502576564..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/index.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -import createStream from './createStream'; -import getBorderCharacters from './getBorderCharacters'; -import table from './table'; - -export { - table, - createStream, - getBorderCharacters, -}; 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 a80d9a06acf1c9..4189a6d21b544e 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js @@ -1,91 +1,58 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _lodash = _interopRequireDefault(require("lodash.clonedeep")); - -var _calculateMaximumColumnWidthIndex = _interopRequireDefault(require("./calculateMaximumColumnWidthIndex")); - -var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters")); - -var _validateConfig = _interopRequireDefault(require("./validateConfig")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); +const calculateMaximumColumnWidthIndex_1 = __importDefault(require("./calculateMaximumColumnWidthIndex")); +const getBorderCharacters_1 = __importDefault(require("./getBorderCharacters")); +const validateConfig_1 = __importDefault(require("./validateConfig")); /** * Merges user provided border characters with the default border ("honeywell") characters. - * - * @param {object} border - * @returns {object} */ -const makeBorder = (border = {}) => { - return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border); +const makeBorder = (border) => { + return { + ...getBorderCharacters_1.default('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 = (0, _calculateMaximumColumnWidthIndex.default)(rows); - - for (let index = 0; index < rows[0].length; index++) { - if (typeof columns[index] === 'undefined') { - columns[index] = {}; - } - - columns[index] = Object.assign({ - alignment: 'left', - paddingLeft: 1, - paddingRight: 1, - truncate: Number.POSITIVE_INFINITY, - width: maximumColumnWidthIndex[index], - wrapWord: false - }, columnDefault, columns[index]); - } - - return columns; +const makeColumns = (rows, columns, columnDefault) => { + const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex_1.default(rows); + return rows[0].map((_cell, index) => { + return { + alignment: 'left', + paddingLeft: 1, + paddingRight: 1, + truncate: Number.POSITIVE_INFINITY, + width: maximumColumnWidthIndex[index], + wrapWord: false, + ...columnDefault, + ...columns === null || columns === void 0 ? void 0 : columns[index], + }; + }); }; /** * 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} */ - - -const makeConfig = (rows, userConfig = {}) => { - (0, _validateConfig.default)('config.json', userConfig); - const config = (0, _lodash.default)(userConfig); - config.border = makeBorder(config.border); - config.columns = makeColumns(rows, config.columns, config.columnDefault); - - if (!config.drawHorizontalLine) { - /** - * @returns {boolean} - */ - config.drawHorizontalLine = () => { - return true; +exports.default = (rows, userConfig = {}) => { + var _a, _b, _c; + validateConfig_1.default('config.json', userConfig); + const config = lodash_clonedeep_1.default(userConfig); + return { + ...config, + border: makeBorder(config.border), + columns: makeColumns(rows, config.columns, config.columnDefault), + drawHorizontalLine: (_a = config.drawHorizontalLine) !== null && _a !== void 0 ? _a : (() => { + return true; + }), + drawVerticalLine: (_b = config.drawVerticalLine) !== null && _b !== void 0 ? _b : (() => { + return true; + }), + singleLine: (_c = config.singleLine) !== null && _c !== void 0 ? _c : false, }; - } - - if (config.singleLine === undefined) { - config.singleLine = false; - } - - return config; }; - -var _default = makeConfig; -exports.default = _default; \ 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 deleted file mode 100644 index 3fcbc79c555f0b..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow +++ /dev/null @@ -1,76 +0,0 @@ -import cloneDeep from 'lodash.clonedeep'; -import calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex'; -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 {Array[]} rows - * @param {object} columns - * @param {object} columnDefault - * @returns {object} - */ -const makeColumns = (rows, columns = {}, columnDefault = {}) => { - const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows); - - for (let index = 0; index < rows[0].length; index++) { - if (typeof columns[index] === 'undefined') { - columns[index] = {}; - } - - columns[index] = Object.assign({ - alignment: 'left', - paddingLeft: 1, - paddingRight: 1, - truncate: Number.POSITIVE_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; - }; - } - - if (config.singleLine === undefined) { - config.singleLine = false; - } - - return config; -}; 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 6ca9733dd358e2..92f577adbff1aa 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js @@ -1,97 +1,59 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _lodash = _interopRequireDefault(require("lodash.clonedeep")); - -var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters")); - -var _validateConfig = _interopRequireDefault(require("./validateConfig")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); +const getBorderCharacters_1 = __importDefault(require("./getBorderCharacters")); +const validateConfig_1 = __importDefault(require("./validateConfig")); /** * Merges user provided border characters with the default border ("honeywell") characters. * - * @param {object} border - * @returns {object} */ -const makeBorder = (border = {}) => { - return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border); +const makeBorder = (border) => { + return { + ...getBorderCharacters_1.default('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 = {}) => { - for (let index = 0; index < columnCount; index++) { - if (typeof columns[index] === 'undefined') { - columns[index] = {}; - } - - columns[index] = Object.assign({ - alignment: 'left', - paddingLeft: 1, - paddingRight: 1, - truncate: Number.POSITIVE_INFINITY, - wrapWord: false - }, columnDefault, columns[index]); - } - - return columns; +const makeColumns = (columnCount, columns = {}, columnDefault) => { + return Array.from({ length: columnCount }).map((_, index) => { + return { + alignment: 'left', + paddingLeft: 1, + paddingRight: 1, + truncate: Number.POSITIVE_INFINITY, + wrapWord: false, + ...columnDefault, + ...columns[index], + }; + }); }; -/** - * @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} */ - - -const makeStreamConfig = (userConfig = {}) => { - (0, _validateConfig.default)('streamConfig.json', userConfig); - const config = (0, _lodash.default)(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; +exports.default = (userConfig) => { + var _a; + validateConfig_1.default('streamConfig.json', userConfig); + const config = lodash_clonedeep_1.default(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.'); + } + return { + ...config, + border: makeBorder(config.border), + columnCount: config.columnCount, + columns: makeColumns(config.columnCount, config.columns, config.columnDefault), + drawVerticalLine: (_a = config.drawVerticalLine) !== null && _a !== void 0 ? _a : (() => { + return true; + }), + }; }; - -var _default = makeStreamConfig; -exports.default = _default; \ 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 deleted file mode 100644 index 8536bf5b37a0c1..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js.flow +++ /dev/null @@ -1,83 +0,0 @@ -import cloneDeep from 'lodash.clonedeep'; -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 = {}) => { - for (let index = 0; index < columnCount; index++) { - if (typeof columns[index] === 'undefined') { - columns[index] = {}; - } - - columns[index] = Object.assign({ - alignment: 'left', - paddingLeft: 1, - paddingRight: 1, - truncate: Number.POSITIVE_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/mapDataUsingRowHeightIndex.js b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js index 1708570759dde0..4b79669cf5081c 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js +++ b/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js @@ -1,41 +1,26 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _lodash = _interopRequireDefault(require("lodash.flatten")); - -var _wrapCell = _interopRequireDefault(require("./wrapCell")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @param {Array} unmappedRows - * @param {number[]} rowHeightIndex - * @param {object} config - * @returns {Array} - */ -const mapDataUsingRowHeightIndex = (unmappedRows, rowHeightIndex, config) => { - const tableWidth = unmappedRows[0].length; - const mappedRows = unmappedRows.map((cells, index0) => { - const rowHeight = Array.from(new Array(rowHeightIndex[index0]), () => { - return new Array(tableWidth).fill(''); - }); // rowHeight - // [{row index within rowSaw; index2}] - // [{cell index within a virtual row; index1}] - - cells.forEach((value, index1) => { - const cellLines = (0, _wrapCell.default)(value, config.columns[index1].width, config.columns[index1].wrapWord); - cellLines.forEach((cellLine, index2) => { - rowHeight[index2][index1] = cellLine; - }); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const lodash_flatten_1 = __importDefault(require("lodash.flatten")); +const wrapCell_1 = __importDefault(require("./wrapCell")); +exports.default = (unmappedRows, rowHeightIndex, config) => { + const tableWidth = unmappedRows[0].length; + const mappedRows = unmappedRows.map((row, index0) => { + const rowHeight = Array.from({ length: rowHeightIndex[index0] }, () => { + return new Array(tableWidth).fill(''); + }); + // rowHeight + // [{row index within rowSaw; index2}] + // [{cell index within a virtual row; index1}] + row.forEach((cell, index1) => { + const cellLines = wrapCell_1.default(cell, config.columns[index1].width, config.columns[index1].wrapWord); + cellLines.forEach((cellLine, index2) => { + rowHeight[index2][index1] = cellLine; + }); + }); + return rowHeight; }); - return rowHeight; - }); - return (0, _lodash.default)(mappedRows); + return lodash_flatten_1.default(mappedRows); }; - -var _default = mapDataUsingRowHeightIndex; -exports.default = _default; \ 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 deleted file mode 100644 index 5d59b059a0ad00..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/mapDataUsingRowHeightIndex.js.flow +++ /dev/null @@ -1,34 +0,0 @@ -import flatten from 'lodash.flatten'; -import wrapCell from './wrapCell'; - -/** - * @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 = Array.from(new Array(rowHeightIndex[index0]), () => { - return new Array(tableWidth).fill(''); - }); - - // rowHeight - // [{row index within rowSaw; index2}] - // [{cell index within a virtual row; index1}] - - cells.forEach((value, index1) => { - const cellLines = wrapCell(value, config.columns[index1].width, config.columns[index1].wrapWord); - - cellLines.forEach((cellLine, index2) => { - rowHeight[index2][index1] = cellLine; - }); - }); - - return rowHeight; - }); - - return flatten(mappedRows); -}; 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 4b7fd4dfeca503..e539f3d7a08629 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/padTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/padTableData.js @@ -1,23 +1,10 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** - * @param {table~row[]} rows - * @param {object} config - * @returns {table~row[]} - */ -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); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.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); + }); }); - }); }; - -var _default = padTableData; -exports.default = _default; \ 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 deleted file mode 100644 index a4e6b142c1839f..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/padTableData.js.flow +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @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/schemas/config.json b/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json deleted file mode 100644 index 10fc74ab93cfc1..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/schemas/config.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$id": "config.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "border": { - "$ref": "shared.json#/definitions/borders" - }, - "columns": { - "$ref": "shared.json#/definitions/columns" - }, - "columnDefault": { - "$ref": "shared.json#/definitions/column" - }, - "drawHorizontalLine": { - "typeof": "function" - }, - "singleLine": { - "typeof": "boolean" - } - }, - "additionalProperties": false -} diff --git a/tools/node_modules/eslint/node_modules/table/dist/schemas/shared.json b/tools/node_modules/eslint/node_modules/table/dist/schemas/shared.json deleted file mode 100644 index 7d03f9269455a5..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/schemas/shared.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "$id": "shared.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "columns": { - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }, - "column": { - "type": "object", - "properties": { - "alignment": { - "type": "string", - "enum": [ - "left", - "right", - "center" - ] - }, - "width": { - "type": "number" - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "number" - }, - "paddingLeft": { - "type": "number" - }, - "paddingRight": { - "type": "number" - } - }, - "additionalProperties": false - }, - "borders": { - "type": "object", - "properties": { - "topBody": { - "$ref": "#/definitions/border" - }, - "topJoin": { - "$ref": "#/definitions/border" - }, - "topLeft": { - "$ref": "#/definitions/border" - }, - "topRight": { - "$ref": "#/definitions/border" - }, - "bottomBody": { - "$ref": "#/definitions/border" - }, - "bottomJoin": { - "$ref": "#/definitions/border" - }, - "bottomLeft": { - "$ref": "#/definitions/border" - }, - "bottomRight": { - "$ref": "#/definitions/border" - }, - "bodyLeft": { - "$ref": "#/definitions/border" - }, - "bodyRight": { - "$ref": "#/definitions/border" - }, - "bodyJoin": { - "$ref": "#/definitions/border" - }, - "joinBody": { - "$ref": "#/definitions/border" - }, - "joinLeft": { - "$ref": "#/definitions/border" - }, - "joinRight": { - "$ref": "#/definitions/border" - }, - "joinJoin": { - "$ref": "#/definitions/border" - } - }, - "additionalProperties": false - }, - "border": { - "type": "string" - } - } -} 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 deleted file mode 100644 index 24dfa56282541a..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/schemas/streamConfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$id": "streamConfig.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "properties": { - "border": { - "$ref": "shared.json#/definitions/borders" - }, - "columns": { - "$ref": "shared.json#/definitions/columns" - }, - "columnDefault": { - "$ref": "shared.json#/definitions/column" - }, - "columnCount": { - "type": "number" - } - }, - "additionalProperties": false -} 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 99640e16551ddc..16d88d553c2886 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js @@ -1,21 +1,7 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** - * Casts all cell values to a string. - * - * @param {table~row[]} rows - * @returns {table~row[]} - */ -const stringifyTableData = rows => { - return rows.map(cells => { - return cells.map(String); - }); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = (rows) => { + return rows.map((cells) => { + return cells.map(String); + }); }; - -var _default = stringifyTableData; -exports.default = _default; \ 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 deleted file mode 100644 index a4dffac13d9be6..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/stringifyTableData.js.flow +++ /dev/null @@ -1,11 +0,0 @@ -/** - * 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/table.js b/tools/node_modules/eslint/node_modules/table/dist/table.js index 8c053d81f773b4..94177acc7bd101 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/table.js +++ b/tools/node_modules/eslint/node_modules/table/dist/table.js @@ -1,109 +1,27 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _alignTableData = _interopRequireDefault(require("./alignTableData")); - -var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex")); - -var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex")); - -var _drawTable = _interopRequireDefault(require("./drawTable")); - -var _makeConfig = _interopRequireDefault(require("./makeConfig")); - -var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex")); - -var _padTableData = _interopRequireDefault(require("./padTableData")); - -var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData")); - -var _truncateTableData = _interopRequireDefault(require("./truncateTableData")); - -var _validateTableData = _interopRequireDefault(require("./validateTableData")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @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 - * @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn. - */ - -/** - * Generates a text table. - * - * @param {table~row[]} data - * @param {table~config} userConfig - * @returns {string} - */ -const table = (data, userConfig = {}) => { - let rows; - (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, config.singleLine); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const alignTableData_1 = __importDefault(require("./alignTableData")); +const calculateCellWidthIndex_1 = __importDefault(require("./calculateCellWidthIndex")); +const calculateRowHeightIndex_1 = __importDefault(require("./calculateRowHeightIndex")); +const drawTable_1 = __importDefault(require("./drawTable")); +const makeConfig_1 = __importDefault(require("./makeConfig")); +const mapDataUsingRowHeightIndex_1 = __importDefault(require("./mapDataUsingRowHeightIndex")); +const padTableData_1 = __importDefault(require("./padTableData")); +const stringifyTableData_1 = __importDefault(require("./stringifyTableData")); +const truncateTableData_1 = __importDefault(require("./truncateTableData")); +const validateTableData_1 = __importDefault(require("./validateTableData")); +exports.default = (data, userConfig = {}) => { + validateTableData_1.default(data); + let rows = stringifyTableData_1.default(data); + const config = makeConfig_1.default(rows, userConfig); + rows = truncateTableData_1.default(rows, config); + const rowHeightIndex = calculateRowHeightIndex_1.default(rows, config); + rows = mapDataUsingRowHeightIndex_1.default(rows, rowHeightIndex, config); + rows = alignTableData_1.default(rows, config); + rows = padTableData_1.default(rows, config); + const cellWidthIndex = calculateCellWidthIndex_1.default(rows[0]); + return drawTable_1.default(rows, cellWidthIndex, rowHeightIndex, config); }; - -var _default = table; -exports.default = _default; \ 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 deleted file mode 100644 index 6790e8cc550f2c..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/table.js.flow +++ /dev/null @@ -1,96 +0,0 @@ -import alignTableData from './alignTableData'; -import calculateCellWidthIndex from './calculateCellWidthIndex'; -import calculateRowHeightIndex from './calculateRowHeightIndex'; -import drawTable from './drawTable'; -import makeConfig from './makeConfig'; -import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex'; -import padTableData from './padTableData'; -import stringifyTableData from './stringifyTableData'; -import truncateTableData from './truncateTableData'; -import validateTableData from './validateTableData'; - -/** - * @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 - * @property {table~singleLine} singleLine Horizontal lines inside the table are not drawn. - */ - -/** - * 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, config.singleLine); -}; 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 72f8bfd8d261b1..8d0f7a31a4d669 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js @@ -1,29 +1,19 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _lodash = _interopRequireDefault(require("lodash.truncate")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const lodash_truncate_1 = __importDefault(require("lodash.truncate")); /** * @todo Make it work with ASCII content. - * @param {table~row[]} rows - * @param {object} config - * @returns {table~row[]} */ -const truncateTableData = (rows, config) => { - return rows.map(cells => { - return cells.map((content, index) => { - return (0, _lodash.default)(content, { - length: config.columns[index].truncate - }); +exports.default = (rows, config) => { + return rows.map((cells) => { + return cells.map((content, index) => { + return lodash_truncate_1.default(content, { + length: config.columns[index].truncate, + omission: '…', + }); + }); }); - }); }; - -var _default = truncateTableData; -exports.default = _default; \ 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 deleted file mode 100644 index e78b7ec7898682..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/truncateTableData.js.flow +++ /dev/null @@ -1,17 +0,0 @@ -import truncate from 'lodash.truncate'; - -/** - * @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/types/api.js b/tools/node_modules/eslint/node_modules/table/dist/types/api.js new file mode 100644 index 00000000000000..c8ad2e549bdc68 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/types/api.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tools/node_modules/eslint/node_modules/table/dist/types/internal.js b/tools/node_modules/eslint/node_modules/table/dist/types/internal.js new file mode 100644 index 00000000000000..c8ad2e549bdc68 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/table/dist/types/internal.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); 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 b01a94b54aad0a..50d837c00ec7e0 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js +++ b/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js @@ -1,40 +1,23 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _validators = _interopRequireDefault(require("../dist/validators")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @param {string} schemaId - * @param {formatData~config} config - * @returns {undefined} - */ -const validateConfig = (schemaId, config = {}) => { - const validate = _validators.default[schemaId]; - - if (!validate(config)) { - const errors = validate.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.'); - } +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const validators_1 = __importDefault(require("./generated/validators")); +exports.default = (schemaId, config) => { + const validate = validators_1.default[schemaId]; + if (!validate(config) && validate.errors) { + const errors = validate.errors.map((error) => { + return { + 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.'); + } }; - -var _default = validateConfig; -exports.default = _default; \ No newline at end of file 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 deleted file mode 100644 index 2873880b7577c1..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/validateConfig.js.flow +++ /dev/null @@ -1,27 +0,0 @@ -import validators from '../dist/validators'; - -/** - * @param {string} schemaId - * @param {formatData~config} config - * @returns {undefined} - */ -export default (schemaId, config = {}) => { - const validate = validators[schemaId]; - if (!validate(config)) { - const errors = validate.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/validateTableData.js b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js index d80c2e26612765..3a11457c714660 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js +++ b/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js @@ -1,54 +1,28 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** - * @typedef {string} cell - */ - -/** - * @typedef {cell[]} validateData~column - */ - -/** - * @param {column[]} rows - * @returns {undefined} - */ -const validateTableData = 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.'); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = (rows) => { + if (!Array.isArray(rows)) { + throw new TypeError('Table data must be an array.'); } - - if (cells.length !== columnNumber) { - throw new Error('Table must have a consistent number of cells.'); + if (rows.length === 0) { + throw new Error('Table must define at least one row.'); } - - for (const cell of cells) { - // eslint-disable-next-line no-control-regex - if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test(cell)) { - throw new Error('Table data must not contain control characters.'); - } + if (rows[0].length === 0) { + throw new Error('Table must define at least one column.'); + } + const columnNumber = rows[0].length; + for (const row of rows) { + if (!Array.isArray(row)) { + throw new TypeError('Table row data must be an array.'); + } + if (row.length !== columnNumber) { + throw new Error('Table must have a consistent number of cells.'); + } + for (const cell of row) { + // eslint-disable-next-line no-control-regex + if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test(cell)) { + throw new Error('Table data must not contain control characters.'); + } + } } - } }; - -var _default = validateTableData; -exports.default = _default; \ 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 deleted file mode 100644 index dcc7fc1d139154..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/validateTableData.js.flow +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @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.'); - } - - for (const cell of cells) { - // eslint-disable-next-line no-control-regex - if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test(cell)) { - throw new Error('Table data must not contain control characters.'); - } - } - } -}; diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapCell.js b/tools/node_modules/eslint/node_modules/table/dist/wrapCell.js index 040787ddeb8a67..df64e7568c0756 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/wrapCell.js +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapCell.js @@ -1,47 +1,47 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _wrapString = _interopRequireDefault(require("./wrapString")); - -var _wrapWord = _interopRequireDefault(require("./wrapWord")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const slice_ansi_1 = __importDefault(require("slice-ansi")); +const strip_ansi_1 = __importDefault(require("strip-ansi")); +const wrapString_1 = __importDefault(require("./wrapString")); +const wrapWord_1 = __importDefault(require("./wrapWord")); +const splitAnsi = (input) => { + const lengths = strip_ansi_1.default(input).split('\n').map(({ length }) => { + return length; + }); + const result = []; + let startIndex = 0; + lengths.forEach((length) => { + result.push(length === 0 ? '' : slice_ansi_1.default(input, startIndex, startIndex + length)); + // Plus 1 for the newline character itself + startIndex += length + 1; + }); + return result; +}; /** * Wrap a single cell value into a list of lines * * Always wraps on newlines, for the remainder uses either word or string wrapping * depending on user configuration. * - * @param {string} cellValue - * @param {number} columnWidth - * @param {boolean} useWrapWord - * @returns {Array} */ -const wrapCell = (cellValue, columnWidth, useWrapWord) => { - // First split on literal newlines - const cellLines = cellValue.split('\n'); // Then iterate over the list and word-wrap every remaining line if necessary. - - for (let lineNr = 0; lineNr < cellLines.length;) { - let lineChunks; - - if (useWrapWord) { - lineChunks = (0, _wrapWord.default)(cellLines[lineNr], columnWidth); - } else { - lineChunks = (0, _wrapString.default)(cellLines[lineNr], columnWidth); - } // Replace our original array element with whatever the wrapping returned - - - cellLines.splice(lineNr, 1, ...lineChunks); - lineNr += lineChunks.length; - } - - return cellLines; +exports.default = (cellValue, columnWidth, useWrapWord) => { + // First split on literal newlines + const cellLines = splitAnsi(cellValue); + // Then iterate over the list and word-wrap every remaining line if necessary. + for (let lineNr = 0; lineNr < cellLines.length;) { + let lineChunks; + if (useWrapWord) { + lineChunks = wrapWord_1.default(cellLines[lineNr], columnWidth); + } + else { + lineChunks = wrapString_1.default(cellLines[lineNr], columnWidth); + } + // Replace our original array element with whatever the wrapping returned + cellLines.splice(lineNr, 1, ...lineChunks); + lineNr += lineChunks.length; + } + return cellLines; }; - -var _default = wrapCell; -exports.default = _default; \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/table/dist/wrapCell.js.flow b/tools/node_modules/eslint/node_modules/table/dist/wrapCell.js.flow deleted file mode 100644 index 0c66260e2599f9..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/wrapCell.js.flow +++ /dev/null @@ -1,35 +0,0 @@ -import wrapString from './wrapString'; -import wrapWord from './wrapWord'; - -/** - * Wrap a single cell value into a list of lines - * - * Always wraps on newlines, for the remainder uses either word or string wrapping - * depending on user configuration. - * - * @param {string} cellValue - * @param {number} columnWidth - * @param {boolean} useWrapWord - * @returns {Array} - */ -export default (cellValue, columnWidth, useWrapWord) => { - // First split on literal newlines - const cellLines = cellValue.split('\n'); - - // Then iterate over the list and word-wrap every remaining line if necessary. - for (let lineNr = 0; lineNr < cellLines.length;) { - let lineChunks; - - if (useWrapWord) { - lineChunks = wrapWord(cellLines[lineNr], columnWidth); - } else { - lineChunks = wrapString(cellLines[lineNr], columnWidth); - } - - // Replace our original array element with whatever the wrapping returned - cellLines.splice(lineNr, 1, ...lineChunks); - lineNr += lineChunks.length; - } - - return cellLines; -}; 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 f97f798c450948..d61620857e2e17 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,10 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _sliceAnsi = _interopRequireDefault(require("slice-ansi")); - -var _stringWidth = _interopRequireDefault(require("string-width")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const slice_ansi_1 = __importDefault(require("slice-ansi")); +const string_width_1 = __importDefault(require("string-width")); /** * Creates an array of strings split into groups the length of size. * This function works with strings that contain ASCII characters. @@ -18,22 +12,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * 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} */ -const wrapString = (subject, size) => { - let subjectSlice; - subjectSlice = subject; - const chunks = []; - - do { - chunks.push((0, _sliceAnsi.default)(subjectSlice, 0, size)); - subjectSlice = (0, _sliceAnsi.default)(subjectSlice, size).trim(); - } while ((0, _stringWidth.default)(subjectSlice)); - - return chunks; +exports.default = (subject, size) => { + let subjectSlice = subject; + const chunks = []; + do { + chunks.push(slice_ansi_1.default(subjectSlice, 0, size)); + subjectSlice = slice_ansi_1.default(subjectSlice, size).trim(); + } while (string_width_1.default(subjectSlice)); + return chunks; }; - -var _default = wrapString; -exports.default = _default; \ 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 deleted file mode 100644 index bbb40721e34f99..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/wrapString.js.flow +++ /dev/null @@ -1,29 +0,0 @@ -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/wrapWord.js b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js index 52a8095ab5aa7d..bc864ace513b35 100644 --- a/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js +++ b/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js @@ -1,46 +1,39 @@ "use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _sliceAnsi = _interopRequireDefault(require("slice-ansi")); - -var _stringWidth = _interopRequireDefault(require("string-width")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * @param {string} input - * @param {number} size - * @returns {Array} - */ -const wrapWord = (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 = (0, _sliceAnsi.default)(subject, (0, _stringWidth.default)(chunk)); - chunk = chunk.trim(); - } else { - chunk = (0, _sliceAnsi.default)(subject, 0, size); - subject = (0, _sliceAnsi.default)(subject, size); - } - - chunks.push(chunk); - } while ((0, _stringWidth.default)(subject)); - - return chunks; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const slice_ansi_1 = __importDefault(require("slice-ansi")); +const strip_ansi_1 = __importDefault(require("strip-ansi")); +const calculateStringLengths = (input, size) => { + let subject = strip_ansi_1.default(input); + const chunks = []; + // https://regex101.com/r/gY5kZ1/1 + const re = new RegExp('(^.{1,' + String(size) + '}(\\s+|$))|(^.{1,' + String(size - 1) + '}(\\\\|/|_|\\.|,|;|-))'); + do { + let chunk; + const match = re.exec(subject); + if (match) { + chunk = match[0]; + subject = subject.slice(chunk.length); + const trimmedLength = chunk.trim().length; + const offset = chunk.length - trimmedLength; + chunks.push([trimmedLength, offset]); + } + else { + chunk = subject.slice(0, size); + subject = subject.slice(size); + chunks.push([chunk.length, 0]); + } + } while (subject.length); + return chunks; +}; +exports.default = (input, size) => { + const result = []; + let startIndex = 0; + calculateStringLengths(input, size).forEach(([length, offset]) => { + result.push(slice_ansi_1.default(input, startIndex, startIndex + length)); + startIndex += length + offset; + }); + return result; }; - -var _default = wrapWord; -exports.default = _default; \ 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 deleted file mode 100644 index 02a8d45ea4c9bd..00000000000000 --- a/tools/node_modules/eslint/node_modules/table/dist/wrapWord.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -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/node_modules/ajv/dist/compile/validate/keyword.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/keyword.js index 42b2e7a33759b6..47f6176b1109cf 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/keyword.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/compile/validate/keyword.js @@ -99,7 +99,7 @@ function validSchemaType(schema, schemaType, allowUndefined = false) { : typeof schema == st || (allowUndefined && typeof schema == "undefined"))); } exports.validSchemaType = validSchemaType; -function validateKeywordUsage({ schema, opts, self }, def, keyword) { +function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) { /* istanbul ignore if */ if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { throw new Error("ajv implementation error"); @@ -111,7 +111,8 @@ function validateKeywordUsage({ schema, opts, self }, def, keyword) { if (def.validateSchema) { const valid = def.validateSchema(schema[keyword]); if (!valid) { - const msg = "keyword value is invalid: " + self.errorsText(def.validateSchema.errors); + const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self.errorsText(def.validateSchema.errors); if (opts.validateSchema === "log") self.logger.error(msg); else diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js index 9eba9f49d9e1e8..a1aae13883da38 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/core.js @@ -61,7 +61,7 @@ const deprecatedOptions = { const MAX_EXPRESSION = 200; // eslint-disable-next-line complexity function requiredOptions(o) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; const s = o.strict; const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize; const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; @@ -80,6 +80,7 @@ function requiredOptions(o) { addUsedSchema: (_s = o.addUsedSchema) !== null && _s !== void 0 ? _s : true, validateSchema: (_t = o.validateSchema) !== null && _t !== void 0 ? _t : true, validateFormats: (_u = o.validateFormats) !== null && _u !== void 0 ? _u : true, + unicodeRegExp: (_v = o.unicodeRegExp) !== null && _v !== void 0 ? _v : true, }; } class Ajv { diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js index 91672bc0846023..09da8547ec735b 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js @@ -50,7 +50,7 @@ const def = { definedProp = codegen_1.nil; } if (patProps.length) { - definedProp = codegen_1.or(definedProp, ...patProps.map((p) => codegen_1._ `${code_1.usePattern(gen, p)}.test(${key})`)); + definedProp = codegen_1.or(definedProp, ...patProps.map((p) => codegen_1._ `${code_1.usePattern(cxt, p)}.test(${key})`)); } return codegen_1.not(definedProp); } diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js index 1f2f9fe71434cf..ff68c82e1061ec 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js @@ -45,7 +45,7 @@ const def = { } function validateProperties(pat) { gen.forIn("key", data, (key) => { - gen.if(codegen_1._ `${code_1.usePattern(gen, pat)}.test(${key})`, () => { + gen.if(codegen_1._ `${code_1.usePattern(cxt, pat)}.test(${key})`, () => { cxt.subschema({ keyword: "patternProperties", schemaProp: pat, diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js index 848a72c88f4c9b..c6f852daf9190f 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/code.js @@ -65,11 +65,12 @@ function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPat return context !== codegen_1.nil ? codegen_1._ `${func}.call(${context}, ${args})` : codegen_1._ `${func}(${args})`; } exports.callValidateCode = callValidateCode; -function usePattern(gen, pattern) { +function usePattern({ gen, it: { opts } }, pattern) { + const u = opts.unicodeRegExp ? "u" : ""; return gen.scopeValue("pattern", { key: pattern, - ref: new RegExp(pattern, "u"), - code: codegen_1._ `new RegExp(${pattern}, "u")`, + ref: new RegExp(pattern, u), + code: codegen_1._ `new RegExp(${pattern}, ${u})`, }); } exports.usePattern = usePattern; diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js index 7bb1587d98d5b5..b0862db342257f 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.js @@ -13,8 +13,10 @@ const def = { $data: true, error, code(cxt) { - const { gen, data, $data, schema, schemaCode } = cxt; - const regExp = $data ? codegen_1._ `(new RegExp(${schemaCode}, "u"))` : code_1.usePattern(gen, schema); // TODO regexp should be wrapped in try/catch + const { data, $data, schema, schemaCode, it } = cxt; + // TODO regexp should be wrapped in try/catchs + const u = it.opts.unicodeRegExp ? "u" : ""; + const regExp = $data ? codegen_1._ `(new RegExp(${schemaCode}, ${u}))` : code_1.usePattern(cxt, schema); cxt.fail$data(codegen_1._ `!${regExp}.test(${data})`); }, }; diff --git a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json index ec9f333b117190..22f7a782c40b27 100644 --- a/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json +++ b/tools/node_modules/eslint/node_modules/table/node_modules/ajv/package.json @@ -1,6 +1,6 @@ { "name": "ajv", - "version": "8.0.5", + "version": "8.1.0", "description": "Another JSON Schema Validator", "main": "dist/ajv.js", "types": "dist/ajv.d.ts", diff --git a/tools/node_modules/eslint/node_modules/table/package.json b/tools/node_modules/eslint/node_modules/table/package.json index c1e2f61bacdcd4..5d331e4b5287bf 100644 --- a/tools/node_modules/eslint/node_modules/table/package.json +++ b/tools/node_modules/eslint/node_modules/table/package.json @@ -6,43 +6,42 @@ }, "dependencies": { "ajv": "^8.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", "lodash.clonedeep": "^4.5.0", "lodash.flatten": "^4.4.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", - "string-width": "^4.2.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" }, "description": "Formats data into a string table.", "devDependencies": { - "@babel/cli": "^7.12.10", - "@babel/core": "^7.12.10", - "@babel/plugin-transform-flow-strip-types": "^7.12.10", - "@babel/preset-env": "^7.12.11", - "@babel/register": "^7.12.10", + "@types/chai": "^4.2.16", + "@types/lodash.clonedeep": "^4.5.6", + "@types/lodash.flatten": "^4.4.6", + "@types/lodash.mapvalues": "^4.6.6", + "@types/lodash.truncate": "^4.4.6", + "@types/mocha": "^8.2.2", + "@types/node": "^14.14.37", + "@types/sinon": "^10.0.0", + "@types/slice-ansi": "^4.0.0", "ajv-cli": "^5.0.0", "ajv-keywords": "^5.0.0", - "babel-plugin-istanbul": "^6.0.0", - "babel-plugin-transform-export-default-name": "^2.1.0", "chai": "^4.2.0", "chalk": "^4.1.0", "coveralls": "^3.1.0", "eslint": "^7.16.0", "eslint-config-canonical": "^25.0.0", - "flow-bin": "^0.141.0", - "flow-copy-source": "^2.0.9", "gitdown": "^3.1.3", "husky": "^4.3.6", "js-beautify": "^1.13.0", "lodash.mapvalues": "^4.6.0", - "lodash.random": "^3.2.0", - "lodash.sample": "^4.2.1", + "mkdirp": "^1.0.4", "mocha": "^8.2.1", "nyc": "^15.1.0", "semantic-release": "^17.3.1", - "sinon": "^9.2.2" + "sinon": "^9.2.2", + "ts-node": "^9.1.1", + "typescript": "4.2.4" }, "engines": { "node": ">=10.0.0" @@ -50,7 +49,7 @@ "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" + "pre-commit": "npm run build && npm run lint && npm run test" } }, "keywords": [ @@ -62,30 +61,35 @@ ], "license": "BSD-3-Clause", "main": "./dist/index.js", + "files": [ + "dist/**/*.js", + "dist/**/*.d.ts" + ], "name": "table", "nyc": { - "include": [ - "src/**/*.js" + "extensions": [ + ".ts" + ], + "exclude": [ + "src/generated/validators.js", + "test/**/*.ts" ], - "instrument": false, "reporter": [ "text-lcov" - ], - "require": [ - "@babel/register" - ], - "sourceMap": false + ] }, "repository": { "type": "git", "url": "https://github.com/gajus/table" }, "scripts": { - "build": "rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files && npm run create-validators && flow-copy-source src dist", + "compile": "tsc", + "prebuild": "rm -fr ./dist && mkdirp dist", + "build": "npm run create-validators && npm run compile", "create-readme": "gitdown ./.README/README.md --output-file ./README.md", - "create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -s src/schemas/streamConfig -r src/schemas/shared -c ajv-keywords/dist/keywords/typeof -o | js-beautify > dist/validators.js", - "lint": "npm run build && eslint ./src ./test && flow", - "test": "mocha --require @babel/register" + "create-validators": "rm -fr ./src/generated && mkdirp ./src/generated && ajv compile --all-errors --inline-refs=false -s src/schemas/config -s src/schemas/streamConfig -r src/schemas/shared -c ajv-keywords/dist/keywords/typeof -o | js-beautify > ./src/generated/validators.js", + "lint": "eslint --ignore-path .gitignore ./src ./test", + "test": "npm run create-validators && mocha --require ts-node/register ./test/**/*.ts" }, - "version": "6.0.9" + "version": "6.5.1" } diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index b414ca6eae5671..4f87ef6403bc82 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -1,6 +1,6 @@ { "name": "eslint", - "version": "7.24.0", + "version": "7.25.0", "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>", "description": "An AST-based pattern checker for JavaScript.", "bin": { @@ -27,10 +27,7 @@ "pre-commit": "lint-staged" }, "lint-staged": { - "*.js": [ - "eslint --fix", - "git add" - ], + "*.js": "eslint --fix", "*.md": "markdownlint" }, "files": [ @@ -103,7 +100,7 @@ "eslint-plugin-jsdoc": "^25.4.3", "eslint-plugin-node": "^11.1.0", "eslint-release": "^2.0.0", - "eslump": "^2.0.0", + "eslump": "^3.0.0", "esprima": "^4.0.1", "fs-teardown": "^0.1.0", "glob": "^7.1.6", diff --git a/tools/test.py b/tools/test.py index cdeb40d59cda78..c3a7ff07e23b5d 100755 --- a/tools/test.py +++ b/tools/test.py @@ -375,7 +375,10 @@ def HasRun(self, output): if output.diagnostic: self.severity = 'ok' - self.traceback = output.diagnostic + if isinstance(output.diagnostic, list): + self.traceback = '\n'.join(output.diagnostic) + else: + self.traceback = output.diagnostic duration = output.test.duration diff --git a/tools/update-npm.sh b/tools/update-npm.sh index c106570d0b33dd..a203bba3623f7e 100755 --- a/tools/update-npm.sh +++ b/tools/update-npm.sh @@ -24,12 +24,11 @@ mkdir -p "$WORKSPACE" cd "$WORKSPACE" -git clone git@github.com:npm/cli.git +git clone --depth=1 --branch="v$NPM_VERSION" git@github.com:npm/cli.git cd cli echo "Preparing npm release" -git checkout v"$NPM_VERSION" make make release diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index ef5319fa08f0db..377e12d1fdcfbd 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1378,6 +1378,9 @@ '<(V8_ROOT)/src/heap/base/worklist.h', ], 'conditions': [ + ['enable_lto=="true"', { + 'cflags_cc': [ '-fno-lto' ], + }], ['clang or OS!="win"', { 'conditions': [ ['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', { @@ -1509,6 +1512,7 @@ 'variables': { 'v8_dump_build_config_args': [ '<(PRODUCT_DIR)/v8_build_config.json', + 'current_cpu=<(v8_current_cpu)', 'dcheck_always_on=<(dcheck_always_on)', 'is_android=<(is_android)', 'is_asan=<(asan)', @@ -1517,20 +1521,30 @@ 'is_component_build=<(component)', 'is_debug=<(CONFIGURATION_NAME)', # Not available in gyp. + 'is_full_debug=0', + # Not available in gyp. 'is_gcov_coverage=0', 'is_msan=<(msan)', 'is_tsan=<(tsan)', # Not available in gyp. 'is_ubsan_vptr=0', 'target_cpu=<(target_arch)', + 'v8_current_cpu=<(v8_current_cpu)', + # Not available in gyp. + 'v8_enable_atomic_marking_state=0', + # Not available in gyp. + 'v8_enable_atomic_object_field_writes=0', + # Not available in gyp. + 'v8_enable_concurrent_marking=0', 'v8_enable_i18n_support=<(v8_enable_i18n_support)', 'v8_enable_verify_predictable=<(v8_enable_verify_predictable)', - 'v8_target_cpu=<(v8_target_arch)', - 'v8_use_siphash=<(v8_use_siphash)', 'v8_enable_verify_csa=<(v8_enable_verify_csa)', 'v8_enable_lite_mode=<(v8_enable_lite_mode)', 'v8_enable_pointer_compression=<(v8_enable_pointer_compression)', 'v8_enable_webassembly=<(v8_enable_webassembly)', + # Not available in gyp. + 'v8_control_flow_integrity=0', + 'v8_target_cpu=<(v8_target_arch)', ] }, 'conditions': [ diff --git a/tsconfig.json b/tsconfig.json index 80189489b6c02f..df191a36f7cb13 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,9 @@ "exclude": ["src","tools","out"], "files": [ "./typings/internalBinding/fs.d.ts", + "./typings/internalBinding/http_parser.d.ts", + "./typings/internalBinding/options.d.ts", + "./typings/internalBinding/serdes.d.ts", "./typings/internalBinding/util.d.ts", "./typings/internalBinding.d.ts", "./typings/primordials.d.ts" diff --git a/typings/internalBinding/http_parser.d.ts b/typings/internalBinding/http_parser.d.ts new file mode 100644 index 00000000000000..260c6e802b0808 --- /dev/null +++ b/typings/internalBinding/http_parser.d.ts @@ -0,0 +1,42 @@ +declare namespace InternalHttpParserBinding { + class HTTPParser { + static REQUEST: 1; + static RESPONSE: 2; + + static kOnMessageBegin: 0; + static kOnHeaders: 1; + static kOnHeadersComplete: 2; + static kOnBody: 3; + static kOnMessageComplete: 4; + static kOnExecute: 5; + static kOnTimeout: 6; + + static kLenientNone: number; + static kLenientHeaders: number; + static kLenientChunkedLength: number; + static kLenientKeepAlive: number; + static kLenientAll: number; + + close(): void; + free(): void; + execute(buffer: Buffer): Error | Buffer; + finish(): Error | Buffer; + initialize( + type: number, + resource: object, + maxHeaderSize?: number, + lenient?: number, + headersTimeout?: number, + ): void; + pause(): void; + resume(): void; + consume(stream: object): void; + unconsume(): void; + getCurrentBuffer(): Buffer; + } +} + +declare function InternalBinding(binding: 'http_parser'): { + methods: string[]; + HTTPParser: typeof InternalHttpParserBinding.HTTPParser; +}; diff --git a/typings/internalBinding/options.d.ts b/typings/internalBinding/options.d.ts new file mode 100644 index 00000000000000..2257463174d101 --- /dev/null +++ b/typings/internalBinding/options.d.ts @@ -0,0 +1,34 @@ +declare function InternalBinding(binding: 'options'): { + getOptions(): { + options: Map< + string, + { + helpText: string; + envVarSettings: 0 | 1; + } & ( + | { type: 0 | 1; value: undefined } + | { type: 2; value: boolean } + | { type: 3 | 4; value: number } + | { type: 5; value: string } + | { type: 6; value: { host: string; port: number } } + | { type: 7; value: string[] } + ) + >; + aliases: Map<string, string[]>; + }; + envSettings: { + kAllowedInEnvironment: 0; + kDisallowedInEnvironment: 1; + }; + shouldNotRegisterESMLoader: boolean; + types: { + kNoOp: 0; + kV8Option: 1; + kBoolean: 2; + kInteger: 3; + kUInteger: 4; + kString: 5; + kHostPort: 6; + kStringList: 7; + }; +}; diff --git a/typings/internalBinding/serdes.d.ts b/typings/internalBinding/serdes.d.ts new file mode 100644 index 00000000000000..d328123e25ade4 --- /dev/null +++ b/typings/internalBinding/serdes.d.ts @@ -0,0 +1,34 @@ +declare namespace InternalSerdesBinding { + class Serializer { + _getDataCloneError: typeof Error; + constructor(); + _setTreatArrayBufferViewsAsHostObjects(value: boolean): void; + releaseBuffer(): Buffer; + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; + writeDouble(value: number): void; + writeHeader(): void; + writeRawBytes(value: ArrayBufferView): void; + writeUint32(value: number): void; + writeUint64(hi: number, lo: number): void; + writeValue(value: any): void; + } + + class Deserializer { + buffer: ArrayBufferView; + constructor(buffer: ArrayBufferView); + _readRawBytes(length: number): number; + getWireFormatVersion(): number; + readDouble(): number; + readHeader(): boolean; + readRawBytes(length: number): Buffer; + readUint32(): number; + readUint64(): [hi: number, lo: number]; + readValue(): unknown; + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer | SharedArrayBuffer): void; + } +} + +declare function InternalBinding(binding: 'serdes'): { + Serializer: typeof InternalSerdesBinding.Serializer; + Deserializer: typeof InternalSerdesBinding.Deserializer; +};