From b6e09971a8f9a3c92188838b69be0a0dda27f0bb Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Thu, 15 Jul 2021 15:48:17 -0400 Subject: [PATCH 01/13] chore: remove ignored files from node_modules --- .../@humanwhocodes/config-array/LICENSE | 201 ------- .../@humanwhocodes/config-array/api.js | 457 --------------- .../@humanwhocodes/config-array/package.json | 61 -- .../@humanwhocodes/object-schema/LICENSE | 29 - .../@humanwhocodes/object-schema/package.json | 33 -- .../@humanwhocodes/object-schema/src/index.js | 7 - .../object-schema/src/merge-strategy.js | 53 -- .../object-schema/src/object-schema.js | 239 -------- .../object-schema/src/validation-strategy.js | 102 ---- .../object-schema/tests/merge-strategy.js | 66 --- .../object-schema/tests/object-schema.js | 528 ------------------ .../tests/validation-strategy.js | 186 ------ 12 files changed, 1962 deletions(-) delete mode 100644 node_modules/@humanwhocodes/config-array/LICENSE delete mode 100644 node_modules/@humanwhocodes/config-array/api.js delete mode 100644 node_modules/@humanwhocodes/config-array/package.json delete mode 100644 node_modules/@humanwhocodes/object-schema/LICENSE delete mode 100644 node_modules/@humanwhocodes/object-schema/package.json delete mode 100644 node_modules/@humanwhocodes/object-schema/src/index.js delete mode 100644 node_modules/@humanwhocodes/object-schema/src/merge-strategy.js delete mode 100644 node_modules/@humanwhocodes/object-schema/src/object-schema.js delete mode 100644 node_modules/@humanwhocodes/object-schema/src/validation-strategy.js delete mode 100644 node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js delete mode 100644 node_modules/@humanwhocodes/object-schema/tests/object-schema.js delete mode 100644 node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js diff --git a/node_modules/@humanwhocodes/config-array/LICENSE b/node_modules/@humanwhocodes/config-array/LICENSE deleted file mode 100644 index 261eeb9e9f8b2..0000000000000 --- a/node_modules/@humanwhocodes/config-array/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@humanwhocodes/config-array/api.js b/node_modules/@humanwhocodes/config-array/api.js deleted file mode 100644 index a9aacf46b5cd4..0000000000000 --- a/node_modules/@humanwhocodes/config-array/api.js +++ /dev/null @@ -1,457 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - -var path = _interopDefault(require('path')); -var minimatch = _interopDefault(require('minimatch')); -var createDebug = _interopDefault(require('debug')); -var objectSchema = require('@humanwhocodes/object-schema'); - -/** - * @fileoverview ConfigSchema - * @author Nicholas C. Zakas - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Assets that a given value is an array. - * @param {*} value The value to check. - * @returns {void} - * @throws {TypeError} When the value is not an array. - */ -function assertIsArray(value) { - if (!Array.isArray(value)) { - throw new TypeError('Expected value to be an array.'); - } -} - -/** - * Assets that a given value is an array containing only strings and functions. - * @param {*} value The value to check. - * @returns {void} - * @throws {TypeError} When the value is not an array of strings and functions. - */ -function assertIsArrayOfStringsAndFunctions(value, name) { - assertIsArray(value); - - if (value.some(item => typeof item !== 'string' && typeof item !== 'function')) { - throw new TypeError('Expected array to only contain strings.'); - } -} - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The base schema that every ConfigArray uses. - * @type Object - */ -const baseSchema = Object.freeze({ - name: { - required: false, - merge() { - return undefined; - }, - validate(value) { - if (typeof value !== 'string') { - throw new TypeError('Property must be a string.'); - } - } - }, - files: { - required: false, - merge() { - return undefined; - }, - validate(value) { - - // first check if it's an array - assertIsArray(value); - - // then check each member - value.forEach(item => { - if (Array.isArray(item)) { - assertIsArrayOfStringsAndFunctions(item); - } else if (typeof item !== 'string' && typeof item !== 'function') { - throw new TypeError('Items must be a string, a function, or an array of strings and functions.'); - } - }); - - } - }, - ignores: { - required: false, - merge() { - return undefined; - }, - validate: assertIsArrayOfStringsAndFunctions - } -}); - -/** - * @fileoverview ConfigArray - * @author Nicholas C. Zakas - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const debug = createDebug('@hwc/config-array'); - -const MINIMATCH_OPTIONS = { - matchBase: true -}; - -/** - * Shorthand for checking if a value is a string. - * @param {any} value The value to check. - * @returns {boolean} True if a string, false if not. - */ -function isString(value) { - return typeof value === 'string'; -} - -/** - * Normalizes a `ConfigArray` by flattening it and executing any functions - * that are found inside. - * @param {Array} items The items in a `ConfigArray`. - * @param {Object} context The context object to pass into any function - * found. - * @returns {Array} A flattened array containing only config objects. - * @throws {TypeError} When a config function returns a function. - */ -async function normalize(items, context) { - - // TODO: Allow async config functions - - function *flatTraverse(array) { - for (let item of array) { - if (typeof item === 'function') { - item = item(context); - } - - if (Array.isArray(item)) { - yield * flatTraverse(item); - } else if (typeof item === 'function') { - throw new TypeError('A config function can only return an object or array.'); - } else { - yield item; - } - } - } - - return [...flatTraverse(items)]; -} - -/** - * Determines if a given file path is matched by a config. If the config - * has no `files` field, then it matches; otherwise, if a `files` field - * is present then we match the globs in `files` and exclude any globs in - * `ignores`. - * @param {string} filePath The absolute file path to check. - * @param {Object} config The config object to check. - * @returns {boolean} True if the file path is matched by the config, - * false if not. - */ -function pathMatches(filePath, basePath, config) { - - // a config without a `files` field always matches - if (!config.files) { - return true; - } - - // if files isn't an array, throw an error - if (!Array.isArray(config.files) || config.files.length === 0) { - throw new TypeError('The files key must be a non-empty array.'); - } - - const relativeFilePath = path.relative(basePath, filePath); - - // match both strings and functions - const match = pattern => { - if (isString(pattern)) { - return minimatch(relativeFilePath, pattern, MINIMATCH_OPTIONS); - } - - if (typeof pattern === 'function') { - return pattern(filePath); - } - }; - - // check for all matches to config.files - let matches = config.files.some(pattern => { - if (Array.isArray(pattern)) { - return pattern.every(match); - } - - return match(pattern); - }); - - /* - * If the file path matches the config.files patterns, then check to see - * if there are any files to ignore. - */ - if (matches && config.ignores) { - matches = !config.ignores.some(pattern => { - return minimatch(filePath, pattern, MINIMATCH_OPTIONS); - }); - } - - return matches; -} - -/** - * Ensures that a ConfigArray has been normalized. - * @param {ConfigArray} configArray The ConfigArray to check. - * @returns {void} - * @throws {Error} When the `ConfigArray` is not normalized. - */ -function assertNormalized(configArray) { - // TODO: Throw more verbose error - if (!configArray.isNormalized()) { - throw new Error('ConfigArray must be normalized to perform this operation.'); - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -const ConfigArraySymbol = { - isNormalized: Symbol('isNormalized'), - configCache: Symbol('configCache'), - schema: Symbol('schema'), - finalizeConfig: Symbol('finalizeConfig'), - preprocessConfig: Symbol('preprocessConfig') -}; - -/** - * Represents an array of config objects and provides method for working with - * those config objects. - */ -class ConfigArray extends Array { - - /** - * Creates a new instance of ConfigArray. - * @param {Iterable|Function|Object} configs An iterable yielding config - * objects, or a config function, or a config object. - * @param {string} [options.basePath=""] The path of the config file - * @param {boolean} [options.normalized=false] Flag indicating if the - * configs have already been normalized. - * @param {Object} [options.schema] The additional schema - * definitions to use for the ConfigArray schema. - */ - constructor(configs, { basePath = '', normalized = false, schema: customSchema } = {}) { - super(); - - /** - * Tracks if the array has been normalized. - * @property isNormalized - * @type boolean - * @private - */ - this[ConfigArraySymbol.isNormalized] = normalized; - - /** - * The schema used for validating and merging configs. - * @property schema - * @type ObjectSchema - * @private - */ - this[ConfigArraySymbol.schema] = new objectSchema.ObjectSchema({ - ...customSchema, - ...baseSchema - }); - - /** - * The path of the config file that this array was loaded from. - * This is used to calculate filename matches. - * @property basePath - * @type string - */ - this.basePath = basePath; - - /** - * A cache to store calculated configs for faster repeat lookup. - * @property configCache - * @type Map - * @private - */ - this[ConfigArraySymbol.configCache] = new Map(); - - // load the configs into this array - if (Array.isArray(configs)) { - this.push(...configs); - } else { - this.push(configs); - } - - } - - /** - * Prevent normal array methods from creating a new `ConfigArray` instance. - * This is to ensure that methods such as `slice()` won't try to create a - * new instance of `ConfigArray` behind the scenes as doing so may throw - * an error due to the different constructor signature. - * @returns {Function} The `Array` constructor. - */ - static get [Symbol.species]() { - return Array; - } - - /** - * Returns the `files` globs from every config object in the array. - * Negated patterns (those beginning with `!`) are not returned. - * This can be used to determine which files will be matched by a - * config array or to use as a glob pattern when no patterns are provided - * for a command line interface. - * @returns {string[]} An array of string patterns. - */ - get files() { - - assertNormalized(this); - - const result = []; - - for (const config of this) { - if (config.files) { - config.files.forEach(filePattern => { - if (Array.isArray(filePattern)) { - result.push(...filePattern.filter(pattern => { - return isString(pattern) && !pattern.startsWith('!'); - })); - } else if (isString(filePattern) && !filePattern.startsWith('!')) { - result.push(filePattern); - } - }); - } - } - - return result; - } - - /** - * Returns the file globs that should always be ignored regardless of - * the matching `files` fields in any configs. This is necessary to mimic - * the behavior of things like .gitignore and .eslintignore, allowing a - * globbing operation to be faster. - * @returns {string[]} An array of string patterns to be ignored. - */ - get ignores() { - - assertNormalized(this); - - const result = []; - - for (const config of this) { - if (config.ignores && !config.files) { - result.push(...config.ignores.filter(isString)); - } - } - - return result; - } - - /** - * Indicates if the config array has been normalized. - * @returns {boolean} True if the config array is normalized, false if not. - */ - isNormalized() { - return this[ConfigArraySymbol.isNormalized]; - } - - /** - * Normalizes a config array by flattening embedded arrays and executing - * config functions. - * @param {ConfigContext} context The context object for config functions. - * @returns {ConfigArray} A new ConfigArray instance that is normalized. - */ - async normalize(context = {}) { - - if (!this.isNormalized()) { - const normalizedConfigs = await normalize(this, context); - this.length = 0; - this.push(...normalizedConfigs.map(this[ConfigArraySymbol.preprocessConfig])); - this[ConfigArraySymbol.isNormalized] = true; - - // prevent further changes - Object.freeze(this); - } - - return this; - } - - /** - * Finalizes the state of a config before being cached and returned by - * `getConfig()`. Does nothing by default but is provided to be - * overridden by subclasses as necessary. - * @param {Object} config The config to finalize. - * @returns {Object} The finalized config. - */ - [ConfigArraySymbol.finalizeConfig](config) { - return config; - } - - /** - * Preprocesses a config during the normalization process. This is the - * method to override if you want to convert an array item before it is - * validated for the first time. For example, if you want to replace a - * string with an object, this is the method to override. - * @param {Object} config The config to preprocess. - * @returns {Object} The config to use in place of the argument. - */ - [ConfigArraySymbol.preprocessConfig](config) { - return config; - } - - /** - * Returns the config object for a given file path. - * @param {string} filePath The complete path of a file to get a config for. - * @returns {Object} The config object for this file. - */ - getConfig(filePath) { - - assertNormalized(this); - - // first check the cache to avoid duplicate work - let finalConfig = this[ConfigArraySymbol.configCache].get(filePath); - - if (finalConfig) { - return finalConfig; - } - - // No config found in cache, so calculate a new one - - const matchingConfigs = []; - - for (const config of this) { - if (pathMatches(filePath, this.basePath, config)) { - debug(`Matching config found for ${filePath}`); - matchingConfigs.push(config); - } else { - debug(`No matching config found for ${filePath}`); - } - } - - finalConfig = matchingConfigs.reduce((result, config) => { - return this[ConfigArraySymbol.schema].merge(result, config); - }, {}, this); - - finalConfig = this[ConfigArraySymbol.finalizeConfig](finalConfig); - - this[ConfigArraySymbol.configCache].set(filePath, finalConfig); - - return finalConfig; - } - -} - -exports.ConfigArray = ConfigArray; -exports.ConfigArraySymbol = ConfigArraySymbol; diff --git a/node_modules/@humanwhocodes/config-array/package.json b/node_modules/@humanwhocodes/config-array/package.json deleted file mode 100644 index 4dc3a4e5d48ab..0000000000000 --- a/node_modules/@humanwhocodes/config-array/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@humanwhocodes/config-array", - "version": "0.5.0", - "description": "Glob-based configuration matching.", - "author": "Nicholas C. Zakas", - "main": "api.js", - "files": [ - "api.js" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/config-array.git" - }, - "bugs": { - "url": "https://github.com/humanwhocodes/config-array/issues" - }, - "homepage": "https://github.com/humanwhocodes/config-array#readme", - "scripts": { - "build": "rollup -c", - "format": "nitpik", - "lint": "eslint *.config.js src/*.js tests/*.js", - "prepublish": "npm run build", - "test:coverage": "nyc --include src/*.js npm run test", - "test": "mocha -r esm tests/ --recursive" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.js": [ - "nitpik", - "eslint --fix --ignore-pattern '!.eslintrc.js'" - ] - }, - "keywords": [ - "configuration", - "configarray", - "config file" - ], - "license": "Apache-2.0", - "engines": { - "node": ">=10.10.0" - }, - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "devDependencies": { - "@nitpik/javascript": "^0.3.3", - "@nitpik/node": "0.0.5", - "chai": "^4.2.0", - "eslint": "^6.7.1", - "esm": "^3.2.25", - "lint-staged": "^10.2.8", - "mocha": "^6.1.4", - "nyc": "^14.1.1", - "rollup": "^1.12.3", - "yorkie": "^2.0.0" - } -} \ No newline at end of file diff --git a/node_modules/@humanwhocodes/object-schema/LICENSE b/node_modules/@humanwhocodes/object-schema/LICENSE deleted file mode 100644 index a5e3ae46fdfc2..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2019, Human Who Codes -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/@humanwhocodes/object-schema/package.json b/node_modules/@humanwhocodes/object-schema/package.json deleted file mode 100644 index ba829090e55bd..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "@humanwhocodes/object-schema", - "version": "1.2.0", - "description": "An object schema merger/validator", - "main": "src/index.js", - "directories": { - "test": "tests" - }, - "scripts": { - "test": "mocha tests/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/object-schema.git" - }, - "keywords": [ - "object", - "validation", - "schema", - "merge" - ], - "author": "Nicholas C. Zakas", - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/humanwhocodes/object-schema/issues" - }, - "homepage": "https://github.com/humanwhocodes/object-schema#readme", - "devDependencies": { - "chai": "^4.2.0", - "eslint": "^5.13.0", - "mocha": "^5.2.0" - } -} \ No newline at end of file diff --git a/node_modules/@humanwhocodes/object-schema/src/index.js b/node_modules/@humanwhocodes/object-schema/src/index.js deleted file mode 100644 index b2bc4fb96e3cb..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/src/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @filedescription Object Schema Package - */ - -exports.ObjectSchema = require("./object-schema").ObjectSchema; -exports.MergeStrategy = require("./merge-strategy").MergeStrategy; -exports.ValidationStrategy = require("./validation-strategy").ValidationStrategy; diff --git a/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js b/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js deleted file mode 100644 index 82174492764a9..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @filedescription Merge Strategy - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Class -//----------------------------------------------------------------------------- - -/** - * Container class for several different merge strategies. - */ -class MergeStrategy { - - /** - * Merges two keys by overwriting the first with the second. - * @param {*} value1 The value from the first object key. - * @param {*} value2 The value from the second object key. - * @returns {*} The second value. - */ - static overwrite(value1, value2) { - return value2; - } - - /** - * Merges two keys by replacing the first with the second only if the - * second is defined. - * @param {*} value1 The value from the first object key. - * @param {*} value2 The value from the second object key. - * @returns {*} The second value if it is defined. - */ - static replace(value1, value2) { - if (typeof value2 !== "undefined") { - return value2; - } - - return value1; - } - - /** - * Merges two properties by assigning properties from the second to the first. - * @param {*} value1 The value from the first object key. - * @param {*} value2 The value from the second object key. - * @returns {*} A new object containing properties from both value1 and - * value2. - */ - static assign(value1, value2) { - return Object.assign({}, value1, value2); - } -} - -exports.MergeStrategy = MergeStrategy; diff --git a/node_modules/@humanwhocodes/object-schema/src/object-schema.js b/node_modules/@humanwhocodes/object-schema/src/object-schema.js deleted file mode 100644 index 25864f5a280cb..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/src/object-schema.js +++ /dev/null @@ -1,239 +0,0 @@ -/** - * @filedescription Object Schema - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const { MergeStrategy } = require("./merge-strategy"); -const { ValidationStrategy } = require("./validation-strategy"); - -//----------------------------------------------------------------------------- -// Private -//----------------------------------------------------------------------------- - -const strategies = Symbol("strategies"); -const requiredKeys = Symbol("requiredKeys"); - -/** - * Validates a schema strategy. - * @param {string} name The name of the key this strategy is for. - * @param {Object} strategy The strategy for the object key. - * @param {boolean} [strategy.required=true] Whether the key is required. - * @param {string[]} [strategy.requires] Other keys that are required when - * this key is present. - * @param {Function} strategy.merge A method to call when merging two objects - * with the same key. - * @param {Function} strategy.validate A method to call when validating an - * object with the key. - * @returns {void} - * @throws {Error} When the strategy is missing a name. - * @throws {Error} When the strategy is missing a merge() method. - * @throws {Error} When the strategy is missing a validate() method. - */ -function validateDefinition(name, strategy) { - - let hasSchema = false; - if (strategy.schema) { - if (typeof strategy.schema === "object") { - hasSchema = true; - } else { - throw new TypeError("Schema must be an object."); - } - } - - if (typeof strategy.merge === "string") { - if (!(strategy.merge in MergeStrategy)) { - throw new TypeError(`Definition for key "${name}" missing valid merge strategy.`); - } - } else if (!hasSchema && typeof strategy.merge !== "function") { - throw new TypeError(`Definition for key "${name}" must have a merge property.`); - } - - if (typeof strategy.validate === "string") { - if (!(strategy.validate in ValidationStrategy)) { - throw new TypeError(`Definition for key "${name}" missing valid validation strategy.`); - } - } else if (!hasSchema && typeof strategy.validate !== "function") { - throw new TypeError(`Definition for key "${name}" must have a validate() method.`); - } -} - - -//----------------------------------------------------------------------------- -// Class -//----------------------------------------------------------------------------- - -/** - * Represents an object validation/merging schema. - */ -class ObjectSchema { - - /** - * Creates a new instance. - */ - constructor(definitions) { - - if (!definitions) { - throw new Error("Schema definitions missing."); - } - - /** - * Track all strategies in the schema by key. - * @type {Map} - * @property strategies - */ - this[strategies] = new Map(); - - /** - * Separately track any keys that are required for faster validation. - * @type {Map} - * @property requiredKeys - */ - this[requiredKeys] = new Map(); - - // add in all strategies - for (const key of Object.keys(definitions)) { - validateDefinition(key, definitions[key]); - - // normalize merge and validate methods if subschema is present - if (typeof definitions[key].schema === "object") { - const schema = new ObjectSchema(definitions[key].schema); - definitions[key] = { - ...definitions[key], - merge(first, second) { - if (first && second) { - return schema.merge(first, second); - } - - return MergeStrategy.assign(first, second); - }, - validate(value) { - ValidationStrategy.object(value); - schema.validate(value); - } - }; - } - - // normalize the merge method in case there's a string - if (typeof definitions[key].merge === "string") { - definitions[key] = { - ...definitions[key], - merge: MergeStrategy[definitions[key].merge] - }; - }; - - // normalize the validate method in case there's a string - if (typeof definitions[key].validate === "string") { - definitions[key] = { - ...definitions[key], - validate: ValidationStrategy[definitions[key].validate] - }; - }; - - this[strategies].set(key, definitions[key]); - - if (definitions[key].required) { - this[requiredKeys].set(key, definitions[key]); - } - } - } - - /** - * Determines if a strategy has been registered for the given object key. - * @param {string} key The object key to find a strategy for. - * @returns {boolean} True if the key has a strategy registered, false if not. - */ - hasKey(key) { - return this[strategies].has(key); - } - - /** - * Merges objects together to create a new object comprised of the keys - * of the all objects. Keys are merged based on the each key's merge - * strategy. - * @param {...Object} objects The objects to merge. - * @returns {Object} A new object with a mix of all objects' keys. - * @throws {Error} If any object is invalid. - */ - merge(...objects) { - - // double check arguments - if (objects.length < 2) { - throw new Error("merge() requires at least two arguments."); - } - - if (objects.some(object => (object == null || typeof object !== "object"))) { - throw new Error("All arguments must be objects."); - } - - return objects.reduce((result, object) => { - - this.validate(object); - - for (const [key, strategy] of this[strategies]) { - try { - if (key in result || key in object) { - const value = strategy.merge.call(this, result[key], object[key]); - if (value !== undefined) { - result[key] = value; - } - } - } catch (ex) { - ex.message = `Key "${key}": ` + ex.message; - throw ex; - } - } - return result; - }, {}); - } - - /** - * Validates an object's keys based on the validate strategy for each key. - * @param {Object} object The object to validate. - * @returns {void} - * @throws {Error} When the object is invalid. - */ - validate(object) { - - // check existing keys first - for (const key of Object.keys(object)) { - - // check to see if the key is defined - if (!this.hasKey(key)) { - throw new Error(`Unexpected key "${key}" found.`); - } - - // validate existing keys - const strategy = this[strategies].get(key); - - // first check to see if any other keys are required - if (Array.isArray(strategy.requires)) { - if (!strategy.requires.every(otherKey => otherKey in object)) { - throw new Error(`Key "${key}" requires keys "${strategy.requires.join("\", \"")}".`); - } - } - - // now apply remaining validation strategy - try { - strategy.validate.call(strategy, object[key]); - } catch (ex) { - ex.message = `Key "${key}": ` + ex.message; - throw ex; - } - } - - // ensure required keys aren't missing - for (const [key] of this[requiredKeys]) { - if (!(key in object)) { - throw new Error(`Missing required key "${key}".`); - } - } - - } -} - -exports.ObjectSchema = ObjectSchema; diff --git a/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js b/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js deleted file mode 100644 index ecf918bdd17b7..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @filedescription Validation Strategy - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Class -//----------------------------------------------------------------------------- - -/** - * Container class for several different validation strategies. - */ -class ValidationStrategy { - - /** - * Validates that a value is an array. - * @param {*} value The value to validate. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ - static array(value) { - if (!Array.isArray(value)) { - throw new TypeError("Expected an array."); - } - } - - /** - * Validates that a value is a boolean. - * @param {*} value The value to validate. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ - static boolean(value) { - if (typeof value !== "boolean") { - throw new TypeError("Expected a Boolean."); - } - } - - /** - * Validates that a value is a number. - * @param {*} value The value to validate. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ - static number(value) { - if (typeof value !== "number") { - throw new TypeError("Expected a number."); - } - } - - /** - * Validates that a value is a object. - * @param {*} value The value to validate. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ - static object(value) { - if (!value || typeof value !== "object") { - throw new TypeError("Expected an object."); - } - } - - /** - * Validates that a value is a object or null. - * @param {*} value The value to validate. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ - static "object?"(value) { - if (typeof value !== "object") { - throw new TypeError("Expected an object or null."); - } - } - - /** - * Validates that a value is a string. - * @param {*} value The value to validate. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ - static string(value) { - if (typeof value !== "string") { - throw new TypeError("Expected a string."); - } - } - - /** - * Validates that a value is a non-empty string. - * @param {*} value The value to validate. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ - static "string!"(value) { - if (typeof value !== "string" || value.length === 0) { - throw new TypeError("Expected a non-empty string."); - } - } - -} - -exports.ValidationStrategy = ValidationStrategy; diff --git a/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js b/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js deleted file mode 100644 index 84032d7e89ae2..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @filedescription Merge Strategy Tests - */ -/* global it, describe, beforeEach */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const assert = require("chai").assert; -const { MergeStrategy } = require("../src/"); - -//----------------------------------------------------------------------------- -// Class -//----------------------------------------------------------------------------- - -describe("MergeStrategy", () => { - - - describe("overwrite()", () => { - - it("should overwrite the first value with the second when the second is defined", () => { - const result = MergeStrategy.overwrite(1, 2); - assert.strictEqual(result, 2); - }); - - it("should overwrite the first value with the second when the second is undefined", () => { - const result = MergeStrategy.overwrite(1, undefined); - assert.strictEqual(result, undefined); - }); - - }); - - describe("replace()", () => { - - it("should overwrite the first value with the second when the second is defined", () => { - const result = MergeStrategy.replace(1, 2); - assert.strictEqual(result, 2); - }); - - it("should return the first value when the second is undefined", () => { - const result = MergeStrategy.replace(1, undefined); - assert.strictEqual(result, 1); - }); - - }); - - describe("assign()", () => { - - it("should merge properties from two objects when called", () => { - - const object1 = { foo: 1, bar: 3 }; - const object2 = { foo: 2 }; - - const result = MergeStrategy.assign(object1, object2); - assert.deepStrictEqual(result, { - foo: 2, - bar: 3 - }); - }); - - }); - -}); diff --git a/node_modules/@humanwhocodes/object-schema/tests/object-schema.js b/node_modules/@humanwhocodes/object-schema/tests/object-schema.js deleted file mode 100644 index bff00600c2ad4..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/tests/object-schema.js +++ /dev/null @@ -1,528 +0,0 @@ -/** - * @filedescription Object Schema Tests - */ -/* global it, describe, beforeEach */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const assert = require("chai").assert; -const { ObjectSchema } = require("../src/"); - -//----------------------------------------------------------------------------- -// Class -//----------------------------------------------------------------------------- - -describe("ObjectSchema", () => { - - let schema; - - describe("new ObjectSchema()", () => { - - it("should add a new key when a strategy is passed", () => { - schema = new ObjectSchema({ - foo: { - merge() {}, - validate() {} - } - }); - - assert.isTrue(schema.hasKey("foo")); - }); - - it("should throw an error when a strategy is missing a merge() method", () => { - assert.throws(() => { - schema = new ObjectSchema({ - foo: { - validate() { } - } - }); - }, /Definition for key "foo" must have a merge property/); - }); - - it("should throw an error when a strategy is missing a merge() method", () => { - assert.throws(() => { - schema = new ObjectSchema(); - }, /Schema definitions missing/); - }); - - it("should throw an error when a strategy is missing a validate() method", () => { - assert.throws(() => { - schema = new ObjectSchema({ - foo: { - merge() { }, - } - }); - }, /Definition for key "foo" must have a validate\(\) method/); - }); - - it("should throw an error when merge is an invalid string", () => { - assert.throws(() => { - new ObjectSchema({ - foo: { - merge: "bar", - validate() { } - } - }); - }, /key "foo" missing valid merge strategy/); - }); - - it("should throw an error when validate is an invalid string", () => { - assert.throws(() => { - new ObjectSchema({ - foo: { - merge: "assign", - validate: "s" - } - }); - }, /key "foo" missing valid validation strategy/); - }); - - }); - - - describe("merge()", () => { - - it("should throw an error when an unexpected key is found", () => { - let schema = new ObjectSchema({}); - - assert.throws(() => { - schema.merge({ foo: true }, { foo: true }); - }, /Unexpected key "foo"/); - }); - - it("should throw an error when merge() throws an error", () => { - let schema = new ObjectSchema({ - foo: { - merge() { - throw new Error("Boom!"); - }, - validate() {} - } - }); - - assert.throws(() => { - schema.merge({ foo: true }, { foo: true }); - }, /Key "foo": Boom!/); - - }); - - it("should call the merge() strategy for one key when called", () => { - - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() {} - } - }); - - const result = schema.merge({ foo: true }, { foo: false }); - assert.propertyVal(result, "foo", "bar"); - }); - - it("should not call the merge() strategy when both objects don't contain the key", () => { - - let called = false; - - schema = new ObjectSchema({ - foo: { - merge() { - called = true; - }, - validate() {} - } - }); - - schema.merge({}, {}); - assert.isFalse(called, "The merge() strategy should not have been called."); - }); - - it("should omit returning the key when the merge() strategy returns undefined", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return undefined; - }, - validate() { } - } - }); - - const result = schema.merge({ foo: true }, { foo: false }); - assert.notProperty(result, "foo"); - }); - - it("should call the merge() strategy for two keys when called", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() { } - }, - bar: { - merge() { - return "baz"; - }, - validate() {} - } - }); - - const result = schema.merge({ foo: true, bar: 1 }, { foo: true, bar: 2 }); - assert.propertyVal(result, "foo", "bar"); - assert.propertyVal(result, "bar", "baz"); - }); - - it("should call the merge() strategy for two keys when called on three objects", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() { } - }, - bar: { - merge() { - return "baz"; - }, - validate() { } - } - }); - - const result = schema.merge( - { foo: true, bar: 1 }, - { foo: true, bar: 3 }, - { foo: false, bar: 2 } - ); - assert.propertyVal(result, "foo", "bar"); - assert.propertyVal(result, "bar", "baz"); - }); - - it("should call the merge() strategy when defined as 'overwrite'", () => { - schema = new ObjectSchema({ - foo: { - merge: "overwrite", - validate() { } - } - }); - - const result = schema.merge( - { foo: true }, - { foo: false } - ); - assert.propertyVal(result, "foo", false); - }); - - it("should call the merge() strategy when defined as 'assign'", () => { - schema = new ObjectSchema({ - foo: { - merge: "assign", - validate() { } - } - }); - - const result = schema.merge( - { foo: { bar: true } }, - { foo: { baz: false } } - ); - - assert.strictEqual(result.foo.bar, true); - assert.strictEqual(result.foo.baz, false); - }); - - it("should call the merge strategy when there's a subschema", () => { - - schema = new ObjectSchema({ - name: { - schema: { - first: { - merge: "replace", - validate: "string" - }, - last: { - merge: "replace", - validate: "string" - } - } - } - }); - - const result = schema.merge({ - name: { - first: "n", - last: "z" - } - }, { - name: { - first: "g" - } - }); - - assert.strictEqual(result.name.first, "g"); - assert.strictEqual(result.name.last, "z"); - }); - - it("should not error when calling the merge strategy when there's a subschema and no matching key in second object", () => { - - schema = new ObjectSchema({ - name: { - schema: { - first: { - merge: "replace", - validate: "string" - }, - last: { - merge: "replace", - validate: "string" - } - } - } - }); - - const result = schema.merge({ - name: { - first: "n", - last: "z" - } - }, { - }); - - assert.strictEqual(result.name.first, "n"); - assert.strictEqual(result.name.last, "z"); - }); - - - }); - - describe("validate()", () => { - - it("should throw an error when an unexpected key is found", () => { - let schema = new ObjectSchema({}); - assert.throws(() => { - schema.validate({ foo: true }); - }, /Unexpected key "foo"/); - }); - - it("should not throw an error when an expected key is found", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() {} - } - }); - - schema.validate({ foo: true }); - }); - - it("should pass the property value into validate() when key is found", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate(value) { - assert.isTrue(value); - } - } - }); - - schema.validate({ foo: true }); - }); - - it("should not throw an error when expected keys are found", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() {} - }, - bar: { - merge() { - return "baz"; - }, - validate() {} - } - }); - - schema.validate({ foo: true, bar: true }); - }); - - it("should not throw an error when expected keys are found with required keys", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() { } - }, - bar: { - requires: ["foo"], - merge() { - return "baz"; - }, - validate() { } - } - }); - - schema.validate({ foo: true, bar: true }); - }); - - it("should throw an error when expected keys are found without required keys", () => { - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() { } - }, - baz: { - merge() { - return "baz"; - }, - validate() { } - }, - bar: { - name: "bar", - requires: ["foo", "baz"], - merge() { }, - validate() { } - } - }); - - assert.throws(() => { - schema.validate({ bar: true }); - }, /Key "bar" requires keys "foo", "baz"./); - }); - - - it("should throw an error when an expected key is found but is invalid", () => { - - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate() { - throw new Error("Invalid key."); - } - } - }); - - assert.throws(() => { - schema.validate({ foo: true }); - }, /Key "foo": Invalid key/); - }); - - it("should throw an error when an expected key is found but is invalid with a string validator", () => { - - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate: "string" - } - }); - - assert.throws(() => { - schema.validate({ foo: true }); - }, /Key "foo": Expected a string/); - }); - - it("should throw an error when an expected key is found but is invalid with a number validator", () => { - - schema = new ObjectSchema({ - foo: { - merge() { - return "bar"; - }, - validate: "number" - } - }); - - assert.throws(() => { - schema.validate({ foo: true }); - }, /Key "foo": Expected a number/); - }); - - it("should throw an error when a required key is missing", () => { - - schema = new ObjectSchema({ - foo: { - required: true, - merge() { - return "bar"; - }, - validate() {} - } - }); - - assert.throws(() => { - schema.validate({}); - }, /Missing required key "foo"/); - }); - - it("should throw an error when a subschema is provided and the value doesn't validate", () => { - - schema = new ObjectSchema({ - name: { - schema: { - first: { - merge: "replace", - validate: "string" - }, - last: { - merge: "replace", - validate: "string" - } - } - } - }); - - assert.throws(() => { - schema.validate({ - name: { - first: 123, - last: "z" - } - }); - - }, /Key "name": Key "first": Expected a string/); - }); - - it("should not throw an error when a subschema is provided and the value validates", () => { - - schema = new ObjectSchema({ - name: { - schema: { - first: { - merge: "replace", - validate: "string" - }, - last: { - merge: "replace", - validate: "string" - } - } - } - }); - - schema.validate({ - name: { - first: "n", - last: "z" - } - }); - - }); - - }); - -}); diff --git a/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js b/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js deleted file mode 100644 index 5d3e4a24dcf34..0000000000000 --- a/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * @filedescription Merge Strategy Tests - */ -/* global it, describe, beforeEach */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const assert = require("chai").assert; -const { ValidationStrategy } = require("../src/"); - -//----------------------------------------------------------------------------- -// Class -//----------------------------------------------------------------------------- - -describe("ValidationStrategy", () => { - - describe("boolean", () => { - it("should not throw an error when the value is a boolean", () => { - ValidationStrategy.boolean(true); - }); - - it("should throw an error when the value is null", () => { - assert.throws(() => { - ValidationStrategy.boolean(null); - }, /Expected a Boolean/); - }); - - it("should throw an error when the value is a string", () => { - assert.throws(() => { - ValidationStrategy.boolean("foo"); - }, /Expected a Boolean/); - }); - - it("should throw an error when the value is a number", () => { - assert.throws(() => { - ValidationStrategy.boolean(123); - }, /Expected a Boolean/); - }); - - it("should throw an error when the value is an object", () => { - assert.throws(() => { - ValidationStrategy.boolean({}); - }, /Expected a Boolean/); - }); - }); - - describe("number", () => { - it("should not throw an error when the value is a number", () => { - ValidationStrategy.number(25); - }); - - it("should throw an error when the value is null", () => { - assert.throws(() => { - ValidationStrategy.number(null); - }, /Expected a number/); - }); - - it("should throw an error when the value is a string", () => { - assert.throws(() => { - ValidationStrategy.number("foo"); - }, /Expected a number/); - }); - - it("should throw an error when the value is a boolean", () => { - assert.throws(() => { - ValidationStrategy.number(true); - }, /Expected a number/); - }); - - it("should throw an error when the value is an object", () => { - assert.throws(() => { - ValidationStrategy.number({}); - }, /Expected a number/); - }); - }); - - describe("object", () => { - it("should not throw an error when the value is an object", () => { - ValidationStrategy.object({}); - }); - - it("should throw an error when the value is null", () => { - assert.throws(() => { - ValidationStrategy.object(null); - }, /Expected an object/); - }); - - it("should throw an error when the value is a string", () => { - assert.throws(() => { - ValidationStrategy.object(""); - }, /Expected an object/); - }); - }); - - describe("array", () => { - it("should not throw an error when the value is an array", () => { - ValidationStrategy.array([]); - }); - - it("should throw an error when the value is null", () => { - assert.throws(() => { - ValidationStrategy.array(null); - }, /Expected an array/); - }); - - it("should throw an error when the value is a string", () => { - assert.throws(() => { - ValidationStrategy.array(""); - }, /Expected an array/); - }); - - it("should throw an error when the value is an object", () => { - assert.throws(() => { - ValidationStrategy.array({}); - }, /Expected an array/); - }); - }); - - describe("object?", () => { - it("should not throw an error when the value is an object", () => { - ValidationStrategy["object?"]({}); - }); - - it("should not throw an error when the value is null", () => { - ValidationStrategy["object?"](null); - }); - - it("should throw an error when the value is a string", () => { - assert.throws(() => { - ValidationStrategy["object?"](""); - }, /Expected an object/); - }); - }); - - describe("string", () => { - it("should not throw an error when the value is a string", () => { - ValidationStrategy.string("foo"); - }); - - it("should not throw an error when the value is an empty string", () => { - ValidationStrategy.string(""); - }); - - it("should throw an error when the value is null", () => { - assert.throws(() => { - ValidationStrategy.string(null); - }, /Expected a string/); - }); - - it("should throw an error when the value is an object", () => { - assert.throws(() => { - ValidationStrategy.string({}); - }, /Expected a string/); - }); - }); - - describe("string!", () => { - it("should not throw an error when the value is an string", () => { - ValidationStrategy["string!"]("foo"); - }); - - it("should throw an error when the value is an empty string", () => { - assert.throws(() => { - ValidationStrategy["string!"](""); - }, /Expected a non-empty string/); - }); - - it("should throw an error when the value is null", () => { - assert.throws(() => { - ValidationStrategy["string!"](null); - }, /Expected a non-empty string/); - }); - - it("should throw an error when the value is an object", () => { - assert.throws(() => { - ValidationStrategy["string!"]({}); - }, /Expected a non-empty string/); - }); - }); - - -}); From a014f3d284e49cd085cfd060a71a161b93bca9d1 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 20 Jul 2021 09:07:31 -0700 Subject: [PATCH 02/13] fix(docs): typo in `npm cmd` docs PR-URL: https://github.com/npm/cli/pull/3562 Credit: @wraithgar Close: #3562 Reviewed-by: @lukekarrys --- docs/content/commands/npm-pkg.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/commands/npm-pkg.md b/docs/content/commands/npm-pkg.md index 78b13cf9e9a00..bc96eb8c3af94 100644 --- a/docs/content/commands/npm-pkg.md +++ b/docs/content/commands/npm-pkg.md @@ -16,7 +16,7 @@ npm pkg delete [. ...] A command that automates the management of `package.json` files. `npm pkg` provide 3 different sub commands that allow you to modify or retrieve -values for given object keys in your `packge.json`. +values for given object keys in your `package.json`. The syntax to retrieve and set fields is a dot separated representation of the nested object properties to be found within your `package.json`, it's the From 1fe1c9b74ea3c3d5bb5b3696b954422b9b55dd91 Mon Sep 17 00:00:00 2001 From: Demira Dimitrova Date: Wed, 7 Jul 2021 10:56:06 +0200 Subject: [PATCH 03/13] fix(docs): updated policy urls PR-URL: https://github.com/npm/cli/pull/3523 Credit: @DemiraDimitrova Close: #3523 Reviewed-by: @wraithgar --- CONTRIBUTING.md | 2 +- docs/content/commands/npm-unpublish.md | 2 +- docs/content/commands/npm.md | 2 +- docs/content/using-npm/registry.md | 2 +- packages/libnpmdiff/README.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 558ce2a839b23..ec1c513864c1b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Code of Conduct -All interactions in the **npm** organization on GitHub are considered to be covered by our standard [Code of Conduct](https://www.npmjs.com/policies/conduct). +All interactions in the **npm** organization on GitHub are considered to be covered by our standard [Code of Conduct](https://docs.npmjs.com/policies/conduct). ## Development diff --git a/docs/content/commands/npm-unpublish.md b/docs/content/commands/npm-unpublish.md index 82779ab65938c..b17ff45406829 100644 --- a/docs/content/commands/npm-unpublish.md +++ b/docs/content/commands/npm-unpublish.md @@ -7,7 +7,7 @@ description: Remove a package from the registry ### Synopsis To learn more about how the npm registry treats unpublish, see our unpublish policies #### Unpublishing a single version of a package diff --git a/docs/content/commands/npm.md b/docs/content/commands/npm.md index 7ff1cc490707e..de510870640d1 100644 --- a/docs/content/commands/npm.md +++ b/docs/content/commands/npm.md @@ -31,7 +31,7 @@ Run `npm help` to get a list of available commands. npm comes preconfigured to use npm's public registry at https://registry.npmjs.org by default. Use of the npm public registry is subject to terms of use available at -https://www.npmjs.com/policies/terms. +https://docs.npmjs.com/policies/terms. You can configure npm to use any compatible registry you like, and even run your own registry. Use of someone else's registry is governed by diff --git a/docs/content/using-npm/registry.md b/docs/content/using-npm/registry.md index c07fa7a48e888..3b07ab11c5bdc 100644 --- a/docs/content/using-npm/registry.md +++ b/docs/content/using-npm/registry.md @@ -12,7 +12,7 @@ package info. npm is configured to use the **npm public registry** at by default. Use of the npm public registry is -subject to terms of use available at . +subject to terms of use available at . You can configure npm to use any compatible registry you like, and even run your own registry. Use of someone else's registry may be governed by their diff --git a/packages/libnpmdiff/README.md b/packages/libnpmdiff/README.md index bc260ad15ce12..6c60f714bb776 100644 --- a/packages/libnpmdiff/README.md +++ b/packages/libnpmdiff/README.md @@ -61,7 +61,7 @@ hesitate to jump in if you'd like to, or even ask us questions if something isn't clear. All participants and maintainers in this project are expected to follow the -[npm Code of Conduct](https://www.npmjs.com/policies/conduct), and just +[npm Code of Conduct](https://docs.npmjs.com/policies/conduct), and just generally be excellent to each other. Please refer to the [Changelog](CHANGELOG.md) for project history details, too. From 009ad1e683aa061d7e5c78b9362b0bd1b14ee643 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 20 Jul 2021 07:53:08 -0700 Subject: [PATCH 04/13] fix(exit-handler): always warn if not called If the exit handler wasn't called it is always a problem, even if there is no exit code. PR-URL: https://github.com/npm/cli/pull/3561 Credit: @wraithgar Close: #3561 Reviewed-by: @lukekarrys --- lib/utils/exit-handler.js | 19 ++++++++++--------- test/lib/utils/exit-handler.js | 11 +++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/utils/exit-handler.js b/lib/utils/exit-handler.js index 95c9655a716cf..7be138d2c361f 100644 --- a/lib/utils/exit-handler.js +++ b/lib/utils/exit-handler.js @@ -52,16 +52,17 @@ process.on('exit', code => { if (!code) npm.log.info('ok') - else { + else npm.log.verbose('code', code) - if (!exitHandlerCalled) { - npm.log.error('', 'Exit handler never called!') - console.error('') - npm.log.error('', 'This is an error with npm itself. Please report this error at:') - npm.log.error('', ' ') - // TODO this doesn't have an npm.config.loaded guard - writeLogFile() - } + + if (!exitHandlerCalled) { + process.exitCode = code || 1 + npm.log.error('', 'Exit handler never called!') + console.error('') + npm.log.error('', 'This is an error with npm itself. Please report this error at:') + npm.log.error('', ' ') + // TODO this doesn't have an npm.config.loaded guard + writeLogFile() } // In timing mode we always write the log file if (npm.config.loaded && npm.config.get('timing') && !wroteLogFile) diff --git a/test/lib/utils/exit-handler.js b/test/lib/utils/exit-handler.js index 981ac9a32b684..c88a1aef67927 100644 --- a/test/lib/utils/exit-handler.js +++ b/test/lib/utils/exit-handler.js @@ -336,15 +336,14 @@ t.test('defaults to log error msg if stack is missing', (t) => { t.end() }) -t.test('exits cleanly when emitting exit event', (t) => { - t.plan(1) +t.test('exits uncleanly when only emitting exit event', (t) => { + t.plan(2) npm.log.level = 'silent' process.emit('exit') - t.match( - npm.log.record.find(r => r.level === 'info'), - { prefix: 'ok', message: '' } - ) + const logData = fs.readFileSync(logFile, 'utf8') + t.match(logData, 'Exit handler never called!') + t.match(process.exitCode, 1, 'exitCode coerced to 1') t.end() }) From eb67054c8303348b25f9717c8f82c8d8d494a242 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 20 Jul 2021 11:03:38 -0700 Subject: [PATCH 05/13] fix(config): consolidate use of npm.color The config value for `color` should never be directly read by npm, or its submodules. The derived value `npm.color` or `npm.flatOptions.color` is what we want to use. This PR consolidates the use of these values, makes sure there is only one place the value is actually calculated, and stops relying on duplicated code in the setup-log.js file for setting one of them. PR-URL: https://github.com/npm/cli/pull/3563 Credit: @wraithgar Close: #3563 Reviewed-by: @lukekarrys --- lib/exec.js | 4 +--- lib/fund.js | 2 +- lib/ls.js | 2 +- lib/npm.js | 8 +++++++- lib/run-script.js | 2 +- lib/utils/config/definitions.js | 3 +++ lib/utils/setup-log.js | 3 +-- test/lib/exec.js | 10 +++++++--- test/lib/utils/error-message.js | 5 ++++- test/lib/utils/setup-log.js | 24 ++++++++++++------------ 10 files changed, 38 insertions(+), 25 deletions(-) diff --git a/lib/exec.js b/lib/exec.js index 959fab66634bd..8c64c2f240581 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -68,7 +68,6 @@ class Exec extends BaseCommand { async _exec (_args, { locationMsg, path, runPath }) { const args = [..._args] const call = this.npm.config.get('call') - const color = this.npm.config.get('color') const { flatOptions, localBin, @@ -87,7 +86,6 @@ class Exec extends BaseCommand { ...flatOptions, args, call, - color, localBin, locationMsg, log, @@ -103,7 +101,7 @@ class Exec extends BaseCommand { async _execWorkspaces (args, filters) { await this.setWorkspaces(filters) - const color = this.npm.config.get('color') + const color = this.npm.color for (const path of this.workspacePaths) { const locationMsg = await getLocationMsg({ color, path }) diff --git a/lib/fund.js b/lib/fund.js index 92580a756e8af..1e0fa1ecb9d73 100644 --- a/lib/fund.js +++ b/lib/fund.js @@ -109,7 +109,7 @@ class Fund extends ArboristWorkspaceCmd { } printHuman (fundingInfo) { - const color = !!this.npm.color + const color = this.npm.color const unicode = this.npm.config.get('unicode') const seenUrls = new Map() diff --git a/lib/ls.js b/lib/ls.js index 91e9a9dd3dba8..7e41892c53442 100644 --- a/lib/ls.js +++ b/lib/ls.js @@ -67,7 +67,7 @@ class LS extends ArboristWorkspaceCmd { async ls (args) { const all = this.npm.config.get('all') - const color = !!this.npm.color + const color = this.npm.color const depth = this.npm.config.get('depth') const dev = this.npm.config.get('dev') const development = this.npm.config.get('development') diff --git a/lib/npm.js b/lib/npm.js index db3559a384bd7..966d11210c275 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -232,7 +232,7 @@ const npm = module.exports = new class extends EventEmitter { process.emit('timeEnd', 'npm:load:setTitle') process.emit('time', 'npm:load:setupLog') - this.color = setupLog(this.config) + setupLog(this.config) process.emit('timeEnd', 'npm:load:setupLog') process.env.COLOR = this.color ? '1' : '0' @@ -261,6 +261,12 @@ const npm = module.exports = new class extends EventEmitter { return flat } + get color () { + // This is a special derived value that takes into consideration not only + // the config, but whether or not we are operating in a tty. + return this.flatOptions.color + } + get lockfileVersion () { return 2 } diff --git a/lib/run-script.js b/lib/run-script.js index b94d2fce07180..1daaeb9900de1 100644 --- a/lib/run-script.js +++ b/lib/run-script.js @@ -137,7 +137,7 @@ class RunScript extends BaseCommand { path = path || this.npm.localPrefix const { scripts, name, _id } = await rpj(`${path}/package.json`) const pkgid = _id || name - const color = !!this.npm.color + const color = this.npm.color if (!scripts) return [] diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index abe6bda70d8bc..36b8a84a61c47 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -438,6 +438,9 @@ define('cidr', { flatten, }) +// This should never be directly used, the flattened value is the derived value +// and is sent to other modules, and is also exposed as `npm.color` for use +// inside npm itself. define('color', { default: !process.env.NO_COLOR || process.env.NO_COLOR === '0', usage: '--color|--no-color|--color always', diff --git a/lib/utils/setup-log.js b/lib/utils/setup-log.js index 9ee79d192d9ea..aaf7fa47e266d 100644 --- a/lib/utils/setup-log.js +++ b/lib/utils/setup-log.js @@ -18,6 +18,7 @@ module.exports = (config) => { const stderrTTY = process.stderr.isTTY const dumbTerm = process.env.TERM === 'dumb' const stderrNotDumb = stderrTTY && !dumbTerm + // this logic is duplicated in the config 'color' flattener const enableColorStderr = color === 'always' ? true : color === false ? false : stderrTTY @@ -58,6 +59,4 @@ module.exports = (config) => { log.enableProgress() else log.disableProgress() - - return enableColorStdout } diff --git a/test/lib/exec.js b/test/lib/exec.js index 6d99c7959d88e..03a1bedf97e50 100644 --- a/test/lib/exec.js +++ b/test/lib/exec.js @@ -25,6 +25,7 @@ const LOG_WARN = [] let PROGRESS_IGNORED = false const flatOptions = { npxCache: 'npx-cache-dir', + color: false, cache: 'cache-dir', legacyPeerDeps: false, package: [], @@ -109,12 +110,13 @@ t.afterEach(() => { LOG_WARN.length = 0 PROGRESS_IGNORED = false flatOptions.legacyPeerDeps = false - config.color = false + flatOptions.color = false config['script-shell'] = 'shell-cmd' config.package = [] flatOptions.package = [] config.call = '' config.yes = true + npm.color = false npm.localBin = 'local-bin' npm.globalBin = 'global-bin' }) @@ -268,7 +270,8 @@ t.test('npm exec , run interactive shell', t => { t.test('print message with color when tty and not in CI', t => { CI_NAME = null process.stdin.isTTY = true - config.color = true + npm.color = true + flatOptions.color = true run(t, true, () => { t.strictSame(LOG_WARN, []) @@ -1204,7 +1207,8 @@ t.test('workspaces', t => { }) }) - config.color = true + npm.color = true + flatOptions.color = true npm._mockOutputs.length = 0 await new Promise((res, rej) => { exec.execWorkspaces([], ['a'], er => { diff --git a/test/lib/utils/error-message.js b/test/lib/utils/error-message.js index 3fdfb8cc25089..908d70fc3924d 100644 --- a/test/lib/utils/error-message.js +++ b/test/lib/utils/error-message.js @@ -15,6 +15,9 @@ const { resolve } = require('path') const npm = require('../../../lib/npm.js') const CACHE = '/some/cache/dir' npm.config = { + flat: { + color: false, + }, loaded: false, localPrefix: '/some/prefix/dir', get: key => { @@ -467,7 +470,7 @@ t.test('explain ERESOLVE errors', t => { t.matchSnapshot(errorMessage(er, npm)) t.match(EXPLAIN_CALLED, [[ er, - undefined, + false, path.resolve(npm.cache, 'eresolve-report.txt'), ]]) t.end() diff --git a/test/lib/utils/setup-log.js b/test/lib/utils/setup-log.js index 86befe6e29297..7f907bc7e4148 100644 --- a/test/lib/utils/setup-log.js +++ b/test/lib/utils/setup-log.js @@ -84,12 +84,12 @@ t.test('setup with color=always and unicode', t => { t.strictSame(WARN_CALLED, [['ERESOLVE', 'hello', { some: 'object' }]]) WARN_CALLED.length = 0 - t.equal(setupLog(config({ + setupLog(config({ loglevel: 'warn', color: 'always', unicode: true, progress: false, - })), true) + })) npmlog.warn('ERESOLVE', 'hello', { some: { other: 'object' } }) t.strictSame(EXPLAIN_CALLED, [[{ some: { other: 'object' } }, true, 2]], @@ -125,12 +125,12 @@ t.test('setup with color=true, no unicode, and non-TTY terminal', t => { process.stderr.isTTY = false process.stdout.isTTY = false - t.equal(setupLog(config({ + setupLog(config({ loglevel: 'warn', color: false, progress: false, heading: 'asdf', - })), false) + })) t.strictSame(settings, { level: 'warn', @@ -156,12 +156,12 @@ t.test('setup with color=true, no unicode, and dumb TTY terminal', t => { process.stdout.isTTY = true process.env.TERM = 'dumb' - t.equal(setupLog(config({ + setupLog(config({ loglevel: 'warn', color: true, progress: false, heading: 'asdf', - })), true) + })) t.strictSame(settings, { level: 'warn', @@ -187,12 +187,12 @@ t.test('setup with color=true, no unicode, and non-dumb TTY terminal', t => { process.stdout.isTTY = true process.env.TERM = 'totes not dum' - t.equal(setupLog(config({ + setupLog(config({ loglevel: 'warn', color: true, progress: true, heading: 'asdf', - })), true) + })) t.strictSame(settings, { level: 'warn', @@ -218,12 +218,12 @@ t.test('setup with non-TTY stdout, TTY stderr', t => { process.stdout.isTTY = false process.env.TERM = 'definitely not a dummy' - t.equal(setupLog(config({ + setupLog(config({ loglevel: 'warn', color: true, progress: true, heading: 'asdf', - })), false) + })) t.strictSame(settings, { level: 'warn', @@ -248,12 +248,12 @@ t.test('setup with TTY stdout, non-TTY stderr', t => { process.stderr.isTTY = false process.stdout.isTTY = true - t.equal(setupLog(config({ + setupLog(config({ loglevel: 'warn', color: true, progress: true, heading: 'asdf', - })), true) + })) t.strictSame(settings, { level: 'warn', From d7f29e8c94ae77661390f82ae72efc1bd6fcfbc3 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 07:20:59 -0700 Subject: [PATCH 06/13] read-package-json-fast@2.0.3 - feat: load directories.bin as a bin object --- node_modules/read-package-json-fast/index.js | 43 ++++++++++++++++++- .../read-package-json-fast/package.json | 4 +- package-lock.json | 14 +++--- package.json | 2 +- 4 files changed, 52 insertions(+), 11 deletions(-) diff --git a/node_modules/read-package-json-fast/index.js b/node_modules/read-package-json-fast/index.js index bc1c059272c04..646ff7dfbbd76 100644 --- a/node_modules/read-package-json-fast/index.js +++ b/node_modules/read-package-json-fast/index.js @@ -1,15 +1,56 @@ const {promisify} = require('util') const fs = require('fs') const readFile = promisify(fs.readFile) +const lstat = promisify(fs.lstat) +const readdir = promisify(fs.readdir) const parse = require('json-parse-even-better-errors') + +const { resolve, dirname, join, relative } = require('path') + const rpj = path => readFile(path, 'utf8') - .then(data => normalize(stripUnderscores(parse(data)))) + .then(data => readBinDir(path, normalize(stripUnderscores(parse(data))))) .catch(er => { er.path = path throw er }) + const normalizePackageBin = require('npm-normalize-package-bin') +// load the directories.bin folder as a 'bin' object +const readBinDir = async (path, data) => { + if (data.bin) + return data + + const m = data.directories && data.directories.bin + if (!m || typeof m !== 'string') + return data + + // cut off any monkey business, like setting directories.bin + // to ../../../etc/passwd or /etc/passwd or something like that. + const root = dirname(path) + const dir = join('.', join('/', m)) + data.bin = await walkBinDir(root, dir, {}) + return data +} + +const walkBinDir = async (root, dir, obj) => { + const entries = await readdir(resolve(root, dir)).catch(() => []) + for (const entry of entries) { + if (entry.charAt(0) === '.') + continue + const f = resolve(root, dir, entry) + // ignore stat errors, weird file types, symlinks, etc. + const st = await lstat(f).catch(() => null) + if (!st) + continue + else if (st.isFile()) + obj[entry] = relative(root, f) + else if (st.isDirectory()) + await walkBinDir(root, join(dir, entry), obj) + } + return obj +} + // do not preserve _fields set in files, they are sus const stripUnderscores = data => { for (const key of Object.keys(data).filter(k => /^_/.test(k))) diff --git a/node_modules/read-package-json-fast/package.json b/node_modules/read-package-json-fast/package.json index 388e76595833e..c3a9f7dc5c37b 100644 --- a/node_modules/read-package-json-fast/package.json +++ b/node_modules/read-package-json-fast/package.json @@ -1,6 +1,6 @@ { "name": "read-package-json-fast", - "version": "2.0.2", + "version": "2.0.3", "description": "Like read-package-json, but faster", "author": "Isaac Z. Schlueter (https://izs.me)", "license": "ISC", @@ -18,7 +18,7 @@ "check-coverage": true }, "devDependencies": { - "tap": "^14.10.1" + "tap": "^15.0.9" }, "dependencies": { "json-parse-even-better-errors": "^2.3.0", diff --git a/package-lock.json b/package-lock.json index 873464a3cf4b2..39774a475d88e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -139,7 +139,7 @@ "qrcode-terminal": "^0.12.0", "read": "~1.0.7", "read-package-json": "^3.0.1", - "read-package-json-fast": "^2.0.2", + "read-package-json-fast": "^2.0.3", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", @@ -6392,9 +6392,9 @@ } }, "node_modules/read-package-json-fast": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-2.0.2.tgz", - "integrity": "sha512-5fyFUyO9B799foVk4n6ylcoAktG/FbE3jwRKxvwaeSrIunaoMc0u81dzXxjeAFKOce7O5KncdfwpGvvs6r5PsQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz", + "integrity": "sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ==", "inBundle": true, "dependencies": { "json-parse-even-better-errors": "^2.3.0", @@ -15081,9 +15081,9 @@ } }, "read-package-json-fast": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-2.0.2.tgz", - "integrity": "sha512-5fyFUyO9B799foVk4n6ylcoAktG/FbE3jwRKxvwaeSrIunaoMc0u81dzXxjeAFKOce7O5KncdfwpGvvs6r5PsQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz", + "integrity": "sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ==", "requires": { "json-parse-even-better-errors": "^2.3.0", "npm-normalize-package-bin": "^1.0.1" diff --git a/package.json b/package.json index f0b9642905ced..a791cf54a641e 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "qrcode-terminal": "^0.12.0", "read": "~1.0.7", "read-package-json": "^3.0.1", - "read-package-json-fast": "^2.0.2", + "read-package-json-fast": "^2.0.3", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.5", From 8dc74de112738725e17b3019b65bad12e3bf810b Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 07:21:59 -0700 Subject: [PATCH 07/13] eslint@7.31.0 --- package-lock.json | 54 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 39774a475d88e..7fe60ea862cb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -157,7 +157,7 @@ "npx": "bin/npx-cli.js" }, "devDependencies": { - "eslint": "^7.30.0", + "eslint": "^7.31.0", "eslint-plugin-import": "^2.23.4", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", @@ -543,9 +543,9 @@ "dev": true }, "node_modules/@eslint/eslintrc": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", - "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -563,9 +563,9 @@ } }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", - "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.10.0.tgz", + "integrity": "sha512-piHC3blgLGFjvOuMmWZX60f+na1lXFDhQXBf1UYp2fXPXqvEUbOhNwi6BsQ0bQishwedgnjkwv1d9zKf+MWw3g==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1027,9 +1027,9 @@ } }, "node_modules/acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -2550,13 +2550,13 @@ } }, "node_modules/eslint": { - "version": "7.30.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.30.0.tgz", - "integrity": "sha512-VLqz80i3as3NdloY44BQSJpFw534L9Oh+6zJOUaViV4JPd+DaHwutqP7tcpkW3YiXbK6s05RZl7yl7cQn+lijg==", + "version": "7.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.31.0.tgz", + "integrity": "sha512-vafgJpSh2ia8tnTkNUkwxGmnumgckLh5aAbLa1xRmIn9+owi8qBNGKL+B881kNKNTy7FFqTEkpNkUvmw0n6PkA==", "dev": true, "dependencies": { "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.2", + "@eslint/eslintrc": "^0.4.3", "@humanwhocodes/config-array": "^0.5.0", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -10750,9 +10750,9 @@ "dev": true }, "@eslint/eslintrc": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", - "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -10767,9 +10767,9 @@ }, "dependencies": { "globals": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", - "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.10.0.tgz", + "integrity": "sha512-piHC3blgLGFjvOuMmWZX60f+na1lXFDhQXBf1UYp2fXPXqvEUbOhNwi6BsQ0bQishwedgnjkwv1d9zKf+MWw3g==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -11134,9 +11134,9 @@ } }, "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "requires": {} }, @@ -12256,13 +12256,13 @@ } }, "eslint": { - "version": "7.30.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.30.0.tgz", - "integrity": "sha512-VLqz80i3as3NdloY44BQSJpFw534L9Oh+6zJOUaViV4JPd+DaHwutqP7tcpkW3YiXbK6s05RZl7yl7cQn+lijg==", + "version": "7.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.31.0.tgz", + "integrity": "sha512-vafgJpSh2ia8tnTkNUkwxGmnumgckLh5aAbLa1xRmIn9+owi8qBNGKL+B881kNKNTy7FFqTEkpNkUvmw0n6PkA==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.2", + "@eslint/eslintrc": "^0.4.3", "@humanwhocodes/config-array": "^0.5.0", "ajv": "^6.10.0", "chalk": "^4.0.0", diff --git a/package.json b/package.json index a791cf54a641e..e91ff4bef974b 100644 --- a/package.json +++ b/package.json @@ -193,7 +193,7 @@ "write-file-atomic" ], "devDependencies": { - "eslint": "^7.30.0", + "eslint": "^7.31.0", "eslint-plugin-import": "^2.23.4", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", From b1fefa73db2f8d9c55b4447ffc1cdbaf8e9bb298 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 10:12:35 -0700 Subject: [PATCH 08/13] npmlog@5.0.0 --- node_modules/.gitignore | 1 - node_modules/color-support/LICENSE | 15 + node_modules/color-support/bin.js | 3 + node_modules/color-support/browser.js | 14 + node_modules/color-support/index.js | 134 +++++++ node_modules/color-support/package.json | 36 ++ node_modules/gauge/has-color.js | 12 +- node_modules/gauge/index.js | 2 +- .../is-fullwidth-code-point/readme.md | 39 -- .../gauge/node_modules/string-width/readme.md | 42 --- node_modules/gauge/package.json | 30 +- node_modules/gauge/progress-bar.js | 2 +- node_modules/gauge/render-template.js | 5 +- node_modules/gauge/template-item.js | 1 - node_modules/gauge/theme-set.js | 1 - node_modules/gauge/themes.js | 28 +- .../node_modules/aproba/LICENSE | 0 .../node_modules/aproba/index.js | 0 .../node_modules/aproba/package.json | 0 .../node-gyp/node_modules/gauge/LICENSE | 13 + .../node-gyp/node_modules/gauge/base-theme.js | 14 + .../node-gyp/node_modules/gauge/error.js | 24 ++ .../node-gyp/node_modules/gauge/has-color.js | 12 + .../node-gyp/node_modules/gauge/index.js | 233 ++++++++++++ .../node-gyp/node_modules/gauge/package.json | 63 ++++ .../node-gyp/node_modules/gauge/plumbing.js | 48 +++ .../node-gyp/node_modules/gauge/process.js | 3 + .../node_modules/gauge/progress-bar.js | 35 ++ .../node_modules/gauge/render-template.js | 181 +++++++++ .../node_modules/gauge/set-immediate.js | 7 + .../node_modules/gauge/set-interval.js | 3 + .../node-gyp/node_modules/gauge/spin.js | 5 + .../node_modules/gauge/template-item.js | 73 ++++ .../node-gyp/node_modules/gauge/theme-set.js | 115 ++++++ .../node-gyp/node_modules/gauge/themes.js | 54 +++ .../node_modules/gauge/wide-truncate.js | 25 ++ .../is-fullwidth-code-point/index.js | 0 .../is-fullwidth-code-point/license | 0 .../is-fullwidth-code-point/package.json | 0 .../node-gyp/node_modules/npmlog/LICENSE | 15 + .../node-gyp/node_modules/npmlog/log.js | 309 +++++++++++++++ .../node-gyp/node_modules/npmlog/package.json | 28 ++ .../node_modules/string-width/index.js | 0 .../node_modules/string-width/license | 0 .../node_modules/string-width/package.json | 0 node_modules/npmlog/log.js | 160 +++++--- node_modules/npmlog/package.json | 21 +- package-lock.json | 354 +++++++++++++----- package.json | 2 +- 49 files changed, 1885 insertions(+), 277 deletions(-) create mode 100644 node_modules/color-support/LICENSE create mode 100755 node_modules/color-support/bin.js create mode 100644 node_modules/color-support/browser.js create mode 100644 node_modules/color-support/index.js create mode 100644 node_modules/color-support/package.json delete mode 100644 node_modules/gauge/node_modules/is-fullwidth-code-point/readme.md delete mode 100644 node_modules/gauge/node_modules/string-width/readme.md rename node_modules/{gauge => node-gyp}/node_modules/aproba/LICENSE (100%) rename node_modules/{gauge => node-gyp}/node_modules/aproba/index.js (100%) rename node_modules/{gauge => node-gyp}/node_modules/aproba/package.json (100%) create mode 100644 node_modules/node-gyp/node_modules/gauge/LICENSE create mode 100644 node_modules/node-gyp/node_modules/gauge/base-theme.js create mode 100644 node_modules/node-gyp/node_modules/gauge/error.js create mode 100644 node_modules/node-gyp/node_modules/gauge/has-color.js create mode 100644 node_modules/node-gyp/node_modules/gauge/index.js create mode 100644 node_modules/node-gyp/node_modules/gauge/package.json create mode 100644 node_modules/node-gyp/node_modules/gauge/plumbing.js create mode 100644 node_modules/node-gyp/node_modules/gauge/process.js create mode 100644 node_modules/node-gyp/node_modules/gauge/progress-bar.js create mode 100644 node_modules/node-gyp/node_modules/gauge/render-template.js create mode 100644 node_modules/node-gyp/node_modules/gauge/set-immediate.js create mode 100644 node_modules/node-gyp/node_modules/gauge/set-interval.js create mode 100644 node_modules/node-gyp/node_modules/gauge/spin.js create mode 100644 node_modules/node-gyp/node_modules/gauge/template-item.js create mode 100644 node_modules/node-gyp/node_modules/gauge/theme-set.js create mode 100644 node_modules/node-gyp/node_modules/gauge/themes.js create mode 100644 node_modules/node-gyp/node_modules/gauge/wide-truncate.js rename node_modules/{gauge => node-gyp}/node_modules/is-fullwidth-code-point/index.js (100%) rename node_modules/{gauge => node-gyp}/node_modules/is-fullwidth-code-point/license (100%) rename node_modules/{gauge => node-gyp}/node_modules/is-fullwidth-code-point/package.json (100%) create mode 100644 node_modules/node-gyp/node_modules/npmlog/LICENSE create mode 100644 node_modules/node-gyp/node_modules/npmlog/log.js create mode 100644 node_modules/node-gyp/node_modules/npmlog/package.json rename node_modules/{gauge => node-gyp}/node_modules/string-width/index.js (100%) rename node_modules/{gauge => node-gyp}/node_modules/string-width/license (100%) rename node_modules/{gauge => node-gyp}/node_modules/string-width/package.json (100%) diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 7ee129c97fe71..2363ccfda45e8 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -99,7 +99,6 @@ readme* /cliui /cmark-gfm /collapse-white-space -/color-support /comma-separated-tokens /commondir /convert-source-map diff --git a/node_modules/color-support/LICENSE b/node_modules/color-support/LICENSE new file mode 100644 index 0000000000000..19129e315fe59 --- /dev/null +++ b/node_modules/color-support/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/color-support/bin.js b/node_modules/color-support/bin.js new file mode 100755 index 0000000000000..3c0a967218083 --- /dev/null +++ b/node_modules/color-support/bin.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node +var colorSupport = require('./')({alwaysReturn: true }) +console.log(JSON.stringify(colorSupport, null, 2)) diff --git a/node_modules/color-support/browser.js b/node_modules/color-support/browser.js new file mode 100644 index 0000000000000..ab5c6631a35b8 --- /dev/null +++ b/node_modules/color-support/browser.js @@ -0,0 +1,14 @@ +module.exports = colorSupport({ alwaysReturn: true }, colorSupport) + +function colorSupport(options, obj) { + obj = obj || {} + options = options || {} + obj.level = 0 + obj.hasBasic = false + obj.has256 = false + obj.has16m = false + if (!options.alwaysReturn) { + return false + } + return obj +} diff --git a/node_modules/color-support/index.js b/node_modules/color-support/index.js new file mode 100644 index 0000000000000..6b6f3b2819424 --- /dev/null +++ b/node_modules/color-support/index.js @@ -0,0 +1,134 @@ +// call it on itself so we can test the export val for basic stuff +module.exports = colorSupport({ alwaysReturn: true }, colorSupport) + +function hasNone (obj, options) { + obj.level = 0 + obj.hasBasic = false + obj.has256 = false + obj.has16m = false + if (!options.alwaysReturn) { + return false + } + return obj +} + +function hasBasic (obj) { + obj.hasBasic = true + obj.has256 = false + obj.has16m = false + obj.level = 1 + return obj +} + +function has256 (obj) { + obj.hasBasic = true + obj.has256 = true + obj.has16m = false + obj.level = 2 + return obj +} + +function has16m (obj) { + obj.hasBasic = true + obj.has256 = true + obj.has16m = true + obj.level = 3 + return obj +} + +function colorSupport (options, obj) { + options = options || {} + + obj = obj || {} + + // if just requesting a specific level, then return that. + if (typeof options.level === 'number') { + switch (options.level) { + case 0: + return hasNone(obj, options) + case 1: + return hasBasic(obj) + case 2: + return has256(obj) + case 3: + return has16m(obj) + } + } + + obj.level = 0 + obj.hasBasic = false + obj.has256 = false + obj.has16m = false + + if (typeof process === 'undefined' || + !process || + !process.stdout || + !process.env || + !process.platform) { + return hasNone(obj, options) + } + + var env = options.env || process.env + var stream = options.stream || process.stdout + var term = options.term || env.TERM || '' + var platform = options.platform || process.platform + + if (!options.ignoreTTY && !stream.isTTY) { + return hasNone(obj, options) + } + + if (!options.ignoreDumb && term === 'dumb' && !env.COLORTERM) { + return hasNone(obj, options) + } + + if (platform === 'win32') { + return hasBasic(obj) + } + + if (env.TMUX) { + return has256(obj) + } + + if (!options.ignoreCI && (env.CI || env.TEAMCITY_VERSION)) { + if (env.TRAVIS) { + return has256(obj) + } else { + return hasNone(obj, options) + } + } + + // TODO: add more term programs + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + var ver = env.TERM_PROGRAM_VERSION || '0.' + if (/^[0-2]\./.test(ver)) { + return has256(obj) + } else { + return has16m(obj) + } + + case 'HyperTerm': + case 'Hyper': + return has16m(obj) + + case 'MacTerm': + return has16m(obj) + + case 'Apple_Terminal': + return has256(obj) + } + + if (/^xterm-256/.test(term)) { + return has256(obj) + } + + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(term)) { + return hasBasic(obj) + } + + if (env.COLORTERM) { + return hasBasic(obj) + } + + return hasNone(obj, options) +} diff --git a/node_modules/color-support/package.json b/node_modules/color-support/package.json new file mode 100644 index 0000000000000..f3e3b77145d6b --- /dev/null +++ b/node_modules/color-support/package.json @@ -0,0 +1,36 @@ +{ + "name": "color-support", + "version": "1.1.3", + "description": "A module which will endeavor to guess your terminal's level of color support.", + "main": "index.js", + "browser": "browser.js", + "bin": "bin.js", + "devDependencies": { + "tap": "^10.3.3" + }, + "scripts": { + "test": "tap test/*.js --100 -J", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/color-support.git" + }, + "keywords": [ + "terminal", + "color", + "support", + "xterm", + "truecolor", + "256" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "files": [ + "browser.js", + "index.js", + "bin.js" + ] +} diff --git a/node_modules/gauge/has-color.js b/node_modules/gauge/has-color.js index e283a256f26b7..16cba0eb47d33 100644 --- a/node_modules/gauge/has-color.js +++ b/node_modules/gauge/has-color.js @@ -1,12 +1,4 @@ 'use strict' +var colorSupport = require('color-support') -module.exports = isWin32() || isColorTerm() - -function isWin32 () { - return process.platform === 'win32' -} - -function isColorTerm () { - var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i - return !!process.env.COLORTERM || termHasColor.test(process.env.TERM) -} +module.exports = colorSupport().hasBasic diff --git a/node_modules/gauge/index.js b/node_modules/gauge/index.js index c55324008cbfa..87a4bb930834e 100644 --- a/node_modules/gauge/index.js +++ b/node_modules/gauge/index.js @@ -188,7 +188,7 @@ Gauge.prototype.show = function (section, completed) { Gauge.prototype.pulse = function (subsection) { this._status.subsection = subsection || '' - this._status.spun ++ + this._status.spun++ if (this._disabled) return if (!this._showing) return this._requestRedraw() diff --git a/node_modules/gauge/node_modules/is-fullwidth-code-point/readme.md b/node_modules/gauge/node_modules/is-fullwidth-code-point/readme.md deleted file mode 100644 index 4936464b1b415..0000000000000 --- a/node_modules/gauge/node_modules/is-fullwidth-code-point/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) - -> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) - - -## Install - -``` -$ npm install --save is-fullwidth-code-point -``` - - -## Usage - -```js -var isFullwidthCodePoint = require('is-fullwidth-code-point'); - -isFullwidthCodePoint('谢'.codePointAt()); -//=> true - -isFullwidthCodePoint('a'.codePointAt()); -//=> false -``` - - -## API - -### isFullwidthCodePoint(input) - -#### input - -Type: `number` - -[Code point](https://en.wikipedia.org/wiki/Code_point) of a character. - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gauge/node_modules/string-width/readme.md b/node_modules/gauge/node_modules/string-width/readme.md deleted file mode 100644 index 1ab42c93580ec..0000000000000 --- a/node_modules/gauge/node_modules/string-width/readme.md +++ /dev/null @@ -1,42 +0,0 @@ -# string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width) - -> Get the visual width of a string - the number of columns required to display it - -Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - -Useful to be able to measure the actual width of command-line output. - - -## Install - -``` -$ npm install --save string-width -``` - - -## Usage - -```js -const stringWidth = require('string-width'); - -stringWidth('古'); -//=> 2 - -stringWidth('\u001b[1m古\u001b[22m'); -//=> 2 - -stringWidth('a'); -//=> 1 -``` - - -## Related - -- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module -- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string -- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/gauge/package.json b/node_modules/gauge/package.json index 4882cff8390d8..8f1c0af6445fe 100644 --- a/node_modules/gauge/package.json +++ b/node_modules/gauge/package.json @@ -1,11 +1,10 @@ { "name": "gauge", - "version": "2.7.4", + "version": "3.0.0", "description": "A terminal based horizontal guage", "main": "index.js", "scripts": { - "test": "standard && tap test/*.js --coverage", - "prepublish": "rm -f *~" + "test": "standard && tap test/*.js --coverage" }, "repository": { "type": "git", @@ -19,24 +18,24 @@ "author": "Rebecca Turner ", "license": "ISC", "bugs": { - "url": "https://github.com/iarna/gauge/issues" + "url": "https://github.com/npm/gauge/issues" }, - "homepage": "https://github.com/iarna/gauge", + "homepage": "https://github.com/npm/gauge", "dependencies": { - "aproba": "^1.0.3", + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", + "has-unicode": "^2.0.1", "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" + "string-width": "^1.0.1 || ^2.0.0", + "strip-ansi": "^3.0.1 || ^4.0.0", + "wide-align": "^1.1.2" }, "devDependencies": { "readable-stream": "^2.0.6", "require-inject": "^1.4.0", - "standard": "^7.1.2", - "tap": "^5.7.2", + "standard": "^11.0.1", + "tap": "^12.0.1", "through2": "^2.0.0" }, "files": [ @@ -59,5 +58,8 @@ "theme-set.js", "themes.js", "wide-truncate.js" - ] + ], + "engines": { + "node": ">=10" + } } diff --git a/node_modules/gauge/progress-bar.js b/node_modules/gauge/progress-bar.js index 7f8dd68be24cf..1780a8a54d1cb 100644 --- a/node_modules/gauge/progress-bar.js +++ b/node_modules/gauge/progress-bar.js @@ -27,7 +27,7 @@ function repeat (string, width) { result += string } n = Math.floor(n / 2) - /*eslint no-self-assign: 0*/ + /* eslint no-self-assign: 0 */ string += string } while (n && stringWidth(result) < width) diff --git a/node_modules/gauge/render-template.js b/node_modules/gauge/render-template.js index 3261bfbe6f4be..9764c6e0a1556 100644 --- a/node_modules/gauge/render-template.js +++ b/node_modules/gauge/render-template.js @@ -1,7 +1,6 @@ 'use strict' var align = require('wide-align') var validate = require('aproba') -var objectAssign = require('object-assign') var wideTruncate = require('./wide-truncate') var error = require('./error') var TemplateItem = require('./template-item') @@ -34,7 +33,7 @@ function hasPreOrPost (item, values) { } function generatePreAndPost (baseItem, parentValues) { - var item = objectAssign({}, baseItem) + var item = Object.assign({}, baseItem) var values = Object.create(parentValues) var template = [] var pre = preType(item) @@ -82,13 +81,11 @@ function prepareItems (width, template, values) { var output = template.map(cloneAndObjectify).filter(function (item) { return item != null }) - var outputLength = 0 var remainingSpace = width var variableCount = output.length function consumeSpace (length) { if (length > remainingSpace) length = remainingSpace - outputLength += length remainingSpace -= length } diff --git a/node_modules/gauge/template-item.js b/node_modules/gauge/template-item.js index e46f447c941d3..4f02fefaa23ec 100644 --- a/node_modules/gauge/template-item.js +++ b/node_modules/gauge/template-item.js @@ -70,4 +70,3 @@ TemplateItem.prototype.getMinLength = function () { if (this.minLength == null) return null return this.minLength + this.padLeft + this.padRight } - diff --git a/node_modules/gauge/theme-set.js b/node_modules/gauge/theme-set.js index 68971d5d231b0..c022d61cf13cb 100644 --- a/node_modules/gauge/theme-set.js +++ b/node_modules/gauge/theme-set.js @@ -112,4 +112,3 @@ ThemeSetProto.newThemeSet = function () { defaults: JSON.parse(JSON.stringify(this.defaults || {})) }) } - diff --git a/node_modules/gauge/themes.js b/node_modules/gauge/themes.js index eb5a4f5b5e103..df1184db51f2c 100644 --- a/node_modules/gauge/themes.js +++ b/node_modules/gauge/themes.js @@ -1,5 +1,5 @@ 'use strict' -var consoleControl = require('console-control-strings') +var color = require('console-control-strings').color var ThemeSet = require('./theme-set.js') var themes = module.exports = new ThemeSet() @@ -17,12 +17,12 @@ themes.addTheme('ASCII', { themes.addTheme('colorASCII', themes.getTheme('ASCII'), { progressbarTheme: { - preComplete: consoleControl.color('inverse'), - complete: ' ', - postComplete: consoleControl.color('stopInverse'), - preRemaining: consoleControl.color('brightBlack'), + preComplete: color('bgBrightWhite', 'brightWhite'), + complete: '#', + postComplete: color('reset'), + preRemaining: color('bgBrightBlack', 'brightBlack'), remaining: '.', - postRemaining: consoleControl.color('reset') + postRemaining: color('reset') } }) @@ -30,7 +30,7 @@ themes.addTheme('brailleSpinner', { preProgressbar: '⸨', postProgressbar: '⸩', progressbarTheme: { - complete: '░', + complete: '#', remaining: '⠂' }, activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏', @@ -39,12 +39,12 @@ themes.addTheme('brailleSpinner', { themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), { progressbarTheme: { - preComplete: consoleControl.color('inverse'), - complete: ' ', - postComplete: consoleControl.color('stopInverse'), - preRemaining: consoleControl.color('brightBlack'), - remaining: '░', - postRemaining: consoleControl.color('reset') + preComplete: color('bgBrightWhite', 'brightWhite'), + complete: '#', + postComplete: color('reset'), + preRemaining: color('bgBrightBlack', 'brightBlack'), + remaining: '⠂', + postRemaining: color('reset') } }) @@ -52,3 +52,5 @@ themes.setDefault({}, 'ASCII') themes.setDefault({hasColor: true}, 'colorASCII') themes.setDefault({platform: 'darwin', hasUnicode: true}, 'brailleSpinner') themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner') +themes.setDefault({platform: 'linux', hasUnicode: true}, 'brailleSpinner') +themes.setDefault({platform: 'linux', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner') diff --git a/node_modules/gauge/node_modules/aproba/LICENSE b/node_modules/node-gyp/node_modules/aproba/LICENSE similarity index 100% rename from node_modules/gauge/node_modules/aproba/LICENSE rename to node_modules/node-gyp/node_modules/aproba/LICENSE diff --git a/node_modules/gauge/node_modules/aproba/index.js b/node_modules/node-gyp/node_modules/aproba/index.js similarity index 100% rename from node_modules/gauge/node_modules/aproba/index.js rename to node_modules/node-gyp/node_modules/aproba/index.js diff --git a/node_modules/gauge/node_modules/aproba/package.json b/node_modules/node-gyp/node_modules/aproba/package.json similarity index 100% rename from node_modules/gauge/node_modules/aproba/package.json rename to node_modules/node-gyp/node_modules/aproba/package.json diff --git a/node_modules/node-gyp/node_modules/gauge/LICENSE b/node_modules/node-gyp/node_modules/gauge/LICENSE new file mode 100644 index 0000000000000..e756052969b78 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2014, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/gauge/base-theme.js b/node_modules/node-gyp/node_modules/gauge/base-theme.js new file mode 100644 index 0000000000000..0b67638e0211d --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/base-theme.js @@ -0,0 +1,14 @@ +'use strict' +var spin = require('./spin.js') +var progressBar = require('./progress-bar.js') + +module.exports = { + activityIndicator: function (values, theme, width) { + if (values.spun == null) return + return spin(theme, values.spun) + }, + progressbar: function (values, theme, width) { + if (values.completed == null) return + return progressBar(theme, width, values.completed) + } +} diff --git a/node_modules/node-gyp/node_modules/gauge/error.js b/node_modules/node-gyp/node_modules/gauge/error.js new file mode 100644 index 0000000000000..d9914ba5335d2 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/error.js @@ -0,0 +1,24 @@ +'use strict' +var util = require('util') + +var User = exports.User = function User (msg) { + var err = new Error(msg) + Error.captureStackTrace(err, User) + err.code = 'EGAUGE' + return err +} + +exports.MissingTemplateValue = function MissingTemplateValue (item, values) { + var err = new User(util.format('Missing template value "%s"', item.type)) + Error.captureStackTrace(err, MissingTemplateValue) + err.template = item + err.values = values + return err +} + +exports.Internal = function Internal (msg) { + var err = new Error(msg) + Error.captureStackTrace(err, Internal) + err.code = 'EGAUGEINTERNAL' + return err +} diff --git a/node_modules/node-gyp/node_modules/gauge/has-color.js b/node_modules/node-gyp/node_modules/gauge/has-color.js new file mode 100644 index 0000000000000..e283a256f26b7 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/has-color.js @@ -0,0 +1,12 @@ +'use strict' + +module.exports = isWin32() || isColorTerm() + +function isWin32 () { + return process.platform === 'win32' +} + +function isColorTerm () { + var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i + return !!process.env.COLORTERM || termHasColor.test(process.env.TERM) +} diff --git a/node_modules/node-gyp/node_modules/gauge/index.js b/node_modules/node-gyp/node_modules/gauge/index.js new file mode 100644 index 0000000000000..c55324008cbfa --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/index.js @@ -0,0 +1,233 @@ +'use strict' +var Plumbing = require('./plumbing.js') +var hasUnicode = require('has-unicode') +var hasColor = require('./has-color.js') +var onExit = require('signal-exit') +var defaultThemes = require('./themes') +var setInterval = require('./set-interval.js') +var process = require('./process.js') +var setImmediate = require('./set-immediate') + +module.exports = Gauge + +function callWith (obj, method) { + return function () { + return method.call(obj) + } +} + +function Gauge (arg1, arg2) { + var options, writeTo + if (arg1 && arg1.write) { + writeTo = arg1 + options = arg2 || {} + } else if (arg2 && arg2.write) { + writeTo = arg2 + options = arg1 || {} + } else { + writeTo = process.stderr + options = arg1 || arg2 || {} + } + + this._status = { + spun: 0, + section: '', + subsection: '' + } + this._paused = false // are we paused for back pressure? + this._disabled = true // are all progress bar updates disabled? + this._showing = false // do we WANT the progress bar on screen + this._onScreen = false // IS the progress bar on screen + this._needsRedraw = false // should we print something at next tick? + this._hideCursor = options.hideCursor == null ? true : options.hideCursor + this._fixedFramerate = options.fixedFramerate == null + ? !(/^v0\.8\./.test(process.version)) + : options.fixedFramerate + this._lastUpdateAt = null + this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval + + this._themes = options.themes || defaultThemes + this._theme = options.theme + var theme = this._computeTheme(options.theme) + var template = options.template || [ + {type: 'progressbar', length: 20}, + {type: 'activityIndicator', kerning: 1, length: 1}, + {type: 'section', kerning: 1, default: ''}, + {type: 'subsection', kerning: 1, default: ''} + ] + this.setWriteTo(writeTo, options.tty) + var PlumbingClass = options.Plumbing || Plumbing + this._gauge = new PlumbingClass(theme, template, this.getWidth()) + + this._$$doRedraw = callWith(this, this._doRedraw) + this._$$handleSizeChange = callWith(this, this._handleSizeChange) + + this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit + this._removeOnExit = null + + if (options.enabled || (options.enabled == null && this._tty && this._tty.isTTY)) { + this.enable() + } else { + this.disable() + } +} +Gauge.prototype = {} + +Gauge.prototype.isEnabled = function () { + return !this._disabled +} + +Gauge.prototype.setTemplate = function (template) { + this._gauge.setTemplate(template) + if (this._showing) this._requestRedraw() +} + +Gauge.prototype._computeTheme = function (theme) { + if (!theme) theme = {} + if (typeof theme === 'string') { + theme = this._themes.getTheme(theme) + } else if (theme && (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null)) { + var useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode + var useColor = theme.hasColor == null ? hasColor : theme.hasColor + theme = this._themes.getDefault({hasUnicode: useUnicode, hasColor: useColor, platform: theme.platform}) + } + return theme +} + +Gauge.prototype.setThemeset = function (themes) { + this._themes = themes + this.setTheme(this._theme) +} + +Gauge.prototype.setTheme = function (theme) { + this._gauge.setTheme(this._computeTheme(theme)) + if (this._showing) this._requestRedraw() + this._theme = theme +} + +Gauge.prototype._requestRedraw = function () { + this._needsRedraw = true + if (!this._fixedFramerate) this._doRedraw() +} + +Gauge.prototype.getWidth = function () { + return ((this._tty && this._tty.columns) || 80) - 1 +} + +Gauge.prototype.setWriteTo = function (writeTo, tty) { + var enabled = !this._disabled + if (enabled) this.disable() + this._writeTo = writeTo + this._tty = tty || + (writeTo === process.stderr && process.stdout.isTTY && process.stdout) || + (writeTo.isTTY && writeTo) || + this._tty + if (this._gauge) this._gauge.setWidth(this.getWidth()) + if (enabled) this.enable() +} + +Gauge.prototype.enable = function () { + if (!this._disabled) return + this._disabled = false + if (this._tty) this._enableEvents() + if (this._showing) this.show() +} + +Gauge.prototype.disable = function () { + if (this._disabled) return + if (this._showing) { + this._lastUpdateAt = null + this._showing = false + this._doRedraw() + this._showing = true + } + this._disabled = true + if (this._tty) this._disableEvents() +} + +Gauge.prototype._enableEvents = function () { + if (this._cleanupOnExit) { + this._removeOnExit = onExit(callWith(this, this.disable)) + } + this._tty.on('resize', this._$$handleSizeChange) + if (this._fixedFramerate) { + this.redrawTracker = setInterval(this._$$doRedraw, this._updateInterval) + if (this.redrawTracker.unref) this.redrawTracker.unref() + } +} + +Gauge.prototype._disableEvents = function () { + this._tty.removeListener('resize', this._$$handleSizeChange) + if (this._fixedFramerate) clearInterval(this.redrawTracker) + if (this._removeOnExit) this._removeOnExit() +} + +Gauge.prototype.hide = function (cb) { + if (this._disabled) return cb && process.nextTick(cb) + if (!this._showing) return cb && process.nextTick(cb) + this._showing = false + this._doRedraw() + cb && setImmediate(cb) +} + +Gauge.prototype.show = function (section, completed) { + this._showing = true + if (typeof section === 'string') { + this._status.section = section + } else if (typeof section === 'object') { + var sectionKeys = Object.keys(section) + for (var ii = 0; ii < sectionKeys.length; ++ii) { + var key = sectionKeys[ii] + this._status[key] = section[key] + } + } + if (completed != null) this._status.completed = completed + if (this._disabled) return + this._requestRedraw() +} + +Gauge.prototype.pulse = function (subsection) { + this._status.subsection = subsection || '' + this._status.spun ++ + if (this._disabled) return + if (!this._showing) return + this._requestRedraw() +} + +Gauge.prototype._handleSizeChange = function () { + this._gauge.setWidth(this._tty.columns - 1) + this._requestRedraw() +} + +Gauge.prototype._doRedraw = function () { + if (this._disabled || this._paused) return + if (!this._fixedFramerate) { + var now = Date.now() + if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) return + this._lastUpdateAt = now + } + if (!this._showing && this._onScreen) { + this._onScreen = false + var result = this._gauge.hide() + if (this._hideCursor) { + result += this._gauge.showCursor() + } + return this._writeTo.write(result) + } + if (!this._showing && !this._onScreen) return + if (this._showing && !this._onScreen) { + this._onScreen = true + this._needsRedraw = true + if (this._hideCursor) { + this._writeTo.write(this._gauge.hideCursor()) + } + } + if (!this._needsRedraw) return + if (!this._writeTo.write(this._gauge.show(this._status))) { + this._paused = true + this._writeTo.on('drain', callWith(this, function () { + this._paused = false + this._doRedraw() + })) + } +} diff --git a/node_modules/node-gyp/node_modules/gauge/package.json b/node_modules/node-gyp/node_modules/gauge/package.json new file mode 100644 index 0000000000000..4882cff8390d8 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/package.json @@ -0,0 +1,63 @@ +{ + "name": "gauge", + "version": "2.7.4", + "description": "A terminal based horizontal guage", + "main": "index.js", + "scripts": { + "test": "standard && tap test/*.js --coverage", + "prepublish": "rm -f *~" + }, + "repository": { + "type": "git", + "url": "https://github.com/iarna/gauge" + }, + "keywords": [ + "progressbar", + "progress", + "gauge" + ], + "author": "Rebecca Turner ", + "license": "ISC", + "bugs": { + "url": "https://github.com/iarna/gauge/issues" + }, + "homepage": "https://github.com/iarna/gauge", + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "devDependencies": { + "readable-stream": "^2.0.6", + "require-inject": "^1.4.0", + "standard": "^7.1.2", + "tap": "^5.7.2", + "through2": "^2.0.0" + }, + "files": [ + "base-theme.js", + "CHANGELOG.md", + "error.js", + "has-color.js", + "index.js", + "LICENSE", + "package.json", + "plumbing.js", + "process.js", + "progress-bar.js", + "README.md", + "render-template.js", + "set-immediate.js", + "set-interval.js", + "spin.js", + "template-item.js", + "theme-set.js", + "themes.js", + "wide-truncate.js" + ] +} diff --git a/node_modules/node-gyp/node_modules/gauge/plumbing.js b/node_modules/node-gyp/node_modules/gauge/plumbing.js new file mode 100644 index 0000000000000..1afb4af6d5017 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/plumbing.js @@ -0,0 +1,48 @@ +'use strict' +var consoleControl = require('console-control-strings') +var renderTemplate = require('./render-template.js') +var validate = require('aproba') + +var Plumbing = module.exports = function (theme, template, width) { + if (!width) width = 80 + validate('OAN', [theme, template, width]) + this.showing = false + this.theme = theme + this.width = width + this.template = template +} +Plumbing.prototype = {} + +Plumbing.prototype.setTheme = function (theme) { + validate('O', [theme]) + this.theme = theme +} + +Plumbing.prototype.setTemplate = function (template) { + validate('A', [template]) + this.template = template +} + +Plumbing.prototype.setWidth = function (width) { + validate('N', [width]) + this.width = width +} + +Plumbing.prototype.hide = function () { + return consoleControl.gotoSOL() + consoleControl.eraseLine() +} + +Plumbing.prototype.hideCursor = consoleControl.hideCursor + +Plumbing.prototype.showCursor = consoleControl.showCursor + +Plumbing.prototype.show = function (status) { + var values = Object.create(this.theme) + for (var key in status) { + values[key] = status[key] + } + + return renderTemplate(this.width, this.template, values).trim() + + consoleControl.color('reset') + + consoleControl.eraseLine() + consoleControl.gotoSOL() +} diff --git a/node_modules/node-gyp/node_modules/gauge/process.js b/node_modules/node-gyp/node_modules/gauge/process.js new file mode 100644 index 0000000000000..05e85694d755b --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/process.js @@ -0,0 +1,3 @@ +'use strict' +// this exists so we can replace it during testing +module.exports = process diff --git a/node_modules/node-gyp/node_modules/gauge/progress-bar.js b/node_modules/node-gyp/node_modules/gauge/progress-bar.js new file mode 100644 index 0000000000000..7f8dd68be24cf --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/progress-bar.js @@ -0,0 +1,35 @@ +'use strict' +var validate = require('aproba') +var renderTemplate = require('./render-template.js') +var wideTruncate = require('./wide-truncate') +var stringWidth = require('string-width') + +module.exports = function (theme, width, completed) { + validate('ONN', [theme, width, completed]) + if (completed < 0) completed = 0 + if (completed > 1) completed = 1 + if (width <= 0) return '' + var sofar = Math.round(width * completed) + var rest = width - sofar + var template = [ + {type: 'complete', value: repeat(theme.complete, sofar), length: sofar}, + {type: 'remaining', value: repeat(theme.remaining, rest), length: rest} + ] + return renderTemplate(width, template, theme) +} + +// lodash's way of repeating +function repeat (string, width) { + var result = '' + var n = width + do { + if (n % 2) { + result += string + } + n = Math.floor(n / 2) + /*eslint no-self-assign: 0*/ + string += string + } while (n && stringWidth(result) < width) + + return wideTruncate(result, width) +} diff --git a/node_modules/node-gyp/node_modules/gauge/render-template.js b/node_modules/node-gyp/node_modules/gauge/render-template.js new file mode 100644 index 0000000000000..3261bfbe6f4be --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/render-template.js @@ -0,0 +1,181 @@ +'use strict' +var align = require('wide-align') +var validate = require('aproba') +var objectAssign = require('object-assign') +var wideTruncate = require('./wide-truncate') +var error = require('./error') +var TemplateItem = require('./template-item') + +function renderValueWithValues (values) { + return function (item) { + return renderValue(item, values) + } +} + +var renderTemplate = module.exports = function (width, template, values) { + var items = prepareItems(width, template, values) + var rendered = items.map(renderValueWithValues(values)).join('') + return align.left(wideTruncate(rendered, width), width) +} + +function preType (item) { + var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1) + return 'pre' + cappedTypeName +} + +function postType (item) { + var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1) + return 'post' + cappedTypeName +} + +function hasPreOrPost (item, values) { + if (!item.type) return + return values[preType(item)] || values[postType(item)] +} + +function generatePreAndPost (baseItem, parentValues) { + var item = objectAssign({}, baseItem) + var values = Object.create(parentValues) + var template = [] + var pre = preType(item) + var post = postType(item) + if (values[pre]) { + template.push({value: values[pre]}) + values[pre] = null + } + item.minLength = null + item.length = null + item.maxLength = null + template.push(item) + values[item.type] = values[item.type] + if (values[post]) { + template.push({value: values[post]}) + values[post] = null + } + return function ($1, $2, length) { + return renderTemplate(length, template, values) + } +} + +function prepareItems (width, template, values) { + function cloneAndObjectify (item, index, arr) { + var cloned = new TemplateItem(item, width) + var type = cloned.type + if (cloned.value == null) { + if (!(type in values)) { + if (cloned.default == null) { + throw new error.MissingTemplateValue(cloned, values) + } else { + cloned.value = cloned.default + } + } else { + cloned.value = values[type] + } + } + if (cloned.value == null || cloned.value === '') return null + cloned.index = index + cloned.first = index === 0 + cloned.last = index === arr.length - 1 + if (hasPreOrPost(cloned, values)) cloned.value = generatePreAndPost(cloned, values) + return cloned + } + + var output = template.map(cloneAndObjectify).filter(function (item) { return item != null }) + + var outputLength = 0 + var remainingSpace = width + var variableCount = output.length + + function consumeSpace (length) { + if (length > remainingSpace) length = remainingSpace + outputLength += length + remainingSpace -= length + } + + function finishSizing (item, length) { + if (item.finished) throw new error.Internal('Tried to finish template item that was already finished') + if (length === Infinity) throw new error.Internal('Length of template item cannot be infinity') + if (length != null) item.length = length + item.minLength = null + item.maxLength = null + --variableCount + item.finished = true + if (item.length == null) item.length = item.getBaseLength() + if (item.length == null) throw new error.Internal('Finished template items must have a length') + consumeSpace(item.getLength()) + } + + output.forEach(function (item) { + if (!item.kerning) return + var prevPadRight = item.first ? 0 : output[item.index - 1].padRight + if (!item.first && prevPadRight < item.kerning) item.padLeft = item.kerning - prevPadRight + if (!item.last) item.padRight = item.kerning + }) + + // Finish any that have a fixed (literal or intuited) length + output.forEach(function (item) { + if (item.getBaseLength() == null) return + finishSizing(item) + }) + + var resized = 0 + var resizing + var hunkSize + do { + resizing = false + hunkSize = Math.round(remainingSpace / variableCount) + output.forEach(function (item) { + if (item.finished) return + if (!item.maxLength) return + if (item.getMaxLength() < hunkSize) { + finishSizing(item, item.maxLength) + resizing = true + } + }) + } while (resizing && resized++ < output.length) + if (resizing) throw new error.Internal('Resize loop iterated too many times while determining maxLength') + + resized = 0 + do { + resizing = false + hunkSize = Math.round(remainingSpace / variableCount) + output.forEach(function (item) { + if (item.finished) return + if (!item.minLength) return + if (item.getMinLength() >= hunkSize) { + finishSizing(item, item.minLength) + resizing = true + } + }) + } while (resizing && resized++ < output.length) + if (resizing) throw new error.Internal('Resize loop iterated too many times while determining minLength') + + hunkSize = Math.round(remainingSpace / variableCount) + output.forEach(function (item) { + if (item.finished) return + finishSizing(item, hunkSize) + }) + + return output +} + +function renderFunction (item, values, length) { + validate('OON', arguments) + if (item.type) { + return item.value(values, values[item.type + 'Theme'] || {}, length) + } else { + return item.value(values, {}, length) + } +} + +function renderValue (item, values) { + var length = item.getBaseLength() + var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value + if (value == null || value === '') return '' + var alignWith = align[item.align] || align.left + var leftPadding = item.padLeft ? align.left('', item.padLeft) : '' + var rightPadding = item.padRight ? align.right('', item.padRight) : '' + var truncated = wideTruncate(String(value), length) + var aligned = alignWith(truncated, length) + return leftPadding + aligned + rightPadding +} diff --git a/node_modules/node-gyp/node_modules/gauge/set-immediate.js b/node_modules/node-gyp/node_modules/gauge/set-immediate.js new file mode 100644 index 0000000000000..6650a485c4993 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/set-immediate.js @@ -0,0 +1,7 @@ +'use strict' +var process = require('./process') +try { + module.exports = setImmediate +} catch (ex) { + module.exports = process.nextTick +} diff --git a/node_modules/node-gyp/node_modules/gauge/set-interval.js b/node_modules/node-gyp/node_modules/gauge/set-interval.js new file mode 100644 index 0000000000000..576198793c550 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/set-interval.js @@ -0,0 +1,3 @@ +'use strict' +// this exists so we can replace it during testing +module.exports = setInterval diff --git a/node_modules/node-gyp/node_modules/gauge/spin.js b/node_modules/node-gyp/node_modules/gauge/spin.js new file mode 100644 index 0000000000000..34142ee31acc7 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/spin.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = function spin (spinstr, spun) { + return spinstr[spun % spinstr.length] +} diff --git a/node_modules/node-gyp/node_modules/gauge/template-item.js b/node_modules/node-gyp/node_modules/gauge/template-item.js new file mode 100644 index 0000000000000..e46f447c941d3 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/template-item.js @@ -0,0 +1,73 @@ +'use strict' +var stringWidth = require('string-width') + +module.exports = TemplateItem + +function isPercent (num) { + if (typeof num !== 'string') return false + return num.slice(-1) === '%' +} + +function percent (num) { + return Number(num.slice(0, -1)) / 100 +} + +function TemplateItem (values, outputLength) { + this.overallOutputLength = outputLength + this.finished = false + this.type = null + this.value = null + this.length = null + this.maxLength = null + this.minLength = null + this.kerning = null + this.align = 'left' + this.padLeft = 0 + this.padRight = 0 + this.index = null + this.first = null + this.last = null + if (typeof values === 'string') { + this.value = values + } else { + for (var prop in values) this[prop] = values[prop] + } + // Realize percents + if (isPercent(this.length)) { + this.length = Math.round(this.overallOutputLength * percent(this.length)) + } + if (isPercent(this.minLength)) { + this.minLength = Math.round(this.overallOutputLength * percent(this.minLength)) + } + if (isPercent(this.maxLength)) { + this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength)) + } + return this +} + +TemplateItem.prototype = {} + +TemplateItem.prototype.getBaseLength = function () { + var length = this.length + if (length == null && typeof this.value === 'string' && this.maxLength == null && this.minLength == null) { + length = stringWidth(this.value) + } + return length +} + +TemplateItem.prototype.getLength = function () { + var length = this.getBaseLength() + if (length == null) return null + return length + this.padLeft + this.padRight +} + +TemplateItem.prototype.getMaxLength = function () { + if (this.maxLength == null) return null + return this.maxLength + this.padLeft + this.padRight +} + +TemplateItem.prototype.getMinLength = function () { + if (this.minLength == null) return null + return this.minLength + this.padLeft + this.padRight +} + diff --git a/node_modules/node-gyp/node_modules/gauge/theme-set.js b/node_modules/node-gyp/node_modules/gauge/theme-set.js new file mode 100644 index 0000000000000..68971d5d231b0 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/theme-set.js @@ -0,0 +1,115 @@ +'use strict' +var objectAssign = require('object-assign') + +module.exports = function () { + return ThemeSetProto.newThemeSet() +} + +var ThemeSetProto = {} + +ThemeSetProto.baseTheme = require('./base-theme.js') + +ThemeSetProto.newTheme = function (parent, theme) { + if (!theme) { + theme = parent + parent = this.baseTheme + } + return objectAssign({}, parent, theme) +} + +ThemeSetProto.getThemeNames = function () { + return Object.keys(this.themes) +} + +ThemeSetProto.addTheme = function (name, parent, theme) { + this.themes[name] = this.newTheme(parent, theme) +} + +ThemeSetProto.addToAllThemes = function (theme) { + var themes = this.themes + Object.keys(themes).forEach(function (name) { + objectAssign(themes[name], theme) + }) + objectAssign(this.baseTheme, theme) +} + +ThemeSetProto.getTheme = function (name) { + if (!this.themes[name]) throw this.newMissingThemeError(name) + return this.themes[name] +} + +ThemeSetProto.setDefault = function (opts, name) { + if (name == null) { + name = opts + opts = {} + } + var platform = opts.platform == null ? 'fallback' : opts.platform + var hasUnicode = !!opts.hasUnicode + var hasColor = !!opts.hasColor + if (!this.defaults[platform]) this.defaults[platform] = {true: {}, false: {}} + this.defaults[platform][hasUnicode][hasColor] = name +} + +ThemeSetProto.getDefault = function (opts) { + if (!opts) opts = {} + var platformName = opts.platform || process.platform + var platform = this.defaults[platformName] || this.defaults.fallback + var hasUnicode = !!opts.hasUnicode + var hasColor = !!opts.hasColor + if (!platform) throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor) + if (!platform[hasUnicode][hasColor]) { + if (hasUnicode && hasColor && platform[!hasUnicode][hasColor]) { + hasUnicode = false + } else if (hasUnicode && hasColor && platform[hasUnicode][!hasColor]) { + hasColor = false + } else if (hasUnicode && hasColor && platform[!hasUnicode][!hasColor]) { + hasUnicode = false + hasColor = false + } else if (hasUnicode && !hasColor && platform[!hasUnicode][hasColor]) { + hasUnicode = false + } else if (!hasUnicode && hasColor && platform[hasUnicode][!hasColor]) { + hasColor = false + } else if (platform === this.defaults.fallback) { + throw this.newMissingDefaultThemeError(platformName, hasUnicode, hasColor) + } + } + if (platform[hasUnicode][hasColor]) { + return this.getTheme(platform[hasUnicode][hasColor]) + } else { + return this.getDefault(objectAssign({}, opts, {platform: 'fallback'})) + } +} + +ThemeSetProto.newMissingThemeError = function newMissingThemeError (name) { + var err = new Error('Could not find a gauge theme named "' + name + '"') + Error.captureStackTrace.call(err, newMissingThemeError) + err.theme = name + err.code = 'EMISSINGTHEME' + return err +} + +ThemeSetProto.newMissingDefaultThemeError = function newMissingDefaultThemeError (platformName, hasUnicode, hasColor) { + var err = new Error( + 'Could not find a gauge theme for your platform/unicode/color use combo:\n' + + ' platform = ' + platformName + '\n' + + ' hasUnicode = ' + hasUnicode + '\n' + + ' hasColor = ' + hasColor) + Error.captureStackTrace.call(err, newMissingDefaultThemeError) + err.platform = platformName + err.hasUnicode = hasUnicode + err.hasColor = hasColor + err.code = 'EMISSINGTHEME' + return err +} + +ThemeSetProto.newThemeSet = function () { + var themeset = function (opts) { + return themeset.getDefault(opts) + } + return objectAssign(themeset, ThemeSetProto, { + themes: objectAssign({}, this.themes), + baseTheme: objectAssign({}, this.baseTheme), + defaults: JSON.parse(JSON.stringify(this.defaults || {})) + }) +} + diff --git a/node_modules/node-gyp/node_modules/gauge/themes.js b/node_modules/node-gyp/node_modules/gauge/themes.js new file mode 100644 index 0000000000000..eb5a4f5b5e103 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/themes.js @@ -0,0 +1,54 @@ +'use strict' +var consoleControl = require('console-control-strings') +var ThemeSet = require('./theme-set.js') + +var themes = module.exports = new ThemeSet() + +themes.addTheme('ASCII', { + preProgressbar: '[', + postProgressbar: ']', + progressbarTheme: { + complete: '#', + remaining: '.' + }, + activityIndicatorTheme: '-\\|/', + preSubsection: '>' +}) + +themes.addTheme('colorASCII', themes.getTheme('ASCII'), { + progressbarTheme: { + preComplete: consoleControl.color('inverse'), + complete: ' ', + postComplete: consoleControl.color('stopInverse'), + preRemaining: consoleControl.color('brightBlack'), + remaining: '.', + postRemaining: consoleControl.color('reset') + } +}) + +themes.addTheme('brailleSpinner', { + preProgressbar: '⸨', + postProgressbar: '⸩', + progressbarTheme: { + complete: '░', + remaining: '⠂' + }, + activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏', + preSubsection: '>' +}) + +themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), { + progressbarTheme: { + preComplete: consoleControl.color('inverse'), + complete: ' ', + postComplete: consoleControl.color('stopInverse'), + preRemaining: consoleControl.color('brightBlack'), + remaining: '░', + postRemaining: consoleControl.color('reset') + } +}) + +themes.setDefault({}, 'ASCII') +themes.setDefault({hasColor: true}, 'colorASCII') +themes.setDefault({platform: 'darwin', hasUnicode: true}, 'brailleSpinner') +themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner') diff --git a/node_modules/node-gyp/node_modules/gauge/wide-truncate.js b/node_modules/node-gyp/node_modules/gauge/wide-truncate.js new file mode 100644 index 0000000000000..c531bc491fbb5 --- /dev/null +++ b/node_modules/node-gyp/node_modules/gauge/wide-truncate.js @@ -0,0 +1,25 @@ +'use strict' +var stringWidth = require('string-width') +var stripAnsi = require('strip-ansi') + +module.exports = wideTruncate + +function wideTruncate (str, target) { + if (stringWidth(str) === 0) return str + if (target <= 0) return '' + if (stringWidth(str) <= target) return str + + // We compute the number of bytes of ansi sequences here and add + // that to our initial truncation to ensure that we don't slice one + // that we want to keep in half. + var noAnsi = stripAnsi(str) + var ansiSize = str.length + noAnsi.length + var truncated = str.slice(0, target + ansiSize) + + // we have to shrink the result to account for our ansi sequence buffer + // (if an ansi sequence was truncated) and double width characters. + while (stringWidth(truncated) > target) { + truncated = truncated.slice(0, -1) + } + return truncated +} diff --git a/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js b/node_modules/node-gyp/node_modules/is-fullwidth-code-point/index.js similarity index 100% rename from node_modules/gauge/node_modules/is-fullwidth-code-point/index.js rename to node_modules/node-gyp/node_modules/is-fullwidth-code-point/index.js diff --git a/node_modules/gauge/node_modules/is-fullwidth-code-point/license b/node_modules/node-gyp/node_modules/is-fullwidth-code-point/license similarity index 100% rename from node_modules/gauge/node_modules/is-fullwidth-code-point/license rename to node_modules/node-gyp/node_modules/is-fullwidth-code-point/license diff --git a/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json b/node_modules/node-gyp/node_modules/is-fullwidth-code-point/package.json similarity index 100% rename from node_modules/gauge/node_modules/is-fullwidth-code-point/package.json rename to node_modules/node-gyp/node_modules/is-fullwidth-code-point/package.json diff --git a/node_modules/node-gyp/node_modules/npmlog/LICENSE b/node_modules/node-gyp/node_modules/npmlog/LICENSE new file mode 100644 index 0000000000000..19129e315fe59 --- /dev/null +++ b/node_modules/node-gyp/node_modules/npmlog/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/npmlog/log.js b/node_modules/node-gyp/node_modules/npmlog/log.js new file mode 100644 index 0000000000000..341f3313ab354 --- /dev/null +++ b/node_modules/node-gyp/node_modules/npmlog/log.js @@ -0,0 +1,309 @@ +'use strict' +var Progress = require('are-we-there-yet') +var Gauge = require('gauge') +var EE = require('events').EventEmitter +var log = exports = module.exports = new EE() +var util = require('util') + +var setBlocking = require('set-blocking') +var consoleControl = require('console-control-strings') + +setBlocking(true) +var stream = process.stderr +Object.defineProperty(log, 'stream', { + set: function (newStream) { + stream = newStream + if (this.gauge) this.gauge.setWriteTo(stream, stream) + }, + get: function () { + return stream + } +}) + +// by default, decide based on tty-ness. +var colorEnabled +log.useColor = function () { + return colorEnabled != null ? colorEnabled : stream.isTTY +} + +log.enableColor = function () { + colorEnabled = true + this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) +} +log.disableColor = function () { + colorEnabled = false + this.gauge.setTheme({hasColor: colorEnabled, hasUnicode: unicodeEnabled}) +} + +// default level +log.level = 'info' + +log.gauge = new Gauge(stream, { + enabled: false, // no progress bars unless asked + theme: {hasColor: log.useColor()}, + template: [ + {type: 'progressbar', length: 20}, + {type: 'activityIndicator', kerning: 1, length: 1}, + {type: 'section', default: ''}, + ':', + {type: 'logline', kerning: 1, default: ''} + ] +}) + +log.tracker = new Progress.TrackerGroup() + +// we track this separately as we may need to temporarily disable the +// display of the status bar for our own loggy purposes. +log.progressEnabled = log.gauge.isEnabled() + +var unicodeEnabled + +log.enableUnicode = function () { + unicodeEnabled = true + this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled}) +} + +log.disableUnicode = function () { + unicodeEnabled = false + this.gauge.setTheme({hasColor: this.useColor(), hasUnicode: unicodeEnabled}) +} + +log.setGaugeThemeset = function (themes) { + this.gauge.setThemeset(themes) +} + +log.setGaugeTemplate = function (template) { + this.gauge.setTemplate(template) +} + +log.enableProgress = function () { + if (this.progressEnabled) return + this.progressEnabled = true + this.tracker.on('change', this.showProgress) + if (this._pause) return + this.gauge.enable() +} + +log.disableProgress = function () { + if (!this.progressEnabled) return + this.progressEnabled = false + this.tracker.removeListener('change', this.showProgress) + this.gauge.disable() +} + +var trackerConstructors = ['newGroup', 'newItem', 'newStream'] + +var mixinLog = function (tracker) { + // mixin the public methods from log into the tracker + // (except: conflicts and one's we handle specially) + Object.keys(log).forEach(function (P) { + if (P[0] === '_') return + if (trackerConstructors.filter(function (C) { return C === P }).length) return + if (tracker[P]) return + if (typeof log[P] !== 'function') return + var func = log[P] + tracker[P] = function () { + return func.apply(log, arguments) + } + }) + // if the new tracker is a group, make sure any subtrackers get + // mixed in too + if (tracker instanceof Progress.TrackerGroup) { + trackerConstructors.forEach(function (C) { + var func = tracker[C] + tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) } + }) + } + return tracker +} + +// Add tracker constructors to the top level log object +trackerConstructors.forEach(function (C) { + log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) } +}) + +log.clearProgress = function (cb) { + if (!this.progressEnabled) return cb && process.nextTick(cb) + this.gauge.hide(cb) +} + +log.showProgress = function (name, completed) { + if (!this.progressEnabled) return + var values = {} + if (name) values.section = name + var last = log.record[log.record.length - 1] + if (last) { + values.subsection = last.prefix + var disp = log.disp[last.level] || last.level + var logline = this._format(disp, log.style[last.level]) + if (last.prefix) logline += ' ' + this._format(last.prefix, this.prefixStyle) + logline += ' ' + last.message.split(/\r?\n/)[0] + values.logline = logline + } + values.completed = completed || this.tracker.completed() + this.gauge.show(values) +}.bind(log) // bind for use in tracker's on-change listener + +// temporarily stop emitting, but don't drop +log.pause = function () { + this._paused = true + if (this.progressEnabled) this.gauge.disable() +} + +log.resume = function () { + if (!this._paused) return + this._paused = false + + var b = this._buffer + this._buffer = [] + b.forEach(function (m) { + this.emitLog(m) + }, this) + if (this.progressEnabled) this.gauge.enable() +} + +log._buffer = [] + +var id = 0 +log.record = [] +log.maxRecordSize = 10000 +log.log = function (lvl, prefix, message) { + var l = this.levels[lvl] + if (l === undefined) { + return this.emit('error', new Error(util.format( + 'Undefined log level: %j', lvl))) + } + + var a = new Array(arguments.length - 2) + var stack = null + for (var i = 2; i < arguments.length; i++) { + var arg = a[i - 2] = arguments[i] + + // resolve stack traces to a plain string. + if (typeof arg === 'object' && arg && + (arg instanceof Error) && arg.stack) { + + Object.defineProperty(arg, 'stack', { + value: stack = arg.stack + '', + enumerable: true, + writable: true + }) + } + } + if (stack) a.unshift(stack + '\n') + message = util.format.apply(util, a) + + var m = { id: id++, + level: lvl, + prefix: String(prefix || ''), + message: message, + messageRaw: a } + + this.emit('log', m) + this.emit('log.' + lvl, m) + if (m.prefix) this.emit(m.prefix, m) + + this.record.push(m) + var mrs = this.maxRecordSize + var n = this.record.length - mrs + if (n > mrs / 10) { + var newSize = Math.floor(mrs * 0.9) + this.record = this.record.slice(-1 * newSize) + } + + this.emitLog(m) +}.bind(log) + +log.emitLog = function (m) { + if (this._paused) { + this._buffer.push(m) + return + } + if (this.progressEnabled) this.gauge.pulse(m.prefix) + var l = this.levels[m.level] + if (l === undefined) return + if (l < this.levels[this.level]) return + if (l > 0 && !isFinite(l)) return + + // If 'disp' is null or undefined, use the lvl as a default + // Allows: '', 0 as valid disp + var disp = log.disp[m.level] != null ? log.disp[m.level] : m.level + this.clearProgress() + m.message.split(/\r?\n/).forEach(function (line) { + if (this.heading) { + this.write(this.heading, this.headingStyle) + this.write(' ') + } + this.write(disp, log.style[m.level]) + var p = m.prefix || '' + if (p) this.write(' ') + this.write(p, this.prefixStyle) + this.write(' ' + line + '\n') + }, this) + this.showProgress() +} + +log._format = function (msg, style) { + if (!stream) return + + var output = '' + if (this.useColor()) { + style = style || {} + var settings = [] + if (style.fg) settings.push(style.fg) + if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1)) + if (style.bold) settings.push('bold') + if (style.underline) settings.push('underline') + if (style.inverse) settings.push('inverse') + if (settings.length) output += consoleControl.color(settings) + if (style.beep) output += consoleControl.beep() + } + output += msg + if (this.useColor()) { + output += consoleControl.color('reset') + } + return output +} + +log.write = function (msg, style) { + if (!stream) return + + stream.write(this._format(msg, style)) +} + +log.addLevel = function (lvl, n, style, disp) { + // If 'disp' is null or undefined, use the lvl as a default + if (disp == null) disp = lvl + this.levels[lvl] = n + this.style[lvl] = style + if (!this[lvl]) { + this[lvl] = function () { + var a = new Array(arguments.length + 1) + a[0] = lvl + for (var i = 0; i < arguments.length; i++) { + a[i + 1] = arguments[i] + } + return this.log.apply(this, a) + }.bind(this) + } + this.disp[lvl] = disp +} + +log.prefixStyle = { fg: 'magenta' } +log.headingStyle = { fg: 'white', bg: 'black' } + +log.style = {} +log.levels = {} +log.disp = {} +log.addLevel('silly', -Infinity, { inverse: true }, 'sill') +log.addLevel('verbose', 1000, { fg: 'blue', bg: 'black' }, 'verb') +log.addLevel('info', 2000, { fg: 'green' }) +log.addLevel('timing', 2500, { fg: 'green', bg: 'black' }) +log.addLevel('http', 3000, { fg: 'green', bg: 'black' }) +log.addLevel('notice', 3500, { fg: 'blue', bg: 'black' }) +log.addLevel('warn', 4000, { fg: 'black', bg: 'yellow' }, 'WARN') +log.addLevel('error', 5000, { fg: 'red', bg: 'black' }, 'ERR!') +log.addLevel('silent', Infinity) + +// allow 'error' prefix +log.on('error', function () {}) diff --git a/node_modules/node-gyp/node_modules/npmlog/package.json b/node_modules/node-gyp/node_modules/npmlog/package.json new file mode 100644 index 0000000000000..7220f8e72a3c7 --- /dev/null +++ b/node_modules/node-gyp/node_modules/npmlog/package.json @@ -0,0 +1,28 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "npmlog", + "description": "logger for npm", + "version": "4.1.2", + "repository": { + "type": "git", + "url": "https://github.com/npm/npmlog.git" + }, + "main": "log.js", + "files": [ + "log.js" + ], + "scripts": { + "test": "standard && tap test/*.js" + }, + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + }, + "devDependencies": { + "standard": "~7.1.2", + "tap": "~5.7.3" + }, + "license": "ISC" +} diff --git a/node_modules/gauge/node_modules/string-width/index.js b/node_modules/node-gyp/node_modules/string-width/index.js similarity index 100% rename from node_modules/gauge/node_modules/string-width/index.js rename to node_modules/node-gyp/node_modules/string-width/index.js diff --git a/node_modules/gauge/node_modules/string-width/license b/node_modules/node-gyp/node_modules/string-width/license similarity index 100% rename from node_modules/gauge/node_modules/string-width/license rename to node_modules/node-gyp/node_modules/string-width/license diff --git a/node_modules/gauge/node_modules/string-width/package.json b/node_modules/node-gyp/node_modules/string-width/package.json similarity index 100% rename from node_modules/gauge/node_modules/string-width/package.json rename to node_modules/node-gyp/node_modules/string-width/package.json diff --git a/node_modules/npmlog/log.js b/node_modules/npmlog/log.js index 341f3313ab354..069154262e4da 100644 --- a/node_modules/npmlog/log.js +++ b/node_modules/npmlog/log.js @@ -13,11 +13,12 @@ var stream = process.stderr Object.defineProperty(log, 'stream', { set: function (newStream) { stream = newStream - if (this.gauge) this.gauge.setWriteTo(stream, stream) + if (this.gauge) + this.gauge.setWriteTo(stream, stream) }, get: function () { return stream - } + }, }) // by default, decide based on tty-ness. @@ -46,8 +47,8 @@ log.gauge = new Gauge(stream, { {type: 'activityIndicator', kerning: 1, length: 1}, {type: 'section', default: ''}, ':', - {type: 'logline', kerning: 1, default: ''} - ] + {type: 'logline', kerning: 1, default: ''}, + ], }) log.tracker = new Progress.TrackerGroup() @@ -77,15 +78,20 @@ log.setGaugeTemplate = function (template) { } log.enableProgress = function () { - if (this.progressEnabled) return + if (this.progressEnabled) + return + this.progressEnabled = true this.tracker.on('change', this.showProgress) - if (this._pause) return + if (this._paused) + return + this.gauge.enable() } log.disableProgress = function () { - if (!this.progressEnabled) return + if (!this.progressEnabled) + return this.progressEnabled = false this.tracker.removeListener('change', this.showProgress) this.gauge.disable() @@ -97,10 +103,20 @@ var mixinLog = function (tracker) { // mixin the public methods from log into the tracker // (except: conflicts and one's we handle specially) Object.keys(log).forEach(function (P) { - if (P[0] === '_') return - if (trackerConstructors.filter(function (C) { return C === P }).length) return - if (tracker[P]) return - if (typeof log[P] !== 'function') return + if (P[0] === '_') + return + + if (trackerConstructors.filter(function (C) { + return C === P + }).length) + return + + if (tracker[P]) + return + + if (typeof log[P] !== 'function') + return + var func = log[P] tracker[P] = function () { return func.apply(log, arguments) @@ -111,7 +127,9 @@ var mixinLog = function (tracker) { if (tracker instanceof Progress.TrackerGroup) { trackerConstructors.forEach(function (C) { var func = tracker[C] - tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) } + tracker[C] = function () { + return mixinLog(func.apply(tracker, arguments)) + } }) } return tracker @@ -119,24 +137,34 @@ var mixinLog = function (tracker) { // Add tracker constructors to the top level log object trackerConstructors.forEach(function (C) { - log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) } + log[C] = function () { + return mixinLog(this.tracker[C].apply(this.tracker, arguments)) + } }) log.clearProgress = function (cb) { - if (!this.progressEnabled) return cb && process.nextTick(cb) + if (!this.progressEnabled) + return cb && process.nextTick(cb) + this.gauge.hide(cb) } log.showProgress = function (name, completed) { - if (!this.progressEnabled) return + if (!this.progressEnabled) + return + var values = {} - if (name) values.section = name + if (name) + values.section = name + var last = log.record[log.record.length - 1] if (last) { values.subsection = last.prefix var disp = log.disp[last.level] || last.level var logline = this._format(disp, log.style[last.level]) - if (last.prefix) logline += ' ' + this._format(last.prefix, this.prefixStyle) + if (last.prefix) + logline += ' ' + this._format(last.prefix, this.prefixStyle) + logline += ' ' + last.message.split(/\r?\n/)[0] values.logline = logline } @@ -147,11 +175,14 @@ log.showProgress = function (name, completed) { // temporarily stop emitting, but don't drop log.pause = function () { this._paused = true - if (this.progressEnabled) this.gauge.disable() + if (this.progressEnabled) + this.gauge.disable() } log.resume = function () { - if (!this._paused) return + if (!this._paused) + return + this._paused = false var b = this._buffer @@ -159,7 +190,8 @@ log.resume = function () { b.forEach(function (m) { this.emitLog(m) }, this) - if (this.progressEnabled) this.gauge.enable() + if (this.progressEnabled) + this.gauge.enable() } log._buffer = [] @@ -180,28 +212,30 @@ log.log = function (lvl, prefix, message) { var arg = a[i - 2] = arguments[i] // resolve stack traces to a plain string. - if (typeof arg === 'object' && arg && - (arg instanceof Error) && arg.stack) { - + if (typeof arg === 'object' && arg instanceof Error && arg.stack) { Object.defineProperty(arg, 'stack', { value: stack = arg.stack + '', enumerable: true, - writable: true + writable: true, }) } } - if (stack) a.unshift(stack + '\n') + if (stack) + a.unshift(stack + '\n') message = util.format.apply(util, a) - var m = { id: id++, - level: lvl, - prefix: String(prefix || ''), - message: message, - messageRaw: a } + var m = { + id: id++, + level: lvl, + prefix: String(prefix || ''), + message: message, + messageRaw: a, + } this.emit('log', m) this.emit('log.' + lvl, m) - if (m.prefix) this.emit(m.prefix, m) + if (m.prefix) + this.emit(m.prefix, m) this.record.push(m) var mrs = this.maxRecordSize @@ -219,11 +253,18 @@ log.emitLog = function (m) { this._buffer.push(m) return } - if (this.progressEnabled) this.gauge.pulse(m.prefix) + if (this.progressEnabled) + this.gauge.pulse(m.prefix) + var l = this.levels[m.level] - if (l === undefined) return - if (l < this.levels[this.level]) return - if (l > 0 && !isFinite(l)) return + if (l === undefined) + return + + if (l < this.levels[this.level]) + return + + if (l > 0 && !isFinite(l)) + return // If 'disp' is null or undefined, use the lvl as a default // Allows: '', 0 as valid disp @@ -236,7 +277,9 @@ log.emitLog = function (m) { } this.write(disp, log.style[m.level]) var p = m.prefix || '' - if (p) this.write(' ') + if (p) + this.write(' ') + this.write(p, this.prefixStyle) this.write(' ' + line + '\n') }, this) @@ -244,45 +287,62 @@ log.emitLog = function (m) { } log._format = function (msg, style) { - if (!stream) return + if (!stream) + return var output = '' if (this.useColor()) { style = style || {} var settings = [] - if (style.fg) settings.push(style.fg) - if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1)) - if (style.bold) settings.push('bold') - if (style.underline) settings.push('underline') - if (style.inverse) settings.push('inverse') - if (settings.length) output += consoleControl.color(settings) - if (style.beep) output += consoleControl.beep() + if (style.fg) + settings.push(style.fg) + + if (style.bg) + settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1)) + + if (style.bold) + settings.push('bold') + + if (style.underline) + settings.push('underline') + + if (style.inverse) + settings.push('inverse') + + if (settings.length) + output += consoleControl.color(settings) + + if (style.beep) + output += consoleControl.beep() } output += msg - if (this.useColor()) { + if (this.useColor()) output += consoleControl.color('reset') - } + return output } log.write = function (msg, style) { - if (!stream) return + if (!stream) + return stream.write(this._format(msg, style)) } log.addLevel = function (lvl, n, style, disp) { // If 'disp' is null or undefined, use the lvl as a default - if (disp == null) disp = lvl + if (disp == null) + disp = lvl + this.levels[lvl] = n this.style[lvl] = style if (!this[lvl]) { this[lvl] = function () { var a = new Array(arguments.length + 1) a[0] = lvl - for (var i = 0; i < arguments.length; i++) { + for (var i = 0; i < arguments.length; i++) a[i + 1] = arguments[i] - } + return this.log.apply(this, a) }.bind(this) } diff --git a/node_modules/npmlog/package.json b/node_modules/npmlog/package.json index 7220f8e72a3c7..5288b9ca06256 100644 --- a/node_modules/npmlog/package.json +++ b/node_modules/npmlog/package.json @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "name": "npmlog", "description": "logger for npm", - "version": "4.1.2", + "version": "5.0.0", "repository": { "type": "git", "url": "https://github.com/npm/npmlog.git" @@ -12,17 +12,22 @@ "log.js" ], "scripts": { - "test": "standard && tap test/*.js" + "test": "tap test/*.js --branches=95", + "npmclilint": "npmcli-lint", + "lint": "npm run npmclilint -- \"*.*js\" \"test/**/*.*js\"", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint --", + "postsnap": "npm run lintfix --" }, "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "^1.1.5", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" }, "devDependencies": { - "standard": "~7.1.2", - "tap": "~5.7.3" + "@npmcli/lint": "^1.0.1", + "tap": "^15.0.9" }, "license": "ISC" } diff --git a/package-lock.json b/package-lock.json index 7fe60ea862cb9..17a410baf9747 100644 --- a/package-lock.json +++ b/package-lock.json @@ -132,7 +132,7 @@ "npm-profile": "^5.0.3", "npm-registry-fetch": "^11.0.0", "npm-user-validate": "^1.0.1", - "npmlog": "~4.1.2", + "npmlog": "^5.0.0", "opener": "^1.5.2", "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", @@ -1914,7 +1914,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, + "inBundle": true, "bin": { "color-support": "bin.js" } @@ -3347,51 +3347,22 @@ "dev": true }, "node_modules/gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.0.tgz", + "integrity": "sha512-VSxauaaCsLOTerAyzunAYGgK3iaWZvOL1BCvBvf/IhDWrczPAf1tUqn05DOCJOOe4k3vOdX6fHhJIvF2UtCMhw==", "inBundle": true, "dependencies": { - "aproba": "^1.0.3", + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", + "has-unicode": "^2.0.1", "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "node_modules/gauge/node_modules/aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "inBundle": true - }, - "node_modules/gauge/node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "inBundle": true, - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "inBundle": true, - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" + "string-width": "^1.0.1 || ^2.0.0", + "strip-ansi": "^3.0.1 || ^4.0.0", + "wide-align": "^1.1.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=10" } }, "node_modules/gensync": { @@ -5366,6 +5337,66 @@ "node": ">= 10.12.0" } }, + "node_modules/node-gyp/node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "inBundle": true + }, + "node_modules/node-gyp/node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "inBundle": true, + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/node-gyp/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "inBundle": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-gyp/node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "inBundle": true, + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/node-gyp/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "inBundle": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -5548,15 +5579,15 @@ "inBundle": true }, "node_modules/npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.0.tgz", + "integrity": "sha512-ftpIiLjerL2tUg3dCqN8pOSoB90gqZlzv/gaZoxHaKjeLClrfJIEQ1Pdxi6qSzflz916Bljdy8dTWQ4J7hAFSQ==", "inBundle": true, "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "^1.1.5", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" } }, "node_modules/null-check": { @@ -6133,6 +6164,66 @@ "node": ">=6" } }, + "node_modules/prebuild-install/node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "node_modules/prebuild-install/node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/prebuild-install/node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prebuild-install/node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/prebuild-install/node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -11766,8 +11857,7 @@ "color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" }, "colors": { "version": "1.4.0", @@ -12852,43 +12942,18 @@ "dev": true }, "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.0.tgz", + "integrity": "sha512-VSxauaaCsLOTerAyzunAYGgK3iaWZvOL1BCvBvf/IhDWrczPAf1tUqn05DOCJOOe4k3vOdX6fHhJIvF2UtCMhw==", "requires": { - "aproba": "^1.0.3", + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", + "has-unicode": "^2.0.1", "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - } + "string-width": "^1.0.1 || ^2.0.0", + "strip-ansi": "^3.0.1 || ^4.0.0", + "wide-align": "^1.1.2" } }, "gensync": { @@ -14325,6 +14390,57 @@ "semver": "^7.3.2", "tar": "^6.0.2", "which": "^2.0.2" + }, + "dependencies": { + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } } }, "node-preload": { @@ -14461,14 +14577,14 @@ "integrity": "sha512-uQwcd/tY+h1jnEaze6cdX/LrhWhoBxfSknxentoqmIuStxUExxjWd3ULMLFPiFUrZKbOVMowH6Jq2FRWfmhcEw==" }, "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.0.tgz", + "integrity": "sha512-ftpIiLjerL2tUg3dCqN8pOSoB90gqZlzv/gaZoxHaKjeLClrfJIEQ1Pdxi6qSzflz916Bljdy8dTWQ4J7hAFSQ==", "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" + "are-we-there-yet": "^1.1.5", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" } }, "null-check": { @@ -14892,6 +15008,62 @@ "simple-get": "^3.0.3", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" + }, + "dependencies": { + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } } }, "prelude-ls": { diff --git a/package.json b/package.json index e91ff4bef974b..5fd50b6f9daa1 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "npm-profile": "^5.0.3", "npm-registry-fetch": "^11.0.0", "npm-user-validate": "^1.0.1", - "npmlog": "~4.1.2", + "npmlog": "^5.0.0", "opener": "^1.5.2", "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", From cf737c505e76a473850c5244b17f3469efbc3c02 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 13:07:49 -0700 Subject: [PATCH 09/13] debug@4.3.2 --- node_modules/debug/package.json | 2 +- node_modules/debug/src/common.js | 15 ++++++++++++++- package-lock.json | 12 ++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json index da809d2b8d28b..b7d70acb9bee8 100644 --- a/node_modules/debug/package.json +++ b/node_modules/debug/package.json @@ -1,6 +1,6 @@ { "name": "debug", - "version": "4.3.1", + "version": "4.3.2", "repository": { "type": "git", "url": "git://github.com/visionmedia/debug.git" diff --git a/node_modules/debug/src/common.js b/node_modules/debug/src/common.js index 392a8e005a063..50ce2925101d7 100644 --- a/node_modules/debug/src/common.js +++ b/node_modules/debug/src/common.js @@ -60,6 +60,8 @@ function setup(env) { function createDebug(namespace) { let prevTime; let enableOverride = null; + let namespacesCache; + let enabledCache; function debug(...args) { // Disabled? @@ -120,7 +122,17 @@ function setup(env) { Object.defineProperty(debug, 'enabled', { enumerable: true, configurable: false, - get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, set: v => { enableOverride = v; } @@ -149,6 +161,7 @@ function setup(env) { */ function enable(namespaces) { createDebug.save(namespaces); + createDebug.namespaces = namespaces; createDebug.names = []; createDebug.skips = []; diff --git a/package-lock.json b/package-lock.json index 17a410baf9747..f4a82e2ffcfab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2093,9 +2093,9 @@ } }, "node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "inBundle": true, "dependencies": { "ms": "2.1.2" @@ -11999,9 +11999,9 @@ } }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "requires": { "ms": "2.1.2" }, From bd715ca0392450bee39a493e9162ba6963fd20cc Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 13:08:43 -0700 Subject: [PATCH 10/13] is-core-module@2.5.0 --- node_modules/is-core-module/core.json | 2 ++ node_modules/is-core-module/package.json | 6 +++--- package-lock.json | 12 ++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/node_modules/is-core-module/core.json b/node_modules/is-core-module/core.json index 44a92a1a414b9..773222f6ba3bc 100644 --- a/node_modules/is-core-module/core.json +++ b/node_modules/is-core-module/core.json @@ -102,6 +102,8 @@ "node:stream": ">= 16", "stream/promises": ">= 15", "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", "string_decoder": true, "node:string_decoder": ">= 16", "sys": [">= 0.6 && < 0.7", ">= 0.8"], diff --git a/node_modules/is-core-module/package.json b/node_modules/is-core-module/package.json index 0442e92cd2065..464294eae96be 100644 --- a/node_modules/is-core-module/package.json +++ b/node_modules/is-core-module/package.json @@ -1,6 +1,6 @@ { "name": "is-core-module", - "version": "2.4.0", + "version": "2.5.0", "description": "Is this specifier a node.js core module?", "main": "index.js", "exports": { @@ -50,8 +50,8 @@ "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "eslint": "^7.26.0", + "auto-changelog": "^2.3.0", + "eslint": "^7.30.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", "semver": "^6.3.0", diff --git a/package-lock.json b/package-lock.json index f4a82e2ffcfab..5565f88a86f07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4025,9 +4025,9 @@ } }, "node_modules/is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", + "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", "inBundle": true, "dependencies": { "has": "^1.0.3" @@ -13407,9 +13407,9 @@ } }, "is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", + "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", "requires": { "has": "^1.0.3" } From f8dbad3e625aa9de98e2f73b8029192584539ad5 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 13:16:38 -0700 Subject: [PATCH 11/13] docs: changelog for v7.20.1 --- CHANGELOG.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5154c16124a77..c3d5e4f8521b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,41 @@ +## v7.20.1 (2021-07-22) + +### BUG FIXES + +* [`009ad1e68`](https://github.com/npm/cli/commit/009ad1e683aa061d7e5c78b9362b0bd1b14ee643) + [#3561](https://github.com/npm/cli/issues/3561) + fix(exit-handler): always warn if not called + ([@wraithgar](https://github.com/wraithgar)) +* [`eb67054c8`](https://github.com/npm/cli/commit/eb67054c8303348b25f9717c8f82c8d8d494a242) + [#3563](https://github.com/npm/cli/issues/3563) + fix(config): consolidate use of npm.color + ([@wraithgar](https://github.com/wraithgar)) + +### DOCUMENTATION + +* [`a014f3d28`](https://github.com/npm/cli/commit/a014f3d284e49cd085cfd060a71a161b93bca9d1) + [#3562](https://github.com/npm/cli/issues/3562) + fix(docs): typo in `npm cmd` docs + ([@wraithgar](https://github.com/wraithgar)) +* [`1fe1c9b74`](https://github.com/npm/cli/commit/1fe1c9b74ea3c3d5bb5b3696b954422b9b55dd91) + [#3523](https://github.com/npm/cli/issues/3523) + fix(docs): updated policy urls + ([@DemiraDimitrova](https://github.com/DemiraDimitrova)) + +### DEPENDENCIES + +* [`d7f29e8c9`](https://github.com/npm/cli/commit/d7f29e8c94ae77661390f82ae72efc1bd6fcfbc3) + `read-package-json-fast@2.0.3`: + - feat: load directories.bin as a bin object +* [`b1fefa73d`](https://github.com/npm/cli/commit/b1fefa73db2f8d9c55b4447ffc1cdbaf8e9bb298) + `npmlog@5.0.0` + * Drop support for node 6 and 8 +* [`b6e09971a`](https://github.com/npm/cli/commit/b6e09971a8f9a3c92188838b69be0a0dda27f0bb) + remove ignored files from node_modules + ([@Ruy Adorno](https://github.com/Ruy Adorno)) +* [`cf737c505`](https://github.com/npm/cli/commit/cf737c505e76a473850c5244b17f3469efbc3c02) + `debug@4.3.2` + ## v7.20.0 (2021-07-15) ### FEATURES From 6eb6e119d7debfffc016d826966e0c2e684d89a2 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 13:16:44 -0700 Subject: [PATCH 12/13] update AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 9474540d33bae..c3685720598a9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -788,3 +788,4 @@ Ivan Aluneed <31174087+aluneed@users.noreply.github.com> relrelb Cameron Tacklind +Demira Dimitrova From deeb22235bf9b7d1727cafe581e54df9f8f19efb Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 13:16:44 -0700 Subject: [PATCH 13/13] 7.20.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5565f88a86f07..8e03db0dedf8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "npm", - "version": "7.20.0", + "version": "7.20.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "npm", - "version": "7.20.0", + "version": "7.20.1", "bundleDependencies": [ "@npmcli/arborist", "@npmcli/ci-detect", diff --git a/package.json b/package.json index 5fd50b6f9daa1..fd60267ed1f02 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "7.20.0", + "version": "7.20.1", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [