update, text, response
This commit is contained in:
2
node_modules/update-browserslist-db/README.md
generated
vendored
2
node_modules/update-browserslist-db/README.md
generated
vendored
@@ -6,7 +6,7 @@
|
||||
CLI tool to update `caniuse-lite` with browsers DB
|
||||
from [Browserslist](https://github.com/browserslist/browserslist/) config.
|
||||
|
||||
Some queries like `last 2 version` or `>1%` depends on actual data
|
||||
Some queries like `last 2 versions` or `>1%` depend on actual data
|
||||
from `caniuse-lite`.
|
||||
|
||||
```sh
|
||||
|
||||
1
node_modules/update-browserslist-db/check-npm-version.js
generated
vendored
1
node_modules/update-browserslist-db/check-npm-version.js
generated
vendored
@@ -13,4 +13,5 @@ try {
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
} catch (e) {}
|
||||
|
||||
2
node_modules/update-browserslist-db/index.d.ts
generated
vendored
2
node_modules/update-browserslist-db/index.d.ts
generated
vendored
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Run update and print output to terminal.
|
||||
*/
|
||||
declare function updateDb(print?: (str: string) => void): Promise<void>
|
||||
declare function updateDb(print?: (str: string) => void): void
|
||||
|
||||
export = updateDb
|
||||
|
||||
66
node_modules/update-browserslist-db/index.js
generated
vendored
66
node_modules/update-browserslist-db/index.js
generated
vendored
@@ -1,10 +1,10 @@
|
||||
let { writeFileSync, readFileSync, existsSync } = require('fs')
|
||||
let { execSync } = require('child_process')
|
||||
let { join } = require('path')
|
||||
let escalade = require('escalade/sync')
|
||||
let { existsSync, readFileSync, writeFileSync } = require('fs')
|
||||
let { join } = require('path')
|
||||
let pico = require('picocolors')
|
||||
|
||||
const { detectIndent, detectEOL } = require('./utils')
|
||||
const { detectEOL, detectIndent } = require('./utils')
|
||||
|
||||
function BrowserslistUpdateError(message) {
|
||||
this.name = 'BrowserslistUpdateError'
|
||||
@@ -17,6 +17,10 @@ function BrowserslistUpdateError(message) {
|
||||
|
||||
BrowserslistUpdateError.prototype = Error.prototype
|
||||
|
||||
// Check if HADOOP_HOME is set to determine if this is running in a Hadoop environment
|
||||
const IsHadoopExists = !!process.env.HADOOP_HOME
|
||||
const yarnCommand = IsHadoopExists ? 'yarnpkg' : 'yarn'
|
||||
|
||||
/* c8 ignore next 3 */
|
||||
function defaultPrint(str) {
|
||||
process.stdout.write(str)
|
||||
@@ -38,18 +42,22 @@ function detectLockfile() {
|
||||
let lockfileShrinkwrap = join(packageDir, 'npm-shrinkwrap.json')
|
||||
let lockfileYarn = join(packageDir, 'yarn.lock')
|
||||
let lockfilePnpm = join(packageDir, 'pnpm-lock.yaml')
|
||||
let lockfileBun = join(packageDir, 'bun.lock')
|
||||
let lockfileBunBinary = join(packageDir, 'bun.lockb')
|
||||
|
||||
if (existsSync(lockfilePnpm)) {
|
||||
return { mode: 'pnpm', file: lockfilePnpm }
|
||||
return { file: lockfilePnpm, mode: 'pnpm' }
|
||||
} else if (existsSync(lockfileBun) || existsSync(lockfileBunBinary)) {
|
||||
return { file: lockfileBun, mode: 'bun' }
|
||||
} else if (existsSync(lockfileNpm)) {
|
||||
return { mode: 'npm', file: lockfileNpm }
|
||||
return { file: lockfileNpm, mode: 'npm' }
|
||||
} else if (existsSync(lockfileYarn)) {
|
||||
let lock = { mode: 'yarn', file: lockfileYarn }
|
||||
let lock = { file: lockfileYarn, mode: 'yarn' }
|
||||
lock.content = readFileSync(lock.file).toString()
|
||||
lock.version = /# yarn lockfile v1/.test(lock.content) ? 1 : 2
|
||||
return lock
|
||||
} else if (existsSync(lockfileShrinkwrap)) {
|
||||
return { mode: 'npm', file: lockfileShrinkwrap }
|
||||
return { file: lockfileShrinkwrap, mode: 'npm' }
|
||||
}
|
||||
throw new BrowserslistUpdateError(
|
||||
'No lockfile found. Run "npm install", "yarn install" or "pnpm install"'
|
||||
@@ -59,17 +67,23 @@ function detectLockfile() {
|
||||
function getLatestInfo(lock) {
|
||||
if (lock.mode === 'yarn') {
|
||||
if (lock.version === 1) {
|
||||
return JSON.parse(execSync('yarn info caniuse-lite --json').toString())
|
||||
.data
|
||||
return JSON.parse(
|
||||
execSync(yarnCommand + ' info caniuse-lite --json').toString()
|
||||
).data
|
||||
} else {
|
||||
return JSON.parse(
|
||||
execSync('yarn npm info caniuse-lite --json').toString()
|
||||
execSync(yarnCommand + ' npm info caniuse-lite --json').toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
if (lock.mode === 'pnpm') {
|
||||
return JSON.parse(execSync('pnpm info caniuse-lite --json').toString())
|
||||
}
|
||||
if (lock.mode === 'bun') {
|
||||
// TO-DO: No 'bun info' yet. Created issue: https://github.com/oven-sh/bun/issues/12280
|
||||
return JSON.parse(execSync(' npm info caniuse-lite --json').toString())
|
||||
}
|
||||
|
||||
return JSON.parse(execSync('npm show caniuse-lite --json').toString())
|
||||
}
|
||||
|
||||
@@ -209,7 +223,8 @@ function updatePackageManually(print, lock, latest) {
|
||||
)
|
||||
writeFileSync(lock.file, lockfileData.content)
|
||||
|
||||
let install = lock.mode === 'yarn' ? 'yarn add -W' : lock.mode + ' install'
|
||||
let install =
|
||||
lock.mode === 'yarn' ? yarnCommand + ' add -W' : lock.mode + ' install'
|
||||
print(
|
||||
'Installing new caniuse-lite version\n' +
|
||||
pico.yellow('$ ' + install + ' caniuse-lite') +
|
||||
@@ -232,7 +247,8 @@ function updatePackageManually(print, lock, latest) {
|
||||
process.exit(1)
|
||||
} /* c8 ignore end */
|
||||
|
||||
let del = lock.mode === 'yarn' ? 'yarn remove -W' : lock.mode + ' uninstall'
|
||||
let del =
|
||||
lock.mode === 'yarn' ? yarnCommand + ' remove -W' : lock.mode + ' uninstall'
|
||||
print(
|
||||
'Cleaning package.json dependencies from caniuse-lite\n' +
|
||||
pico.yellow('$ ' + del + ' caniuse-lite') +
|
||||
@@ -277,9 +293,11 @@ module.exports = function updateDB(print = defaultPrint) {
|
||||
print('Latest version: ' + pico.bold(pico.green(latest.version)) + '\n')
|
||||
|
||||
if (lock.mode === 'yarn' && lock.version !== 1) {
|
||||
updateWith(print, 'yarn up -R caniuse-lite')
|
||||
updateWith(print, yarnCommand + ' up -R caniuse-lite')
|
||||
} else if (lock.mode === 'pnpm') {
|
||||
updateWith(print, 'pnpm up caniuse-lite')
|
||||
} else if (lock.mode === 'bun') {
|
||||
updateWith(print, 'bun update caniuse-lite')
|
||||
} else {
|
||||
updatePackageManually(print, lock, latest)
|
||||
}
|
||||
@@ -296,15 +314,21 @@ module.exports = function updateDB(print = defaultPrint) {
|
||||
}
|
||||
|
||||
if (listError) {
|
||||
print(
|
||||
pico.red(
|
||||
'\n' +
|
||||
listError.stack +
|
||||
'\n\n' +
|
||||
'Problem with browser list retrieval.\n' +
|
||||
'Target browser changes won’t be shown.\n'
|
||||
if (listError.message.includes("Cannot find module 'browserslist'")) {
|
||||
print(
|
||||
pico.gray(
|
||||
'Install `browserslist` to your direct dependencies ' +
|
||||
'to see target browser changes\n'
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
print(
|
||||
pico.gray(
|
||||
'Problem with browser list retrieval.\n' +
|
||||
'Target browser changes won’t be shown.\n'
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
let changes = diffBrowsers(oldList, newList)
|
||||
if (changes) {
|
||||
|
||||
2
node_modules/update-browserslist-db/node_modules/picocolors/LICENSE
generated
vendored
2
node_modules/update-browserslist-db/node_modules/picocolors/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
|
||||
Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
||||
4
node_modules/update-browserslist-db/node_modules/picocolors/package.json
generated
vendored
4
node_modules/update-browserslist-db/node_modules/picocolors/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "picocolors",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.1",
|
||||
"main": "./picocolors.js",
|
||||
"types": "./picocolors.d.ts",
|
||||
"browser": {
|
||||
@@ -10,7 +10,7 @@
|
||||
"description": "The tiniest and the fastest library for terminal output formatting with ANSI colors",
|
||||
"files": [
|
||||
"picocolors.*",
|
||||
"types.ts"
|
||||
"types.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"terminal",
|
||||
|
||||
2
node_modules/update-browserslist-db/node_modules/picocolors/picocolors.browser.js
generated
vendored
2
node_modules/update-browserslist-db/node_modules/picocolors/picocolors.browser.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
var x=String;
|
||||
var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x}};
|
||||
var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}};
|
||||
module.exports=create();
|
||||
module.exports.createColors = create;
|
||||
|
||||
111
node_modules/update-browserslist-db/node_modules/picocolors/picocolors.js
generated
vendored
111
node_modules/update-browserslist-db/node_modules/picocolors/picocolors.js
generated
vendored
@@ -1,58 +1,75 @@
|
||||
let tty = require("tty")
|
||||
|
||||
let p = process || {}, argv = p.argv || [], env = p.env || {}
|
||||
let isColorSupported =
|
||||
!("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
|
||||
("FORCE_COLOR" in process.env ||
|
||||
process.argv.includes("--color") ||
|
||||
process.platform === "win32" ||
|
||||
(tty.isatty(1) && process.env.TERM !== "dumb") ||
|
||||
"CI" in process.env)
|
||||
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
||||
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI)
|
||||
|
||||
let formatter =
|
||||
(open, close, replace = open) =>
|
||||
let formatter = (open, close, replace = open) =>
|
||||
input => {
|
||||
let string = "" + input
|
||||
let index = string.indexOf(close, open.length)
|
||||
return ~index
|
||||
? open + replaceClose(string, close, replace, index) + close
|
||||
: open + string + close
|
||||
let string = "" + input, index = string.indexOf(close, open.length)
|
||||
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
|
||||
}
|
||||
|
||||
let replaceClose = (string, close, replace, index) => {
|
||||
let start = string.substring(0, index) + replace
|
||||
let end = string.substring(index + close.length)
|
||||
let nextIndex = end.indexOf(close)
|
||||
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
|
||||
let result = "", cursor = 0
|
||||
do {
|
||||
result += string.substring(cursor, index) + replace
|
||||
cursor = index + close.length
|
||||
index = string.indexOf(close, cursor)
|
||||
} while (~index)
|
||||
return result + string.substring(cursor)
|
||||
}
|
||||
|
||||
let createColors = (enabled = isColorSupported) => ({
|
||||
isColorSupported: enabled,
|
||||
reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
|
||||
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
||||
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
||||
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
||||
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
||||
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
||||
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
||||
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
||||
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
||||
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
||||
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
||||
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
||||
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
||||
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
||||
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
||||
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
||||
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
||||
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
||||
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
||||
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
||||
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
||||
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
||||
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
||||
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
||||
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
|
||||
})
|
||||
let createColors = (enabled = isColorSupported) => {
|
||||
let f = enabled ? formatter : () => String
|
||||
return {
|
||||
isColorSupported: enabled,
|
||||
reset: f("\x1b[0m", "\x1b[0m"),
|
||||
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
||||
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
||||
italic: f("\x1b[3m", "\x1b[23m"),
|
||||
underline: f("\x1b[4m", "\x1b[24m"),
|
||||
inverse: f("\x1b[7m", "\x1b[27m"),
|
||||
hidden: f("\x1b[8m", "\x1b[28m"),
|
||||
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
||||
|
||||
black: f("\x1b[30m", "\x1b[39m"),
|
||||
red: f("\x1b[31m", "\x1b[39m"),
|
||||
green: f("\x1b[32m", "\x1b[39m"),
|
||||
yellow: f("\x1b[33m", "\x1b[39m"),
|
||||
blue: f("\x1b[34m", "\x1b[39m"),
|
||||
magenta: f("\x1b[35m", "\x1b[39m"),
|
||||
cyan: f("\x1b[36m", "\x1b[39m"),
|
||||
white: f("\x1b[37m", "\x1b[39m"),
|
||||
gray: f("\x1b[90m", "\x1b[39m"),
|
||||
|
||||
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
||||
bgRed: f("\x1b[41m", "\x1b[49m"),
|
||||
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
||||
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
||||
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
||||
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
||||
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
||||
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
||||
|
||||
blackBright: f("\x1b[90m", "\x1b[39m"),
|
||||
redBright: f("\x1b[91m", "\x1b[39m"),
|
||||
greenBright: f("\x1b[92m", "\x1b[39m"),
|
||||
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
||||
blueBright: f("\x1b[94m", "\x1b[39m"),
|
||||
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
||||
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
||||
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
||||
|
||||
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
||||
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
||||
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
||||
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
||||
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
||||
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
||||
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
||||
bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createColors()
|
||||
module.exports.createColors = createColors
|
||||
|
||||
@@ -2,6 +2,7 @@ export type Formatter = (input: string | number | null | undefined) => string
|
||||
|
||||
export interface Colors {
|
||||
isColorSupported: boolean
|
||||
|
||||
reset: Formatter
|
||||
bold: Formatter
|
||||
dim: Formatter
|
||||
@@ -10,6 +11,7 @@ export interface Colors {
|
||||
inverse: Formatter
|
||||
hidden: Formatter
|
||||
strikethrough: Formatter
|
||||
|
||||
black: Formatter
|
||||
red: Formatter
|
||||
green: Formatter
|
||||
@@ -19,6 +21,7 @@ export interface Colors {
|
||||
cyan: Formatter
|
||||
white: Formatter
|
||||
gray: Formatter
|
||||
|
||||
bgBlack: Formatter
|
||||
bgRed: Formatter
|
||||
bgGreen: Formatter
|
||||
@@ -27,4 +30,22 @@ export interface Colors {
|
||||
bgMagenta: Formatter
|
||||
bgCyan: Formatter
|
||||
bgWhite: Formatter
|
||||
|
||||
blackBright: Formatter
|
||||
redBright: Formatter
|
||||
greenBright: Formatter
|
||||
yellowBright: Formatter
|
||||
blueBright: Formatter
|
||||
magentaBright: Formatter
|
||||
cyanBright: Formatter
|
||||
whiteBright: Formatter
|
||||
|
||||
bgBlackBright: Formatter
|
||||
bgRedBright: Formatter
|
||||
bgGreenBright: Formatter
|
||||
bgYellowBright: Formatter
|
||||
bgBlueBright: Formatter
|
||||
bgMagentaBright: Formatter
|
||||
bgCyanBright: Formatter
|
||||
bgWhiteBright: Formatter
|
||||
}
|
||||
6
node_modules/update-browserslist-db/package.json
generated
vendored
6
node_modules/update-browserslist-db/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "update-browserslist-db",
|
||||
"version": "1.0.11",
|
||||
"version": "1.1.3",
|
||||
"description": "CLI tool to update caniuse-lite to refresh target browsers from Browserslist config",
|
||||
"keywords": [
|
||||
"caniuse",
|
||||
@@ -30,8 +30,8 @@
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"escalade": "^3.1.1",
|
||||
"picocolors": "^1.0.0"
|
||||
"escalade": "^3.2.0",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"browserslist": ">= 4.21.0"
|
||||
|
||||
7
node_modules/update-browserslist-db/utils.js
generated
vendored
7
node_modules/update-browserslist-db/utils.js
generated
vendored
@@ -3,8 +3,11 @@ const { EOL } = require('os')
|
||||
const getFirstRegexpMatchOrDefault = (text, regexp, defaultValue) => {
|
||||
regexp.lastIndex = 0 // https://stackoverflow.com/a/11477448/4536543
|
||||
let match = regexp.exec(text)
|
||||
if (match !== null) return match[1]
|
||||
return defaultValue
|
||||
if (match !== null) {
|
||||
return match[1]
|
||||
} else {
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
const DEFAULT_INDENT = ' '
|
||||
|
||||
Reference in New Issue
Block a user