diff --git a/.eslintrc.js b/.eslintrc.js index f5100fd3cc91b8..e84c7408d11572 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,6 +18,7 @@ const hacks = [ 'eslint-plugin-markdown', '@babel/eslint-parser', '@babel/plugin-syntax-class-properties', + '@babel/plugin-syntax-import-assertions', '@babel/plugin-syntax-top-level-await', ]; Module._findPath = (request, paths, isMain) => { @@ -41,6 +42,7 @@ module.exports = { babelOptions: { plugins: [ Module._findPath('@babel/plugin-syntax-class-properties'), + Module._findPath('@babel/plugin-syntax-import-assertions'), Module._findPath('@babel/plugin-syntax-top-level-await'), ], }, diff --git a/.github/workflows/authors.yml b/.github/workflows/authors.yml index 1f410a727abd42..01bd0652a4b399 100644 --- a/.github/workflows/authors.yml +++ b/.github/workflows/authors.yml @@ -12,11 +12,11 @@ jobs: - run: "tools/update-authors.js" # run the AUTHORS tool - uses: gr2m/create-or-update-pull-request-action@v1 # create a PR or update the Action's existing PR env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} with: - title: "meta: update AUTHORS" + author: Node.js GitHub Bot body: "If this PR exists, there's presumably new additions to the AUTHORS file. This is an automatically generated PR by the `authors.yml` GitHub Action, which runs `tools/update-authors.js` and submits a new PR or updates an existing PR.\n\nPlease note that there might be duplicate entries. If there are, please remove them and add the duplicate emails to .mailmap directly to this PR." branch: "actions/authors-update" # custom branch *just* for this Action. commit-message: "meta: update AUTHORS" - author: github-actions[bot] labels: meta + title: "meta: update AUTHORS" diff --git a/.github/workflows/find-inactive-collaborators.yml b/.github/workflows/find-inactive-collaborators.yml index fbb392d2e537ef..f4dfc964ccd2f3 100644 --- a/.github/workflows/find-inactive-collaborators.yml +++ b/.github/workflows/find-inactive-collaborators.yml @@ -32,9 +32,9 @@ jobs: - name: Open pull request uses: gr2m/create-or-update-pull-request-action@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} with: - author: github-actions[bot] + author: Node.js GitHub Bot body: This PR was generated by tools/find-inactive-collaborators.yml. commit-message: "meta: move one or more collaborators to emeritus" labels: meta diff --git a/.gitignore b/.gitignore index 08b44ff9561db3..c0053a07323419 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,7 @@ _UpgradeReport_Files/ *.wixobj /tools/msvs/genfiles/ /npm.wxs +/corepack.wxs /tools/msvs/msi/Release/ /tools/msvs/msi/obj/ /tools/msvs/msi/x64/ diff --git a/.mailmap b/.mailmap index e53d49109038df..efd81d38bc26f7 100644 --- a/.mailmap +++ b/.mailmap @@ -26,6 +26,7 @@ Andreas Offenhaeuser Andrew Hughes Andy Bettisworth Angel Stoyanov +Anna Henningsen Anna Henningsen Anna Henningsen Anna Magdalena Kedzierska @@ -122,6 +123,7 @@ Elliott Cable Eric Phetteplace Ernesto Salazar Erwin W. Ramadhan +Ethan Arrowood Eugene Obrezkov Eugene Ostroukhov Eugene Ostroukhov @@ -299,6 +301,8 @@ Nebu Pookins Netto Farah Nicholas Kinsey Nick Soggin +Nigel Kibodeaux +Nikola Glavina Nikolai Vavilov Nils Kuhnhenn Nitzan Uziely diff --git a/AUTHORS b/AUTHORS index 213c03ba9f32a8..b9ad7e86f12f5c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1237,12 +1237,12 @@ Josh Mays Matt Crummey michael6 Raja Panidepu -Ethan Arrowood +Ethan Arrowood Dan Villa CodeTheInternet Eric Gonzalez rgoodwin -Nigel Kibodeaux +Nigel Kibodeaux fmizzell cdnadmin Paul Lucas @@ -1772,7 +1772,6 @@ Guilherme Akio Sakae Martin Michaelis Christopher Sidebottom Edward Andrew Robinson -Nigel Kibodeaux Shakeel Mohamed Tobias Kieslich Ruy Adorno @@ -3088,7 +3087,7 @@ Anentropic Saleem Julien Poissonnier zombieleet -Nikola Glavina +Nikola Glavina Johannes Schöpp Francisco Ryan Tolmasky I Ye-hyoung Kang @@ -3167,9 +3166,7 @@ FeelyChau Darcy Clarke mayank agarwal woodfairy -Nikola Glavina Rishabh Mehan -Anna Henningsen Andrew Casey Anders Kaseorg Hollow Man diff --git a/CHANGELOG.md b/CHANGELOG.md index 70cc4fd6c1c524..297c6a7f1e4b45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,8 @@ release. -16.8.0
+16.9.0
+16.8.0
16.7.0
16.6.2
16.6.1
diff --git a/LICENSE b/LICENSE index 29bd53a3610f89..b1da90352139aa 100644 --- a/LICENSE +++ b/LICENSE @@ -625,6 +625,17 @@ The externally maintained libraries used by Node.js are: USE OR OTHER DEALINGS IN THE SOFTWARE. """ +- corepack, located at deps/corepack, is licensed as follows: + """ + **Copyright © Corepack contributors** + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + - OpenSSL, located at deps/openssl, is licensed as follows: """ Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. diff --git a/Makefile b/Makefile index 609d0614419f86..cc0539d98e8ab9 100644 --- a/Makefile +++ b/Makefile @@ -1054,6 +1054,14 @@ endif # Builds the macOS installer for releases. pkg: $(PKG) +corepack-update: + rm -rf /tmp/node-corepack-clone + git clone 'https://github.com/nodejs/corepack.git' /tmp/node-corepack-clone + cd /tmp/node-corepack-clone && yarn pack + rm -rf deps/corepack && mkdir -p deps/corepack + cd deps/corepack && tar xf /tmp/node-corepack-clone/package.tgz --strip-components=1 + chmod +x deps/corepack/shims/* + # Note: this is strictly for release builds on release machines only. pkg-upload: pkg ssh $(STAGINGSERVER) "mkdir -p nodejs/$(DISTTYPEDIR)/$(FULLVERSION)" diff --git a/README.md b/README.md index d29b9bc7bf6624..032b622908c319 100644 --- a/README.md +++ b/README.md @@ -171,8 +171,6 @@ For information about the governance of the Node.js project, see **Colin Ihrig** <cjihrig@gmail.com> (he/him) * [codebytere](https://github.com/codebytere) - **Shelley Vohr** <shelley.vohr@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) - @@ -214,6 +212,8 @@ For information about the governance of the Node.js project, see **Ben Noordhuis** <info@bnoordhuis.nl> * [chrisdickinson](https://github.com/chrisdickinson) - **Chris Dickinson** <christopher.s.dickinson@gmail.com> +* [danbev](https://github.com/danbev) - +**Daniel Bevenius** <daniel.bevenius@gmail.com> (he/him) * [evanlucas](https://github.com/evanlucas) - **Evan Lucas** <evanlucas@me.com> (he/him) * [Fishrock123](https://github.com/Fishrock123) - @@ -622,12 +622,18 @@ maintaining the Node.js project. **Qingyu Deng** <i@ayase-lab.com> * [himadriganguly](https://github.com/himadriganguly) - **Himadri Ganguly** <himadri.tech@gmail.com> (he/him) +* [iam-frankqiu](https://github.com/iam-frankqiu) - +**Frank Qiu** <iam.frankqiu@gmail.com> (he/him) * [marsonya](https://github.com/marsonya) - **Akhil Marsonya** <akhil.marsonya27@gmail.com> (he/him) +* [Mesteery](https://github.com/Mesteery) - +**Mestery** <mestery@pm.me> * [PoojaDurgad](https://github.com/PoojaDurgad) - **Pooja Durgad** <Pooja.D.P@ibm.com> * [RaisinTen](https://github.com/RaisinTen) - **Darshan Sen** <raisinten@gmail.com> +* [VoltrexMaster](https://github.com/VoltrexMaster) - +**Voltrex** <mohammadkeyvanzade94@gmail.com> (he/him) ### Release keys diff --git a/benchmark/async_hooks/async-local-storage-run.js b/benchmark/async_hooks/async-local-storage-run.js new file mode 100644 index 00000000000000..d65abb7047b2e4 --- /dev/null +++ b/benchmark/async_hooks/async-local-storage-run.js @@ -0,0 +1,21 @@ +'use strict'; +const common = require('../common.js'); +const { AsyncLocalStorage } = require('async_hooks'); + +const bench = common.createBenchmark(main, { + n: [1e7] +}); + +async function run(store, n) { + for (let i = 0; i < n; i++) { + await new Promise((resolve) => store.run(i, resolve)); + } +} + +function main({ n }) { + const store = new AsyncLocalStorage(); + bench.start(); + run(store, n).then(() => { + bench.end(n); + }); +} diff --git a/common.gypi b/common.gypi index 8db2c0dec6ecfe..0f8999f4079994 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.20', + 'v8_embedder_string': '-node.11', ##### V8 defaults for Node.js ##### diff --git a/deps/corepack/LICENSE.md b/deps/corepack/LICENSE.md new file mode 100644 index 00000000000000..965ccaa1ae72fa --- /dev/null +++ b/deps/corepack/LICENSE.md @@ -0,0 +1,7 @@ +**Copyright © Corepack contributors** + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/corepack/README.md b/deps/corepack/README.md new file mode 100644 index 00000000000000..d557a1b4fc3826 --- /dev/null +++ b/deps/corepack/README.md @@ -0,0 +1,147 @@ +# corepack + +Corepack is a zero-runtime-dependency Node script that acts as a bridge between Node projects and the package managers they are intended to be used with during development. In practical terms, **Corepack will let you use Yarn and pnpm without having to install them** - just like what currently happens with npm, which is shipped by Node by default. + +**Important:** At the moment, Corepack only covers Yarn and pnpm. Given that we have little control on the npm project, we prefer to focus on the Yarn and pnpm use cases. As a result, Corepack doesn't have any effect at all on the way you use npm. + +## How to Install + +### Default Installs + +Corepack isn't intended to be installed manually. While it's certainly possible, we're working with the Node TSC to provide Corepack by default starting from Node 15, thus ensuring that all package managers can be used with little to no friction. + +### Manual Installs + +
+Click here to see how to install Corepack using npm + +First uninstall your global Yarn and pnpm binaries (just leave npm). In general, you'd do this by running the following command: + +```shell +npm uninstall -g yarn pnpm + +# That should be enough, but if you installed Yarn without going through npm it might +# be more tedious - for example, you might need to run `brew uninstall yarn` as well. +``` + +Then install Corepack: + +```shell +npm install -g corepack +``` + +We do acknowledge the irony and overhead of using npm to install Corepack, which is at least part of why the preferred option is to use the Corepack version that will be distributed along with Node itself. + +
+ +### Prebuilt Binaries + +
+Click here to see how to download prebuilt Corepack Node distributions + +We have a few prebuilt Node binaries (based on the [following branch](https://github.com/arcanis/node/tree/mael/pmm)) that you can just download, unpack somewhere, and add to your `PATH` environment variable. + +1. Go to [this page](https://github.com/arcanis/pmm/actions?query=workflow%3ABuild) +2. Open the latest build (the one at the top) +3. Download the right artifact (Linux or Darwin) +4. Unzip the artifact, then untar it +5. Add the `node-v15.0.0-nightlyYYYY-MM-DDXXXX-linux-x64/bin` directory to your `$PATH` + +
+ +## Usage + +Just use your package managers as you usually would. Run `yarn install` in Yarn projects, `pnpm install` in pnpm projects, and `npm` in npm projects. Corepack will catch these calls, and depending on the situation: + +- **If the local project is configured for the package manager you're using**, Corepack will silently download and cache the latest compatible version. + +- **If the local project is configured for a different package manager**, Corepack will request you to run the command again using the right package manager - thus avoiding corruptions of your install artifacts. + +- **If the local project isn't configured for any package manager**, Corepack will assume that you know what you're doing, and will use whatever package manager version has been pinned as "known good release". Check the relevant section for more details. + +## Known Good Releases + +When running Yarn or pnpm within projects that don't list a supported package manager, Corepack will default to a set of Known Good Releases. In a way, you can compare this to Node, where each version ships with a specific version of npm. + +The Known Good Releases can be updated system-wide using the `--activate` flag from the `corepack prepare` and `corepack hydrate` commands. + +## Offline Workflow + +The utility commands detailed in the next section. + +- Either you can use the network while building your container image, in which case you'll simply run `corepack prepare` to make sure that your image includes the Last Known Good release for the specified package manager. + + - If you want to have *all* Last Known Good releases for all package managers, just use the `--all` flag which will do just that. + +- Or you're publishing your project to a system where the network is unavailable, in which case you'll preemptively generate a package manager archive from your local computer (using `corepack prepare -o`) before storing it somewhere your container will be able to access (for example within your repository). After that it'll just be a matter of running `corepack hydrate ` to setup the cache. + +## Utility Commands + +### `corepack [@] [... args]` + +This meta-command runs the specified package manager in the local folder. You can use it to force an install to run with a given version, which can be useful when looking for regressions. + +Note that those commands still check whether the local project is configured for the given package manager (ie you won't be able to run `corepack yarn install` on a project where the `packageManager` field references `pnpm`). + +### `corepack enable [... name]` + +| Option | Description | +| --- | --- | +| `--install-directory` | Add the shims to the specified location | + +This command will detect where Node is installed and will create shims next to it for each of the specified package managers (or all of them if the command is called without parameters). Note that the npm shims will not be installed unless explicitly requested, as npm is currently distributed with Node through other means. + +### `corepack disable [... name]` + +| Option | Description | +| --- | --- | +| `--install-directory` | Remove the shims to the specified location | + +This command will detect where Node is installed and will remove the shims from there. + +### `corepack prepare [... name@version]` + +| Option | Description | +| --- | --- | +| `--all` | Prepare the "Last Known Good" version of all supported package managers | +| `-o,--output` | Also generate an archive containing the package managers | +| `--activate` | Also update the "Last Known Good" release | + +This command will download the given package managers (or the one configured for the local project if no argument is passed in parameter) and store it within the Corepack cache. If the `-o,--output` flag is set (optionally with a path as parameter), an archive will also be generated that can be used by the `corepack hydrate` command. + +### `corepack hydrate ` + +| Option | Description | +| --- | --- | +| `--activate` | Also update the "Last Known Good" release | + +This command will retrieve the given package manager from the specified archive and will install it within the Corepack cache, ready to be used without further network interaction. + +## Environment Variables + +- `COREPACK_ENABLED` has no functional impact on Corepack itself; it's automatically being set in your environment by Corepack when it shells out to the underlying package managers, so that they can feature-detect its presence (useful for commands like `yarn init`). + +## Contributing + +If you want to build corepack yourself, you can build the project like this: + +1. Clone this repository +2. Run `yarn build` (no need for `yarn install`) +3. The `dist/` directory now contains the corepack build and the shims +4. Call `node ./dist/corepack --help` and behold + +You can also run the tests with `yarn jest` (still no install needed). + +## Design + +Various tidbits about Corepack's design are explained in more details in [DESIGN.md](/DESIGN.md). + +## License (MIT) + +> **Copyright © Corepack contributors** +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/deps/corepack/dist/corepack.js b/deps/corepack/dist/corepack.js new file mode 100755 index 00000000000000..ca368a487c4b20 --- /dev/null +++ b/deps/corepack/dist/corepack.js @@ -0,0 +1,14865 @@ +#!/usr/bin/env node +/* eslint-disable */ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Cli.js": +/*!*********************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Cli.js ***! + \*********************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var constants = __webpack_require__(/*! ../constants.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/constants.js"); +var Command = __webpack_require__(/*! ./Command.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js"); +var core = __webpack_require__(/*! ../core.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/core.js"); +var format = __webpack_require__(/*! ../format.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/format.js"); +var HelpCommand = __webpack_require__(/*! ./HelpCommand.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/HelpCommand.js"); + +const errorCommandSymbol = Symbol(`clipanion/errorCommand`); +function getDefaultColorSettings() { + if (process.env.FORCE_COLOR === `0`) + return false; + if (process.env.FORCE_COLOR === `1`) + return true; + if (typeof process.stdout !== `undefined` && process.stdout.isTTY) + return true; + return false; +} +/** + * @template Context The context shared by all commands. Contexts are a set of values, defined when calling the `run`/`runExit` functions from the CLI instance, that will be made available to the commands via `this.context`. + */ +class Cli { + constructor({ binaryLabel, binaryName: binaryNameOpt = `...`, binaryVersion, enableColors = getDefaultColorSettings() } = {}) { + this.registrations = new Map(); + this.builder = new core.CliBuilder({ binaryName: binaryNameOpt }); + this.binaryLabel = binaryLabel; + this.binaryName = binaryNameOpt; + this.binaryVersion = binaryVersion; + this.enableColors = enableColors; + } + /** + * Creates a new Cli and registers all commands passed as parameters. + * + * @param commandClasses The Commands to register + * @returns The created `Cli` instance + */ + static from(commandClasses, options = {}) { + const cli = new Cli(options); + for (const commandClass of commandClasses) + cli.register(commandClass); + return cli; + } + /** + * Registers a command inside the CLI. + */ + register(commandClass) { + var _a; + const specs = new Map(); + const command = new commandClass(); + for (const key in command) { + const value = command[key]; + if (typeof value === `object` && value !== null && value[Command.Command.isOption]) { + specs.set(key, value); + } + } + const builder = this.builder.command(); + const index = builder.cliIndex; + const paths = (_a = commandClass.paths) !== null && _a !== void 0 ? _a : command.paths; + if (typeof paths !== `undefined`) + for (const path of paths) + builder.addPath(path); + this.registrations.set(commandClass, { specs, builder, index }); + for (const [key, { definition }] of specs.entries()) + definition(builder, key); + builder.setContext({ + commandClass, + }); + } + process(input) { + const { contexts, process } = this.builder.compile(); + const state = process(input); + switch (state.selectedIndex) { + case constants.HELP_COMMAND_INDEX: + { + return HelpCommand.HelpCommand.from(state, contexts); + } + default: + { + const { commandClass } = contexts[state.selectedIndex]; + const record = this.registrations.get(commandClass); + if (typeof record === `undefined`) + throw new Error(`Assertion failed: Expected the command class to have been registered.`); + const command = new commandClass(); + command.path = state.path; + try { + for (const [key, { transformer }] of record.specs.entries()) + command[key] = transformer(record.builder, key, state); + return command; + } + catch (error) { + error[errorCommandSymbol] = command; + throw error; + } + } + break; + } + } + async run(input, context) { + let command; + if (!Array.isArray(input)) { + command = input; + } + else { + try { + command = this.process(input); + } + catch (error) { + context.stdout.write(this.error(error)); + return 1; + } + } + if (command.help) { + context.stdout.write(this.usage(command, { detailed: true })); + return 0; + } + command.context = context; + command.cli = { + binaryLabel: this.binaryLabel, + binaryName: this.binaryName, + binaryVersion: this.binaryVersion, + enableColors: this.enableColors, + definitions: () => this.definitions(), + error: (error, opts) => this.error(error, opts), + process: input => this.process(input), + run: (input, subContext) => this.run(input, { ...context, ...subContext }), + usage: (command, opts) => this.usage(command, opts), + }; + let exitCode; + try { + exitCode = await command.validateAndExecute().catch(error => command.catch(error).then(() => 0)); + } + catch (error) { + context.stdout.write(this.error(error, { command })); + return 1; + } + return exitCode; + } + /** + * Runs a command and exits the current `process` with the exit code returned by the command. + * + * @param input An array containing the name of the command and its arguments. + * + * @example + * cli.runExit(process.argv.slice(2), Cli.defaultContext) + */ + async runExit(input, context) { + process.exitCode = await this.run(input, context); + } + suggest(input, partial) { + const { suggest } = this.builder.compile(); + return suggest(input, partial); + } + definitions({ colored = false } = {}) { + const data = []; + for (const [commandClass, { index }] of this.registrations) { + if (typeof commandClass.usage === `undefined`) + continue; + const { usage: path } = this.getUsageByIndex(index, { detailed: false }); + const { usage, options } = this.getUsageByIndex(index, { detailed: true, inlineOptions: false }); + const category = typeof commandClass.usage.category !== `undefined` + ? format.formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false }) + : undefined; + const description = typeof commandClass.usage.description !== `undefined` + ? format.formatMarkdownish(commandClass.usage.description, { format: this.format(colored), paragraphs: false }) + : undefined; + const details = typeof commandClass.usage.details !== `undefined` + ? format.formatMarkdownish(commandClass.usage.details, { format: this.format(colored), paragraphs: true }) + : undefined; + const examples = typeof commandClass.usage.examples !== `undefined` + ? commandClass.usage.examples.map(([label, cli]) => [format.formatMarkdownish(label, { format: this.format(colored), paragraphs: false }), cli.replace(/\$0/g, this.binaryName)]) + : undefined; + data.push({ path, usage, category, description, details, examples, options }); + } + return data; + } + usage(command = null, { colored, detailed = false, prefix = `$ ` } = {}) { + var _a; + // In case the default command is the only one, we can just show the command help rather than the general one + if (command === null) { + for (const commandClass of this.registrations.keys()) { + const paths = commandClass.paths; + const isDocumented = typeof commandClass.usage !== `undefined`; + const isExclusivelyDefault = !paths || paths.length === 0 || (paths.length === 1 && paths[0].length === 0); + const isDefault = isExclusivelyDefault || ((_a = paths === null || paths === void 0 ? void 0 : paths.some(path => path.length === 0)) !== null && _a !== void 0 ? _a : false); + if (isDefault) { + if (command) { + command = null; + break; + } + else { + command = commandClass; + } + } + else { + if (isDocumented) { + command = null; + continue; + } + } + } + if (command) { + detailed = true; + } + } + // @ts-ignore + const commandClass = command !== null && command instanceof Command.Command + ? command.constructor + : command; + let result = ``; + if (!commandClass) { + const commandsByCategories = new Map(); + for (const [commandClass, { index }] of this.registrations.entries()) { + if (typeof commandClass.usage === `undefined`) + continue; + const category = typeof commandClass.usage.category !== `undefined` + ? format.formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false }) + : null; + let categoryCommands = commandsByCategories.get(category); + if (typeof categoryCommands === `undefined`) + commandsByCategories.set(category, categoryCommands = []); + const { usage } = this.getUsageByIndex(index); + categoryCommands.push({ commandClass, usage }); + } + const categoryNames = Array.from(commandsByCategories.keys()).sort((a, b) => { + if (a === null) + return -1; + if (b === null) + return +1; + return a.localeCompare(b, `en`, { usage: `sort`, caseFirst: `upper` }); + }); + const hasLabel = typeof this.binaryLabel !== `undefined`; + const hasVersion = typeof this.binaryVersion !== `undefined`; + if (hasLabel || hasVersion) { + if (hasLabel && hasVersion) + result += `${this.format(colored).header(`${this.binaryLabel} - ${this.binaryVersion}`)}\n\n`; + else if (hasLabel) + result += `${this.format(colored).header(`${this.binaryLabel}`)}\n`; + else + result += `${this.format(colored).header(`${this.binaryVersion}`)}\n`; + result += ` ${this.format(colored).bold(prefix)}${this.binaryName} \n`; + } + else { + result += `${this.format(colored).bold(prefix)}${this.binaryName} \n`; + } + for (const categoryName of categoryNames) { + const commands = commandsByCategories.get(categoryName).slice().sort((a, b) => { + return a.usage.localeCompare(b.usage, `en`, { usage: `sort`, caseFirst: `upper` }); + }); + const header = categoryName !== null + ? categoryName.trim() + : `General commands`; + result += `\n`; + result += `${this.format(colored).header(`${header}`)}\n`; + for (const { commandClass, usage } of commands) { + const doc = commandClass.usage.description || `undocumented`; + result += `\n`; + result += ` ${this.format(colored).bold(usage)}\n`; + result += ` ${format.formatMarkdownish(doc, { format: this.format(colored), paragraphs: false })}`; + } + } + result += `\n`; + result += format.formatMarkdownish(`You can also print more details about any of these commands by calling them with the \`-h,--help\` flag right after the command name.`, { format: this.format(colored), paragraphs: true }); + } + else { + if (!detailed) { + const { usage } = this.getUsageByRegistration(commandClass); + result += `${this.format(colored).bold(prefix)}${usage}\n`; + } + else { + const { description = ``, details = ``, examples = [], } = commandClass.usage || {}; + if (description !== ``) { + result += format.formatMarkdownish(description, { format: this.format(colored), paragraphs: false }).replace(/^./, $0 => $0.toUpperCase()); + result += `\n`; + } + if (details !== `` || examples.length > 0) { + result += `${this.format(colored).header(`Usage`)}\n`; + result += `\n`; + } + const { usage, options } = this.getUsageByRegistration(commandClass, { inlineOptions: false }); + result += `${this.format(colored).bold(prefix)}${usage}\n`; + if (options.length > 0) { + result += `\n`; + result += `${format.richFormat.header(`Options`)}\n`; + const maxDefinitionLength = options.reduce((length, option) => { + return Math.max(length, option.definition.length); + }, 0); + result += `\n`; + for (const { definition, description } of options) { + result += ` ${this.format(colored).bold(definition.padEnd(maxDefinitionLength))} ${format.formatMarkdownish(description, { format: this.format(colored), paragraphs: false })}`; + } + } + if (details !== ``) { + result += `\n`; + result += `${this.format(colored).header(`Details`)}\n`; + result += `\n`; + result += format.formatMarkdownish(details, { format: this.format(colored), paragraphs: true }); + } + if (examples.length > 0) { + result += `\n`; + result += `${this.format(colored).header(`Examples`)}\n`; + for (const [description, example] of examples) { + result += `\n`; + result += format.formatMarkdownish(description, { format: this.format(colored), paragraphs: false }); + result += `${example + .replace(/^/m, ` ${this.format(colored).bold(prefix)}`) + .replace(/\$0/g, this.binaryName)}\n`; + } + } + } + } + return result; + } + error(error, _a) { + var _b; + var { colored, command = (_b = error[errorCommandSymbol]) !== null && _b !== void 0 ? _b : null } = _a === void 0 ? {} : _a; + if (!(error instanceof Error)) + error = new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(error)})`); + let result = ``; + let name = error.name.replace(/([a-z])([A-Z])/g, `$1 $2`); + if (name === `Error`) + name = `Internal Error`; + result += `${this.format(colored).error(name)}: ${error.message}\n`; + const meta = error.clipanion; + if (typeof meta !== `undefined`) { + if (meta.type === `usage`) { + result += `\n`; + result += this.usage(command); + } + } + else { + if (error.stack) { + result += `${error.stack.replace(/^.*\n/, ``)}\n`; + } + } + return result; + } + getUsageByRegistration(klass, opts) { + const record = this.registrations.get(klass); + if (typeof record === `undefined`) + throw new Error(`Assertion failed: Unregistered command`); + return this.getUsageByIndex(record.index, opts); + } + getUsageByIndex(n, opts) { + return this.builder.getBuilderByIndex(n).usage(opts); + } + format(colored = this.enableColors) { + return colored ? format.richFormat : format.textFormat; + } +} +/** + * The default context of the CLI. + * + * Contains the stdio of the current `process`. + */ +Cli.defaultContext = { + stdin: process.stdin, + stdout: process.stdout, + stderr: process.stderr, +}; + +exports.Cli = Cli; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js": +/*!*************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js ***! + \*************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./options/utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { + return e[k]; + } + }); + } + }); + } + n['default'] = e; + return Object.freeze(n); +} + +class Command { + constructor() { + /** + * Predefined that will be set to true if `-h,--help` has been used, in + * which case `Command#execute` won't be called. + */ + this.help = false; + } + /** + * Defines the usage information for the given command. + */ + static Usage(usage) { + return usage; + } + /** + * Standard error handler which will simply rethrow the error. Can be used + * to add custom logic to handle errors from the command or simply return + * the parent class error handling. + */ + async catch(error) { + throw error; + } + async validateAndExecute() { + const commandClass = this.constructor; + const cascade = commandClass.schema; + if (typeof cascade !== `undefined`) { + const { isDict, isUnknown, applyCascade } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(__webpack_require__(/*! typanion */ "./.yarn/cache/typanion-npm-3.3.1-ee9997c7cf-212d2beb55.zip/node_modules/typanion/lib/index.js")); }); + const schema = applyCascade(isDict(isUnknown()), cascade); + const errors = []; + const coercions = []; + const check = schema(this, { errors, coercions }); + if (!check) + throw utils.formatError(`Invalid option schema`, errors); + for (const [, op] of coercions) { + op(); + } + } + const exitCode = await this.execute(); + if (typeof exitCode !== `undefined`) { + return exitCode; + } + else { + return 0; + } + } +} +/** + * Used to detect option definitions. + */ +Command.isOption = utils.isOptionSymbol; +/** + * Just an helper to use along with the `paths` fields, to make it + * clearer that a command is the default one. + * + * @example + * class MyCommand extends Command { + * static paths = [Command.Default]; + * } + */ +Command.Default = []; + +exports.Command = Command; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/HelpCommand.js": +/*!*****************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/HelpCommand.js ***! + \*****************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var Command = __webpack_require__(/*! ./Command.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js"); + +class HelpCommand extends Command.Command { + constructor(contexts) { + super(); + this.contexts = contexts; + this.commands = []; + } + static from(state, contexts) { + const command = new HelpCommand(contexts); + command.path = state.path; + for (const opt of state.options) { + switch (opt.name) { + case `-c`: + { + command.commands.push(Number(opt.value)); + } + break; + case `-i`: + { + command.index = Number(opt.value); + } + break; + } + } + return command; + } + async execute() { + let commands = this.commands; + if (typeof this.index !== `undefined` && this.index >= 0 && this.index < commands.length) + commands = [commands[this.index]]; + if (commands.length === 0) { + this.context.stdout.write(this.cli.usage()); + } + else if (commands.length === 1) { + this.context.stdout.write(this.cli.usage(this.contexts[commands[0]].commandClass, { detailed: true })); + } + else if (commands.length > 1) { + this.context.stdout.write(`Multiple commands match your selection:\n`); + this.context.stdout.write(`\n`); + let index = 0; + for (const command of this.commands) + this.context.stdout.write(this.cli.usage(this.contexts[command].commandClass, { prefix: `${index++}. `.padStart(5) })); + this.context.stdout.write(`\n`); + this.context.stdout.write(`Run again with -h= to see the longer details of any of those commands.\n`); + } + } +} + +exports.HelpCommand = HelpCommand; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/definitions.js": +/*!**************************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/definitions.js ***! + \**************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var Command = __webpack_require__(/*! ../Command.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js"); + +/** + * A command that prints the clipanion definitions. + */ +class DefinitionsCommand extends Command.Command { + async execute() { + this.context.stdout.write(`${JSON.stringify(this.cli.definitions(), null, 2)}\n`); + } +} +DefinitionsCommand.paths = [[`--clipanion=definitions`]]; + +exports.DefinitionsCommand = DefinitionsCommand; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/help.js": +/*!*******************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/help.js ***! + \*******************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var Command = __webpack_require__(/*! ../Command.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js"); + +/** + * A command that prints the usage of all commands. + * + * Paths: `-h`, `--help` + */ +class HelpCommand extends Command.Command { + async execute() { + this.context.stdout.write(this.cli.usage()); + } +} +HelpCommand.paths = [[`-h`], [`--help`]]; + +exports.HelpCommand = HelpCommand; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/index.js": +/*!********************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/index.js ***! + \********************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var definitions = __webpack_require__(/*! ./definitions.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/definitions.js"); +var help = __webpack_require__(/*! ./help.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/help.js"); +var version = __webpack_require__(/*! ./version.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/version.js"); + + + +exports.DefinitionsCommand = definitions.DefinitionsCommand; +exports.HelpCommand = help.HelpCommand; +exports.VersionCommand = version.VersionCommand; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/version.js": +/*!**********************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/version.js ***! + \**********************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var Command = __webpack_require__(/*! ../Command.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js"); + +/** + * A command that prints the version of the binary (`cli.binaryVersion`). + * + * Paths: `-v`, `--version` + */ +class VersionCommand extends Command.Command { + async execute() { + var _a; + this.context.stdout.write(`${(_a = this.cli.binaryVersion) !== null && _a !== void 0 ? _a : ``}\n`); + } +} +VersionCommand.paths = [[`-v`], [`--version`]]; + +exports.VersionCommand = VersionCommand; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js": +/*!***********************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js ***! + \***********************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var errors = __webpack_require__(/*! ../errors.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/errors.js"); +var Command = __webpack_require__(/*! ./Command.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Command.js"); +var Cli = __webpack_require__(/*! ./Cli.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/Cli.js"); +var index = __webpack_require__(/*! ./builtins/index.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/builtins/index.js"); +var index$1 = __webpack_require__(/*! ./options/index.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/index.js"); + + + +exports.UsageError = errors.UsageError; +exports.Command = Command.Command; +exports.Cli = Cli.Cli; +exports.Builtins = index; +exports.Option = index$1; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Array.js": +/*!*******************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Array.js ***! + \*******************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); + +function Array(descriptor, initialValueBase, optsBase) { + const [initialValue, opts] = utils.rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {}); + const { arity = 1 } = opts; + const optNames = descriptor.split(`,`); + const nameSet = new Set(optNames); + return utils.makeCommandOption({ + definition(builder) { + builder.addOption({ + names: optNames, + arity, + hidden: opts === null || opts === void 0 ? void 0 : opts.hidden, + description: opts === null || opts === void 0 ? void 0 : opts.description, + required: opts.required, + }); + }, + transformer(builder, key, state) { + let currentValue = typeof initialValue !== `undefined` + ? [...initialValue] + : undefined; + for (const { name, value } of state.options) { + if (!nameSet.has(name)) + continue; + currentValue = currentValue !== null && currentValue !== void 0 ? currentValue : []; + currentValue.push(value); + } + return currentValue; + }, + }); +} + +exports.Array = Array; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Boolean.js": +/*!*********************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Boolean.js ***! + \*********************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); + +function Boolean(descriptor, initialValueBase, optsBase) { + const [initialValue, opts] = utils.rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {}); + const optNames = descriptor.split(`,`); + const nameSet = new Set(optNames); + return utils.makeCommandOption({ + definition(builder) { + builder.addOption({ + names: optNames, + allowBinding: false, + arity: 0, + hidden: opts.hidden, + description: opts.description, + required: opts.required, + }); + }, + transformer(builer, key, state) { + let currentValue = initialValue; + for (const { name, value } of state.options) { + if (!nameSet.has(name)) + continue; + currentValue = value; + } + return currentValue; + }, + }); +} + +exports.Boolean = Boolean; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Counter.js": +/*!*********************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Counter.js ***! + \*********************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); + +function Counter(descriptor, initialValueBase, optsBase) { + const [initialValue, opts] = utils.rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {}); + const optNames = descriptor.split(`,`); + const nameSet = new Set(optNames); + return utils.makeCommandOption({ + definition(builder) { + builder.addOption({ + names: optNames, + allowBinding: false, + arity: 0, + hidden: opts.hidden, + description: opts.description, + required: opts.required, + }); + }, + transformer(builder, key, state) { + let currentValue = initialValue; + for (const { name, value } of state.options) { + if (!nameSet.has(name)) + continue; + currentValue !== null && currentValue !== void 0 ? currentValue : (currentValue = 0); + // Negated options reset the counter + if (!value) { + currentValue = 0; + } + else { + currentValue += 1; + } + } + return currentValue; + }, + }); +} + +exports.Counter = Counter; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Proxy.js": +/*!*******************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Proxy.js ***! + \*******************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); + +/** + * Used to annotate that the command wants to retrieve all trailing + * arguments that cannot be tied to a declared option. + * + * Be careful: this function is order-dependent! Make sure to define it + * after any positional argument you want to declare. + * + * This function is mutually exclusive with Option.Rest. + * + * @example + * yarn run foo hello --foo=bar world + * ► proxy = ["hello", "--foo=bar", "world"] + */ +function Proxy(opts = {}) { + return utils.makeCommandOption({ + definition(builder, key) { + var _a; + builder.addProxy({ + name: (_a = opts.name) !== null && _a !== void 0 ? _a : key, + required: opts.required, + }); + }, + transformer(builder, key, state) { + return state.positionals.map(({ value }) => value); + }, + }); +} + +exports.Proxy = Proxy; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Rest.js": +/*!******************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Rest.js ***! + \******************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); +var core = __webpack_require__(/*! ../../core.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/core.js"); + +/** + * Used to annotate that the command supports any number of positional + * arguments. + * + * Be careful: this function is order-dependent! Make sure to define it + * after any positional argument you want to declare. + * + * This function is mutually exclusive with Option.Proxy. + * + * @example + * yarn add hello world + * ► rest = ["hello", "world"] + */ +function Rest(opts = {}) { + return utils.makeCommandOption({ + definition(builder, key) { + var _a; + builder.addRest({ + name: (_a = opts.name) !== null && _a !== void 0 ? _a : key, + required: opts.required, + }); + }, + transformer(builder, key, state) { + // The builder's arity.extra will always be NoLimits, + // because it is set when we call registerDefinition + const isRestPositional = (index) => { + const positional = state.positionals[index]; + // A NoLimits extra (i.e. an optional rest argument) + if (positional.extra === core.NoLimits) + return true; + // A leading positional (i.e. a required rest argument) + if (positional.extra === false && index < builder.arity.leading.length) + return true; + return false; + }; + let count = 0; + while (count < state.positionals.length && isRestPositional(count)) + count += 1; + return state.positionals.splice(0, count).map(({ value }) => value); + }, + }); +} + +exports.Rest = Rest; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/String.js": +/*!********************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/String.js ***! + \********************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); +var core = __webpack_require__(/*! ../../core.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/core.js"); + +function StringOption(descriptor, initialValueBase, optsBase) { + const [initialValue, opts] = utils.rerouteArguments(initialValueBase, optsBase !== null && optsBase !== void 0 ? optsBase : {}); + const { arity = 1 } = opts; + const optNames = descriptor.split(`,`); + const nameSet = new Set(optNames); + return utils.makeCommandOption({ + definition(builder) { + builder.addOption({ + names: optNames, + arity: opts.tolerateBoolean ? 0 : arity, + hidden: opts.hidden, + description: opts.description, + required: opts.required, + }); + }, + transformer(builder, key, state) { + let usedName; + let currentValue = initialValue; + for (const { name, value } of state.options) { + if (!nameSet.has(name)) + continue; + usedName = name; + currentValue = value; + } + if (typeof currentValue === `string`) { + return utils.applyValidator(usedName !== null && usedName !== void 0 ? usedName : key, currentValue, opts.validator); + } + else { + return currentValue; + } + }, + }); +} +function StringPositional(opts = {}) { + const { required = true } = opts; + return utils.makeCommandOption({ + definition(builder, key) { + var _a; + builder.addPositional({ + name: (_a = opts.name) !== null && _a !== void 0 ? _a : key, + required: opts.required, + }); + }, + transformer(builder, key, state) { + var _a; + for (let i = 0; i < state.positionals.length; ++i) { + // We skip NoLimits extras. We only care about + // required and optional finite positionals. + if (state.positionals[i].extra === core.NoLimits) + continue; + // We skip optional positionals when we only + // care about required positionals. + if (required && state.positionals[i].extra === true) + continue; + // We skip required positionals when we only + // care about optional positionals. + if (!required && state.positionals[i].extra === false) + continue; + // We remove the positional from the list + const [positional] = state.positionals.splice(i, 1); + return utils.applyValidator((_a = opts.name) !== null && _a !== void 0 ? _a : key, positional.value, opts.validator); + } + return undefined; + }, + }); +} +// This function is badly typed, but it doesn't matter because the overloads provide the true public typings +function String(descriptor, ...args) { + if (typeof descriptor === `string`) { + return StringOption(descriptor, ...args); + } + else { + return StringPositional(descriptor); + } +} + +exports.String = String; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/index.js": +/*!*******************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/index.js ***! + \*******************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var utils = __webpack_require__(/*! ./utils.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js"); +var _Array = __webpack_require__(/*! ./Array.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Array.js"); +var _Boolean = __webpack_require__(/*! ./Boolean.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Boolean.js"); +var Counter = __webpack_require__(/*! ./Counter.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Counter.js"); +var _Proxy = __webpack_require__(/*! ./Proxy.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Proxy.js"); +var Rest = __webpack_require__(/*! ./Rest.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/Rest.js"); +var _String = __webpack_require__(/*! ./String.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/String.js"); + + + +exports.applyValidator = utils.applyValidator; +exports.cleanValidationError = utils.cleanValidationError; +exports.formatError = utils.formatError; +exports.isOptionSymbol = utils.isOptionSymbol; +exports.makeCommandOption = utils.makeCommandOption; +exports.rerouteArguments = utils.rerouteArguments; +exports.Array = _Array.Array; +exports.Boolean = _Boolean.Boolean; +exports.Counter = Counter.Counter; +exports.Proxy = _Proxy.Proxy; +exports.Rest = Rest.Rest; +exports.String = _String.String; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js": +/*!*******************************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/options/utils.js ***! + \*******************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var errors = __webpack_require__(/*! ../../errors.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/errors.js"); + +const isOptionSymbol = Symbol(`clipanion/isOption`); +function makeCommandOption(spec) { + // We lie! But it's for the good cause: the cli engine will turn the specs into proper values after instantiation. + return { ...spec, [isOptionSymbol]: true }; +} +function rerouteArguments(a, b) { + if (typeof a === `undefined`) + return [a, b]; + if (typeof a === `object` && a !== null && !Array.isArray(a)) { + return [undefined, a]; + } + else { + return [a, b]; + } +} +function cleanValidationError(message, lowerCase = false) { + let cleaned = message.replace(/^\.: /, ``); + if (lowerCase) + cleaned = cleaned[0].toLowerCase() + cleaned.slice(1); + return cleaned; +} +function formatError(message, errors$1) { + if (errors$1.length === 1) { + return new errors.UsageError(`${message}: ${cleanValidationError(errors$1[0], true)}`); + } + else { + return new errors.UsageError(`${message}:\n${errors$1.map(error => `\n- ${cleanValidationError(error)}`).join(``)}`); + } +} +function applyValidator(name, value, validator) { + if (typeof validator === `undefined`) + return value; + const errors = []; + const coercions = []; + const coercion = (v) => { + const orig = value; + value = v; + return coercion.bind(null, orig); + }; + const check = validator(value, { errors, coercions, coercion }); + if (!check) + throw formatError(`Invalid value for ${name}`, errors); + for (const [, op] of coercions) + op(); + return value; +} + +exports.applyValidator = applyValidator; +exports.cleanValidationError = cleanValidationError; +exports.formatError = formatError; +exports.isOptionSymbol = isOptionSymbol; +exports.makeCommandOption = makeCommandOption; +exports.rerouteArguments = rerouteArguments; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/constants.js": +/*!******************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/constants.js ***! + \******************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const NODE_INITIAL = 0; +const NODE_SUCCESS = 1; +const NODE_ERRORED = 2; +const START_OF_INPUT = `\u0001`; +const END_OF_INPUT = `\u0000`; +const HELP_COMMAND_INDEX = -1; +const HELP_REGEX = /^(-h|--help)(?:=([0-9]+))?$/; +const OPTION_REGEX = /^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/; +const BATCH_REGEX = /^-[a-zA-Z]{2,}$/; +const BINDING_REGEX = /^([^=]+)=([\s\S]*)$/; +const DEBUG = process.env.DEBUG_CLI === `1`; + +exports.BATCH_REGEX = BATCH_REGEX; +exports.BINDING_REGEX = BINDING_REGEX; +exports.DEBUG = DEBUG; +exports.END_OF_INPUT = END_OF_INPUT; +exports.HELP_COMMAND_INDEX = HELP_COMMAND_INDEX; +exports.HELP_REGEX = HELP_REGEX; +exports.NODE_ERRORED = NODE_ERRORED; +exports.NODE_INITIAL = NODE_INITIAL; +exports.NODE_SUCCESS = NODE_SUCCESS; +exports.OPTION_REGEX = OPTION_REGEX; +exports.START_OF_INPUT = START_OF_INPUT; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/core.js": +/*!*************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/core.js ***! + \*************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var constants = __webpack_require__(/*! ./constants.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/constants.js"); +var errors = __webpack_require__(/*! ./errors.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/errors.js"); + +// ------------------------------------------------------------------------ +function debug(str) { + if (constants.DEBUG) { + console.log(str); + } +} +const basicHelpState = { + candidateUsage: null, + requiredOptions: [], + errorMessage: null, + ignoreOptions: false, + path: [], + positionals: [], + options: [], + remainder: null, + selectedIndex: constants.HELP_COMMAND_INDEX, +}; +function makeStateMachine() { + return { + nodes: [makeNode(), makeNode(), makeNode()], + }; +} +function makeAnyOfMachine(inputs) { + const output = makeStateMachine(); + const heads = []; + let offset = output.nodes.length; + for (const input of inputs) { + heads.push(offset); + for (let t = 0; t < input.nodes.length; ++t) + if (!isTerminalNode(t)) + output.nodes.push(cloneNode(input.nodes[t], offset)); + offset += input.nodes.length - 2; + } + for (const head of heads) + registerShortcut(output, constants.NODE_INITIAL, head); + return output; +} +function injectNode(machine, node) { + machine.nodes.push(node); + return machine.nodes.length - 1; +} +function simplifyMachine(input) { + const visited = new Set(); + const process = (node) => { + if (visited.has(node)) + return; + visited.add(node); + const nodeDef = input.nodes[node]; + for (const transitions of Object.values(nodeDef.statics)) + for (const { to } of transitions) + process(to); + for (const [, { to }] of nodeDef.dynamics) + process(to); + for (const { to } of nodeDef.shortcuts) + process(to); + const shortcuts = new Set(nodeDef.shortcuts.map(({ to }) => to)); + while (nodeDef.shortcuts.length > 0) { + const { to } = nodeDef.shortcuts.shift(); + const toDef = input.nodes[to]; + for (const [segment, transitions] of Object.entries(toDef.statics)) { + const store = !Object.prototype.hasOwnProperty.call(nodeDef.statics, segment) + ? nodeDef.statics[segment] = [] + : nodeDef.statics[segment]; + for (const transition of transitions) { + if (!store.some(({ to }) => transition.to === to)) { + store.push(transition); + } + } + } + for (const [test, transition] of toDef.dynamics) + if (!nodeDef.dynamics.some(([otherTest, { to }]) => test === otherTest && transition.to === to)) + nodeDef.dynamics.push([test, transition]); + for (const transition of toDef.shortcuts) { + if (!shortcuts.has(transition.to)) { + nodeDef.shortcuts.push(transition); + shortcuts.add(transition.to); + } + } + } + }; + process(constants.NODE_INITIAL); +} +function debugMachine(machine, { prefix = `` } = {}) { + // Don't iterate unless it's needed + if (constants.DEBUG) { + debug(`${prefix}Nodes are:`); + for (let t = 0; t < machine.nodes.length; ++t) { + debug(`${prefix} ${t}: ${JSON.stringify(machine.nodes[t])}`); + } + } +} +function runMachineInternal(machine, input, partial = false) { + debug(`Running a vm on ${JSON.stringify(input)}`); + let branches = [{ node: constants.NODE_INITIAL, state: { + candidateUsage: null, + requiredOptions: [], + errorMessage: null, + ignoreOptions: false, + options: [], + path: [], + positionals: [], + remainder: null, + selectedIndex: null, + } }]; + debugMachine(machine, { prefix: ` ` }); + const tokens = [constants.START_OF_INPUT, ...input]; + for (let t = 0; t < tokens.length; ++t) { + const segment = tokens[t]; + debug(` Processing ${JSON.stringify(segment)}`); + const nextBranches = []; + for (const { node, state } of branches) { + debug(` Current node is ${node}`); + const nodeDef = machine.nodes[node]; + if (node === constants.NODE_ERRORED) { + nextBranches.push({ node, state }); + continue; + } + console.assert(nodeDef.shortcuts.length === 0, `Shortcuts should have been eliminated by now`); + const hasExactMatch = Object.prototype.hasOwnProperty.call(nodeDef.statics, segment); + if (!partial || t < tokens.length - 1 || hasExactMatch) { + if (hasExactMatch) { + const transitions = nodeDef.statics[segment]; + for (const { to, reducer } of transitions) { + nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment) : state }); + debug(` Static transition to ${to} found`); + } + } + else { + debug(` No static transition found`); + } + } + else { + let hasMatches = false; + for (const candidate of Object.keys(nodeDef.statics)) { + if (!candidate.startsWith(segment)) + continue; + if (segment === candidate) { + for (const { to, reducer } of nodeDef.statics[candidate]) { + nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment) : state }); + debug(` Static transition to ${to} found`); + } + } + else { + for (const { to } of nodeDef.statics[candidate]) { + nextBranches.push({ node: to, state: { ...state, remainder: candidate.slice(segment.length) } }); + debug(` Static transition to ${to} found (partial match)`); + } + } + hasMatches = true; + } + if (!hasMatches) { + debug(` No partial static transition found`); + } + } + if (segment !== constants.END_OF_INPUT) { + for (const [test, { to, reducer }] of nodeDef.dynamics) { + if (execute(tests, test, state, segment)) { + nextBranches.push({ node: to, state: typeof reducer !== `undefined` ? execute(reducers, reducer, state, segment) : state }); + debug(` Dynamic transition to ${to} found (via ${test})`); + } + } + } + } + if (nextBranches.length === 0 && segment === constants.END_OF_INPUT && input.length === 1) { + return [{ + node: constants.NODE_INITIAL, + state: basicHelpState, + }]; + } + if (nextBranches.length === 0) { + throw new errors.UnknownSyntaxError(input, branches.filter(({ node }) => { + return node !== constants.NODE_ERRORED; + }).map(({ state }) => { + return { usage: state.candidateUsage, reason: null }; + })); + } + if (nextBranches.every(({ node }) => node === constants.NODE_ERRORED)) { + throw new errors.UnknownSyntaxError(input, nextBranches.map(({ state }) => { + return { usage: state.candidateUsage, reason: state.errorMessage }; + })); + } + branches = trimSmallerBranches(nextBranches); + } + if (branches.length > 0) { + debug(` Results:`); + for (const branch of branches) { + debug(` - ${branch.node} -> ${JSON.stringify(branch.state)}`); + } + } + else { + debug(` No results`); + } + return branches; +} +function checkIfNodeIsFinished(node, state) { + if (state.selectedIndex !== null) + return true; + if (Object.prototype.hasOwnProperty.call(node.statics, constants.END_OF_INPUT)) + for (const { to } of node.statics[constants.END_OF_INPUT]) + if (to === constants.NODE_SUCCESS) + return true; + return false; +} +function suggestMachine(machine, input, partial) { + // If we're accepting partial matches, then exact matches need to be + // prefixed with an extra space. + const prefix = partial && input.length > 0 ? [``] : []; + const branches = runMachineInternal(machine, input, partial); + const suggestions = []; + const suggestionsJson = new Set(); + const traverseSuggestion = (suggestion, node, skipFirst = true) => { + let nextNodes = [node]; + while (nextNodes.length > 0) { + const currentNodes = nextNodes; + nextNodes = []; + for (const node of currentNodes) { + const nodeDef = machine.nodes[node]; + const keys = Object.keys(nodeDef.statics); + // The fact that `key` is unused is likely a bug, but no one has investigated it yet. + // TODO: Investigate it. + // eslint-disable-next-line @typescript-eslint/no-unused-vars + for (const key of Object.keys(nodeDef.statics)) { + const segment = keys[0]; + for (const { to, reducer } of nodeDef.statics[segment]) { + if (reducer !== `pushPath`) + continue; + if (!skipFirst) + suggestion.push(segment); + nextNodes.push(to); + } + } + } + skipFirst = false; + } + const json = JSON.stringify(suggestion); + if (suggestionsJson.has(json)) + return; + suggestions.push(suggestion); + suggestionsJson.add(json); + }; + for (const { node, state } of branches) { + if (state.remainder !== null) { + traverseSuggestion([state.remainder], node); + continue; + } + const nodeDef = machine.nodes[node]; + const isFinished = checkIfNodeIsFinished(nodeDef, state); + for (const [candidate, transitions] of Object.entries(nodeDef.statics)) + if ((isFinished && candidate !== constants.END_OF_INPUT) || (!candidate.startsWith(`-`) && transitions.some(({ reducer }) => reducer === `pushPath`))) + traverseSuggestion([...prefix, candidate], node); + if (!isFinished) + continue; + for (const [test, { to }] of nodeDef.dynamics) { + if (to === constants.NODE_ERRORED) + continue; + const tokens = suggest(test, state); + if (tokens === null) + continue; + for (const token of tokens) { + traverseSuggestion([...prefix, token], node); + } + } + } + return [...suggestions].sort(); +} +function runMachine(machine, input) { + const branches = runMachineInternal(machine, [...input, constants.END_OF_INPUT]); + return selectBestState(input, branches.map(({ state }) => { + return state; + })); +} +function trimSmallerBranches(branches) { + let maxPathSize = 0; + for (const { state } of branches) + if (state.path.length > maxPathSize) + maxPathSize = state.path.length; + return branches.filter(({ state }) => { + return state.path.length === maxPathSize; + }); +} +function selectBestState(input, states) { + const terminalStates = states.filter(state => { + return state.selectedIndex !== null; + }); + if (terminalStates.length === 0) + throw new Error(); + const requiredOptionsSetStates = terminalStates.filter(state => state.requiredOptions.every(names => names.some(name => state.options.find(opt => opt.name === name)))); + if (requiredOptionsSetStates.length === 0) { + throw new errors.UnknownSyntaxError(input, terminalStates.map(state => ({ + usage: state.candidateUsage, + reason: null, + }))); + } + let maxPathSize = 0; + for (const state of requiredOptionsSetStates) + if (state.path.length > maxPathSize) + maxPathSize = state.path.length; + const bestPathBranches = requiredOptionsSetStates.filter(state => { + return state.path.length === maxPathSize; + }); + const getPositionalCount = (state) => state.positionals.filter(({ extra }) => { + return !extra; + }).length + state.options.length; + const statesWithPositionalCount = bestPathBranches.map(state => { + return { state, positionalCount: getPositionalCount(state) }; + }); + let maxPositionalCount = 0; + for (const { positionalCount } of statesWithPositionalCount) + if (positionalCount > maxPositionalCount) + maxPositionalCount = positionalCount; + const bestPositionalStates = statesWithPositionalCount.filter(({ positionalCount }) => { + return positionalCount === maxPositionalCount; + }).map(({ state }) => { + return state; + }); + const fixedStates = aggregateHelpStates(bestPositionalStates); + if (fixedStates.length > 1) + throw new errors.AmbiguousSyntaxError(input, fixedStates.map(state => state.candidateUsage)); + return fixedStates[0]; +} +function aggregateHelpStates(states) { + const notHelps = []; + const helps = []; + for (const state of states) { + if (state.selectedIndex === constants.HELP_COMMAND_INDEX) { + helps.push(state); + } + else { + notHelps.push(state); + } + } + if (helps.length > 0) { + notHelps.push({ + ...basicHelpState, + path: findCommonPrefix(...helps.map(state => state.path)), + options: helps.reduce((options, state) => options.concat(state.options), []), + }); + } + return notHelps; +} +function findCommonPrefix(firstPath, secondPath, ...rest) { + if (secondPath === undefined) + return Array.from(firstPath); + return findCommonPrefix(firstPath.filter((segment, i) => segment === secondPath[i]), ...rest); +} +function makeNode() { + return { + dynamics: [], + shortcuts: [], + statics: {}, + }; +} +function isTerminalNode(node) { + return node === constants.NODE_SUCCESS || node === constants.NODE_ERRORED; +} +function cloneTransition(input, offset = 0) { + return { + to: !isTerminalNode(input.to) ? input.to > 2 ? input.to + offset - 2 : input.to + offset : input.to, + reducer: input.reducer, + }; +} +function cloneNode(input, offset = 0) { + const output = makeNode(); + for (const [test, transition] of input.dynamics) + output.dynamics.push([test, cloneTransition(transition, offset)]); + for (const transition of input.shortcuts) + output.shortcuts.push(cloneTransition(transition, offset)); + for (const [segment, transitions] of Object.entries(input.statics)) + output.statics[segment] = transitions.map(transition => cloneTransition(transition, offset)); + return output; +} +function registerDynamic(machine, from, test, to, reducer) { + machine.nodes[from].dynamics.push([ + test, + { to, reducer: reducer }, + ]); +} +function registerShortcut(machine, from, to, reducer) { + machine.nodes[from].shortcuts.push({ to, reducer: reducer }); +} +function registerStatic(machine, from, test, to, reducer) { + const store = !Object.prototype.hasOwnProperty.call(machine.nodes[from].statics, test) + ? machine.nodes[from].statics[test] = [] + : machine.nodes[from].statics[test]; + store.push({ to, reducer: reducer }); +} +function execute(store, callback, state, segment) { + // TypeScript's control flow can't properly narrow + // generic conditionals for some mysterious reason + if (Array.isArray(callback)) { + const [name, ...args] = callback; + return store[name](state, segment, ...args); + } + else { + return store[callback](state, segment); + } +} +function suggest(callback, state) { + const fn = Array.isArray(callback) + ? tests[callback[0]] + : tests[callback]; + // @ts-ignore + if (typeof fn.suggest === `undefined`) + return null; + const args = Array.isArray(callback) + ? callback.slice(1) + : []; + // @ts-ignore + return fn.suggest(state, ...args); +} +const tests = { + always: () => { + return true; + }, + isOptionLike: (state, segment) => { + return !state.ignoreOptions && (segment !== `-` && segment.startsWith(`-`)); + }, + isNotOptionLike: (state, segment) => { + return state.ignoreOptions || segment === `-` || !segment.startsWith(`-`); + }, + isOption: (state, segment, name, hidden) => { + return !state.ignoreOptions && segment === name; + }, + isBatchOption: (state, segment, names) => { + return !state.ignoreOptions && constants.BATCH_REGEX.test(segment) && [...segment.slice(1)].every(name => names.includes(`-${name}`)); + }, + isBoundOption: (state, segment, names, options) => { + const optionParsing = segment.match(constants.BINDING_REGEX); + return !state.ignoreOptions && !!optionParsing && constants.OPTION_REGEX.test(optionParsing[1]) && names.includes(optionParsing[1]) + // Disallow bound options with no arguments (i.e. booleans) + && options.filter(opt => opt.names.includes(optionParsing[1])).every(opt => opt.allowBinding); + }, + isNegatedOption: (state, segment, name) => { + return !state.ignoreOptions && segment === `--no-${name.slice(2)}`; + }, + isHelp: (state, segment) => { + return !state.ignoreOptions && constants.HELP_REGEX.test(segment); + }, + isUnsupportedOption: (state, segment, names) => { + return !state.ignoreOptions && segment.startsWith(`-`) && constants.OPTION_REGEX.test(segment) && !names.includes(segment); + }, + isInvalidOption: (state, segment) => { + return !state.ignoreOptions && segment.startsWith(`-`) && !constants.OPTION_REGEX.test(segment); + }, +}; +// @ts-ignore +tests.isOption.suggest = (state, name, hidden = true) => { + return !hidden ? [name] : null; +}; +const reducers = { + setCandidateState: (state, segment, candidateState) => { + return { ...state, ...candidateState }; + }, + setSelectedIndex: (state, segment, index) => { + return { ...state, selectedIndex: index }; + }, + pushBatch: (state, segment) => { + return { ...state, options: state.options.concat([...segment.slice(1)].map(name => ({ name: `-${name}`, value: true }))) }; + }, + pushBound: (state, segment) => { + const [, name, value] = segment.match(constants.BINDING_REGEX); + return { ...state, options: state.options.concat({ name, value }) }; + }, + pushPath: (state, segment) => { + return { ...state, path: state.path.concat(segment) }; + }, + pushPositional: (state, segment) => { + return { ...state, positionals: state.positionals.concat({ value: segment, extra: false }) }; + }, + pushExtra: (state, segment) => { + return { ...state, positionals: state.positionals.concat({ value: segment, extra: true }) }; + }, + pushExtraNoLimits: (state, segment) => { + return { ...state, positionals: state.positionals.concat({ value: segment, extra: NoLimits }) }; + }, + pushTrue: (state, segment, name = segment) => { + return { ...state, options: state.options.concat({ name: segment, value: true }) }; + }, + pushFalse: (state, segment, name = segment) => { + return { ...state, options: state.options.concat({ name, value: false }) }; + }, + pushUndefined: (state, segment) => { + return { ...state, options: state.options.concat({ name: segment, value: undefined }) }; + }, + pushStringValue: (state, segment) => { + var _a; + const copy = { ...state, options: [...state.options] }; + const lastOption = state.options[state.options.length - 1]; + lastOption.value = ((_a = lastOption.value) !== null && _a !== void 0 ? _a : []).concat([segment]); + return copy; + }, + setStringValue: (state, segment) => { + const copy = { ...state, options: [...state.options] }; + const lastOption = state.options[state.options.length - 1]; + lastOption.value = segment; + return copy; + }, + inhibateOptions: (state) => { + return { ...state, ignoreOptions: true }; + }, + useHelp: (state, segment, command) => { + const [, /* name */ , index] = segment.match(constants.HELP_REGEX); + if (typeof index !== `undefined`) { + return { ...state, options: [{ name: `-c`, value: String(command) }, { name: `-i`, value: index }] }; + } + else { + return { ...state, options: [{ name: `-c`, value: String(command) }] }; + } + }, + setError: (state, segment, errorMessage) => { + if (segment === constants.END_OF_INPUT) { + return { ...state, errorMessage: `${errorMessage}.` }; + } + else { + return { ...state, errorMessage: `${errorMessage} ("${segment}").` }; + } + }, + setOptionArityError: (state, segment) => { + const lastOption = state.options[state.options.length - 1]; + return { ...state, errorMessage: `Not enough arguments to option ${lastOption.name}.` }; + }, +}; +// ------------------------------------------------------------------------ +const NoLimits = Symbol(); +class CommandBuilder { + constructor(cliIndex, cliOpts) { + this.allOptionNames = []; + this.arity = { leading: [], trailing: [], extra: [], proxy: false }; + this.options = []; + this.paths = []; + this.cliIndex = cliIndex; + this.cliOpts = cliOpts; + } + addPath(path) { + this.paths.push(path); + } + setArity({ leading = this.arity.leading, trailing = this.arity.trailing, extra = this.arity.extra, proxy = this.arity.proxy }) { + Object.assign(this.arity, { leading, trailing, extra, proxy }); + } + addPositional({ name = `arg`, required = true } = {}) { + if (!required && this.arity.extra === NoLimits) + throw new Error(`Optional parameters cannot be declared when using .rest() or .proxy()`); + if (!required && this.arity.trailing.length > 0) + throw new Error(`Optional parameters cannot be declared after the required trailing positional arguments`); + if (!required && this.arity.extra !== NoLimits) { + this.arity.extra.push(name); + } + else if (this.arity.extra !== NoLimits && this.arity.extra.length === 0) { + this.arity.leading.push(name); + } + else { + this.arity.trailing.push(name); + } + } + addRest({ name = `arg`, required = 0 } = {}) { + if (this.arity.extra === NoLimits) + throw new Error(`Infinite lists cannot be declared multiple times in the same command`); + if (this.arity.trailing.length > 0) + throw new Error(`Infinite lists cannot be declared after the required trailing positional arguments`); + for (let t = 0; t < required; ++t) + this.addPositional({ name }); + this.arity.extra = NoLimits; + } + addProxy({ required = 0 } = {}) { + this.addRest({ required }); + this.arity.proxy = true; + } + addOption({ names, description, arity = 0, hidden = false, required = false, allowBinding = true }) { + if (!allowBinding && arity > 1) + throw new Error(`The arity cannot be higher than 1 when the option only supports the --arg=value syntax`); + if (!Number.isInteger(arity)) + throw new Error(`The arity must be an integer, got ${arity}`); + if (arity < 0) + throw new Error(`The arity must be positive, got ${arity}`); + this.allOptionNames.push(...names); + this.options.push({ names, description, arity, hidden, required, allowBinding }); + } + setContext(context) { + this.context = context; + } + usage({ detailed = true, inlineOptions = true } = {}) { + const segments = [this.cliOpts.binaryName]; + const detailedOptionList = []; + if (this.paths.length > 0) + segments.push(...this.paths[0]); + if (detailed) { + for (const { names, arity, hidden, description, required } of this.options) { + if (hidden) + continue; + const args = []; + for (let t = 0; t < arity; ++t) + args.push(` #${t}`); + const definition = `${names.join(`,`)}${args.join(``)}`; + if (!inlineOptions && description) { + detailedOptionList.push({ definition, description, required }); + } + else { + segments.push(required ? `<${definition}>` : `[${definition}]`); + } + } + segments.push(...this.arity.leading.map(name => `<${name}>`)); + if (this.arity.extra === NoLimits) + segments.push(`...`); + else + segments.push(...this.arity.extra.map(name => `[${name}]`)); + segments.push(...this.arity.trailing.map(name => `<${name}>`)); + } + const usage = segments.join(` `); + return { usage, options: detailedOptionList }; + } + compile() { + if (typeof this.context === `undefined`) + throw new Error(`Assertion failed: No context attached`); + const machine = makeStateMachine(); + let firstNode = constants.NODE_INITIAL; + const candidateUsage = this.usage().usage; + const requiredOptions = this.options + .filter(opt => opt.required) + .map(opt => opt.names); + firstNode = injectNode(machine, makeNode()); + registerStatic(machine, constants.NODE_INITIAL, constants.START_OF_INPUT, firstNode, [`setCandidateState`, { candidateUsage, requiredOptions }]); + const positionalArgument = this.arity.proxy + ? `always` + : `isNotOptionLike`; + const paths = this.paths.length > 0 + ? this.paths + : [[]]; + for (const path of paths) { + let lastPathNode = firstNode; + // We allow options to be specified before the path. Note that we + // only do this when there is a path, otherwise there would be + // some redundancy with the options attached later. + if (path.length > 0) { + const optionPathNode = injectNode(machine, makeNode()); + registerShortcut(machine, lastPathNode, optionPathNode); + this.registerOptions(machine, optionPathNode); + lastPathNode = optionPathNode; + } + for (let t = 0; t < path.length; ++t) { + const nextPathNode = injectNode(machine, makeNode()); + registerStatic(machine, lastPathNode, path[t], nextPathNode, `pushPath`); + lastPathNode = nextPathNode; + } + if (this.arity.leading.length > 0 || !this.arity.proxy) { + const helpNode = injectNode(machine, makeNode()); + registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]); + registerStatic(machine, helpNode, constants.END_OF_INPUT, constants.NODE_SUCCESS, [`setSelectedIndex`, constants.HELP_COMMAND_INDEX]); + this.registerOptions(machine, lastPathNode); + } + if (this.arity.leading.length > 0) + registerStatic(machine, lastPathNode, constants.END_OF_INPUT, constants.NODE_ERRORED, [`setError`, `Not enough positional arguments`]); + let lastLeadingNode = lastPathNode; + for (let t = 0; t < this.arity.leading.length; ++t) { + const nextLeadingNode = injectNode(machine, makeNode()); + if (!this.arity.proxy) + this.registerOptions(machine, nextLeadingNode); + if (this.arity.trailing.length > 0 || t + 1 !== this.arity.leading.length) + registerStatic(machine, nextLeadingNode, constants.END_OF_INPUT, constants.NODE_ERRORED, [`setError`, `Not enough positional arguments`]); + registerDynamic(machine, lastLeadingNode, `isNotOptionLike`, nextLeadingNode, `pushPositional`); + lastLeadingNode = nextLeadingNode; + } + let lastExtraNode = lastLeadingNode; + if (this.arity.extra === NoLimits || this.arity.extra.length > 0) { + const extraShortcutNode = injectNode(machine, makeNode()); + registerShortcut(machine, lastLeadingNode, extraShortcutNode); + if (this.arity.extra === NoLimits) { + const extraNode = injectNode(machine, makeNode()); + if (!this.arity.proxy) + this.registerOptions(machine, extraNode); + registerDynamic(machine, lastLeadingNode, positionalArgument, extraNode, `pushExtraNoLimits`); + registerDynamic(machine, extraNode, positionalArgument, extraNode, `pushExtraNoLimits`); + registerShortcut(machine, extraNode, extraShortcutNode); + } + else { + for (let t = 0; t < this.arity.extra.length; ++t) { + const nextExtraNode = injectNode(machine, makeNode()); + if (!this.arity.proxy) + this.registerOptions(machine, nextExtraNode); + registerDynamic(machine, lastExtraNode, positionalArgument, nextExtraNode, `pushExtra`); + registerShortcut(machine, nextExtraNode, extraShortcutNode); + lastExtraNode = nextExtraNode; + } + } + lastExtraNode = extraShortcutNode; + } + if (this.arity.trailing.length > 0) + registerStatic(machine, lastExtraNode, constants.END_OF_INPUT, constants.NODE_ERRORED, [`setError`, `Not enough positional arguments`]); + let lastTrailingNode = lastExtraNode; + for (let t = 0; t < this.arity.trailing.length; ++t) { + const nextTrailingNode = injectNode(machine, makeNode()); + if (!this.arity.proxy) + this.registerOptions(machine, nextTrailingNode); + if (t + 1 < this.arity.trailing.length) + registerStatic(machine, nextTrailingNode, constants.END_OF_INPUT, constants.NODE_ERRORED, [`setError`, `Not enough positional arguments`]); + registerDynamic(machine, lastTrailingNode, `isNotOptionLike`, nextTrailingNode, `pushPositional`); + lastTrailingNode = nextTrailingNode; + } + registerDynamic(machine, lastTrailingNode, positionalArgument, constants.NODE_ERRORED, [`setError`, `Extraneous positional argument`]); + registerStatic(machine, lastTrailingNode, constants.END_OF_INPUT, constants.NODE_SUCCESS, [`setSelectedIndex`, this.cliIndex]); + } + return { + machine, + context: this.context, + }; + } + registerOptions(machine, node) { + registerDynamic(machine, node, [`isOption`, `--`], node, `inhibateOptions`); + registerDynamic(machine, node, [`isBatchOption`, this.allOptionNames], node, `pushBatch`); + registerDynamic(machine, node, [`isBoundOption`, this.allOptionNames, this.options], node, `pushBound`); + registerDynamic(machine, node, [`isUnsupportedOption`, this.allOptionNames], constants.NODE_ERRORED, [`setError`, `Unsupported option name`]); + registerDynamic(machine, node, [`isInvalidOption`], constants.NODE_ERRORED, [`setError`, `Invalid option name`]); + for (const option of this.options) { + const longestName = option.names.reduce((longestName, name) => { + return name.length > longestName.length ? name : longestName; + }, ``); + if (option.arity === 0) { + for (const name of option.names) { + registerDynamic(machine, node, [`isOption`, name, option.hidden || name !== longestName], node, `pushTrue`); + if (name.startsWith(`--`) && !name.startsWith(`--no-`)) { + registerDynamic(machine, node, [`isNegatedOption`, name], node, [`pushFalse`, name]); + } + } + } + else { + // We inject a new node at the end of the state machine + let lastNode = injectNode(machine, makeNode()); + // We register transitions from the starting node to this new node + for (const name of option.names) + registerDynamic(machine, node, [`isOption`, name, option.hidden || name !== longestName], lastNode, `pushUndefined`); + // For each argument, we inject a new node at the end and we + // register a transition from the current node to this new node + for (let t = 0; t < option.arity; ++t) { + const nextNode = injectNode(machine, makeNode()); + // We can provide better errors when another option or END_OF_INPUT is encountered + registerStatic(machine, lastNode, constants.END_OF_INPUT, constants.NODE_ERRORED, `setOptionArityError`); + registerDynamic(machine, lastNode, `isOptionLike`, constants.NODE_ERRORED, `setOptionArityError`); + // If the option has a single argument, no need to store it in an array + const action = option.arity === 1 + ? `setStringValue` + : `pushStringValue`; + registerDynamic(machine, lastNode, `isNotOptionLike`, nextNode, action); + lastNode = nextNode; + } + // In the end, we register a shortcut from + // the last node back to the starting node + registerShortcut(machine, lastNode, node); + } + } + } +} +class CliBuilder { + constructor({ binaryName = `...` } = {}) { + this.builders = []; + this.opts = { binaryName }; + } + static build(cbs, opts = {}) { + return new CliBuilder(opts).commands(cbs).compile(); + } + getBuilderByIndex(n) { + if (!(n >= 0 && n < this.builders.length)) + throw new Error(`Assertion failed: Out-of-bound command index (${n})`); + return this.builders[n]; + } + commands(cbs) { + for (const cb of cbs) + cb(this.command()); + return this; + } + command() { + const builder = new CommandBuilder(this.builders.length, this.opts); + this.builders.push(builder); + return builder; + } + compile() { + const machines = []; + const contexts = []; + for (const builder of this.builders) { + const { machine, context } = builder.compile(); + machines.push(machine); + contexts.push(context); + } + const machine = makeAnyOfMachine(machines); + simplifyMachine(machine); + return { + machine, + contexts, + process: (input) => { + return runMachine(machine, input); + }, + suggest: (input, partial) => { + return suggestMachine(machine, input, partial); + }, + }; + } +} + +exports.CliBuilder = CliBuilder; +exports.CommandBuilder = CommandBuilder; +exports.NoLimits = NoLimits; +exports.aggregateHelpStates = aggregateHelpStates; +exports.cloneNode = cloneNode; +exports.cloneTransition = cloneTransition; +exports.debug = debug; +exports.debugMachine = debugMachine; +exports.execute = execute; +exports.injectNode = injectNode; +exports.isTerminalNode = isTerminalNode; +exports.makeAnyOfMachine = makeAnyOfMachine; +exports.makeNode = makeNode; +exports.makeStateMachine = makeStateMachine; +exports.reducers = reducers; +exports.registerDynamic = registerDynamic; +exports.registerShortcut = registerShortcut; +exports.registerStatic = registerStatic; +exports.runMachineInternal = runMachineInternal; +exports.selectBestState = selectBestState; +exports.simplifyMachine = simplifyMachine; +exports.suggest = suggest; +exports.tests = tests; +exports.trimSmallerBranches = trimSmallerBranches; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/errors.js": +/*!***************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/errors.js ***! + \***************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var constants = __webpack_require__(/*! ./constants.js */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/constants.js"); + +/** + * A generic usage error with the name `UsageError`. + * + * It should be used over `Error` only when it's the user's fault. + */ +class UsageError extends Error { + constructor(message) { + super(message); + this.clipanion = { type: `usage` }; + this.name = `UsageError`; + } +} +class UnknownSyntaxError extends Error { + constructor(input, candidates) { + super(); + this.input = input; + this.candidates = candidates; + this.clipanion = { type: `none` }; + this.name = `UnknownSyntaxError`; + if (this.candidates.length === 0) { + this.message = `Command not found, but we're not sure what's the alternative.`; + } + else if (this.candidates.every(candidate => candidate.reason !== null && candidate.reason === candidates[0].reason)) { + const [{ reason }] = this.candidates; + this.message = `${reason}\n\n${this.candidates.map(({ usage }) => `$ ${usage}`).join(`\n`)}`; + } + else if (this.candidates.length === 1) { + const [{ usage }] = this.candidates; + this.message = `Command not found; did you mean:\n\n$ ${usage}\n${whileRunning(input)}`; + } + else { + this.message = `Command not found; did you mean one of:\n\n${this.candidates.map(({ usage }, index) => { + return `${`${index}.`.padStart(4)} ${usage}`; + }).join(`\n`)}\n\n${whileRunning(input)}`; + } + } +} +class AmbiguousSyntaxError extends Error { + constructor(input, usages) { + super(); + this.input = input; + this.usages = usages; + this.clipanion = { type: `none` }; + this.name = `AmbiguousSyntaxError`; + this.message = `Cannot find which to pick amongst the following alternatives:\n\n${this.usages.map((usage, index) => { + return `${`${index}.`.padStart(4)} ${usage}`; + }).join(`\n`)}\n\n${whileRunning(input)}`; + } +} +const whileRunning = (input) => `While running ${input.filter(token => { + return token !== constants.END_OF_INPUT; +}).map(token => { + const json = JSON.stringify(token); + if (token.match(/\s/) || token.length === 0 || json !== `"${token}"`) { + return json; + } + else { + return token; + } +}).join(` `)}`; + +exports.AmbiguousSyntaxError = AmbiguousSyntaxError; +exports.UnknownSyntaxError = UnknownSyntaxError; +exports.UsageError = UsageError; + + +/***/ }), + +/***/ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/format.js": +/*!***************************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/format.js ***! + \***************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const MAX_LINE_LENGTH = 80; +const richLine = Array(MAX_LINE_LENGTH).fill(`━`); +for (let t = 0; t <= 24; ++t) + richLine[richLine.length - t] = `\x1b[38;5;${232 + t}m━`; +const richFormat = { + header: str => `\x1b[1m━━━ ${str}${str.length < MAX_LINE_LENGTH - 5 ? ` ${richLine.slice(str.length + 5).join(``)}` : `:`}\x1b[0m`, + bold: str => `\x1b[1m${str}\x1b[22m`, + error: str => `\x1b[31m\x1b[1m${str}\x1b[22m\x1b[39m`, + code: str => `\x1b[36m${str}\x1b[39m`, +}; +const textFormat = { + header: str => str, + bold: str => str, + error: str => str, + code: str => str, +}; +function dedent(text) { + const lines = text.split(`\n`); + const nonEmptyLines = lines.filter(line => line.match(/\S/)); + const indent = nonEmptyLines.length > 0 ? nonEmptyLines.reduce((minLength, line) => Math.min(minLength, line.length - line.trimStart().length), Number.MAX_VALUE) : 0; + return lines + .map(line => line.slice(indent).trimRight()) + .join(`\n`); +} +function formatMarkdownish(text, { format, paragraphs }) { + // Enforce \n as newline character + text = text.replace(/\r\n?/g, `\n`); + // Remove the indentation, since it got messed up with the JS indentation + text = dedent(text); + // Remove surrounding newlines, since they got added for JS formatting + text = text.replace(/^\n+|\n+$/g, ``); + // List items always end with at least two newlines (in order to not be collapsed) + text = text.replace(/^(\s*)-([^\n]*?)\n+/gm, `$1-$2\n\n`); + // Single newlines are removed; larger than that are collapsed into one + text = text.replace(/\n(\n)?\n*/g, `$1`); + if (paragraphs) { + text = text.split(/\n/).map(paragraph => { + // Does the paragraph starts with a list? + const bulletMatch = paragraph.match(/^\s*[*-][\t ]+(.*)/); + if (!bulletMatch) + // No, cut the paragraphs into segments of 80 characters + return paragraph.match(/(.{1,80})(?: |$)/g).join(`\n`); + const indent = paragraph.length - paragraph.trimStart().length; + // Yes, cut the paragraphs into segments of (78 - indent) characters (to account for the prefix) + return bulletMatch[1].match(new RegExp(`(.{1,${78 - indent}})(?: |$)`, `g`)).map((line, index) => { + return ` `.repeat(indent) + (index === 0 ? `- ` : ` `) + line; + }).join(`\n`); + }).join(`\n\n`); + } + // Highlight the code segments + text = text.replace(/(`+)((?:.|[\n])*?)\1/g, ($0, $1, $2) => { + return format.code($1 + $2 + $1); + }); + // Highlight the code segments + text = text.replace(/(\*\*)((?:.|[\n])*?)\1/g, ($0, $1, $2) => { + return format.bold($1 + $2 + $1); + }); + return text ? `${text}\n` : ``; +} + +exports.formatMarkdownish = formatMarkdownish; +exports.richFormat = richFormat; +exports.textFormat = textFormat; + + +/***/ }), + +/***/ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/browser.js": +/*!****************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/browser.js ***! + \****************************************************************************************************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ +function log(...args) { + // This hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return typeof console === 'object' && + console.log && + console.log(...args); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = __webpack_require__(/*! ./common */ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/common.js")(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; + + +/***/ }), + +/***/ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/common.js": +/*!***************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/common.js ***! + \***************************************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = __webpack_require__(/*! ms */ "./.yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip/node_modules/ms/index.js"); + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * Active `debug` instances. + */ + createDebug.instances = []; + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return match; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.enabled = createDebug.enabled(namespace); + debug.useColors = createDebug.useColors(); + debug.color = selectColor(namespace); + debug.destroy = destroy; + debug.extend = extend; + // Debug.formatArgs = formatArgs; + // debug.rawLog = rawLog; + + // env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + createDebug.instances.push(debug); + + return debug; + } + + function destroy() { + const index = createDebug.instances.indexOf(this); + if (index !== -1) { + createDebug.instances.splice(index, 1); + return true; + } + return false; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + + for (i = 0; i < createDebug.instances.length; i++) { + const instance = createDebug.instances[i]; + instance.enabled = createDebug.enabled(instance.namespace); + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; + + +/***/ }), + +/***/ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/index.js": +/*!**************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/index.js ***! + \**************************************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = __webpack_require__(/*! ./browser.js */ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/browser.js"); +} else { + module.exports = __webpack_require__(/*! ./node.js */ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/node.js"); +} + + +/***/ }), + +/***/ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/node.js": +/*!*************************************************************************************************************************************!*\ + !*** ./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/node.js ***! + \*************************************************************************************************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +/** + * Module dependencies. + */ + +const tty = __webpack_require__(/*! tty */ "tty"); +const util = __webpack_require__(/*! util */ "util"); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = __webpack_require__(/*! supports-color */ "./.yarn/cache/supports-color-npm-7.1.0-df2ba1e338-899480ac85.zip/node_modules/supports-color/index.js"); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = __webpack_require__(/*! ./common */ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/common.js")(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; + + +/***/ }), + +/***/ "./sources/Engine.ts": +/*!***************************!*\ + !*** ./sources/Engine.ts ***! + \***************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Engine": () => (/* binding */ Engine) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/index.js"); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _config_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config.json */ "./config.json"); +/* harmony import */ var _folderUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./folderUtils */ "./sources/folderUtils.ts"); +/* harmony import */ var _pmmUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pmmUtils */ "./sources/pmmUtils.ts"); +/* harmony import */ var _semverUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./semverUtils */ "./sources/semverUtils.ts"); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./types */ "./sources/types.ts"); + + + + + + + + + +class Engine { + constructor(config = _config_json__WEBPACK_IMPORTED_MODULE_3__) { + this.config = config; + } + getPackageManagerFor(binaryName) { + for (const packageManager of _types__WEBPACK_IMPORTED_MODULE_7__.SupportedPackageManagerSet) { + for (const rangeDefinition of Object.values(this.config.definitions[packageManager].ranges)) { + const bins = Array.isArray(rangeDefinition.bin) + ? rangeDefinition.bin + : Object.keys(rangeDefinition.bin); + if (bins.includes(binaryName)) { + return packageManager; + } + } + } + return null; + } + getBinariesFor(name) { + const binNames = new Set(); + for (const rangeDefinition of Object.values(this.config.definitions[name].ranges)) { + const bins = Array.isArray(rangeDefinition.bin) + ? rangeDefinition.bin + : Object.keys(rangeDefinition.bin); + for (const name of bins) { + binNames.add(name); + } + } + return binNames; + } + async getDefaultDescriptors() { + const locators = []; + for (const name of _types__WEBPACK_IMPORTED_MODULE_7__.SupportedPackageManagerSet) + locators.push({ name, range: await this.getDefaultVersion(name) }); + return locators; + } + async getDefaultVersion(packageManager) { + const definition = this.config.definitions[packageManager]; + if (typeof definition === `undefined`) + throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`This package manager (${packageManager}) isn't supported by this corepack build`); + let lastKnownGood; + try { + lastKnownGood = JSON.parse(await fs__WEBPACK_IMPORTED_MODULE_0___default().promises.readFile(this.getLastKnownGoodFile(), `utf8`)); + } + catch (_a) { + // Ignore errors; too bad + } + if (typeof lastKnownGood !== `object` || lastKnownGood === null) + return definition.default; + if (!Object.prototype.hasOwnProperty.call(lastKnownGood, packageManager)) + return definition.default; + const override = lastKnownGood[packageManager]; + if (typeof override !== `string`) + return definition.default; + return override; + } + async activatePackageManager(locator) { + const lastKnownGoodFile = this.getLastKnownGoodFile(); + let lastKnownGood; + try { + lastKnownGood = JSON.parse(await fs__WEBPACK_IMPORTED_MODULE_0___default().promises.readFile(lastKnownGoodFile, `utf8`)); + } + catch (_a) { + // Ignore errors; too bad + } + if (typeof lastKnownGood !== `object` || lastKnownGood === null) + lastKnownGood = {}; + lastKnownGood[locator.name] = locator.reference; + await fs__WEBPACK_IMPORTED_MODULE_0___default().promises.mkdir(path__WEBPACK_IMPORTED_MODULE_1___default().dirname(lastKnownGoodFile), { recursive: true }); + await fs__WEBPACK_IMPORTED_MODULE_0___default().promises.writeFile(lastKnownGoodFile, `${JSON.stringify(lastKnownGood, null, 2)}\n`); + } + async ensurePackageManager(locator) { + const definition = this.config.definitions[locator.name]; + if (typeof definition === `undefined`) + throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`This package manager (${locator.name}) isn't supported by this corepack build`); + const ranges = Object.keys(definition.ranges).reverse(); + const range = ranges.find(range => _semverUtils__WEBPACK_IMPORTED_MODULE_6__.satisfiesWithPrereleases(locator.reference, range)); + if (typeof range === `undefined`) + throw new Error(`Assertion failed: Specified resolution (${locator.reference}) isn't supported by any of ${ranges.join(`, `)}`); + const installedLocation = await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.installVersion(_folderUtils__WEBPACK_IMPORTED_MODULE_4__.getInstallFolder(), locator, { + spec: definition.ranges[range], + }); + return { + location: installedLocation, + spec: definition.ranges[range], + }; + } + async resolveDescriptor(descriptor, { allowTags = false, useCache = true } = {}) { + const definition = this.config.definitions[descriptor.name]; + if (typeof definition === `undefined`) + throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`This package manager (${descriptor.name}) isn't supported by this corepack build`); + let finalDescriptor = descriptor; + if (descriptor.range.match(/^[a-z-]+$/)) { + if (!allowTags) + throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`Packages managers can't be referended via tags in this context`); + // We only resolve tags from the latest registry entry + const ranges = Object.keys(definition.ranges); + const tagRange = ranges[ranges.length - 1]; + const tags = await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.fetchAvailableTags(definition.ranges[tagRange].registry); + if (!Object.prototype.hasOwnProperty.call(tags, descriptor.range)) + throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`Tag not found (${descriptor.range})`); + finalDescriptor = { + name: descriptor.name, + range: tags[descriptor.range], + }; + } + // If a compatible version is already installed, no need to query one + // from the remote listings + const cachedVersion = await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.findInstalledVersion(_folderUtils__WEBPACK_IMPORTED_MODULE_4__.getInstallFolder(), finalDescriptor); + if (cachedVersion !== null && useCache) + return { name: finalDescriptor.name, reference: cachedVersion }; + const candidateRangeDefinitions = Object.keys(definition.ranges).filter(range => { + return _semverUtils__WEBPACK_IMPORTED_MODULE_6__.satisfiesWithPrereleases(finalDescriptor.range, range); + }); + const tagResolutions = await Promise.all(candidateRangeDefinitions.map(async (range) => { + return [range, await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.fetchAvailableVersions(definition.ranges[range].registry)]; + })); + // If a version is available under multiple strategies (for example if + // Yarn is published to both the v1 package and git), we only care + // about the latest one + const resolutionMap = new Map(); + for (const [range, resolutions] of tagResolutions) + for (const entry of resolutions) + resolutionMap.set(entry, range); + const candidates = [...resolutionMap.keys()]; + const maxSatisfying = semver__WEBPACK_IMPORTED_MODULE_2___default().maxSatisfying(candidates, finalDescriptor.range); + if (maxSatisfying === null) + return null; + return { name: finalDescriptor.name, reference: maxSatisfying }; + } + getLastKnownGoodFile() { + return path__WEBPACK_IMPORTED_MODULE_1___default().join(_folderUtils__WEBPACK_IMPORTED_MODULE_4__.getInstallFolder(), `lastKnownGood.json`); + } +} + + +/***/ }), + +/***/ "./sources/commands/Disable.ts": +/*!*************************************!*\ + !*** ./sources/commands/Disable.ts ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "DisableCommand": () => (/* binding */ DisableCommand) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var which__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! which */ "./.yarn/cache/which-npm-2.0.2-320ddf72f7-1a5c563d3c.zip/node_modules/which/which.js"); +/* harmony import */ var which__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(which__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../types */ "./sources/types.ts"); + + + + + +class DisableCommand extends clipanion__WEBPACK_IMPORTED_MODULE_4__.Command { + constructor() { + super(...arguments); + this.installDirectory = clipanion__WEBPACK_IMPORTED_MODULE_4__.Option.String(`--install-directory`, { + description: `Where the shims are located`, + }); + this.names = clipanion__WEBPACK_IMPORTED_MODULE_4__.Option.Rest(); + } + async execute() { + let installDirectory = this.installDirectory; + // Node always call realpath on the module it executes, so we already + // lost track of how the binary got called. To find it back, we need to + // iterate over the PATH variable. + if (typeof installDirectory === `undefined`) + installDirectory = path__WEBPACK_IMPORTED_MODULE_1___default().dirname(await which__WEBPACK_IMPORTED_MODULE_2___default()(`corepack`)); + const names = this.names.length === 0 + ? _types__WEBPACK_IMPORTED_MODULE_3__.SupportedPackageManagerSetWithoutNpm + : this.names; + for (const name of new Set(names)) { + if (!(0,_types__WEBPACK_IMPORTED_MODULE_3__.isSupportedPackageManager)(name)) + throw new clipanion__WEBPACK_IMPORTED_MODULE_4__.UsageError(`Invalid package manager name '${name}'`); + for (const binName of this.context.engine.getBinariesFor(name)) { + if (process.platform === `win32`) { + await this.removeWin32Link(installDirectory, binName); + } + else { + await this.removePosixLink(installDirectory, binName); + } + } + } + } + async removePosixLink(installDirectory, binName) { + const file = path__WEBPACK_IMPORTED_MODULE_1___default().join(installDirectory, binName); + try { + await fs__WEBPACK_IMPORTED_MODULE_0___default().promises.unlink(file); + } + catch (err) { + if (err.code !== `ENOENT`) { + throw err; + } + } + } + async removeWin32Link(installDirectory, binName) { + for (const ext of [``, `.ps1`, `.cmd`]) { + const file = path__WEBPACK_IMPORTED_MODULE_1___default().join(installDirectory, `${binName}${ext}`); + try { + await fs__WEBPACK_IMPORTED_MODULE_0___default().promises.unlink(file); + } + catch (err) { + if (err.code !== `ENOENT`) { + throw err; + } + } + } + } +} +DisableCommand.paths = [ + [`disable`], +]; +DisableCommand.usage = clipanion__WEBPACK_IMPORTED_MODULE_4__.Command.Usage({ + description: `Remove the Corepack shims from the install directory`, + details: ` + When run, this command will remove the shims for the specified package managers from the install directory, or all shims if no parameters are passed. + + By default it will locate the install directory by running the equivalent of \`which corepack\`, but this can be tweaked by explicitly passing the install directory via the \`--bin-folder\` flag. + `, + examples: [[ + `Disable all shims, removing them if they're next to the \`coreshim\` binary`, + `$0 disable`, + ], [ + `Disable all shims, removing them from the specified directory`, + `$0 disable --install-directory /path/to/bin`, + ], [ + `Disable the Yarn shim only`, + `$0 disable yarn`, + ]], +}); + + +/***/ }), + +/***/ "./sources/commands/Enable.ts": +/*!************************************!*\ + !*** ./sources/commands/Enable.ts ***! + \************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "EnableCommand": () => (/* binding */ EnableCommand) +/* harmony export */ }); +/* harmony import */ var _zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @zkochan/cmd-shim */ "./.yarn/cache/@zkochan-cmd-shim-npm-5.0.0-9e90407ba0-ace99c7c36.zip/node_modules/@zkochan/cmd-shim/index.js"); +/* harmony import */ var _zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ "fs"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var which__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! which */ "./.yarn/cache/which-npm-2.0.2-320ddf72f7-1a5c563d3c.zip/node_modules/which/which.js"); +/* harmony import */ var which__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(which__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../types */ "./sources/types.ts"); + + + + + + +class EnableCommand extends clipanion__WEBPACK_IMPORTED_MODULE_5__.Command { + constructor() { + super(...arguments); + this.installDirectory = clipanion__WEBPACK_IMPORTED_MODULE_5__.Option.String(`--install-directory`, { + description: `Where the shims are to be installed`, + }); + this.names = clipanion__WEBPACK_IMPORTED_MODULE_5__.Option.Rest(); + } + async execute() { + let installDirectory = this.installDirectory; + // Node always call realpath on the module it executes, so we already + // lost track of how the binary got called. To find it back, we need to + // iterate over the PATH variable. + if (typeof installDirectory === `undefined`) + installDirectory = path__WEBPACK_IMPORTED_MODULE_2___default().dirname(await which__WEBPACK_IMPORTED_MODULE_3___default()(`corepack`)); + // Otherwise the relative symlink we'll compute will be incorrect, if the + // install directory is within a symlink + installDirectory = fs__WEBPACK_IMPORTED_MODULE_1___default().realpathSync(installDirectory); + // We use `eval` so that Webpack doesn't statically transform it. + const manifestPath = eval(`require`).resolve(`corepack/package.json`); + const distFolder = path__WEBPACK_IMPORTED_MODULE_2___default().join(path__WEBPACK_IMPORTED_MODULE_2___default().dirname(manifestPath), `dist`); + if (!fs__WEBPACK_IMPORTED_MODULE_1___default().existsSync(distFolder)) + throw new Error(`Assertion failed: The stub folder doesn't exist`); + const names = this.names.length === 0 + ? _types__WEBPACK_IMPORTED_MODULE_4__.SupportedPackageManagerSetWithoutNpm + : this.names; + for (const name of new Set(names)) { + if (!(0,_types__WEBPACK_IMPORTED_MODULE_4__.isSupportedPackageManager)(name)) + throw new clipanion__WEBPACK_IMPORTED_MODULE_5__.UsageError(`Invalid package manager name '${name}'`); + for (const binName of this.context.engine.getBinariesFor(name)) { + if (process.platform === `win32`) { + await this.generateWin32Link(installDirectory, distFolder, binName); + } + else { + await this.generatePosixLink(installDirectory, distFolder, binName); + } + } + } + } + async generatePosixLink(installDirectory, distFolder, binName) { + const file = path__WEBPACK_IMPORTED_MODULE_2___default().join(installDirectory, binName); + const symlink = path__WEBPACK_IMPORTED_MODULE_2___default().relative(installDirectory, path__WEBPACK_IMPORTED_MODULE_2___default().join(distFolder, `${binName}.js`)); + if (fs__WEBPACK_IMPORTED_MODULE_1___default().existsSync(file)) { + const currentSymlink = await fs__WEBPACK_IMPORTED_MODULE_1___default().promises.readlink(file); + if (currentSymlink !== symlink) { + await fs__WEBPACK_IMPORTED_MODULE_1___default().promises.unlink(file); + } + else { + return; + } + } + await fs__WEBPACK_IMPORTED_MODULE_1___default().promises.symlink(symlink, file); + } + async generateWin32Link(installDirectory, distFolder, binName) { + const file = path__WEBPACK_IMPORTED_MODULE_2___default().join(installDirectory, binName); + await _zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0___default()(path__WEBPACK_IMPORTED_MODULE_2___default().join(distFolder, `${binName}.js`), file, { + createCmdFile: true, + }); + } +} +EnableCommand.paths = [ + [`enable`], +]; +EnableCommand.usage = clipanion__WEBPACK_IMPORTED_MODULE_5__.Command.Usage({ + description: `Add the Corepack shims to the install directories`, + details: ` + When run, this commmand will check whether the shims for the specified package managers can be found with the correct values inside the install directory. If not, or if they don't exist, they will be created. + + By default it will locate the install directory by running the equivalent of \`which corepack\`, but this can be tweaked by explicitly passing the install directory via the \`--bin-folder\` flag. + `, + examples: [[ + `Enable all shims, putting them next to the \`corepath\` binary`, + `$0 enable`, + ], [ + `Enable all shims, putting them in the specified directory`, + `$0 enable --install-directory /path/to/folder`, + ], [ + `Enable the Yarn shim only`, + `$0 enable yarn`, + ]], +}); + + +/***/ }), + +/***/ "./sources/commands/Hydrate.ts": +/*!*************************************!*\ + !*** ./sources/commands/Hydrate.ts ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "HydrateCommand": () => (/* binding */ HydrateCommand) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _folderUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../folderUtils */ "./sources/folderUtils.ts"); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../types */ "./sources/types.ts"); + + + + +class HydrateCommand extends clipanion__WEBPACK_IMPORTED_MODULE_3__.Command { + constructor() { + super(...arguments); + this.activate = clipanion__WEBPACK_IMPORTED_MODULE_3__.Option.Boolean(`--activate`, false, { + description: `If true, this release will become the default one for this package manager`, + }); + this.fileName = clipanion__WEBPACK_IMPORTED_MODULE_3__.Option.String(); + } + async execute() { + const installFolder = _folderUtils__WEBPACK_IMPORTED_MODULE_1__.getInstallFolder(); + const fileName = path__WEBPACK_IMPORTED_MODULE_0___default().resolve(this.context.cwd, this.fileName); + const archiveEntries = new Map(); + let hasShortEntries = false; + const { default: tar } = await Promise.resolve(/*! import() eager */).then(__webpack_require__.t.bind(__webpack_require__, /*! tar */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/index.js", 19)); + await tar.t({ file: fileName, onentry: entry => { + const segments = entry.header.path.split(/\//g); + if (segments.length < 3) { + hasShortEntries = true; + } + else { + let references = archiveEntries.get(segments[0]); + if (typeof references === `undefined`) + archiveEntries.set(segments[0], references = new Set()); + references.add(segments[1]); + } + } }); + if (hasShortEntries || archiveEntries.size < 1) + throw new clipanion__WEBPACK_IMPORTED_MODULE_3__.UsageError(`Invalid archive format; did it get generated by 'corepack prepare'?`); + for (const [name, references] of archiveEntries) { + for (const reference of references) { + if (!(0,_types__WEBPACK_IMPORTED_MODULE_2__.isSupportedPackageManager)(name)) + throw new clipanion__WEBPACK_IMPORTED_MODULE_3__.UsageError(`Unsupported package manager '${name}'`); + if (this.activate) + this.context.stdout.write(`Hydrating ${name}@${reference} for immediate activation...\n`); + else + this.context.stdout.write(`Hydrating ${name}@${reference}...\n`); + await tar.x({ file: fileName, cwd: installFolder }, [`${name}/${reference}`]); + if (this.activate) { + await this.context.engine.activatePackageManager({ name, reference }); + } + } + } + this.context.stdout.write(`All done!\n`); + } +} +HydrateCommand.paths = [ + [`hydrate`], +]; +HydrateCommand.usage = clipanion__WEBPACK_IMPORTED_MODULE_3__.Command.Usage({ + description: `Import a package manager into the cache`, + details: ` + This command unpacks a package manager archive into the cache. The archive must have been generated by the \`corepack prepare\` command - no other will work. + `, + examples: [[ + `Import a package manager in the cache`, + `$0 hydrate corepack.tgz`, + ]], +}); + + +/***/ }), + +/***/ "./sources/commands/Prepare.ts": +/*!*************************************!*\ + !*** ./sources/commands/Prepare.ts ***! + \*************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "PrepareCommand": () => (/* binding */ PrepareCommand) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _folderUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../folderUtils */ "./sources/folderUtils.ts"); +/* harmony import */ var _specUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../specUtils */ "./sources/specUtils.ts"); + + + + +class PrepareCommand extends clipanion__WEBPACK_IMPORTED_MODULE_3__.Command { + constructor() { + super(...arguments); + this.activate = clipanion__WEBPACK_IMPORTED_MODULE_3__.Option.Boolean(`--activate`, false, { + description: `If true, this release will become the default one for this package manager`, + }); + this.all = clipanion__WEBPACK_IMPORTED_MODULE_3__.Option.Boolean(`--all`, false, { + description: `If true, all available default package managers will be installed`, + }); + this.json = clipanion__WEBPACK_IMPORTED_MODULE_3__.Option.Boolean(`--json`, false, { + description: `If true, the output will be the path of the generated tarball`, + }); + this.output = clipanion__WEBPACK_IMPORTED_MODULE_3__.Option.String(`-o,--output`, { + description: `If true, the installed package managers will also be stored in a tarball`, + tolerateBoolean: true, + }); + this.specs = clipanion__WEBPACK_IMPORTED_MODULE_3__.Option.Rest(); + } + async execute() { + if (this.all && this.specs.length > 0) + throw new clipanion__WEBPACK_IMPORTED_MODULE_3__.UsageError(`The --all option cannot be used along with an explicit package manager specification`); + const specs = this.all + ? await this.context.engine.getDefaultDescriptors() + : this.specs; + const installLocations = []; + for (const request of specs) { + let spec; + if (typeof request === `undefined`) { + const lookup = await _specUtils__WEBPACK_IMPORTED_MODULE_2__.loadSpec(this.context.cwd); + switch (lookup.type) { + case `NoProject`: + throw new clipanion__WEBPACK_IMPORTED_MODULE_3__.UsageError(`Couldn't find a project in the local directory - please explicit the package manager to pack, or run this command from a valid project`); + case `NoSpec`: + throw new clipanion__WEBPACK_IMPORTED_MODULE_3__.UsageError(`The local project doesn't feature a 'packageManager' field - please explicit the package manager to pack, or update the manifest to reference it`); + default: { + spec = lookup.spec; + } + } + } + else { + spec = typeof request === `string` + ? _specUtils__WEBPACK_IMPORTED_MODULE_2__.parseSpec(request, `CLI arguments`) + : request; + } + const resolved = await this.context.engine.resolveDescriptor(spec); + if (resolved === null) + throw new clipanion__WEBPACK_IMPORTED_MODULE_3__.UsageError(`Failed to successfully resolve '${spec.range}' to a valid ${spec.name} release`); + if (!this.json) { + if (this.activate) { + this.context.stdout.write(`Preparing ${spec.name}@${spec.range} for immediate activation...\n`); + } + else { + this.context.stdout.write(`Preparing ${spec.name}@${spec.range}...\n`); + } + } + const installSpec = await this.context.engine.ensurePackageManager(resolved); + installLocations.push(installSpec.location); + if (this.activate) { + await this.context.engine.activatePackageManager(resolved); + } + } + if (this.output) { + const outputName = typeof this.output === `string` + ? this.output + : `corepack.tgz`; + const baseInstallFolder = _folderUtils__WEBPACK_IMPORTED_MODULE_1__.getInstallFolder(); + const outputPath = path__WEBPACK_IMPORTED_MODULE_0___default().resolve(this.context.cwd, outputName); + if (!this.json) + this.context.stdout.write(`Packing the selected tools in ${path__WEBPACK_IMPORTED_MODULE_0___default().basename(outputPath)}...\n`); + const { default: tar } = await Promise.resolve(/*! import() eager */).then(__webpack_require__.t.bind(__webpack_require__, /*! tar */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/index.js", 19)); + await tar.c({ gzip: true, cwd: baseInstallFolder, file: path__WEBPACK_IMPORTED_MODULE_0___default().resolve(outputPath) }, installLocations.map(location => { + return path__WEBPACK_IMPORTED_MODULE_0___default().relative(baseInstallFolder, location); + })); + if (this.json) { + this.context.stdout.write(`${JSON.stringify(outputPath)}\n`); + } + else { + this.context.stdout.write(`All done!\n`); + } + } + } +} +PrepareCommand.paths = [ + [`prepare`], +]; +PrepareCommand.usage = clipanion__WEBPACK_IMPORTED_MODULE_3__.Command.Usage({ + description: `Generate a package manager archive`, + details: ` + This command makes sure that the specified package managers are installed in the local cache. Calling this command explicitly unless you operate in an environment without network access (in which case you'd have to call \`prepare\` while building your image, to make sure all tools are available for later use). + + When the \`-o,--output\` flag is set, Corepack will also compress the resulting package manager into a format suitable for \`corepack hydrate\`, and will store it at the specified location on the disk. + `, + examples: [[ + `Prepare the package manager from the active project`, + `$0 prepare`, + ], [ + `Prepare a specific Yarn version`, + `$0 prepare yarn@2.2.2`, + ], [ + `Generate an archive for a specific Yarn version`, + `$0 prepare yarn@2.2.2 -o`, + ], [ + `Generate a named archive`, + `$0 prepare yarn@2.2.2 --output=yarn.tgz`, + ]], +}); + + +/***/ }), + +/***/ "./sources/debugUtils.ts": +/*!*******************************!*\ + !*** ./sources/debugUtils.ts ***! + \*******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "log": () => (/* binding */ log) +/* harmony export */ }); +/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/index.js"); +/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(debug__WEBPACK_IMPORTED_MODULE_0__); + +const log = debug__WEBPACK_IMPORTED_MODULE_0___default()(`corepack`); + + +/***/ }), + +/***/ "./sources/folderUtils.ts": +/*!********************************!*\ + !*** ./sources/folderUtils.ts ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getInstallFolder": () => (/* binding */ getInstallFolder), +/* harmony export */ "getTemporaryFolder": () => (/* binding */ getTemporaryFolder) +/* harmony export */ }); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! os */ "os"); +/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); + + + +function getInstallFolder() { + var _a; + return (_a = process.env.COREPACK_HOME) !== null && _a !== void 0 ? _a : (0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,os__WEBPACK_IMPORTED_MODULE_1__.homedir)(), `.node/corepack`); +} +function getTemporaryFolder(target = (0,os__WEBPACK_IMPORTED_MODULE_1__.tmpdir)()) { + (0,fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(target, { recursive: true }); + while (true) { + const rnd = Math.random() * 0x100000000; + const hex = rnd.toString(16).padStart(8, `0`); + const path = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(target, `corepack-${process.pid}-${hex}`); + try { + (0,fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(path); + return path; + } + catch (error) { + if (error.code === `EEXIST`) { + continue; + } + else { + throw error; + } + } + } +} + + +/***/ }), + +/***/ "./sources/fsUtils.ts": +/*!****************************!*\ + !*** ./sources/fsUtils.ts ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "mutex": () => (/* binding */ mutex) +/* harmony export */ }); +async function mutex(p, cb) { + return await cb(); +} + + +/***/ }), + +/***/ "./sources/httpUtils.ts": +/*!******************************!*\ + !*** ./sources/httpUtils.ts ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "fetchUrlStream": () => (/* binding */ fetchUrlStream), +/* harmony export */ "fetchAsBuffer": () => (/* binding */ fetchAsBuffer), +/* harmony export */ "fetchAsJson": () => (/* binding */ fetchAsJson) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); + +async function fetchUrlStream(url, options = {}) { + if (process.env.COREPACK_ENABLE_NETWORK === `0`) + throw new clipanion__WEBPACK_IMPORTED_MODULE_0__.UsageError(`Network access disabled by the environment; can't reach ${url}`); + const { default: https } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! https */ "https", 23)); + return new Promise((resolve, reject) => { + const request = https.get(url, options, response => { + var _a; + const statusCode = (_a = response.statusCode) !== null && _a !== void 0 ? _a : 500; + if (!(statusCode >= 200 && statusCode < 300)) + return reject(new Error(`Server answered with HTTP ${statusCode}`)); + return resolve(response); + }); + request.on(`error`, err => { + reject(new Error(`Error when performing the request`)); + }); + }); +} +async function fetchAsBuffer(url, options) { + const response = await fetchUrlStream(url, options); + return new Promise((resolve, reject) => { + const chunks = []; + response.on(`data`, chunk => { + chunks.push(chunk); + }); + response.on(`error`, error => { + reject(error); + }); + response.on(`end`, () => { + resolve(Buffer.concat(chunks)); + }); + }); +} +async function fetchAsJson(url, options) { + const buffer = await fetchAsBuffer(url, options); + const asText = buffer.toString(); + try { + return JSON.parse(asText); + } + catch (error) { + const truncated = asText.length > 30 + ? `${asText.slice(0, 30)}...` + : asText; + throw new Error(`Couldn't parse JSON data: ${JSON.stringify(truncated)}`); + } +} + + +/***/ }), + +/***/ "./sources/miscUtils.ts": +/*!******************************!*\ + !*** ./sources/miscUtils.ts ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Cancellation": () => (/* binding */ Cancellation) +/* harmony export */ }); +class Cancellation extends Error { + constructor() { + super(`Cancelled operation`); + } +} + + +/***/ }), + +/***/ "./sources/pmmUtils.ts": +/*!*****************************!*\ + !*** ./sources/pmmUtils.ts ***! + \*****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "fetchAvailableTags": () => (/* binding */ fetchAvailableTags), +/* harmony export */ "fetchAvailableVersions": () => (/* binding */ fetchAvailableVersions), +/* harmony export */ "findInstalledVersion": () => (/* binding */ findInstalledVersion), +/* harmony export */ "installVersion": () => (/* binding */ installVersion), +/* harmony export */ "runVersion": () => (/* binding */ runVersion) +/* harmony export */ }); +/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! child_process */ "child_process"); +/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ "fs"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/index.js"); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _debugUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./debugUtils */ "./sources/debugUtils.ts"); +/* harmony import */ var _folderUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./folderUtils */ "./sources/folderUtils.ts"); +/* harmony import */ var _fsUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./fsUtils */ "./sources/fsUtils.ts"); +/* harmony import */ var _httpUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./httpUtils */ "./sources/httpUtils.ts"); + + + + + + + + +async function fetchAvailableTags(spec) { + switch (spec.type) { + case `npm`: { + const data = await _httpUtils__WEBPACK_IMPORTED_MODULE_7__.fetchAsJson(`https://registry.npmjs.org/${spec.package}`, { headers: { [`Accept`]: `application/vnd.npm.install-v1+json` } }); + return data[`dist-tags`]; + } + case `url`: { + const data = await _httpUtils__WEBPACK_IMPORTED_MODULE_7__.fetchAsJson(spec.url); + return data[spec.fields.tags]; + } + default: { + throw new Error(`Unsupported specification ${JSON.stringify(spec)}`); + } + } +} +async function fetchAvailableVersions(spec) { + switch (spec.type) { + case `npm`: { + const data = await _httpUtils__WEBPACK_IMPORTED_MODULE_7__.fetchAsJson(`https://registry.npmjs.org/${spec.package}`, { headers: { [`Accept`]: `application/vnd.npm.install-v1+json` } }); + return Object.keys(data.versions); + } + case `url`: { + const data = await _httpUtils__WEBPACK_IMPORTED_MODULE_7__.fetchAsJson(spec.url); + const field = data[spec.fields.versions]; + return Array.isArray(field) ? field : Object.keys(field); + } + default: { + throw new Error(`Unsupported specification ${JSON.stringify(spec)}`); + } + } +} +async function findInstalledVersion(installTarget, descriptor) { + const installFolder = path__WEBPACK_IMPORTED_MODULE_2___default().join(installTarget, descriptor.name); + let folderContent; + try { + folderContent = await fs__WEBPACK_IMPORTED_MODULE_1___default().promises.readdir(installFolder); + } + catch (error) { + if (error.code === `ENOENT`) { + folderContent = []; + } + else { + throw error; + } + } + const candidateVersions = []; + for (const entry of folderContent) { + // Some dot-folders tend to pop inside directories, especially on OSX + if (entry.startsWith(`.`)) + continue; + candidateVersions.push(entry); + } + const bestMatch = semver__WEBPACK_IMPORTED_MODULE_3___default().maxSatisfying(candidateVersions, descriptor.range); + if (bestMatch === null) + return null; + return bestMatch; +} +async function installVersion(installTarget, locator, { spec }) { + const { default: tar } = await Promise.resolve(/*! import() eager */).then(__webpack_require__.t.bind(__webpack_require__, /*! tar */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/index.js", 19)); + const installFolder = path__WEBPACK_IMPORTED_MODULE_2___default().join(installTarget, locator.name, locator.reference); + if (fs__WEBPACK_IMPORTED_MODULE_1___default().existsSync(installFolder)) { + _debugUtils__WEBPACK_IMPORTED_MODULE_4__.log(`Reusing ${locator.name}@${locator.reference}`); + return installFolder; + } + const url = spec.url.replace(`{}`, locator.reference); + _debugUtils__WEBPACK_IMPORTED_MODULE_4__.log(`Installing ${locator.name}@${locator.reference} from ${url}`); + return await _fsUtils__WEBPACK_IMPORTED_MODULE_6__.mutex(installFolder, async () => { + // Creating a temporary folder inside the install folder means that we + // are sure it'll be in the same drive as the destination, so we can + // just move it there atomically once we are done + const tmpFolder = _folderUtils__WEBPACK_IMPORTED_MODULE_5__.getTemporaryFolder(installTarget); + const stream = await _httpUtils__WEBPACK_IMPORTED_MODULE_7__.fetchUrlStream(url); + const parsedUrl = new URL(url); + const ext = path__WEBPACK_IMPORTED_MODULE_2___default().posix.extname(parsedUrl.pathname); + let outputFile = null; + let sendTo; + if (ext === `.tgz`) { + sendTo = tar.x({ strip: 1, cwd: tmpFolder }); + } + else if (ext === `.js`) { + outputFile = path__WEBPACK_IMPORTED_MODULE_2___default().join(tmpFolder, path__WEBPACK_IMPORTED_MODULE_2___default().posix.basename(parsedUrl.pathname)); + sendTo = fs__WEBPACK_IMPORTED_MODULE_1___default().createWriteStream(outputFile); + } + stream.pipe(sendTo); + await new Promise(resolve => { + sendTo.on(`finish`, resolve); + }); + await fs__WEBPACK_IMPORTED_MODULE_1___default().promises.mkdir(path__WEBPACK_IMPORTED_MODULE_2___default().dirname(installFolder), { recursive: true }); + await fs__WEBPACK_IMPORTED_MODULE_1___default().promises.rename(tmpFolder, installFolder); + _debugUtils__WEBPACK_IMPORTED_MODULE_4__.log(`Install finished`); + return installFolder; + }); +} +async function runVersion(installSpec, locator, binName, args, context) { + let binPath = null; + if (Array.isArray(installSpec.spec.bin)) { + if (installSpec.spec.bin.some(bin => bin === binName)) { + const parsedUrl = new URL(installSpec.spec.url); + const ext = path__WEBPACK_IMPORTED_MODULE_2___default().posix.extname(parsedUrl.pathname); + if (ext === `.js`) { + binPath = path__WEBPACK_IMPORTED_MODULE_2___default().join(installSpec.location, path__WEBPACK_IMPORTED_MODULE_2___default().posix.basename(parsedUrl.pathname)); + } + } + } + else { + for (const [name, dest] of Object.entries(installSpec.spec.bin)) { + if (name === binName) { + binPath = path__WEBPACK_IMPORTED_MODULE_2___default().join(installSpec.location, dest); + break; + } + } + } + if (!binPath) + throw new Error(`Assertion failed: Unable to locate path for bin '${binName}'`); + return new Promise((resolve, reject) => { + process.on(`SIGINT`, () => { + // We don't want to exit the process before the child, so we just + // ignore SIGINT and wait for the regular exit to happen (the child + // will receive SIGINT too since it's part of the same process grp) + }); + const stdio = [`pipe`, `pipe`, `pipe`]; + if (context.stdin === process.stdin) + stdio[0] = `inherit`; + if (context.stdout === process.stdout) + stdio[1] = `inherit`; + if (context.stderr === process.stderr) + stdio[2] = `inherit`; + const v8CompileCache = typeof require !== `undefined` + ? eval(`require`).resolve(`./vcc.js`) + : eval(`require`).resolve(`corepack/dist/vcc.js`); + const child = (0,child_process__WEBPACK_IMPORTED_MODULE_0__.spawn)(process.execPath, [`--require`, v8CompileCache, binPath, ...args], { + cwd: context.cwd, + stdio, + env: Object.assign(Object.assign({}, process.env), { COREPACK_ROOT: path__WEBPACK_IMPORTED_MODULE_2___default().dirname(eval(`__dirname`)) }), + }); + activeChildren.add(child); + if (activeChildren.size === 1) { + process.on(`SIGINT`, sigintHandler); + process.on(`SIGTERM`, sigtermHandler); + } + if (context.stdin !== process.stdin) + context.stdin.pipe(child.stdin); + if (context.stdout !== process.stdout) + child.stdout.pipe(context.stdout); + if (context.stderr !== process.stderr) + child.stderr.pipe(context.stderr); + child.on(`error`, error => { + activeChildren.delete(child); + if (activeChildren.size === 0) { + process.off(`SIGINT`, sigintHandler); + process.off(`SIGTERM`, sigtermHandler); + } + reject(error); + }); + child.on(`exit`, exitCode => { + activeChildren.delete(child); + if (activeChildren.size === 0) { + process.off(`SIGINT`, sigintHandler); + process.off(`SIGTERM`, sigtermHandler); + } + resolve(exitCode !== null ? exitCode : 1); + }); + }); +} +const activeChildren = new Set(); +function sigintHandler() { + // We don't want SIGINT to kill our process; we want it to kill the + // innermost process, whose end will cause our own to exit. +} +function sigtermHandler() { + for (const child of activeChildren) { + child.kill(); + } +} + + +/***/ }), + +/***/ "./sources/semverUtils.ts": +/*!********************************!*\ + !*** ./sources/semverUtils.ts ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "satisfiesWithPrereleases": () => (/* binding */ satisfiesWithPrereleases) +/* harmony export */ }); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/index.js"); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_0__); + +/** + * Returns whether the given semver version satisfies the given range. Notably + * this supports prerelease versions so that "2.0.0-rc.0" satisfies the range + * ">=1.0.0", for example. + * + * This function exists because the semver.satisfies method does not include + * pre releases. This means ranges such as * would not satisfy 1.0.0-rc. The + * includePrerelease flag has a weird behavior and cannot be used (if you want + * to try it out, just run the `semverUtils` testsuite using this flag instead + * of our own implementation, and you'll see the failing cases). + * + * See https://github.com/yarnpkg/berry/issues/575 for more context. + */ +function satisfiesWithPrereleases(version, range, loose = false) { + let semverRange; + try { + semverRange = new (semver__WEBPACK_IMPORTED_MODULE_0___default().Range)(range, loose); + } + catch (err) { + return false; + } + if (!version) + return false; + let semverVersion; + try { + semverVersion = new (semver__WEBPACK_IMPORTED_MODULE_0___default().SemVer)(version, semverRange.loose); + if (semverVersion.prerelease) { + semverVersion.prerelease = []; + } + } + catch (err) { + return false; + } + // A range has multiple sets of comparators. A version must satisfy all + // comparators in a set and at least one set to satisfy the range. + return semverRange.set.some(comparatorSet => { + for (const comparator of comparatorSet) + if (comparator.semver.prerelease) + comparator.semver.prerelease = []; + return comparatorSet.every(comparator => { + return comparator.test(semverVersion); + }); + }); +} + + +/***/ }), + +/***/ "./sources/specUtils.ts": +/*!******************************!*\ + !*** ./sources/specUtils.ts ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "parseSpec": () => (/* binding */ parseSpec), +/* harmony export */ "findProjectSpec": () => (/* binding */ findProjectSpec), +/* harmony export */ "loadSpec": () => (/* binding */ loadSpec) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/index.js"); +/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types */ "./sources/types.ts"); + + + + + +const nodeModulesRegExp = /[\\/]node_modules[\\/](@[^\\/]*[\\/])?([^@\\/][^\\/]*)$/; +function parseSpec(raw, source) { + if (typeof raw !== `string`) + throw new clipanion__WEBPACK_IMPORTED_MODULE_4__.UsageError(`Invalid package manager specification in ${source}; expected a string`); + const match = raw.match(/^(?!_)(.+)@(.+)$/); + if (match === null || !semver__WEBPACK_IMPORTED_MODULE_2___default().valid(match[2])) + throw new clipanion__WEBPACK_IMPORTED_MODULE_4__.UsageError(`Invalid package manager specification in ${source}; expected a semver version`); + if (!(0,_types__WEBPACK_IMPORTED_MODULE_3__.isSupportedPackageManager)(match[1])) + throw new clipanion__WEBPACK_IMPORTED_MODULE_4__.UsageError(`Unsupported package manager specification (${match})`); + return { + name: match[1], + range: match[2], + }; +} +/** + * Locates the active project's package manager specification. + * + * If the specification exists but doesn't match the active package manager, + * an error is thrown to prevent users from using the wrong package manager, + * which would lead to inconsistent project layouts. + * + * If the project doesn't include a specification file, we just assume that + * whatever the user uses is exactly what they want to use. Since the version + * isn't explicited, we fallback on known good versions. + * + * Finally, if the project doesn't exist at all, we ask the user whether they + * want to create one in the current project. If they do, we initialize a new + * project using the default package managers, and configure it so that we + * don't need to ask again in the future. + */ +async function findProjectSpec(initialCwd, locator, { transparent = false } = {}) { + // A locator is a valid descriptor (but not the other way around) + const fallbackLocator = { name: locator.name, range: locator.reference }; + while (true) { + const result = await loadSpec(initialCwd); + switch (result.type) { + case `NoProject`: + case `NoSpec`: + { + return fallbackLocator; + } + break; + case `Found`: + { + if (result.spec.name !== locator.name) { + if (transparent) { + return fallbackLocator; + } + else { + throw new clipanion__WEBPACK_IMPORTED_MODULE_4__.UsageError(`This project is configured to use ${result.spec.name}`); + } + } + else { + return result.spec; + } + } + break; + } + } +} +async function loadSpec(initialCwd) { + let nextCwd = initialCwd; + let currCwd = ``; + let selection = null; + while (nextCwd !== currCwd && (!selection || !selection.data.packageManager)) { + currCwd = nextCwd; + nextCwd = path__WEBPACK_IMPORTED_MODULE_1___default().dirname(currCwd); + if (nodeModulesRegExp.test(currCwd)) + continue; + const manifestPath = path__WEBPACK_IMPORTED_MODULE_1___default().join(currCwd, `package.json`); + if (!fs__WEBPACK_IMPORTED_MODULE_0___default().existsSync(manifestPath)) + continue; + const content = await fs__WEBPACK_IMPORTED_MODULE_0___default().promises.readFile(manifestPath, `utf8`); + let data; + try { + data = JSON.parse(content); + } + catch (_a) { } + if (typeof data !== `object` || data === null) + throw new clipanion__WEBPACK_IMPORTED_MODULE_4__.UsageError(`Invalid package.json in ${path__WEBPACK_IMPORTED_MODULE_1___default().relative(initialCwd, manifestPath)}`); + selection = { data, manifestPath }; + } + if (selection === null) + return { type: `NoProject`, target: path__WEBPACK_IMPORTED_MODULE_1___default().join(initialCwd, `package.json`) }; + const rawPmSpec = selection.data.packageManager; + if (typeof rawPmSpec === `undefined`) + return { type: `NoSpec`, target: selection.manifestPath }; + return { + type: `Found`, + spec: parseSpec(rawPmSpec, path__WEBPACK_IMPORTED_MODULE_1___default().relative(initialCwd, selection.manifestPath)), + }; +} + + +/***/ }), + +/***/ "./sources/types.ts": +/*!**************************!*\ + !*** ./sources/types.ts ***! + \**************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "SupportedPackageManagers": () => (/* binding */ SupportedPackageManagers), +/* harmony export */ "SupportedPackageManagerSet": () => (/* binding */ SupportedPackageManagerSet), +/* harmony export */ "SupportedPackageManagerSetWithoutNpm": () => (/* binding */ SupportedPackageManagerSetWithoutNpm), +/* harmony export */ "isSupportedPackageManager": () => (/* binding */ isSupportedPackageManager) +/* harmony export */ }); +var SupportedPackageManagers; +(function (SupportedPackageManagers) { + SupportedPackageManagers["Npm"] = "npm"; + SupportedPackageManagers["Pnpm"] = "pnpm"; + SupportedPackageManagers["Yarn"] = "yarn"; +})(SupportedPackageManagers || (SupportedPackageManagers = {})); +const SupportedPackageManagerSet = new Set(Object.values(SupportedPackageManagers)); +const SupportedPackageManagerSetWithoutNpm = new Set(Object.values(SupportedPackageManagers)); +// npm is distributed with Node as a builtin; we don't want Corepack to override it unless the npm team is on board +SupportedPackageManagerSetWithoutNpm.delete(SupportedPackageManagers.Npm); +function isSupportedPackageManager(value) { + return SupportedPackageManagerSet.has(value); +} + + +/***/ }), + +/***/ "./.yarn/cache/@zkochan-cmd-shim-npm-5.0.0-9e90407ba0-ace99c7c36.zip/node_modules/@zkochan/cmd-shim/index.js": +/*!*******************************************************************************************************************!*\ + !*** ./.yarn/cache/@zkochan-cmd-shim-npm-5.0.0-9e90407ba0-ace99c7c36.zip/node_modules/@zkochan/cmd-shim/index.js ***! + \*******************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +cmdShim.ifExists = cmdShimIfExists; +const util_1 = __webpack_require__(/*! util */ "util"); +const path = __webpack_require__(/*! path */ "path"); +const isWindows = __webpack_require__(/*! is-windows */ "./.yarn/cache/is-windows-npm-1.0.2-898cd6f3d7-438b7e5265.zip/node_modules/is-windows/index.js"); +const shebangExpr = /^#!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/; +const DEFAULT_OPTIONS = { + // Create PowerShell file by default if the option hasn't been specified + createPwshFile: true, + createCmdFile: isWindows(), + fs: __webpack_require__(/*! fs */ "fs") +}; +/** + * Map from extensions of files that this module is frequently used for to their runtime. + * @type {Map} + */ +const extensionToProgramMap = new Map([ + ['.js', 'node'], + ['.cmd', 'cmd'], + ['.bat', 'cmd'], + ['.ps1', 'pwsh'], + ['.sh', 'sh'] +]); +function ingestOptions(opts) { + const opts_ = { ...DEFAULT_OPTIONS, ...opts }; + const fs = opts_.fs; + opts_.fs_ = { + chmod: fs.chmod ? util_1.promisify(fs.chmod) : (async () => { }), + mkdir: util_1.promisify(fs.mkdir), + readFile: util_1.promisify(fs.readFile), + stat: util_1.promisify(fs.stat), + unlink: util_1.promisify(fs.unlink), + writeFile: util_1.promisify(fs.writeFile) + }; + return opts_; +} +/** + * Try to create shims. + * + * @param src Path to program (executable or script). + * @param to Path to shims. + * Don't add an extension if you will create multiple types of shims. + * @param opts Options. + * @throws If `src` is missing. + */ +async function cmdShim(src, to, opts) { + const opts_ = ingestOptions(opts); + await opts_.fs_.stat(src); + await cmdShim_(src, to, opts_); +} +/** + * Try to create shims. + * + * Does nothing if `src` doesn't exist. + * + * @param src Path to program (executable or script). + * @param to Path to shims. + * Don't add an extension if you will create multiple types of shims. + * @param opts Options. + */ +function cmdShimIfExists(src, to, opts) { + return cmdShim(src, to, opts).catch(() => { }); +} +/** + * Try to unlink, but ignore errors. + * Any problems will surface later. + * + * @param path File to be removed. + */ +function rm(path, opts) { + return opts.fs_.unlink(path).catch(() => { }); +} +/** + * Try to create shims **even if `src` is missing**. + * + * @param src Path to program (executable or script). + * @param to Path to shims. + * Don't add an extension if you will create multiple types of shims. + * @param opts Options. + */ +async function cmdShim_(src, to, opts) { + const srcRuntimeInfo = await searchScriptRuntime(src, opts); + // Always tries to create all types of shims by calling `writeAllShims` as of now. + // Append your code here to change the behavior in response to `srcRuntimeInfo`. + // Create 3 shims for (Ba)sh in Cygwin / MSYS, no extension) & CMD (.cmd) & PowerShell (.ps1) + await writeShimsPreCommon(to, opts); + return writeAllShims(src, to, srcRuntimeInfo, opts); +} +/** + * Do processes before **all** shims are created. + * This must be called **only once** for one call of `cmdShim(IfExists)`. + * + * @param target Path of shims that are going to be created. + */ +function writeShimsPreCommon(target, opts) { + return opts.fs_.mkdir(path.dirname(target), { recursive: true }); +} +/** + * Write all types (sh & cmd & pwsh) of shims to files. + * Extensions (`.cmd` and `.ps1`) are appended to cmd and pwsh shims. + * + * + * @param src Path to program (executable or script). + * @param to Path to shims **without extensions**. + * Extensions are added for CMD and PowerShell shims. + * @param srcRuntimeInfo Return value of `await searchScriptRuntime(src)`. + * @param opts Options. + */ +function writeAllShims(src, to, srcRuntimeInfo, opts) { + const opts_ = ingestOptions(opts); + const generatorAndExts = [{ generator: generateShShim, extension: '' }]; + if (opts_.createCmdFile) { + generatorAndExts.push({ generator: generateCmdShim, extension: '.cmd' }); + } + if (opts_.createPwshFile) { + generatorAndExts.push({ generator: generatePwshShim, extension: '.ps1' }); + } + return Promise.all(generatorAndExts.map((generatorAndExt) => writeShim(src, to + generatorAndExt.extension, srcRuntimeInfo, generatorAndExt.generator, opts_))); +} +/** + * Do processes before writing shim. + * + * @param target Path to shim that is going to be created. + */ +function writeShimPre(target, opts) { + return rm(target, opts); +} +/** + * Do processes after writing the shim. + * + * @param target Path to just created shim. + */ +function writeShimPost(target, opts) { + // Only chmoding shims as of now. + // Some other processes may be appended. + return chmodShim(target, opts); +} +/** + * Look into runtime (e.g. `node` & `sh` & `pwsh`) and its arguments + * of the target program (script or executable). + * + * @param target Path to the executable or script. + * @return Promise of infomation of runtime of `target`. + */ +async function searchScriptRuntime(target, opts) { + const data = await opts.fs_.readFile(target, 'utf8'); + // First, check if the bin is a #! of some sort. + const firstLine = data.trim().split(/\r*\n/)[0]; + const shebang = firstLine.match(shebangExpr); + if (!shebang) { + // If not, infer script type from its extension. + // If the inference fails, it's something that'll be compiled, or some other + // sort of script, and just call it directly. + const targetExtension = path.extname(target).toLowerCase(); + return { + // undefined if extension is unknown but it's converted to null. + program: extensionToProgramMap.get(targetExtension) || null, + additionalArgs: '' + }; + } + return { + program: shebang[1], + additionalArgs: shebang[2] + }; +} +/** + * Write shim to the file system while executing the pre- and post-processes + * defined in `WriteShimPre` and `WriteShimPost`. + * + * @param src Path to the executable or script. + * @param to Path to the (sh) shim(s) that is going to be created. + * @param srcRuntimeInfo Result of `await searchScriptRuntime(src)`. + * @param generateShimScript Generator of shim script. + * @param opts Other options. + */ +async function writeShim(src, to, srcRuntimeInfo, generateShimScript, opts) { + const defaultArgs = opts.preserveSymlinks ? '--preserve-symlinks' : ''; + // `Array.prototype.filter` removes ''. + // ['--foo', '--bar'].join(' ') and [].join(' ') returns '--foo --bar' and '' respectively. + const args = [srcRuntimeInfo.additionalArgs, defaultArgs].filter(arg => arg).join(' '); + opts = Object.assign({}, opts, { + prog: srcRuntimeInfo.program, + args: args + }); + await writeShimPre(to, opts); + await opts.fs_.writeFile(to, generateShimScript(src, to, opts), 'utf8'); + return writeShimPost(to, opts); +} +/** + * Generate the content of a shim for CMD. + * + * @param src Path to the executable or script. + * @param to Path to the shim to be created. + * It is highly recommended to end with `.cmd` (or `.bat`). + * @param opts Options. + * @return The content of shim. + */ +function generateCmdShim(src, to, opts) { + // `shTarget` is not used to generate the content. + const shTarget = path.relative(path.dirname(to), src); + let target = shTarget.split('/').join('\\'); + const quotedPathToTarget = path.isAbsolute(target) ? `"${target}"` : `"%~dp0\\${target}"`; + let longProg; + let prog = opts.prog; + let args = opts.args || ''; + const nodePath = normalizePathEnvVar(opts.nodePath).win32; + if (!prog) { + prog = quotedPathToTarget; + args = ''; + target = ''; + } + else { + longProg = `"%~dp0\\${prog}.exe"`; + target = quotedPathToTarget; + } + let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : ''; + // @IF EXIST "%~dp0\node.exe" ( + // "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* + // ) ELSE ( + // SETLOCAL + // SET PATHEXT=%PATHEXT:;.JS;=;% + // node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* + // ) + let cmd = nodePath ? `@SET NODE_PATH=${nodePath}\r\n` : ''; + if (longProg) { + cmd += `@IF EXIST ${longProg} (\r\n` + + ` ${longProg} ${args} ${target} ${progArgs}%*\r\n` + + ') ELSE (\r\n' + + ' @SETLOCAL\r\n' + + ' @SET PATHEXT=%PATHEXT:;.JS;=;%\r\n' + + ` ${prog} ${args} ${target} ${progArgs}%*\r\n` + + ')'; + } + else { + cmd += `@${prog} ${args} ${target} ${progArgs}%*\r\n`; + } + return cmd; +} +/** + * Generate the content of a shim for (Ba)sh in, for example, Cygwin and MSYS(2). + * + * @param src Path to the executable or script. + * @param to Path to the shim to be created. + * It is highly recommended to end with `.sh` or to contain no extension. + * @param opts Options. + * @return The content of shim. + */ +function generateShShim(src, to, opts) { + let shTarget = path.relative(path.dirname(to), src); + let shProg = opts.prog && opts.prog.split('\\').join('/'); + let shLongProg; + shTarget = shTarget.split('\\').join('/'); + const quotedPathToTarget = path.isAbsolute(shTarget) ? `"${shTarget}"` : `"$basedir/${shTarget}"`; + let args = opts.args || ''; + const shNodePath = normalizePathEnvVar(opts.nodePath).posix; + if (!shProg) { + shProg = quotedPathToTarget; + args = ''; + shTarget = ''; + } + else { + shLongProg = `"$basedir/${opts.prog}"`; + shTarget = quotedPathToTarget; + } + let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : ''; + // #!/bin/sh + // basedir=`dirname "$0"` + // + // case `uname` in + // *CYGWIN*) basedir=`cygpath -w "$basedir"`;; + // esac + // + // export NODE_PATH="" + // + // if [ -x "$basedir/node.exe" ]; then + // exec "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@" + // else + // exec node "$basedir/node_modules/npm/bin/npm-cli.js" "$@" + // fi + let sh = '#!/bin/sh\n'; + sh = sh + + "basedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\,/,g')\")\n" + + '\n' + + 'case `uname` in\n' + + ' *CYGWIN*) basedir=`cygpath -w "$basedir"`;;\n' + + 'esac\n' + + '\n'; + const env = opts.nodePath ? `export NODE_PATH="${shNodePath}"\n` : ''; + if (shLongProg) { + sh += env + + `if [ -x ${shLongProg} ]; then\n` + + ` exec ${shLongProg} ${args} ${shTarget} ${progArgs}"$@"\n` + + 'else \n' + + ` exec ${shProg} ${args} ${shTarget} ${progArgs}"$@"\n` + + 'fi\n'; + } + else { + sh += `${env}${shProg} ${args} ${shTarget} ${progArgs}"$@"\n` + + 'exit $?\n'; + } + return sh; +} +/** + * Generate the content of a shim for PowerShell. + * + * @param src Path to the executable or script. + * @param to Path to the shim to be created. + * It is highly recommended to end with `.ps1`. + * @param opts Options. + * @return The content of shim. + */ +function generatePwshShim(src, to, opts) { + let shTarget = path.relative(path.dirname(to), src); + const shProg = opts.prog && opts.prog.split('\\').join('/'); + let pwshProg = shProg && `"${shProg}$exe"`; + let pwshLongProg; + shTarget = shTarget.split('\\').join('/'); + const quotedPathToTarget = path.isAbsolute(shTarget) ? `"${shTarget}"` : `"$basedir/${shTarget}"`; + let args = opts.args || ''; + let normalizedPathEnvVar = normalizePathEnvVar(opts.nodePath); + const nodePath = normalizedPathEnvVar.win32; + const shNodePath = normalizedPathEnvVar.posix; + if (!pwshProg) { + pwshProg = quotedPathToTarget; + args = ''; + shTarget = ''; + } + else { + pwshLongProg = `"$basedir/${opts.prog}$exe"`; + shTarget = quotedPathToTarget; + } + let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : ''; + // #!/usr/bin/env pwsh + // $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + // + // $ret=0 + // $exe = "" + // if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + // # Fix case when both the Windows and Linux builds of Node + // # are installed in the same directory + // $exe = ".exe" + // } + // if (Test-Path "$basedir/node") { + // # Support pipeline input + // if ($MyInvocation.ExpectingInput) { + // $input | & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } else { + // & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } + // $ret=$LASTEXITCODE + // } else { + // # Support pipeline input + // if ($MyInvocation.ExpectingInput) { + // $input | & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } else { + // & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } + // $ret=$LASTEXITCODE + // } + // exit $ret + let pwsh = '#!/usr/bin/env pwsh\n' + + '$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent\n' + + '\n' + + '$exe=""\n' + + (opts.nodePath ? '$env_node_path=$env:NODE_PATH\n' + + `$env:NODE_PATH="${nodePath}"\n` : '') + + 'if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {\n' + + ' # Fix case when both the Windows and Linux builds of Node\n' + + ' # are installed in the same directory\n' + + ' $exe=".exe"\n' + + '}'; + if (opts.nodePath) { + pwsh = pwsh + + ' else {\n' + + ` $env:NODE_PATH="${shNodePath}"\n` + + '}'; + } + pwsh += '\n'; + if (pwshLongProg) { + pwsh = pwsh + + '$ret=0\n' + + `if (Test-Path ${pwshLongProg}) {\n` + + ' # Support pipeline input\n' + + ' if ($MyInvocation.ExpectingInput) {\n' + + ` $input | & ${pwshLongProg} ${args} ${shTarget} ${progArgs}$args\n` + + ' } else {\n' + + ` & ${pwshLongProg} ${args} ${shTarget} ${progArgs}$args\n` + + ' }\n' + + ' $ret=$LASTEXITCODE\n' + + '} else {\n' + + ' # Support pipeline input\n' + + ' if ($MyInvocation.ExpectingInput) {\n' + + ` $input | & ${pwshProg} ${args} ${shTarget} ${progArgs}$args\n` + + ' } else {\n' + + ` & ${pwshProg} ${args} ${shTarget} ${progArgs}$args\n` + + ' }\n' + + ' $ret=$LASTEXITCODE\n' + + '}\n' + + (opts.nodePath ? '$env:NODE_PATH=$env_node_path\n' : '') + + 'exit $ret\n'; + } + else { + pwsh = pwsh + + '# Support pipeline input\n' + + 'if ($MyInvocation.ExpectingInput) {\n' + + ` $input | & ${pwshProg} ${args} ${shTarget} ${progArgs}$args\n` + + '} else {\n' + + ` & ${pwshProg} ${args} ${shTarget} ${progArgs}$args\n` + + '}\n' + + (opts.nodePath ? '$env:NODE_PATH=$env_node_path\n' : '') + + 'exit $LASTEXITCODE\n'; + } + return pwsh; +} +/** + * Chmod just created shim and make it executable + * + * @param to Path to shim. + */ +function chmodShim(to, opts) { + return opts.fs_.chmod(to, 0o755); +} +function normalizePathEnvVar(nodePath) { + if (!nodePath) { + return { + win32: '', + posix: '' + }; + } + let split = (typeof nodePath === 'string' ? nodePath.split(path.delimiter) : Array.from(nodePath)); + let result = {}; + for (let i = 0; i < split.length; i++) { + const win32 = split[i].split('/').join('\\'); + const posix = isWindows() ? split[i].split('\\').join('/').replace(/^([^:\\/]*):/, (_, $1) => `/mnt/${$1.toLowerCase()}`) : split[i]; + result.win32 = result.win32 ? `${result.win32};${win32}` : win32; + result.posix = result.posix ? `${result.posix}:${posix}` : posix; + result[i] = { win32, posix }; + } + return result; +} +module.exports = cmdShim; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ "./.yarn/cache/chownr-npm-1.1.4-5bd400ab08-115648f8eb.zip/node_modules/chownr/chownr.js": +/*!**********************************************************************************************!*\ + !*** ./.yarn/cache/chownr-npm-1.1.4-5bd400ab08-115648f8eb.zip/node_modules/chownr/chownr.js ***! + \**********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const fs = __webpack_require__(/*! fs */ "fs") +const path = __webpack_require__(/*! path */ "path") + +/* istanbul ignore next */ +const LCHOWN = fs.lchown ? 'lchown' : 'chown' +/* istanbul ignore next */ +const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync' + +/* istanbul ignore next */ +const needEISDIRHandled = fs.lchown && + !process.version.match(/v1[1-9]+\./) && + !process.version.match(/v10\.[6-9]/) + +const lchownSync = (path, uid, gid) => { + try { + return fs[LCHOWNSYNC](path, uid, gid) + } catch (er) { + if (er.code !== 'ENOENT') + throw er + } +} + +/* istanbul ignore next */ +const chownSync = (path, uid, gid) => { + try { + return fs.chownSync(path, uid, gid) + } catch (er) { + if (er.code !== 'ENOENT') + throw er + } +} + +/* istanbul ignore next */ +const handleEISDIR = + needEISDIRHandled ? (path, uid, gid, cb) => er => { + // Node prior to v10 had a very questionable implementation of + // fs.lchown, which would always try to call fs.open on a directory + // Fall back to fs.chown in those cases. + if (!er || er.code !== 'EISDIR') + cb(er) + else + fs.chown(path, uid, gid, cb) + } + : (_, __, ___, cb) => cb + +/* istanbul ignore next */ +const handleEISDirSync = + needEISDIRHandled ? (path, uid, gid) => { + try { + return lchownSync(path, uid, gid) + } catch (er) { + if (er.code !== 'EISDIR') + throw er + chownSync(path, uid, gid) + } + } + : (path, uid, gid) => lchownSync(path, uid, gid) + +// fs.readdir could only accept an options object as of node v6 +const nodeVersion = process.version +let readdir = (path, options, cb) => fs.readdir(path, options, cb) +let readdirSync = (path, options) => fs.readdirSync(path, options) +/* istanbul ignore next */ +if (/^v4\./.test(nodeVersion)) + readdir = (path, options, cb) => fs.readdir(path, cb) + +const chown = (cpath, uid, gid, cb) => { + fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => { + // Skip ENOENT error + cb(er && er.code !== 'ENOENT' ? er : null) + })) +} + +const chownrKid = (p, child, uid, gid, cb) => { + if (typeof child === 'string') + return fs.lstat(path.resolve(p, child), (er, stats) => { + // Skip ENOENT error + if (er) + return cb(er.code !== 'ENOENT' ? er : null) + stats.name = child + chownrKid(p, stats, uid, gid, cb) + }) + + if (child.isDirectory()) { + chownr(path.resolve(p, child.name), uid, gid, er => { + if (er) + return cb(er) + const cpath = path.resolve(p, child.name) + chown(cpath, uid, gid, cb) + }) + } else { + const cpath = path.resolve(p, child.name) + chown(cpath, uid, gid, cb) + } +} + + +const chownr = (p, uid, gid, cb) => { + readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er) { + if (er.code === 'ENOENT') + return cb() + else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er) + } + if (er || !children.length) + return chown(p, uid, gid, cb) + + let len = children.length + let errState = null + const then = er => { + if (errState) + return + if (er) + return cb(errState = er) + if (-- len === 0) + return chown(p, uid, gid, cb) + } + + children.forEach(child => chownrKid(p, child, uid, gid, then)) + }) +} + +const chownrKidSync = (p, child, uid, gid) => { + if (typeof child === 'string') { + try { + const stats = fs.lstatSync(path.resolve(p, child)) + stats.name = child + child = stats + } catch (er) { + if (er.code === 'ENOENT') + return + else + throw er + } + } + + if (child.isDirectory()) + chownrSync(path.resolve(p, child.name), uid, gid) + + handleEISDirSync(path.resolve(p, child.name), uid, gid) +} + +const chownrSync = (p, uid, gid) => { + let children + try { + children = readdirSync(p, { withFileTypes: true }) + } catch (er) { + if (er.code === 'ENOENT') + return + else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP') + return handleEISDirSync(p, uid, gid) + else + throw er + } + + if (children && children.length) + children.forEach(child => chownrKidSync(p, child, uid, gid)) + + return handleEISDirSync(p, uid, gid) +} + +module.exports = chownr +chownr.sync = chownrSync + + +/***/ }), + +/***/ "./.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip/node_modules/fs-minipass/index.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip/node_modules/fs-minipass/index.js ***! + \*******************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +const MiniPass = __webpack_require__(/*! minipass */ "./.yarn/cache/minipass-npm-3.1.1-b51d7e264d-cfcfd86adc.zip/node_modules/minipass/index.js") +const EE = __webpack_require__(/*! events */ "events").EventEmitter +const fs = __webpack_require__(/*! fs */ "fs") + +let writev = fs.writev +/* istanbul ignore next */ +if (!writev) { + // This entire block can be removed if support for earlier than Node.js + // 12.9.0 is not needed. + const binding = process.binding('fs') + const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback + + writev = (fd, iovec, pos, cb) => { + const done = (er, bw) => cb(er, bw, iovec) + const req = new FSReqWrap() + req.oncomplete = done + binding.writeBuffers(fd, iovec, pos, req) + } +} + +const _autoClose = Symbol('_autoClose') +const _close = Symbol('_close') +const _ended = Symbol('_ended') +const _fd = Symbol('_fd') +const _finished = Symbol('_finished') +const _flags = Symbol('_flags') +const _flush = Symbol('_flush') +const _handleChunk = Symbol('_handleChunk') +const _makeBuf = Symbol('_makeBuf') +const _mode = Symbol('_mode') +const _needDrain = Symbol('_needDrain') +const _onerror = Symbol('_onerror') +const _onopen = Symbol('_onopen') +const _onread = Symbol('_onread') +const _onwrite = Symbol('_onwrite') +const _open = Symbol('_open') +const _path = Symbol('_path') +const _pos = Symbol('_pos') +const _queue = Symbol('_queue') +const _read = Symbol('_read') +const _readSize = Symbol('_readSize') +const _reading = Symbol('_reading') +const _remain = Symbol('_remain') +const _size = Symbol('_size') +const _write = Symbol('_write') +const _writing = Symbol('_writing') +const _defaultFlag = Symbol('_defaultFlag') +const _errored = Symbol('_errored') + +class ReadStream extends MiniPass { + constructor (path, opt) { + opt = opt || {} + super(opt) + + this.readable = true + this.writable = false + + if (typeof path !== 'string') + throw new TypeError('path must be a string') + + this[_errored] = false + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_path] = path + this[_readSize] = opt.readSize || 16*1024*1024 + this[_reading] = false + this[_size] = typeof opt.size === 'number' ? opt.size : Infinity + this[_remain] = this[_size] + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + if (typeof this[_fd] === 'number') + this[_read]() + else + this[_open]() + } + + get fd () { return this[_fd] } + get path () { return this[_path] } + + write () { + throw new TypeError('this is a readable stream') + } + + end () { + throw new TypeError('this is a readable stream') + } + + [_open] () { + fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (er) + this[_onerror](er) + else { + this[_fd] = fd + this.emit('open', fd) + this[_read]() + } + } + + [_makeBuf] () { + return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])) + } + + [_read] () { + if (!this[_reading]) { + this[_reading] = true + const buf = this[_makeBuf]() + /* istanbul ignore if */ + if (buf.length === 0) + return process.nextTick(() => this[_onread](null, 0, buf)) + fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) => + this[_onread](er, br, buf)) + } + } + + [_onread] (er, br, buf) { + this[_reading] = false + if (er) + this[_onerror](er) + else if (this[_handleChunk](br, buf)) + this[_read]() + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) + } + } + + [_onerror] (er) { + this[_reading] = true + this[_close]() + this.emit('error', er) + } + + [_handleChunk] (br, buf) { + let ret = false + // no effect if infinite + this[_remain] -= br + if (br > 0) + ret = super.write(br < buf.length ? buf.slice(0, br) : buf) + + if (br === 0 || this[_remain] <= 0) { + ret = false + this[_close]() + super.end() + } + + return ret + } + + emit (ev, data) { + switch (ev) { + case 'prefinish': + case 'finish': + break + + case 'drain': + if (typeof this[_fd] === 'number') + this[_read]() + break + + case 'error': + if (this[_errored]) + return + this[_errored] = true + return super.emit(ev, data) + + default: + return super.emit(ev, data) + } + } +} + +class ReadStreamSync extends ReadStream { + [_open] () { + let threw = true + try { + this[_onopen](null, fs.openSync(this[_path], 'r')) + threw = false + } finally { + if (threw) + this[_close]() + } + } + + [_read] () { + let threw = true + try { + if (!this[_reading]) { + this[_reading] = true + do { + const buf = this[_makeBuf]() + /* istanbul ignore next */ + const br = buf.length === 0 ? 0 + : fs.readSync(this[_fd], buf, 0, buf.length, null) + if (!this[_handleChunk](br, buf)) + break + } while (true) + this[_reading] = false + } + threw = false + } finally { + if (threw) + this[_close]() + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.closeSync(fd) + this.emit('close') + } + } +} + +class WriteStream extends EE { + constructor (path, opt) { + opt = opt || {} + super(opt) + this.readable = false + this.writable = true + this[_errored] = false + this[_writing] = false + this[_ended] = false + this[_needDrain] = false + this[_queue] = [] + this[_path] = path + this[_fd] = typeof opt.fd === 'number' ? opt.fd : null + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode + this[_pos] = typeof opt.start === 'number' ? opt.start : null + this[_autoClose] = typeof opt.autoClose === 'boolean' ? + opt.autoClose : true + + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== null ? 'r+' : 'w' + this[_defaultFlag] = opt.flags === undefined + this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags + + if (this[_fd] === null) + this[_open]() + } + + emit (ev, data) { + if (ev === 'error') { + if (this[_errored]) + return + this[_errored] = true + } + return super.emit(ev, data) + } + + + get fd () { return this[_fd] } + get path () { return this[_path] } + + [_onerror] (er) { + this[_close]() + this[_writing] = true + this.emit('error', er) + } + + [_open] () { + fs.open(this[_path], this[_flags], this[_mode], + (er, fd) => this[_onopen](er, fd)) + } + + [_onopen] (er, fd) { + if (this[_defaultFlag] && + this[_flags] === 'r+' && + er && er.code === 'ENOENT') { + this[_flags] = 'w' + this[_open]() + } else if (er) + this[_onerror](er) + else { + this[_fd] = fd + this.emit('open', fd) + this[_flush]() + } + } + + end (buf, enc) { + if (buf) + this.write(buf, enc) + + this[_ended] = true + + // synthetic after-write logic, where drain/finish live + if (!this[_writing] && !this[_queue].length && + typeof this[_fd] === 'number') + this[_onwrite](null, 0) + return this + } + + write (buf, enc) { + if (typeof buf === 'string') + buf = Buffer.from(buf, enc) + + if (this[_ended]) { + this.emit('error', new Error('write() after end()')) + return false + } + + if (this[_fd] === null || this[_writing] || this[_queue].length) { + this[_queue].push(buf) + this[_needDrain] = true + return false + } + + this[_writing] = true + this[_write](buf) + return true + } + + [_write] (buf) { + fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => + this[_onwrite](er, bw)) + } + + [_onwrite] (er, bw) { + if (er) + this[_onerror](er) + else { + if (this[_pos] !== null) + this[_pos] += bw + if (this[_queue].length) + this[_flush]() + else { + this[_writing] = false + + if (this[_ended] && !this[_finished]) { + this[_finished] = true + this[_close]() + this.emit('finish') + } else if (this[_needDrain]) { + this[_needDrain] = false + this.emit('drain') + } + } + } + } + + [_flush] () { + if (this[_queue].length === 0) { + if (this[_ended]) + this[_onwrite](null, 0) + } else if (this[_queue].length === 1) + this[_write](this[_queue].pop()) + else { + const iovec = this[_queue] + this[_queue] = [] + writev(this[_fd], iovec, this[_pos], + (er, bw) => this[_onwrite](er, bw)) + } + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) + } + } +} + +class WriteStreamSync extends WriteStream { + [_open] () { + let fd + // only wrap in a try{} block if we know we'll retry, to avoid + // the rethrow obscuring the error's source frame in most cases. + if (this[_defaultFlag] && this[_flags] === 'r+') { + try { + fd = fs.openSync(this[_path], this[_flags], this[_mode]) + } catch (er) { + if (er.code === 'ENOENT') { + this[_flags] = 'w' + return this[_open]() + } else + throw er + } + } else + fd = fs.openSync(this[_path], this[_flags], this[_mode]) + + this[_onopen](null, fd) + } + + [_close] () { + if (this[_autoClose] && typeof this[_fd] === 'number') { + const fd = this[_fd] + this[_fd] = null + fs.closeSync(fd) + this.emit('close') + } + } + + [_write] (buf) { + // throw the original, but try to close if it fails + let threw = true + try { + this[_onwrite](null, + fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])) + threw = false + } finally { + if (threw) + try { this[_close]() } catch (_) {} + } + } +} + +exports.ReadStream = ReadStream +exports.ReadStreamSync = ReadStreamSync + +exports.WriteStream = WriteStream +exports.WriteStreamSync = WriteStreamSync + + +/***/ }), + +/***/ "./.yarn/cache/has-flag-npm-4.0.0-32af9f0536-261a135703.zip/node_modules/has-flag/index.js": +/*!*************************************************************************************************!*\ + !*** ./.yarn/cache/has-flag-npm-4.0.0-32af9f0536-261a135703.zip/node_modules/has-flag/index.js ***! + \*************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +module.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +}; + + +/***/ }), + +/***/ "./.yarn/cache/is-windows-npm-1.0.2-898cd6f3d7-438b7e5265.zip/node_modules/is-windows/index.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/is-windows-npm-1.0.2-898cd6f3d7-438b7e5265.zip/node_modules/is-windows/index.js ***! + \*****************************************************************************************************/ +/***/ ((module, exports) => { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + * is-windows + * + * Copyright © 2015-2018, Jon Schlinkert. + * Released under the MIT License. + */ + +(function(factory) { + if (exports && typeof exports === 'object' && "object" !== 'undefined') { + module.exports = factory(); + } else if (true) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} +})(function() { + 'use strict'; + return function isWindows() { + return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)); + }; +}); + + +/***/ }), + +/***/ "./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/index.js": +/*!*******************************************************************************************!*\ + !*** ./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/index.js ***! + \*******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var fs = __webpack_require__(/*! fs */ "fs") +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = __webpack_require__(/*! ./windows.js */ "./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/windows.js") +} else { + core = __webpack_require__(/*! ./mode.js */ "./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/mode.js") +} + +module.exports = isexe +isexe.sync = sync + +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') + } + + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } + }) + }) + } + + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) + }) +} + +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } + } +} + + +/***/ }), + +/***/ "./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/mode.js": +/*!******************************************************************************************!*\ + !*** ./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/mode.js ***! + \******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = isexe +isexe.sync = sync + +var fs = __webpack_require__(/*! fs */ "fs") + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), options) +} + +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) +} + +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid + + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() + + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g + + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 + + return ret +} + + +/***/ }), + +/***/ "./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/windows.js": +/*!*********************************************************************************************!*\ + !*** ./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/windows.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = isexe +isexe.sync = sync + +var fs = __webpack_require__(/*! fs */ "fs") + +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } + } + return false +} + +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) +} + + +/***/ }), + +/***/ "./.yarn/cache/minipass-npm-3.1.1-b51d7e264d-cfcfd86adc.zip/node_modules/minipass/index.js": +/*!*************************************************************************************************!*\ + !*** ./.yarn/cache/minipass-npm-3.1.1-b51d7e264d-cfcfd86adc.zip/node_modules/minipass/index.js ***! + \*************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const EE = __webpack_require__(/*! events */ "events") +const Stream = __webpack_require__(/*! stream */ "stream") +const Yallist = __webpack_require__(/*! yallist */ "./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/yallist.js") +const SD = __webpack_require__(/*! string_decoder */ "string_decoder").StringDecoder + +const EOF = Symbol('EOF') +const MAYBE_EMIT_END = Symbol('maybeEmitEnd') +const EMITTED_END = Symbol('emittedEnd') +const EMITTING_END = Symbol('emittingEnd') +const CLOSED = Symbol('closed') +const READ = Symbol('read') +const FLUSH = Symbol('flush') +const FLUSHCHUNK = Symbol('flushChunk') +const ENCODING = Symbol('encoding') +const DECODER = Symbol('decoder') +const FLOWING = Symbol('flowing') +const PAUSED = Symbol('paused') +const RESUME = Symbol('resume') +const BUFFERLENGTH = Symbol('bufferLength') +const BUFFERPUSH = Symbol('bufferPush') +const BUFFERSHIFT = Symbol('bufferShift') +const OBJECTMODE = Symbol('objectMode') +const DESTROYED = Symbol('destroyed') + +// TODO remove when Node v8 support drops +const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' +const ASYNCITERATOR = doIter && Symbol.asyncIterator + || Symbol('asyncIterator not implemented') +const ITERATOR = doIter && Symbol.iterator + || Symbol('iterator not implemented') + +// events that mean 'the stream is over' +// these are treated specially, and re-emitted +// if they are listened for after emitting. +const isEndish = ev => + ev === 'end' || + ev === 'finish' || + ev === 'prefinish' + +const isArrayBuffer = b => b instanceof ArrayBuffer || + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0 + +const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b) + +module.exports = class Minipass extends Stream { + constructor (options) { + super() + this[FLOWING] = false + // whether we're explicitly paused + this[PAUSED] = false + this.pipes = new Yallist() + this.buffer = new Yallist() + this[OBJECTMODE] = options && options.objectMode || false + if (this[OBJECTMODE]) + this[ENCODING] = null + else + this[ENCODING] = options && options.encoding || null + if (this[ENCODING] === 'buffer') + this[ENCODING] = null + this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null + this[EOF] = false + this[EMITTED_END] = false + this[EMITTING_END] = false + this[CLOSED] = false + this.writable = true + this.readable = true + this[BUFFERLENGTH] = 0 + this[DESTROYED] = false + } + + get bufferLength () { return this[BUFFERLENGTH] } + + get encoding () { return this[ENCODING] } + set encoding (enc) { + if (this[OBJECTMODE]) + throw new Error('cannot set encoding in objectMode') + + if (this[ENCODING] && enc !== this[ENCODING] && + (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH])) + throw new Error('cannot change encoding') + + if (this[ENCODING] !== enc) { + this[DECODER] = enc ? new SD(enc) : null + if (this.buffer.length) + this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk)) + } + + this[ENCODING] = enc + } + + setEncoding (enc) { + this.encoding = enc + } + + get objectMode () { return this[OBJECTMODE] } + set objectMode (ॐ ) { this[OBJECTMODE] = this[OBJECTMODE] || !!ॐ } + + write (chunk, encoding, cb) { + if (this[EOF]) + throw new Error('write after end') + + if (this[DESTROYED]) { + this.emit('error', Object.assign( + new Error('Cannot call write after a stream was destroyed'), + { code: 'ERR_STREAM_DESTROYED' } + )) + return true + } + + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + + if (!encoding) + encoding = 'utf8' + + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything else switches us into object mode + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) + else if (isArrayBuffer(chunk)) + chunk = Buffer.from(chunk) + else if (typeof chunk !== 'string') + // use the setter so we throw if we have encoding set + this.objectMode = true + } + + // this ensures at this point that the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!this.objectMode && !chunk.length) { + const ret = this.flowing + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') + if (cb) + cb() + return ret + } + + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && !this[OBJECTMODE] && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) { + chunk = Buffer.from(chunk, encoding) + } + + if (Buffer.isBuffer(chunk) && this[ENCODING]) + chunk = this[DECODER].write(chunk) + + try { + return this.flowing + ? (this.emit('data', chunk), this.flowing) + : (this[BUFFERPUSH](chunk), false) + } finally { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') + if (cb) + cb() + } + } + + read (n) { + if (this[DESTROYED]) + return null + + try { + if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) + return null + + if (this[OBJECTMODE]) + n = null + + if (this.buffer.length > 1 && !this[OBJECTMODE]) { + if (this.encoding) + this.buffer = new Yallist([ + Array.from(this.buffer).join('') + ]) + else + this.buffer = new Yallist([ + Buffer.concat(Array.from(this.buffer), this[BUFFERLENGTH]) + ]) + } + + return this[READ](n || null, this.buffer.head.value) + } finally { + this[MAYBE_EMIT_END]() + } + } + + [READ] (n, chunk) { + if (n === chunk.length || n === null) + this[BUFFERSHIFT]() + else { + this.buffer.head.value = chunk.slice(n) + chunk = chunk.slice(0, n) + this[BUFFERLENGTH] -= n + } + + this.emit('data', chunk) + + if (!this.buffer.length && !this[EOF]) + this.emit('drain') + + return chunk + } + + end (chunk, encoding, cb) { + if (typeof chunk === 'function') + cb = chunk, chunk = null + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + if (chunk) + this.write(chunk, encoding) + if (cb) + this.once('end', cb) + this[EOF] = true + this.writable = false + + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this.flowing || !this[PAUSED]) + this[MAYBE_EMIT_END]() + return this + } + + // don't let the internal resume be overwritten + [RESUME] () { + if (this[DESTROYED]) + return + + this[PAUSED] = false + this[FLOWING] = true + this.emit('resume') + if (this.buffer.length) + this[FLUSH]() + else if (this[EOF]) + this[MAYBE_EMIT_END]() + else + this.emit('drain') + } + + resume () { + return this[RESUME]() + } + + pause () { + this[FLOWING] = false + this[PAUSED] = true + } + + get destroyed () { + return this[DESTROYED] + } + + get flowing () { + return this[FLOWING] + } + + get paused () { + return this[PAUSED] + } + + [BUFFERPUSH] (chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1 + else + this[BUFFERLENGTH] += chunk.length + return this.buffer.push(chunk) + } + + [BUFFERSHIFT] () { + if (this.buffer.length) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1 + else + this[BUFFERLENGTH] -= this.buffer.head.value.length + } + return this.buffer.shift() + } + + [FLUSH] () { + do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]())) + + if (!this.buffer.length && !this[EOF]) + this.emit('drain') + } + + [FLUSHCHUNK] (chunk) { + return chunk ? (this.emit('data', chunk), this.flowing) : false + } + + pipe (dest, opts) { + if (this[DESTROYED]) + return + + const ended = this[EMITTED_END] + opts = opts || {} + if (dest === process.stdout || dest === process.stderr) + opts.end = false + else + opts.end = opts.end !== false + + const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() } + this.pipes.push(p) + + dest.on('drain', p.ondrain) + this[RESUME]() + // piping an ended stream ends immediately + if (ended && p.opts.end) + p.dest.end() + return dest + } + + addListener (ev, fn) { + return this.on(ev, fn) + } + + on (ev, fn) { + try { + return super.on(ev, fn) + } finally { + if (ev === 'data' && !this.pipes.length && !this.flowing) + this[RESUME]() + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev) + this.removeAllListeners(ev) + } + } + } + + get emittedEnd () { + return this[EMITTED_END] + } + + [MAYBE_EMIT_END] () { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this.buffer.length === 0 && + this[EOF]) { + this[EMITTING_END] = true + this.emit('end') + this.emit('prefinish') + this.emit('finish') + if (this[CLOSED]) + this.emit('close') + this[EMITTING_END] = false + } + } + + emit (ev, data) { + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) + return + else if (ev === 'data') { + if (!data) + return + + if (this.pipes.length) + this.pipes.forEach(p => + p.dest.write(data) === false && this.pause()) + } else if (ev === 'end') { + // only actual end gets this treatment + if (this[EMITTED_END] === true) + return + + this[EMITTED_END] = true + this.readable = false + + if (this[DECODER]) { + data = this[DECODER].end() + if (data) { + this.pipes.forEach(p => p.dest.write(data)) + super.emit('data', data) + } + } + + this.pipes.forEach(p => { + p.dest.removeListener('drain', p.ondrain) + if (p.opts.end) + p.dest.end() + }) + } else if (ev === 'close') { + this[CLOSED] = true + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return + } + + // TODO: replace with a spread operator when Node v4 support drops + const args = new Array(arguments.length) + args[0] = ev + args[1] = data + if (arguments.length > 2) { + for (let i = 2; i < arguments.length; i++) { + args[i] = arguments[i] + } + } + + try { + return super.emit.apply(this, args) + } finally { + if (!isEndish(ev)) + this[MAYBE_EMIT_END]() + else + this.removeAllListeners(ev) + } + } + + // const all = await stream.collect() + collect () { + const buf = [] + if (!this[OBJECTMODE]) + buf.dataLength = 0 + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise() + this.on('data', c => { + buf.push(c) + if (!this[OBJECTMODE]) + buf.dataLength += c.length + }) + return p.then(() => buf) + } + + // const data = await stream.concat() + concat () { + return this[OBJECTMODE] + ? Promise.reject(new Error('cannot concat in objectMode')) + : this.collect().then(buf => + this[OBJECTMODE] + ? Promise.reject(new Error('cannot concat in objectMode')) + : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength)) + } + + // stream.promise().then(() => done, er => emitted error) + promise () { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))) + this.on('end', () => resolve()) + this.on('error', er => reject(er)) + }) + } + + // for await (let chunk of stream) + [ASYNCITERATOR] () { + const next = () => { + const res = this.read() + if (res !== null) + return Promise.resolve({ done: false, value: res }) + + if (this[EOF]) + return Promise.resolve({ done: true }) + + let resolve = null + let reject = null + const onerr = er => { + this.removeListener('data', ondata) + this.removeListener('end', onend) + reject(er) + } + const ondata = value => { + this.removeListener('error', onerr) + this.removeListener('end', onend) + this.pause() + resolve({ value: value, done: !!this[EOF] }) + } + const onend = () => { + this.removeListener('error', onerr) + this.removeListener('data', ondata) + resolve({ done: true }) + } + const ondestroy = () => onerr(new Error('stream destroyed')) + return new Promise((res, rej) => { + reject = rej + resolve = res + this.once(DESTROYED, ondestroy) + this.once('error', onerr) + this.once('end', onend) + this.once('data', ondata) + }) + } + + return { next } + } + + // for (let chunk of stream) + [ITERATOR] () { + const next = () => { + const value = this.read() + const done = value === null + return { value, done } + } + return { next } + } + + destroy (er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er) + else + this.emit(DESTROYED) + return this + } + + this[DESTROYED] = true + + // throw away all buffered data, it's never coming out + this.buffer = new Yallist() + this[BUFFERLENGTH] = 0 + + if (typeof this.close === 'function' && !this[CLOSED]) + this.close() + + if (er) + this.emit('error', er) + else // if no error to emit, still reject pending promises + this.emit(DESTROYED) + + return this + } + + static isStream (s) { + return !!s && (s instanceof Minipass || s instanceof Stream || + s instanceof EE && ( + typeof s.pipe === 'function' || // readable + (typeof s.write === 'function' && typeof s.end === 'function') // writable + )) + } +} + + +/***/ }), + +/***/ "./.yarn/cache/minizlib-npm-2.1.0-9531be52b3-6a811aaa3a.zip/node_modules/minizlib/constants.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/minizlib-npm-2.1.0-9531be52b3-6a811aaa3a.zip/node_modules/minizlib/constants.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// Update with any zlib constants that are added or changed in the future. +// Node v6 didn't export this, so we just hard code the version and rely +// on all the other hard-coded values from zlib v4736. When node v6 +// support drops, we can just export the realZlibConstants object. +const realZlibConstants = __webpack_require__(/*! zlib */ "zlib").constants || + /* istanbul ignore next */ { ZLIB_VERNUM: 4736 } + +module.exports = Object.freeze(Object.assign(Object.create(null), { + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + Z_VERSION_ERROR: -6, + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + DEFLATE: 1, + INFLATE: 2, + GZIP: 3, + GUNZIP: 4, + DEFLATERAW: 5, + INFLATERAW: 6, + UNZIP: 7, + BROTLI_DECODE: 8, + BROTLI_ENCODE: 9, + Z_MIN_WINDOWBITS: 8, + Z_MAX_WINDOWBITS: 15, + Z_DEFAULT_WINDOWBITS: 15, + Z_MIN_CHUNK: 64, + Z_MAX_CHUNK: Infinity, + Z_DEFAULT_CHUNK: 16384, + Z_MIN_MEMLEVEL: 1, + Z_MAX_MEMLEVEL: 9, + Z_DEFAULT_MEMLEVEL: 8, + Z_MIN_LEVEL: -1, + Z_MAX_LEVEL: 9, + Z_DEFAULT_LEVEL: -1, + BROTLI_OPERATION_PROCESS: 0, + BROTLI_OPERATION_FLUSH: 1, + BROTLI_OPERATION_FINISH: 2, + BROTLI_OPERATION_EMIT_METADATA: 3, + BROTLI_MODE_GENERIC: 0, + BROTLI_MODE_TEXT: 1, + BROTLI_MODE_FONT: 2, + BROTLI_DEFAULT_MODE: 0, + BROTLI_MIN_QUALITY: 0, + BROTLI_MAX_QUALITY: 11, + BROTLI_DEFAULT_QUALITY: 11, + BROTLI_MIN_WINDOW_BITS: 10, + BROTLI_MAX_WINDOW_BITS: 24, + BROTLI_LARGE_MAX_WINDOW_BITS: 30, + BROTLI_DEFAULT_WINDOW: 22, + BROTLI_MIN_INPUT_BLOCK_BITS: 16, + BROTLI_MAX_INPUT_BLOCK_BITS: 24, + BROTLI_PARAM_MODE: 0, + BROTLI_PARAM_QUALITY: 1, + BROTLI_PARAM_LGWIN: 2, + BROTLI_PARAM_LGBLOCK: 3, + BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, + BROTLI_PARAM_SIZE_HINT: 5, + BROTLI_PARAM_LARGE_WINDOW: 6, + BROTLI_PARAM_NPOSTFIX: 7, + BROTLI_PARAM_NDIRECT: 8, + BROTLI_DECODER_RESULT_ERROR: 0, + BROTLI_DECODER_RESULT_SUCCESS: 1, + BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, + BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, + BROTLI_DECODER_NO_ERROR: 0, + BROTLI_DECODER_SUCCESS: 1, + BROTLI_DECODER_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, + BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, + BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, + BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, + BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, + BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, + BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, + BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, + BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, + BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, + BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, + BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, + BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, + BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, + BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, + BROTLI_DECODER_ERROR_UNREACHABLE: -31, +}, realZlibConstants)) + + +/***/ }), + +/***/ "./.yarn/cache/minizlib-npm-2.1.0-9531be52b3-6a811aaa3a.zip/node_modules/minizlib/index.js": +/*!*************************************************************************************************!*\ + !*** ./.yarn/cache/minizlib-npm-2.1.0-9531be52b3-6a811aaa3a.zip/node_modules/minizlib/index.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const assert = __webpack_require__(/*! assert */ "assert") +const Buffer = __webpack_require__(/*! buffer */ "buffer").Buffer +const realZlib = __webpack_require__(/*! zlib */ "zlib") + +const constants = exports.constants = __webpack_require__(/*! ./constants.js */ "./.yarn/cache/minizlib-npm-2.1.0-9531be52b3-6a811aaa3a.zip/node_modules/minizlib/constants.js") +const Minipass = __webpack_require__(/*! minipass */ "./.yarn/cache/minipass-npm-3.1.1-b51d7e264d-cfcfd86adc.zip/node_modules/minipass/index.js") + +const OriginalBufferConcat = Buffer.concat + +const _superWrite = Symbol('_superWrite') +class ZlibError extends Error { + constructor (err) { + super('zlib: ' + err.message) + this.code = err.code + this.errno = err.errno + /* istanbul ignore if */ + if (!this.code) + this.code = 'ZLIB_ERROR' + + this.message = 'zlib: ' + err.message + Error.captureStackTrace(this, this.constructor) + } + + get name () { + return 'ZlibError' + } +} + +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. +const _opts = Symbol('opts') +const _flushFlag = Symbol('flushFlag') +const _finishFlushFlag = Symbol('finishFlushFlag') +const _fullFlushFlag = Symbol('fullFlushFlag') +const _handle = Symbol('handle') +const _onError = Symbol('onError') +const _sawError = Symbol('sawError') +const _level = Symbol('level') +const _strategy = Symbol('strategy') +const _ended = Symbol('ended') +const _defaultFullFlush = Symbol('_defaultFullFlush') + +class ZlibBase extends Minipass { + constructor (opts, mode) { + if (!opts || typeof opts !== 'object') + throw new TypeError('invalid options for ZlibBase constructor') + + super(opts) + this[_ended] = false + this[_opts] = opts + + this[_flushFlag] = opts.flush + this[_finishFlushFlag] = opts.finishFlush + // this will throw if any options are invalid for the class selected + try { + this[_handle] = new realZlib[mode](opts) + } catch (er) { + // make sure that all errors get decorated properly + throw new ZlibError(er) + } + + this[_onError] = (err) => { + this[_sawError] = true + // there is no way to cleanly recover. + // continuing only obscures problems. + this.close() + this.emit('error', err) + } + + this[_handle].on('error', er => this[_onError](new ZlibError(er))) + this.once('end', () => this.close) + } + + close () { + if (this[_handle]) { + this[_handle].close() + this[_handle] = null + this.emit('close') + } + } + + reset () { + if (!this[_sawError]) { + assert(this[_handle], 'zlib binding closed') + return this[_handle].reset() + } + } + + flush (flushFlag) { + if (this.ended) + return + + if (typeof flushFlag !== 'number') + flushFlag = this[_fullFlushFlag] + this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag })) + } + + end (chunk, encoding, cb) { + if (chunk) + this.write(chunk, encoding) + this.flush(this[_finishFlushFlag]) + this[_ended] = true + return super.end(null, null, cb) + } + + get ended () { + return this[_ended] + } + + write (chunk, encoding, cb) { + // process the chunk using the sync process + // then super.write() all the outputted chunks + if (typeof encoding === 'function') + cb = encoding, encoding = 'utf8' + + if (typeof chunk === 'string') + chunk = Buffer.from(chunk, encoding) + + if (this[_sawError]) + return + assert(this[_handle], 'zlib binding closed') + + // _processChunk tries to .close() the native handle after it's done, so we + // intercept that by temporarily making it a no-op. + const nativeHandle = this[_handle]._handle + const originalNativeClose = nativeHandle.close + nativeHandle.close = () => {} + const originalClose = this[_handle].close + this[_handle].close = () => {} + // It also calls `Buffer.concat()` at the end, which may be convenient + // for some, but which we are not interested in as it slows us down. + Buffer.concat = (args) => args + let result + try { + const flushFlag = typeof chunk[_flushFlag] === 'number' + ? chunk[_flushFlag] : this[_flushFlag] + result = this[_handle]._processChunk(chunk, flushFlag) + // if we don't throw, reset it back how it was + Buffer.concat = OriginalBufferConcat + } catch (err) { + // or if we do, put Buffer.concat() back before we emit error + // Error events call into user code, which may call Buffer.concat() + Buffer.concat = OriginalBufferConcat + this[_onError](new ZlibError(err)) + } finally { + if (this[_handle]) { + // Core zlib resets `_handle` to null after attempting to close the + // native handle. Our no-op handler prevented actual closure, but we + // need to restore the `._handle` property. + this[_handle]._handle = nativeHandle + nativeHandle.close = originalNativeClose + this[_handle].close = originalClose + // `_processChunk()` adds an 'error' listener. If we don't remove it + // after each call, these handlers start piling up. + this[_handle].removeAllListeners('error') + } + } + + let writeReturn + if (result) { + if (Array.isArray(result) && result.length > 0) { + // The first buffer is always `handle._outBuffer`, which would be + // re-used for later invocations; so, we always have to copy that one. + writeReturn = this[_superWrite](Buffer.from(result[0])) + for (let i = 1; i < result.length; i++) { + writeReturn = this[_superWrite](result[i]) + } + } else { + writeReturn = this[_superWrite](Buffer.from(result)) + } + } + + if (cb) + cb() + return writeReturn + } + + [_superWrite] (data) { + return super.write(data) + } +} + +class Zlib extends ZlibBase { + constructor (opts, mode) { + opts = opts || {} + + opts.flush = opts.flush || constants.Z_NO_FLUSH + opts.finishFlush = opts.finishFlush || constants.Z_FINISH + super(opts, mode) + + this[_fullFlushFlag] = constants.Z_FULL_FLUSH + this[_level] = opts.level + this[_strategy] = opts.strategy + } + + params (level, strategy) { + if (this[_sawError]) + return + + if (!this[_handle]) + throw new Error('cannot switch params when binding is closed') + + // no way to test this without also not supporting params at all + /* istanbul ignore if */ + if (!this[_handle].params) + throw new Error('not supported in this implementation') + + if (this[_level] !== level || this[_strategy] !== strategy) { + this.flush(constants.Z_SYNC_FLUSH) + assert(this[_handle], 'zlib binding closed') + // .params() calls .flush(), but the latter is always async in the + // core zlib. We override .flush() temporarily to intercept that and + // flush synchronously. + const origFlush = this[_handle].flush + this[_handle].flush = (flushFlag, cb) => { + this.flush(flushFlag) + cb() + } + try { + this[_handle].params(level, strategy) + } finally { + this[_handle].flush = origFlush + } + /* istanbul ignore else */ + if (this[_handle]) { + this[_level] = level + this[_strategy] = strategy + } + } + } +} + +// minimal 2-byte header +class Deflate extends Zlib { + constructor (opts) { + super(opts, 'Deflate') + } +} + +class Inflate extends Zlib { + constructor (opts) { + super(opts, 'Inflate') + } +} + +// gzip - bigger header, same deflate compression +const _portable = Symbol('_portable') +class Gzip extends Zlib { + constructor (opts) { + super(opts, 'Gzip') + this[_portable] = opts && !!opts.portable + } + + [_superWrite] (data) { + if (!this[_portable]) + return super[_superWrite](data) + + // we'll always get the header emitted in one first chunk + // overwrite the OS indicator byte with 0xFF + this[_portable] = false + data[9] = 255 + return super[_superWrite](data) + } +} + +class Gunzip extends Zlib { + constructor (opts) { + super(opts, 'Gunzip') + } +} + +// raw - no header +class DeflateRaw extends Zlib { + constructor (opts) { + super(opts, 'DeflateRaw') + } +} + +class InflateRaw extends Zlib { + constructor (opts) { + super(opts, 'InflateRaw') + } +} + +// auto-detect header. +class Unzip extends Zlib { + constructor (opts) { + super(opts, 'Unzip') + } +} + +class Brotli extends ZlibBase { + constructor (opts, mode) { + opts = opts || {} + + opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS + opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH + + super(opts, mode) + + this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH + } +} + +class BrotliCompress extends Brotli { + constructor (opts) { + super(opts, 'BrotliCompress') + } +} + +class BrotliDecompress extends Brotli { + constructor (opts) { + super(opts, 'BrotliDecompress') + } +} + +exports.Deflate = Deflate +exports.Inflate = Inflate +exports.Gzip = Gzip +exports.Gunzip = Gunzip +exports.DeflateRaw = DeflateRaw +exports.InflateRaw = InflateRaw +exports.Unzip = Unzip +/* istanbul ignore else */ +if (typeof realZlib.BrotliCompress === 'function') { + exports.BrotliCompress = BrotliCompress + exports.BrotliDecompress = BrotliDecompress +} else { + exports.BrotliCompress = exports.BrotliDecompress = class { + constructor () { + throw new Error('Brotli is not supported in this version of Node.js') + } + } +} + + +/***/ }), + +/***/ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/index.js": +/*!*********************************************************************************************!*\ + !*** ./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/index.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const optsArg = __webpack_require__(/*! ./lib/opts-arg.js */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/opts-arg.js") +const pathArg = __webpack_require__(/*! ./lib/path-arg.js */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/path-arg.js") + +const {mkdirpNative, mkdirpNativeSync} = __webpack_require__(/*! ./lib/mkdirp-native.js */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/mkdirp-native.js") +const {mkdirpManual, mkdirpManualSync} = __webpack_require__(/*! ./lib/mkdirp-manual.js */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/mkdirp-manual.js") +const {useNative, useNativeSync} = __webpack_require__(/*! ./lib/use-native.js */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/use-native.js") + + +const mkdirp = (path, opts) => { + path = pathArg(path) + opts = optsArg(opts) + return useNative(opts) + ? mkdirpNative(path, opts) + : mkdirpManual(path, opts) +} + +const mkdirpSync = (path, opts) => { + path = pathArg(path) + opts = optsArg(opts) + return useNativeSync(opts) + ? mkdirpNativeSync(path, opts) + : mkdirpManualSync(path, opts) +} + +mkdirp.sync = mkdirpSync +mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts)) +mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts)) +mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts)) +mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts)) + +module.exports = mkdirp + + +/***/ }), + +/***/ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/find-made.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/find-made.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const {dirname} = __webpack_require__(/*! path */ "path") + +const findMade = (opts, parent, path = undefined) => { + // we never want the 'made' return value to be a root directory + if (path === parent) + return Promise.resolve() + + return opts.statAsync(parent).then( + st => st.isDirectory() ? path : undefined, // will fail later + er => er.code === 'ENOENT' + ? findMade(opts, dirname(parent), parent) + : undefined + ) +} + +const findMadeSync = (opts, parent, path = undefined) => { + if (path === parent) + return undefined + + try { + return opts.statSync(parent).isDirectory() ? path : undefined + } catch (er) { + return er.code === 'ENOENT' + ? findMadeSync(opts, dirname(parent), parent) + : undefined + } +} + +module.exports = {findMade, findMadeSync} + + +/***/ }), + +/***/ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/mkdirp-manual.js": +/*!*********************************************************************************************************!*\ + !*** ./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/mkdirp-manual.js ***! + \*********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const {dirname} = __webpack_require__(/*! path */ "path") + +const mkdirpManual = (path, opts, made) => { + opts.recursive = false + const parent = dirname(path) + if (parent === path) { + return opts.mkdirAsync(path, opts).catch(er => { + // swallowed by recursive implementation on posix systems + // any other error is a failure + if (er.code !== 'EISDIR') + throw er + }) + } + + return opts.mkdirAsync(path, opts).then(() => made || path, er => { + if (er.code === 'ENOENT') + return mkdirpManual(parent, opts) + .then(made => mkdirpManual(path, opts, made)) + if (er.code !== 'EEXIST' && er.code !== 'EROFS') + throw er + return opts.statAsync(path).then(st => { + if (st.isDirectory()) + return made + else + throw er + }, () => { throw er }) + }) +} + +const mkdirpManualSync = (path, opts, made) => { + const parent = dirname(path) + opts.recursive = false + + if (parent === path) { + try { + return opts.mkdirSync(path, opts) + } catch (er) { + // swallowed by recursive implementation on posix systems + // any other error is a failure + if (er.code !== 'EISDIR') + throw er + else + return + } + } + + try { + opts.mkdirSync(path, opts) + return made || path + } catch (er) { + if (er.code === 'ENOENT') + return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made)) + if (er.code !== 'EEXIST' && er.code !== 'EROFS') + throw er + try { + if (!opts.statSync(path).isDirectory()) + throw er + } catch (_) { + throw er + } + } +} + +module.exports = {mkdirpManual, mkdirpManualSync} + + +/***/ }), + +/***/ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/mkdirp-native.js": +/*!*********************************************************************************************************!*\ + !*** ./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/mkdirp-native.js ***! + \*********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const {dirname} = __webpack_require__(/*! path */ "path") +const {findMade, findMadeSync} = __webpack_require__(/*! ./find-made.js */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/find-made.js") +const {mkdirpManual, mkdirpManualSync} = __webpack_require__(/*! ./mkdirp-manual.js */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/mkdirp-manual.js") + +const mkdirpNative = (path, opts) => { + opts.recursive = true + const parent = dirname(path) + if (parent === path) + return opts.mkdirAsync(path, opts) + + return findMade(opts, path).then(made => + opts.mkdirAsync(path, opts).then(() => made) + .catch(er => { + if (er.code === 'ENOENT') + return mkdirpManual(path, opts) + else + throw er + })) +} + +const mkdirpNativeSync = (path, opts) => { + opts.recursive = true + const parent = dirname(path) + if (parent === path) + return opts.mkdirSync(path, opts) + + const made = findMadeSync(opts, path) + try { + opts.mkdirSync(path, opts) + return made + } catch (er) { + if (er.code === 'ENOENT') + return mkdirpManualSync(path, opts) + else + throw er + } +} + +module.exports = {mkdirpNative, mkdirpNativeSync} + + +/***/ }), + +/***/ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/opts-arg.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/opts-arg.js ***! + \****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { promisify } = __webpack_require__(/*! util */ "util") +const fs = __webpack_require__(/*! fs */ "fs") +const optsArg = opts => { + if (!opts) + opts = { mode: 0o777 & (~process.umask()), fs } + else if (typeof opts === 'object') + opts = { mode: 0o777 & (~process.umask()), fs, ...opts } + else if (typeof opts === 'number') + opts = { mode: opts, fs } + else if (typeof opts === 'string') + opts = { mode: parseInt(opts, 8), fs } + else + throw new TypeError('invalid options argument') + + opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir + opts.mkdirAsync = promisify(opts.mkdir) + opts.stat = opts.stat || opts.fs.stat || fs.stat + opts.statAsync = promisify(opts.stat) + opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync + opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync + return opts +} +module.exports = optsArg + + +/***/ }), + +/***/ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/path-arg.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/path-arg.js ***! + \****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform +const { resolve, parse } = __webpack_require__(/*! path */ "path") +const pathArg = path => { + if (/\0/.test(path)) { + // simulate same failure that node raises + throw Object.assign( + new TypeError('path must be a string without null bytes'), + { + path, + code: 'ERR_INVALID_ARG_VALUE', + } + ) + } + + path = resolve(path) + if (platform === 'win32') { + const badWinChars = /[*|"<>?:]/ + const {root} = parse(path) + if (badWinChars.test(path.substr(root.length))) { + throw Object.assign(new Error('Illegal characters in path.'), { + path, + code: 'EINVAL', + }) + } + } + + return path +} +module.exports = pathArg + + +/***/ }), + +/***/ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/use-native.js": +/*!******************************************************************************************************!*\ + !*** ./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/lib/use-native.js ***! + \******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const fs = __webpack_require__(/*! fs */ "fs") + +const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version +const versArr = version.replace(/^v/, '').split('.') +const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12 + +const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir +const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync + +module.exports = {useNative, useNativeSync} + + +/***/ }), + +/***/ "./.yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip/node_modules/ms/index.js": +/*!*************************************************************************************!*\ + !*** ./.yarn/cache/ms-npm-2.1.2-ec0c1512ff-673cdb2c31.zip/node_modules/ms/index.js ***! + \*************************************************************************************/ +/***/ ((module) => { + +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/comparator.js": +/*!**********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/comparator.js ***! + \**********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + constructor (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } + + toString () { + return this.value + } + + test (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + const sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + const sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + const sameSemVer = this.semver.version === comp.semver.version + const differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + const oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<') + const oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>') + + return ( + sameDirectionIncreasing || + sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || + oppositeDirectionsGreaterThan + ) + } +} + +module.exports = Comparator + +const {re, t} = __webpack_require__(/*! ../internal/re */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js") +const cmp = __webpack_require__(/*! ../functions/cmp */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/cmp.js") +const debug = __webpack_require__(/*! ../internal/debug */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/debug.js") +const SemVer = __webpack_require__(/*! ./semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const Range = __webpack_require__(/*! ./range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.format() + return this + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First, split based on boolean or || + this.raw = range + this.set = range + .split(/\s*\|\|\s*/) + // map the range to a 2d array of comparators + .map(range => this.parseRange(range.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`) + } + + this.format() + } + + format () { + this.range = this.set + .map((comps) => { + return comps.join(' ').trim() + }) + .join('||') + .trim() + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + const loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + return range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // in loose mode, throw out any that are not valid comparators + .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) + .map(comp => new Comparator(comp, this.options)) + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } +} +module.exports = Range + +const Comparator = __webpack_require__(/*! ./comparator */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/comparator.js") +const debug = __webpack_require__(/*! ../internal/debug */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/debug.js") +const SemVer = __webpack_require__(/*! ./semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace +} = __webpack_require__(/*! ../internal/re */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js") + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +const replaceTildes = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceTilde(comp, options) + }).join(' ') + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +const replaceCarets = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceCaret(comp, options) + }).join(' ') + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0` + } else { + ret = `>=${M}.${m}.0 <${+M + 1}.0.0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + } <${M}.${m}.${+p + 1}` + } else { + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map((comp) => { + return replaceXRange(comp, options) + }).join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0${pr}` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0${pr}` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[t.STAR], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +const hyphenReplace = ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0` + } else { + from = `>=${from}` + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else { + to = `<=${to}` + } + + return (`${from} ${to}`).trim() +} + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js": +/*!******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js ***! + \******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const debug = __webpack_require__(/*! ../internal/debug */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/debug.js") +const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(/*! ../internal/constants */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/constants.js") +const { re, t } = __webpack_require__(/*! ../internal/re */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js") + +const { compareIdentifiers } = __webpack_require__(/*! ../internal/identifiers */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/identifiers.js") +class SemVer { + constructor (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid Version: ${version}`) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease + + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.format() + this.raw = this.version + return this + } +} + +module.exports = SemVer + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/clean.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/clean.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(/*! ./parse */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js") +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/cmp.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/cmp.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const eq = __webpack_require__(/*! ./eq */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/eq.js") +const neq = __webpack_require__(/*! ./neq */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/neq.js") +const gt = __webpack_require__(/*! ./gt */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gt.js") +const gte = __webpack_require__(/*! ./gte */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gte.js") +const lt = __webpack_require__(/*! ./lt */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lt.js") +const lte = __webpack_require__(/*! ./lte */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lte.js") + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/coerce.js": +/*!********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/coerce.js ***! + \********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const parse = __webpack_require__(/*! ./parse */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js") +const {re, t} = __webpack_require__(/*! ../internal/re */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js") + +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + let next + while ((next = re[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + re[t.COERCERTL].lastIndex = -1 + } + + if (match === null) + return null + + return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) +} +module.exports = coerce + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-build.js": +/*!***************************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-build.js ***! + \***************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-loose.js": +/*!***************************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-loose.js ***! + \***************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js": +/*!*********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js ***! + \*********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/diff.js": +/*!******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/diff.js ***! + \******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(/*! ./parse */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js") +const eq = __webpack_require__(/*! ./eq */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/eq.js") + +const diff = (version1, version2) => { + if (eq(version1, version2)) { + return null + } else { + const v1 = parse(version1) + const v2 = parse(version2) + const hasPre = v1.prerelease.length || v2.prerelease.length + const prefix = hasPre ? 'pre' : '' + const defaultResult = hasPre ? 'prerelease' : '' + for (const key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} +module.exports = diff + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/eq.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/eq.js ***! + \****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gt.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gt.js ***! + \****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gte.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gte.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/inc.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/inc.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") + +const inc = (version, release, options, identifier) => { + if (typeof (options) === 'string') { + identifier = options + options = undefined + } + + try { + return new SemVer(version, options).inc(release, identifier).version + } catch (er) { + return null + } +} +module.exports = inc + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lt.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lt.js ***! + \****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lte.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lte.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/major.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/major.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/minor.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/minor.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/neq.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/neq.js ***! + \*****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const {MAX_LENGTH} = __webpack_require__(/*! ../internal/constants */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/constants.js") +const { re, t } = __webpack_require__(/*! ../internal/re */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js") +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") + +const parse = (version, options) => { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + const r = options.loose ? re[t.LOOSE] : re[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +module.exports = parse + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/patch.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/patch.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/prerelease.js": +/*!************************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/prerelease.js ***! + \************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(/*! ./parse */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js") +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} +module.exports = prerelease + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/rcompare.js": +/*!**********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/rcompare.js ***! + \**********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(/*! ./compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js") +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/rsort.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/rsort.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compareBuild = __webpack_require__(/*! ./compare-build */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-build.js") +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/satisfies.js": +/*!***********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/satisfies.js ***! + \***********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/sort.js": +/*!******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/sort.js ***! + \******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compareBuild = __webpack_require__(/*! ./compare-build */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-build.js") +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/valid.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/valid.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(/*! ./parse */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js") +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/index.js": +/*!*********************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/index.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// just pre-load all the stuff that index.js lazily exports +const internalRe = __webpack_require__(/*! ./internal/re */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js") +module.exports = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: __webpack_require__(/*! ./internal/constants */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/constants.js").SEMVER_SPEC_VERSION, + SemVer: __webpack_require__(/*! ./classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js"), + compareIdentifiers: __webpack_require__(/*! ./internal/identifiers */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/identifiers.js").compareIdentifiers, + rcompareIdentifiers: __webpack_require__(/*! ./internal/identifiers */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/identifiers.js").rcompareIdentifiers, + parse: __webpack_require__(/*! ./functions/parse */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/parse.js"), + valid: __webpack_require__(/*! ./functions/valid */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/valid.js"), + clean: __webpack_require__(/*! ./functions/clean */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/clean.js"), + inc: __webpack_require__(/*! ./functions/inc */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/inc.js"), + diff: __webpack_require__(/*! ./functions/diff */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/diff.js"), + major: __webpack_require__(/*! ./functions/major */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/major.js"), + minor: __webpack_require__(/*! ./functions/minor */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/minor.js"), + patch: __webpack_require__(/*! ./functions/patch */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/patch.js"), + prerelease: __webpack_require__(/*! ./functions/prerelease */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/prerelease.js"), + compare: __webpack_require__(/*! ./functions/compare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare.js"), + rcompare: __webpack_require__(/*! ./functions/rcompare */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/rcompare.js"), + compareLoose: __webpack_require__(/*! ./functions/compare-loose */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-loose.js"), + compareBuild: __webpack_require__(/*! ./functions/compare-build */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/compare-build.js"), + sort: __webpack_require__(/*! ./functions/sort */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/sort.js"), + rsort: __webpack_require__(/*! ./functions/rsort */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/rsort.js"), + gt: __webpack_require__(/*! ./functions/gt */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gt.js"), + lt: __webpack_require__(/*! ./functions/lt */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lt.js"), + eq: __webpack_require__(/*! ./functions/eq */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/eq.js"), + neq: __webpack_require__(/*! ./functions/neq */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/neq.js"), + gte: __webpack_require__(/*! ./functions/gte */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gte.js"), + lte: __webpack_require__(/*! ./functions/lte */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lte.js"), + cmp: __webpack_require__(/*! ./functions/cmp */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/cmp.js"), + coerce: __webpack_require__(/*! ./functions/coerce */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/coerce.js"), + Comparator: __webpack_require__(/*! ./classes/comparator */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/comparator.js"), + Range: __webpack_require__(/*! ./classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js"), + satisfies: __webpack_require__(/*! ./functions/satisfies */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/satisfies.js"), + toComparators: __webpack_require__(/*! ./ranges/to-comparators */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/to-comparators.js"), + maxSatisfying: __webpack_require__(/*! ./ranges/max-satisfying */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/max-satisfying.js"), + minSatisfying: __webpack_require__(/*! ./ranges/min-satisfying */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/min-satisfying.js"), + minVersion: __webpack_require__(/*! ./ranges/min-version */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/min-version.js"), + validRange: __webpack_require__(/*! ./ranges/valid */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/valid.js"), + outside: __webpack_require__(/*! ./ranges/outside */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/outside.js"), + gtr: __webpack_require__(/*! ./ranges/gtr */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/gtr.js"), + ltr: __webpack_require__(/*! ./ranges/ltr */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/ltr.js"), + intersects: __webpack_require__(/*! ./ranges/intersects */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/intersects.js"), +} + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/constants.js": +/*!**********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/constants.js ***! + \**********************************************************************************************************/ +/***/ ((module) => { + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' + +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +module.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH +} + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/debug.js": +/*!******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/debug.js ***! + \******************************************************************************************************/ +/***/ ((module) => { + +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/identifiers.js": +/*!************************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/identifiers.js ***! + \************************************************************************************************************/ +/***/ ((module) => { + +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers +} + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js": +/*!***************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/re.js ***! + \***************************************************************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(/*! ./constants */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/constants.js") +const debug = __webpack_require__(/*! ./debug */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/internal/debug.js") +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const createToken = (name, value, isGlobal) => { + const index = R++ + debug(index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCE', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/gtr.js": +/*!**************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/gtr.js ***! + \**************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// Determine if version is greater than all the versions possible in the range. +const outside = __webpack_require__(/*! ./outside */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/outside.js") +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/intersects.js": +/*!*********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/intersects.js ***! + \*********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} +module.exports = intersects + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/ltr.js": +/*!**************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/ltr.js ***! + \**************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const outside = __webpack_require__(/*! ./outside */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/outside.js") +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/max-satisfying.js": +/*!*************************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/max-satisfying.js ***! + \*************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} +module.exports = maxSatisfying + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/min-satisfying.js": +/*!*************************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/min-satisfying.js ***! + \*************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} +module.exports = minSatisfying + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/min-version.js": +/*!**********************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/min-version.js ***! + \**********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") +const gt = __webpack_require__(/*! ../functions/gt */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gt.js") + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/outside.js": +/*!******************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/outside.js ***! + \******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(/*! ../classes/semver */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/semver.js") +const Comparator = __webpack_require__(/*! ../classes/comparator */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/comparator.js") +const {ANY} = Comparator +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") +const satisfies = __webpack_require__(/*! ../functions/satisfies */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/satisfies.js") +const gt = __webpack_require__(/*! ../functions/gt */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gt.js") +const lt = __webpack_require__(/*! ../functions/lt */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lt.js") +const lte = __webpack_require__(/*! ../functions/lte */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/lte.js") +const gte = __webpack_require__(/*! ../functions/gte */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/functions/gte.js") + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/to-comparators.js": +/*!*************************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/to-comparators.js ***! + \*************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators + + +/***/ }), + +/***/ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/valid.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/ranges/valid.js ***! + \****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(/*! ../classes/range */ "./.yarn/cache/semver-npm-7.1.3-1741df6bad-a7700fd039.zip/node_modules/semver/classes/range.js") +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange + + +/***/ }), + +/***/ "./.yarn/cache/supports-color-npm-7.1.0-df2ba1e338-899480ac85.zip/node_modules/supports-color/index.js": +/*!*************************************************************************************************************!*\ + !*** ./.yarn/cache/supports-color-npm-7.1.0-df2ba1e338-899480ac85.zip/node_modules/supports-color/index.js ***! + \*************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const os = __webpack_require__(/*! os */ "os"); +const tty = __webpack_require__(/*! tty */ "tty"); +const hasFlag = __webpack_require__(/*! has-flag */ "./.yarn/cache/has-flag-npm-4.0.0-32af9f0536-261a135703.zip/node_modules/has-flag/index.js"); + +const {env} = process; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = 1; +} + +if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); + } +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } + + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if ('GITHUB_ACTIONS' in env) { + return 1; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/index.js": +/*!***************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/index.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +// high-level commands +exports.c = exports.create = __webpack_require__(/*! ./lib/create.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/create.js") +exports.r = exports.replace = __webpack_require__(/*! ./lib/replace.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/replace.js") +exports.t = exports.list = __webpack_require__(/*! ./lib/list.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/list.js") +exports.u = exports.update = __webpack_require__(/*! ./lib/update.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/update.js") +exports.x = exports.extract = __webpack_require__(/*! ./lib/extract.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/extract.js") + +// classes +exports.Pack = __webpack_require__(/*! ./lib/pack.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pack.js") +exports.Unpack = __webpack_require__(/*! ./lib/unpack.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/unpack.js") +exports.Parse = __webpack_require__(/*! ./lib/parse.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/parse.js") +exports.ReadEntry = __webpack_require__(/*! ./lib/read-entry.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/read-entry.js") +exports.WriteEntry = __webpack_require__(/*! ./lib/write-entry.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/write-entry.js") +exports.Header = __webpack_require__(/*! ./lib/header.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/header.js") +exports.Pax = __webpack_require__(/*! ./lib/pax.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pax.js") +exports.types = __webpack_require__(/*! ./lib/types.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/types.js") + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/create.js": +/*!********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/create.js ***! + \********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// tar -c +const hlo = __webpack_require__(/*! ./high-level-opt.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/high-level-opt.js") + +const Pack = __webpack_require__(/*! ./pack.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pack.js") +const fs = __webpack_require__(/*! fs */ "fs") +const fsm = __webpack_require__(/*! fs-minipass */ "./.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip/node_modules/fs-minipass/index.js") +const t = __webpack_require__(/*! ./list.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/list.js") +const path = __webpack_require__(/*! path */ "path") + +const c = module.exports = (opt_, files, cb) => { + if (typeof files === 'function') + cb = files + + if (Array.isArray(opt_)) + files = opt_, opt_ = {} + + if (!files || !Array.isArray(files) || !files.length) + throw new TypeError('no files or directories specified') + + files = Array.from(files) + + const opt = hlo(opt_) + + if (opt.sync && typeof cb === 'function') + throw new TypeError('callback not supported for sync tar functions') + + if (!opt.file && typeof cb === 'function') + throw new TypeError('callback only supported with file option') + + return opt.file && opt.sync ? createFileSync(opt, files) + : opt.file ? createFile(opt, files, cb) + : opt.sync ? createSync(opt, files) + : create(opt, files) +} + +const createFileSync = (opt, files) => { + const p = new Pack.Sync(opt) + const stream = new fsm.WriteStreamSync(opt.file, { + mode: opt.mode || 0o666 + }) + p.pipe(stream) + addFilesSync(p, files) +} + +const createFile = (opt, files, cb) => { + const p = new Pack(opt) + const stream = new fsm.WriteStream(opt.file, { + mode: opt.mode || 0o666 + }) + p.pipe(stream) + + const promise = new Promise((res, rej) => { + stream.on('error', rej) + stream.on('close', res) + p.on('error', rej) + }) + + addFilesAsync(p, files) + + return cb ? promise.then(cb, cb) : promise +} + +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') + t({ + file: path.resolve(p.cwd, file.substr(1)), + sync: true, + noResume: true, + onentry: entry => p.add(entry) + }) + else + p.add(file) + }) + p.end() +} + +const addFilesAsync = (p, files) => { + while (files.length) { + const file = files.shift() + if (file.charAt(0) === '@') + return t({ + file: path.resolve(p.cwd, file.substr(1)), + noResume: true, + onentry: entry => p.add(entry) + }).then(_ => addFilesAsync(p, files)) + else + p.add(file) + } + p.end() +} + +const createSync = (opt, files) => { + const p = new Pack.Sync(opt) + addFilesSync(p, files) + return p +} + +const create = (opt, files) => { + const p = new Pack(opt) + addFilesAsync(p, files) + return p +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/extract.js": +/*!*********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/extract.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// tar -x +const hlo = __webpack_require__(/*! ./high-level-opt.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/high-level-opt.js") +const Unpack = __webpack_require__(/*! ./unpack.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/unpack.js") +const fs = __webpack_require__(/*! fs */ "fs") +const fsm = __webpack_require__(/*! fs-minipass */ "./.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip/node_modules/fs-minipass/index.js") +const path = __webpack_require__(/*! path */ "path") + +const x = module.exports = (opt_, files, cb) => { + if (typeof opt_ === 'function') + cb = opt_, files = null, opt_ = {} + else if (Array.isArray(opt_)) + files = opt_, opt_ = {} + + if (typeof files === 'function') + cb = files, files = null + + if (!files) + files = [] + else + files = Array.from(files) + + const opt = hlo(opt_) + + if (opt.sync && typeof cb === 'function') + throw new TypeError('callback not supported for sync tar functions') + + if (!opt.file && typeof cb === 'function') + throw new TypeError('callback only supported with file option') + + if (files.length) + filesFilter(opt, files) + + return opt.file && opt.sync ? extractFileSync(opt) + : opt.file ? extractFile(opt, cb) + : opt.sync ? extractSync(opt) + : extract(opt) +} + +// construct a filter that limits the file entries listed +// include child entries if a dir is included +const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [f.replace(/\/+$/, ''), true])) + const filter = opt.filter + + const mapHas = (file, r) => { + const root = r || path.parse(file).root || '.' + const ret = file === root ? false + : map.has(file) ? map.get(file) + : mapHas(path.dirname(file), root) + + map.set(file, ret) + return ret + } + + opt.filter = filter + ? (file, entry) => filter(file, entry) && mapHas(file.replace(/\/+$/, '')) + : file => mapHas(file.replace(/\/+$/, '')) +} + +const extractFileSync = opt => { + const u = new Unpack.Sync(opt) + + const file = opt.file + let threw = true + let fd + const stat = fs.statSync(file) + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + const readSize = opt.maxReadSize || 16*1024*1024 + const stream = new fsm.ReadStreamSync(file, { + readSize: readSize, + size: stat.size + }) + stream.pipe(u) +} + +const extractFile = (opt, cb) => { + const u = new Unpack(opt) + const readSize = opt.maxReadSize || 16*1024*1024 + + const file = opt.file + const p = new Promise((resolve, reject) => { + u.on('error', reject) + u.on('close', resolve) + + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + fs.stat(file, (er, stat) => { + if (er) + reject(er) + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size + }) + stream.on('error', reject) + stream.pipe(u) + } + }) + }) + return cb ? p.then(cb, cb) : p +} + +const extractSync = opt => { + return new Unpack.Sync(opt) +} + +const extract = opt => { + return new Unpack(opt) +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/get-write-flag.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/get-write-flag.js ***! + \****************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// Get the appropriate flag to use for creating files +// We use fmap on Windows platforms for files less than +// 512kb. This is a fairly low limit, but avoids making +// things slower in some cases. Since most of what this +// library is used for is extracting tarballs of many +// relatively small files in npm packages and the like, +// it can be a big boost on Windows platforms. +// Only supported in Node v12.9.0 and above. +const platform = process.env.__FAKE_PLATFORM__ || process.platform +const isWindows = platform === 'win32' +const fs = global.__FAKE_TESTING_FS__ || __webpack_require__(/*! fs */ "fs") + +/* istanbul ignore next */ +const { O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP = 0 } = fs.constants + +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP +const fMapLimit = 512 * 1024 +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY +module.exports = !fMapEnabled ? () => 'w' + : size => size < fMapLimit ? fMapFlag : 'w' + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/header.js": +/*!********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/header.js ***! + \********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +// parse a 512-byte header block to a data object, or vice-versa +// encode returns `true` if a pax extended header is needed, because +// the data could not be faithfully encoded in a simple header. +// (Also, check header.needPax to see if it needs a pax header.) + +const types = __webpack_require__(/*! ./types.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/types.js") +const pathModule = __webpack_require__(/*! path */ "path").posix +const large = __webpack_require__(/*! ./large-numbers.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/large-numbers.js") + +const SLURP = Symbol('slurp') +const TYPE = Symbol('type') + +class Header { + constructor (data, off, ex, gex) { + this.cksumValid = false + this.needPax = false + this.nullBlock = false + + this.block = null + this.path = null + this.mode = null + this.uid = null + this.gid = null + this.size = null + this.mtime = null + this.cksum = null + this[TYPE] = '0' + this.linkpath = null + this.uname = null + this.gname = null + this.devmaj = 0 + this.devmin = 0 + this.atime = null + this.ctime = null + + if (Buffer.isBuffer(data)) + this.decode(data, off || 0, ex, gex) + else if (data) + this.set(data) + } + + decode (buf, off, ex, gex) { + if (!off) + off = 0 + + if (!buf || !(buf.length >= off + 512)) + throw new Error('need 512 bytes for header') + + this.path = decString(buf, off, 100) + this.mode = decNumber(buf, off + 100, 8) + this.uid = decNumber(buf, off + 108, 8) + this.gid = decNumber(buf, off + 116, 8) + this.size = decNumber(buf, off + 124, 12) + this.mtime = decDate(buf, off + 136, 12) + this.cksum = decNumber(buf, off + 148, 12) + + // if we have extended or global extended headers, apply them now + // See https://github.com/npm/node-tar/pull/187 + this[SLURP](ex) + this[SLURP](gex, true) + + // old tar versions marked dirs as a file with a trailing / + this[TYPE] = decString(buf, off + 156, 1) + if (this[TYPE] === '') + this[TYPE] = '0' + if (this[TYPE] === '0' && this.path.substr(-1) === '/') + this[TYPE] = '5' + + // tar implementations sometimes incorrectly put the stat(dir).size + // as the size in the tarball, even though Directory entries are + // not able to have any body at all. In the very rare chance that + // it actually DOES have a body, we weren't going to do anything with + // it anyway, and it'll just be a warning about an invalid header. + if (this[TYPE] === '5') + this.size = 0 + + this.linkpath = decString(buf, off + 157, 100) + if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') { + this.uname = decString(buf, off + 265, 32) + this.gname = decString(buf, off + 297, 32) + this.devmaj = decNumber(buf, off + 329, 8) + this.devmin = decNumber(buf, off + 337, 8) + if (buf[off + 475] !== 0) { + // definitely a prefix, definitely >130 chars. + const prefix = decString(buf, off + 345, 155) + this.path = prefix + '/' + this.path + } else { + const prefix = decString(buf, off + 345, 130) + if (prefix) + this.path = prefix + '/' + this.path + this.atime = decDate(buf, off + 476, 12) + this.ctime = decDate(buf, off + 488, 12) + } + } + + let sum = 8 * 0x20 + for (let i = off; i < off + 148; i++) { + sum += buf[i] + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i] + } + this.cksumValid = sum === this.cksum + if (this.cksum === null && sum === 8 * 0x20) + this.nullBlock = true + } + + [SLURP] (ex, global) { + for (let k in ex) { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. + if (ex[k] !== null && ex[k] !== undefined && + !(global && k === 'path')) + this[k] = ex[k] + } + } + + encode (buf, off) { + if (!buf) { + buf = this.block = Buffer.alloc(512) + off = 0 + } + + if (!off) + off = 0 + + if (!(buf.length >= off + 512)) + throw new Error('need 512 bytes for header') + + const prefixSize = this.ctime || this.atime ? 130 : 155 + const split = splitPrefix(this.path || '', prefixSize) + const path = split[0] + const prefix = split[1] + this.needPax = split[2] + + this.needPax = encString(buf, off, 100, path) || this.needPax + this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax + this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax + this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax + this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax + this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax + buf[off + 156] = this[TYPE].charCodeAt(0) + this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax + buf.write('ustar\u000000', off + 257, 8) + this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax + this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax + this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax + this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax + this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax + if (buf[off + 475] !== 0) + this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax + else { + this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax + this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax + this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax + } + + let sum = 8 * 0x20 + for (let i = off; i < off + 148; i++) { + sum += buf[i] + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i] + } + this.cksum = sum + encNumber(buf, off + 148, 8, this.cksum) + this.cksumValid = true + + return this.needPax + } + + set (data) { + for (let i in data) { + if (data[i] !== null && data[i] !== undefined) + this[i] = data[i] + } + } + + get type () { + return types.name.get(this[TYPE]) || this[TYPE] + } + + get typeKey () { + return this[TYPE] + } + + set type (type) { + if (types.code.has(type)) + this[TYPE] = types.code.get(type) + else + this[TYPE] = type + } +} + +const splitPrefix = (p, prefixSize) => { + const pathSize = 100 + let pp = p + let prefix = '' + let ret + const root = pathModule.parse(p).root || '.' + + if (Buffer.byteLength(pp) < pathSize) + ret = [pp, prefix, false] + else { + // first set prefix to the dir, and path to the base + prefix = pathModule.dirname(pp) + pp = pathModule.basename(pp) + + do { + // both fit! + if (Buffer.byteLength(pp) <= pathSize && + Buffer.byteLength(prefix) <= prefixSize) + ret = [pp, prefix, false] + + // prefix fits in prefix, but path doesn't fit in path + else if (Buffer.byteLength(pp) > pathSize && + Buffer.byteLength(prefix) <= prefixSize) + ret = [pp.substr(0, pathSize - 1), prefix, true] + + else { + // make path take a bit from prefix + pp = pathModule.join(pathModule.basename(prefix), pp) + prefix = pathModule.dirname(prefix) + } + } while (prefix !== root && !ret) + + // at this point, found no resolution, just truncate + if (!ret) + ret = [p.substr(0, pathSize - 1), '', true] + } + return ret +} + +const decString = (buf, off, size) => + buf.slice(off, off + size).toString('utf8').replace(/\0.*/, '') + +const decDate = (buf, off, size) => + numToDate(decNumber(buf, off, size)) + +const numToDate = num => num === null ? null : new Date(num * 1000) + +const decNumber = (buf, off, size) => + buf[off] & 0x80 ? large.parse(buf.slice(off, off + size)) + : decSmallNumber(buf, off, size) + +const nanNull = value => isNaN(value) ? null : value + +const decSmallNumber = (buf, off, size) => + nanNull(parseInt( + buf.slice(off, off + size) + .toString('utf8').replace(/\0.*$/, '').trim(), 8)) + +// the maximum encodable as a null-terminated octal, by field size +const MAXNUM = { + 12: 0o77777777777, + 8 : 0o7777777 +} + +const encNumber = (buf, off, size, number) => + number === null ? false : + number > MAXNUM[size] || number < 0 + ? (large.encode(number, buf.slice(off, off + size)), true) + : (encSmallNumber(buf, off, size, number), false) + +const encSmallNumber = (buf, off, size, number) => + buf.write(octalString(number, size), off, size, 'ascii') + +const octalString = (number, size) => + padOctal(Math.floor(number).toString(8), size) + +const padOctal = (string, size) => + (string.length === size - 1 ? string + : new Array(size - string.length - 1).join('0') + string + ' ') + '\0' + +const encDate = (buf, off, size, date) => + date === null ? false : + encNumber(buf, off, size, date.getTime() / 1000) + +// enough to fill the longest string we've got +const NULLS = new Array(156).join('\0') +// pad with nulls, return true if it's longer or non-ascii +const encString = (buf, off, size, string) => + string === null ? false : + (buf.write(string + NULLS, off, size, 'utf8'), + string.length !== Buffer.byteLength(string) || string.length > size) + +module.exports = Header + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/high-level-opt.js": +/*!****************************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/high-level-opt.js ***! + \****************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +// turn tar(1) style args like `C` into the more verbose things like `cwd` + +const argmap = new Map([ + ['C', 'cwd'], + ['f', 'file'], + ['z', 'gzip'], + ['P', 'preservePaths'], + ['U', 'unlink'], + ['strip-components', 'strip'], + ['stripComponents', 'strip'], + ['keep-newer', 'newer'], + ['keepNewer', 'newer'], + ['keep-newer-files', 'newer'], + ['keepNewerFiles', 'newer'], + ['k', 'keep'], + ['keep-existing', 'keep'], + ['keepExisting', 'keep'], + ['m', 'noMtime'], + ['no-mtime', 'noMtime'], + ['p', 'preserveOwner'], + ['L', 'follow'], + ['h', 'follow'] +]) + +const parse = module.exports = opt => opt ? Object.keys(opt).map(k => [ + argmap.has(k) ? argmap.get(k) : k, opt[k] +]).reduce((set, kv) => (set[kv[0]] = kv[1], set), Object.create(null)) : {} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/large-numbers.js": +/*!***************************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/large-numbers.js ***! + \***************************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Tar can encode large and negative numbers using a leading byte of +// 0xff for negative, and 0x80 for positive. + +const encode = exports.encode = (num, buf) => { + if (!Number.isSafeInteger(num)) + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('cannot encode number outside of javascript safe integer range') + else if (num < 0) + encodeNegative(num, buf) + else + encodePositive(num, buf) + return buf +} + +const encodePositive = (num, buf) => { + buf[0] = 0x80 + + for (var i = buf.length; i > 1; i--) { + buf[i-1] = num & 0xff + num = Math.floor(num / 0x100) + } +} + +const encodeNegative = (num, buf) => { + buf[0] = 0xff + var flipped = false + num = num * -1 + for (var i = buf.length; i > 1; i--) { + var byte = num & 0xff + num = Math.floor(num / 0x100) + if (flipped) + buf[i-1] = onesComp(byte) + else if (byte === 0) + buf[i-1] = 0 + else { + flipped = true + buf[i-1] = twosComp(byte) + } + } +} + +const parse = exports.parse = (buf) => { + var post = buf[buf.length - 1] + var pre = buf[0] + var value; + if (pre === 0x80) + value = pos(buf.slice(1, buf.length)) + else if (pre === 0xff) + value = twos(buf) + else + throw Error('invalid base256 encoding') + + if (!Number.isSafeInteger(value)) + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('parsed number outside of javascript safe integer range') + + return value +} + +const twos = (buf) => { + var len = buf.length + var sum = 0 + var flipped = false + for (var i = len - 1; i > -1; i--) { + var byte = buf[i] + var f + if (flipped) + f = onesComp(byte) + else if (byte === 0) + f = byte + else { + flipped = true + f = twosComp(byte) + } + if (f !== 0) + sum -= f * Math.pow(256, len - i - 1) + } + return sum +} + +const pos = (buf) => { + var len = buf.length + var sum = 0 + for (var i = len - 1; i > -1; i--) { + var byte = buf[i] + if (byte !== 0) + sum += byte * Math.pow(256, len - i - 1) + } + return sum +} + +const onesComp = byte => (0xff ^ byte) & 0xff + +const twosComp = byte => ((0xff ^ byte) + 1) & 0xff + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/list.js": +/*!******************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/list.js ***! + \******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// XXX: This shares a lot in common with extract.js +// maybe some DRY opportunity here? + +// tar -t +const hlo = __webpack_require__(/*! ./high-level-opt.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/high-level-opt.js") +const Parser = __webpack_require__(/*! ./parse.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/parse.js") +const fs = __webpack_require__(/*! fs */ "fs") +const fsm = __webpack_require__(/*! fs-minipass */ "./.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip/node_modules/fs-minipass/index.js") +const path = __webpack_require__(/*! path */ "path") + +const t = module.exports = (opt_, files, cb) => { + if (typeof opt_ === 'function') + cb = opt_, files = null, opt_ = {} + else if (Array.isArray(opt_)) + files = opt_, opt_ = {} + + if (typeof files === 'function') + cb = files, files = null + + if (!files) + files = [] + else + files = Array.from(files) + + const opt = hlo(opt_) + + if (opt.sync && typeof cb === 'function') + throw new TypeError('callback not supported for sync tar functions') + + if (!opt.file && typeof cb === 'function') + throw new TypeError('callback only supported with file option') + + if (files.length) + filesFilter(opt, files) + + if (!opt.noResume) + onentryFunction(opt) + + return opt.file && opt.sync ? listFileSync(opt) + : opt.file ? listFile(opt, cb) + : list(opt) +} + +const onentryFunction = opt => { + const onentry = opt.onentry + opt.onentry = onentry ? e => { + onentry(e) + e.resume() + } : e => e.resume() +} + +// construct a filter that limits the file entries listed +// include child entries if a dir is included +const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [f.replace(/\/+$/, ''), true])) + const filter = opt.filter + + const mapHas = (file, r) => { + const root = r || path.parse(file).root || '.' + const ret = file === root ? false + : map.has(file) ? map.get(file) + : mapHas(path.dirname(file), root) + + map.set(file, ret) + return ret + } + + opt.filter = filter + ? (file, entry) => filter(file, entry) && mapHas(file.replace(/\/+$/, '')) + : file => mapHas(file.replace(/\/+$/, '')) +} + +const listFileSync = opt => { + const p = list(opt) + const file = opt.file + let threw = true + let fd + try { + const stat = fs.statSync(file) + const readSize = opt.maxReadSize || 16*1024*1024 + if (stat.size < readSize) { + p.end(fs.readFileSync(file)) + } else { + let pos = 0 + const buf = Buffer.allocUnsafe(readSize) + fd = fs.openSync(file, 'r') + while (pos < stat.size) { + let bytesRead = fs.readSync(fd, buf, 0, readSize, pos) + pos += bytesRead + p.write(buf.slice(0, bytesRead)) + } + p.end() + } + threw = false + } finally { + if (threw && fd) + try { fs.closeSync(fd) } catch (er) {} + } +} + +const listFile = (opt, cb) => { + const parse = new Parser(opt) + const readSize = opt.maxReadSize || 16*1024*1024 + + const file = opt.file + const p = new Promise((resolve, reject) => { + parse.on('error', reject) + parse.on('end', resolve) + + fs.stat(file, (er, stat) => { + if (er) + reject(er) + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size + }) + stream.on('error', reject) + stream.pipe(parse) + } + }) + }) + return cb ? p.then(cb, cb) : p +} + +const list = opt => new Parser(opt) + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/mkdir.js": +/*!*******************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/mkdir.js ***! + \*******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +// wrapper around mkdirp for tar's needs. + +// TODO: This should probably be a class, not functionally +// passing around state in a gazillion args. + +const mkdirp = __webpack_require__(/*! mkdirp */ "./.yarn/cache/mkdirp-npm-1.0.3-02fc91ac70-c5c46ae417.zip/node_modules/mkdirp/index.js") +const fs = __webpack_require__(/*! fs */ "fs") +const path = __webpack_require__(/*! path */ "path") +const chownr = __webpack_require__(/*! chownr */ "./.yarn/cache/chownr-npm-1.1.4-5bd400ab08-115648f8eb.zip/node_modules/chownr/chownr.js") + +class SymlinkError extends Error { + constructor (symlink, path) { + super('Cannot extract through symbolic link') + this.path = path + this.symlink = symlink + } + + get name () { + return 'SylinkError' + } +} + +class CwdError extends Error { + constructor (path, code) { + super(code + ': Cannot cd into \'' + path + '\'') + this.path = path + this.code = code + } + + get name () { + return 'CwdError' + } +} + +const mkdir = module.exports = (dir, opt, cb) => { + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + const umask = opt.umask + const mode = opt.mode | 0o0700 + const needChmod = (mode & umask) !== 0 + + const uid = opt.uid + const gid = opt.gid + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + ( uid !== opt.processUid || gid !== opt.processGid ) + + const preserve = opt.preserve + const unlink = opt.unlink + const cache = opt.cache + const cwd = opt.cwd + + const done = (er, created) => { + if (er) + cb(er) + else { + cache.set(dir, true) + if (created && doChown) + chownr(created, uid, gid, er => done(er)) + else if (needChmod) + fs.chmod(dir, mode, cb) + else + cb() + } + } + + if (cache && cache.get(dir) === true) + return done() + + if (dir === cwd) + return fs.stat(dir, (er, st) => { + if (er || !st.isDirectory()) + er = new CwdError(dir, er && er.code || 'ENOTDIR') + done(er) + }) + + if (preserve) + return mkdirp(dir, {mode}).then(made => done(null, made), done) + + const sub = path.relative(cwd, dir) + const parts = sub.split(/\/|\\/) + mkdir_(cwd, parts, mode, cache, unlink, cwd, null, done) +} + +const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { + if (!parts.length) + return cb(null, created) + const p = parts.shift() + const part = base + '/' + p + if (cache.get(part)) + return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) + fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)) +} + +const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => { + if (er) { + if (er.path && path.dirname(er.path) === cwd && + (er.code === 'ENOTDIR' || er.code === 'ENOENT')) + return cb(new CwdError(cwd, er.code)) + + fs.lstat(part, (statEr, st) => { + if (statEr) + cb(statEr) + else if (st.isDirectory()) + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) + else if (unlink) + fs.unlink(part, er => { + if (er) + return cb(er) + fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)) + }) + else if (st.isSymbolicLink()) + return cb(new SymlinkError(part, part + '/' + parts.join('/'))) + else + cb(er) + }) + } else { + created = created || part + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) + } +} + +const mkdirSync = module.exports.sync = (dir, opt) => { + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + const umask = opt.umask + const mode = opt.mode | 0o0700 + const needChmod = (mode & umask) !== 0 + + const uid = opt.uid + const gid = opt.gid + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + ( uid !== opt.processUid || gid !== opt.processGid ) + + const preserve = opt.preserve + const unlink = opt.unlink + const cache = opt.cache + const cwd = opt.cwd + + const done = (created) => { + cache.set(dir, true) + if (created && doChown) + chownr.sync(created, uid, gid) + if (needChmod) + fs.chmodSync(dir, mode) + } + + if (cache && cache.get(dir) === true) + return done() + + if (dir === cwd) { + let ok = false + let code = 'ENOTDIR' + try { + ok = fs.statSync(dir).isDirectory() + } catch (er) { + code = er.code + } finally { + if (!ok) + throw new CwdError(dir, code) + } + done() + return + } + + if (preserve) + return done(mkdirp.sync(dir, mode)) + + const sub = path.relative(cwd, dir) + const parts = sub.split(/\/|\\/) + let created = null + for (let p = parts.shift(), part = cwd; + p && (part += '/' + p); + p = parts.shift()) { + + if (cache.get(part)) + continue + + try { + fs.mkdirSync(part, mode) + created = created || part + cache.set(part, true) + } catch (er) { + if (er.path && path.dirname(er.path) === cwd && + (er.code === 'ENOTDIR' || er.code === 'ENOENT')) + return new CwdError(cwd, er.code) + + const st = fs.lstatSync(part) + if (st.isDirectory()) { + cache.set(part, true) + continue + } else if (unlink) { + fs.unlinkSync(part) + fs.mkdirSync(part, mode) + created = created || part + cache.set(part, true) + continue + } else if (st.isSymbolicLink()) + return new SymlinkError(part, part + '/' + parts.join('/')) + } + } + + return done(created) +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/mode-fix.js": +/*!**********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/mode-fix.js ***! + \**********************************************************************************************/ +/***/ ((module) => { + +"use strict"; + +module.exports = (mode, isDir, portable) => { + mode &= 0o7777 + + // in portable mode, use the minimum reasonable umask + // if this system creates files with 0o664 by default + // (as some linux distros do), then we'll write the + // archive with 0o644 instead. Also, don't ever create + // a file that is not readable/writable by the owner. + if (portable) { + mode = (mode | 0o600) &~0o22 + } + + // if dirs are readable, then they should be listable + if (isDir) { + if (mode & 0o400) + mode |= 0o100 + if (mode & 0o40) + mode |= 0o10 + if (mode & 0o4) + mode |= 0o1 + } + return mode +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pack.js": +/*!******************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pack.js ***! + \******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// A readable tar stream creator +// Technically, this is a transform stream that you write paths into, +// and tar format comes out of. +// The `add()` method is like `write()` but returns this, +// and end() return `this` as well, so you can +// do `new Pack(opt).add('files').add('dir').end().pipe(output) +// You could also do something like: +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) + +class PackJob { + constructor (path, absolute) { + this.path = path || './' + this.absolute = absolute + this.entry = null + this.stat = null + this.readdir = null + this.pending = false + this.ignore = false + this.piped = false + } +} + +const MiniPass = __webpack_require__(/*! minipass */ "./.yarn/cache/minipass-npm-3.1.1-b51d7e264d-cfcfd86adc.zip/node_modules/minipass/index.js") +const zlib = __webpack_require__(/*! minizlib */ "./.yarn/cache/minizlib-npm-2.1.0-9531be52b3-6a811aaa3a.zip/node_modules/minizlib/index.js") +const ReadEntry = __webpack_require__(/*! ./read-entry.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/read-entry.js") +const WriteEntry = __webpack_require__(/*! ./write-entry.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/write-entry.js") +const WriteEntrySync = WriteEntry.Sync +const WriteEntryTar = WriteEntry.Tar +const Yallist = __webpack_require__(/*! yallist */ "./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/yallist.js") +const EOF = Buffer.alloc(1024) +const ONSTAT = Symbol('onStat') +const ENDED = Symbol('ended') +const QUEUE = Symbol('queue') +const CURRENT = Symbol('current') +const PROCESS = Symbol('process') +const PROCESSING = Symbol('processing') +const PROCESSJOB = Symbol('processJob') +const JOBS = Symbol('jobs') +const JOBDONE = Symbol('jobDone') +const ADDFSENTRY = Symbol('addFSEntry') +const ADDTARENTRY = Symbol('addTarEntry') +const STAT = Symbol('stat') +const READDIR = Symbol('readdir') +const ONREADDIR = Symbol('onreaddir') +const PIPE = Symbol('pipe') +const ENTRY = Symbol('entry') +const ENTRYOPT = Symbol('entryOpt') +const WRITEENTRYCLASS = Symbol('writeEntryClass') +const WRITE = Symbol('write') +const ONDRAIN = Symbol('ondrain') + +const fs = __webpack_require__(/*! fs */ "fs") +const path = __webpack_require__(/*! path */ "path") +const warner = __webpack_require__(/*! ./warn-mixin.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/warn-mixin.js") + +const Pack = warner(class Pack extends MiniPass { + constructor (opt) { + super(opt) + opt = opt || Object.create(null) + this.opt = opt + this.file = opt.file || '' + this.cwd = opt.cwd || process.cwd() + this.maxReadSize = opt.maxReadSize + this.preservePaths = !!opt.preservePaths + this.strict = !!opt.strict + this.noPax = !!opt.noPax + this.prefix = (opt.prefix || '').replace(/(\\|\/)+$/, '') + this.linkCache = opt.linkCache || new Map() + this.statCache = opt.statCache || new Map() + this.readdirCache = opt.readdirCache || new Map() + + this[WRITEENTRYCLASS] = WriteEntry + if (typeof opt.onwarn === 'function') + this.on('warn', opt.onwarn) + + this.portable = !!opt.portable + this.zip = null + if (opt.gzip) { + if (typeof opt.gzip !== 'object') + opt.gzip = {} + if (this.portable) + opt.gzip.portable = true + this.zip = new zlib.Gzip(opt.gzip) + this.zip.on('data', chunk => super.write(chunk)) + this.zip.on('end', _ => super.end()) + this.zip.on('drain', _ => this[ONDRAIN]()) + this.on('resume', _ => this.zip.resume()) + } else + this.on('drain', this[ONDRAIN]) + + this.noDirRecurse = !!opt.noDirRecurse + this.follow = !!opt.follow + this.noMtime = !!opt.noMtime + this.mtime = opt.mtime || null + + this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true + + this[QUEUE] = new Yallist + this[JOBS] = 0 + this.jobs = +opt.jobs || 4 + this[PROCESSING] = false + this[ENDED] = false + } + + [WRITE] (chunk) { + return super.write(chunk) + } + + add (path) { + this.write(path) + return this + } + + end (path) { + if (path) + this.write(path) + this[ENDED] = true + this[PROCESS]() + return this + } + + write (path) { + if (this[ENDED]) + throw new Error('write after end') + + if (path instanceof ReadEntry) + this[ADDTARENTRY](path) + else + this[ADDFSENTRY](path) + return this.flowing + } + + [ADDTARENTRY] (p) { + const absolute = path.resolve(this.cwd, p.path) + if (this.prefix) + p.path = this.prefix + '/' + p.path.replace(/^\.(\/+|$)/, '') + + // in this case, we don't have to wait for the stat + if (!this.filter(p.path, p)) + p.resume() + else { + const job = new PackJob(p.path, absolute, false) + job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)) + job.entry.on('end', _ => this[JOBDONE](job)) + this[JOBS] += 1 + this[QUEUE].push(job) + } + + this[PROCESS]() + } + + [ADDFSENTRY] (p) { + const absolute = path.resolve(this.cwd, p) + if (this.prefix) + p = this.prefix + '/' + p.replace(/^\.(\/+|$)/, '') + + this[QUEUE].push(new PackJob(p, absolute)) + this[PROCESS]() + } + + [STAT] (job) { + job.pending = true + this[JOBS] += 1 + const stat = this.follow ? 'stat' : 'lstat' + fs[stat](job.absolute, (er, stat) => { + job.pending = false + this[JOBS] -= 1 + if (er) + this.emit('error', er) + else + this[ONSTAT](job, stat) + }) + } + + [ONSTAT] (job, stat) { + this.statCache.set(job.absolute, stat) + job.stat = stat + + // now we have the stat, we can filter it. + if (!this.filter(job.path, stat)) + job.ignore = true + + this[PROCESS]() + } + + [READDIR] (job) { + job.pending = true + this[JOBS] += 1 + fs.readdir(job.absolute, (er, entries) => { + job.pending = false + this[JOBS] -= 1 + if (er) + return this.emit('error', er) + this[ONREADDIR](job, entries) + }) + } + + [ONREADDIR] (job, entries) { + this.readdirCache.set(job.absolute, entries) + job.readdir = entries + this[PROCESS]() + } + + [PROCESS] () { + if (this[PROCESSING]) + return + + this[PROCESSING] = true + for (let w = this[QUEUE].head; + w !== null && this[JOBS] < this.jobs; + w = w.next) { + this[PROCESSJOB](w.value) + if (w.value.ignore) { + const p = w.next + this[QUEUE].removeNode(w) + w.next = p + } + } + + this[PROCESSING] = false + + if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { + if (this.zip) + this.zip.end(EOF) + else { + super.write(EOF) + super.end() + } + } + } + + get [CURRENT] () { + return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value + } + + [JOBDONE] (job) { + this[QUEUE].shift() + this[JOBS] -= 1 + this[PROCESS]() + } + + [PROCESSJOB] (job) { + if (job.pending) + return + + if (job.entry) { + if (job === this[CURRENT] && !job.piped) + this[PIPE](job) + return + } + + if (!job.stat) { + if (this.statCache.has(job.absolute)) + this[ONSTAT](job, this.statCache.get(job.absolute)) + else + this[STAT](job) + } + if (!job.stat) + return + + // filtered out! + if (job.ignore) + return + + if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) { + if (this.readdirCache.has(job.absolute)) + this[ONREADDIR](job, this.readdirCache.get(job.absolute)) + else + this[READDIR](job) + if (!job.readdir) + return + } + + // we know it doesn't have an entry, because that got checked above + job.entry = this[ENTRY](job) + if (!job.entry) { + job.ignore = true + return + } + + if (job === this[CURRENT] && !job.piped) + this[PIPE](job) + } + + [ENTRYOPT] (job) { + return { + onwarn: (code, msg, data) => this.warn(code, msg, data), + noPax: this.noPax, + cwd: this.cwd, + absolute: job.absolute, + preservePaths: this.preservePaths, + maxReadSize: this.maxReadSize, + strict: this.strict, + portable: this.portable, + linkCache: this.linkCache, + statCache: this.statCache, + noMtime: this.noMtime, + mtime: this.mtime + } + } + + [ENTRY] (job) { + this[JOBS] += 1 + try { + return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)) + .on('end', () => this[JOBDONE](job)) + .on('error', er => this.emit('error', er)) + } catch (er) { + this.emit('error', er) + } + } + + [ONDRAIN] () { + if (this[CURRENT] && this[CURRENT].entry) + this[CURRENT].entry.resume() + } + + // like .pipe() but using super, because our write() is special + [PIPE] (job) { + job.piped = true + + if (job.readdir) + job.readdir.forEach(entry => { + const p = this.prefix ? + job.path.slice(this.prefix.length + 1) || './' + : job.path + + const base = p === './' ? '' : p.replace(/\/*$/, '/') + this[ADDFSENTRY](base + entry) + }) + + const source = job.entry + const zip = this.zip + + if (zip) + source.on('data', chunk => { + if (!zip.write(chunk)) + source.pause() + }) + else + source.on('data', chunk => { + if (!super.write(chunk)) + source.pause() + }) + } + + pause () { + if (this.zip) + this.zip.pause() + return super.pause() + } +}) + +class PackSync extends Pack { + constructor (opt) { + super(opt) + this[WRITEENTRYCLASS] = WriteEntrySync + } + + // pause/resume are no-ops in sync streams. + pause () {} + resume () {} + + [STAT] (job) { + const stat = this.follow ? 'statSync' : 'lstatSync' + this[ONSTAT](job, fs[stat](job.absolute)) + } + + [READDIR] (job, stat) { + this[ONREADDIR](job, fs.readdirSync(job.absolute)) + } + + // gotta get it all in this tick + [PIPE] (job) { + const source = job.entry + const zip = this.zip + + if (job.readdir) + job.readdir.forEach(entry => { + const p = this.prefix ? + job.path.slice(this.prefix.length + 1) || './' + : job.path + + const base = p === './' ? '' : p.replace(/\/*$/, '/') + this[ADDFSENTRY](base + entry) + }) + + if (zip) + source.on('data', chunk => { + zip.write(chunk) + }) + else + source.on('data', chunk => { + super[WRITE](chunk) + }) + } +} + +Pack.Sync = PackSync + +module.exports = Pack + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/parse.js": +/*!*******************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/parse.js ***! + \*******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// this[BUFFER] is the remainder of a chunk if we're waiting for +// the full 512 bytes of a header to come in. We will Buffer.concat() +// it to the next write(), which is a mem copy, but a small one. +// +// this[QUEUE] is a Yallist of entries that haven't been emitted +// yet this can only get filled up if the user keeps write()ing after +// a write() returns false, or does a write() with more than one entry +// +// We don't buffer chunks, we always parse them and either create an +// entry, or push it into the active entry. The ReadEntry class knows +// to throw data away if .ignore=true +// +// Shift entry off the buffer when it emits 'end', and emit 'entry' for +// the next one in the list. +// +// At any time, we're pushing body chunks into the entry at WRITEENTRY, +// and waiting for 'end' on the entry at READENTRY +// +// ignored entries get .resume() called on them straight away + +const warner = __webpack_require__(/*! ./warn-mixin.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/warn-mixin.js") +const path = __webpack_require__(/*! path */ "path") +const Header = __webpack_require__(/*! ./header.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/header.js") +const EE = __webpack_require__(/*! events */ "events") +const Yallist = __webpack_require__(/*! yallist */ "./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/yallist.js") +const maxMetaEntrySize = 1024 * 1024 +const Entry = __webpack_require__(/*! ./read-entry.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/read-entry.js") +const Pax = __webpack_require__(/*! ./pax.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pax.js") +const zlib = __webpack_require__(/*! minizlib */ "./.yarn/cache/minizlib-npm-2.1.0-9531be52b3-6a811aaa3a.zip/node_modules/minizlib/index.js") + +const gzipHeader = Buffer.from([0x1f, 0x8b]) +const STATE = Symbol('state') +const WRITEENTRY = Symbol('writeEntry') +const READENTRY = Symbol('readEntry') +const NEXTENTRY = Symbol('nextEntry') +const PROCESSENTRY = Symbol('processEntry') +const EX = Symbol('extendedHeader') +const GEX = Symbol('globalExtendedHeader') +const META = Symbol('meta') +const EMITMETA = Symbol('emitMeta') +const BUFFER = Symbol('buffer') +const QUEUE = Symbol('queue') +const ENDED = Symbol('ended') +const EMITTEDEND = Symbol('emittedEnd') +const EMIT = Symbol('emit') +const UNZIP = Symbol('unzip') +const CONSUMECHUNK = Symbol('consumeChunk') +const CONSUMECHUNKSUB = Symbol('consumeChunkSub') +const CONSUMEBODY = Symbol('consumeBody') +const CONSUMEMETA = Symbol('consumeMeta') +const CONSUMEHEADER = Symbol('consumeHeader') +const CONSUMING = Symbol('consuming') +const BUFFERCONCAT = Symbol('bufferConcat') +const MAYBEEND = Symbol('maybeEnd') +const WRITING = Symbol('writing') +const ABORTED = Symbol('aborted') +const DONE = Symbol('onDone') +const SAW_VALID_ENTRY = Symbol('sawValidEntry') +const SAW_NULL_BLOCK = Symbol('sawNullBlock') +const SAW_EOF = Symbol('sawEOF') + +const noop = _ => true + +module.exports = warner(class Parser extends EE { + constructor (opt) { + opt = opt || {} + super(opt) + + this.file = opt.file || '' + + // set to boolean false when an entry starts. 1024 bytes of \0 + // is technically a valid tarball, albeit a boring one. + this[SAW_VALID_ENTRY] = null + + // these BADARCHIVE errors can't be detected early. listen on DONE. + this.on(DONE, _ => { + if (this[STATE] === 'begin' || this[SAW_VALID_ENTRY] === false) { + // either less than 1 block of data, or all entries were invalid. + // Either way, probably not even a tarball. + this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format') + } + }) + + if (opt.ondone) + this.on(DONE, opt.ondone) + else + this.on(DONE, _ => { + this.emit('prefinish') + this.emit('finish') + this.emit('end') + this.emit('close') + }) + + this.strict = !!opt.strict + this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize + this.filter = typeof opt.filter === 'function' ? opt.filter : noop + + // have to set this so that streams are ok piping into it + this.writable = true + this.readable = false + + this[QUEUE] = new Yallist() + this[BUFFER] = null + this[READENTRY] = null + this[WRITEENTRY] = null + this[STATE] = 'begin' + this[META] = '' + this[EX] = null + this[GEX] = null + this[ENDED] = false + this[UNZIP] = null + this[ABORTED] = false + this[SAW_NULL_BLOCK] = false + this[SAW_EOF] = false + if (typeof opt.onwarn === 'function') + this.on('warn', opt.onwarn) + if (typeof opt.onentry === 'function') + this.on('entry', opt.onentry) + } + + [CONSUMEHEADER] (chunk, position) { + if (this[SAW_VALID_ENTRY] === null) + this[SAW_VALID_ENTRY] = false + let header + try { + header = new Header(chunk, position, this[EX], this[GEX]) + } catch (er) { + return this.warn('TAR_ENTRY_INVALID', er) + } + + if (header.nullBlock) { + if (this[SAW_NULL_BLOCK]) { + this[SAW_EOF] = true + // ending an archive with no entries. pointless, but legal. + if (this[STATE] === 'begin') + this[STATE] = 'header' + this[EMIT]('eof') + } else { + this[SAW_NULL_BLOCK] = true + this[EMIT]('nullBlock') + } + } else { + this[SAW_NULL_BLOCK] = false + if (!header.cksumValid) + this.warn('TAR_ENTRY_INVALID', 'checksum failure', {header}) + else if (!header.path) + this.warn('TAR_ENTRY_INVALID', 'path is required', {header}) + else { + const type = header.type + if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) + this.warn('TAR_ENTRY_INVALID', 'linkpath required', {header}) + else if (!/^(Symbolic)?Link$/.test(type) && header.linkpath) + this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {header}) + else { + const entry = this[WRITEENTRY] = new Entry(header, this[EX], this[GEX]) + + // we do this for meta & ignored entries as well, because they + // are still valid tar, or else we wouldn't know to ignore them + if (!this[SAW_VALID_ENTRY]) { + if (entry.remain) { + // this might be the one! + const onend = () => { + if (!entry.invalid) + this[SAW_VALID_ENTRY] = true + } + entry.on('end', onend) + } else { + this[SAW_VALID_ENTRY] = true + } + } + + if (entry.meta) { + if (entry.size > this.maxMetaEntrySize) { + entry.ignore = true + this[EMIT]('ignoredEntry', entry) + this[STATE] = 'ignore' + entry.resume() + } else if (entry.size > 0) { + this[META] = '' + entry.on('data', c => this[META] += c) + this[STATE] = 'meta' + } + } else { + this[EX] = null + entry.ignore = entry.ignore || !this.filter(entry.path, entry) + + if (entry.ignore) { + // probably valid, just not something we care about + this[EMIT]('ignoredEntry', entry) + this[STATE] = entry.remain ? 'ignore' : 'header' + entry.resume() + } else { + if (entry.remain) + this[STATE] = 'body' + else { + this[STATE] = 'header' + entry.end() + } + + if (!this[READENTRY]) { + this[QUEUE].push(entry) + this[NEXTENTRY]() + } else + this[QUEUE].push(entry) + } + } + } + } + } + } + + [PROCESSENTRY] (entry) { + let go = true + + if (!entry) { + this[READENTRY] = null + go = false + } else if (Array.isArray(entry)) + this.emit.apply(this, entry) + else { + this[READENTRY] = entry + this.emit('entry', entry) + if (!entry.emittedEnd) { + entry.on('end', _ => this[NEXTENTRY]()) + go = false + } + } + + return go + } + + [NEXTENTRY] () { + do {} while (this[PROCESSENTRY](this[QUEUE].shift())) + + if (!this[QUEUE].length) { + // At this point, there's nothing in the queue, but we may have an + // entry which is being consumed (readEntry). + // If we don't, then we definitely can handle more data. + // If we do, and either it's flowing, or it has never had any data + // written to it, then it needs more. + // The only other possibility is that it has returned false from a + // write() call, so we wait for the next drain to continue. + const re = this[READENTRY] + const drainNow = !re || re.flowing || re.size === re.remain + if (drainNow) { + if (!this[WRITING]) + this.emit('drain') + } else + re.once('drain', _ => this.emit('drain')) + } + } + + [CONSUMEBODY] (chunk, position) { + // write up to but no more than writeEntry.blockRemain + const entry = this[WRITEENTRY] + const br = entry.blockRemain + const c = (br >= chunk.length && position === 0) ? chunk + : chunk.slice(position, position + br) + + entry.write(c) + + if (!entry.blockRemain) { + this[STATE] = 'header' + this[WRITEENTRY] = null + entry.end() + } + + return c.length + } + + [CONSUMEMETA] (chunk, position) { + const entry = this[WRITEENTRY] + const ret = this[CONSUMEBODY](chunk, position) + + // if we finished, then the entry is reset + if (!this[WRITEENTRY]) + this[EMITMETA](entry) + + return ret + } + + [EMIT] (ev, data, extra) { + if (!this[QUEUE].length && !this[READENTRY]) + this.emit(ev, data, extra) + else + this[QUEUE].push([ev, data, extra]) + } + + [EMITMETA] (entry) { + this[EMIT]('meta', this[META]) + switch (entry.type) { + case 'ExtendedHeader': + case 'OldExtendedHeader': + this[EX] = Pax.parse(this[META], this[EX], false) + break + + case 'GlobalExtendedHeader': + this[GEX] = Pax.parse(this[META], this[GEX], true) + break + + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + this[EX] = this[EX] || Object.create(null) + this[EX].path = this[META].replace(/\0.*/, '') + break + + case 'NextFileHasLongLinkpath': + this[EX] = this[EX] || Object.create(null) + this[EX].linkpath = this[META].replace(/\0.*/, '') + break + + /* istanbul ignore next */ + default: throw new Error('unknown meta: ' + entry.type) + } + } + + abort (error) { + this[ABORTED] = true + this.emit('abort', error) + // always throws, even in non-strict mode + this.warn('TAR_ABORT', error, { recoverable: false }) + } + + write (chunk) { + if (this[ABORTED]) + return + + // first write, might be gzipped + if (this[UNZIP] === null && chunk) { + if (this[BUFFER]) { + chunk = Buffer.concat([this[BUFFER], chunk]) + this[BUFFER] = null + } + if (chunk.length < gzipHeader.length) { + this[BUFFER] = chunk + return true + } + for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) { + if (chunk[i] !== gzipHeader[i]) + this[UNZIP] = false + } + if (this[UNZIP] === null) { + const ended = this[ENDED] + this[ENDED] = false + this[UNZIP] = new zlib.Unzip() + this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)) + this[UNZIP].on('error', er => this.abort(er)) + this[UNZIP].on('end', _ => { + this[ENDED] = true + this[CONSUMECHUNK]() + }) + this[WRITING] = true + const ret = this[UNZIP][ended ? 'end' : 'write' ](chunk) + this[WRITING] = false + return ret + } + } + + this[WRITING] = true + if (this[UNZIP]) + this[UNZIP].write(chunk) + else + this[CONSUMECHUNK](chunk) + this[WRITING] = false + + // return false if there's a queue, or if the current entry isn't flowing + const ret = + this[QUEUE].length ? false : + this[READENTRY] ? this[READENTRY].flowing : + true + + // if we have no queue, then that means a clogged READENTRY + if (!ret && !this[QUEUE].length) + this[READENTRY].once('drain', _ => this.emit('drain')) + + return ret + } + + [BUFFERCONCAT] (c) { + if (c && !this[ABORTED]) + this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c + } + + [MAYBEEND] () { + if (this[ENDED] && + !this[EMITTEDEND] && + !this[ABORTED] && + !this[CONSUMING]) { + this[EMITTEDEND] = true + const entry = this[WRITEENTRY] + if (entry && entry.blockRemain) { + // truncated, likely a damaged file + const have = this[BUFFER] ? this[BUFFER].length : 0 + this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${ + entry.blockRemain} more bytes, only ${have} available)`, {entry}) + if (this[BUFFER]) + entry.write(this[BUFFER]) + entry.end() + } + this[EMIT](DONE) + } + } + + [CONSUMECHUNK] (chunk) { + if (this[CONSUMING]) + this[BUFFERCONCAT](chunk) + else if (!chunk && !this[BUFFER]) + this[MAYBEEND]() + else { + this[CONSUMING] = true + if (this[BUFFER]) { + this[BUFFERCONCAT](chunk) + const c = this[BUFFER] + this[BUFFER] = null + this[CONSUMECHUNKSUB](c) + } else { + this[CONSUMECHUNKSUB](chunk) + } + + while (this[BUFFER] && + this[BUFFER].length >= 512 && + !this[ABORTED] && + !this[SAW_EOF]) { + const c = this[BUFFER] + this[BUFFER] = null + this[CONSUMECHUNKSUB](c) + } + this[CONSUMING] = false + } + + if (!this[BUFFER] || this[ENDED]) + this[MAYBEEND]() + } + + [CONSUMECHUNKSUB] (chunk) { + // we know that we are in CONSUMING mode, so anything written goes into + // the buffer. Advance the position and put any remainder in the buffer. + let position = 0 + let length = chunk.length + while (position + 512 <= length && !this[ABORTED] && !this[SAW_EOF]) { + switch (this[STATE]) { + case 'begin': + case 'header': + this[CONSUMEHEADER](chunk, position) + position += 512 + break + + case 'ignore': + case 'body': + position += this[CONSUMEBODY](chunk, position) + break + + case 'meta': + position += this[CONSUMEMETA](chunk, position) + break + + /* istanbul ignore next */ + default: + throw new Error('invalid state: ' + this[STATE]) + } + } + + if (position < length) { + if (this[BUFFER]) + this[BUFFER] = Buffer.concat([chunk.slice(position), this[BUFFER]]) + else + this[BUFFER] = chunk.slice(position) + } + } + + end (chunk) { + if (!this[ABORTED]) { + if (this[UNZIP]) + this[UNZIP].end(chunk) + else { + this[ENDED] = true + this.write(chunk) + } + } + } +}) + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/path-reservations.js": +/*!*******************************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/path-reservations.js ***! + \*******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// A path exclusive reservation system +// reserve([list, of, paths], fn) +// When the fn is first in line for all its paths, it +// is called with a cb that clears the reservation. +// +// Used by async unpack to avoid clobbering paths in use, +// while still allowing maximal safe parallelization. + +const assert = __webpack_require__(/*! assert */ "assert") + +module.exports = () => { + // path => [function or Set] + // A Set object means a directory reservation + // A fn is a direct reservation on that path + const queues = new Map() + + // fn => {paths:[path,...], dirs:[path, ...]} + const reservations = new Map() + + // return a set of parent dirs for a given path + const { join } = __webpack_require__(/*! path */ "path") + const getDirs = path => + join(path).split(/[\\\/]/).slice(0, -1).reduce((set, path) => + set.length ? set.concat(join(set[set.length-1], path)) : [path], []) + + // functions currently running + const running = new Set() + + // return the queues for each path the function cares about + // fn => {paths, dirs} + const getQueues = fn => { + const res = reservations.get(fn) + /* istanbul ignore if - unpossible */ + if (!res) + throw new Error('function does not have any path reservations') + return { + paths: res.paths.map(path => queues.get(path)), + dirs: [...res.dirs].map(path => queues.get(path)), + } + } + + // check if fn is first in line for all its paths, and is + // included in the first set for all its dir queues + const check = fn => { + const {paths, dirs} = getQueues(fn) + return paths.every(q => q[0] === fn) && + dirs.every(q => q[0] instanceof Set && q[0].has(fn)) + } + + // run the function if it's first in line and not already running + const run = fn => { + if (running.has(fn) || !check(fn)) + return false + running.add(fn) + fn(() => clear(fn)) + return true + } + + const clear = fn => { + if (!running.has(fn)) + return false + + const { paths, dirs } = reservations.get(fn) + const next = new Set() + + paths.forEach(path => { + const q = queues.get(path) + assert.equal(q[0], fn) + if (q.length === 1) + queues.delete(path) + else { + q.shift() + if (typeof q[0] === 'function') + next.add(q[0]) + else + q[0].forEach(fn => next.add(fn)) + } + }) + + dirs.forEach(dir => { + const q = queues.get(dir) + assert(q[0] instanceof Set) + if (q[0].size === 1 && q.length === 1) { + queues.delete(dir) + } else if (q[0].size === 1) { + q.shift() + + // must be a function or else the Set would've been reused + next.add(q[0]) + } else + q[0].delete(fn) + }) + running.delete(fn) + + next.forEach(fn => run(fn)) + return true + } + + const reserve = (paths, fn) => { + const dirs = new Set( + paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)) + ) + reservations.set(fn, {dirs, paths}) + paths.forEach(path => { + const q = queues.get(path) + if (!q) + queues.set(path, [fn]) + else + q.push(fn) + }) + dirs.forEach(dir => { + const q = queues.get(dir) + if (!q) + queues.set(dir, [new Set([fn])]) + else if (q[q.length-1] instanceof Set) + q[q.length-1].add(fn) + else + q.push(new Set([fn])) + }) + + return run(fn) + } + + return { check, reserve } +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pax.js": +/*!*****************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pax.js ***! + \*****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const Header = __webpack_require__(/*! ./header.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/header.js") +const path = __webpack_require__(/*! path */ "path") + +class Pax { + constructor (obj, global) { + this.atime = obj.atime || null + this.charset = obj.charset || null + this.comment = obj.comment || null + this.ctime = obj.ctime || null + this.gid = obj.gid || null + this.gname = obj.gname || null + this.linkpath = obj.linkpath || null + this.mtime = obj.mtime || null + this.path = obj.path || null + this.size = obj.size || null + this.uid = obj.uid || null + this.uname = obj.uname || null + this.dev = obj.dev || null + this.ino = obj.ino || null + this.nlink = obj.nlink || null + this.global = global || false + } + + encode () { + const body = this.encodeBody() + if (body === '') + return null + + const bodyLen = Buffer.byteLength(body) + // round up to 512 bytes + // add 512 for header + const bufLen = 512 * Math.ceil(1 + bodyLen / 512) + const buf = Buffer.allocUnsafe(bufLen) + + // 0-fill the header section, it might not hit every field + for (let i = 0; i < 512; i++) { + buf[i] = 0 + } + + new Header({ + // XXX split the path + // then the path should be PaxHeader + basename, but less than 99, + // prepend with the dirname + path: ('PaxHeader/' + path.basename(this.path)).slice(0, 99), + mode: this.mode || 0o644, + uid: this.uid || null, + gid: this.gid || null, + size: bodyLen, + mtime: this.mtime || null, + type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', + linkpath: '', + uname: this.uname || '', + gname: this.gname || '', + devmaj: 0, + devmin: 0, + atime: this.atime || null, + ctime: this.ctime || null + }).encode(buf) + + buf.write(body, 512, bodyLen, 'utf8') + + // null pad after the body + for (let i = bodyLen + 512; i < buf.length; i++) { + buf[i] = 0 + } + + return buf + } + + encodeBody () { + return ( + this.encodeField('path') + + this.encodeField('ctime') + + this.encodeField('atime') + + this.encodeField('dev') + + this.encodeField('ino') + + this.encodeField('nlink') + + this.encodeField('charset') + + this.encodeField('comment') + + this.encodeField('gid') + + this.encodeField('gname') + + this.encodeField('linkpath') + + this.encodeField('mtime') + + this.encodeField('size') + + this.encodeField('uid') + + this.encodeField('uname') + ) + } + + encodeField (field) { + if (this[field] === null || this[field] === undefined) + return '' + const v = this[field] instanceof Date ? this[field].getTime() / 1000 + : this[field] + const s = ' ' + + (field === 'dev' || field === 'ino' || field === 'nlink' + ? 'SCHILY.' : '') + + field + '=' + v + '\n' + const byteLen = Buffer.byteLength(s) + // the digits includes the length of the digits in ascii base-10 + // so if it's 9 characters, then adding 1 for the 9 makes it 10 + // which makes it 11 chars. + let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1 + if (byteLen + digits >= Math.pow(10, digits)) + digits += 1 + const len = digits + byteLen + return len + s + } +} + +Pax.parse = (string, ex, g) => new Pax(merge(parseKV(string), ex), g) + +const merge = (a, b) => + b ? Object.keys(a).reduce((s, k) => (s[k] = a[k], s), b) : a + +const parseKV = string => + string + .replace(/\n$/, '') + .split('\n') + .reduce(parseKVLine, Object.create(null)) + +const parseKVLine = (set, line) => { + const n = parseInt(line, 10) + + // XXX Values with \n in them will fail this. + // Refactor to not be a naive line-by-line parse. + if (n !== Buffer.byteLength(line) + 1) + return set + + line = line.substr((n + ' ').length) + const kv = line.split('=') + const k = kv.shift().replace(/^SCHILY\.(dev|ino|nlink)/, '$1') + if (!k) + return set + + const v = kv.join('=') + set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) + ? new Date(v * 1000) + : /^[0-9]+$/.test(v) ? +v + : v + return set +} + +module.exports = Pax + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/read-entry.js": +/*!************************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/read-entry.js ***! + \************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const types = __webpack_require__(/*! ./types.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/types.js") +const MiniPass = __webpack_require__(/*! minipass */ "./.yarn/cache/minipass-npm-3.1.1-b51d7e264d-cfcfd86adc.zip/node_modules/minipass/index.js") + +const SLURP = Symbol('slurp') +module.exports = class ReadEntry extends MiniPass { + constructor (header, ex, gex) { + super() + // read entries always start life paused. this is to avoid the + // situation where Minipass's auto-ending empty streams results + // in an entry ending before we're ready for it. + this.pause() + this.extended = ex + this.globalExtended = gex + this.header = header + this.startBlockSize = 512 * Math.ceil(header.size / 512) + this.blockRemain = this.startBlockSize + this.remain = header.size + this.type = header.type + this.meta = false + this.ignore = false + switch (this.type) { + case 'File': + case 'OldFile': + case 'Link': + case 'SymbolicLink': + case 'CharacterDevice': + case 'BlockDevice': + case 'Directory': + case 'FIFO': + case 'ContiguousFile': + case 'GNUDumpDir': + break + + case 'NextFileHasLongLinkpath': + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + case 'GlobalExtendedHeader': + case 'ExtendedHeader': + case 'OldExtendedHeader': + this.meta = true + break + + // NOTE: gnutar and bsdtar treat unrecognized types as 'File' + // it may be worth doing the same, but with a warning. + default: + this.ignore = true + } + + this.path = header.path + this.mode = header.mode + if (this.mode) + this.mode = this.mode & 0o7777 + this.uid = header.uid + this.gid = header.gid + this.uname = header.uname + this.gname = header.gname + this.size = header.size + this.mtime = header.mtime + this.atime = header.atime + this.ctime = header.ctime + this.linkpath = header.linkpath + this.uname = header.uname + this.gname = header.gname + + if (ex) this[SLURP](ex) + if (gex) this[SLURP](gex, true) + } + + write (data) { + const writeLen = data.length + if (writeLen > this.blockRemain) + throw new Error('writing more to entry than is appropriate') + + const r = this.remain + const br = this.blockRemain + this.remain = Math.max(0, r - writeLen) + this.blockRemain = Math.max(0, br - writeLen) + if (this.ignore) + return true + + if (r >= writeLen) + return super.write(data) + + // r < writeLen + return super.write(data.slice(0, r)) + } + + [SLURP] (ex, global) { + for (let k in ex) { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. + if (ex[k] !== null && ex[k] !== undefined && + !(global && k === 'path')) + this[k] = ex[k] + } + } +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/replace.js": +/*!*********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/replace.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// tar -r +const hlo = __webpack_require__(/*! ./high-level-opt.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/high-level-opt.js") +const Pack = __webpack_require__(/*! ./pack.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pack.js") +const Parse = __webpack_require__(/*! ./parse.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/parse.js") +const fs = __webpack_require__(/*! fs */ "fs") +const fsm = __webpack_require__(/*! fs-minipass */ "./.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip/node_modules/fs-minipass/index.js") +const t = __webpack_require__(/*! ./list.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/list.js") +const path = __webpack_require__(/*! path */ "path") + +// starting at the head of the file, read a Header +// If the checksum is invalid, that's our position to start writing +// If it is, jump forward by the specified size (round up to 512) +// and try again. +// Write the new Pack stream starting there. + +const Header = __webpack_require__(/*! ./header.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/header.js") + +const r = module.exports = (opt_, files, cb) => { + const opt = hlo(opt_) + + if (!opt.file) + throw new TypeError('file is required') + + if (opt.gzip) + throw new TypeError('cannot append to compressed archives') + + if (!files || !Array.isArray(files) || !files.length) + throw new TypeError('no files or directories specified') + + files = Array.from(files) + + return opt.sync ? replaceSync(opt, files) + : replace(opt, files, cb) +} + +const replaceSync = (opt, files) => { + const p = new Pack.Sync(opt) + + let threw = true + let fd + let position + + try { + try { + fd = fs.openSync(opt.file, 'r+') + } catch (er) { + if (er.code === 'ENOENT') + fd = fs.openSync(opt.file, 'w+') + else + throw er + } + + const st = fs.fstatSync(fd) + const headBuf = Buffer.alloc(512) + + POSITION: for (position = 0; position < st.size; position += 512) { + for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { + bytes = fs.readSync( + fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos + ) + + if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) + throw new Error('cannot append to compressed archives') + + if (!bytes) + break POSITION + } + + let h = new Header(headBuf) + if (!h.cksumValid) + break + let entryBlockSize = 512 * Math.ceil(h.size / 512) + if (position + entryBlockSize + 512 > st.size) + break + // the 512 for the header we just parsed will be added as well + // also jump ahead all the blocks for the body + position += entryBlockSize + if (opt.mtimeCache) + opt.mtimeCache.set(h.path, h.mtime) + } + threw = false + + streamSync(opt, p, position, fd, files) + } finally { + if (threw) + try { fs.closeSync(fd) } catch (er) {} + } +} + +const streamSync = (opt, p, position, fd, files) => { + const stream = new fsm.WriteStreamSync(opt.file, { + fd: fd, + start: position + }) + p.pipe(stream) + addFilesSync(p, files) +} + +const replace = (opt, files, cb) => { + files = Array.from(files) + const p = new Pack(opt) + + const getPos = (fd, size, cb_) => { + const cb = (er, pos) => { + if (er) + fs.close(fd, _ => cb_(er)) + else + cb_(null, pos) + } + + let position = 0 + if (size === 0) + return cb(null, 0) + + let bufPos = 0 + const headBuf = Buffer.alloc(512) + const onread = (er, bytes) => { + if (er) + return cb(er) + bufPos += bytes + if (bufPos < 512 && bytes) + return fs.read( + fd, headBuf, bufPos, headBuf.length - bufPos, + position + bufPos, onread + ) + + if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) + return cb(new Error('cannot append to compressed archives')) + + // truncated header + if (bufPos < 512) + return cb(null, position) + + const h = new Header(headBuf) + if (!h.cksumValid) + return cb(null, position) + + const entryBlockSize = 512 * Math.ceil(h.size / 512) + if (position + entryBlockSize + 512 > size) + return cb(null, position) + + position += entryBlockSize + 512 + if (position >= size) + return cb(null, position) + + if (opt.mtimeCache) + opt.mtimeCache.set(h.path, h.mtime) + bufPos = 0 + fs.read(fd, headBuf, 0, 512, position, onread) + } + fs.read(fd, headBuf, 0, 512, position, onread) + } + + const promise = new Promise((resolve, reject) => { + p.on('error', reject) + let flag = 'r+' + const onopen = (er, fd) => { + if (er && er.code === 'ENOENT' && flag === 'r+') { + flag = 'w+' + return fs.open(opt.file, flag, onopen) + } + + if (er) + return reject(er) + + fs.fstat(fd, (er, st) => { + if (er) + return reject(er) + getPos(fd, st.size, (er, position) => { + if (er) + return reject(er) + const stream = new fsm.WriteStream(opt.file, { + fd: fd, + start: position + }) + p.pipe(stream) + stream.on('error', reject) + stream.on('close', resolve) + addFilesAsync(p, files) + }) + }) + } + fs.open(opt.file, flag, onopen) + }) + + return cb ? promise.then(cb, cb) : promise +} + +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') + t({ + file: path.resolve(p.cwd, file.substr(1)), + sync: true, + noResume: true, + onentry: entry => p.add(entry) + }) + else + p.add(file) + }) + p.end() +} + +const addFilesAsync = (p, files) => { + while (files.length) { + const file = files.shift() + if (file.charAt(0) === '@') + return t({ + file: path.resolve(p.cwd, file.substr(1)), + noResume: true, + onentry: entry => p.add(entry) + }).then(_ => addFilesAsync(p, files)) + else + p.add(file) + } + p.end() +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/types.js": +/*!*******************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/types.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// map types from key to human-friendly name +exports.name = new Map([ + ['0', 'File'], + // same as File + ['', 'OldFile'], + ['1', 'Link'], + ['2', 'SymbolicLink'], + // Devices and FIFOs aren't fully supported + // they are parsed, but skipped when unpacking + ['3', 'CharacterDevice'], + ['4', 'BlockDevice'], + ['5', 'Directory'], + ['6', 'FIFO'], + // same as File + ['7', 'ContiguousFile'], + // pax headers + ['g', 'GlobalExtendedHeader'], + ['x', 'ExtendedHeader'], + // vendor-specific stuff + // skip + ['A', 'SolarisACL'], + // like 5, but with data, which should be skipped + ['D', 'GNUDumpDir'], + // metadata only, skip + ['I', 'Inode'], + // data = link path of next file + ['K', 'NextFileHasLongLinkpath'], + // data = path of next file + ['L', 'NextFileHasLongPath'], + // skip + ['M', 'ContinuationFile'], + // like L + ['N', 'OldGnuLongPath'], + // skip + ['S', 'SparseFile'], + // skip + ['V', 'TapeVolumeHeader'], + // like x + ['X', 'OldExtendedHeader'] +]) + +// map the other direction +exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]])) + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/unpack.js": +/*!********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/unpack.js ***! + \********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. +// but the path reservations are required to avoid race conditions where +// parallelized unpack ops may mess with one another, due to dependencies +// (like a Link depending on its target) or destructive operations (like +// clobbering an fs object to create one of a different type.) + +const assert = __webpack_require__(/*! assert */ "assert") +const EE = __webpack_require__(/*! events */ "events").EventEmitter +const Parser = __webpack_require__(/*! ./parse.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/parse.js") +const fs = __webpack_require__(/*! fs */ "fs") +const fsm = __webpack_require__(/*! fs-minipass */ "./.yarn/cache/fs-minipass-npm-2.1.0-501ef87306-1b8d128dae.zip/node_modules/fs-minipass/index.js") +const path = __webpack_require__(/*! path */ "path") +const mkdir = __webpack_require__(/*! ./mkdir.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/mkdir.js") +const mkdirSync = mkdir.sync +const wc = __webpack_require__(/*! ./winchars.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/winchars.js") +const pathReservations = __webpack_require__(/*! ./path-reservations.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/path-reservations.js") + +const ONENTRY = Symbol('onEntry') +const CHECKFS = Symbol('checkFs') +const CHECKFS2 = Symbol('checkFs2') +const ISREUSABLE = Symbol('isReusable') +const MAKEFS = Symbol('makeFs') +const FILE = Symbol('file') +const DIRECTORY = Symbol('directory') +const LINK = Symbol('link') +const SYMLINK = Symbol('symlink') +const HARDLINK = Symbol('hardlink') +const UNSUPPORTED = Symbol('unsupported') +const UNKNOWN = Symbol('unknown') +const CHECKPATH = Symbol('checkPath') +const MKDIR = Symbol('mkdir') +const ONERROR = Symbol('onError') +const PENDING = Symbol('pending') +const PEND = Symbol('pend') +const UNPEND = Symbol('unpend') +const ENDED = Symbol('ended') +const MAYBECLOSE = Symbol('maybeClose') +const SKIP = Symbol('skip') +const DOCHOWN = Symbol('doChown') +const UID = Symbol('uid') +const GID = Symbol('gid') +const crypto = __webpack_require__(/*! crypto */ "crypto") +const getFlag = __webpack_require__(/*! ./get-write-flag.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/get-write-flag.js") + +/* istanbul ignore next */ +const neverCalled = () => { + throw new Error('sync function called cb somehow?!?') +} + +// Unlinks on Windows are not atomic. +// +// This means that if you have a file entry, followed by another +// file entry with an identical name, and you cannot re-use the file +// (because it's a hardlink, or because unlink:true is set, or it's +// Windows, which does not have useful nlink values), then the unlink +// will be committed to the disk AFTER the new file has been written +// over the old one, deleting the new file. +// +// To work around this, on Windows systems, we rename the file and then +// delete the renamed file. It's a sloppy kludge, but frankly, I do not +// know of a better way to do this, given windows' non-atomic unlink +// semantics. +// +// See: https://github.com/npm/node-tar/issues/183 +/* istanbul ignore next */ +const unlinkFile = (path, cb) => { + if (process.platform !== 'win32') + return fs.unlink(path, cb) + + const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex') + fs.rename(path, name, er => { + if (er) + return cb(er) + fs.unlink(name, cb) + }) +} + +/* istanbul ignore next */ +const unlinkFileSync = path => { + if (process.platform !== 'win32') + return fs.unlinkSync(path) + + const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex') + fs.renameSync(path, name) + fs.unlinkSync(name) +} + +// this.gid, entry.gid, this.processUid +const uint32 = (a, b, c) => + a === a >>> 0 ? a + : b === b >>> 0 ? b + : c + +class Unpack extends Parser { + constructor (opt) { + if (!opt) + opt = {} + + opt.ondone = _ => { + this[ENDED] = true + this[MAYBECLOSE]() + } + + super(opt) + + this.reservations = pathReservations() + + this.transform = typeof opt.transform === 'function' ? opt.transform : null + + this.writable = true + this.readable = false + + this[PENDING] = 0 + this[ENDED] = false + + this.dirCache = opt.dirCache || new Map() + + if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { + // need both or neither + if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number') + throw new TypeError('cannot set owner without number uid and gid') + if (opt.preserveOwner) + throw new TypeError( + 'cannot preserve owner in archive and also set owner explicitly') + this.uid = opt.uid + this.gid = opt.gid + this.setOwner = true + } else { + this.uid = null + this.gid = null + this.setOwner = false + } + + // default true for root + if (opt.preserveOwner === undefined && typeof opt.uid !== 'number') + this.preserveOwner = process.getuid && process.getuid() === 0 + else + this.preserveOwner = !!opt.preserveOwner + + this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? + process.getuid() : null + this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? + process.getgid() : null + + // mostly just for testing, but useful in some cases. + // Forcibly trigger a chown on every entry, no matter what + this.forceChown = opt.forceChown === true + + // turn > this[ONENTRY](entry)) + } + + // a bad or damaged archive is a warning for Parser, but an error + // when extracting. Mark those errors as unrecoverable, because + // the Unpack contract cannot be met. + warn (code, msg, data = {}) { + if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') + data.recoverable = false + return super.warn(code, msg, data) + } + + [MAYBECLOSE] () { + if (this[ENDED] && this[PENDING] === 0) { + this.emit('prefinish') + this.emit('finish') + this.emit('end') + this.emit('close') + } + } + + [CHECKPATH] (entry) { + if (this.strip) { + const parts = entry.path.split(/\/|\\/) + if (parts.length < this.strip) + return false + entry.path = parts.slice(this.strip).join('/') + + if (entry.type === 'Link') { + const linkparts = entry.linkpath.split(/\/|\\/) + if (linkparts.length >= this.strip) + entry.linkpath = linkparts.slice(this.strip).join('/') + } + } + + if (!this.preservePaths) { + const p = entry.path + if (p.match(/(^|\/|\\)\.\.(\\|\/|$)/)) { + this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { + entry, + path: p, + }) + return false + } + + // absolutes on posix are also absolutes on win32 + // so we only need to test this one to get both + if (path.win32.isAbsolute(p)) { + const parsed = path.win32.parse(p) + entry.path = p.substr(parsed.root.length) + const r = parsed.root + this.warn('TAR_ENTRY_INFO', `stripping ${r} from absolute path`, { + entry, + path: p, + }) + } + } + + // only encode : chars that aren't drive letter indicators + if (this.win32) { + const parsed = path.win32.parse(entry.path) + entry.path = parsed.root === '' ? wc.encode(entry.path) + : parsed.root + wc.encode(entry.path.substr(parsed.root.length)) + } + + if (path.isAbsolute(entry.path)) + entry.absolute = entry.path + else + entry.absolute = path.resolve(this.cwd, entry.path) + + return true + } + + [ONENTRY] (entry) { + if (!this[CHECKPATH](entry)) + return entry.resume() + + assert.equal(typeof entry.absolute, 'string') + + switch (entry.type) { + case 'Directory': + case 'GNUDumpDir': + if (entry.mode) + entry.mode = entry.mode | 0o700 + + case 'File': + case 'OldFile': + case 'ContiguousFile': + case 'Link': + case 'SymbolicLink': + return this[CHECKFS](entry) + + case 'CharacterDevice': + case 'BlockDevice': + case 'FIFO': + return this[UNSUPPORTED](entry) + } + } + + [ONERROR] (er, entry) { + // Cwd has to exist, or else nothing works. That's serious. + // Other errors are warnings, which raise the error in strict + // mode, but otherwise continue on. + if (er.name === 'CwdError') + this.emit('error', er) + else { + this.warn('TAR_ENTRY_ERROR', er, {entry}) + this[UNPEND]() + entry.resume() + } + } + + [MKDIR] (dir, mode, cb) { + mkdir(dir, { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode + }, cb) + } + + [DOCHOWN] (entry) { + // in preserve owner mode, chown if the entry doesn't match process + // in set owner mode, chown if setting doesn't match process + return this.forceChown || + this.preserveOwner && + ( typeof entry.uid === 'number' && entry.uid !== this.processUid || + typeof entry.gid === 'number' && entry.gid !== this.processGid ) + || + ( typeof this.uid === 'number' && this.uid !== this.processUid || + typeof this.gid === 'number' && this.gid !== this.processGid ) + } + + [UID] (entry) { + return uint32(this.uid, entry.uid, this.processUid) + } + + [GID] (entry) { + return uint32(this.gid, entry.gid, this.processGid) + } + + [FILE] (entry, fullyDone) { + const mode = entry.mode & 0o7777 || this.fmode + const stream = new fsm.WriteStream(entry.absolute, { + flags: getFlag(entry.size), + mode: mode, + autoClose: false + }) + stream.on('error', er => this[ONERROR](er, entry)) + + let actions = 1 + const done = er => { + if (er) + return this[ONERROR](er, entry) + + if (--actions === 0) { + fs.close(stream.fd, er => { + fullyDone() + er ? this[ONERROR](er, entry) : this[UNPEND]() + }) + } + } + + stream.on('finish', _ => { + // if futimes fails, try utimes + // if utimes fails, fail with the original error + // same for fchown/chown + const abs = entry.absolute + const fd = stream.fd + + if (entry.mtime && !this.noMtime) { + actions++ + const atime = entry.atime || new Date() + const mtime = entry.mtime + fs.futimes(fd, atime, mtime, er => + er ? fs.utimes(abs, atime, mtime, er2 => done(er2 && er)) + : done()) + } + + if (this[DOCHOWN](entry)) { + actions++ + const uid = this[UID](entry) + const gid = this[GID](entry) + fs.fchown(fd, uid, gid, er => + er ? fs.chown(abs, uid, gid, er2 => done(er2 && er)) + : done()) + } + + done() + }) + + const tx = this.transform ? this.transform(entry) || entry : entry + if (tx !== entry) { + tx.on('error', er => this[ONERROR](er, entry)) + entry.pipe(tx) + } + tx.pipe(stream) + } + + [DIRECTORY] (entry, fullyDone) { + const mode = entry.mode & 0o7777 || this.dmode + this[MKDIR](entry.absolute, mode, er => { + if (er) { + fullyDone() + return this[ONERROR](er, entry) + } + + let actions = 1 + const done = _ => { + if (--actions === 0) { + fullyDone() + this[UNPEND]() + entry.resume() + } + } + + if (entry.mtime && !this.noMtime) { + actions++ + fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, done) + } + + if (this[DOCHOWN](entry)) { + actions++ + fs.chown(entry.absolute, this[UID](entry), this[GID](entry), done) + } + + done() + }) + } + + [UNSUPPORTED] (entry) { + entry.unsupported = true + this.warn('TAR_ENTRY_UNSUPPORTED', + `unsupported entry type: ${entry.type}`, {entry}) + entry.resume() + } + + [SYMLINK] (entry, done) { + this[LINK](entry, entry.linkpath, 'symlink', done) + } + + [HARDLINK] (entry, done) { + this[LINK](entry, path.resolve(this.cwd, entry.linkpath), 'link', done) + } + + [PEND] () { + this[PENDING]++ + } + + [UNPEND] () { + this[PENDING]-- + this[MAYBECLOSE]() + } + + [SKIP] (entry) { + this[UNPEND]() + entry.resume() + } + + // Check if we can reuse an existing filesystem entry safely and + // overwrite it, rather than unlinking and recreating + // Windows doesn't report a useful nlink, so we just never reuse entries + [ISREUSABLE] (entry, st) { + return entry.type === 'File' && + !this.unlink && + st.isFile() && + st.nlink <= 1 && + process.platform !== 'win32' + } + + // check if a thing is there, and if so, try to clobber it + [CHECKFS] (entry) { + this[PEND]() + const paths = [entry.path] + if (entry.linkpath) + paths.push(entry.linkpath) + this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)) + } + [CHECKFS2] (entry, done) { + this[MKDIR](path.dirname(entry.absolute), this.dmode, er => { + if (er) { + done() + return this[ONERROR](er, entry) + } + fs.lstat(entry.absolute, (er, st) => { + if (st && (this.keep || this.newer && st.mtime > entry.mtime)) { + this[SKIP](entry) + done() + } else if (er || this[ISREUSABLE](entry, st)) { + this[MAKEFS](null, entry, done) + } + else if (st.isDirectory()) { + if (entry.type === 'Directory') { + if (!entry.mode || (st.mode & 0o7777) === entry.mode) + this[MAKEFS](null, entry, done) + else + fs.chmod(entry.absolute, entry.mode, + er => this[MAKEFS](er, entry, done)) + } else + fs.rmdir(entry.absolute, er => this[MAKEFS](er, entry, done)) + } else + unlinkFile(entry.absolute, er => this[MAKEFS](er, entry, done)) + }) + }) + } + + [MAKEFS] (er, entry, done) { + if (er) + return this[ONERROR](er, entry) + + switch (entry.type) { + case 'File': + case 'OldFile': + case 'ContiguousFile': + return this[FILE](entry, done) + + case 'Link': + return this[HARDLINK](entry, done) + + case 'SymbolicLink': + return this[SYMLINK](entry, done) + + case 'Directory': + case 'GNUDumpDir': + return this[DIRECTORY](entry, done) + } + } + + [LINK] (entry, linkpath, link, done) { + // XXX: get the type ('file' or 'dir') for windows + fs[link](linkpath, entry.absolute, er => { + if (er) + return this[ONERROR](er, entry) + done() + this[UNPEND]() + entry.resume() + }) + } +} + +class UnpackSync extends Unpack { + constructor (opt) { + super(opt) + } + + [CHECKFS] (entry) { + const er = this[MKDIR](path.dirname(entry.absolute), this.dmode, neverCalled) + if (er) + return this[ONERROR](er, entry) + try { + const st = fs.lstatSync(entry.absolute) + if (this.keep || this.newer && st.mtime > entry.mtime) + return this[SKIP](entry) + else if (this[ISREUSABLE](entry, st)) + return this[MAKEFS](null, entry, neverCalled) + else { + try { + if (st.isDirectory()) { + if (entry.type === 'Directory') { + if (entry.mode && (st.mode & 0o7777) !== entry.mode) + fs.chmodSync(entry.absolute, entry.mode) + } else + fs.rmdirSync(entry.absolute) + } else + unlinkFileSync(entry.absolute) + return this[MAKEFS](null, entry, neverCalled) + } catch (er) { + return this[ONERROR](er, entry) + } + } + } catch (er) { + return this[MAKEFS](null, entry, neverCalled) + } + } + + [FILE] (entry, _) { + const mode = entry.mode & 0o7777 || this.fmode + + const oner = er => { + let closeError + try { + fs.closeSync(fd) + } catch (e) { + closeError = e + } + if (er || closeError) + this[ONERROR](er || closeError, entry) + } + + let stream + let fd + try { + fd = fs.openSync(entry.absolute, getFlag(entry.size), mode) + } catch (er) { + return oner(er) + } + const tx = this.transform ? this.transform(entry) || entry : entry + if (tx !== entry) { + tx.on('error', er => this[ONERROR](er, entry)) + entry.pipe(tx) + } + + tx.on('data', chunk => { + try { + fs.writeSync(fd, chunk, 0, chunk.length) + } catch (er) { + oner(er) + } + }) + + tx.on('end', _ => { + let er = null + // try both, falling futimes back to utimes + // if either fails, handle the first error + if (entry.mtime && !this.noMtime) { + const atime = entry.atime || new Date() + const mtime = entry.mtime + try { + fs.futimesSync(fd, atime, mtime) + } catch (futimeser) { + try { + fs.utimesSync(entry.absolute, atime, mtime) + } catch (utimeser) { + er = futimeser + } + } + } + + if (this[DOCHOWN](entry)) { + const uid = this[UID](entry) + const gid = this[GID](entry) + + try { + fs.fchownSync(fd, uid, gid) + } catch (fchowner) { + try { + fs.chownSync(entry.absolute, uid, gid) + } catch (chowner) { + er = er || fchowner + } + } + } + + oner(er) + }) + } + + [DIRECTORY] (entry, _) { + const mode = entry.mode & 0o7777 || this.dmode + const er = this[MKDIR](entry.absolute, mode) + if (er) + return this[ONERROR](er, entry) + if (entry.mtime && !this.noMtime) { + try { + fs.utimesSync(entry.absolute, entry.atime || new Date(), entry.mtime) + } catch (er) {} + } + if (this[DOCHOWN](entry)) { + try { + fs.chownSync(entry.absolute, this[UID](entry), this[GID](entry)) + } catch (er) {} + } + entry.resume() + } + + [MKDIR] (dir, mode) { + try { + return mkdir.sync(dir, { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode + }) + } catch (er) { + return er + } + } + + [LINK] (entry, linkpath, link, _) { + try { + fs[link + 'Sync'](linkpath, entry.absolute) + entry.resume() + } catch (er) { + return this[ONERROR](er, entry) + } + } +} + +Unpack.Sync = UnpackSync +module.exports = Unpack + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/update.js": +/*!********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/update.js ***! + \********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// tar -u + +const hlo = __webpack_require__(/*! ./high-level-opt.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/high-level-opt.js") +const r = __webpack_require__(/*! ./replace.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/replace.js") +// just call tar.r with the filter and mtimeCache + +const u = module.exports = (opt_, files, cb) => { + const opt = hlo(opt_) + + if (!opt.file) + throw new TypeError('file is required') + + if (opt.gzip) + throw new TypeError('cannot append to compressed archives') + + if (!files || !Array.isArray(files) || !files.length) + throw new TypeError('no files or directories specified') + + files = Array.from(files) + + mtimeFilter(opt) + return r(opt, files, cb) +} + +const mtimeFilter = opt => { + const filter = opt.filter + + if (!opt.mtimeCache) + opt.mtimeCache = new Map() + + opt.filter = filter ? (path, stat) => + filter(path, stat) && !(opt.mtimeCache.get(path) > stat.mtime) + : (path, stat) => !(opt.mtimeCache.get(path) > stat.mtime) +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/warn-mixin.js": +/*!************************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/warn-mixin.js ***! + \************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + +module.exports = Base => class extends Base { + warn (code, message, data = {}) { + if (this.file) + data.file = this.file + if (this.cwd) + data.cwd = this.cwd + data.code = message instanceof Error && message.code || code + data.tarCode = code + if (!this.strict && data.recoverable !== false) { + if (message instanceof Error) { + data = Object.assign(message, data) + message = message.message + } + this.emit('warn', data.tarCode, message, data) + } else if (message instanceof Error) { + this.emit('error', Object.assign(message, data)) + } else + this.emit('error', Object.assign(new Error(`${code}: ${message}`), data)) + } +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/winchars.js": +/*!**********************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/winchars.js ***! + \**********************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +// When writing files on Windows, translate the characters to their +// 0xf000 higher-encoded versions. + +const raw = [ + '|', + '<', + '>', + '?', + ':' +] + +const win = raw.map(char => + String.fromCharCode(0xf000 + char.charCodeAt(0))) + +const toWin = new Map(raw.map((char, i) => [char, win[i]])) +const toRaw = new Map(win.map((char, i) => [char, raw[i]])) + +module.exports = { + encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s), + decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s) +} + + +/***/ }), + +/***/ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/write-entry.js": +/*!*************************************************************************************************!*\ + !*** ./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/write-entry.js ***! + \*************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const MiniPass = __webpack_require__(/*! minipass */ "./.yarn/cache/minipass-npm-3.1.1-b51d7e264d-cfcfd86adc.zip/node_modules/minipass/index.js") +const Pax = __webpack_require__(/*! ./pax.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/pax.js") +const Header = __webpack_require__(/*! ./header.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/header.js") +const ReadEntry = __webpack_require__(/*! ./read-entry.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/read-entry.js") +const fs = __webpack_require__(/*! fs */ "fs") +const path = __webpack_require__(/*! path */ "path") + +const types = __webpack_require__(/*! ./types.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/types.js") +const maxReadSize = 16 * 1024 * 1024 +const PROCESS = Symbol('process') +const FILE = Symbol('file') +const DIRECTORY = Symbol('directory') +const SYMLINK = Symbol('symlink') +const HARDLINK = Symbol('hardlink') +const HEADER = Symbol('header') +const READ = Symbol('read') +const LSTAT = Symbol('lstat') +const ONLSTAT = Symbol('onlstat') +const ONREAD = Symbol('onread') +const ONREADLINK = Symbol('onreadlink') +const OPENFILE = Symbol('openfile') +const ONOPENFILE = Symbol('onopenfile') +const CLOSE = Symbol('close') +const MODE = Symbol('mode') +const warner = __webpack_require__(/*! ./warn-mixin.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/warn-mixin.js") +const winchars = __webpack_require__(/*! ./winchars.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/winchars.js") + +const modeFix = __webpack_require__(/*! ./mode-fix.js */ "./.yarn/cache/tar-npm-6.0.1-aedef672fb-498c4a5671.zip/node_modules/tar/lib/mode-fix.js") + +const WriteEntry = warner(class WriteEntry extends MiniPass { + constructor (p, opt) { + opt = opt || {} + super(opt) + if (typeof p !== 'string') + throw new TypeError('path is required') + this.path = p + // suppress atime, ctime, uid, gid, uname, gname + this.portable = !!opt.portable + // until node has builtin pwnam functions, this'll have to do + this.myuid = process.getuid && process.getuid() + this.myuser = process.env.USER || '' + this.maxReadSize = opt.maxReadSize || maxReadSize + this.linkCache = opt.linkCache || new Map() + this.statCache = opt.statCache || new Map() + this.preservePaths = !!opt.preservePaths + this.cwd = opt.cwd || process.cwd() + this.strict = !!opt.strict + this.noPax = !!opt.noPax + this.noMtime = !!opt.noMtime + this.mtime = opt.mtime || null + + if (typeof opt.onwarn === 'function') + this.on('warn', opt.onwarn) + + let pathWarn = false + if (!this.preservePaths && path.win32.isAbsolute(p)) { + // absolutes on posix are also absolutes on win32 + // so we only need to test this one to get both + const parsed = path.win32.parse(p) + this.path = p.substr(parsed.root.length) + pathWarn = parsed.root + } + + this.win32 = !!opt.win32 || process.platform === 'win32' + if (this.win32) { + this.path = winchars.decode(this.path.replace(/\\/g, '/')) + p = p.replace(/\\/g, '/') + } + + this.absolute = opt.absolute || path.resolve(this.cwd, p) + + if (this.path === '') + this.path = './' + + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }) + } + + if (this.statCache.has(this.absolute)) + this[ONLSTAT](this.statCache.get(this.absolute)) + else + this[LSTAT]() + } + + [LSTAT] () { + fs.lstat(this.absolute, (er, stat) => { + if (er) + return this.emit('error', er) + this[ONLSTAT](stat) + }) + } + + [ONLSTAT] (stat) { + this.statCache.set(this.absolute, stat) + this.stat = stat + if (!stat.isFile()) + stat.size = 0 + this.type = getType(stat) + this.emit('stat', stat) + this[PROCESS]() + } + + [PROCESS] () { + switch (this.type) { + case 'File': return this[FILE]() + case 'Directory': return this[DIRECTORY]() + case 'SymbolicLink': return this[SYMLINK]() + // unsupported types are ignored. + default: return this.end() + } + } + + [MODE] (mode) { + return modeFix(mode, this.type === 'Directory', this.portable) + } + + [HEADER] () { + if (this.type === 'Directory' && this.portable) + this.noMtime = true + + this.header = new Header({ + path: this.path, + linkpath: this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this[MODE](this.stat.mode), + uid: this.portable ? null : this.stat.uid, + gid: this.portable ? null : this.stat.gid, + size: this.stat.size, + mtime: this.noMtime ? null : this.mtime || this.stat.mtime, + type: this.type, + uname: this.portable ? null : + this.stat.uid === this.myuid ? this.myuser : '', + atime: this.portable ? null : this.stat.atime, + ctime: this.portable ? null : this.stat.ctime + }) + + if (this.header.encode() && !this.noPax) + this.write(new Pax({ + atime: this.portable ? null : this.header.atime, + ctime: this.portable ? null : this.header.ctime, + gid: this.portable ? null : this.header.gid, + mtime: this.noMtime ? null : this.mtime || this.header.mtime, + path: this.path, + linkpath: this.linkpath, + size: this.header.size, + uid: this.portable ? null : this.header.uid, + uname: this.portable ? null : this.header.uname, + dev: this.portable ? null : this.stat.dev, + ino: this.portable ? null : this.stat.ino, + nlink: this.portable ? null : this.stat.nlink + }).encode()) + this.write(this.header.block) + } + + [DIRECTORY] () { + if (this.path.substr(-1) !== '/') + this.path += '/' + this.stat.size = 0 + this[HEADER]() + this.end() + } + + [SYMLINK] () { + fs.readlink(this.absolute, (er, linkpath) => { + if (er) + return this.emit('error', er) + this[ONREADLINK](linkpath) + }) + } + + [ONREADLINK] (linkpath) { + this.linkpath = linkpath.replace(/\\/g, '/') + this[HEADER]() + this.end() + } + + [HARDLINK] (linkpath) { + this.type = 'Link' + this.linkpath = path.relative(this.cwd, linkpath).replace(/\\/g, '/') + this.stat.size = 0 + this[HEADER]() + this.end() + } + + [FILE] () { + if (this.stat.nlink > 1) { + const linkKey = this.stat.dev + ':' + this.stat.ino + if (this.linkCache.has(linkKey)) { + const linkpath = this.linkCache.get(linkKey) + if (linkpath.indexOf(this.cwd) === 0) + return this[HARDLINK](linkpath) + } + this.linkCache.set(linkKey, this.absolute) + } + + this[HEADER]() + if (this.stat.size === 0) + return this.end() + + this[OPENFILE]() + } + + [OPENFILE] () { + fs.open(this.absolute, 'r', (er, fd) => { + if (er) + return this.emit('error', er) + this[ONOPENFILE](fd) + }) + } + + [ONOPENFILE] (fd) { + const blockLen = 512 * Math.ceil(this.stat.size / 512) + const bufLen = Math.min(blockLen, this.maxReadSize) + const buf = Buffer.allocUnsafe(bufLen) + this[READ](fd, buf, 0, buf.length, 0, this.stat.size, blockLen) + } + + [READ] (fd, buf, offset, length, pos, remain, blockRemain) { + fs.read(fd, buf, offset, length, pos, (er, bytesRead) => { + if (er) { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + return this[CLOSE](fd, () => this.emit('error', er)) + } + this[ONREAD](fd, buf, offset, length, pos, remain, blockRemain, bytesRead) + }) + } + + [CLOSE] (fd, cb) { + fs.close(fd, cb) + } + + [ONREAD] (fd, buf, offset, length, pos, remain, blockRemain, bytesRead) { + if (bytesRead <= 0 && remain > 0) { + const er = new Error('encountered unexpected EOF') + er.path = this.absolute + er.syscall = 'read' + er.code = 'EOF' + return this[CLOSE](fd, () => this.emit('error', er)) + } + + if (bytesRead > remain) { + const er = new Error('did not encounter expected EOF') + er.path = this.absolute + er.syscall = 'read' + er.code = 'EOF' + return this[CLOSE](fd, () => this.emit('error', er)) + } + + // null out the rest of the buffer, if we could fit the block padding + if (bytesRead === remain) { + for (let i = bytesRead; i < length && bytesRead < blockRemain; i++) { + buf[i + offset] = 0 + bytesRead ++ + remain ++ + } + } + + const writeBuf = offset === 0 && bytesRead === buf.length ? + buf : buf.slice(offset, offset + bytesRead) + remain -= bytesRead + blockRemain -= bytesRead + pos += bytesRead + offset += bytesRead + + this.write(writeBuf) + + if (!remain) { + if (blockRemain) + this.write(Buffer.alloc(blockRemain)) + return this[CLOSE](fd, er => er ? this.emit('error', er) : this.end()) + } + + if (offset >= length) { + buf = Buffer.allocUnsafe(length) + offset = 0 + } + length = buf.length - offset + this[READ](fd, buf, offset, length, pos, remain, blockRemain) + } +}) + +class WriteEntrySync extends WriteEntry { + constructor (path, opt) { + super(path, opt) + } + + [LSTAT] () { + this[ONLSTAT](fs.lstatSync(this.absolute)) + } + + [SYMLINK] () { + this[ONREADLINK](fs.readlinkSync(this.absolute)) + } + + [OPENFILE] () { + this[ONOPENFILE](fs.openSync(this.absolute, 'r')) + } + + [READ] (fd, buf, offset, length, pos, remain, blockRemain) { + let threw = true + try { + const bytesRead = fs.readSync(fd, buf, offset, length, pos) + this[ONREAD](fd, buf, offset, length, pos, remain, blockRemain, bytesRead) + threw = false + } finally { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + if (threw) + try { this[CLOSE](fd, () => {}) } catch (er) {} + } + } + + [CLOSE] (fd, cb) { + fs.closeSync(fd) + cb() + } +} + +const WriteEntryTar = warner(class WriteEntryTar extends MiniPass { + constructor (readEntry, opt) { + opt = opt || {} + super(opt) + this.preservePaths = !!opt.preservePaths + this.portable = !!opt.portable + this.strict = !!opt.strict + this.noPax = !!opt.noPax + this.noMtime = !!opt.noMtime + + this.readEntry = readEntry + this.type = readEntry.type + if (this.type === 'Directory' && this.portable) + this.noMtime = true + + this.path = readEntry.path + this.mode = this[MODE](readEntry.mode) + this.uid = this.portable ? null : readEntry.uid + this.gid = this.portable ? null : readEntry.gid + this.uname = this.portable ? null : readEntry.uname + this.gname = this.portable ? null : readEntry.gname + this.size = readEntry.size + this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime + this.atime = this.portable ? null : readEntry.atime + this.ctime = this.portable ? null : readEntry.ctime + this.linkpath = readEntry.linkpath + + if (typeof opt.onwarn === 'function') + this.on('warn', opt.onwarn) + + let pathWarn = false + if (path.isAbsolute(this.path) && !this.preservePaths) { + const parsed = path.parse(this.path) + pathWarn = parsed.root + this.path = this.path.substr(parsed.root.length) + } + + this.remain = readEntry.size + this.blockRemain = readEntry.startBlockSize + + this.header = new Header({ + path: this.path, + linkpath: this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this.mode, + uid: this.portable ? null : this.uid, + gid: this.portable ? null : this.gid, + size: this.size, + mtime: this.noMtime ? null : this.mtime, + type: this.type, + uname: this.portable ? null : this.uname, + atime: this.portable ? null : this.atime, + ctime: this.portable ? null : this.ctime + }) + + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }) + } + + if (this.header.encode() && !this.noPax) + super.write(new Pax({ + atime: this.portable ? null : this.atime, + ctime: this.portable ? null : this.ctime, + gid: this.portable ? null : this.gid, + mtime: this.noMtime ? null : this.mtime, + path: this.path, + linkpath: this.linkpath, + size: this.size, + uid: this.portable ? null : this.uid, + uname: this.portable ? null : this.uname, + dev: this.portable ? null : this.readEntry.dev, + ino: this.portable ? null : this.readEntry.ino, + nlink: this.portable ? null : this.readEntry.nlink + }).encode()) + + super.write(this.header.block) + readEntry.pipe(this) + } + + [MODE] (mode) { + return modeFix(mode, this.type === 'Directory', this.portable) + } + + write (data) { + const writeLen = data.length + if (writeLen > this.blockRemain) + throw new Error('writing more to entry than is appropriate') + this.blockRemain -= writeLen + return super.write(data) + } + + end () { + if (this.blockRemain) + this.write(Buffer.alloc(this.blockRemain)) + return super.end() + } +}) + +WriteEntry.Sync = WriteEntrySync +WriteEntry.Tar = WriteEntryTar + +const getType = stat => + stat.isFile() ? 'File' + : stat.isDirectory() ? 'Directory' + : stat.isSymbolicLink() ? 'SymbolicLink' + : 'Unsupported' + +module.exports = WriteEntry + + +/***/ }), + +/***/ "./.yarn/cache/typanion-npm-3.3.1-ee9997c7cf-212d2beb55.zip/node_modules/typanion/lib/index.js": +/*!*****************************************************************************************************!*\ + !*** ./.yarn/cache/typanion-npm-3.3.1-ee9997c7cf-212d2beb55.zip/node_modules/typanion/lib/index.js ***! + \*****************************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const simpleKeyRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/; +const colorStringRegExp = /^#[0-9a-f]{6}$/i; +const colorStringAlphaRegExp = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i; +// https://stackoverflow.com/a/475217/880703 +const base64RegExp = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; +// https://stackoverflow.com/a/14166194/880703 +const uuid4RegExp = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i; +// https://stackoverflow.com/a/28022901/880703 + https://www.debuggex.com/r/bl8J35wMKk48a7u_ +const iso8601RegExp = /^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/; +const makeTrait = (value) => () => { + return value; +}; +function makeValidator({ test }) { + return makeTrait(test)(); +} +function getPrintable(value) { + if (value === null) + return `null`; + if (value === undefined) + return `undefined`; + if (value === ``) + return `an empty string`; + return JSON.stringify(value); +} +function computeKey(state, key) { + var _a, _b, _c; + if (typeof key === `number`) { + return `${(_a = state === null || state === void 0 ? void 0 : state.p) !== null && _a !== void 0 ? _a : `.`}[${key}]`; + } + else if (simpleKeyRegExp.test(key)) { + return `${(_b = state === null || state === void 0 ? void 0 : state.p) !== null && _b !== void 0 ? _b : ``}.${key}`; + } + else { + return `${(_c = state === null || state === void 0 ? void 0 : state.p) !== null && _c !== void 0 ? _c : `.`}[${JSON.stringify(key)}]`; + } +} +function makeCoercionFn(target, key) { + return (v) => { + const previous = target[key]; + target[key] = v; + return makeCoercionFn(target, key).bind(null, previous); + }; +} +function makeSetter(target, key) { + return (v) => { + target[key] = v; + }; +} +function plural(n, singular, plural) { + return n === 1 ? singular : plural; +} +function pushError({ errors, p } = {}, message) { + errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message}`); + return false; +} +const isUnknown = () => makeValidator({ + test: (value, state) => { + return true; + }, +}); +function isLiteral(expected) { + return makeValidator({ + test: (value, state) => { + if (value !== expected) + return pushError(state, `Expected a literal (got ${getPrintable(expected)})`); + return true; + }, + }); +} +const isString = () => makeValidator({ + test: (value, state) => { + if (typeof value !== `string`) + return pushError(state, `Expected a string (got ${getPrintable(value)})`); + return true; + }, +}); +function isEnum(enumSpec) { + const valuesArray = Array.isArray(enumSpec) ? enumSpec : Object.values(enumSpec); + const values = new Set(valuesArray); + return makeValidator({ + test: (value, state) => { + if (!values.has(value)) + return pushError(state, `Expected a valid enumeration value (got ${getPrintable(value)})`); + return true; + }, + }); +} +const BOOLEAN_COERCIONS = new Map([ + [`true`, true], + [`True`, true], + [`1`, true], + [1, true], + [`false`, false], + [`False`, false], + [`0`, false], + [0, false], +]); +const isBoolean = () => makeValidator({ + test: (value, state) => { + var _a; + if (typeof value !== `boolean`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) + return pushError(state, `Unbound coercion result`); + const coercion = BOOLEAN_COERCIONS.get(value); + if (typeof coercion !== `undefined`) { + state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]); + return true; + } + } + return pushError(state, `Expected a boolean (got ${getPrintable(value)})`); + } + return true; + }, +}); +const isNumber = () => makeValidator({ + test: (value, state) => { + var _a; + if (typeof value !== `number`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) + return pushError(state, `Unbound coercion result`); + let coercion; + if (typeof value === `string`) { + let val; + try { + val = JSON.parse(value); + } + catch (_b) { } + // We check against JSON.stringify that the output is the same to ensure that the number can be safely represented in JS + if (typeof val === `number`) { + if (JSON.stringify(val) === value) { + coercion = val; + } + else { + return pushError(state, `Received a number that can't be safely represented by the runtime (${value})`); + } + } + } + if (typeof coercion !== `undefined`) { + state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]); + return true; + } + } + return pushError(state, `Expected a number (got ${getPrintable(value)})`); + } + return true; + }, +}); +const isDate = () => makeValidator({ + test: (value, state) => { + var _a; + if (!(value instanceof Date)) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) + return pushError(state, `Unbound coercion result`); + let coercion; + if (typeof value === `string` && iso8601RegExp.test(value)) { + coercion = new Date(value); + } + else { + let timestamp; + if (typeof value === `string`) { + let val; + try { + val = JSON.parse(value); + } + catch (_b) { } + if (typeof val === `number`) { + timestamp = val; + } + } + else if (typeof value === `number`) { + timestamp = value; + } + if (typeof timestamp !== `undefined`) { + if (Number.isSafeInteger(timestamp) || !Number.isSafeInteger(timestamp * 1000)) { + coercion = new Date(timestamp * 1000); + } + else { + return pushError(state, `Received a timestamp that can't be safely represented by the runtime (${value})`); + } + } + } + if (typeof coercion !== `undefined`) { + state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, coercion)]); + return true; + } + } + return pushError(state, `Expected a date (got ${getPrintable(value)})`); + } + return true; + }, +}); +const isArray = (spec, { delimiter } = {}) => makeValidator({ + test: (value, state) => { + var _a; + if (typeof value === `string` && typeof delimiter !== `undefined`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) + return pushError(state, `Unbound coercion result`); + value = value.split(delimiter); + state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]); + } + } + if (!Array.isArray(value)) + return pushError(state, `Expected an array (got ${getPrintable(value)})`); + let valid = true; + for (let t = 0, T = value.length; t < T; ++t) { + valid = spec(value[t], Object.assign(Object.assign({}, state), { p: computeKey(state, t), coercion: makeCoercionFn(value, t) })) && valid; + if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) { + break; + } + } + return valid; + }, +}); +const isTuple = (spec, { delimiter } = {}) => { + const lengthValidator = hasExactLength(spec.length); + return makeValidator({ + test: (value, state) => { + var _a; + if (typeof value === `string` && typeof delimiter !== `undefined`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) + return pushError(state, `Unbound coercion result`); + value = value.split(delimiter); + state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, value)]); + } + } + if (!Array.isArray(value)) + return pushError(state, `Expected a tuple (got ${getPrintable(value)})`); + let valid = lengthValidator(value, Object.assign({}, state)); + for (let t = 0, T = value.length; t < T && t < spec.length; ++t) { + valid = spec[t](value[t], Object.assign(Object.assign({}, state), { p: computeKey(state, t), coercion: makeCoercionFn(value, t) })) && valid; + if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) { + break; + } + } + return valid; + }, + }); +}; +const isDict = (spec, { keys: keySpec = null, } = {}) => makeValidator({ + test: (value, state) => { + if (typeof value !== `object` || value === null) + return pushError(state, `Expected an object (got ${getPrintable(value)})`); + const keys = Object.keys(value); + let valid = true; + for (let t = 0, T = keys.length; t < T && (valid || (state === null || state === void 0 ? void 0 : state.errors) != null); ++t) { + const key = keys[t]; + const sub = value[key]; + if (key === `__proto__` || key === `constructor`) { + valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Unsafe property name`); + continue; + } + if (keySpec !== null && !keySpec(key, state)) { + valid = false; + continue; + } + if (!spec(sub, Object.assign(Object.assign({}, state), { p: computeKey(state, key), coercion: makeCoercionFn(value, key) }))) { + valid = false; + continue; + } + } + return valid; + }, +}); +const isObject = (props, { extra: extraSpec = null, } = {}) => { + const specKeys = Object.keys(props); + return makeValidator({ + test: (value, state) => { + if (typeof value !== `object` || value === null) + return pushError(state, `Expected an object (got ${getPrintable(value)})`); + const keys = new Set([...specKeys, ...Object.keys(value)]); + const extra = {}; + let valid = true; + for (const key of keys) { + if (key === `constructor` || key === `__proto__`) { + valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Unsafe property name`); + } + else { + const spec = Object.prototype.hasOwnProperty.call(props, key) + ? props[key] + : undefined; + const sub = Object.prototype.hasOwnProperty.call(value, key) + ? value[key] + : undefined; + if (typeof spec !== `undefined`) { + valid = spec(sub, Object.assign(Object.assign({}, state), { p: computeKey(state, key), coercion: makeCoercionFn(value, key) })) && valid; + } + else if (extraSpec === null) { + valid = pushError(Object.assign(Object.assign({}, state), { p: computeKey(state, key) }), `Extraneous property (got ${getPrintable(sub)})`); + } + else { + Object.defineProperty(extra, key, { + enumerable: true, + get: () => sub, + set: makeSetter(value, key) + }); + } + } + if (!valid && (state === null || state === void 0 ? void 0 : state.errors) == null) { + break; + } + } + if (extraSpec !== null && (valid || (state === null || state === void 0 ? void 0 : state.errors) != null)) + valid = extraSpec(extra, state) && valid; + return valid; + }, + }); +}; +const isInstanceOf = (constructor) => makeValidator({ + test: (value, state) => { + if (!(value instanceof constructor)) + return pushError(state, `Expected an instance of ${constructor.name} (got ${getPrintable(value)})`); + return true; + }, +}); +const isOneOf = (specs, { exclusive = false, } = {}) => makeValidator({ + test: (value, state) => { + var _a, _b, _c; + const matches = []; + const errorBuffer = typeof (state === null || state === void 0 ? void 0 : state.errors) !== `undefined` + ? [] : undefined; + for (let t = 0, T = specs.length; t < T; ++t) { + const subErrors = typeof (state === null || state === void 0 ? void 0 : state.errors) !== `undefined` + ? [] : undefined; + const subCoercions = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined` + ? [] : undefined; + if (specs[t](value, Object.assign(Object.assign({}, state), { errors: subErrors, coercions: subCoercions, p: `${(_a = state === null || state === void 0 ? void 0 : state.p) !== null && _a !== void 0 ? _a : `.`}#${t + 1}` }))) { + matches.push([`#${t + 1}`, subCoercions]); + if (!exclusive) { + break; + } + } + else { + errorBuffer === null || errorBuffer === void 0 ? void 0 : errorBuffer.push(subErrors[0]); + } + } + if (matches.length === 1) { + const [, subCoercions] = matches[0]; + if (typeof subCoercions !== `undefined`) + (_b = state === null || state === void 0 ? void 0 : state.coercions) === null || _b === void 0 ? void 0 : _b.push(...subCoercions); + return true; + } + if (matches.length > 1) + pushError(state, `Expected to match exactly a single predicate (matched ${matches.join(`, `)})`); + else + (_c = state === null || state === void 0 ? void 0 : state.errors) === null || _c === void 0 ? void 0 : _c.push(...errorBuffer); + return false; + }, +}); +const applyCascade = (spec, followups) => makeValidator({ + test: (value, state) => { + var _a, _b; + const context = { value: value }; + const subCoercion = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined` + ? makeCoercionFn(context, `value`) : undefined; + const subCoercions = typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined` + ? [] : undefined; + if (!spec(value, Object.assign(Object.assign({}, state), { coercion: subCoercion, coercions: subCoercions }))) + return false; + const reverts = []; + if (typeof subCoercions !== `undefined`) + for (const [, coercion] of subCoercions) + reverts.push(coercion()); + try { + if (typeof (state === null || state === void 0 ? void 0 : state.coercions) !== `undefined`) { + if (context.value !== value) { + if (typeof (state === null || state === void 0 ? void 0 : state.coercion) === `undefined`) + return pushError(state, `Unbound coercion result`); + state.coercions.push([(_a = state.p) !== null && _a !== void 0 ? _a : `.`, state.coercion.bind(null, context.value)]); + } + (_b = state === null || state === void 0 ? void 0 : state.coercions) === null || _b === void 0 ? void 0 : _b.push(...subCoercions); + } + return followups.every(spec => { + return spec(context.value, state); + }); + } + finally { + for (const revert of reverts) { + revert(); + } + } + }, +}); +const isOptional = (spec) => makeValidator({ + test: (value, state) => { + if (typeof value === `undefined`) + return true; + return spec(value, state); + }, +}); +const isNullable = (spec) => makeValidator({ + test: (value, state) => { + if (value === null) + return true; + return spec(value, state); + }, +}); +const hasMinLength = (length) => makeValidator({ + test: (value, state) => { + if (!(value.length >= length)) + return pushError(state, `Expected to have a length of at least ${length} elements (got ${value.length})`); + return true; + }, +}); +const hasMaxLength = (length) => makeValidator({ + test: (value, state) => { + if (!(value.length <= length)) + return pushError(state, `Expected to have a length of at most ${length} elements (got ${value.length})`); + return true; + }, +}); +const hasExactLength = (length) => makeValidator({ + test: (value, state) => { + if (!(value.length === length)) + return pushError(state, `Expected to have a length of exactly ${length} elements (got ${value.length})`); + return true; + }, +}); +const hasUniqueItems = ({ map, } = {}) => makeValidator({ + test: (value, state) => { + const set = new Set(); + const dup = new Set(); + for (let t = 0, T = value.length; t < T; ++t) { + const sub = value[t]; + const key = typeof map !== `undefined` + ? map(sub) + : sub; + if (set.has(key)) { + if (dup.has(key)) + continue; + pushError(state, `Expected to contain unique elements; got a duplicate with ${getPrintable(value)}`); + dup.add(key); + } + else { + set.add(key); + } + } + return dup.size === 0; + }, +}); +const isNegative = () => makeValidator({ + test: (value, state) => { + if (!(value <= 0)) + return pushError(state, `Expected to be negative (got ${value})`); + return true; + }, +}); +const isPositive = () => makeValidator({ + test: (value, state) => { + if (!(value >= 0)) + return pushError(state, `Expected to be positive (got ${value})`); + return true; + }, +}); +const isAtLeast = (n) => makeValidator({ + test: (value, state) => { + if (!(value >= n)) + return pushError(state, `Expected to be at least ${n} (got ${value})`); + return true; + }, +}); +const isAtMost = (n) => makeValidator({ + test: (value, state) => { + if (!(value <= n)) + return pushError(state, `Expected to be at most ${n} (got ${value})`); + return true; + }, +}); +const isInInclusiveRange = (a, b) => makeValidator({ + test: (value, state) => { + if (!(value >= a && value <= b)) + return pushError(state, `Expected to be in the [${a}; ${b}] range (got ${value})`); + return true; + }, +}); +const isInExclusiveRange = (a, b) => makeValidator({ + test: (value, state) => { + if (!(value >= a && value < b)) + return pushError(state, `Expected to be in the [${a}; ${b}[ range (got ${value})`); + return true; + }, +}); +const isInteger = ({ unsafe = false, } = {}) => makeValidator({ + test: (value, state) => { + if (value !== Math.round(value)) + return pushError(state, `Expected to be an integer (got ${value})`); + if (!Number.isSafeInteger(value)) + return pushError(state, `Expected to be a safe integer (got ${value})`); + return true; + }, +}); +const matchesRegExp = (regExp) => makeValidator({ + test: (value, state) => { + if (!regExp.test(value)) + return pushError(state, `Expected to match the pattern ${regExp.toString()} (got ${getPrintable(value)})`); + return true; + }, +}); +const isLowerCase = () => makeValidator({ + test: (value, state) => { + if (value !== value.toLowerCase()) + return pushError(state, `Expected to be all-lowercase (got ${value})`); + return true; + }, +}); +const isUpperCase = () => makeValidator({ + test: (value, state) => { + if (value !== value.toUpperCase()) + return pushError(state, `Expected to be all-uppercase (got ${value})`); + return true; + }, +}); +const isUUID4 = () => makeValidator({ + test: (value, state) => { + if (!uuid4RegExp.test(value)) + return pushError(state, `Expected to be a valid UUID v4 (got ${getPrintable(value)})`); + return true; + }, +}); +const isISO8601 = () => makeValidator({ + test: (value, state) => { + if (!iso8601RegExp.test(value)) + return pushError(state, `Expected to be a valid ISO 8601 date string (got ${getPrintable(value)})`); + return false; + }, +}); +const isHexColor = ({ alpha = false, }) => makeValidator({ + test: (value, state) => { + const res = alpha + ? colorStringRegExp.test(value) + : colorStringAlphaRegExp.test(value); + if (!res) + return pushError(state, `Expected to be a valid hexadecimal color string (got ${getPrintable(value)})`); + return true; + }, +}); +const isBase64 = () => makeValidator({ + test: (value, state) => { + if (!base64RegExp.test(value)) + return pushError(state, `Expected to be a valid base 64 string (got ${getPrintable(value)})`); + return true; + }, +}); +const isJSON = (spec = isUnknown()) => makeValidator({ + test: (value, state) => { + let data; + try { + data = JSON.parse(value); + } + catch (_a) { + return pushError(state, `Expected to be a valid JSON string (got ${getPrintable(value)})`); + } + return spec(data, state); + }, +}); +const hasRequiredKeys = (requiredKeys) => { + const requiredSet = new Set(requiredKeys); + return makeValidator({ + test: (value, state) => { + const keys = new Set(Object.keys(value)); + const problems = []; + for (const key of requiredSet) + if (!keys.has(key)) + problems.push(key); + if (problems.length > 0) + return pushError(state, `Missing required ${plural(problems.length, `property`, `properties`)} ${problems.map(name => `"${name}"`).join(`, `)}`); + return true; + }, + }); +}; +const hasForbiddenKeys = (forbiddenKeys) => { + const forbiddenSet = new Set(forbiddenKeys); + return makeValidator({ + test: (value, state) => { + const keys = new Set(Object.keys(value)); + const problems = []; + for (const key of forbiddenSet) + if (keys.has(key)) + problems.push(key); + if (problems.length > 0) + return pushError(state, `Forbidden ${plural(problems.length, `property`, `properties`)} ${problems.map(name => `"${name}"`).join(`, `)}`); + return true; + }, + }); +}; +const hasMutuallyExclusiveKeys = (exclusiveKeys) => { + const exclusiveSet = new Set(exclusiveKeys); + return makeValidator({ + test: (value, state) => { + const keys = new Set(Object.keys(value)); + const used = []; + for (const key of exclusiveSet) + if (keys.has(key)) + used.push(key); + if (used.length > 1) + return pushError(state, `Mutually exclusive properties ${used.map(name => `"${name}"`).join(`, `)}`); + return true; + }, + }); +}; +(function (KeyRelationship) { + KeyRelationship["Forbids"] = "Forbids"; + KeyRelationship["Requires"] = "Requires"; +})(exports.KeyRelationship || (exports.KeyRelationship = {})); +const keyRelationships = { + [exports.KeyRelationship.Forbids]: { + expect: false, + message: `forbids using`, + }, + [exports.KeyRelationship.Requires]: { + expect: true, + message: `requires using`, + }, +}; +const hasKeyRelationship = (subject, relationship, others, { ignore = [], } = {}) => { + const skipped = new Set(ignore); + const otherSet = new Set(others); + const spec = keyRelationships[relationship]; + return makeValidator({ + test: (value, state) => { + const keys = new Set(Object.keys(value)); + if (!keys.has(subject) || skipped.has(value[subject])) + return true; + const problems = []; + for (const key of otherSet) + if ((keys.has(key) && !skipped.has(value[key])) !== spec.expect) + problems.push(key); + if (problems.length >= 1) + return pushError(state, `Property "${subject}" ${spec.message} ${plural(problems.length, `property`, `properties`)} ${problems.map(name => `"${name}"`).join(`, `)}`); + return true; + }, + }); +}; + +exports.applyCascade = applyCascade; +exports.base64RegExp = base64RegExp; +exports.colorStringAlphaRegExp = colorStringAlphaRegExp; +exports.colorStringRegExp = colorStringRegExp; +exports.computeKey = computeKey; +exports.getPrintable = getPrintable; +exports.hasExactLength = hasExactLength; +exports.hasForbiddenKeys = hasForbiddenKeys; +exports.hasKeyRelationship = hasKeyRelationship; +exports.hasMaxLength = hasMaxLength; +exports.hasMinLength = hasMinLength; +exports.hasMutuallyExclusiveKeys = hasMutuallyExclusiveKeys; +exports.hasRequiredKeys = hasRequiredKeys; +exports.hasUniqueItems = hasUniqueItems; +exports.isArray = isArray; +exports.isAtLeast = isAtLeast; +exports.isAtMost = isAtMost; +exports.isBase64 = isBase64; +exports.isBoolean = isBoolean; +exports.isDate = isDate; +exports.isDict = isDict; +exports.isEnum = isEnum; +exports.isHexColor = isHexColor; +exports.isISO8601 = isISO8601; +exports.isInExclusiveRange = isInExclusiveRange; +exports.isInInclusiveRange = isInInclusiveRange; +exports.isInstanceOf = isInstanceOf; +exports.isInteger = isInteger; +exports.isJSON = isJSON; +exports.isLiteral = isLiteral; +exports.isLowerCase = isLowerCase; +exports.isNegative = isNegative; +exports.isNullable = isNullable; +exports.isNumber = isNumber; +exports.isObject = isObject; +exports.isOneOf = isOneOf; +exports.isOptional = isOptional; +exports.isPositive = isPositive; +exports.isString = isString; +exports.isTuple = isTuple; +exports.isUUID4 = isUUID4; +exports.isUnknown = isUnknown; +exports.isUpperCase = isUpperCase; +exports.iso8601RegExp = iso8601RegExp; +exports.makeCoercionFn = makeCoercionFn; +exports.makeSetter = makeSetter; +exports.makeTrait = makeTrait; +exports.makeValidator = makeValidator; +exports.matchesRegExp = matchesRegExp; +exports.plural = plural; +exports.pushError = pushError; +exports.simpleKeyRegExp = simpleKeyRegExp; +exports.uuid4RegExp = uuid4RegExp; + + +/***/ }), + +/***/ "./.yarn/cache/which-npm-2.0.2-320ddf72f7-1a5c563d3c.zip/node_modules/which/which.js": +/*!*******************************************************************************************!*\ + !*** ./.yarn/cache/which-npm-2.0.2-320ddf72f7-1a5c563d3c.zip/node_modules/which/which.js ***! + \*******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +const path = __webpack_require__(/*! path */ "path") +const COLON = isWindows ? ';' : ':' +const isexe = __webpack_require__(/*! isexe */ "./.yarn/cache/isexe-npm-2.0.0-b58870bd2e-26bf6c5480.zip/node_modules/isexe/index.js") + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, opt) => { + const colon = opt.colon || COLON + + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] + : ( + [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(opt.path || process.env.PATH || + /* istanbul ignore next: very unusual */ '').split(colon), + ] + ) + const pathExtExe = isWindows + ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' + : '' + const pathExt = isWindows ? pathExtExe.split(colon) : [''] + + if (isWindows) { + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + return { + pathEnv, + pathExt, + pathExtExe, + } +} + +const which = (cmd, opt, cb) => { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + if (!opt) + opt = {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + const step = i => new Promise((resolve, reject) => { + if (i === pathEnv.length) + return opt.all && found.length ? resolve(found) + : reject(getNotFoundError(cmd)) + + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + resolve(subStep(p, i, 0)) + }) + + const subStep = (p, i, ii) => new Promise((resolve, reject) => { + if (ii === pathExt.length) + return resolve(step(i + 1)) + const ext = pathExt[ii] + isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { + if (!er && is) { + if (opt.all) + found.push(p + ext) + else + return resolve(p + ext) + } + return resolve(subStep(p, i, ii + 1)) + }) + }) + + return cb ? step(0).then(res => cb(null, res), cb) : step(0) +} + +const whichSync = (cmd, opt) => { + opt = opt || {} + + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (let i = 0; i < pathEnv.length; i ++) { + const ppRaw = pathEnv[i] + const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw + + const pCmd = path.join(pathPart, cmd) + const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd + : pCmd + + for (let j = 0; j < pathExt.length; j ++) { + const cur = p + pathExt[j] + try { + const is = isexe.sync(cur, { pathExt: pathExtExe }) + if (is) { + if (opt.all) + found.push(cur) + else + return cur + } + } catch (ex) {} + } + } + + if (opt.all && found.length) + return found + + if (opt.nothrow) + return null + + throw getNotFoundError(cmd) +} + +module.exports = which +which.sync = whichSync + + +/***/ }), + +/***/ "./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/iterator.js": +/*!**************************************************************************************************!*\ + !*** ./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/iterator.js ***! + \**************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + +module.exports = function (Yallist) { + Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value + } + } +} + + +/***/ }), + +/***/ "./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/yallist.js": +/*!*************************************************************************************************!*\ + !*** ./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/yallist.js ***! + \*************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Yallist + +Yallist.Node = Node +Yallist.create = Yallist + +function Yallist (list) { + var self = this + if (!(self instanceof Yallist)) { + self = new Yallist() + } + + self.tail = null + self.head = null + self.length = 0 + + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item) + }) + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]) + } + } + + return self +} + +Yallist.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list') + } + + var next = node.next + var prev = node.prev + + if (next) { + next.prev = prev + } + + if (prev) { + prev.next = next + } + + if (node === this.head) { + this.head = next + } + if (node === this.tail) { + this.tail = prev + } + + node.list.length-- + node.next = null + node.prev = null + node.list = null + + return next +} + +Yallist.prototype.unshiftNode = function (node) { + if (node === this.head) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var head = this.head + node.list = this + node.next = head + if (head) { + head.prev = node + } + + this.head = node + if (!this.tail) { + this.tail = node + } + this.length++ +} + +Yallist.prototype.pushNode = function (node) { + if (node === this.tail) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var tail = this.tail + node.list = this + node.prev = tail + if (tail) { + tail.next = node + } + + this.tail = node + if (!this.head) { + this.head = node + } + this.length++ +} + +Yallist.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.pop = function () { + if (!this.tail) { + return undefined + } + + var res = this.tail.value + this.tail = this.tail.prev + if (this.tail) { + this.tail.next = null + } else { + this.head = null + } + this.length-- + return res +} + +Yallist.prototype.shift = function () { + if (!this.head) { + return undefined + } + + var res = this.head.value + this.head = this.head.next + if (this.head) { + this.head.prev = null + } else { + this.tail = null + } + this.length-- + return res +} + +Yallist.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this) + walker = walker.next + } +} + +Yallist.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this) + walker = walker.prev + } +} + +Yallist.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.map = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.next + } + return res +} + +Yallist.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.prev + } + return res +} + +Yallist.prototype.reduce = function (fn, initial) { + var acc + var walker = this.head + if (arguments.length > 1) { + acc = initial + } else if (this.head) { + walker = this.head.next + acc = this.head.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i) + walker = walker.next + } + + return acc +} + +Yallist.prototype.reduceReverse = function (fn, initial) { + var acc + var walker = this.tail + if (arguments.length > 1) { + acc = initial + } else if (this.tail) { + walker = this.tail.prev + acc = this.tail.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i) + walker = walker.prev + } + + return acc +} + +Yallist.prototype.toArray = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value + walker = walker.next + } + return arr +} + +Yallist.prototype.toArrayReverse = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value + walker = walker.prev + } + return arr +} + +Yallist.prototype.slice = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.sliceReverse = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.splice = function (start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1 + } + if (start < 0) { + start = this.length + start; + } + + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next + } + + var ret = [] + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value) + walker = this.removeNode(walker) + } + if (walker === null) { + walker = this.tail + } + + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev + } + + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]) + } + return ret; +} + +Yallist.prototype.reverse = function () { + var head = this.head + var tail = this.tail + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev + walker.prev = walker.next + walker.next = p + } + this.head = tail + this.tail = head + return this +} + +function insert (self, node, value) { + var inserted = node === self.head ? + new Node(value, null, node, self) : + new Node(value, node, node.next, self) + + if (inserted.next === null) { + self.tail = inserted + } + if (inserted.prev === null) { + self.head = inserted + } + + self.length++ + + return inserted +} + +function push (self, item) { + self.tail = new Node(item, self.tail, null, self) + if (!self.head) { + self.head = self.tail + } + self.length++ +} + +function unshift (self, item) { + self.head = new Node(item, null, self.head, self) + if (!self.tail) { + self.tail = self.head + } + self.length++ +} + +function Node (value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list) + } + + this.list = list + this.value = value + + if (prev) { + prev.next = this + this.prev = prev + } else { + this.prev = null + } + + if (next) { + next.prev = this + this.next = next + } else { + this.next = null + } +} + +try { + // add if support for Symbol.iterator is present + __webpack_require__(/*! ./iterator.js */ "./.yarn/cache/yallist-npm-4.0.0-b493d9e907-343617202a.zip/node_modules/yallist/iterator.js")(Yallist) +} catch (er) {} + + +/***/ }), + +/***/ "./config.json": +/*!*********************!*\ + !*** ./config.json ***! + \*********************/ +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"definitions":{"npm":{"default":"7.20.1","transparent":{"commands":[["npm","init"],["npx"]]},"ranges":{"*":{"url":"https://registry.npmjs.org/npm/-/npm-{}.tgz","bin":{"npm":"./bin/npm-cli.js","npx":"./bin/npx-cli.js"},"registry":{"type":"npm","package":"npm"}}}},"pnpm":{"default":"6.11.0","transparent":{"commands":[["pnpm","init"],["pnpx"]]},"ranges":{"<6.0.0":{"url":"https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz","bin":{"pnpm":"./bin/pnpm.js","pnpx":"./bin/pnpx.js"},"registry":{"type":"npm","package":"pnpm"}},">=6.0.0":{"url":"https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz","bin":{"pnpm":"./bin/pnpm.cjs","pnpx":"./bin/pnpx.cjs"},"registry":{"type":"npm","package":"pnpm"}}}},"yarn":{"default":"1.22.11","transparent":{"default":"3.0.0","commands":[["yarn","dlx"]]},"ranges":{"<2.0.0":{"url":"https://registry.yarnpkg.com/yarn/-/yarn-{}.tgz","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"registry":{"type":"npm","package":"yarn"}},">=2.0.0":{"name":"yarn","url":"https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js","bin":["yarn","yarnpkg"],"registry":{"type":"url","url":"https://repo.yarnpkg.com/tags","fields":{"tags":"latest","versions":"tags"}}}}}}}'); + +/***/ }), + +/***/ "./package.json": +/*!**********************!*\ + !*** ./package.json ***! + \**********************/ +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"name":"corepack","version":"0.9.0","homepage":"https://github.com/nodejs/corepack#readme","bugs":{"url":"https://github.com/nodejs/corepack/issues"},"repository":{"type":"git","url":"https://github.com/nodejs/corepack.git"},"license":"MIT","bin":{"corepack":"./dist/corepack.js","pnpm":"./dist/pnpm.js","pnpx":"./dist/pnpx.js","yarn":"./dist/yarn.js","yarnpkg":"./dist/yarnpkg.js"},"packageManager":"yarn@3.0.0","devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.14.2","@babel/plugin-proposal-nullish-coalescing-operator":"^7.10.4","@babel/plugin-transform-modules-commonjs":"^7.14.0","@babel/preset-typescript":"^7.13.0","@types/debug":"^4.1.5","@types/jest":"^26.0.23","@types/node":"^13.9.2","@types/semver":"^7.1.0","@types/tar":"^4.0.3","@types/which":"^1.3.2","@typescript-eslint/eslint-plugin":"^2.0.0","@typescript-eslint/parser":"^4.2.0","@yarnpkg/eslint-config":"^0.1.0","@yarnpkg/fslib":"^2.1.0","@zkochan/cmd-shim":"^5.0.0","babel-plugin-dynamic-import-node":"^2.3.3","clipanion":"^3.0.1","debug":"^4.1.1","eslint":"^7.10.0","eslint-plugin-arca":"^0.9.5","jest":"^26.0.0","nock":"^13.0.4","semver":"^7.1.3","supports-color":"^7.1.0","tar":"^6.0.1","terser-webpack-plugin":"^5.1.2","ts-loader":"^8.0.2","ts-node":"^8.10.2","typescript":"^4.3.2","v8-compile-cache":"^2.3.0","webpack":"^5.38.1","webpack-cli":"^3.3.11","which":"^2.0.2"},"scripts":{"build":"rm -rf dist && webpack && ts-node ./mkshims.ts","corepack":"ts-node ./sources/main.ts","prepack":"node ./.yarn/releases/*.*js build","postpack":"rm -rf dist shims","test":"yarn jest"},"files":["dist","shims","LICENSE.md"],"publishConfig":{"executableFiles":["./dist/npm.js","./dist/npx.js","./dist/pnpm.js","./dist/pnpx.js","./dist/yarn.js","./dist/yarnpkg.js","./dist/corepack.js","./shims/npm","./shims/npm.ps1","./shims/npx","./shims/npx.ps1","./shims/pnpm","./shims/pnpm.ps1","./shims/pnpx","./shims/pnpx.ps1","./shims/yarn","./shims/yarn.ps1","./shims/yarnpkg","./shims/yarnpkg.ps1"]}}'); + +/***/ }), + +/***/ "assert": +/*!*************************!*\ + !*** external "assert" ***! + \*************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("assert");; + +/***/ }), + +/***/ "buffer": +/*!*************************!*\ + !*** external "buffer" ***! + \*************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("buffer");; + +/***/ }), + +/***/ "child_process": +/*!********************************!*\ + !*** external "child_process" ***! + \********************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("child_process");; + +/***/ }), + +/***/ "crypto": +/*!*************************!*\ + !*** external "crypto" ***! + \*************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("crypto");; + +/***/ }), + +/***/ "events": +/*!*************************!*\ + !*** external "events" ***! + \*************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("events");; + +/***/ }), + +/***/ "fs": +/*!*********************!*\ + !*** external "fs" ***! + \*********************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("fs");; + +/***/ }), + +/***/ "https": +/*!************************!*\ + !*** external "https" ***! + \************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("https");; + +/***/ }), + +/***/ "os": +/*!*********************!*\ + !*** external "os" ***! + \*********************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("os");; + +/***/ }), + +/***/ "path": +/*!***********************!*\ + !*** external "path" ***! + \***********************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("path");; + +/***/ }), + +/***/ "stream": +/*!*************************!*\ + !*** external "stream" ***! + \*************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("stream");; + +/***/ }), + +/***/ "string_decoder": +/*!*********************************!*\ + !*** external "string_decoder" ***! + \*********************************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("string_decoder");; + +/***/ }), + +/***/ "tty": +/*!**********************!*\ + !*** external "tty" ***! + \**********************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("tty");; + +/***/ }), + +/***/ "util": +/*!***********************!*\ + !*** external "util" ***! + \***********************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("util");; + +/***/ }), + +/***/ "zlib": +/*!***********************!*\ + !*** external "zlib" ***! + \***********************/ +/***/ ((module) => { + +"use strict"; +module.exports = require("zlib");; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/create fake namespace object */ +/******/ (() => { +/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); +/******/ var leafPrototypes; +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 16: return value when it's Promise-like +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = this(value); +/******/ if(mode & 8) return value; +/******/ if(typeof value === 'object' && value) { +/******/ if((mode & 4) && value.__esModule) return value; +/******/ if((mode & 16) && typeof value.then === 'function') return value; +/******/ } +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ var def = {}; +/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; +/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { +/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); +/******/ } +/******/ def['default'] = () => (value); +/******/ __webpack_require__.d(ns, def); +/******/ return ns; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +/*!*************************!*\ + !*** ./sources/main.ts ***! + \*************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "main": () => (/* binding */ main), +/* harmony export */ "runMain": () => (/* binding */ runMain) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); +/* harmony import */ var _Engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Engine */ "./sources/Engine.ts"); +/* harmony import */ var _commands_Disable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./commands/Disable */ "./sources/commands/Disable.ts"); +/* harmony import */ var _commands_Enable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/Enable */ "./sources/commands/Enable.ts"); +/* harmony import */ var _commands_Hydrate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./commands/Hydrate */ "./sources/commands/Hydrate.ts"); +/* harmony import */ var _commands_Prepare__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./commands/Prepare */ "./sources/commands/Prepare.ts"); +/* harmony import */ var _miscUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./miscUtils */ "./sources/miscUtils.ts"); +/* harmony import */ var _pmmUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pmmUtils */ "./sources/pmmUtils.ts"); +/* harmony import */ var _specUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./specUtils */ "./sources/specUtils.ts"); + + + + + + + + + +function getPackageManagerRequestFromCli(parameter, context) { + if (!parameter) + return null; + const match = parameter.match(/^([^@]*)(?:@(.*))?$/); + if (!match) + return null; + const [, binaryName, binaryVersion] = match; + const packageManager = context.engine.getPackageManagerFor(binaryName); + if (!packageManager) + return null; + return { + packageManager, + binaryName, + binaryVersion: binaryVersion || null, + }; +} +async function executePackageManagerRequest({ packageManager, binaryName, binaryVersion }, args, context) { + var _a; + const defaultVersion = await context.engine.getDefaultVersion(packageManager); + const definition = context.engine.config.definitions[packageManager]; + // If all leading segments match one of the patterns defined in the `transparent` + // key, we tolerate calling this binary even if the local project isn't explicitly + // configured for it, and we use the special default version if requested. + let isTransparentCommand = false; + for (const transparentPath of definition.transparent.commands) { + if (transparentPath[0] === binaryName && transparentPath.slice(1).every((segment, index) => segment === args[index])) { + isTransparentCommand = true; + break; + } + } + const fallbackReference = isTransparentCommand + ? (_a = definition.transparent.default) !== null && _a !== void 0 ? _a : defaultVersion + : defaultVersion; + const fallbackLocator = { + name: packageManager, + reference: fallbackReference, + }; + let descriptor; + try { + descriptor = await _specUtils__WEBPACK_IMPORTED_MODULE_7__.findProjectSpec(context.cwd, fallbackLocator, { transparent: isTransparentCommand }); + } + catch (err) { + if (err instanceof _miscUtils__WEBPACK_IMPORTED_MODULE_5__.Cancellation) { + return 1; + } + else { + throw err; + } + } + if (binaryVersion) + descriptor.range = binaryVersion; + const resolved = await context.engine.resolveDescriptor(descriptor, { allowTags: true }); + if (resolved === null) + throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`Failed to successfully resolve '${descriptor.range}' to a valid ${descriptor.name} release`); + const installSpec = await context.engine.ensurePackageManager(resolved); + const exitCode = await _pmmUtils__WEBPACK_IMPORTED_MODULE_6__.runVersion(installSpec, resolved, binaryName, args, context); + return exitCode; +} +async function main(argv, context) { + const corepackVersion = __webpack_require__(/*! ../package.json */ "./package.json").version; + const [firstArg, ...restArgs] = argv; + const request = getPackageManagerRequestFromCli(firstArg, context); + let cli; + if (!request) { + // If the first argument doesn't match any supported package manager, we fallback to the standard Corepack CLI + cli = new clipanion__WEBPACK_IMPORTED_MODULE_8__.Cli({ + binaryLabel: `Corepack`, + binaryName: `corepack`, + binaryVersion: corepackVersion, + }); + cli.register(clipanion__WEBPACK_IMPORTED_MODULE_8__.Builtins.HelpCommand); + cli.register(clipanion__WEBPACK_IMPORTED_MODULE_8__.Builtins.VersionCommand); + cli.register(_commands_Enable__WEBPACK_IMPORTED_MODULE_2__.EnableCommand); + cli.register(_commands_Disable__WEBPACK_IMPORTED_MODULE_1__.DisableCommand); + cli.register(_commands_Hydrate__WEBPACK_IMPORTED_MODULE_3__.HydrateCommand); + cli.register(_commands_Prepare__WEBPACK_IMPORTED_MODULE_4__.PrepareCommand); + return await cli.run(argv, Object.assign(Object.assign({}, clipanion__WEBPACK_IMPORTED_MODULE_8__.Cli.defaultContext), context)); + } + else { + // Otherwise, we create a single-command CLI to run the specified package manager (we still use Clipanion in order to pretty-print usage errors). + const cli = new clipanion__WEBPACK_IMPORTED_MODULE_8__.Cli({ + binaryLabel: `'${request.binaryName}', via Corepack`, + binaryName: request.binaryName, + binaryVersion: `corepack/${corepackVersion}`, + }); + cli.register(class BinaryCommand extends clipanion__WEBPACK_IMPORTED_MODULE_8__.Command { + constructor() { + super(...arguments); + this.proxy = clipanion__WEBPACK_IMPORTED_MODULE_8__.Option.Proxy(); + } + async execute() { + return executePackageManagerRequest(request, this.proxy, this.context); + } + }); + return await cli.run(restArgs, Object.assign(Object.assign({}, clipanion__WEBPACK_IMPORTED_MODULE_8__.Cli.defaultContext), context)); + } +} +function runMain(argv) { + main(argv, { + cwd: process.cwd(), + engine: new _Engine__WEBPACK_IMPORTED_MODULE_0__.Engine(), + }).then(exitCode => { + process.exitCode = exitCode; + }, err => { + console.error(err.stack); + process.exitCode = 1; + }); +} +// Using `eval` to be sure that Webpack doesn't transform it +if (process.mainModule === eval(`module`)) + runMain(process.argv.slice(2)); + +})(); + +var __webpack_export_target__ = exports; +for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; +if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); +/******/ })() +; \ No newline at end of file diff --git a/deps/corepack/dist/npm.js b/deps/corepack/dist/npm.js new file mode 100755 index 00000000000000..1eb91951725942 --- /dev/null +++ b/deps/corepack/dist/npm.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['npm', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/npx.js b/deps/corepack/dist/npx.js new file mode 100755 index 00000000000000..15b149436fc484 --- /dev/null +++ b/deps/corepack/dist/npx.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['npx', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/pnpm.js b/deps/corepack/dist/pnpm.js new file mode 100755 index 00000000000000..13ea6c61d8da38 --- /dev/null +++ b/deps/corepack/dist/pnpm.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['pnpm', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/pnpx.js b/deps/corepack/dist/pnpx.js new file mode 100755 index 00000000000000..852954e309455b --- /dev/null +++ b/deps/corepack/dist/pnpx.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['pnpx', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/vcc.js b/deps/corepack/dist/vcc.js new file mode 100644 index 00000000000000..69558e7cdd55a4 --- /dev/null +++ b/deps/corepack/dist/vcc.js @@ -0,0 +1,424 @@ +#!/usr/bin/env node +/* eslint-disable */ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./.yarn/cache/v8-compile-cache-npm-2.3.0-961375f150-adb0a271ea.zip/node_modules/v8-compile-cache/v8-compile-cache.js": +/*!****************************************************************************************************************************!*\ + !*** ./.yarn/cache/v8-compile-cache-npm-2.3.0-961375f150-adb0a271ea.zip/node_modules/v8-compile-cache/v8-compile-cache.js ***! + \****************************************************************************************************************************/ +/***/ (function(module, exports) { + +'use strict'; + +const Module = require('module'); +const crypto = require('crypto'); +const fs = require('fs'); +const path = require('path'); +const vm = require('vm'); +const os = require('os'); + +const hasOwnProperty = Object.prototype.hasOwnProperty; + +//------------------------------------------------------------------------------ +// FileSystemBlobStore +//------------------------------------------------------------------------------ + +class FileSystemBlobStore { + constructor(directory, prefix) { + const name = prefix ? slashEscape(prefix + '.') : ''; + this._blobFilename = path.join(directory, name + 'BLOB'); + this._mapFilename = path.join(directory, name + 'MAP'); + this._lockFilename = path.join(directory, name + 'LOCK'); + this._directory = directory; + this._load(); + } + + has(key, invalidationKey) { + if (hasOwnProperty.call(this._memoryBlobs, key)) { + return this._invalidationKeys[key] === invalidationKey; + } else if (hasOwnProperty.call(this._storedMap, key)) { + return this._storedMap[key][0] === invalidationKey; + } + return false; + } + + get(key, invalidationKey) { + if (hasOwnProperty.call(this._memoryBlobs, key)) { + if (this._invalidationKeys[key] === invalidationKey) { + return this._memoryBlobs[key]; + } + } else if (hasOwnProperty.call(this._storedMap, key)) { + const mapping = this._storedMap[key]; + if (mapping[0] === invalidationKey) { + return this._storedBlob.slice(mapping[1], mapping[2]); + } + } + } + + set(key, invalidationKey, buffer) { + this._invalidationKeys[key] = invalidationKey; + this._memoryBlobs[key] = buffer; + this._dirty = true; + } + + delete(key) { + if (hasOwnProperty.call(this._memoryBlobs, key)) { + this._dirty = true; + delete this._memoryBlobs[key]; + } + if (hasOwnProperty.call(this._invalidationKeys, key)) { + this._dirty = true; + delete this._invalidationKeys[key]; + } + if (hasOwnProperty.call(this._storedMap, key)) { + this._dirty = true; + delete this._storedMap[key]; + } + } + + isDirty() { + return this._dirty; + } + + save() { + const dump = this._getDump(); + const blobToStore = Buffer.concat(dump[0]); + const mapToStore = JSON.stringify(dump[1]); + + try { + mkdirpSync(this._directory); + fs.writeFileSync(this._lockFilename, 'LOCK', {flag: 'wx'}); + } catch (error) { + // Swallow the exception if we fail to acquire the lock. + return false; + } + + try { + fs.writeFileSync(this._blobFilename, blobToStore); + fs.writeFileSync(this._mapFilename, mapToStore); + } finally { + fs.unlinkSync(this._lockFilename); + } + + return true; + } + + _load() { + try { + this._storedBlob = fs.readFileSync(this._blobFilename); + this._storedMap = JSON.parse(fs.readFileSync(this._mapFilename)); + } catch (e) { + this._storedBlob = Buffer.alloc(0); + this._storedMap = {}; + } + this._dirty = false; + this._memoryBlobs = {}; + this._invalidationKeys = {}; + } + + _getDump() { + const buffers = []; + const newMap = {}; + let offset = 0; + + function push(key, invalidationKey, buffer) { + buffers.push(buffer); + newMap[key] = [invalidationKey, offset, offset + buffer.length]; + offset += buffer.length; + } + + for (const key of Object.keys(this._memoryBlobs)) { + const buffer = this._memoryBlobs[key]; + const invalidationKey = this._invalidationKeys[key]; + push(key, invalidationKey, buffer); + } + + for (const key of Object.keys(this._storedMap)) { + if (hasOwnProperty.call(newMap, key)) continue; + const mapping = this._storedMap[key]; + const buffer = this._storedBlob.slice(mapping[1], mapping[2]); + push(key, mapping[0], buffer); + } + + return [buffers, newMap]; + } +} + +//------------------------------------------------------------------------------ +// NativeCompileCache +//------------------------------------------------------------------------------ + +class NativeCompileCache { + constructor() { + this._cacheStore = null; + this._previousModuleCompile = null; + } + + setCacheStore(cacheStore) { + this._cacheStore = cacheStore; + } + + install() { + const self = this; + const hasRequireResolvePaths = typeof require.resolve.paths === 'function'; + this._previousModuleCompile = Module.prototype._compile; + Module.prototype._compile = function(content, filename) { + const mod = this; + + function require(id) { + return mod.require(id); + } + + // https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L28 + function resolve(request, options) { + return Module._resolveFilename(request, mod, false, options); + } + require.resolve = resolve; + + // https://github.com/nodejs/node/blob/v10.15.3/lib/internal/modules/cjs/helpers.js#L37 + // resolve.resolve.paths was added in v8.9.0 + if (hasRequireResolvePaths) { + resolve.paths = function paths(request) { + return Module._resolveLookupPaths(request, mod, true); + }; + } + + require.main = process.mainModule; + + // Enable support to add extra extension types + require.extensions = Module._extensions; + require.cache = Module._cache; + + const dirname = path.dirname(filename); + + const compiledWrapper = self._moduleCompile(filename, content); + + // We skip the debugger setup because by the time we run, node has already + // done that itself. + + // `Buffer` is included for Electron. + // See https://github.com/zertosh/v8-compile-cache/pull/10#issuecomment-518042543 + const args = [mod.exports, require, mod, filename, dirname, process, global, Buffer]; + return compiledWrapper.apply(mod.exports, args); + }; + } + + uninstall() { + Module.prototype._compile = this._previousModuleCompile; + } + + _moduleCompile(filename, content) { + // https://github.com/nodejs/node/blob/v7.5.0/lib/module.js#L511 + + // Remove shebang + var contLen = content.length; + if (contLen >= 2) { + if (content.charCodeAt(0) === 35/*#*/ && + content.charCodeAt(1) === 33/*!*/) { + if (contLen === 2) { + // Exact match + content = ''; + } else { + // Find end of shebang line and slice it off + var i = 2; + for (; i < contLen; ++i) { + var code = content.charCodeAt(i); + if (code === 10/*\n*/ || code === 13/*\r*/) break; + } + if (i === contLen) { + content = ''; + } else { + // Note that this actually includes the newline character(s) in the + // new output. This duplicates the behavior of the regular + // expression that was previously used to replace the shebang line + content = content.slice(i); + } + } + } + } + + // create wrapper function + var wrapper = Module.wrap(content); + + var invalidationKey = crypto + .createHash('sha1') + .update(content, 'utf8') + .digest('hex'); + + var buffer = this._cacheStore.get(filename, invalidationKey); + + var script = new vm.Script(wrapper, { + filename: filename, + lineOffset: 0, + displayErrors: true, + cachedData: buffer, + produceCachedData: true, + }); + + if (script.cachedDataProduced) { + this._cacheStore.set(filename, invalidationKey, script.cachedData); + } else if (script.cachedDataRejected) { + this._cacheStore.delete(filename); + } + + var compiledWrapper = script.runInThisContext({ + filename: filename, + lineOffset: 0, + columnOffset: 0, + displayErrors: true, + }); + + return compiledWrapper; + } +} + +//------------------------------------------------------------------------------ +// utilities +// +// https://github.com/substack/node-mkdirp/blob/f2003bb/index.js#L55-L98 +// https://github.com/zertosh/slash-escape/blob/e7ebb99/slash-escape.js +//------------------------------------------------------------------------------ + +function mkdirpSync(p_) { + _mkdirpSync(path.resolve(p_), 0o777); +} + +function _mkdirpSync(p, mode) { + try { + fs.mkdirSync(p, mode); + } catch (err0) { + if (err0.code === 'ENOENT') { + _mkdirpSync(path.dirname(p)); + _mkdirpSync(p); + } else { + try { + const stat = fs.statSync(p); + if (!stat.isDirectory()) { throw err0; } + } catch (err1) { + throw err0; + } + } + } +} + +function slashEscape(str) { + const ESCAPE_LOOKUP = { + '\\': 'zB', + ':': 'zC', + '/': 'zS', + '\x00': 'z0', + 'z': 'zZ', + }; + const ESCAPE_REGEX = /[\\:/\x00z]/g; // eslint-disable-line no-control-regex + return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]); +} + +function supportsCachedData() { + const script = new vm.Script('""', {produceCachedData: true}); + // chakracore, as of v1.7.1.0, returns `false`. + return script.cachedDataProduced === true; +} + +function getCacheDir() { + const v8_compile_cache_cache_dir = process.env.V8_COMPILE_CACHE_CACHE_DIR; + if (v8_compile_cache_cache_dir) { + return v8_compile_cache_cache_dir; + } + + // Avoid cache ownership issues on POSIX systems. + const dirname = typeof process.getuid === 'function' + ? 'v8-compile-cache-' + process.getuid() + : 'v8-compile-cache'; + const version = typeof process.versions.v8 === 'string' + ? process.versions.v8 + : typeof process.versions.chakracore === 'string' + ? 'chakracore-' + process.versions.chakracore + : 'node-' + process.version; + const cacheDir = path.join(os.tmpdir(), dirname, version); + return cacheDir; +} + +function getMainName() { + // `require.main.filename` is undefined or null when: + // * node -e 'require("v8-compile-cache")' + // * node -r 'v8-compile-cache' + // * Or, requiring from the REPL. + const mainName = require.main && typeof require.main.filename === 'string' + ? require.main.filename + : process.cwd(); + return mainName; +} + +//------------------------------------------------------------------------------ +// main +//------------------------------------------------------------------------------ + +if (!process.env.DISABLE_V8_COMPILE_CACHE && supportsCachedData()) { + const cacheDir = getCacheDir(); + const prefix = getMainName(); + const blobStore = new FileSystemBlobStore(cacheDir, prefix); + + const nativeCompileCache = new NativeCompileCache(); + nativeCompileCache.setCacheStore(blobStore); + nativeCompileCache.install(); + + process.once('exit', () => { + if (blobStore.isDirty()) { + blobStore.save(); + } + nativeCompileCache.uninstall(); + }); +} + +module.exports.__TEST__ = { + FileSystemBlobStore, + NativeCompileCache, + mkdirpSync, + slashEscape, + supportsCachedData, + getCacheDir, + getMainName, +}; + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module doesn't tell about it's top-level declarations so it can't be inlined +/******/ var __webpack_exports__ = __webpack_require__("./.yarn/cache/v8-compile-cache-npm-2.3.0-961375f150-adb0a271ea.zip/node_modules/v8-compile-cache/v8-compile-cache.js"); +/******/ var __webpack_export_target__ = exports; +/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; +/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/deps/corepack/dist/yarn.js b/deps/corepack/dist/yarn.js new file mode 100755 index 00000000000000..7a337eaa3c4742 --- /dev/null +++ b/deps/corepack/dist/yarn.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['yarn', ...process.argv.slice(2)]); diff --git a/deps/corepack/dist/yarnpkg.js b/deps/corepack/dist/yarnpkg.js new file mode 100755 index 00000000000000..8c2a3531f4eddf --- /dev/null +++ b/deps/corepack/dist/yarnpkg.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./corepack').runMain(['yarnpkg', ...process.argv.slice(2)]); diff --git a/deps/corepack/package.json b/deps/corepack/package.json new file mode 100644 index 00000000000000..4c5a5b8fc7c2ff --- /dev/null +++ b/deps/corepack/package.json @@ -0,0 +1,93 @@ +{ + "name": "corepack", + "version": "0.9.0", + "homepage": "https://github.com/nodejs/corepack#readme", + "bugs": { + "url": "https://github.com/nodejs/corepack/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/nodejs/corepack.git" + }, + "license": "MIT", + "bin": { + "corepack": "./dist/corepack.js", + "pnpm": "./dist/pnpm.js", + "pnpx": "./dist/pnpx.js", + "yarn": "./dist/yarn.js", + "yarnpkg": "./dist/yarnpkg.js" + }, + "packageManager": "yarn@3.0.0", + "devDependencies": { + "@babel/core": "^7.14.3", + "@babel/plugin-proposal-class-properties": "^7.13.0", + "@babel/plugin-proposal-decorators": "^7.14.2", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4", + "@babel/plugin-transform-modules-commonjs": "^7.14.0", + "@babel/preset-typescript": "^7.13.0", + "@types/debug": "^4.1.5", + "@types/jest": "^26.0.23", + "@types/node": "^13.9.2", + "@types/semver": "^7.1.0", + "@types/tar": "^4.0.3", + "@types/which": "^1.3.2", + "@typescript-eslint/eslint-plugin": "^2.0.0", + "@typescript-eslint/parser": "^4.2.0", + "@yarnpkg/eslint-config": "^0.1.0", + "@yarnpkg/fslib": "^2.1.0", + "@zkochan/cmd-shim": "^5.0.0", + "babel-plugin-dynamic-import-node": "^2.3.3", + "clipanion": "^3.0.1", + "debug": "^4.1.1", + "eslint": "^7.10.0", + "eslint-plugin-arca": "^0.9.5", + "jest": "^26.0.0", + "nock": "^13.0.4", + "semver": "^7.1.3", + "supports-color": "^7.1.0", + "tar": "^6.0.1", + "terser-webpack-plugin": "^5.1.2", + "ts-loader": "^8.0.2", + "ts-node": "^8.10.2", + "typescript": "^4.3.2", + "v8-compile-cache": "^2.3.0", + "webpack": "^5.38.1", + "webpack-cli": "^3.3.11", + "which": "^2.0.2" + }, + "scripts": { + "build": "rm -rf dist && webpack && ts-node ./mkshims.ts", + "corepack": "ts-node ./sources/main.ts", + "prepack": "node ./.yarn/releases/*.*js build", + "postpack": "rm -rf dist shims", + "test": "yarn jest" + }, + "files": [ + "dist", + "shims", + "LICENSE.md" + ], + "publishConfig": { + "executableFiles": [ + "./dist/npm.js", + "./dist/npx.js", + "./dist/pnpm.js", + "./dist/pnpx.js", + "./dist/yarn.js", + "./dist/yarnpkg.js", + "./dist/corepack.js", + "./shims/npm", + "./shims/npm.ps1", + "./shims/npx", + "./shims/npx.ps1", + "./shims/pnpm", + "./shims/pnpm.ps1", + "./shims/pnpx", + "./shims/pnpx.ps1", + "./shims/yarn", + "./shims/yarn.ps1", + "./shims/yarnpkg", + "./shims/yarnpkg.ps1" + ] + } +} \ No newline at end of file diff --git a/deps/corepack/shims/corepack b/deps/corepack/shims/corepack new file mode 100755 index 00000000000000..3e78b5591196f8 --- /dev/null +++ b/deps/corepack/shims/corepack @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/corepack.js" "$@" +else + exec node "$basedir/../dist/corepack.js" "$@" +fi diff --git a/deps/corepack/shims/corepack.cmd b/deps/corepack/shims/corepack.cmd new file mode 100644 index 00000000000000..9fd54a0bf33827 --- /dev/null +++ b/deps/corepack/shims/corepack.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\dist\corepack.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\dist\corepack.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/corepack.ps1 b/deps/corepack/shims/corepack.ps1 new file mode 100644 index 00000000000000..c3b027b7070bca --- /dev/null +++ b/deps/corepack/shims/corepack.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/corepack.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/corepack.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/corepack.js" $args + } else { + & "node$exe" "$basedir/../dist/corepack.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/corepack b/deps/corepack/shims/nodewin/corepack new file mode 100644 index 00000000000000..f07039780041f8 --- /dev/null +++ b/deps/corepack/shims/nodewin/corepack @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/corepack.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/corepack.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/corepack.cmd b/deps/corepack/shims/nodewin/corepack.cmd new file mode 100644 index 00000000000000..ef86865f757b65 --- /dev/null +++ b/deps/corepack/shims/nodewin/corepack.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\corepack.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\corepack.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/corepack.ps1 b/deps/corepack/shims/nodewin/corepack.ps1 new file mode 100644 index 00000000000000..4bed6916816b97 --- /dev/null +++ b/deps/corepack/shims/nodewin/corepack.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/corepack.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/corepack.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/corepack.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/corepack.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/npm b/deps/corepack/shims/nodewin/npm new file mode 100644 index 00000000000000..396430290339cf --- /dev/null +++ b/deps/corepack/shims/nodewin/npm @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/npm.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/npm.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/npm.cmd b/deps/corepack/shims/nodewin/npm.cmd new file mode 100644 index 00000000000000..f2aa293259da77 --- /dev/null +++ b/deps/corepack/shims/nodewin/npm.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\npm.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\npm.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/npm.ps1 b/deps/corepack/shims/nodewin/npm.ps1 new file mode 100644 index 00000000000000..53fa7e425acf83 --- /dev/null +++ b/deps/corepack/shims/nodewin/npm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/npm.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/npm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/npm.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/npm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/npx b/deps/corepack/shims/nodewin/npx new file mode 100644 index 00000000000000..32f7dbcc2a25ea --- /dev/null +++ b/deps/corepack/shims/nodewin/npx @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/npx.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/npx.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/npx.cmd b/deps/corepack/shims/nodewin/npx.cmd new file mode 100644 index 00000000000000..edd58fd269d991 --- /dev/null +++ b/deps/corepack/shims/nodewin/npx.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\npx.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\npx.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/npx.ps1 b/deps/corepack/shims/nodewin/npx.ps1 new file mode 100644 index 00000000000000..14c08544c5de8f --- /dev/null +++ b/deps/corepack/shims/nodewin/npx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/pnpm b/deps/corepack/shims/nodewin/pnpm new file mode 100644 index 00000000000000..b8d922e9d3619f --- /dev/null +++ b/deps/corepack/shims/nodewin/pnpm @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/pnpm.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/pnpm.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/pnpm.cmd b/deps/corepack/shims/nodewin/pnpm.cmd new file mode 100644 index 00000000000000..e5c62711468115 --- /dev/null +++ b/deps/corepack/shims/nodewin/pnpm.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\pnpm.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\pnpm.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/pnpm.ps1 b/deps/corepack/shims/nodewin/pnpm.ps1 new file mode 100644 index 00000000000000..13f0be3b21827b --- /dev/null +++ b/deps/corepack/shims/nodewin/pnpm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/pnpm.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/pnpm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/pnpm.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/pnpm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/pnpx b/deps/corepack/shims/nodewin/pnpx new file mode 100644 index 00000000000000..5fe24b62152c74 --- /dev/null +++ b/deps/corepack/shims/nodewin/pnpx @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/pnpx.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/pnpx.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/pnpx.cmd b/deps/corepack/shims/nodewin/pnpx.cmd new file mode 100644 index 00000000000000..9907571ea4ea73 --- /dev/null +++ b/deps/corepack/shims/nodewin/pnpx.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\pnpx.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\pnpx.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/pnpx.ps1 b/deps/corepack/shims/nodewin/pnpx.ps1 new file mode 100644 index 00000000000000..a25e07e580cac8 --- /dev/null +++ b/deps/corepack/shims/nodewin/pnpx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/pnpx.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/pnpx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/pnpx.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/pnpx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/vcc b/deps/corepack/shims/nodewin/vcc new file mode 100644 index 00000000000000..ab31371c115658 --- /dev/null +++ b/deps/corepack/shims/nodewin/vcc @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/vcc.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/vcc.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/vcc.cmd b/deps/corepack/shims/nodewin/vcc.cmd new file mode 100644 index 00000000000000..5a3b42a79077fa --- /dev/null +++ b/deps/corepack/shims/nodewin/vcc.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\vcc.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\vcc.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/vcc.ps1 b/deps/corepack/shims/nodewin/vcc.ps1 new file mode 100644 index 00000000000000..f59bef9a959fdc --- /dev/null +++ b/deps/corepack/shims/nodewin/vcc.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/vcc.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/vcc.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/vcc.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/vcc.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/yarn b/deps/corepack/shims/nodewin/yarn new file mode 100644 index 00000000000000..c8757d2aa9b019 --- /dev/null +++ b/deps/corepack/shims/nodewin/yarn @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/yarn.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/yarn.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/yarn.cmd b/deps/corepack/shims/nodewin/yarn.cmd new file mode 100644 index 00000000000000..ce32ffe3e0d2f2 --- /dev/null +++ b/deps/corepack/shims/nodewin/yarn.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\yarn.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\yarn.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/yarn.ps1 b/deps/corepack/shims/nodewin/yarn.ps1 new file mode 100644 index 00000000000000..2af2b4478ad260 --- /dev/null +++ b/deps/corepack/shims/nodewin/yarn.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/yarn.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/yarn.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/yarn.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/yarn.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/nodewin/yarnpkg b/deps/corepack/shims/nodewin/yarnpkg new file mode 100644 index 00000000000000..a33404c52666cc --- /dev/null +++ b/deps/corepack/shims/nodewin/yarnpkg @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/node_modules/corepack/dist/yarnpkg.js" "$@" +else + exec node "$basedir/node_modules/corepack/dist/yarnpkg.js" "$@" +fi diff --git a/deps/corepack/shims/nodewin/yarnpkg.cmd b/deps/corepack/shims/nodewin/yarnpkg.cmd new file mode 100644 index 00000000000000..7e78a17aa53f15 --- /dev/null +++ b/deps/corepack/shims/nodewin/yarnpkg.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\node_modules\corepack\dist\yarnpkg.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\node_modules\corepack\dist\yarnpkg.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/nodewin/yarnpkg.ps1 b/deps/corepack/shims/nodewin/yarnpkg.ps1 new file mode 100644 index 00000000000000..a6df5d22d2c856 --- /dev/null +++ b/deps/corepack/shims/nodewin/yarnpkg.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/yarnpkg.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/yarnpkg.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/yarnpkg.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/yarnpkg.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/npm b/deps/corepack/shims/npm new file mode 100755 index 00000000000000..5e4ec9a230e5de --- /dev/null +++ b/deps/corepack/shims/npm @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/npm.js" "$@" +else + exec node "$basedir/../dist/npm.js" "$@" +fi diff --git a/deps/corepack/shims/npm.cmd b/deps/corepack/shims/npm.cmd new file mode 100644 index 00000000000000..11c22ebf26b0bd --- /dev/null +++ b/deps/corepack/shims/npm.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\dist\npm.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\dist\npm.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/npm.ps1 b/deps/corepack/shims/npm.ps1 new file mode 100755 index 00000000000000..3f6d6516892031 --- /dev/null +++ b/deps/corepack/shims/npm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/npm.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/npm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/npm.js" $args + } else { + & "node$exe" "$basedir/../dist/npm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/npx b/deps/corepack/shims/npx new file mode 100755 index 00000000000000..f17a82d7ff8506 --- /dev/null +++ b/deps/corepack/shims/npx @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/npx.js" "$@" +else + exec node "$basedir/../dist/npx.js" "$@" +fi diff --git a/deps/corepack/shims/npx.cmd b/deps/corepack/shims/npx.cmd new file mode 100644 index 00000000000000..1a5aa9863b6a98 --- /dev/null +++ b/deps/corepack/shims/npx.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\dist\npx.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\dist\npx.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/npx.ps1 b/deps/corepack/shims/npx.ps1 new file mode 100755 index 00000000000000..950c2212ed9f9a --- /dev/null +++ b/deps/corepack/shims/npx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/npx.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/npx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/npx.js" $args + } else { + & "node$exe" "$basedir/../dist/npx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/pnpm b/deps/corepack/shims/pnpm new file mode 100755 index 00000000000000..785c7d75e2bbe9 --- /dev/null +++ b/deps/corepack/shims/pnpm @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/pnpm.js" "$@" +else + exec node "$basedir/../dist/pnpm.js" "$@" +fi diff --git a/deps/corepack/shims/pnpm.cmd b/deps/corepack/shims/pnpm.cmd new file mode 100644 index 00000000000000..6b56eead039737 --- /dev/null +++ b/deps/corepack/shims/pnpm.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\dist\pnpm.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\dist\pnpm.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/pnpm.ps1 b/deps/corepack/shims/pnpm.ps1 new file mode 100755 index 00000000000000..35046e1ef7dfc9 --- /dev/null +++ b/deps/corepack/shims/pnpm.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/pnpm.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/pnpm.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/pnpm.js" $args + } else { + & "node$exe" "$basedir/../dist/pnpm.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/pnpx b/deps/corepack/shims/pnpx new file mode 100755 index 00000000000000..12bd7cc4f565e3 --- /dev/null +++ b/deps/corepack/shims/pnpx @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/pnpx.js" "$@" +else + exec node "$basedir/../dist/pnpx.js" "$@" +fi diff --git a/deps/corepack/shims/pnpx.cmd b/deps/corepack/shims/pnpx.cmd new file mode 100644 index 00000000000000..e5050ae93cba81 --- /dev/null +++ b/deps/corepack/shims/pnpx.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\dist\pnpx.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\dist\pnpx.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/pnpx.ps1 b/deps/corepack/shims/pnpx.ps1 new file mode 100755 index 00000000000000..341bb49fbead7a --- /dev/null +++ b/deps/corepack/shims/pnpx.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/pnpx.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/pnpx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/pnpx.js" $args + } else { + & "node$exe" "$basedir/../dist/pnpx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/yarn b/deps/corepack/shims/yarn new file mode 100755 index 00000000000000..298711ea934fbf --- /dev/null +++ b/deps/corepack/shims/yarn @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/yarn.js" "$@" +else + exec node "$basedir/../dist/yarn.js" "$@" +fi diff --git a/deps/corepack/shims/yarn.cmd b/deps/corepack/shims/yarn.cmd new file mode 100644 index 00000000000000..d287d59ac5e301 --- /dev/null +++ b/deps/corepack/shims/yarn.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\dist\yarn.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\dist\yarn.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/yarn.ps1 b/deps/corepack/shims/yarn.ps1 new file mode 100755 index 00000000000000..f40254603d8aae --- /dev/null +++ b/deps/corepack/shims/yarn.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/yarn.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/yarn.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/yarn.js" $args + } else { + & "node$exe" "$basedir/../dist/yarn.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/corepack/shims/yarnpkg b/deps/corepack/shims/yarnpkg new file mode 100755 index 00000000000000..3aa289648ad107 --- /dev/null +++ b/deps/corepack/shims/yarnpkg @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../dist/yarnpkg.js" "$@" +else + exec node "$basedir/../dist/yarnpkg.js" "$@" +fi diff --git a/deps/corepack/shims/yarnpkg.cmd b/deps/corepack/shims/yarnpkg.cmd new file mode 100644 index 00000000000000..90d32f5c239463 --- /dev/null +++ b/deps/corepack/shims/yarnpkg.cmd @@ -0,0 +1,7 @@ +@IF EXIST "%~dp0\node.exe" ( + "%~dp0\node.exe" "%~dp0\..\dist\yarnpkg.js" %* +) ELSE ( + @SETLOCAL + @SET PATHEXT=%PATHEXT:;.JS;=;% + node "%~dp0\..\dist\yarnpkg.js" %* +) \ No newline at end of file diff --git a/deps/corepack/shims/yarnpkg.ps1 b/deps/corepack/shims/yarnpkg.ps1 new file mode 100755 index 00000000000000..825935c07351da --- /dev/null +++ b/deps/corepack/shims/yarnpkg.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../dist/yarnpkg.js" $args + } else { + & "$basedir/node$exe" "$basedir/../dist/yarnpkg.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../dist/yarnpkg.js" $args + } else { + & "node$exe" "$basedir/../dist/yarnpkg.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/deps/npm/docs/content/using-npm/scripts.md b/deps/npm/docs/content/using-npm/scripts.md index 8fd5c5c0dbc9d8..2f2d53c1c2b64b 100644 --- a/deps/npm/docs/content/using-npm/scripts.md +++ b/deps/npm/docs/content/using-npm/scripts.md @@ -203,6 +203,19 @@ will default the `start` command to `node server.js`. `prestart` and * `test` * `posttest` +#### A Note on a lack of [`npm uninstall`](/commands/npm-uninstall) scripts + +While npm v6 had `uninstall` lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful. + +Reasons for a package removal include: + +* a user directly uninstalled this package +* a user uninstalled a dependant package and so this dependency is being uninstalled +* a user uninstalled a dependant package but another package also depends on this version +* this version has been merged as a duplicate with another version +* etc. + +Due to the lack of necessary context, `uninstall` lifecycle scripts are not implemented and will not function. ### User diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index fb05ec983d1b12..e45846324faac9 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,7 @@

Description

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

-
npm@7.21.0 /path/to/npm
+
npm@7.21.1 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index cb00df323df54f..a2feb42e43b6da 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -148,7 +148,7 @@

Table of contents

npm <command> [args]
 

Version

-

7.21.0

+

7.21.1

Description

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/using-npm/scripts.html b/deps/npm/docs/output/using-npm/scripts.html index 9b1a2e322e3621..6dcf9a0416e4c2 100644 --- a/deps/npm/docs/output/using-npm/scripts.html +++ b/deps/npm/docs/output/using-npm/scripts.html @@ -141,7 +141,7 @@

scripts

Table of contents

- +

Description

@@ -337,6 +337,17 @@

npm test<
  • test
  • posttest
  • +

    A Note on a lack of npm uninstall scripts

    +

    While npm v6 had uninstall lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there’s no clear way to currently give the script enough context to be useful.

    +

    Reasons for a package removal include:

    +
      +
    • a user directly uninstalled this package
    • +
    • a user uninstalled a dependant package and so this dependency is being uninstalled
    • +
    • a user uninstalled a dependant package but another package also depends on this version
    • +
    • this version has been merged as a duplicate with another version
    • +
    • etc.
    • +
    +

    Due to the lack of necessary context, uninstall lifecycle scripts are not implemented and will not function.

    User

    When npm is run as root, scripts are always run with the effective uid and gid of the working directory owner.

    diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js index a56dd92ffbde6a..2df7bf513437cc 100644 --- a/deps/npm/lib/config.js +++ b/deps/npm/lib/config.js @@ -121,7 +121,7 @@ class Config extends BaseCommand { break case 'list': case 'ls': - await (this.npm.config.get('json') ? this.listJson() : this.list()) + await (this.npm.flatOptions.json ? this.listJson() : this.list()) break case 'edit': await this.edit() @@ -138,7 +138,7 @@ class Config extends BaseCommand { if (!args.length) throw this.usageError() - const where = this.npm.config.get('location') + const where = this.npm.flatOptions.location for (const [key, val] of Object.entries(keyValues(args))) { this.npm.log.info('config', 'set %j %j', key, val) this.npm.config.set(key, val || '', where) @@ -168,15 +168,15 @@ class Config extends BaseCommand { if (!keys.length) throw this.usageError() - const where = this.npm.config.get('location') + const where = this.npm.flatOptions.location for (const key of keys) this.npm.config.delete(key, where) await this.npm.config.save(where) } async edit () { - const e = this.npm.config.get('editor') - const where = this.npm.config.get('location') + const e = this.npm.flatOptions.editor + const where = this.npm.flatOptions.location const file = this.npm.config.data.get(where).source // save first, just to make sure it's synced up @@ -232,6 +232,7 @@ ${defData} async list () { const msg = [] + // long does not have a flattener const long = this.npm.config.get('long') for (const [where, { data, source }] of this.npm.config.data.entries()) { if (where === 'default' && !long) diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index c71781627872a8..092e0fc435cb4e 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -804,7 +804,11 @@ define('global', { * bin files are linked to \`{prefix}/bin\` * man pages are linked to \`{prefix}/share/man\` `, - flatten, + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.global) + flatOptions.location = 'global' + }, }) define('global-style', { @@ -1131,14 +1135,10 @@ define('location', { description: ` When passed to \`npm config\` this refers to which config file to use. `, - // NOTE: the flattener here deliberately does not alter the value of global - // for now, this is to avoid inadvertently causing any breakage. the value of - // global, however, does modify this flag. - flatten (key, obj, flatOptions) { - // if global is set, we override ourselves - if (obj.global) - obj.location = 'global' - flatOptions.location = obj.location + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.global) + flatOptions.location = 'global' }, }) @@ -1359,7 +1359,11 @@ define('package-lock', { modules will also be disabled. To remove extraneous modules with package-locks disabled use \`npm prune\`. `, - flatten, + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.packageLockOnly) + flatOptions.packageLock = true + }, }) define('package-lock-only', { @@ -1375,7 +1379,11 @@ define('package-lock-only', { For \`list\` this means the output will be based on the tree described by the \`package-lock.json\`, rather than the contents of \`node_modules\`. `, - flatten, + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.packageLockOnly) + flatOptions.packageLock = true + }, }) define('pack-destination', { diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 8dd999493aa23f..00d30a51c933cd 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\.21\.0 /path/to/npm +npm@7\.21\.1 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index a4ac45b5ef163d..e915deec084429 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -10,7 +10,7 @@ npm [args] .RE .SS Version .P -7\.21\.0 +7\.21\.1 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7 index 086f7289b5117b..47e5879639b814 100644 --- a/deps/npm/man/man7/scripts.7 +++ b/deps/npm/man/man7/scripts.7 @@ -290,6 +290,26 @@ will default the \fBstart\fP command to \fBnode server\.js\fP\|\. \fBprestart\f \fBposttest\fP .RE +.SS A Note on a lack of npm help \fBuninstall\fP scripts +.P +While npm v6 had \fBuninstall\fP lifecycle scripts, npm v7 does not\. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful\. +.P +Reasons for a package removal include: +.RS 0 +.IP \(bu 2 +a user directly uninstalled this package +.IP \(bu 2 +a user uninstalled a dependant package and so this dependency is being uninstalled +.IP \(bu 2 +a user uninstalled a dependant package but another package also depends on this version +.IP \(bu 2 +this version has been merged as a duplicate with another version +.IP \(bu 2 +etc\. + +.RE +.P +Due to the lack of necessary context, \fBuninstall\fP lifecycle scripts are not implemented and will not function\. .SS User .P When npm is run as root, scripts are always run with the effective uid diff --git a/deps/npm/node_modules/@gar/promisify/index.js b/deps/npm/node_modules/@gar/promisify/index.js new file mode 100644 index 00000000000000..d0be95f6fec610 --- /dev/null +++ b/deps/npm/node_modules/@gar/promisify/index.js @@ -0,0 +1,36 @@ +'use strict' + +const { promisify } = require('util') + +const handler = { + get: function (target, prop, receiver) { + if (typeof target[prop] !== 'function') { + return target[prop] + } + if (target[prop][promisify.custom]) { + return function () { + return Reflect.get(target, prop, receiver)[promisify.custom].apply(target, arguments) + } + } + return function () { + return new Promise((resolve, reject) => { + Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) { + if (err) { + return reject(err) + } + resolve(result) + }]) + }) + } + } +} + +module.exports = function (thingToPromisify) { + if (typeof thingToPromisify === 'function') { + return promisify(thingToPromisify) + } + if (typeof thingToPromisify === 'object') { + return new Proxy(thingToPromisify, handler) + } + throw new TypeError('Can only promisify functions or objects') +} diff --git a/deps/npm/node_modules/@gar/promisify/package.json b/deps/npm/node_modules/@gar/promisify/package.json new file mode 100644 index 00000000000000..b5140876c2cb78 --- /dev/null +++ b/deps/npm/node_modules/@gar/promisify/package.json @@ -0,0 +1,32 @@ +{ + "name": "@gar/promisify", + "version": "1.1.2", + "description": "Promisify an entire class or object", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/wraithgar/gar-promisify.git" + }, + "scripts": { + "lint": "standard", + "lint:fix": "standard --fix", + "test": "lab -a @hapi/code -t 100", + "posttest": "npm run lint" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promisify", + "all", + "class", + "object" + ], + "author": "Gar ", + "license": "MIT", + "devDependencies": { + "@hapi/code": "^8.0.1", + "@hapi/lab": "^24.1.0", + "standard": "^16.0.3" + } +} diff --git a/deps/npm/node_modules/@npmcli/fs/LICENSE.md b/deps/npm/node_modules/@npmcli/fs/LICENSE.md new file mode 100644 index 00000000000000..845be76f64e789 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/LICENSE.md @@ -0,0 +1,18 @@ +ISC License + +Copyright npm, 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 NPM DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO +EVENT SHALL NPM 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/@npmcli/fs/lib/common/file-url-to-path/index.js b/deps/npm/node_modules/@npmcli/fs/lib/common/file-url-to-path/index.js new file mode 100644 index 00000000000000..7755d1c10e6d0f --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/common/file-url-to-path/index.js @@ -0,0 +1,17 @@ +const url = require('url') + +const node = require('../node.js') +const polyfill = require('./polyfill.js') + +const useNative = node.satisfies('>=10.12.0') + +const fileURLToPath = (path) => { + // the polyfill is tested separately from this module, no need to hack + // process.version to try to trigger it just for coverage + // istanbul ignore next + return useNative + ? url.fileURLToPath(path) + : polyfill(path) +} + +module.exports = fileURLToPath diff --git a/deps/npm/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js b/deps/npm/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js new file mode 100644 index 00000000000000..794d9bba415aef --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js @@ -0,0 +1,120 @@ +const { URL, domainToUnicode } = require('url') + +const CHAR_LOWERCASE_A = 97 +const CHAR_LOWERCASE_Z = 122 + +const isWindows = process.platform === 'win32' + +class ERR_INVALID_FILE_URL_HOST extends TypeError { + constructor (platform) { + super(`File URL host must be "localhost" or empty on ${platform}`) + this.code = 'ERR_INVALID_FILE_URL_HOST' + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } +} + +class ERR_INVALID_FILE_URL_PATH extends TypeError { + constructor (msg) { + super(`File URL path ${msg}`) + this.code = 'ERR_INVALID_FILE_URL_PATH' + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } +} + +class ERR_INVALID_ARG_TYPE extends TypeError { + constructor (name, actual) { + super(`The "${name}" argument must be one of type string or an instance of URL. Received type ${typeof actual} ${actual}`) + this.code = 'ERR_INVALID_ARG_TYPE' + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } +} + +class ERR_INVALID_URL_SCHEME extends TypeError { + constructor (expected) { + super(`The URL must be of scheme ${expected}`) + this.code = 'ERR_INVALID_URL_SCHEME' + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } +} + +const isURLInstance = (input) => { + return input != null && input.href && input.origin +} + +const getPathFromURLWin32 = (url) => { + const hostname = url.hostname + let pathname = url.pathname + for (let n = 0; n < pathname.length; n++) { + if (pathname[n] === '%') { + const third = pathname.codePointAt(n + 2) | 0x20 + if ((pathname[n + 1] === '2' && third === 102) || + (pathname[n + 1] === '5' && third === 99)) { + throw new ERR_INVALID_FILE_URL_PATH('must not include encoded \\ or / characters') + } + } + } + + pathname = pathname.replace(/\//g, '\\') + pathname = decodeURIComponent(pathname) + if (hostname !== '') { + return `\\\\${domainToUnicode(hostname)}${pathname}` + } + + const letter = pathname.codePointAt(1) | 0x20 + const sep = pathname[2] + if (letter < CHAR_LOWERCASE_A || letter > CHAR_LOWERCASE_Z || + (sep !== ':')) { + throw new ERR_INVALID_FILE_URL_PATH('must be absolute') + } + + return pathname.slice(1) +} + +const getPathFromURLPosix = (url) => { + if (url.hostname !== '') { + throw new ERR_INVALID_FILE_URL_HOST(process.platform) + } + + const pathname = url.pathname + + for (let n = 0; n < pathname.length; n++) { + if (pathname[n] === '%') { + const third = pathname.codePointAt(n + 2) | 0x20 + if (pathname[n + 1] === '2' && third === 102) { + throw new ERR_INVALID_FILE_URL_PATH('must not include encoded / characters') + } + } + } + + return decodeURIComponent(pathname) +} + +const fileURLToPath = (path) => { + if (typeof path === 'string') { + path = new URL(path) + } else if (!isURLInstance(path)) { + throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path) + } + + if (path.protocol !== 'file:') { + throw new ERR_INVALID_URL_SCHEME('file') + } + + return isWindows + ? getPathFromURLWin32(path) + : getPathFromURLPosix(path) +} + +module.exports = fileURLToPath diff --git a/deps/npm/node_modules/@npmcli/fs/lib/common/get-options.js b/deps/npm/node_modules/@npmcli/fs/lib/common/get-options.js new file mode 100644 index 00000000000000..cb5982f79077ac --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/common/get-options.js @@ -0,0 +1,20 @@ +// given an input that may or may not be an object, return an object that has +// a copy of every defined property listed in 'copy'. if the input is not an +// object, assign it to the property named by 'wrap' +const getOptions = (input, { copy, wrap }) => { + const result = {} + + if (input && typeof input === 'object') { + for (const prop of copy) { + if (input[prop] !== undefined) { + result[prop] = input[prop] + } + } + } else { + result[wrap] = input + } + + return result +} + +module.exports = getOptions diff --git a/deps/npm/node_modules/@npmcli/fs/lib/common/node.js b/deps/npm/node_modules/@npmcli/fs/lib/common/node.js new file mode 100644 index 00000000000000..4d13bc037359d7 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/common/node.js @@ -0,0 +1,9 @@ +const semver = require('semver') + +const satisfies = (range) => { + return semver.satisfies(process.version, range, { includePrerelease: true }) +} + +module.exports = { + satisfies, +} diff --git a/deps/npm/node_modules/@npmcli/fs/lib/common/owner.js b/deps/npm/node_modules/@npmcli/fs/lib/common/owner.js new file mode 100644 index 00000000000000..e3468b077d00ec --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/common/owner.js @@ -0,0 +1,92 @@ +const { dirname, resolve } = require('path') + +const fileURLToPath = require('./file-url-to-path/index.js') +const fs = require('../fs.js') + +// given a path, find the owner of the nearest parent +const find = async (path) => { + // if we have no getuid, permissions are irrelevant on this platform + if (!process.getuid) { + return {} + } + + // fs methods accept URL objects with a scheme of file: so we need to unwrap + // those into an actual path string before we can resolve it + const resolved = path != null && path.href && path.origin + ? resolve(fileURLToPath(path)) + : resolve(path) + + let stat + + try { + stat = await fs.lstat(resolved) + } finally { + // if we got a stat, return its contents + if (stat) { + return { uid: stat.uid, gid: stat.gid } + } + + // try the parent directory + if (resolved !== dirname(resolved)) { + return find(dirname(resolved)) + } + + // no more parents, never got a stat, just return an empty object + return {} + } +} + +// given a path, uid, and gid update the ownership of the path if necessary +const update = async (path, uid, gid) => { + // nothing to update, just exit + if (uid === undefined && gid === undefined) { + return + } + + try { + // see if the permissions are already the same, if they are we don't + // need to do anything, so return early + const stat = await fs.stat(path) + if (uid === stat.uid && gid === stat.gid) { + return + } + } catch (err) {} + + try { + await fs.chown(path, uid, gid) + } catch (err) {} +} + +// accepts a `path` and the `owner` property of an options object and normalizes +// it into an object with numerical `uid` and `gid` +const validate = async (path, input) => { + let uid + let gid + + if (typeof input === 'string' || typeof input === 'number') { + uid = input + gid = input + } else if (input && typeof input === 'object') { + uid = input.uid + gid = input.gid + } + + if (uid === 'inherit' || gid === 'inherit') { + const owner = await find(path) + if (uid === 'inherit') { + uid = owner.uid + } + + if (gid === 'inherit') { + gid = owner.gid + } + } + + return { uid, gid } +} + +module.exports = { + find, + update, + validate, +} diff --git a/deps/npm/node_modules/@npmcli/fs/lib/copy-file.js b/deps/npm/node_modules/@npmcli/fs/lib/copy-file.js new file mode 100644 index 00000000000000..d9875aba11f793 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/copy-file.js @@ -0,0 +1,22 @@ +const fs = require('./fs.js') +const getOptions = require('./common/get-options.js') +const owner = require('./common/owner.js') + +const copyFile = async (src, dest, opts) => { + const options = getOptions(opts, { + copy: ['mode', 'owner'], + wrap: 'mode', + }) + + const { uid, gid } = await owner.validate(dest, options.owner) + + // the node core method as of 16.5.0 does not support the mode being in an + // object, so we have to pass the mode value directly + const result = await fs.copyFile(src, dest, options.mode) + + await owner.update(dest, uid, gid) + + return result +} + +module.exports = copyFile diff --git a/deps/npm/node_modules/@npmcli/fs/lib/fs.js b/deps/npm/node_modules/@npmcli/fs/lib/fs.js new file mode 100644 index 00000000000000..29e5fb57356836 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/fs.js @@ -0,0 +1,8 @@ +const fs = require('fs') +const promisify = require('@gar/promisify') + +// this module returns the core fs module wrapped in a proxy that promisifies +// method calls within the getter. we keep it in a separate module so that the +// overridden methods have a consistent way to get to promisified fs methods +// without creating a circular dependency +module.exports = promisify(fs) diff --git a/deps/npm/node_modules/@npmcli/fs/lib/index.js b/deps/npm/node_modules/@npmcli/fs/lib/index.js new file mode 100644 index 00000000000000..f669efc1a91e0b --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/index.js @@ -0,0 +1,9 @@ +module.exports = { + ...require('./fs.js'), + copyFile: require('./copy-file.js'), + mkdir: require('./mkdir/index.js'), + mkdtemp: require('./mkdtemp.js'), + rm: require('./rm/index.js'), + withTempDir: require('./with-temp-dir.js'), + writeFile: require('./write-file.js'), +} diff --git a/deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js b/deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js new file mode 100644 index 00000000000000..04ff4479034545 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/mkdir/index.js @@ -0,0 +1,32 @@ +const fs = require('../fs.js') +const getOptions = require('../common/get-options.js') +const node = require('../common/node.js') +const owner = require('../common/owner.js') + +const polyfill = require('./polyfill.js') + +// node 10.12.0 added the options parameter, which allows recursive and mode +// properties to be passed +const useNative = node.satisfies('>=10.12.0') + +// extends mkdir with the ability to specify an owner of the new dir +const mkdir = async (path, opts) => { + const options = getOptions(opts, { + copy: ['mode', 'recursive', 'owner'], + wrap: 'mode', + }) + const { uid, gid } = await owner.validate(path, options.owner) + + // the polyfill is tested separately from this module, no need to hack + // process.version to try to trigger it just for coverage + // istanbul ignore next + const result = useNative + ? await fs.mkdir(path, options) + : await polyfill(path, options) + + await owner.update(path, uid, gid) + + return result +} + +module.exports = mkdir diff --git a/deps/npm/node_modules/@npmcli/fs/lib/mkdir/polyfill.js b/deps/npm/node_modules/@npmcli/fs/lib/mkdir/polyfill.js new file mode 100644 index 00000000000000..4f8e6f006a30ec --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/mkdir/polyfill.js @@ -0,0 +1,81 @@ +const { dirname } = require('path') + +const fileURLToPath = require('../common/file-url-to-path/index.js') +const fs = require('../fs.js') + +const defaultOptions = { + mode: 0o777, + recursive: false, +} + +const mkdir = async (path, opts) => { + const options = { ...defaultOptions, ...opts } + + // if we're not in recursive mode, just call the real mkdir with the path and + // the mode option only + if (!options.recursive) { + return fs.mkdir(path, options.mode) + } + + const makeDirectory = async (dir, mode) => { + // we can't use dirname directly since these functions support URL + // objects with the file: protocol as the path input, so first we get a + // string path, then we can call dirname on that + const parent = dir != null && dir.href && dir.origin + ? dirname(fileURLToPath(dir)) + : dirname(dir) + + // if the parent is the dir itself, try to create it. anything but EISDIR + // should be rethrown + if (parent === dir) { + try { + await fs.mkdir(dir, opts) + } catch (err) { + if (err.code !== 'EISDIR') { + throw err + } + } + return undefined + } + + try { + await fs.mkdir(dir, mode) + return dir + } catch (err) { + // ENOENT means the parent wasn't there, so create that + if (err.code === 'ENOENT') { + const made = await makeDirectory(parent, mode) + await makeDirectory(dir, mode) + // return the shallowest path we created, i.e. the result of creating + // the parent + return made + } + + // an EEXIST means there's already something there + // an EROFS means we have a read-only filesystem and can't create a dir + // any other error is fatal and we should give up now + if (err.code !== 'EEXIST' && err.code !== 'EROFS') { + throw err + } + + // stat the directory, if the result is a directory, then we successfully + // created this one so return its path. otherwise, we reject with the + // original error by ignoring the error in the catch + try { + const stat = await fs.stat(dir) + if (stat.isDirectory()) { + // if it already existed, we didn't create anything so return + // undefined + return undefined + } + } catch (_) {} + + // if the thing that's there isn't a directory, then just re-throw + throw err + } + } + + return makeDirectory(path, options.mode) +} + +module.exports = mkdir diff --git a/deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js b/deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js new file mode 100644 index 00000000000000..b7f078029d1111 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/mkdtemp.js @@ -0,0 +1,28 @@ +const { dirname, sep } = require('path') + +const fs = require('./fs.js') +const getOptions = require('./common/get-options.js') +const owner = require('./common/owner.js') + +const mkdtemp = async (prefix, opts) => { + const options = getOptions(opts, { + copy: ['encoding', 'owner'], + wrap: 'encoding', + }) + + // mkdtemp relies on the trailing path separator to indicate if it should + // create a directory inside of the prefix. if that's the case then the root + // we infer ownership from is the prefix itself, otherwise it's the dirname + // /tmp -> /tmpABCDEF, infers from / + // /tmp/ -> /tmp/ABCDEF, infers from /tmp + const root = prefix.endsWith(sep) ? prefix : dirname(prefix) + const { uid, gid } = await owner.validate(root, options.owner) + + const result = await fs.mkdtemp(prefix, options) + + await owner.update(result, uid, gid) + + return result +} + +module.exports = mkdtemp diff --git a/deps/npm/node_modules/@npmcli/fs/lib/rm/index.js b/deps/npm/node_modules/@npmcli/fs/lib/rm/index.js new file mode 100644 index 00000000000000..cb81fbdf8cc479 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/rm/index.js @@ -0,0 +1,22 @@ +const fs = require('../fs.js') +const getOptions = require('../common/get-options.js') +const node = require('../common/node.js') +const polyfill = require('./polyfill.js') + +// node 14.14.0 added fs.rm, which allows both the force and recursive options +const useNative = node.satisfies('>=14.14.0') + +const rm = async (path, opts) => { + const options = getOptions(opts, { + copy: ['retryDelay', 'maxRetries', 'recursive', 'force'], + }) + + // the polyfill is tested separately from this module, no need to hack + // process.version to try to trigger it just for coverage + // istanbul ignore next + return useNative + ? fs.rm(path, options) + : polyfill(path, options) +} + +module.exports = rm diff --git a/deps/npm/node_modules/@npmcli/fs/lib/rm/polyfill.js b/deps/npm/node_modules/@npmcli/fs/lib/rm/polyfill.js new file mode 100644 index 00000000000000..77196b76beb06c --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/rm/polyfill.js @@ -0,0 +1,238 @@ +// this file is a modified version of the code in node core >=14.14.0 +// which is, in turn, a modified version of the rimraf module on npm +// node core changes: +// - Use of the assert module has been replaced with core's error system. +// - All code related to the glob dependency has been removed. +// - Bring your own custom fs module is not currently supported. +// - Some basic code cleanup. +// changes here: +// - remove all callback related code +// - drop sync support +// - change assertions back to non-internal methods (see options.js) +// - throws ENOTDIR when rmdir gets an ENOENT for a path that exists in Windows +const errnos = require('os').constants.errno +const { join } = require('path') +const fs = require('../fs.js') + +// error codes that mean we need to remove contents +const notEmptyCodes = new Set([ + 'ENOTEMPTY', + 'EEXIST', + 'EPERM', +]) + +// error codes we can retry later +const retryCodes = new Set([ + 'EBUSY', + 'EMFILE', + 'ENFILE', + 'ENOTEMPTY', + 'EPERM', +]) + +const isWindows = process.platform === 'win32' + +const defaultOptions = { + retryDelay: 100, + maxRetries: 0, + recursive: false, + force: false, +} + +// this is drastically simplified, but should be roughly equivalent to what +// node core throws +class ERR_FS_EISDIR extends Error { + constructor (path) { + super() + this.info = { + code: 'EISDIR', + message: 'is a directory', + path, + syscall: 'rm', + errno: errnos.EISDIR, + } + this.name = 'SystemError' + this.code = 'ERR_FS_EISDIR' + this.errno = errnos.EISDIR + this.syscall = 'rm' + this.path = path + this.message = `Path is a directory: ${this.syscall} returned ${this.info.code} (is a directory) ${path}` + } + + toString () { + return `${this.name} [${this.code}]: ${this.message}` + } +} + +class ENOTDIR extends Error { + constructor (path) { + super() + this.name = 'Error' + this.code = 'ENOTDIR' + this.errno = errnos.ENOTDIR + this.syscall = 'rmdir' + this.path = path + this.message = `not a directory, ${this.syscall} '${this.path}'` + } + + toString () { + return `${this.name}: ${this.code}: ${this.message}` + } +} + +// force is passed separately here because we respect it for the first entry +// into rimraf only, any further calls that are spawned as a result (i.e. to +// delete content within the target) will ignore ENOENT errors +const rimraf = async (path, options, isTop = false) => { + const force = isTop ? options.force : true + const stat = await fs.lstat(path) + .catch((err) => { + // we only ignore ENOENT if we're forcing this call + if (err.code === 'ENOENT' && force) { + return + } + + if (isWindows && err.code === 'EPERM') { + return fixEPERM(path, options, err, isTop) + } + + throw err + }) + + // no stat object here means either lstat threw an ENOENT, or lstat threw + // an EPERM and the fixPERM function took care of things. either way, we're + // already done, so return early + if (!stat) { + return + } + + if (stat.isDirectory()) { + return rmdir(path, options, null, isTop) + } + + return fs.unlink(path) + .catch((err) => { + if (err.code === 'ENOENT' && force) { + return + } + + if (err.code === 'EISDIR') { + return rmdir(path, options, err, isTop) + } + + if (err.code === 'EPERM') { + // in windows, we handle this through fixEPERM which will also try to + // delete things again. everywhere else since deleting the target as a + // file didn't work we go ahead and try to delete it as a directory + return isWindows + ? fixEPERM(path, options, err, isTop) + : rmdir(path, options, err, isTop) + } + + throw err + }) +} + +const fixEPERM = async (path, options, originalErr, isTop) => { + const force = isTop ? options.force : true + const targetMissing = await fs.chmod(path, 0o666) + .catch((err) => { + if (err.code === 'ENOENT' && force) { + return true + } + + throw originalErr + }) + + // got an ENOENT above, return now. no file = no problem + if (targetMissing) { + return + } + + // this function does its own lstat rather than calling rimraf again to avoid + // infinite recursion for a repeating EPERM + const stat = await fs.lstat(path) + .catch((err) => { + if (err.code === 'ENOENT' && force) { + return + } + + throw originalErr + }) + + if (!stat) { + return + } + + if (stat.isDirectory()) { + return rmdir(path, options, originalErr, isTop) + } + + return fs.unlink(path) +} + +const rmdir = async (path, options, originalErr, isTop) => { + if (!options.recursive && isTop) { + throw originalErr || new ERR_FS_EISDIR(path) + } + const force = isTop ? options.force : true + + return fs.rmdir(path) + .catch(async (err) => { + // in Windows, calling rmdir on a file path will fail with ENOENT rather + // than ENOTDIR. to determine if that's what happened, we have to do + // another lstat on the path. if the path isn't actually gone, we throw + // away the ENOENT and replace it with our own ENOTDIR + if (isWindows && err.code === 'ENOENT') { + const stillExists = await fs.lstat(path).then(() => true, () => false) + if (stillExists) { + err = new ENOTDIR(path) + } + } + + // not there, not a problem + if (err.code === 'ENOENT' && force) { + return + } + + // we may not have originalErr if lstat tells us our target is a + // directory but that changes before we actually remove it, so + // only throw it here if it's set + if (originalErr && err.code === 'ENOTDIR') { + throw originalErr + } + + // the directory isn't empty, remove the contents and try again + if (notEmptyCodes.has(err.code)) { + const files = await fs.readdir(path) + await Promise.all(files.map((file) => { + const target = join(path, file) + return rimraf(target, options) + })) + return fs.rmdir(path) + } + + throw err + }) +} + +const rm = async (path, opts) => { + const options = { ...defaultOptions, ...opts } + let retries = 0 + + const errHandler = async (err) => { + if (retryCodes.has(err.code) && ++retries < options.maxRetries) { + const delay = retries * options.retryDelay + await promiseTimeout(delay) + return rimraf(path, options, true).catch(errHandler) + } + + throw err + } + + return rimraf(path, options, true).catch(errHandler) +} + +const promiseTimeout = (ms) => new Promise((r) => setTimeout(r, ms)) + +module.exports = rm diff --git a/deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js b/deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js new file mode 100644 index 00000000000000..353d5555d10f69 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js @@ -0,0 +1,39 @@ +const { join, sep } = require('path') + +const getOptions = require('./common/get-options.js') +const mkdir = require('./mkdir/index.js') +const mkdtemp = require('./mkdtemp.js') +const rm = require('./rm/index.js') + +// create a temp directory, ensure its permissions match its parent, then call +// the supplied function passing it the path to the directory. clean up after +// the function finishes, whether it throws or not +const withTempDir = async (root, fn, opts) => { + const options = getOptions(opts, { + copy: ['tmpPrefix'], + }) + // create the directory, and fix its ownership + await mkdir(root, { recursive: true, owner: 'inherit' }) + + const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || ''), { owner: 'inherit' }) + let err + let result + + try { + result = await fn(target) + } catch (_err) { + err = _err + } + + try { + await rm(target, { force: true, recursive: true }) + } catch (err) {} + + if (err) { + throw err + } + + return result +} + +module.exports = withTempDir diff --git a/deps/npm/node_modules/@npmcli/fs/lib/write-file.js b/deps/npm/node_modules/@npmcli/fs/lib/write-file.js new file mode 100644 index 00000000000000..01de531d980c4d --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/lib/write-file.js @@ -0,0 +1,19 @@ +const fs = require('./fs.js') +const getOptions = require('./common/get-options.js') +const owner = require('./common/owner.js') + +const writeFile = async (file, data, opts) => { + const options = getOptions(opts, { + copy: ['encoding', 'mode', 'flag', 'signal', 'owner'], + wrap: 'encoding', + }) + const { uid, gid } = await owner.validate(file, options.owner) + + const result = await fs.writeFile(file, data, options) + + await owner.update(file, uid, gid) + + return result +} + +module.exports = writeFile diff --git a/deps/npm/node_modules/@npmcli/fs/package.json b/deps/npm/node_modules/@npmcli/fs/package.json new file mode 100644 index 00000000000000..b114b73d24e9e8 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/fs/package.json @@ -0,0 +1,36 @@ +{ + "name": "@npmcli/fs", + "version": "1.0.0", + "description": "filesystem utilities for the npm cli", + "main": "lib/index.js", + "files": [ + "lib", + "bin" + ], + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "snap": "tap", + "test": "tap", + "npmclilint": "npmcli-lint", + "lint": "npm run npmclilint -- \"lib/**/*.*js\" \"test/**/*.*js\"", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint --", + "postsnap": "npm run lintfix --" + }, + "keywords": [ + "npm", + "oss" + ], + "author": "GitHub Inc.", + "license": "ISC", + "devDependencies": { + "@npmcli/lint": "^1.0.1", + "tap": "^15.0.9" + }, + "dependencies": { + "@gar/promisify": "^1.0.1", + "semver": "^7.3.5" + } +} diff --git a/deps/npm/node_modules/cacache/get.js b/deps/npm/node_modules/cacache/get.js index fe710bbd68def3..4e905e7cf861c1 100644 --- a/deps/npm/node_modules/cacache/get.js +++ b/deps/npm/node_modules/cacache/get.js @@ -1,119 +1,112 @@ 'use strict' -const util = require('util') +const Collect = require('minipass-collect') +const Minipass = require('minipass') +const Pipeline = require('minipass-pipeline') const fs = require('fs') +const util = require('util') + const index = require('./lib/entry-index') const memo = require('./lib/memoization') const read = require('./lib/content/read') -const Minipass = require('minipass') -const Collect = require('minipass-collect') -const Pipeline = require('minipass-pipeline') - const writeFile = util.promisify(fs.writeFile) -module.exports = function get (cache, key, opts) { - return getData(false, cache, key, opts) -} -module.exports.byDigest = function getByDigest (cache, digest, opts) { - return getData(true, cache, digest, opts) -} - -function getData (byDigest, cache, key, opts = {}) { +function getData (cache, key, opts = {}) { const { integrity, memoize, size } = opts - const memoized = byDigest - ? memo.get.byDigest(cache, key, opts) - : memo.get(cache, key, opts) + const memoized = memo.get(cache, key, opts) if (memoized && memoize !== false) { - return Promise.resolve( - byDigest - ? memoized - : { - metadata: memoized.entry.metadata, - data: memoized.data, - integrity: memoized.entry.integrity, - size: memoized.entry.size, - } - ) + return Promise.resolve({ + metadata: memoized.entry.metadata, + data: memoized.data, + integrity: memoized.entry.integrity, + size: memoized.entry.size, + }) } - return (byDigest ? Promise.resolve(null) : index.find(cache, key, opts)).then( - (entry) => { - if (!entry && !byDigest) - throw new index.NotFoundError(cache, key) - return read(cache, byDigest ? key : entry.integrity, { - integrity, - size, - }) - .then((data) => - byDigest - ? data - : { - data, - metadata: entry.metadata, - size: entry.size, - integrity: entry.integrity, - } - ) - .then((res) => { - if (memoize && byDigest) - memo.put.byDigest(cache, key, res, opts) - else if (memoize) - memo.put(cache, entry, res.data, opts) - - return res - }) - } - ) -} + return index.find(cache, key, opts).then((entry) => { + if (!entry) + throw new index.NotFoundError(cache, key) + + return read(cache, entry.integrity, { integrity, size }).then((data) => { + if (memoize) + memo.put(cache, entry, data, opts) -module.exports.sync = function get (cache, key, opts) { - return getDataSync(false, cache, key, opts) + return { + data, + metadata: entry.metadata, + size: entry.size, + integrity: entry.integrity, + } + }) + }) } -module.exports.sync.byDigest = function getByDigest (cache, digest, opts) { - return getDataSync(true, cache, digest, opts) +module.exports = getData + +function getDataByDigest (cache, key, opts = {}) { + const { integrity, memoize, size } = opts + const memoized = memo.get.byDigest(cache, key, opts) + if (memoized && memoize !== false) + return Promise.resolve(memoized) + + return read(cache, key, { integrity, size }).then((res) => { + if (memoize) + memo.put.byDigest(cache, key, res, opts) + return res + }) } +module.exports.byDigest = getDataByDigest -function getDataSync (byDigest, cache, key, opts = {}) { +function getDataSync (cache, key, opts = {}) { const { integrity, memoize, size } = opts - const memoized = byDigest - ? memo.get.byDigest(cache, key, opts) - : memo.get(cache, key, opts) + const memoized = memo.get(cache, key, opts) + if (memoized && memoize !== false) { - return byDigest - ? memoized - : { - metadata: memoized.entry.metadata, - data: memoized.data, - integrity: memoized.entry.integrity, - size: memoized.entry.size, - } + return { + metadata: memoized.entry.metadata, + data: memoized.data, + integrity: memoized.entry.integrity, + size: memoized.entry.size, + } } - const entry = !byDigest && index.find.sync(cache, key, opts) - if (!entry && !byDigest) + const entry = index.find.sync(cache, key, opts) + if (!entry) throw new index.NotFoundError(cache, key) - - const data = read.sync(cache, byDigest ? key : entry.integrity, { + const data = read.sync(cache, entry.integrity, { integrity: integrity, size: size, }) - const res = byDigest - ? data - : { - metadata: entry.metadata, - data: data, - size: entry.size, - integrity: entry.integrity, - } - if (memoize && byDigest) - memo.put.byDigest(cache, key, res, opts) - else if (memoize) + const res = { + metadata: entry.metadata, + data: data, + size: entry.size, + integrity: entry.integrity, + } + if (memoize) memo.put(cache, entry, res.data, opts) return res } -module.exports.stream = getStream +module.exports.sync = getDataSync + +function getDataByDigestSync (cache, digest, opts = {}) { + const { integrity, memoize, size } = opts + const memoized = memo.get.byDigest(cache, digest, opts) + + if (memoized && memoize !== false) + return memoized + + const res = read.sync(cache, digest, { + integrity: integrity, + size: size, + }) + if (memoize) + memo.put.byDigest(cache, digest, res, opts) + + return res +} +module.exports.sync.byDigest = getDataByDigestSync const getMemoizedStream = (memoized) => { const stream = new Minipass() @@ -166,7 +159,7 @@ function getStream (cache, key, opts = {}) { return stream } -module.exports.stream.byDigest = getStreamDigest +module.exports.stream = getStream function getStreamDigest (cache, integrity, opts = {}) { const { memoize } = opts @@ -191,7 +184,7 @@ function getStreamDigest (cache, integrity, opts = {}) { } } -module.exports.info = info +module.exports.stream.byDigest = getStreamDigest function info (cache, key, opts = {}) { const { memoize } = opts @@ -201,53 +194,44 @@ function info (cache, key, opts = {}) { else return index.find(cache, key) } +module.exports.info = info -module.exports.hasContent = read.hasContent - -function cp (cache, key, dest, opts) { - return copy(false, cache, key, dest, opts) -} - -module.exports.copy = cp - -function cpDigest (cache, digest, dest, opts) { - return copy(true, cache, digest, dest, opts) -} - -module.exports.copy.byDigest = cpDigest - -function copy (byDigest, cache, key, dest, opts = {}) { +function copy (cache, key, dest, opts = {}) { if (read.copy) { - return (byDigest - ? Promise.resolve(null) - : index.find(cache, key, opts) - ).then((entry) => { - if (!entry && !byDigest) + return index.find(cache, key, opts).then((entry) => { + if (!entry) throw new index.NotFoundError(cache, key) - - return read - .copy(cache, byDigest ? key : entry.integrity, dest, opts) + return read.copy(cache, entry.integrity, dest, opts) .then(() => { - return byDigest - ? key - : { - metadata: entry.metadata, - size: entry.size, - integrity: entry.integrity, - } + return { + metadata: entry.metadata, + size: entry.size, + integrity: entry.integrity, + } }) }) } - return getData(byDigest, cache, key, opts).then((res) => { - return writeFile(dest, byDigest ? res : res.data).then(() => { - return byDigest - ? key - : { - metadata: res.metadata, - size: res.size, - integrity: res.integrity, - } + return getData(cache, key, opts).then((res) => { + return writeFile(dest, res.data).then(() => { + return { + metadata: res.metadata, + size: res.size, + integrity: res.integrity, + } }) }) } +module.exports.copy = copy + +function copyByDigest (cache, key, dest, opts = {}) { + if (read.copy) + return read.copy(cache, key, dest, opts).then(() => key) + + return getDataByDigest(cache, key, opts).then((res) => { + return writeFile(dest, res).then(() => key) + }) +} +module.exports.copy.byDigest = copyByDigest + +module.exports.hasContent = read.hasContent diff --git a/deps/npm/node_modules/cacache/lib/util/tmp.js b/deps/npm/node_modules/cacache/lib/util/tmp.js index fbcd2ab132eae5..0a5a50eba30618 100644 --- a/deps/npm/node_modules/cacache/lib/util/tmp.js +++ b/deps/npm/node_modules/cacache/lib/util/tmp.js @@ -1,21 +1,21 @@ 'use strict' -const util = require('util') +const fs = require('@npmcli/fs') const fixOwner = require('./fix-owner') const path = require('path') -const rimraf = util.promisify(require('rimraf')) -const uniqueFilename = require('unique-filename') -const { disposer } = require('./disposer') module.exports.mkdir = mktmpdir function mktmpdir (cache, opts = {}) { const { tmpPrefix } = opts - const tmpTarget = uniqueFilename(path.join(cache, 'tmp'), tmpPrefix) - return fixOwner.mkdirfix(cache, tmpTarget).then(() => { - return tmpTarget - }) + const tmpDir = path.join(cache, 'tmp') + return fs.mkdir(tmpDir, { recursive: true, owner: 'inherit' }) + .then(() => { + // do not use path.join(), it drops the trailing / if tmpPrefix is unset + const target = `${tmpDir}${path.sep}${tmpPrefix || ''}` + return fs.mkdtemp(target, { owner: 'inherit' }) + }) } module.exports.withTmp = withTmp @@ -25,7 +25,7 @@ function withTmp (cache, opts, cb) { cb = opts opts = {} } - return disposer(mktmpdir(cache, opts), rimraf, cb) + return fs.withTempDir(path.join(cache, 'tmp'), cb, opts) } module.exports.fix = fixtmpdir diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json index 3c2e65c0404a0d..6cb4140159af8c 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,6 +1,6 @@ { "name": "cacache", - "version": "15.2.0", + "version": "15.3.0", "cache-version": { "content": "2", "index": "5" @@ -43,6 +43,7 @@ ], "license": "ISC", "dependencies": { + "@npmcli/fs": "^1.0.0", "@npmcli/move-file": "^1.0.1", "chownr": "^2.0.0", "fs-minipass": "^2.0.0", diff --git a/deps/npm/node_modules/make-fetch-happen/lib/agent.js b/deps/npm/node_modules/make-fetch-happen/lib/agent.js index 873d69cf4760b8..3675dd8ae981a9 100644 --- a/deps/npm/node_modules/make-fetch-happen/lib/agent.js +++ b/deps/npm/node_modules/make-fetch-happen/lib/agent.js @@ -33,7 +33,7 @@ function getAgent (uri, opts) { ? `proxy:${pxuri.protocol}//${pxuri.host}:${pxuri.port}` : '>no-proxy<', `local-address:${opts.localAddress || '>no-local-address<'}`, - `strict-ssl:${isHttps ? !!opts.strictSSL : '>no-strict-ssl<'}`, + `strict-ssl:${isHttps ? opts.rejectUnauthorized : '>no-strict-ssl<'}`, `ca:${(isHttps && opts.ca) || '>no-ca<'}`, `cert:${(isHttps && opts.cert) || '>no-cert<'}`, `key:${(isHttps && opts.key) || '>no-key<'}`, @@ -72,7 +72,7 @@ function getAgent (uri, opts) { cert: opts.cert, key: opts.key, localAddress: opts.localAddress, - rejectUnauthorized: opts.strictSSL, + rejectUnauthorized: opts.rejectUnauthorized, timeout: agentTimeout, }) : new HttpAgent({ maxSockets: agentMaxSockets, @@ -173,7 +173,7 @@ function getProxy (proxyUrl, opts, isHttps) { timeout: getAgentTimeout(opts.timeout), localAddress: opts.localAddress, maxSockets: getMaxSockets(opts.maxSockets), - rejectUnauthorized: opts.strictSSL, + rejectUnauthorized: opts.rejectUnauthorized, } if (proxyUrl.protocol === 'http:' || proxyUrl.protocol === 'https:') { diff --git a/deps/npm/node_modules/make-fetch-happen/lib/options.js b/deps/npm/node_modules/make-fetch-happen/lib/options.js index 08891754868a50..f6138e6e1d13a6 100644 --- a/deps/npm/node_modules/make-fetch-happen/lib/options.js +++ b/deps/npm/node_modules/make-fetch-happen/lib/options.js @@ -7,10 +7,9 @@ const conditionalHeaders = [ ] const configureOptions = (opts) => { - const options = { ...opts } + const {strictSSL, ...options} = { ...opts } options.method = options.method ? options.method.toUpperCase() : 'GET' - if (Object.prototype.hasOwnProperty.call(options, 'strictSSL')) - options.rejectUnauthorized = options.strictSSL + options.rejectUnauthorized = strictSSL !== false if (!options.retry) options.retry = { retries: 0 } diff --git a/deps/npm/node_modules/make-fetch-happen/package.json b/deps/npm/node_modules/make-fetch-happen/package.json index 013156756e9772..dae7b37da40691 100644 --- a/deps/npm/node_modules/make-fetch-happen/package.json +++ b/deps/npm/node_modules/make-fetch-happen/package.json @@ -1,6 +1,6 @@ { "name": "make-fetch-happen", - "version": "9.0.5", + "version": "9.1.0", "description": "Opinionated, caching, retrying fetch client", "main": "lib/index.js", "files": [ diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json index 6589be8063714a..5ca535cfd14adb 100644 --- a/deps/npm/node_modules/read-package-json/package.json +++ b/deps/npm/node_modules/read-package-json/package.json @@ -1,6 +1,6 @@ { "name": "read-package-json", - "version": "4.0.0", + "version": "4.0.1", "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "description": "The thing npm uses to read package.json files with semantics and defaults and validation", "repository": { @@ -11,9 +11,13 @@ "scripts": { "prerelease": "npm t", "postrelease": "npm publish && git push --follow-tags", - "pretest": "standard", "release": "standard-version -s", - "test": "tap --nyc-arg=--all --coverage test/*.js" + "test": "tap --nyc-arg=--all --coverage test/*.js --branches 68 --functions 83 --lines 76 --statements 77", + "npmclilint": "npmcli-lint", + "lint": "npm run npmclilint -- --ignore-pattern test/fixtures \"*.*js\" \"test/**/*.*js\"", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint --", + "postsnap": "npm run lintfix --" }, "dependencies": { "glob": "^7.1.1", @@ -22,9 +26,9 @@ "npm-normalize-package-bin": "^1.0.0" }, "devDependencies": { - "standard": "^11.0.0", - "standard-version": "^4.3.0", - "tap": "^11.1.2" + "@npmcli/lint": "^1.0.2", + "standard-version": "^9.3.1", + "tap": "^15.0.9" }, "license": "ISC", "files": [ diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/read-json.js index 4226e77c0ff38c..04d22e3af7e211 100644 --- a/deps/npm/node_modules/read-package-json/read-json.js +++ b/deps/npm/node_modules/read-package-json/read-json.js @@ -20,7 +20,7 @@ readJson.extraSet = [ readme, mans, bins, - githead + githead, ] var typoWarned = {} @@ -36,7 +36,9 @@ function readJson (file, log_, strict_, cb_) { } } - if (!log) log = function () {} + if (!log) { + log = function () {} + } cb = arguments[arguments.length - 1] readJson_(file, log, strict, cb) @@ -52,7 +54,9 @@ function stripBOM (content) { // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) // because the buffer-to-string conversion in `fs.readFileSync()` // translates it to FEFF, the UTF-16 BOM. - if (content.charCodeAt(0) === 0xFEFF) content = content.slice(1) + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1) + } return content } @@ -87,9 +91,13 @@ function parseJson (file, er, d, log, strict, cb) { } }) } - if (er) return cb(er) + if (er) { + return cb(er) + } - if (cache[d]) return cb(null, jsonClone(cache[d])) + if (cache[d]) { + return cb(null, jsonClone(cache[d])) + } var data @@ -102,7 +110,9 @@ function parseJson (file, er, d, log, strict, cb) { } } catch (er) { data = parseIndex(d) - if (!data) return cb(parseError(er, file)) + if (!data) { + return cb(parseError(er, file)) + } } extrasCached(file, d, data, log, strict, cb) @@ -118,16 +128,24 @@ function extrasCached (file, d, data, log, strict, cb) { } function indexjs (file, er, log, strict, cb) { - if (path.basename(file) === 'index.js') return cb(er) + if (path.basename(file) === 'index.js') { + return cb(er) + } var index = path.resolve(path.dirname(file), 'index.js') fs.readFile(index, 'utf8', function (er2, d) { - if (er2) return cb(er) + if (er2) { + return cb(er) + } - if (cache[d]) return cb(null, cache[d]) + if (cache[d]) { + return cb(null, cache[d]) + } var data = parseIndex(d) - if (!data) return cb(er) + if (!data) { + return cb(er) + } extrasCached(file, d, data, log, strict, cb) }) @@ -144,7 +162,9 @@ function extras (file, data, log_, strict_, cb_) { } } - if (!log) log = function () {} + if (!log) { + log = function () {} + } cb = arguments[i] var set = readJson.extraSet @@ -155,15 +175,23 @@ function extras (file, data, log_, strict_, cb_) { }) function then (er) { - if (errState) return - if (er) return cb(errState = er) - if (--n > 0) return + if (errState) { + return + } + if (er) { + return cb(errState = er) + } + if (--n > 0) { + return + } final(file, data, log, strict, cb) } } function scriptpath (file, data, cb) { - if (!data.scripts) return cb(null, data) + if (!data.scripts) { + return cb(null, data) + } var k = Object.keys(data.scripts) k.forEach(scriptpath_, data.scripts) cb(null, data) @@ -172,7 +200,9 @@ function scriptpath (file, data, cb) { function scriptpath_ (key) { var s = this[key] // This is never allowed, and only causes problems - if (typeof s !== 'string') return delete this[key] + if (typeof s !== 'string') { + return delete this[key] + } var spre = /^(\.[/\\])?node_modules[/\\].bin[\\/]/ if (s.match(spre)) { @@ -183,17 +213,25 @@ function scriptpath_ (key) { function gypfile (file, data, cb) { var dir = path.dirname(file) var s = data.scripts || {} - if (s.install || s.preinstall) return cb(null, data) + if (s.install || s.preinstall) { + return cb(null, data) + } glob('*.gyp', { cwd: dir }, function (er, files) { - if (er) return cb(er) - if (data.gypfile === false) return cb(null, data) + if (er) { + return cb(er) + } + if (data.gypfile === false) { + return cb(null, data) + } gypfile_(file, data, files, cb) }) } function gypfile_ (file, data, files, cb) { - if (!files.length) return cb(null, data) + if (!files.length) { + return cb(null, data) + } var s = data.scripts || {} s.install = 'node-gyp rebuild' data.scripts = s @@ -204,15 +242,21 @@ function gypfile_ (file, data, files, cb) { function serverjs (file, data, cb) { var dir = path.dirname(file) var s = data.scripts || {} - if (s.start) return cb(null, data) + if (s.start) { + return cb(null, data) + } glob('server.js', { cwd: dir }, function (er, files) { - if (er) return cb(er) + if (er) { + return cb(er) + } serverjs_(file, data, files, cb) }) } function serverjs_ (file, data, files, cb) { - if (!files.length) return cb(null, data) + if (!files.length) { + return cb(null, data) + } var s = data.scripts || {} s.start = 'node server.js' data.scripts = s @@ -220,11 +264,15 @@ function serverjs_ (file, data, files, cb) { } function authors (file, data, cb) { - if (data.contributors) return cb(null, data) + if (data.contributors) { + return cb(null, data) + } var af = path.resolve(path.dirname(file), 'AUTHORS') fs.readFile(af, 'utf8', function (er, ad) { // ignore error. just checking it. - if (er) return cb(null, data) + if (er) { + return cb(null, data) + } authors_(file, data, ad, cb) }) } @@ -240,16 +288,22 @@ function authors_ (file, data, ad, cb) { } function readme (file, data, cb) { - if (data.readme) return cb(null, data) + if (data.readme) { + return cb(null, data) + } var dir = path.dirname(file) var globOpts = { cwd: dir, nocase: true, mark: true } glob('{README,README.*}', globOpts, function (er, files) { - if (er) return cb(er) + if (er) { + return cb(er) + } // don't accept directories. files = files.filter(function (file) { return !file.match(/\/$/) }) - if (!files.length) return cb() + if (!files.length) { + return cb() + } var fn = preferMarkdownReadme(files) var rm = path.resolve(dir, fn) readme_(file, data, rm, cb) @@ -275,7 +329,9 @@ function readme_ (file, data, rm, cb) { var rmfn = path.basename(rm) fs.readFile(rm, 'utf8', function (er, rm) { // maybe not readable, or something. - if (er) return cb() + if (er) { + return cb() + } data.readme = rm data.readmeFilename = rmfn return cb(er, data) @@ -284,31 +340,32 @@ function readme_ (file, data, rm, cb) { function mans (file, data, cb) { var m = data.directories && data.directories.man - if (data.man || !m) return cb(null, data) + if (data.man || !m) { + return cb(null, data) + } m = path.resolve(path.dirname(file), m) glob('**/*.[0-9]', { cwd: m }, function (er, mans) { - if (er) return cb(er) - mans_(file, data, mans, cb) - }) -} - -function mans_ (file, data, mans, cb) { - var m = data.directories && data.directories.man - data.man = mans.map(function (mf) { - return path.resolve(path.dirname(file), m, mf) + if (er) { + return cb(er) + } + data.man = mans + return cb(null, data) }) - return cb(null, data) } function bins (file, data, cb) { data = normalizePackageBin(data) var m = data.directories && data.directories.bin - if (data.bin || !m) return cb(null, data) + if (data.bin || !m) { + return cb(null, data) + } m = path.resolve(path.dirname(file), m) glob('**', { cwd: m }, function (er, bins) { - if (er) return cb(er) + if (er) { + return cb(er) + } bins_(file, data, bins, cb) }) } @@ -330,11 +387,14 @@ function bundleDependencies (file, data, cb) { var bdd = 'bundledDependencies' // normalize key name if (data[bdd] !== undefined) { - if (data[bd] === undefined) data[bd] = data[bdd] + if (data[bd] === undefined) { + data[bd] = data[bdd] + } delete data[bdd] } - if (data[bd] === false) delete data[bd] - else if (data[bd] === true) { + if (data[bd] === false) { + delete data[bd] + } else if (data[bd] === true) { data[bd] = Object.keys(data.dependencies || {}) } else if (data[bd] !== undefined && !Array.isArray(data[bd])) { delete data[bd] @@ -343,16 +403,24 @@ function bundleDependencies (file, data, cb) { } function githead (file, data, cb) { - if (data.gitHead) return cb(null, data) + if (data.gitHead) { + return cb(null, data) + } var dir = path.dirname(file) var head = path.resolve(dir, '.git/HEAD') fs.readFile(head, 'utf8', function (er, head) { - if (er) return cb(null, data) - githead_(file, data, dir, head, cb) + if (er) { + var parent = path.dirname(dir) + if (parent === dir) { + return cb(null, data) + } + return githead(dir, data, cb) + } + githead_(data, dir, head, cb) }) } -function githead_ (file, data, dir, head, cb) { +function githead_ (data, dir, head, cb) { if (!head.match(/^ref: /)) { data.gitHead = head.trim() return cb(null, data) @@ -388,16 +456,24 @@ function githead_ (file, data, dir, head, cb) { * normalize-package-data if it had access to the file path. */ function checkBinReferences_ (file, data, warn, cb) { - if (!(data.bin instanceof Object)) return cb() + if (!(data.bin instanceof Object)) { + return cb() + } var keys = Object.keys(data.bin) var keysLeft = keys.length - if (!keysLeft) return cb() + if (!keysLeft) { + return cb() + } function handleExists (relName, result) { keysLeft-- - if (!result) warn('No bin file found at ' + relName) - if (!keysLeft) cb() + if (!result) { + warn('No bin file found at ' + relName) + } + if (!keysLeft) { + cb() + } } keys.forEach(function (key) { @@ -421,8 +497,12 @@ function final (file, data, log, strict, cb) { var pId = makePackageId(data) function warn (msg) { - if (typoWarned[pId]) return - if (log) log('package.json', pId, msg) + if (typoWarned[pId]) { + return + } + if (log) { + log('package.json', pId, msg) + } } try { @@ -451,11 +531,15 @@ function cleanString (str) { function parseIndex (data) { data = data.split(/^\/\*\*package(?:\s|$)/m) - if (data.length < 2) return null + if (data.length < 2) { + return null + } data = data[1] data = data.split(/\*\*\/$/m) - if (data.length < 2) return null + if (data.length < 2) { + return null + } data = data[0] data = data.replace(/^\s*\*/mg, '') diff --git a/deps/npm/node_modules/tar/lib/normalize-unicode.js b/deps/npm/node_modules/tar/lib/normalize-unicode.js new file mode 100644 index 00000000000000..4aeb1d50db9e19 --- /dev/null +++ b/deps/npm/node_modules/tar/lib/normalize-unicode.js @@ -0,0 +1,11 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const normalizeCache = Object.create(null) +const {hasOwnProperty} = Object.prototype +module.exports = s => { + if (!hasOwnProperty.call(normalizeCache, s)) + normalizeCache[s] = s.normalize('NFKD') + return normalizeCache[s] +} diff --git a/deps/npm/node_modules/tar/lib/path-reservations.js b/deps/npm/node_modules/tar/lib/path-reservations.js index 8d0ead9b6017f1..8183c45f8535c9 100644 --- a/deps/npm/node_modules/tar/lib/path-reservations.js +++ b/deps/npm/node_modules/tar/lib/path-reservations.js @@ -7,7 +7,7 @@ // while still allowing maximal safe parallelization. const assert = require('assert') -const normPath = require('./normalize-windows-path.js') +const normalize = require('./normalize-unicode.js') const stripSlashes = require('./strip-trailing-slashes.js') const { join } = require('path') @@ -28,7 +28,7 @@ module.exports = () => { const getDirs = path => { const dirs = path.split('/').slice(0, -1).reduce((set, path) => { if (set.length) - path = normPath(join(set[set.length - 1], path)) + path = join(set[set.length - 1], path) set.push(path || '/') return set }, []) @@ -116,9 +116,8 @@ module.exports = () => { // So, we just pretend that every path matches every other path here, // effectively removing all parallelization on windows. paths = isWindows ? ['win32 parallelization disabled'] : paths.map(p => { - return stripSlashes(normPath(join(p))) - .normalize('NFKD') - .toLowerCase() + // don't need normPath, because we skip this entirely for windows + return normalize(stripSlashes(join(p))).toLowerCase() }) const dirs = new Set( diff --git a/deps/npm/node_modules/tar/lib/strip-trailing-slashes.js b/deps/npm/node_modules/tar/lib/strip-trailing-slashes.js index f702ed5a5c0ce5..3e3ecec5a402b8 100644 --- a/deps/npm/node_modules/tar/lib/strip-trailing-slashes.js +++ b/deps/npm/node_modules/tar/lib/strip-trailing-slashes.js @@ -1,24 +1,13 @@ -// this is the only approach that was significantly faster than using -// str.replace(/\/+$/, '') for strings ending with a lot of / chars and -// containing multiple / chars. -const batchStrings = [ - '/'.repeat(1024), - '/'.repeat(512), - '/'.repeat(256), - '/'.repeat(128), - '/'.repeat(64), - '/'.repeat(32), - '/'.repeat(16), - '/'.repeat(8), - '/'.repeat(4), - '/'.repeat(2), - '/', -] - +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. module.exports = str => { - for (const s of batchStrings) { - while (str.length >= s.length && str.slice(-1 * s.length) === s) - str = str.slice(0, -1 * s.length) + let i = str.length - 1 + let slashesStart = -1 + while (i > -1 && str.charAt(i) === '/') { + slashesStart = i + i-- } - return str + return slashesStart === -1 ? str : str.slice(0, slashesStart) } diff --git a/deps/npm/node_modules/tar/lib/unpack.js b/deps/npm/node_modules/tar/lib/unpack.js index 7f397f10379211..7d39dc0f7e79fd 100644 --- a/deps/npm/node_modules/tar/lib/unpack.js +++ b/deps/npm/node_modules/tar/lib/unpack.js @@ -17,6 +17,7 @@ const pathReservations = require('./path-reservations.js') const stripAbsolutePath = require('./strip-absolute-path.js') const normPath = require('./normalize-windows-path.js') const stripSlash = require('./strip-trailing-slashes.js') +const normalize = require('./normalize-unicode.js') const ONENTRY = Symbol('onEntry') const CHECKFS = Symbol('checkFs') @@ -101,8 +102,7 @@ const uint32 = (a, b, c) => // Note that on windows, we always drop the entire cache whenever a // symbolic link is encountered, because 8.3 filenames are impossible // to reason about, and collisions are hazards rather than just failures. -const cacheKeyNormalize = path => stripSlash(normPath(path)) - .normalize('NFKD') +const cacheKeyNormalize = path => normalize(stripSlash(normPath(path))) .toLowerCase() const pruneCache = (cache, abs) => { diff --git a/deps/npm/node_modules/tar/package.json b/deps/npm/node_modules/tar/package.json index a10cdac85ea8f8..9f9977a0ca99b0 100644 --- a/deps/npm/node_modules/tar/package.json +++ b/deps/npm/node_modules/tar/package.json @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "name": "tar", "description": "tar for node", - "version": "6.1.10", + "version": "6.1.11", "repository": { "type": "git", "url": "https://github.com/npm/node-tar.git" diff --git a/deps/npm/package.json b/deps/npm/package.json index cb8b11ff5e61f5..d5f3cf54cf89c6 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "7.21.0", + "version": "7.21.1", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -63,7 +63,7 @@ "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", "archy": "~1.0.0", - "cacache": "^15.2.0", + "cacache": "^15.3.0", "chalk": "^4.1.2", "chownr": "^2.0.0", "cli-columns": "^3.1.2", @@ -88,7 +88,7 @@ "libnpmsearch": "^3.1.1", "libnpmteam": "^2.0.3", "libnpmversion": "^1.2.1", - "make-fetch-happen": "^9.0.5", + "make-fetch-happen": "^9.1.0", "minipass": "^3.1.3", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -108,13 +108,13 @@ "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", - "read-package-json": "^4.0.0", + "read-package-json": "^4.0.1", "read-package-json-fast": "^2.0.3", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", "ssri": "^8.0.1", - "tar": "^6.1.10", + "tar": "^6.1.11", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^1.0.4", @@ -209,7 +209,7 @@ "test": "tap", "check-coverage": "tap", "snap": "tap", - "postsnap": "make -s docs/content/*/*.md", + "postsnap": "make -s mandocs", "test:nocleanup": "NO_TEST_CLEANUP=1 npm run test --", "sudotest": "sudo npm run test --", "sudotest:nocleanup": "sudo NO_TEST_CLEANUP=1 npm run test --", diff --git a/deps/npm/tap-snapshots/test/lib/config.js.test.cjs b/deps/npm/tap-snapshots/test/lib/config.js.test.cjs index a094bd32d56dfc..8f349a6f54249e 100644 --- a/deps/npm/tap-snapshots/test/lib/config.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/config.js.test.cjs @@ -5,158 +5,334 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/lib/config.js TAP config edit --location=global > should write global config file 1`] = ` -;;;; -; npm globalconfig file: /etc/npmrc -; this is a simple ini-formatted file -; lines that start with semi-colons are comments -; run \`npm help 7 config\` for documentation of the various options -; -; Configs like \`@scope:registry\` map a scope to a given registry url. -; -; Configs like \`///:_authToken\` are auth that is restricted -; to the registry host specified. - -init.author.name=Foo - -;;;; -; all available options shown below with default values -;;;; - - -; init-author-name= -; init-version=1.0.0 -; init.author.name= -; init.version=1.0.0 - -` - -exports[`test/lib/config.js TAP config edit > should write config file 1`] = ` -;;;; -; npm userconfig file: ~/.npmrc -; this is a simple ini-formatted file -; lines that start with semi-colons are comments -; run \`npm help 7 config\` for documentation of the various options -; -; Configs like \`@scope:registry\` map a scope to a given registry url. -; -; Configs like \`///:_authToken\` are auth that is restricted -; to the registry host specified. - -//registry.npmjs.org/:_authToken=0000000 -init.author.name=Foo -sign-git-commit=true - -;;;; -; all available options shown below with default values -;;;; - - -; init-author-name= -; init-version=1.0.0 -; init.author.name= -; init.version=1.0.0 - -` - -exports[`test/lib/config.js TAP config edit > should write config file 2`] = ` -;;;; -; npm userconfig file: ~/.npmrc -; this is a simple ini-formatted file -; lines that start with semi-colons are comments -; run \`npm help 7 config\` for documentation of the various options -; -; Configs like \`@scope:registry\` map a scope to a given registry url. -; -; Configs like \`///:_authToken\` are auth that is restricted -; to the registry host specified. - - - -;;;; -; all available options shown below with default values -;;;; - - -; init-author-name= -; init-version=1.0.0 -; init.author.name= -; init.version=1.0.0 - -` - -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 - -cat = true -chai = true -dog = true -editor = "vi" -json = false -location = "user" -long = false - -; node bin location = /path/to/node -; cwd = {CWD} -; HOME = ~/ -; Run \`npm config ls -l\` to show all defaults. +exports[`test/lib/config.js TAP config list --json > output matches snapshot 1`] = ` +{ + "prefix": "{LOCALPREFIX}", + "userconfig": "{HOME}/.npmrc", + "json": true, + "projectloaded": "yes", + "userloaded": "yes", + "globalloaded": "yes", + "access": null, + "all": false, + "allow-same-version": false, + "also": null, + "audit": true, + "audit-level": null, + "auth-type": "legacy", + "before": null, + "bin-links": true, + "browser": null, + "ca": null, + "cache": "{CACHE}", + "cache-max": null, + "cache-min": 0, + "cafile": null, + "call": "", + "cert": null, + "ci-name": null, + "cidr": null, + "color": true, + "commit-hooks": true, + "depth": null, + "description": true, + "dev": false, + "diff": [], + "diff-ignore-all-space": false, + "diff-name-only": false, + "diff-no-prefix": false, + "diff-dst-prefix": "b/", + "diff-src-prefix": "a/", + "diff-text": false, + "diff-unified": 3, + "dry-run": false, + "editor": "{EDITOR}", + "engine-strict": false, + "fetch-retries": 2, + "fetch-retry-factor": 10, + "fetch-retry-maxtimeout": 60000, + "fetch-retry-mintimeout": 10000, + "fetch-timeout": 300000, + "force": false, + "foreground-scripts": false, + "format-package-lock": true, + "fund": true, + "git": "git", + "git-tag-version": true, + "global": false, + "global-style": false, + "globalconfig": "{GLOBALPREFIX}/npmrc", + "heading": "npm", + "https-proxy": null, + "if-present": false, + "ignore-scripts": false, + "include": [], + "include-staged": false, + "init-author-email": "", + "init-author-name": "", + "init-author-url": "", + "init-license": "ISC", + "init-module": "{HOME}/.npm-init.js", + "init-version": "1.0.0", + "init.author.email": "", + "init.author.name": "", + "init.author.url": "", + "init.license": "ISC", + "init.module": "{HOME}/.npm-init.js", + "init.version": "1.0.0", + "key": null, + "legacy-bundling": false, + "legacy-peer-deps": false, + "link": false, + "local-address": null, + "location": "user", + "loglevel": "notice", + "logs-max": 10, + "long": false, + "maxsockets": 15, + "message": "%s", + "node-options": null, + "node-version": "{NODE-VERSION}", + "noproxy": [ + "" + ], + "npm-version": "{NPM-VERSION}", + "offline": false, + "omit": [], + "only": null, + "optional": null, + "otp": null, + "package": [], + "package-lock": true, + "package-lock-only": false, + "pack-destination": ".", + "parseable": false, + "prefer-offline": false, + "prefer-online": false, + "preid": "", + "production": null, + "progress": true, + "proxy": null, + "read-only": false, + "rebuild-bundle": true, + "registry": "https://registry.npmjs.org/", + "save": true, + "save-bundle": false, + "save-dev": false, + "save-exact": false, + "save-optional": false, + "save-peer": false, + "save-prefix": "^", + "save-prod": false, + "scope": "", + "script-shell": null, + "searchexclude": "", + "searchlimit": 20, + "searchopts": "", + "searchstaleness": 900, + "shell": "{SHELL}", + "shrinkwrap": true, + "sign-git-commit": false, + "sign-git-tag": false, + "sso-poll-frequency": 500, + "sso-type": "oauth", + "strict-peer-deps": false, + "strict-ssl": true, + "tag": "latest", + "tag-version-prefix": "v", + "timing": false, + "tmp": "{TMP}", + "umask": 0, + "unicode": false, + "update-notifier": true, + "usage": false, + "user-agent": "npm/{NPM-VERSION} node/{NODE-VERSION} {PLATFORM} {ARCH} workspaces/false", + "version": false, + "versions": false, + "viewer": "{VIEWER}", + "which": null, + "workspace": [], + "workspaces": false, + "yes": null, + "metrics-registry": "https://registry.npmjs.org/" +} ` -exports[`test/lib/config.js TAP config list --long > should list all configs 1`] = ` +exports[`test/lib/config.js TAP config list --long > output matches snapshot 1`] = ` ; "default" config from default values +_auth = (protected) +access = null +all = false +allow-same-version = false +also = null +audit = true +audit-level = null +auth-type = "legacy" +before = null +bin-links = true +browser = null +ca = null +cache = "{CACHE}" +cache-max = null +cache-min = 0 +cafile = null +call = "" +cert = null +ci-name = null +cidr = null +color = true +commit-hooks = true +depth = null +description = true +dev = false +diff = [] +diff-dst-prefix = "b/" +diff-ignore-all-space = false +diff-name-only = false +diff-no-prefix = false +diff-src-prefix = "a/" +diff-text = false +diff-unified = 3 +dry-run = false +editor = "{EDITOR}" +engine-strict = false +fetch-retries = 2 +fetch-retry-factor = 10 +fetch-retry-maxtimeout = 60000 +fetch-retry-mintimeout = 10000 +fetch-timeout = 300000 +force = false +foreground-scripts = false +format-package-lock = true +fund = true +git = "git" +git-tag-version = true +global = false +global-style = false +globalconfig = "{GLOBALPREFIX}/npmrc" +heading = "npm" +https-proxy = null +if-present = false +ignore-scripts = false +include = [] +include-staged = false +init-author-email = "" init-author-name = "" +init-author-url = "" +init-license = "ISC" +init-module = "{HOME}/.npm-init.js" init-version = "1.0.0" +init.author.email = "" init.author.name = "" +init.author.url = "" +init.license = "ISC" +init.module = "{HOME}/.npm-init.js" init.version = "1.0.0" - -; "cli" config from command line options - -cat = true -chai = true -dog = true -editor = "vi" json = false +key = null +legacy-bundling = false +legacy-peer-deps = false +link = false +local-address = null location = "user" -long = true -` +loglevel = "notice" +logs-max = 10 +; long = false ; overridden by cli +maxsockets = 15 +message = "%s" +metrics-registry = "https://registry.npmjs.org/" +node-options = null +node-version = "{NODE-VERSION}" +noproxy = [""] +npm-version = "{NPM-VERSION}" +offline = false +omit = [] +only = null +optional = null +otp = null +pack-destination = "." +package = [] +package-lock = true +package-lock-only = false +parseable = false +prefer-offline = false +prefer-online = false +; prefix = "{REALGLOBALREFIX}" ; overridden by cli +preid = "" +production = null +progress = true +proxy = null +read-only = false +rebuild-bundle = true +registry = "https://registry.npmjs.org/" +save = true +save-bundle = false +save-dev = false +save-exact = false +save-optional = false +save-peer = false +save-prefix = "^" +save-prod = false +scope = "" +script-shell = null +searchexclude = "" +searchlimit = 20 +searchopts = "" +searchstaleness = 900 +shell = "{SHELL}" +shrinkwrap = true +sign-git-commit = false +sign-git-tag = false +sso-poll-frequency = 500 +sso-type = "oauth" +strict-peer-deps = false +strict-ssl = true +tag = "latest" +tag-version-prefix = "v" +timing = false +tmp = "{TMP}" +umask = 0 +unicode = false +update-notifier = true +usage = false +user-agent = "npm/{NPM-VERSION} node/{NODE-VERSION} {PLATFORM} {ARCH} workspaces/false" +; userconfig = "{HOME}/.npmrc" ; overridden by cli +version = false +versions = false +viewer = "{VIEWER}" +which = null +workspace = [] +workspaces = false +yes = null + +; "global" config from {GLOBALPREFIX}/npmrc + +globalloaded = "yes" + +; "user" config from {HOME}/.npmrc + +userloaded = "yes" + +; "project" config from {LOCALPREFIX}/.npmrc + +projectloaded = "yes" -exports[`test/lib/config.js TAP config list > should list configs 1`] = ` ; "cli" config from command line options -cat = true -chai = true -dog = true -editor = "vi" -json = false -location = "user" -long = false - -; node bin location = /path/to/node -; cwd = {CWD} -; HOME = ~/ -; Run \`npm config ls -l\` to show all defaults. +long = true +prefix = "{LOCALPREFIX}" +userconfig = "{HOME}/.npmrc" ` -exports[`test/lib/config.js TAP config list overrides > should list overridden configs 1`] = ` +exports[`test/lib/config.js TAP config list > output matches snapshot 1`] = ` ; "cli" config from command line options -cat = true -chai = true -dog = true -editor = "vi" -init.author.name = "Bar" -json = false -location = "user" -long = false - -; "user" config from ~/.npmrc - -; //private-reg.npmjs.org/:_authThoken = (protected) ; overridden by cli -; init.author.name = "Foo" ; overridden by cli +prefix = "{LOCALPREFIX}" +userconfig = "{HOME}/.npmrc" -; node bin location = /path/to/node -; cwd = {CWD} -; HOME = ~/ +; node bin location = {EXECPATH} +; cwd = {NPMDIR} +; HOME = {HOME} ; Run \`npm config ls -l\` to show all defaults. ` diff --git a/deps/npm/tap-snapshots/test/lib/publish.js.test.cjs b/deps/npm/tap-snapshots/test/lib/publish.js.test.cjs index 7a7502e02e338a..13e8f7d4b49fa0 100644 --- a/deps/npm/tap-snapshots/test/lib/publish.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/publish.js.test.cjs @@ -15,6 +15,7 @@ exports[`test/lib/publish.js TAP private workspaces colorless > should publish a Array [ Object { "_id": "@npmcli/b@1.0.0", + "gitHead": "{GITHEAD}", "name": "@npmcli/b", "readme": "ERROR: No README data found!", "version": "1.0.0", @@ -32,6 +33,7 @@ exports[`test/lib/publish.js TAP private workspaces with color > should publish Array [ Object { "_id": "@npmcli/b@1.0.0", + "gitHead": "{GITHEAD}", "name": "@npmcli/b", "readme": "ERROR: No README data found!", "version": "1.0.0", @@ -70,6 +72,7 @@ exports[`test/lib/publish.js TAP workspaces all workspaces > should publish all Array [ Object { "_id": "workspace-a@1.2.3-a", + "gitHead": "{GITHEAD}", "name": "workspace-a", "readme": "ERROR: No README data found!", "repository": Object { @@ -83,6 +86,7 @@ Array [ "bugs": Object { "url": "https://github.com/npm/workspace-b/issues", }, + "gitHead": "{GITHEAD}", "homepage": "https://github.com/npm/workspace-b#readme", "name": "workspace-b", "readme": "ERROR: No README data found!", @@ -94,6 +98,7 @@ Array [ }, Object { "_id": "workspace-n@1.2.3-n", + "gitHead": "{GITHEAD}", "name": "workspace-n", "readme": "ERROR: No README data found!", "version": "1.2.3-n", @@ -123,6 +128,7 @@ exports[`test/lib/publish.js TAP workspaces json > should publish all workspaces Array [ Object { "_id": "workspace-a@1.2.3-a", + "gitHead": "{GITHEAD}", "name": "workspace-a", "readme": "ERROR: No README data found!", "repository": Object { @@ -136,6 +142,7 @@ Array [ "bugs": Object { "url": "https://github.com/npm/workspace-b/issues", }, + "gitHead": "{GITHEAD}", "homepage": "https://github.com/npm/workspace-b#readme", "name": "workspace-b", "readme": "ERROR: No README data found!", @@ -147,6 +154,7 @@ Array [ }, Object { "_id": "workspace-n@1.2.3-n", + "gitHead": "{GITHEAD}", "name": "workspace-n", "readme": "ERROR: No README data found!", "version": "1.2.3-n", @@ -164,6 +172,7 @@ exports[`test/lib/publish.js TAP workspaces one workspace > should publish given Array [ Object { "_id": "workspace-a@1.2.3-a", + "gitHead": "{GITHEAD}", "name": "workspace-a", "readme": "ERROR: No README data found!", "repository": Object { diff --git a/deps/npm/test/fixtures/sandbox.js b/deps/npm/test/fixtures/sandbox.js new file mode 100644 index 00000000000000..4cdd9b70dbc6f9 --- /dev/null +++ b/deps/npm/test/fixtures/sandbox.js @@ -0,0 +1,366 @@ +const { createHook, executionAsyncId } = require('async_hooks') +const { EventEmitter } = require('events') +const { homedir, tmpdir } = require('os') +const { dirname, join } = require('path') +const { promisify } = require('util') +const mkdirp = require('mkdirp-infer-owner') +const npmlog = require('npmlog') +const rimraf = promisify(require('rimraf')) +const t = require('tap') + +let active = null +const chain = new Map() +const sandboxes = new Map() + +// keep a reference to the real process +const _process = process + +const processHook = createHook({ + init: (asyncId, type, triggerAsyncId, resource) => { + // track parentage of asyncIds + chain.set(asyncId, triggerAsyncId) + }, + before: (asyncId) => { + // find the nearest parent id that has a sandbox + let parent = asyncId + while (chain.has(parent) && !sandboxes.has(parent)) { + parent = chain.get(parent) + } + + process = sandboxes.has(parent) + ? sandboxes.get(parent) + : _process + }, +}).enable() + +for (const level in npmlog.levels) { + npmlog[`_${level}`] = npmlog[level] + npmlog[level] = (...args) => { + process._logs = process._logs || {} + process._logs[level] = process._logs[level] || [] + process._logs[level].push(args) + const _level = npmlog.level + npmlog.level = 'silent' + npmlog[`_${level}`](...args) + npmlog.level = _level + } +} + +const _data = Symbol('sandbox.data') +const _dirs = Symbol('sandbox.dirs') +const _test = Symbol('sandbox.test') +const _mocks = Symbol('sandbox.mocks') +const _npm = Symbol('sandbox.npm') +const _parent = Symbol('sandbox.parent') +const _output = Symbol('sandbox.output') +const _proxy = Symbol('sandbox.proxy') +const _get = Symbol('sandbox.proxy.get') +const _set = Symbol('sandbox.proxy.set') + +// these config keys can be redacted widely +const redactedDefaults = [ + 'node-version', + 'npm-version', + 'tmp', +] + +// we can't just replace these values everywhere because they're known to be +// very short strings that could be present all over the place, so we only +// replace them if they're located within quotes for now +const vagueRedactedDefaults = [ + 'editor', + 'shell', +] + +const normalize = (str) => str + .replace(/\r\n/g, '\n') // normalize line endings (for ini) + .replace(/[A-z]:\\/g, '\\') // turn windows roots to posix ones + .replace(/\\+/g, '/') // replace \ with / + +class Sandbox extends EventEmitter { + constructor (test, options = {}) { + super() + + this[_test] = test + this[_mocks] = options.mocks || {} + this[_data] = new Map() + this[_output] = [] + const tempDir = `${test.testdirName}-sandbox` + this[_dirs] = { + temp: tempDir, + global: options.global || join(tempDir, 'global'), + home: options.home || join(tempDir, 'home'), + project: options.project || join(tempDir, 'project'), + } + + this[_proxy] = new Proxy(_process, { + get: this[_get].bind(this), + set: this[_set].bind(this), + }) + this[_proxy].env = {} + this[_proxy].argv = [] + + test.cleanSnapshot = this.cleanSnapshot.bind(this) + test.afterEach(() => this.reset()) + test.teardown(() => this.teardown()) + } + + get config () { + return this[_npm] && this[_npm].config + } + + get logs () { + return this[_proxy]._logs + } + + get global () { + return this[_dirs].global + } + + get home () { + return this[_dirs].home + } + + get project () { + return this[_dirs].project + } + + get process () { + return this[_proxy] + } + + get output () { + return this[_output].map((line) => line.join(' ')).join('\n') + } + + cleanSnapshot (snapshot) { + let clean = normalize(snapshot) + + const viewer = _process.platform === 'win32' + ? /"browser"([^:]+|$)/g + : /"man"([^:]+|$)/g + + // the global prefix is platform dependent + const realGlobalPrefix = _process.platform === 'win32' + ? dirname(_process.execPath) + : dirname(dirname(_process.execPath)) + + const cache = _process.platform === 'win32' + ? /\{HOME\}\/npm-cache(\r?\n|"|\/|$)/g + : /\{HOME\}\/\.npm(\n|"|\/|$)/g + + // and finally replace some paths we know could be present + clean = clean + .replace(viewer, '"{VIEWER}"$1') + .split(normalize(this[_proxy].execPath)).join('{EXECPATH}') + .split(normalize(_process.execPath)).join('{REALEXECPATH}') + .split(normalize(this.global)).join('{GLOBALPREFIX}') + .split(normalize(realGlobalPrefix)).join('{REALGLOBALREFIX}') + .split(normalize(this.project)).join('{LOCALPREFIX}') + .split(normalize(this.home)).join('{HOME}') + .replace(cache, '{CACHE}$1') + .split(normalize(dirname(dirname(__dirname)))).join('{NPMDIR}') + .split(normalize(tmpdir())).join('{TMP}') + .split(normalize(homedir())).join('{REALHOME}') + .split(this[_proxy].platform).join('{PLATFORM}') + .split(this[_proxy].arch).join('{ARCH}') + + // We do the defaults after everything else so that they don't cause the + // other cleaners to miss values we would have clobbered here. For + // instance if execPath is /home/user/.nvm/versions/node/1.0.0/bin/node, + // and we replaced the node version first, the real execPath we're trying + // to replace would no longer be represented, and be missed. + if (this[_npm]) { + // replace default config values with placeholders + for (const name of redactedDefaults) { + let value = this[_npm].config.defaults[name] + clean = clean.split(value).join(`{${name.toUpperCase()}}`) + } + + // replace vague default config values that are present within quotes + // with placeholders + for (const name of vagueRedactedDefaults) { + const value = this[_npm].config.defaults[name] + clean = clean.split(`"${value}"`).join(`"{${name.toUpperCase()}}"`) + } + } + + return clean + } + + // test.afterEach hook + reset () { + this.removeAllListeners() + this[_parent] = undefined + this[_output] = [] + this[_data].clear() + this[_proxy].env = {} + this[_proxy].argv = [] + this[_npm] = undefined + } + + // test.teardown hook + teardown () { + if (this[_parent]) { + sandboxes.delete(this[_parent]) + } + return rimraf(this[_dirs].temp).catch(() => null) + } + + // proxy get handler + [_get] (target, prop, receiver) { + if (this[_data].has(prop)) { + return this[_data].get(prop) + } + + if (this[prop] !== undefined) { + return Reflect.get(this, prop, this) + } + + const actual = Reflect.get(target, prop, receiver) + if (typeof actual === 'function') { + // in node 10.1 there's an interesting bug where if a function on process + // is called without explicitly forcing the 'this' arg to something, we + // get 'Illegal invocation' errors. wrapping function properties in their + // own proxy so that we can make sure the context is right fixes it + return new Proxy(actual, { + apply: (target, context, args) => { + return Reflect.apply(target, _process, args) + }, + }) + } + + return actual + } + + // proxy set handler + [_set] (target, prop, value) { + if (prop === 'env') { + value = { + ...value, + HOME: this.home, + } + } + + if (prop === 'argv') { + value = [ + process.execPath, + join(dirname(process.execPath), 'npm'), + ...value, + ] + } + + return this[_data].set(prop, value) + } + + async run (command, argv = []) { + await Promise.all([ + mkdirp(this.project), + mkdirp(this.home), + mkdirp(this.global), + ]) + + // attach the sandbox process now, doing it after the promise above is + // necessary to make sure that only async calls spawned as part of this + // call to run will receive the sandbox. if we attach it too early, we + // end up interfering with tap + this[_parent] = executionAsyncId() + this[_data].set('_asyncId', this[_parent]) + sandboxes.set(this[_parent], this[_proxy]) + process = this[_proxy] + + this[_proxy].argv = [ + '--prefix', this.project, + '--userconfig', join(this.home, '.npmrc'), + '--globalconfig', join(this.global, 'npmrc'), + command, + ...argv, + ] + + this[_npm] = this[_test].mock('../../lib/npm.js', this[_mocks]) + this[_npm].output = (...args) => this[_output].push(args) + await this[_npm].load() + // in some node versions (later 10.x) our executionAsyncId at this point + // will for some reason appear to have been triggered by a different parent + // so immediately after load, if we can see that we lost our ancestry, we + // fix it here with a hammer + if (chain.get(executionAsyncId()) !== this[_parent]) { + chain.set(executionAsyncId(), this[_parent]) + process = this[_proxy] + } + + const cmd = this[_npm].argv.shift() + const impl = this[_npm].commands[cmd] + if (!impl) { + throw new Error(`Unknown command: ${cmd}`) + } + + return new Promise((resolve, reject) => { + impl(this[_npm].argv, (err) => { + if (err) { + return reject(err) + } + + return resolve() + }) + }) + } + + async complete (command, argv, partial) { + if (!Array.isArray(argv)) { + partial = argv + argv = [] + } + + await Promise.all([ + mkdirp(this.project), + mkdirp(this.home), + mkdirp(this.global), + ]) + + // attach the sandbox process now, doing it after the promise above is + // necessary to make sure that only async calls spawned as part of this + // call to run will receive the sandbox. if we attach it too early, we + // end up interfering with tap + this[_parent] = executionAsyncId() + this[_data].set('_asyncId', this[_parent]) + sandboxes.set(this[_parent], this[_proxy]) + process = this[_proxy] + + this[_proxy].argv = [ + '--prefix', this.project, + '--userconfig', join(this.home, '.npmrc'), + '--globalconfig', join(this.global, 'npmrc'), + command, + ...argv, + ] + + this[_npm] = this[_test].mock('../../lib/npm.js', this[_mocks]) + this[_npm].output = (...args) => this[_output].push(args) + await this[_npm].load() + // in some node versions (later 10.x) our executionAsyncId at this point + // will for some reason appear to have been triggered by a different parent + // so immediately after load, if we can see that we lost our ancestry, we + // fix it here with a hammer + if (chain.get(executionAsyncId()) !== this[_parent]) { + chain.set(executionAsyncId(), this[_parent]) + process = this[_proxy] + } + + const impl = this[_npm].commands[command] + if (!impl) { + throw new Error(`Unknown command: ${cmd}`) + } + + return impl.completion({ + partialWord: partial, + conf: { + argv: { + remain: ['npm', command, ...argv], + }, + }, + }) + } +} + +module.exports = Sandbox diff --git a/deps/npm/test/lib/config.js b/deps/npm/test/lib/config.js index 8a1e7d85e09aa3..ba47fa11d0bbc7 100644 --- a/deps/npm/test/lib/config.js +++ b/deps/npm/test/lib/config.js @@ -1,659 +1,379 @@ +const { join } = require('path') +const { promisify } = require('util') +const fs = require('fs') +const spawk = require('spawk') const t = require('tap') -const { EventEmitter } = require('events') - -const redactCwd = (path) => { - const normalizePath = p => p - .replace(/\\+/g, '/') - .replace(/\r\n/g, '\n') - const replaceCwd = p => p - .replace(new RegExp(normalizePath(process.cwd()), 'g'), '{CWD}') - const cleanupWinPaths = p => p - .replace(normalizePath(process.execPath), '/path/to/node') - .replace(normalizePath(process.env.HOME), '~/') - - return cleanupWinPaths( - replaceCwd( - normalizePath(path) - ) - ) -} - -t.cleanSnapshot = (str) => redactCwd(str) - -let result = '' - -const configDefs = require('../../lib/utils/config') -const definitions = Object.entries(configDefs.definitions) - .filter(([key, def]) => { - return [ - 'init-author-name', - 'init.author.name', - 'init-version', - 'init.version', - ].includes(key) - }).reduce((defs, [key, def]) => { - defs[key] = def - return defs - }, {}) - -const defaults = { - 'init-author-name': '', - 'init-version': '1.0.0', - 'init.author.name': '', - 'init.version': '1.0.0', -} - -const cliConfig = { - editor: 'vi', - json: false, - location: 'user', - long: false, - cat: true, - chai: true, - dog: true, -} - -const npm = { - log: { - warn: () => null, - info: () => null, - enableProgress: () => null, - disableProgress: () => null, - }, - config: { - data: new Map(Object.entries({ - default: { data: defaults, source: 'default values' }, - global: { data: {}, source: '/etc/npmrc' }, - cli: { data: cliConfig, source: 'command line options' }, - })), - get (key) { - return cliConfig[key] - }, - validate () { - return true - }, - }, - output: msg => { - result = msg - }, -} - -const usageUtil = () => 'usage instructions' - -const mocks = { - '../../lib/utils/config/index.js': { defaults, definitions }, - '../../lib/utils/usage.js': usageUtil, -} - -const Config = t.mock('../../lib/config.js', mocks) -const config = new Config(npm) - -t.test('config no args', t => { - config.exec([], (err) => { - t.match(err, /usage instructions/, 'should not error out on empty locations') - t.end() - }) -}) +spawk.preventUnmatched() -t.test('config ignores workspaces', t => { - npm.log.warn = (title, msg) => { - t.equal(title, 'config', 'should warn with expected title') - t.equal( - msg, - 'This command does not support workspaces.', - 'should warn with unsupported option msg' - ) - } - config.execWorkspaces([], [], (err) => { - t.match(err, /usage instructions/, 'should not error out when workspaces are defined') - npm.log.warn = () => null - t.end() - }) +const readFile = promisify(fs.readFile) + +const Sandbox = require('../fixtures/sandbox.js') + +t.test('config no args', async (t) => { + const sandbox = new Sandbox(t) + + await t.rejects(sandbox.run('config', []), { + code: 'EUSAGE', + }, 'rejects with usage') }) -t.test('config list', t => { - t.plan(2) +t.test('config ignores workspaces', async (t) => { + const sandbox = new Sandbox(t) - npm.config.find = () => 'cli' - result = '' - t.teardown(() => { - result = '' - delete npm.config.find - }) + await t.rejects(sandbox.run('config', ['--workspaces']), { + code: 'EUSAGE', + }, 'rejects with usage') - config.exec(['list'], (err) => { - t.error(err, 'npm config list') - t.matchSnapshot(result, 'should list configs') - }) + t.match(sandbox.logs.warn, [['config', 'This command does not support workspaces.']], 'logged the warning') }) -t.test('config list overrides', t => { - t.plan(2) +t.test('config list', async (t) => { + const sandbox = new Sandbox(t) - npm.config.data.set('user', { - data: { - 'init.author.name': 'Foo', - '//private-reg.npmjs.org/:_authThoken': 'f00ba1', + const temp = t.testdir({ + global: { + npmrc: 'globalloaded=yes', + }, + project: { + '.npmrc': 'projectloaded=yes', + }, + home: { + '.npmrc': 'userloaded=yes', }, - source: '~/.npmrc', - }) - cliConfig['init.author.name'] = 'Bar' - npm.config.find = () => 'cli' - result = '' - t.teardown(() => { - result = '' - npm.config.data.delete('user') - delete cliConfig['init.author.name'] - delete npm.config.find }) + const global = join(temp, 'global') + const project = join(temp, 'project') + const home = join(temp, 'home') - config.exec(['list'], (err) => { - t.error(err, 'npm config list') - t.matchSnapshot(result, 'should list overridden configs') - }) -}) + await sandbox.run('config', ['list'], { global, project, home }) -t.test('config list --long', t => { - t.plan(2) + t.matchSnapshot(sandbox.output, 'output matches snapshot') +}) - npm.config.find = key => key in cliConfig ? 'cli' : 'default' - cliConfig.long = true - result = '' - t.teardown(() => { - delete npm.config.find - cliConfig.long = false - result = '' +t.test('config list --long', async (t) => { + const temp = t.testdir({ + global: { + npmrc: 'globalloaded=yes', + }, + project: { + '.npmrc': 'projectloaded=yes', + }, + home: { + '.npmrc': 'userloaded=yes', + }, }) + const global = join(temp, 'global') + const project = join(temp, 'project') + const home = join(temp, 'home') - config.exec(['list'], (err) => { - t.error(err, 'npm config list --long') - t.matchSnapshot(result, 'should list all configs') - }) + const sandbox = new Sandbox(t, { global, project, home }) + await sandbox.run('config', ['list', '--long']) + + t.matchSnapshot(sandbox.output, 'output matches snapshot') }) -t.test('config list --json', t => { - t.plan(2) +t.test('config list --json', async (t) => { + const temp = t.testdir({ + global: { + npmrc: 'globalloaded=yes', + }, + project: { + '.npmrc': 'projectloaded=yes', + }, + home: { + '.npmrc': 'userloaded=yes', + }, + }) + const global = join(temp, 'global') + const project = join(temp, 'project') + const home = join(temp, 'home') - cliConfig.json = true - result = '' - npm.config.list = [{ - '//private-reg.npmjs.org/:_authThoken': 'f00ba1', - ...npm.config.data.get('cli').data, - }] - const npmConfigGet = npm.config.get - npm.config.get = key => npm.config.list[0][key] + const sandbox = new Sandbox(t, { global, project, home }) + await sandbox.run('config', ['list', '--json']) - t.teardown(() => { - delete npm.config.list - cliConfig.json = false - npm.config.get = npmConfigGet - result = '' - }) + t.matchSnapshot(sandbox.output, 'output matches snapshot') +}) - config.exec(['list'], (err) => { - t.error(err, 'npm config list --json') - t.same( - JSON.parse(result), - { - editor: 'vi', - json: true, - location: 'user', - long: false, - cat: true, - chai: true, - dog: true, - }, - 'should list configs usin json' - ) - }) +t.test('config delete no args', async (t) => { + const sandbox = new Sandbox(t) + + await t.rejects(sandbox.run('config', ['delete']), { + code: 'EUSAGE', + }, 'rejects with usage') }) -t.test('config delete no args', t => { - config.exec(['delete'], (err) => { - t.match(err, { message: '\nUsage: usage instructions' }) - t.end() +t.test('config delete single key', async (t) => { + // location defaults to user, so we work with a userconfig + const home = t.testdir({ + '.npmrc': 'foo=bar\nbar=baz', }) -}) -t.test('config delete key', t => { - t.plan(4) + const sandbox = new Sandbox(t) + await sandbox.run('config', ['delete', 'foo'], { home }) - npm.config.delete = (key, where) => { - t.equal(key, 'foo', 'should delete expected keyword') - t.equal(where, 'user', 'should delete key from user config by default') - } + t.equal(sandbox.config.get('foo'), undefined, 'foo should no longer be set') - npm.config.save = where => { - t.equal(where, 'user', 'should save user config post-delete') - } + const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' }) + t.not(contents.includes('foo='), 'foo was removed on disk') +}) - config.exec(['delete', 'foo'], (err) => { - t.error(err, 'npm config delete key') +t.test('config delete multiple keys', async (t) => { + const home = t.testdir({ + '.npmrc': 'foo=bar\nbar=baz\nbaz=buz', }) - t.teardown(() => { - delete npm.config.delete - delete npm.config.save - }) -}) + const sandbox = new Sandbox(t) + await sandbox.run('config', ['delete', 'foo', 'bar'], { home }) -t.test('config delete multiple key', t => { - t.plan(6) + t.equal(sandbox.config.get('foo'), undefined, 'foo should no longer be set') + t.equal(sandbox.config.get('bar'), undefined, 'bar should no longer be set') - const expect = [ - 'foo', - 'bar', - ] + const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' }) + t.not(contents.includes('foo='), 'foo was removed on disk') + t.not(contents.includes('bar='), 'bar was removed on disk') +}) - npm.config.delete = (key, where) => { - t.equal(key, expect.shift(), 'should delete expected keyword') - t.equal(where, 'user', 'should delete key from user config by default') - } +t.test('config delete key --location=global', async (t) => { + const global = t.testdir({ + npmrc: 'foo=bar\nbar=baz', + }) - npm.config.save = where => { - t.equal(where, 'user', 'should save user config post-delete') - } + const sandbox = new Sandbox(t) + await sandbox.run('config', ['delete', 'foo', '--location=global'], { global }) - config.exec(['delete', 'foo', 'bar'], (err) => { - t.error(err, 'npm config delete keys') - }) + t.equal(sandbox.config.get('foo', 'global'), undefined, 'foo should no longer be set') - t.teardown(() => { - delete npm.config.delete - delete npm.config.save - }) + const contents = await readFile(join(global, 'npmrc'), { encoding: 'utf8' }) + t.not(contents.includes('foo='), 'foo was removed on disk') }) -t.test('config delete key --location=global', t => { - t.plan(4) +t.test('config delete key --global', async (t) => { + const global = t.testdir({ + npmrc: 'foo=bar\nbar=baz', + }) + + const sandbox = new Sandbox(t) + await sandbox.run('config', ['delete', 'foo', '--global'], { global }) - npm.config.delete = (key, where) => { - t.equal(key, 'foo', 'should delete expected keyword from global configs') - t.equal(where, 'global', 'should delete key from global config by default') - } + t.equal(sandbox.config.get('foo', 'global'), undefined, 'foo should no longer be set') - npm.config.save = where => { - t.equal(where, 'global', 'should save global config post-delete') - } + const contents = await readFile(join(global, 'npmrc'), { encoding: 'utf8' }) + t.not(contents.includes('foo='), 'foo was removed on disk') +}) - cliConfig.location = 'global' - config.exec(['delete', 'foo'], (err) => { - t.error(err, 'npm config delete key --location=global') - }) +t.test('config set no args', async (t) => { + const sandbox = new Sandbox(t) - t.teardown(() => { - cliConfig.location = 'user' - delete npm.config.delete - delete npm.config.save - }) + await t.rejects(sandbox.run('config', ['set']), { + code: 'EUSAGE', + }, 'rejects with usage') }) -t.test('config set no args', t => { - config.exec(['set'], (err) => { - t.match(err, { message: '\nUsage: usage instructions' }) - t.end() +t.test('config set key', async (t) => { + const home = t.testdir({ + '.npmrc': 'foo=bar', }) -}) -t.test('config set key', t => { - t.plan(5) + const sandbox = new Sandbox(t, { home }) - npm.config.set = (key, val, where) => { - t.equal(key, 'foo', 'should set expected key to user config') - t.equal(val, 'bar', 'should set expected value to user config') - t.equal(where, 'user', 'should set key/val in user config by default') - } + await sandbox.run('config', ['set', 'foo']) - npm.config.save = where => { - t.equal(where, 'user', 'should save user config') - } + t.equal(sandbox.config.get('foo'), '', 'set the value for foo') - config.exec(['set', 'foo', 'bar'], (err) => { - t.error(err, 'npm config set key') - }) + const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' }) + t.ok(contents.includes('foo='), 'wrote foo to disk') +}) - t.teardown(() => { - delete npm.config.set - delete npm.config.save +t.test('config set key value', async (t) => { + const home = t.testdir({ + '.npmrc': 'foo=bar', }) -}) -t.test('config set key=val', t => { - t.plan(5) + const sandbox = new Sandbox(t, { home }) - npm.config.set = (key, val, where) => { - t.equal(key, 'foo', 'should set expected key to user config') - t.equal(val, 'bar', 'should set expected value to user config') - t.equal(where, 'user', 'should set key/val in user config by default') - } + await sandbox.run('config', ['set', 'foo', 'baz']) - npm.config.save = where => { - t.equal(where, 'user', 'should save user config') - } + t.equal(sandbox.config.get('foo'), 'baz', 'set the value for foo') - config.exec(['set', 'foo=bar'], (err) => { - t.error(err, 'npm config set key') - }) + const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' }) + t.ok(contents.includes('foo=baz'), 'wrote foo to disk') +}) - t.teardown(() => { - delete npm.config.set - delete npm.config.save +t.test('config set key=value', async (t) => { + const home = t.testdir({ + '.npmrc': 'foo=bar', }) -}) -t.test('config set multiple keys', t => { - t.plan(11) - - const expect = [ - ['foo', 'bar'], - ['bar', 'baz'], - ['asdf', ''], - ] - const args = ['foo', 'bar', 'bar=baz', 'asdf'] - - npm.config.set = (key, val, where) => { - const [expectKey, expectVal] = expect.shift() - t.equal(key, expectKey, 'should set expected key to user config') - t.equal(val, expectVal, 'should set expected value to user config') - t.equal(where, 'user', 'should set key/val in user config by default') - } + const sandbox = new Sandbox(t, { home }) - npm.config.save = where => { - t.equal(where, 'user', 'should save user config') - } + await sandbox.run('config', ['set', 'foo=baz']) - config.exec(['set', ...args], (err) => { - t.error(err, 'npm config set key') - }) + t.equal(sandbox.config.get('foo'), 'baz', 'set the value for foo') - t.teardown(() => { - delete npm.config.set - delete npm.config.save - }) + const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' }) + t.ok(contents.includes('foo=baz'), 'wrote foo to disk') }) -t.test('config set key to empty value', t => { - t.plan(5) - - npm.config.set = (key, val, where) => { - t.equal(key, 'foo', 'should set expected key to user config') - t.equal(val, '', 'should set "" to user config') - t.equal(where, 'user', 'should set key/val in user config by default') - } +t.test('config set key1 value1 key2=value2 key3', async (t) => { + const home = t.testdir({ + '.npmrc': 'foo=bar\nbar=baz\nbaz=foo', + }) - npm.config.save = where => { - t.equal(where, 'user', 'should save user config') - } + const sandbox = new Sandbox(t, { home }) + await sandbox.run('config', ['set', 'foo', 'oof', 'bar=rab', 'baz']) - config.exec(['set', 'foo'], (err) => { - t.error(err, 'npm config set key to empty value') - }) + t.equal(sandbox.config.get('foo'), 'oof', 'foo was set') + t.equal(sandbox.config.get('bar'), 'rab', 'bar was set') + t.equal(sandbox.config.get('baz'), '', 'baz was set') - t.teardown(() => { - delete npm.config.set - delete npm.config.save - }) + const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' }) + t.ok(contents.includes('foo=oof'), 'foo was written to disk') + t.ok(contents.includes('bar=rab'), 'bar was written to disk') + t.ok(contents.includes('baz='), 'baz was written to disk') }) -t.test('config set invalid key', t => { - t.plan(3) +t.test('config set invalid key logs warning', async (t) => { + const sandbox = new Sandbox(t) - const npmConfigValidate = npm.config.validate - npm.config.save = () => null - npm.config.set = () => null - npm.config.validate = () => false - npm.log.warn = (title, msg) => { - t.equal(title, 'config', 'should warn with expected title') - t.equal(msg, 'omitting invalid config values', 'should use expected msg') - } - t.teardown(() => { - npm.config.validate = npmConfigValidate - delete npm.config.save - delete npm.config.set - npm.log.warn = () => null - }) - - config.exec(['set', 'foo', 'bar'], (err) => { - t.error(err, 'npm config set invalid key') - }) + // this doesn't reject, it only logs a warning + await sandbox.run('config', ['set', 'access=foo']) + t.match(sandbox.logs.warn, [ + ['invalid config', 'access="foo"', `set in ${join(sandbox.home, '.npmrc')}`], + ], 'logged warning') }) -t.test('config set key --location=global', t => { - t.plan(5) +t.test('config set key=value --location=global', async (t) => { + const global = t.testdir({ + npmrc: 'foo=bar\nbar=baz', + }) - npm.config.set = (key, val, where) => { - t.equal(key, 'foo', 'should set expected key to global config') - t.equal(val, 'bar', 'should set expected value to global config') - t.equal(where, 'global', 'should set key/val in global config') - } + const sandbox = new Sandbox(t, { global }) + await sandbox.run('config', ['set', 'foo=buzz', '--location=global']) - npm.config.save = where => { - t.equal(where, 'global', 'should save global config') - } + t.equal(sandbox.config.get('foo', 'global'), 'buzz', 'foo should be set') - cliConfig.location = 'global' - config.exec(['set', 'foo', 'bar'], (err) => { - t.error(err, 'npm config set key --location=global') - }) + const contents = await readFile(join(global, 'npmrc'), { encoding: 'utf8' }) + t.not(contents.includes('foo=buzz'), 'foo was saved on disk') +}) - t.teardown(() => { - cliConfig.location = 'user' - delete npm.config.set - delete npm.config.save +t.test('config set key=value --global', async (t) => { + const global = t.testdir({ + npmrc: 'foo=bar\nbar=baz', }) -}) -t.test('config get no args', t => { - t.plan(2) + const sandbox = new Sandbox(t, { global }) + await sandbox.run('config', ['set', 'foo=buzz', '--global']) - npm.config.find = () => 'cli' - result = '' - t.teardown(() => { - result = '' - delete npm.config.find - }) + t.equal(sandbox.config.get('foo', 'global'), 'buzz', 'foo should be set') - config.exec(['get'], (err) => { - t.error(err, 'npm config get no args') - t.matchSnapshot(result, 'should list configs on config get no args') - }) + const contents = await readFile(join(global, 'npmrc'), { encoding: 'utf8' }) + t.not(contents.includes('foo=buzz'), 'foo was saved on disk') }) -t.test('config get key', t => { - t.plan(2) +t.test('config get no args', async (t) => { + const sandbox = new Sandbox(t) - const npmConfigGet = npm.config.get - npm.config.get = (key) => { - t.equal(key, 'foo', 'should use expected key') - return 'bar' - } + await sandbox.run('config', ['get']) + const getOutput = sandbox.output - npm.config.save = where => { - throw new Error('should not save') - } + sandbox.reset() - config.exec(['get', 'foo'], (err) => { - t.error(err, 'npm config get key') - }) + await sandbox.run('config', ['list']) + const listOutput = sandbox.output - t.teardown(() => { - npm.config.get = npmConfigGet - delete npm.config.save - }) + t.equal(listOutput, getOutput, 'get with no args outputs list') }) -t.test('config get multiple keys', t => { - t.plan(4) - - const expect = [ - 'foo', - 'bar', - ] +t.test('config get single key', async (t) => { + const sandbox = new Sandbox(t) - const npmConfigGet = npm.config.get - npm.config.get = (key) => { - t.equal(key, expect.shift(), 'should use expected key') - return 'asdf' - } - - npm.config.save = where => { - throw new Error('should not save') - } + await sandbox.run('config', ['get', 'node-version']) + t.equal(sandbox.output, sandbox.config.get('node-version'), 'should get the value') +}) - config.exec(['get', 'foo', 'bar'], (err) => { - t.error(err, 'npm config get multiple keys') - t.equal(result, 'foo=asdf\nbar=asdf') - }) +t.test('config get multiple keys', async (t) => { + const sandbox = new Sandbox(t) - t.teardown(() => { - result = '' - npm.config.get = npmConfigGet - delete npm.config.save - }) + await sandbox.run('config', ['get', 'node-version', 'npm-version']) + t.ok(sandbox.output.includes(`node-version=${sandbox.config.get('node-version')}`), 'outputs node-version') + t.ok(sandbox.output.includes(`npm-version=${sandbox.config.get('npm-version')}`), 'outputs npm-version') }) -t.test('config get private key', t => { - config.exec(['get', '//private-reg.npmjs.org/:_authThoken'], (err) => { - t.match( - err, - /The \/\/private-reg.npmjs.org\/:_authThoken option is protected, and cannot be retrieved in this way/, - 'should throw unable to retrieve error' - ) - t.end() - }) +t.test('config get private key', async (t) => { + const sandbox = new Sandbox(t) + + await t.rejects(sandbox.run('config', ['get', '_authToken']), '_authToken is protected', 'rejects with protected string') }) -t.test('config edit', t => { - t.plan(12) - const npmrc = `//registry.npmjs.org/:_authToken=0000000 -init.author.name=Foo -sign-git-commit=true` - npm.config.data.set('user', { - source: '~/.npmrc', - }) - npm.config.save = async where => { - t.equal(where, 'user', 'should save to user config by default') - } - const editMocks = { - ...mocks, - 'mkdirp-infer-owner': async () => null, - fs: { - readFile (path, encoding, cb) { - cb(null, npmrc) - }, - writeFile (file, data, encoding, cb) { - t.equal(file, '~/.npmrc', 'should save to expected file location') - t.matchSnapshot(data, 'should write config file') - cb() - }, - }, - child_process: { - spawn: (bin, args) => { - t.equal(bin, 'vi', 'should use default editor') - t.strictSame(args, ['~/.npmrc'], 'should match user source data') - const ee = new EventEmitter() - process.nextTick(() => { - ee.emit('exit', 0) - }) - return ee - }, - }, - } - const Config = t.mock('../../lib/config.js', editMocks) - const config = new Config(npm) - - config.exec(['edit'], (err) => { - t.error(err, 'npm config edit') - - // test no config file result - editMocks.fs.readFile = (p, e, cb) => { - cb(new Error('ERR')) - } - const Config = t.mock('../../lib/config.js', editMocks) - const config = new Config(npm) - config.exec(['edit'], (err) => { - t.error(err, 'npm config edit') - }) +t.test('config edit', async (t) => { + const home = t.testdir({ + '.npmrc': 'foo=bar\nbar=baz', }) t.teardown(() => { - npm.config.data.delete('user') - delete npm.config.save + spawk.clean() }) -}) -t.test('config edit --location=global', t => { - t.plan(6) + const EDITOR = 'vim' + const editor = spawk.spawn(EDITOR).exit(0) - cliConfig.location = 'global' - const npmrc = 'init.author.name=Foo' - npm.config.data.set('global', { - source: '/etc/npmrc', - }) - npm.config.save = async where => { - t.equal(where, 'global', 'should save to global config') - } - const editMocks = { - ...mocks, - 'mkdirp-infer-owner': async () => null, - fs: { - readFile (path, encoding, cb) { - cb(null, npmrc) - }, - writeFile (file, data, encoding, cb) { - t.equal(file, '/etc/npmrc', 'should save to global file location') - t.matchSnapshot(data, 'should write global config file') - cb() - }, - }, - child_process: { - spawn: (bin, args, cb) => { - t.equal(bin, 'vi', 'should use default editor') - t.strictSame(args, ['/etc/npmrc'], 'should match global source data') - const ee = new EventEmitter() - process.nextTick(() => { - ee.emit('exit', 137) - }) - return ee - }, - }, - } - 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') - }) + const sandbox = new Sandbox(t, { home }) + sandbox.process.env.EDITOR = EDITOR + await sandbox.run('config', ['edit']) + + t.ok(editor.called, 'editor was spawned') + t.same(editor.calledWith.args, [join(sandbox.home, '.npmrc')], 'editor opened the user config file') + + const contents = await readFile(join(home, '.npmrc'), { encoding: 'utf8' }) + t.ok(contents.includes('foo=bar'), 'kept foo') + t.ok(contents.includes('bar=baz'), 'kept bar') + t.ok(contents.includes('shown below with default values'), 'appends defaults to file') +}) +t.test('config edit - editor exits non-0', async (t) => { t.teardown(() => { - cliConfig.location = 'user' - npm.config.data.delete('user') - delete npm.config.save + spawk.clean() }) -}) -t.test('completion', t => { - const { completion } = config + const EDITOR = 'vim' + const editor = spawk.spawn(EDITOR).exit(1) - const testComp = (argv, expect) => { - t.resolveMatch(completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' ')) - } + const sandbox = new Sandbox(t) + sandbox.process.env.EDITOR = EDITOR + await t.rejects(sandbox.run('config', ['edit']), { + message: 'editor process exited with code: 1', + }, 'rejects with error about editor code') - testComp(['npm', 'foo'], []) - testComp(['npm', 'config'], ['get', 'set', 'delete', 'ls', 'rm', 'edit', 'list']) - testComp(['npm', 'config', 'set', 'foo'], []) + t.ok(editor.called, 'editor was spawned') + t.same(editor.calledWith.args, [join(sandbox.home, '.npmrc')], 'editor opened the user config file') +}) - const possibleConfigKeys = [...Object.keys(definitions)] - testComp(['npm', 'config', 'get'], possibleConfigKeys) - testComp(['npm', 'config', 'set'], possibleConfigKeys) - testComp(['npm', 'config', 'delete'], possibleConfigKeys) - testComp(['npm', 'config', 'rm'], possibleConfigKeys) - testComp(['npm', 'config', 'edit'], []) - testComp(['npm', 'config', 'list'], []) - testComp(['npm', 'config', 'ls'], []) +t.test('completion', async (t) => { + const sandbox = new Sandbox(t) - const partial = completion({conf: { argv: { remain: ['npm', 'config'] } }, partialWord: 'l'}) - t.resolveMatch(partial, ['get', 'set', 'delete', 'ls', 'rm', 'edit'], 'npm config') + let allKeys + const testComp = async (argv, expect) => { + t.match(await sandbox.complete('config', argv), expect, argv.join(' ')) + if (!allKeys) + allKeys = Object.keys(sandbox.config.definitions) + sandbox.reset() + } - t.end() + await testComp([], ['get', 'set', 'delete', 'ls', 'rm', 'edit', 'list']) + await testComp(['set', 'foo'], []) + await testComp(['get'], allKeys) + await testComp(['set'], allKeys) + await testComp(['delete'], allKeys) + await testComp(['rm'], allKeys) + await testComp(['edit'], []) + await testComp(['list'], []) + await testComp(['ls'], []) + + const getCommand = await sandbox.complete('get') + t.match(getCommand, allKeys, 'also works for just npm get') + sandbox.reset() + + const partial = await sandbox.complete('config', 'l') + t.match(partial, ['get', 'set', 'delete', 'ls', 'rm', 'edit'], 'and works on partials') }) diff --git a/deps/npm/test/lib/publish.js b/deps/npm/test/lib/publish.js index 4aa3e5592751e0..6e0075835c2691 100644 --- a/deps/npm/test/lib/publish.js +++ b/deps/npm/test/lib/publish.js @@ -9,6 +9,14 @@ const fs = require('fs') const log = require('npmlog') log.level = 'silent' +const cleanGithead = (result) => { + return result.map((r) => { + if (r.gitHead) + r.gitHead = '{GITHEAD}' + + return r + }) +} const {definitions} = require('../../lib/utils/config') const defaults = Object.entries(definitions).reduce((defaults, [key, def]) => { defaults[key] = def.default @@ -581,7 +589,7 @@ t.test('workspaces', (t) => { log.level = 'info' publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(publishes, 'should publish all workspaces') + t.matchSnapshot(cleanGithead(publishes), 'should publish all workspaces') t.matchSnapshot(outputs, 'should output all publishes') t.end() }) @@ -591,7 +599,7 @@ t.test('workspaces', (t) => { log.level = 'info' publish.execWorkspaces([], ['workspace-a'], (err) => { t.notOk(err) - t.matchSnapshot(publishes, 'should publish given workspace') + t.matchSnapshot(cleanGithead(publishes), 'should publish given workspace') t.matchSnapshot(outputs, 'should output one publish') t.end() }) @@ -610,7 +618,7 @@ t.test('workspaces', (t) => { npm.config.set('json', true) publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(publishes, 'should publish all workspaces') + t.matchSnapshot(cleanGithead(publishes), 'should publish all workspaces') t.matchSnapshot(outputs, 'should output all publishes as json') t.end() }) @@ -699,7 +707,7 @@ t.test('private workspaces', (t) => { npm.color = true publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(publishes, 'should publish all non-private workspaces') + t.matchSnapshot(cleanGithead(publishes), 'should publish all non-private workspaces') t.matchSnapshot(outputs, 'should output all publishes') npm.color = false t.end() @@ -726,7 +734,7 @@ t.test('private workspaces', (t) => { publish.execWorkspaces([], [], (err) => { t.notOk(err) - t.matchSnapshot(publishes, 'should publish all non-private workspaces') + t.matchSnapshot(cleanGithead(publishes), 'should publish all non-private workspaces') t.matchSnapshot(outputs, 'should output all publishes') t.end() }) diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js index 63d9bbd195ab28..65193020d050c5 100644 --- a/deps/npm/test/lib/utils/config/definitions.js +++ b/deps/npm/test/lib/utils/config/definitions.js @@ -812,19 +812,44 @@ t.test('location', t => { location: 'user', } const flat = {} + // the global flattener is what sets location, so run that + definitions.global.flatten('global', obj, flat) definitions.location.flatten('location', obj, flat) // global = true sets location in both places to global - t.strictSame(flat, { location: 'global' }) - t.strictSame(obj, { global: true, location: 'global' }) + t.strictSame(flat, { global: true, location: 'global' }) + // location here is still 'user' because flattening doesn't modify the object + t.strictSame(obj, { global: true, location: 'user' }) obj.global = false obj.location = 'user' delete flat.global delete flat.location + definitions.global.flatten('global', obj, flat) definitions.location.flatten('location', obj, flat) // global = false leaves location unaltered - t.strictSame(flat, { location: 'user' }) + t.strictSame(flat, { global: false, location: 'user' }) t.strictSame(obj, { global: false, location: 'user' }) t.end() }) + +t.test('package-lock-only', t => { + const obj = { + 'package-lock': false, + 'package-lock-only': true, + } + const flat = {} + + definitions['package-lock-only'].flatten('package-lock-only', obj, flat) + definitions['package-lock'].flatten('package-lock', obj, flat) + t.strictSame(flat, { packageLock: true, packageLockOnly: true }) + + obj['package-lock-only'] = false + delete flat.packageLock + delete flat.packageLockOnly + + definitions['package-lock-only'].flatten('package-lock-only', obj, flat) + definitions['package-lock'].flatten('package-lock', obj, flat) + t.strictSame(flat, { packageLock: false, packageLockOnly: false }) + t.end() +}) diff --git a/deps/openssl/config/archs/BSD-x86/asm/configdata.pm b/deps/openssl/config/archs/BSD-x86/asm/configdata.pm index 891b580c679939..c2642090fd8639 100644 --- a/deps/openssl/config/archs/BSD-x86/asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h index 5b23c458770d44..aedf3990e8a103 100644 --- a/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86" -#define DATE "built on: Thu Mar 25 15:42:28 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:53 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm b/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm index 18feda61c80781..d8f4786799da88 100644 --- a/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h index 34b4d42b16ae04..8834f1421844d3 100644 --- a/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86" -#define DATE "built on: Thu Mar 25 15:42:31 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:57 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm b/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm index 081bf31df4a04b..e2f40f81b1759b 100644 --- a/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h index b8e59e8092e23e..781abaa70a8e7e 100644 --- a/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86" -#define DATE "built on: Thu Mar 25 15:42:33 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:02 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm b/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm index 3c6977a5b85fdc..2ff407581f4d15 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h index a0e5ccbe413e99..4dba93780c899d 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86_64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86_64" -#define DATE "built on: Thu Mar 25 15:42:35 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:04 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm index eba0c52540705c..055cce619dfa68 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h index 3bcc328ee3eda8..654e762bf8a6ce 100644 --- a/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86_64" -#define DATE "built on: Thu Mar 25 15:42:41 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:15 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm b/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm index 32460d7c9a9a64..9b335728401ab0 100644 --- a/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/BSD-x86_64/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "BSD-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h index 54873e1e8dcc05..45d164c9c941be 100644 --- a/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/BSD-x86_64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: BSD-x86_64" -#define DATE "built on: Thu Mar 25 15:42:47 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:26 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm b/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm index 0d8074bb846700..96a6303571c6b6 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN32/asm/configdata.pm @@ -115,8 +115,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN32", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( @@ -132,7 +132,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55c51430d9f8)", + RANLIB => "CODE(0x55db8a6796f0)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86.s aesni-x86.s", diff --git a/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h index 768c1c44d7236d..bea5cb687a2076 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN32/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Thu Mar 25 15:45:00 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:40 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm b/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm index a8c0bfe55105e7..a5e0d90fc70aa0 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN32/asm_avx2/configdata.pm @@ -115,8 +115,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN32", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( @@ -132,7 +132,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55ef1e4a36c8)", + RANLIB => "CODE(0x559089244600)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86.s aesni-x86.s", diff --git a/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h index 0c0b25c25e0e19..c64fba75afcc28 100644 --- a/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN32/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Thu Mar 25 15:45:03 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:44 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm b/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm index e06bc02b014a7a..aa28c5e5b8704f 100644 --- a/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN32/no-asm/configdata.pm @@ -114,8 +114,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN32", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( @@ -131,7 +131,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x5643c93df2f8)", + RANLIB => "CODE(0x55977bd52240)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c", diff --git a/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h index 8ad926959a0150..c6398e2b67cac6 100644 --- a/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN32/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Thu Mar 25 15:45:05 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:48 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm index 998036606f06c4..023e4c00c64a07 100644 --- a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/configdata.pm @@ -113,8 +113,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64-ARM", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( @@ -128,7 +128,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x564e049cb988)", + RANLIB => "CODE(0x559c5faa5ae0)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/50-win-onecore.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c", diff --git a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h index 22df0eea75ab77..fcdd33e56a3757 100644 --- a/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: VC-WIN64-ARM" -#define DATE "built on: Thu Mar 25 15:45:06 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:50 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm b/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm index b541f2036e6431..2e92ba23105fab 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64A/asm/configdata.pm @@ -116,8 +116,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64A", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( @@ -133,7 +133,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55a7657f0078)", + RANLIB => "CODE(0x556c966c8ed0)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s", diff --git a/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h index aa50a0a939f520..4d7e02b2fb05ca 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64A/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Thu Mar 25 15:44:47 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:14 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64A/asm/crypto/chacha/chacha-x86_64.asm b/deps/openssl/config/archs/VC-WIN64A/asm/crypto/chacha/chacha-x86_64.asm index 1a2003ea1fa179..4ae3fe31a63414 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm/crypto/chacha/chacha-x86_64.asm +++ b/deps/openssl/config/archs/VC-WIN64A/asm/crypto/chacha/chacha-x86_64.asm @@ -367,7 +367,7 @@ $L$ChaCha20_ssse3: ja NEAR $L$ChaCha20_4x $L$do_sse3_after_all: - sub rsp,64+40 + sub rsp,64+168 movaps XMMWORD[(-40)+r9],xmm6 movaps XMMWORD[(-24)+r9],xmm7 $L$ssse3_body: @@ -2378,9 +2378,17 @@ $L$ChaCha20_avx512: cmp rdx,512 ja NEAR $L$ChaCha20_16x - sub rsp,64+40 - movaps XMMWORD[(-40)+r9],xmm6 - movaps XMMWORD[(-24)+r9],xmm7 + sub rsp,64+168 + movaps XMMWORD[(-168)+r9],xmm6 + movaps XMMWORD[(-152)+r9],xmm7 + movaps XMMWORD[(-136)+r9],xmm8 + movaps XMMWORD[(-120)+r9],xmm9 + movaps XMMWORD[(-104)+r9],xmm10 + movaps XMMWORD[(-88)+r9],xmm11 + movaps XMMWORD[(-72)+r9],xmm12 + movaps XMMWORD[(-56)+r9],xmm13 + movaps XMMWORD[(-40)+r9],xmm14 + movaps XMMWORD[(-24)+r9],xmm15 $L$avx512_body: vbroadcasti32x4 zmm0,ZMMWORD[$L$sigma] vbroadcasti32x4 zmm1,ZMMWORD[rcx] @@ -2560,8 +2568,16 @@ $L$oop_tail_avx512: $L$done_avx512: vzeroall - movaps xmm6,XMMWORD[((-40))+r9] - movaps xmm7,XMMWORD[((-24))+r9] + movaps xmm6,XMMWORD[((-168))+r9] + movaps xmm7,XMMWORD[((-152))+r9] + movaps xmm8,XMMWORD[((-136))+r9] + movaps xmm9,XMMWORD[((-120))+r9] + movaps xmm10,XMMWORD[((-104))+r9] + movaps xmm11,XMMWORD[((-88))+r9] + movaps xmm12,XMMWORD[((-72))+r9] + movaps xmm13,XMMWORD[((-56))+r9] + movaps xmm14,XMMWORD[((-40))+r9] + movaps xmm15,XMMWORD[((-24))+r9] lea rsp,[r9] $L$avx512_epilogue: @@ -2591,9 +2607,17 @@ $L$ChaCha20_avx512vl: cmp rdx,128 ja NEAR $L$ChaCha20_8xvl - sub rsp,64+40 - movaps XMMWORD[(-40)+r9],xmm6 - movaps XMMWORD[(-24)+r9],xmm7 + sub rsp,64+168 + movaps XMMWORD[(-168)+r9],xmm6 + movaps XMMWORD[(-152)+r9],xmm7 + movaps XMMWORD[(-136)+r9],xmm8 + movaps XMMWORD[(-120)+r9],xmm9 + movaps XMMWORD[(-104)+r9],xmm10 + movaps XMMWORD[(-88)+r9],xmm11 + movaps XMMWORD[(-72)+r9],xmm12 + movaps XMMWORD[(-56)+r9],xmm13 + movaps XMMWORD[(-40)+r9],xmm14 + movaps XMMWORD[(-24)+r9],xmm15 $L$avx512vl_body: vbroadcasti128 ymm0,XMMWORD[$L$sigma] vbroadcasti128 ymm1,XMMWORD[rcx] @@ -2730,8 +2754,16 @@ $L$oop_tail_avx512vl: $L$done_avx512vl: vzeroall - movaps xmm6,XMMWORD[((-40))+r9] - movaps xmm7,XMMWORD[((-24))+r9] + movaps xmm6,XMMWORD[((-168))+r9] + movaps xmm7,XMMWORD[((-152))+r9] + movaps xmm8,XMMWORD[((-136))+r9] + movaps xmm9,XMMWORD[((-120))+r9] + movaps xmm10,XMMWORD[((-104))+r9] + movaps xmm11,XMMWORD[((-88))+r9] + movaps xmm12,XMMWORD[((-72))+r9] + movaps xmm13,XMMWORD[((-56))+r9] + movaps xmm14,XMMWORD[((-40))+r9] + movaps xmm15,XMMWORD[((-24))+r9] lea rsp,[r9] $L$avx512vl_epilogue: diff --git a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm index 921c897a5a85b4..5fcc853f99cd20 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/configdata.pm @@ -116,8 +116,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64A", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( @@ -133,7 +133,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55ef6679a0b8)", + RANLIB => "CODE(0x5596a5c60760)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s", diff --git a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h index ad961df2482f87..61489af321c2ea 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Thu Mar 25 15:44:53 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:26 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/chacha/chacha-x86_64.asm b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/chacha/chacha-x86_64.asm index 1a2003ea1fa179..4ae3fe31a63414 100644 --- a/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/chacha/chacha-x86_64.asm +++ b/deps/openssl/config/archs/VC-WIN64A/asm_avx2/crypto/chacha/chacha-x86_64.asm @@ -367,7 +367,7 @@ $L$ChaCha20_ssse3: ja NEAR $L$ChaCha20_4x $L$do_sse3_after_all: - sub rsp,64+40 + sub rsp,64+168 movaps XMMWORD[(-40)+r9],xmm6 movaps XMMWORD[(-24)+r9],xmm7 $L$ssse3_body: @@ -2378,9 +2378,17 @@ $L$ChaCha20_avx512: cmp rdx,512 ja NEAR $L$ChaCha20_16x - sub rsp,64+40 - movaps XMMWORD[(-40)+r9],xmm6 - movaps XMMWORD[(-24)+r9],xmm7 + sub rsp,64+168 + movaps XMMWORD[(-168)+r9],xmm6 + movaps XMMWORD[(-152)+r9],xmm7 + movaps XMMWORD[(-136)+r9],xmm8 + movaps XMMWORD[(-120)+r9],xmm9 + movaps XMMWORD[(-104)+r9],xmm10 + movaps XMMWORD[(-88)+r9],xmm11 + movaps XMMWORD[(-72)+r9],xmm12 + movaps XMMWORD[(-56)+r9],xmm13 + movaps XMMWORD[(-40)+r9],xmm14 + movaps XMMWORD[(-24)+r9],xmm15 $L$avx512_body: vbroadcasti32x4 zmm0,ZMMWORD[$L$sigma] vbroadcasti32x4 zmm1,ZMMWORD[rcx] @@ -2560,8 +2568,16 @@ $L$oop_tail_avx512: $L$done_avx512: vzeroall - movaps xmm6,XMMWORD[((-40))+r9] - movaps xmm7,XMMWORD[((-24))+r9] + movaps xmm6,XMMWORD[((-168))+r9] + movaps xmm7,XMMWORD[((-152))+r9] + movaps xmm8,XMMWORD[((-136))+r9] + movaps xmm9,XMMWORD[((-120))+r9] + movaps xmm10,XMMWORD[((-104))+r9] + movaps xmm11,XMMWORD[((-88))+r9] + movaps xmm12,XMMWORD[((-72))+r9] + movaps xmm13,XMMWORD[((-56))+r9] + movaps xmm14,XMMWORD[((-40))+r9] + movaps xmm15,XMMWORD[((-24))+r9] lea rsp,[r9] $L$avx512_epilogue: @@ -2591,9 +2607,17 @@ $L$ChaCha20_avx512vl: cmp rdx,128 ja NEAR $L$ChaCha20_8xvl - sub rsp,64+40 - movaps XMMWORD[(-40)+r9],xmm6 - movaps XMMWORD[(-24)+r9],xmm7 + sub rsp,64+168 + movaps XMMWORD[(-168)+r9],xmm6 + movaps XMMWORD[(-152)+r9],xmm7 + movaps XMMWORD[(-136)+r9],xmm8 + movaps XMMWORD[(-120)+r9],xmm9 + movaps XMMWORD[(-104)+r9],xmm10 + movaps XMMWORD[(-88)+r9],xmm11 + movaps XMMWORD[(-72)+r9],xmm12 + movaps XMMWORD[(-56)+r9],xmm13 + movaps XMMWORD[(-40)+r9],xmm14 + movaps XMMWORD[(-24)+r9],xmm15 $L$avx512vl_body: vbroadcasti128 ymm0,XMMWORD[$L$sigma] vbroadcasti128 ymm1,XMMWORD[rcx] @@ -2730,8 +2754,16 @@ $L$oop_tail_avx512vl: $L$done_avx512vl: vzeroall - movaps xmm6,XMMWORD[((-40))+r9] - movaps xmm7,XMMWORD[((-24))+r9] + movaps xmm6,XMMWORD[((-168))+r9] + movaps xmm7,XMMWORD[((-152))+r9] + movaps xmm8,XMMWORD[((-136))+r9] + movaps xmm9,XMMWORD[((-120))+r9] + movaps xmm10,XMMWORD[((-104))+r9] + movaps xmm11,XMMWORD[((-88))+r9] + movaps xmm12,XMMWORD[((-72))+r9] + movaps xmm13,XMMWORD[((-56))+r9] + movaps xmm14,XMMWORD[((-40))+r9] + movaps xmm15,XMMWORD[((-24))+r9] lea rsp,[r9] $L$avx512vl_epilogue: diff --git a/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm b/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm index 7aa782d1f68c6a..9b8426bdf121ac 100644 --- a/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm +++ b/deps/openssl/config/archs/VC-WIN64A/no-asm/configdata.pm @@ -115,8 +115,8 @@ our %config = ( sourcedir => ".", target => "VC-WIN64A", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( @@ -132,7 +132,7 @@ our %target = ( LDFLAGS => "/nologo /debug", MT => "mt", MTFLAGS => "-nologo", - RANLIB => "CODE(0x55f54c2a9d48)", + RANLIB => "CODE(0x5569b6014340)", RC => "rc", _conf_fname_int => [ "Configurations/00-base-templates.conf", "Configurations/00-base-templates.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/10-main.conf", "Configurations/shared-info.pl" ], aes_asm_src => "aes_core.c aes_cbc.c", diff --git a/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h index f5c8515cac1e54..846b8ab3a03a32 100644 --- a/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/VC-WIN64A/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: " -#define DATE "built on: Thu Mar 25 15:44:59 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:37 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix-gcc/asm/configdata.pm b/deps/openssl/config/archs/aix-gcc/asm/configdata.pm index e3b31e749c5d72..433a9e70c93799 100644 --- a/deps/openssl/config/archs/aix-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/aix-gcc/asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h index 0e2113a8f0bab9..73760026a0c26d 100644 --- a/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix-gcc" -#define DATE "built on: Thu Mar 25 15:42:17 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:32 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm index e8277af259ba22..ae81f8558e28eb 100644 --- a/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/aix-gcc/asm_avx2/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h index d2f178d52159c0..13073c425be661 100644 --- a/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix-gcc" -#define DATE "built on: Thu Mar 25 15:42:19 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:35 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm index c61120bb0d0b51..44e8767ae28860 100644 --- a/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/aix-gcc/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h index 6bd902c5569f3c..69a4bdb9114639 100644 --- a/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix-gcc" -#define DATE "built on: Thu Mar 25 15:42:21 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:39 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm b/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm index 6c7ea7a38ec34c..69914be859de51 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/aix64-gcc/asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h index 2a80fc8166172a..f501bd7b69bac5 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix64-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix64-gcc" -#define DATE "built on: Thu Mar 25 15:42:22 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:42 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm index 0053407cf93584..f5db6f66c1c4b6 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/aix64-gcc/asm_avx2/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h index 2d01f3168aa2bc..61260008561ced 100644 --- a/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix64-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix64-gcc" -#define DATE "built on: Thu Mar 25 15:42:25 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:46 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm index fb7ef022cef91c..f6bc0193089fd6 100644 --- a/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/aix64-gcc/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "aix64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h index 013c76ca1d63ba..226ccf9887d634 100644 --- a/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/aix64-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: aix64-gcc" -#define DATE "built on: Thu Mar 25 15:42:27 2021 UTC" +#define DATE "built on: Tue Aug 24 15:07:50 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm b/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm index b7c5d7fa62e389..5b4cad94fd53ef 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm +++ b/deps/openssl/config/archs/darwin-i386-cc/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin-i386-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h index ae0628c55c7793..97113aa4f60840 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin-i386-cc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin-i386-cc" -#define DATE "built on: Thu Mar 25 15:43:01 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:53 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm index f0a31bbc8ff3e0..d2dedf15dedb87 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin-i386-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h index 87ddc3fa4f1c9f..43c0e5b350f8ff 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin-i386-cc" -#define DATE "built on: Thu Mar 25 15:43:03 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:58 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm b/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm index 73f0b61c96307b..92e58e6faf68dd 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/darwin-i386-cc/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "darwin-i386-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h index e7a1caeea15b87..c42c3cd0e9494d 100644 --- a/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin-i386-cc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin-i386-cc" -#define DATE "built on: Thu Mar 25 15:43:06 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:02 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-arm64-cc/asm/configdata.pm b/deps/openssl/config/archs/darwin64-arm64-cc/asm/configdata.pm index 6da68da0953e42..5a37376cc7d000 100644 --- a/deps/openssl/config/archs/darwin64-arm64-cc/asm/configdata.pm +++ b/deps/openssl/config/archs/darwin64-arm64-cc/asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "darwin64-arm64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-arm64-cc/asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-arm64-cc/asm/crypto/buildinf.h index 1f03c3bcca2972..be3f4bfa763542 100644 --- a/deps/openssl/config/archs/darwin64-arm64-cc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-arm64-cc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-arm64-cc" -#define DATE "built on: Thu Mar 25 15:43:07 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:05 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/configdata.pm b/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/configdata.pm index 572a4907b331e1..4ca948c6367cc2 100644 --- a/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "darwin64-arm64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/crypto/buildinf.h index b081faec060597..c0e8cb0bfe7cd1 100644 --- a/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-arm64-cc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-arm64-cc" -#define DATE "built on: Thu Mar 25 15:43:09 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:09 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/configdata.pm b/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/configdata.pm index 69fdbf3b880080..bd4135760d8c29 100644 --- a/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "darwin64-arm64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/crypto/buildinf.h index fbe71f645bc722..da88a45b263bbc 100644 --- a/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-arm64-cc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-arm64-cc" -#define DATE "built on: Thu Mar 25 15:43:12 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:13 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm index c8116442f719db..ab75057e0c3978 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin64-x86_64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h index 7060c8469173df..652042b6cb8c02 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-x86_64-cc" -#define DATE "built on: Thu Mar 25 15:42:48 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:29 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm index 7b61c9fe5b63b6..74e8d707d3562b 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "darwin64-x86_64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h index 75200f3048a102..23daa66897195a 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-x86_64-cc" -#define DATE "built on: Thu Mar 25 15:42:54 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:40 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm index 1779ec4383f3a8..01cd92363ab18d 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "darwin64-x86_64-cc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h index c6c0ea798acc6a..f37e9f39b650e1 100644 --- a/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: darwin64-x86_64-cc" -#define DATE "built on: Thu Mar 25 15:42:59 2021 UTC" +#define DATE "built on: Tue Aug 24 15:08:51 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm b/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm index a6c6c6e370f08a..f6068104e218cd 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-aarch64/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-aarch64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h index 1c0a894bb2a8d7..fb2831cbdcbbe5 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-aarch64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-aarch64" -#define DATE "built on: Thu Mar 25 15:43:13 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:16 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm index fbadd519409e09..ebba729cc24ffc 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-aarch64/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-aarch64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h index ef7d1e3dd74f8b..e11be1067b574e 100644 --- a/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-aarch64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-aarch64" -#define DATE "built on: Thu Mar 25 15:43:15 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:20 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm b/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm index 50e5dee829a623..440f31f3438ed9 100644 --- a/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-aarch64/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-aarch64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h index 3f5e680f11370e..5d6dcd23c8627c 100644 --- a/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-aarch64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-aarch64" -#define DATE "built on: Thu Mar 25 15:43:17 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:24 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-armv4/asm/configdata.pm b/deps/openssl/config/archs/linux-armv4/asm/configdata.pm index de29511ca253c9..3dd1c0a2b3fafd 100644 --- a/deps/openssl/config/archs/linux-armv4/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-armv4/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-armv4", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h index 42947a5a11fe4f..c0db349df3102d 100644 --- a/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-armv4/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-armv4" -#define DATE "built on: Thu Mar 25 15:43:19 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:27 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm index 647045d8fb6b01..c8e9d7ab2cfffe 100644 --- a/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-armv4/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-armv4", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h index c7f2bd129c07d7..e7391644209db2 100644 --- a/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-armv4/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-armv4" -#define DATE "built on: Thu Mar 25 15:43:21 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:31 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm b/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm index a84e7866bd9154..39e611e2084dc0 100644 --- a/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-armv4/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-armv4", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h index 0348809834a246..efaaa7e85e1076 100644 --- a/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-armv4/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-armv4" -#define DATE "built on: Thu Mar 25 15:43:23 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:35 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-elf/asm/configdata.pm b/deps/openssl/config/archs/linux-elf/asm/configdata.pm index 7e07cd4ee0f60b..d1b680326fa1ac 100644 --- a/deps/openssl/config/archs/linux-elf/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-elf/asm/configdata.pm @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-elf", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h index 91dc5e61c7f38f..2b241d31c53eb3 100644 --- a/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-elf/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-elf" -#define DATE "built on: Thu Mar 25 15:43:25 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:38 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm index c5201185b74e82..8bf2a67e29b512 100644 --- a/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-elf/asm_avx2/configdata.pm @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-elf", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h index cf9b0580ea3067..00e2c89d07c958 100644 --- a/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-elf/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-elf" -#define DATE "built on: Thu Mar 25 15:43:27 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:42 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm b/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm index 0572dd40c7dcc9..fc68744b78542b 100644 --- a/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-elf/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-elf", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h index 2b91e3fe231cbc..d4f44424191266 100644 --- a/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-elf/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-elf" -#define DATE "built on: Thu Mar 25 15:43:30 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:47 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc/asm/configdata.pm b/deps/openssl/config/archs/linux-ppc/asm/configdata.pm index 6752de03934080..108f1f85fe459a 100644 --- a/deps/openssl/config/archs/linux-ppc/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h index 81d209b39b83ec..7478052faf10b6 100644 --- a/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc" -#define DATE "built on: Thu Mar 25 15:43:57 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:39 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm index 9c5b00c42545f9..b651f481ddda4e 100644 --- a/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h index ed5ea64d0b877d..cdd2eb7acd0b1b 100644 --- a/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc" -#define DATE "built on: Thu Mar 25 15:43:59 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:43 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm b/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm index e3c18449a5229c..7b1b09b3910f36 100644 --- a/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h index 20b4252c666745..a4bb2d22aa6cbf 100644 --- a/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc" -#define DATE "built on: Thu Mar 25 15:44:01 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:47 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm index 1fd3577cf99a76..aa8296d7a03375 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h index 982aea519f7856..3a610f6b001cee 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64" -#define DATE "built on: Thu Mar 25 15:44:02 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:49 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm index 0a473a34e2a962..ed2ba948e9adb6 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h index 6913869019afea..591fca00d4d522 100644 --- a/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64" -#define DATE "built on: Thu Mar 25 15:44:05 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:54 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm index c77cd43a35217e..68ab665b65dee2 100644 --- a/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h index 03332a35a90468..cf86af8eaf83c1 100644 --- a/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64" -#define DATE "built on: Thu Mar 25 15:44:07 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:58 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm index f99178de981d6b..f6cd83404c3f1d 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64le/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64le", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h index eda2983cd767a0..89ac2e856035f1 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64le/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64le" -#define DATE "built on: Thu Mar 25 15:44:08 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:01 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm index 4293853c6a9bb9..57f4b96c6cce93 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64le", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h index 4452d4f6b32cb3..0beb5822c36b70 100644 --- a/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64le" -#define DATE "built on: Thu Mar 25 15:44:11 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:05 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm b/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm index baf7b61efe537c..0370c06d2a4ecb 100644 --- a/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-ppc64le/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-ppc64le", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h index 7abdc41c9d8e51..0a981ee94685c8 100644 --- a/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-ppc64le/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-ppc64le" -#define DATE "built on: Thu Mar 25 15:44:13 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:09 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x32/asm/configdata.pm b/deps/openssl/config/archs/linux-x32/asm/configdata.pm index 0cf2081c2eccff..f38bb5be6d1073 100644 --- a/deps/openssl/config/archs/linux-x32/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x32/asm/configdata.pm @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x32", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h index b70963f93daf41..379c2dfa5d7da6 100644 --- a/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x32/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x32" -#define DATE "built on: Thu Mar 25 15:43:31 2021 UTC" +#define DATE "built on: Tue Aug 24 15:09:50 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm index 37e62c2838fa4e..94ce36b4d0ed66 100644 --- a/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-x32/asm_avx2/configdata.pm @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x32", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h index ac5cdad547d136..95d66e87de59a6 100644 --- a/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x32/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x32" -#define DATE "built on: Thu Mar 25 15:43:37 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:01 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm b/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm index 626e5f4804284b..0f27640c4b0903 100644 --- a/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x32/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-x32", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h index b27fe551cd541e..15b6aeb7bcea2c 100644 --- a/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x32/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x32" -#define DATE "built on: Thu Mar 25 15:43:43 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:12 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm b/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm index e9a02093852ff6..a40f247d21a462 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x86_64/asm/configdata.pm @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h index 806bc7b0be0b27..e9247a45788cfd 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x86_64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x86_64" -#define DATE "built on: Thu Mar 25 15:43:44 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:14 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm index 902bc82300ade0..903f552dc00edb 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux-x86_64/asm_avx2/configdata.pm @@ -112,8 +112,8 @@ our %config = ( sourcedir => ".", target => "linux-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h index bbbad72d0e6db9..8fe4292918296f 100644 --- a/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x86_64" -#define DATE "built on: Thu Mar 25 15:43:50 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:26 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm b/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm index 73805ab88375ab..8ccc2bad4ebbff 100644 --- a/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux-x86_64/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux-x86_64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h index 9a409a9312fd0f..805cedc3b89486 100644 --- a/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux-x86_64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux-x86_64" -#define DATE "built on: Thu Mar 25 15:43:55 2021 UTC" +#define DATE "built on: Tue Aug 24 15:10:36 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm b/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm index fae651069d4eb4..ef5da21ed4e719 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm +++ b/deps/openssl/config/archs/linux32-s390x/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux32-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h index 3e6aeb8da38d41..cc06551a555046 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux32-s390x/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux32-s390x" -#define DATE "built on: Thu Mar 25 15:44:14 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:12 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm index 67b341576a8ced..665d2fa4a61a4a 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux32-s390x/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux32-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h index 92bce59708af9a..2d129eb5471698 100644 --- a/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux32-s390x/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux32-s390x" -#define DATE "built on: Thu Mar 25 15:44:16 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:15 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm b/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm index 6fc9d28971f89f..da99a20b491bdb 100644 --- a/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux32-s390x/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux32-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h index 4991b2fa382916..8e42ed155106a3 100644 --- a/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux32-s390x/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux32-s390x" -#define DATE "built on: Thu Mar 25 15:44:17 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:18 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm b/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm index 8f08c123d5de3f..2404081c456edf 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-mips64/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-mips64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h index ee4656b0a675b1..8d38c94dff573f 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-mips64/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-mips64" -#define DATE "built on: Thu Mar 25 15:44:24 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:29 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm index 40aee3e9a067f8..0bffe1bfa25785 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux64-mips64/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-mips64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h index ab40ae4230c835..f6c692bc2e3ddd 100644 --- a/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-mips64/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-mips64" -#define DATE "built on: Thu Mar 25 15:44:25 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:32 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm b/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm index 81f1d6d1afbc7a..2bd8348b9e182f 100644 --- a/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-mips64/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-mips64", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h index d4c47016888189..0b3b5ec4f60365 100644 --- a/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-mips64/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-mips64" -#define DATE "built on: Thu Mar 25 15:44:27 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:35 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm b/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm index 95a3b0def67e56..3eec132e49da31 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-s390x/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h index c002b48aac3e34..e23e81a98b58b7 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-s390x/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-s390x" -#define DATE "built on: Thu Mar 25 15:44:19 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:20 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm b/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm index 8f15cff9c3ea81..f8ad37e24a0b50 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/linux64-s390x/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h index 9a75af1ec23a9c..19fb9ed0b45aac 100644 --- a/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-s390x/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-s390x" -#define DATE "built on: Thu Mar 25 15:44:20 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:23 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm b/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm index 67f1f71b7de603..7b3690fd32f315 100644 --- a/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm +++ b/deps/openssl/config/archs/linux64-s390x/no-asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "linux64-s390x", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h index 187943708784f9..1fb6e6c6e316ed 100644 --- a/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/linux64-s390x/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: linux64-s390x" -#define DATE "built on: Thu Mar 25 15:44:22 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:26 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm b/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm index 3861816e21501d..54bc224d72196c 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris-x86-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h index 45e08014daa4e1..5af32249813d38 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris-x86-gcc" -#define DATE "built on: Thu Mar 25 15:44:28 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:37 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm index a531022015b1cb..74c4e33a3e05b6 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris-x86-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h index e2bf12b071fc72..726a0ace849340 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris-x86-gcc" -#define DATE "built on: Thu Mar 25 15:44:31 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:42 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm index 01ec53c68e9bea..83347ab602b947 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "solaris-x86-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h index 71a3c8005bd80b..a555ac265a0f45 100644 --- a/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris-x86-gcc" -#define DATE "built on: Thu Mar 25 15:44:33 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:47 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm index fe897ccea532b4..c84d37026df5ff 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris64-x86_64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h index 42ace5b9c85156..436c0737ff3a44 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris64-x86_64-gcc" -#define DATE "built on: Thu Mar 25 15:44:34 2021 UTC" +#define DATE "built on: Tue Aug 24 15:11:49 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm index 6eba11c7528875..ef8bac9d1fbe75 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/configdata.pm @@ -111,8 +111,8 @@ our %config = ( sourcedir => ".", target => "solaris64-x86_64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h index 2002a92d98cf7b..e3b07b2b1e66cb 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris64-x86_64-gcc" -#define DATE "built on: Thu Mar 25 15:44:40 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:00 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm index 1b7266967e3b4b..64e17bf0791d7b 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/configdata.pm @@ -110,8 +110,8 @@ our %config = ( sourcedir => ".", target => "solaris64-x86_64-gcc", tdirs => [ "ossl_shim" ], - version => "1.1.1k+quic", - version_num => "0x101010bfL", + version => "1.1.1l+quic", + version_num => "0x101010cfL", ); our %target = ( diff --git a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h index 7feca299a49af0..7cab3b053fdbc8 100644 --- a/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h +++ b/deps/openssl/config/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h @@ -11,7 +11,7 @@ */ #define PLATFORM "platform: solaris64-x86_64-gcc" -#define DATE "built on: Thu Mar 25 15:44:46 2021 UTC" +#define DATE "built on: Tue Aug 24 15:12:11 2021 UTC" /* * Generate compiler_flags as an array of individual characters. This is a diff --git a/deps/openssl/openssl/CHANGES b/deps/openssl/openssl/CHANGES index 5f67b2be02472c..7401b52d3a386a 100644 --- a/deps/openssl/openssl/CHANGES +++ b/deps/openssl/openssl/CHANGES @@ -7,6 +7,71 @@ https://github.com/openssl/openssl/commits/ and pick the appropriate release branch. + Changes between 1.1.1k and 1.1.1l [24 Aug 2021] + + *) Fixed an SM2 Decryption Buffer Overflow. + + In order to decrypt SM2 encrypted data an application is expected to call the + API function EVP_PKEY_decrypt(). Typically an application will call this + function twice. The first time, on entry, the "out" parameter can be NULL and, + on exit, the "outlen" parameter is populated with the buffer size required to + hold the decrypted plaintext. The application can then allocate a sufficiently + sized buffer and call EVP_PKEY_decrypt() again, but this time passing a non-NULL + value for the "out" parameter. + + A bug in the implementation of the SM2 decryption code means that the + calculation of the buffer size required to hold the plaintext returned by the + first call to EVP_PKEY_decrypt() can be smaller than the actual size required by + the second call. This can lead to a buffer overflow when EVP_PKEY_decrypt() is + called by the application a second time with a buffer that is too small. + + A malicious attacker who is able present SM2 content for decryption to an + application could cause attacker chosen data to overflow the buffer by up to a + maximum of 62 bytes altering the contents of other data held after the + buffer, possibly changing application behaviour or causing the application to + crash. The location of the buffer is application dependent but is typically + heap allocated. + (CVE-2021-3711) + [Matt Caswell] + + *) Fixed various read buffer overruns processing ASN.1 strings + + ASN.1 strings are represented internally within OpenSSL as an ASN1_STRING + structure which contains a buffer holding the string data and a field holding + the buffer length. This contrasts with normal C strings which are repesented as + a buffer for the string data which is terminated with a NUL (0) byte. + + Although not a strict requirement, ASN.1 strings that are parsed using OpenSSL's + own "d2i" functions (and other similar parsing functions) as well as any string + whose value has been set with the ASN1_STRING_set() function will additionally + NUL terminate the byte array in the ASN1_STRING structure. + + However, it is possible for applications to directly construct valid ASN1_STRING + structures which do not NUL terminate the byte array by directly setting the + "data" and "length" fields in the ASN1_STRING array. This can also happen by + using the ASN1_STRING_set0() function. + + Numerous OpenSSL functions that print ASN.1 data have been found to assume that + the ASN1_STRING byte array will be NUL terminated, even though this is not + guaranteed for strings that have been directly constructed. Where an application + requests an ASN.1 structure to be printed, and where that ASN.1 structure + contains ASN1_STRINGs that have been directly constructed by the application + without NUL terminating the "data" field, then a read buffer overrun can occur. + + The same thing can also occur during name constraints processing of certificates + (for example if a certificate has been directly constructed by the application + instead of loading it via the OpenSSL parsing functions, and the certificate + contains non NUL terminated ASN1_STRING structures). It can also occur in the + X509_get1_email(), X509_REQ_get1_email() and X509_get1_ocsp() functions. + + If a malicious actor can cause an application to directly construct an + ASN1_STRING and then process it through one of the affected OpenSSL functions + then this issue could be hit. This might result in a crash (causing a Denial of + Service attack). It could also result in the disclosure of private memory + contents (such as private keys, or sensitive plaintext). + (CVE-2021-3712) + [Matt Caswell] + Changes between 1.1.1j and 1.1.1k [25 Mar 2021] *) Fixed a problem with verifying a certificate chain when using the diff --git a/deps/openssl/openssl/Configurations/10-main.conf b/deps/openssl/openssl/Configurations/10-main.conf index 8dc3e858dfa8f2..61c6689a0cf7d4 100644 --- a/deps/openssl/openssl/Configurations/10-main.conf +++ b/deps/openssl/openssl/Configurations/10-main.conf @@ -754,6 +754,13 @@ my %targets = ( multilib => "64", }, + # riscv64 below refers to contemporary RISCV Architecture + # specifications, + "linux64-riscv64" => { + inherit_from => [ "linux-generic64"], + perlasm_scheme => "linux64", + }, + #### IA-32 targets... #### These two targets are a bit aged and are to be used on older Linux #### machines where gcc doesn't understand -m32 and -m64 diff --git a/deps/openssl/openssl/Configurations/15-android.conf b/deps/openssl/openssl/Configurations/15-android.conf index 4616394f8cfd43..fd5cd3f478225b 100644 --- a/deps/openssl/openssl/Configurations/15-android.conf +++ b/deps/openssl/openssl/Configurations/15-android.conf @@ -29,18 +29,18 @@ $ndk = $ENV{$ndk_var}; last if defined $ndk; } - die "\$ANDROID_NDK_HOME is not defined" if (!$ndk); - if (!-d "$ndk/platforms" && !-f "$ndk/AndroidVersion.txt") { - # $ndk/platforms is traditional "all-inclusive" NDK, while - # $ndk/AndroidVersion.txt is so-called standalone toolchain - # tailored for specific target down to API level. + die "\$ANDROID_NDK_HOME is not defined" if (!$ndk); + my $is_standalone_toolchain = -f "$ndk/AndroidVersion.txt"; + my $ndk_src_props = "$ndk/source.properties"; + my $is_ndk = -f $ndk_src_props; + if ($is_ndk == $is_standalone_toolchain) { die "\$ANDROID_NDK_HOME=$ndk is invalid"; } $ndk = canonpath($ndk); my $ndkver = undef; - if (open my $fh, "<$ndk/source.properties") { + if (open my $fh, "<$ndk_src_props") { local $_; while(<$fh>) { if (m|Pkg\.Revision\s*=\s*([0-9]+)|) { @@ -59,7 +59,7 @@ if ($sysroot = $ENV{CROSS_SYSROOT}) { $sysroot =~ m|/android-([0-9]+)/arch-(\w+)/?$|; ($api, $arch) = ($1, $2); - } elsif (-f "$ndk/AndroidVersion.txt") { + } elsif ($is_standalone_toolchain) { $sysroot = "$ndk/sysroot"; } else { $api = "*"; @@ -72,17 +72,31 @@ } } - # list available platforms (numerically) - my @platforms = sort { $a =~ m/-([0-9]+)$/; my $aa = $1; - $b =~ m/-([0-9]+)$/; $aa <=> $1; - } glob("$ndk/platforms/android-$api"); - die "no $ndk/platforms/android-$api" if ($#platforms < 0); + if (-d "$ndk/platforms") { + # list available platforms (numerically) + my @platforms = sort { $a =~ m/-([0-9]+)$/; my $aa = $1; + $b =~ m/-([0-9]+)$/; $aa <=> $1; + } glob("$ndk/platforms/android-$api"); + die "no $ndk/platforms/android-$api" if ($#platforms < 0); - $sysroot = "@platforms[$#platforms]/arch-$arch"; - $sysroot =~ m|/android-([0-9]+)/arch-$arch|; - $api = $1; + $sysroot = "@platforms[$#platforms]/arch-$arch"; + $sysroot =~ m|/android-([0-9]+)/arch-$arch|; + $api = $1; + } elsif ($api eq "*") { + # r22 Removed platforms dir, use this JSON file + my $path = "$ndk/meta/platforms.json"; + open my $fh, $path or die "Could not open '$path' $!"; + while (<$fh>) { + if (/"max": (\d+),/) { + $api = $1; + last; + } + } + close $fh; + } + die "Could not get default API Level" if ($api eq "*"); } - die "no sysroot=$sysroot" if (!-d $sysroot); + die "no sysroot=$sysroot" if (length $sysroot && !-d $sysroot); my $triarch = $triplet{$arch}; my $cflags; @@ -95,17 +109,21 @@ my $arm = $ndkver > 16 ? "armv7a" : "armv5te"; (my $tridefault = $triarch) =~ s/^arm-/$arm-/; (my $tritools = $triarch) =~ s/(?:x|i6)86(_64)?-.*/x86$1/; - $cflags .= " -target $tridefault " - . "-gcc-toolchain \$($ndk_var)/toolchains" - . "/$tritools-4.9/prebuilt/$host"; - $user{CC} = "clang" if ($user{CC} !~ m|clang|); + if (length $sysroot) { + $cflags .= " -target $tridefault " + . "-gcc-toolchain \$($ndk_var)/toolchains" + . "/$tritools-4.9/prebuilt/$host"; + $user{CC} = "clang" if ($user{CC} !~ m|clang|); + } else { + $user{CC} = "$tridefault$api-clang"; + } $user{CROSS_COMPILE} = undef; if (which("llvm-ar") =~ m|^$ndk/.*/prebuilt/([^/]+)/|) { $user{AR} = "llvm-ar"; $user{ARFLAGS} = [ "rs" ]; $user{RANLIB} = ":"; } - } elsif (-f "$ndk/AndroidVersion.txt") { #"standalone toolchain" + } elsif ($is_standalone_toolchain) { my $cc = $user{CC} // "clang"; # One can probably argue that both clang and gcc should be # probed, but support for "standalone toolchain" was added @@ -127,19 +145,21 @@ $user{CROSS_COMPILE} = "$triarch-"; } - if (!-d "$sysroot/usr/include") { - my $incroot = "$ndk/sysroot/usr/include"; - die "no $incroot" if (!-d $incroot); - die "no $incroot/$triarch" if (!-d "$incroot/$triarch"); - $incroot =~ s|^$ndk/||; - $cppflags = "-D__ANDROID_API__=$api"; - $cppflags .= " -isystem \$($ndk_var)/$incroot/$triarch"; - $cppflags .= " -isystem \$($ndk_var)/$incroot"; + if (length $sysroot) { + if (!-d "$sysroot/usr/include") { + my $incroot = "$ndk/sysroot/usr/include"; + die "no $incroot" if (!-d $incroot); + die "no $incroot/$triarch" if (!-d "$incroot/$triarch"); + $incroot =~ s|^$ndk/||; + $cppflags = "-D__ANDROID_API__=$api"; + $cppflags .= " -isystem \$($ndk_var)/$incroot/$triarch"; + $cppflags .= " -isystem \$($ndk_var)/$incroot"; + } + $sysroot =~ s|^$ndk/||; + $sysroot = " --sysroot=\$($ndk_var)/$sysroot"; } - - $sysroot =~ s|^$ndk/||; $android_ndk = { - cflags => "$cflags --sysroot=\$($ndk_var)/$sysroot", + cflags => $cflags . $sysroot, cppflags => $cppflags, bn_ops => $arch =~ m/64$/ ? "SIXTY_FOUR_BIT_LONG" : "BN_LLONG", diff --git a/deps/openssl/openssl/Configurations/unix-Makefile.tmpl b/deps/openssl/openssl/Configurations/unix-Makefile.tmpl index 41648c952667f3..66617d6f4f90f9 100644 --- a/deps/openssl/openssl/Configurations/unix-Makefile.tmpl +++ b/deps/openssl/openssl/Configurations/unix-Makefile.tmpl @@ -523,7 +523,6 @@ clean: libclean $(RM) -r test/test-runs $(RM) openssl.pc libcrypto.pc libssl.pc -$(RM) `find . -type l \! -name '.*' -print` - $(RM) $(TARFILE) distclean: clean $(RM) configdata.pm diff --git a/deps/openssl/openssl/Configurations/windows-makefile.tmpl b/deps/openssl/openssl/Configurations/windows-makefile.tmpl index 9351149fe8e1b8..13716e06441dd2 100644 --- a/deps/openssl/openssl/Configurations/windows-makefile.tmpl +++ b/deps/openssl/openssl/Configurations/windows-makefile.tmpl @@ -324,15 +324,15 @@ build_apps build_tests: build_programs # Convenience target to prebuild all generated files, not just the mandatory # ones build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) - @{- output_off() if $disabled{makedepend}; "" -} + @{- output_off() if $disabled{makedepend}; "\@rem" -} @$(ECHO) "Warning: consider configuring with no-makedepend, because if" @$(ECHO) " target system doesn't have $(PERL)," @$(ECHO) " then make will fail..." - @{- output_on() if $disabled{makedepend}; "" -} + @{- output_on() if $disabled{makedepend}; "\@rem" -} test: tests {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep - @{- output_off() if $disabled{tests}; "" -} + @{- output_off() if $disabled{tests}; "\@rem" -} -mkdir $(BLDDIR)\test\test-runs set SRCTOP=$(SRCDIR) set BLDTOP=$(BLDDIR) @@ -341,17 +341,17 @@ test: tests set OPENSSL_ENGINES=$(MAKEDIR)\engines set OPENSSL_DEBUG_MEMORY=on "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS) - @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} + @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "\@rem" -} @$(ECHO) "Tests are not supported with your chosen Configure options" - @{- output_on() if !$disabled{tests}; "" -} + @{- output_on() if !$disabled{tests}; "\@rem" -} list-tests: - @{- output_off() if $disabled{tests}; "" -} + @{- output_off() if $disabled{tests}; "\@rem" -} @set SRCTOP=$(SRCDIR) @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list - @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} + @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "\@rem" -} @$(ECHO) "Tests are not supported with your chosen Configure options" - @{- output_on() if !$disabled{tests}; "" -} + @{- output_on() if !$disabled{tests}; "\@rem" -} install: install_sw install_ssldirs install_docs @@ -362,7 +362,7 @@ libclean: -del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb clean: libclean - {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -} + {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) || "\@rem" -} -del /Q /F $(ENGINES) -del /Q /F $(SCRIPTS) -del /Q /F $(GENERATED_MANDATORY) @@ -378,9 +378,9 @@ distclean: clean -del /Q /F makefile depend: - @ {- output_off() if $disabled{makedepend}; "" -} + @ {- output_off() if $disabled{makedepend}; "\@rem" -} @ "$(PERL)" "$(SRCDIR)\util\add-depends.pl" "VC" - @ {- output_on() if $disabled{makedepend}; "" -} + @ {- output_on() if $disabled{makedepend}; "\@rem" -} # Install helper targets ############################################# @@ -413,10 +413,10 @@ install_dev: install_runtime_libs @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) @$(ECHO) "*** Installing development files" @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl" - @{- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} + @{- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "\@rem" -} @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \ "$(INSTALLTOP)\include\openssl" - @{- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} + @{- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "\@rem" -} @"$(PERL)" "$(SRCDIR)\util\copy.pl" "-exclude_re=/__DECC_" \ "$(SRCDIR)\include\openssl\*.h" \ "$(INSTALLTOP)\include\openssl" diff --git a/deps/openssl/openssl/NEWS b/deps/openssl/openssl/NEWS index 05991a0c214a96..5a1207c66ed4db 100644 --- a/deps/openssl/openssl/NEWS +++ b/deps/openssl/openssl/NEWS @@ -5,6 +5,11 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.1.1k and OpenSSL 1.1.1l [24 Aug 2021] + + o Fixed an SM2 Decryption Buffer Overflow (CVE-2021-3711) + o Fixed various read buffer overruns processing ASN.1 strings (CVE-2021-3712) + Major changes between OpenSSL 1.1.1j and OpenSSL 1.1.1k [25 Mar 2021] o Fixed a problem with verifying a certificate chain when using the diff --git a/deps/openssl/openssl/README-OpenSSL.md b/deps/openssl/openssl/README-OpenSSL.md index b92a8bd3a4b599..7dc4e6790c3419 100644 --- a/deps/openssl/openssl/README-OpenSSL.md +++ b/deps/openssl/openssl/README-OpenSSL.md @@ -1,5 +1,5 @@ - OpenSSL 1.1.1k 25 Mar 2021 + OpenSSL 1.1.1l 24 Aug 2021 Copyright (c) 1998-2021 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson diff --git a/deps/openssl/openssl/apps/crl2p7.c b/deps/openssl/openssl/apps/crl2p7.c index 88fabcb22c3618..3f619bf5278e9d 100644 --- a/deps/openssl/openssl/apps/crl2p7.c +++ b/deps/openssl/openssl/apps/crl2p7.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -120,19 +120,20 @@ int crl2pkcs7_main(int argc, char **argv) if (!ASN1_INTEGER_set(p7s->version, 1)) goto end; - if ((crl_stack = sk_X509_CRL_new_null()) == NULL) - goto end; - p7s->crl = crl_stack; + if (crl != NULL) { + if ((crl_stack = sk_X509_CRL_new_null()) == NULL) + goto end; + p7s->crl = crl_stack; sk_X509_CRL_push(crl_stack, crl); crl = NULL; /* now part of p7 for OPENSSL_freeing */ } - if ((cert_stack = sk_X509_new_null()) == NULL) - goto end; - p7s->cert = cert_stack; + if (certflst != NULL) { + if ((cert_stack = sk_X509_new_null()) == NULL) + goto end; + p7s->cert = cert_stack; - if (certflst != NULL) for (i = 0; i < sk_OPENSSL_STRING_num(certflst); i++) { certfile = sk_OPENSSL_STRING_value(certflst, i); if (add_certs_from_file(cert_stack, certfile) < 0) { @@ -141,6 +142,7 @@ int crl2pkcs7_main(int argc, char **argv) goto end; } } + } out = bio_open_default(outfile, 'w', outformat); if (out == NULL) diff --git a/deps/openssl/openssl/apps/enc.c b/deps/openssl/openssl/apps/enc.c index ddf51e0dba1563..65710771a089de 100644 --- a/deps/openssl/openssl/apps/enc.c +++ b/deps/openssl/openssl/apps/enc.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -81,7 +81,7 @@ const OPTIONS enc_options[] = { {"", OPT_CIPHER, '-', "Any supported cipher"}, OPT_R_OPTIONS, #ifdef ZLIB - {"z", OPT_Z, '-', "Use zlib as the 'encryption'"}, + {"z", OPT_Z, '-', "Compress or decompress encrypted data using zlib"}, #endif #ifndef OPENSSL_NO_ENGINE {"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"}, diff --git a/deps/openssl/openssl/apps/s_server.c b/deps/openssl/openssl/apps/s_server.c index 0ba75999fd286e..938e244222d8f8 100644 --- a/deps/openssl/openssl/apps/s_server.c +++ b/deps/openssl/openssl/apps/s_server.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * Copyright 2005 Nokia. All rights reserved. * @@ -133,6 +133,17 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity, if (s_debug) BIO_printf(bio_s_out, "psk_server_cb\n"); + + if (SSL_version(ssl) >= TLS1_3_VERSION) { + /* + * This callback is designed for use in TLSv1.2. It is possible to use + * a single callback for all protocol versions - but it is preferred to + * use a dedicated callback for TLSv1.3. For TLSv1.3 we have + * psk_find_session_cb. + */ + return 0; + } + if (identity == NULL) { BIO_printf(bio_err, "Error: client did not send PSK identity\n"); goto out_err; diff --git a/deps/openssl/openssl/apps/s_socket.c b/deps/openssl/openssl/apps/s_socket.c index 76f92890020762..aee366d5f45797 100644 --- a/deps/openssl/openssl/apps/s_socket.c +++ b/deps/openssl/openssl/apps/s_socket.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -214,6 +214,8 @@ int do_server(int *accept_sock, const char *host, const char *port, const BIO_ADDRINFO *next; int sock_family, sock_type, sock_protocol, sock_port; const BIO_ADDR *sock_address; + int sock_family_fallback = AF_UNSPEC; + const BIO_ADDR *sock_address_fallback = NULL; int sock_options = BIO_SOCK_REUSEADDR; int ret = 0; @@ -244,6 +246,10 @@ int do_server(int *accept_sock, const char *host, const char *port, && BIO_ADDRINFO_protocol(next) == sock_protocol) { if (sock_family == AF_INET && BIO_ADDRINFO_family(next) == AF_INET6) { + /* In case AF_INET6 is returned but not supported by the + * kernel, retry with the first detected address family */ + sock_family_fallback = sock_family; + sock_address_fallback = sock_address; sock_family = AF_INET6; sock_address = BIO_ADDRINFO_address(next); } else if (sock_family == AF_INET6 @@ -253,6 +259,10 @@ int do_server(int *accept_sock, const char *host, const char *port, } asock = BIO_socket(sock_family, sock_type, sock_protocol, 0); + if (asock == INVALID_SOCKET && sock_family_fallback != AF_UNSPEC) { + asock = BIO_socket(sock_family_fallback, sock_type, sock_protocol, 0); + sock_address = sock_address_fallback; + } if (asock == INVALID_SOCKET || !BIO_listen(asock, sock_address, sock_options)) { BIO_ADDRINFO_free(res); diff --git a/deps/openssl/openssl/crypto/armcap.c b/deps/openssl/openssl/crypto/armcap.c index 8bf96f10214fc3..c5685bde5891eb 100644 --- a/deps/openssl/openssl/crypto/armcap.c +++ b/deps/openssl/openssl/crypto/armcap.c @@ -68,6 +68,12 @@ void OPENSSL_cpuid_setup(void) __attribute__ ((constructor)); # include # define OSSL_IMPLEMENT_GETAUXVAL # endif +# elif defined(__ANDROID_API__) +/* see https://developer.android.google.cn/ndk/guides/cpu-features */ +# if __ANDROID_API__ >= 18 +# include +# define OSSL_IMPLEMENT_GETAUXVAL +# endif # endif # if defined(__FreeBSD__) # include @@ -87,6 +93,15 @@ static unsigned long getauxval(unsigned long key) # endif # endif +/* + * Android: according to https://developer.android.com/ndk/guides/cpu-features, + * getauxval is supported starting with API level 18 + */ +# if defined(__ANDROID__) && defined(__ANDROID_API__) && __ANDROID_API__ >= 18 +# include +# define OSSL_IMPLEMENT_GETAUXVAL +# endif + /* * ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas * AArch64 used AT_HWCAP. diff --git a/deps/openssl/openssl/crypto/asn1/a_object.c b/deps/openssl/openssl/crypto/asn1/a_object.c index d67a723c961160..8ade9e50a7cb2e 100644 --- a/deps/openssl/openssl/crypto/asn1/a_object.c +++ b/deps/openssl/openssl/crypto/asn1/a_object.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -286,16 +286,13 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, } } - /* - * only the ASN1_OBJECTs from the 'table' will have values for ->sn or - * ->ln - */ if ((a == NULL) || ((*a) == NULL) || !((*a)->flags & ASN1_OBJECT_FLAG_DYNAMIC)) { if ((ret = ASN1_OBJECT_new()) == NULL) return NULL; - } else + } else { ret = (*a); + } p = *pp; /* detach data from object */ @@ -313,6 +310,12 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, ret->flags |= ASN1_OBJECT_FLAG_DYNAMIC_DATA; } memcpy(data, p, length); + /* If there are dynamic strings, free them here, and clear the flag */ + if ((ret->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS) != 0) { + OPENSSL_free((char *)ret->sn); + OPENSSL_free((char *)ret->ln); + ret->flags &= ~ASN1_OBJECT_FLAG_DYNAMIC_STRINGS; + } /* reattach data to object, after which it remains const */ ret->data = data; ret->length = length; diff --git a/deps/openssl/openssl/crypto/asn1/a_strex.c b/deps/openssl/openssl/crypto/asn1/a_strex.c index 4879b33785e97e..284dde274c9f25 100644 --- a/deps/openssl/openssl/crypto/asn1/a_strex.c +++ b/deps/openssl/openssl/crypto/asn1/a_strex.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -280,6 +280,8 @@ static int do_dump(unsigned long lflags, char_io *io_ch, void *arg, t.type = str->type; t.value.ptr = (char *)str; der_len = i2d_ASN1_TYPE(&t, NULL); + if (der_len <= 0) + return -1; if ((der_buf = OPENSSL_malloc(der_len)) == NULL) { ASN1err(ASN1_F_DO_DUMP, ERR_R_MALLOC_FAILURE); return -1; diff --git a/deps/openssl/openssl/crypto/asn1/asn1_lib.c b/deps/openssl/openssl/crypto/asn1/asn1_lib.c index 366afc5f6c6b52..3d99d1383d429b 100644 --- a/deps/openssl/openssl/crypto/asn1/asn1_lib.c +++ b/deps/openssl/openssl/crypto/asn1/asn1_lib.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -292,7 +292,12 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len_in) } if ((size_t)str->length <= len || str->data == NULL) { c = str->data; +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* No NUL terminator in fuzzing builds */ + str->data = OPENSSL_realloc(c, len); +#else str->data = OPENSSL_realloc(c, len + 1); +#endif if (str->data == NULL) { ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); str->data = c; @@ -302,8 +307,13 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len_in) str->length = len; if (data != NULL) { memcpy(str->data, data, len); - /* an allowance for strings :-) */ +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* + * Add a NUL terminator. This should not be necessary - but we add it as + * a safety precaution + */ str->data[len] = '\0'; +#endif } return 1; } diff --git a/deps/openssl/openssl/crypto/asn1/bio_asn1.c b/deps/openssl/openssl/crypto/asn1/bio_asn1.c index 86ee566323052d..914d77c866c64f 100644 --- a/deps/openssl/openssl/crypto/asn1/bio_asn1.c +++ b/deps/openssl/openssl/crypto/asn1/bio_asn1.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -138,6 +138,11 @@ static int asn1_bio_free(BIO *b) if (ctx == NULL) return 0; + if (ctx->prefix_free != NULL) + ctx->prefix_free(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg); + if (ctx->suffix_free != NULL) + ctx->suffix_free(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg); + OPENSSL_free(ctx->buf); OPENSSL_free(ctx); BIO_set_data(b, NULL); diff --git a/deps/openssl/openssl/crypto/asn1/bio_ndef.c b/deps/openssl/openssl/crypto/asn1/bio_ndef.c index d7d7d80eea912a..760e4846a47449 100644 --- a/deps/openssl/openssl/crypto/asn1/bio_ndef.c +++ b/deps/openssl/openssl/crypto/asn1/bio_ndef.c @@ -142,6 +142,9 @@ static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, ndef_aux = *(NDEF_SUPPORT **)parg; + if (ndef_aux == NULL) + return 0; + OPENSSL_free(ndef_aux->derbuf); ndef_aux->derbuf = NULL; diff --git a/deps/openssl/openssl/crypto/asn1/d2i_pr.c b/deps/openssl/openssl/crypto/asn1/d2i_pr.c index 7b127d2092fa2c..2094963036fee8 100644 --- a/deps/openssl/openssl/crypto/asn1/d2i_pr.c +++ b/deps/openssl/openssl/crypto/asn1/d2i_pr.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -78,13 +78,53 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, * type */ +static EVP_PKEY *key_as_pkcs8(const unsigned char **pp, long length, int *carry_on) +{ + const unsigned char *p = *pp; + PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length); + EVP_PKEY *ret; + + if (p8 == NULL) + return NULL; + + ret = EVP_PKCS82PKEY(p8); + if (ret == NULL) + *carry_on = 0; + + PKCS8_PRIV_KEY_INFO_free(p8); + + if (ret != NULL) + *pp = p; + + return ret; +} + EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, long length) { STACK_OF(ASN1_TYPE) *inkey; const unsigned char *p; int keytype; + EVP_PKEY *ret = NULL; + int carry_on = 1; + + ERR_set_mark(); + ret = key_as_pkcs8(pp, length, &carry_on); + if (ret != NULL) { + ERR_clear_last_mark(); + if (a != NULL) + *a = ret; + return ret; + } + + if (carry_on == 0) { + ERR_clear_last_mark(); + ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY, + ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); + return NULL; + } p = *pp; + /* * Dirty trick: read in the ASN1 data into a STACK_OF(ASN1_TYPE): by * analyzing it we can determine the passed structure: this assumes the @@ -100,28 +140,15 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, keytype = EVP_PKEY_DSA; else if (sk_ASN1_TYPE_num(inkey) == 4) keytype = EVP_PKEY_EC; - else if (sk_ASN1_TYPE_num(inkey) == 3) { /* This seems to be PKCS8, not - * traditional format */ - PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length); - EVP_PKEY *ret; - - sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); - if (!p8) { - ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY, - ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE); - return NULL; - } - ret = EVP_PKCS82PKEY(p8); - PKCS8_PRIV_KEY_INFO_free(p8); - if (ret == NULL) - return NULL; - *pp = p; - if (a) { - *a = ret; - } - return ret; - } else + else keytype = EVP_PKEY_RSA; sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free); - return d2i_PrivateKey(keytype, a, pp, length); + + ret = d2i_PrivateKey(keytype, a, pp, length); + if (ret != NULL) + ERR_pop_to_mark(); + else + ERR_clear_last_mark(); + + return ret; } diff --git a/deps/openssl/openssl/crypto/asn1/t_spki.c b/deps/openssl/openssl/crypto/asn1/t_spki.c index 51b56d0aa9f746..3d4aea8ad9a4d5 100644 --- a/deps/openssl/openssl/crypto/asn1/t_spki.c +++ b/deps/openssl/openssl/crypto/asn1/t_spki.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -38,7 +38,7 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) } chal = spki->spkac->challenge; if (chal->length) - BIO_printf(out, " Challenge String: %s\n", chal->data); + BIO_printf(out, " Challenge String: %.*s\n", chal->length, chal->data); i = OBJ_obj2nid(spki->sig_algor.algorithm); BIO_printf(out, " Signature Algorithm: %s", (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); diff --git a/deps/openssl/openssl/crypto/bio/b_addr.c b/deps/openssl/openssl/crypto/bio/b_addr.c index b023bbda406b0f..8ea32bce401b15 100644 --- a/deps/openssl/openssl/crypto/bio/b_addr.c +++ b/deps/openssl/openssl/crypto/bio/b_addr.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -689,7 +689,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type, hints.ai_protocol = protocol; # ifdef AI_ADDRCONFIG # ifdef AF_UNSPEC - if (family == AF_UNSPEC) + if (host != NULL && family == AF_UNSPEC) # endif hints.ai_flags |= AI_ADDRCONFIG; # endif diff --git a/deps/openssl/openssl/crypto/bio/b_sock2.c b/deps/openssl/openssl/crypto/bio/b_sock2.c index 335dfabc6180db..104ff31b0d2ed8 100644 --- a/deps/openssl/openssl/crypto/bio/b_sock2.c +++ b/deps/openssl/openssl/crypto/bio/b_sock2.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -243,7 +243,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options) } } -# ifdef IPV6_V6ONLY + /* On OpenBSD it is always ipv6 only with ipv6 sockets thus read-only */ +# if defined(IPV6_V6ONLY) && !defined(__OpenBSD__) if (BIO_ADDR_family(addr) == AF_INET6) { /* * Note: Windows default of IPV6_V6ONLY is ON, and Linux is OFF. diff --git a/deps/openssl/openssl/crypto/bn/bn_div.c b/deps/openssl/openssl/crypto/bn/bn_div.c index 286d69c895fd16..0da9f39b31a93d 100644 --- a/deps/openssl/openssl/crypto/bn/bn_div.c +++ b/deps/openssl/openssl/crypto/bn/bn_div.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -268,7 +268,7 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, BIGNUM *tmp, *snum, *sdiv, *res; BN_ULONG *resp, *wnum, *wnumtop; BN_ULONG d0, d1; - int num_n, div_n; + int num_n, div_n, num_neg; assert(divisor->top > 0 && divisor->d[divisor->top - 1] != 0); @@ -326,7 +326,8 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, /* Setup quotient */ if (!bn_wexpand(res, loop)) goto err; - res->neg = (num->neg ^ divisor->neg); + num_neg = num->neg; + res->neg = (num_neg ^ divisor->neg); res->top = loop; res->flags |= BN_FLG_FIXED_TOP; resp = &(res->d[loop]); @@ -442,7 +443,7 @@ int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, *--resp = q; } /* snum holds remainder, it's as wide as divisor */ - snum->neg = num->neg; + snum->neg = num_neg; snum->top = div_n; snum->flags |= BN_FLG_FIXED_TOP; if (rm != NULL) diff --git a/deps/openssl/openssl/crypto/chacha/asm/chacha-x86_64.pl b/deps/openssl/openssl/crypto/chacha/asm/chacha-x86_64.pl index 227ee59ff2ba5a..c0e5d863dcb2d5 100755 --- a/deps/openssl/openssl/crypto/chacha/asm/chacha-x86_64.pl +++ b/deps/openssl/openssl/crypto/chacha/asm/chacha-x86_64.pl @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -471,7 +471,7 @@ sub SSSE3ROUND { # critical path is 20 "SIMD ticks" per round &por ($b,$t); } -my $xframe = $win64 ? 32+8 : 8; +my $xframe = $win64 ? 160+8 : 8; $code.=<<___; .type ChaCha20_ssse3,\@function,5 @@ -2499,7 +2499,7 @@ sub AVX512ROUND { # critical path is 14 "SIMD ticks" per round &vprold ($b,$b,7); } -my $xframe = $win64 ? 32+8 : 8; +my $xframe = $win64 ? 160+8 : 8; $code.=<<___; .type ChaCha20_avx512,\@function,5 @@ -2515,8 +2515,16 @@ sub AVX512ROUND { # critical path is 14 "SIMD ticks" per round sub \$64+$xframe,%rsp ___ $code.=<<___ if ($win64); - movaps %xmm6,-0x28(%r9) - movaps %xmm7,-0x18(%r9) + movaps %xmm6,-0xa8(%r9) + movaps %xmm7,-0x98(%r9) + movaps %xmm8,-0x88(%r9) + movaps %xmm9,-0x78(%r9) + movaps %xmm10,-0x68(%r9) + movaps %xmm11,-0x58(%r9) + movaps %xmm12,-0x48(%r9) + movaps %xmm13,-0x38(%r9) + movaps %xmm14,-0x28(%r9) + movaps %xmm15,-0x18(%r9) .Lavx512_body: ___ $code.=<<___; @@ -2683,8 +2691,16 @@ sub AVX512ROUND { # critical path is 14 "SIMD ticks" per round vzeroall ___ $code.=<<___ if ($win64); - movaps -0x28(%r9),%xmm6 - movaps -0x18(%r9),%xmm7 + movaps -0xa8(%r9),%xmm6 + movaps -0x98(%r9),%xmm7 + movaps -0x88(%r9),%xmm8 + movaps -0x78(%r9),%xmm9 + movaps -0x68(%r9),%xmm10 + movaps -0x58(%r9),%xmm11 + movaps -0x48(%r9),%xmm12 + movaps -0x38(%r9),%xmm13 + movaps -0x28(%r9),%xmm14 + movaps -0x18(%r9),%xmm15 ___ $code.=<<___; lea (%r9),%rsp @@ -2711,8 +2727,16 @@ sub AVX512ROUND { # critical path is 14 "SIMD ticks" per round sub \$64+$xframe,%rsp ___ $code.=<<___ if ($win64); - movaps %xmm6,-0x28(%r9) - movaps %xmm7,-0x18(%r9) + movaps %xmm6,-0xa8(%r9) + movaps %xmm7,-0x98(%r9) + movaps %xmm8,-0x88(%r9) + movaps %xmm9,-0x78(%r9) + movaps %xmm10,-0x68(%r9) + movaps %xmm11,-0x58(%r9) + movaps %xmm12,-0x48(%r9) + movaps %xmm13,-0x38(%r9) + movaps %xmm14,-0x28(%r9) + movaps %xmm15,-0x18(%r9) .Lavx512vl_body: ___ $code.=<<___; @@ -2836,8 +2860,16 @@ sub AVX512ROUND { # critical path is 14 "SIMD ticks" per round vzeroall ___ $code.=<<___ if ($win64); - movaps -0x28(%r9),%xmm6 - movaps -0x18(%r9),%xmm7 + movaps -0xa8(%r9),%xmm6 + movaps -0x98(%r9),%xmm7 + movaps -0x88(%r9),%xmm8 + movaps -0x78(%r9),%xmm9 + movaps -0x68(%r9),%xmm10 + movaps -0x58(%r9),%xmm11 + movaps -0x48(%r9),%xmm12 + movaps -0x38(%r9),%xmm13 + movaps -0x28(%r9),%xmm14 + movaps -0x18(%r9),%xmm15 ___ $code.=<<___; lea (%r9),%rsp diff --git a/deps/openssl/openssl/crypto/dsa/dsa_prn.c b/deps/openssl/openssl/crypto/dsa/dsa_prn.c index a4a1fd5650e457..070b881e1fae19 100644 --- a/deps/openssl/openssl/crypto/dsa/dsa_prn.c +++ b/deps/openssl/openssl/crypto/dsa/dsa_prn.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -49,9 +49,11 @@ int DSA_print(BIO *bp, const DSA *x, int off) EVP_PKEY *pk; int ret; pk = EVP_PKEY_new(); - if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x)) + if (pk == NULL) return 0; - ret = EVP_PKEY_print_private(bp, pk, off, NULL); + ret = EVP_PKEY_set1_DSA(pk, (DSA *)x); + if (ret) + ret = EVP_PKEY_print_private(bp, pk, off, NULL); EVP_PKEY_free(pk); return ret; } @@ -61,9 +63,11 @@ int DSAparams_print(BIO *bp, const DSA *x) EVP_PKEY *pk; int ret; pk = EVP_PKEY_new(); - if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x)) + if (pk == NULL) return 0; - ret = EVP_PKEY_print_params(bp, pk, 4, NULL); + ret = EVP_PKEY_set1_DSA(pk, (DSA *)x); + if (ret) + ret = EVP_PKEY_print_params(bp, pk, 4, NULL); EVP_PKEY_free(pk); return ret; } diff --git a/deps/openssl/openssl/crypto/ec/ec2_oct.c b/deps/openssl/openssl/crypto/ec/ec2_oct.c index 48543265eeabb7..788e6501fbcd4b 100644 --- a/deps/openssl/openssl/crypto/ec/ec2_oct.c +++ b/deps/openssl/openssl/crypto/ec/ec2_oct.c @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2011-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the OpenSSL license (the "License"). You may not use @@ -247,9 +247,21 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_BUFFER_TOO_SMALL); return 0; } - form = buf[0]; - y_bit = form & 1; - form = form & ~1U; + + /* + * The first octet is the point converison octet PC, see X9.62, page 4 + * and section 4.4.2. It must be: + * 0x00 for the point at infinity + * 0x02 or 0x03 for compressed form + * 0x04 for uncompressed form + * 0x06 or 0x07 for hybrid form. + * For compressed or hybrid forms, we store the last bit of buf[0] as + * y_bit and clear it from buf[0] so as to obtain a POINT_CONVERSION_*. + * We error if buf[0] contains any but the above values. + */ + y_bit = buf[0] & 1; + form = buf[0] & ~1U; + if ((form != 0) && (form != POINT_CONVERSION_COMPRESSED) && (form != POINT_CONVERSION_UNCOMPRESSED) && (form != POINT_CONVERSION_HYBRID)) { @@ -261,6 +273,7 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, return 0; } + /* The point at infinity is represented by a single zero octet. */ if (form == 0) { if (len != 1) { ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING); @@ -312,11 +325,23 @@ int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, goto err; } if (form == POINT_CONVERSION_HYBRID) { - if (!group->meth->field_div(group, yxi, y, x, ctx)) - goto err; - if (y_bit != BN_is_odd(yxi)) { - ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_INVALID_ENCODING); - goto err; + /* + * Check that the form in the encoding was set correctly + * according to X9.62 4.4.2.a, 4(c), see also first paragraph + * of X9.62, 4.4.1.b. + */ + if (BN_is_zero(x)) { + if (y_bit != 0) { + ECerr(ERR_LIB_EC, EC_R_INVALID_ENCODING); + goto err; + } + } else { + if (!group->meth->field_div(group, yxi, y, x, ctx)) + goto err; + if (y_bit != BN_is_odd(yxi)) { + ECerr(ERR_LIB_EC, EC_R_INVALID_ENCODING); + goto err; + } } } diff --git a/deps/openssl/openssl/crypto/ec/ec_asn1.c b/deps/openssl/openssl/crypto/ec/ec_asn1.c index 7b7c75ce84435a..c8ee1e6f176218 100644 --- a/deps/openssl/openssl/crypto/ec/ec_asn1.c +++ b/deps/openssl/openssl/crypto/ec/ec_asn1.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -761,7 +761,10 @@ EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params) ret->seed_len = params->curve->seed->length; } - if (!params->order || !params->base || !params->base->data) { + if (params->order == NULL + || params->base == NULL + || params->base->data == NULL + || params->base->length == 0) { ECerr(EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS, EC_R_ASN1_ERROR); goto err; } diff --git a/deps/openssl/openssl/crypto/err/openssl.txt b/deps/openssl/openssl/crypto/err/openssl.txt index a1472fb23dc6f2..66cc25ab04db0f 100644 --- a/deps/openssl/openssl/crypto/err/openssl.txt +++ b/deps/openssl/openssl/crypto/err/openssl.txt @@ -1160,6 +1160,7 @@ SSL_F_FINAL_EC_PT_FORMATS:485:final_ec_pt_formats SSL_F_FINAL_EMS:486:final_ems SSL_F_FINAL_KEY_SHARE:503:final_key_share SSL_F_FINAL_MAXFRAGMENTLEN:557:final_maxfragmentlen +SSL_F_FINAL_PSK:639:final_psk SSL_F_FINAL_QUIC_TRANSPORT_PARAMS:3012:final_quic_transport_params SSL_F_FINAL_RENEGOTIATE:483:final_renegotiate SSL_F_FINAL_SERVER_NAME:558:final_server_name @@ -1677,6 +1678,7 @@ X509V3_F_I2S_ASN1_ENUMERATED:121:i2s_ASN1_ENUMERATED X509V3_F_I2S_ASN1_IA5STRING:149:i2s_ASN1_IA5STRING X509V3_F_I2S_ASN1_INTEGER:120:i2s_ASN1_INTEGER X509V3_F_I2V_AUTHORITY_INFO_ACCESS:138:i2v_AUTHORITY_INFO_ACCESS +X509V3_F_I2V_AUTHORITY_KEYID:173:i2v_AUTHORITY_KEYID X509V3_F_LEVEL_ADD_NODE:168:level_add_node X509V3_F_NOTICE_SECTION:132:notice_section X509V3_F_NREF_NOS:133:nref_nos @@ -1717,6 +1719,7 @@ X509V3_F_V2I_SUBJECT_ALT:154:v2i_subject_alt X509V3_F_V2I_TLS_FEATURE:165:v2i_TLS_FEATURE X509V3_F_V3_GENERIC_EXTENSION:116:v3_generic_extension X509V3_F_X509V3_ADD1_I2D:140:X509V3_add1_i2d +X509V3_F_X509V3_ADD_LEN_VALUE:174:x509v3_add_len_value X509V3_F_X509V3_ADD_VALUE:105:X509V3_add_value X509V3_F_X509V3_EXT_ADD:104:X509V3_EXT_add X509V3_F_X509V3_EXT_ADD_ALIAS:106:X509V3_EXT_add_alias @@ -2766,6 +2769,7 @@ SSL_R_MISSING_DSA_SIGNING_CERT:165:missing dsa signing cert SSL_R_MISSING_ECDSA_SIGNING_CERT:381:missing ecdsa signing cert SSL_R_MISSING_FATAL:256:missing fatal SSL_R_MISSING_PARAMETERS:290:missing parameters +SSL_R_MISSING_PSK_KEX_MODES_EXTENSION:310:missing psk kex modes extension SSL_R_MISSING_QUIC_TRANSPORT_PARAMETERS_EXTENSION:801:\ missing quic transport parameters extension SSL_R_MISSING_RSA_CERTIFICATE:168:missing rsa certificate @@ -2811,6 +2815,7 @@ SSL_R_NO_VALID_SCTS:216:no valid scts SSL_R_NO_VERIFY_COOKIE_CALLBACK:403:no verify cookie callback SSL_R_NULL_SSL_CTX:195:null ssl ctx SSL_R_NULL_SSL_METHOD_PASSED:196:null ssl method passed +SSL_R_OCSP_CALLBACK_FAILURE:294:ocsp callback failure SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED:197:old session cipher not returned SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED:344:\ old session compression algorithm not returned diff --git a/deps/openssl/openssl/crypto/evp/e_aes.c b/deps/openssl/openssl/crypto/evp/e_aes.c index 405ddbf9bf09e0..a1d3ab90fa6159 100644 --- a/deps/openssl/openssl/crypto/evp/e_aes.c +++ b/deps/openssl/openssl/crypto/evp/e_aes.c @@ -1,5 +1,5 @@ /* - * Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -611,22 +611,22 @@ void aes_t4_decrypt(const unsigned char *in, unsigned char *out, */ void aes128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const AES_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void aes128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len, const AES_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void aes192_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const AES_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void aes192_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len, const AES_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void aes256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const AES_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void aes256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len, const AES_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void aes128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks, const AES_KEY *key, unsigned char *ivec); @@ -1168,9 +1168,9 @@ typedef struct { static int s390x_aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); -# define S390X_aes_128_cbc_CAPABLE 1 /* checked by callee */ -# define S390X_aes_192_cbc_CAPABLE 1 -# define S390X_aes_256_cbc_CAPABLE 1 +# define S390X_aes_128_cbc_CAPABLE 0 /* checked by callee */ +# define S390X_aes_192_cbc_CAPABLE 0 +# define S390X_aes_256_cbc_CAPABLE 0 # define S390X_AES_CBC_CTX EVP_AES_KEY # define s390x_aes_cbc_init_key aes_init_key @@ -1190,11 +1190,11 @@ static int s390x_aes_ecb_init_key(EVP_CIPHER_CTX *ctx, S390X_AES_ECB_CTX *cctx = EVP_C_DATA(S390X_AES_ECB_CTX, ctx); const int keylen = EVP_CIPHER_CTX_key_length(ctx); - cctx->fc = S390X_AES_FC(keylen); - if (!enc) - cctx->fc |= S390X_DECRYPT; + cctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT); + + if (key != NULL) + memcpy(cctx->km.param.k, key, keylen); - memcpy(cctx->km.param.k, key, keylen); return 1; } @@ -1222,14 +1222,17 @@ static int s390x_aes_ofb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *ivec, int enc) { S390X_AES_OFB_CTX *cctx = EVP_C_DATA(S390X_AES_OFB_CTX, ctx); - const unsigned char *iv = EVP_CIPHER_CTX_original_iv(ctx); + const unsigned char *oiv = EVP_CIPHER_CTX_original_iv(ctx); const int keylen = EVP_CIPHER_CTX_key_length(ctx); const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); - memcpy(cctx->kmo.param.cv, iv, ivlen); - memcpy(cctx->kmo.param.k, key, keylen); cctx->fc = S390X_AES_FC(keylen); + + if (key != NULL) + memcpy(cctx->kmo.param.k, key, keylen); + cctx->res = 0; + memcpy(cctx->kmo.param.cv, oiv, ivlen); return 1; } @@ -1237,9 +1240,12 @@ static int s390x_aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { S390X_AES_OFB_CTX *cctx = EVP_C_DATA(S390X_AES_OFB_CTX, ctx); + const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); + unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx); int n = cctx->res; int rem; + memcpy(cctx->kmo.param.cv, iv, ivlen); while (n && len) { *out = *in ^ cctx->kmo.param.cv[n]; n = (n + 1) & 0xf; @@ -1268,6 +1274,7 @@ static int s390x_aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } } + memcpy(iv, cctx->kmo.param.cv, ivlen); cctx->res = n; return 1; } @@ -1287,18 +1294,18 @@ static int s390x_aes_cfb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *ivec, int enc) { S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx); - const unsigned char *iv = EVP_CIPHER_CTX_original_iv(ctx); + const unsigned char *oiv = EVP_CIPHER_CTX_original_iv(ctx); const int keylen = EVP_CIPHER_CTX_key_length(ctx); const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); - cctx->fc = S390X_AES_FC(keylen); - cctx->fc |= 16 << 24; /* 16 bytes cipher feedback */ - if (!enc) - cctx->fc |= S390X_DECRYPT; + cctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT) + | (16 << 24); /* 16 bytes cipher feedback */ + + if (key != NULL) + memcpy(cctx->kmf.param.k, key, keylen); cctx->res = 0; - memcpy(cctx->kmf.param.cv, iv, ivlen); - memcpy(cctx->kmf.param.k, key, keylen); + memcpy(cctx->kmf.param.cv, oiv, ivlen); return 1; } @@ -1308,10 +1315,13 @@ static int s390x_aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx); const int keylen = EVP_CIPHER_CTX_key_length(ctx); const int enc = EVP_CIPHER_CTX_encrypting(ctx); + const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); + unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx); int n = cctx->res; int rem; unsigned char tmp; + memcpy(cctx->kmf.param.cv, iv, ivlen); while (n && len) { tmp = *in; *out = cctx->kmf.param.cv[n] ^ tmp; @@ -1344,6 +1354,7 @@ static int s390x_aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } } + memcpy(iv, cctx->kmf.param.cv, ivlen); cctx->res = n; return 1; } @@ -1360,17 +1371,18 @@ static int s390x_aes_cfb8_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *ivec, int enc) { S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx); - const unsigned char *iv = EVP_CIPHER_CTX_original_iv(ctx); + const unsigned char *oiv = EVP_CIPHER_CTX_original_iv(ctx); const int keylen = EVP_CIPHER_CTX_key_length(ctx); const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); - cctx->fc = S390X_AES_FC(keylen); - cctx->fc |= 1 << 24; /* 1 byte cipher feedback */ - if (!enc) - cctx->fc |= S390X_DECRYPT; + cctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT) + | (1 << 24); /* 1 byte cipher feedback flag */ - memcpy(cctx->kmf.param.cv, iv, ivlen); - memcpy(cctx->kmf.param.k, key, keylen); + if (key != NULL) + memcpy(cctx->kmf.param.k, key, keylen); + + cctx->res = 0; + memcpy(cctx->kmf.param.cv, oiv, ivlen); return 1; } @@ -1378,8 +1390,12 @@ static int s390x_aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { S390X_AES_CFB_CTX *cctx = EVP_C_DATA(S390X_AES_CFB_CTX, ctx); + const int ivlen = EVP_CIPHER_CTX_iv_length(ctx); + unsigned char *iv = EVP_CIPHER_CTX_iv_noconst(ctx); + memcpy(cctx->kmf.param.cv, iv, ivlen); s390x_kmf(in, len, out, cctx->fc, &cctx->kmf.param); + memcpy(iv, cctx->kmf.param.cv, ivlen); return 1; } @@ -1393,9 +1409,9 @@ static int s390x_aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, static int s390x_aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len); -# define S390X_aes_128_ctr_CAPABLE 1 /* checked by callee */ -# define S390X_aes_192_ctr_CAPABLE 1 -# define S390X_aes_256_ctr_CAPABLE 1 +# define S390X_aes_128_ctr_CAPABLE 0 /* checked by callee */ +# define S390X_aes_192_ctr_CAPABLE 0 +# define S390X_aes_256_ctr_CAPABLE 0 # define S390X_AES_CTR_CTX EVP_AES_KEY # define s390x_aes_ctr_init_key aes_init_key @@ -1563,8 +1579,7 @@ static int s390x_aes_gcm(S390X_AES_GCM_CTX *ctx, const unsigned char *in, /*- * Initialize context structure. Code is big-endian. */ -static void s390x_aes_gcm_setiv(S390X_AES_GCM_CTX *ctx, - const unsigned char *iv) +static void s390x_aes_gcm_setiv(S390X_AES_GCM_CTX *ctx) { ctx->kma.param.t.g[0] = 0; ctx->kma.param.t.g[1] = 0; @@ -1575,12 +1590,11 @@ static void s390x_aes_gcm_setiv(S390X_AES_GCM_CTX *ctx, ctx->kreslen = 0; if (ctx->ivlen == 12) { - memcpy(&ctx->kma.param.j0, iv, ctx->ivlen); + memcpy(&ctx->kma.param.j0, ctx->iv, ctx->ivlen); ctx->kma.param.j0.w[3] = 1; ctx->kma.param.cv.w = 1; } else { /* ctx->iv has the right size and is already padded. */ - memcpy(ctx->iv, iv, ctx->ivlen); s390x_kma(ctx->iv, S390X_gcm_ivpadlen(ctx->ivlen), NULL, 0, NULL, ctx->fc, &ctx->kma.param); ctx->fc |= S390X_KMA_HS; @@ -1694,7 +1708,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) if (gctx->iv_gen == 0 || gctx->key_set == 0) return 0; - s390x_aes_gcm_setiv(gctx, gctx->iv); + s390x_aes_gcm_setiv(gctx); if (arg <= 0 || arg > gctx->ivlen) arg = gctx->ivlen; @@ -1714,7 +1728,7 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 0; memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg); - s390x_aes_gcm_setiv(gctx, gctx->iv); + s390x_aes_gcm_setiv(gctx); gctx->iv_set = 1; return 1; @@ -1770,43 +1784,36 @@ static int s390x_aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) } /*- - * Set key and/or iv. Returns 1 on success. Otherwise 0 is returned. + * Set key or iv or enc/dec. Returns 1 on success. Otherwise 0 is returned. */ static int s390x_aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { S390X_AES_GCM_CTX *gctx = EVP_C_DATA(S390X_AES_GCM_CTX, ctx); - int keylen; + const int keylen = EVP_CIPHER_CTX_key_length(ctx); - if (iv == NULL && key == NULL) - return 1; + gctx->fc = S390X_AES_FC(keylen) | (enc ? 0 : S390X_DECRYPT); if (key != NULL) { - keylen = EVP_CIPHER_CTX_key_length(ctx); + gctx->fc &= ~S390X_KMA_HS; memcpy(&gctx->kma.param.k, key, keylen); - - gctx->fc = S390X_AES_FC(keylen); - if (!enc) - gctx->fc |= S390X_DECRYPT; - - if (iv == NULL && gctx->iv_set) - iv = gctx->iv; - - if (iv != NULL) { - s390x_aes_gcm_setiv(gctx, iv); - gctx->iv_set = 1; - } gctx->key_set = 1; - } else { - if (gctx->key_set) - s390x_aes_gcm_setiv(gctx, iv); - else - memcpy(gctx->iv, iv, gctx->ivlen); + } - gctx->iv_set = 1; + if (iv != NULL) { + memcpy(gctx->iv, iv, gctx->ivlen); gctx->iv_gen = 0; + gctx->iv_set = 1; } + + if (gctx->key_set && gctx->iv_set) + s390x_aes_gcm_setiv(gctx); + + gctx->fc &= ~(S390X_KMA_LPC | S390X_KMA_LAAD); + gctx->areslen = 0; + gctx->mreslen = 0; + gctx->kreslen = 0; return 1; } @@ -1895,7 +1902,6 @@ static int s390x_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, /* recall that we already did en-/decrypt gctx->mres * and returned it to caller... */ OPENSSL_cleanse(tmp, gctx->mreslen); - gctx->iv_set = 0; enc = EVP_CIPHER_CTX_encrypting(ctx); if (enc) { @@ -1929,8 +1935,8 @@ static int s390x_aes_gcm_cleanup(EVP_CIPHER_CTX *c) } # define S390X_AES_XTS_CTX EVP_AES_XTS_CTX -# define S390X_aes_128_xts_CAPABLE 1 /* checked by callee */ -# define S390X_aes_256_xts_CAPABLE 1 +# define S390X_aes_128_xts_CAPABLE 0 /* checked by callee */ +# define S390X_aes_256_xts_CAPABLE 0 # define s390x_aes_xts_init_key aes_xts_init_key static int s390x_aes_xts_init_key(EVP_CIPHER_CTX *ctx, @@ -2134,9 +2140,10 @@ static int s390x_aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t len) { S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx); - unsigned char *ivec = EVP_CIPHER_CTX_iv_noconst(ctx); + const unsigned char *ivec = EVP_CIPHER_CTX_iv(ctx); unsigned char *buf = EVP_CIPHER_CTX_buf_noconst(ctx); const int enc = EVP_CIPHER_CTX_encrypting(ctx); + unsigned char iv[EVP_MAX_IV_LENGTH]; if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)cctx->aes.ccm.m)) @@ -2152,8 +2159,9 @@ static int s390x_aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, * Get explicit iv (sequence number). We already have fixed iv * (server/client_write_iv) here. */ - memcpy(ivec + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN); - s390x_aes_ccm_setiv(cctx, ivec, len); + memcpy(iv, ivec, sizeof(iv)); + memcpy(iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN); + s390x_aes_ccm_setiv(cctx, iv, len); /* Process aad (sequence number|type|version|length) */ s390x_aes_ccm_aad(cctx, buf, cctx->aes.ccm.tls_aad_len); @@ -2180,42 +2188,35 @@ static int s390x_aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } /*- - * Set key and flag field and/or iv. Returns 1 if successful. Otherwise 0 is - * returned. + * Set key or iv or enc/dec. Returns 1 if successful. + * Otherwise 0 is returned. */ static int s390x_aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx); - unsigned char *ivec; - int keylen; + const int keylen = EVP_CIPHER_CTX_key_length(ctx); + unsigned char *ivec = EVP_CIPHER_CTX_iv_noconst(ctx); - if (iv == NULL && key == NULL) - return 1; + cctx->aes.ccm.fc = S390X_AES_FC(keylen); if (key != NULL) { - keylen = EVP_CIPHER_CTX_key_length(ctx); - cctx->aes.ccm.fc = S390X_AES_FC(keylen); memcpy(cctx->aes.ccm.kmac_param.k, key, keylen); - - /* Store encoded m and l. */ - cctx->aes.ccm.nonce.b[0] = ((cctx->aes.ccm.l - 1) & 0x7) - | (((cctx->aes.ccm.m - 2) >> 1) & 0x7) << 3; - memset(cctx->aes.ccm.nonce.b + 1, 0, - sizeof(cctx->aes.ccm.nonce.b)); - cctx->aes.ccm.blocks = 0; - cctx->aes.ccm.key_set = 1; } - if (iv != NULL) { - ivec = EVP_CIPHER_CTX_iv_noconst(ctx); memcpy(ivec, iv, 15 - cctx->aes.ccm.l); - cctx->aes.ccm.iv_set = 1; } + /* Store encoded m and l. */ + cctx->aes.ccm.nonce.b[0] = ((cctx->aes.ccm.l - 1) & 0x7) + | (((cctx->aes.ccm.m - 2) >> 1) & 0x7) << 3; + memset(cctx->aes.ccm.nonce.b + 1, 0, sizeof(cctx->aes.ccm.nonce.b) - 1); + + cctx->aes.ccm.blocks = 0; + cctx->aes.ccm.len_set = 0; return 1; } @@ -2230,8 +2231,9 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { S390X_AES_CCM_CTX *cctx = EVP_C_DATA(S390X_AES_CCM_CTX, ctx); const int enc = EVP_CIPHER_CTX_encrypting(ctx); + const unsigned char *ivec = EVP_CIPHER_CTX_iv(ctx); + unsigned char *buf; int rv; - unsigned char *buf, *ivec; if (!cctx->aes.ccm.key_set) return -1; @@ -2253,7 +2255,6 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (out == NULL) { /* Update(): Pass message length. */ if (in == NULL) { - ivec = EVP_CIPHER_CTX_iv_noconst(ctx); s390x_aes_ccm_setiv(cctx, ivec, len); cctx->aes.ccm.len_set = 1; @@ -2279,7 +2280,6 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, * In case message length was not previously set explicitly via * Update(), set it now. */ - ivec = EVP_CIPHER_CTX_iv_noconst(ctx); s390x_aes_ccm_setiv(cctx, ivec, len); cctx->aes.ccm.len_set = 1; @@ -2304,9 +2304,6 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (rv == -1) OPENSSL_cleanse(out, len); - cctx->aes.ccm.iv_set = 0; - cctx->aes.ccm.tag_set = 0; - cctx->aes.ccm.len_set = 0; return rv; } } @@ -2414,9 +2411,6 @@ static int s390x_aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 0; memcpy(ptr, cctx->aes.ccm.kmac_param.icv.b, cctx->aes.ccm.m); - cctx->aes.ccm.tag_set = 0; - cctx->aes.ccm.iv_set = 0; - cctx->aes.ccm.len_set = 0; return 1; case EVP_CTRL_COPY: @@ -2453,7 +2447,7 @@ static const EVP_CIPHER s390x_aes_##keylen##_##mode = { \ nid##_##keylen##_##nmode,blocksize, \ keylen / 8, \ ivlen, \ - flags | EVP_CIPH_##MODE##_MODE, \ + flags | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_##MODE##_MODE, \ s390x_aes_##mode##_init_key, \ s390x_aes_##mode##_cipher, \ NULL, \ @@ -2490,7 +2484,7 @@ static const EVP_CIPHER s390x_aes_##keylen##_##mode = { \ blocksize, \ (EVP_CIPH_##MODE##_MODE == EVP_CIPH_XTS_MODE ? 2 : 1) * keylen / 8, \ ivlen, \ - flags | EVP_CIPH_##MODE##_MODE, \ + flags | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_##MODE##_MODE, \ s390x_aes_##mode##_init_key, \ s390x_aes_##mode##_cipher, \ s390x_aes_##mode##_cleanup, \ diff --git a/deps/openssl/openssl/crypto/evp/e_camellia.c b/deps/openssl/openssl/crypto/evp/e_camellia.c index 502d6936cc1307..f8c01980126772 100644 --- a/deps/openssl/openssl/crypto/evp/e_camellia.c +++ b/deps/openssl/openssl/crypto/evp/e_camellia.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -55,16 +55,16 @@ void cmll_t4_decrypt(const unsigned char *in, unsigned char *out, void cmll128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const CAMELLIA_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void cmll128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len, const CAMELLIA_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void cmll256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, const CAMELLIA_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void cmll256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len, const CAMELLIA_KEY *key, - unsigned char *ivec); + unsigned char *ivec, int /*unused*/); void cmll128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks, const CAMELLIA_KEY *key, unsigned char *ivec); diff --git a/deps/openssl/openssl/crypto/hmac/hm_ameth.c b/deps/openssl/openssl/crypto/hmac/hm_ameth.c index 638f61b5863aef..f871e4fe71e5fd 100644 --- a/deps/openssl/openssl/crypto/hmac/hm_ameth.c +++ b/deps/openssl/openssl/crypto/hmac/hm_ameth.c @@ -1,5 +1,5 @@ /* - * Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -47,7 +47,8 @@ static int hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) static int hmac_pkey_public_cmp(const EVP_PKEY *a, const EVP_PKEY *b) { - return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)); + /* the ameth pub_cmp must return 1 on match, 0 on mismatch */ + return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)) == 0; } static int hmac_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv, diff --git a/deps/openssl/openssl/crypto/pkcs12/p12_key.c b/deps/openssl/openssl/crypto/pkcs12/p12_key.c index ab31a6129500eb..03eda2664251d2 100644 --- a/deps/openssl/openssl/crypto/pkcs12/p12_key.c +++ b/deps/openssl/openssl/crypto/pkcs12/p12_key.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -101,7 +101,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, #endif v = EVP_MD_block_size(md_type); u = EVP_MD_size(md_type); - if (u < 0 || v <= 0) + if (u <= 0 || v <= 0) goto err; D = OPENSSL_malloc(v); Ai = OPENSSL_malloc(u); diff --git a/deps/openssl/openssl/crypto/poly1305/poly1305_ameth.c b/deps/openssl/openssl/crypto/poly1305/poly1305_ameth.c index 0c8a91dc79dcc5..0dddf79626e33e 100644 --- a/deps/openssl/openssl/crypto/poly1305/poly1305_ameth.c +++ b/deps/openssl/openssl/crypto/poly1305/poly1305_ameth.c @@ -1,5 +1,5 @@ /* - * Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -43,7 +43,7 @@ static int poly1305_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) static int poly1305_pkey_public_cmp(const EVP_PKEY *a, const EVP_PKEY *b) { - return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)); + return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)) == 0; } static int poly1305_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv, diff --git a/deps/openssl/openssl/crypto/ppccap.c b/deps/openssl/openssl/crypto/ppccap.c index e51156468ae584..eeaa47cc6b4181 100644 --- a/deps/openssl/openssl/crypto/ppccap.c +++ b/deps/openssl/openssl/crypto/ppccap.c @@ -211,6 +211,12 @@ size_t OPENSSL_instrument_bus2(unsigned int *out, size_t cnt, size_t max) # if __GLIBC_PREREQ(2, 16) # include # define OSSL_IMPLEMENT_GETAUXVAL +# elif defined(__ANDROID_API__) +/* see https://developer.android.google.cn/ndk/guides/cpu-features */ +# if __ANDROID_API__ >= 18 +# include +# define OSSL_IMPLEMENT_GETAUXVAL +# endif # endif #endif diff --git a/deps/openssl/openssl/crypto/rand/rand_unix.c b/deps/openssl/openssl/crypto/rand/rand_unix.c index ec6be791b37f44..43f1069d151d80 100644 --- a/deps/openssl/openssl/crypto/rand/rand_unix.c +++ b/deps/openssl/openssl/crypto/rand/rand_unix.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -34,6 +34,9 @@ #if defined(__OpenBSD__) # include #endif +#if defined(__APPLE__) +# include +#endif #if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__) # include @@ -378,6 +381,11 @@ static ssize_t syscall_random(void *buf, size_t buflen) if (errno != ENOSYS) return -1; } +# elif defined(__APPLE__) + if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess) + return (ssize_t)buflen; + + return -1; # else union { void *p; diff --git a/deps/openssl/openssl/crypto/rsa/rsa_prn.c b/deps/openssl/openssl/crypto/rsa/rsa_prn.c index b5f4bce2a3e654..23df448a5212ca 100644 --- a/deps/openssl/openssl/crypto/rsa/rsa_prn.c +++ b/deps/openssl/openssl/crypto/rsa/rsa_prn.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -34,9 +34,11 @@ int RSA_print(BIO *bp, const RSA *x, int off) EVP_PKEY *pk; int ret; pk = EVP_PKEY_new(); - if (pk == NULL || !EVP_PKEY_set1_RSA(pk, (RSA *)x)) + if (pk == NULL) return 0; - ret = EVP_PKEY_print_private(bp, pk, off, NULL); + ret = EVP_PKEY_set1_RSA(pk, (RSA *)x); + if (ret) + ret = EVP_PKEY_print_private(bp, pk, off, NULL); EVP_PKEY_free(pk); return ret; } diff --git a/deps/openssl/openssl/crypto/siphash/siphash_ameth.c b/deps/openssl/openssl/crypto/siphash/siphash_ameth.c index 2da6dfec8025d3..7fce76390ef4fd 100644 --- a/deps/openssl/openssl/crypto/siphash/siphash_ameth.c +++ b/deps/openssl/openssl/crypto/siphash/siphash_ameth.c @@ -1,5 +1,5 @@ /* - * Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -44,7 +44,7 @@ static int siphash_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) static int siphash_pkey_public_cmp(const EVP_PKEY *a, const EVP_PKEY *b) { - return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)); + return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b)) == 0; } static int siphash_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv, diff --git a/deps/openssl/openssl/crypto/sm2/sm2_crypt.c b/deps/openssl/openssl/crypto/sm2/sm2_crypt.c index ef505f64412bdc..83b97f4edc8828 100644 --- a/deps/openssl/openssl/crypto/sm2/sm2_crypt.c +++ b/deps/openssl/openssl/crypto/sm2/sm2_crypt.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2017 Ribose Inc. All Rights Reserved. * Ported from Ribose contributions from Botan. * @@ -61,29 +61,20 @@ static size_t ec_field_size(const EC_GROUP *group) return field_size; } -int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, - size_t *pt_size) +int sm2_plaintext_size(const unsigned char *ct, size_t ct_size, size_t *pt_size) { - const size_t field_size = ec_field_size(EC_KEY_get0_group(key)); - const int md_size = EVP_MD_size(digest); - size_t overhead; + struct SM2_Ciphertext_st *sm2_ctext = NULL; - if (md_size < 0) { - SM2err(SM2_F_SM2_PLAINTEXT_SIZE, SM2_R_INVALID_DIGEST); - return 0; - } - if (field_size == 0) { - SM2err(SM2_F_SM2_PLAINTEXT_SIZE, SM2_R_INVALID_FIELD); - return 0; - } + sm2_ctext = d2i_SM2_Ciphertext(NULL, &ct, ct_size); - overhead = 10 + 2 * field_size + (size_t)md_size; - if (msg_len <= overhead) { + if (sm2_ctext == NULL) { SM2err(SM2_F_SM2_PLAINTEXT_SIZE, SM2_R_INVALID_ENCODING); return 0; } - *pt_size = msg_len - overhead; + *pt_size = sm2_ctext->C2->length; + SM2_Ciphertext_free(sm2_ctext); + return 1; } @@ -303,6 +294,10 @@ int sm2_decrypt(const EC_KEY *key, C2 = sm2_ctext->C2->data; C3 = sm2_ctext->C3->data; msg_len = sm2_ctext->C2->length; + if (*ptext_len < (size_t)msg_len) { + SM2err(SM2_F_SM2_DECRYPT, SM2_R_BUFFER_TOO_SMALL); + goto done; + } ctx = BN_CTX_new(); if (ctx == NULL) { diff --git a/deps/openssl/openssl/crypto/sm2/sm2_pmeth.c b/deps/openssl/openssl/crypto/sm2/sm2_pmeth.c index b42a14c32f265a..0e722b910b5766 100644 --- a/deps/openssl/openssl/crypto/sm2/sm2_pmeth.c +++ b/deps/openssl/openssl/crypto/sm2/sm2_pmeth.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -151,7 +151,7 @@ static int pkey_sm2_decrypt(EVP_PKEY_CTX *ctx, const EVP_MD *md = (dctx->md == NULL) ? EVP_sm3() : dctx->md; if (out == NULL) { - if (!sm2_plaintext_size(ec, md, inlen, outlen)) + if (!sm2_plaintext_size(in, inlen, outlen)) return -1; else return 1; diff --git a/deps/openssl/openssl/crypto/sparcv9cap.c b/deps/openssl/openssl/crypto/sparcv9cap.c index ff1a983ac98b4b..b3cb3d4be9585b 100644 --- a/deps/openssl/openssl/crypto/sparcv9cap.c +++ b/deps/openssl/openssl/crypto/sparcv9cap.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -16,6 +16,7 @@ #include #include #include "internal/cryptlib.h" +#include "bn/bn_local.h" /* for definition of bn_mul_mont */ #include "sparc_arch.h" diff --git a/deps/openssl/openssl/crypto/srp/srp_vfy.c b/deps/openssl/openssl/crypto/srp/srp_vfy.c index 3dd2ab05075718..394e1180dfa433 100644 --- a/deps/openssl/openssl/crypto/srp/srp_vfy.c +++ b/deps/openssl/openssl/crypto/srp/srp_vfy.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2004, EdelKey Project. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use @@ -684,7 +684,7 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, BIGNUM *x = NULL; BN_CTX *bn_ctx = BN_CTX_new(); unsigned char tmp2[MAX_LEN]; - BIGNUM *salttmp = NULL; + BIGNUM *salttmp = NULL, *verif; if ((user == NULL) || (pass == NULL) || @@ -707,17 +707,18 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, if (x == NULL) goto err; - *verifier = BN_new(); - if (*verifier == NULL) + verif = BN_new(); + if (verif == NULL) goto err; - if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { - BN_clear_free(*verifier); + if (!BN_mod_exp(verif, g, x, N, bn_ctx)) { + BN_clear_free(verif); goto err; } result = 1; *salt = salttmp; + *verifier = verif; err: if (salt != NULL && *salt != salttmp) diff --git a/deps/openssl/openssl/crypto/store/loader_file.c b/deps/openssl/openssl/crypto/store/loader_file.c index 9c9e3bd085068c..32e7b9f65a4174 100644 --- a/deps/openssl/openssl/crypto/store/loader_file.c +++ b/deps/openssl/openssl/crypto/store/loader_file.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -370,6 +370,7 @@ static OSSL_STORE_INFO *try_decode_PKCS8Encrypted(const char *pem_name, mem->data = (char *)new_data; mem->max = mem->length = (size_t)new_data_len; X509_SIG_free(p8); + p8 = NULL; store_info = ossl_store_info_new_EMBEDDED(PEM_STRING_PKCS8INF, mem); if (store_info == NULL) { diff --git a/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c b/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c index c2e7abd67f5096..7fe3d27e74a2c1 100644 --- a/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c +++ b/deps/openssl/openssl/crypto/ts/ts_rsp_verify.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -612,6 +612,7 @@ static int ts_compute_imprint(BIO *data, TS_TST_INFO *tst_info, err: EVP_MD_CTX_free(md_ctx); X509_ALGOR_free(*md_alg); + *md_alg = NULL; OPENSSL_free(*imprint); *imprint_len = 0; *imprint = 0; diff --git a/deps/openssl/openssl/crypto/ts/ts_verify_ctx.c b/deps/openssl/openssl/crypto/ts/ts_verify_ctx.c index 1e80e0d3702966..32cd2f542bb756 100644 --- a/deps/openssl/openssl/crypto/ts/ts_verify_ctx.c +++ b/deps/openssl/openssl/crypto/ts/ts_verify_ctx.c @@ -1,5 +1,5 @@ /* - * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -126,6 +126,8 @@ TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx) goto err; msg = imprint->hashed_msg; ret->imprint_len = ASN1_STRING_length(msg); + if (ret->imprint_len <= 0) + goto err; if ((ret->imprint = OPENSSL_malloc(ret->imprint_len)) == NULL) goto err; memcpy(ret->imprint, ASN1_STRING_get0_data(msg), ret->imprint_len); diff --git a/deps/openssl/openssl/crypto/uid.c b/deps/openssl/openssl/crypto/uid.c index 65b1171039fe5a..5e3315eeb2e388 100644 --- a/deps/openssl/openssl/crypto/uid.c +++ b/deps/openssl/openssl/crypto/uid.c @@ -1,5 +1,5 @@ /* - * Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -36,6 +36,12 @@ int OPENSSL_issetugid(void) # include # define OSSL_IMPLEMENT_GETAUXVAL # endif +# elif defined(__ANDROID_API__) +/* see https://developer.android.google.cn/ndk/guides/cpu-features */ +# if __ANDROID_API__ >= 18 +# include +# define OSSL_IMPLEMENT_GETAUXVAL +# endif # endif int OPENSSL_issetugid(void) diff --git a/deps/openssl/openssl/crypto/x509/t_x509.c b/deps/openssl/openssl/crypto/x509/t_x509.c index 12d807f705ede5..ece987a6bdbec3 100644 --- a/deps/openssl/openssl/crypto/x509/t_x509.c +++ b/deps/openssl/openssl/crypto/x509/t_x509.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -365,9 +365,9 @@ int X509_aux_print(BIO *out, X509 *x, int indent) BIO_puts(out, "\n"); } else BIO_printf(out, "%*sNo Rejected Uses.\n", indent, ""); - alias = X509_alias_get0(x, NULL); + alias = X509_alias_get0(x, &i); if (alias) - BIO_printf(out, "%*sAlias: %s\n", indent, "", alias); + BIO_printf(out, "%*sAlias: %.*s\n", indent, "", i, alias); keyid = X509_keyid_get0(x, &keyidlen); if (keyid) { BIO_printf(out, "%*sKey Id: ", indent, ""); diff --git a/deps/openssl/openssl/crypto/x509/x509_vpm.c b/deps/openssl/openssl/crypto/x509/x509_vpm.c index 68b681d5ee854a..535f169a29e70e 100644 --- a/deps/openssl/openssl/crypto/x509/x509_vpm.c +++ b/deps/openssl/openssl/crypto/x509/x509_vpm.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -199,7 +199,8 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest, return 0; } - /* Copy the host flags if and only if we're copying the host list */ + x509_verify_param_copy(hostflags, 0); + if (test_x509_verify_param_copy(hosts, NULL)) { sk_OPENSSL_STRING_pop_free(dest->hosts, str_free); dest->hosts = NULL; @@ -208,7 +209,6 @@ int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest, sk_OPENSSL_STRING_deep_copy(src->hosts, str_copy, str_free); if (dest->hosts == NULL) return 0; - dest->hostflags = src->hostflags; } } diff --git a/deps/openssl/openssl/crypto/x509v3/v3_akey.c b/deps/openssl/openssl/crypto/x509v3/v3_akey.c index d9f770433cfb61..33b1933d7228d0 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3_akey.c +++ b/deps/openssl/openssl/crypto/x509v3/v3_akey.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -39,20 +39,48 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, STACK_OF(CONF_VALUE) *extlist) { - char *tmp; + char *tmp = NULL; + STACK_OF(CONF_VALUE) *origextlist = extlist, *tmpextlist; + if (akeyid->keyid) { tmp = OPENSSL_buf2hexstr(akeyid->keyid->data, akeyid->keyid->length); - X509V3_add_value("keyid", tmp, &extlist); + if (tmp == NULL) { + X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_MALLOC_FAILURE); + return NULL; + } + if (!X509V3_add_value("keyid", tmp, &extlist)) { + OPENSSL_free(tmp); + X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_X509_LIB); + goto err; + } OPENSSL_free(tmp); } - if (akeyid->issuer) - extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist); + if (akeyid->issuer) { + tmpextlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist); + if (tmpextlist == NULL) { + X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_X509_LIB); + goto err; + } + extlist = tmpextlist; + } if (akeyid->serial) { tmp = OPENSSL_buf2hexstr(akeyid->serial->data, akeyid->serial->length); - X509V3_add_value("serial", tmp, &extlist); + if (tmp == NULL) { + X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_MALLOC_FAILURE); + goto err; + } + if (!X509V3_add_value("serial", tmp, &extlist)) { + OPENSSL_free(tmp); + X509V3err(X509V3_F_I2V_AUTHORITY_KEYID, ERR_R_X509_LIB); + goto err; + } OPENSSL_free(tmp); } return extlist; + err: + if (origextlist == NULL) + sk_CONF_VALUE_pop_free(extlist, X509V3_conf_free); + return NULL; } /*- diff --git a/deps/openssl/openssl/crypto/x509v3/v3_alt.c b/deps/openssl/openssl/crypto/x509v3/v3_alt.c index 4dce0041012e44..7c32d4031d1142 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3_alt.c +++ b/deps/openssl/openssl/crypto/x509v3/v3_alt.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -9,6 +9,7 @@ #include #include "internal/cryptlib.h" +#include "crypto/x509.h" #include #include #include "ext_dat.h" @@ -99,17 +100,20 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, break; case GEN_EMAIL: - if (!X509V3_add_value_uchar("email", gen->d.ia5->data, &ret)) + if (!x509v3_add_len_value_uchar("email", gen->d.ia5->data, + gen->d.ia5->length, &ret)) return NULL; break; case GEN_DNS: - if (!X509V3_add_value_uchar("DNS", gen->d.ia5->data, &ret)) + if (!x509v3_add_len_value_uchar("DNS", gen->d.ia5->data, + gen->d.ia5->length, &ret)) return NULL; break; case GEN_URI: - if (!X509V3_add_value_uchar("URI", gen->d.ia5->data, &ret)) + if (!x509v3_add_len_value_uchar("URI", gen->d.ia5->data, + gen->d.ia5->length, &ret)) return NULL; break; diff --git a/deps/openssl/openssl/crypto/x509v3/v3_cpols.c b/deps/openssl/openssl/crypto/x509v3/v3_cpols.c index 1d12c899125c85..09804b58482cf7 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3_cpols.c +++ b/deps/openssl/openssl/crypto/x509v3/v3_cpols.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -422,7 +422,8 @@ static void print_qualifiers(BIO *out, STACK_OF(POLICYQUALINFO) *quals, qualinfo = sk_POLICYQUALINFO_value(quals, i); switch (OBJ_obj2nid(qualinfo->pqualid)) { case NID_id_qt_cps: - BIO_printf(out, "%*sCPS: %s\n", indent, "", + BIO_printf(out, "%*sCPS: %.*s\n", indent, "", + qualinfo->d.cpsuri->length, qualinfo->d.cpsuri->data); break; @@ -447,7 +448,8 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent) if (notice->noticeref) { NOTICEREF *ref; ref = notice->noticeref; - BIO_printf(out, "%*sOrganization: %s\n", indent, "", + BIO_printf(out, "%*sOrganization: %.*s\n", indent, "", + ref->organization->length, ref->organization->data); BIO_printf(out, "%*sNumber%s: ", indent, "", sk_ASN1_INTEGER_num(ref->noticenos) > 1 ? "s" : ""); @@ -470,7 +472,8 @@ static void print_notice(BIO *out, USERNOTICE *notice, int indent) BIO_puts(out, "\n"); } if (notice->exptext) - BIO_printf(out, "%*sExplicit Text: %s\n", indent, "", + BIO_printf(out, "%*sExplicit Text: %.*s\n", indent, "", + notice->exptext->length, notice->exptext->data); } diff --git a/deps/openssl/openssl/crypto/x509v3/v3_ncons.c b/deps/openssl/openssl/crypto/x509v3/v3_ncons.c index 2a7b4f0992a813..d985aa91dacd39 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3_ncons.c +++ b/deps/openssl/openssl/crypto/x509v3/v3_ncons.c @@ -1,5 +1,5 @@ /* - * Copyright 2003-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -63,8 +63,31 @@ ASN1_SEQUENCE(NAME_CONSTRAINTS) = { IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +#define IA5_OFFSET_LEN(ia5base, offset) \ + ((ia5base)->length - ((unsigned char *)(offset) - (ia5base)->data)) + +/* Like memchr but for ASN1_IA5STRING. Additionally you can specify the + * starting point to search from + */ +# define ia5memchr(str, start, c) memchr(start, c, IA5_OFFSET_LEN(str, start)) + +/* Like memrrchr but for ASN1_IA5STRING */ +static char *ia5memrchr(ASN1_IA5STRING *str, int c) +{ + int i; + + for (i = str->length; i > 0 && str->data[i - 1] != c; i--); + + if (i == 0) + return NULL; + + return (char *)&str->data[i - 1]; +} + /* - * We cannot use strncasecmp here because that applies locale specific rules. + * We cannot use strncasecmp here because that applies locale specific rules. It + * also doesn't work with ASN1_STRINGs that may have embedded NUL characters. * For example in Turkish 'I' is not the uppercase character for 'i'. We need to * do a simple ASCII case comparison ignoring the locale (that is why we use * numeric constants below). @@ -89,20 +112,12 @@ static int ia5ncasecmp(const char *s1, const char *s2, size_t n) /* c1 > c2 */ return 1; - } else if (*s1 == 0) { - /* If we get here we know that *s2 == 0 too */ - return 0; } } return 0; } -static int ia5casecmp(const char *s1, const char *s2) -{ - return ia5ncasecmp(s1, s2, SIZE_MAX); -} - static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval) { @@ -337,7 +352,7 @@ static int cn2dnsid(ASN1_STRING *cn, unsigned char **dnsid, size_t *idlen) --utf8_length; /* Reject *embedded* NULs */ - if ((size_t)utf8_length != strlen((char *)utf8_value)) { + if (memchr(utf8_value, 0, utf8_length) != NULL) { OPENSSL_free(utf8_value); return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX; } @@ -536,9 +551,14 @@ static int nc_dns(ASN1_IA5STRING *dns, ASN1_IA5STRING *base) { char *baseptr = (char *)base->data; char *dnsptr = (char *)dns->data; + /* Empty matches everything */ - if (!*baseptr) + if (base->length == 0) return X509_V_OK; + + if (dns->length < base->length) + return X509_V_ERR_PERMITTED_VIOLATION; + /* * Otherwise can add zero or more components on the left so compare RHS * and if dns is longer and expect '.' as preceding character. @@ -549,7 +569,7 @@ static int nc_dns(ASN1_IA5STRING *dns, ASN1_IA5STRING *base) return X509_V_ERR_PERMITTED_VIOLATION; } - if (ia5casecmp(baseptr, dnsptr)) + if (ia5ncasecmp(baseptr, dnsptr, base->length)) return X509_V_ERR_PERMITTED_VIOLATION; return X509_V_OK; @@ -560,16 +580,17 @@ static int nc_email(ASN1_IA5STRING *eml, ASN1_IA5STRING *base) { const char *baseptr = (char *)base->data; const char *emlptr = (char *)eml->data; + const char *baseat = ia5memrchr(base, '@'); + const char *emlat = ia5memrchr(eml, '@'); + size_t basehostlen, emlhostlen; - const char *baseat = strchr(baseptr, '@'); - const char *emlat = strchr(emlptr, '@'); if (!emlat) return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX; /* Special case: initial '.' is RHS match */ - if (!baseat && (*baseptr == '.')) { + if (!baseat && base->length > 0 && (*baseptr == '.')) { if (eml->length > base->length) { emlptr += eml->length - base->length; - if (ia5casecmp(baseptr, emlptr) == 0) + if (ia5ncasecmp(baseptr, emlptr, base->length) == 0) return X509_V_OK; } return X509_V_ERR_PERMITTED_VIOLATION; @@ -589,8 +610,10 @@ static int nc_email(ASN1_IA5STRING *eml, ASN1_IA5STRING *base) baseptr = baseat + 1; } emlptr = emlat + 1; + basehostlen = IA5_OFFSET_LEN(base, baseptr); + emlhostlen = IA5_OFFSET_LEN(eml, emlptr); /* Just have hostname left to match: case insensitive */ - if (ia5casecmp(baseptr, emlptr)) + if (basehostlen != emlhostlen || ia5ncasecmp(baseptr, emlptr, emlhostlen)) return X509_V_ERR_PERMITTED_VIOLATION; return X509_V_OK; @@ -601,10 +624,14 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base) { const char *baseptr = (char *)base->data; const char *hostptr = (char *)uri->data; - const char *p = strchr(hostptr, ':'); + const char *p = ia5memchr(uri, (char *)uri->data, ':'); int hostlen; + /* Check for foo:// and skip past it */ - if (!p || (p[1] != '/') || (p[2] != '/')) + if (p == NULL + || IA5_OFFSET_LEN(uri, p) < 3 + || p[1] != '/' + || p[2] != '/') return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX; hostptr = p + 3; @@ -612,13 +639,13 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base) /* Look for a port indicator as end of hostname first */ - p = strchr(hostptr, ':'); + p = ia5memchr(uri, hostptr, ':'); /* Otherwise look for trailing slash */ - if (!p) - p = strchr(hostptr, '/'); + if (p == NULL) + p = ia5memchr(uri, hostptr, '/'); - if (!p) - hostlen = strlen(hostptr); + if (p == NULL) + hostlen = IA5_OFFSET_LEN(uri, hostptr); else hostlen = p - hostptr; @@ -626,7 +653,7 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base) return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX; /* Special case: initial '.' is RHS match */ - if (*baseptr == '.') { + if (base->length > 0 && *baseptr == '.') { if (hostlen > base->length) { p = hostptr + hostlen - base->length; if (ia5ncasecmp(p, baseptr, base->length) == 0) diff --git a/deps/openssl/openssl/crypto/x509v3/v3_pci.c b/deps/openssl/openssl/crypto/x509v3/v3_pci.c index 3d124fa6d95d61..532d4e192fec5c 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3_pci.c +++ b/deps/openssl/openssl/crypto/x509v3/v3_pci.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -77,7 +77,8 @@ static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *pci, i2a_ASN1_OBJECT(out, pci->proxyPolicy->policyLanguage); BIO_puts(out, "\n"); if (pci->proxyPolicy->policy && pci->proxyPolicy->policy->data) - BIO_printf(out, "%*sPolicy Text: %s\n", indent, "", + BIO_printf(out, "%*sPolicy Text: %.*s\n", indent, "", + pci->proxyPolicy->policy->length, pci->proxyPolicy->policy->data); return 1; } diff --git a/deps/openssl/openssl/crypto/x509v3/v3_utl.c b/deps/openssl/openssl/crypto/x509v3/v3_utl.c index 7281a7b917a8cc..f41c699b5af04e 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3_utl.c +++ b/deps/openssl/openssl/crypto/x509v3/v3_utl.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -12,6 +12,7 @@ #include "e_os.h" #include "internal/cryptlib.h" #include +#include #include "crypto/ctype.h" #include #include @@ -34,17 +35,26 @@ static int ipv6_hex(unsigned char *out, const char *in, int inlen); /* Add a CONF_VALUE name value pair to stack */ -int X509V3_add_value(const char *name, const char *value, - STACK_OF(CONF_VALUE) **extlist) +static int x509v3_add_len_value(const char *name, const char *value, + size_t vallen, STACK_OF(CONF_VALUE) **extlist) { CONF_VALUE *vtmp = NULL; char *tname = NULL, *tvalue = NULL; int sk_allocated = (*extlist == NULL); - if (name && (tname = OPENSSL_strdup(name)) == NULL) - goto err; - if (value && (tvalue = OPENSSL_strdup(value)) == NULL) + if (name != NULL && (tname = OPENSSL_strdup(name)) == NULL) goto err; + if (value != NULL && vallen > 0) { + /* + * We tolerate a single trailing NUL character, but otherwise no + * embedded NULs + */ + if (memchr(value, 0, vallen - 1) != NULL) + goto err; + tvalue = OPENSSL_strndup(value, vallen); + if (tvalue == NULL) + goto err; + } if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) goto err; if (sk_allocated && (*extlist = sk_CONF_VALUE_new_null()) == NULL) @@ -56,7 +66,7 @@ int X509V3_add_value(const char *name, const char *value, goto err; return 1; err: - X509V3err(X509V3_F_X509V3_ADD_VALUE, ERR_R_MALLOC_FAILURE); + X509V3err(X509V3_F_X509V3_ADD_LEN_VALUE, ERR_R_MALLOC_FAILURE); if (sk_allocated) { sk_CONF_VALUE_free(*extlist); *extlist = NULL; @@ -67,10 +77,26 @@ int X509V3_add_value(const char *name, const char *value, return 0; } +int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist) +{ + return x509v3_add_len_value(name, value, + value != NULL ? strlen((const char *)value) : 0, + extlist); +} + int X509V3_add_value_uchar(const char *name, const unsigned char *value, STACK_OF(CONF_VALUE) **extlist) { - return X509V3_add_value(name, (const char *)value, extlist); + return x509v3_add_len_value(name, (const char *)value, + value != NULL ? strlen((const char *)value) : 0, + extlist); +} + +int x509v3_add_len_value_uchar(const char *name, const unsigned char *value, + size_t vallen, STACK_OF(CONF_VALUE) **extlist) +{ + return x509v3_add_len_value(name, (const char *)value, vallen, extlist); } /* Free function for STACK_OF(CONF_VALUE) */ @@ -502,18 +528,26 @@ static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, const ASN1_IA5STRING *email /* First some sanity checks */ if (email->type != V_ASN1_IA5STRING) return 1; - if (!email->data || !email->length) + if (email->data == NULL || email->length == 0) + return 1; + if (memchr(email->data, 0, email->length) != NULL) return 1; if (*sk == NULL) *sk = sk_OPENSSL_STRING_new(sk_strcmp); if (*sk == NULL) return 0; + + emtmp = OPENSSL_strndup((char *)email->data, email->length); + if (emtmp == NULL) + return 0; + /* Don't add duplicates */ - if (sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1) + if (sk_OPENSSL_STRING_find(*sk, emtmp) != -1) { + OPENSSL_free(emtmp); return 1; - emtmp = OPENSSL_strdup((char *)email->data); - if (emtmp == NULL || !sk_OPENSSL_STRING_push(*sk, emtmp)) { - OPENSSL_free(emtmp); /* free on push failure */ + } + if (!sk_OPENSSL_STRING_push(*sk, emtmp)) { + OPENSSL_free(emtmp); /* free on push failure */ X509_email_free(*sk); *sk = NULL; return 0; diff --git a/deps/openssl/openssl/crypto/x509v3/v3err.c b/deps/openssl/openssl/crypto/x509v3/v3err.c index 4f2ea52a4a5f17..8b2918a64fff56 100644 --- a/deps/openssl/openssl/crypto/x509v3/v3err.c +++ b/deps/openssl/openssl/crypto/x509v3/v3err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -39,6 +39,8 @@ static const ERR_STRING_DATA X509V3_str_functs[] = { "i2s_ASN1_INTEGER"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_I2V_AUTHORITY_INFO_ACCESS, 0), "i2v_AUTHORITY_INFO_ACCESS"}, + {ERR_PACK(ERR_LIB_X509V3, X509V3_F_I2V_AUTHORITY_KEYID, 0), + "i2v_AUTHORITY_KEYID"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_LEVEL_ADD_NODE, 0), "level_add_node"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_NOTICE_SECTION, 0), "notice_section"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_NREF_NOS, 0), "nref_nos"}, @@ -104,6 +106,8 @@ static const ERR_STRING_DATA X509V3_str_functs[] = { {ERR_PACK(ERR_LIB_X509V3, X509V3_F_V3_GENERIC_EXTENSION, 0), "v3_generic_extension"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_ADD1_I2D, 0), "X509V3_add1_i2d"}, + {ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_ADD_LEN_VALUE, 0), + "x509v3_add_len_value"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_ADD_VALUE, 0), "X509V3_add_value"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_X509V3_EXT_ADD, 0), "X509V3_EXT_add"}, diff --git a/deps/openssl/openssl/demos/bio/client-arg.c b/deps/openssl/openssl/demos/bio/client-arg.c index e8d5e46ab5365d..d51c43c457f328 100644 --- a/deps/openssl/openssl/demos/bio/client-arg.c +++ b/deps/openssl/openssl/demos/bio/client-arg.c @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -94,12 +94,6 @@ int main(int argc, char **argv) goto end; } - if (BIO_do_handshake(sbio) <= 0) { - fprintf(stderr, "Error establishing SSL connection\n"); - ERR_print_errors_fp(stderr); - goto end; - } - /* Could examine ssl here to get connection info */ BIO_puts(sbio, "GET / HTTP/1.0\n\n"); diff --git a/deps/openssl/openssl/demos/bio/client-conf.c b/deps/openssl/openssl/demos/bio/client-conf.c index e819030eecf747..cb5c729ee66367 100644 --- a/deps/openssl/openssl/demos/bio/client-conf.c +++ b/deps/openssl/openssl/demos/bio/client-conf.c @@ -1,5 +1,5 @@ /* - * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -102,12 +102,6 @@ int main(int argc, char **argv) goto end; } - if (BIO_do_handshake(sbio) <= 0) { - fprintf(stderr, "Error establishing SSL connection\n"); - ERR_print_errors_fp(stderr); - goto end; - } - /* Could examine ssl here to get connection info */ BIO_puts(sbio, "GET / HTTP/1.0\n\n"); diff --git a/deps/openssl/openssl/doc/man1/enc.pod b/deps/openssl/openssl/doc/man1/enc.pod index 3c7b6c42ea2ca5..9068282db5431b 100644 --- a/deps/openssl/openssl/doc/man1/enc.pod +++ b/deps/openssl/openssl/doc/man1/enc.pod @@ -180,8 +180,8 @@ Debug the BIOs used for I/O. =item B<-z> -Compress or decompress clear text using zlib before encryption or after -decryption. This option exists only if OpenSSL with compiled with zlib +Compress or decompress encrypted data using zlib after encryption or before +decryption. This option exists only if OpenSSL was compiled with the zlib or zlib-dynamic option. =item B<-none> diff --git a/deps/openssl/openssl/doc/man1/s_client.pod b/deps/openssl/openssl/doc/man1/s_client.pod index 743b2db2ba434d..f1a2c4abdf535c 100644 --- a/deps/openssl/openssl/doc/man1/s_client.pod +++ b/deps/openssl/openssl/doc/man1/s_client.pod @@ -797,7 +797,7 @@ server. The B utility is a test tool and is designed to continue the handshake after any certificate verification errors. As a result it will -accept any certificate chain (trusted or not) sent by the peer. None test +accept any certificate chain (trusted or not) sent by the peer. Non-test applications should B do this as it makes them vulnerable to a MITM attack. This behaviour can be changed by with the B<-verify_return_error> option: any verify errors are then returned aborting the handshake. diff --git a/deps/openssl/openssl/doc/man1/s_server.pod b/deps/openssl/openssl/doc/man1/s_server.pod index 9fdac491903821..aa6c19d31f9a8c 100644 --- a/deps/openssl/openssl/doc/man1/s_server.pod +++ b/deps/openssl/openssl/doc/man1/s_server.pod @@ -701,7 +701,7 @@ disabling the ephemeral DH cipher suites. =item B<-alpn val>, B<-nextprotoneg val> -These flags enable the Enable the Application-Layer Protocol Negotiation +These flags enable the Application-Layer Protocol Negotiation or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the IETF standard and replaces NPN. The B list is a comma-separated list of supported protocol diff --git a/deps/openssl/openssl/doc/man3/BIO_f_ssl.pod b/deps/openssl/openssl/doc/man3/BIO_f_ssl.pod index 59cccbd4e59791..641ee2329efc1e 100644 --- a/deps/openssl/openssl/doc/man3/BIO_f_ssl.pod +++ b/deps/openssl/openssl/doc/man3/BIO_f_ssl.pod @@ -185,11 +185,6 @@ unencrypted example in L. ERR_print_errors_fp(stderr); exit(1); } - if (BIO_do_handshake(sbio) <= 0) { - fprintf(stderr, "Error establishing SSL connection\n"); - ERR_print_errors_fp(stderr); - exit(1); - } /* XXX Could examine ssl here to get connection info */ @@ -298,7 +293,7 @@ be modified to handle this fix or they may free up an already freed BIO. =head1 COPYRIGHT -Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/doc/man3/BIO_push.pod b/deps/openssl/openssl/doc/man3/BIO_push.pod index 93f2cc31fdae5a..8b98bee498852f 100644 --- a/deps/openssl/openssl/doc/man3/BIO_push.pod +++ b/deps/openssl/openssl/doc/man3/BIO_push.pod @@ -61,8 +61,8 @@ the new chain is B. Data written to B will be digested by B and B, B encoded and written to B. It should be noted that reading causes data to pass in the reverse -direction, that is data is read from B, base64 B and digested -by B and B. If the call: +direction, that is data is read from B, B decoded and digested +by B and B. If the call: BIO_pop(md2); @@ -79,7 +79,7 @@ The BIO_set_next() function was added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/doc/man3/BN_cmp.pod b/deps/openssl/openssl/doc/man3/BN_cmp.pod index 95d162ff295793..261619c512abaa 100644 --- a/deps/openssl/openssl/doc/man3/BN_cmp.pod +++ b/deps/openssl/openssl/doc/man3/BN_cmp.pod @@ -2,42 +2,47 @@ =head1 NAME -BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_is_odd - BIGNUM comparison and test functions +BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_abs_is_word, BN_is_odd - BIGNUM comparison and test functions =head1 SYNOPSIS #include - int BN_cmp(BIGNUM *a, BIGNUM *b); - int BN_ucmp(BIGNUM *a, BIGNUM *b); + int BN_cmp(const BIGNUM *a, const BIGNUM *b); + int BN_ucmp(const BIGNUM *a, const BIGNUM *b); - int BN_is_zero(BIGNUM *a); - int BN_is_one(BIGNUM *a); - int BN_is_word(BIGNUM *a, BN_ULONG w); - int BN_is_odd(BIGNUM *a); + int BN_is_zero(const BIGNUM *a); + int BN_is_one(const BIGNUM *a); + int BN_is_word(const BIGNUM *a, const BN_ULONG w); + int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); + int BN_is_odd(const BIGNUM *a); =head1 DESCRIPTION -BN_cmp() compares the numbers B and B. BN_ucmp() compares their +BN_cmp() compares the numbers I and I. BN_ucmp() compares their absolute values. -BN_is_zero(), BN_is_one() and BN_is_word() test if B equals 0, 1, -or B respectively. BN_is_odd() tests if a is odd. - -BN_is_zero(), BN_is_one(), BN_is_word() and BN_is_odd() are macros. +BN_is_zero(), BN_is_one(), BN_is_word() and BN_abs_is_word() test if +I equals 0, 1, I, or EIE respectively. +BN_is_odd() tests if I is odd. =head1 RETURN VALUES -BN_cmp() returns -1 if B E B, 0 if B == B and 1 if -B E B. BN_ucmp() is the same using the absolute values -of B and B. +BN_cmp() returns -1 if I E I, 0 if I == I and 1 if +I E I. BN_ucmp() is the same using the absolute values +of I and I. + +BN_is_zero(), BN_is_one() BN_is_word(), BN_abs_is_word() and +BN_is_odd() return 1 if the condition is true, 0 otherwise. + +=head1 HISTORY -BN_is_zero(), BN_is_one() BN_is_word() and BN_is_odd() return 1 if -the condition is true, 0 otherwise. +Prior to OpenSSL 1.1.0, BN_is_zero(), BN_is_one(), BN_is_word(), +BN_abs_is_word() and BN_is_odd() were macros. =head1 COPYRIGHT -Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/doc/man3/SSL_CTX_set_num_tickets.pod b/deps/openssl/openssl/doc/man3/SSL_CTX_set_num_tickets.pod index ad13ed15f40658..67d9b7b2cab444 100644 --- a/deps/openssl/openssl/doc/man3/SSL_CTX_set_num_tickets.pod +++ b/deps/openssl/openssl/doc/man3/SSL_CTX_set_num_tickets.pod @@ -5,7 +5,8 @@ SSL_set_num_tickets, SSL_get_num_tickets, SSL_CTX_set_num_tickets, -SSL_CTX_get_num_tickets +SSL_CTX_get_num_tickets, +SSL_new_session_ticket - control the number of TLSv1.3 session tickets that are issued =head1 SYNOPSIS @@ -16,6 +17,7 @@ SSL_CTX_get_num_tickets size_t SSL_get_num_tickets(SSL *s); int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); size_t SSL_CTX_get_num_tickets(SSL_CTX *ctx); + int SSL_new_session_ticket(SSL *s); =head1 DESCRIPTION @@ -40,21 +42,43 @@ handshake then SSL_set_num_tickets() can be called again prior to calling SSL_verify_client_post_handshake() to update the number of tickets that will be sent. +To issue tickets after other events (such as application-layer changes), +SSL_new_session_ticket() is used by a server application to request that a new +ticket be sent when it is safe to do so. New tickets are only allowed to be +sent in this manner after the initial handshake has completed, and only for +TLS 1.3 connections. By default, the ticket generation and transmission are +delayed until the server is starting a new write operation, so that it is +bundled with other application data being written and properly aligned to a +record boundary. If the connection was at a record boundary when +SSL_new_session_ticket() was called, the ticket can be sent immediately +(without waiting for the next application write) by calling +SSL_do_handshake(). SSL_new_session_ticket() can be called more than once to +request additional tickets be sent; all such requests are queued and written +together when it is safe to do so and triggered by SSL_write() or +SSL_do_handshake(). Note that a successful return from +SSL_new_session_ticket() indicates only that the request to send a ticket was +processed, not that the ticket itself was sent. To be notified when the +ticket itself is sent, a new-session callback can be registered with +L that will be invoked as the ticket or tickets +are generated. + SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets set by a previous call to SSL_CTX_set_num_tickets() or SSL_set_num_tickets(), or 2 if no such call has been made. =head1 RETURN VALUES -SSL_CTX_set_num_tickets() and SSL_set_num_tickets() return 1 on success or 0 on -failure. +SSL_CTX_set_num_tickets(), SSL_set_num_tickets(), and +SSL_new_session_ticket() return 1 on success or 0 on failure. SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets that have been previously set. =head1 HISTORY -These functions were added in OpenSSL 1.1.1. +SSL_new_session_ticket() was added in OpenSSL 3.0.0. +SSL_set_num_tickets(), SSL_get_num_tickets(), SSL_CTX_set_num_tickets(), and +SSL_CTX_get_num_tickets() were added in OpenSSL 1.1.1. =head1 COPYRIGHT diff --git a/deps/openssl/openssl/doc/man3/d2i_PrivateKey.pod b/deps/openssl/openssl/doc/man3/d2i_PrivateKey.pod index 4e3f20f8b324b7..e7272595bc4040 100644 --- a/deps/openssl/openssl/doc/man3/d2i_PrivateKey.pod +++ b/deps/openssl/openssl/doc/man3/d2i_PrivateKey.pod @@ -42,6 +42,10 @@ These functions are similar to the d2i_X509() functions; see L. =head1 NOTES +All the functions that operate on data in memory update the data pointer I<*pp> +after a successful operation, just like the other d2i and i2d functions; +see L. + All these functions use DER format and unencrypted keys. Applications wishing to encrypt or decrypt private keys should use other functions such as d2i_PKCS8PrivateKey() instead. @@ -71,7 +75,7 @@ L =head1 COPYRIGHT -Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/doc/man7/x509.pod b/deps/openssl/openssl/doc/man7/x509.pod index 065dcb14fbeb87..7274e5ce95528f 100644 --- a/deps/openssl/openssl/doc/man7/x509.pod +++ b/deps/openssl/openssl/doc/man7/x509.pod @@ -11,7 +11,7 @@ x509 - X.509 certificate handling =head1 DESCRIPTION An X.509 certificate is a structured grouping of information about -an individual, a device, or anything one can imagine. A X.509 CRL +an individual, a device, or anything one can imagine. An X.509 CRL (certificate revocation list) is a tool to help determine if a certificate is still valid. The exact definition of those can be found in the X.509 document from ITU-T, or in RFC3280 from PKIX. @@ -24,7 +24,7 @@ X509_REQ is used to express such a certificate request. To handle some complex parts of a certificate, there are the types X509_NAME (to express a certificate name), X509_ATTRIBUTE (to express -a certificate attributes), X509_EXTENSION (to express a certificate +a certificate attribute), X509_EXTENSION (to express a certificate extension) and a few more. Finally, there's the supertype X509_INFO, which can contain a CRL, a @@ -63,7 +63,7 @@ L =head1 COPYRIGHT -Copyright 2003-2017 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/deps/openssl/openssl/include/crypto/sm2.h b/deps/openssl/openssl/include/crypto/sm2.h index 76ee80baff1923..a7f5548c08437e 100644 --- a/deps/openssl/openssl/include/crypto/sm2.h +++ b/deps/openssl/openssl/include/crypto/sm2.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2017 Ribose Inc. All Rights Reserved. * Ported from Ribose contributions from Botan. * @@ -60,8 +60,7 @@ int sm2_verify(const unsigned char *dgst, int dgstlen, int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, size_t *ct_size); -int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, - size_t *pt_size); +int sm2_plaintext_size(const unsigned char *ct, size_t ct_size, size_t *pt_size); int sm2_encrypt(const EC_KEY *key, const EVP_MD *digest, diff --git a/deps/openssl/openssl/include/crypto/x509.h b/deps/openssl/openssl/include/crypto/x509.h index b53c2b03c39ec4..243ea74f6f4ece 100644 --- a/deps/openssl/openssl/include/crypto/x509.h +++ b/deps/openssl/openssl/include/crypto/x509.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -8,6 +8,8 @@ */ #include "internal/refcount.h" +#include +#include /* Internal X509 structures and functions: not for application use */ @@ -284,3 +286,6 @@ int a2i_ipadd(unsigned char *ipout, const char *ipasc); int x509_set1_time(ASN1_TIME **ptm, const ASN1_TIME *tm); void x509_init_sig_info(X509 *x); + +int x509v3_add_len_value_uchar(const char *name, const unsigned char *value, + size_t vallen, STACK_OF(CONF_VALUE) **extlist); diff --git a/deps/openssl/openssl/include/openssl/e_os2.h b/deps/openssl/openssl/include/openssl/e_os2.h index cf308eee2cd252..5c88e5194919b4 100644 --- a/deps/openssl/openssl/include/openssl/e_os2.h +++ b/deps/openssl/openssl/include/openssl/e_os2.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -279,7 +279,8 @@ typedef unsigned __int64 uint64_t; # define ossl_inline inline # endif -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \ + !defined(__cplusplus) # define ossl_noreturn _Noreturn # elif defined(__GNUC__) && __GNUC__ >= 2 # define ossl_noreturn __attribute__((noreturn)) diff --git a/deps/openssl/openssl/include/openssl/opensslv.h b/deps/openssl/openssl/include/openssl/opensslv.h index 44b464e5263f26..a8b71e511418d4 100644 --- a/deps/openssl/openssl/include/openssl/opensslv.h +++ b/deps/openssl/openssl/include/openssl/opensslv.h @@ -39,8 +39,8 @@ extern "C" { * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ -# define OPENSSL_VERSION_NUMBER 0x101010bfL -# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1k+quic 25 Mar 2021" +# define OPENSSL_VERSION_NUMBER 0x101010cfL +# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1l+quic 24 Aug 2021" /*- * The macros below are to be used for shared library (.so, .dll, ...) diff --git a/deps/openssl/openssl/include/openssl/ssl.h b/deps/openssl/openssl/include/openssl/ssl.h index c6f8e4d180106c..17bd0bc2c9c9ce 100644 --- a/deps/openssl/openssl/include/openssl/ssl.h +++ b/deps/openssl/openssl/include/openssl/ssl.h @@ -1921,6 +1921,7 @@ int SSL_get_key_update_type(const SSL *s); int SSL_renegotiate(SSL *s); int SSL_renegotiate_abbreviated(SSL *s); __owur int SSL_renegotiate_pending(const SSL *s); +int SSL_new_session_ticket(SSL *s); int SSL_shutdown(SSL *s); __owur int SSL_verify_client_post_handshake(SSL *s); void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); diff --git a/deps/openssl/openssl/include/openssl/sslerr.h b/deps/openssl/openssl/include/openssl/sslerr.h index 528c880e1f0cca..64e152cc517d54 100644 --- a/deps/openssl/openssl/include/openssl/sslerr.h +++ b/deps/openssl/openssl/include/openssl/sslerr.h @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -70,6 +70,7 @@ int ERR_load_SSL_strings(void); # define SSL_F_FINAL_EMS 486 # define SSL_F_FINAL_KEY_SHARE 503 # define SSL_F_FINAL_MAXFRAGMENTLEN 557 +# define SSL_F_FINAL_PSK 639 # define SSL_F_FINAL_QUIC_TRANSPORT_PARAMS 3012 # define SSL_F_FINAL_RENEGOTIATE 483 # define SSL_F_FINAL_SERVER_NAME 558 @@ -609,6 +610,7 @@ int ERR_load_SSL_strings(void); # define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 # define SSL_R_MISSING_FATAL 256 # define SSL_R_MISSING_PARAMETERS 290 +# define SSL_R_MISSING_PSK_KEX_MODES_EXTENSION 310 # define SSL_R_MISSING_QUIC_TRANSPORT_PARAMETERS_EXTENSION 801 # define SSL_R_MISSING_RSA_CERTIFICATE 168 # define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 @@ -651,6 +653,7 @@ int ERR_load_SSL_strings(void); # define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 # define SSL_R_NULL_SSL_CTX 195 # define SSL_R_NULL_SSL_METHOD_PASSED 196 +# define SSL_R_OCSP_CALLBACK_FAILURE 294 # define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 # define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 # define SSL_R_OVERFLOW_ERROR 237 diff --git a/deps/openssl/openssl/include/openssl/x509v3err.h b/deps/openssl/openssl/include/openssl/x509v3err.h index 5f25442f12fd34..3b9f7139d80e42 100644 --- a/deps/openssl/openssl/include/openssl/x509v3err.h +++ b/deps/openssl/openssl/include/openssl/x509v3err.h @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -38,6 +38,7 @@ int ERR_load_X509V3_strings(void); # define X509V3_F_I2S_ASN1_IA5STRING 149 # define X509V3_F_I2S_ASN1_INTEGER 120 # define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 +# define X509V3_F_I2V_AUTHORITY_KEYID 173 # define X509V3_F_LEVEL_ADD_NODE 168 # define X509V3_F_NOTICE_SECTION 132 # define X509V3_F_NREF_NOS 133 @@ -78,6 +79,7 @@ int ERR_load_X509V3_strings(void); # define X509V3_F_V2I_TLS_FEATURE 165 # define X509V3_F_V3_GENERIC_EXTENSION 116 # define X509V3_F_X509V3_ADD1_I2D 140 +# define X509V3_F_X509V3_ADD_LEN_VALUE 174 # define X509V3_F_X509V3_ADD_VALUE 105 # define X509V3_F_X509V3_EXT_ADD 104 # define X509V3_F_X509V3_EXT_ADD_ALIAS 106 diff --git a/deps/openssl/openssl/ssl/bio_ssl.c b/deps/openssl/openssl/ssl/bio_ssl.c index 53129bfb88111c..c4239345b63375 100644 --- a/deps/openssl/openssl/ssl/bio_ssl.c +++ b/deps/openssl/openssl/ssl/bio_ssl.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -451,6 +451,7 @@ BIO *BIO_new_ssl_connect(SSL_CTX *ctx) goto err; return ret; err: + BIO_free(ssl); BIO_free(con); #endif return NULL; diff --git a/deps/openssl/openssl/ssl/d1_lib.c b/deps/openssl/openssl/ssl/d1_lib.c index afbf015216a39f..05b85c1078c052 100644 --- a/deps/openssl/openssl/ssl/d1_lib.c +++ b/deps/openssl/openssl/ssl/d1_lib.c @@ -342,12 +342,11 @@ int dtls1_is_timer_expired(SSL *s) return 1; } -void dtls1_double_timeout(SSL *s) +static void dtls1_double_timeout(SSL *s) { s->d1->timeout_duration_us *= 2; if (s->d1->timeout_duration_us > 60000000) s->d1->timeout_duration_us = 60000000; - dtls1_start_timer(s); } void dtls1_stop_timer(SSL *s) diff --git a/deps/openssl/openssl/ssl/record/rec_layer_s3.c b/deps/openssl/openssl/ssl/record/rec_layer_s3.c index b2a7a47eb07529..cdc90ed0b39662 100644 --- a/deps/openssl/openssl/ssl/record/rec_layer_s3.c +++ b/deps/openssl/openssl/ssl/record/rec_layer_s3.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -172,9 +172,9 @@ int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold, /* * If extend == 0, obtain new n-byte packet; if extend == 1, increase * packet by another n bytes. The packet will be in the sub-array of - * s->s3->rbuf.buf specified by s->packet and s->packet_length. (If - * s->rlayer.read_ahead is set, 'max' bytes may be stored in rbuf [plus - * s->packet_length bytes if extend == 1].) + * s->rlayer.rbuf.buf specified by s->rlayer.packet and + * s->rlayer.packet_length. (If s->rlayer.read_ahead is set, 'max' bytes may + * be stored in rbuf [plus s->rlayer.packet_length bytes if extend == 1].) * if clearold == 1, move the packet to the start of the buffer; if * clearold == 0 then leave any old packets where they were */ @@ -374,10 +374,12 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, size_t len, s->rlayer.wnum = 0; /* - * If we are supposed to be sending a KeyUpdate then go into init unless we - * have writes pending - in which case we should finish doing that first. + * If we are supposed to be sending a KeyUpdate or NewSessionTicket then go + * into init unless we have writes pending - in which case we should finish + * doing that first. */ - if (wb->left == 0 && s->key_update != SSL_KEY_UPDATE_NONE) + if (wb->left == 0 && (s->key_update != SSL_KEY_UPDATE_NONE + || s->ext.extra_tickets_expected > 0)) ossl_statem_set_in_init(s, 1); /* diff --git a/deps/openssl/openssl/ssl/record/ssl3_buffer.c b/deps/openssl/openssl/ssl/record/ssl3_buffer.c index 9b2a6964c68912..b9ba25e0c3f824 100644 --- a/deps/openssl/openssl/ssl/record/ssl3_buffer.c +++ b/deps/openssl/openssl/ssl/record/ssl3_buffer.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -74,7 +74,6 @@ int ssl3_setup_read_buffer(SSL *s) b->len = len; } - RECORD_LAYER_set_packet(&s->rlayer, &(b->buf[0])); return 1; } diff --git a/deps/openssl/openssl/ssl/record/ssl3_record.c b/deps/openssl/openssl/ssl/record/ssl3_record.c index ab5d22aa10cb1d..e6a8bbd7107392 100644 --- a/deps/openssl/openssl/ssl/record/ssl3_record.c +++ b/deps/openssl/openssl/ssl/record/ssl3_record.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -405,7 +405,7 @@ int ssl3_get_record(SSL *s) more = thisrr->length; } if (more > 0) { - /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ + /* now s->rlayer.packet_length == SSL3_RT_HEADER_LENGTH */ rret = ssl3_read_n(s, more, more, 1, 0, &n); if (rret <= 0) @@ -416,9 +416,9 @@ int ssl3_get_record(SSL *s) RECORD_LAYER_set_rstate(&s->rlayer, SSL_ST_READ_HEADER); /* - * At this point, s->packet_length == SSL3_RT_HEADER_LENGTH - * + thisrr->length, or s->packet_length == SSL2_RT_HEADER_LENGTH - * + thisrr->length and we have that many bytes in s->packet + * At this point, s->rlayer.packet_length == SSL3_RT_HEADER_LENGTH + * + thisrr->length, or s->rlayer.packet_length == SSL2_RT_HEADER_LENGTH + * + thisrr->length and we have that many bytes in s->rlayer.packet */ if (thisrr->rec_version == SSL2_VERSION) { thisrr->input = @@ -429,11 +429,11 @@ int ssl3_get_record(SSL *s) } /* - * ok, we can now read from 's->packet' data into 'thisrr' thisrr->input - * points at thisrr->length bytes, which need to be copied into - * thisrr->data by either the decryption or by the decompression When - * the data is 'copied' into the thisrr->data buffer, thisrr->input will - * be pointed at the new buffer + * ok, we can now read from 's->rlayer.packet' data into 'thisrr'. + * thisrr->input points at thisrr->length bytes, which need to be copied + * into thisrr->data by either the decryption or by the decompression. + * When the data is 'copied' into the thisrr->data buffer, + * thisrr->input will be updated to point at the new buffer */ /* @@ -1616,16 +1616,16 @@ int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) sess = s->session; /* - * At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length, - * and we have that many bytes in s->packet + * At this point, s->rlayer.packet_length == SSL3_RT_HEADER_LNGTH + rr->length, + * and we have that many bytes in s->rlayer.packet */ rr->input = &(RECORD_LAYER_get_packet(&s->rlayer)[DTLS1_RT_HEADER_LENGTH]); /* - * ok, we can now read from 's->packet' data into 'rr' rr->input points - * at rr->length bytes, which need to be copied into rr->data by either - * the decryption or by the decompression When the data is 'copied' into - * the rr->data buffer, rr->input will be pointed at the new buffer + * ok, we can now read from 's->rlayer.packet' data into 'rr'. rr->input + * points at rr->length bytes, which need to be copied into rr->data by + * either the decryption or by the decompression. When the data is 'copied' + * into the rr->data buffer, rr->input will be pointed at the new buffer */ /* @@ -1947,7 +1947,7 @@ int dtls1_get_record(SSL *s) if (rr->length > RECORD_LAYER_get_packet_length(&s->rlayer) - DTLS1_RT_HEADER_LENGTH) { - /* now s->packet_length == DTLS1_RT_HEADER_LENGTH */ + /* now s->rlayer.packet_length == DTLS1_RT_HEADER_LENGTH */ more = rr->length; rret = ssl3_read_n(s, more, more, 1, 1, &n); /* this packet contained a partial record, dump it */ @@ -1963,7 +1963,7 @@ int dtls1_get_record(SSL *s) } /* - * now n == rr->length, and s->packet_length == + * now n == rr->length, and s->rlayer.packet_length == * DTLS1_RT_HEADER_LENGTH + rr->length */ } diff --git a/deps/openssl/openssl/ssl/s3_msg.c b/deps/openssl/openssl/ssl/s3_msg.c index 7c382912216653..1adf564e95089f 100644 --- a/deps/openssl/openssl/ssl/s3_msg.c +++ b/deps/openssl/openssl/ssl/s3_msg.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -48,6 +48,8 @@ int ssl3_send_alert(SSL *s, int level, int desc) * protocol_version alerts */ if (desc < 0) return -1; + if (s->shutdown & SSL_SENT_SHUTDOWN && desc != SSL_AD_CLOSE_NOTIFY) + return -1; /* If a fatal one, remove from cache */ if ((level == SSL3_AL_FATAL) && (s->session != NULL)) SSL_CTX_remove_session(s->session_ctx, s->session); diff --git a/deps/openssl/openssl/ssl/ssl_cert.c b/deps/openssl/openssl/ssl/ssl_cert.c index 5d3e83f328974c..e7feda81d04615 100644 --- a/deps/openssl/openssl/ssl/ssl_cert.c +++ b/deps/openssl/openssl/ssl/ssl_cert.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the OpenSSL license (the "License"). You may not use @@ -876,18 +876,36 @@ int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain, int ref) return 1; } +int ssl_get_security_level_bits(const SSL *s, const SSL_CTX *ctx, int *levelp) +{ + int level; + static const int minbits_table[5 + 1] = { 0, 80, 112, 128, 192, 256 }; + + if (ctx != NULL) + level = SSL_CTX_get_security_level(ctx); + else + level = SSL_get_security_level(s); + + if (level > 5) + level = 5; + else if (level < 0) + level = 0; + + if (levelp != NULL) + *levelp = level; + + return minbits_table[level]; +} + static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, int op, int bits, int nid, void *other, void *ex) { int level, minbits; - static const int minbits_table[5] = { 80, 112, 128, 192, 256 }; - if (ctx) - level = SSL_CTX_get_security_level(ctx); - else - level = SSL_get_security_level(s); - if (level <= 0) { + minbits = ssl_get_security_level_bits(s, ctx, &level); + + if (level == 0) { /* * No EDH keys weaker than 1024-bits even at level 0, otherwise, * anything goes. @@ -896,9 +914,6 @@ static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, return 0; return 1; } - if (level > 5) - level = 5; - minbits = minbits_table[level - 1]; switch (op) { case SSL_SECOP_CIPHER_SUPPORTED: case SSL_SECOP_CIPHER_SHARED: diff --git a/deps/openssl/openssl/ssl/ssl_err.c b/deps/openssl/openssl/ssl/ssl_err.c index cb2fe7f77ae586..56adfdca42a550 100644 --- a/deps/openssl/openssl/ssl/ssl_err.c +++ b/deps/openssl/openssl/ssl/ssl_err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -85,6 +85,7 @@ static const ERR_STRING_DATA SSL_str_functs[] = { {ERR_PACK(ERR_LIB_SSL, SSL_F_FINAL_KEY_SHARE, 0), "final_key_share"}, {ERR_PACK(ERR_LIB_SSL, SSL_F_FINAL_MAXFRAGMENTLEN, 0), "final_maxfragmentlen"}, + {ERR_PACK(ERR_LIB_SSL, SSL_F_FINAL_PSK, 0), "final_psk"}, {ERR_PACK(ERR_LIB_SSL, SSL_F_FINAL_QUIC_TRANSPORT_PARAMS, 0), "final_quic_transport_params"}, {ERR_PACK(ERR_LIB_SSL, SSL_F_FINAL_RENEGOTIATE, 0), "final_renegotiate"}, @@ -981,6 +982,8 @@ static const ERR_STRING_DATA SSL_str_reasons[] = { "missing ecdsa signing cert"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MISSING_FATAL), "missing fatal"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MISSING_PARAMETERS), "missing parameters"}, + {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MISSING_PSK_KEX_MODES_EXTENSION), + "missing psk kex modes extension"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MISSING_QUIC_TRANSPORT_PARAMETERS_EXTENSION), "missing quic transport parameters extension"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_MISSING_RSA_CERTIFICATE), @@ -1053,6 +1056,8 @@ static const ERR_STRING_DATA SSL_str_reasons[] = { {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_NULL_SSL_CTX), "null ssl ctx"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_NULL_SSL_METHOD_PASSED), "null ssl method passed"}, + {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_OCSP_CALLBACK_FAILURE), + "ocsp callback failure"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED), "old session cipher not returned"}, {ERR_PACK(ERR_LIB_SSL, 0, SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED), diff --git a/deps/openssl/openssl/ssl/ssl_lib.c b/deps/openssl/openssl/ssl/ssl_lib.c index ab0bf907b2b20f..098a1842778e97 100644 --- a/deps/openssl/openssl/ssl/ssl_lib.c +++ b/deps/openssl/openssl/ssl/ssl_lib.c @@ -2155,6 +2155,11 @@ int SSL_key_update(SSL *s, int updatetype) return 0; } + if (RECORD_LAYER_write_pending(&s->rlayer)) { + SSLerr(SSL_F_SSL_KEY_UPDATE, SSL_R_BAD_WRITE_RETRY); + return 0; + } + ossl_statem_set_in_init(s, 1); s->key_update = updatetype; return 1; @@ -2210,6 +2215,19 @@ int SSL_renegotiate_pending(const SSL *s) return (s->renegotiate != 0); } +int SSL_new_session_ticket(SSL *s) +{ + /* If we are in init because we're sending tickets, okay to send more. */ + if ((SSL_in_init(s) && s->ext.extra_tickets_expected == 0) + || SSL_IS_FIRST_HANDSHAKE(s) || !s->server + || !SSL_IS_TLS13(s)) + return 0; + s->ext.extra_tickets_expected++; + if (s->rlayer.wbuf[0].left == 0 && !SSL_in_init(s)) + ossl_statem_set_in_init(s, 1); + return 1; +} + long SSL_ctrl(SSL *s, int cmd, long larg, void *parg) { long l; @@ -2865,6 +2883,19 @@ void SSL_CTX_set_npn_select_cb(SSL_CTX *ctx, } #endif +static int alpn_value_ok(const unsigned char *protos, unsigned int protos_len) +{ + unsigned int idx; + + if (protos_len < 2 || protos == NULL) + return 0; + + for (idx = 0; idx < protos_len; idx += protos[idx] + 1) { + if (protos[idx] == 0) + return 0; + } + return idx == protos_len; +} /* * SSL_CTX_set_alpn_protos sets the ALPN protocol list on |ctx| to |protos|. * |protos| must be in wire-format (i.e. a series of non-empty, 8-bit @@ -2873,13 +2904,25 @@ void SSL_CTX_set_npn_select_cb(SSL_CTX *ctx, int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, unsigned int protos_len) { - OPENSSL_free(ctx->ext.alpn); - ctx->ext.alpn = OPENSSL_memdup(protos, protos_len); - if (ctx->ext.alpn == NULL) { + unsigned char *alpn; + + if (protos_len == 0 || protos == NULL) { + OPENSSL_free(ctx->ext.alpn); + ctx->ext.alpn = NULL; ctx->ext.alpn_len = 0; + return 0; + } + /* Not valid per RFC */ + if (!alpn_value_ok(protos, protos_len)) + return 1; + + alpn = OPENSSL_memdup(protos, protos_len); + if (alpn == NULL) { SSLerr(SSL_F_SSL_CTX_SET_ALPN_PROTOS, ERR_R_MALLOC_FAILURE); return 1; } + OPENSSL_free(ctx->ext.alpn); + ctx->ext.alpn = alpn; ctx->ext.alpn_len = protos_len; return 0; @@ -2893,13 +2936,25 @@ int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, unsigned int protos_len) { - OPENSSL_free(ssl->ext.alpn); - ssl->ext.alpn = OPENSSL_memdup(protos, protos_len); - if (ssl->ext.alpn == NULL) { + unsigned char *alpn; + + if (protos_len == 0 || protos == NULL) { + OPENSSL_free(ssl->ext.alpn); + ssl->ext.alpn = NULL; ssl->ext.alpn_len = 0; + return 0; + } + /* Not valid per RFC */ + if (!alpn_value_ok(protos, protos_len)) + return 1; + + alpn = OPENSSL_memdup(protos, protos_len); + if (alpn == NULL) { SSLerr(SSL_F_SSL_SET_ALPN_PROTOS, ERR_R_MALLOC_FAILURE); return 1; } + OPENSSL_free(ssl->ext.alpn); + ssl->ext.alpn = alpn; ssl->ext.alpn_len = protos_len; return 0; @@ -4576,8 +4631,11 @@ int ssl_handshake_hash(SSL *s, unsigned char *out, size_t outlen, } ctx = EVP_MD_CTX_new(); - if (ctx == NULL) + if (ctx == NULL) { + SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_HANDSHAKE_HASH, + ERR_R_INTERNAL_ERROR); goto err; + } if (!EVP_MD_CTX_copy_ex(ctx, hdgst) || EVP_DigestFinal_ex(ctx, out, NULL) <= 0) { diff --git a/deps/openssl/openssl/ssl/ssl_local.h b/deps/openssl/openssl/ssl/ssl_local.h index 63b39378f3f5bd..9793306e7582ef 100644 --- a/deps/openssl/openssl/ssl/ssl_local.h +++ b/deps/openssl/openssl/ssl/ssl_local.h @@ -1320,6 +1320,8 @@ struct ssl_st { /* RFC4507 session ticket expected to be received or sent */ int ticket_expected; + /* TLS 1.3 tickets requested by the application. */ + int extra_tickets_expected; # ifndef OPENSSL_NO_EC size_t ecpointformats_len; /* our list */ @@ -2361,6 +2363,7 @@ __owur int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain, __owur int ssl_security(const SSL *s, int op, int bits, int nid, void *other); __owur int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, void *other); +int ssl_get_security_level_bits(const SSL *s, const SSL_CTX *ctx, int *levelp); __owur int ssl_cert_lookup_by_nid(int nid, size_t *pidx); __owur const SSL_CERT_LOOKUP *ssl_cert_lookup_by_pkey(const EVP_PKEY *pk, @@ -2482,7 +2485,6 @@ __owur int dtls1_handle_timeout(SSL *s); void dtls1_start_timer(SSL *s); void dtls1_stop_timer(SSL *s); __owur int dtls1_is_timer_expired(SSL *s); -void dtls1_double_timeout(SSL *s); __owur int dtls_raw_hello_verify_request(WPACKET *pkt, unsigned char *cookie, size_t cookie_len); __owur size_t dtls1_min_mtu(SSL *s); diff --git a/deps/openssl/openssl/ssl/statem/extensions.c b/deps/openssl/openssl/ssl/statem/extensions.c index b1d28bea4c9e47..3a6702cd6aad77 100644 --- a/deps/openssl/openssl/ssl/statem/extensions.c +++ b/deps/openssl/openssl/ssl/statem/extensions.c @@ -18,6 +18,7 @@ static int final_renegotiate(SSL *s, unsigned int context, int sent); static int init_server_name(SSL *s, unsigned int context); static int final_server_name(SSL *s, unsigned int context, int sent); #ifndef OPENSSL_NO_EC +static int init_ec_point_formats(SSL *s, unsigned int context); static int final_ec_pt_formats(SSL *s, unsigned int context, int sent); #endif static int init_session_ticket(SSL *s, unsigned int context); @@ -56,6 +57,7 @@ static int final_sig_algs(SSL *s, unsigned int context, int sent); static int final_early_data(SSL *s, unsigned int context, int sent); static int final_maxfragmentlen(SSL *s, unsigned int context, int sent); static int init_post_handshake_auth(SSL *s, unsigned int context); +static int final_psk(SSL *s, unsigned int context, int sent); #ifndef OPENSSL_NO_QUIC static int init_quic_transport_params(SSL *s, unsigned int context); static int final_quic_transport_params_draft(SSL *s, unsigned int context, int sent); @@ -163,7 +165,7 @@ static const EXTENSION_DEFINITION ext_defs[] = { TLSEXT_TYPE_ec_point_formats, SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_TLS1_2_AND_BELOW_ONLY, - NULL, tls_parse_ctos_ec_pt_formats, tls_parse_stoc_ec_pt_formats, + init_ec_point_formats, tls_parse_ctos_ec_pt_formats, tls_parse_stoc_ec_pt_formats, tls_construct_stoc_ec_pt_formats, tls_construct_ctos_ec_pt_formats, final_ec_pt_formats }, @@ -416,7 +418,7 @@ static const EXTENSION_DEFINITION ext_defs[] = { SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_3_SERVER_HELLO | SSL_EXT_TLS_IMPLEMENTATION_ONLY | SSL_EXT_TLS1_3_ONLY, NULL, tls_parse_ctos_psk, tls_parse_stoc_psk, tls_construct_stoc_psk, - tls_construct_ctos_psk, NULL + tls_construct_ctos_psk, final_psk } }; @@ -1053,6 +1055,15 @@ static int final_server_name(SSL *s, unsigned int context, int sent) } #ifndef OPENSSL_NO_EC +static int init_ec_point_formats(SSL *s, unsigned int context) +{ + OPENSSL_free(s->ext.peer_ecpointformats); + s->ext.peer_ecpointformats = NULL; + s->ext.peer_ecpointformats_len = 0; + + return 1; +} + static int final_ec_pt_formats(SSL *s, unsigned int context, int sent) { unsigned long alg_k, alg_a; @@ -1746,6 +1757,22 @@ static int init_post_handshake_auth(SSL *s, unsigned int context) return 1; } +/* + * If clients offer "pre_shared_key" without a "psk_key_exchange_modes" + * extension, servers MUST abort the handshake. + */ +static int final_psk(SSL *s, unsigned int context, int sent) +{ + if (s->server && sent && s->clienthello != NULL + && !s->clienthello->pre_proc_exts[TLSEXT_IDX_psk_kex_modes].present) { + SSLfatal(s, TLS13_AD_MISSING_EXTENSION, SSL_F_FINAL_PSK, + SSL_R_MISSING_PSK_KEX_MODES_EXTENSION); + return 0; + } + + return 1; +} + #ifndef OPENSSL_NO_QUIC static int init_quic_transport_params(SSL *s, unsigned int context) { diff --git a/deps/openssl/openssl/ssl/statem/extensions_srvr.c b/deps/openssl/openssl/ssl/statem/extensions_srvr.c index 617b67ebcee041..f47a09ed942873 100644 --- a/deps/openssl/openssl/ssl/statem/extensions_srvr.c +++ b/deps/openssl/openssl/ssl/statem/extensions_srvr.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -1751,6 +1751,13 @@ EXT_RETURN tls_construct_stoc_key_share(SSL *s, WPACKET *pkt, } return EXT_RETURN_NOT_SENT; } + if (s->hit && (s->ext.psk_kex_mode & TLSEXT_KEX_MODE_FLAG_KE_DHE) == 0) { + /* + * PSK ('hit') and explicitly not doing DHE (if the client sent the + * DHE option we always take it); don't send key share. + */ + return EXT_RETURN_NOT_SENT; + } if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_key_share) || !WPACKET_start_sub_packet_u16(pkt) diff --git a/deps/openssl/openssl/ssl/statem/statem_clnt.c b/deps/openssl/openssl/ssl/statem/statem_clnt.c index b756cdd1e0ca69..8c0b5b5c71a822 100644 --- a/deps/openssl/openssl/ssl/statem/statem_clnt.c +++ b/deps/openssl/openssl/ssl/statem/statem_clnt.c @@ -1009,7 +1009,8 @@ size_t ossl_statem_client_max_message_size(SSL *s) return CCS_MAX_LENGTH; case TLS_ST_CR_SESSION_TICKET: - return SSL3_RT_MAX_PLAIN_LENGTH; + return (SSL_IS_TLS13(s)) ? SESSION_TICKET_MAX_LENGTH_TLS13 + : SESSION_TICKET_MAX_LENGTH_TLS12; case TLS_ST_CR_FINISHED: return FINISHED_MAX_LENGTH; @@ -2841,7 +2842,7 @@ int tls_process_initial_server_flight(SSL *s) if (ret < 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT, - ERR_R_MALLOC_FAILURE); + SSL_R_OCSP_CALLBACK_FAILURE); return 0; } } diff --git a/deps/openssl/openssl/ssl/statem/statem_local.h b/deps/openssl/openssl/ssl/statem/statem_local.h index 97aff78b3035e9..7bf905f3dfe939 100644 --- a/deps/openssl/openssl/ssl/statem/statem_local.h +++ b/deps/openssl/openssl/ssl/statem/statem_local.h @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -22,6 +22,8 @@ #define SERVER_HELLO_MAX_LENGTH 20000 #define HELLO_RETRY_REQUEST_MAX_LENGTH 20000 #define ENCRYPTED_EXTENSIONS_MAX_LENGTH 20000 +#define SESSION_TICKET_MAX_LENGTH_TLS13 131338 +#define SESSION_TICKET_MAX_LENGTH_TLS12 65541 #define SERVER_KEY_EXCH_MAX_LENGTH 102400 #define SERVER_HELLO_DONE_MAX_LENGTH 0 #define KEY_UPDATE_MAX_LENGTH 1 diff --git a/deps/openssl/openssl/ssl/statem/statem_srvr.c b/deps/openssl/openssl/ssl/statem/statem_srvr.c index 7f5f0db0c73a2b..4a2f8872acad6b 100644 --- a/deps/openssl/openssl/ssl/statem/statem_srvr.c +++ b/deps/openssl/openssl/ssl/statem/statem_srvr.c @@ -437,6 +437,10 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL *s) st->hand_state = TLS_ST_SW_CERT_REQ; return WRITE_TRAN_CONTINUE; } + if (s->ext.extra_tickets_expected > 0) { + st->hand_state = TLS_ST_SW_SESSION_TICKET; + return WRITE_TRAN_CONTINUE; + } /* Try to read from the client instead */ return WRITE_TRAN_FINISHED; @@ -527,7 +531,9 @@ static WRITE_TRAN ossl_statem_server13_write_transition(SSL *s) * Following an initial handshake we send the number of tickets we have * been configured for. */ - if (s->hit || s->num_tickets <= s->sent_tickets) { + if (!SSL_IS_FIRST_HANDSHAKE(s) && s->ext.extra_tickets_expected > 0) { + return WRITE_TRAN_CONTINUE; + } else if (s->hit || s->num_tickets <= s->sent_tickets) { /* We've written enough tickets out. */ st->hand_state = TLS_ST_OK; } @@ -723,7 +729,8 @@ WORK_STATE ossl_statem_server_pre_work(SSL *s, WORK_STATE wst) return WORK_FINISHED_CONTINUE; case TLS_ST_SW_SESSION_TICKET: - if (SSL_IS_TLS13(s) && s->sent_tickets == 0) { + if (SSL_IS_TLS13(s) && s->sent_tickets == 0 + && s->ext.extra_tickets_expected == 0) { /* * Actually this is the end of the handshake, but we're going * straight into writing the session ticket out. So we finish off @@ -3764,6 +3771,7 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL *s, PACKET *pkt) sk_X509_pop_free(s->session->peer_chain, X509_free); s->session->peer_chain = sk; + sk = NULL; /* * Freeze the handshake buffer. For generate_ticket_cb != NULL && - tctx->generate_ticket_cb(s, tctx->ticket_cb_data) == 0) + tctx->generate_ticket_cb(s, tctx->ticket_cb_data) == 0) { + SSLfatal(s, SSL_AD_INTERNAL_ERROR, + SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET, + ERR_R_INTERNAL_ERROR); goto err; - + } /* * If we are using anti-replay protection then we behave as if * SSL_OP_NO_TICKET is set - we are caching tickets anyway so there @@ -4182,10 +4192,13 @@ int tls_construct_new_session_ticket(SSL *s, WPACKET *pkt) /* * Increment both |sent_tickets| and |next_ticket_nonce|. |sent_tickets| * gets reset to 0 if we send more tickets following a post-handshake - * auth, but |next_ticket_nonce| does not. + * auth, but |next_ticket_nonce| does not. If we're sending extra + * tickets, decrement the count of pending extra tickets. */ s->sent_tickets++; s->next_ticket_nonce++; + if (s->ext.extra_tickets_expected > 0) + s->ext.extra_tickets_expected--; ssl_update_cache(s, SSL_SESS_CACHE_SERVER); } diff --git a/deps/openssl/openssl/ssl/t1_lib.c b/deps/openssl/openssl/ssl/t1_lib.c index 48d46f8a48bdc6..b1d3add1874301 100644 --- a/deps/openssl/openssl/ssl/t1_lib.c +++ b/deps/openssl/openssl/ssl/t1_lib.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -2441,7 +2441,8 @@ DH *ssl_get_auto_dh(SSL *s) { DH *dhp = NULL; BIGNUM *p = NULL, *g = NULL; - int dh_secbits = 80; + int dh_secbits = 80, sec_level_bits; + if (s->cert->dh_tmp_auto != 2) { if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { if (s->s3->tmp.new_cipher->strength_bits == 256) @@ -2464,6 +2465,12 @@ DH *ssl_get_auto_dh(SSL *s) BN_free(g); return NULL; } + + /* Do not pick a prime that is too weak for the current security level */ + sec_level_bits = ssl_get_security_level_bits(s, NULL, NULL); + if (dh_secbits < sec_level_bits) + dh_secbits = sec_level_bits; + if (dh_secbits >= 192) p = BN_get_rfc3526_prime_8192(NULL); else if (dh_secbits >= 152) diff --git a/deps/openssl/openssl/test/asn1_decode_test.c b/deps/openssl/openssl/test/asn1_decode_test.c index 18f0ca12e96082..de4dff63634d1d 100644 --- a/deps/openssl/openssl/test/asn1_decode_test.c +++ b/deps/openssl/openssl/test/asn1_decode_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -12,6 +12,7 @@ #include #include +#include #include "internal/numbers.h" #include "testutil.h" @@ -195,6 +196,30 @@ static int test_invalid_template(void) return 0; } +static int test_reuse_asn1_object(void) +{ + static unsigned char cn_der[] = { 0x06, 0x03, 0x55, 0x04, 0x06 }; + static unsigned char oid_der[] = { + 0x06, 0x06, 0x2a, 0x03, 0x04, 0x05, 0x06, 0x07 + }; + int ret = 0; + ASN1_OBJECT *obj; + unsigned char const *p = oid_der; + + /* Create an object that owns dynamically allocated 'sn' and 'ln' fields */ + + if (!TEST_ptr(obj = ASN1_OBJECT_create(NID_undef, cn_der, sizeof(cn_der), + "C", "countryName"))) + goto err; + /* reuse obj - this should not leak sn and ln */ + if (!TEST_ptr(d2i_ASN1_OBJECT(&obj, &p, sizeof(oid_der)))) + goto err; + ret = 1; +err: + ASN1_OBJECT_free(obj); + return ret; +} + int setup_tests(void) { #if OPENSSL_API_COMPAT < 0x10200000L @@ -205,5 +230,6 @@ int setup_tests(void) ADD_TEST(test_int64); ADD_TEST(test_uint64); ADD_TEST(test_invalid_template); + ADD_TEST(test_reuse_asn1_object); return 1; } diff --git a/deps/openssl/openssl/test/bio_memleak_test.c b/deps/openssl/openssl/test/bio_memleak_test.c index 383c82d156c064..610f8febc7501c 100644 --- a/deps/openssl/openssl/test/bio_memleak_test.c +++ b/deps/openssl/openssl/test/bio_memleak_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include "testutil.h" @@ -35,7 +37,7 @@ static int test_bio_memleak(void) goto finish; ok = 1; -finish: + finish: BIO_free(bio); return ok; } @@ -62,7 +64,7 @@ static int test_bio_get_mem(void) goto finish; ok = 1; -finish: + finish: BIO_free(bio); BUF_MEM_free(bufmem); return ok; @@ -98,7 +100,7 @@ static int test_bio_new_mem_buf(void) goto finish; ok = 1; -finish: + finish: BIO_free(bio); return ok; } @@ -139,7 +141,7 @@ static int test_bio_rdonly_mem_buf(void) goto finish; ok = 1; -finish: + finish: BIO_free(bio); BIO_free(bio2); return ok; @@ -176,7 +178,7 @@ static int test_bio_rdwr_rdonly(void) ok = 1; -finish: + finish: BIO_free(bio); return ok; } @@ -216,11 +218,72 @@ static int test_bio_nonclear_rst(void) ok = 1; -finish: + finish: BIO_free(bio); return ok; } +static int error_callback_fired; +static long BIO_error_callback(BIO *bio, int cmd, const char *argp, + size_t len, int argi, + long argl, int ret, size_t *processed) +{ + if ((cmd & (BIO_CB_READ | BIO_CB_RETURN)) != 0) { + error_callback_fired = 1; + ret = 0; /* fail for read operations to simulate error in input BIO */ + } + return ret; +} + +/* Checks i2d_ASN1_bio_stream() is freeing all memory when input BIO ends unexpectedly. */ +static int test_bio_i2d_ASN1_mime(void) +{ + int ok = 0; + BIO *bio = NULL, *out = NULL; + BUF_MEM bufmem; + static const char str[] = "BIO mime test\n"; + PKCS7 *p7 = NULL; + + if (!TEST_ptr(bio = BIO_new(BIO_s_mem()))) + goto finish; + + bufmem.length = sizeof(str); + bufmem.data = (char *) str; + bufmem.max = bufmem.length; + BIO_set_mem_buf(bio, &bufmem, BIO_NOCLOSE); + BIO_set_flags(bio, BIO_FLAGS_MEM_RDONLY); + BIO_set_callback_ex(bio, BIO_error_callback); + + if (!TEST_ptr(out = BIO_new(BIO_s_mem()))) + goto finish; + if (!TEST_ptr(p7 = PKCS7_new())) + goto finish; + if (!TEST_true(PKCS7_set_type(p7, NID_pkcs7_data))) + goto finish; + + error_callback_fired = 0; + + /* + * The call succeeds even if the input stream ends unexpectedly as + * there is no handling for this case in SMIME_crlf_copy(). + */ + if (!TEST_true(i2d_ASN1_bio_stream(out, (ASN1_VALUE*) p7, bio, + SMIME_STREAM | SMIME_BINARY, + ASN1_ITEM_rptr(PKCS7)))) + goto finish; + + if (!TEST_int_eq(error_callback_fired, 1)) + goto finish; + + ok = 1; + + finish: + BIO_free(bio); + BIO_free(out); + PKCS7_free(p7); + return ok; +} + int global_init(void) { CRYPTO_set_mem_debug(1); @@ -236,5 +299,6 @@ int setup_tests(void) ADD_TEST(test_bio_rdonly_mem_buf); ADD_TEST(test_bio_rdwr_rdonly); ADD_TEST(test_bio_nonclear_rst); + ADD_TEST(test_bio_i2d_ASN1_mime); return 1; } diff --git a/deps/openssl/openssl/test/bntest.c b/deps/openssl/openssl/test/bntest.c index 97d08ac0be6bc0..236501e6792c46 100644 --- a/deps/openssl/openssl/test/bntest.c +++ b/deps/openssl/openssl/test/bntest.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -305,6 +305,75 @@ static int test_div_recip(void) return st; } +static struct { + int n, divisor, result, remainder; +} signed_mod_tests[] = { + { 10, 3, 3, 1 }, + { -10, 3, -3, -1 }, + { 10, -3, -3, 1 }, + { -10, -3, 3, -1 }, +}; + +static BIGNUM *set_signed_bn(int value) +{ + BIGNUM *bn = BN_new(); + + if (bn == NULL) + return NULL; + if (!BN_set_word(bn, value < 0 ? -value : value)) { + BN_free(bn); + return NULL; + } + BN_set_negative(bn, value < 0); + return bn; +} + +static int test_signed_mod_replace_ab(int n) +{ + BIGNUM *a = NULL, *b = NULL, *c = NULL, *d = NULL; + int st = 0; + + if (!TEST_ptr(a = set_signed_bn(signed_mod_tests[n].n)) + || !TEST_ptr(b = set_signed_bn(signed_mod_tests[n].divisor)) + || !TEST_ptr(c = set_signed_bn(signed_mod_tests[n].result)) + || !TEST_ptr(d = set_signed_bn(signed_mod_tests[n].remainder))) + goto err; + + if (TEST_true(BN_div(a, b, a, b, ctx)) + && TEST_BN_eq(a, c) + && TEST_BN_eq(b, d)) + st = 1; + err: + BN_free(a); + BN_free(b); + BN_free(c); + BN_free(d); + return st; +} + +static int test_signed_mod_replace_ba(int n) +{ + BIGNUM *a = NULL, *b = NULL, *c = NULL, *d = NULL; + int st = 0; + + if (!TEST_ptr(a = set_signed_bn(signed_mod_tests[n].n)) + || !TEST_ptr(b = set_signed_bn(signed_mod_tests[n].divisor)) + || !TEST_ptr(c = set_signed_bn(signed_mod_tests[n].result)) + || !TEST_ptr(d = set_signed_bn(signed_mod_tests[n].remainder))) + goto err; + + if (TEST_true(BN_div(b, a, a, b, ctx)) + && TEST_BN_eq(b, c) + && TEST_BN_eq(a, d)) + st = 1; + err: + BN_free(a); + BN_free(b); + BN_free(c); + BN_free(d); + return st; +} + static int test_mod(void) { BIGNUM *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL; @@ -326,8 +395,10 @@ static int test_mod(void) BN_set_negative(b, rand_neg()); if (!(TEST_true(BN_mod(c, a, b, ctx)) && TEST_true(BN_div(d, e, a, b, ctx)) - && TEST_true(BN_sub(e, e, c)) - && TEST_BN_eq_zero(e))) + && TEST_BN_eq(e, c) + && TEST_true(BN_mul(c, d, b, ctx)) + && TEST_true(BN_add(d, c, e)) + && TEST_BN_eq(d, a))) goto err; } st = 1; @@ -2759,6 +2830,8 @@ int setup_tests(void) if (n == 0) { ADD_TEST(test_sub); ADD_TEST(test_div_recip); + ADD_ALL_TESTS(test_signed_mod_replace_ab, OSSL_NELEM(signed_mod_tests)); + ADD_ALL_TESTS(test_signed_mod_replace_ba, OSSL_NELEM(signed_mod_tests)); ADD_TEST(test_mod); ADD_TEST(test_modexp_mont5); ADD_TEST(test_kronecker); diff --git a/deps/openssl/openssl/test/certs/ee-self-signed.pem b/deps/openssl/openssl/test/certs/ee-self-signed.pem index e854c9ad272d24..ad1e37ba0e79e3 100644 --- a/deps/openssl/openssl/test/certs/ee-self-signed.pem +++ b/deps/openssl/openssl/test/certs/ee-self-signed.pem @@ -1,19 +1,18 @@ -----BEGIN CERTIFICATE----- -MIIDIjCCAgqgAwIBAgIUT99h/YrAdcDg3fdLy5UajB8e994wDQYJKoZIhvcNAQEL -BQAwGTEXMBUGA1UEAwwOZWUtc2VsZi1zaWduZWQwIBcNMjAwNzI4MTQxNjA4WhgP -MjEyMDA3MDQxNDE2MDhaMBkxFzAVBgNVBAMMDmVlLXNlbGYtc2lnbmVkMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqP+JWGGFrt7bLA/Vc/vit6gbenVg -K9R9PHN2ta7eky9/JJBtyRz0ijjNn6KAFlbLtCy7k+UXH/8NxkP+MTT4KNh16aO7 -iILvo3LiU2IFRU3gMZfvqp0Q0lgNngaeMrsbCFZdZQ8/Zo7CNqAR/8BZNf1JHN0c -QjMGeK4EOCPl53Vn05StWqlAH6xZEPUMwWStSsTGNVOzlmqCGxWL0Zmr5J5vlKrS -luVX+4yRZIo8JBbG0hm+gmATO2Kw7T4ds8r5a98xuXqeS0dopynHP0riIie075Bj -1+/Qckk+W625G9Qrb4Zo3dVzErhDydxBD6KjRk+LZ4iED2H+eTQfSokftwIDAQAB -o2AwXjAdBgNVHQ4EFgQU55viKq2KbDrLdlHljgeYIpfhc6IwHwYDVR0jBBgwFoAU -55viKq2KbDrLdlHljgeYIpfhc6IwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMC -B4AwDQYJKoZIhvcNAQELBQADggEBAGDEbS5kJArjjQNK02oxhQyz1dbDy23evRxm -WW/NtlJAQAgEMXoNo9fioj0L4cvDy40r87V6/RsV2eijwZEfwGloACif7v78w8QO -h4XiW9oGxcQkdMIYZLDVW9AZPDIkK5NHNfQaeAxCprAufYnRMv035UotLzCBRrkG -G2TIs45vRp/6mYFVtm0Nf9CFvu4dXH8W+GlBONG0FAiBW+JzgTr9OmrzfqJTEDrf -vv/hOiu8XvvlF5piPBqKE76rEvkXUSjgDZ2/Ju1fjqpV2I8Hz1Mj9w9tRE8g4E9o -ZcRXX3MNPaHxnNhgYSPdpywwkyILz2AHwmAzh07cdttRFFPw+fM= +MIICzzCCAbegAwIBAgIUBP7iEKPlKuinZGQNFxSY3IBIb0swDQYJKoZIhvcNAQEL +BQAwGTEXMBUGA1UEAwwOZWUtc2VsZi1zaWduZWQwHhcNMjAwNjI4MTA1MTQ1WhcN +MjAwNzI4MTA1MTQ1WjAZMRcwFQYDVQQDDA5lZS1zZWxmLXNpZ25lZDCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKj/iVhhha7e2ywP1XP74reoG3p1YCvU +fTxzdrWu3pMvfySQbckc9Io4zZ+igBZWy7Qsu5PlFx//DcZD/jE0+CjYdemju4iC +76Ny4lNiBUVN4DGX76qdENJYDZ4GnjK7GwhWXWUPP2aOwjagEf/AWTX9SRzdHEIz +BniuBDgj5ed1Z9OUrVqpQB+sWRD1DMFkrUrExjVTs5ZqghsVi9GZq+Seb5Sq0pbl +V/uMkWSKPCQWxtIZvoJgEztisO0+HbPK+WvfMbl6nktHaKcpxz9K4iIntO+QY9fv +0HJJPlutuRvUK2+GaN3VcxK4Q8ncQQ+io0ZPi2eIhA9h/nk0H0qJH7cCAwEAAaMP +MA0wCwYDVR0PBAQDAgeAMA0GCSqGSIb3DQEBCwUAA4IBAQBiLmIUCGb+hmRGbmpO +lDqEwiRVdxHBs4OSb3IA9QgU1QKUDRqn7q27RRelmzTXllubZZcX3K6o+dunRW5G +d3f3FVr+3Z7wnmkQtC2y3NWtGuWNczss+6rMLzKvla5CjRiNPlSvluMNpcs7BJxI +ppk1LxlaiYlQkDW32OPyxzXWDNv1ZkphcOcoCkHAagnq9x1SszvLTjAlo5XpYrm5 +CPgBOEnVwFCgne5Ab4QPTgkxPh/Ta508I/FKaPLJqci1EfGKipZkS7mMGTUJEeVK +wZrn4z7RiTfJ4PdqO5iv8eOpt03fqdPEXQWe8DrKyfGM6/e369FaXMFhcd2ZxZy2 +WHoc -----END CERTIFICATE----- diff --git a/deps/openssl/openssl/test/clienthellotest.c b/deps/openssl/openssl/test/clienthellotest.c index 8ae1e4d9c6425f..ee32b5e2c526a2 100644 --- a/deps/openssl/openssl/test/clienthellotest.c +++ b/deps/openssl/openssl/test/clienthellotest.c @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -45,10 +45,16 @@ static const char *sessionfile = NULL; /* Dummy ALPN protocols used to pad out the size of the ClientHello */ +/* ASCII 'O' = 79 = 0x4F = EBCDIC '|'*/ +#ifdef CHARSET_EBCDIC static const char alpn_prots[] = - "0123456789012345678901234567890123456789012345678901234567890123456789" - "0123456789012345678901234567890123456789012345678901234567890123456789" - "01234567890123456789"; + "|1234567890123456789012345678901234567890123456789012345678901234567890123456789" + "|1234567890123456789012345678901234567890123456789012345678901234567890123456789"; +#else +static const char alpn_prots[] = + "O1234567890123456789012345678901234567890123456789012345678901234567890123456789" + "O1234567890123456789012345678901234567890123456789012345678901234567890123456789"; +#endif static int test_client_hello(int currtest) { diff --git a/deps/openssl/openssl/test/ectest.c b/deps/openssl/openssl/test/ectest.c index 9bdbf70afb402a..bd3c4d8cad06b0 100644 --- a/deps/openssl/openssl/test/ectest.c +++ b/deps/openssl/openssl/test/ectest.c @@ -1,5 +1,5 @@ /* - * Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the OpenSSL license (the "License"). You may not use @@ -1124,7 +1124,56 @@ static int char2_field_tests(void) BN_free(yplusone); return r; } -# endif + +static int hybrid_point_encoding_test(void) +{ + BIGNUM *x = NULL, *y = NULL; + EC_GROUP *group = NULL; + EC_POINT *point = NULL; + unsigned char *buf = NULL; + size_t len; + int r = 0; + + if (!TEST_true(BN_dec2bn(&x, "0")) + || !TEST_true(BN_dec2bn(&y, "1")) + || !TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_sect571k1)) + || !TEST_ptr(point = EC_POINT_new(group)) + || !TEST_true(EC_POINT_set_affine_coordinates(group, point, x, y, NULL)) + || !TEST_size_t_ne(0, (len = EC_POINT_point2oct(group, + point, + POINT_CONVERSION_HYBRID, + NULL, + 0, + NULL))) + || !TEST_ptr(buf = OPENSSL_malloc(len)) + || !TEST_size_t_eq(len, EC_POINT_point2oct(group, + point, + POINT_CONVERSION_HYBRID, + buf, + len, + NULL))) + goto err; + + r = 1; + + /* buf contains a valid hybrid point, check that we can decode it. */ + if (!TEST_true(EC_POINT_oct2point(group, point, buf, len, NULL))) + r = 0; + + /* Flip the y_bit and verify that the invalid encoding is rejected. */ + buf[0] ^= 1; + if (!TEST_false(EC_POINT_oct2point(group, point, buf, len, NULL))) + r = 0; + +err: + BN_free(x); + BN_free(y); + EC_GROUP_free(group); + EC_POINT_free(point); + OPENSSL_free(buf); + return r; +} +#endif static int internal_curve_test(int n) { @@ -2195,6 +2244,7 @@ int setup_tests(void) ADD_ALL_TESTS(cardinality_test, crv_len); ADD_TEST(prime_field_tests); # ifndef OPENSSL_NO_EC2M + ADD_TEST(hybrid_point_encoding_test); ADD_TEST(char2_field_tests); ADD_ALL_TESTS(char2_curve_test, OSSL_NELEM(char2_curve_tests)); # endif diff --git a/deps/openssl/openssl/test/evp_extra_test.c b/deps/openssl/openssl/test/evp_extra_test.c index 877b99197be314..2a5eefb1044dbd 100644 --- a/deps/openssl/openssl/test/evp_extra_test.c +++ b/deps/openssl/openssl/test/evp_extra_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -320,6 +320,96 @@ static const unsigned char pExampleECParamDER[] = { }; #endif +static const unsigned char kCFBDefaultKey[] = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, + 0x09, 0xCF, 0x4F, 0x3C +}; + +static const unsigned char kGCMDefaultKey[32] = { 0 }; + +static const unsigned char kGCMResetKey[] = { + 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 0x6d, 0x6a, 0x8f, 0x94, + 0x67, 0x30, 0x83, 0x08, 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, + 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 +}; + +static const unsigned char iCFBIV[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F +}; + +static const unsigned char iGCMDefaultIV[12] = { 0 }; + +static const unsigned char iGCMResetIV1[] = { + 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad +}; + +static const unsigned char iGCMResetIV2[] = { + 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 0xde, 0xca, 0xf8, 0x88 +}; + +static const unsigned char cfbPlaintext[] = { + 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, 0xE9, 0x3D, 0x7E, 0x11, + 0x73, 0x93, 0x17, 0x2A +}; + +static const unsigned char gcmDefaultPlaintext[16] = { 0 }; + +static const unsigned char gcmResetPlaintext[] = { + 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 0xa5, 0x59, 0x09, 0xc5, + 0xaf, 0xf5, 0x26, 0x9a, 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, + 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 0x1c, 0x3c, 0x0c, 0x95, + 0x95, 0x68, 0x09, 0x53, 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, + 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 0xba, 0x63, 0x7b, 0x39 +}; + +static const unsigned char cfbCiphertext[] = { + 0x3B, 0x3F, 0xD9, 0x2E, 0xB7, 0x2D, 0xAD, 0x20, 0x33, 0x34, 0x49, 0xF8, + 0xE8, 0x3C, 0xFB, 0x4A +}; + +static const unsigned char gcmDefaultCiphertext[] = { + 0xce, 0xa7, 0x40, 0x3d, 0x4d, 0x60, 0x6b, 0x6e, 0x07, 0x4e, 0xc5, 0xd3, + 0xba, 0xf3, 0x9d, 0x18 +}; + +static const unsigned char gcmResetCiphertext1[] = { + 0xc3, 0x76, 0x2d, 0xf1, 0xca, 0x78, 0x7d, 0x32, 0xae, 0x47, 0xc1, 0x3b, + 0xf1, 0x98, 0x44, 0xcb, 0xaf, 0x1a, 0xe1, 0x4d, 0x0b, 0x97, 0x6a, 0xfa, + 0xc5, 0x2f, 0xf7, 0xd7, 0x9b, 0xba, 0x9d, 0xe0, 0xfe, 0xb5, 0x82, 0xd3, + 0x39, 0x34, 0xa4, 0xf0, 0x95, 0x4c, 0xc2, 0x36, 0x3b, 0xc7, 0x3f, 0x78, + 0x62, 0xac, 0x43, 0x0e, 0x64, 0xab, 0xe4, 0x99, 0xf4, 0x7c, 0x9b, 0x1f +}; + +static const unsigned char gcmResetCiphertext2[] = { + 0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07, 0xf4, 0x7f, 0x37, 0xa3, + 0x2a, 0x84, 0x42, 0x7d, 0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9, + 0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa, 0x8c, 0xb0, 0x8e, 0x48, + 0x59, 0x0d, 0xbb, 0x3d, 0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38, + 0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a, 0xbc, 0xc9, 0xf6, 0x62 +}; + +static const unsigned char gcmAAD[] = { + 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, + 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2 +}; + +static const unsigned char gcmDefaultTag[] = { + 0xd0, 0xd1, 0xc8, 0xa7, 0x99, 0x99, 0x6b, 0xf0, 0x26, 0x5b, 0x98, 0xb5, + 0xd4, 0x8a, 0xb9, 0x19 +}; + +static const unsigned char gcmResetTag1[] = { + 0x3a, 0x33, 0x7d, 0xbf, 0x46, 0xa7, 0x92, 0xc4, 0x5e, 0x45, 0x49, 0x13, + 0xfe, 0x2e, 0xa8, 0xf2 +}; + +static const unsigned char gcmResetTag2[] = { + 0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68, 0xcd, 0xdf, 0x88, 0x53, + 0xbb, 0x2d, 0x55, 0x1b +}; + + typedef struct APK_DATA_st { const unsigned char *kder; size_t size; @@ -330,6 +420,494 @@ typedef struct APK_DATA_st { int type; /* 0 for private, 1 for public, 2 for params */ } APK_DATA; +typedef struct { + const char *cipher; + const unsigned char *key; + const unsigned char *iv; + const unsigned char *input; + const unsigned char *expected; + const unsigned char *tag; + size_t ivlen; /* 0 if we do not need to set a specific IV len */ + size_t inlen; + size_t expectedlen; + size_t taglen; + int keyfirst; + int initenc; + int finalenc; +} EVP_INIT_TEST_st; + +static const EVP_INIT_TEST_st evp_init_tests[] = { + { + "aes-128-cfb", kCFBDefaultKey, iCFBIV, cfbPlaintext, + cfbCiphertext, NULL, 0, sizeof(cfbPlaintext), sizeof(cfbCiphertext), + 0, 1, 0, 1 + }, + { + "aes-256-gcm", kGCMDefaultKey, iGCMDefaultIV, gcmDefaultPlaintext, + gcmDefaultCiphertext, gcmDefaultTag, sizeof(iGCMDefaultIV), + sizeof(gcmDefaultPlaintext), sizeof(gcmDefaultCiphertext), + sizeof(gcmDefaultTag), 1, 0, 1 + }, + { + "aes-128-cfb", kCFBDefaultKey, iCFBIV, cfbPlaintext, + cfbCiphertext, NULL, 0, sizeof(cfbPlaintext), sizeof(cfbCiphertext), + 0, 0, 0, 1 + }, + { + "aes-256-gcm", kGCMDefaultKey, iGCMDefaultIV, gcmDefaultPlaintext, + gcmDefaultCiphertext, gcmDefaultTag, sizeof(iGCMDefaultIV), + sizeof(gcmDefaultPlaintext), sizeof(gcmDefaultCiphertext), + sizeof(gcmDefaultTag), 0, 0, 1 + }, + { + "aes-128-cfb", kCFBDefaultKey, iCFBIV, cfbCiphertext, + cfbPlaintext, NULL, 0, sizeof(cfbCiphertext), sizeof(cfbPlaintext), + 0, 1, 1, 0 + }, + { + "aes-256-gcm", kGCMDefaultKey, iGCMDefaultIV, gcmDefaultCiphertext, + gcmDefaultPlaintext, gcmDefaultTag, sizeof(iGCMDefaultIV), + sizeof(gcmDefaultCiphertext), sizeof(gcmDefaultPlaintext), + sizeof(gcmDefaultTag), 1, 1, 0 + }, + { + "aes-128-cfb", kCFBDefaultKey, iCFBIV, cfbCiphertext, + cfbPlaintext, NULL, 0, sizeof(cfbCiphertext), sizeof(cfbPlaintext), + 0, 0, 1, 0 + }, + { + "aes-256-gcm", kGCMDefaultKey, iGCMDefaultIV, gcmDefaultCiphertext, + gcmDefaultPlaintext, gcmDefaultTag, sizeof(iGCMDefaultIV), + sizeof(gcmDefaultCiphertext), sizeof(gcmDefaultPlaintext), + sizeof(gcmDefaultTag), 0, 1, 0 + } +}; + +static int evp_init_seq_set_iv(EVP_CIPHER_CTX *ctx, const EVP_INIT_TEST_st *t) +{ + int res = 0; + + if (t->ivlen != 0) { + if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen, NULL))) + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, t->iv, -1))) + goto err; + res = 1; + err: + return res; +} + +/* + * Test step-wise cipher initialization via EVP_CipherInit_ex where the + * arguments are given one at a time and a final adjustment to the enc + * parameter sets the correct operation. + */ +static int test_evp_init_seq(int idx) +{ + int outlen1, outlen2; + int testresult = 0; + unsigned char outbuf[1024]; + unsigned char tag[16]; + const EVP_INIT_TEST_st *t = &evp_init_tests[idx]; + EVP_CIPHER_CTX *ctx = NULL; + const EVP_CIPHER *type = NULL; + size_t taglen = sizeof(tag); + char *errmsg = NULL; + + ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) { + errmsg = "CTX_ALLOC"; + goto err; + } + if (!TEST_ptr(type = EVP_get_cipherbyname(t->cipher))) { + errmsg = "GET_CIPHERBYNAME"; + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, NULL, NULL, t->initenc))) { + errmsg = "EMPTY_ENC_INIT"; + goto err; + } + if (!TEST_true(EVP_CIPHER_CTX_set_padding(ctx, 0))) { + errmsg = "PADDING"; + goto err; + } + if (t->keyfirst && !TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, t->key, NULL, -1))) { + errmsg = "KEY_INIT (before iv)"; + goto err; + } + if (!evp_init_seq_set_iv(ctx, t)) { + errmsg = "IV_INIT"; + goto err; + } + if (t->keyfirst == 0 && !TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, t->key, NULL, -1))) { + errmsg = "KEY_INIT (after iv)"; + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, t->finalenc))) { + errmsg = "FINAL_ENC_INIT"; + goto err; + } + if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, t->input, t->inlen))) { + errmsg = "CIPHER_UPDATE"; + goto err; + } + if (t->finalenc == 0 && t->tag != NULL) { + /* Set expected tag */ + if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, + t->taglen, (void *)t->tag))) { + errmsg = "SET_TAG"; + goto err; + } + } + if (!TEST_true(EVP_CipherFinal_ex(ctx, outbuf + outlen1, &outlen2))) { + errmsg = "CIPHER_FINAL"; + goto err; + } + if (!TEST_mem_eq(t->expected, t->expectedlen, outbuf, outlen1 + outlen2)) { + errmsg = "WRONG_RESULT"; + goto err; + } + if (t->finalenc != 0 && t->tag != NULL) { + if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag))) { + errmsg = "GET_TAG"; + goto err; + } + if (!TEST_mem_eq(t->tag, t->taglen, tag, taglen)) { + errmsg = "TAG_ERROR"; + goto err; + } + } + testresult = 1; + err: + if (errmsg != NULL) + TEST_info("evp_init_test %d: %s", idx, errmsg); + EVP_CIPHER_CTX_free(ctx); + return testresult; +} + +typedef struct { + const unsigned char *input; + const unsigned char *expected; + size_t inlen; + size_t expectedlen; + int enc; +} EVP_RESET_TEST_st; + +static const EVP_RESET_TEST_st evp_reset_tests[] = { + { + cfbPlaintext, cfbCiphertext, + sizeof(cfbPlaintext), sizeof(cfbCiphertext), 1 + }, + { + cfbCiphertext, cfbPlaintext, + sizeof(cfbCiphertext), sizeof(cfbPlaintext), 0 + } +}; + +/* + * Test a reset of a cipher via EVP_CipherInit_ex after the cipher has already + * been used. + */ +static int test_evp_reset(int idx) +{ + const EVP_RESET_TEST_st *t = &evp_reset_tests[idx]; + int outlen1, outlen2; + int testresult = 0; + unsigned char outbuf[1024]; + EVP_CIPHER_CTX *ctx = NULL; + const EVP_CIPHER *type = NULL; + char *errmsg = NULL; + + if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())) { + errmsg = "CTX_ALLOC"; + goto err; + } + if (!TEST_ptr(type = EVP_get_cipherbyname("aes-128-cfb"))) { + errmsg = "GET_CIPHERBYNAME"; + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, kCFBDefaultKey, iCFBIV, t->enc))) { + errmsg = "CIPHER_INIT"; + goto err; + } + if (!TEST_true(EVP_CIPHER_CTX_set_padding(ctx, 0))) { + errmsg = "PADDING"; + goto err; + } + if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, t->input, t->inlen))) { + errmsg = "CIPHER_UPDATE"; + goto err; + } + if (!TEST_true(EVP_CipherFinal_ex(ctx, outbuf + outlen1, &outlen2))) { + errmsg = "CIPHER_FINAL"; + goto err; + } + if (!TEST_mem_eq(t->expected, t->expectedlen, outbuf, outlen1 + outlen2)) { + errmsg = "WRONG_RESULT"; + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1))) { + errmsg = "CIPHER_REINIT"; + goto err; + } + if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, t->input, t->inlen))) { + errmsg = "CIPHER_UPDATE (reinit)"; + goto err; + } + if (!TEST_true(EVP_CipherFinal_ex(ctx, outbuf + outlen1, &outlen2))) { + errmsg = "CIPHER_FINAL (reinit)"; + goto err; + } + if (!TEST_mem_eq(t->expected, t->expectedlen, outbuf, outlen1 + outlen2)) { + errmsg = "WRONG_RESULT (reinit)"; + goto err; + } + testresult = 1; + err: + if (errmsg != NULL) + TEST_info("test_evp_reset %d: %s", idx, errmsg); + EVP_CIPHER_CTX_free(ctx); + return testresult; +} + +typedef struct { + const unsigned char *iv1; + const unsigned char *iv2; + const unsigned char *expected1; + const unsigned char *expected2; + const unsigned char *tag1; + const unsigned char *tag2; + size_t ivlen1; + size_t ivlen2; + size_t expectedlen1; + size_t expectedlen2; +} TEST_GCM_IV_REINIT_st; + +static const TEST_GCM_IV_REINIT_st gcm_reinit_tests[] = { + { + iGCMResetIV1, iGCMResetIV2, gcmResetCiphertext1, gcmResetCiphertext2, + gcmResetTag1, gcmResetTag2, sizeof(iGCMResetIV1), sizeof(iGCMResetIV2), + sizeof(gcmResetCiphertext1), sizeof(gcmResetCiphertext2) + }, + { + iGCMResetIV2, iGCMResetIV1, gcmResetCiphertext2, gcmResetCiphertext1, + gcmResetTag2, gcmResetTag1, sizeof(iGCMResetIV2), sizeof(iGCMResetIV1), + sizeof(gcmResetCiphertext2), sizeof(gcmResetCiphertext1) + } +}; + +static int test_gcm_reinit(int idx) +{ + int outlen1, outlen2, outlen3; + int testresult = 0; + unsigned char outbuf[1024]; + unsigned char tag[16]; + const TEST_GCM_IV_REINIT_st *t = &gcm_reinit_tests[idx]; + EVP_CIPHER_CTX *ctx = NULL; + const EVP_CIPHER *type = NULL; + size_t taglen = sizeof(tag); + char *errmsg = NULL; + + if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())) { + errmsg = "CTX_ALLOC"; + goto err; + } + if (!TEST_ptr(type = EVP_get_cipherbyname("aes-256-gcm"))) { + errmsg = "GET_CIPHERBYNAME"; + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, NULL, NULL, 1))) { + errmsg = "ENC_INIT"; + goto err; + } + if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen1, NULL))) { + errmsg = "SET_IVLEN1"; + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, kGCMResetKey, t->iv1, 1))) { + errmsg = "SET_IV1"; + goto err; + } + if (!TEST_true(EVP_CipherUpdate(ctx, NULL, &outlen3, gcmAAD, sizeof(gcmAAD)))) { + errmsg = "AAD1"; + goto err; + } + EVP_CIPHER_CTX_set_padding(ctx, 0); + if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, gcmResetPlaintext, + sizeof(gcmResetPlaintext)))) { + errmsg = "CIPHER_UPDATE1"; + goto err; + } + if (!TEST_true(EVP_CipherFinal_ex(ctx, outbuf + outlen1, &outlen2))) { + errmsg = "CIPHER_FINAL1"; + goto err; + } + if (!TEST_mem_eq(t->expected1, t->expectedlen1, outbuf, outlen1 + outlen2)) { + errmsg = "WRONG_RESULT1"; + goto err; + } + if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag))) { + errmsg = "GET_TAG1"; + goto err; + } + if (!TEST_mem_eq(t->tag1, taglen, tag, taglen)) { + errmsg = "TAG_ERROR1"; + goto err; + } + /* Now reinit */ + if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_IVLEN, t->ivlen2, NULL))) { + errmsg = "SET_IVLEN2"; + goto err; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, NULL, NULL, NULL, t->iv2, -1))) { + errmsg = "SET_IV2"; + goto err; + } + if (!TEST_true(EVP_CipherUpdate(ctx, NULL, &outlen3, gcmAAD, sizeof(gcmAAD)))) { + errmsg = "AAD2"; + goto err; + } + if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, gcmResetPlaintext, + sizeof(gcmResetPlaintext)))) { + errmsg = "CIPHER_UPDATE2"; + goto err; + } + if (!TEST_true(EVP_CipherFinal_ex(ctx, outbuf + outlen1, &outlen2))) { + errmsg = "CIPHER_FINAL2"; + goto err; + } + if (!TEST_mem_eq(t->expected2, t->expectedlen2, outbuf, outlen1 + outlen2)) { + errmsg = "WRONG_RESULT2"; + goto err; + } + if (!TEST_true(EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag))) { + errmsg = "GET_TAG2"; + goto err; + } + if (!TEST_mem_eq(t->tag2, taglen, tag, taglen)) { + errmsg = "TAG_ERROR2"; + goto err; + } + testresult = 1; + err: + if (errmsg != NULL) + TEST_info("evp_init_test %d: %s", idx, errmsg); + EVP_CIPHER_CTX_free(ctx); + return testresult; +} + +typedef struct { + const char *cipher; + int enc; +} EVP_UPDATED_IV_TEST_st; + +static const EVP_UPDATED_IV_TEST_st evp_updated_iv_tests[] = { + { + "aes-128-cfb", 1 + }, + { + "aes-128-cfb", 0 + }, + { + "aes-128-cfb1", 1 + }, + { + "aes-128-cfb1", 0 + }, + { + "aes-128-cfb128", 1 + }, + { + "aes-128-cfb128", 0 + }, + { + "aes-128-cfb8", 1 + }, + { + "aes-128-cfb8", 0 + }, + { + "aes-128-ofb", 1 + }, + { + "aes-128-ofb", 0 + }, + { + "aes-128-ctr", 1 + }, + { + "aes-128-ctr", 0 + }, + { + "aes-128-cbc", 1 + }, + { + "aes-128-cbc", 0 + } +}; + +/* + * Test that the IV in the context is updated during a crypto operation for CFB + * and OFB. + */ +static int test_evp_updated_iv(int idx) +{ + const EVP_UPDATED_IV_TEST_st *t = &evp_updated_iv_tests[idx]; + int outlen1, outlen2; + int testresult = 0; + unsigned char outbuf[1024]; + EVP_CIPHER_CTX *ctx = NULL; + const EVP_CIPHER *type = NULL; + const unsigned char *updated_iv; + int iv_len; + char *errmsg = NULL; + + if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new())) { + errmsg = "CTX_ALLOC"; + goto err; + } + if ((type = EVP_get_cipherbyname(t->cipher)) == NULL) { + TEST_info("cipher %s not supported, skipping", t->cipher); + goto ok; + } + if (!TEST_true(EVP_CipherInit_ex(ctx, type, NULL, kCFBDefaultKey, iCFBIV, t->enc))) { + errmsg = "CIPHER_INIT"; + goto err; + } + if (!TEST_true(EVP_CIPHER_CTX_set_padding(ctx, 0))) { + errmsg = "PADDING"; + goto err; + } + if (!TEST_true(EVP_CipherUpdate(ctx, outbuf, &outlen1, cfbPlaintext, sizeof(cfbPlaintext)))) { + errmsg = "CIPHER_UPDATE"; + goto err; + } + if (!TEST_ptr(updated_iv = EVP_CIPHER_CTX_iv(ctx))) { + errmsg = "CIPHER_CTX_IV"; + goto err; + } + if (!TEST_true(iv_len = EVP_CIPHER_CTX_iv_length(ctx))) { + errmsg = "CIPHER_CTX_IV_LEN"; + goto err; + } + if (!TEST_mem_ne(iCFBIV, sizeof(iCFBIV), updated_iv, iv_len)) { + errmsg = "IV_NOT_UPDATED"; + goto err; + } + if (!TEST_true(EVP_CipherFinal_ex(ctx, outbuf + outlen1, &outlen2))) { + errmsg = "CIPHER_FINAL"; + goto err; + } + ok: + testresult = 1; + err: + if (errmsg != NULL) + TEST_info("test_evp_updated_iv %d: %s", idx, errmsg); + EVP_CIPHER_CTX_free(ctx); + return testresult; +} + static APK_DATA keydata[] = { {kExampleRSAKeyDER, sizeof(kExampleRSAKeyDER), EVP_PKEY_RSA}, {kExampleRSAKeyPKCS8, sizeof(kExampleRSAKeyPKCS8), EVP_PKEY_RSA}, @@ -818,10 +1396,14 @@ static struct keys_st { } keys[] = { { EVP_PKEY_HMAC, "0123456789", NULL +#ifndef OPENSSL_NO_POLY1305 }, { EVP_PKEY_POLY1305, "01234567890123456789012345678901", NULL +#endif +#ifndef OPENSSL_NO_SIPHASH }, { EVP_PKEY_SIPHASH, "0123456789012345", NULL +#endif }, #ifndef OPENSSL_NO_EC { @@ -851,18 +1433,22 @@ static int test_set_get_raw_keys_int(int tst, int pub) EVP_PKEY *pkey; /* Check if this algorithm supports public keys */ - if (keys[tst].pub == NULL) + if (pub && keys[tst].pub == NULL) return 1; memset(buf, 0, sizeof(buf)); if (pub) { +#ifndef OPENSSL_NO_EC inlen = strlen(keys[tst].pub); in = (unsigned char *)keys[tst].pub; pkey = EVP_PKEY_new_raw_public_key(keys[tst].type, NULL, in, inlen); +#else + return 1; +#endif } else { inlen = strlen(keys[tst].priv); in = (unsigned char *)keys[tst].priv; @@ -873,6 +1459,7 @@ static int test_set_get_raw_keys_int(int tst, int pub) } if (!TEST_ptr(pkey) + || !TEST_int_eq(EVP_PKEY_cmp(pkey, pkey), 1) || (!pub && !TEST_true(EVP_PKEY_get_raw_private_key(pkey, NULL, &len))) || (pub && !TEST_true(EVP_PKEY_get_raw_public_key(pkey, NULL, &len))) || !TEST_true(len == inlen) @@ -1251,5 +1838,10 @@ int setup_tests(void) ADD_TEST(test_EVP_PKEY_set1_DH); #endif + ADD_ALL_TESTS(test_evp_init_seq, OSSL_NELEM(evp_init_tests)); + ADD_ALL_TESTS(test_evp_reset, OSSL_NELEM(evp_reset_tests)); + ADD_ALL_TESTS(test_gcm_reinit, OSSL_NELEM(gcm_reinit_tests)); + ADD_ALL_TESTS(test_evp_updated_iv, OSSL_NELEM(evp_updated_iv_tests)); + return 1; } diff --git a/deps/openssl/openssl/test/recipes/25-test_req.t b/deps/openssl/openssl/test/recipes/25-test_req.t index 5e1ea308a2f1f5..383120c234d9f1 100644 --- a/deps/openssl/openssl/test/recipes/25-test_req.t +++ b/deps/openssl/openssl/test/recipes/25-test_req.t @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -47,7 +47,7 @@ ok(!run(app([@addext_args, "-addext", $val, "-addext", $val3]))); ok(!run(app([@addext_args, "-addext", $val2, "-addext", $val3]))); subtest "generating certificate requests with RSA" => sub { - plan tests => 2; + plan tests => 6; SKIP: { skip "RSA is not supported by this OpenSSL build", 2 @@ -63,6 +63,29 @@ subtest "generating certificate requests with RSA" => sub { "-config", srctop_file("test", "test.cnf"), "-verify", "-in", "testreq.pem", "-noout"])), "Verifying signature on request"); + + ok(run(app(["openssl", "req", + "-config", srctop_file("test", "test.cnf"), + "-new", "-out", "testreq_withattrs_pem.pem", "-utf8", + "-key", srctop_file("test", "testrsa_withattrs.pem")])), + "Generating request from a key with extra attributes - PEM"); + + ok(run(app(["openssl", "req", + "-config", srctop_file("test", "test.cnf"), + "-verify", "-in", "testreq_withattrs_pem.pem", "-noout"])), + "Verifying signature on request from a key with extra attributes - PEM"); + + ok(run(app(["openssl", "req", + "-config", srctop_file("test", "test.cnf"), + "-new", "-out", "testreq_withattrs_der.pem", "-utf8", + "-key", srctop_file("test", "testrsa_withattrs.der"), + "-keyform", "DER"])), + "Generating request from a key with extra attributes - PEM"); + + ok(run(app(["openssl", "req", + "-config", srctop_file("test", "test.cnf"), + "-verify", "-in", "testreq_withattrs_der.pem", "-noout"])), + "Verifying signature on request from a key with extra attributes - PEM"); } }; @@ -165,7 +188,7 @@ run_conversion('req conversions', run_conversion('req conversions -- testreq2', srctop_file("test", "testreq2.pem")); -unlink "testkey.pem", "testreq.pem"; +unlink "testkey.pem", "testreq.pem", "testreq_withattrs_pem.pem", "testreq_withattrs_der.pem"; sub run_conversion { my $title = shift; diff --git a/deps/openssl/openssl/test/recipes/25-test_verify.t b/deps/openssl/openssl/test/recipes/25-test_verify.t index 96b559e5c9aa30..ffa48ed20bbfb4 100644 --- a/deps/openssl/openssl/test/recipes/25-test_verify.t +++ b/deps/openssl/openssl/test/recipes/25-test_verify.t @@ -396,7 +396,8 @@ ok(verify("some-names2", "sslserver", ["many-constraints"], ["many-constraints"] ok(verify("root-cert-rsa2", "sslserver", ["root-cert-rsa2"], [], "-check_ss_sig"), "Public Key Algorithm rsa instead of rsaEncryption"); - ok(verify("ee-self-signed", "sslserver", ["ee-self-signed"], []), +ok(verify("ee-self-signed", "sslserver", ["ee-self-signed"], [], + "-attime", "1593565200"), "accept trusted self-signed EE cert excluding key usage keyCertSign"); SKIP: { diff --git a/deps/openssl/openssl/test/recipes/30-test_evp_data/evppkey.txt b/deps/openssl/openssl/test/recipes/30-test_evp_data/evppkey.txt index 736e0ce4d33f5c..05baeae72a0244 100644 --- a/deps/openssl/openssl/test/recipes/30-test_evp_data/evppkey.txt +++ b/deps/openssl/openssl/test/recipes/30-test_evp_data/evppkey.txt @@ -1,5 +1,5 @@ # -# Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -18444,6 +18444,16 @@ Decrypt = SM2_key1 Input = 30818A0220466BE2EF5C11782EC77864A0055417F407A5AFC11D653C6BCE69E417BB1D05B6022062B572E21FF0DDF5C726BD3F9FF2EAE56E6294713A607E9B9525628965F62CC804203C1B5713B5DB2728EB7BF775E44F4689FC32668BDC564F52EA45B09E8DF2A5F40422084A9D0CC2997092B7D3C404FCE95956EB604D732B2307A8E5B8900ED6608CA5B197 Output = "The floofy bunnies hop at midnight" +# Test with an C1y value < 32 bytes in length (self generated) +Decrypt = SM2_key1 +Input = 3072022070DAD60CDA7C30D64CF4F278A849003581223F5324BFEC9BB329229BFFAD21A6021F18AFAB2B35459D2643243B242BE4EA80C6FA5071D2D847340CC57EB9309E5D04200B772E4DB664B2601E3B85E39C4AA8C2C1910308BE13B331E009C5A9258C29FD040B6D588BE9260A94DA18E0E6 +Output = "Hello World" + +# Test with an C1x and C1y valuey > 32 bytes in length, and longer plaintext (self generated) +Decrypt = SM2_key1 +Input = 3081DD022100CD49634BBCB21CAFFFA6D33669A5A867231CB2A942A14352EF4CAF6DC3344D54022100C35B41D4DEBB3A2735EFEE821B9EBA566BD86900176A0C06672E30EE5CC04E930420C4190A3D80D86C4BD20E99F7E4B59BF6427C6808793533EEA9591D1188EC56B50473747295470E81D951BED279AC1B86A1AFE388CD2833FA9632799EC199C7D364E5663D5A94888BB2358CFCBF6283184DE0CBC41CCEA91D24746E99D231A1DA77AFD83CDF908190ED628B7369724494568A27C782A1D1D7294BCAD80C34569ED22859896301128A8118F48924D8CCD43E998D9533 +Output = "Some longer plaintext for testing SM2 decryption. Blah blah blah blah blah blah blah blah blah blah blah blah blah." + # This is a "fake" test as it does only verify that the SM2 EVP_PKEY interface # is capable of creating a signature without failing, but it does not say # anything about the generated signature being valid, nor does it test the diff --git a/deps/openssl/openssl/test/recipes/70-test_tls13kexmodes.t b/deps/openssl/openssl/test/recipes/70-test_tls13kexmodes.t index 98989b4703a5e4..1f76bcb8c7ef8f 100644 --- a/deps/openssl/openssl/test/recipes/70-test_tls13kexmodes.t +++ b/deps/openssl/openssl/test/recipes/70-test_tls13kexmodes.t @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -195,17 +195,14 @@ $proxy->start() or plan skip_all => "Unable to start up Proxy for tests"; plan tests => 11; ok(TLSProxy::Message->success(), "Initial connection"); -#Test 2: Attempt a resume with no kex modes extension. Should not resume +#Test 2: Attempt a resume with no kex modes extension. Should fail (server +# MUST abort handshake with pre_shared key and no psk_kex_modes) $proxy->clear(); $proxy->clientflags("-sess_in ".$session); my $testtype = DELETE_EXTENSION; $proxy->filter(\&modify_kex_modes_filter); $proxy->start(); -checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE, - checkhandshake::DEFAULT_EXTENSIONS - | checkhandshake::KEY_SHARE_SRV_EXTENSION - | checkhandshake::PSK_CLI_EXTENSION, - "Resume with no kex modes"); +ok(TLSProxy::Message->fail(), "Resume with no kex modes"); #Test 3: Attempt a resume with empty kex modes extension. Should fail (empty # extension is invalid) @@ -243,6 +240,7 @@ checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE, "Resume with non-dhe kex mode"); #Test 6: Attempt a resume with only unrecognised kex modes. Should not resume +# but rather fall back to full handshake $proxy->clear(); $proxy->clientflags("-sess_in ".$session); $testtype = UNKNOWN_KEX_MODES; @@ -252,7 +250,7 @@ checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE, | checkhandshake::PSK_KEX_MODES_EXTENSION | checkhandshake::KEY_SHARE_SRV_EXTENSION | checkhandshake::PSK_CLI_EXTENSION, - "Resume with empty kex modes"); + "Resume with unrecognized kex mode"); #Test 7: Attempt a resume with both non-dhe and dhe kex mode. Should resume with # a key_share diff --git a/deps/openssl/openssl/test/recipes/80-test_ssl_old.t b/deps/openssl/openssl/test/recipes/80-test_ssl_old.t index 377bf090baae6b..6f5fdb76693a5e 100644 --- a/deps/openssl/openssl/test/recipes/80-test_ssl_old.t +++ b/deps/openssl/openssl/test/recipes/80-test_ssl_old.t @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -476,10 +476,10 @@ sub testssl { subtest 'RSA/(EC)DHE/PSK tests' => sub { ###################################################################### - plan tests => 5; + plan tests => 6; SKIP: { - skip "TLSv1.0 is not supported by this OpenSSL build", 5 + skip "TLSv1.0 is not supported by this OpenSSL build", 6 if $no_tls1; SKIP: { @@ -514,6 +514,14 @@ sub testssl { ok(run(test([@ssltest, "-bio_pair", "-tls1", "-cipher", "PSK", "-psk", "abc123"])), 'test tls1 with PSK via BIO pair'); } + + SKIP: { + skip "skipping auto PSK tests", 1 + if ($no_dh || $no_psk || $no_ec); + + ok(run(test(['ssltest_old', '-psk', '0102030405', '-cipher', '@SECLEVEL=2:DHE-PSK-AES128-CCM'])), + 'test auto DH meets security strength'); + } } }; diff --git a/deps/openssl/openssl/test/rsa_test.c b/deps/openssl/openssl/test/rsa_test.c index be6db029410c30..15e8767a2ef5d3 100644 --- a/deps/openssl/openssl/test/rsa_test.c +++ b/deps/openssl/openssl/test/rsa_test.c @@ -306,7 +306,6 @@ static int test_rsa_oaep(int idx) int ret = 0; RSA *key = NULL; unsigned char ptext[256]; - unsigned char ctext[256]; static unsigned char ptext_ex[] = "\x54\x85\x9b\x34\x2c\x49\xea\x2a"; unsigned char ctext_ex[256]; int plen; @@ -328,17 +327,17 @@ static int test_rsa_oaep(int idx) /* Try decrypting corrupted ciphertexts. */ for (n = 0; n < clen; ++n) { - ctext[n] ^= 1; - num = RSA_private_decrypt(clen, ctext, ptext, key, + ctext_ex[n] ^= 1; + num = RSA_private_decrypt(clen, ctext_ex, ptext, key, RSA_PKCS1_OAEP_PADDING); if (!TEST_int_le(num, 0)) goto err; - ctext[n] ^= 1; + ctext_ex[n] ^= 1; } /* Test truncated ciphertexts, as well as negative length. */ for (n = -1; n < clen; ++n) { - num = RSA_private_decrypt(n, ctext, ptext, key, + num = RSA_private_decrypt(n, ctext_ex, ptext, key, RSA_PKCS1_OAEP_PADDING); if (!TEST_int_le(num, 0)) goto err; diff --git a/deps/openssl/openssl/test/sm2_internal_test.c b/deps/openssl/openssl/test/sm2_internal_test.c index 2bb73947ff3bd6..18b1407c9720c4 100644 --- a/deps/openssl/openssl/test/sm2_internal_test.c +++ b/deps/openssl/openssl/test/sm2_internal_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -185,7 +185,7 @@ static int test_sm2_crypt(const EC_GROUP *group, if (!TEST_mem_eq(ctext, ctext_len, expected, ctext_len)) goto done; - if (!TEST_true(sm2_plaintext_size(key, digest, ctext_len, &ptext_len)) + if (!TEST_true(sm2_plaintext_size(ctext, ctext_len, &ptext_len)) || !TEST_int_eq(ptext_len, msg_len)) goto done; diff --git a/deps/openssl/openssl/test/sslapitest.c b/deps/openssl/openssl/test/sslapitest.c index f00d5cb074dec8..64082ed4e539db 100644 --- a/deps/openssl/openssl/test/sslapitest.c +++ b/deps/openssl/openssl/test/sslapitest.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -17,6 +17,7 @@ #include #include #include +#include #include "ssltestlib.h" #include "testutil.h" @@ -1626,6 +1627,168 @@ static int test_psk_tickets(void) return testresult; } + +static int test_extra_tickets(int idx) +{ + SSL_CTX *sctx = NULL, *cctx = NULL; + SSL *serverssl = NULL, *clientssl = NULL; + BIO *bretry = BIO_new(bio_s_always_retry()); + BIO *tmp = NULL; + int testresult = 0; + int stateful = 0; + size_t nbytes; + unsigned char c, buf[1]; + + new_called = 0; + do_cache = 1; + + if (idx >= 3) { + idx -= 3; + stateful = 1; + } + + if (!TEST_ptr(bretry) || !setup_ticket_test(stateful, idx, &sctx, &cctx)) + goto end; + SSL_CTX_sess_set_new_cb(sctx, new_session_cb); + /* setup_ticket_test() uses new_cachesession_cb which we don't need. */ + SSL_CTX_sess_set_new_cb(cctx, new_session_cb); + + if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, + &clientssl, NULL, NULL))) + goto end; + + /* + * Note that we have new_session_cb on both sctx and cctx, so new_called is + * incremented by both client and server. + */ + if (!TEST_true(create_ssl_connection(serverssl, clientssl, + SSL_ERROR_NONE)) + /* Check we got the number of tickets we were expecting */ + || !TEST_int_eq(idx * 2, new_called) + || !TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_int_eq(idx * 2, new_called)) + goto end; + + /* Now try a (real) write to actually send the tickets */ + c = '1'; + if (!TEST_true(SSL_write_ex(serverssl, &c, 1, &nbytes)) + || !TEST_size_t_eq(1, nbytes) + || !TEST_int_eq(idx * 2 + 2, new_called) + || !TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)) + || !TEST_int_eq(idx * 2 + 4, new_called) + || !TEST_int_eq(sizeof(buf), nbytes) + || !TEST_int_eq(c, buf[0]) + || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes))) + goto end; + + /* Try with only requesting one new ticket, too */ + c = '2'; + new_called = 0; + if (!TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_true(SSL_write_ex(serverssl, &c, sizeof(c), &nbytes)) + || !TEST_size_t_eq(sizeof(c), nbytes) + || !TEST_int_eq(1, new_called) + || !TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)) + || !TEST_int_eq(2, new_called) + || !TEST_size_t_eq(sizeof(buf), nbytes) + || !TEST_int_eq(c, buf[0])) + goto end; + + /* Do it again but use dummy writes to drive the ticket generation */ + c = '3'; + new_called = 0; + if (!TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_true(SSL_write_ex(serverssl, &c, 0, &nbytes)) + || !TEST_size_t_eq(0, nbytes) + || !TEST_int_eq(2, new_called) + || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)) + || !TEST_int_eq(4, new_called)) + goto end; + + /* Once more, but with SSL_do_handshake() to drive the ticket generation */ + c = '4'; + new_called = 0; + if (!TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_true(SSL_do_handshake(serverssl)) + || !TEST_int_eq(2, new_called) + || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)) + || !TEST_int_eq(4, new_called)) + goto end; + + /* + * Use the always-retry BIO to exercise the logic that forces ticket + * generation to wait until a record boundary. + */ + c = '5'; + new_called = 0; + tmp = SSL_get_wbio(serverssl); + if (!TEST_ptr(tmp) || !TEST_true(BIO_up_ref(tmp))) { + tmp = NULL; + goto end; + } + SSL_set0_wbio(serverssl, bretry); + bretry = NULL; + if (!TEST_false(SSL_write_ex(serverssl, &c, 1, &nbytes)) + || !TEST_int_eq(SSL_get_error(serverssl, 0), SSL_ERROR_WANT_WRITE) + || !TEST_size_t_eq(nbytes, 0)) + goto end; + /* Restore a BIO that will let the write succeed */ + SSL_set0_wbio(serverssl, tmp); + tmp = NULL; + /* + * These calls should just queue the request and not send anything + * even if we explicitly try to hit the state machine. + */ + if (!TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_true(SSL_new_session_ticket(serverssl)) + || !TEST_int_eq(0, new_called) + || !TEST_true(SSL_do_handshake(serverssl)) + || !TEST_int_eq(0, new_called)) + goto end; + /* Re-do the write; still no tickets sent */ + if (!TEST_true(SSL_write_ex(serverssl, &c, 1, &nbytes)) + || !TEST_size_t_eq(1, nbytes) + || !TEST_int_eq(0, new_called) + || !TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)) + || !TEST_int_eq(0, new_called) + || !TEST_int_eq(sizeof(buf), nbytes) + || !TEST_int_eq(c, buf[0]) + || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes))) + goto end; + /* Even trying to hit the state machine now will still not send tickets */ + if (!TEST_true(SSL_do_handshake(serverssl)) + || !TEST_int_eq(0, new_called)) + goto end; + /* Now the *next* write should send the tickets */ + c = '6'; + if (!TEST_true(SSL_write_ex(serverssl, &c, 1, &nbytes)) + || !TEST_size_t_eq(1, nbytes) + || !TEST_int_eq(2, new_called) + || !TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes)) + || !TEST_int_eq(4, new_called) + || !TEST_int_eq(sizeof(buf), nbytes) + || !TEST_int_eq(c, buf[0]) + || !TEST_false(SSL_read_ex(clientssl, buf, sizeof(buf), &nbytes))) + goto end; + + SSL_shutdown(clientssl); + SSL_shutdown(serverssl); + testresult = 1; + + end: + BIO_free(bretry); + BIO_free(tmp); + SSL_free(serverssl); + SSL_free(clientssl); + SSL_CTX_free(sctx); + SSL_CTX_free(cctx); + clientssl = serverssl = NULL; + sctx = cctx = NULL; + return testresult; +} #endif #define USE_NULL 0 @@ -1826,8 +1989,10 @@ static int execute_test_ssl_bio(int pop_ssl, bio_change_t change_bio) /* Verify changing the rbio/wbio directly does not cause leaks */ if (change_bio != NO_BIO_CHANGE) { - if (!TEST_ptr(membio2 = BIO_new(BIO_s_mem()))) + if (!TEST_ptr(membio2 = BIO_new(BIO_s_mem()))) { + ssl = NULL; goto end; + } if (change_bio == CHANGE_RBIO) SSL_set0_rbio(ssl, membio2); else @@ -6713,6 +6878,118 @@ static int test_sni_tls13(void) return testresult; } #endif +/* + * Test that setting an ALPN does not violate RFC + */ +static int test_set_alpn(void) +{ + SSL_CTX *ctx = NULL; + SSL *ssl = NULL; + int testresult = 0; + + unsigned char bad0[] = { 0x00, 'b', 'a', 'd' }; + unsigned char good[] = { 0x04, 'g', 'o', 'o', 'd' }; + unsigned char bad1[] = { 0x01, 'b', 'a', 'd' }; + unsigned char bad2[] = { 0x03, 'b', 'a', 'd', 0x00}; + unsigned char bad3[] = { 0x03, 'b', 'a', 'd', 0x01, 'b', 'a', 'd'}; + unsigned char bad4[] = { 0x03, 'b', 'a', 'd', 0x06, 'b', 'a', 'd'}; + + /* Create an initial SSL_CTX with no certificate configured */ + ctx = SSL_CTX_new(TLS_server_method()); + if (!TEST_ptr(ctx)) + goto end; + + /* the set_alpn functions return 0 (false) on success, non-zero (true) on failure */ + if (!TEST_false(SSL_CTX_set_alpn_protos(ctx, NULL, 2))) + goto end; + if (!TEST_false(SSL_CTX_set_alpn_protos(ctx, good, 0))) + goto end; + if (!TEST_false(SSL_CTX_set_alpn_protos(ctx, good, sizeof(good)))) + goto end; + if (!TEST_true(SSL_CTX_set_alpn_protos(ctx, good, 1))) + goto end; + if (!TEST_true(SSL_CTX_set_alpn_protos(ctx, bad0, sizeof(bad0)))) + goto end; + if (!TEST_true(SSL_CTX_set_alpn_protos(ctx, bad1, sizeof(bad1)))) + goto end; + if (!TEST_true(SSL_CTX_set_alpn_protos(ctx, bad2, sizeof(bad2)))) + goto end; + if (!TEST_true(SSL_CTX_set_alpn_protos(ctx, bad3, sizeof(bad3)))) + goto end; + if (!TEST_true(SSL_CTX_set_alpn_protos(ctx, bad4, sizeof(bad4)))) + goto end; + + ssl = SSL_new(ctx); + if (!TEST_ptr(ssl)) + goto end; + + if (!TEST_false(SSL_set_alpn_protos(ssl, NULL, 2))) + goto end; + if (!TEST_false(SSL_set_alpn_protos(ssl, good, 0))) + goto end; + if (!TEST_false(SSL_set_alpn_protos(ssl, good, sizeof(good)))) + goto end; + if (!TEST_true(SSL_set_alpn_protos(ssl, good, 1))) + goto end; + if (!TEST_true(SSL_set_alpn_protos(ssl, bad0, sizeof(bad0)))) + goto end; + if (!TEST_true(SSL_set_alpn_protos(ssl, bad1, sizeof(bad1)))) + goto end; + if (!TEST_true(SSL_set_alpn_protos(ssl, bad2, sizeof(bad2)))) + goto end; + if (!TEST_true(SSL_set_alpn_protos(ssl, bad3, sizeof(bad3)))) + goto end; + if (!TEST_true(SSL_set_alpn_protos(ssl, bad4, sizeof(bad4)))) + goto end; + + testresult = 1; + +end: + SSL_free(ssl); + SSL_CTX_free(ctx); + return testresult; +} + +static int test_inherit_verify_param(void) +{ + int testresult = 0; + + SSL_CTX *ctx = NULL; + X509_VERIFY_PARAM *cp = NULL; + SSL *ssl = NULL; + X509_VERIFY_PARAM *sp = NULL; + int hostflags = X509_CHECK_FLAG_NEVER_CHECK_SUBJECT; + + ctx = SSL_CTX_new(TLS_server_method()); + if (!TEST_ptr(ctx)) + goto end; + + cp = SSL_CTX_get0_param(ctx); + if (!TEST_ptr(cp)) + goto end; + if (!TEST_int_eq(X509_VERIFY_PARAM_get_hostflags(cp), 0)) + goto end; + + X509_VERIFY_PARAM_set_hostflags(cp, hostflags); + + ssl = SSL_new(ctx); + if (!TEST_ptr(ssl)) + goto end; + + sp = SSL_get0_param(ssl); + if (!TEST_ptr(sp)) + goto end; + if (!TEST_int_eq(X509_VERIFY_PARAM_get_hostflags(sp), hostflags)) + goto end; + + testresult = 1; + + end: + SSL_free(ssl); + SSL_CTX_free(ctx); + + return testresult; +} #ifndef OPENSSL_NO_QUIC @@ -7115,6 +7392,7 @@ int setup_tests(void) ADD_ALL_TESTS(test_stateful_tickets, 3); ADD_ALL_TESTS(test_stateless_tickets, 3); ADD_TEST(test_psk_tickets); + ADD_ALL_TESTS(test_extra_tickets, 6); #endif ADD_ALL_TESTS(test_ssl_set_bio, TOTAL_SSL_SET_BIO_TESTS); ADD_TEST(test_ssl_bio_pop_next_bio); @@ -7193,6 +7471,8 @@ int setup_tests(void) #ifndef OPENSSL_NO_TLS1_3 ADD_TEST(test_sni_tls13); #endif + ADD_TEST(test_set_alpn); + ADD_TEST(test_inherit_verify_param); #ifndef OPENSSL_NO_QUIC ADD_ALL_TESTS(test_quic_api, 9); ADD_ALL_TESTS(test_quic_early_data, 3); diff --git a/deps/openssl/openssl/test/testrsa_withattrs.der b/deps/openssl/openssl/test/testrsa_withattrs.der new file mode 100644 index 00000000000000..811e1e0bcb003c Binary files /dev/null and b/deps/openssl/openssl/test/testrsa_withattrs.der differ diff --git a/deps/openssl/openssl/test/testrsa_withattrs.pem b/deps/openssl/openssl/test/testrsa_withattrs.pem new file mode 100644 index 00000000000000..42d0a3c51cfe02 --- /dev/null +++ b/deps/openssl/openssl/test/testrsa_withattrs.pem @@ -0,0 +1,29 @@ +-----BEGIN PRIVATE KEY----- +MIIE+QIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDsh7QWxhftrqng +RC3Ms+HxH2NFCX1sRoiIV4cYK2z0DQdEiNpFdpHlcs3weTuudcpr8XursodVFMTB +eHjROhgwO/LT9xReEUiaoHJgfv6KcKcxEvntCjQkzGhkw03OH5VYdtTRAbwpwcYt +groPiZ2STINpQOmFabzai+K+3rddwTGkkca3C5kY7KOMlnt9IuvmycksRqH6MPKz +P5QbztlgY95rtra+OEzKLYQ1ux6hkaUlpxT5eGKfzYdccwKJWa0dUXyT/8F6rpTm +Zbz3BxdKGAWMywaTfh5ywhNmVNTeIumxIRc3+PInn0rqKTaDrWylxiBdb3t27HxQ +InDZmPwdAgMBAAECggEBAMTRrzN8JxEq1ES/tvStgodoPOyHlwxwLNB3NP0RtZnm +9XM8BZTjs0egnmlKGDV14riruuMGrcJIg+kR3EcN9m68k7V51kLoUugINuTBCAIe +96DIT5vFb9pnFT8znRy1/0obp787mF2O1t+r9jNTqgDBFmCRGUBg2jtpR4bYQPEL +ZjXMDPcsmOlmbBdsyQvjlOHqXjCoUWwOCBEZdtaLzxaOPrBW5Jh2h3Xz1pV3NdZ/ +xufAYRhpJamPNiSipRehBZAeQP2ZAyHj/5x3tgEcA+C04Ki8NvuwJx/6T/lGKD+1 +x3DKsniNi6fEbGlpST/Zp1GY4WyVPcrLa8JxyO+UagECgYEA+gvBBI+LSK5enPXu +WooEQP17fKzdZG7Cic8TfTPbtBIcXjNQFLHjFoBNk+TBFCjZma7L+fEcKcDm+Bg1 +qa4xihOP6BoQqHXZZNZ+9ZU96MPmI9Zb60CMG9lM1VVhSqrm2n3Q+tefod/a2bQk +oz8QsdpsUFqVFCF5l+Tb6lp2QN0CgYEA8imPEml6LG35snBY1H6t0ASCHT1oFdHP +o01WKQas/tuLO+pMfZrA0zLZBExxZuUJloC6COsTcOrlK+hGM60Ab6TgSPbUvYqH +8yMV7SYLvheEngqIiFExmHg79mxnys3Rgv9KMxAV2Ip2wBrBMwUOaURU9pUKXlIN +xiaUuevSVEECgYEA0Dbrcs3JUSuKM7AC3DfjlO6/XrFf5hrpOfJKq058m/Uc1EBs +Zd8/V2RdtVKeiRf/Ix9QUYA6UHaGnn8iaHpaXD0v7zmNN4pzDaojrIKrO+GtCZid +kEd+pE4N0fO4AYJQnA567/aPwi7zQaflfl6smz1kRoE3dLzvUNHNYtgTcq0CgYAm +Op1VgMVCwlHK86VyVlVGI5AO4aTO3QJ0ez8A1wb0bOA8Iy7UHVwXe017Oj4kyj+L +POMhiUrWZp6rIc4DVmpdNaAapKzNB1OS9JT/jSQJbFkJQgxvyLGVqlV8/3wbLgbH +MVobWYy5VJKOnSqmzUOLJrhq/PhYD4gRIgIUn7/igQKBgQCptqrREOq9fXDEpozC +39TL4vDrKJWpB1uK6pBEjgEVD/+tcfziVN40j5hnNFDUu/8kxxp9/4w8mPjdJ0CF +hWIvrXasjnnFehy6IewWCljNH5CfOM64rDoXaF+ESIM4rLBHbQ8KYvaKkMjOcdNB +JG1sRWVU01AwEhnvxS1zbyBtiqA4MDYGCCqFAwIJAwgBMSoEKBqiSOXm8r5I7hEA ++gglN/s0bbRCnzopEhuEorpcnDXrktVtjQrmMi0= +-----END PRIVATE KEY----- diff --git a/deps/openssl/openssl/test/x509_time_test.c b/deps/openssl/openssl/test/x509_time_test.c index b6fd38a5c587a4..93a5b07565f6b2 100644 --- a/deps/openssl/openssl/test/x509_time_test.c +++ b/deps/openssl/openssl/test/x509_time_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -330,10 +330,12 @@ static int test_x509_time(int idx) /* if t is not NULL but expected_string is NULL, it is an 'OK' case too */ if (t != NULL && x509_format_tests[idx].expected_string) { - if (!TEST_str_eq((const char *)t->data, - x509_format_tests[idx].expected_string)) { - TEST_info("test_x509_time(%d) failed: expected_string %s, got %s\n", - idx, x509_format_tests[idx].expected_string, t->data); + if (!TEST_mem_eq((const char *)t->data, t->length, + x509_format_tests[idx].expected_string, + strlen(x509_format_tests[idx].expected_string))) { + TEST_info("test_x509_time(%d) failed: expected_string %s, got %.*s\n", + idx, x509_format_tests[idx].expected_string, t->length, + t->data); goto out; } } diff --git a/deps/openssl/openssl/util/libssl.num b/deps/openssl/openssl/util/libssl.num index 7c8f9463abff09..e4df4b580fabe3 100644 --- a/deps/openssl/openssl/util/libssl.num +++ b/deps/openssl/openssl/util/libssl.num @@ -514,3 +514,4 @@ SSL_set_quic_transport_version 20012 1_1_1i EXIST::FUNCTION:QUIC SSL_get_peer_quic_transport_version 20013 1_1_1i EXIST::FUNCTION:QUIC SSL_get_quic_transport_version 20014 1_1_1i EXIST::FUNCTION:QUIC SSL_set_quic_early_data_enabled 20015 1_1_1j EXIST::FUNCTION:QUIC +SSL_new_session_ticket 20016 1_1_1k EXIST::FUNCTION: diff --git a/deps/openssl/openssl/util/mkdir-p.pl b/deps/openssl/openssl/util/mkdir-p.pl index 328060243f3c5a..b02db98f031008 100755 --- a/deps/openssl/openssl/util/mkdir-p.pl +++ b/deps/openssl/openssl/util/mkdir-p.pl @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -34,11 +34,12 @@ sub do_mkdir_p { } unless (mkdir($dir, 0777)) { + local($err) = $!; if (-d $dir) { # We raced against another instance doing the same thing. return; } - die "Cannot create directory $dir: $!\n"; + die "Cannot create directory $dir: $err\n"; } print "created directory `$dir'\n"; } diff --git a/deps/v8/.bazelrc b/deps/v8/.bazelrc new file mode 100644 index 00000000000000..e0127628ca93aa --- /dev/null +++ b/deps/v8/.bazelrc @@ -0,0 +1,26 @@ +# 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. + +# V8 bazel port only supports clang +build --action_env=BAZEL_COMPILER=clang +build --action_env=CC=clang +build --action_env=CXX=clang++ +build --action_env=PATH + +# V8 debug config +build:debug --compilation_mode=dbg +build:debug --config=v8_enable_debugging_features +build:debug --//:v8_enable_fast_mksnapshot +build:debug --//:v8_enable_backtrace + +# v8_enable_debugging_features flags +build:v8_enable_debugging_features --//:v8_enable_verify_heap +build:v8_enable_debugging_features --//:v8_enable_object_print +build:v8_enable_debugging_features --//:v8_enable_disassembler +build:v8_enable_debugging_features --//:v8_enable_trace_maps +build:v8_enable_debugging_features --//:v8_enable_test_features +build:v8_enable_debugging_features --//:v8_enable_v8_checks +build:v8_enable_debugging_features --//:v8_code_comments +build:v8_enable_debugging_features --//:v8_enable_debug_code +build:v8_enable_debugging_features --//:v8_enable_snapshot_native_code_counters diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index b340100517a5a4..315f3ae0be65ad 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -51,6 +51,7 @@ /test/benchmarks/data /test/fuzzer/wasm_corpus /test/fuzzer/wasm_corpus.tar.gz +!/test/mjsunit/tools/*.log /test/mozilla/data /test/test262/data /test/test262/harness @@ -111,7 +112,10 @@ turbo*.cfg turbo*.dot turbo*.json v8.ignition_dispatches_table.json - +bazel-bin +bazel-out +bazel-testlogs +bazel-v8 !/third_party/jinja2 !/third_party/markupsafe !/third_party/zlib diff --git a/deps/v8/.mailmap b/deps/v8/.mailmap new file mode 100644 index 00000000000000..7f2e3b9e5e9098 --- /dev/null +++ b/deps/v8/.mailmap @@ -0,0 +1,14 @@ +# 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. + +# People change their names or email addresses for many reasons. This +# list makes sure people’s preferences are respected when using Git +# commands such as `git log` or `git blame`. +# +# See https://git-scm.com/docs/gitmailmap for more information. +# +# Please keep the list sorted. + +Clemens Backes Clemens Hammacher +Timothy Gu diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 8b0d38adfc4f04..ea786ddea4c085 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -127,6 +127,7 @@ Jay Freeman James Pike James M Snell Javad Amiri +Jesper van den Ende Ji Qiu Jianghua Yang Jiawen Geng @@ -164,6 +165,7 @@ Michael Lutz Michael Mclaughlin Michael Smith Michaël Zasso +Mihir Shah Mike Gilbert Mike Pennisi Mikhail Gusarov @@ -213,6 +215,7 @@ Seo Sanghyeon Shawn Anastasio Shawn Presser Stefan Penner +Stephan Hartmann Stephen Belanger Sylvestre Ledru Taketoshi Aono @@ -229,6 +232,7 @@ Victor Costan Vlad Burlik Vladimir Krivosheev Vladimir Shutoff +Wael Almattar Wei Wu Wenlu Wang Wenyu Zhao @@ -247,6 +251,7 @@ Yuri Iozzelli Zac Hansen Zeynep Cankara Zhao Jiazhong +Zheng Liu Zhongping Wang 柳荣一 Tianping Yang diff --git a/deps/v8/BUILD.bazel b/deps/v8/BUILD.bazel new file mode 100644 index 00000000000000..e0d5ce713852ca --- /dev/null +++ b/deps/v8/BUILD.bazel @@ -0,0 +1,3052 @@ +# 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. + +load("@bazel_skylib//lib:selects.bzl", "selects") +load( + "@v8//:bazel/defs.bzl", + "v8_binary", + "v8_config", + "v8_custom_config", + "v8_raw_flag", + "v8_flag", + "v8_int", + "v8_string", + "v8_library", + "v8_torque", + "v8_mksnapshot", +) + +# ================================================= +# Configuration settings +# ================================================= + +config_setting( + name = "is_debug", + values = { + "compilation_mode": "dbg", + }, +) + +config_setting( + name = "is_k8", + values = {"cpu": "k8"}, +) + +config_setting( + name = "is_darwin", + values = {"cpu": "darwin"}, +) + +selects.config_setting_group( + name = "is_x64", + match_any = [":is_k8", ":is_darwin"], +) + +config_setting( + name = "is_arm64", + values = { + "host_cpu": "k8", + "cpu": "arm", + }, +) + +config_setting( + name = "is_ia32", + values = { + "host_cpu": "k8", + "cpu": "x86", + }, +) + +config_setting( + name = "is_arm", + values = { + "host_cpu": "k8", + "cpu": "armeabi-v7a", + }, +) + +selects.config_setting_group( + name = "is_32bits", + match_any = [":is_ia32", ":is_arm"], +) + +config_setting( + name = "is_linux", + constraint_values = ["@platforms//os:linux"], +) + +config_setting( + name = "is_android", + constraint_values = ["@platforms//os:android"], +) + +config_setting( + name = "is_macos", + constraint_values = ["@platforms//os:macos"], +) + +selects.config_setting_group( + name = "is_posix", + match_any = [":is_linux", ":is_android", ":is_macos"], +) + +config_setting( + name = "is_linux_x64", + constraint_values = ["@platforms//os:linux"], + values = {"cpu": "k8"}, +) + +config_setting( + name = "is_macos_x64", + constraint_values = ["@platforms//os:macos"], + values = {"cpu": "darwin"}, +) + +selects.config_setting_group( + name = "is_linux_x64_or_macos_x64", + match_any = [":is_linux_x64", ":is_macos_x64"], +) + +config_setting( + name = "is_android_x86", + constraint_values = ["@platforms//os:android"], + values = {"cpu": "x86"}, +) + +# ================================================= +# Flags +# ================================================= + +# V8 GN flags not currently supported: +# v8_custom_deps +# v8_embed_script +# v8_embedder_string +# v8_promise_internal_field_count +# v8_enable_vtunejit +# v8_enable_vtunetracemark +# v8_enable_fast_torque +# v8_win64_unwinding_info +# v8_enable_31bit_smis_on_64bit_arch +# v8_enable_trace_unoptimized +# v8_enable_trace_ignition +# v8_enable_trace_baseline_exec +# v8_enable_trace_feedback_updates +# v8_enable_atomic_object_field_writes +# v8_enable_atomic_marking_state +# v8_enable_concurrent_marking +# v8_enable_ignition_dispatch_counting +# v8_enable_builtins_profiling +# v8_enable_builtins_profiling_verbose +# v8_builtins_profiling_log_file +# v8_enable_short_builtin_calls +# v8_enable_external_code_space +# v8_postmortem_support +# v8_use_siphash +# v8_no_inline +# v8_os_page_size +# v8_can_use_fpu_instructions +# v8_use_mips_abi_hardfloat +# v8_enable_gdbjit +# v8_untrusted_code_mitigations +# v8_enable_minor_mc +# v8_check_header_includes +# v8_enable_shared_ro_heap +# v8_enable_lazy_source_positions +# v8_enable_third_party_heap +# v8_third_party_heap_files +# v8_disable_write_barriers +# v8_enable_unconditional_write_barriers +# v8_enable_single_generation +# v8_enable_regexp_interpreter_threaded_dispatch +# v8_verify_torque_generation_invariance +# v8_enable_snapshot_compression +# v8_control_flow_integrity +# cppgc_enable_object_names +# cppgc_enable_caged_heap +# cppgc_enable_verify_live_bytes +# cppgc_enable_check_assignments_in_prefinalizers +# cppgc_enable_young_generation +# v8_enable_zone_compression +# v8_enable_heap_sandbox +# v8_enable_precise_zone_stats +# v8_enable_swiss_name_dictionary +# v8_generate_external_defines_header +# v8_dict_property_const_tracking +# v8_enable_map_packing +# v8_allow_javascript_in_promise_hooks +# v8_enable_allocation_folding +# v8_allocation_site_tracking + +v8_string(name = "v8_root", default = ".") + +v8_flag(name = "v8_android_log_stdout") +v8_flag(name = "v8_annotate_torque_ir") + +v8_flag(name = "v8_code_comments") + +v8_flag(name = "v8_deprecation_warnings", default = True) +v8_flag(name = "v8_imminent_deprecation_warnings", default = True) + +v8_flag(name = "v8_enable_backtrace") +v8_flag(name = "v8_enable_debug_code") +v8_flag(name = "v8_enable_disassembler") +v8_flag(name = "v8_enable_handle_zapping", default = True) +v8_flag(name = "v8_enable_hugepage") +v8_flag(name = "v8_enable_fast_mksnapshot") +v8_flag(name = "v8_enable_future") +v8_flag(name = "v8_enable_i18n_support", default = True) +v8_flag(name = "v8_enable_lazy_source_positions", default = True) +v8_flag(name = "v8_enable_minor_mc", default = True) +v8_flag(name = "v8_enable_object_print") +v8_flag(name = "v8_enable_slow_dchecks") +v8_flag(name = "v8_enable_snapshot_code_comments") +v8_flag(name = "v8_enable_snapshot_native_code_counters") +v8_flag(name = "v8_enable_trace_maps") +v8_flag(name = "v8_enable_v8_checks") +v8_flag(name = "v8_enable_verify_csa") +v8_flag(name = "v8_enable_verify_heap") +v8_flag(name = "v8_enable_verify_predictable") +v8_flag(name = "v8_enable_test_features") +v8_flag(name = "v8_enable_webassembly", default = True) + +v8_int(name = "v8_typed_array_max_size_in_heap", default = 64) + +# Pointer compression, true by default if x64 or arm64. +v8_raw_flag(name = "v8_enable_pointer_compression") +selects.config_setting_group( + name = "is_v8_enable_pointer_compression", + match_any = [ ":raw_v8_enable_pointer_compression", ":is_x64", ":is_arm64" ], +) +# Pointer cage, true by default if v8_enable_pointer_compression. +v8_flag(name = "v8_enable_pointer_compression_shared_cage", default = True) +# Enable shared cage if v8_enable_pointer_compression +# and v8_enable_pointer_compression_shared_cage. +selects.config_setting_group( + name = "enable_pointer_compression_shared_cage", + match_all = [ + ":is_v8_enable_pointer_compression", + ":is_v8_enable_pointer_compression_shared_cage", + ], +) +# Enable isolated cage if v8_enable_pointer_compression and +# NOT v8_enable_pointer_compression_shared_cage. +selects.config_setting_group( + name = "enable_pointer_compression_isolated_cage", + match_all = [ + ":is_v8_enable_pointer_compression", + ":is_not_v8_enable_pointer_compression_shared_cage", + ], +) + +# Enable -rdynamic. +selects.config_setting_group( + name = "should_add_rdynamic", + match_all = [ ":is_linux", ":is_v8_enable_backtrace" ], +) + +v8_custom_config(name = "default") + +v8_config( + name = "define_flags", + conditional_defines = { + "v8_android_log_stdout": "V8_ANDROID_LOG_STDOUT", + "v8_code_comments": "V8_CODE_COMMENTS", + "v8_deprecation_warnings": "V8_DEPRECATION_WARNINGS", + "v8_imminent_deprecation_warnings": "V8_IMMINENT_DEPRECATION_WARNINGS", + "v8_enable_debug_code": "V8_ENABLE_DEBUG_CODE", + "v8_enable_disassembler": "ENABLE_DISASSEMBLER", + "v8_enable_handle_zapping": "ENABLE_HANDLE_ZAPPING", + "v8_enable_hugepage": "ENABLE_HUGEPAGE", + "v8_enable_future": "V8_ENABLE_FUTURE", + "v8_enable_i18n_support": "V8_INTL_SUPPORT", + "v8_enable_lazy_source_positions": "V8_ENABLE_LAZY_SOURCE_POSITIONS", + "v8_enable_minor_mc": "ENABLE_MINOR_MC", + "v8_enable_object_print": "OBJECT_PRINT", + "v8_enable_slow_dchecks": "ENABLE_SLOW_DCHECKS", + "v8_enable_snapshot_native_code_counters": + "V8_SNAPSHOT_NATIVE_CODE_COUNTERS", + "v8_enable_trace_maps": "V8_TRACE_MAPS", + "v8_enable_v8_checks": "V8_ENABLE_CHECKS", + "v8_enable_verify_csa": "ENABLE_VERIFY_CSA", + "v8_enable_verify_heap": "VERIFY_HEAP", + "v8_enable_verify_predictable": "VERIFY_PREDICTABLE", + "v8_enable_webassembly": "V8_ENABLE_WEBASSEMBLY", + }, + defines = [ + "GOOGLE3", + "CHROMIUM_ZLIB_NO_CHROMECONF", + "V8_ADVANCED_BIGINT_ALGORITHMS", + "V8_CONCURRENT_MARKING", + ] + select({ + ":is_debug": [ "DEBUG" ], + "//conditions:default": [], + }) + select({ + ":is_ia32": [ "V8_TARGET_ARCH_IA32" ], + ":is_x64": [ "V8_TARGET_ARCH_X64" ], + ":is_arm": [ + "V8_TARGET_ARCH_ARM", + "CAN_USE_ARMV7_INSTRUCTIONS", + "CAN_USE_VFP3_INSTRUCTIONS", + ], + ":is_arm64": [ "V8_TARGET_ARCH_ARM64" ], + }) + select({ + ":is_android": [ + "V8_HAVE_TARGET_OS", + "V8_TARGET_OS_ANDROID", + ], + ":is_linux": [ + "V8_HAVE_TARGET_OS", + "V8_TARGET_OS_LINUX", + ], + ":is_macos": [ + "V8_HAVE_TARGET_OS", + "V8_TARGET_OS_MACOSX", + ], + }) + select({ + ":is_android_x86": [ "DISABLE_UNTRUSTED_CODE_MITIGATIONS" ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_pointer_compression": [ + "V8_COMPRESS_POINTERS", + "V8_31BIT_SMIS_ON_64BIT_ARCH", + ], + "//conditions:default": [], + }) + select({ + ":enable_pointer_compression_shared_cage": [ + "V8_COMPRESS_POINTERS_IN_SHARED_CAGE" + ], + ":enable_pointer_compression_isolated_cage": [ + "V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE" + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_test_features": [ + "V8_ENABLE_ALLOCATION_TIMEOUT", + "V8_ENABLE_FORCE_SLOW_PATH", + "V8_ENABLE_DOUBLE_CONST_STORE_CHECK", + ], + "//conditions:default": [], + }), + deps = [ ":default" ], +) + +# ================================================= +# File group rules +# ================================================= + +filegroup( + name = "v8_config_headers_files", + srcs = [ + "include/v8-platform.h", + "include/v8config.h", + ], +) + +filegroup( + name = "v8_version_files", + srcs = [ + "include/v8-value-serializer-version.h", + "include/v8-version-string.h", + "include/v8-version.h", + ], +) + +filegroup( + name = "cppgc_headers_files", + srcs = [ + "include/cppgc/allocation.h", + "include/cppgc/common.h", + "include/cppgc/custom-space.h", + "include/cppgc/default-platform.h", + "include/cppgc/ephemeron-pair.h", + "include/cppgc/explicit-management.h", + "include/cppgc/garbage-collected.h", + "include/cppgc/heap-consistency.h", + "include/cppgc/heap-state.h", + "include/cppgc/heap-statistics.h", + "include/cppgc/heap.h", + "include/cppgc/internal/api-constants.h", + "include/cppgc/internal/atomic-entry-flag.h", + "include/cppgc/internal/caged-heap-local-data.h", + "include/cppgc/internal/compiler-specific.h", + "include/cppgc/internal/finalizer-trait.h", + "include/cppgc/internal/gc-info.h", + "include/cppgc/internal/logging.h", + "include/cppgc/internal/name-trait.h", + "include/cppgc/internal/persistent-node.h", + "include/cppgc/internal/pointer-policies.h", + "include/cppgc/internal/prefinalizer-handler.h", + "include/cppgc/internal/write-barrier.h", + "include/cppgc/liveness-broker.h", + "include/cppgc/macros.h", + "include/cppgc/member.h", + "include/cppgc/name-provider.h", + "include/cppgc/object-size-trait.h", + "include/cppgc/persistent.h", + "include/cppgc/platform.h", + "include/cppgc/prefinalizer.h", + "include/cppgc/process-heap-statistics.h", + "include/cppgc/sentinel-pointer.h", + "include/cppgc/source-location.h", + "include/cppgc/trace-trait.h", + "include/cppgc/type-traits.h", + "include/cppgc/visitor.h", + ] +) + +filegroup( + name = "v8_headers_files", + srcs = [ + ":cppgc_headers_files", + ":v8_version_files", + "include/v8-cppgc.h", + "include/v8-fast-api-calls.h", + "include/v8-internal.h", + "include/v8-profiler.h", + "include/v8-util.h", + "include/v8.h", + ], +) + +filegroup( + name = "v8_flags", + srcs = [ + "src/flags/flag-definitions.h", + "src/flags/flags.h", + ] + select({ + "is_v8_enable_webassembly": [ "src/wasm/wasm-feature-flags.h" ], + "//conditions:default": [], + }), +) + +filegroup( + name = "v8_shared_internal_headers", + srcs = [ + "src/common/globals.h", + "testing/gtest/include/gtest/gtest_prod.h", + ] + select({ + "is_v8_enable_webassembly": [ + "src/wasm/wasm-constants.h", + "src/wasm/wasm-limits.h", + ], + "//conditions:default": [], + }), +) + +filegroup( + name = "v8_libbase_files", + srcs = [ + ":v8_flags", + ":v8_config_headers_files", + ":v8_headers_files", + "src/base/vlq.h", + "src/base/address-region.h", + "src/base/atomic-utils.h", + "src/base/atomicops.h", + "src/base/atomicops_internals_atomicword_compat.h", + "src/base/base-export.h", + "src/base/bit-field.h", + "src/base/bits-iterator.h", + "src/base/bits.cc", + "src/base/bits.h", + "src/base/bounded-page-allocator.cc", + "src/base/bounded-page-allocator.h", + "src/base/bounds.h", + "src/base/build_config.h", + "src/base/compiler-specific.h", + "src/base/cpu.cc", + "src/base/cpu.h", + "src/base/debug/stack_trace.cc", + "src/base/debug/stack_trace.h", + "src/base/division-by-constant.cc", + "src/base/division-by-constant.h", + "src/base/enum-set.h", + "src/base/export-template.h", + "src/base/file-utils.cc", + "src/base/file-utils.h", + "src/base/flags.h", + "src/base/free_deleter.h", + "src/base/functional.cc", + "src/base/functional.h", + "src/base/hashmap-entry.h", + "src/base/hashmap.h", + "src/base/ieee754.cc", + "src/base/ieee754.h", + "src/base/immediate-crash.h", + "src/base/iterator.h", + "src/base/lazy-instance.h", + "src/base/logging.cc", + "src/base/logging.h", + "src/base/macros.h", + "src/base/memory.h", + "src/base/numbers/bignum-dtoa.cc", + "src/base/numbers/bignum-dtoa.h", + "src/base/numbers/bignum.cc", + "src/base/numbers/bignum.h", + "src/base/numbers/cached-powers.cc", + "src/base/numbers/cached-powers.h", + "src/base/numbers/diy-fp.cc", + "src/base/numbers/diy-fp.h", + "src/base/numbers/double.h", + "src/base/numbers/dtoa.cc", + "src/base/numbers/dtoa.h", + "src/base/numbers/fast-dtoa.cc", + "src/base/numbers/fast-dtoa.h", + "src/base/numbers/fixed-dtoa.cc", + "src/base/numbers/fixed-dtoa.h", + "src/base/numbers/strtod.cc", + "src/base/numbers/strtod.h", + "src/base/once.cc", + "src/base/once.h", + "src/base/optional.h", + "src/base/overflowing-math.h", + "src/base/page-allocator.cc", + "src/base/page-allocator.h", + "src/base/platform/condition-variable.cc", + "src/base/platform/condition-variable.h", + "src/base/platform/elapsed-timer.h", + "src/base/platform/mutex.cc", + "src/base/platform/mutex.h", + "src/base/platform/platform.h", + "src/base/platform/semaphore.cc", + "src/base/platform/semaphore.h", + "src/base/platform/time.cc", + "src/base/platform/time.h", + "src/base/platform/wrappers.h", + "src/base/region-allocator.cc", + "src/base/region-allocator.h", + "src/base/ring-buffer.h", + "src/base/safe_conversions.h", + "src/base/safe_conversions_arm_impl.h", + "src/base/safe_conversions_impl.h", + "src/base/small-vector.h", + "src/base/strings.cc", + "src/base/strings.h", + "src/base/sys-info.cc", + "src/base/sys-info.h", + "src/base/template-utils.h", + "src/base/timezone-cache.h", + "src/base/threaded-list.h", + "src/base/type-traits.h", + "src/base/utils/random-number-generator.cc", + "src/base/utils/random-number-generator.h", + "src/base/vector.h", + "src/base/v8-fallthrough.h", + "src/base/vlq-base64.cc", + "src/base/vlq-base64.h", + ] + select({ + ":is_posix": [ + "src/base/platform/platform-posix.cc", + "src/base/platform/platform-posix.h", + "src/base/platform/platform-posix-time.cc", + "src/base/platform/platform-posix-time.h", + ], + "//conditions:default": [], + }) + select({ + ":is_linux": [ + "src/base/debug/stack_trace_posix.cc", + "src/base/platform/platform-linux.cc", + ], + "is_android": [ + "src/base/debug/stack_trace_android.cc", + "src/base/platform/platform-linux.cc", + ], + "is_macos": [ + "src/base/debug/stack_trace_posix.cc", + "src/base/platform/platform-macos.cc", + ], + }), +) + +filegroup( + name = "v8_libplatform_files", + srcs = [ + "base/trace_event/common/trace_event_common.h", + "include/libplatform/libplatform.h", + "include/libplatform/libplatform-export.h", + "include/libplatform/v8-tracing.h", + "src/libplatform/default-foreground-task-runner.cc", + "src/libplatform/default-foreground-task-runner.h", + "src/libplatform/default-job.cc", + "src/libplatform/default-job.h", + "src/libplatform/default-platform.cc", + "src/libplatform/default-platform.h", + "src/libplatform/default-worker-threads-task-runner.cc", + "src/libplatform/default-worker-threads-task-runner.h", + "src/libplatform/delayed-task-queue.cc", + "src/libplatform/delayed-task-queue.h", + "src/libplatform/task-queue.cc", + "src/libplatform/task-queue.h", + "src/libplatform/tracing/recorder.h", + "src/libplatform/tracing/trace-buffer.cc", + "src/libplatform/tracing/trace-buffer.h", + "src/libplatform/tracing/trace-config.cc", + "src/libplatform/tracing/trace-object.cc", + "src/libplatform/tracing/trace-writer.cc", + "src/libplatform/tracing/trace-writer.h", + "src/libplatform/tracing/tracing-controller.cc", + "src/libplatform/worker-thread.cc", + "src/libplatform/worker-thread.h", + ], +) + +filegroup( + name = "v8_libsampler_files", + srcs = [ + "src/libsampler/sampler.cc", + "src/libsampler/sampler.h", + ], +) + +filegroup( + name = "torque_runtime_support_files", + srcs = [ "src/torque/runtime-support.h" ], +) + +filegroup( + name = "torque_files", + srcs = [ + "src/builtins/aggregate-error.tq", + "src/builtins/array-at.tq", + "src/builtins/array-copywithin.tq", + "src/builtins/array-every.tq", + "src/builtins/array-filter.tq", + "src/builtins/array-find.tq", + "src/builtins/array-findindex.tq", + "src/builtins/array-foreach.tq", + "src/builtins/array-from.tq", + "src/builtins/array-isarray.tq", + "src/builtins/array-join.tq", + "src/builtins/array-lastindexof.tq", + "src/builtins/array-map.tq", + "src/builtins/array-of.tq", + "src/builtins/array-reduce-right.tq", + "src/builtins/array-reduce.tq", + "src/builtins/array-reverse.tq", + "src/builtins/array-shift.tq", + "src/builtins/array-slice.tq", + "src/builtins/array-some.tq", + "src/builtins/array-splice.tq", + "src/builtins/array-unshift.tq", + "src/builtins/array.tq", + "src/builtins/arraybuffer.tq", + "src/builtins/base.tq", + "src/builtins/boolean.tq", + "src/builtins/builtins-bigint.tq", + "src/builtins/builtins-string.tq", + "src/builtins/cast.tq", + "src/builtins/collections.tq", + "src/builtins/constructor.tq", + "src/builtins/conversion.tq", + "src/builtins/convert.tq", + "src/builtins/console.tq", + "src/builtins/data-view.tq", + "src/builtins/finalization-registry.tq", + "src/builtins/frames.tq", + "src/builtins/frame-arguments.tq", + "src/builtins/function.tq", + "src/builtins/growable-fixed-array.tq", + "src/builtins/ic-callable.tq", + "src/builtins/ic-dynamic-check-maps.tq", + "src/builtins/ic.tq", + "src/builtins/internal-coverage.tq", + "src/builtins/internal.tq", + "src/builtins/iterator.tq", + "src/builtins/math.tq", + "src/builtins/number.tq", + "src/builtins/object-fromentries.tq", + "src/builtins/object.tq", + "src/builtins/promise-abstract-operations.tq", + "src/builtins/promise-all.tq", + "src/builtins/promise-all-element-closure.tq", + "src/builtins/promise-any.tq", + "src/builtins/promise-constructor.tq", + "src/builtins/promise-finally.tq", + "src/builtins/promise-misc.tq", + "src/builtins/promise-race.tq", + "src/builtins/promise-reaction-job.tq", + "src/builtins/promise-resolve.tq", + "src/builtins/promise-then.tq", + "src/builtins/promise-jobs.tq", + "src/builtins/proxy-constructor.tq", + "src/builtins/proxy-delete-property.tq", + "src/builtins/proxy-get-property.tq", + "src/builtins/proxy-get-prototype-of.tq", + "src/builtins/proxy-has-property.tq", + "src/builtins/proxy-is-extensible.tq", + "src/builtins/proxy-prevent-extensions.tq", + "src/builtins/proxy-revocable.tq", + "src/builtins/proxy-revoke.tq", + "src/builtins/proxy-set-property.tq", + "src/builtins/proxy-set-prototype-of.tq", + "src/builtins/proxy.tq", + "src/builtins/reflect.tq", + "src/builtins/regexp-exec.tq", + "src/builtins/regexp-match-all.tq", + "src/builtins/regexp-match.tq", + "src/builtins/regexp-replace.tq", + "src/builtins/regexp-search.tq", + "src/builtins/regexp-source.tq", + "src/builtins/regexp-split.tq", + "src/builtins/regexp-test.tq", + "src/builtins/regexp.tq", + "src/builtins/string-at.tq", + "src/builtins/string-endswith.tq", + "src/builtins/string-html.tq", + "src/builtins/string-includes.tq", + "src/builtins/string-indexof.tq", + "src/builtins/string-iterator.tq", + "src/builtins/string-match-search.tq", + "src/builtins/string-pad.tq", + "src/builtins/string-repeat.tq", + "src/builtins/string-replaceall.tq", + "src/builtins/string-slice.tq", + "src/builtins/string-startswith.tq", + "src/builtins/string-substr.tq", + "src/builtins/string-substring.tq", + "src/builtins/string-trim.tq", + "src/builtins/symbol.tq", + "src/builtins/torque-internal.tq", + "src/builtins/typed-array-at.tq", + "src/builtins/typed-array-createtypedarray.tq", + "src/builtins/typed-array-every.tq", + "src/builtins/typed-array-entries.tq", + "src/builtins/typed-array-filter.tq", + "src/builtins/typed-array-find.tq", + "src/builtins/typed-array-findindex.tq", + "src/builtins/typed-array-foreach.tq", + "src/builtins/typed-array-from.tq", + "src/builtins/typed-array-keys.tq", + "src/builtins/typed-array-of.tq", + "src/builtins/typed-array-reduce.tq", + "src/builtins/typed-array-reduceright.tq", + "src/builtins/typed-array-set.tq", + "src/builtins/typed-array-slice.tq", + "src/builtins/typed-array-some.tq", + "src/builtins/typed-array-sort.tq", + "src/builtins/typed-array-subarray.tq", + "src/builtins/typed-array-values.tq", + "src/builtins/typed-array.tq", + "src/builtins/weak-ref.tq", + "src/ic/handler-configuration.tq", + "src/objects/allocation-site.tq", + "src/objects/api-callbacks.tq", + "src/objects/arguments.tq", + "src/objects/bigint.tq", + "src/objects/cell.tq", + "src/objects/code.tq", + "src/objects/contexts.tq", + "src/objects/data-handler.tq", + "src/objects/debug-objects.tq", + "src/objects/descriptor-array.tq", + "src/objects/embedder-data-array.tq", + "src/objects/feedback-cell.tq", + "src/objects/feedback-vector.tq", + "src/objects/fixed-array.tq", + "src/objects/foreign.tq", + "src/objects/free-space.tq", + "src/objects/heap-number.tq", + "src/objects/heap-object.tq", + "src/objects/js-array-buffer.tq", + "src/objects/js-array.tq", + "src/objects/js-collection-iterator.tq", + "src/objects/js-collection.tq", + "src/objects/js-function.tq", + "src/objects/js-generator.tq", + "src/objects/js-objects.tq", + "src/objects/js-promise.tq", + "src/objects/js-proxy.tq", + "src/objects/js-regexp-string-iterator.tq", + "src/objects/js-regexp.tq", + "src/objects/js-weak-refs.tq", + "src/objects/literal-objects.tq", + "src/objects/map.tq", + "src/objects/megadom-handler.tq", + "src/objects/microtask.tq", + "src/objects/module.tq", + "src/objects/name.tq", + "src/objects/oddball.tq", + "src/objects/ordered-hash-table.tq", + "src/objects/primitive-heap-object.tq", + "src/objects/promise.tq", + "src/objects/property-array.tq", + "src/objects/property-cell.tq", + "src/objects/property-descriptor-object.tq", + "src/objects/prototype-info.tq", + "src/objects/regexp-match-info.tq", + "src/objects/scope-info.tq", + "src/objects/script.tq", + "src/objects/shared-function-info.tq", + "src/objects/source-text-module.tq", + "src/objects/stack-frame-info.tq", + "src/objects/string.tq", + "src/objects/struct.tq", + "src/objects/swiss-hash-table-helpers.tq", + "src/objects/swiss-name-dictionary.tq", + "src/objects/synthetic-module.tq", + "src/objects/template-objects.tq", + "src/objects/templates.tq", + "src/objects/torque-defined-classes.tq", + "test/torque/test-torque.tq", + "third_party/v8/builtins/array-sort.tq", + ] + select({ + ":is_v8_enable_webassembly": [ + "src/builtins/wasm.tq", + "src/debug/debug-wasm-objects.tq", + "src/wasm/wasm-objects.tq", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_i18n_support": [ + "src/objects/intl-objects.tq", + "src/objects/js-break-iterator.tq", + "src/objects/js-collator.tq", + "src/objects/js-date-time-format.tq", + "src/objects/js-display-names.tq", + "src/objects/js-list-format.tq", + "src/objects/js-locale.tq", + "src/objects/js-number-format.tq", + "src/objects/js-plural-rules.tq", + "src/objects/js-relative-time-format.tq", + "src/objects/js-segment-iterator.tq", + "src/objects/js-segmenter.tq", + "src/objects/js-segments.tq", + ], + "//conditions:default": [], + }) +) + +filegroup( + name = "torque_base_files", + srcs = [ + "src/torque/ast.h", + "src/torque/cc-generator.cc", + "src/torque/cc-generator.h", + "src/torque/cfg.cc", + "src/torque/cfg.h", + "src/torque/class-debug-reader-generator.cc", + "src/torque/constants.h", + "src/torque/contextual.h", + "src/torque/cpp-builder.cc", + "src/torque/cpp-builder.h", + "src/torque/csa-generator.cc", + "src/torque/csa-generator.h", + "src/torque/declarable.cc", + "src/torque/declarable.h", + "src/torque/declaration-visitor.cc", + "src/torque/declaration-visitor.h", + "src/torque/declarations.cc", + "src/torque/declarations.h", + "src/torque/earley-parser.cc", + "src/torque/earley-parser.h", + "src/torque/global-context.cc", + "src/torque/global-context.h", + "src/torque/implementation-visitor.cc", + "src/torque/implementation-visitor.h", + "src/torque/instance-type-generator.cc", + "src/torque/instructions.cc", + "src/torque/instructions.h", + "src/torque/parameter-difference.h", + "src/torque/server-data.cc", + "src/torque/server-data.h", + "src/torque/source-positions.cc", + "src/torque/source-positions.h", + "src/torque/torque-code-generator.cc", + "src/torque/torque-code-generator.h", + "src/torque/torque-compiler.cc", + "src/torque/torque-compiler.h", + "src/torque/torque-parser.cc", + "src/torque/torque-parser.h", + "src/torque/type-inference.cc", + "src/torque/type-inference.h", + "src/torque/type-oracle.cc", + "src/torque/type-oracle.h", + "src/torque/type-visitor.cc", + "src/torque/type-visitor.h", + "src/torque/types.cc", + "src/torque/types.h", + "src/torque/utils.cc", + "src/torque/utils.h", + ], +) + +filegroup( + name = "v8_base_without_compiler_files", + srcs = [ + ":cppgc_base_files", + ":v8_cppgc_shared_files", + ":v8_bigint", + ":generated_bytecode_builtins_list", + "base/trace_event/common/trace_event_common.h", + "include/cppgc/common.h", + "include/v8-inspector-protocol.h", + "include/v8-inspector.h", + "include/v8-metrics.h", + "include/v8-unwinder-state.h", + "include/v8-wasm-trap-handler-posix.h", + "src/api/api-arguments-inl.h", + "src/api/api-arguments.cc", + "src/api/api-arguments.h", + "src/api/api-inl.h", + "src/api/api-macros.h", + "src/api/api-macros-undef.h", + "src/api/api-natives.cc", + "src/api/api-natives.h", + "src/api/api.cc", + "src/api/api.h", + "src/ast/ast-function-literal-id-reindexer.cc", + "src/ast/ast-function-literal-id-reindexer.h", + "src/ast/ast-source-ranges.h", + "src/ast/ast-traversal-visitor.h", + "src/ast/ast-value-factory.cc", + "src/ast/ast-value-factory.h", + "src/ast/ast.cc", + "src/ast/ast.h", + "src/ast/modules.cc", + "src/ast/modules.h", + "src/ast/prettyprinter.cc", + "src/ast/prettyprinter.h", + "src/ast/scopes.cc", + "src/ast/scopes.h", + "src/ast/source-range-ast-visitor.cc", + "src/ast/source-range-ast-visitor.h", + "src/ast/variables.cc", + "src/ast/variables.h", + "src/baseline/baseline-assembler-inl.h", + "src/baseline/baseline-assembler.h", + "src/baseline/baseline-compiler.cc", + "src/baseline/baseline-compiler.h", + "src/baseline/baseline.cc", + "src/baseline/baseline.h", + "src/baseline/baseline-batch-compiler.h", + "src/baseline/baseline-batch-compiler.cc", + "src/baseline/bytecode-offset-iterator.h", + "src/baseline/bytecode-offset-iterator.cc", + "src/builtins/accessors.cc", + "src/builtins/accessors.h", + "src/builtins/builtins-api.cc", + "src/builtins/builtins-array.cc", + "src/builtins/builtins-arraybuffer.cc", + "src/builtins/builtins-async-module.cc", + "src/builtins/builtins-bigint.cc", + "src/builtins/builtins-callsite.cc", + "src/builtins/builtins-collections.cc", + "src/builtins/builtins-console.cc", + "src/builtins/builtins-constructor.h", + "src/builtins/builtins-dataview.cc", + "src/builtins/builtins-date.cc", + "src/builtins/builtins-definitions.h", + "src/builtins/builtins-descriptors.h", + "src/builtins/builtins-error.cc", + "src/builtins/builtins-function.cc", + "src/builtins/builtins-global.cc", + "src/builtins/builtins-internal.cc", + "src/builtins/builtins-json.cc", + "src/builtins/builtins-number.cc", + "src/builtins/builtins-object.cc", + "src/builtins/builtins-promise.h", + "src/builtins/builtins-reflect.cc", + "src/builtins/builtins-regexp.cc", + "src/builtins/builtins-sharedarraybuffer.cc", + "src/builtins/builtins-string.cc", + "src/builtins/builtins-symbol.cc", + "src/builtins/builtins-trace.cc", + "src/builtins/builtins-typed-array.cc", + "src/builtins/builtins-utils-inl.h", + "src/builtins/builtins-utils.h", + "src/builtins/builtins-weak-refs.cc", + "src/builtins/builtins.cc", + "src/builtins/builtins.h", + "src/builtins/constants-table-builder.cc", + "src/builtins/constants-table-builder.h", + "src/builtins/profile-data-reader.h", + "src/codegen/aligned-slot-allocator.h", + "src/codegen/aligned-slot-allocator.cc", + "src/codegen/assembler-arch.h", + "src/codegen/assembler-inl.h", + "src/codegen/assembler.cc", + "src/codegen/assembler.h", + "src/codegen/bailout-reason.cc", + "src/codegen/bailout-reason.h", + "src/codegen/callable.h", + "src/codegen/code-comments.cc", + "src/codegen/code-comments.h", + "src/codegen/code-desc.cc", + "src/codegen/code-desc.h", + "src/codegen/code-factory.cc", + "src/codegen/code-factory.h", + "src/codegen/code-reference.cc", + "src/codegen/code-reference.h", + "src/codegen/compilation-cache.cc", + "src/codegen/compilation-cache.h", + "src/codegen/compiler.cc", + "src/codegen/compiler.h", + "src/codegen/constant-pool.cc", + "src/codegen/constant-pool.h", + "src/codegen/constants-arch.h", + "src/codegen/cpu-features.h", + "src/codegen/external-reference-encoder.cc", + "src/codegen/external-reference-encoder.h", + "src/codegen/external-reference-table.cc", + "src/codegen/external-reference-table.h", + "src/codegen/external-reference.cc", + "src/codegen/external-reference.h", + "src/codegen/flush-instruction-cache.cc", + "src/codegen/flush-instruction-cache.h", + "src/codegen/handler-table.cc", + "src/codegen/handler-table.h", + "src/codegen/interface-descriptors.cc", + "src/codegen/interface-descriptors-inl.h", + "src/codegen/interface-descriptors.h", + "src/codegen/label.h", + "src/codegen/machine-type.cc", + "src/codegen/machine-type.h", + "src/codegen/macro-assembler-inl.h", + "src/codegen/macro-assembler.h", + "src/codegen/optimized-compilation-info.cc", + "src/codegen/optimized-compilation-info.h", + "src/codegen/pending-optimization-table.cc", + "src/codegen/pending-optimization-table.h", + "src/codegen/register-arch.h", + "src/codegen/register-configuration.cc", + "src/codegen/register-configuration.h", + "src/codegen/register.h", + "src/codegen/reglist.h", + "src/codegen/reloc-info.cc", + "src/codegen/reloc-info.h", + "src/codegen/safepoint-table.cc", + "src/codegen/safepoint-table.h", + "src/codegen/signature.h", + "src/codegen/source-position-table.cc", + "src/codegen/source-position-table.h", + "src/codegen/source-position.cc", + "src/codegen/source-position.h", + "src/codegen/string-constants.cc", + "src/codegen/string-constants.h", + "src/codegen/tick-counter.cc", + "src/codegen/tick-counter.h", + "src/codegen/tnode.cc", + "src/codegen/tnode.h", + "src/codegen/turbo-assembler.cc", + "src/codegen/turbo-assembler.h", + "src/codegen/unoptimized-compilation-info.cc", + "src/codegen/unoptimized-compilation-info.h", + "src/common/assert-scope.cc", + "src/common/assert-scope.h", + "src/common/checks.h", + "src/common/external-pointer-inl.h", + "src/common/external-pointer.h", + "src/common/message-template.h", + "src/common/ptr-compr-inl.h", + "src/common/ptr-compr.h", + "src/compiler-dispatcher/compiler-dispatcher.cc", + "src/compiler-dispatcher/compiler-dispatcher.h", + "src/compiler-dispatcher/optimizing-compile-dispatcher.cc", + "src/compiler-dispatcher/optimizing-compile-dispatcher.h", + "src/date/date.cc", + "src/date/date.h", + "src/date/dateparser-inl.h", + "src/date/dateparser.cc", + "src/date/dateparser.h", + "src/debug/debug-coverage.cc", + "src/debug/debug-coverage.h", + "src/debug/debug-evaluate.cc", + "src/debug/debug-evaluate.h", + "src/debug/debug-frames.cc", + "src/debug/debug-frames.h", + "src/debug/debug-interface.cc", + "src/debug/debug-interface.h", + "src/debug/debug-property-iterator.cc", + "src/debug/debug-property-iterator.h", + "src/debug/debug-scope-iterator.cc", + "src/debug/debug-scope-iterator.h", + "src/debug/debug-scopes.cc", + "src/debug/debug-scopes.h", + "src/debug/debug-stack-trace-iterator.cc", + "src/debug/debug-stack-trace-iterator.h", + "src/debug/debug-type-profile.cc", + "src/debug/debug-type-profile.h", + "src/debug/debug.cc", + "src/debug/debug.h", + "src/debug/interface-types.h", + "src/debug/liveedit.cc", + "src/debug/liveedit.h", + "src/deoptimizer/deoptimize-reason.cc", + "src/deoptimizer/deoptimize-reason.h", + "src/deoptimizer/deoptimized-frame-info.cc", + "src/deoptimizer/deoptimized-frame-info.h", + "src/deoptimizer/deoptimizer.cc", + "src/deoptimizer/deoptimizer.h", + "src/deoptimizer/frame-description.h", + "src/deoptimizer/materialized-object-store.cc", + "src/deoptimizer/materialized-object-store.h", + "src/deoptimizer/translated-state.cc", + "src/deoptimizer/translated-state.h", + "src/deoptimizer/translation-array.cc", + "src/deoptimizer/translation-array.h", + "src/deoptimizer/translation-opcode.h", + "src/diagnostics/basic-block-profiler.cc", + "src/diagnostics/basic-block-profiler.h", + "src/diagnostics/code-tracer.h", + "src/diagnostics/compilation-statistics.cc", + "src/diagnostics/compilation-statistics.h", + "src/diagnostics/disasm.h", + "src/diagnostics/disassembler.cc", + "src/diagnostics/disassembler.h", + "src/diagnostics/eh-frame.cc", + "src/diagnostics/eh-frame.h", + "src/diagnostics/gdb-jit.cc", + "src/diagnostics/gdb-jit.h", + "src/diagnostics/objects-debug.cc", + "src/diagnostics/objects-printer.cc", + "src/diagnostics/perf-jit.cc", + "src/diagnostics/perf-jit.h", + "src/diagnostics/unwinder.cc", + "src/diagnostics/unwinder.h", + "src/execution/arguments-inl.h", + "src/execution/arguments.cc", + "src/execution/arguments.h", + "src/execution/execution.cc", + "src/execution/execution.h", + "src/execution/external-pointer-table.cc", + "src/execution/external-pointer-table.h", + "src/execution/frame-constants.h", + "src/execution/frames-inl.h", + "src/execution/frames.cc", + "src/execution/frames.h", + "src/execution/futex-emulation.cc", + "src/execution/futex-emulation.h", + "src/execution/interrupts-scope.cc", + "src/execution/interrupts-scope.h", + "src/execution/isolate-data.h", + "src/execution/isolate-inl.h", + "src/execution/isolate-utils.h", + "src/execution/isolate-utils-inl.h", + "src/snapshot/embedded/platform-embedded-file-writer-base.h", + "src/snapshot/embedded/embedded-file-writer.h", + "src/execution/isolate.cc", + "src/execution/isolate.h", + "src/execution/local-isolate-inl.h", + "src/execution/local-isolate.cc", + "src/execution/local-isolate.h", + "src/execution/messages.cc", + "src/execution/messages.h", + "src/execution/microtask-queue.cc", + "src/execution/microtask-queue.h", + "src/execution/pointer-authentication.h", + "src/execution/protectors-inl.h", + "src/execution/protectors.cc", + "src/execution/protectors.h", + "src/execution/runtime-profiler.cc", + "src/execution/runtime-profiler.h", + "src/execution/shared-mutex-guard-if-off-thread.h", + "src/execution/simulator-base.cc", + "src/execution/simulator-base.h", + "src/execution/simulator.h", + "src/execution/stack-guard.cc", + "src/execution/stack-guard.h", + "src/execution/thread-id.cc", + "src/execution/thread-id.h", + "src/execution/thread-local-top.cc", + "src/execution/thread-local-top.h", + "src/execution/v8threads.cc", + "src/execution/v8threads.h", + "src/execution/vm-state-inl.h", + "src/execution/vm-state.h", + "src/extensions/cputracemark-extension.cc", + "src/extensions/cputracemark-extension.h", + "src/extensions/externalize-string-extension.cc", + "src/extensions/externalize-string-extension.h", + "src/extensions/gc-extension.cc", + "src/extensions/gc-extension.h", + "src/extensions/ignition-statistics-extension.cc", + "src/extensions/ignition-statistics-extension.h", + "src/extensions/statistics-extension.cc", + "src/extensions/statistics-extension.h", + "src/extensions/trigger-failure-extension.cc", + "src/extensions/trigger-failure-extension.h", + "src/flags/flag-definitions.h", + "src/flags/flags.cc", + "src/flags/flags.h", + "src/handles/global-handles.cc", + "src/handles/global-handles.h", + "src/handles/handles-inl.h", + "src/handles/handles.cc", + "src/handles/handles.h", + "src/handles/local-handles-inl.h", + "src/handles/local-handles.cc", + "src/handles/local-handles.h", + "src/handles/maybe-handles-inl.h", + "src/handles/maybe-handles.h", + "src/handles/persistent-handles.cc", + "src/handles/persistent-handles.h", + "src/heap/allocation-observer.cc", + "src/heap/allocation-observer.h", + "src/heap/allocation-stats.h", + "src/heap/array-buffer-sweeper.cc", + "src/heap/array-buffer-sweeper.h", + "src/heap/barrier.h", + "src/heap/base-space.cc", + "src/heap/base-space.h", + "src/heap/basic-memory-chunk.cc", + "src/heap/basic-memory-chunk.h", + "src/heap/code-object-registry.cc", + "src/heap/code-object-registry.h", + "src/heap/code-range.h", + "src/heap/code-range.cc", + "src/heap/code-stats.cc", + "src/heap/code-stats.h", + "src/heap/collection-barrier.cc", + "src/heap/collection-barrier.h", + "src/heap/combined-heap.cc", + "src/heap/combined-heap.h", + "src/heap/concurrent-allocator-inl.h", + "src/heap/concurrent-allocator.cc", + "src/heap/concurrent-allocator.h", + "src/heap/concurrent-marking.cc", + "src/heap/concurrent-marking.h", + "src/heap/cppgc-js/cpp-heap.cc", + "src/heap/cppgc-js/cpp-heap.h", + "src/heap/cppgc-js/cpp-snapshot.cc", + "src/heap/cppgc-js/cpp-snapshot.h", + "src/heap/cppgc-js/unified-heap-marking-state.h", + "src/heap/cppgc-js/unified-heap-marking-verifier.cc", + "src/heap/cppgc-js/unified-heap-marking-verifier.h", + "src/heap/cppgc-js/unified-heap-marking-visitor.cc", + "src/heap/cppgc-js/unified-heap-marking-visitor.h", + "src/heap/embedder-tracing.cc", + "src/heap/embedder-tracing.h", + "src/heap/factory-base.cc", + "src/heap/factory-base.h", + "src/heap/factory-base-inl.h", + "src/heap/factory-inl.h", + "src/heap/factory.cc", + "src/heap/factory.h", + "src/heap/finalization-registry-cleanup-task.cc", + "src/heap/finalization-registry-cleanup-task.h", + "src/heap/free-list-inl.h", + "src/heap/free-list.cc", + "src/heap/free-list.h", + "src/heap/gc-idle-time-handler.cc", + "src/heap/gc-idle-time-handler.h", + "src/heap/gc-tracer.cc", + "src/heap/gc-tracer.h", + "src/heap/heap-controller.cc", + "src/heap/heap-controller.h", + "src/heap/heap-inl.h", + "src/heap/heap-write-barrier-inl.h", + "src/heap/heap-write-barrier.cc", + "src/heap/heap-write-barrier.h", + "src/heap/heap.cc", + "src/heap/heap.h", + "src/heap/incremental-marking-inl.h", + "src/heap/incremental-marking-job.cc", + "src/heap/incremental-marking-job.h", + "src/heap/incremental-marking.cc", + "src/heap/incremental-marking.h", + "src/heap/index-generator.cc", + "src/heap/index-generator.h", + "src/heap/invalidated-slots-inl.h", + "src/heap/invalidated-slots.cc", + "src/heap/invalidated-slots.h", + "src/heap/large-spaces.cc", + "src/heap/large-spaces.h", + "src/heap/list.h", + "src/heap/local-allocator-inl.h", + "src/heap/local-allocator.h", + "src/heap/local-factory.cc", + "src/heap/local-factory.h", + "src/heap/local-factory-inl.h", + "src/heap/local-heap-inl.h", + "src/heap/local-heap.cc", + "src/heap/local-heap.h", + "src/heap/mark-compact-inl.h", + "src/heap/mark-compact.cc", + "src/heap/mark-compact.h", + "src/heap/marking-barrier.cc", + "src/heap/marking-barrier.h", + "src/heap/marking-barrier-inl.h", + "src/heap/marking-visitor-inl.h", + "src/heap/marking-visitor.h", + "src/heap/marking-worklist-inl.h", + "src/heap/marking-worklist.cc", + "src/heap/marking-worklist.h", + "src/heap/marking.cc", + "src/heap/marking.h", + "src/heap/memory-allocator.cc", + "src/heap/memory-allocator.h", + "src/heap/memory-chunk-inl.h", + "src/heap/memory-chunk-layout.cc", + "src/heap/memory-chunk-layout.h", + "src/heap/memory-chunk.cc", + "src/heap/memory-chunk.h", + "src/heap/memory-measurement-inl.h", + "src/heap/memory-measurement.cc", + "src/heap/memory-measurement.h", + "src/heap/memory-reducer.cc", + "src/heap/memory-reducer.h", + "src/heap/new-spaces-inl.h", + "src/heap/new-spaces.cc", + "src/heap/new-spaces.h", + "src/heap/object-stats.cc", + "src/heap/object-stats.h", + "src/heap/objects-visiting-inl.h", + "src/heap/objects-visiting.cc", + "src/heap/objects-visiting.h", + "src/heap/paged-spaces-inl.h", + "src/heap/paged-spaces.cc", + "src/heap/paged-spaces.h", + "src/heap/parallel-work-item.h", + "src/heap/parked-scope.h", + "src/heap/read-only-heap-inl.h", + "src/heap/read-only-heap.cc", + "src/heap/read-only-heap.h", + "src/heap/read-only-spaces.cc", + "src/heap/read-only-spaces.h", + "src/heap/remembered-set-inl.h", + "src/heap/remembered-set.h", + "src/heap/safepoint.cc", + "src/heap/safepoint.h", + "src/heap/scavenge-job.cc", + "src/heap/scavenge-job.h", + "src/heap/scavenger-inl.h", + "src/heap/scavenger.cc", + "src/heap/scavenger.h", + "src/heap/slot-set.cc", + "src/heap/slot-set.h", + "src/heap/spaces-inl.h", + "src/heap/spaces.cc", + "src/heap/spaces.h", + "src/heap/stress-marking-observer.cc", + "src/heap/stress-marking-observer.h", + "src/heap/stress-scavenge-observer.cc", + "src/heap/stress-scavenge-observer.h", + "src/heap/sweeper.cc", + "src/heap/sweeper.h", + "src/heap/weak-object-worklists.cc", + "src/heap/weak-object-worklists.h", + "src/heap/worklist.h", + "src/ic/call-optimization.cc", + "src/ic/call-optimization.h", + "src/ic/handler-configuration-inl.h", + "src/ic/handler-configuration.cc", + "src/ic/handler-configuration.h", + "src/ic/ic-inl.h", + "src/ic/ic-stats.cc", + "src/ic/ic-stats.h", + "src/ic/ic.cc", + "src/ic/ic.h", + "src/ic/stub-cache.cc", + "src/ic/stub-cache.h", + "src/init/bootstrapper.cc", + "src/init/bootstrapper.h", + "src/init/heap-symbols.h", + "src/init/icu_util.cc", + "src/init/icu_util.h", + "src/init/isolate-allocator.cc", + "src/init/isolate-allocator.h", + "src/init/setup-isolate.h", + "src/init/startup-data-util.cc", + "src/init/startup-data-util.h", + "src/init/v8.cc", + "src/init/v8.h", + "src/interpreter/block-coverage-builder.h", + "src/interpreter/bytecode-array-builder.cc", + "src/interpreter/bytecode-array-builder.h", + "src/interpreter/bytecode-array-iterator.cc", + "src/interpreter/bytecode-array-iterator.h", + "src/interpreter/bytecode-array-random-iterator.cc", + "src/interpreter/bytecode-array-random-iterator.h", + "src/interpreter/bytecode-array-writer.cc", + "src/interpreter/bytecode-array-writer.h", + "src/interpreter/bytecode-decoder.cc", + "src/interpreter/bytecode-decoder.h", + "src/interpreter/bytecode-flags.cc", + "src/interpreter/bytecode-flags.h", + "src/interpreter/bytecode-generator.cc", + "src/interpreter/bytecode-generator.h", + "src/interpreter/bytecode-jump-table.h", + "src/interpreter/bytecode-label.cc", + "src/interpreter/bytecode-label.h", + "src/interpreter/bytecode-node.cc", + "src/interpreter/bytecode-node.h", + "src/interpreter/bytecode-operands.cc", + "src/interpreter/bytecode-operands.h", + "src/interpreter/bytecode-register-allocator.h", + "src/interpreter/bytecode-register-optimizer.cc", + "src/interpreter/bytecode-register-optimizer.h", + "src/interpreter/bytecode-register.cc", + "src/interpreter/bytecode-register.h", + "src/interpreter/bytecode-source-info.cc", + "src/interpreter/bytecode-source-info.h", + "src/interpreter/bytecode-traits.h", + "src/interpreter/bytecodes.cc", + "src/interpreter/bytecodes.h", + "src/interpreter/constant-array-builder.cc", + "src/interpreter/constant-array-builder.h", + "src/interpreter/control-flow-builders.cc", + "src/interpreter/control-flow-builders.h", + "src/interpreter/handler-table-builder.cc", + "src/interpreter/handler-table-builder.h", + "src/interpreter/interpreter-generator.h", + "src/interpreter/interpreter-intrinsics.cc", + "src/interpreter/interpreter-intrinsics.h", + "src/interpreter/interpreter.cc", + "src/interpreter/interpreter.h", + "src/json/json-parser.cc", + "src/json/json-parser.h", + "src/json/json-stringifier.cc", + "src/json/json-stringifier.h", + "src/logging/code-events.h", + "src/logging/counters-definitions.h", + "src/logging/counters.cc", + "src/logging/counters.h", + "src/logging/local-logger.cc", + "src/logging/local-logger.h", + "src/logging/log-inl.h", + "src/logging/log-utils.cc", + "src/logging/log-utils.h", + "src/logging/log.cc", + "src/logging/log.h", + "src/logging/metrics.cc", + "src/logging/metrics.h", + "src/logging/tracing-flags.cc", + "src/logging/tracing-flags.h", + "src/logging/runtime-call-stats.h", + "src/logging/runtime-call-stats-scope.h", + "src/numbers/conversions-inl.h", + "src/numbers/conversions.cc", + "src/numbers/conversions.h", + "src/numbers/hash-seed-inl.h", + "src/numbers/math-random.cc", + "src/numbers/math-random.h", + "src/objects/all-objects-inl.h", + "src/objects/allocation-site-inl.h", + "src/objects/allocation-site-scopes-inl.h", + "src/objects/allocation-site-scopes.h", + "src/objects/allocation-site.h", + "src/objects/api-callbacks-inl.h", + "src/objects/api-callbacks.h", + "src/objects/arguments-inl.h", + "src/objects/arguments.h", + "src/objects/backing-store.cc", + "src/objects/backing-store.h", + "src/objects/bigint-inl.h", + "src/objects/bigint.cc", + "src/objects/bigint.h", + "src/objects/cell-inl.h", + "src/objects/cell.h", + "src/objects/code-inl.h", + "src/objects/code-kind.cc", + "src/objects/code-kind.h", + "src/objects/code.cc", + "src/objects/code.h", + "src/objects/compilation-cache-table-inl.h", + "src/objects/compilation-cache-table.cc", + "src/objects/compilation-cache-table.h", + "src/objects/compressed-slots-inl.h", + "src/objects/compressed-slots.h", + "src/objects/contexts-inl.h", + "src/objects/contexts.cc", + "src/objects/contexts.h", + "src/objects/data-handler-inl.h", + "src/objects/data-handler.h", + "src/objects/debug-objects-inl.h", + "src/objects/debug-objects.cc", + "src/objects/debug-objects.h", + "src/objects/descriptor-array-inl.h", + "src/objects/descriptor-array.h", + "src/objects/dictionary-inl.h", + "src/objects/dictionary.h", + "src/objects/elements-inl.h", + "src/objects/elements-kind.cc", + "src/objects/elements-kind.h", + "src/objects/elements.cc", + "src/objects/elements.h", + "src/objects/embedder-data-array-inl.h", + "src/objects/embedder-data-array.cc", + "src/objects/embedder-data-array.h", + "src/objects/embedder-data-slot-inl.h", + "src/objects/embedder-data-slot.h", + "src/objects/feedback-cell-inl.h", + "src/objects/feedback-cell.h", + "src/objects/feedback-vector-inl.h", + "src/objects/feedback-vector.cc", + "src/objects/feedback-vector.h", + "src/objects/field-index-inl.h", + "src/objects/field-index.h", + "src/objects/field-type.cc", + "src/objects/field-type.h", + "src/objects/fixed-array-inl.h", + "src/objects/fixed-array.h", + "src/objects/foreign-inl.h", + "src/objects/foreign.h", + "src/objects/free-space-inl.h", + "src/objects/free-space.h", + "src/objects/function-kind.h", + "src/objects/function-syntax-kind.h", + "src/objects/hash-table-inl.h", + "src/objects/hash-table.h", + "src/objects/heap-number-inl.h", + "src/objects/heap-number.h", + "src/objects/heap-object-inl.h", + "src/objects/heap-object.h", + "src/objects/instance-type-inl.h", + "src/objects/instance-type.h", + "src/objects/internal-index.h", + "src/objects/js-array-buffer-inl.h", + "src/objects/js-array-buffer.cc", + "src/objects/js-array-buffer.h", + "src/objects/js-array-inl.h", + "src/objects/js-array.h", + "src/objects/js-collection-inl.h", + "src/objects/js-collection-iterator.h", + "src/objects/js-collection-iterator-inl.h", + "src/objects/js-collection.h", + "src/objects/js-function-inl.h", + "src/objects/js-function.cc", + "src/objects/js-function.h", + "src/objects/js-generator-inl.h", + "src/objects/js-generator.h", + "src/objects/js-objects-inl.h", + "src/objects/js-objects.cc", + "src/objects/js-objects.h", + "src/objects/js-promise-inl.h", + "src/objects/js-promise.h", + "src/objects/js-proxy-inl.h", + "src/objects/js-proxy.h", + "src/objects/js-regexp-inl.h", + "src/objects/js-regexp-string-iterator-inl.h", + "src/objects/js-regexp-string-iterator.h", + "src/objects/js-regexp.cc", + "src/objects/js-regexp.h", + "src/objects/js-weak-refs.h", + "src/objects/js-weak-refs-inl.h", + "src/objects/keys.cc", + "src/objects/keys.h", + "src/objects/literal-objects-inl.h", + "src/objects/literal-objects.cc", + "src/objects/literal-objects.h", + "src/objects/lookup-cache-inl.h", + "src/objects/lookup-cache.cc", + "src/objects/lookup-cache.h", + "src/objects/lookup-inl.h", + "src/objects/lookup.cc", + "src/objects/lookup.h", + "src/objects/managed.cc", + "src/objects/managed.h", + "src/objects/map-inl.h", + "src/objects/map-updater.cc", + "src/objects/map-updater.h", + "src/objects/map.cc", + "src/objects/map.h", + "src/objects/maybe-object-inl.h", + "src/objects/maybe-object.h", + "src/objects/megadom-handler-inl.h", + "src/objects/megadom-handler.h", + "src/objects/microtask-inl.h", + "src/objects/microtask.h", + "src/objects/module-inl.h", + "src/objects/module.cc", + "src/objects/module.h", + "src/objects/name-inl.h", + "src/objects/name.h", + "src/objects/object-list-macros.h", + "src/objects/object-macros-undef.h", + "src/objects/object-macros.h", + "src/objects/object-type.cc", + "src/objects/object-type.h", + "src/objects/objects-body-descriptors-inl.h", + "src/objects/objects-body-descriptors.h", + "src/objects/objects-inl.h", + "src/objects/objects.cc", + "src/objects/objects.h", + "src/objects/objects-definitions.h", + "src/objects/oddball-inl.h", + "src/objects/oddball.h", + "src/objects/ordered-hash-table-inl.h", + "src/objects/ordered-hash-table.cc", + "src/objects/ordered-hash-table.h", + "src/objects/osr-optimized-code-cache-inl.h", + "src/objects/osr-optimized-code-cache.cc", + "src/objects/osr-optimized-code-cache.h", + "src/objects/primitive-heap-object-inl.h", + "src/objects/primitive-heap-object.h", + "src/objects/promise-inl.h", + "src/objects/promise.h", + "src/objects/property-array-inl.h", + "src/objects/property-array.h", + "src/objects/property-cell-inl.h", + "src/objects/property-cell.h", + "src/objects/property-descriptor-object-inl.h", + "src/objects/property-descriptor-object.h", + "src/objects/property-descriptor.cc", + "src/objects/property-descriptor.h", + "src/objects/property-details.h", + "src/objects/property.cc", + "src/objects/property.h", + "src/objects/prototype-info-inl.h", + "src/objects/prototype-info.h", + "src/objects/prototype.h", + "src/objects/prototype-inl.h", + "src/objects/regexp-match-info.h", + "src/objects/scope-info-inl.h", + "src/objects/scope-info.cc", + "src/objects/scope-info.h", + "src/objects/script-inl.h", + "src/objects/script.h", + "src/objects/shared-function-info-inl.h", + "src/objects/shared-function-info.cc", + "src/objects/shared-function-info.h", + "src/objects/slots-atomic-inl.h", + "src/objects/slots-inl.h", + "src/objects/slots.h", + "src/objects/smi-inl.h", + "src/objects/smi.h", + "src/objects/source-text-module.cc", + "src/objects/source-text-module.h", + "src/objects/source-text-module-inl.h", + "src/objects/stack-frame-info-inl.h", + "src/objects/stack-frame-info.cc", + "src/objects/stack-frame-info.h", + "src/objects/string-comparator.cc", + "src/objects/string-comparator.h", + "src/objects/string-inl.h", + "src/objects/string-set-inl.h", + "src/objects/string-set.h", + "src/objects/string-table-inl.h", + "src/objects/string-table.cc", + "src/objects/string-table.h", + "src/objects/string.cc", + "src/objects/string.h", + "src/objects/struct-inl.h", + "src/objects/struct.h", + "src/objects/swiss-hash-table-helpers.h", + "src/objects/swiss-name-dictionary-inl.h", + "src/objects/swiss-name-dictionary.cc", + "src/objects/swiss-name-dictionary.h", + "src/objects/synthetic-module-inl.h", + "src/objects/synthetic-module.cc", + "src/objects/synthetic-module.h", + "src/objects/tagged-field-inl.h", + "src/objects/tagged-field.h", + "src/objects/tagged-impl-inl.h", + "src/objects/tagged-impl.cc", + "src/objects/tagged-impl.h", + "src/objects/tagged-index.h", + "src/objects/tagged-value-inl.h", + "src/objects/tagged-value.h", + "src/objects/template-objects-inl.h", + "src/objects/template-objects.cc", + "src/objects/template-objects.h", + "src/objects/templates-inl.h", + "src/objects/templates.cc", + "src/objects/templates.h", + "src/objects/torque-defined-classes-inl.h", + "src/objects/torque-defined-classes.h", + "src/objects/transitions-inl.h", + "src/objects/transitions.cc", + "src/objects/transitions.h", + "src/objects/type-hints.cc", + "src/objects/type-hints.h", + "src/objects/value-serializer.cc", + "src/objects/value-serializer.h", + "src/objects/visitors.cc", + "src/objects/visitors.h", + "src/parsing/expression-scope.h", + "src/parsing/func-name-inferrer.cc", + "src/parsing/func-name-inferrer.h", + "src/parsing/import-assertions.cc", + "src/parsing/import-assertions.h", + "src/parsing/keywords-gen.h", + "src/parsing/literal-buffer.cc", + "src/parsing/literal-buffer.h", + "src/parsing/parse-info.cc", + "src/parsing/parse-info.h", + "src/parsing/parser-base.h", + "src/parsing/parser.cc", + "src/parsing/parser.h", + "src/parsing/parsing.cc", + "src/parsing/parsing.h", + "src/parsing/pending-compilation-error-handler.cc", + "src/parsing/pending-compilation-error-handler.h", + "src/parsing/preparse-data-impl.h", + "src/parsing/preparse-data.cc", + "src/parsing/preparse-data.h", + "src/parsing/preparser-logger.h", + "src/parsing/preparser.cc", + "src/parsing/preparser.h", + "src/parsing/rewriter.cc", + "src/parsing/rewriter.h", + "src/parsing/scanner-character-streams.cc", + "src/parsing/scanner-character-streams.h", + "src/parsing/scanner.cc", + "src/parsing/scanner.h", + "src/parsing/scanner-inl.h", + "src/parsing/token.cc", + "src/parsing/token.h", + "src/profiler/allocation-tracker.cc", + "src/profiler/allocation-tracker.h", + "src/profiler/circular-queue-inl.h", + "src/profiler/circular-queue.h", + "src/profiler/cpu-profiler-inl.h", + "src/profiler/cpu-profiler.cc", + "src/profiler/cpu-profiler.h", + "src/profiler/heap-profiler.cc", + "src/profiler/heap-profiler.h", + "src/profiler/heap-snapshot-generator-inl.h", + "src/profiler/heap-snapshot-generator.cc", + "src/profiler/heap-snapshot-generator.h", + "src/profiler/profile-generator-inl.h", + "src/profiler/profile-generator.cc", + "src/profiler/profile-generator.h", + "src/profiler/profiler-listener.cc", + "src/profiler/profiler-listener.h", + "src/profiler/profiler-stats.cc", + "src/profiler/profiler-stats.h", + "src/profiler/sampling-heap-profiler.cc", + "src/profiler/sampling-heap-profiler.h", + "src/profiler/strings-storage.cc", + "src/profiler/strings-storage.h", + "src/profiler/symbolizer.cc", + "src/profiler/symbolizer.h", + "src/profiler/tick-sample.cc", + "src/profiler/tick-sample.h", + "src/profiler/tracing-cpu-profiler.cc", + "src/profiler/tracing-cpu-profiler.h", + "src/profiler/weak-code-registry.h", + "src/profiler/weak-code-registry.cc", + "src/regexp/experimental/experimental-bytecode.cc", + "src/regexp/experimental/experimental-bytecode.h", + "src/regexp/experimental/experimental-compiler.cc", + "src/regexp/experimental/experimental-compiler.h", + "src/regexp/experimental/experimental-interpreter.cc", + "src/regexp/experimental/experimental-interpreter.h", + "src/regexp/experimental/experimental.cc", + "src/regexp/experimental/experimental.h", + "src/regexp/property-sequences.cc", + "src/regexp/property-sequences.h", + "src/regexp/regexp-ast.cc", + "src/regexp/regexp-ast.h", + "src/regexp/regexp-bytecode-generator-inl.h", + "src/regexp/regexp-bytecode-generator.cc", + "src/regexp/regexp-bytecode-generator.h", + "src/regexp/regexp-bytecode-peephole.cc", + "src/regexp/regexp-bytecode-peephole.h", + "src/regexp/regexp-bytecodes.cc", + "src/regexp/regexp-bytecodes.h", + "src/regexp/regexp-compiler-tonode.cc", + "src/regexp/regexp-compiler.cc", + "src/regexp/regexp-compiler.h", + "src/regexp/regexp-dotprinter.cc", + "src/regexp/regexp-dotprinter.h", + "src/regexp/regexp-error.cc", + "src/regexp/regexp-error.h", + "src/regexp/regexp-interpreter.cc", + "src/regexp/regexp-interpreter.h", + "src/regexp/regexp-macro-assembler-arch.h", + "src/regexp/regexp-macro-assembler-tracer.cc", + "src/regexp/regexp-macro-assembler-tracer.h", + "src/regexp/regexp-macro-assembler.cc", + "src/regexp/regexp-macro-assembler.h", + "src/regexp/regexp-nodes.h", + "src/regexp/regexp-parser.cc", + "src/regexp/regexp-parser.h", + "src/regexp/regexp-stack.cc", + "src/regexp/regexp-stack.h", + "src/regexp/regexp-utils.cc", + "src/regexp/regexp-utils.h", + "src/regexp/regexp.cc", + "src/regexp/regexp.h", + "src/regexp/special-case.h", + "src/roots/roots-inl.h", + "src/roots/roots.cc", + "src/roots/roots.h", + "src/runtime/runtime-array.cc", + "src/runtime/runtime-atomics.cc", + "src/runtime/runtime-bigint.cc", + "src/runtime/runtime-classes.cc", + "src/runtime/runtime-collections.cc", + "src/runtime/runtime-compiler.cc", + "src/runtime/runtime-date.cc", + "src/runtime/runtime-debug.cc", + "src/runtime/runtime-forin.cc", + "src/runtime/runtime-function.cc", + "src/runtime/runtime-futex.cc", + "src/runtime/runtime-generator.cc", + "src/runtime/runtime-internal.cc", + "src/runtime/runtime-literals.cc", + "src/runtime/runtime-module.cc", + "src/runtime/runtime-numbers.cc", + "src/runtime/runtime-object.cc", + "src/runtime/runtime-operators.cc", + "src/runtime/runtime-promise.cc", + "src/runtime/runtime-proxy.cc", + "src/runtime/runtime-regexp.cc", + "src/runtime/runtime-scopes.cc", + "src/runtime/runtime-strings.cc", + "src/runtime/runtime-symbol.cc", + "src/runtime/runtime-test.cc", + "src/runtime/runtime-trace.cc", + "src/runtime/runtime-typedarray.cc", + "src/runtime/runtime-utils.h", + "src/runtime/runtime-weak-refs.cc", + "src/runtime/runtime.cc", + "src/runtime/runtime.h", + "src/base/sanitizer/asan.h", + "src/base/sanitizer/lsan-page-allocator.cc", + "src/base/sanitizer/lsan-page-allocator.h", + "src/base/sanitizer/msan.h", + "src/snapshot/code-serializer.cc", + "src/snapshot/code-serializer.h", + "src/snapshot/context-deserializer.cc", + "src/snapshot/context-deserializer.h", + "src/snapshot/context-serializer.cc", + "src/snapshot/context-serializer.h", + "src/snapshot/deserializer.cc", + "src/snapshot/deserializer.h", + "src/snapshot/embedded/embedded-data.cc", + "src/snapshot/embedded/embedded-data.h", + "src/snapshot/embedded/embedded-file-writer-interface.h", + "src/snapshot/object-deserializer.cc", + "src/snapshot/object-deserializer.h", + "src/snapshot/read-only-deserializer.cc", + "src/snapshot/read-only-deserializer.h", + "src/snapshot/read-only-serializer.cc", + "src/snapshot/read-only-serializer.h", + "src/snapshot/references.h", + "src/snapshot/roots-serializer.cc", + "src/snapshot/roots-serializer.h", + "src/snapshot/serializer-deserializer.cc", + "src/snapshot/serializer-deserializer.h", + "src/snapshot/serializer.cc", + "src/snapshot/serializer.h", + "src/snapshot/snapshot-compression.cc", + "src/snapshot/snapshot-compression.h", + "src/snapshot/snapshot-data.cc", + "src/snapshot/snapshot-data.h", + "src/snapshot/snapshot-source-sink.cc", + "src/snapshot/snapshot-source-sink.h", + "src/snapshot/snapshot-utils.cc", + "src/snapshot/snapshot-utils.h", + "src/snapshot/snapshot.cc", + "src/snapshot/snapshot.h", + "src/snapshot/startup-deserializer.cc", + "src/snapshot/startup-deserializer.h", + "src/snapshot/startup-serializer.cc", + "src/snapshot/startup-serializer.h", + "src/strings/char-predicates-inl.h", + "src/strings/char-predicates.h", + "src/strings/string-builder-inl.h", + "src/strings/string-builder.cc", + "src/strings/string-case.cc", + "src/strings/string-case.h", + "src/strings/string-hasher-inl.h", + "src/strings/string-hasher.h", + "src/strings/string-search.h", + "src/strings/string-stream.cc", + "src/strings/string-stream.h", + "src/strings/unicode-decoder.cc", + "src/strings/unicode-decoder.h", + "src/strings/unicode-inl.h", + "src/strings/unicode.cc", + "src/strings/unicode.h", + "src/strings/uri.cc", + "src/strings/uri.h", + "src/tasks/cancelable-task.cc", + "src/tasks/cancelable-task.h", + "src/tasks/operations-barrier.cc", + "src/tasks/operations-barrier.h", + "src/tasks/task-utils.cc", + "src/tasks/task-utils.h", + "src/torque/runtime-macro-shims.h", + "src/third_party/siphash/halfsiphash.cc", + "src/third_party/siphash/halfsiphash.h", + "src/third_party/utf8-decoder/utf8-decoder.h", + "src/tracing/trace-event.cc", + "src/tracing/trace-event.h", + "src/tracing/traced-value.cc", + "src/tracing/traced-value.h", + "src/tracing/tracing-category-observer.cc", + "src/tracing/tracing-category-observer.h", + "src/trap-handler/handler-inside.cc", + "src/trap-handler/handler-inside-posix.h", + "src/trap-handler/handler-outside.cc", + "src/trap-handler/handler-shared.cc", + "src/trap-handler/trap-handler-internal.h", + "src/trap-handler/trap-handler.h", + "src/utils/address-map.cc", + "src/utils/address-map.h", + "src/utils/allocation.cc", + "src/utils/allocation.h", + "src/utils/bit-vector.cc", + "src/utils/bit-vector.h", + "src/utils/boxed-float.h", + "src/utils/detachable-vector.cc", + "src/utils/detachable-vector.h", + "src/utils/identity-map.cc", + "src/utils/identity-map.h", + "src/utils/locked-queue-inl.h", + "src/utils/locked-queue.h", + "src/utils/memcopy.cc", + "src/utils/memcopy.h", + "src/utils/ostreams.cc", + "src/utils/ostreams.h", + "src/utils/pointer-with-payload.h", + "src/utils/scoped-list.h", + "src/utils/utils-inl.h", + "src/utils/utils.cc", + "src/utils/utils.h", + "src/utils/version.cc", + "src/utils/version.h", + "src/web-snapshot/web-snapshot.h", + "src/web-snapshot/web-snapshot.cc", + "src/zone/accounting-allocator.cc", + "src/zone/accounting-allocator.h", + "src/zone/compressed-zone-ptr.h", + "src/zone/type-stats.cc", + "src/zone/type-stats.h", + "src/zone/zone-allocator.h", + "src/zone/zone-chunk-list.h", + "src/zone/zone-compression.h", + "src/zone/zone-containers.h", + "src/zone/zone-handle-set.h", + "src/zone/zone-hashmap.h", + "src/zone/zone-list-inl.h", + "src/zone/zone-list.h", + "src/zone/zone-segment.cc", + "src/zone/zone-segment.h", + "src/zone/zone-type-traits.h", + "src/zone/zone-utils.h", + "src/zone/zone.cc", + "src/zone/zone.h", + "src/asmjs/asm-js.h", + "src/execution/pointer-authentication-dummy.h", + "src/heap/third-party/heap-api.h", + "src/heap/third-party/heap-api-stub.cc", + ] + select({ + ":is_ia32": [ + "src/baseline/ia32/baseline-assembler-ia32-inl.h", + "src/baseline/ia32/baseline-compiler-ia32-inl.h", + "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h", + "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.cc", + "src/codegen/ia32/cpu-ia32.cc", + "src/codegen/ia32/assembler-ia32-inl.h", + "src/codegen/ia32/assembler-ia32.cc", + "src/codegen/ia32/assembler-ia32.h", + "src/codegen/ia32/constants-ia32.h", + "src/codegen/ia32/interface-descriptors-ia32-inl.h", + "src/codegen/ia32/sse-instr.h", + "src/codegen/ia32/macro-assembler-ia32.cc", + "src/codegen/ia32/macro-assembler-ia32.h", + "src/codegen/ia32/register-ia32.h", + "src/compiler/backend/ia32/code-generator-ia32.cc", + "src/compiler/backend/ia32/instruction-codes-ia32.h", + "src/compiler/backend/ia32/instruction-scheduler-ia32.cc", + "src/compiler/backend/ia32/instruction-selector-ia32.cc", + "src/deoptimizer/ia32/deoptimizer-ia32.cc", + "src/diagnostics/ia32/disasm-ia32.cc", + "src/diagnostics/ia32/unwinder-ia32.cc", + "src/execution/ia32/frame-constants-ia32.cc", + "src/execution/ia32/frame-constants-ia32.h", + "src/regexp/ia32/regexp-macro-assembler-ia32.cc", + "src/regexp/ia32/regexp-macro-assembler-ia32.h", + "src/third_party/valgrind/valgrind.h", + "src/wasm/baseline/ia32/liftoff-assembler-ia32.h", + ], + ":is_x64": [ + "src/baseline/x64/baseline-assembler-x64-inl.h", + "src/baseline/x64/baseline-compiler-x64-inl.h", + "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.h", + "src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.cc", + "src/codegen/x64/cpu-x64.cc", + "src/codegen/x64/assembler-x64-inl.h", + "src/codegen/x64/assembler-x64.cc", + "src/codegen/x64/assembler-x64.h", + "src/codegen/x64/constants-x64.h", + "src/codegen/x64/fma-instr.h", + "src/codegen/x64/interface-descriptors-x64-inl.h", + "src/codegen/x64/sse-instr.h", + "src/codegen/x64/macro-assembler-x64.cc", + "src/codegen/x64/macro-assembler-x64.h", + "src/codegen/x64/register-x64.h", + "src/compiler/backend/x64/code-generator-x64.cc", + "src/compiler/backend/x64/instruction-codes-x64.h", + "src/compiler/backend/x64/instruction-scheduler-x64.cc", + "src/compiler/backend/x64/instruction-selector-x64.cc", + "src/compiler/backend/x64/unwinding-info-writer-x64.cc", + "src/compiler/backend/x64/unwinding-info-writer-x64.h", + "src/deoptimizer/x64/deoptimizer-x64.cc", + "src/diagnostics/x64/disasm-x64.cc", + "src/diagnostics/x64/eh-frame-x64.cc", + "src/diagnostics/x64/unwinder-x64.cc", + "src/execution/x64/frame-constants-x64.cc", + "src/execution/x64/frame-constants-x64.h", + "src/regexp/x64/regexp-macro-assembler-x64.cc", + "src/regexp/x64/regexp-macro-assembler-x64.h", + "src/third_party/valgrind/valgrind.h", + "src/wasm/baseline/x64/liftoff-assembler-x64.h", + ], + "is_arm": [ + "src/baseline/arm/baseline-assembler-arm-inl.h", + "src/baseline/arm/baseline-compiler-arm-inl.h", + "src/codegen/arm/assembler-arm-inl.h", + "src/codegen/arm/assembler-arm.cc", + "src/codegen/arm/assembler-arm.h", + "src/codegen/arm/constants-arm.cc", + "src/codegen/arm/constants-arm.h", + "src/codegen/arm/cpu-arm.cc", + "src/codegen/arm/interface-descriptors-arm-inl.h", + "src/codegen/arm/macro-assembler-arm.cc", + "src/codegen/arm/macro-assembler-arm.h", + "src/codegen/arm/register-arm.h", + "src/compiler/backend/arm/code-generator-arm.cc", + "src/compiler/backend/arm/instruction-codes-arm.h", + "src/compiler/backend/arm/instruction-scheduler-arm.cc", + "src/compiler/backend/arm/instruction-selector-arm.cc", + "src/compiler/backend/arm/unwinding-info-writer-arm.cc", + "src/compiler/backend/arm/unwinding-info-writer-arm.h", + "src/deoptimizer/arm/deoptimizer-arm.cc", + "src/diagnostics/arm/disasm-arm.cc", + "src/diagnostics/arm/eh-frame-arm.cc", + "src/diagnostics/arm/unwinder-arm.cc", + "src/execution/arm/frame-constants-arm.cc", + "src/execution/arm/frame-constants-arm.h", + "src/execution/arm/simulator-arm.cc", + "src/execution/arm/simulator-arm.h", + "src/regexp/arm/regexp-macro-assembler-arm.cc", + "src/regexp/arm/regexp-macro-assembler-arm.h", + "src/wasm/baseline/arm/liftoff-assembler-arm.h", + ], + ":is_arm64": [ + "src/baseline/arm64/baseline-assembler-arm64-inl.h", + "src/baseline/arm64/baseline-compiler-arm64-inl.h", + "src/codegen/arm64/assembler-arm64-inl.h", + "src/codegen/arm64/assembler-arm64.cc", + "src/codegen/arm64/assembler-arm64.h", + "src/codegen/arm64/constants-arm64.h", + "src/codegen/arm64/cpu-arm64.cc", + "src/codegen/arm64/decoder-arm64-inl.h", + "src/codegen/arm64/decoder-arm64.cc", + "src/codegen/arm64/decoder-arm64.h", + "src/codegen/arm64/interface-descriptors-arm64-inl.h", + "src/codegen/arm64/instructions-arm64-constants.cc", + "src/codegen/arm64/instructions-arm64.cc", + "src/codegen/arm64/instructions-arm64.h", + "src/codegen/arm64/macro-assembler-arm64-inl.h", + "src/codegen/arm64/macro-assembler-arm64.cc", + "src/codegen/arm64/macro-assembler-arm64.h", + "src/codegen/arm64/register-arm64.cc", + "src/codegen/arm64/register-arm64.h", + "src/codegen/arm64/utils-arm64.cc", + "src/codegen/arm64/utils-arm64.h", + "src/compiler/backend/arm64/code-generator-arm64.cc", + "src/compiler/backend/arm64/instruction-codes-arm64.h", + "src/compiler/backend/arm64/instruction-scheduler-arm64.cc", + "src/compiler/backend/arm64/instruction-selector-arm64.cc", + "src/compiler/backend/arm64/unwinding-info-writer-arm64.cc", + "src/compiler/backend/arm64/unwinding-info-writer-arm64.h", + "src/deoptimizer/arm64/deoptimizer-arm64.cc", + "src/diagnostics/arm64/disasm-arm64.cc", + "src/diagnostics/arm64/disasm-arm64.h", + "src/diagnostics/arm64/eh-frame-arm64.cc", + "src/diagnostics/arm64/unwinder-arm64.cc", + "src/execution/arm64/frame-constants-arm64.cc", + "src/execution/arm64/frame-constants-arm64.h", + "src/execution/arm64/pointer-auth-arm64.cc", + "src/execution/arm64/simulator-arm64.cc", + "src/execution/arm64/simulator-arm64.h", + "src/execution/arm64/simulator-logic-arm64.cc", + "src/regexp/arm64/regexp-macro-assembler-arm64.cc", + "src/regexp/arm64/regexp-macro-assembler-arm64.h", + "src/wasm/baseline/arm64/liftoff-assembler-arm64.h", + ], + }) + select({ + ":is_linux_x64_or_macos_x64": [ + "src/trap-handler/handler-inside-posix.cc", + "src/trap-handler/handler-outside-posix.cc", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_webassembly": [ + "src/asmjs/asm-js.cc", + "src/asmjs/asm-names.h", + "src/asmjs/asm-parser.cc", + "src/asmjs/asm-parser.h", + "src/asmjs/asm-scanner.cc", + "src/asmjs/asm-scanner.h", + "src/asmjs/asm-types.cc", + "src/asmjs/asm-types.h", + "src/compiler/int64-lowering.h", + "src/compiler/wasm-compiler.h", + "src/debug/debug-wasm-objects.cc", + "src/debug/debug-wasm-objects.h", + "src/debug/debug-wasm-objects-inl.h", + "src/runtime/runtime-test-wasm.cc", + "src/runtime/runtime-wasm.cc", + "src/wasm/baseline/liftoff-assembler.cc", + "src/wasm/baseline/liftoff-assembler-defs.h", + "src/wasm/baseline/liftoff-assembler.h", + "src/wasm/baseline/liftoff-compiler.cc", + "src/wasm/baseline/liftoff-compiler.h", + "src/wasm/baseline/liftoff-register.h", + "src/wasm/branch-hint-map.h", + "src/wasm/code-space-access.cc", + "src/wasm/code-space-access.h", + "src/wasm/compilation-environment.h", + "src/wasm/decoder.h", + "src/wasm/function-body-decoder.cc", + "src/wasm/function-body-decoder.h", + "src/wasm/function-body-decoder-impl.h", + "src/wasm/function-compiler.cc", + "src/wasm/function-compiler.h", + "src/wasm/graph-builder-interface.cc", + "src/wasm/graph-builder-interface.h", + "src/wasm/init-expr-interface.cc", + "src/wasm/init-expr-interface.h", + "src/wasm/jump-table-assembler.cc", + "src/wasm/jump-table-assembler.h", + "src/wasm/leb-helper.h", + "src/wasm/local-decl-encoder.cc", + "src/wasm/local-decl-encoder.h", + "src/wasm/memory-protection-key.cc", + "src/wasm/memory-protection-key.h", + "src/wasm/memory-tracing.cc", + "src/wasm/memory-tracing.h", + "src/wasm/module-compiler.cc", + "src/wasm/module-compiler.h", + "src/wasm/module-decoder.cc", + "src/wasm/module-decoder.h", + "src/wasm/module-instantiate.cc", + "src/wasm/module-instantiate.h", + "src/wasm/object-access.h", + "src/wasm/signature-map.cc", + "src/wasm/signature-map.h", + "src/wasm/simd-shuffle.cc", + "src/wasm/simd-shuffle.h", + "src/wasm/streaming-decoder.cc", + "src/wasm/streaming-decoder.h", + "src/wasm/struct-types.h", + "src/wasm/sync-streaming-decoder.cc", + "src/wasm/value-type.cc", + "src/wasm/value-type.h", + "src/wasm/wasm-arguments.h", + "src/wasm/wasm-code-manager.cc", + "src/wasm/wasm-code-manager.h", + "src/wasm/wasm-debug.cc", + "src/wasm/wasm-debug.h", + "src/wasm/wasm-engine.cc", + "src/wasm/wasm-engine.h", + "src/wasm/wasm-external-refs.cc", + "src/wasm/wasm-external-refs.h", + "src/wasm/wasm-features.cc", + "src/wasm/wasm-features.h", + "src/wasm/wasm-import-wrapper-cache.cc", + "src/wasm/wasm-import-wrapper-cache.h", + "src/wasm/wasm-init-expr.cc", + "src/wasm/wasm-init-expr.h", + "src/wasm/wasm-js.cc", + "src/wasm/wasm-js.h", + "src/wasm/wasm-linkage.h", + "src/wasm/wasm-module-builder.cc", + "src/wasm/wasm-module-builder.h", + "src/wasm/wasm-module.cc", + "src/wasm/wasm-module.h", + "src/wasm/wasm-module-sourcemap.cc", + "src/wasm/wasm-module-sourcemap.h", + "src/wasm/wasm-objects.cc", + "src/wasm/wasm-objects.h", + "src/wasm/wasm-objects-inl.h", + "src/wasm/wasm-opcodes.cc", + "src/wasm/wasm-opcodes.h", + "src/wasm/wasm-opcodes-inl.h", + "src/wasm/wasm-result.cc", + "src/wasm/wasm-result.h", + "src/wasm/wasm-serialization.cc", + "src/wasm/wasm-serialization.h", + "src/wasm/wasm-subtyping.cc", + "src/wasm/wasm-subtyping.h", + "src/wasm/wasm-tier.h", + "src/wasm/wasm-value.h", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_i18n_support": [ + "src/builtins/builtins-intl.cc", + "src/builtins/builtins-intl-gen.cc", + "src/objects/intl-objects.cc", + "src/objects/intl-objects.h", + "src/objects/js-break-iterator.cc", + "src/objects/js-break-iterator.h", + "src/objects/js-break-iterator-inl.h", + "src/objects/js-collator.cc", + "src/objects/js-collator.h", + "src/objects/js-collator-inl.h", + "src/objects/js-date-time-format.cc", + "src/objects/js-date-time-format.h", + "src/objects/js-date-time-format-inl.h", + "src/objects/js-display-names.cc", + "src/objects/js-display-names.h", + "src/objects/js-display-names-inl.h", + "src/objects/js-list-format.cc", + "src/objects/js-list-format.h", + "src/objects/js-list-format-inl.h", + "src/objects/js-locale.cc", + "src/objects/js-locale.h", + "src/objects/js-locale-inl.h", + "src/objects/js-number-format.cc", + "src/objects/js-number-format.h", + "src/objects/js-number-format-inl.h", + "src/objects/js-plural-rules.cc", + "src/objects/js-plural-rules.h", + "src/objects/js-plural-rules-inl.h", + "src/objects/js-relative-time-format.cc", + "src/objects/js-relative-time-format.h", + "src/objects/js-relative-time-format-inl.h", + "src/objects/js-segmenter.cc", + "src/objects/js-segmenter.h", + "src/objects/js-segmenter-inl.h", + "src/objects/js-segment-iterator.cc", + "src/objects/js-segment-iterator.h", + "src/objects/js-segment-iterator-inl.h", + "src/objects/js-segments.cc", + "src/objects/js-segments.h", + "src/objects/js-segments-inl.h", + "src/runtime/runtime-intl.cc", + "src/strings/char-predicates.cc", + ], + "//conditions:default": [], + }), +) + +filegroup( + name = "v8_compiler_files", + srcs = [ + "src/builtins/profile-data-reader.h", + "src/compiler/access-builder.cc", + "src/compiler/access-builder.h", + "src/compiler/access-info.cc", + "src/compiler/access-info.h", + "src/compiler/add-type-assertions-reducer.cc", + "src/compiler/add-type-assertions-reducer.h", + "src/compiler/all-nodes.cc", + "src/compiler/all-nodes.h", + "src/compiler/allocation-builder.h", + "src/compiler/allocation-builder-inl.h", + "src/compiler/backend/code-generator.cc", + "src/compiler/backend/code-generator.h", + "src/compiler/backend/code-generator-impl.h", + "src/compiler/backend/frame-elider.cc", + "src/compiler/backend/frame-elider.h", + "src/compiler/backend/gap-resolver.cc", + "src/compiler/backend/gap-resolver.h", + "src/compiler/backend/instruction.cc", + "src/compiler/backend/instruction.h", + "src/compiler/backend/instruction-codes.h", + "src/compiler/backend/instruction-scheduler.cc", + "src/compiler/backend/instruction-scheduler.h", + "src/compiler/backend/instruction-selector.cc", + "src/compiler/backend/instruction-selector.h", + "src/compiler/backend/instruction-selector-impl.h", + "src/compiler/backend/jump-threading.cc", + "src/compiler/backend/jump-threading.h", + "src/compiler/backend/mid-tier-register-allocator.cc", + "src/compiler/backend/mid-tier-register-allocator.h", + "src/compiler/backend/move-optimizer.cc", + "src/compiler/backend/move-optimizer.h", + "src/compiler/backend/register-allocation.h", + "src/compiler/backend/register-allocator.cc", + "src/compiler/backend/register-allocator.h", + "src/compiler/backend/register-allocator-verifier.cc", + "src/compiler/backend/register-allocator-verifier.h", + "src/compiler/backend/spill-placer.cc", + "src/compiler/backend/spill-placer.h", + "src/compiler/backend/unwinding-info-writer.h", + "src/compiler/basic-block-instrumentor.cc", + "src/compiler/basic-block-instrumentor.h", + "src/compiler/branch-elimination.cc", + "src/compiler/branch-elimination.h", + "src/compiler/bytecode-analysis.cc", + "src/compiler/bytecode-analysis.h", + "src/compiler/bytecode-graph-builder.cc", + "src/compiler/bytecode-graph-builder.h", + "src/compiler/bytecode-liveness-map.cc", + "src/compiler/bytecode-liveness-map.h", + "src/compiler/c-linkage.cc", + "src/compiler/checkpoint-elimination.cc", + "src/compiler/checkpoint-elimination.h", + "src/compiler/code-assembler.cc", + "src/compiler/code-assembler.h", + "src/compiler/common-node-cache.cc", + "src/compiler/common-node-cache.h", + "src/compiler/common-operator.cc", + "src/compiler/common-operator.h", + "src/compiler/common-operator-reducer.cc", + "src/compiler/common-operator-reducer.h", + "src/compiler/compilation-dependencies.cc", + "src/compiler/compilation-dependencies.h", + "src/compiler/compilation-dependency.h", + "src/compiler/compiler-source-position-table.cc", + "src/compiler/compiler-source-position-table.h", + "src/compiler/constant-folding-reducer.cc", + "src/compiler/constant-folding-reducer.h", + "src/compiler/control-equivalence.cc", + "src/compiler/control-equivalence.h", + "src/compiler/control-flow-optimizer.cc", + "src/compiler/control-flow-optimizer.h", + "src/compiler/csa-load-elimination.cc", + "src/compiler/csa-load-elimination.h", + "src/compiler/dead-code-elimination.cc", + "src/compiler/dead-code-elimination.h", + "src/compiler/decompression-optimizer.cc", + "src/compiler/decompression-optimizer.h", + "src/compiler/diamond.h", + "src/compiler/effect-control-linearizer.cc", + "src/compiler/effect-control-linearizer.h", + "src/compiler/escape-analysis.cc", + "src/compiler/escape-analysis.h", + "src/compiler/escape-analysis-reducer.cc", + "src/compiler/escape-analysis-reducer.h", + "src/compiler/fast-api-calls.cc", + "src/compiler/fast-api-calls.h", + "src/compiler/feedback-source.cc", + "src/compiler/feedback-source.h", + "src/compiler/frame.cc", + "src/compiler/frame.h", + "src/compiler/frame-states.cc", + "src/compiler/frame-states.h", + "src/compiler/functional-list.h", + "src/compiler/globals.h", + "src/compiler/graph.cc", + "src/compiler/graph.h", + "src/compiler/graph-assembler.cc", + "src/compiler/graph-assembler.h", + "src/compiler/graph-reducer.cc", + "src/compiler/graph-reducer.h", + "src/compiler/graph-trimmer.cc", + "src/compiler/graph-trimmer.h", + "src/compiler/graph-visualizer.cc", + "src/compiler/graph-visualizer.h", + "src/compiler/graph-zone-traits.h", + "src/compiler/heap-refs.cc", + "src/compiler/heap-refs.h", + "src/compiler/js-call-reducer.cc", + "src/compiler/js-call-reducer.h", + "src/compiler/js-context-specialization.cc", + "src/compiler/js-context-specialization.h", + "src/compiler/js-create-lowering.cc", + "src/compiler/js-create-lowering.h", + "src/compiler/js-generic-lowering.cc", + "src/compiler/js-generic-lowering.h", + "src/compiler/js-graph.cc", + "src/compiler/js-graph.h", + "src/compiler/js-heap-broker.cc", + "src/compiler/js-heap-broker.h", + "src/compiler/js-heap-copy-reducer.cc", + "src/compiler/js-heap-copy-reducer.h", + "src/compiler/js-inlining.cc", + "src/compiler/js-inlining.h", + "src/compiler/js-inlining-heuristic.cc", + "src/compiler/js-inlining-heuristic.h", + "src/compiler/js-intrinsic-lowering.cc", + "src/compiler/js-intrinsic-lowering.h", + "src/compiler/js-native-context-specialization.cc", + "src/compiler/js-native-context-specialization.h", + "src/compiler/js-operator.cc", + "src/compiler/js-operator.h", + "src/compiler/js-type-hint-lowering.cc", + "src/compiler/js-type-hint-lowering.h", + "src/compiler/js-typed-lowering.cc", + "src/compiler/js-typed-lowering.h", + "src/compiler/linkage.cc", + "src/compiler/linkage.h", + "src/compiler/load-elimination.cc", + "src/compiler/load-elimination.h", + "src/compiler/loop-analysis.cc", + "src/compiler/loop-analysis.h", + "src/compiler/loop-peeling.cc", + "src/compiler/loop-peeling.h", + "src/compiler/loop-unrolling.cc", + "src/compiler/loop-unrolling.h", + "src/compiler/loop-variable-optimizer.cc", + "src/compiler/loop-variable-optimizer.h", + "src/compiler/machine-graph.cc", + "src/compiler/machine-graph.h", + "src/compiler/machine-graph-verifier.cc", + "src/compiler/machine-graph-verifier.h", + "src/compiler/machine-operator.cc", + "src/compiler/machine-operator.h", + "src/compiler/machine-operator-reducer.cc", + "src/compiler/machine-operator-reducer.h", + "src/compiler/map-inference.cc", + "src/compiler/map-inference.h", + "src/compiler/memory-lowering.cc", + "src/compiler/memory-lowering.h", + "src/compiler/memory-optimizer.cc", + "src/compiler/memory-optimizer.h", + "src/compiler/node.cc", + "src/compiler/node.h", + "src/compiler/node-aux-data.h", + "src/compiler/node-cache.h", + "src/compiler/node-marker.cc", + "src/compiler/node-marker.h", + "src/compiler/node-matchers.cc", + "src/compiler/node-matchers.h", + "src/compiler/node-observer.cc", + "src/compiler/node-observer.h", + "src/compiler/node-origin-table.cc", + "src/compiler/node-origin-table.h", + "src/compiler/node-properties.cc", + "src/compiler/node-properties.h", + "src/compiler/opcodes.cc", + "src/compiler/opcodes.h", + "src/compiler/operation-typer.cc", + "src/compiler/operation-typer.h", + "src/compiler/operator.cc", + "src/compiler/operator.h", + "src/compiler/operator-properties.cc", + "src/compiler/operator-properties.h", + "src/compiler/osr.cc", + "src/compiler/osr.h", + "src/compiler/per-isolate-compiler-cache.h", + "src/compiler/persistent-map.h", + "src/compiler/pipeline.cc", + "src/compiler/pipeline.h", + "src/compiler/pipeline-statistics.cc", + "src/compiler/pipeline-statistics.h", + "src/compiler/processed-feedback.h", + "src/compiler/property-access-builder.cc", + "src/compiler/property-access-builder.h", + "src/compiler/raw-machine-assembler.cc", + "src/compiler/raw-machine-assembler.h", + "src/compiler/redundancy-elimination.cc", + "src/compiler/redundancy-elimination.h", + "src/compiler/refs-map.cc", + "src/compiler/refs-map.h", + "src/compiler/representation-change.cc", + "src/compiler/representation-change.h", + "src/compiler/schedule.cc", + "src/compiler/schedule.h", + "src/compiler/scheduler.cc", + "src/compiler/scheduler.h", + "src/compiler/select-lowering.cc", + "src/compiler/select-lowering.h", + "src/compiler/serializer-for-background-compilation.cc", + "src/compiler/serializer-for-background-compilation.h", + "src/compiler/serializer-hints.h", + "src/compiler/simplified-lowering.cc", + "src/compiler/simplified-lowering.h", + "src/compiler/simplified-operator.cc", + "src/compiler/simplified-operator.h", + "src/compiler/simplified-operator-reducer.cc", + "src/compiler/simplified-operator-reducer.h", + "src/compiler/state-values-utils.cc", + "src/compiler/state-values-utils.h", + "src/compiler/store-store-elimination.cc", + "src/compiler/store-store-elimination.h", + "src/compiler/type-cache.cc", + "src/compiler/type-cache.h", + "src/compiler/type-narrowing-reducer.cc", + "src/compiler/type-narrowing-reducer.h", + "src/compiler/typed-optimization.cc", + "src/compiler/typed-optimization.h", + "src/compiler/typer.cc", + "src/compiler/typer.h", + "src/compiler/types.cc", + "src/compiler/types.h", + "src/compiler/value-numbering-reducer.cc", + "src/compiler/value-numbering-reducer.h", + "src/compiler/verifier.cc", + "src/compiler/verifier.h", + "src/compiler/write-barrier-kind.h", + "src/compiler/zone-stats.cc", + "src/compiler/zone-stats.h", + ] + select({ + ":is_v8_enable_webassembly": [ + "src/compiler/int64-lowering.cc", + "src/compiler/wasm-compiler.cc", + ], + "//conditions:default": [], + }), +) + + + +filegroup( + name = "v8_initializers_files", + srcs = [ + "src/builtins/builtins-array-gen.cc", + "src/builtins/builtins-array-gen.h", + "src/builtins/builtins-async-function-gen.cc", + "src/builtins/builtins-async-gen.cc", + "src/builtins/builtins-async-gen.h", + "src/builtins/builtins-async-generator-gen.cc", + "src/builtins/builtins-async-iterator-gen.cc", + "src/builtins/builtins-bigint-gen.cc", + "src/builtins/builtins-bigint-gen.h", + "src/builtins/builtins-call-gen.cc", + "src/builtins/builtins-call-gen.h", + "src/builtins/builtins-collections-gen.cc", + "src/builtins/builtins-collections-gen.h", + "src/builtins/builtins-constructor-gen.cc", + "src/builtins/builtins-constructor-gen.h", + "src/builtins/builtins-constructor.h", + "src/builtins/builtins-conversion-gen.cc", + "src/builtins/builtins-data-view-gen.h", + "src/builtins/builtins-date-gen.cc", + "src/builtins/builtins-generator-gen.cc", + "src/builtins/builtins-global-gen.cc", + "src/builtins/builtins-handler-gen.cc", + "src/builtins/builtins-ic-gen.cc", + "src/builtins/builtins-internal-gen.cc", + "src/builtins/builtins-interpreter-gen.cc", + "src/builtins/builtins-iterator-gen.cc", + "src/builtins/builtins-iterator-gen.h", + "src/builtins/builtins-lazy-gen.cc", + "src/builtins/builtins-lazy-gen.h", + "src/builtins/builtins-microtask-queue-gen.cc", + "src/builtins/builtins-number-gen.cc", + "src/builtins/builtins-object-gen.cc", + "src/builtins/builtins-promise-gen.cc", + "src/builtins/builtins-promise-gen.h", + "src/builtins/builtins-proxy-gen.cc", + "src/builtins/builtins-proxy-gen.h", + "src/builtins/builtins-regexp-gen.cc", + "src/builtins/builtins-regexp-gen.h", + "src/builtins/builtins-sharedarraybuffer-gen.cc", + "src/builtins/builtins-string-gen.cc", + "src/builtins/builtins-string-gen.h", + "src/builtins/builtins-typed-array-gen.cc", + "src/builtins/builtins-typed-array-gen.h", + "src/builtins/builtins-utils-gen.h", + "src/builtins/growable-fixed-array-gen.cc", + "src/builtins/growable-fixed-array-gen.h", + "src/builtins/profile-data-reader.cc", + "src/builtins/profile-data-reader.h", + "src/builtins/setup-builtins-internal.cc", + "src/builtins/torque-csa-header-includes.h", + "src/codegen/code-stub-assembler.cc", + "src/codegen/code-stub-assembler.h", + "src/heap/setup-heap-internal.cc", + "src/ic/accessor-assembler.cc", + "src/ic/accessor-assembler.h", + "src/ic/binary-op-assembler.cc", + "src/ic/binary-op-assembler.h", + "src/ic/keyed-store-generic.cc", + "src/ic/keyed-store-generic.h", + "src/ic/unary-op-assembler.cc", + "src/ic/unary-op-assembler.h", + "src/interpreter/interpreter-assembler.cc", + "src/interpreter/interpreter-assembler.h", + "src/interpreter/interpreter-generator.cc", + "src/interpreter/interpreter-generator.h", + "src/interpreter/interpreter-intrinsics-generator.cc", + "src/interpreter/interpreter-intrinsics-generator.h", + ] + select({ + ":is_ia32": ["src/builtins/ia32/builtins-ia32.cc"], + ":is_x64": ["src/builtins/x64/builtins-x64.cc"], + ":is_arm" : ["src/builtins/arm/builtins-arm.cc"], + ":is_arm64": ["src/builtins/arm64/builtins-arm64.cc"], + }) + select({ + ":is_v8_enable_webassembly": [ + "src/builtins/builtins-wasm-gen.cc", + "src/builtins/builtins-wasm-gen.h", + ], + "//conditions:default": [], + }), +) + +filegroup( + name = "cppgc_base_files", + srcs = [ + "src/heap/cppgc/allocation.cc", + "src/heap/cppgc/compaction-worklists.cc", + "src/heap/cppgc/compaction-worklists.h", + "src/heap/cppgc/compactor.cc", + "src/heap/cppgc/compactor.h", + "src/heap/cppgc/concurrent-marker.cc", + "src/heap/cppgc/concurrent-marker.h", + "src/heap/cppgc/default-platform.cc", + "src/heap/cppgc/explicit-management.cc", + "src/heap/cppgc/free-list.cc", + "src/heap/cppgc/free-list.h", + "src/heap/cppgc/garbage-collector.h", + "src/heap/cppgc/gc-info.cc", + "src/heap/cppgc/gc-info-table.cc", + "src/heap/cppgc/gc-info-table.h", + "src/heap/cppgc/gc-invoker.cc", + "src/heap/cppgc/gc-invoker.h", + "src/heap/cppgc/heap.cc", + "src/heap/cppgc/heap.h", + "src/heap/cppgc/heap-base.cc", + "src/heap/cppgc/heap-base.h", + "src/heap/cppgc/heap-consistency.cc", + "src/heap/cppgc/heap-growing.cc", + "src/heap/cppgc/heap-growing.h", + "src/heap/cppgc/heap-object-header.cc", + "src/heap/cppgc/heap-object-header.h", + "src/heap/cppgc/heap-page.cc", + "src/heap/cppgc/heap-page.h", + "src/heap/cppgc/heap-space.cc", + "src/heap/cppgc/heap-space.h", + "src/heap/cppgc/heap-state.cc", + "src/heap/cppgc/heap-statistics-collector.cc", + "src/heap/cppgc/heap-statistics-collector.h", + "src/heap/cppgc/heap-visitor.h", + "src/heap/cppgc/incremental-marking-schedule.cc", + "src/heap/cppgc/incremental-marking-schedule.h", + "src/heap/cppgc/liveness-broker.cc", + "src/heap/cppgc/liveness-broker.h", + "src/heap/cppgc/logging.cc", + "src/heap/cppgc/marker.cc", + "src/heap/cppgc/marker.h", + "src/heap/cppgc/marking-state.cc", + "src/heap/cppgc/marking-state.h", + "src/heap/cppgc/marking-verifier.cc", + "src/heap/cppgc/marking-verifier.h", + "src/heap/cppgc/marking-visitor.cc", + "src/heap/cppgc/marking-visitor.h", + "src/heap/cppgc/marking-worklists.cc", + "src/heap/cppgc/marking-worklists.h", + "src/heap/cppgc/memory.h", + "src/heap/cppgc/metric-recorder.h", + "src/heap/cppgc/name-trait.cc", + "src/heap/cppgc/object-allocator.cc", + "src/heap/cppgc/object-allocator.h", + "src/heap/cppgc/object-poisoner.h", + "src/heap/cppgc/object-size-trait.cc", + "src/heap/cppgc/object-start-bitmap.h", + "src/heap/cppgc/object-view.h", + "src/heap/cppgc/page-memory.cc", + "src/heap/cppgc/page-memory.h", + "src/heap/cppgc/persistent-node.cc", + "src/heap/cppgc/platform.cc", + "src/heap/cppgc/pointer-policies.cc", + "src/heap/cppgc/prefinalizer-handler.cc", + "src/heap/cppgc/prefinalizer-handler.h", + "src/heap/cppgc/process-heap.cc", + "src/heap/cppgc/process-heap.h", + "src/heap/cppgc/process-heap-statistics.cc", + "src/heap/cppgc/process-heap-statistics.h", + "src/heap/cppgc/raw-heap.cc", + "src/heap/cppgc/raw-heap.h", + "src/heap/cppgc/source-location.cc", + "src/heap/cppgc/stats-collector.cc", + "src/heap/cppgc/stats-collector.h", + "src/heap/cppgc/sweeper.cc", + "src/heap/cppgc/sweeper.h", + "src/heap/cppgc/task-handle.h", + "src/heap/cppgc/trace-event.h", + "src/heap/cppgc/trace-trait.cc", + "src/heap/cppgc/virtual-memory.cc", + "src/heap/cppgc/virtual-memory.h", + "src/heap/cppgc/visitor.cc", + "src/heap/cppgc/visitor.h", + "src/heap/cppgc/write-barrier.cc", + "src/heap/cppgc/write-barrier.h", + ], +) + +filegroup( + name = "v8_cppgc_shared_files", + srcs = [ + "src/heap/base/stack.cc", + "src/heap/base/stack.h", + "src/heap/base/worklist.cc", + "src/heap/base/worklist.h", + "src/heap/cppgc/globals.h", + ] + select({ + ":is_ia32": ["src/heap/base/asm/ia32/push_registers_asm.cc"], + ":is_x64": ["src/heap/base/asm/x64/push_registers_asm.cc"], + ":is_arm" : ["src/heap/base/asm/arm/push_registers_asm.cc"], + ":is_arm64": ["src/heap/base/asm/arm64/push_registers_asm.cc"], + }), +) + +filegroup( + name = "v8_bigint", + srcs = [ + "src/bigint/bigint-internal.cc", + "src/bigint/bigint-internal.h", + "src/bigint/bigint.h", + "src/bigint/digit-arithmetic.h", + "src/bigint/div-burnikel.cc", + "src/bigint/div-helpers.cc", + "src/bigint/div-helpers.h", + "src/bigint/div-schoolbook.cc", + "src/bigint/mul-fft.cc", + "src/bigint/mul-karatsuba.cc", + "src/bigint/mul-schoolbook.cc", + "src/bigint/mul-toom.cc", + "src/bigint/tostring.cc", + "src/bigint/util.h", + "src/bigint/vector-arithmetic.cc", + "src/bigint/vector-arithmetic.h", + ], +) + +filegroup( + name = "mksnapshot_files", + srcs = [ + "src/snapshot/embedded/embedded-empty.cc", + "src/snapshot/embedded/embedded-file-writer.cc", + "src/snapshot/embedded/embedded-file-writer.h", + "src/snapshot/embedded/platform-embedded-file-writer-aix.cc", + "src/snapshot/embedded/platform-embedded-file-writer-aix.h", + "src/snapshot/embedded/platform-embedded-file-writer-base.cc", + "src/snapshot/embedded/platform-embedded-file-writer-base.h", + "src/snapshot/embedded/platform-embedded-file-writer-generic.cc", + "src/snapshot/embedded/platform-embedded-file-writer-generic.h", + "src/snapshot/embedded/platform-embedded-file-writer-mac.cc", + "src/snapshot/embedded/platform-embedded-file-writer-mac.h", + "src/snapshot/embedded/platform-embedded-file-writer-win.cc", + "src/snapshot/embedded/platform-embedded-file-writer-win.h", + "src/snapshot/mksnapshot.cc", + "src/snapshot/snapshot-empty.cc", + "src/init/setup-isolate-full.cc", + ] +) + +filegroup( + name = "v8_inspector_files", + srcs = [ + "src/inspector/custom-preview.cc", + "src/inspector/custom-preview.h", + "src/inspector/injected-script.cc", + "src/inspector/injected-script.h", + "src/inspector/inspected-context.cc", + "src/inspector/inspected-context.h", + "src/inspector/remote-object-id.cc", + "src/inspector/remote-object-id.h", + "src/inspector/search-util.cc", + "src/inspector/search-util.h", + "src/inspector/string-16.cc", + "src/inspector/string-16.h", + "src/inspector/string-util.cc", + "src/inspector/string-util.h", + "src/inspector/test-interface.cc", + "src/inspector/test-interface.h", + "src/inspector/v8-console.cc", + "src/inspector/v8-console.h", + "src/inspector/v8-console-agent-impl.cc", + "src/inspector/v8-console-agent-impl.h", + "src/inspector/v8-console-message.cc", + "src/inspector/v8-console-message.h", + "src/inspector/v8-debugger.cc", + "src/inspector/v8-debugger.h", + "src/inspector/v8-debugger-agent-impl.cc", + "src/inspector/v8-debugger-agent-impl.h", + "src/inspector/v8-debugger-script.cc", + "src/inspector/v8-debugger-script.h", + "src/inspector/v8-heap-profiler-agent-impl.cc", + "src/inspector/v8-heap-profiler-agent-impl.h", + "src/inspector/v8-inspector-impl.cc", + "src/inspector/v8-inspector-impl.h", + "src/inspector/v8-inspector-session-impl.cc", + "src/inspector/v8-inspector-session-impl.h", + "src/inspector/v8-profiler-agent-impl.cc", + "src/inspector/v8-profiler-agent-impl.h", + "src/inspector/v8-regex.cc", + "src/inspector/v8-regex.h", + "src/inspector/v8-runtime-agent-impl.cc", + "src/inspector/v8-runtime-agent-impl.h", + "src/inspector/v8-schema-agent-impl.cc", + "src/inspector/v8-schema-agent-impl.h", + "src/inspector/v8-stack-trace-impl.cc", + "src/inspector/v8-stack-trace-impl.h", + "src/inspector/v8-string-conversions.cc", + "src/inspector/v8-string-conversions.h", + "src/inspector/v8-value-utils.cc", + "src/inspector/v8-value-utils.h", + "src/inspector/v8-debugger-id.h", + "src/inspector/v8-debugger-id.cc", + "src/inspector/value-mirror.cc", + "src/inspector/value-mirror.h", + ":crdtp_platform_files", + ":generated_inspector_files", + ], +) + +filegroup( + name = "crdtp_platform_files", + srcs = [ + "third_party/inspector_protocol/crdtp/json_platform.h", + "third_party/inspector_protocol/crdtp/json_platform_v8.cc", + ":crdtp_files", + ], +) + +filegroup( + name = "crdtp_files", + srcs = [ + "third_party/inspector_protocol/crdtp/cbor.cc", + "third_party/inspector_protocol/crdtp/cbor.h", + "third_party/inspector_protocol/crdtp/maybe.h", + "third_party/inspector_protocol/crdtp/dispatch.cc", + "third_party/inspector_protocol/crdtp/dispatch.h", + "third_party/inspector_protocol/crdtp/error_support.cc", + "third_party/inspector_protocol/crdtp/error_support.h", + "third_party/inspector_protocol/crdtp/export.h", + "third_party/inspector_protocol/crdtp/find_by_first.h", + "third_party/inspector_protocol/crdtp/frontend_channel.h", + "third_party/inspector_protocol/crdtp/glue.h", + "third_party/inspector_protocol/crdtp/protocol_core.h", + "third_party/inspector_protocol/crdtp/protocol_core.cc", + "third_party/inspector_protocol/crdtp/json.cc", + "third_party/inspector_protocol/crdtp/json.h", + "third_party/inspector_protocol/crdtp/parser_handler.h", + "third_party/inspector_protocol/crdtp/serializable.cc", + "third_party/inspector_protocol/crdtp/serializable.h", + "third_party/inspector_protocol/crdtp/serializer_traits.h", + "third_party/inspector_protocol/crdtp/span.cc", + "third_party/inspector_protocol/crdtp/span.h", + "third_party/inspector_protocol/crdtp/status.cc", + "third_party/inspector_protocol/crdtp/status.h", + ], +) + +filegroup( + name = "snapshot_files", + srcs = [ + "src/init/setup-isolate-deserialize.cc", + # TODO(victorgomes): Create a flag to select pregenerated snapshots. + ":generated_snapshot_files", + ] +) + +filegroup( + name = "wee8_files", + srcs = [ + "src/wasm/c-api.cc", + "src/wasm/c-api.h", + "third_party/wasm-api/wasm.h", + "third_party/wasm-api/wasm.hh", + ] +) + +# ================================================= +# Generated files +# ================================================= + +# TODO(victorgomes): Add support to tools/debug_helper, +# which needs class-debug-readers and debug-macros. +v8_torque( + name = "generated_torque_files", + srcs = [":torque_files"], + extras = [ + "bit-fields.h", + "builtin-definitions.h", + # "class-debug-readers.cc", + # "class-debug-readers.h", + "class-forward-declarations.h", + "class-verifiers.cc", + "class-verifiers.h", + "csa-types.h", + # "debug-macros.cc", + # "debug-macros.h", + "enum-verifiers.cc", + "exported-macros-assembler.cc", + "exported-macros-assembler.h", + "factory.cc", + "factory.inc", + "field-offsets.h", + "instance-types.h", + "interface-descriptors.inc", + "objects-body-descriptors-inl.inc", + "objects-printer.cc", + ], + args = select({ + ":is_v8_annotate_torque_ir": [ "-annotate-ir" ], + "//conditions:default": [], + }) + select({ + ":is_32bits": [ "-m32" ], + "//conditions:default": [], + }), +) + +genrule( + name = "generated_inspector_files", + srcs = [ "include/js_protocol.pdl" ], + outs = [ + "include/inspector/Debugger.h", + "include/inspector/Runtime.h", + "include/inspector/Schema.h", + "src/inspector/protocol/Forward.h", + "src/inspector/protocol/Protocol.cpp", + "src/inspector/protocol/Protocol.h", + "src/inspector/protocol/Console.cpp", + "src/inspector/protocol/Console.h", + "src/inspector/protocol/Debugger.cpp", + "src/inspector/protocol/Debugger.h", + "src/inspector/protocol/HeapProfiler.cpp", + "src/inspector/protocol/HeapProfiler.h", + "src/inspector/protocol/Profiler.cpp", + "src/inspector/protocol/Profiler.h", + "src/inspector/protocol/Runtime.cpp", + "src/inspector/protocol/Runtime.h", + "src/inspector/protocol/Schema.cpp", + "src/inspector/protocol/Schema.h", + ], + message = "Generating inspector files", + cmd = "bazel/generate-inspector-files.sh $(@D)", + local = 1, +) + +genrule( + name = "generated_bytecode_builtins_list", + srcs = [], + outs = ["builtins-generated/bytecodes-builtins-list.h"], + cmd = "$(location :bytecode_builtins_list_generator) $@", + tools = [":bytecode_builtins_list_generator"], +) + +genrule( + name = "generated_regexp_special_case", + srcs = [], + outs = ["src/regexp/special-case.cc"], + cmd = "$(location :regexp_special_case_generator) $@", + tools = [":regexp_special_case_generator"], +) + +v8_mksnapshot( + name = "generated_snapshot_files", + args = select({ + ":is_v8_enable_verify_heap": [ "--verify-heap" ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_fast_mksnapshot": [ + "--no-turbo-rewrite-far-jumps", + "--no-turbo-verify-allocation", + ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_snapshot_code_comments": [ "--code-comments" ], + "//conditions:default": [], + }) + select({ + ":is_v8_enable_snapshot_native_code_counters": [ + "--native-code-counters" + ], + "//conditions:default": [ "--no-native-code-counters" ], + }) +) + +# ================================================= +# Libraries rules +# ================================================= + +v8_library( + name = "v8_libbase", + srcs = [ + ":v8_shared_internal_headers", + ":v8_libbase_files", + ], +) + +v8_library( + name = "v8_libshared", + srcs = [ + ":generated_torque_files", + ":torque_runtime_support_files", + ":v8_base_without_compiler_files", + ":v8_compiler_files", + ":v8_initializers_files", + ":v8_libplatform_files", + ":v8_libsampler_files", + ":v8_shared_internal_headers", + ] + select({ + ":is_v8_enable_i18n_support": [ ":generated_regexp_special_case" ], + "//conditions:default": [], + }), + deps = [ + ":v8_libbase", + "@zlib", + ] + select({ + ":is_v8_enable_i18n_support": [ "@icu" ], + "//conditions:default": [], + }), +) + +v8_library( + name = "v8", + srcs = [ + ":snapshot_files", + ":v8_inspector_files", + ], + deps = [ ":v8_libshared" ], +) + +# TODO(victorgomes): Check if v8_enable_webassembly is true. +v8_library( + name = "wee8", + srcs = [ ":wee8_files" ], + deps = [ ":v8" ], +) + +# ================================================= +# Binary rules +# ================================================= + +v8_binary( + name = "bytecode_builtins_list_generator", + srcs = [ + "src/builtins/generate-bytecodes-builtins-list.cc", + "src/interpreter/bytecode-operands.cc", + "src/interpreter/bytecode-operands.h", + "src/interpreter/bytecode-traits.h", + "src/interpreter/bytecodes.cc", + "src/interpreter/bytecodes.h", + ], + deps = [ "v8_libbase" ], +) + +v8_binary( + name = "regexp_special_case_generator", + srcs = [ + ":v8_shared_internal_headers", + ":v8_libbase_files", + "src/regexp/special-case.h", + "src/regexp/gen-regexp-special-case.cc", + ], + deps = [ "@icu" ], +) + +v8_binary( + name = "torque", + srcs = [ + ":torque_base_files", + "src/torque/torque.cc", + ], + copts = [ "-fexceptions" ], + features = [ "-use_header_modules" ], + deps = [ "v8_libbase" ], +) + +v8_binary( + name = "mksnapshot", + srcs = [ ":mksnapshot_files" ], + deps = [ ":v8_libshared" ], + linkopts = select({ + "is_android": [ "-llog" ], + "//conditions:default": [], + }), +) + +v8_binary( + name = "d8", + srcs = [ + "src/d8/async-hooks-wrapper.cc", + "src/d8/async-hooks-wrapper.h", + "src/d8/d8.cc", + "src/d8/d8.h", + "src/d8/d8-console.cc", + "src/d8/d8-console.h", + "src/d8/d8-js.cc", + "src/d8/d8-platforms.cc", + "src/d8/d8-platforms.h", + "src/d8/d8-posix.cc", + "src/d8/d8-test.cc", + ], + deps = [ ":v8" ], +) diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn index 5e3045bfdc1d80..17bab98e8faba5 100644 --- a/deps/v8/BUILD.gn +++ b/deps/v8/BUILD.gn @@ -79,6 +79,9 @@ declare_args() { # Sets -dENABLE_VTUNE_TRACEMARK. v8_enable_vtunetracemark = false + # Sets -dENABLE_HUGEPAGE + v8_enable_hugepage = false + # Sets -dENABLE_HANDLE_ZAPPING. v8_enable_handle_zapping = is_debug @@ -150,6 +153,15 @@ declare_args() { # v8_enable_concurrent_marking_state. See the default setting code below. v8_enable_concurrent_marking = true + # Sets -dV8_IGNITION_DISPATCH_COUNTING. + # Enables counting frequencies of bytecode dispatches. After building in this + # configuration, subsequent runs of d8 can output frequencies for each pair + # of (current, next) bytecode instructions executed if you specify + # --trace-ignition-dispatches-output-file, or can generate a JS object with + # those frequencies if you run with --expose-ignition-statistics and call the + # extension function getIgnitionDispatchCounters(). + v8_enable_ignition_dispatch_counting = false + # Runs mksnapshot with --turbo-profiling. After building in this # configuration, any subsequent run of d8 will output information about usage # of basic blocks in builtins. @@ -184,6 +196,11 @@ declare_args() { # Sets -dV8_SHORT_BUILTIN_CALLS v8_enable_short_builtin_calls = "" + # Enable support for external code range relative to the pointer compression + # cage. + # Sets -dV8_EXTERNAL_CODE_SPACE + v8_enable_external_code_space = "" + # With post mortem support enabled, metadata is embedded into libv8 that # describes various parameters of the VM for use by debuggers. See # tools/gen-postmortem-metadata.py for details. @@ -213,11 +230,8 @@ declare_args() { # Enable mitigations for executing untrusted code. # Disabled by default on ia32 due to conflicting requirements with embedded - # builtins. Enabled by default on Android since it doesn't support - # site-isolation in Chrome and on simulator builds which test code generation - # on these platforms. - v8_untrusted_code_mitigations = - v8_current_cpu != "x86" && (is_android || target_is_simulator) + # builtins. + v8_untrusted_code_mitigations = false # Enable minor mark compact. v8_enable_minor_mc = true @@ -283,6 +297,10 @@ declare_args() { # TODO(v8:11785): Enable by default when running with the verifier. cppgc_enable_verify_live_bytes = false + # Enable assignment checks for Members/Persistents during prefinalizer invocations. + # TODO(v8:11749): Enable by default after fixing any existing issues in Blink. + cppgc_enable_check_assignments_in_prefinalizers = false + # Enable young generation in cppgc. cppgc_enable_young_generation = false @@ -317,6 +335,13 @@ declare_args() { # Allow for JS promise hooks (instead of just C++). v8_allow_javascript_in_promise_hooks = false + + # Enable allocation folding globally (sets -dV8_ALLOCATION_FOLDING). + # When it's disabled, the --turbo-allocation-folding runtime flag will be ignored. + v8_enable_allocation_folding = true + + # Enable global allocation site tracking. + v8_allocation_site_tracking = true } # Derived defaults. @@ -371,6 +396,9 @@ if (v8_enable_short_builtin_calls == "") { v8_enable_short_builtin_calls = v8_current_cpu == "x64" || (!is_android && v8_current_cpu == "arm64") } +if (v8_enable_external_code_space == "") { + v8_enable_external_code_space = false +} if (v8_enable_single_generation == "") { v8_enable_single_generation = v8_disable_write_barriers } @@ -386,6 +414,10 @@ if (v8_enable_third_party_heap) { v8_enable_shared_ro_heap = false v8_enable_pointer_compression = false v8_enable_pointer_compression_shared_cage = false + v8_enable_allocation_folding = false +} +if (v8_enable_single_generation) { + v8_allocation_site_tracking = false } assert(!v8_enable_concurrent_marking || v8_enable_atomic_object_field_writes, "Concurrent marking requires atomic object field writes.") @@ -448,13 +480,17 @@ assert(!v8_use_multi_snapshots || !v8_control_flow_integrity, assert(!v8_enable_heap_sandbox || v8_enable_pointer_compression, "V8 Heap Sandbox requires pointer compression") +assert(!v8_enable_heap_sandbox || !v8_enable_external_code_space, + "V8 Heap Sandbox is not compatible with external code space YET") + assert( !v8_enable_pointer_compression_shared_cage || v8_enable_pointer_compression, "Can't share a pointer compression cage if pointers aren't compressed") -assert(!v8_enable_pointer_compression_shared_cage || v8_current_cpu == "x64" || - v8_current_cpu == "arm64", - "Sharing a pointer compression cage is only supported on x64 and arm64") +assert( + !v8_enable_pointer_compression_shared_cage || v8_current_cpu == "x64" || + v8_current_cpu == "arm64" || v8_current_cpu == "riscv64", + "Sharing a pointer compression cage is only supported on x64,arm64 and riscv64") assert(!v8_enable_unconditional_write_barriers || !v8_disable_write_barriers, "Write barriers can't be both enabled and disabled") @@ -605,6 +641,7 @@ external_v8_defines = [ "V8_NO_ARGUMENTS_ADAPTOR", "V8_USE_PERFETTO", "V8_MAP_PACKING", + "V8_IS_TSAN", ] enabled_external_v8_defines = [] @@ -641,6 +678,9 @@ if (v8_use_perfetto) { if (v8_enable_map_packing) { enabled_external_v8_defines += [ "V8_MAP_PACKING" ] } +if (is_tsan) { + enabled_external_v8_defines += [ "V8_IS_TSAN" ] +} disabled_external_v8_defines = external_v8_defines - enabled_external_v8_defines @@ -711,6 +751,10 @@ config("features") { defines += [ "CPPGC_VERIFY_LIVE_BYTES" ] } + if (cppgc_enable_check_assignments_in_prefinalizers) { + defines += [ "CPPGC_CHECK_ASSIGNMENTS_IN_PREFINALIZERS" ] + } + if (v8_embedder_string != "") { defines += [ "V8_EMBEDDER_STRING=\"$v8_embedder_string\"" ] } @@ -743,6 +787,9 @@ config("features") { if (v8_enable_vtunetracemark) { defines += [ "ENABLE_VTUNE_TRACEMARK" ] } + if (v8_enable_hugepage) { + defines += [ "ENABLE_HUGEPAGE" ] + } if (v8_enable_minor_mc) { defines += [ "ENABLE_MINOR_MC" ] } @@ -805,6 +852,9 @@ config("features") { if (v8_enable_atomic_marking_state) { defines += [ "V8_ATOMIC_MARKING_STATE" ] } + if (v8_enable_ignition_dispatch_counting) { + defines += [ "V8_IGNITION_DISPATCH_COUNTING" ] + } if (v8_enable_lazy_source_positions) { defines += [ "V8_ENABLE_LAZY_SOURCE_POSITIONS" ] } @@ -841,6 +891,9 @@ config("features") { if (v8_enable_short_builtin_calls) { defines += [ "V8_SHORT_BUILTIN_CALLS" ] } + if (v8_enable_external_code_space) { + defines += [ "V8_EXTERNAL_CODE_SPACE" ] + } if (v8_enable_swiss_name_dictionary) { defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ] } @@ -859,6 +912,12 @@ config("features") { if (v8_allow_javascript_in_promise_hooks) { defines += [ "V8_ALLOW_JAVASCRIPT_IN_PROMISE_HOOKS" ] } + if (v8_enable_allocation_folding) { + defines += [ "V8_ALLOCATION_FOLDING" ] + } + if (v8_allocation_site_tracking) { + defines += [ "V8_ALLOCATION_SITE_TRACKING" ] + } } config("toolchain") { @@ -2350,8 +2409,8 @@ v8_header_set("v8_internal_headers") { "src/ast/variables.h", "src/baseline/baseline-assembler-inl.h", "src/baseline/baseline-assembler.h", + "src/baseline/baseline-batch-compiler.h", "src/baseline/baseline-compiler.h", - "src/baseline/baseline-osr-inl.h", "src/baseline/baseline.h", "src/baseline/bytecode-offset-iterator.h", "src/builtins/accessors.h", @@ -2458,6 +2517,7 @@ v8_header_set("v8_internal_headers") { "src/compiler/effect-control-linearizer.h", "src/compiler/escape-analysis-reducer.h", "src/compiler/escape-analysis.h", + "src/compiler/fast-api-calls.h", "src/compiler/feedback-source.h", "src/compiler/frame-states.h", "src/compiler/frame.h", @@ -2753,21 +2813,13 @@ v8_header_set("v8_internal_headers") { "src/logging/log-utils.h", "src/logging/log.h", "src/logging/metrics.h", + "src/logging/runtime-call-stats-scope.h", "src/logging/runtime-call-stats.h", "src/logging/tracing-flags.h", - "src/numbers/bignum-dtoa.h", - "src/numbers/bignum.h", - "src/numbers/cached-powers.h", "src/numbers/conversions-inl.h", "src/numbers/conversions.h", - "src/numbers/diy-fp.h", - "src/numbers/double.h", - "src/numbers/dtoa.h", - "src/numbers/fast-dtoa.h", - "src/numbers/fixed-dtoa.h", "src/numbers/hash-seed-inl.h", "src/numbers/math-random.h", - "src/numbers/strtod.h", "src/objects/all-objects-inl.h", "src/objects/allocation-site-inl.h", "src/objects/allocation-site-scopes-inl.h", @@ -2879,6 +2931,7 @@ v8_header_set("v8_internal_headers") { "src/objects/object-list-macros.h", "src/objects/object-macros-undef.h", "src/objects/object-macros.h", + "src/objects/object-type.h", "src/objects/objects-body-descriptors-inl.h", "src/objects/objects-body-descriptors.h", "src/objects/objects-inl.h", @@ -3057,8 +3110,6 @@ v8_header_set("v8_internal_headers") { "src/tracing/trace-event.h", "src/tracing/traced-value.h", "src/tracing/tracing-category-observer.h", - "src/trap-handler/trap-handler-internal.h", - "src/trap-handler/trap-handler.h", "src/utils/address-map.h", "src/utils/allocation.h", "src/utils/bit-vector.h", @@ -3073,7 +3124,6 @@ v8_header_set("v8_internal_headers") { "src/utils/scoped-list.h", "src/utils/utils-inl.h", "src/utils/utils.h", - "src/utils/vector.h", "src/utils/version.h", "src/zone/accounting-allocator.h", "src/zone/compressed-zone-ptr.h", @@ -3106,6 +3156,8 @@ v8_header_set("v8_internal_headers") { "src/compiler/wasm-compiler.h", "src/debug/debug-wasm-objects-inl.h", "src/debug/debug-wasm-objects.h", + "src/trap-handler/trap-handler-internal.h", + "src/trap-handler/trap-handler.h", "src/wasm/baseline/liftoff-assembler-defs.h", "src/wasm/baseline/liftoff-assembler.h", "src/wasm/baseline/liftoff-compiler.h", @@ -3117,6 +3169,7 @@ v8_header_set("v8_internal_headers") { "src/wasm/function-body-decoder.h", "src/wasm/function-compiler.h", "src/wasm/graph-builder-interface.h", + "src/wasm/init-expr-interface.h", "src/wasm/jump-table-assembler.h", "src/wasm/leb-helper.h", "src/wasm/local-decl-encoder.h", @@ -3156,6 +3209,12 @@ v8_header_set("v8_internal_headers") { ] } + if (!v8_enable_third_party_heap) { + sources += filter_include(v8_third_party_heap_files, [ "*.h" ]) + } else { + sources += [ "src/heap/third-party/heap-api.h" ] + } + if (v8_enable_i18n_support) { sources += [ "src/objects/intl-objects.h", @@ -3248,16 +3307,19 @@ v8_header_set("v8_internal_headers") { "src/wasm/baseline/x64/liftoff-assembler-x64.h", ] - # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both - # based on Darwin and thus POSIX-compliant to a similar degree. - if (is_linux || is_chromeos || is_mac || is_ios || target_os == "freebsd") { - sources += [ "src/trap-handler/handler-inside-posix.h" ] - } if (is_win) { - sources += [ - "src/diagnostics/unwinding-info-win64.h", - "src/trap-handler/handler-inside-win.h", - ] + sources += [ "src/diagnostics/unwinding-info-win64.h" ] + } + + if (v8_enable_webassembly) { + # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both + # based on Darwin and thus POSIX-compliant to a similar degree. + if (is_linux || is_chromeos || is_mac || is_ios || + target_os == "freebsd") { + sources += [ "src/trap-handler/handler-inside-posix.h" ] + } else if (is_win) { + sources += [ "src/trap-handler/handler-inside-win.h" ] + } } } else if (v8_current_cpu == "arm") { sources += [ ### gcmole(arch:arm) ### @@ -3302,7 +3364,7 @@ v8_header_set("v8_internal_headers") { if (v8_control_flow_integrity) { sources += [ "src/execution/arm64/pointer-authentication-arm64.h" ] } - if (current_cpu == "arm64" && is_mac) { + if (v8_enable_webassembly && current_cpu == "arm64" && is_mac) { sources += [ "src/trap-handler/handler-inside-posix.h" ] } if (is_win) { @@ -3456,6 +3518,7 @@ v8_compiler_sources = [ "src/compiler/effect-control-linearizer.cc", "src/compiler/escape-analysis-reducer.cc", "src/compiler/escape-analysis.cc", + "src/compiler/fast-api-calls.cc", "src/compiler/feedback-source.cc", "src/compiler/frame-states.cc", "src/compiler/frame.cc", @@ -3630,6 +3693,7 @@ v8_source_set("v8_base_without_compiler") { "src/ast/scopes.cc", "src/ast/source-range-ast-visitor.cc", "src/ast/variables.cc", + "src/baseline/baseline-batch-compiler.cc", "src/baseline/baseline-compiler.cc", "src/baseline/baseline.cc", "src/baseline/bytecode-offset-iterator.cc", @@ -3845,16 +3909,8 @@ v8_source_set("v8_base_without_compiler") { "src/logging/metrics.cc", "src/logging/runtime-call-stats.cc", "src/logging/tracing-flags.cc", - "src/numbers/bignum-dtoa.cc", - "src/numbers/bignum.cc", - "src/numbers/cached-powers.cc", "src/numbers/conversions.cc", - "src/numbers/diy-fp.cc", - "src/numbers/dtoa.cc", - "src/numbers/fast-dtoa.cc", - "src/numbers/fixed-dtoa.cc", "src/numbers/math-random.cc", - "src/numbers/strtod.cc", "src/objects/backing-store.cc", "src/objects/bigint.cc", "src/objects/code-kind.cc", @@ -3892,6 +3948,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/map-updater.cc", "src/objects/map.cc", "src/objects/module.cc", + "src/objects/object-type.cc", "src/objects/objects.cc", "src/objects/ordered-hash-table.cc", "src/objects/osr-optimized-code-cache.cc", @@ -3908,6 +3965,7 @@ v8_source_set("v8_base_without_compiler") { "src/objects/synthetic-module.cc", "src/objects/tagged-impl.cc", "src/objects/template-objects.cc", + "src/objects/templates.cc", "src/objects/transitions.cc", "src/objects/type-hints.cc", "src/objects/value-serializer.cc", @@ -4021,9 +4079,6 @@ v8_source_set("v8_base_without_compiler") { "src/tracing/trace-event.cc", "src/tracing/traced-value.cc", "src/tracing/tracing-category-observer.cc", - "src/trap-handler/handler-inside.cc", - "src/trap-handler/handler-outside.cc", - "src/trap-handler/handler-shared.cc", "src/utils/address-map.cc", "src/utils/allocation.cc", "src/utils/bit-vector.cc", @@ -4050,11 +4105,16 @@ v8_source_set("v8_base_without_compiler") { "src/debug/debug-wasm-objects.cc", "src/runtime/runtime-test-wasm.cc", "src/runtime/runtime-wasm.cc", + "src/trap-handler/handler-inside.cc", + "src/trap-handler/handler-outside.cc", + "src/trap-handler/handler-shared.cc", "src/wasm/baseline/liftoff-assembler.cc", "src/wasm/baseline/liftoff-compiler.cc", + "src/wasm/code-space-access.cc", "src/wasm/function-body-decoder.cc", "src/wasm/function-compiler.cc", "src/wasm/graph-builder-interface.cc", + "src/wasm/init-expr-interface.cc", "src/wasm/jump-table-assembler.cc", "src/wasm/local-decl-encoder.cc", "src/wasm/memory-protection-key.cc", @@ -4088,12 +4148,9 @@ v8_source_set("v8_base_without_compiler") { } if (v8_enable_third_party_heap) { - sources += v8_third_party_heap_files + sources += filter_exclude(v8_third_party_heap_files, [ "*.h" ]) } else { - sources += [ - "src/heap/third-party/heap-api-stub.cc", - "src/heap/third-party/heap-api.h", - ] + sources += [ "src/heap/third-party/heap-api-stub.cc" ] } if (v8_enable_conservative_stack_scanning) { @@ -4146,20 +4203,25 @@ v8_source_set("v8_base_without_compiler") { "src/regexp/x64/regexp-macro-assembler-x64.cc", ] - # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both - # based on Darwin and thus POSIX-compliant to a similar degree. - if (is_linux || is_chromeos || is_mac || is_ios || target_os == "freebsd") { - sources += [ - "src/trap-handler/handler-inside-posix.cc", - "src/trap-handler/handler-outside-posix.cc", - ] - } if (is_win) { - sources += [ - "src/diagnostics/unwinding-info-win64.cc", - "src/trap-handler/handler-inside-win.cc", - "src/trap-handler/handler-outside-win.cc", - ] + sources += [ "src/diagnostics/unwinding-info-win64.cc" ] + } + + if (v8_enable_webassembly) { + # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both + # based on Darwin and thus POSIX-compliant to a similar degree. + if (is_linux || is_chromeos || is_mac || is_ios || + target_os == "freebsd") { + sources += [ + "src/trap-handler/handler-inside-posix.cc", + "src/trap-handler/handler-outside-posix.cc", + ] + } else if (is_win) { + sources += [ + "src/trap-handler/handler-inside-win.cc", + "src/trap-handler/handler-outside-win.cc", + ] + } } } else if (v8_current_cpu == "arm") { sources += [ ### gcmole(arch:arm) ### @@ -4203,7 +4265,7 @@ v8_source_set("v8_base_without_compiler") { "src/execution/arm64/simulator-logic-arm64.cc", "src/regexp/arm64/regexp-macro-assembler-arm64.cc", ] - if (current_cpu == "arm64" && is_mac) { + if (v8_enable_webassembly && current_cpu == "arm64" && is_mac) { sources += [ "src/trap-handler/handler-inside-posix.cc", "src/trap-handler/handler-outside-posix.cc", @@ -4447,6 +4509,8 @@ v8_source_set("torque_base") { "src/torque/class-debug-reader-generator.cc", "src/torque/constants.h", "src/torque/contextual.h", + "src/torque/cpp-builder.cc", + "src/torque/cpp-builder.h", "src/torque/csa-generator.cc", "src/torque/csa-generator.h", "src/torque/declarable.cc", @@ -4597,6 +4661,23 @@ v8_component("v8_libbase") { "src/base/logging.h", "src/base/macros.h", "src/base/memory.h", + "src/base/numbers/bignum-dtoa.cc", + "src/base/numbers/bignum-dtoa.h", + "src/base/numbers/bignum.cc", + "src/base/numbers/bignum.h", + "src/base/numbers/cached-powers.cc", + "src/base/numbers/cached-powers.h", + "src/base/numbers/diy-fp.cc", + "src/base/numbers/diy-fp.h", + "src/base/numbers/double.h", + "src/base/numbers/dtoa.cc", + "src/base/numbers/dtoa.h", + "src/base/numbers/fast-dtoa.cc", + "src/base/numbers/fast-dtoa.h", + "src/base/numbers/fixed-dtoa.cc", + "src/base/numbers/fixed-dtoa.h", + "src/base/numbers/strtod.cc", + "src/base/numbers/strtod.h", "src/base/once.cc", "src/base/once.h", "src/base/optional.h", @@ -4626,6 +4707,8 @@ v8_component("v8_libbase") { "src/base/sanitizer/lsan.h", "src/base/sanitizer/msan.h", "src/base/small-vector.h", + "src/base/strings.cc", + "src/base/strings.h", "src/base/sys-info.cc", "src/base/sys-info.h", "src/base/template-utils.h", @@ -4633,6 +4716,7 @@ v8_component("v8_libbase") { "src/base/type-traits.h", "src/base/utils/random-number-generator.cc", "src/base/utils/random-number-generator.h", + "src/base/vector.h", "src/base/vlq-base64.cc", "src/base/vlq-base64.h", "src/base/vlq.h", @@ -4869,11 +4953,27 @@ v8_source_set("v8_bigint") { "src/bigint/bigint-internal.h", "src/bigint/bigint.h", "src/bigint/digit-arithmetic.h", + "src/bigint/div-burnikel.cc", + "src/bigint/div-helpers.cc", + "src/bigint/div-helpers.h", + "src/bigint/div-schoolbook.cc", + "src/bigint/mul-karatsuba.cc", "src/bigint/mul-schoolbook.cc", + "src/bigint/tostring.cc", + "src/bigint/util.h", "src/bigint/vector-arithmetic.cc", "src/bigint/vector-arithmetic.h", ] + if (v8_advanced_bigint_algorithms) { + sources += [ + "src/bigint/mul-fft.cc", + "src/bigint/mul-toom.cc", + ] + + defines = [ "V8_ADVANCED_BIGINT_ALGORITHMS" ] + } + configs = [ ":internal_config" ] } @@ -4962,6 +5062,10 @@ v8_header_set("cppgc_headers") { "include/cppgc/process-heap-statistics.h", "include/cppgc/sentinel-pointer.h", "include/cppgc/source-location.h", + + # TODO(v8:11952): Remove the testing header here once depending on both, + # //v8:v8 and //v8:v8_for_testing does not result in ODR violations. + "include/cppgc/testing.h", "include/cppgc/trace-trait.h", "include/cppgc/type-traits.h", "include/cppgc/visitor.h", @@ -5058,6 +5162,10 @@ v8_source_set("cppgc_base") { "src/heap/cppgc/sweeper.cc", "src/heap/cppgc/sweeper.h", "src/heap/cppgc/task-handle.h", + + # TODO(v8:11952): Remove the testing header here once depending on both, + # //v8:v8 and //v8:v8_for_testing does not result in ODR violations. + "src/heap/cppgc/testing.cc", "src/heap/cppgc/trace-event.h", "src/heap/cppgc/trace-trait.cc", "src/heap/cppgc/virtual-memory.cc", @@ -5094,22 +5202,6 @@ v8_source_set("cppgc_base") { } } -v8_source_set("cppgc_base_for_testing") { - visibility = [ ":*" ] - - sources = [ - "include/cppgc/testing.h", - "src/heap/cppgc/testing.cc", - ] - - configs = [ - ":internal_config", - ":cppgc_base_config", - ] - - public_deps = [ ":cppgc_base" ] -} - if (v8_check_header_includes) { # This file will be generated by tools/generate-header-include-checks.py # if the "check_v8_header_includes" gclient variable is set. @@ -5491,7 +5583,6 @@ if (is_component_build) { sources = [ "src/utils/v8dll-main.cc" ] public_deps = [ - ":cppgc_base_for_testing", ":torque_base", ":torque_ls_base", ":v8_base", @@ -5520,10 +5611,7 @@ if (is_component_build) { v8_component("cppgc_for_testing") { testonly = true - public_deps = [ - ":cppgc_base", - ":cppgc_base_for_testing", - ] + public_deps = [ ":cppgc_base" ] configs = [] public_configs = [ ":external_config" ] @@ -5552,7 +5640,6 @@ if (is_component_build) { testonly = true public_deps = [ - ":cppgc_base_for_testing", ":torque_base", ":torque_ls_base", ":v8_base", @@ -5577,10 +5664,7 @@ if (is_component_build) { group("cppgc_for_testing") { testonly = true - public_deps = [ - ":cppgc_base", - ":cppgc_base_for_testing", - ] + public_deps = [ ":cppgc_base" ] public_configs = [ ":external_config" ] } diff --git a/deps/v8/COMMON_OWNERS b/deps/v8/COMMON_OWNERS index 8072df037bf0c5..69222f9843c3d6 100644 --- a/deps/v8/COMMON_OWNERS +++ b/deps/v8/COMMON_OWNERS @@ -35,7 +35,6 @@ solanes@chromium.org syg@chromium.org szuend@chromium.org thibaudm@chromium.org -ulan@chromium.org vahl@chromium.org verwaest@chromium.org victorgomes@chromium.org diff --git a/deps/v8/DEPS b/deps/v8/DEPS index d3de2c5ddc9eaf..b1e297b106f44c 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -41,13 +41,18 @@ vars = { 'android_url': 'https://android.googlesource.com', 'download_gcmole': False, 'download_jsfunfuzz': False, + 'download_prebuilt_bazel': False, 'check_v8_header_includes': False, + 'checkout_reclient': False, + + # reclient CIPD package version + 'reclient_version': 're_client_version:0.33.0.3e223d5', # GN CIPD package version. - 'gn_version': 'git_revision:39a87c0b36310bdf06b692c098f199a0d97fc810', + 'gn_version': 'git_revision:24e2f7df92641de0351a96096fb2c490b2436bb8', # luci-go CIPD package version. - 'luci_go': 'git_revision:22d464e2f8f3bd2bd33f69fe819326d63f881008', + 'luci_go': 'git_revision:8b8a9a6040ca6debd30694a71a99a1eac97d72fd', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version @@ -84,16 +89,12 @@ vars = { } deps = { + 'base/trace_event/common': + Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'd5bb24e5d9802c8c917fcaa4375d5239a586c168', 'build': - Var('chromium_url') + '/chromium/src/build.git' + '@' + '4036cf1b17581f5668b487a25e252d56e0321a7f', - 'third_party/depot_tools': - Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + '6b0a611c2c692684f94c0c3629f793feebd16b39', - 'third_party/icu': - Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'f022e298b4f4a782486bb6d5ce6589c998b51fe2', - 'third_party/instrumented_libraries': - Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '4ae2535e8e894c3cd81d46aacdaf151b5df30709', + Var('chromium_url') + '/chromium/src/build.git' + '@' + '2d999384c270a340f592cce0a0fb3f8f94c15290', 'buildtools': - Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '20b1d0fc13ebaa263a1248f08814f523a86e6bed', + Var('chromium_url') + '/chromium/src/buildtools.git' + '@' + '2500c1d8f3a20a66a7cbafe3f69079a2edb742dd', 'buildtools/clang_format/script': Var('chromium_url') + '/external/github.com/llvm/llvm-project/clang/tools/clang-format.git' + '@' + '99803d74e35962f63a775f29477882afd4d57d94', 'buildtools/linux64': { @@ -117,11 +118,11 @@ deps = { 'condition': 'host_os == "mac"', }, 'buildtools/third_party/libc++/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '8fa87946779682841e21e2da977eccfb6cb3bded', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxx.git' + '@' + '79a2e924d96e2fc1e4b937c42efd08898fa472d7', 'buildtools/third_party/libc++abi/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '767de317f97343db64af048e3d198ab8b10fee5d', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libcxxabi.git' + '@' + '6803464b0f46df0a51862347d39e0791b59cf568', 'buildtools/third_party/libunwind/trunk': - Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + '7846d256355e40273f7cc192c8f5893e8665a1f9', + Var('chromium_url') + '/external/github.com/llvm/llvm-project/libunwind.git' + '@' + 'a5feaf61658af4453e282142a76aeb6f9c045311', 'buildtools/win': { 'packages': [ { @@ -132,14 +133,50 @@ deps = { 'dep_type': 'cipd', 'condition': 'host_os == "win"', }, - 'base/trace_event/common': - Var('chromium_url') + '/chromium/src/base/trace_event/common.git' + '@' + 'd5bb24e5d9802c8c917fcaa4375d5239a586c168', + 'buildtools/reclient': { + 'packages': [ + { + 'package': 'infra/rbe/client/${{platform}}', + 'version': Var('reclient_version'), + } + ], + 'dep_type': 'cipd', + 'condition': '(host_os == "linux" or host_os == "win") and checkout_reclient', + }, + 'test/benchmarks/data': + Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f', + 'test/mozilla/data': + Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', + 'test/test262/data': + Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + 'ebb6c34fa5dd76a6bea01c54ed7b182596492176', + 'test/test262/harness': + Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '278bcfaed0dcaa13936831fb1769d15e7c1e3b2b', + 'third_party/aemu-linux-x64': { + 'packages': [ + { + 'package': 'fuchsia/third_party/aemu/linux-amd64', + 'version': 'm4sM10idq7LeFHXpoLKLBtaOZsQzuj63Usa3Cl9af1YC' + }, + ], + 'condition': 'host_os == "linux" and checkout_fuchsia', + 'dep_type': 'cipd', + }, + 'third_party/aemu-mac-x64': { + 'packages': [ + { + 'package': 'fuchsia/third_party/aemu/mac-amd64', + 'version': 'T9bWxf8aUC5TwCFgPxpuW29Mfy-7Z9xCfXB9QO8MfU0C' + }, + ], + 'condition': 'host_os == "mac" and checkout_fuchsia', + 'dep_type': 'cipd', + }, 'third_party/android_ndk': { 'url': Var('chromium_url') + '/android_ndk.git' + '@' + '401019bf85744311b26c88ced255cd53401af8b7', 'condition': 'checkout_android', }, 'third_party/android_platform': { - 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'fdaa5e5b9f6384c3011ca8479d672e47528f743f', + 'url': Var('chromium_url') + '/chromium/src/third_party/android_platform.git' + '@' + 'b291e88d8e3e6774d6d46151e11dc3189ddeeb09', 'condition': 'checkout_android', }, 'third_party/android_sdk/public': { @@ -181,36 +218,46 @@ deps = { 'dep_type': 'cipd', }, 'third_party/catapult': { - 'url': Var('chromium_url') + '/catapult.git' + '@' + 'c1e1d559b46476584ec0eb1d83bd7f43fa5a1b36', + 'url': Var('chromium_url') + '/catapult.git' + '@' + '2814ff3716a8512518bee705a0f91425ce06b27b', 'condition': 'checkout_android', }, 'third_party/colorama/src': { 'url': Var('chromium_url') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', 'condition': 'checkout_android', }, + 'third_party/depot_tools': + Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'a806594b95a39141fdbf1f359087a44ffb2deaaf', 'third_party/fuchsia-sdk': { - 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + 'efa46583d89ea8c97523281d9f52a0d96472114d', + 'url': Var('chromium_url') + '/chromium/src/third_party/fuchsia-sdk.git' + '@' + '18896843130c33372c455c153ad07d2217bd2085', 'condition': 'checkout_fuchsia', }, - 'third_party/googletest/src': - Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '23ef29555ef4789f555f1ba8c51b4c52975f0907', 'third_party/google_benchmark/src': { - 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + '7d0d9061d83b663ce05d9de5da3d5865a3845b79', + 'url': Var('chromium_url') + '/external/github.com/google/benchmark.git' + '@' + 'e451e50e9b8af453f076dec10bd6890847f1624e', + }, + 'third_party/googletest/src': + Var('chromium_url') + '/external/github.com/google/googletest.git' + '@' + '4ec4cd23f486bf70efcc5d2caa40f24368f752e3', + 'third_party/icu': + Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'b9dfc58bf9b02ea0365509244aca13841322feb0', + 'third_party/instrumented_libraries': + Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + '4ae2535e8e894c3cd81d46aacdaf151b5df30709', + 'third_party/ittapi': { + # Force checkout ittapi libraries to pass v8 header includes check on + # bots that has check_v8_header_includes enabled. + 'url': Var('chromium_url') + '/external/github.com/intel/ittapi' + '@' + 'b4ae0122ba749163096058b4f1bb065bf4a7de94', + 'condition': "checkout_ittapi or check_v8_header_includes", }, 'third_party/jinja2': - Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '11b6b3e5971d760bd2d310f77643f55a818a6d25', + Var('chromium_url') + '/chromium/src/third_party/jinja2.git' + '@' + '7c54c1f227727e0c4c1d3dc19dd71cd601a2db95', + 'third_party/jsoncpp/source': + Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '9059f5cad030ba11d37818847443a53918c327b1', + 'third_party/logdog/logdog': + Var('chromium_url') + '/infra/luci/luci-py/client/libs/logdog' + '@' + '794d09a24c10401953880c253d0c7e267234ab75', 'third_party/markupsafe': - Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '0944e71f4b2cb9a871bcbe353f95e889b64a611a', - 'tools/swarming_client': - Var('chromium_url') + '/infra/luci/client-py.git' + '@' + 'a32a1607f6093d338f756c7e7c7b4333b0c50c9c', - 'test/benchmarks/data': - Var('chromium_url') + '/v8/deps/third_party/benchmarks.git' + '@' + '05d7188267b4560491ff9155c5ee13e207ecd65f', - 'test/mozilla/data': - Var('chromium_url') + '/v8/deps/third_party/mozilla-tests.git' + '@' + 'f6c578a10ea707b1a8ab0b88943fe5115ce2b9be', - 'test/test262/data': - Var('chromium_url') + '/external/github.com/tc39/test262.git' + '@' + '6d353a4436747e2de8820efac27ae5ef7e601b60', - 'test/test262/harness': - Var('chromium_url') + '/external/github.com/test262-utils/test262-harness-py.git' + '@' + '278bcfaed0dcaa13936831fb1769d15e7c1e3b2b', + Var('chromium_url') + '/chromium/src/third_party/markupsafe.git' + '@' + '1b882ef6372b58bfd55a3285f37ed801be9137cd', + 'third_party/perfetto': + Var('android_url') + '/platform/external/perfetto.git' + '@' + 'aa4385bc5997ecad4c633885e1b331b1115012fb', + 'third_party/protobuf': + Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + '6a59a2ad1f61d9696092f79b6d74368b4d7970a3', 'third_party/qemu-linux-x64': { 'packages': [ { @@ -231,28 +278,24 @@ deps = { 'condition': 'host_os == "mac" and checkout_fuchsia', 'dep_type': 'cipd', }, - 'third_party/aemu-linux-x64': { - 'packages': [ - { - 'package': 'fuchsia/third_party/aemu/linux-amd64', - 'version': '-Sz2gSN_5yVSHDlitjxUlmZpHuz-F2kFDW6TnmggCZoC' - }, - ], - 'condition': 'host_os == "linux" and checkout_fuchsia', - 'dep_type': 'cipd', - }, - 'third_party/aemu-mac-x64': { - 'packages': [ - { - 'package': 'fuchsia/third_party/aemu/mac-amd64', - 'version': 'T9bWxf8aUC5TwCFgPxpuW29Mfy-7Z9xCfXB9QO8MfU0C' - }, - ], - 'condition': 'host_os == "mac" and checkout_fuchsia', - 'dep_type': 'cipd', + 'third_party/requests': { + 'url': Var('chromium_url') + '/external/github.com/kennethreitz/requests.git' + '@' + '2c2138e811487b13020eb331482fb991fd399d4e', + 'condition': 'checkout_android', }, + 'third_party/zlib': + Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + 'dfbc590f5855bc2765256a743cad0abc56330a30', 'tools/clang': - Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + 'a38f01b956e091d5e698d2af484c81cd4e9a2a2d', + Var('chromium_url') + '/chromium/src/tools/clang.git' + '@' + '9d0a403e85d25b5b0d3016a342d4b83b12941fd5', + 'tools/clang/dsymutil': { + 'packages': [ + { + 'package': 'chromium/llvm-build-tools/dsymutil', + 'version': 'M56jPzDv1620Rnm__jTMYS62Zi8rxHVq7yw0qeBFEgkC', + } + ], + 'condition': 'checkout_mac', + 'dep_type': 'cipd', + }, 'tools/luci-go': { 'packages': [ { @@ -271,34 +314,8 @@ deps = { 'condition': 'host_cpu != "s390" and host_os != "aix"', 'dep_type': 'cipd', }, - 'tools/clang/dsymutil': { - 'packages': [ - { - 'package': 'chromium/llvm-build-tools/dsymutil', - 'version': 'M56jPzDv1620Rnm__jTMYS62Zi8rxHVq7yw0qeBFEgkC', - } - ], - 'condition': 'checkout_mac', - 'dep_type': 'cipd', - }, - 'third_party/perfetto': - Var('android_url') + '/platform/external/perfetto.git' + '@' + 'aa4385bc5997ecad4c633885e1b331b1115012fb', - 'third_party/protobuf': - Var('chromium_url') + '/external/github.com/google/protobuf'+ '@' + '6a59a2ad1f61d9696092f79b6d74368b4d7970a3', - 'third_party/zlib': - Var('chromium_url') + '/chromium/src/third_party/zlib.git'+ '@' + '5b8d433953beb2a75a755ba321a3076b95f7cdb9', - 'third_party/jsoncpp/source': - Var('chromium_url') + '/external/github.com/open-source-parsers/jsoncpp.git'+ '@' + '9059f5cad030ba11d37818847443a53918c327b1', - 'third_party/ittapi': { - # Force checkout ittapi libraries to pass v8 header includes check on - # bots that has check_v8_header_includes enabled. - 'url': Var('chromium_url') + '/external/github.com/intel/ittapi' + '@' + 'b4ae0122ba749163096058b4f1bb065bf4a7de94', - 'condition': "checkout_ittapi or check_v8_header_includes", - }, - 'third_party/requests': { - 'url': Var('chromium_url') + '/external/github.com/kennethreitz/requests.git' + '@' + '2c2138e811487b13020eb331482fb991fd399d4e', - 'condition': 'checkout_android', - }, + 'tools/swarming_client': + Var('chromium_url') + '/infra/luci/client-py.git' + '@' + 'a32a1607f6093d338f756c7e7c7b4333b0c50c9c', } include_rules = [ @@ -340,6 +357,17 @@ hooks = [ 'tools/get_landmines.py', ], }, + { + 'name': 'bazel', + 'pattern': '.', + 'condition': 'download_prebuilt_bazel', + 'action': [ 'download_from_google_storage', + '--bucket', 'chromium-v8-prebuilt-bazel/linux', + '--no_resume', + '-s', 'tools/bazel/bazel.sha1', + '--platform=linux*', + ], + }, # Pull clang-format binaries using checked-in hashes. { 'name': 'clang_format_win', @@ -538,17 +566,6 @@ hooks = [ '--boot-images={checkout_fuchsia_boot_images}', ], }, - { - # Mac doesn't use lld so it's not included in the default clang bundle - # there. However, lld is need in Fuchsia cross builds, so - # download it there. - # Should run after the clang hook. - 'name': 'lld/mac', - 'pattern': '.', - 'condition': 'host_os == "mac" and checkout_fuchsia', - 'action': ['python', 'tools/clang/scripts/update.py', - '--package=lld_mac'], - }, { # Mac does not have llvm-objdump, download it for cross builds in Fuchsia. 'name': 'llvm-objdump', diff --git a/deps/v8/OWNERS b/deps/v8/OWNERS index 2ad1949b515935..6f0ac017208f5c 100644 --- a/deps/v8/OWNERS +++ b/deps/v8/OWNERS @@ -10,9 +10,13 @@ per-file .git-blame-ignore-revs=file:INFRA_OWNERS per-file .gitattributes=file:INFRA_OWNERS per-file .gitignore=file:INFRA_OWNERS per-file .gn=file:INFRA_OWNERS +per-file .mailmap=file:COMMON_OWNERS per-file .vpython=file:INFRA_OWNERS per-file .ycm_extra_conf.py=file:INFRA_OWNERS +per-file .bazelrc=file:COMMON_OWNERS +per-file BUILD.bazel=file:COMMON_OWNERS per-file BUILD.gn=file:COMMON_OWNERS +per-file WORKSPACE=file:COMMON_OWNERS per-file DEPS=file:INFRA_OWNERS # For Test262 rolls. per-file DEPS=mathias@chromium.org diff --git a/deps/v8/WATCHLISTS b/deps/v8/WATCHLISTS index c54f15ad797078..f691d88e921606 100644 --- a/deps/v8/WATCHLISTS +++ b/deps/v8/WATCHLISTS @@ -97,7 +97,13 @@ }, 'regexp': { 'filepath': 'src/.*regexp', - } + }, + 'bazel': { + 'filepath': 'BUILD.gn' \ + '|BUILD.bazel' \ + '|WORKSPACE' \ + '|bazel/' + }, }, 'WATCHLISTS': { @@ -156,5 +162,8 @@ 'jgruber+watch@chromium.org', 'pthier+watch@chromium.org' ], + 'bazel' : [ + 'victorgomes+watch@chromium.org' + ], }, } diff --git a/deps/v8/WORKSPACE b/deps/v8/WORKSPACE new file mode 100644 index 00000000000000..289902f68d857f --- /dev/null +++ b/deps/v8/WORKSPACE @@ -0,0 +1,29 @@ +# 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. + +workspace(name = "v8") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "bazel_skylib", + urls = [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", + ], + sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", +) +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") +bazel_skylib_workspace() + +new_local_repository( + name = "zlib", + path = "third_party/zlib", + build_file = "bazel/BUILD.zlib", +) + +new_local_repository( + name = "icu", + path = "third_party/icu", + build_file = "bazel/BUILD.icu", +) diff --git a/deps/v8/bazel/BUILD.icu b/deps/v8/bazel/BUILD.icu new file mode 100644 index 00000000000000..fd651d513ddf89 --- /dev/null +++ b/deps/v8/bazel/BUILD.icu @@ -0,0 +1,76 @@ +# 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. + +filegroup( + name = "icudata", + srcs = [ "common/icudtl.dat" ] +) + +cc_library( + name = "icuuc", + srcs = glob([ + "source/common/**/*.h", + "source/common/**/*.cpp" + ]), + defines = [ + "U_COMMON_IMPLEMENTATION", + "U_ICUDATAENTRY_IN_COMMON", + "HAVE_DLOPEN=0", + "UCONFIG_ONLY_HTML_CONVERSION=1", + "U_CHARSET_IS_UTF8=1", + "U_USING_ICU_NAMESPACE=0", + "U_ENABLE_DYLOAD=0", + "USE_CHROMIUM_ICU=1", + "U_ENABLE_TRACING=1", + "U_ENABLE_RESOURCE_TRACING=0", + "UNISTR_FROM_STRING_EXPLICIT=", + "UNISTR_FROM_CHAR_EXPLICIT=", + "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE", + ], + copts = [ + "-Wno-unused-function", + "-Wno-parentheses", + "-Wno-unused-function", + "-Wno-unused-variable", + "-Wno-deprecated-declarations", + ], + includes = [ + "source/common", + "source/i18n", + ], + tags = ["requires-rtti"], + data = [ ":icudata" ], + alwayslink = 1, +) + +cc_library( + name = "icui18n", + srcs = glob([ + "source/i18n/**/*.h", + "source/i18n/**/*.cpp" + ]), + defines = [ + "U_I18N_IMPLEMENTATION", + ], + deps = [ ":icuuc" ], + alwayslink = 1, +) + +cc_library( + name = "icu", + hdrs = glob([ + "source/common/unicode/*.h", + "source/i18n/unicode/*.h", + ]), + srcs = [ + "source/stubdata/stubdata.cpp", + ], + include_prefix = "third_party/icu", + deps = [ + ":icuuc", + ":icui18n" + ], + visibility = ["//visibility:public"], + alwayslink = 1, +) diff --git a/deps/v8/bazel/BUILD.zlib b/deps/v8/bazel/BUILD.zlib new file mode 100644 index 00000000000000..0c97b325a34c51 --- /dev/null +++ b/deps/v8/bazel/BUILD.zlib @@ -0,0 +1,52 @@ +# 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. + +cc_library( + name = "zlib", + srcs = [ + "adler32.c", + "chromeconf.h", + "compress.c", + "contrib/optimizations/insert_string.h", + "cpu_features.c", + "cpu_features.h", + "crc32.c", + "crc32.h", + "deflate.c", + "deflate.h", + "gzclose.c", + "gzguts.h", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inffast.h", + "inffixed.h", + "inflate.c", + "inflate.h", + "inftrees.c", + "inftrees.h", + "trees.c", + "trees.h", + "uncompr.c", + "zconf.h", + "zlib.h", + "zutil.c", + "zutil.h", + "google/compression_utils_portable.h", + "google/compression_utils_portable.cc", + ], + hdrs = [ + "zlib.h", + "google/compression_utils_portable.h", + ], + include_prefix = "third_party/zlib", + defines = [ + "CHROMIUM_ZLIB_NO_CHROMECONF", + "HAVE_HIDDEN", + "CPU_NO_SIMD", + ], + visibility = ["//visibility:public"], +) diff --git a/deps/v8/bazel/OWNERS b/deps/v8/bazel/OWNERS new file mode 100644 index 00000000000000..8636f621c416b4 --- /dev/null +++ b/deps/v8/bazel/OWNERS @@ -0,0 +1,5 @@ +# Google3 V8 owners +ahaas@chromium.org +cbruni@chromium.org +delphick@chromium.org +victorgomes@chromium.org diff --git a/deps/v8/bazel/defs.bzl b/deps/v8/bazel/defs.bzl new file mode 100644 index 00000000000000..fbd1830ecb1e35 --- /dev/null +++ b/deps/v8/bazel/defs.bzl @@ -0,0 +1,239 @@ +# 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. + +FlagInfo = provider(fields = ["value"]) + +def _options_impl(ctx): + return FlagInfo(value = ctx.build_setting_value) + +_create_option_flag = rule( + implementation = _options_impl, + build_setting = config.bool(flag = True), +) + +_create_option_string = rule( + implementation = _options_impl, + build_setting = config.string(flag = True), +) + +_create_option_int = rule( + implementation = _options_impl, + build_setting = config.int(flag = True), +) + +def v8_raw_flag(name, default = False): + _create_option_flag(name = name, build_setting_default = default) + native.config_setting(name = "raw_" + name, flag_values = {name: "True"}) + +def v8_flag(name, default = False): + _create_option_flag(name = name, build_setting_default = default) + native.config_setting(name = "is_" + name, flag_values = {name: "True"}) + native.config_setting(name = "is_not_" + name, flag_values = {name: "False"}) + +def v8_string(name, default = ""): + _create_option_string(name = name, build_setting_default = default) + +def v8_int(name, default = 0): + _create_option_int(name = name, build_setting_default = default) + +def _custom_config_impl(ctx): + defs = [] + defs.append("V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=" + + str(ctx.attr._v8_typed_array_max_size_in_heap[FlagInfo].value)) + context = cc_common.create_compilation_context(defines = depset(defs)) + return [CcInfo(compilation_context = context)] + +v8_custom_config = rule( + implementation = _custom_config_impl, + attrs = { + "_v8_typed_array_max_size_in_heap": + attr.label(default = ":v8_typed_array_max_size_in_heap"), + } +) + +def _config_impl(ctx): + hdrs = [] + # Add headers + for h in ctx.attr.hdrs: + hdrs += h[DefaultInfo].files.to_list() + defs = [] + # Add conditional_defines + for f, d in ctx.attr.conditional_defines.items(): + if f[FlagInfo].value: + defs.append(d) + # Add defines + for d in ctx.attr.defines: + defs.append(d) + context = cc_common.create_compilation_context( + defines = depset( + defs, + transitive = [dep[CcInfo].compilation_context.defines for dep in ctx.attr.deps], + ), + headers = depset( + hdrs, + transitive = [dep[CcInfo].compilation_context.headers for dep in ctx.attr.deps], + ), + ) + return [CcInfo(compilation_context = context)] + +v8_config = rule( + implementation = _config_impl, + attrs = { + "conditional_defines": attr.label_keyed_string_dict(), + "defines": attr.string_list(), + "deps": attr.label_list(), + "hdrs": attr.label_list(allow_files = True), + }, +) + +def _default_args(configs): + return struct( + deps = configs + [":define_flags"], + copts = [ + "-fPIC", + "-Werror", + "-Wextra", + "-Wno-builtin-assume-aligned-alignment", + "-Wno-unused-parameter", + "-Wno-implicit-int-float-conversion", + "-Wno-deprecated-copy", + "-Wno-non-virtual-dtor", + "-std=c++17", + "-isystem .", + ], + includes = ["include"], + linkopts = [ + "-pthread" + ] + select({ + ":is_macos": [], + "//conditions:default": [ "-Wl,--no-as-needed -ldl" ], + }) + select({ + ":should_add_rdynamic": [ "-rdynamic" ], + "//conditions:default": [], + }), + ) + +def v8_binary( + name, + srcs, + configs = [], + deps = [], + includes = [], + copts = [], + linkopts = [], + **kwargs): + default = _default_args(configs) + native.cc_binary( + name = name, + srcs = srcs, + deps = deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts, + linkopts = linkopts + default.linkopts, + **kwargs + ) + +def v8_library( + name, + srcs, + configs = [], + deps = [], + includes = [], + copts = [], + linkopts = [], + **kwargs): + default = _default_args(configs) + native.cc_library( + name = name, + srcs = srcs, + deps = deps + default.deps, + includes = includes + default.includes, + copts = copts + default.copts, + linkopts = linkopts + default.linkopts, + alwayslink = 1, + **kwargs + ) + +def _torque_impl(ctx): + v8root = ctx.attr.v8root[FlagInfo].value + # Arguments + args = [] + args += ctx.attr.args + args.append("-o") + args.append(ctx.bin_dir.path + "/torque-generated") + args.append("-strip-v8-root") + args.append("-v8-root") + args.append(v8root) + # Sources + args += [f.path for f in ctx.files.srcs] + # Generate/declare output files + outs = [] + for src in ctx.files.srcs: + root, period, ext = src.path.rpartition(".") + # Strip v8root + if root[:len(v8root)] == v8root: + root = root[len(v8root):] + file = "torque-generated/" + root + outs.append(ctx.actions.declare_file(file + "-tq-csa.cc")) + outs.append(ctx.actions.declare_file(file + "-tq-csa.h")) + outs.append(ctx.actions.declare_file(file + "-tq-inl.inc")) + outs.append(ctx.actions.declare_file(file + "-tq.inc")) + outs.append(ctx.actions.declare_file(file + "-tq.cc")) + outs += [ctx.actions.declare_file("torque-generated/" + f) for f in ctx.attr.extras] + ctx.actions.run( + outputs = outs, + inputs = ctx.files.srcs, + arguments = args, + executable = ctx.executable.tool, + progress_message = "Generating Torque files", + ) + return [DefaultInfo(files = depset(outs))] + +v8_torque = rule( + implementation = _torque_impl, + attrs = { + "srcs": attr.label_list(allow_files = True, mandatory = True), + "extras": attr.string_list(), + "tool": attr.label( + default = ":torque", + allow_files = True, + executable = True, + cfg = "host", + ), + "args": attr.string_list(), + "v8root": attr.label(default = ":v8_root"), + }, +) + +def _mksnapshot(ctx): + outs = [ + ctx.actions.declare_file("snapshot.cc"), + ctx.actions.declare_file("embedded.S"), + ] + ctx.actions.run( + outputs = outs, + inputs = [], + arguments = [ + "--embedded_variant=Default", + "--startup_src", outs[0].path, + "--embedded_src", outs[1].path, + ] + ctx.attr.args, + executable = ctx.executable.tool, + progress_message = "Running mksnapshot" + ) + return [DefaultInfo(files = depset(outs))] + + +v8_mksnapshot = rule( + implementation = _mksnapshot, + attrs = { + "args": attr.string_list(), + "tool": attr.label( + default = ":mksnapshot", + allow_files = True, + executable = True, + cfg = "host", + ), + } +) diff --git a/deps/v8/bazel/generate-inspector-files.sh b/deps/v8/bazel/generate-inspector-files.sh new file mode 100755 index 00000000000000..7fd4ab2a564a4e --- /dev/null +++ b/deps/v8/bazel/generate-inspector-files.sh @@ -0,0 +1,19 @@ +# 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. + +BAZEL_OUT=$1 + +# Create a default GN output folder +gn gen out/inspector + +# Generate inspector files +autoninja -C out/inspector src/inspector:inspector + +# Create directories in bazel output folder +mkdir -p $BAZEL_OUT/include/inspector +mkdir -p $BAZEL_OUT/src/inspector/protocol + +# Copy generated files to bazel output folder +cp out/inspector/gen/include/inspector/* $BAZEL_OUT/include/inspector/ +cp out/inspector/gen/src/inspector/protocol/* $BAZEL_OUT/src/inspector/protocol/ diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni index 8741e86c087069..a3346517978b32 100644 --- a/deps/v8/gni/v8.gni +++ b/deps/v8/gni/v8.gni @@ -87,6 +87,10 @@ declare_args() { v8_enable_google_benchmark = false cppgc_is_standalone = false + + # Enable advanced BigInt algorithms, costing about 10-30 KB binary size + # depending on platform. Disabled on Android to save binary size. + v8_advanced_bigint_algorithms = !is_android } if (v8_use_external_startup_data == "") { diff --git a/deps/v8/include/OWNERS b/deps/v8/include/OWNERS index 7d538da1aa6642..d85849d52a1219 100644 --- a/deps/v8/include/OWNERS +++ b/deps/v8/include/OWNERS @@ -2,7 +2,6 @@ adamk@chromium.org cbruni@chromium.org leszeks@chromium.org mlippautz@chromium.org -ulan@chromium.org verwaest@chromium.org yangguo@chromium.org diff --git a/deps/v8/include/cppgc/allocation.h b/deps/v8/include/cppgc/allocation.h index 7a803cf2cc43b3..b06d9d70206409 100644 --- a/deps/v8/include/cppgc/allocation.h +++ b/deps/v8/include/cppgc/allocation.h @@ -5,25 +5,20 @@ #ifndef INCLUDE_CPPGC_ALLOCATION_H_ #define INCLUDE_CPPGC_ALLOCATION_H_ -#include - #include +#include +#include +#include #include #include "cppgc/custom-space.h" -#include "cppgc/garbage-collected.h" #include "cppgc/internal/api-constants.h" #include "cppgc/internal/gc-info.h" +#include "cppgc/type-traits.h" +#include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { -template -class MakeGarbageCollectedTraitBase; - -namespace internal { -class ObjectAllocator; -} // namespace internal - /** * AllocationHandle is used to allocate garbage-collected objects. */ diff --git a/deps/v8/include/cppgc/heap-statistics.h b/deps/v8/include/cppgc/heap-statistics.h index 2fe6e1ae58abbb..8e626596e5b07b 100644 --- a/deps/v8/include/cppgc/heap-statistics.h +++ b/deps/v8/include/cppgc/heap-statistics.h @@ -5,7 +5,8 @@ #ifndef INCLUDE_CPPGC_HEAP_STATISTICS_H_ #define INCLUDE_CPPGC_HEAP_STATISTICS_H_ -#include +#include +#include #include #include @@ -30,19 +31,17 @@ struct HeapStatistics final { }; /** - * Statistics of object types. For each type the statistics record its name, - * how many objects of that type were allocated, and the overall size used by - * these objects. + * Object statistics for a single type. */ - struct ObjectStatistics { - /** Number of distinct types in the heap. */ - size_t num_types = 0; - /** Name of each type in the heap. */ - std::vector type_name; - /** Number of allocated objects per each type. */ - std::vector type_count; - /** Overall size of allocated objects per each type. */ - std::vector type_bytes; + struct ObjectStatsEntry { + /** + * Number of allocated bytes. + */ + size_t allocated_bytes; + /** + * Number of allocated objects. + */ + size_t object_count; }; /** @@ -50,10 +49,15 @@ struct HeapStatistics final { * allocated memory size and overall used memory size for the page. */ struct PageStatistics { - /** Overall amount of memory allocated for the page. */ - size_t physical_size_bytes = 0; + /** Overall committed amount of memory for the page. */ + size_t committed_size_bytes = 0; + /** Resident amount of memory held by the page. */ + size_t resident_size_bytes = 0; /** Amount of memory actually used on the page. */ size_t used_size_bytes = 0; + /** Statistics for object allocated on the page. Filled only when + * NameProvider::HideInternalNames() is false. */ + std::vector object_statistics; }; /** @@ -80,29 +84,35 @@ struct HeapStatistics final { struct SpaceStatistics { /** The space name */ std::string name; - /** Overall amount of memory allocated for the space. */ - size_t physical_size_bytes = 0; + /** Overall committed amount of memory for the heap. */ + size_t committed_size_bytes = 0; + /** Resident amount of memory held by the heap. */ + size_t resident_size_bytes = 0; /** Amount of memory actually used on the space. */ size_t used_size_bytes = 0; /** Statistics for each of the pages in the space. */ std::vector page_stats; /** Statistics for the freelist of the space. */ FreeListStatistics free_list_stats; - /** Statistics for object allocated on the space. Filled only when - * NameProvider::HideInternalNames() is false. */ - ObjectStatistics object_stats; }; - /** Overall amount of memory allocated for the heap. */ - size_t physical_size_bytes = 0; + /** Overall committed amount of memory for the heap. */ + size_t committed_size_bytes = 0; + /** Resident amount of memory help by the heap. */ + size_t resident_size_bytes = 0; /** Amount of memory actually used on the heap. */ size_t used_size_bytes = 0; /** Detail level of this HeapStatistics. */ DetailLevel detail_level; /** Statistics for each of the spaces in the heap. Filled only when - * detail_level is kDetailed. */ + * `detail_level` is `DetailLevel::kDetailed`. */ std::vector space_stats; + + /** + * Vector of `cppgc::GarbageCollected` type names. + */ + std::vector type_names; }; } // namespace cppgc diff --git a/deps/v8/include/cppgc/heap.h b/deps/v8/include/cppgc/heap.h index fd0512f1f18e16..136c4fb44d08ab 100644 --- a/deps/v8/include/cppgc/heap.h +++ b/deps/v8/include/cppgc/heap.h @@ -5,6 +5,8 @@ #ifndef INCLUDE_CPPGC_HEAP_H_ #define INCLUDE_CPPGC_HEAP_H_ +#include +#include #include #include diff --git a/deps/v8/include/cppgc/internal/api-constants.h b/deps/v8/include/cppgc/internal/api-constants.h index a70f00710c8b8a..7253a47089352c 100644 --- a/deps/v8/include/cppgc/internal/api-constants.h +++ b/deps/v8/include/cppgc/internal/api-constants.h @@ -5,8 +5,8 @@ #ifndef INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ #define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ -#include -#include +#include +#include #include "v8config.h" // NOLINT(build/include_directory) diff --git a/deps/v8/include/cppgc/internal/gc-info.h b/deps/v8/include/cppgc/internal/gc-info.h index b9074b1ad5d1b9..0830b194909fb8 100644 --- a/deps/v8/include/cppgc/internal/gc-info.h +++ b/deps/v8/include/cppgc/internal/gc-info.h @@ -7,6 +7,7 @@ #include #include +#include #include "cppgc/internal/finalizer-trait.h" #include "cppgc/internal/name-trait.h" diff --git a/deps/v8/include/cppgc/internal/name-trait.h b/deps/v8/include/cppgc/internal/name-trait.h index ae99d41c0d76f9..2e2da1eab4a225 100644 --- a/deps/v8/include/cppgc/internal/name-trait.h +++ b/deps/v8/include/cppgc/internal/name-trait.h @@ -73,7 +73,7 @@ class NameTrait final : public NameTraitBase { private: static HeapObjectName GetNameFor(const NameProvider* name_provider) { - return {name_provider->GetName(), false}; + return {name_provider->GetHumanReadableName(), false}; } static HeapObjectName GetNameFor(...) { @@ -91,7 +91,7 @@ class NameTrait final : public NameTraitBase { static const HeapObjectName leaky_name = GetNameFromTypeSignature(PRETTY_FUNCTION_VALUE); - return leaky_name; + return {leaky_name, false}; #undef PRETTY_FUNCTION_VALUE diff --git a/deps/v8/include/cppgc/internal/pointer-policies.h b/deps/v8/include/cppgc/internal/pointer-policies.h index e09b86199f46b3..cdf0bb693d6996 100644 --- a/deps/v8/include/cppgc/internal/pointer-policies.h +++ b/deps/v8/include/cppgc/internal/pointer-policies.h @@ -82,7 +82,7 @@ class V8_EXPORT EnabledCheckingPolicy { class DisabledCheckingPolicy { protected: - void CheckPointer(const void* raw) {} + void CheckPointer(const void*) {} }; #if V8_ENABLE_CHECKS @@ -92,6 +92,10 @@ using DefaultPersistentCheckingPolicy = EnabledCheckingPolicy; using DefaultMemberCheckingPolicy = DisabledCheckingPolicy; using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy; #endif +// For CT(W)P neither marking information (for value), nor objectstart bitmap +// (for slot) are guaranteed to be present because there's no synchonization +// between heaps after marking. +using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy; class KeepLocationPolicy { public: @@ -154,7 +158,7 @@ struct WeakCrossThreadPersistentPolicy { // Forward declarations setting up the default policies. template + typename CheckingPolicy = DefaultCrossThreadPersistentCheckingPolicy> class BasicCrossThreadPersistent; template +#include + #include "cppgc/heap-state.h" #include "cppgc/internal/api-constants.h" #include "cppgc/internal/atomic-entry-flag.h" @@ -22,8 +25,11 @@ class HeapHandle; namespace internal { +#if defined(CPPGC_CAGED_HEAP) class WriteBarrierTypeForCagedHeapPolicy; +#else // !CPPGC_CAGED_HEAP class WriteBarrierTypeForNonCagedHeapPolicy; +#endif // !CPPGC_CAGED_HEAP class V8_EXPORT WriteBarrier final { public: diff --git a/deps/v8/include/cppgc/macros.h b/deps/v8/include/cppgc/macros.h index 70ab44c65759f1..030f397e3df15c 100644 --- a/deps/v8/include/cppgc/macros.h +++ b/deps/v8/include/cppgc/macros.h @@ -5,7 +5,7 @@ #ifndef INCLUDE_CPPGC_MACROS_H_ #define INCLUDE_CPPGC_MACROS_H_ -#include +#include #include "cppgc/internal/compiler-specific.h" diff --git a/deps/v8/include/cppgc/member.h b/deps/v8/include/cppgc/member.h index 16aed060226ea3..d0bf414c69d7f5 100644 --- a/deps/v8/include/cppgc/member.h +++ b/deps/v8/include/cppgc/member.h @@ -226,20 +226,20 @@ class BasicMember final : private MemberBase, private CheckingPolicy { template -bool operator==( - BasicMember member1, - BasicMember - member2) { +bool operator==(const BasicMember& member1, + const BasicMember& member2) { return member1.Get() == member2.Get(); } template -bool operator!=( - BasicMember member1, - BasicMember - member2) { +bool operator!=(const BasicMember& member1, + const BasicMember& member2) { return !(member1 == member2); } diff --git a/deps/v8/include/cppgc/name-provider.h b/deps/v8/include/cppgc/name-provider.h index 8b70b8ea5ee89a..224dd4b5d678ec 100644 --- a/deps/v8/include/cppgc/name-provider.h +++ b/deps/v8/include/cppgc/name-provider.h @@ -57,7 +57,7 @@ class V8_EXPORT NameProvider { * * @returns a human readable name for the object. */ - virtual const char* GetName() const = 0; + virtual const char* GetHumanReadableName() const = 0; }; } // namespace cppgc diff --git a/deps/v8/include/cppgc/persistent.h b/deps/v8/include/cppgc/persistent.h index 22cda7c6e8fcb7..03b5e5b06b5e28 100644 --- a/deps/v8/include/cppgc/persistent.h +++ b/deps/v8/include/cppgc/persistent.h @@ -141,7 +141,7 @@ class BasicPersistent final : public PersistentBase, } // Move assignment. - BasicPersistent& operator=(BasicPersistent&& other) { + BasicPersistent& operator=(BasicPersistent&& other) noexcept { if (this == &other) return *this; Clear(); PersistentBase::operator=(std::move(other)); diff --git a/deps/v8/include/cppgc/platform.h b/deps/v8/include/cppgc/platform.h index 0d7377668cf258..2d933d620dc011 100644 --- a/deps/v8/include/cppgc/platform.h +++ b/deps/v8/include/cppgc/platform.h @@ -5,6 +5,8 @@ #ifndef INCLUDE_CPPGC_PLATFORM_H_ #define INCLUDE_CPPGC_PLATFORM_H_ +#include + #include "v8-platform.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory) diff --git a/deps/v8/include/cppgc/source-location.h b/deps/v8/include/cppgc/source-location.h index 29d69b0a1372e6..da5a5ede520138 100644 --- a/deps/v8/include/cppgc/source-location.h +++ b/deps/v8/include/cppgc/source-location.h @@ -5,6 +5,7 @@ #ifndef INCLUDE_CPPGC_SOURCE_LOCATION_H_ #define INCLUDE_CPPGC_SOURCE_LOCATION_H_ +#include #include #include "v8config.h" // NOLINT(build/include_directory) diff --git a/deps/v8/include/js_protocol.pdl b/deps/v8/include/js_protocol.pdl index 9c0483ae7059c2..63baa3da13b843 100644 --- a/deps/v8/include/js_protocol.pdl +++ b/deps/v8/include/js_protocol.pdl @@ -175,7 +175,7 @@ domain Debugger command enable parameters # The maximum size in bytes of collected scripts (not referenced by other heap objects) - # the debugger can hold. Puts no limit if paramter is omitted. + # the debugger can hold. Puts no limit if parameter is omitted. experimental optional number maxScriptsCacheSize returns # Unique identifier of the debugger. @@ -714,7 +714,7 @@ experimental domain HeapProfiler parameters # If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. optional boolean reportProgress - # If true, a raw snapshot without artifical roots will be generated + # If true, a raw snapshot without artificial roots will be generated optional boolean treatGlobalObjectsAsRoots # If true, numerical values are included in the snapshot optional boolean captureNumericValue @@ -972,13 +972,13 @@ domain Profiler # Reports coverage delta since the last poll (either from an event like this, or from # `takePreciseCoverage` for the current isolate. May only be sent if precise code # coverage has been started. This event can be trigged by the embedder to, for example, - # trigger collection of coverage data immediatelly at a certain point in time. + # trigger collection of coverage data immediately at a certain point in time. experimental event preciseCoverageDeltaUpdate parameters # Monotonically increasing time (in seconds) when the coverage update was taken in the backend. number timestamp # Identifier for distinguishing coverage events. - string occassion + string occasion # Coverage data for the current isolate. array of ScriptCoverage result @@ -1225,7 +1225,7 @@ domain Runtime string origin # Human readable name describing given context. string name - # A system-unique execution context identifier. Unlike the id, this is unique accross + # A system-unique execution context identifier. Unlike the id, this is unique across # multiple processes, so can be reliably used to identify specific context while backend # performs a cross-process navigation. experimental string uniqueId @@ -1254,6 +1254,10 @@ domain Runtime optional RemoteObject exception # Identifier of the context where exception happened. optional ExecutionContextId executionContextId + # Dictionary with entries of meta data that the client associated + # with this exception, such as information about associated network + # requests, etc. + experimental optional object exceptionMetaData # Number of milliseconds since epoch. type Timestamp extends number @@ -1343,6 +1347,8 @@ domain Runtime # Symbolic group name that can be used to release multiple objects. If objectGroup is not # specified and objectId is, objectGroup will be inherited from object. optional string objectGroup + # Whether to throw an exception if side effect cannot be ruled out during evaluation. + experimental optional boolean throwOnSideEffect returns # Call result. RemoteObject result @@ -1422,9 +1428,9 @@ domain Runtime # evaluation and allows unsafe-eval. Defaults to true. experimental optional boolean allowUnsafeEvalBlockedByCSP # An alternative way to specify the execution context to evaluate in. - # Compared to contextId that may be reused accross processes, this is guaranteed to be + # Compared to contextId that may be reused across processes, this is guaranteed to be # system-unique, so it can be used to prevent accidental evaluation of the expression - # in context different than intended (e.g. as a result of navigation accross process + # in context different than intended (e.g. as a result of navigation across process # boundaries). # This is mutually exclusive with `contextId`. experimental optional string uniqueContextId diff --git a/deps/v8/include/v8-fast-api-calls.h b/deps/v8/include/v8-fast-api-calls.h index cda1959c866548..1848800b488683 100644 --- a/deps/v8/include/v8-fast-api-calls.h +++ b/deps/v8/include/v8-fast-api-calls.h @@ -156,6 +156,7 @@ * - float64_t * Currently supported argument types: * - pointer to an embedder type + * - JavaScript array of primitive types * - bool * - int32_t * - uint32_t @@ -176,8 +177,43 @@ * passes NaN values as-is, i.e. doesn't normalize them. * * To be supported types: - * - arrays of C types + * - TypedArrays and ArrayBuffers * - arrays of embedder types + * + * + * The API offers a limited support for function overloads: + * + * \code + * void FastMethod_2Args(int param, bool another_param); + * void FastMethod_3Args(int param, bool another_param, int third_param); + * + * v8::CFunction fast_method_2args_c_func = + * MakeV8CFunction(FastMethod_2Args); + * v8::CFunction fast_method_3args_c_func = + * MakeV8CFunction(FastMethod_3Args); + * const v8::CFunction fast_method_overloads[] = {fast_method_2args_c_func, + * fast_method_3args_c_func}; + * Local method_template = + * v8::FunctionTemplate::NewWithCFunctionOverloads( + * isolate, SlowCallback, data, signature, length, + * constructor_behavior, side_effect_type, + * {fast_method_overloads, 2}); + * \endcode + * + * In this example a single FunctionTemplate is associated to multiple C++ + * functions. The overload resolution is currently only based on the number of + * arguments passed in a call. For example, if this method_template is + * registered with a wrapper JS object as described above, a call with two + * arguments: + * obj.method(42, true); + * will result in a fast call to FastMethod_2Args, while a call with three or + * more arguments: + * obj.method(42, true, 11); + * will result in a fast call to FastMethod_3Args. Instead a call with less than + * two arguments, like: + * obj.method(42); + * would not result in a fast call but would fall back to executing the + * associated SlowCallback. */ #ifndef INCLUDE_V8_FAST_API_CALLS_H_ @@ -217,22 +253,73 @@ class CTypeInfo { // than any valid Type enum. static constexpr Type kCallbackOptionsType = Type(255); + enum class SequenceType : uint8_t { + kScalar, + kIsSequence, // sequence + kIsTypedArray, // TypedArray of T or any ArrayBufferView if T + // is void + kIsArrayBuffer // ArrayBuffer + }; + enum class Flags : uint8_t { kNone = 0, + kAllowSharedBit = 1 << 0, // Must be an ArrayBuffer or TypedArray + kEnforceRangeBit = 1 << 1, // T must be integral + kClampBit = 1 << 2, // T must be integral + kIsRestrictedBit = 1 << 3, // T must be float or double }; - explicit constexpr CTypeInfo(Type type, Flags flags = Flags::kNone) - : type_(type), flags_(flags) {} + explicit constexpr CTypeInfo( + Type type, SequenceType sequence_type = SequenceType::kScalar, + Flags flags = Flags::kNone) + : type_(type), sequence_type_(sequence_type), flags_(flags) {} constexpr Type GetType() const { return type_; } - + constexpr SequenceType GetSequenceType() const { return sequence_type_; } constexpr Flags GetFlags() const { return flags_; } + static constexpr bool IsIntegralType(Type type) { + return type == Type::kInt32 || type == Type::kUint32 || + type == Type::kInt64 || type == Type::kUint64; + } + + static constexpr bool IsFloatingPointType(Type type) { + return type == Type::kFloat32 || type == Type::kFloat64; + } + + static constexpr bool IsPrimitive(Type type) { + return IsIntegralType(type) || IsFloatingPointType(type) || + type == Type::kBool; + } + private: Type type_; + SequenceType sequence_type_; Flags flags_; }; +template +struct FastApiTypedArray { + T* data; // should include the typed array offset applied + size_t length; // length in number of elements +}; + +// Any TypedArray. It uses kTypedArrayBit with base type void +// Overloaded args of ArrayBufferView and TypedArray are not supported +// (for now) because the generic “any” ArrayBufferView doesn’t have its +// own instance type. It could be supported if we specify that +// TypedArray always has precedence over the generic ArrayBufferView, +// but this complicates overload resolution. +struct FastApiArrayBufferView { + void* data; + size_t byte_length; +}; + +struct FastApiArrayBuffer { + void* data; + size_t byte_length; +}; + class V8_EXPORT CFunctionInfo { public: // Construct a struct to hold a CFunction's type information. @@ -284,6 +371,42 @@ class V8_EXPORT CFunction { const void* GetAddress() const { return address_; } const CFunctionInfo* GetTypeInfo() const { return type_info_; } + enum class OverloadResolution { kImpossible, kAtRuntime, kAtCompileTime }; + + // Returns whether an overload between this and the given CFunction can + // be resolved at runtime by the RTTI available for the arguments or at + // compile time for functions with different number of arguments. + OverloadResolution GetOverloadResolution(const CFunction* other) { + // Runtime overload resolution can only deal with functions with the + // same number of arguments. Functions with different arity are handled + // by compile time overload resolution though. + if (ArgumentCount() != other->ArgumentCount()) { + return OverloadResolution::kAtCompileTime; + } + + // The functions can only differ by a single argument position. + int diff_index = -1; + for (unsigned int i = 0; i < ArgumentCount(); ++i) { + if (ArgumentInfo(i).GetSequenceType() != + other->ArgumentInfo(i).GetSequenceType()) { + if (diff_index >= 0) { + return OverloadResolution::kImpossible; + } + diff_index = i; + + // We only support overload resolution between sequence types. + if (ArgumentInfo(i).GetSequenceType() == + CTypeInfo::SequenceType::kScalar || + other->ArgumentInfo(i).GetSequenceType() == + CTypeInfo::SequenceType::kScalar) { + return OverloadResolution::kImpossible; + } + } + } + + return OverloadResolution::kAtRuntime; + } + template static CFunction Make(F* func) { return ArgUnwrap::Make(func); @@ -412,28 +535,91 @@ struct TypeInfoHelper { } \ \ static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \ + static constexpr CTypeInfo::SequenceType SequenceType() { \ + return CTypeInfo::SequenceType::kScalar; \ + } \ }; -#define BASIC_C_TYPES(V) \ - V(void, kVoid) \ - V(bool, kBool) \ - V(int32_t, kInt32) \ - V(uint32_t, kUint32) \ - V(int64_t, kInt64) \ - V(uint64_t, kUint64) \ - V(float, kFloat32) \ - V(double, kFloat64) \ - V(ApiObject, kApiObject) \ - V(v8::Local, kV8Value) \ - V(v8::Local, kV8Value) +template +struct CTypeInfoTraits {}; + +#define DEFINE_TYPE_INFO_TRAITS(CType, Enum) \ + template <> \ + struct CTypeInfoTraits { \ + using ctype = CType; \ + }; + +#define PRIMITIVE_C_TYPES(V) \ + V(bool, kBool) \ + V(int32_t, kInt32) \ + V(uint32_t, kUint32) \ + V(int64_t, kInt64) \ + V(uint64_t, kUint64) \ + V(float, kFloat32) \ + V(double, kFloat64) + +// Same as above, but includes deprecated types for compatibility. +#define ALL_C_TYPES(V) \ + PRIMITIVE_C_TYPES(V) \ + V(void, kVoid) \ + V(v8::Local, kV8Value) \ + V(v8::Local, kV8Value) \ + V(ApiObject, kApiObject) // ApiObject was a temporary solution to wrap the pointer to the v8::Value. // Please use v8::Local in new code for the arguments and // v8::Local for the receiver, as ApiObject will be deprecated. -BASIC_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR) +ALL_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR) +PRIMITIVE_C_TYPES(DEFINE_TYPE_INFO_TRAITS) -#undef BASIC_C_TYPES +#undef PRIMITIVE_C_TYPES +#undef ALL_C_TYPES + +#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA(T, Enum) \ + template <> \ + struct TypeInfoHelper> { \ + static constexpr CTypeInfo::Flags Flags() { \ + return CTypeInfo::Flags::kNone; \ + } \ + \ + static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \ + static constexpr CTypeInfo::SequenceType SequenceType() { \ + return CTypeInfo::SequenceType::kIsTypedArray; \ + } \ + }; + +#define TYPED_ARRAY_C_TYPES(V) \ + V(int32_t, kInt32) \ + V(uint32_t, kUint32) \ + V(int64_t, kInt64) \ + V(uint64_t, kUint64) \ + V(float, kFloat32) \ + V(double, kFloat64) + +TYPED_ARRAY_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA) + +#undef TYPED_ARRAY_C_TYPES + +template <> +struct TypeInfoHelper> { + static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; } + + static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kVoid; } + static constexpr CTypeInfo::SequenceType SequenceType() { + return CTypeInfo::SequenceType::kIsSequence; + } +}; + +template <> +struct TypeInfoHelper> { + static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; } + + static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kUint32; } + static constexpr CTypeInfo::SequenceType SequenceType() { + return CTypeInfo::SequenceType::kIsTypedArray; + } +}; template <> struct TypeInfoHelper { @@ -442,26 +628,63 @@ struct TypeInfoHelper { static constexpr CTypeInfo::Type Type() { return CTypeInfo::kCallbackOptionsType; } + static constexpr CTypeInfo::SequenceType SequenceType() { + return CTypeInfo::SequenceType::kScalar; + } }; +#define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \ + static_assert(((COND) == 0) || (ASSERTION), MSG) + template class CTypeInfoBuilder { public: using BaseType = T; static constexpr CTypeInfo Build() { - // Get the flags and merge in any additional flags. - uint8_t flags = uint8_t(TypeInfoHelper::Flags()); - int unused[] = {0, (flags |= uint8_t(Flags), 0)...}; - // With C++17, we could use a "..." fold expression over a parameter pack. - // Since we're still using C++14, we have to evaluate an OR expresion while - // constructing an unused list of 0's. This applies the binary operator - // for each value in Flags. - (void)unused; + constexpr CTypeInfo::Flags kFlags = + MergeFlags(TypeInfoHelper::Flags(), Flags...); + constexpr CTypeInfo::Type kType = TypeInfoHelper::Type(); + constexpr CTypeInfo::SequenceType kSequenceType = + TypeInfoHelper::SequenceType(); + + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit), + (kSequenceType == CTypeInfo::SequenceType::kIsTypedArray || + kSequenceType == CTypeInfo::SequenceType::kIsArrayBuffer), + "kAllowSharedBit is only allowed for TypedArrays and ArrayBuffers."); + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kEnforceRangeBit), + CTypeInfo::IsIntegralType(kType), + "kEnforceRangeBit is only allowed for integral types."); + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kClampBit), + CTypeInfo::IsIntegralType(kType), + "kClampBit is only allowed for integral types."); + STATIC_ASSERT_IMPLIES( + uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kIsRestrictedBit), + CTypeInfo::IsFloatingPointType(kType), + "kIsRestrictedBit is only allowed for floating point types."); + STATIC_ASSERT_IMPLIES(kSequenceType == CTypeInfo::SequenceType::kIsSequence, + kType == CTypeInfo::Type::kVoid, + "Sequences are only supported from void type."); + STATIC_ASSERT_IMPLIES( + kSequenceType == CTypeInfo::SequenceType::kIsTypedArray, + CTypeInfo::IsPrimitive(kType) || kType == CTypeInfo::Type::kVoid, + "TypedArrays are only supported from primitive types or void."); // Return the same type with the merged flags. - return CTypeInfo(TypeInfoHelper::Type(), CTypeInfo::Flags(flags)); + return CTypeInfo(TypeInfoHelper::Type(), + TypeInfoHelper::SequenceType(), kFlags); + } + + private: + template + static constexpr CTypeInfo::Flags MergeFlags(CTypeInfo::Flags flags, + Rest... rest) { + return CTypeInfo::Flags(uint8_t(flags) | uint8_t(MergeFlags(rest...))); } + static constexpr CTypeInfo::Flags MergeFlags() { return CTypeInfo::Flags(0); } }; template @@ -513,8 +736,9 @@ class CFunctionBuilderWithFunction { Flags...>; }; - // Return a copy of the CFunctionBuilder, but merges the Flags on ArgBuilder - // index N with the new Flags passed in the template parameter pack. + // Return a copy of the CFunctionBuilder, but merges the Flags on + // ArgBuilder index N with the new Flags passed in the template parameter + // pack. template constexpr auto ArgImpl(std::index_sequence) { return CFunctionBuilderWithFunction< @@ -546,6 +770,22 @@ CFunction CFunction::ArgUnwrap::Make(R (*func)(Args...)) { using CFunctionBuilder = internal::CFunctionBuilder; +/** + * Copies the contents of this JavaScript array to a C++ buffer with + * a given max_length. A CTypeInfo is passed as an argument, + * instructing different rules for conversion (e.g. restricted float/double). + * The element type T of the destination array must match the C type + * corresponding to the CTypeInfo (specified by CTypeInfoTraits). + * If the array length is larger than max_length or the array is of + * unsupported type, the operation will fail, returning false. Generally, an + * array which contains objects, undefined, null or anything not convertible + * to the requested destination type, is considered unsupported. The operation + * returns true on success. `type_info` will be used for conversions. + */ +template +bool CopyAndConvertArrayToCppBuffer(Local src, T* dst, + uint32_t max_length); + } // namespace v8 #endif // INCLUDE_V8_FAST_API_CALLS_H_ diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h index 852b39d7252295..0c19104a3774ab 100644 --- a/deps/v8/include/v8-inspector.h +++ b/deps/v8/include/v8-inspector.h @@ -170,7 +170,7 @@ class V8_EXPORT V8InspectorSession { v8::Local*, std::unique_ptr* objectGroup) = 0; virtual void releaseObjectGroup(StringView) = 0; - virtual void triggerPreciseCoverageDeltaUpdate(StringView occassion) = 0; + virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0; }; class V8_EXPORT V8InspectorClient { @@ -301,6 +301,10 @@ class V8_EXPORT V8Inspector { int scriptId) = 0; virtual void exceptionRevoked(v8::Local, unsigned exceptionId, StringView message) = 0; + virtual bool associateExceptionData(v8::Local, + v8::Local exception, + v8::Local key, + v8::Local value) = 0; // Connection. class V8_EXPORT Channel { diff --git a/deps/v8/include/v8-internal.h b/deps/v8/include/v8-internal.h index 5f0177182b598f..85471960006a08 100644 --- a/deps/v8/include/v8-internal.h +++ b/deps/v8/include/v8-internal.h @@ -145,6 +145,7 @@ enum ExternalPointerTag : uint64_t { kForeignForeignAddressTag = 0x01f7000000000000, // 0b000000111110111 kNativeContextMicrotaskQueueTag = 0x01fb000000000000, // 0b000000111111011 kEmbedderDataSlotPayloadTag = 0x01fd000000000000, // 0b000000111111101 + kCodeEntryPointTag = 0x01fe000000000000, // 0b000000111111110 }; constexpr uint64_t kExternalPointerTagMask = 0xffff000000000000; diff --git a/deps/v8/include/v8-metrics.h b/deps/v8/include/v8-metrics.h index 0217f40d63a629..498ee25f6d25c3 100644 --- a/deps/v8/include/v8-metrics.h +++ b/deps/v8/include/v8-metrics.h @@ -49,11 +49,19 @@ struct GarbageCollectionFullMainThreadIncrementalMark { int64_t cpp_wall_clock_duration_in_us = -1; }; +struct GarbageCollectionFullMainThreadBatchedIncrementalMark { + std::vector events; +}; + struct GarbageCollectionFullMainThreadIncrementalSweep { int64_t wall_clock_duration_in_us = -1; int64_t cpp_wall_clock_duration_in_us = -1; }; +struct GarbageCollectionFullMainThreadBatchedIncrementalSweep { + std::vector events; +}; + struct GarbageCollectionYoungCycle { int64_t total_wall_clock_duration_in_us = -1; int64_t main_thread_wall_clock_duration_in_us = -1; @@ -69,6 +77,7 @@ struct WasmModuleDecoded { size_t module_size_in_bytes = 0; size_t function_count = 0; int64_t wall_clock_duration_in_us = -1; + int64_t cpu_duration_in_us = -1; }; struct WasmModuleCompiled { @@ -81,6 +90,7 @@ struct WasmModuleCompiled { size_t code_size_in_bytes = 0; size_t liftoff_bailout_count = 0; int64_t wall_clock_duration_in_us = -1; + int64_t cpu_duration_in_us = -1; }; struct WasmModuleInstantiated { @@ -94,20 +104,23 @@ struct WasmModuleTieredUp { bool lazy = false; size_t code_size_in_bytes = 0; int64_t wall_clock_duration_in_us = -1; + int64_t cpu_duration_in_us = -1; }; struct WasmModulesPerIsolate { size_t count = 0; }; -#define V8_MAIN_THREAD_METRICS_EVENTS(V) \ - V(GarbageCollectionFullCycle) \ - V(GarbageCollectionFullMainThreadIncrementalMark) \ - V(GarbageCollectionFullMainThreadIncrementalSweep) \ - V(GarbageCollectionYoungCycle) \ - V(WasmModuleDecoded) \ - V(WasmModuleCompiled) \ - V(WasmModuleInstantiated) \ +#define V8_MAIN_THREAD_METRICS_EVENTS(V) \ + V(GarbageCollectionFullCycle) \ + V(GarbageCollectionFullMainThreadIncrementalMark) \ + V(GarbageCollectionFullMainThreadBatchedIncrementalMark) \ + V(GarbageCollectionFullMainThreadIncrementalSweep) \ + V(GarbageCollectionFullMainThreadBatchedIncrementalSweep) \ + V(GarbageCollectionYoungCycle) \ + V(WasmModuleDecoded) \ + V(WasmModuleCompiled) \ + V(WasmModuleInstantiated) \ V(WasmModuleTieredUp) #define V8_THREAD_SAFE_METRICS_EVENTS(V) V(WasmModulesPerIsolate) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 1cf4d7e28448ce..213d8805b86087 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -9,9 +9,9 @@ // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. #define V8_MAJOR_VERSION 9 -#define V8_MINOR_VERSION 2 -#define V8_BUILD_NUMBER 230 -#define V8_PATCH_LEVEL 21 +#define V8_MINOR_VERSION 3 +#define V8_BUILD_NUMBER 345 +#define V8_PATCH_LEVEL 16 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 101e3c8accfa07..796daba1fb06f5 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -50,6 +50,7 @@ class CFunction; class CallHandlerHelper; class Context; class CppHeap; +class CTypeInfo; class Data; class Date; class EscapableHandleScope; @@ -885,6 +886,8 @@ class TracedReferenceBase { std::memory_order_relaxed); } + V8_EXPORT void CheckValue() const; + // val_ points to a GlobalHandles node. internal::Address* val_ = nullptr; @@ -926,8 +929,18 @@ class BasicTracedReference : public TracedReferenceBase { const_cast&>(*this)); } - T* operator->() const { return reinterpret_cast(val_); } - T* operator*() const { return reinterpret_cast(val_); } + T* operator->() const { +#ifdef V8_ENABLE_CHECKS + CheckValue(); +#endif // V8_ENABLE_CHECKS + return reinterpret_cast(val_); + } + T* operator*() const { +#ifdef V8_ENABLE_CHECKS + CheckValue(); +#endif // V8_ENABLE_CHECKS + return reinterpret_cast(val_); + } private: enum DestructionMode { kWithDestructor, kWithoutDestructor }; @@ -4427,6 +4440,7 @@ class V8_EXPORT Array : public Object { static Local New(Isolate* isolate, Local* elements, size_t length); V8_INLINE static Array* Cast(Value* obj); + private: Array(); static void CheckCast(Value* obj); @@ -4913,6 +4927,12 @@ class V8_EXPORT Promise : public Object { */ void MarkAsHandled(); + /** + * Marks this promise as silent to prevent pausing the debugger when the + * promise is rejected. + */ + void MarkAsSilent(); + V8_INLINE static Promise* Cast(Value* obj); static const int kEmbedderFieldCount = V8_PROMISE_INTERNAL_FIELD_COUNT; @@ -8811,7 +8831,7 @@ class V8_EXPORT Isolate { kDateToLocaleTimeString = 68, kAttemptOverrideReadOnlyOnPrototypeSloppy = 69, kAttemptOverrideReadOnlyOnPrototypeStrict = 70, - kOptimizedFunctionWithOneShotBytecode = 71, + kOptimizedFunctionWithOneShotBytecode = 71, // Unused. kRegExpMatchIsTrueishOnNonJSRegExp = 72, kRegExpMatchIsFalseishOnJSRegExp = 73, kDateGetTimezoneOffset = 74, // Unused. @@ -8913,6 +8933,14 @@ class V8_EXPORT Isolate { */ static Isolate* GetCurrent(); + /** + * Returns the entered isolate for the current thread or NULL in + * case there is no current isolate. + * + * No checks are performed by this method. + */ + static Isolate* TryGetCurrent(); + /** * Clears the set of objects held strongly by the heap. This set of * objects are originally built when a WeakRef is created or @@ -8979,6 +9007,13 @@ class V8_EXPORT Isolate { */ void MemoryPressureNotification(MemoryPressureLevel level); + /** + * Drop non-essential caches. Should only be called from testing code. + * The method can potentially block for a long time and does not necessarily + * trigger GC. + */ + void ClearCachesForTesting(); + /** * Methods below this point require holding a lock (using Locker) in * a multi-threaded environment. diff --git a/deps/v8/infra/mb/mb_config.pyl b/deps/v8/infra/mb/mb_config.pyl index 9c0c933cda7d12..aaeda39f1c73b5 100644 --- a/deps/v8/infra/mb/mb_config.pyl +++ b/deps/v8/infra/mb/mb_config.pyl @@ -62,8 +62,10 @@ 'V8 Linux - verify csa': 'release_x86_verify_csa', # Linux64. 'V8 Linux64 - builder': 'release_x64', + 'V8 Linux64 - builder (reclient)': 'release_x64_reclient', 'V8 Linux64 - debug builder': 'debug_x64', 'V8 Linux64 - dict tracking - debug - builder': 'debug_x64_dict_tracking_trybot', + 'V8 Linux64 - external code space - debug - builder': 'debug_x64_external_code_space', 'V8 Linux64 - custom snapshot - debug builder': 'debug_x64_custom', 'V8 Linux64 - heap sandbox - debug - builder': 'debug_x64_heap_sandbox', 'V8 Linux64 - internal snapshot': 'release_x64_internal', @@ -213,6 +215,7 @@ 'release_simulate_arm64_pointer_compression', 'v8_linux64_dbg_ng': 'debug_x64_trybot', 'v8_linux64_dict_tracking_dbg_ng': 'debug_x64_dict_tracking_trybot', + 'v8_linux64_external_code_space_dbg_ng': 'debug_x64_external_code_space', 'v8_linux64_gc_stress_custom_snapshot_dbg_ng': 'debug_x64_trybot_custom', 'v8_linux64_gcc_compile_dbg': 'debug_x64_gcc', 'v8_linux64_gcov_coverage': 'release_x64_gcc_coverage', @@ -475,8 +478,7 @@ 'release_bot', 'x64', 'cfi_clusterfuzz'], 'release_x64_fuzzilli': [ 'release_bot', 'x64', 'dcheck_always_on', 'v8_enable_slow_dchecks', - 'v8_verify_heap', 'v8_verify_csa', 'v8_enable_verify_predictable', - 'fuzzilli'], + 'v8_verify_heap', 'v8_verify_csa', 'fuzzilli'], 'release_x64_msvc': [ 'release_bot_no_goma', 'x64', 'minimal_symbols', 'msvc'], 'release_x64_correctness_fuzzer' : [ @@ -499,6 +501,8 @@ 'v8_disable_pointer_compression'], 'release_x64_pointer_compression_without_dchecks': [ 'release_bot', 'x64', 'v8_disable_pointer_compression'], + 'release_x64_reclient': [ + 'release_bot_reclient', 'x64'], 'release_x64_trybot': [ 'release_trybot', 'x64'], 'release_x64_test_features_trybot': [ @@ -537,6 +541,8 @@ 'x64', 'asan'], 'debug_x64_custom': [ 'debug_bot', 'x64', 'v8_snapshot_custom'], + 'debug_x64_external_code_space': [ + 'debug_bot', 'x64', 'external_code_space'], 'debug_x64_fuchsia': [ 'debug_bot', 'x64', 'fuchsia'], 'debug_x64_gcc': [ @@ -692,6 +698,10 @@ 'gn_args': 'chrome_pgo_phase=0', }, + 'external_code_space': { + 'gn_args': 'v8_enable_external_code_space=true', + }, + 'fuchsia': { 'gn_args': 'target_os="fuchsia"', }, @@ -764,6 +774,10 @@ 'gn_args': 'v8_use_perfetto=true', }, + 'reclient': { + 'gn_args': 'use_rbe=true', + }, + 'release': { 'gn_args': 'is_debug=false', }, @@ -776,6 +790,10 @@ 'mixins': ['release', 'static', 'no_goma'], }, + 'release_bot_reclient': { + 'mixins': ['release', 'static', 'no_goma', 'reclient'], + }, + 'release_trybot': { 'mixins': ['release_bot', 'minimal_symbols', 'dcheck_always_on'], }, diff --git a/deps/v8/infra/testing/builders.pyl b/deps/v8/infra/testing/builders.pyl index 8fe8872ed9b0fa..d40e4ed9e7a167 100644 --- a/deps/v8/infra/testing/builders.pyl +++ b/deps/v8/infra/testing/builders.pyl @@ -77,7 +77,7 @@ {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, {'name': 'test262', 'variant': 'default', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, # Noavx. @@ -347,7 +347,7 @@ {'name': 'mozilla'}, {'name': 'mozilla', 'variant': 'extra'}, {'name': 'test262', 'variant': 'default'}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 3}, {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, {'name': 'v8testing', 'variant': 'minor_mc'}, @@ -366,6 +366,15 @@ {'name': 'v8testing', 'shards': 3}, ], }, + 'v8_linux64_external_code_space_dbg_ng_triggered': { + 'swarming_dimensions' : { + 'cpu': 'x86-64-avx2', + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 3}, + ], + }, 'v8_linux64_fuzzilli_ng_triggered': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -504,13 +513,13 @@ 'os': 'Ubuntu-18.04', }, 'tests': [ - {'name': 'benchmarks'}, - {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 3}, - {'name': 'v8testing', 'shards': 5}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'slow_path'}, - {'name': 'v8testing', 'variant': 'stress_concurrent_allocation'}, + {'name': 'benchmarks', 'shards': 2}, + {'name': 'mozilla', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 5}, + {'name': 'v8testing', 'shards': 6}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 5}, + {'name': 'v8testing', 'variant': 'slow_path', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, ], }, 'v8_linux64_tsan_no_cm_rel_ng_triggered': { @@ -528,7 +537,7 @@ 'test_args': ['--extra-flags=--future'], 'shards': 6, }, - {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining', 'shards': 2}, ], }, 'v8_linux64_tsan_isolates_rel_ng_triggered': { @@ -752,7 +761,7 @@ 'swarming_dimensions' : { 'cpu': 'arm64', 'os': 'Mac-11', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'tests': [ {'name': 'v8testing'}, @@ -762,7 +771,7 @@ 'swarming_dimensions' : { 'cpu': 'arm64', 'os': 'Mac-11', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'tests': [ {'name': 'v8testing'}, @@ -772,7 +781,7 @@ 'swarming_dimensions' : { 'cpu': 'arm64', 'os': 'Mac-11', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'tests': [ {'name': 'v8testing'}, @@ -935,7 +944,7 @@ {'name': 'optimize_for_size'}, {'name': 'test262', 'shards': 6}, {'name': 'test262', 'variant': 'code_serializer', 'shards': 2}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 3}, { 'name': 'v8testing', @@ -1023,7 +1032,7 @@ 'os': 'Ubuntu-18.04', }, 'tests': [ - {'name': 'v8testing', 'variant': 'default', 'shards': 4}, + {'name': 'v8testing', 'variant': 'default', 'shards': 6}, ], }, 'V8 Linux - gc stress': { @@ -1168,7 +1177,7 @@ {'name': 'mozilla', 'variant': 'extra'}, {'name': 'optimize_for_size'}, {'name': 'test262', 'shards': 5}, - {'name': 'test262', 'variant': 'extra', 'shards': 3}, + {'name': 'test262', 'variant': 'extra', 'shards': 5}, {'name': 'v8testing', 'shards': 2}, {'name': 'v8testing', 'variant': 'extra', 'shards': 2}, {'name': 'v8testing', 'variant': 'minor_mc'}, @@ -1252,6 +1261,15 @@ {'name': 'v8testing', 'shards': 3}, ], }, + 'V8 Linux64 - external code space - debug': { + 'swarming_dimensions' : { + 'cpu': 'x86-64-avx2', + 'os': 'Ubuntu-18.04', + }, + 'tests': [ + {'name': 'v8testing', 'shards': 3}, + ], + }, 'V8 Linux64 - fyi': { 'swarming_dimensions' : { 'os': 'Ubuntu-18.04', @@ -1350,13 +1368,13 @@ 'os': 'Ubuntu-18.04', }, 'tests': [ - {'name': 'benchmarks'}, - {'name': 'mozilla'}, - {'name': 'test262', 'variant': 'default', 'shards': 3}, - {'name': 'v8testing', 'shards': 5}, - {'name': 'v8testing', 'variant': 'extra', 'shards': 3}, - {'name': 'v8testing', 'variant': 'slow_path', 'shards': 1}, - {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 1}, + {'name': 'benchmarks', 'shards': 2}, + {'name': 'mozilla', 'shards': 2}, + {'name': 'test262', 'variant': 'default', 'shards': 5}, + {'name': 'v8testing', 'shards': 6}, + {'name': 'v8testing', 'variant': 'extra', 'shards': 5}, + {'name': 'v8testing', 'variant': 'slow_path', 'shards': 2}, + {'name': 'v8testing', 'variant': 'stress_concurrent_allocation', 'shards': 2}, ], }, 'V8 Linux64 TSAN - stress-incremental-marking': { @@ -1372,16 +1390,18 @@ { 'name': 'benchmarks', 'test_args': ['--extra-flags=--stress-incremental-marking'], + 'shards': 2, }, { 'name': 'mozilla', 'test_args': ['--extra-flags=--stress-incremental-marking'], + 'shards': 2, }, { 'name': 'test262', 'variant': 'default', 'test_args': ['--extra-flags=--stress-incremental-marking'], - 'shards': 4, + 'shards': 5, }, { 'name': 'v8testing', @@ -1413,7 +1433,7 @@ 'test_args': ['--extra-flags=--future'], 'shards': 6, }, - {'name': 'v8testing', 'variant': 'stress_concurrent_inlining'}, + {'name': 'v8testing', 'variant': 'stress_concurrent_inlining', 'shards': 2}, ], }, 'V8 Linux64 UBSan': { @@ -1473,7 +1493,7 @@ 'swarming_dimensions' : { 'os': 'Mac-11', 'cpu': 'arm64', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'swarming_task_attrs': { 'expiration': 14400, @@ -1489,7 +1509,7 @@ 'swarming_dimensions' : { 'os': 'Mac-11', 'cpu': 'arm64', - 'pool': 'chromium.tests.mac-arm64', + 'pool': 'chromium.tests', }, 'swarming_task_attrs': { 'expiration': 14400, diff --git a/deps/v8/src/DEPS b/deps/v8/src/DEPS index 3c5dca663f61e2..0a5e3b8480b84c 100644 --- a/deps/v8/src/DEPS +++ b/deps/v8/src/DEPS @@ -5,7 +5,7 @@ include_rules = [ "+src/asmjs/asm-js.h", "-src/baseline", "+src/baseline/baseline.h", - "+src/baseline/baseline-osr-inl.h", + "+src/baseline/baseline-batch-compiler.h", "+src/baseline/bytecode-offset-iterator.h", "-src/bigint", "+src/bigint/bigint.h", @@ -72,6 +72,9 @@ specific_include_rules = { "+include/libplatform/v8-tracing.h", "+perfetto/tracing.h" ], + "d8-platforms\.cc": [ + "+include/libplatform/libplatform.h", + ], "builtins-trace\.cc": [ "+protos/perfetto", ], diff --git a/deps/v8/src/api/api-arguments-inl.h b/deps/v8/src/api/api-arguments-inl.h index 4edd0dad29d9da..f6825e592225ec 100644 --- a/deps/v8/src/api/api-arguments-inl.h +++ b/deps/v8/src/api/api-arguments-inl.h @@ -6,11 +6,10 @@ #define V8_API_API_ARGUMENTS_INL_H_ #include "src/api/api-arguments.h" - #include "src/api/api-inl.h" #include "src/debug/debug.h" #include "src/execution/vm-state-inl.h" -#include "src/logging/counters.h" +#include "src/logging/runtime-call-stats-scope.h" #include "src/objects/api-callbacks.h" #include "src/objects/slots-inl.h" #include "src/tracing/trace-event.h" diff --git a/deps/v8/src/api/api-inl.h b/deps/v8/src/api/api-inl.h index 84b9b288bb09e3..9bd266395e18f6 100644 --- a/deps/v8/src/api/api-inl.h +++ b/deps/v8/src/api/api-inl.h @@ -5,10 +5,12 @@ #ifndef V8_API_API_INL_H_ #define V8_API_API_INL_H_ +#include "include/v8-fast-api-calls.h" #include "src/api/api.h" #include "src/execution/interrupts-scope.h" #include "src/execution/microtask-queue.h" #include "src/handles/handles-inl.h" +#include "src/heap/heap-inl.h" #include "src/objects/foreign-inl.h" #include "src/objects/js-weak-refs.h" #include "src/objects/objects-inl.h" @@ -239,6 +241,58 @@ inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) { return false; } +template +void CopySmiElementsToTypedBuffer(T* dst, uint32_t length, + i::FixedArray elements) { + for (uint32_t i = 0; i < length; ++i) { + double value = elements.get(static_cast(i)).Number(); + // TODO(mslekova): Avoid converting back-and-forth when possible, e.g + // avoid int->double->int conversions to boost performance. + dst[i] = i::ConvertDouble(value); + } +} + +template +void CopyDoubleElementsToTypedBuffer(T* dst, uint32_t length, + i::FixedDoubleArray elements) { + for (uint32_t i = 0; i < length; ++i) { + double value = elements.get_scalar(static_cast(i)); + // TODO(mslekova): There are certain cases, e.g. double->double, in which + // we could do a memcpy directly. + dst[i] = i::ConvertDouble(value); + } +} + +template +bool CopyAndConvertArrayToCppBuffer(Local src, T* dst, + uint32_t max_length) { + static_assert( + std::is_same< + T, typename i::CTypeInfoTraitsGetType()>::ctype>::value, + "Type mismatch between the expected CTypeInfo::Type and the destination " + "array"); + + uint32_t length = src->Length(); + if (length > max_length) { + return false; + } + + i::DisallowGarbageCollection no_gc; + i::JSArray obj = *reinterpret_cast(*src); + + i::FixedArrayBase elements = obj.elements(); + if (obj.HasSmiElements()) { + CopySmiElementsToTypedBuffer(dst, length, i::FixedArray::cast(elements)); + return true; + } else if (obj.HasDoubleElements()) { + CopyDoubleElementsToTypedBuffer(dst, length, + i::FixedDoubleArray::cast(elements)); + return true; + } else { + return false; + } +} + namespace internal { Handle HandleScopeImplementer::LastEnteredContext() { diff --git a/deps/v8/src/api/api-natives.cc b/deps/v8/src/api/api-natives.cc index 46d54f6f5872ae..985f5956a82e6b 100644 --- a/deps/v8/src/api/api-natives.cc +++ b/deps/v8/src/api/api-natives.cc @@ -7,6 +7,8 @@ #include "src/api/api-inl.h" #include "src/common/message-template.h" #include "src/execution/isolate-inl.h" +#include "src/heap/heap-inl.h" +#include "src/logging/runtime-call-stats-scope.h" #include "src/objects/api-callbacks.h" #include "src/objects/hash-table-inl.h" #include "src/objects/lookup.h" @@ -109,7 +111,7 @@ MaybeHandle DefineDataProperty(Isolate* isolate, ASSIGN_RETURN_ON_EXCEPTION(isolate, value, Instantiate(isolate, prop_data, name), Object); - LookupIterator::Key key(isolate, name); + PropertyKey key(isolate, name); LookupIterator it(isolate, object, key, LookupIterator::OWN_SKIP_INTERCEPTOR); #ifdef DEBUG diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 031d4244f7f80b..e49ede0d7cf400 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -25,6 +25,7 @@ #include "src/base/platform/time.h" #include "src/base/safe_conversions.h" #include "src/base/utils/random-number-generator.h" +#include "src/baseline/baseline-batch-compiler.h" #include "src/builtins/accessors.h" #include "src/builtins/builtins-utils.h" #include "src/codegen/compiler.h" @@ -58,6 +59,7 @@ #include "src/json/json-stringifier.h" #include "src/logging/counters.h" #include "src/logging/metrics.h" +#include "src/logging/runtime-call-stats-scope.h" #include "src/logging/tracing-flags.h" #include "src/numbers/conversions-inl.h" #include "src/objects/api-callbacks.h" @@ -107,11 +109,11 @@ #include "src/strings/string-hasher.h" #include "src/strings/unicode-inl.h" #include "src/tracing/trace-event.h" -#include "src/trap-handler/trap-handler.h" #include "src/utils/detachable-vector.h" #include "src/utils/version.h" #if V8_ENABLE_WEBASSEMBLY +#include "src/trap-handler/trap-handler.h" #include "src/wasm/streaming-decoder.h" #include "src/wasm/value-type.h" #include "src/wasm/wasm-engine.h" @@ -409,6 +411,8 @@ SnapshotCreator::SnapshotCreator(Isolate* isolate, internal_isolate->InitWithoutSnapshot(); } data_ = data; + // Disable batch compilation during snapshot creation. + internal_isolate->baseline_batch_compiler()->set_enabled(false); } SnapshotCreator::SnapshotCreator(const intptr_t* external_references, @@ -1220,7 +1224,9 @@ static Local FunctionTemplateNew( bool do_not_cache, v8::Local cached_property_name = v8::Local(), SideEffectType side_effect_type = SideEffectType::kHasSideEffect, - const MemorySpan& c_function_overloads = {}) { + const MemorySpan& c_function_overloads = {}, + uint8_t instance_type = 0, uint8_t allowed_receiver_range_start = 0, + uint8_t allowed_receiver_range_end = 0) { i::Handle struct_obj = isolate->factory()->NewStruct( i::FUNCTION_TEMPLATE_INFO_TYPE, i::AllocationType::kOld); i::Handle obj = @@ -1242,6 +1248,9 @@ static Local FunctionTemplateNew( ? i::ReadOnlyRoots(isolate).the_hole_value() : *Utils::OpenHandle(*cached_property_name)); if (behavior == ConstructorBehavior::kThrow) raw.set_remove_prototype(true); + raw.SetInstanceType(instance_type); + raw.set_allowed_receiver_range_start(allowed_receiver_range_start); + raw.set_allowed_receiver_range_end(allowed_receiver_range_end); } if (callback != nullptr) { Utils::ToLocal(obj)->SetCallHandlerV8_92(callback, data, side_effect_type, @@ -1263,7 +1272,8 @@ Local FunctionTemplate::New( i_isolate, callback, data, signature, length, behavior, false, Local(), side_effect_type, c_function ? MemorySpan{c_function, 1} - : MemorySpan{}); + : MemorySpan{}, + 0, 0, 0); } Local FunctionTemplate::NewWithCFunctionOverloads( @@ -1271,6 +1281,15 @@ Local FunctionTemplate::NewWithCFunctionOverloads( v8::Local signature, int length, ConstructorBehavior behavior, SideEffectType side_effect_type, const MemorySpan& c_function_overloads) { + // TODO(mslekova): Once runtime overload resolution between sequences is + // supported, check that if (c_function_overloads.size() == 2), then + // c_function_overloads.data()[0]. + // CanResolveOverload(c_function_overloads.data()[1]). We won't support + // the case where the size is greater than 2 for runtime resolution, until + // we've added support for ArrayBuffers and ArrayBufferViews. OTOH the + // overloads list might contain more than 2 functions with different arity, + // the resolution between which is available at compile time. + i::Isolate* i_isolate = reinterpret_cast(isolate); LOG_API(i_isolate, FunctionTemplate, New); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); @@ -3253,7 +3272,8 @@ ValueDeserializer::Delegate::GetSharedArrayBufferFromId(Isolate* v8_isolate, } struct ValueDeserializer::PrivateData { - PrivateData(i::Isolate* i, i::Vector data, Delegate* delegate) + PrivateData(i::Isolate* i, base::Vector data, + Delegate* delegate) : isolate(i), deserializer(i, data, delegate) {} i::Isolate* isolate; i::ValueDeserializer deserializer; @@ -3270,10 +3290,11 @@ ValueDeserializer::ValueDeserializer(Isolate* isolate, const uint8_t* data, if (base::IsValueInRangeForNumericType(size)) { private_ = new PrivateData( reinterpret_cast(isolate), - i::Vector(data, static_cast(size)), delegate); + base::Vector(data, static_cast(size)), delegate); } else { - private_ = new PrivateData(reinterpret_cast(isolate), - i::Vector(nullptr, 0), nullptr); + private_ = + new PrivateData(reinterpret_cast(isolate), + base::Vector(nullptr, 0), nullptr); private_->has_aborted = true; } } @@ -4118,7 +4139,7 @@ Maybe v8::Object::CreateDataProperty(v8::Local context, i::Handle key_obj = Utils::OpenHandle(*key); i::Handle value_obj = Utils::OpenHandle(*value); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, i::LookupIterator::OWN); if (self->IsJSProxy()) { ENTER_V8(isolate, context, Object, CreateDataProperty, Nothing(), @@ -4794,7 +4815,7 @@ MaybeLocal v8::Object::GetRealNamedPropertyInPrototypeChain( if (iter.IsAtEnd()) return MaybeLocal(); i::Handle proto = i::PrototypeIterator::GetCurrent(iter); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, proto, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); Local result; @@ -4818,7 +4839,7 @@ v8::Object::GetRealNamedPropertyAttributesInPrototypeChain( if (iter.IsAtEnd()) return Nothing(); i::Handle proto = i::PrototypeIterator::GetCurrent(iter); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, proto, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); Maybe result = @@ -4835,7 +4856,7 @@ MaybeLocal v8::Object::GetRealNamedProperty(Local context, PREPARE_FOR_EXECUTION(context, Object, GetRealNamedProperty, Value); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, self, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); Local result; @@ -4852,7 +4873,7 @@ Maybe v8::Object::GetRealNamedPropertyAttributes( Nothing(), i::HandleScope); i::Handle self = Utils::OpenHandle(this); i::Handle key_obj = Utils::OpenHandle(*key); - i::LookupIterator::Key lookup_key(isolate, key_obj); + i::PropertyKey lookup_key(isolate, key_obj); i::LookupIterator it(isolate, self, lookup_key, self, i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); auto result = i::JSReceiver::GetPropertyAttributes(&it); @@ -5117,7 +5138,8 @@ Local Function::GetDisplayName() const { } auto func = i::Handle::cast(self); i::Handle property_name = - isolate->factory()->InternalizeString(i::StaticCharVector("displayName")); + isolate->factory()->InternalizeString( + base::StaticCharVector("displayName")); i::Handle value = i::JSReceiver::GetDataProperty(func, property_name); if (value->IsString()) { @@ -5374,7 +5396,7 @@ namespace { // units until the buffer capacity is reached, would be exceeded by the next // unit, or all code units have been written out. template -static int WriteUtf8Impl(i::Vector string, char* write_start, +static int WriteUtf8Impl(base::Vector string, char* write_start, int write_capacity, int options, int* utf16_chars_read_out) { bool write_null = !(options & v8::String::NO_NULL_TERMINATION); @@ -5406,7 +5428,7 @@ static int WriteUtf8Impl(i::Vector string, char* write_start, for (int i = read_index; i < up_to; i++) char_mask |= read_start[i]; if ((char_mask & 0x80) == 0) { int copy_length = up_to - read_index; - base::Memcpy(current_write, read_start + read_index, copy_length); + memcpy(current_write, read_start + read_index, copy_length); current_write += copy_length; read_index = up_to; } else { @@ -5885,8 +5907,9 @@ bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info, // code rather than the wasm code, so the trap handler cannot find the landing // pad and lets the process crash. Therefore, only enable trap handlers if // the host and target arch are the same. -#if (V8_TARGET_ARCH_X64 && !V8_OS_ANDROID) || \ - (V8_HOST_ARCH_ARM64 && V8_TARGET_ARCH_ARM64 && V8_OS_MACOSX) +#if V8_ENABLE_WEBASSEMBLY && \ + ((V8_TARGET_ARCH_X64 && !V8_OS_ANDROID) || \ + (V8_HOST_ARCH_ARM64 && V8_TARGET_ARCH_ARM64 && V8_OS_MACOSX)) return i::trap_handler::TryHandleSignal(sig_code, info, context); #else return false; @@ -5901,15 +5924,20 @@ bool V8::TryHandleSignal(int signum, void* info, void* context) { #if V8_OS_WIN bool TryHandleWebAssemblyTrapWindows(EXCEPTION_POINTERS* exception) { -#if V8_TARGET_ARCH_X64 +#if V8_ENABLE_WEBASSEMBLY && V8_TARGET_ARCH_X64 return i::trap_handler::TryHandleWasmTrap(exception); -#endif +#else return false; +#endif } #endif bool V8::EnableWebAssemblyTrapHandler(bool use_v8_signal_handler) { +#if V8_ENABLE_WEBASSEMBLY return v8::internal::trap_handler::EnableTrapHandler(use_v8_signal_handler); +#else + return false; +#endif } #if defined(V8_OS_WIN) @@ -6148,7 +6176,7 @@ Local NewContext( // TODO(jkummerow): This is for crbug.com/713699. Remove it if it doesn't // fail. // Sanity-check that the isolate is initialized and usable. - CHECK(isolate->builtins()->builtin(i::Builtins::kIllegal).IsCode()); + CHECK(isolate->builtins()->code(i::Builtin::kIllegal).IsCode()); TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.NewContext"); LOG_API(isolate, Context, New); @@ -6254,7 +6282,7 @@ v8::Local Context::Global() { i::Handle context = Utils::OpenHandle(this); i::Isolate* isolate = context->GetIsolate(); i::Handle global(context->global_proxy(), isolate); - // TODO(dcarney): This should always return the global proxy + // TODO(chromium:324812): This should always return the global proxy // but can't presently as calls to GetProtoype will return the wrong result. if (i::Handle::cast(global)->IsDetachedFrom( context->global_object())) { @@ -6545,7 +6573,7 @@ inline int StringLength(const uint16_t* string) { V8_WARN_UNUSED_RESULT inline i::MaybeHandle NewString(i::Factory* factory, NewStringType type, - i::Vector string) { + base::Vector string) { if (type == NewStringType::kInternalized) { return factory->InternalizeUtf8String(string); } @@ -6555,7 +6583,7 @@ inline i::MaybeHandle NewString(i::Factory* factory, V8_WARN_UNUSED_RESULT inline i::MaybeHandle NewString(i::Factory* factory, NewStringType type, - i::Vector string) { + base::Vector string) { if (type == NewStringType::kInternalized) { return factory->InternalizeString(string); } @@ -6563,9 +6591,9 @@ inline i::MaybeHandle NewString(i::Factory* factory, } V8_WARN_UNUSED_RESULT -inline i::MaybeHandle NewString(i::Factory* factory, - NewStringType type, - i::Vector string) { +inline i::MaybeHandle NewString( + i::Factory* factory, NewStringType type, + base::Vector string) { if (type == NewStringType::kInternalized) { return factory->InternalizeString(string); } @@ -6591,7 +6619,7 @@ STATIC_ASSERT(v8::String::kMaxLength == i::String::kMaxLength); if (length < 0) length = StringLength(data); \ i::Handle handle_result = \ NewString(i_isolate->factory(), type, \ - i::Vector(data, length)) \ + base::Vector(data, length)) \ .ToHandleChecked(); \ result = Utils::ToLocal(handle_result); \ } @@ -6604,7 +6632,7 @@ Local String::NewFromUtf8Literal(Isolate* isolate, const char* literal, LOG_API(i_isolate, String, NewFromUtf8Literal); i::Handle handle_result = NewString(i_isolate->factory(), type, - i::Vector(literal, length)) + base::Vector(literal, length)) .ToHandleChecked(); return Utils::ToLocal(handle_result); } @@ -7044,7 +7072,7 @@ MaybeLocal v8::RegExp::NewWithBacktrackLimit( Local v8::RegExp::GetSource() const { i::Handle obj = Utils::OpenHandle(this); return Utils::ToLocal( - i::Handle(obj->Pattern(), obj->GetIsolate())); + i::Handle(obj->EscapedPattern(), obj->GetIsolate())); } // Assert that the static flags cast in GetFlags is valid. @@ -7497,6 +7525,11 @@ void Promise::MarkAsHandled() { js_promise->set_has_handler(true); } +void Promise::MarkAsSilent() { + i::Handle js_promise = Utils::OpenHandle(this); + js_promise->set_is_silent(true); +} + Local Proxy::GetTarget() { i::Handle self = Utils::OpenHandle(this); i::Handle target(self->target(), self->GetIsolate()); @@ -7555,7 +7588,7 @@ OwnedBuffer CompiledWasmModule::Serialize() { MemorySpan CompiledWasmModule::GetWireBytesRef() { #if V8_ENABLE_WEBASSEMBLY - i::Vector bytes_vec = native_module_->wire_bytes(); + base::Vector bytes_vec = native_module_->wire_bytes(); return {bytes_vec.begin(), bytes_vec.size()}; #else UNREACHABLE(); @@ -7592,9 +7625,9 @@ MaybeLocal WasmModuleObject::FromCompiledModule( #if V8_ENABLE_WEBASSEMBLY i::Isolate* i_isolate = reinterpret_cast(isolate); i::Handle module_object = - i_isolate->wasm_engine()->ImportNativeModule( + i::wasm::GetWasmEngine()->ImportNativeModule( i_isolate, compiled_module.native_module_, - i::VectorOf(compiled_module.source_url())); + base::VectorOf(compiled_module.source_url())); return Local::Cast( Utils::ToLocal(i::Handle::cast(module_object))); #else @@ -7623,7 +7656,7 @@ void* v8::ArrayBuffer::Allocator::Reallocate(void* data, size_t old_length, reinterpret_cast(AllocateUninitialized(new_length)); if (new_data == nullptr) return nullptr; size_t bytes_to_copy = std::min(old_length, new_length); - base::Memcpy(new_data, data, bytes_to_copy); + memcpy(new_data, data, bytes_to_copy); if (new_length > bytes_to_copy) { memset(new_data + bytes_to_copy, 0, new_length - bytes_to_copy); } @@ -7930,7 +7963,7 @@ size_t v8::ArrayBufferView::CopyContents(void* dest, size_t byte_length) { isolate); source = reinterpret_cast(typed_array->DataPtr()); } - base::Memcpy(dest, source + byte_offset, bytes_to_copy); + memcpy(dest, source + byte_offset, bytes_to_copy); } return bytes_to_copy; } @@ -8555,7 +8588,7 @@ void Isolate::RequestInterrupt(InterruptCallback callback, void* data) { bool Isolate::HasPendingBackgroundTasks() { #if V8_ENABLE_WEBASSEMBLY i::Isolate* isolate = reinterpret_cast(this); - return isolate->wasm_engine()->HasRunningCompileJob(isolate); + return i::wasm::GetWasmEngine()->HasRunningCompileJob(isolate); #else return false; #endif // V8_ENABLE_WEBASSEMBLY @@ -8582,6 +8615,11 @@ Isolate* Isolate::GetCurrent() { return reinterpret_cast(isolate); } +Isolate* Isolate::TryGetCurrent() { + i::Isolate* isolate = i::Isolate::TryGetCurrent(); + return reinterpret_cast(isolate); +} + // static Isolate* Isolate::Allocate() { return reinterpret_cast(i::Isolate::New()); @@ -8610,23 +8648,6 @@ void Isolate::Initialize(Isolate* isolate, } else { i_isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob()); } - auto code_event_handler = params.code_event_handler; -#ifdef ENABLE_GDB_JIT_INTERFACE - if (code_event_handler == nullptr && i::FLAG_gdbjit) { - code_event_handler = i::GDBJITInterface::EventHandler; - } -#endif // ENABLE_GDB_JIT_INTERFACE -#if defined(V8_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION) - if (code_event_handler == nullptr && i::FLAG_enable_system_instrumentation) { - code_event_handler = i::ETWJITInterface::EventHandler; - } -#endif // defined(V8_OS_WIN) - - if (code_event_handler) { - i_isolate->InitializeLoggingAndCounters(); - i_isolate->logger()->SetCodeEventHandler(kJitCodeEventDefault, - code_event_handler); - } if (params.counter_lookup_callback) { isolate->SetCounterFunction(params.counter_lookup_callback); } @@ -8651,22 +8672,40 @@ void Isolate::Initialize(Isolate* isolate, } // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this. Isolate::Scope isolate_scope(isolate); + if (i_isolate->snapshot_blob() == nullptr) { + FATAL( + "V8 snapshot blob was not set during initialization. This can mean " + "that the snapshot blob file is corrupted or missing."); + } if (!i::Snapshot::Initialize(i_isolate)) { // If snapshot data was provided and we failed to deserialize it must // have been corrupted. - if (i_isolate->snapshot_blob() != nullptr) { - FATAL( - "Failed to deserialize the V8 snapshot blob. This can mean that the " - "snapshot blob file is corrupted or missing."); + FATAL( + "Failed to deserialize the V8 snapshot blob. This can mean that the " + "snapshot blob file is corrupted or missing."); + } + + { + // Set up code event handlers. Needs to be after i::Snapshot::Initialize + // because that is where we add the isolate to WasmEngine. + auto code_event_handler = params.code_event_handler; +#ifdef ENABLE_GDB_JIT_INTERFACE + if (code_event_handler == nullptr && i::FLAG_gdbjit) { + code_event_handler = i::GDBJITInterface::EventHandler; } - base::ElapsedTimer timer; - if (i::FLAG_profile_deserialization) timer.Start(); - i_isolate->InitWithoutSnapshot(); - if (i::FLAG_profile_deserialization) { - double ms = timer.Elapsed().InMillisecondsF(); - i::PrintF("[Initializing isolate from scratch took %0.3f ms]\n", ms); +#endif // ENABLE_GDB_JIT_INTERFACE +#if defined(V8_OS_WIN) && defined(V8_ENABLE_SYSTEM_INSTRUMENTATION) + if (code_event_handler == nullptr && + i::FLAG_enable_system_instrumentation) { + code_event_handler = i::ETWJITInterface::EventHandler; + } +#endif // defined(V8_OS_WIN) + + if (code_event_handler) { + isolate->SetJitCodeEventHandler(kJitCodeEventDefault, code_event_handler); } } + i_isolate->set_only_terminate_in_safe_scope( params.only_terminate_in_safe_scope); i_isolate->set_embedder_wrapper_type_index( @@ -8880,7 +8919,12 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { heap_statistics->malloced_memory_ = isolate->allocator()->GetCurrentMemoryUsage() + isolate->string_table()->GetCurrentMemoryUsage(); - heap_statistics->external_memory_ = isolate->heap()->backing_store_bytes(); + // On 32-bit systems backing_store_bytes() might overflow size_t temporarily + // due to concurrent array buffer sweeping. + heap_statistics->external_memory_ = + isolate->heap()->backing_store_bytes() < SIZE_MAX + ? static_cast(isolate->heap()->backing_store_bytes()) + : SIZE_MAX; heap_statistics->peak_malloced_memory_ = isolate->allocator()->GetMaxMemoryUsage(); heap_statistics->number_of_native_contexts_ = heap->NumberOfNativeContexts(); @@ -8890,9 +8934,9 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { #if V8_ENABLE_WEBASSEMBLY heap_statistics->malloced_memory_ += - isolate->wasm_engine()->allocator()->GetCurrentMemoryUsage(); + i::wasm::GetWasmEngine()->allocator()->GetCurrentMemoryUsage(); heap_statistics->peak_malloced_memory_ += - isolate->wasm_engine()->allocator()->GetMaxMemoryUsage(); + i::wasm::GetWasmEngine()->allocator()->GetMaxMemoryUsage(); #endif // V8_ENABLE_WEBASSEMBLY } @@ -9170,7 +9214,7 @@ void Isolate::SetAddHistogramSampleFunction( void Isolate::SetMetricsRecorder( const std::shared_ptr& metrics_recorder) { i::Isolate* isolate = reinterpret_cast(this); - isolate->metrics_recorder()->SetRecorder(isolate, metrics_recorder); + isolate->metrics_recorder()->SetEmbedderRecorder(isolate, metrics_recorder); } void Isolate::SetAddCrashKeyCallback(AddCrashKeyCallback callback) { @@ -9206,7 +9250,7 @@ int Isolate::ContextDisposedNotification(bool dependant_context) { // of that context. // A handle scope for the native context. i::HandleScope handle_scope(isolate); - isolate->wasm_engine()->DeleteCompileJobsOnContext( + i::wasm::GetWasmEngine()->DeleteCompileJobsOnContext( isolate->native_context()); } } @@ -9234,6 +9278,12 @@ void Isolate::MemoryPressureNotification(MemoryPressureLevel level) { isolate->heap()->MemoryPressureNotification(level, on_isolate_thread); } +void Isolate::ClearCachesForTesting() { + i::Isolate* isolate = reinterpret_cast(this); + isolate->AbortConcurrentOptimization(i::BlockingBehavior::kBlock); + isolate->ClearSerializerData(); +} + void Isolate::EnableMemorySavingsMode() { i::Isolate* isolate = reinterpret_cast(this); isolate->EnableMemorySavingsMode(); @@ -9297,10 +9347,10 @@ JSEntryStubs Isolate::GetJSEntryStubs() { JSEntryStubs entry_stubs; i::Isolate* isolate = reinterpret_cast(this); - std::array, 3> stubs = { - {{i::Builtins::kJSEntry, &entry_stubs.js_entry_stub}, - {i::Builtins::kJSConstructEntry, &entry_stubs.js_construct_entry_stub}, - {i::Builtins::kJSRunMicrotasksEntry, + std::array, 3> stubs = { + {{i::Builtin::kJSEntry, &entry_stubs.js_entry_stub}, + {i::Builtin::kJSConstructEntry, &entry_stubs.js_construct_entry_stub}, + {i::Builtin::kJSRunMicrotasksEntry, &entry_stubs.js_run_microtasks_entry_stub}}}; for (auto& pair : stubs) { i::Code js_entry = isolate->heap()->builtin(pair.first); @@ -9962,8 +10012,6 @@ const char* CodeEvent::GetCodeEventTypeName(CodeEventType code_event_type) { } // The execution should never pass here UNREACHABLE(); - // NOTE(mmarchini): Workaround to fix a compiler failure on GCC 4.9 - return "Unknown"; } CodeEventHandler::CodeEventHandler(Isolate* isolate) { @@ -10012,7 +10060,6 @@ Local HeapGraphEdge::GetName() const { default: UNREACHABLE(); } - return v8::Undefined(reinterpret_cast(isolate)); } const HeapGraphNode* HeapGraphEdge::GetFromNode() const { @@ -10294,6 +10341,14 @@ void EmbedderHeapTracer::ResetHandleInNonTracingGC( UNREACHABLE(); } +void TracedReferenceBase::CheckValue() const { +#ifdef V8_HOST_ARCH_64_BIT + if (!val_) return; + + CHECK_NE(internal::kGlobalHandleZapValue, *reinterpret_cast(val_)); +#endif // V8_HOST_ARCH_64_BIT +} + CFunction::CFunction(const void* address, const CFunctionInfo* type_info) : address_(address), type_info_(type_info) { CHECK_NOT_NULL(address_); @@ -10554,6 +10609,49 @@ void InvokeFinalizationRegistryCleanupFromTask( } } +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +int32_t ConvertDouble(double d) { + return internal::DoubleToInt32(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +uint32_t ConvertDouble(double d) { + return internal::DoubleToUint32(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +float ConvertDouble(double d) { + return internal::DoubleToFloat32(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +double ConvertDouble(double d) { + return d; +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +int64_t ConvertDouble(double d) { + return internal::DoubleToWebIDLInt64(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +uint64_t ConvertDouble(double d) { + return internal::DoubleToWebIDLUint64(d); +} + +template <> +EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) +bool ConvertDouble(double d) { + // Implements https://tc39.es/ecma262/#sec-toboolean. + return !std::isnan(d) && d != 0; +} + // Undefine macros for jumbo build. #undef SET_FIELD_WRAPPED #undef NEW_STRING diff --git a/deps/v8/src/api/api.h b/deps/v8/src/api/api.h index efb25c0e01b163..7d2a0c3e9cfb95 100644 --- a/deps/v8/src/api/api.h +++ b/deps/v8/src/api/api.h @@ -536,6 +536,10 @@ void InvokeFinalizationRegistryCleanupFromTask( Handle finalization_registry, Handle callback); +template +EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) +T ConvertDouble(double d); + } // namespace internal } // namespace v8 diff --git a/deps/v8/src/asmjs/asm-js.cc b/deps/v8/src/asmjs/asm-js.cc index 2aecd86b692447..28b44bf088b1e7 100644 --- a/deps/v8/src/asmjs/asm-js.cc +++ b/deps/v8/src/asmjs/asm-js.cc @@ -9,6 +9,7 @@ #include "src/ast/ast.h" #include "src/base/optional.h" #include "src/base/platform/elapsed-timer.h" +#include "src/base/vector.h" #include "src/codegen/compiler.h" #include "src/codegen/unoptimized-compilation-info.h" #include "src/common/assert-scope.h" @@ -23,8 +24,6 @@ #include "src/parsing/parse-info.h" #include "src/parsing/scanner-character-streams.h" #include "src/parsing/scanner.h" -#include "src/utils/vector.h" - #include "src/wasm/wasm-engine.h" #include "src/wasm/wasm-js.h" #include "src/wasm/wasm-limits.h" @@ -42,7 +41,7 @@ namespace { Handle StdlibMathMember(Isolate* isolate, Handle stdlib, Handle name) { Handle math_name( - isolate->factory()->InternalizeString(StaticCharVector("Math"))); + isolate->factory()->InternalizeString(base::StaticCharVector("Math"))); Handle math = JSReceiver::GetDataProperty(stdlib, math_name); if (!math->IsJSReceiver()) return isolate->factory()->undefined_value(); Handle math_receiver = Handle::cast(math); @@ -68,40 +67,40 @@ bool AreStdlibMembersValid(Isolate* isolate, Handle stdlib, #define STDLIB_MATH_FUNC(fname, FName, ignore1, ignore2) \ if (members.contains(wasm::AsmJsParser::StandardMember::kMath##FName)) { \ members.Remove(wasm::AsmJsParser::StandardMember::kMath##FName); \ - Handle name( \ - isolate->factory()->InternalizeString(StaticCharVector(#fname))); \ + Handle name(isolate->factory()->InternalizeString( \ + base::StaticCharVector(#fname))); \ Handle value = StdlibMathMember(isolate, stdlib, name); \ if (!value->IsJSFunction()) return false; \ SharedFunctionInfo shared = Handle::cast(value)->shared(); \ if (!shared.HasBuiltinId() || \ - shared.builtin_id() != Builtins::kMath##FName) { \ + shared.builtin_id() != Builtin::kMath##FName) { \ return false; \ } \ DCHECK_EQ(shared.GetCode(), \ - isolate->builtins()->builtin(Builtins::kMath##FName)); \ + isolate->builtins()->code(Builtin::kMath##FName)); \ } STDLIB_MATH_FUNCTION_LIST(STDLIB_MATH_FUNC) #undef STDLIB_MATH_FUNC #define STDLIB_MATH_CONST(cname, const_value) \ if (members.contains(wasm::AsmJsParser::StandardMember::kMath##cname)) { \ members.Remove(wasm::AsmJsParser::StandardMember::kMath##cname); \ - Handle name( \ - isolate->factory()->InternalizeString(StaticCharVector(#cname))); \ + Handle name(isolate->factory()->InternalizeString( \ + base::StaticCharVector(#cname))); \ Handle value = StdlibMathMember(isolate, stdlib, name); \ if (!value->IsNumber() || value->Number() != const_value) return false; \ } STDLIB_MATH_VALUE_LIST(STDLIB_MATH_CONST) #undef STDLIB_MATH_CONST -#define STDLIB_ARRAY_TYPE(fname, FName) \ - if (members.contains(wasm::AsmJsParser::StandardMember::k##FName)) { \ - members.Remove(wasm::AsmJsParser::StandardMember::k##FName); \ - *is_typed_array = true; \ - Handle name( \ - isolate->factory()->InternalizeString(StaticCharVector(#FName))); \ - Handle value = JSReceiver::GetDataProperty(stdlib, name); \ - if (!value->IsJSFunction()) return false; \ - Handle func = Handle::cast(value); \ - if (!func.is_identical_to(isolate->fname())) return false; \ +#define STDLIB_ARRAY_TYPE(fname, FName) \ + if (members.contains(wasm::AsmJsParser::StandardMember::k##FName)) { \ + members.Remove(wasm::AsmJsParser::StandardMember::k##FName); \ + *is_typed_array = true; \ + Handle name(isolate->factory()->InternalizeString( \ + base::StaticCharVector(#FName))); \ + Handle value = JSReceiver::GetDataProperty(stdlib, name); \ + if (!value->IsJSFunction()) return false; \ + Handle func = Handle::cast(value); \ + if (!func.is_identical_to(isolate->fname())) return false; \ } STDLIB_ARRAY_TYPE(int8_array_fun, Int8Array) STDLIB_ARRAY_TYPE(uint8_array_fun, Uint8Array) @@ -117,7 +116,7 @@ bool AreStdlibMembersValid(Isolate* isolate, Handle stdlib, return true; } -void Report(Handle +
    @@ -19,6 +31,8 @@

    Code Panel

    +

    Properties

    +

    Disassembly

    
         

    Source Code

    diff --git a/deps/v8/tools/system-analyzer/view/code-panel.mjs b/deps/v8/tools/system-analyzer/view/code-panel.mjs index 34e4ad300e441e..793b31cde7db15 100644 --- a/deps/v8/tools/system-analyzer/view/code-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/code-panel.mjs @@ -1,11 +1,14 @@ // Copyright 2020 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. -import {IcLogEntry} from '../log/ic.mjs'; -import {MapLogEntry} from '../log/map.mjs'; +import {SelectRelatedEvent} from './events.mjs'; +import {CollapsableElement, DOM, formatBytes, formatMicroSeconds} from './helper.mjs'; -import {FocusEvent, SelectionEvent, ToolTipEvent} from './events.mjs'; -import {CollapsableElement, delay, DOM, formatBytes, formatMicroSeconds} from './helper.mjs'; +const kRegisters = ['rsp', 'rbp', 'rax', 'rbx', 'rcx', 'rdx', 'rsi', 'rdi']; +// Add Interpreter and x64 registers +for (let i = 0; i < 14; i++) { + kRegisters.push(`r${i}`); +} DOM.defineCustomElement('view/code-panel', (templateText) => @@ -16,6 +19,11 @@ DOM.defineCustomElement('view/code-panel', constructor() { super(templateText); + this._codeSelectNode = this.$('#codeSelect'); + this._disassemblyNode = this.$('#disassembly'); + this._sourceNode = this.$('#sourceCode'); + this._registerSelector = new RegisterSelector(this._disassemblyNode); + this._codeSelectNode.onchange = this._handleSelectCode.bind(this); this.$('#selectedRelatedButton').onclick = this._handleSelectRelated.bind(this) @@ -34,27 +42,52 @@ DOM.defineCustomElement('view/code-panel', set entry(entry) { this._entry = entry; + if (entry !== undefined) { + this.$('#properties').propertyDict = { + '__this__': entry, + functionName: entry.functionName, + size: formatBytes(entry.size), + creationTime: formatMicroSeconds(entry.time / 1000), + sourcePosition: entry.sourcePosition, + script: entry.script, + type: entry.type, + kind: entry.kindName, + variants: entry.variants.length > 1 ? entry.variants : undefined, + }; + } else { + this.$('#properties').propertyDict = {}; + } this.requestUpdate(); } - get _disassemblyNode() { - return this.$('#disassembly'); - } - - get _sourceNode() { - return this.$('#sourceCode'); - } - - get _codeSelectNode() { - return this.$('#codeSelect'); - } - _update() { this._updateSelect(); - this._disassemblyNode.innerText = this._entry?.disassemble ?? ''; + this._formatDisassembly(); this._sourceNode.innerText = this._entry?.source ?? ''; } + _formatDisassembly() { + if (!this._entry?.code) { + this._disassemblyNode.innerText = ''; + return; + } + const rawCode = this._entry?.code; + try { + this._disassemblyNode.innerText = rawCode; + let formattedCode = this._disassemblyNode.innerHTML; + for (let register of kRegisters) { + const button = `${register}` + formattedCode = formattedCode.replaceAll(register, button); + } + // Let's replace the base-address since it doesn't add any value. + // TODO + this._disassemblyNode.innerHTML = formattedCode; + } catch (e) { + console.error(e); + this._disassemblyNode.innerText = rawCode; + } + } + _updateSelect() { const select = this._codeSelectNode; if (select.data === this._selectedEntries) return; @@ -64,13 +97,19 @@ DOM.defineCustomElement('view/code-panel', this._selectedEntries.slice().sort((a, b) => a.time - b.time); for (const code of this._selectedEntries) { const option = DOM.element('option'); - option.text = - `${code.name}(...) t=${formatMicroSeconds(code.time)} size=${ - formatBytes(code.size)} script=${code.script?.toString()}`; + option.text = this._entrySummary(code); option.data = code; select.add(option); } } + _entrySummary(code) { + if (code.isBuiltinKind) { + return `${code.functionName}(...) t=${ + formatMicroSeconds(code.time)} size=${formatBytes(code.size)}`; + } + return `${code.functionName}(...) t=${formatMicroSeconds(code.time)} size=${ + formatBytes(code.size)} script=${code.script?.toString()}`; + } _handleSelectCode() { this.entry = this._codeSelectNode.selectedOptions[0].data; @@ -80,4 +119,37 @@ DOM.defineCustomElement('view/code-panel', if (!this._entry) return; this.dispatchEvent(new SelectRelatedEvent(this._entry)); } -}); \ No newline at end of file +}); + +class RegisterSelector { + _currentRegister; + constructor(node) { + this._node = node; + this._node.onmousemove = this._handleDisassemblyMouseMove.bind(this); + } + + _handleDisassemblyMouseMove(event) { + const target = event.target; + if (!target.classList.contains('register')) { + this._clear(); + return; + }; + this._select(target.innerText); + } + + _clear() { + if (this._currentRegister == undefined) return; + for (let node of this._node.querySelectorAll('.register')) { + node.classList.remove('selected'); + } + } + + _select(register) { + if (register == this._currentRegister) return; + this._clear(); + this._currentRegister = register; + for (let node of this._node.querySelectorAll(`.register.${register}`)) { + node.classList.add('selected'); + } + } +} \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/events.mjs b/deps/v8/tools/system-analyzer/view/events.mjs index 4204973f8f2027..f91fd6ffe82e58 100644 --- a/deps/v8/tools/system-analyzer/view/events.mjs +++ b/deps/v8/tools/system-analyzer/view/events.mjs @@ -76,10 +76,10 @@ export class ToolTipEvent extends AppEvent { constructor(content, positionOrTargetNode) { super(ToolTipEvent.name); - this._content = content; - if (!positionOrTargetNode && !node) { + if (!positionOrTargetNode) { throw Error('Either provide a valid position or targetNode'); } + this._content = content; this._positionOrTargetNode = positionOrTargetNode; } diff --git a/deps/v8/tools/system-analyzer/view/helper.mjs b/deps/v8/tools/system-analyzer/view/helper.mjs index 44da06ced4dfdc..a3d250091d7788 100644 --- a/deps/v8/tools/system-analyzer/view/helper.mjs +++ b/deps/v8/tools/system-analyzer/view/helper.mjs @@ -17,6 +17,7 @@ export class CSSColor { this._cache.set(name, color); return color; } + static reset() { this._cache.clear(); } @@ -82,7 +83,7 @@ export class CSSColor { return this.list[index % this.list.length]; } - static darken(hexColorString, amount = -40) { + static darken(hexColorString, amount = -50) { if (hexColorString[0] !== '#') { throw new Error(`Unsupported color: ${hexColorString}`); } @@ -122,13 +123,45 @@ export class CSSColor { } export class DOM { - static element(type, classes) { + static element(type, options) { const node = document.createElement(type); - if (classes === undefined) return node; + if (options !== undefined) { + if (typeof options === 'string') { + // Old behaviour: options = class string + node.className = options; + } else if (Array.isArray(options)) { + // Old behaviour: options = class array + DOM.addClasses(node, options); + } else { + // New behaviour: options = attribute dict + for (const [key, value] of Object.entries(options)) { + if (key == 'className') { + node.className = value; + } else if (key == 'classList') { + node.classList = value; + } else if (key == 'textContent') { + node.textContent = value; + } else if (key == 'children') { + for (const child of value) { + node.appendChild(child); + } + } else { + node.setAttribute(key, value); + } + } + } + } + return node; + } + + static addClasses(node, classes) { + const classList = node.classList; if (typeof classes === 'string') { - node.className = classes; + classList.add(classes); } else { - classes.forEach(cls => node.classList.add(cls)); + for (let i = 0; i < classes.length; i++) { + classList.add(classes[i]); + } } return node; } @@ -137,20 +170,27 @@ export class DOM { return document.createTextNode(string); } - static div(classes) { - return this.element('div', classes); + static button(label, clickHandler) { + const button = DOM.element('button'); + button.innerText = label; + button.onclick = clickHandler; + return button; + } + + static div(options) { + return this.element('div', options); } - static span(classes) { - return this.element('span', classes); + static span(options) { + return this.element('span', options); } - static table(classes) { - return this.element('table', classes); + static table(options) { + return this.element('table', options); } - static tbody(classes) { - return this.element('tbody', classes); + static tbody(options) { + return this.element('tbody', options); } static td(textOrNode, className) { @@ -174,8 +214,17 @@ export class DOM { range.deleteContents(); } - static defineCustomElement(path, generator) { - let name = path.substring(path.lastIndexOf('/') + 1, path.length); + static defineCustomElement( + path, nameOrGenerator, maybeGenerator = undefined) { + let generator = nameOrGenerator; + let name = nameOrGenerator; + if (typeof nameOrGenerator == 'function') { + console.assert(maybeGenerator === undefined); + name = path.substring(path.lastIndexOf('/') + 1, path.length); + } else { + console.assert(typeof nameOrGenerator == 'string'); + generator = maybeGenerator; + } path = path + '-template.html'; fetch(path) .then(stream => stream.text()) @@ -185,6 +234,27 @@ export class DOM { } } +const SVGNamespace = 'http://www.w3.org/2000/svg'; +export class SVG { + static element(type, classes) { + const node = document.createElementNS(SVGNamespace, type); + if (classes !== undefined) DOM.addClasses(node, classes); + return node; + } + + static svg(classes) { + return this.element('svg', classes); + } + + static rect(classes) { + return this.element('rect', classes); + } + + static g(classes) { + return this.element('g', classes); + } +} + export function $(id) { return document.querySelector(id) } @@ -233,31 +303,42 @@ export class CollapsableElement extends V8CustomElement { constructor(templateText) { super(templateText); this._hasPendingUpdate = false; - this._closer.onclick = _ => this.tryUpdateOnVisibilityChange(); + this._closer.onclick = _ => this._requestUpdateIfVisible(); } get _closer() { return this.$('#closer'); } - _contentIsVisible() { + get _contentIsVisible() { return !this._closer.checked; } + hide() { + if (this._contentIsVisible) { + this._closer.checked = true; + this._requestUpdateIfVisible(); + } + this.scrollIntoView(); + } + + show() { + if (!this._contentIsVisible) { + this._closer.checked = false; + this._requestUpdateIfVisible(); + } + this.scrollIntoView(); + } + requestUpdate(useAnimation = false) { // A pending update will be resolved later, no need to try again. if (this._hasPendingUpdate) return; this._hasPendingUpdate = true; - this.requestUpdateIfVisible(useAnimation); - } - - tryUpdateOnVisibilityChange() { - if (!this._hasPendingUpdate) return; - this.requestUpdateIfVisible(true); + this._requestUpdateIfVisible(useAnimation); } - requestUpdateIfVisible(useAnimation) { - if (!this._contentIsVisible()) return; + _requestUpdateIfVisible(useAnimation = true) { + if (!this._contentIsVisible) return; return super.requestUpdate(useAnimation); } @@ -267,6 +348,43 @@ export class CollapsableElement extends V8CustomElement { } } +export class ExpandableText { + constructor(node, string, limit = 200) { + this._node = node; + this._string = string; + this._delta = limit / 2; + this._start = 0; + this._end = string.length; + this._button = this._createExpandButton(); + this.expand(); + } + + _createExpandButton() { + const button = DOM.element('button'); + button.innerText = '...'; + button.onclick = (e) => { + e.stopImmediatePropagation(); + this.expand() + }; + return button; + } + + expand() { + DOM.removeAllChildren(this._node); + this._start = this._start + this._delta; + this._end = this._end - this._delta; + if (this._start >= this._end) { + this._node.innerText = this._string; + this._button.onclick = undefined; + return; + } + this._node.appendChild(DOM.text(this._string.substring(0, this._start))); + this._node.appendChild(this._button); + this._node.appendChild( + DOM.text(this._string.substring(this._end, this._string.length))); + } +} + export class Chunked { constructor(iterable, limit) { this._iterator = iterable[Symbol.iterator](); @@ -340,8 +458,8 @@ export function gradientStopsFromGroups( const stops = []; for (let group of groups) { const color = colorFn(group.key); - increment += group.count; - let height = (increment / totalLength * kMaxHeight) | 0; + increment += group.length; + const height = (increment / totalLength * kMaxHeight) | 0; stops.push(`${color} ${lastHeight}${kUnit} ${height}${kUnit}`) lastHeight = height; } diff --git a/deps/v8/tools/system-analyzer/view/list-panel.mjs b/deps/v8/tools/system-analyzer/view/list-panel.mjs index bc3b2f89d58392..495aaae0591197 100644 --- a/deps/v8/tools/system-analyzer/view/list-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/list-panel.mjs @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {Script, SourcePosition} from '../../profile.mjs'; -import {LogEntry} from '../log/log.mjs'; +import {App} from '../index.mjs' import {FocusEvent, ToolTipEvent} from './events.mjs'; import {groupBy, LazyTable} from './helper.mjs'; @@ -128,8 +127,7 @@ DOM.defineCustomElement('view/list-panel', _logEntryMouseOverHandler(e) { const group = e.currentTarget.group; - this.dispatchEvent( - new ToolTipEvent(group.key.toStringLong(), e.currentTarget)); + this.dispatchEvent(new ToolTipEvent(group.key, e.currentTarget)); } _handleDetailsClick(event) { @@ -178,7 +176,7 @@ DOM.defineCustomElement('view/list-panel', _render(groups, table) { let last; new LazyTable(table, groups, group => { - if (last && last.count < group.count) { + if (last && last.count < group.length) { console.log(last, group); } last = group; @@ -187,9 +185,9 @@ DOM.defineCustomElement('view/list-panel', const details = tr.appendChild(DOM.td('', 'toggle')); details.onclick = this._detailsClickHandler; tr.appendChild(DOM.td(`${group.percent.toFixed(2)}%`, 'percentage')); - tr.appendChild(DOM.td(group.count, 'count')); - const valueTd = tr.appendChild(DOM.td(`${group.key}`, 'key')); - if (this._isClickable(group.key)) { + tr.appendChild(DOM.td(group.length, 'count')); + const valueTd = tr.appendChild(DOM.td(group.key?.toString(), 'key')); + if (App.isClickable(group.key)) { tr.onclick = this._logEntryClickHandler; tr.onmouseover = this._logEntryMouseOverHandler; valueTd.classList.add('clickable'); @@ -197,12 +195,4 @@ DOM.defineCustomElement('view/list-panel', return tr; }, 10); } - - _isClickable(object) { - if (typeof object !== 'object') return false; - if (object instanceof LogEntry) return true; - if (object instanceof SourcePosition) return true; - if (object instanceof Script) return true; - return false; - } }); diff --git a/deps/v8/tools/system-analyzer/view/log-file-reader-template.html b/deps/v8/tools/system-analyzer/view/log-file-reader-template.html index 478e08129c70fd..68403300e30b8f 100644 --- a/deps/v8/tools/system-analyzer/view/log-file-reader-template.html +++ b/deps/v8/tools/system-analyzer/view/log-file-reader-template.html @@ -14,15 +14,14 @@ transition: all 0.5s ease-in-out; background-color: var(--surface-color); } - + #fileReader:hover { background-color: var(--primary-color); color: var(--on-primary-color); } .done #fileReader{ - height: 20px; - line-height: 20px; + display: none; } .fail #fileReader { @@ -51,6 +50,7 @@ height: 100%; background-color: var(--file-reader-background-color); } + #spinner { position: absolute; width: 100px; @@ -64,6 +64,10 @@ animation: spin 1s ease-in-out infinite; } + #label { + user-select: none; + } + @keyframes spin { 0% { transform: rotate(0deg); diff --git a/deps/v8/tools/system-analyzer/view/log-file-reader.mjs b/deps/v8/tools/system-analyzer/view/log-file-reader.mjs index fd935f2f836353..5edb90d2fca567 100644 --- a/deps/v8/tools/system-analyzer/view/log-file-reader.mjs +++ b/deps/v8/tools/system-analyzer/view/log-file-reader.mjs @@ -1,6 +1,7 @@ // Copyright 2020 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. +import {delay} from '../helper.mjs'; import {DOM, V8CustomElement} from './helper.mjs'; DOM.defineCustomElement('view/log-file-reader', @@ -65,20 +66,45 @@ DOM.defineCustomElement('view/log-file-reader', } this.fileReader.blur(); this.root.className = 'loading'; - const reader = new FileReader(); - reader.onload = (e) => this.handleFileLoad(e, file); // Delay the loading a bit to allow for CSS animations to happen. - setTimeout(() => reader.readAsText(file), 0); + window.requestAnimationFrame(() => this.asyncReadFile(file)); } - handleFileLoad(e, file) { - const chunk = e.target.result; + async asyncReadFile(file) { + const decoder = globalThis.TextDecoderStream; + if (decoder) { + await this._streamFile(file, decoder); + } else { + await this._readFullFile(file); + } this._updateLabel(`Finished loading '${file.name}'.`); - this.dispatchEvent(new CustomEvent('fileuploadend', { + this.dispatchEvent( + new CustomEvent('fileuploadend', {bubbles: true, composed: true})); + this.root.className = 'done'; + } + + async _readFullFile(file) { + const text = await file.text(); + this._handleFileChunk(text) + } + + async _streamFile(file, decoder) { + const stream = file.stream().pipeThrough(new decoder()); + const reader = stream.getReader(); + let chunk, readerDone; + do { + const readResult = await reader.read(); + chunk = readResult.value; + readerDone = readResult.done; + if (chunk) this._handleFileChunk(chunk); + } while (!readerDone); + } + + _handleFileChunk(chunk) { + this.dispatchEvent(new CustomEvent('fileuploadchunk', { bubbles: true, composed: true, detail: chunk, })); - this.root.className = 'done'; } }); diff --git a/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html b/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html index b109d4c8ac7bbb..83cdd059ac113b 100644 --- a/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html +++ b/deps/v8/tools/system-analyzer/view/map-panel/map-details-template.html @@ -15,5 +15,5 @@ white-space: pre; } -
    +
    diff --git a/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs b/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs index a8ea27e2e4e147..505c24cf8d352f 100644 --- a/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs +++ b/deps/v8/tools/system-analyzer/view/map-panel/map-details.mjs @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {FocusEvent} from '../events.mjs'; +import {ExpandableText} from '../helper.mjs'; import {DOM, V8CustomElement} from '../helper.mjs'; DOM.defineCustomElement( @@ -11,15 +12,14 @@ DOM.defineCustomElement( constructor() { super(templateText); - this._filePositionNode.onclick = e => this._handleFilePositionClick(e); } get _mapDetails() { return this.$('#mapDetails'); } - get _filePositionNode() { - return this.$('#filePositionNode'); + get _mapProperties() { + return this.$('#mapProperties'); } set map(map) { @@ -29,19 +29,32 @@ DOM.defineCustomElement( } _update() { - let details = ''; - let clickableDetails = ''; + this._mapProperties.innerText = ''; if (this._map) { - clickableDetails = `ID: ${this._map.id}`; - clickableDetails += `\nSource location: ${this._map.filePosition}`; - details = this._map.description; + let clickableDetailsTable = DOM.table('properties'); + + { + const row = clickableDetailsTable.insertRow(); + row.insertCell().innerText = 'ID'; + row.insertCell().innerText = `${this._map.id}`; + } + { + const row = clickableDetailsTable.insertRow(); + row.insertCell().innerText = 'Source location'; + const sourceLocation = row.insertCell(); + new ExpandableText(sourceLocation, `${this._map.sourcePosition}`); + sourceLocation.className = 'clickable'; + sourceLocation.onclick = e => this._handleSourcePositionClick(e); + } + + this._mapProperties.appendChild(clickableDetailsTable); + this._mapDetails.innerText = this._map.description; + } else { + this._mapDetails.innerText = ''; } - this._filePositionNode.innerText = clickableDetails; - this._filePositionNode.classList.add('clickable'); - this._mapDetails.innerText = details; } - _handleFilePositionClick(event) { + _handleSourcePositionClick(event) { this.dispatchEvent(new FocusEvent(this._map.sourcePosition)); } }); diff --git a/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs b/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs index fbe78f91563ce7..95d6b0371f6cd8 100644 --- a/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs +++ b/deps/v8/tools/system-analyzer/view/map-panel/map-transitions.mjs @@ -5,177 +5,177 @@ import {FocusEvent, SelectRelatedEvent, ToolTipEvent} from '../events.mjs'; import {CSSColor} from '../helper.mjs'; import {DOM, V8CustomElement} from '../helper.mjs'; -DOM.defineCustomElement( - './view/map-panel/map-transitions', - (templateText) => class MapTransitions extends V8CustomElement { - _timeline; - _map; - _edgeToColor = new Map(); - _selectedLogEntries; - _displayedMapsInTree; - _toggleSubtreeHandler = this._handleToggleSubtree.bind(this); - _mapClickHandler = this._handleMapClick.bind(this); - _mapDoubleClickHandler = this._handleMapDoubleClick.bind(this); - _mouseoverMapHandler = this._handleMouseoverMap.bind(this); - - constructor() { - super(templateText); - this.currentNode = this.transitionView; - } - - get transitionView() { - return this.$('#transitionView'); - } - - set timeline(timeline) { - this._timeline = timeline; - this._edgeToColor.clear(); - timeline.getBreakdown().forEach(breakdown => { - this._edgeToColor.set(breakdown.key, CSSColor.at(breakdown.id)); - }); - } - - set selectedLogEntries(list) { - this._selectedLogEntries = list; - this.requestUpdate(); - } - - _update() { - this.transitionView.style.display = 'none'; - DOM.removeAllChildren(this.transitionView); - if (this._selectedLogEntries.length == 0) return; - this._displayedMapsInTree = new Set(); - // Limit view to 200 maps for performance reasons. - this._selectedLogEntries.slice(0, 200).forEach( - (map) => this._addMapAndParentTransitions(map)); - this._displayedMapsInTree = undefined; - this.transitionView.style.display = ''; - } - - _addMapAndParentTransitions(map) { - if (map === undefined) return; - if (this._displayedMapsInTree.has(map)) return; - this._displayedMapsInTree.add(map); - this.currentNode = this.transitionView; - let parents = map.getParents(); - if (parents.length > 0) { - this._addTransitionTo(parents.pop()); - parents.reverse().forEach((each) => this._addTransitionTo(each)); - } - let mapNode = this._addSubtransitions(map); - // Mark and show the selected map. - mapNode.classList.add('selected'); - if (this.selectedMap == map) { - setTimeout( - () => mapNode.scrollIntoView({ - behavior: 'smooth', - block: 'nearest', - inline: 'nearest', - }), - 1); - } - } - - _addSubtransitions(map) { - let mapNode = this._addTransitionTo(map); - // Draw outgoing linear transition line. - let current = map; - while (current.children.length == 1) { - current = current.children[0].to; - this._addTransitionTo(current); - } - return mapNode; - } - - _addTransitionEdge(map) { - let classes = ['transitionEdge']; - let edge = DOM.div(classes); - edge.style.backgroundColor = this._edgeToColor.get(map.edge.type); - let labelNode = DOM.div('transitionLabel'); - labelNode.innerText = map.edge.toString(); - edge.appendChild(labelNode); - return edge; - } - - _addTransitionTo(map) { - // transition[ transitions[ transition[...], transition[...], ...]]; - this._displayedMapsInTree?.add(map); - let transition = DOM.div('transition'); - if (map.isDeprecated()) transition.classList.add('deprecated'); - if (map.edge) { - transition.appendChild(this._addTransitionEdge(map)); - } - let mapNode = this._addMapNode(map); - transition.appendChild(mapNode); - - let subtree = DOM.div('transitions'); - transition.appendChild(subtree); - - this.currentNode.appendChild(transition); - this.currentNode = subtree; - - return mapNode; - } - - _addMapNode(map) { - let node = DOM.div('map'); - if (map.edge) - node.style.backgroundColor = this._edgeToColor.get(map.edge.type); - node.map = map; - node.onclick = this._mapClickHandler - node.ondblclick = this._mapDoubleClickHandler - node.onmouseover = this._mouseoverMapHandler - if (map.children.length > 1) { - node.innerText = map.children.length; - const showSubtree = DOM.div('showSubtransitions'); - showSubtree.onclick = this._toggleSubtreeHandler - node.appendChild(showSubtree); - } - else if (map.children.length == 0) { - node.innerHTML = '●'; - } - this.currentNode.appendChild(node); - return node; - } - - _handleMapClick(event) { - const map = event.currentTarget.map; - this.dispatchEvent(new FocusEvent(map)); - } - - _handleMapDoubleClick(event) { - this.dispatchEvent(new SelectRelatedEvent(event.currentTarget.map)); - } - - _handleMouseoverMap(event) { - this.dispatchEvent(new ToolTipEvent( - event.currentTarget.map.toStringLong(), event.currentTarget)); - } - - _handleToggleSubtree(event) { - event.preventDefault(); - const node = event.currentTarget.parentElement; - let map = node.map; - event.target.classList.toggle('opened'); - let transitionsNode = node.parentElement.querySelector('.transitions'); - let subtransitionNodes = transitionsNode.children; - if (subtransitionNodes.length <= 1) { - // Add subtransitions except the one that's already shown. - let visibleTransitionMap = subtransitionNodes.length == 1 ? - transitionsNode.querySelector('.map').map : - undefined; - map.children.forEach((edge) => { - if (edge.to != visibleTransitionMap) { - this.currentNode = transitionsNode; - this._addSubtransitions(edge.to); - } - }); - } else { - // remove all but the first (currently selected) subtransition - for (let i = subtransitionNodes.length - 1; i > 0; i--) { - transitionsNode.removeChild(subtransitionNodes[i]); - } +DOM.defineCustomElement('./view/map-panel/map-transitions', + (templateText) => + class MapTransitions extends V8CustomElement { + _timeline; + _map; + _edgeToColor = new Map(); + _selectedLogEntries; + _displayedMapsInTree; + _toggleSubtreeHandler = this._handleToggleSubtree.bind(this); + _mapClickHandler = this._handleMapClick.bind(this); + _mapDoubleClickHandler = this._handleMapDoubleClick.bind(this); + _mouseoverMapHandler = this._handleMouseoverMap.bind(this); + + constructor() { + super(templateText); + this.currentNode = this.transitionView; + } + + get transitionView() { + return this.$('#transitionView'); + } + + set timeline(timeline) { + this._timeline = timeline; + this._edgeToColor.clear(); + timeline.getBreakdown().forEach(breakdown => { + this._edgeToColor.set(breakdown.key, CSSColor.at(breakdown.id)); + }); + } + + set selectedLogEntries(list) { + this._selectedLogEntries = list; + this.requestUpdate(); + } + + _update() { + this.transitionView.style.display = 'none'; + DOM.removeAllChildren(this.transitionView); + if (this._selectedLogEntries.length == 0) return; + this._displayedMapsInTree = new Set(); + // Limit view to 200 maps for performance reasons. + this._selectedLogEntries.slice(0, 200).forEach( + (map) => this._addMapAndParentTransitions(map)); + this._displayedMapsInTree = undefined; + this.transitionView.style.display = ''; + } + + _addMapAndParentTransitions(map) { + if (map === undefined) return; + if (this._displayedMapsInTree.has(map)) return; + this._displayedMapsInTree.add(map); + this.currentNode = this.transitionView; + let parents = map.getParents(); + if (parents.length > 0) { + this._addTransitionTo(parents.pop()); + parents.reverse().forEach((each) => this._addTransitionTo(each)); + } + let mapNode = this._addSubtransitions(map); + // Mark and show the selected map. + mapNode.classList.add('selected'); + if (this.selectedMap == map) { + setTimeout( + () => mapNode.scrollIntoView({ + behavior: 'smooth', + block: 'nearest', + inline: 'nearest', + }), + 1); + } + } + + _addSubtransitions(map) { + let mapNode = this._addTransitionTo(map); + // Draw outgoing linear transition line. + let current = map; + while (current.children.length == 1) { + current = current.children[0].to; + this._addTransitionTo(current); + } + return mapNode; + } + + _addTransitionEdge(map) { + let classes = ['transitionEdge']; + let edge = DOM.div(classes); + edge.style.backgroundColor = this._edgeToColor.get(map.edge.type); + let labelNode = DOM.div('transitionLabel'); + labelNode.innerText = map.edge.toString(); + edge.appendChild(labelNode); + return edge; + } + + _addTransitionTo(map) { + // transition[ transitions[ transition[...], transition[...], ...]]; + this._displayedMapsInTree?.add(map); + let transition = DOM.div('transition'); + if (map.isDeprecated()) transition.classList.add('deprecated'); + if (map.edge) { + transition.appendChild(this._addTransitionEdge(map)); + } + let mapNode = this._addMapNode(map); + transition.appendChild(mapNode); + + let subtree = DOM.div('transitions'); + transition.appendChild(subtree); + + this.currentNode.appendChild(transition); + this.currentNode = subtree; + + return mapNode; + } + + _addMapNode(map) { + let node = DOM.div('map'); + if (map.edge) + node.style.backgroundColor = this._edgeToColor.get(map.edge.type); + node.map = map; + node.onclick = this._mapClickHandler + node.ondblclick = this._mapDoubleClickHandler + node.onmouseover = this._mouseoverMapHandler + if (map.children.length > 1) { + node.innerText = map.children.length; + const showSubtree = DOM.div('showSubtransitions'); + showSubtree.onclick = this._toggleSubtreeHandler + node.appendChild(showSubtree); + } + else if (map.children.length == 0) { + node.innerHTML = '●'; + } + this.currentNode.appendChild(node); + return node; + } + + _handleMapClick(event) { + const map = event.currentTarget.map; + this.dispatchEvent(new FocusEvent(map)); + } + + _handleMapDoubleClick(event) { + this.dispatchEvent(new SelectRelatedEvent(event.currentTarget.map)); + } + + _handleMouseoverMap(event) { + this.dispatchEvent( + new ToolTipEvent(event.currentTarget.map, event.currentTarget)); + } + + _handleToggleSubtree(event) { + event.stopImmediatePropagation(); + const node = event.currentTarget.parentElement; + const map = node.map; + event.target.classList.toggle('opened'); + const transitionsNode = node.parentElement.querySelector('.transitions'); + const subtransitionNodes = transitionsNode.children; + if (subtransitionNodes.length <= 1) { + // Add subtransitions except the one that's already shown. + let visibleTransitionMap = subtransitionNodes.length == 1 ? + transitionsNode.querySelector('.map').map : + undefined; + map.children.forEach((edge) => { + if (edge.to != visibleTransitionMap) { + this.currentNode = transitionsNode; + this._addSubtransitions(edge.to); } - return false; + }); + } else { + // remove all but the first (currently selected) subtransition + for (let i = subtransitionNodes.length - 1; i > 0; i--) { + transitionsNode.removeChild(subtransitionNodes[i]); } - }); + } + return false; + } +}); diff --git a/deps/v8/tools/system-analyzer/view/property-link-table-template.html b/deps/v8/tools/system-analyzer/view/property-link-table-template.html new file mode 100644 index 00000000000000..85f2cdc178caae --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/property-link-table-template.html @@ -0,0 +1,39 @@ + + + + + + + +
    +
    +
    \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/property-link-table.mjs b/deps/v8/tools/system-analyzer/view/property-link-table.mjs new file mode 100644 index 00000000000000..d2e2dce60bdb92 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/property-link-table.mjs @@ -0,0 +1,122 @@ +// 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. + +import {App} from '../index.mjs' +import {FocusEvent} from './events.mjs'; +import {DOM, ExpandableText, V8CustomElement} from './helper.mjs'; + +DOM.defineCustomElement( + 'view/property-link-table', + template => class PropertyLinkTable extends V8CustomElement { + _instance; + _propertyDict; + _instanceLinkButtons = false; + _logEntryClickHandler = this._handleLogEntryClick.bind(this); + _logEntryRelatedHandler = this._handleLogEntryRelated.bind(this); + _arrayValueSelectHandler = this._handleArrayValueSelect.bind(this); + + constructor() { + super(template); + } + + set instanceLinkButtons(newValue) { + this._instanceLinkButtons = newValue; + } + + set propertyDict(propertyDict) { + if (this._propertyDict === propertyDict) return; + this._propertyDict = propertyDict; + this.requestUpdate(); + } + + _update() { + this._fragment = new DocumentFragment(); + this._table = DOM.table('properties'); + for (let key in this._propertyDict) { + const value = this._propertyDict[key]; + this._addKeyValue(key, value); + } + this._addFooter(); + this._fragment.appendChild(this._table); + + const newContent = DOM.div(); + newContent.appendChild(this._fragment); + this.$('#content').replaceWith(newContent); + newContent.id = 'content'; + this._fragment = undefined; + } + + _addKeyValue(key, value) { + if (key == 'title') { + this._addTitle(value); + return; + } + if (key == '__this__') { + this._instance = value; + return; + } + const row = this._table.insertRow(); + row.insertCell().innerText = key; + const cell = row.insertCell(); + if (value == undefined) return; + if (Array.isArray(value)) { + cell.appendChild(this._addArrayValue(value)); + return; + } + if (App.isClickable(value)) { + cell.className = 'clickable'; + cell.onclick = this._logEntryClickHandler; + cell.data = value; + } + new ExpandableText(cell, value.toString()); + } + + _addArrayValue(array) { + if (array.length == 0) { + return DOM.text('empty'); + } else if (array.length > 200) { + return DOM.text(`${array.length} items`); + } + const select = DOM.element('select'); + select.onchange = this._arrayValueSelectHandler; + for (let value of array) { + const option = DOM.element('option'); + option.innerText = value.toString(); + option.data = value; + select.add(option); + } + return select; + } + + _addTitle(value) { + const title = DOM.element('h3'); + title.innerText = value; + this._fragment.appendChild(title); + } + + _addFooter() { + if (this._instance === undefined) return; + if (!this._instanceLinkButtons) return; + const td = this._table.createTFoot().insertRow().insertCell(); + td.colSpan = 2; + let showButton = + td.appendChild(DOM.button('Show', this._logEntryClickHandler)); + showButton.data = this._instance; + let showRelatedButton = td.appendChild( + DOM.button('Show Related', this._logEntryRelatedClickHandler)); + showRelatedButton.data = this._instance; + } + + _handleArrayValueSelect(event) { + const logEntry = event.currentTarget.selectedOptions[0].data; + this.dispatchEvent(new FocusEvent(logEntry)); + } + _handleLogEntryClick(event) { + this.dispatchEvent(new FocusEvent(event.currentTarget.data)); + } + + _handleLogEntryRelated(event) { + this.dispatchEvent(new SelectRelatedEvent(event.currentTarget.data)); + } + }); diff --git a/deps/v8/tools/system-analyzer/view/script-panel-template.html b/deps/v8/tools/system-analyzer/view/script-panel-template.html index ab5c3f95f35279..de3150366a5f6b 100644 --- a/deps/v8/tools/system-analyzer/view/script-panel-template.html +++ b/deps/v8/tools/system-analyzer/view/script-panel-template.html @@ -10,10 +10,6 @@ font-family: Consolas, monospace; } - .scriptNode:before { - counter-reset: sourceLineCounter; - } - .scriptNode span { counter-increment: sourceLineCounter 1; text-indent: -3.5em; diff --git a/deps/v8/tools/system-analyzer/view/script-panel.mjs b/deps/v8/tools/system-analyzer/view/script-panel.mjs index 6f5befcc16073b..23b4c03ec5b145 100644 --- a/deps/v8/tools/system-analyzer/view/script-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/script-panel.mjs @@ -1,17 +1,21 @@ // Copyright 2020 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. -import {groupBy} from '../helper.mjs'; +import {defer, groupBy} from '../helper.mjs'; import {App} from '../index.mjs' import {SelectRelatedEvent, ToolTipEvent} from './events.mjs'; import {CollapsableElement, CSSColor, delay, DOM, formatBytes, gradientStopsFromGroups} from './helper.mjs'; +// A source mapping proxy for source maps that don't have CORS headers. +// TODO(leszeks): Make this configurable. +const sourceMapFetchPrefix = 'http://localhost:8080/'; + DOM.defineCustomElement('view/script-panel', (templateText) => class SourcePanel extends CollapsableElement { _selectedSourcePositions = []; - _sourcePositionsToMarkNodes = []; + _sourcePositionsToMarkNodesPromise = Promise.resolve([]); _scripts = []; _script; @@ -34,8 +38,13 @@ DOM.defineCustomElement('view/script-panel', set script(script) { if (this._script === script) return; this._script = script; - this._renderSourcePanel(); - this._updateScriptDropdownSelection(); + script.ensureSourceMapCalculated(sourceMapFetchPrefix); + this._sourcePositionsToMarkNodesPromise = defer(); + this.requestUpdate(); + } + + set focusedSourcePositions(sourcePositions) { + this.selectedSourcePositions = sourcePositions; } set selectedSourcePositions(sourcePositions) { @@ -45,10 +54,6 @@ DOM.defineCustomElement('view/script-panel', this._focusSelectedMarkers(); } - set focusedSourcePositions(sourcePositions) { - this.selectedSourcePositions = sourcePositions; - } - set scripts(scripts) { this._scripts = scripts; this._initializeScriptDropdown(); @@ -58,8 +63,13 @@ DOM.defineCustomElement('view/script-panel', return this.$('#script-dropdown'); } + _update() { + this._renderSourcePanel(); + this._updateScriptDropdownSelection(); + } + _initializeScriptDropdown() { - this._scripts.sort((a, b) => a.name.localeCompare(b.name)); + this._scripts.sort((a, b) => a.name?.localeCompare(b.name) ?? 0); let select = this.scriptDropdown; select.options.length = 0; for (const script of this._scripts) { @@ -70,6 +80,7 @@ DOM.defineCustomElement('view/script-panel', select.add(option); } } + _updateScriptDropdownSelection() { this.scriptDropdown.selectedIndex = this._script ? this._scripts.indexOf(this._script) : -1; @@ -77,15 +88,19 @@ DOM.defineCustomElement('view/script-panel', async _renderSourcePanel() { let scriptNode; - if (this._script) { + const script = this._script; + if (script) { await delay(1); + if (script != this._script) return; const builder = new LineBuilder(this, this._script); - scriptNode = builder.createScriptNode(); - this._sourcePositionsToMarkNodes = builder.sourcePositionToMarkers; + scriptNode = await builder.createScriptNode(this._script.startLine); + if (script != this._script) return; + this._sourcePositionsToMarkNodesPromise.resolve( + builder.sourcePositionToMarkers); } else { scriptNode = DOM.div(); this._selectedMarkNodes = undefined; - this._sourcePositionsToMarkNodes = new Map(); + this._sourcePositionsToMarkNodesPromise.resolve(new Map()); } const oldScriptNode = this.script.childNodes[1]; this.script.replaceChild(scriptNode, oldScriptNode); @@ -93,22 +108,24 @@ DOM.defineCustomElement('view/script-panel', async _focusSelectedMarkers() { await delay(100); + const sourcePositionsToMarkNodes = + await this._sourcePositionsToMarkNodesPromise; // Remove all marked nodes. - for (let markNode of this._sourcePositionsToMarkNodes.values()) { + for (let markNode of sourcePositionsToMarkNodes.values()) { markNode.className = ''; } for (let sourcePosition of this._selectedSourcePositions) { if (sourcePosition.script !== this._script) continue; - this._sourcePositionsToMarkNodes.get(sourcePosition).className = 'marked'; + sourcePositionsToMarkNodes.get(sourcePosition).className = 'marked'; } - this._scrollToFirstSourcePosition() + this._scrollToFirstSourcePosition(sourcePositionsToMarkNodes) } - _scrollToFirstSourcePosition() { + _scrollToFirstSourcePosition(sourcePositionsToMarkNodes) { const sourcePosition = this._selectedSourcePositions.find( each => each.script === this._script); if (!sourcePosition) return; - const markNode = this._sourcePositionsToMarkNodes.get(sourcePosition); + const markNode = sourcePositionsToMarkNodes.get(sourcePosition); markNode.scrollIntoView( {behavior: 'auto', block: 'center', inline: 'center'}); } @@ -130,19 +147,59 @@ DOM.defineCustomElement('view/script-panel', } handleSourcePositionMouseOver(e) { - const entries = e.target.sourcePosition.entries; + const sourcePosition = e.target.sourcePosition; + const entries = sourcePosition.entries; let text = groupBy(entries, each => each.constructor, true) .map(group => { - let text = `${group.key.name}: ${group.count}\n` + let text = `${group.key.name}: ${group.length}\n` text += groupBy(group.entries, each => each.type, true) .map(group => { - return ` - ${group.key}: ${group.count}`; + return ` - ${group.key}: ${group.length}`; }) .join('\n'); return text; }) .join('\n'); - this.dispatchEvent(new ToolTipEvent(text, e.target)); + + let sourceMapContent; + switch (this._script.sourceMapState) { + case 'loaded': { + const originalPosition = sourcePosition.originalPosition; + if (originalPosition.source === null) { + sourceMapContent = + DOM.element('i', {textContent: 'no source mapping for location'}); + } else { + sourceMapContent = DOM.element('a', { + href: `${originalPosition.source}`, + target: '_blank', + textContent: `${originalPosition.source}:${originalPosition.line}:${ + originalPosition.column}` + }); + } + break; + } + case 'loading': + sourceMapContent = + DOM.element('i', {textContent: 'source map still loading...'}); + break; + case 'failed': + sourceMapContent = + DOM.element('i', {textContent: 'source map failed to load'}); + break; + case 'none': + sourceMapContent = DOM.element('i', {textContent: 'no source map'}); + break; + default: + break; + } + + const toolTipContent = DOM.div({ + children: [ + DOM.element('pre', {className: 'textContent', textContent: text}), + sourceMapContent + ] + }); + this.dispatchEvent(new ToolTipEvent(toolTipContent, e.target)); } }); @@ -180,9 +237,9 @@ class SourcePositionIterator { } } -function* lineIterator(source) { +function* lineIterator(source, startLine) { let current = 0; - let line = 1; + let line = startLine; while (current < source.length) { const next = source.indexOf('\n', current); if (next === -1) break; @@ -209,37 +266,42 @@ class LineBuilder { _script; _clickHandler; _mouseoverHandler; - _sourcePositions; _sourcePositionToMarkers = new Map(); constructor(panel, script) { this._script = script; this._clickHandler = panel.handleSourcePositionClick.bind(panel); this._mouseoverHandler = panel.handleSourcePositionMouseOver.bind(panel); - // TODO: sort on script finalization. - script.sourcePositions.sort((a, b) => { - if (a.line === b.line) return a.column - b.column; - return a.line - b.line; - }); - this._sourcePositions = new SourcePositionIterator(script.sourcePositions); } get sourcePositionToMarkers() { return this._sourcePositionToMarkers; } - createScriptNode() { + async createScriptNode(startLine) { const scriptNode = DOM.div('scriptNode'); - for (let [lineIndex, line] of lineIterator(this._script.source)) { - scriptNode.appendChild(this._createLineNode(lineIndex, line)); + + // TODO: sort on script finalization. + this._script.sourcePositions.sort((a, b) => { + if (a.line === b.line) return a.column - b.column; + return a.line - b.line; + }); + + const sourcePositionsIterator = + new SourcePositionIterator(this._script.sourcePositions); + scriptNode.style.counterReset = `sourceLineCounter ${startLine - 1}`; + for (let [lineIndex, line] of lineIterator( + this._script.source, startLine)) { + scriptNode.appendChild( + this._createLineNode(sourcePositionsIterator, lineIndex, line)); } return scriptNode; } - _createLineNode(lineIndex, line) { + _createLineNode(sourcePositionsIterator, lineIndex, line) { const lineNode = DOM.span(); let columnIndex = 0; - for (const sourcePosition of this._sourcePositions.forLine(lineIndex)) { + for (const sourcePosition of sourcePositionsIterator.forLine(lineIndex)) { const nextColumnIndex = sourcePosition.column - 1; lineNode.appendChild(document.createTextNode( line.substring(columnIndex, nextColumnIndex))); @@ -263,10 +325,14 @@ class LineBuilder { marker.onmouseover = this._mouseoverHandler; const entries = sourcePosition.entries; - const stops = gradientStopsFromGroups( - entries.length, '%', groupBy(entries, entry => entry.constructor), - type => LineBuilder.colorMap.get(type)); - marker.style.backgroundImage = `linear-gradient(0deg,${stops.join(',')})` + const groups = groupBy(entries, entry => entry.constructor); + if (groups.length > 1) { + const stops = gradientStopsFromGroups( + entries.length, '%', groups, type => LineBuilder.colorMap.get(type)); + marker.style.backgroundImage = `linear-gradient(0deg,${stops.join(',')})` + } else { + marker.style.backgroundColor = LineBuilder.colorMap.get(groups[0].key) + } return marker; } diff --git a/deps/v8/tools/system-analyzer/view/timeline-panel-template.html b/deps/v8/tools/system-analyzer/view/timeline-panel-template.html index da0ce26380907c..6367e7e1aba3f8 100644 --- a/deps/v8/tools/system-analyzer/view/timeline-panel-template.html +++ b/deps/v8/tools/system-analyzer/view/timeline-panel-template.html @@ -18,10 +18,26 @@ width: 30px; background-color: var(--border-color); } + .titleButtons { + float: right; + } + .titleButtons button { + border-radius: 20px; + width: 20px; + height: 20px; + font-weight: bold; + line-height: 11px; + }
    -

    Timeline Panel

    +

    + Timeline Panel +
    + + +
    +

    diff --git a/deps/v8/tools/system-analyzer/view/timeline-panel.mjs b/deps/v8/tools/system-analyzer/view/timeline-panel.mjs index 331db401e96db9..35d8f028931974 100644 --- a/deps/v8/tools/system-analyzer/view/timeline-panel.mjs +++ b/deps/v8/tools/system-analyzer/view/timeline-panel.mjs @@ -3,6 +3,9 @@ // found in the LICENSE file. import './timeline/timeline-track.mjs'; +import './timeline/timeline-track-map.mjs'; +import './timeline/timeline-track-tick.mjs'; +import './timeline/timeline-track-timer.mjs'; import {SynchronizeSelectionEvent} from './events.mjs'; import {DOM, V8CustomElement} from './helper.mjs'; @@ -16,11 +19,15 @@ DOM.defineCustomElement( this.addEventListener( SynchronizeSelectionEvent.name, e => this.handleSelectionSyncronization(e)); + this.$('#zoomIn').onclick = () => this.nofChunks *= 1.5; + this.$('#zoomOut').onclick = () => this.nofChunks /= 1.5; } set nofChunks(count) { + const time = this.currentTime for (const track of this.timelineTracks) { track.nofChunks = count; + track.currentTime = time; } } @@ -28,13 +35,16 @@ DOM.defineCustomElement( return this.timelineTracks[0].nofChunks; } + get currentTime() { + return this.timelineTracks[0].currentTime; + } + get timelineTracks() { return this.$('slot').assignedNodes().filter( node => node.nodeType === Node.ELEMENT_NODE); } handleTrackScroll(event) { - // TODO(zcankara) add forEachTrack helper method for (const track of this.timelineTracks) { track.scrollLeft = event.detail; } diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-base.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-base.mjs new file mode 100644 index 00000000000000..4faa8fc3aa8702 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-base.mjs @@ -0,0 +1,621 @@ +// Copyright 2020 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. + +import {delay} from '../../helper.mjs'; +import {kChunkHeight, kChunkVisualWidth, kChunkWidth} from '../../log/map.mjs'; +import {SelectionEvent, SelectTimeEvent, SynchronizeSelectionEvent, ToolTipEvent,} from '../events.mjs'; +import {CSSColor, DOM, formatDurationMicros, SVG, V8CustomElement} from '../helper.mjs'; + +export const kTimelineHeight = 200; + +export class TimelineTrackBase extends V8CustomElement { + _timeline; + _nofChunks = 500; + _chunks = []; + _selectedEntry; + _focusedEntry; + _timeToPixel; + _timeStartPixelOffset; + _legend; + _lastContentWidth = 0; + + _cachedTimelineBoundingClientRect; + _cachedTimelineScrollLeft; + + constructor(templateText) { + super(templateText); + this._selectionHandler = new SelectionHandler(this); + this._legend = new Legend(this.$('#legendTable')); + this._legend.onFilter = (type) => this._handleFilterTimeline(); + + this.timelineChunks = this.$('#timelineChunks'); + this.timelineSamples = this.$('#timelineSamples'); + this.timelineNode = this.$('#timeline'); + this.toolTipTargetNode = this.$('#toolTipTarget'); + this.hitPanelNode = this.$('#hitPanel'); + this.timelineAnnotationsNode = this.$('#timelineAnnotations'); + this.timelineMarkersNode = this.$('#timelineMarkers'); + this._scalableContentNode = this.$('#scalableContent'); + + this.timelineNode.addEventListener( + 'scroll', e => this._handleTimelineScroll(e)); + this.hitPanelNode.onclick = this._handleClick.bind(this); + this.hitPanelNode.ondblclick = this._handleDoubleClick.bind(this); + this.hitPanelNode.onmousemove = this._handleMouseMove.bind(this); + window.addEventListener('resize', () => this._resetCachedDimensions()); + this.isLocked = false; + } + + static get observedAttributes() { + return ['title']; + } + + attributeChangedCallback(name, oldValue, newValue) { + if (name == 'title') { + this.$('#title').innerHTML = newValue; + } + } + + _handleFilterTimeline(type) { + this._updateChunks(); + } + + set data(timeline) { + this._timeline = timeline; + this._legend.timeline = timeline; + this.$('.content').style.display = timeline.isEmpty() ? 'none' : 'relative'; + this._updateChunks(); + } + + set timeSelection(selection) { + this._selectionHandler.timeSelection = selection; + this.updateSelection(); + } + + updateSelection() { + this._selectionHandler.update(); + this._legend.update(); + } + + get _timelineBoundingClientRect() { + if (this._cachedTimelineBoundingClientRect === undefined) { + this._cachedTimelineBoundingClientRect = + this.timelineNode.getBoundingClientRect(); + } + return this._cachedTimelineBoundingClientRect; + } + + get _timelineScrollLeft() { + if (this._cachedTimelineScrollLeft === undefined) { + this._cachedTimelineScrollLeft = this.timelineNode.scrollLeft; + } + return this._cachedTimelineScrollLeft; + } + + _resetCachedDimensions() { + this._cachedTimelineBoundingClientRect = undefined; + this._cachedTimelineScrollLeft = undefined; + } + + // Maps the clicked x position to the x position on timeline + positionOnTimeline(pagePosX) { + let rect = this._timelineBoundingClientRect; + let posClickedX = pagePosX - rect.left + this._timelineScrollLeft; + return posClickedX; + } + + positionToTime(pagePosX) { + return this.relativePositionToTime(this.positionOnTimeline(pagePosX)); + } + + relativePositionToTime(timelineRelativeX) { + const timelineAbsoluteX = timelineRelativeX + this._timeStartPixelOffset; + return (timelineAbsoluteX / this._timeToPixel) | 0; + } + + timeToPosition(time) { + let relativePosX = time * this._timeToPixel; + relativePosX -= this._timeStartPixelOffset; + return relativePosX; + } + + set nofChunks(count) { + this._nofChunks = count | 0; + this._updateChunks(); + } + + get nofChunks() { + return this._nofChunks; + } + + _updateChunks() { + this._chunks = undefined; + this._updateDimensions(); + this.requestUpdate(); + } + + get chunks() { + return this._chunks; + } + + set selectedEntry(value) { + this._selectedEntry = value; + this.drawAnnotations(value); + } + + get selectedEntry() { + return this._selectedEntry; + } + + set scrollLeft(offset) { + this.timelineNode.scrollLeft = offset; + this._cachedTimelineScrollLeft = offset; + } + + handleEntryTypeDoubleClick(e) { + this.dispatchEvent(new SelectionEvent(e.target.parentNode.entries)); + } + + timelineIndicatorMove(offset) { + this.timelineNode.scrollLeft += offset; + this._cachedTimelineScrollLeft = undefined; + } + + _handleTimelineScroll(e) { + let scrollLeft = e.currentTarget.scrollLeft; + this._cachedTimelineScrollLeft = scrollLeft; + this.dispatchEvent(new CustomEvent( + 'scrolltrack', {bubbles: true, composed: true, detail: scrollLeft})); + } + + _updateDimensions() { + const centerOffset = this._timelineBoundingClientRect.width / 2; + const time = + this.relativePositionToTime(this._timelineScrollLeft + centerOffset); + const start = this._timeline.startTime; + const width = this._nofChunks * kChunkWidth; + this._lastContentWidth = parseInt(this.timelineMarkersNode.style.width); + this._timeToPixel = width / this._timeline.duration(); + this._timeStartPixelOffset = start * this._timeToPixel; + this.timelineChunks.style.width = `${width}px`; + this.timelineMarkersNode.style.width = `${width}px`; + this.timelineAnnotationsNode.style.width = `${width}px`; + this.hitPanelNode.style.width = `${width}px`; + this._drawMarkers(); + this._selectionHandler.update(); + this._scaleContent(width); + this._cachedTimelineScrollLeft = this.timelineNode.scrollLeft = + this.timeToPosition(time) - centerOffset; + } + + _scaleContent(currentWidth) { + if (!this._lastContentWidth) return; + const ratio = currentWidth / this._lastContentWidth; + this._scalableContentNode.style.transform = `scale(${ratio}, 1)`; + } + + _adjustHeight(height) { + const dataHeight = Math.max(height, 200); + const viewHeight = Math.min(dataHeight, 400); + this.style.setProperty('--data-height', dataHeight + 'px'); + this.style.setProperty('--view-height', viewHeight + 'px'); + this.timelineNode.style.overflowY = + (height > kTimelineHeight) ? 'scroll' : 'hidden'; + } + + _update() { + this._legend.update(); + this._drawContent(); + this._drawAnnotations(this.selectedEntry); + this._resetCachedDimensions(); + } + + async _drawContent() { + await delay(5); + if (this._timeline.isEmpty()) return; + if (this.chunks?.length != this.nofChunks) { + this._chunks = + this._timeline.chunks(this.nofChunks, this._legend.filterPredicate); + console.assert(this._chunks.length == this._nofChunks); + } + const chunks = this.chunks; + const max = chunks.max(each => each.size()); + let buffer = ''; + for (let i = 0; i < chunks.length; i++) { + const chunk = chunks[i]; + const height = (chunk.size() / max * kChunkHeight); + chunk.height = height; + if (chunk.isEmpty()) continue; + buffer += ''; + buffer += this._drawChunk(i, chunk); + buffer += '' + } + this._scalableContentNode.innerHTML = buffer; + this._scalableContentNode.style.transform = 'scale(1, 1)'; + } + + _drawChunk(chunkIndex, chunk) { + const groups = chunk.getBreakdown(event => event.type); + let buffer = ''; + const kHeight = chunk.height; + let lastHeight = kTimelineHeight; + for (let i = 0; i < groups.length; i++) { + const group = groups[i]; + if (group.length == 0) break; + const height = (group.length / chunk.size() * kHeight) | 0; + lastHeight -= height; + const color = this._legend.colorForType(group.key); + buffer += `` + } + return buffer; + } + + _drawMarkers() { + // Put a time marker roughly every 20 chunks. + const expected = this._timeline.duration() / this._nofChunks * 20; + let interval = (10 ** Math.floor(Math.log10(expected))); + let correction = Math.log10(expected / interval); + correction = (correction < 0.33) ? 1 : (correction < 0.75) ? 2.5 : 5; + interval *= correction; + + const start = this._timeline.startTime; + let time = start; + let buffer = ''; + while (time < this._timeline.endTime) { + const delta = time - start; + const text = `${(delta / 1000) | 0} ms`; + const x = (delta * this._timeToPixel) | 0; + buffer += `${text}` + buffer += + `` + time += interval; + } + this.timelineMarkersNode.innerHTML = buffer; + } + + _drawAnnotations(logEntry, time) { + if (!this._focusedEntry) return; + this._drawEntryMark(this._focusedEntry); + } + + _drawEntryMark(entry) { + const [x, y] = this._positionForEntry(entry); + const color = this._legend.colorForType(entry.type); + const mark = + ``; + this.timelineAnnotationsNode.innerHTML = mark; + } + + _handleUnlockedMouseEvent(event) { + this._focusedEntry = this._getEntryForEvent(event); + if (!this._focusedEntry) return false; + this._updateToolTip(event); + const time = this.positionToTime(event.pageX); + this._drawAnnotations(this._focusedEntry, time); + } + + _updateToolTip(event) { + if (!this._focusedEntry) return false; + this.dispatchEvent( + new ToolTipEvent(this._focusedEntry, this.toolTipTargetNode)); + event.stopImmediatePropagation(); + } + + _handleClick(event) { + if (event.button !== 0) return; + if (event.target === this.timelineChunks) return; + this.isLocked = !this.isLocked; + // Do this unconditionally since we want the tooltip to be update to the + // latest locked state. + this._handleUnlockedMouseEvent(event); + return false; + } + + _handleDoubleClick(event) { + if (event.button !== 0) return; + this._selectionHandler.clearSelection(); + const time = this.positionToTime(event.pageX); + const chunk = this._getChunkForEvent(event) + if (!chunk) return; + event.stopImmediatePropagation(); + this.dispatchEvent(new SelectTimeEvent(chunk.start, chunk.end)); + return false; + } + + _handleMouseMove(event) { + if (event.button !== 0) return; + if (this._selectionHandler.isSelecting) return false; + if (this.isLocked && this._focusedEntry) { + this._updateToolTip(event); + return false; + } + this._handleUnlockedMouseEvent(event); + } + + _getChunkForEvent(event) { + const time = this.positionToTime(event.pageX); + return this._chunkForTime(time); + } + + _chunkForTime(time) { + const chunkIndex = ((time - this._timeline.startTime) / + this._timeline.duration() * this._nofChunks) | + 0; + return this.chunks[chunkIndex]; + } + + _positionForEntry(entry) { + const chunk = this._chunkForTime(entry.time); + if (chunk === undefined) return [-1, -1]; + const xFrom = (chunk.index * kChunkWidth + kChunkVisualWidth / 2) | 0; + const yFrom = kTimelineHeight - chunk.yOffset(entry) | 0; + return [xFrom, yFrom]; + } + + _getEntryForEvent(event) { + const chunk = this._getChunkForEvent(event); + if (chunk?.isEmpty() ?? true) return false; + const relativeIndex = Math.round( + (kTimelineHeight - event.layerY) / chunk.height * (chunk.size() - 1)); + if (relativeIndex > chunk.size()) return false; + const logEntry = chunk.at(relativeIndex); + const style = this.toolTipTargetNode.style; + style.left = `${chunk.index * kChunkWidth}px`; + style.top = `${kTimelineHeight - chunk.height}px`; + style.height = `${chunk.height}px`; + style.width = `${kChunkVisualWidth}px`; + return logEntry; + } +}; + +class SelectionHandler { + // TODO turn into static field once Safari supports it. + static get SELECTION_OFFSET() { + return 10 + }; + + _timeSelection = {start: -1, end: Infinity}; + _selectionOriginTime = -1; + + constructor(timeline) { + this._timeline = timeline; + this._timelineNode.addEventListener( + 'mousedown', e => this._handleTimeSelectionMouseDown(e)); + this._timelineNode.addEventListener( + 'mouseup', e => this._handleTimeSelectionMouseUp(e)); + this._timelineNode.addEventListener( + 'mousemove', e => this._handleTimeSelectionMouseMove(e)); + } + + update() { + if (!this.hasSelection) { + this._selectionNode.style.display = 'none'; + return; + } + this._selectionNode.style.display = 'inherit'; + const startPosition = this.timeToPosition(this._timeSelection.start); + const endPosition = this.timeToPosition(this._timeSelection.end); + this._leftHandleNode.style.left = startPosition + 'px'; + this._rightHandleNode.style.left = endPosition + 'px'; + const delta = endPosition - startPosition; + const selectionNode = this._selectionBackgroundNode; + selectionNode.style.left = startPosition + 'px'; + selectionNode.style.width = delta + 'px'; + } + + set timeSelection(selection) { + this._timeSelection.start = selection.start; + this._timeSelection.end = selection.end; + } + + clearSelection() { + this._timeline.dispatchEvent(new SelectTimeEvent()); + } + + timeToPosition(posX) { + return this._timeline.timeToPosition(posX); + } + + positionToTime(posX) { + return this._timeline.positionToTime(posX); + } + + get isSelecting() { + return this._selectionOriginTime >= 0; + } + + get hasSelection() { + return this._timeSelection.start >= 0 && + this._timeSelection.end != Infinity; + } + + get _timelineNode() { + return this._timeline.$('#timeline'); + } + + get _selectionNode() { + return this._timeline.$('#selection'); + } + + get _selectionBackgroundNode() { + return this._timeline.$('#selectionBackground'); + } + + get _leftHandleNode() { + return this._timeline.$('#leftHandle'); + } + + get _rightHandleNode() { + return this._timeline.$('#rightHandle'); + } + + get _leftHandlePosX() { + return this._leftHandleNode.getBoundingClientRect().x; + } + + get _rightHandlePosX() { + return this._rightHandleNode.getBoundingClientRect().x; + } + + _isOnLeftHandle(posX) { + return Math.abs(this._leftHandlePosX - posX) <= + SelectionHandler.SELECTION_OFFSET; + } + + _isOnRightHandle(posX) { + return Math.abs(this._rightHandlePosX - posX) <= + SelectionHandler.SELECTION_OFFSET; + } + + _handleTimeSelectionMouseDown(event) { + if (event.button !== 0) return; + let xPosition = event.clientX + // Update origin time in case we click on a handle. + if (this._isOnLeftHandle(xPosition)) { + xPosition = this._rightHandlePosX; + } + else if (this._isOnRightHandle(xPosition)) { + xPosition = this._leftHandlePosX; + } + this._selectionOriginTime = this.positionToTime(xPosition); + } + + _handleTimeSelectionMouseMove(event) { + if (event.button !== 0) return; + if (!this.isSelecting) return; + const currentTime = this.positionToTime(event.clientX); + this._timeline.dispatchEvent(new SynchronizeSelectionEvent( + Math.min(this._selectionOriginTime, currentTime), + Math.max(this._selectionOriginTime, currentTime))); + } + + _handleTimeSelectionMouseUp(event) { + if (event.button !== 0) return; + this._selectionOriginTime = -1; + if (this._timeSelection.start === -1) return; + const delta = this._timeSelection.end - this._timeSelection.start; + if (delta <= 1 || isNaN(delta)) return; + this._timeline.dispatchEvent(new SelectTimeEvent( + this._timeSelection.start, this._timeSelection.end)); + } +} + +class Legend { + _timeline; + _typesFilters = new Map(); + _typeClickHandler = this._handleTypeClick.bind(this); + _filterPredicate = this.filter.bind(this); + onFilter = () => {}; + + constructor(table) { + this._table = table; + this._enableDuration = false; + } + + set timeline(timeline) { + this._timeline = timeline; + const groups = timeline.getBreakdown(); + this._typesFilters = new Map(groups.map(each => [each.key, true])); + this._colors = + new Map(groups.map(each => [each.key, CSSColor.at(each.id)])); + } + + get selection() { + return this._timeline.selectionOrSelf; + } + + get filterPredicate() { + for (let visible of this._typesFilters.values()) { + if (!visible) return this._filterPredicate; + } + return undefined; + } + + colorForType(type) { + let color = this._colors.get(type); + if (color === undefined) { + color = CSSColor.at(this._colors.size); + this._colors.set(type, color); + } + return color; + } + + filter(logEntry) { + return this._typesFilters.get(logEntry.type); + } + + update() { + const tbody = DOM.tbody(); + const missingTypes = new Set(this._typesFilters.keys()); + this._checkDurationField(); + this.selection.getBreakdown(undefined, this._enableDuration) + .forEach(group => { + tbody.appendChild(this._addTypeRow(group)); + missingTypes.delete(group.key); + }); + missingTypes.forEach(key => tbody.appendChild(this._row('', key, 0, '0%'))); + if (this._timeline.selection) { + tbody.appendChild( + this._row('', 'Selection', this.selection.length, '100%')); + } + tbody.appendChild(this._row('', 'All', this._timeline.length, '')); + this._table.tBodies[0].replaceWith(tbody); + } + + _checkDurationField() { + if (this._enableDuration) return; + const example = this.selection.at(0); + if (!example || !('duration' in example)) return; + this._enableDuration = true; + this._table.tHead.appendChild(DOM.td('Duration')); + this._table.tHead.appendChild(DOM.td('')); + } + + _row(colorNode, type, count, countPercent, duration, durationPercent) { + const row = DOM.tr(); + row.appendChild(DOM.td(colorNode)); + const typeCell = row.appendChild(DOM.td(type)); + typeCell.setAttribute('title', type); + row.appendChild(DOM.td(count.toString())); + row.appendChild(DOM.td(countPercent)); + if (this._enableDuration) { + row.appendChild(DOM.td(formatDurationMicros(duration ?? 0))); + row.appendChild(DOM.td(durationPercent ?? '0%')); + } + return row + } + + _addTypeRow(group) { + const color = this.colorForType(group.key); + const colorDiv = DOM.div('colorbox'); + if (this._typesFilters.get(group.key)) { + colorDiv.style.backgroundColor = color; + } else { + colorDiv.style.borderColor = color; + colorDiv.style.backgroundColor = CSSColor.backgroundImage; + } + let duration = 0; + if (this._enableDuration) { + const entries = group.entries; + for (let i = 0; i < entries.length; i++) { + duration += entries[i].duration; + } + } + let countPercent = + `${(group.length / this.selection.length * 100).toFixed(1)}%`; + const row = this._row( + colorDiv, group.key, group.length, countPercent, duration, ''); + row.className = 'clickable'; + row.onclick = this._typeClickHandler; + row.data = group.key; + return row; + } + + _handleTypeClick(e) { + const type = e.currentTarget.data; + this._typesFilters.set(type, !this._typesFilters.get(type)); + this.onFilter(type); + } +} diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-map.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-map.mjs new file mode 100644 index 00000000000000..639acc03123bb7 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-map.mjs @@ -0,0 +1,138 @@ +// 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. + +import {kChunkVisualWidth, MapLogEntry} from '../../log/map.mjs'; +import {CSSColor, DOM} from '../helper.mjs'; + +import {TimelineTrackBase} from './timeline-track-base.mjs' + +DOM.defineCustomElement('view/timeline/timeline-track', 'timeline-track-map', + (templateText) => + class TimelineTrackMap extends TimelineTrackBase { + constructor() { + super(templateText); + } + + getMapStyle(map) { + return map.edge && map.edge.from ? CSSColor.onBackgroundColor : + CSSColor.onPrimaryColor; + } + + markMap(map) { + const [x, y] = map.position(this.chunks); + const strokeColor = this.getMapStyle(map); + return `` + } + + markSelectedMap(map) { + const [x, y] = map.position(this.chunks); + const strokeColor = this.getMapStyle(map); + return `` + } + + _drawAnnotations(logEntry, time) { + if (!(logEntry instanceof MapLogEntry)) return; + if (!logEntry.edge) { + this.timelineAnnotationsNode.innerHTML = ''; + return; + } + // Draw the trace of maps in reverse order to make sure the outgoing + // transitions of previous maps aren't drawn over. + const kOpaque = 1.0; + let stack = []; + let current = logEntry; + while (current !== undefined) { + stack.push(current); + current = current.parent; + } + + // Draw outgoing refs as fuzzy background. Skip the last map entry. + let buffer = ''; + let nofEdges = 0; + const kMaxOutgoingEdges = 100; + for (let i = stack.length - 2; i >= 0; i--) { + const map = stack[i].parent; + nofEdges += map.children.length; + if (nofEdges > kMaxOutgoingEdges) break; + buffer += this.drawOutgoingEdges(map, 0.4, 1); + } + + // Draw main connection. + let labelOffset = 15; + let xPrev = 0; + for (let i = stack.length - 1; i >= 0; i--) { + let map = stack[i]; + if (map.edge) { + const [xTo, data] = this.drawEdge(map.edge, kOpaque, labelOffset); + buffer += data; + if (xTo == xPrev) { + labelOffset += 10; + } else { + labelOffset = 15 + } + xPrev = xTo; + } + buffer += this.markMap(map); + } + + buffer += this.drawOutgoingEdges(logEntry, 0.9, 3); + // Mark selected map + buffer += this.markSelectedMap(logEntry); + this.timelineAnnotationsNode.innerHTML = buffer; + } + + drawEdge(edge, opacity, labelOffset = 20) { + let buffer = ''; + if (!edge.from || !edge.to) return [-1, buffer]; + const [xFrom, yFrom] = edge.from.position(this.chunks); + const [xTo, yTo] = edge.to.position(this.chunks); + const sameChunk = xTo == xFrom; + if (sameChunk) labelOffset += 10; + const color = this._legend.colorForType(edge.type); + const offsetX = 20; + const midX = xFrom + (xTo - xFrom) / 2; + const midY = (yFrom + yTo) / 2 - 100; + if (!sameChunk) { + if (opacity == 1.0) { + buffer += `` + } + buffer += `` + } else { + if (opacity == 1.0) { + buffer += ``; + } + buffer += ``; + } + if (opacity == 1.0) { + const centerX = sameChunk ? xTo : ((xFrom / 2 + midX + xTo / 2) / 2) | 0; + const centerY = sameChunk ? yTo : ((yFrom / 2 + midY + yTo / 2) / 2) | 0; + const centerYTo = centerY - labelOffset; + buffer += ``; + buffer += `${ + edge.toString()}`; + } + return [xTo, buffer]; + } + + drawOutgoingEdges(map, opacity = 1.0, max = 10, depth = 0) { + let buffer = ''; + if (!map || depth >= max) return buffer; + const limit = Math.min(map.children.length, 100) + for (let i = 0; i < limit; i++) { + const edge = map.children[i]; + const [xTo, data] = this.drawEdge(edge, opacity); + buffer += data; + buffer += this.drawOutgoingEdges(edge.to, opacity * 0.5, max, depth + 1); + } + return buffer; + } +}) \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-stacked-base.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-stacked-base.mjs new file mode 100644 index 00000000000000..24b389b95965d5 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-stacked-base.mjs @@ -0,0 +1,144 @@ +// 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. + +import {delay} from '../../helper.mjs'; +import {Timeline} from '../../timeline.mjs'; +import {SelectTimeEvent} from '../events.mjs'; +import {CSSColor, DOM, SVG} from '../helper.mjs'; + +import {TimelineTrackBase} from './timeline-track-base.mjs' + +const kItemHeight = 8; + +export class TimelineTrackStackedBase extends TimelineTrackBase { + _originalContentWidth = 0; + _drawableItems = new Timeline(); + + _updateChunks() { + // We don't need to update the chunks here. + this._updateDimensions(); + this.requestUpdate(); + } + + set data(timeline) { + super.data = timeline; + this._contentWidth = 0; + this._prepareDrawableItems(); + } + + _handleDoubleClick(event) { + if (event.button !== 0) return; + this._selectionHandler.clearSelection(); + const item = this._getDrawableItemForEvent(event); + if (item === undefined) return; + event.stopImmediatePropagation(); + this.dispatchEvent(new SelectTimeEvent(item.startTime, item.endTime)); + return false; + } + + _getStackDepthForEvent(event) { + return Math.floor(event.layerY / kItemHeight) - 1; + } + + _getDrawableItemForEvent(event) { + const depth = this._getStackDepthForEvent(event); + const time = this.positionToTime(event.pageX); + const index = this._drawableItems.find(time); + for (let i = index - 1; i > 0; i--) { + const item = this._drawableItems.at(i); + if (item.depth != depth) continue; + if (item.endTime < time) continue; + return item; + } + return undefined; + } + + _drawableItemToLogEntry(item) { + return item; + } + + _getEntryForEvent(event) { + const item = this._getDrawableItemForEvent(event); + const logEntry = this._drawableItemToLogEntry(item); + if (item === undefined) return undefined; + const style = this.toolTipTargetNode.style; + style.left = `${event.layerX}px`; + style.top = `${(item.depth + 1) * kItemHeight}px`; + style.height = `${kItemHeight}px` + return logEntry; + } + + _prepareDrawableItems() { + // Subclass responsibility. + } + + _adjustStackDepth(maxDepth) { + // Account for empty top line + maxDepth++; + this._adjustHeight(maxDepth * kItemHeight); + } + + _scaleContent(currentWidth) { + if (this._originalContentWidth == 0) return; + // Instead of repainting just scale the content. + const ratio = currentWidth / this._originalContentWidth; + this._scalableContentNode.style.transform = `scale(${ratio}, 1)`; + this.style.setProperty('--txt-scale', `scale(${1 / ratio}, 1)`); + } + + async _drawContent() { + if (this._originalContentWidth > 0) return; + this._originalContentWidth = parseInt(this.timelineMarkersNode.style.width); + this._scalableContentNode.innerHTML = ''; + let buffer = ''; + const add = async () => { + const svg = SVG.svg(); + svg.innerHTML = buffer; + this._scalableContentNode.appendChild(svg); + buffer = ''; + await delay(50); + }; + const items = this._drawableItems.values; + for (let i = 0; i < items.length; i++) { + if ((i % 3000) == 0) await add(); + buffer += this._drawItem(items[i], i); + } + add(); + } + + _drawItem(item, i, outline = false) { + const x = this.timeToPosition(item.time); + const y = (item.depth + 1) * kItemHeight; + let width = item.duration * this._timeToPixel; + if (outline) { + return ``; + } + let color = this._legend.colorForType(item.type); + if (i % 2 == 1) { + color = CSSColor.darken(color, 20); + } + return ``; + } + + _drawItemText(item) { + const type = item.type; + const kHeight = 9; + const x = this.timeToPosition(item.time); + const y = item.depth * (kHeight + 1); + let width = item.duration * this._timeToPixel; + width -= width * 0.1; + + let buffer = ''; + if (width < 15 || type == 'Other') return buffer; + const rawName = item.entry.getName(); + if (rawName.length == 0) return buffer; + const kChartWidth = 5; + const maxChars = Math.floor(width / kChartWidth) + const text = rawName.substr(0, maxChars); + buffer += `${text}` + return buffer; + } +} \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html index bcab2d53490595..911476360656d2 100644 --- a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-template.html @@ -6,61 +6,37 @@ +
    @@ -180,23 +206,29 @@

    -
    +
    -
    Frequency
    -
    - + + + + + +
    + +
    + - + diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-tick.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-tick.mjs new file mode 100644 index 00000000000000..502504beb485f4 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-tick.mjs @@ -0,0 +1,201 @@ +// 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. + +import {delay} from '../../helper.mjs'; +import {TickLogEntry} from '../../log/tick.mjs'; +import {Timeline} from '../../timeline.mjs'; +import {DOM, SVG} from '../helper.mjs'; + +import {TimelineTrackStackedBase} from './timeline-track-stacked-base.mjs' + +class Flame { + constructor(time, logEntry, depth) { + this._time = time; + this._logEntry = logEntry; + this.depth = depth; + this._duration = -1; + this.parent = undefined; + this.children = []; + } + + static add(time, logEntry, stack, flames) { + const depth = stack.length; + const newFlame = new Flame(time, logEntry, depth) + if (depth > 0) { + const parent = stack[depth - 1]; + newFlame.parent = parent; + parent.children.push(newFlame); + } + flames.push(newFlame); + stack.push(newFlame); + } + + stop(time) { + if (this._duration !== -1) throw new Error('Already stopped'); + this._duration = time - this._time + } + + get time() { + return this._time; + } + + get logEntry() { + return this._logEntry; + } + + get startTime() { + return this._time; + } + + get endTime() { + return this._time + this._duration; + } + + get duration() { + return this._duration; + } + + get type() { + return TickLogEntry.extractCodeEntryType(this._logEntry?.entry); + } +} + +DOM.defineCustomElement( + 'view/timeline/timeline-track', 'timeline-track-tick', + (templateText) => class TimelineTrackTick extends TimelineTrackStackedBase { + constructor() { + super(templateText); + this._annotations = new Annotations(this); + } + + _prepareDrawableItems() { + const tmpFlames = []; + // flameStack = [bottom, ..., top]; + const flameStack = []; + const ticks = this._timeline.values; + let maxDepth = 0; + + for (let tickIndex = 0; tickIndex < ticks.length; tickIndex++) { + const tick = ticks[tickIndex]; + const tickStack = tick.stack; + maxDepth = Math.max(maxDepth, tickStack.length); + // tick.stack = [top, .... , bottom]; + for (let stackIndex = tickStack.length - 1; stackIndex >= 0; + stackIndex--) { + const codeEntry = tickStack[stackIndex]; + // codeEntry is either a CodeEntry or a raw pc. + const logEntry = codeEntry?.logEntry; + const flameStackIndex = tickStack.length - stackIndex - 1; + if (flameStackIndex < flameStack.length) { + if (flameStack[flameStackIndex].logEntry === logEntry) continue; + for (let k = flameStackIndex; k < flameStack.length; k++) { + flameStack[k].stop(tick.time); + } + flameStack.length = flameStackIndex; + } + Flame.add(tick.time, logEntry, flameStack, tmpFlames); + } + if (tickStack.length < flameStack.length) { + for (let k = tickStack.length; k < flameStack.length; k++) { + flameStack[k].stop(tick.time); + } + flameStack.length = tickStack.length; + } + } + const lastTime = ticks[ticks.length - 1].time; + for (let k = 0; k < flameStack.length; k++) { + flameStack[k].stop(lastTime); + } + this._drawableItems = new Timeline(Flame, tmpFlames); + this._annotations.flames = this._drawableItems; + this._adjustStackDepth(maxDepth); + } + + _drawAnnotations(logEntry, time) { + if (time === undefined) { + time = this.relativePositionToTime(this._timelineScrollLeft); + } + this._annotations.update(logEntry, time); + } + + _drawableItemToLogEntry(flame) { + const logEntry = flame?.logEntry; + if (logEntry === undefined || typeof logEntry == 'number') + return undefined; + return logEntry; + } + }) + +class Annotations { + _flames; + _logEntry; + _buffer; + + constructor(track) { + this._track = track; + } + + set flames(flames) { + this._flames = flames; + } + + get _node() { + return this._track.timelineAnnotationsNode; + } + + async update(logEntry, time) { + if (this._logEntry == logEntry) return; + this._logEntry = logEntry; + this._node.innerHTML = ''; + if (logEntry === undefined) return; + this._buffer = ''; + const start = this._flames.find(time); + let offset = 0; + // Draw annotations gradually outwards starting form the given time. + let deadline = performance.now() + 500; + for (let range = 0; range < this._flames.length; range += 10000) { + this._markFlames(start - range, start - offset); + this._markFlames(start + offset, start + range); + offset = range; + if ((navigator?.scheduling?.isInputPending({includeContinuous: true}) ?? + false) || + performance.now() >= deadline) { + // Yield if we have to handle an input event, or we're out of time. + await delay(50); + // Abort if we started another update asynchronously. + if (this._logEntry != logEntry) return; + + deadline = performance.now() + 500; + } + this._drawBuffer(); + } + this._drawBuffer(); + } + + _markFlames(start, end) { + const rawFlames = this._flames.values; + if (start < 0) start = 0; + if (end > rawFlames.length) end = rawFlames.length; + const logEntry = this._logEntry; + // Also compare against the function, if any. + const func = logEntry.entry?.func; + for (let i = start; i < end; i++) { + const flame = rawFlames[i]; + if (!flame.entry) continue; + if (flame.entry.logEntry !== logEntry && + (!func || flame.entry.func !== func)) { + continue; + } + this._buffer += this._track.drawFlame(flame, i, true); + } + } + + _drawBuffer() { + if (this._buffer.length == 0) return; + const svg = SVG.svg(); + svg.innerHTML = this._buffer; + this._node.appendChild(svg); + this._buffer = ''; + } +} \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track-timer.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-timer.mjs new file mode 100644 index 00000000000000..62ee07aff7d2d7 --- /dev/null +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track-timer.mjs @@ -0,0 +1,41 @@ +// 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. + +import {CSSColor, DOM, SVG, V8CustomElement} from '../helper.mjs'; + +import {TimelineTrackBase} from './timeline-track-base.mjs' +import {TimelineTrackStackedBase} from './timeline-track-stacked-base.mjs' + +DOM.defineCustomElement( + 'view/timeline/timeline-track', 'timeline-track-timer', + (templateText) => + class TimelineTrackTimer extends TimelineTrackStackedBase { + constructor() { + super(templateText); + } + + _prepareDrawableItems() { + const stack = []; + let maxDepth = 0; + for (let i = 0; i < this._timeline.length; i++) { + const timer = this._timeline.at(i); + let insertDepth = -1; + for (let depth = 0; depth < stack.length; depth++) { + const pendingTimer = stack[depth]; + if (pendingTimer === undefined) { + if (insertDepth === -1) insertDepth = depth; + } else if (pendingTimer.endTime <= timer.startTime) { + stack[depth] == undefined; + if (insertDepth === -1) insertDepth = depth; + } + } + if (insertDepth === -1) insertDepth = stack.length; + stack[insertDepth] = timer; + timer.depth = insertDepth; + maxDepth = Math.max(maxDepth, insertDepth); + } + this._drawableItems = this._timeline; + this._adjustStackDepth(maxDepth++); + } + }); \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs b/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs index 6f05b772d81c1b..8952afc182f2af 100644 --- a/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs +++ b/deps/v8/tools/system-analyzer/view/timeline/timeline-track.mjs @@ -1,605 +1,15 @@ -// Copyright 2020 the V8 project authors. All rights reserved. +// 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. -import {kChunkHeight, kChunkWidth} from '../../log/map.mjs'; -import {MapLogEntry} from '../../log/map.mjs'; -import {FocusEvent, SelectionEvent, SelectTimeEvent, SynchronizeSelectionEvent, ToolTipEvent,} from '../events.mjs'; -import {CSSColor, DOM, gradientStopsFromGroups, V8CustomElement} from '../helper.mjs'; +import {CSSColor, DOM, SVG, V8CustomElement} from '../helper.mjs'; -DOM.defineCustomElement('view/timeline/timeline-track', - (templateText) => - class TimelineTrack extends V8CustomElement { - _timeline; - _nofChunks = 400; - _chunks; - _selectedEntry; - _timeToPixel; - _timeStartOffset; - _legend; +import {TimelineTrackBase} from './timeline-track-base.mjs' - _chunkMouseMoveHandler = this._handleChunkMouseMove.bind(this); - _chunkClickHandler = this._handleChunkClick.bind(this); - _chunkDoubleClickHandler = this._handleChunkDoubleClick.bind(this); - - constructor() { - super(templateText); - this._selectionHandler = new SelectionHandler(this); - this._legend = new Legend(this.$('#legendTable')); - this._legend.onFilter = (type) => this._handleFilterTimeline(); - this.timelineNode.addEventListener( - 'scroll', e => this._handleTimelineScroll(e)); - this.timelineNode.ondblclick = (e) => - this._selectionHandler.clearSelection(); - this.isLocked = false; - } - - static get observedAttributes() { - return ['title']; - } - - attributeChangedCallback(name, oldValue, newValue) { - if (name == 'title') { - this.$('#title').innerHTML = newValue; - } - } - - _handleFilterTimeline(type) { - this._updateChunks(); - } - - set data(timeline) { - this._timeline = timeline; - this._legend.timeline = timeline; - this.$('.content').style.display = timeline.isEmpty() ? 'none' : 'relative'; - this._updateChunks(); - } - - set timeSelection(selection) { - this._selectionHandler.timeSelection = selection; - this.updateSelection(); - } - - updateSelection() { - this._selectionHandler.update(); - this._legend.update(); - } - - // Maps the clicked x position to the x position on timeline canvas - positionOnTimeline(posX) { - let rect = this.timelineNode.getBoundingClientRect(); - let posClickedX = posX - rect.left + this.timelineNode.scrollLeft; - return posClickedX; - } - - positionToTime(posX) { - let posTimelineX = this.positionOnTimeline(posX) + this._timeStartOffset; - return posTimelineX / this._timeToPixel; - } - - timeToPosition(time) { - let posX = time * this._timeToPixel; - posX -= this._timeStartOffset; - return posX; - } - - get timelineCanvas() { - return this.$('#timelineCanvas'); - } - - get timelineChunks() { - return this.$('#timelineChunks'); - } - - get timelineNode() { - return this.$('#timeline'); - } - - _update() { - this._updateTimeline(); - this._legend.update(); - } - - set nofChunks(count) { - this._nofChunks = count; - this._updateChunks(); - } - - get nofChunks() { - return this._nofChunks; - } - - _updateChunks() { - this._chunks = - this._timeline.chunks(this.nofChunks, this._legend.filterPredicate); - this.requestUpdate(); - } - - get chunks() { - return this._chunks; - } - - set selectedEntry(value) { - this._selectedEntry = value; - if (value.edge) this.redraw(); - } - - get selectedEntry() { - return this._selectedEntry; - } - - set scrollLeft(offset) { - this.timelineNode.scrollLeft = offset; - } - - handleEntryTypeDoubleClick(e) { - this.dispatchEvent(new SelectionEvent(e.target.parentNode.entries)); - } - - timelineIndicatorMove(offset) { - this.timelineNode.scrollLeft += offset; - } - - _handleTimelineScroll(e) { - let horizontal = e.currentTarget.scrollLeft; - this.dispatchEvent(new CustomEvent( - 'scrolltrack', {bubbles: true, composed: true, detail: horizontal})); - } - - _createBackgroundImage(chunk) { - const stops = gradientStopsFromGroups( - chunk.length, chunk.height, chunk.getBreakdown(event => event.type), - type => this._legend.colorForType(type)); - return `linear-gradient(0deg,${stops.join(',')})`; - } - - _updateTimeline() { - const reusableNodes = Array.from(this.timelineChunks.childNodes).reverse(); - let fragment = new DocumentFragment(); - let chunks = this.chunks; - let max = chunks.max(each => each.size()); - let start = this._timeline.startTime; - let end = this._timeline.endTime; - let duration = end - start; - this._timeToPixel = chunks.length * kChunkWidth / duration; - this._timeStartOffset = start * this._timeToPixel; - for (let i = 0; i < chunks.length; i++) { - let chunk = chunks[i]; - let height = (chunk.size() / max * kChunkHeight); - chunk.height = height; - if (chunk.isEmpty()) continue; - let node = reusableNodes[reusableNodes.length - 1]; - let reusedNode = false; - if (node?.className == 'chunk') { - reusableNodes.pop(); - reusedNode = true; - } else { - node = DOM.div('chunk'); - node.onmousemove = this._chunkMouseMoveHandler; - node.onclick = this._chunkClickHandler; - node.ondblclick = this._chunkDoubleClickHandler; - } - const style = node.style; - style.left = `${i * kChunkWidth}px`; - style.height = `${height | 0}px`; - style.backgroundImage = this._createBackgroundImage(chunk); - node.chunk = chunk; - if (!reusedNode) fragment.appendChild(node); - } - - // Put a time marker roughly every 20 chunks. - let expected = duration / chunks.length * 20; - let interval = (10 ** Math.floor(Math.log10(expected))); - let correction = Math.log10(expected / interval); - correction = (correction < 0.33) ? 1 : (correction < 0.75) ? 2.5 : 5; - interval *= correction; - - let time = start; - while (time < end) { - let timeNode = DOM.div('timestamp'); - timeNode.innerText = `${((time - start) / 1000) | 0} ms`; - timeNode.style.left = `${((time - start) * this._timeToPixel) | 0}px`; - fragment.appendChild(timeNode); - time += interval; - } - - // Remove superfluos nodes lazily, for Chrome this is a very expensive - // operation. - if (reusableNodes.length > 0) { - for (const node of reusableNodes) { - node.style.display = 'none'; +DOM.defineCustomElement( + 'view/timeline/timeline-track', + (templateText) => class TimelineTrack extends TimelineTrackBase { + constructor() { + super(templateText); } - setTimeout(() => { - const range = document.createRange(); - const first = reusableNodes[reusableNodes.length - 1]; - const last = reusableNodes[0]; - range.setStartBefore(first); - range.setEndAfter(last); - range.deleteContents(); - }, 100); - } - this.timelineChunks.appendChild(fragment); - this.redraw(); - } - - _handleChunkMouseMove(event) { - if (this.isLocked) return false; - if (this._selectionHandler.isSelecting) return false; - let chunk = event.target.chunk; - if (!chunk) return; - if (chunk.isEmpty()) return; - // topmost map (at chunk.height) == map #0. - let relativeIndex = Math.round( - event.layerY / event.target.offsetHeight * (chunk.size() - 1)); - let logEntry = chunk.at(relativeIndex); - this.dispatchEvent(new FocusEvent(logEntry)); - this.dispatchEvent(new ToolTipEvent(logEntry.toStringLong(), event.target)); - } - - _handleChunkClick(event) { - this.isLocked = !this.isLocked; - } - - _handleChunkDoubleClick(event) { - let chunk = event.target.chunk; - if (!chunk) return; - event.stopPropagation(); - this.dispatchEvent(new SelectTimeEvent(chunk.start, chunk.end)); - } - - redraw() { - window.requestAnimationFrame(() => this._redraw()); - } - - _redraw() { - if (!(this._timeline.at(0) instanceof MapLogEntry)) return; - let canvas = this.timelineCanvas; - let width = (this.chunks.length + 1) * kChunkWidth; - if (width > 32767) width = 32767; - canvas.width = width; - canvas.height = kChunkHeight; - let ctx = canvas.getContext('2d'); - ctx.clearRect(0, 0, canvas.width, kChunkHeight); - if (!this.selectedEntry || !this.selectedEntry.edge) return; - this.drawEdges(ctx); - } - - setMapStyle(map, ctx) { - ctx.fillStyle = map.edge && map.edge.from ? CSSColor.onBackgroundColor : - CSSColor.onPrimaryColor; - } - - setEdgeStyle(edge, ctx) { - let color = this._legend.colorForType(edge.type); - ctx.strokeStyle = color; - ctx.fillStyle = color; - } - - markMap(ctx, map) { - let [x, y] = map.position(this.chunks); - ctx.beginPath(); - this.setMapStyle(map, ctx); - ctx.arc(x, y, 3, 0, 2 * Math.PI); - ctx.fill(); - ctx.beginPath(); - ctx.fillStyle = CSSColor.onBackgroundColor; - ctx.arc(x, y, 2, 0, 2 * Math.PI); - ctx.fill(); - } - - markSelectedMap(ctx, map) { - let [x, y] = map.position(this.chunks); - ctx.beginPath(); - this.setMapStyle(map, ctx); - ctx.arc(x, y, 6, 0, 2 * Math.PI); - ctx.strokeStyle = CSSColor.onBackgroundColor; - ctx.stroke(); - } - - drawEdges(ctx) { - // Draw the trace of maps in reverse order to make sure the outgoing - // transitions of previous maps aren't drawn over. - const kMaxOutgoingEdges = 100; - let nofEdges = 0; - let stack = []; - let current = this.selectedEntry; - while (current && nofEdges < kMaxOutgoingEdges) { - nofEdges += current.children.length; - stack.push(current); - current = current.parent(); - } - ctx.save(); - this.drawOutgoingEdges(ctx, this.selectedEntry, 3); - ctx.restore(); - - let labelOffset = 15; - let xPrev = 0; - while (current = stack.pop()) { - if (current.edge) { - this.setEdgeStyle(current.edge, ctx); - let [xTo, yTo] = this.drawEdge(ctx, current.edge, true, labelOffset); - if (xTo == xPrev) { - labelOffset += 8; - } else { - labelOffset = 15 - } - xPrev = xTo; - } - this.markMap(ctx, current); - current = current.parent(); - ctx.save(); - // this.drawOutgoingEdges(ctx, current, 1); - ctx.restore(); - } - // Mark selected map - this.markSelectedMap(ctx, this.selectedEntry); - } - - drawEdge(ctx, edge, showLabel = true, labelOffset = 20) { - if (!edge.from || !edge.to) return [-1, -1]; - let [xFrom, yFrom] = edge.from.position(this.chunks); - let [xTo, yTo] = edge.to.position(this.chunks); - let sameChunk = xTo == xFrom; - if (sameChunk) labelOffset += 8; - - ctx.beginPath(); - ctx.moveTo(xFrom, yFrom); - let offsetX = 20; - let offsetY = 20; - let midX = xFrom + (xTo - xFrom) / 2; - let midY = (yFrom + yTo) / 2 - 100; - if (!sameChunk) { - ctx.quadraticCurveTo(midX, midY, xTo, yTo); - } else { - ctx.lineTo(xTo, yTo); - } - if (!showLabel) { - ctx.stroke(); - } else { - let centerX, centerY; - if (!sameChunk) { - centerX = (xFrom / 2 + midX + xTo / 2) / 2; - centerY = (yFrom / 2 + midY + yTo / 2) / 2; - } else { - centerX = xTo; - centerY = yTo; - } - ctx.moveTo(centerX, centerY); - ctx.lineTo(centerX + offsetX, centerY - labelOffset); - ctx.stroke(); - ctx.textAlign = 'left'; - ctx.fillStyle = this._legend.colorForType(edge.type); - ctx.fillText( - edge.toString(), centerX + offsetX + 2, centerY - labelOffset); - } - return [xTo, yTo]; - } - - drawOutgoingEdges(ctx, map, max = 10, depth = 0) { - if (!map) return; - if (depth >= max) return; - ctx.globalAlpha = 0.5 - depth * (0.3 / max); - ctx.strokeStyle = CSSColor.timelineBackgroundColor; - const limit = Math.min(map.children.length, 100) - for (let i = 0; i < limit; i++) { - let edge = map.children[i]; - this.drawEdge(ctx, edge, true); - this.drawOutgoingEdges(ctx, edge.to, max, depth + 1); - } - } -}); - -class SelectionHandler { - // TODO turn into static field once Safari supports it. - static get SELECTION_OFFSET() { - return 10 - }; - - _timeSelection = {start: -1, end: Infinity}; - _selectionOriginTime = -1; - - constructor(timeline) { - this._timeline = timeline; - this._timelineNode.addEventListener( - 'mousedown', e => this._handleTimeSelectionMouseDown(e)); - this._timelineNode.addEventListener( - 'mouseup', e => this._handleTimeSelectionMouseUp(e)); - this._timelineNode.addEventListener( - 'mousemove', e => this._handleTimeSelectionMouseMove(e)); - } - - update() { - if (!this.hasSelection) { - this._selectionNode.style.display = 'none'; - return; - } - this._selectionNode.style.display = 'inherit'; - const startPosition = this.timeToPosition(this._timeSelection.start); - const endPosition = this.timeToPosition(this._timeSelection.end); - this._leftHandleNode.style.left = startPosition + 'px'; - this._rightHandleNode.style.left = endPosition + 'px'; - const delta = endPosition - startPosition; - const selectionNode = this._selectionBackgroundNode; - selectionNode.style.left = startPosition + 'px'; - selectionNode.style.width = delta + 'px'; - } - - set timeSelection(selection) { - this._timeSelection.start = selection.start; - this._timeSelection.end = selection.end; - } - - clearSelection() { - this._timeline.dispatchEvent(new SelectTimeEvent()); - } - - timeToPosition(posX) { - return this._timeline.timeToPosition(posX); - } - - positionToTime(posX) { - return this._timeline.positionToTime(posX); - } - - get isSelecting() { - return this._selectionOriginTime >= 0; - } - - get hasSelection() { - return this._timeSelection.start >= 0 && - this._timeSelection.end != Infinity; - } - - get _timelineNode() { - return this._timeline.$('#timeline'); - } - - get _selectionNode() { - return this._timeline.$('#selection'); - } - - get _selectionBackgroundNode() { - return this._timeline.$('#selectionBackground'); - } - - get _leftHandleNode() { - return this._timeline.$('#leftHandle'); - } - - get _rightHandleNode() { - return this._timeline.$('#rightHandle'); - } - - get _leftHandlePosX() { - return this._leftHandleNode.getBoundingClientRect().x; - } - - get _rightHandlePosX() { - return this._rightHandleNode.getBoundingClientRect().x; - } - - _isOnLeftHandle(posX) { - return Math.abs(this._leftHandlePosX - posX) <= - SelectionHandler.SELECTION_OFFSET; - } - - _isOnRightHandle(posX) { - return Math.abs(this._rightHandlePosX - posX) <= - SelectionHandler.SELECTION_OFFSET; - } - - _handleTimeSelectionMouseDown(e) { - let xPosition = e.clientX - // Update origin time in case we click on a handle. - if (this._isOnLeftHandle(xPosition)) { - xPosition = this._rightHandlePosX; - } - else if (this._isOnRightHandle(xPosition)) { - xPosition = this._leftHandlePosX; - } - this._selectionOriginTime = this.positionToTime(xPosition); - } - - _handleTimeSelectionMouseMove(e) { - if (!this.isSelecting) return; - const currentTime = this.positionToTime(e.clientX); - this._timeline.dispatchEvent(new SynchronizeSelectionEvent( - Math.min(this._selectionOriginTime, currentTime), - Math.max(this._selectionOriginTime, currentTime))); - } - - _handleTimeSelectionMouseUp(e) { - this._selectionOriginTime = -1; - const delta = this._timeSelection.end - this._timeSelection.start; - if (delta <= 1 || isNaN(delta)) return; - this._timeline.dispatchEvent(new SelectTimeEvent( - this._timeSelection.start, this._timeSelection.end)); - } -} - -class Legend { - _timeline; - _typesFilters = new Map(); - _typeClickHandler = this._handleTypeClick.bind(this); - _filterPredicate = this.filter.bind(this); - onFilter = () => {}; - - constructor(table) { - this._table = table; - } - - set timeline(timeline) { - this._timeline = timeline; - const groups = timeline.getBreakdown(); - this._typesFilters = new Map(groups.map(each => [each.key, true])); - this._colors = - new Map(groups.map(each => [each.key, CSSColor.at(each.id)])); - } - - get selection() { - return this._timeline.selectionOrSelf; - } - - get filterPredicate() { - for (let visible of this._typesFilters.values()) { - if (!visible) return this._filterPredicate; - } - return undefined; - } - - colorForType(type) { - return this._colors.get(type); - } - - filter(logEntry) { - return this._typesFilters.get(logEntry.type); - } - - update() { - const tbody = DOM.tbody(); - const missingTypes = new Set(this._typesFilters.keys()); - this.selection.getBreakdown().forEach(group => { - tbody.appendChild(this._addTypeRow(group)); - missingTypes.delete(group.key); - }); - missingTypes.forEach(key => tbody.appendChild(this._row('', key, 0, '0%'))); - if (this._timeline.selection) { - tbody.appendChild( - this._row('', 'Selection', this.selection.length, '100%')); - } - tbody.appendChild(this._row('', 'All', this._timeline.length, '')); - this._table.tBodies[0].replaceWith(tbody); - } - - _row(color, type, count, percent) { - const row = DOM.tr(); - row.appendChild(DOM.td(color)); - row.appendChild(DOM.td(type)); - row.appendChild(DOM.td(count.toString())); - row.appendChild(DOM.td(percent)); - return row - } - - _addTypeRow(group) { - const color = this.colorForType(group.key); - const colorDiv = DOM.div('colorbox'); - if (this._typesFilters.get(group.key)) { - colorDiv.style.backgroundColor = color; - } else { - colorDiv.style.borderColor = color; - colorDiv.style.backgroundColor = CSSColor.backgroundImage; - } - let percent = `${(group.count / this.selection.length * 100).toFixed(1)}%`; - const row = this._row(colorDiv, group.key, group.count, percent); - row.className = 'clickable'; - row.onclick = this._typeClickHandler; - row.data = group.key; - return row; - } - - _handleTypeClick(e) { - const type = e.currentTarget.data; - this._typesFilters.set(type, !this._typesFilters.get(type)); - this.onFilter(type); - } -} \ No newline at end of file + }) \ No newline at end of file diff --git a/deps/v8/tools/system-analyzer/view/tool-tip-template.html b/deps/v8/tools/system-analyzer/view/tool-tip-template.html index dc56997825f6de..78fcca920a3cb7 100644 --- a/deps/v8/tools/system-analyzer/view/tool-tip-template.html +++ b/deps/v8/tools/system-analyzer/view/tool-tip-template.html @@ -11,14 +11,21 @@ } #content { - background-color: var(--surface-color); + background-color: rgba(var(--surface-color-rgb), 0.8); border: 3px var(--primary-color) solid; border-radius: 10px; + padding: 10px; + width: auto; min-width: 100px; + max-width: 400px; min-height: 100px; - padding: 10px; + max-height: 400px; + overflow: auto; box-shadow: 0px 0px 10px rgba(0,0,0,0.5); - width: auto; + } + + #content > h3 { + margin-top: 0; } .textContent { @@ -32,9 +39,10 @@ #body { display: none; position: absolute; + z-index: 99999; --tip-offset: 10px; --tip-width: 10px; - --tip-height: 15px; + --tip-height: 40px; } #body.top { @@ -50,33 +58,56 @@ left: calc(var(--tip-offset) * -1 - var(--tip-width)); } - .tip { + .tip, .tipThin { width: 0; height: 0; border-style: solid; position: absolute; - border-width: var(--tip-height) var(--tip-width) 0 var(--tip-width); border-color: var(--primary-color) transparent transparent transparent; pointer-events: none; } - + .tip { + border-width: var(--tip-width) var(--tip-width) 0 var(--tip-width); + } + .tipThin { + border-width: var(--tip-height) 4px 2px 4px; + bottom: -30px; + left: -4px; + } + /* Tip positioning modifiers */ .top > .tip { + bottom: calc(var(--tip-width) * -1); + } + .top > .tipThin { bottom: calc(var(--tip-height) * -1); } .bottom > .tip { + top: calc(var(--tip-width) * -1); + transform: scaleY(-1); + } + .bottom > .tipThin { top: calc(var(--tip-height) * -1); transform: scaleY(-1); } .left > .tip { right: var(--tip-offset); } + .left > .tipThin { + right: var(--tip-offset); + } .right > .tip { left: var(--tip-offset); } + .right > .tipThin { + left: var(--tip-offset); + }
    + +
    +
    +
    -
    diff --git a/deps/v8/tools/system-analyzer/view/tool-tip.mjs b/deps/v8/tools/system-analyzer/view/tool-tip.mjs index a01ee1bdbf6d38..5be98ae2147a84 100644 --- a/deps/v8/tools/system-analyzer/view/tool-tip.mjs +++ b/deps/v8/tools/system-analyzer/view/tool-tip.mjs @@ -9,6 +9,7 @@ DOM.defineCustomElement( _targetNode; _content; _isHidden = true; + constructor() { super(templateText); this._intersectionObserver = new IntersectionObserver((entries) => { @@ -19,7 +20,15 @@ DOM.defineCustomElement( this.requestUpdate(true); } }); - document.addEventListener('click', (e) => this.hide()); + document.addEventListener('click', (event) => { + // Only hide the tooltip if we click anywhere outside of it. + let target = event.target; + while (target) { + if (target == this) return; + target = target.parentNode; + } + this.hide() + }); } _update() { @@ -28,9 +37,7 @@ DOM.defineCustomElement( rect.x += rect.width / 2; let atRight = this._useRight(rect.x); let atBottom = this._useBottom(rect.y); - if (atBottom) { - rect.y += rect.height; - } + if (atBottom) rect.y += rect.height; this._setPosition(rect, atRight, atBottom); this.requestUpdate(true); } @@ -46,10 +53,11 @@ DOM.defineCustomElement( set targetNode(targetNode) { this._intersectionObserver.disconnect(); this._targetNode = targetNode; - if (targetNode) { + if (targetNode === undefined) return; + if (!(targetNode instanceof SVGElement)) { this._intersectionObserver.observe(targetNode); - this.requestUpdate(true); } + this.requestUpdate(true); } set position(position) { @@ -82,14 +90,27 @@ DOM.defineCustomElement( if (typeof content === 'string') { this.contentNode.innerHTML = content; this.contentNode.className = 'textContent'; + } else if (content?.nodeType && content?.nodeName) { + this._setContentNode(content); } else { - const newContent = DOM.div(); - newContent.appendChild(content); - this.contentNode.replaceWith(newContent); - newContent.id = 'content'; + if (this.contentNode.firstChild?.localName == 'property-link-table') { + this.contentNode.firstChild.propertyDict = content; + } else { + const node = DOM.element('property-link-table'); + node.instanceLinkButtons = true; + node.propertyDict = content; + this._setContentNode(node); + } } } + _setContentNode(content) { + const newContent = DOM.div(); + newContent.appendChild(content); + this.contentNode.replaceWith(newContent); + newContent.id = 'content'; + } + hide() { this._isHidden = true; this.bodyNode.style.display = 'none'; diff --git a/deps/v8/tools/testrunner/base_runner.py b/deps/v8/tools/testrunner/base_runner.py index 739a109a0c5346..cf5854c32ca3de 100644 --- a/deps/v8/tools/testrunner/base_runner.py +++ b/deps/v8/tools/testrunner/base_runner.py @@ -284,6 +284,11 @@ def execute(self, sys_args=None): # this less cryptic by printing it ourselves. print(' '.join(sys.argv)) + # TODO(machenbach): Print used Python version until we have switched to + # Python3 everywhere. + print('Running with:') + print(sys.version) + # Kill stray processes from previous tasks on swarming. util.kill_processes_linux() @@ -661,6 +666,12 @@ def _get_statusfile_variables(self, options): self.build_config.arch == 'mipsel': no_simd_hardware = not simd_mips + # S390 hosts without VEF1 do not support Simd. + if self.build_config.arch == 's390x' and \ + not self.build_config.simulator_run and \ + not utils.IsS390SimdSupported(): + no_simd_hardware = True + # Ppc64 processors earlier than POWER9 do not support Simd instructions if self.build_config.arch == 'ppc64' and \ not self.build_config.simulator_run and \ @@ -738,7 +749,7 @@ def _timeout_scalefactor(self, options): if self.build_config.predictable: factor *= 4 if self.build_config.tsan: - factor *= 1.5 + factor *= 2 if self.build_config.use_sanitizer: factor *= 1.5 if self.build_config.is_full_debug: diff --git a/deps/v8/tools/testrunner/local/statusfile.py b/deps/v8/tools/testrunner/local/statusfile.py index b6f97cd5641935..48b92869599a5e 100644 --- a/deps/v8/tools/testrunner/local/statusfile.py +++ b/deps/v8/tools/testrunner/local/statusfile.py @@ -46,6 +46,7 @@ FAIL_SLOPPY = "FAIL_SLOPPY" # Modifiers +HEAVY = "HEAVY" SKIP = "SKIP" SLOW = "SLOW" NO_VARIANTS = "NO_VARIANTS" @@ -54,8 +55,8 @@ ALWAYS = "ALWAYS" KEYWORDS = {} -for key in [SKIP, FAIL, PASS, CRASH, SLOW, FAIL_OK, NO_VARIANTS, FAIL_SLOPPY, - ALWAYS, FAIL_PHASE_ONLY]: +for key in [SKIP, FAIL, PASS, CRASH, HEAVY, SLOW, FAIL_OK, NO_VARIANTS, + FAIL_SLOPPY, ALWAYS, FAIL_PHASE_ONLY]: KEYWORDS[key] = key # Support arches, modes to be written as keywords instead of strings. diff --git a/deps/v8/tools/testrunner/local/utils.py b/deps/v8/tools/testrunner/local/utils.py index 94429a9fde9e45..05d1ef7d5e94f6 100644 --- a/deps/v8/tools/testrunner/local/utils.py +++ b/deps/v8/tools/testrunner/local/utils.py @@ -97,6 +97,18 @@ def GuessOS(): return None +# Check if Vector Enhancement Facility 1 is available on the +# host S390 machine. This facility is required for supporting Simd on V8. +def IsS390SimdSupported(): + import subprocess + cpuinfo = subprocess.check_output("cat /proc/cpuinfo", shell=True) + cpuinfo_list = cpuinfo.strip().decode("utf-8").splitlines() + facilities = "".join(x for x in cpuinfo_list if x.startswith("facilities")) + facilities_list = facilities.split(" ") + # Having bit 135 set indicates VEF1 is available. + return "135" in facilities_list + + # Returns power processor version, taking compatibility mode into account. # (Power9 running in Power8 compatibility mode returns 8) # Only useful if arch is ppc64 diff --git a/deps/v8/tools/testrunner/local/variants.py b/deps/v8/tools/testrunner/local/variants.py index e214de05404d74..1d39f6951ddfd5 100644 --- a/deps/v8/tools/testrunner/local/variants.py +++ b/deps/v8/tools/testrunner/local/variants.py @@ -16,7 +16,7 @@ "concurrent_inlining": [["--concurrent-inlining"]], "jitless": [["--jitless"]], "sparkplug": [["--sparkplug"]], - "always_sparkplug": [[ "--always-sparkplug" ]], + "always_sparkplug": [[ "--always-sparkplug", "--sparkplug"]], "minor_mc": [["--minor-mc"]], "no_lfa": [["--no-lazy-feedback-allocation"]], # No optimization means disable all optimizations. OptimizeFunctionOnNextCall @@ -30,7 +30,8 @@ "stress": [["--stress-opt", "--no-liftoff", "--stress-lazy-source-positions", "--no-wasm-generic-wrapper"]], "stress_concurrent_allocation": [["--stress-concurrent-allocation"]], - "stress_concurrent_inlining": [["--stress-concurrent-inlining"]], + "stress_concurrent_inlining": [["--stress-concurrent-inlining", + "--concurrent-inlining"]], "stress_js_bg_compile_wasm_code_gc": [["--stress-background-compile", "--stress-wasm-code-gc"]], "stress_incremental_marking": [["--stress-incremental-marking"]], @@ -40,7 +41,7 @@ "trusted": [["--no-untrusted-code-mitigations"]], "no_wasm_traps": [["--no-wasm-trap-handler"]], "turboprop": [["--turboprop"]], - "turboprop_as_toptier": [["--turboprop-as-toptier"]], + "turboprop_as_toptier": [["--turboprop-as-toptier", "--turboprop"]], "instruction_scheduling": [["--turbo-instruction-scheduling"]], "stress_instruction_scheduling": [["--turbo-stress-instruction-scheduling"]], "top_level_await": [["--harmony-top-level-await"]], @@ -51,33 +52,26 @@ # variant. This depends on the flags specified in ALL_VARIANT_FLAGS and on the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_VARIANT = { - "assert_types": ["--no-assert-types"], "jitless": ["--opt", "--always-opt", "--liftoff", "--track-field-types", "--validate-asm", "--sparkplug", "--always-sparkplug"], - "no_wasm_traps": ["--wasm-trap-handler"], - "nooptimization": ["--opt", "--always-opt", "--no-liftoff", - "--wasm-tier-up"], + "nooptimization": ["--always-opt"], "slow_path": ["--no-force-slow-path"], "stress_concurrent_allocation": ["--single-threaded-gc", "--predictable"], - "stress_concurrent_inlining": ["--single-threaded", "--predictable", - "--no-concurrent-inlining"], - "concurrent_inlining": ["--no-concurrent-inlining"], - "stress_incremental_marking": ["--no-stress-incremental-marking"], - "stress_js_bg_compile_wasm_code_gc": ["--no-stress-background-compile"], - "stress": ["--no-stress-opt", "--always-opt", "--no-always-opt", "--liftoff", + "stress_concurrent_inlining": ["--single-threaded", "--predictable"], + # The fast API tests initialize an embedder object that never needs to be + # serialized to the snapshot, so we don't have a + # SerializeInternalFieldsCallback for it, so they are incompatible with + # stress_snapshot. + "stress_snapshot": [["--turbo-fast-api-calls"]], + "stress": ["--always-opt", "--no-always-opt", "--max-inlined-bytecode-size=*", "--max-inlined-bytecode-size-cumulative=*", "--stress-inline", - "--wasm-generic-wrapper"], - "sparkplug": ["--jitless", "--no-sparkplug" ], - "always_sparkplug": ["--jitless", "--no-sparkplug", "--no-always-sparkplug"], - "turboprop": ["--interrupt-budget=*", "--no-turboprop"], - "turboprop_as_toptier": ["--interrupt-budget=*", "--no-turboprop", - "--no-turboprop-as-toptier"], + "--liftoff-only"], + "sparkplug": ["--jitless"], + "always_sparkplug": ["--jitless"], "code_serializer": ["--cache=after-execute", "--cache=full-code-cache", "--cache=none"], - "no_local_heaps": ["--concurrent-inlining", "--turboprop"], - "experimental_regexp": ["--no-enable-experimental-regexp-engine", - "--no-default-to-experimental-regexp-engine"], + "experimental_regexp": ["--no-enable-experimental-regexp-engine"], # There is a negative implication: --perf-prof disables # --wasm-write-protect-code-memory. "wasm_write_protect_code": ["--perf-prof"], @@ -89,12 +83,13 @@ # The conflicts might be directly contradictory flags or be caused by the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE = { - "lite_mode": ["--no-lazy-feedback-allocation", "--max-semi-space-size=*"] + "lite_mode": ["--no-lazy-feedback-allocation", "--max-semi-space-size=*", + "--stress-concurrent-inlining"] + INCOMPATIBLE_FLAGS_PER_VARIANT["jitless"], - "predictable": ["--liftoff", "--parallel-compile-tasks", + "predictable": ["--parallel-compile-tasks", "--concurrent-recompilation", - "--wasm-num-compilation-tasks=*", - "--stress-concurrent-allocation"], + "--stress-concurrent-allocation", + "--stress-concurrent-inlining"], } # Flags that lead to a contradiction when a certain extra-flag is present. @@ -103,20 +98,13 @@ # The conflicts might be directly contradictory flags or be caused by the # implications defined in flag-definitions.h. INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG = { - "--concurrent-inlining": - INCOMPATIBLE_FLAGS_PER_VARIANT["concurrent_inlining"], - "--concurrent-recompilation": ["--no-concurrent-recompilation", "--predictable"], - "--enable-armv8": ["--no-enable-armv8"], + "--concurrent-recompilation": ["--predictable"], "--gc-interval=*": ["--gc-interval=*"], - "--no-enable-sse3": ["--enable-sse3"], - "--no-enable-ssse3": ["--enable-ssse3"], - "--no-enable-sse4-1": ["--enable-sse4-1"], "--optimize-for-size": ["--max-semi-space-size=*"], - "--stress_concurrent_allocation": ["--single-threaded-gc", "--predictable"], + "--stress_concurrent_allocation": + INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_allocation"], "--stress-concurrent-inlining": INCOMPATIBLE_FLAGS_PER_VARIANT["stress_concurrent_inlining"], - "--stress-flush-bytecode": ["--no-stress-flush-bytecode"], - "--stress-incremental-marking": INCOMPATIBLE_FLAGS_PER_VARIANT["stress_incremental_marking"], } SLOW_VARIANTS = set([ diff --git a/deps/v8/tools/testrunner/objects/testcase.py b/deps/v8/tools/testrunner/objects/testcase.py index e037f996797256..a1f1754b22a47c 100644 --- a/deps/v8/tools/testrunner/objects/testcase.py +++ b/deps/v8/tools/testrunner/objects/testcase.py @@ -34,6 +34,7 @@ from ..local import command from ..local import statusfile from ..local import utils +from ..local.variants import ALL_VARIANT_FLAGS from ..local.variants import INCOMPATIBLE_FLAGS_PER_VARIANT from ..local.variants import INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE from ..local.variants import INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG @@ -46,8 +47,9 @@ RESOURCES_PATTERN = re.compile(r"//\s+Resources:(.*)") # Pattern to auto-detect files to push on Android for statements like: # load("path/to/file.js") +# d8.file.execute("path/to/file.js") LOAD_PATTERN = re.compile( - r"(?:load|readbuffer|read)\((?:'|\")([^'\"]+)(?:'|\")\)") + r"(?:execute|load|readbuffer|read)\((?:'|\")([^'\"]+)(?:'|\")\)") # Pattern to auto-detect files to push on Android for statements like: # import foobar from "path/to/file.js" # import {foo, bar} from "path/to/file.js" @@ -166,9 +168,30 @@ def allow_timeouts(self): @property def expected_outcomes(self): + def is_flag(maybe_flag): + return maybe_flag.startswith("--") # Best-effort heuristic. + + # Filter to flags, e.g.: ["--foo", "3", "--bar"] -> ["--foo", "--bar"]. + def filter_flags(normalized_flags): + return [f for f in normalized_flags if is_flag(f)]; + def normalize_flag(flag): return flag.replace("_", "-").replace("--no-", "--no") + def normalize_flags(flags): + return [normalize_flag(flag) for flag in filter_flags(flags)] + + # Note this can get it wrong if the flag name starts with the characters + # "--no" where "no" is part of the flag name, e.g. "--nobodys-perfect". + # In that case the negation "--bodys-perfect" would be returned. This is + # a weakness we accept and hope to never run into. + def negate_flag(normalized_flag): + return ("--" + normalized_flag[4:] if normalized_flag.startswith("--no") + else "--no" + normalized_flag[2:]) + + def negate_flags(normalized_flags): + return [negate_flag(flag) for flag in normalized_flags] + def has_flag(conflicting_flag, flags): conflicting_flag = normalize_flag(conflicting_flag) if conflicting_flag in flags: @@ -191,18 +214,31 @@ def check_flags(incompatible_flags, actual_flags, rule): file_specific_flags = (self._get_source_flags() + self._get_suite_flags() + self._get_statusfile_flags()) - file_specific_flags = [normalize_flag(flag) for flag in file_specific_flags] - extra_flags = [normalize_flag(flag) for flag in self._get_extra_flags()] - + file_specific_flags = normalize_flags(file_specific_flags) + extra_flags = normalize_flags(self._get_extra_flags()) + + # Contradiction: flags contains both a flag --foo and its negation + # --no-foo. + if self.variant in ALL_VARIANT_FLAGS: + for flags in ALL_VARIANT_FLAGS[self.variant]: + all_flags = (file_specific_flags + extra_flags + + normalize_flags(flags)) + check_flags(negate_flags(all_flags), all_flags, "Flag negations") + + # Contradiction: flags specified through the "Flags:" annotation are + # incompatible with the variant. if self.variant in INCOMPATIBLE_FLAGS_PER_VARIANT: check_flags(INCOMPATIBLE_FLAGS_PER_VARIANT[self.variant], file_specific_flags, "INCOMPATIBLE_FLAGS_PER_VARIANT[\""+self.variant+"\"]") + # Contradiction: flags specified through the "Flags:" annotation are + # incompatible with the build. for variable, incompatible_flags in INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE.items(): if self.suite.statusfile.variables[variable]: check_flags(incompatible_flags, file_specific_flags, "INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE[\""+variable+"\"]") + # Contradiction: flags passed through --extra-flags are incompatible. for extra_flag, incompatible_flags in INCOMPATIBLE_FLAGS_PER_EXTRA_FLAG.items(): if has_flag(extra_flag, extra_flags): check_flags(incompatible_flags, file_specific_flags, @@ -214,9 +250,13 @@ def do_skip(self): return (statusfile.SKIP in self._statusfile_outcomes and not self.suite.test_config.run_skipped) + @property + def is_heavy(self): + return statusfile.HEAVY in self._statusfile_outcomes + @property def is_slow(self): - return statusfile.SLOW in self._statusfile_outcomes + return self.is_heavy or statusfile.SLOW in self._statusfile_outcomes @property def is_fail_ok(self): diff --git a/deps/v8/tools/testrunner/standard_runner.py b/deps/v8/tools/testrunner/standard_runner.py index 94c25766824b79..5b901b8a530cfb 100755 --- a/deps/v8/tools/testrunner/standard_runner.py +++ b/deps/v8/tools/testrunner/standard_runner.py @@ -25,6 +25,7 @@ from testrunner.testproc.filter import StatusFileFilterProc, NameFilterProc from testrunner.testproc.loader import LoadProc from testrunner.testproc.seed import SeedProc +from testrunner.testproc.sequence import SequenceProc from testrunner.testproc.variant import VariantProc @@ -122,6 +123,8 @@ def _add_parser_options(self, parser): 'generation.') # Extra features. + parser.add_option('--max-heavy-tests', default=1, type='int', + help='Maximum number of heavy tests run in parallel') parser.add_option('--time', help='Print timing information after running', default=False, action='store_true') @@ -282,6 +285,10 @@ def _get_statusfile_variables(self, options): }) return variables + def _create_sequence_proc(self, options): + """Create processor for sequencing heavy tests on swarming.""" + return SequenceProc(options.max_heavy_tests) if options.swarming else None + def _do_execute(self, tests, args, options): jobs = options.j @@ -306,6 +313,7 @@ def _do_execute(self, tests, args, options): self._create_predictable_filter(), self._create_shard_proc(options), self._create_seed_proc(options), + self._create_sequence_proc(options), sigproc, ] + indicators + [ results, diff --git a/deps/v8/tools/testrunner/testproc/progress.py b/deps/v8/tools/testrunner/testproc/progress.py index 634ef7c2f2e3c0..ec97ab226f9d19 100644 --- a/deps/v8/tools/testrunner/testproc/progress.py +++ b/deps/v8/tools/testrunner/testproc/progress.py @@ -18,15 +18,13 @@ from ..local import junit_output -def print_failure_header(test): +def print_failure_header(test, is_flaky=False): + text = [str(test)] if test.output_proc.negative: - negative_marker = '[negative] ' - else: - negative_marker = '' - print("=== %(label)s %(negative)s===" % { - 'label': test, - 'negative': negative_marker, - }) + text.append('[negative]') + if is_flaky: + text.append('(flaky)') + print('=== %s ===' % ' '.join(text)) class ResultsTracker(base.TestProcObserver): @@ -75,13 +73,18 @@ def __init__(self): def _on_result_for(self, test, result): # TODO(majeski): Support for dummy/grouped results if result.has_unexpected_output: - self._failed.append((test, result)) + self._failed.append((test, result, False)) + elif result.is_rerun: + # Print only the first result of a flaky failure that was rerun. + self._failed.append((test, result.results[0], True)) def finished(self): crashed = 0 + flaky = 0 print() - for test, result in self._failed: - print_failure_header(test) + for test, result, is_flaky in self._failed: + flaky += int(is_flaky) + print_failure_header(test, is_flaky=is_flaky) if result.output.stderr: print("--- stderr ---") print(result.output.stderr.strip()) @@ -102,9 +105,11 @@ def finished(self): else: print() print("===") - print("=== %i tests failed" % len(self._failed)) + print("=== %d tests failed" % len(self._failed)) + if flaky > 0: + print("=== %d tests were flaky" % flaky) if crashed > 0: - print("=== %i tests CRASHED" % crashed) + print("=== %d tests CRASHED" % crashed) print("===") @@ -130,6 +135,17 @@ def print(self, prefix, test): print('%s: %ss' % (prefix, test)) sys.stdout.flush() + +def format_result_status(result): + if result.has_unexpected_output: + if result.output.HasCrashed(): + return 'CRASH' + else: + return 'FAIL' + else: + return 'PASS' + + class VerboseProgressIndicator(SimpleProgressIndicator): def __init__(self): super(VerboseProgressIndicator, self).__init__() @@ -142,13 +158,10 @@ def _print(self, text): def _message(self, test, result): # TODO(majeski): Support for dummy/grouped results - if result.has_unexpected_output: - if result.output.HasCrashed(): - outcome = 'CRASH' - else: - outcome = 'FAIL' + if result.is_rerun: + outcome = ' '.join(format_result_status(r) for r in result.results) else: - outcome = 'pass' + outcome = format_result_status(result) return '%s %s: %s' % ( test, test.variant or 'default', outcome) diff --git a/deps/v8/tools/testrunner/testproc/sequence.py b/deps/v8/tools/testrunner/testproc/sequence.py new file mode 100644 index 00000000000000..4509a4abf998ec --- /dev/null +++ b/deps/v8/tools/testrunner/testproc/sequence.py @@ -0,0 +1,59 @@ +# 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. + +from collections import deque + +from . import base + + +class SequenceProc(base.TestProc): + """Processor ensuring heavy tests are sent sequentially into the execution + pipeline. + + The class keeps track of the number of tests in the pipeline marked heavy + and permits only a configurable amount. An excess amount is queued and sent + as soon as other heavy tests return. + """ + def __init__(self, max_heavy): + """Initialize the processor. + + Args: + max_heavy: The maximum number of heavy tests that will be sent further + down the pipeline simultaneously. + """ + super(SequenceProc, self).__init__() + assert max_heavy > 0 + self.max_heavy = max_heavy + self.n_heavy = 0 + self.buffer = deque() + + def next_test(self, test): + if test.is_heavy: + if self.n_heavy < self.max_heavy: + # Enough space to send more heavy tests. Check if the test is not + # filtered otherwise. + used = self._send_test(test) + if used: + self.n_heavy += 1 + return used + else: + # Too many tests in the pipeline. Buffer the test and indicate that + # this test didn't end up in the execution queue (i.e. test loader + # will try to send more tests). + self.buffer.append(test) + return False + else: + return self._send_test(test) + + def result_for(self, test, result): + if test.is_heavy: + # A heavy test finished computing. Try to send one from the buffer. + self.n_heavy -= 1 + while self.buffer: + next_test = self.buffer.popleft() + if self._send_test(next_test): + self.n_heavy += 1 + break + + self._send_result(test, result) diff --git a/deps/v8/tools/testrunner/testproc/sequence_unittest.py b/deps/v8/tools/testrunner/testproc/sequence_unittest.py new file mode 100644 index 00000000000000..8a0edc36bbcb68 --- /dev/null +++ b/deps/v8/tools/testrunner/testproc/sequence_unittest.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python +# 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. + +""" +Test integrating the sequence processor into a simple test pipeline. +""" + +import os +import sys +import unittest + +# Needed because the test runner contains relative imports. +TOOLS_PATH = os.path.dirname(os.path.dirname(os.path.dirname( + os.path.abspath(__file__)))) +sys.path.append(TOOLS_PATH) + +from testrunner.testproc import base +from testrunner.testproc.loader import LoadProc +from testrunner.testproc.sequence import SequenceProc + + +class FakeExecutionProc(base.TestProc): + """Simulates the pipeline sink consuming and running the tests. + + Test execution is simulated for each test by calling run(). + """ + def __init__(self): + super(FakeExecutionProc, self).__init__() + self.tests = [] + + def next_test(self, test): + self.tests.append(test) + return True + + def run(self): + test = self.tests.pop() + self._send_result(test, test.n) + + +class FakeResultObserver(base.TestProcObserver): + """Observer to track all results sent back through the pipeline.""" + def __init__(self): + super(FakeResultObserver, self).__init__() + self.tests = set([]) + + def _on_result_for(self, test, result): + self.tests.add(test.n) + + +class FakeTest(object): + """Simple test representation to differentiate light/heavy tests.""" + def __init__(self, n, is_heavy): + self.n = n + self.is_heavy = is_heavy + self.keep_output = False + + +class TestSequenceProc(unittest.TestCase): + def _test(self, tests, batch_size, max_heavy): + # Set up a simple processing pipeline: + # Loader -> observe results -> sequencer -> execution. + loader = LoadProc(iter(tests)) + results = FakeResultObserver() + sequence_proc = SequenceProc(max_heavy) + execution = FakeExecutionProc() + loader.connect_to(results) + results.connect_to(sequence_proc) + sequence_proc.connect_to(execution) + + # Fill the execution queue (with the number of tests potentially + # executed in parallel). + loader.load_initial_tests(batch_size) + + # Simulate the execution test by test. + while execution.tests: + # Assert the invariant of maximum heavy tests executed simultaneously. + self.assertLessEqual( + sum(int(test.is_heavy) for test in execution.tests), max_heavy) + + # As in the real pipeline, running a test and returning its result + # will add another test into the pipeline. + execution.run() + + # Ensure that all tests are processed and deliver results. + self.assertEqual(set(test.n for test in tests), results.tests) + + def test_wrong_usage(self): + self.assertRaises(lambda: SequenceProc(0)) + + def test_no_tests(self): + self._test([], 1, 1) + + def test_large_batch_light(self): + self._test([ + FakeTest(0, False), + FakeTest(1, False), + FakeTest(2, False), + ], 4, 1) + + def test_small_batch_light(self): + self._test([ + FakeTest(0, False), + FakeTest(1, False), + FakeTest(2, False), + ], 2, 1) + + def test_large_batch_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + ], 4, 1) + + def test_small_batch_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + ], 2, 1) + + def test_large_batch_mixed(self): + self._test([ + FakeTest(0, True), + FakeTest(1, False), + FakeTest(2, True), + FakeTest(3, False), + ], 4, 1) + + def test_small_batch_mixed(self): + self._test([ + FakeTest(0, True), + FakeTest(1, False), + FakeTest(2, True), + FakeTest(3, False), + ], 2, 1) + + def test_large_batch_more_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + FakeTest(3, False), + FakeTest(4, True), + FakeTest(5, True), + FakeTest(6, False), + ], 4, 2) + + def test_small_batch_more_heavy(self): + self._test([ + FakeTest(0, True), + FakeTest(1, True), + FakeTest(2, True), + FakeTest(3, False), + FakeTest(4, True), + FakeTest(5, True), + FakeTest(6, False), + ], 2, 2) + +if __name__ == '__main__': + unittest.main() diff --git a/deps/v8/tools/testrunner/testproc/variant.py b/deps/v8/tools/testrunner/testproc/variant.py index 0164ad88452b47..be3484fb0fef68 100644 --- a/deps/v8/tools/testrunner/testproc/variant.py +++ b/deps/v8/tools/testrunner/testproc/variant.py @@ -42,8 +42,11 @@ def _next_test(self, test): return self._try_send_new_subtest(test, gen) def _result_for(self, test, subtest, result): - gen = self._next_variant[test.procid] - if not self._try_send_new_subtest(test, gen): + # The generator might have been removed after cycling through all subtests + # below. If some of the subtests are heavy, they get buffered and return + # their results later. + gen = self._next_variant.get(test.procid) + if not gen or not self._try_send_new_subtest(test, gen): self._send_result(test, None) def _try_send_new_subtest(self, test, variants_gen): diff --git a/deps/v8/tools/testrunner/trycatch_loader.js b/deps/v8/tools/testrunner/trycatch_loader.js index 737c8e45dbe202..28e2ba217e628f 100644 --- a/deps/v8/tools/testrunner/trycatch_loader.js +++ b/deps/v8/tools/testrunner/trycatch_loader.js @@ -19,7 +19,7 @@ var tests = arguments.slice(separator + 1) var preambleString = "" for (let jstest of preamble) { - preambleString += "load(\"" + jstest + "\");" + preambleString += "d8.file.execute(\"" + jstest + "\");" } for (let jstest of tests) { @@ -30,7 +30,7 @@ for (let jstest of tests) { (function () { let realm = Realm.create(); try { - Realm.eval(realm, preambleString + "load(\"" + jstest + "\");"); + Realm.eval(realm, preambleString + "d8.file.execute(\"" + jstest + "\");"); } catch (err) { // ignore all errors } diff --git a/deps/v8/tools/tick-processor.html b/deps/v8/tools/tick-processor.html index ecb794ec949c5b..97aaa2df5f5612 100644 --- a/deps/v8/tools/tick-processor.html +++ b/deps/v8/tools/tick-processor.html @@ -44,7 +44,7 @@
    Type CountPercent