From 7a6e3f7dbe3a9e63ae505e466a5ab7fa21979f2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Apr 2022 11:24:18 +0000 Subject: [PATCH] Build(deps): Bump strip-ansi from 6.0.0 to 7.0.0 (#10731) --- package.json | 2 +- scripts/vendors/vendor-meta.json | 34 +++++++++++++++++++ scripts/vendors/vendors.mjs | 1 + src/cli/logger.js | 3 +- tests/integration/__tests__/loglevel.js | 2 +- tests/integration/run-prettier.js | 2 +- vendors/string-width.js | 4 +-- vendors/strip-ansi.d.ts | 3 ++ vendors/strip-ansi.js | 45 +++++++++++++++++++++++++ yarn.lock | 19 ++++------- 10 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 vendors/strip-ansi.d.ts create mode 100644 vendors/strip-ansi.js diff --git a/package.json b/package.json index 82b321a78ca5..dfd1cf59dbe6 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "resolve": "1.22.0", "semver": "7.3.5", "string-width": "5.0.1", - "strip-ansi": "6.0.0", + "strip-ansi": "7.0.1", "typescript": "4.6.3", "unicode-regex": "3.0.0", "unified": "9.2.1", diff --git a/scripts/vendors/vendor-meta.json b/scripts/vendors/vendor-meta.json index 0631c4c21b0b..c47e5d34370a 100644 --- a/scripts/vendors/vendor-meta.json +++ b/scripts/vendors/vendor-meta.json @@ -544,6 +544,40 @@ }, "contributors": [] }, + { + "name": "ansi-regex", + "maintainers": [], + "version": "6.0.1", + "description": "Regular expression for matching ANSI escape codes", + "repository": "chalk/ansi-regex", + "homepage": null, + "private": false, + "license": "MIT", + "licenseText": "MIT License\n\nCopyright (c) Sindre Sorhus (https://sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "contributors": [] + }, + { + "name": "strip-ansi", + "maintainers": [], + "version": "7.0.1", + "description": "Strip ANSI escape codes from a string", + "repository": "chalk/strip-ansi", + "homepage": null, + "private": false, + "license": "MIT", + "licenseText": "MIT License\n\nCopyright (c) Sindre Sorhus (https://sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "contributors": [] + }, { "name": "crypto-random-string", "maintainers": [], diff --git a/scripts/vendors/vendors.mjs b/scripts/vendors/vendors.mjs index dc00c233c782..f1c43d4eb9a8 100644 --- a/scripts/vendors/vendors.mjs +++ b/scripts/vendors/vendors.mjs @@ -7,6 +7,7 @@ const vendors = [ "html-void-elements", "mem", "string-width", + "strip-ansi", "tempy", ]; diff --git a/src/cli/logger.js b/src/cli/logger.js index 350e91309d36..3e1331bc0106 100644 --- a/src/cli/logger.js +++ b/src/cli/logger.js @@ -1,9 +1,10 @@ "use strict"; const readline = require("readline"); -const stripAnsi = require("strip-ansi"); const wcwidth = require("wcwidth"); +// eslint-disable-next-line no-restricted-modules +const { default: stripAnsi } = require("../../vendors/strip-ansi.js"); // eslint-disable-next-line no-restricted-modules const { default: chalk } = require("../../vendors/chalk.js"); diff --git a/tests/integration/__tests__/loglevel.js b/tests/integration/__tests__/loglevel.js index 53ad29937d45..3fe029ca214d 100644 --- a/tests/integration/__tests__/loglevel.js +++ b/tests/integration/__tests__/loglevel.js @@ -1,6 +1,6 @@ "use strict"; -const stripAnsi = require("strip-ansi"); +const { default: stripAnsi } = require("../../../vendors/strip-ansi.js"); const runPrettier = require("../run-prettier.js"); test("do not show logs with --loglevel silent", async () => { diff --git a/tests/integration/run-prettier.js b/tests/integration/run-prettier.js index b1543ddbc738..b167fe2e2288 100644 --- a/tests/integration/run-prettier.js +++ b/tests/integration/run-prettier.js @@ -2,7 +2,7 @@ const fs = require("fs"); const path = require("path"); -const stripAnsi = require("strip-ansi"); +const { default: stripAnsi } = require("../../vendors/strip-ansi.js"); const { prettierCli, thirdParty } = require("./env.js"); async function run(dir, args, options) { diff --git a/vendors/string-width.js b/vendors/string-width.js index bed36dfd438b..384d4a261cda 100644 --- a/vendors/string-width.js +++ b/vendors/string-width.js @@ -41,7 +41,7 @@ __export(string_width_exports, { }); module.exports = __toCommonJS(string_width_exports); -// node_modules/string-width/node_modules/ansi-regex/index.js +// node_modules/strip-ansi/node_modules/ansi-regex/index.js function ansiRegex({ onlyFirst = false } = {}) { const pattern = [ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", @@ -50,7 +50,7 @@ function ansiRegex({ onlyFirst = false } = {}) { return new RegExp(pattern, onlyFirst ? void 0 : "g"); } -// node_modules/string-width/node_modules/strip-ansi/index.js +// node_modules/strip-ansi/index.js function stripAnsi(string) { if (typeof string !== "string") { throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); diff --git a/vendors/strip-ansi.d.ts b/vendors/strip-ansi.d.ts new file mode 100644 index 000000000000..07389334ca60 --- /dev/null +++ b/vendors/strip-ansi.d.ts @@ -0,0 +1,3 @@ +// This file is generated automatically. +export {default} from "strip-ansi"; +export * from "strip-ansi"; diff --git a/vendors/strip-ansi.js b/vendors/strip-ansi.js new file mode 100644 index 000000000000..1c3a4e564683 --- /dev/null +++ b/vendors/strip-ansi.js @@ -0,0 +1,45 @@ +// @ts-nocheck +// This file is generated automatically +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// node_modules/strip-ansi/index.js +var strip_ansi_exports = {}; +__export(strip_ansi_exports, { + default: () => stripAnsi +}); +module.exports = __toCommonJS(strip_ansi_exports); + +// node_modules/strip-ansi/node_modules/ansi-regex/index.js +function ansiRegex({ onlyFirst = false } = {}) { + const pattern = [ + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", + "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))" + ].join("|"); + return new RegExp(pattern, onlyFirst ? void 0 : "g"); +} + +// node_modules/strip-ansi/index.js +function stripAnsi(string) { + if (typeof string !== "string") { + throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); + } + return string.replace(ansiRegex(), ""); +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = {}); diff --git a/yarn.lock b/yarn.lock index 1c04baf4d50f..e0bc44db9134 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1870,7 +1870,7 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== -ansi-regex@^5.0.0, ansi-regex@^5.0.1: +ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== @@ -6181,12 +6181,12 @@ strip-ansi@5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== +strip-ansi@7.0.1, strip-ansi@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" + integrity sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw== dependencies: - ansi-regex "^5.0.0" + ansi-regex "^6.0.1" strip-ansi@^4.0.0: version "4.0.0" @@ -6202,13 +6202,6 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" - integrity sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw== - dependencies: - ansi-regex "^6.0.1" - strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"