From ea074218cdc8394131975adb1e6ab498dcec49fb Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 31 Oct 2023 10:34:39 -0700 Subject: [PATCH] deps: is-cidr@5.0.3 --- lib/commands/token.js | 6 ++--- node_modules/cidr-regex/index.js | 15 +++++------ node_modules/cidr-regex/package.json | 34 +++++++++-------------- node_modules/ip-regex/index.js | 40 ++++++++++++++-------------- node_modules/ip-regex/license | 2 +- node_modules/ip-regex/package.json | 13 +++++---- node_modules/is-cidr/index.js | 14 +++++----- node_modules/is-cidr/package.json | 38 +++++++++----------------- package-lock.json | 33 ++++++++++++----------- package.json | 2 +- 10 files changed, 88 insertions(+), 109 deletions(-) diff --git a/lib/commands/token.js b/lib/commands/token.js index c24684b3dd614..dc1df6e0fcb25 100644 --- a/lib/commands/token.js +++ b/lib/commands/token.js @@ -1,5 +1,4 @@ const Table = require('cli-table3') -const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr') const log = require('../utils/log-shim.js') const profile = require('npm-profile') @@ -137,7 +136,7 @@ class Token extends BaseCommand { const readonly = conf.readOnly const password = await readUserInfo.password() - const validCIDR = this.validateCIDRList(cidr) + const validCIDR = await this.validateCIDRList(cidr) log.info('token', 'creating') const result = await pulseTillDone.withPromise( otplease(this.npm, conf, c => profile.createToken(password, readonly, validCIDR, c)) @@ -209,7 +208,8 @@ class Token extends BaseCommand { return byId } - validateCIDRList (cidrs) { + async validateCIDRList (cidrs) { + const { v4: isCidrV4, v6: isCidrV6 } = await import('is-cidr') const maybeList = [].concat(cidrs).filter(Boolean) const list = maybeList.length === 1 ? maybeList[0].split(/,\s*/) : maybeList for (const cidr of list) { diff --git a/node_modules/cidr-regex/index.js b/node_modules/cidr-regex/index.js index 0f12ee10b3c81..61597c62532aa 100644 --- a/node_modules/cidr-regex/index.js +++ b/node_modules/cidr-regex/index.js @@ -1,18 +1,15 @@ -"use strict"; - -const ipRegex = require("ip-regex"); +import ipRegex from "ip-regex"; const defaultOpts = {exact: false}; - const v4str = `${ipRegex.v4().source}\\/(3[0-2]|[12]?[0-9])`; const v6str = `${ipRegex.v6().source}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`; -// can not precompile the non-exact regexes because global flag makes the regex object stateful -// which would require the user to reset .lastIndex on subsequent calls +// pre-compile only the exact regexes as global flag makes regex objects stateful const v4exact = new RegExp(`^${v4str}$`); const v6exact = new RegExp(`^${v6str}$`); const v46exact = new RegExp(`(?:^${v4str}$)|(?:^${v6str}$)`); -module.exports = ({exact} = defaultOpts) => exact ? v46exact : new RegExp(`(?:${v4str})|(?:${v6str})`, "g"); -module.exports.v4 = ({exact} = defaultOpts) => exact ? v4exact : new RegExp(v4str, "g"); -module.exports.v6 = ({exact} = defaultOpts) => exact ? v6exact : new RegExp(v6str, "g"); +const cidrRegex = ({exact} = defaultOpts) => exact ? v46exact : new RegExp(`(?:${v4str})|(?:${v6str})`, "g"); +export const v4 = cidrRegex.v4 = ({exact} = defaultOpts) => exact ? v4exact : new RegExp(v4str, "g"); +export const v6 = cidrRegex.v6 = ({exact} = defaultOpts) => exact ? v6exact : new RegExp(v6str, "g"); +export default cidrRegex; diff --git a/node_modules/cidr-regex/package.json b/node_modules/cidr-regex/package.json index 8ddef4ed96a93..4f743464075e3 100644 --- a/node_modules/cidr-regex/package.json +++ b/node_modules/cidr-regex/package.json @@ -1,6 +1,6 @@ { "name": "cidr-regex", - "version": "3.1.1", + "version": "4.0.3", "description": "Regular expression for matching IP addresses in CIDR notation", "author": "silverwind ", "contributors": [ @@ -8,35 +8,25 @@ ], "repository": "silverwind/cidr-regex", "license": "BSD-2-Clause", - "scripts": { - "test": "make test" - }, + "type": "module", + "exports": "./index.js", + "sideEffects": false, "engines": { - "node": ">=10" + "node": ">=14" }, "files": [ "index.js", "index.d.ts" ], - "keywords": [ - "cidr", - "regex", - "notation", - "cidr notation", - "prefix", - "prefixes", - "ip", - "ip address" - ], "dependencies": { - "ip-regex": "^4.1.0" + "ip-regex": "^5.0.0" }, "devDependencies": { - "eslint": "7.8.1", - "eslint-config-silverwind": "18.0.8", - "jest": "26.4.2", - "tsd": "0.13.1", - "updates": "10.3.6", - "versions": "8.4.3" + "eslint": "8.37.0", + "eslint-config-silverwind": "65.1.3", + "tsd": "0.28.1", + "updates": "13.2.9", + "versions": "10.4.2", + "vitest": "0.29.8" } } diff --git a/node_modules/ip-regex/index.js b/node_modules/ip-regex/index.js index ab7a37f1caf0e..1fe723cb7f5a9 100644 --- a/node_modules/ip-regex/index.js +++ b/node_modules/ip-regex/index.js @@ -1,23 +1,23 @@ -'use strict'; - const word = '[a-fA-F\\d:]'; -const b = options => options && options.includeBoundaries ? - `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))` : - ''; + +const boundry = options => options && options.includeBoundaries + ? `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))` + : ''; const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}'; -const v6seg = '[a-fA-F\\d]{1,4}'; +const v6segment = '[a-fA-F\\d]{1,4}'; + const v6 = ` (?: -(?:${v6seg}:){7}(?:${v6seg}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8 -(?:${v6seg}:){6}(?:${v4}|:${v6seg}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4 -(?:${v6seg}:){5}(?::${v4}|(?::${v6seg}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4 -(?:${v6seg}:){4}(?:(?::${v6seg}){0,1}:${v4}|(?::${v6seg}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4 -(?:${v6seg}:){3}(?:(?::${v6seg}){0,2}:${v4}|(?::${v6seg}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4 -(?:${v6seg}:){2}(?:(?::${v6seg}){0,3}:${v4}|(?::${v6seg}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4 -(?:${v6seg}:){1}(?:(?::${v6seg}){0,4}:${v4}|(?::${v6seg}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4 -(?::(?:(?::${v6seg}){0,5}:${v4}|(?::${v6seg}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4 +(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8 +(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4 +(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4 +(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4 +(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4 +(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4 +(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4 +(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4 )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1 `.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim(); @@ -26,11 +26,11 @@ const v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`); const v4exact = new RegExp(`^${v4}$`); const v6exact = new RegExp(`^${v6}$`); -const ip = options => options && options.exact ? - v46Exact : - new RegExp(`(?:${b(options)}${v4}${b(options)})|(?:${b(options)}${v6}${b(options)})`, 'g'); +const ipRegex = options => options && options.exact + ? v46Exact + : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g'); -ip.v4 = options => options && options.exact ? v4exact : new RegExp(`${b(options)}${v4}${b(options)}`, 'g'); -ip.v6 = options => options && options.exact ? v6exact : new RegExp(`${b(options)}${v6}${b(options)}`, 'g'); +ipRegex.v4 = options => options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g'); +ipRegex.v6 = options => options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g'); -module.exports = ip; +export default ipRegex; diff --git a/node_modules/ip-regex/license b/node_modules/ip-regex/license index e7af2f77107d7..fa7ceba3eb4a9 100644 --- a/node_modules/ip-regex/license +++ b/node_modules/ip-regex/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/node_modules/ip-regex/package.json b/node_modules/ip-regex/package.json index 2fb8a03c812a0..1f82fd5947262 100644 --- a/node_modules/ip-regex/package.json +++ b/node_modules/ip-regex/package.json @@ -1,16 +1,19 @@ { "name": "ip-regex", - "version": "4.3.0", + "version": "5.0.0", "description": "Regular expression for matching IP addresses (IPv4 & IPv6)", "license": "MIT", "repository": "sindresorhus/ip-regex", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, + "type": "module", + "exports": "./index.js", "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "scripts": { "test": "xo && ava && tsd" @@ -37,8 +40,8 @@ "validate" ], "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" + "ava": "^3.15.0", + "tsd": "^0.19.1", + "xo": "^0.47.0" } } diff --git a/node_modules/is-cidr/index.js b/node_modules/is-cidr/index.js index 8caef5fbb72a3..ed7f152c1163e 100644 --- a/node_modules/is-cidr/index.js +++ b/node_modules/is-cidr/index.js @@ -1,9 +1,9 @@ -"use strict"; -const {v4, v6} = require("cidr-regex"); +import {v4 as v4Re, v6 as v6Re} from "cidr-regex"; -const re4 = v4({exact: true}); -const re6 = v6({exact: true}); +const re4 = v4Re({exact: true}); +const re6 = v6Re({exact: true}); -module.exports = str => re4.test(str) ? 4 : (re6.test(str) ? 6 : 0); -module.exports.v4 = str => re4.test(str); -module.exports.v6 = str => re6.test(str); +const isCidr = str => re4.test(str) ? 4 : (re6.test(str) ? 6 : 0); +export const v4 = isCidr.v4 = str => re4.test(str); +export const v6 = isCidr.v6 = str => re6.test(str); +export default isCidr; diff --git a/node_modules/is-cidr/package.json b/node_modules/is-cidr/package.json index b02775a0e3f6f..d6971b3b33bd8 100644 --- a/node_modules/is-cidr/package.json +++ b/node_modules/is-cidr/package.json @@ -1,6 +1,6 @@ { "name": "is-cidr", - "version": "4.0.2", + "version": "5.0.3", "description": "Check if a string is an IP address in CIDR notation", "author": "silverwind ", "contributors": [ @@ -8,39 +8,25 @@ ], "repository": "silverwind/is-cidr", "license": "BSD-2-Clause", - "scripts": { - "test": "make test" - }, + "type": "module", + "exports": "./index.js", + "sideEffects": false, "engines": { - "node": ">=10" + "node": ">=14" }, "files": [ "index.js", "index.d.ts" ], - "keywords": [ - "cidr", - "regex", - "notation", - "cidr notation", - "prefix", - "prefixes", - "ip", - "ip address", - "network" - ], "dependencies": { - "cidr-regex": "^3.1.1" + "cidr-regex": "4.0.3" }, "devDependencies": { - "eslint": "7.10.0", - "eslint-config-silverwind": "18.0.10", - "jest": "26.4.2", - "updates": "11.1.5", - "versions": "8.4.3" - }, - "jest": { - "verbose": false, - "testTimeout": 10000 + "eslint": "8.37.0", + "eslint-config-silverwind": "65.1.3", + "tsd": "0.28.1", + "updates": "13.2.9", + "versions": "10.4.2", + "vitest": "0.29.8" } } diff --git a/package-lock.json b/package-lock.json index d3c7778e8edef..1bf8cc1bb5cb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -113,7 +113,7 @@ "hosted-git-info": "^7.0.1", "ini": "^4.1.1", "init-package-json": "^6.0.0", - "is-cidr": "^4.0.2", + "is-cidr": "^5.0.3", "json-parse-even-better-errors": "^3.0.0", "libnpmaccess": "^8.0.1", "libnpmdiff": "^6.0.2", @@ -4919,15 +4919,15 @@ } }, "node_modules/cidr-regex": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-3.1.1.tgz", - "integrity": "sha512-RBqYd32aDwbCMFJRL6wHOlDNYJsPNTt8vC82ErHF5vKt8QQzxm1FrkW8s/R5pVrXMf17sba09Uoy91PKiddAsw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-4.0.3.tgz", + "integrity": "sha512-HOwDIy/rhKeMf6uOzxtv7FAbrz8zPjmVKfSpM+U7/bNBXC5rtOyr758jxcptiSx6ZZn5LOhPJT5WWxPAGDV8dw==", "inBundle": true, "dependencies": { - "ip-regex": "^4.1.0" + "ip-regex": "^5.0.0" }, "engines": { - "node": ">=10" + "node": ">=14" } }, "node_modules/clean-stack": { @@ -7827,12 +7827,15 @@ "inBundle": true }, "node_modules/ip-regex": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", - "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-5.0.0.tgz", + "integrity": "sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==", "inBundle": true, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-array-buffer": { @@ -7935,15 +7938,15 @@ } }, "node_modules/is-cidr": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-4.0.2.tgz", - "integrity": "sha512-z4a1ENUajDbEl/Q6/pVBpTR1nBjjEE1X7qb7bmWYanNnPoKAvUCPFKeXV6Fe4mgTkWKBqiHIcwsI3SndiO5FeA==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-5.0.3.tgz", + "integrity": "sha512-lKkM0tmz07dAxNsr8Ii9MGreExa9ZR34N9j8mTG5op824kcwBqinZPowNjcVWWc7j+jR8XAMMItOmBkniN0jOA==", "inBundle": true, "dependencies": { - "cidr-regex": "^3.1.1" + "cidr-regex": "4.0.3" }, "engines": { - "node": ">=10" + "node": ">=14" } }, "node_modules/is-core-module": { diff --git a/package.json b/package.json index a7950f8f5f11e..58737421f0fc2 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "hosted-git-info": "^7.0.1", "ini": "^4.1.1", "init-package-json": "^6.0.0", - "is-cidr": "^4.0.2", + "is-cidr": "^5.0.3", "json-parse-even-better-errors": "^3.0.0", "libnpmaccess": "^8.0.1", "libnpmdiff": "^6.0.2",