deps: upgrade npm to 10.2.4

PR-URL: https://github.com/nodejs/node/pull/50751
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
npm CLI robot
2023-11-16 09:12:25 -08:00
committed by GitHub
parent 1e0b75c3df
commit bfe32ec016
143 changed files with 2411 additions and 1007 deletions

View File

@@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For
example, running `npm ls promzard` in npm's source tree will show:
```bash
npm@10.2.3 /path/to/npm
npm@10.2.4 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```

View File

@@ -18,10 +18,9 @@ then only packages matching one of the supplied names are removed.
Extraneous packages are those present in the `node_modules` folder that are
not listed as any package's dependency list.
If the `--production` flag is specified or the `NODE_ENV` environment
If the `--omit=dev` flag is specified or the `NODE_ENV` environment
variable is set to `production`, this command will remove the packages
specified in your `devDependencies`. Setting `--no-production` will negate
`NODE_ENV` being set to `production`.
specified in your `devDependencies`.
If the `--dry-run` flag is used then no changes will actually be made.

View File

@@ -32,6 +32,13 @@ For example, to show the dependencies of the `ronn` package at version
npm view ronn@0.3.5 dependencies
```
By default, `npm view` shows data about the current project context (by looking for a `package.json`).
To show field data for the current project use a file path (i.e. `.`):
```bash
npm view . dependencies
```
You can view child fields by separating them with a period.
To view the git repository URL for the latest version of `npm`, you would run the following command:

View File

@@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.
### Version
10.2.3
10.2.4
### Description

View File

@@ -160,7 +160,7 @@ tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code>
the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For
example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
<pre><code class="language-bash">npm@10.2.3 /path/to/npm
<pre><code class="language-bash">npm@10.2.4 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>

View File

@@ -153,10 +153,9 @@ npm command-line interface
then only packages matching one of the supplied names are removed.</p>
<p>Extraneous packages are those present in the <code>node_modules</code> folder that are
not listed as any package's dependency list.</p>
<p>If the <code>--production</code> flag is specified or the <code>NODE_ENV</code> environment
<p>If the <code>--omit=dev</code> flag is specified or the <code>NODE_ENV</code> environment
variable is set to <code>production</code>, this command will remove the packages
specified in your <code>devDependencies</code>. Setting <code>--no-production</code> will negate
<code>NODE_ENV</code> being set to <code>production</code>.</p>
specified in your <code>devDependencies</code>.</p>
<p>If the <code>--dry-run</code> flag is used then no changes will actually be made.</p>
<p>If the <code>--json</code> flag is used, then the changes <code>npm prune</code> made (or would
have made with <code>--dry-run</code>) are printed as a JSON object.</p>

View File

@@ -161,6 +161,10 @@ For example, to show the dependencies of the <code>ronn</code> package at versio
<code>0.3.5</code>, you could do the following:</p>
<pre><code class="language-bash">npm view ronn@0.3.5 dependencies
</code></pre>
<p>By default, <code>npm view</code> shows data about the current project context (by looking for a <code>package.json</code>).
To show field data for the current project use a file path (i.e. <code>.</code>):</p>
<pre><code class="language-bash">npm view . dependencies
</code></pre>
<p>You can view child fields by separating them with a period.
To view the git repository URL for the latest version of <code>npm</code>, you would run the following command:</p>
<pre><code class="language-bash">npm view npm repository.url

View File

@@ -150,7 +150,7 @@ npm command-line interface
</code></pre>
<p>Note: This command is unaware of workspaces.</p>
<h3 id="version">Version</h3>
<p>10.2.3</p>
<p>10.2.4</p>
<h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency

View File

@@ -34,24 +34,33 @@ class Exec extends BaseCommand {
for (const [name, path] of this.workspaces) {
const locationMsg =
`in workspace ${this.npm.chalk.green(name)} at location:\n${this.npm.chalk.dim(path)}`
await this.callExec(args, { locationMsg, runPath: path })
await this.callExec(args, { name, locationMsg, runPath: path })
}
}
async callExec (args, { locationMsg, runPath } = {}) {
// This is where libnpmexec will look for locally installed packages
async callExec (args, { name, locationMsg, runPath } = {}) {
// This is where libnpmexec will look for locally installed packages at the project level
const localPrefix = this.npm.localPrefix
// This is where libnpmexec will look for locally installed packages at the workspace level
let localBin = this.npm.localBin
let path = localPrefix
// This is where libnpmexec will actually run the scripts from
if (!runPath) {
runPath = process.cwd()
} else {
// We have to consider if the workspace has its own separate versions
// libnpmexec will walk up to localDir after looking here
localBin = resolve(this.npm.localDir, name, 'node_modules', '.bin')
// We also need to look for `bin` entries in the workspace package.json
// libnpmexec will NOT look in the project root for the bin entry
path = runPath
}
const call = this.npm.config.get('call')
let globalPath
const {
flatOptions,
localBin,
globalBin,
globalDir,
chalk,
@@ -79,14 +88,14 @@ class Exec extends BaseCommand {
// copy args so they dont get mutated
args: [...args],
call,
localBin,
locationMsg,
chalk,
globalBin,
globalPath,
localBin,
locationMsg,
output,
chalk,
packages,
path: localPrefix,
path,
runPath,
scriptShell,
yes,

View File

@@ -6,7 +6,6 @@ const npa = require('npm-package-arg')
const pickManifest = require('npm-pick-manifest')
const localeCompare = require('@isaacs/string-locale-compare')('en')
const ansiTrim = require('strip-ansi')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
class Outdated extends ArboristWorkspaceCmd {
@@ -23,6 +22,7 @@ class Outdated extends ArboristWorkspaceCmd {
]
async exec (args) {
const { default: stripAnsi } = await import('strip-ansi')
const global = resolve(this.npm.globalDir, '..')
const where = this.npm.global
? global
@@ -106,7 +106,7 @@ class Outdated extends ArboristWorkspaceCmd {
const tableOpts = {
align: ['l', 'r', 'r', 'r', 'l'],
stringLength: s => ansiTrim(s).length,
stringLength: s => stripAnsi(s).length,
}
this.npm.output(table(outTable, tableOpts))
}

View File

@@ -82,10 +82,9 @@ class Pkg extends BaseCommand {
}
}
// only outputs if not running with workspaces config,
// in case you're retrieving info for workspaces the pkgWorkspaces
// will handle the output to make sure it get keyed by ws name
if (!this.npm.config.get('workspaces')) {
// only outputs if not running with workspaces config
// execWorkspaces will handle the output otherwise
if (!this.workspaces) {
this.npm.output(JSON.stringify(result, null, 2))
}

View File

@@ -81,12 +81,12 @@ class Search extends BaseCommand {
const filterStream = new FilterStream()
// Grab a configured output stream that will spit out packages in the
// desired format.
const outputStream = formatSearchStream({
const { default: stripAnsi } = await import('strip-ansi')
// Grab a configured output stream that will spit out packages in the desired format.
const outputStream = await formatSearchStream({
args, // --searchinclude options are not highlighted
...opts,
})
}, stripAnsi)
log.silly('search', 'searching packages')
const p = new Pipeline(

View File

@@ -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) {

View File

@@ -1,6 +1,5 @@
const { Minipass } = require('minipass')
const columnify = require('columnify')
const ansiTrim = require('strip-ansi')
// This module consumes package data in the following format:
//
@@ -16,8 +15,8 @@ const ansiTrim = require('strip-ansi')
// The returned stream will format this package data
// into a byte stream of formatted, displayable output.
module.exports = (opts) => {
return opts.json ? new JSONOutputStream() : new TextOutputStream(opts)
module.exports = async (opts, clean) => {
return opts.json ? new JSONOutputStream() : new TextOutputStream(opts, clean)
}
class JSONOutputStream extends Minipass {
@@ -41,121 +40,96 @@ class JSONOutputStream extends Minipass {
}
class TextOutputStream extends Minipass {
constructor (opts) {
#clean
#opts
#line = 0
constructor (opts, clean) {
super()
this._opts = opts
this._line = 0
this.#clean = clean
this.#opts = opts
}
write (pkg) {
return super.write(prettify(pkg, ++this._line, this._opts))
}
}
function prettify (data, num, opts) {
var truncate = !opts.long
var pkg = normalizePackage(data, opts)
var columns = ['name', 'description', 'author', 'date', 'version', 'keywords']
if (opts.parseable) {
return columns.map(function (col) {
return pkg[col] && ('' + pkg[col]).replace(/\t/g, ' ')
}).join('\t')
return super.write(this.#prettify(pkg))
}
// stdout in tap is never a tty
/* istanbul ignore next */
const maxWidth = process.stdout.isTTY ? process.stdout.getWindowSize()[0] : Infinity
let output = columnify(
[pkg],
{
include: columns,
showHeaders: num <= 1,
columnSplitter: ' | ',
truncate: truncate,
config: {
name: { minWidth: 25, maxWidth: 25, truncate: false, truncateMarker: '' },
description: { minWidth: 20, maxWidth: 20 },
author: { minWidth: 15, maxWidth: 15 },
date: { maxWidth: 11 },
version: { minWidth: 8, maxWidth: 8 },
keywords: { maxWidth: Infinity },
},
#prettify (data) {
const pkg = {
author: data.maintainers.map((m) => `=${this.#clean(m.username)}`).join(' '),
date: 'prehistoric',
description: this.#clean(data.description ?? ''),
keywords: '',
name: this.#clean(data.name),
version: data.version,
}
if (Array.isArray(data.keywords)) {
pkg.keywords = data.keywords.map((k) => this.#clean(k)).join(' ')
} else if (typeof data.keywords === 'string') {
pkg.keywords = this.#clean(data.keywords.replace(/[,\s]+/, ' '))
}
if (data.date) {
pkg.date = data.date.toISOString().split('T')[0] // remove time
}
).split('\n').map(line => line.slice(0, maxWidth)).join('\n')
if (opts.color) {
output = highlightSearchTerms(output, opts.args)
}
const columns = ['name', 'description', 'author', 'date', 'version', 'keywords']
if (this.#opts.parseable) {
return columns.map((col) => pkg[col] && ('' + pkg[col]).replace(/\t/g, ' ')).join('\t')
}
return output
}
// stdout in tap is never a tty
/* istanbul ignore next */
const maxWidth = process.stdout.isTTY ? process.stdout.getWindowSize()[0] : Infinity
let output = columnify(
[pkg],
{
include: columns,
showHeaders: ++this.#line <= 1,
columnSplitter: ' | ',
truncate: !this.#opts.long,
config: {
name: { minWidth: 25, maxWidth: 25, truncate: false, truncateMarker: '' },
description: { minWidth: 20, maxWidth: 20 },
author: { minWidth: 15, maxWidth: 15 },
date: { maxWidth: 11 },
version: { minWidth: 8, maxWidth: 8 },
keywords: { maxWidth: Infinity },
},
}
).split('\n').map(line => line.slice(0, maxWidth)).join('\n')
var colors = [31, 33, 32, 36, 34, 35]
var cl = colors.length
if (!this.#opts.color) {
return output
}
function addColorMarker (str, arg, i) {
var m = i % cl + 1
var markStart = String.fromCharCode(m)
var markEnd = String.fromCharCode(0)
const colors = ['31m', '33m', '32m', '36m', '34m', '35m']
if (arg.charAt(0) === '/') {
return str.replace(
new RegExp(arg.slice(1, -1), 'gi'),
bit => markStart + bit + markEnd
)
}
this.#opts.args.forEach((arg, i) => {
const markStart = String.fromCharCode(i % colors.length + 1)
const markEnd = String.fromCharCode(0)
// just a normal string, do the split/map thing
var pieces = str.toLowerCase().split(arg.toLowerCase())
var p = 0
if (arg.charAt(0) === '/') {
output = output.replace(
new RegExp(arg.slice(1, -1), 'gi'),
bit => `${markStart}${bit}${markEnd}`
)
} else {
// just a normal string, do the split/map thing
let p = 0
return pieces.map(function (piece) {
piece = str.slice(p, p + piece.length)
var mark = markStart +
str.slice(p + piece.length, p + piece.length + arg.length) +
markEnd
p += piece.length + arg.length
return piece + mark
}).join('')
}
output = output.toLowerCase().split(arg.toLowerCase()).map(piece => {
piece = output.slice(p, p + piece.length)
p += piece.length
const mark = `${markStart}${output.slice(p, p + arg.length)}${markEnd}`
p += arg.length
return `${piece}${mark}`
}).join('')
}
})
function colorize (line) {
for (var i = 0; i < cl; i++) {
var m = i + 1
var color = '\u001B[' + colors[i] + 'm'
line = line.split(String.fromCharCode(m)).join(color)
}
var uncolor = '\u001B[0m'
return line.split('\u0000').join(uncolor)
}
function highlightSearchTerms (str, terms) {
terms.forEach(function (arg, i) {
str = addColorMarker(str, arg, i)
})
return colorize(str).trim()
}
function normalizePackage (data, opts) {
return {
name: ansiTrim(data.name),
description: ansiTrim(data.description ?? ''),
author: data.maintainers.map((m) => `=${ansiTrim(m.username)}`).join(' '),
keywords: Array.isArray(data.keywords)
? data.keywords.map(ansiTrim).join(' ')
: typeof data.keywords === 'string'
? ansiTrim(data.keywords.replace(/[,\s]+/, ' '))
: '',
version: data.version,
date: (data.date &&
(data.date.toISOString() // remove time
.split('T').join(' ')
.replace(/:[0-9]{2}\.[0-9]{3}Z$/, ''))
.slice(0, -5)) ||
'prehistoric',
for (let i = 1; i <= colors.length; i++) {
output = output.split(String.fromCharCode(i)).join(`\u001B[${colors[i - 1]}`)
}
return output.split('\u0000').join('\u001B[0m').trim()
}
}

View File

@@ -39,7 +39,7 @@ const open = async (npm, url, errMsg, isFile) => {
const command = browser === true ? null : browser
await promiseSpawn.open(url, { command })
.catch((err) => {
if (err.code !== 'ENOENT') {
if (err.code !== 127) {
throw err
}

View File

@@ -86,7 +86,14 @@ const toCyclonedxItem = (node, { packageType }) => {
let parsedLicense
try {
parsedLicense = parseLicense(node.package?.license)
let license = node.package?.license
if (license) {
if (typeof license === 'object') {
license = license.type
}
}
parsedLicense = parseLicense(license)
} catch (err) {
parsedLicense = null
}
@@ -152,7 +159,7 @@ const toCyclonedxItem = (node, { packageType }) => {
// If license is a single SPDX license, use the license field
if (parsedLicense?.license) {
component.licenses = [{ license: { id: parsedLicense.license } }]
// If license is a conjunction, use the expression field
// If license is a conjunction, use the expression field
} else if (parsedLicense?.conjunction) {
component.licenses = [{ expression: node.package.license }]
}

View File

@@ -93,6 +93,13 @@ const toSpdxItem = (node, { packageType }) => {
location = node.linksIn.values().next().value.location
}
let license = node.package?.license
if (license) {
if (typeof license === 'object') {
license = license.type
}
}
const pkg = {
name: node.packageName,
SPDXID: toSpdxID(node),
@@ -103,7 +110,7 @@ const toSpdxItem = (node, { packageType }) => {
downloadLocation: (node.isLink ? undefined : node.resolved) || NO_ASSERTION,
filesAnalyzed: false,
homepage: node.package?.homepage || NO_ASSERTION,
licenseDeclared: node.package?.license || NO_ASSERTION,
licenseDeclared: license || NO_ASSERTION,
externalRefs: [
{
referenceCategory: REF_CAT_PACKAGE_MANAGER,

View File

@@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit
.P
.RS 2
.nf
npm@10.2.3 /path/to/npm
npm@10.2.4 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
.fi

View File

@@ -14,7 +14,7 @@ This command removes "extraneous" packages. If a package name is provided, then
.P
Extraneous packages are those present in the \fBnode_modules\fR folder that are not listed as any package's dependency list.
.P
If the \fB--production\fR flag is specified or the \fBNODE_ENV\fR environment variable is set to \fBproduction\fR, this command will remove the packages specified in your \fBdevDependencies\fR. Setting \fB--no-production\fR will negate \fBNODE_ENV\fR being set to \fBproduction\fR.
If the \fB--omit=dev\fR flag is specified or the \fBNODE_ENV\fR environment variable is set to \fBproduction\fR, this command will remove the packages specified in your \fBdevDependencies\fR.
.P
If the \fB--dry-run\fR flag is used then no changes will actually be made.
.P

View File

@@ -32,6 +32,14 @@ npm view ronn@0.3.5 dependencies
.fi
.RE
.P
By default, \fBnpm view\fR shows data about the current project context (by looking for a \fBpackage.json\fR). To show field data for the current project use a file path (i.e. \fB.\fR):
.P
.RS 2
.nf
npm view . dependencies
.fi
.RE
.P
You can view child fields by separating them with a period. To view the git repository URL for the latest version of \fBnpm\fR, you would run the following command:
.P
.RS 2

View File

@@ -12,7 +12,7 @@ npm
Note: This command is unaware of workspaces.
.SS "Version"
.P
10.2.3
10.2.4
.SS "Description"
.P
npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.

View File

@@ -1,8 +0,0 @@
export default 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 ? undefined : 'g');
}

View File

@@ -1,14 +0,0 @@
import ansiRegex from 'ansi-regex';
const regex = ansiRegex();
export default function stripAnsi(string) {
if (typeof string !== 'string') {
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
}
// Even though the regex is global, we don't need to reset the `.lastIndex`
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
// and doing it manually has a performance penalty.
return string.replace(regex, '');
}

View File

@@ -1,6 +1,6 @@
{
"name": "@npmcli/config",
"version": "8.0.1",
"version": "8.0.2",
"files": [
"bin/",
"lib/"
@@ -37,7 +37,7 @@
},
"dependencies": {
"@npmcli/map-workspaces": "^3.0.2",
"ci-info": "^3.8.0",
"ci-info": "^4.0.0",
"ini": "^4.1.0",
"nopt": "^7.0.0",
"proc-log": "^3.0.0",

View File

@@ -0,0 +1,163 @@
'use strict';
const wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${code + offset}m`;
};
const wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
const setLazyProperty = (object, property, get) => {
Object.defineProperty(object, property, {
get: () => {
const value = get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
/** @type {typeof import('color-convert')} */
let colorConvert;
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
if (colorConvert === undefined) {
colorConvert = require('color-convert');
}
const offset = isBackground ? 10 : 0;
const styles = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
if (sourceSpace === targetSpace) {
styles[name] = wrap(identity, offset);
} else if (typeof suite === 'object') {
styles[name] = wrap(suite[targetSpace], offset);
}
}
return styles;
};
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
// Alias bright black as gray (and grey)
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
return styles;
}
// Make the export immutable
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

View File

@@ -1,6 +1,6 @@
{
"name": "ansi-styles",
"version": "6.2.1",
"version": "4.3.0",
"description": "ANSI escape codes for styling strings in the terminal",
"license": "MIT",
"repository": "chalk/ansi-styles",
@@ -8,12 +8,10 @@
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
"url": "sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
@@ -45,10 +43,14 @@
"command-line",
"text"
],
"dependencies": {
"color-convert": "^2.0.1"
},
"devDependencies": {
"ava": "^3.15.0",
"@types/color-convert": "^1.9.0",
"ava": "^2.3.0",
"svg-term-cli": "^2.1.1",
"tsd": "^0.19.0",
"xo": "^0.47.0"
"tsd": "^0.11.0",
"xo": "^0.25.3"
}
}

View File

@@ -22,13 +22,14 @@ const entry_1 = require("./entry");
exports.DEFAULT_REKOR_URL = 'https://rekor.sigstore.dev';
class RekorWitness {
constructor(options) {
this.entryType = options.entryType;
this.tlog = new client_1.TLogClient({
...options,
rekorBaseURL: options.rekorBaseURL || /* istanbul ignore next */ exports.DEFAULT_REKOR_URL,
});
}
async testify(content, publicKey) {
const proposedEntry = (0, entry_1.toProposedEntry)(content, publicKey);
const proposedEntry = (0, entry_1.toProposedEntry)(content, publicKey, this.entryType);
const entry = await this.tlog.createEntry(proposedEntry);
return toTransparencyLogEntry(entry);
}

View File

@@ -1,6 +1,6 @@
{
"name": "@sigstore/sign",
"version": "2.1.0",
"version": "2.2.0",
"description": "Sigstore signing library",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -27,9 +27,9 @@
},
"devDependencies": {
"@sigstore/jest": "^0.0.0",
"@sigstore/mock": "^0.4.0",
"@sigstore/mock": "^0.6.0",
"@sigstore/rekor-types": "^2.0.0",
"@types/make-fetch-happen": "^10.0.0"
"@types/make-fetch-happen": "^10.0.3"
},
"dependencies": {
"@sigstore/bundle": "^2.1.0",

View File

@@ -25,8 +25,8 @@ const tuf_js_1 = require("tuf-js");
const target_1 = require("./target");
class TUFClient {
constructor(options) {
initTufCache(options.cachePath, options.rootPath);
const remote = initRemoteConfig(options.cachePath, options.mirrorURL);
initTufCache(options);
const remote = initRemoteConfig(options);
this.updater = initClient(options.cachePath, remote, options);
}
async refresh() {
@@ -42,7 +42,7 @@ exports.TUFClient = TUFClient;
// created. If the targets directory does not exist, it will be created.
// If the root.json file does not exist, it will be copied from the
// rootPath argument.
function initTufCache(cachePath, tufRootPath) {
function initTufCache({ cachePath, rootPath: tufRootPath, force, }) {
const targetsPath = path_1.default.join(cachePath, 'targets');
const cachedRootPath = path_1.default.join(cachePath, 'root.json');
if (!fs_1.default.existsSync(cachePath)) {
@@ -51,7 +51,9 @@ function initTufCache(cachePath, tufRootPath) {
if (!fs_1.default.existsSync(targetsPath)) {
fs_1.default.mkdirSync(targetsPath);
}
if (!fs_1.default.existsSync(cachedRootPath)) {
// If the root.json file does not exist (or we're forcing re-initialization),
// copy it from the rootPath argument
if (!fs_1.default.existsSync(cachedRootPath) || force) {
fs_1.default.copyFileSync(tufRootPath, cachedRootPath);
}
return cachePath;
@@ -59,14 +61,18 @@ function initTufCache(cachePath, tufRootPath) {
// Initializes the remote.json file, which contains the URL of the TUF
// repository. If the file does not exist, it will be created. If the file
// exists, it will be parsed and returned.
function initRemoteConfig(rootDir, mirrorURL) {
function initRemoteConfig({ cachePath, mirrorURL, force, }) {
let remoteConfig;
const remoteConfigPath = path_1.default.join(rootDir, 'remote.json');
if (fs_1.default.existsSync(remoteConfigPath)) {
const remoteConfigPath = path_1.default.join(cachePath, 'remote.json');
// If the remote config file exists, read it and parse it (skip if force is
// true)
if (!force && fs_1.default.existsSync(remoteConfigPath)) {
const data = fs_1.default.readFileSync(remoteConfigPath, 'utf-8');
remoteConfig = JSON.parse(data);
}
if (!remoteConfig) {
// If the remote config file does not exist (or we're forcing initialization),
// create it
if (!remoteConfig || force) {
remoteConfig = { mirror: mirrorURL };
fs_1.default.writeFileSync(remoteConfigPath, JSON.stringify(remoteConfig));
}

View File

@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TUFError = exports.initTUF = exports.getTrustedRoot = void 0;
exports.TUFError = exports.initTUF = exports.getTrustedRoot = exports.DEFAULT_MIRROR_URL = void 0;
/*
Copyright 2023 The Sigstore Authors.
@@ -19,8 +19,8 @@ limitations under the License.
const protobuf_specs_1 = require("@sigstore/protobuf-specs");
const appdata_1 = require("./appdata");
const client_1 = require("./client");
exports.DEFAULT_MIRROR_URL = 'https://tuf-repo-cdn.sigstore.dev';
const DEFAULT_CACHE_DIR = 'sigstore-js';
const DEFAULT_MIRROR_URL = 'https://tuf-repo-cdn.sigstore.dev';
const DEFAULT_TUF_ROOT_PATH = '../store/public-good-instance-root.json';
const DEFAULT_RETRY = { retries: 2 };
const DEFAULT_TIMEOUT = 5000;
@@ -46,9 +46,10 @@ function createClient(options) {
return new client_1.TUFClient({
cachePath: options.cachePath || (0, appdata_1.appDataPath)(DEFAULT_CACHE_DIR),
rootPath: options.rootPath || require.resolve(DEFAULT_TUF_ROOT_PATH),
mirrorURL: options.mirrorURL || DEFAULT_MIRROR_URL,
mirrorURL: options.mirrorURL || exports.DEFAULT_MIRROR_URL,
retry: options.retry ?? DEFAULT_RETRY,
timeout: options.timeout ?? DEFAULT_TIMEOUT,
force: options.force ?? false,
});
}
var error_1 = require("./error");

View File

@@ -1,6 +1,6 @@
{
"name": "@sigstore/tuf",
"version": "2.1.0",
"version": "2.2.0",
"description": "Client for the Sigstore TUF repository",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,10 +1,8 @@
'use strict';
module.exports = ({onlyFirst = false} = {}) => {
export default function ansiRegex({onlyFirst = false} = {}) {
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
'[\\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 ? undefined : 'g');
};
}

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

View File

@@ -1,16 +1,19 @@
{
"name": "ansi-regex",
"version": "5.0.1",
"version": "6.0.1",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "chalk/ansi-regex",
"funding": "https://github.com/chalk/ansi-regex?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd",
@@ -48,8 +51,8 @@
"pattern"
],
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
}

View File

@@ -1,130 +1,83 @@
'use strict';
const ANSI_BACKGROUND_OFFSET = 10;
const wrapAnsi16 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${code + offset}m`;
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
overline: [53, 55],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29],
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
gray: [90, 39], // Alias of `blackBright`
grey: [90, 39], // Alias of `blackBright`
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39],
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgGray: [100, 49], // Alias of `bgBlackBright`
bgGrey: [100, 49], // Alias of `bgBlackBright`
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49],
},
};
const wrapAnsi256 = (fn, offset) => (...args) => {
const code = fn(...args);
return `\u001B[${38 + offset};5;${code}m`;
};
const wrapAnsi16m = (fn, offset) => (...args) => {
const rgb = fn(...args);
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
};
const ansi2ansi = n => n;
const rgb2rgb = (r, g, b) => [r, g, b];
const setLazyProperty = (object, property, get) => {
Object.defineProperty(object, property, {
get: () => {
const value = get();
Object.defineProperty(object, property, {
value,
enumerable: true,
configurable: true
});
return value;
},
enumerable: true,
configurable: true
});
};
/** @type {typeof import('color-convert')} */
let colorConvert;
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
if (colorConvert === undefined) {
colorConvert = require('color-convert');
}
const offset = isBackground ? 10 : 0;
const styles = {};
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
if (sourceSpace === targetSpace) {
styles[name] = wrap(identity, offset);
} else if (typeof suite === 'object') {
styles[name] = wrap(suite[targetSpace], offset);
}
}
return styles;
};
export const modifierNames = Object.keys(styles.modifier);
export const foregroundColorNames = Object.keys(styles.color);
export const backgroundColorNames = Object.keys(styles.bgColor);
export const colorNames = [...foregroundColorNames, ...backgroundColorNames];
function assembleStyles() {
const codes = new Map();
const styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
// Alias bright black as gray (and grey)
styles.color.gray = styles.color.blackBright;
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
styles.color.grey = styles.color.blackBright;
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\u001B[${style[0]}m`,
close: `\u001B[${style[1]}m`
close: `\u001B[${style[1]}m`,
};
group[styleName] = styles[styleName];
@@ -134,30 +87,137 @@ function assembleStyles() {
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
enumerable: false,
});
}
Object.defineProperty(styles, 'codes', {
value: codes,
enumerable: false
enumerable: false,
});
styles.color.close = '\u001B[39m';
styles.bgColor.close = '\u001B[49m';
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
styles.color.ansi = wrapAnsi16();
styles.color.ansi256 = wrapAnsi256();
styles.color.ansi16m = wrapAnsi16m();
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
Object.defineProperties(styles, {
rgbToAnsi256: {
value: (red, green, blue) => {
// We use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (red === green && green === blue) {
if (red < 8) {
return 16;
}
if (red > 248) {
return 231;
}
return Math.round(((red - 8) / 247) * 24) + 232;
}
return 16
+ (36 * Math.round(red / 255 * 5))
+ (6 * Math.round(green / 255 * 5))
+ Math.round(blue / 255 * 5);
},
enumerable: false,
},
hexToRgb: {
value: hex => {
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
if (!matches) {
return [0, 0, 0];
}
let [colorString] = matches;
if (colorString.length === 3) {
colorString = [...colorString].map(character => character + character).join('');
}
const integer = Number.parseInt(colorString, 16);
return [
/* eslint-disable no-bitwise */
(integer >> 16) & 0xFF,
(integer >> 8) & 0xFF,
integer & 0xFF,
/* eslint-enable no-bitwise */
];
},
enumerable: false,
},
hexToAnsi256: {
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
enumerable: false,
},
ansi256ToAnsi: {
value: code => {
if (code < 8) {
return 30 + code;
}
if (code < 16) {
return 90 + (code - 8);
}
let red;
let green;
let blue;
if (code >= 232) {
red = (((code - 232) * 10) + 8) / 255;
green = red;
blue = red;
} else {
code -= 16;
const remainder = code % 36;
red = Math.floor(code / 36) / 5;
green = Math.floor(remainder / 6) / 5;
blue = (remainder % 6) / 5;
}
const value = Math.max(red, green, blue) * 2;
if (value === 0) {
return 30;
}
// eslint-disable-next-line no-bitwise
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
if (value === 2) {
result += 60;
}
return result;
},
enumerable: false,
},
rgbToAnsi: {
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
enumerable: false,
},
hexToAnsi: {
value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
enumerable: false,
},
});
return styles;
}
// Make the export immutable
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});
const ansiStyles = assembleStyles();
export default ansiStyles;

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

View File

@@ -1,6 +1,6 @@
{
"name": "ansi-styles",
"version": "4.3.0",
"version": "6.2.1",
"description": "ANSI escape codes for styling strings in the terminal",
"license": "MIT",
"repository": "chalk/ansi-styles",
@@ -8,10 +8,12 @@
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd",
@@ -43,14 +45,10 @@
"command-line",
"text"
],
"dependencies": {
"color-convert": "^2.0.1"
},
"devDependencies": {
"@types/color-convert": "^1.9.0",
"ava": "^2.3.0",
"ava": "^3.15.0",
"svg-term-cli": "^2.1.1",
"tsd": "^0.11.0",
"xo": "^0.25.3"
"tsd": "^0.19.0",
"xo": "^0.47.0"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "ci-info",
"version": "3.9.0",
"version": "4.0.0",
"description": "Get details about the current Continuous Integration environment",
"main": "index.js",
"typings": "index.d.ts",

View File

@@ -1,4 +1,10 @@
[
{
"name": "Agola CI",
"constant": "AGOLA",
"env": "AGOLA_GIT_REF",
"pr": "AGOLA_PULL_REQUEST_ID"
},
{
"name": "Appcircle",
"constant": "APPCIRCLE",
@@ -104,6 +110,11 @@
"constant": "DSARI",
"env": "DSARI"
},
{
"name": "Earthly",
"constant": "EARTHLY",
"env": "EARTHLY_CI"
},
{
"name": "Expo Application Services",
"constant": "EAS",
@@ -114,6 +125,11 @@
"constant": "GERRIT",
"env": "GERRIT_PROJECT"
},
{
"name": "Gitea Actions",
"constant": "GITEA_ACTIONS",
"env": "GITEA_ACTIONS"
},
{
"name": "GitHub Actions",
"constant": "GITHUB_ACTIONS",
@@ -199,6 +215,11 @@
"ne": "false"
}
},
{
"name": "Prow",
"constant": "PROW",
"env": "PROW_JOB_ID"
},
{
"name": "ReleaseHub",
"constant": "RELEASEHUB",
@@ -233,20 +254,6 @@
"env": "SEMAPHORE",
"pr": "PULL_REQUEST_NUMBER"
},
{
"name": "Shippable",
"constant": "SHIPPABLE",
"env": "SHIPPABLE",
"pr": {
"IS_PULL_REQUEST": "true"
}
},
{
"name": "Solano CI",
"constant": "SOLANO",
"env": "TDDIUM",
"pr": "TDDIUM_PR_ID"
},
{
"name": "Sourcehut",
"constant": "SOURCEHUT",
@@ -281,6 +288,14 @@
"ne": "false"
}
},
{
"name": "Vela",
"constant": "VELA",
"env": "VELA",
"pr": {
"VELA_PULL_REQUEST": "1"
}
},
{
"name": "Vercel",
"constant": "VERCEL",

View File

@@ -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;

View File

@@ -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 <me@silverwind.io>",
"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"
}
}

View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = ({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 ? undefined : 'g');
};

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

View File

@@ -1,19 +1,16 @@
{
"name": "ansi-regex",
"version": "6.0.1",
"version": "5.0.1",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "chalk/ansi-regex",
"funding": "https://github.com/chalk/ansi-regex?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
"url": "sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
@@ -51,8 +48,8 @@
"pattern"
],
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
"ava": "^2.4.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
}
}

View File

@@ -0,0 +1,4 @@
'use strict';
const ansiRegex = require('ansi-regex');
module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

View File

@@ -1,19 +1,16 @@
{
"name": "strip-ansi",
"version": "7.1.0",
"version": "6.0.1",
"description": "Strip ANSI escape codes from a string",
"license": "MIT",
"repository": "chalk/strip-ansi",
"funding": "https://github.com/chalk/strip-ansi?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
"url": "sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
@@ -47,11 +44,11 @@
"text"
],
"dependencies": {
"ansi-regex": "^6.0.1"
"ansi-regex": "^5.0.1"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.17.0",
"xo": "^0.44.0"
"ava": "^2.4.0",
"tsd": "^0.10.0",
"xo": "^0.25.3"
}
}

View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = ({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 ? undefined : 'g');
};

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

View File

@@ -1,19 +1,16 @@
{
"name": "ansi-regex",
"version": "6.0.1",
"version": "5.0.1",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "chalk/ansi-regex",
"funding": "https://github.com/chalk/ansi-regex?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
"url": "sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
@@ -51,8 +48,8 @@
"pattern"
],
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
"ava": "^2.4.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
}
}

View File

@@ -0,0 +1,4 @@
'use strict';
const ansiRegex = require('ansi-regex');
module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,19 +1,16 @@
{
"name": "strip-ansi",
"version": "7.1.0",
"version": "6.0.1",
"description": "Strip ANSI escape codes from a string",
"license": "MIT",
"repository": "chalk/strip-ansi",
"funding": "https://github.com/chalk/strip-ansi?sponsor=1",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
"url": "sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
@@ -47,11 +44,11 @@
"text"
],
"dependencies": {
"ansi-regex": "^6.0.1"
"ansi-regex": "^5.0.1"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.17.0",
"xo": "^0.44.0"
"ava": "^2.4.0",
"tsd": "^0.10.0",
"xo": "^0.25.3"
}
}

View File

@@ -3,43 +3,75 @@
/* eslint no-invalid-this: 1 */
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
var slice = Array.prototype.slice;
var toStr = Object.prototype.toString;
var max = Math.max;
var funcType = '[object Function]';
var concatty = function concatty(a, b) {
var arr = [];
for (var i = 0; i < a.length; i += 1) {
arr[i] = a[i];
}
for (var j = 0; j < b.length; j += 1) {
arr[j + a.length] = b[j];
}
return arr;
};
var slicy = function slicy(arrLike, offset) {
var arr = [];
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
arr[j] = arrLike[i];
}
return arr;
};
var joiny = function (arr, joiner) {
var str = '';
for (var i = 0; i < arr.length; i += 1) {
str += arr[i];
if (i + 1 < arr.length) {
str += joiner;
}
}
return str;
};
module.exports = function bind(that) {
var target = this;
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
}
var args = slice.call(arguments, 1);
var args = slicy(arguments, 1);
var bound;
var binder = function () {
if (this instanceof bound) {
var result = target.apply(
this,
args.concat(slice.call(arguments))
concatty(args, arguments)
);
if (Object(result) === result) {
return result;
}
return this;
} else {
return target.apply(
that,
args.concat(slice.call(arguments))
);
}
return target.apply(
that,
concatty(args, arguments)
);
};
var boundLength = Math.max(0, target.length - args.length);
var boundLength = max(0, target.length - args.length);
var boundArgs = [];
for (var i = 0; i < boundLength; i++) {
boundArgs.push('$' + i);
boundArgs[i] = '$' + i;
}
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
if (target.prototype) {
var Empty = function Empty() {};

View File

@@ -1,6 +1,6 @@
{
"name": "function-bind",
"version": "1.1.1",
"version": "1.1.2",
"description": "Implementation of Function.prototype.bind",
"keywords": [
"function",
@@ -9,7 +9,13 @@
"es5"
],
"author": "Raynos <raynos2@gmail.com>",
"repository": "git://github.com/Raynos/function-bind.git",
"repository": {
"type": "git",
"url": "https://github.com/Raynos/function-bind.git"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"main": "index",
"homepage": "https://github.com/Raynos/function-bind",
"contributors": [
@@ -25,24 +31,29 @@
"url": "https://github.com/Raynos/function-bind/issues",
"email": "raynos2@gmail.com"
},
"dependencies": {},
"devDependencies": {
"@ljharb/eslint-config": "^12.2.1",
"covert": "^1.1.0",
"eslint": "^4.5.0",
"jscs": "^3.0.7",
"tape": "^4.8.0"
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.3",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.1"
},
"license": "MIT",
"scripts": {
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepack": "npmignore --auto --commentLines=autogenerated",
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npm run coverage -- --quiet",
"tests-only": "node test",
"coverage": "covert test/*.js",
"lint": "npm run jscs && npm run eslint",
"jscs": "jscs *.js */*.js",
"eslint": "eslint *.js */*.js"
"posttest": "aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"lint": "eslint --ext=js,mjs .",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"testling": {
"files": "test/index.js",
@@ -59,5 +70,18 @@
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = ({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 ? undefined : 'g');
};

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,55 @@
{
"name": "ansi-regex",
"version": "5.0.1",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "chalk/ansi-regex",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd",
"view-supported": "node fixtures/view-codes.js"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.9.0",
"xo": "^0.25.3"
}
}

View File

@@ -0,0 +1,4 @@
'use strict';
const ansiRegex = require('ansi-regex');
module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,54 @@
{
"name": "strip-ansi",
"version": "6.0.1",
"description": "Strip ANSI escape codes from a string",
"license": "MIT",
"repository": "chalk/strip-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"strip",
"trim",
"remove",
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"ansi-regex": "^5.0.1"
},
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.10.0",
"xo": "^0.25.3"
}
}

View File

@@ -1,22 +0,0 @@
Copyright (c) 2013 Thiago de Arruda
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,48 +0,0 @@
{
"name": "has",
"description": "Object.prototype.hasOwnProperty.call shortcut",
"version": "1.0.3",
"homepage": "https://github.com/tarruda/has",
"author": {
"name": "Thiago de Arruda",
"email": "tpadilha84@gmail.com"
},
"contributors": [
{
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
}
],
"repository": {
"type": "git",
"url": "git://github.com/tarruda/has.git"
},
"bugs": {
"url": "https://github.com/tarruda/has/issues"
},
"license": "MIT",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT"
}
],
"main": "./src",
"dependencies": {
"function-bind": "^1.1.1"
},
"devDependencies": {
"@ljharb/eslint-config": "^12.2.1",
"eslint": "^4.19.1",
"tape": "^4.9.0"
},
"engines": {
"node": ">= 0.4.0"
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "tape test"
}
}

View File

@@ -1,5 +0,0 @@
'use strict';
var bind = require('function-bind');
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);

View File

@@ -1,10 +0,0 @@
'use strict';
var test = require('tape');
var has = require('../');
test('has', function (t) {
t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"');
t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"');
t.end();
});

21
deps/npm/node_modules/hasown/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Jordan Harband and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

8
deps/npm/node_modules/hasown/index.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict';
var call = Function.prototype.call;
var $hasOwn = Object.prototype.hasOwnProperty;
var bind = require('function-bind');
/** @type {(o: {}, p: PropertyKey) => p is keyof o} */
module.exports = bind.call(call, $hasOwn);

91
deps/npm/node_modules/hasown/package.json generated vendored Normal file
View File

@@ -0,0 +1,91 @@
{
"name": "hasown",
"version": "2.0.0",
"description": "A robust, ES3 compatible, \"has own property\" predicate.",
"main": "index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated && npm run emit-types",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "npm run tsc",
"preemit-types": "rm -f *.ts *.ts.map test/*.ts test/*.ts.map",
"emit-types": "npm run tsc -- --noEmit false --emitDeclarationOnly",
"pretest": "npm run lint",
"tsc": "tsc -p .",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/inspect-js/hasOwn.git"
},
"keywords": [
"has",
"hasOwnProperty",
"hasOwn",
"has-own",
"own",
"has",
"property",
"in",
"javascript",
"ecmascript"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/inspect-js/hasOwn/issues"
},
"homepage": "https://github.com/inspect-js/hasOwn#readme",
"dependencies": {
"function-bind": "^1.1.2"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
"@types/function-bind": "^1.1.9",
"@types/mock-property": "^1.0.1",
"@types/tape": "^5.6.3",
"aud": "^2.0.3",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"mock-property": "^1.0.2",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.1",
"typescript": "^5.3.0-dev.20231019"
},
"engines": {
"node": ">= 0.4"
},
"testling": {
"files": "test/index.js"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows",
"test",
"!*.d.ts",
"!*.d.ts.map"
]
}
}

49
deps/npm/node_modules/hasown/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
"useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
"typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */
"resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
/* JavaScript Support */
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
"maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declarationMap": true, /* Create sourcemaps for d.ts files. */
"noEmit": true, /* Disable emitting files from a compilation. */
/* Interop Constraints */
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
/* Completeness */
//"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": [
"coverage"
]
}

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

View File

@@ -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"
}
}

View File

@@ -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;

View File

@@ -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 <me@silverwind.io>",
"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"
}
}

View File

@@ -1,6 +1,6 @@
'use strict';
var has = require('has');
var hasOwn = require('hasown');
function specifierIncluded(current, specifier) {
var nodeParts = current.split('.');
@@ -65,5 +65,5 @@ function versionIncluded(nodeVersion, specifierValue) {
var data = require('./core.json');
module.exports = function isCore(x, nodeVersion) {
return has(data, x) && versionIncluded(nodeVersion, data[x]);
return hasOwn(data, x) && versionIncluded(nodeVersion, data[x]);
};

View File

@@ -1,6 +1,6 @@
{
"name": "is-core-module",
"version": "2.13.0",
"version": "2.13.1",
"description": "Is this specifier a node.js core module?",
"main": "index.js",
"sideEffects": false,
@@ -42,7 +42,7 @@
},
"homepage": "https://github.com/inspect-js/is-core-module",
"dependencies": {
"has": "^1.0.3"
"hasown": "^2.0.0"
},
"devDependencies": {
"@ljharb/eslint-config": "^21.1.0",
@@ -50,12 +50,12 @@
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"in-publish": "^2.0.1",
"mock-property": "^1.0.0",
"mock-property": "^1.0.2",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"semver": "^6.3.1",
"tape": "^5.6.6"
"tape": "^5.7.1"
},
"auto-changelog": {
"output": "CHANGELOG.md",

View File

@@ -1,6 +1,6 @@
{
"name": "libnpmexec",
"version": "7.0.3",
"version": "7.0.4",
"files": [
"bin/",
"lib/"
@@ -61,7 +61,7 @@
"dependencies": {
"@npmcli/arborist": "^7.2.1",
"@npmcli/run-script": "^7.0.2",
"ci-info": "^3.7.1",
"ci-info": "^4.0.0",
"npm-package-arg": "^11.0.1",
"npmlog": "^7.0.1",
"pacote": "^17.0.4",

View File

@@ -19,9 +19,11 @@ const generateProvenance = async (subject, opts) => {
let payload
if (ci.GITHUB_ACTIONS) {
/* istanbul ignore next - not covering missing env var case */
const [workflowPath, workflowRef] = (env.GITHUB_WORKFLOW_REF || '')
.replace(env.GITHUB_REPOSITORY + '/', '')
.split('@')
const relativeRef = (env.GITHUB_WORKFLOW_REF || '').replace(env.GITHUB_REPOSITORY + '/', '')
const delimiterIndex = relativeRef.indexOf('@')
const workflowPath = relativeRef.slice(0, delimiterIndex)
const workflowRef = relativeRef.slice(delimiterIndex + 1)
payload = {
_type: INTOTO_STATEMENT_V1_TYPE,
subject,

View File

@@ -1,6 +1,6 @@
{
"name": "libnpmpublish",
"version": "9.0.1",
"version": "9.0.2",
"description": "Programmatic API for the bits behind npm publish and unpublish",
"author": "GitHub Inc.",
"main": "lib/index.js",
@@ -38,7 +38,7 @@
"bugs": "https://github.com/npm/cli/issues",
"homepage": "https://npmjs.com/package/libnpmpublish",
"dependencies": {
"ci-info": "^3.6.1",
"ci-info": "^4.0.0",
"normalize-package-data": "^6.0.0",
"npm-package-arg": "^11.0.1",
"npm-registry-fetch": "^16.0.0",

File diff suppressed because one or more lines are too long

View File

@@ -435,6 +435,9 @@ class LRUCache {
if (ttls[index]) {
const ttl = ttls[index];
const start = starts[index];
/* c8 ignore next */
if (!ttl || !start)
return;
status.ttl = ttl;
status.start = start;
status.now = cachedNow || getNow();
@@ -466,16 +469,16 @@ class LRUCache {
}
const ttl = ttls[index];
const start = starts[index];
if (ttl === 0 || start === 0) {
if (!ttl || !start) {
return Infinity;
}
const age = (cachedNow || getNow()) - start;
return ttl - age;
};
this.#isStale = index => {
return (ttls[index] !== 0 &&
starts[index] !== 0 &&
(cachedNow || getNow()) - starts[index] > ttls[index]);
const s = starts[index];
const t = ttls[index];
return !!t && !!s && (cachedNow || getNow()) - s > t;
};
}
// conditionally set private methods related to TTL
@@ -999,12 +1002,13 @@ class LRUCache {
peek(k, peekOptions = {}) {
const { allowStale = this.allowStale } = peekOptions;
const index = this.#keyMap.get(k);
if (index !== undefined &&
(allowStale || !this.#isStale(index))) {
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
if (index === undefined ||
(!allowStale && this.#isStale(index))) {
return;
}
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
}
#backgroundFetch(k, index, options, context) {
const v = index === undefined ? undefined : this.#valList[index];
@@ -1340,8 +1344,10 @@ class LRUCache {
this.#head = this.#next[index];
}
else {
this.#next[this.#prev[index]] = this.#next[index];
this.#prev[this.#next[index]] = this.#prev[index];
const pi = this.#prev[index];
this.#next[pi] = this.#next[index];
const ni = this.#next[index];
this.#prev[ni] = this.#prev[index];
}
this.#size--;
this.#free.push(index);

View File

@@ -432,6 +432,9 @@ export class LRUCache {
if (ttls[index]) {
const ttl = ttls[index];
const start = starts[index];
/* c8 ignore next */
if (!ttl || !start)
return;
status.ttl = ttl;
status.start = start;
status.now = cachedNow || getNow();
@@ -463,16 +466,16 @@ export class LRUCache {
}
const ttl = ttls[index];
const start = starts[index];
if (ttl === 0 || start === 0) {
if (!ttl || !start) {
return Infinity;
}
const age = (cachedNow || getNow()) - start;
return ttl - age;
};
this.#isStale = index => {
return (ttls[index] !== 0 &&
starts[index] !== 0 &&
(cachedNow || getNow()) - starts[index] > ttls[index]);
const s = starts[index];
const t = ttls[index];
return !!t && !!s && (cachedNow || getNow()) - s > t;
};
}
// conditionally set private methods related to TTL
@@ -996,12 +999,13 @@ export class LRUCache {
peek(k, peekOptions = {}) {
const { allowStale = this.allowStale } = peekOptions;
const index = this.#keyMap.get(k);
if (index !== undefined &&
(allowStale || !this.#isStale(index))) {
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
if (index === undefined ||
(!allowStale && this.#isStale(index))) {
return;
}
const v = this.#valList[index];
// either stale and allowed, or forcing a refresh of non-stale value
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
}
#backgroundFetch(k, index, options, context) {
const v = index === undefined ? undefined : this.#valList[index];
@@ -1337,8 +1341,10 @@ export class LRUCache {
this.#head = this.#next[index];
}
else {
this.#next[this.#prev[index]] = this.#next[index];
this.#prev[this.#next[index]] = this.#prev[index];
const pi = this.#prev[index];
this.#next[pi] = this.#next[index];
const ni = this.#next[index];
this.#prev[ni] = this.#prev[index];
}
this.#size--;
this.#free.push(index);

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "10.0.1",
"version": "10.0.2",
"author": "Isaac Z. Schlueter <i@izs.me>",
"keywords": [
"mru",
@@ -11,67 +11,57 @@
"sideEffects": false,
"scripts": {
"build": "npm run prepare",
"preprepare": "rm -rf dist",
"prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json",
"prepare": "tshy",
"postprepare": "bash fixup.sh",
"pretest": "npm run prepare",
"presnap": "npm run prepare",
"test": "c8 tap",
"snap": "c8 tap",
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags",
"format": "prettier --write .",
"typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts",
"typedoc": "typedoc --tsconfig ./.tshy/esm.json ./src/*.ts",
"benchmark-results-typedoc": "bash scripts/benchmark-results-typedoc.sh",
"prebenchmark": "npm run prepare",
"benchmark": "make -C benchmark",
"preprofile": "npm run prepare",
"profile": "make -C benchmark profile"
},
"main": "./dist/cjs/index.js",
"module": "./dist/mjs/index.js",
"exports": {
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.min.js"
}
},
".": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
"main": "./dist/commonjs/index.js",
"types": "./dist/commonjs/index.d.ts",
"tshy": {
"exports": {
".": "./src/index.ts",
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.min.js"
}
}
}
},
"repository": "git://github.com/isaacs/node-lru-cache.git",
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.8",
"@tapjs/clock": "^1.1.16",
"@types/node": "^20.2.5",
"@types/tap": "^15.0.6",
"benchmark": "^2.1.4",
"c8": "^7.11.2",
"clock-mock": "^1.0.6",
"clock-mock": "^2.0.2",
"esbuild": "^0.17.11",
"eslint-config-prettier": "^8.5.0",
"marked": "^4.2.12",
"mkdirp": "^2.1.5",
"prettier": "^2.6.2",
"size-limit": "^7.0.8",
"tap": "^16.3.4",
"ts-node": "^10.9.1",
"tap": "^18.5.7",
"tshy": "^1.8.0",
"tslib": "^2.4.0",
"typedoc": "^0.24.6",
"typescript": "^5.0.4"
"typedoc": "^0.25.3",
"typescript": "^5.2.2"
},
"license": "ISC",
"files": [
@@ -92,17 +82,37 @@
"endOfLine": "lf"
},
"tap": {
"coverage": false,
"node-arg": [
"--expose-gc",
"-r",
"ts-node/register"
"--expose-gc"
],
"ts": false
"plugin": [
"@tapjs/clock"
]
},
"size-limit": [
{
"path": "./dist/mjs/index.js"
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
},
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.min.js"
}
}
]
},
"type": "module",
"dependencies": {
"semver": "^7.3.5"
}
}

View File

@@ -20,7 +20,7 @@ const processOk = (process) => !!process &&
const kExitEmitter = Symbol.for('signal-exit emitter');
const global = globalThis;
const ObjectDefineProperty = Object.defineProperty.bind(Object);
// teeny tiny ee
// teeny special purpose ee
class Emitter {
emitted = {
afterExit: false,
@@ -63,12 +63,17 @@ class Emitter {
}
emit(ev, code, signal) {
if (this.emitted[ev]) {
return;
return false;
}
this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) {
fn(code, signal);
ret = fn(code, signal) === true || ret;
}
if (ev === 'exit') {
ret = this.emit('afterExit', code, signal) || ret;
}
return ret;
}
}
class SignalExitBase {
@@ -122,18 +127,22 @@ class SignalExit extends SignalExitBase {
// exit v4 are not aware of each other, and each will attempt to let
// the other handle it, so neither of them do. To correct this, we
// detect if we're the only handler *except* for previous versions
// of signal-exit.
// of signal-exit, and increment by the count of listeners it has
// created.
/* c8 ignore start */
//@ts-ignore
if (typeof process.__signal_exit_emitter__ === 'object')
count++;
const p = process;
if (typeof p.__signal_exit_emitter__ === 'object' &&
typeof p.__signal_exit_emitter__.count === 'number') {
count += p.__signal_exit_emitter__.count;
}
/* c8 ignore stop */
if (listeners.length === count) {
this.unload();
this.#emitter.emit('exit', null, sig);
this.#emitter.emit('afterExit', null, sig);
const ret = this.#emitter.emit('exit', null, sig);
/* c8 ignore start */
process.kill(process.pid, sig === 'SIGHUP' ? this.#hupSig : sig);
const s = sig === 'SIGHUP' ? this.#hupSig : sig;
if (!ret)
process.kill(process.pid, s);
/* c8 ignore stop */
}
};
@@ -216,7 +225,6 @@ class SignalExit extends SignalExitBase {
this.#process.exitCode = code || 0;
/* c8 ignore stop */
this.#emitter.emit('exit', this.#process.exitCode, null);
this.#emitter.emit('afterExit', this.#process.exitCode, null);
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
}
#processEmit(ev, ...args) {
@@ -230,7 +238,6 @@ class SignalExit extends SignalExitBase {
const ret = og.call(this.#process, ev, ...args);
/* c8 ignore start */
this.#emitter.emit('exit', this.#process.exitCode, null);
this.#emitter.emit('afterExit', this.#process.exitCode, null);
/* c8 ignore stop */
return ret;
}

View File

@@ -16,7 +16,7 @@ const processOk = (process) => !!process &&
const kExitEmitter = Symbol.for('signal-exit emitter');
const global = globalThis;
const ObjectDefineProperty = Object.defineProperty.bind(Object);
// teeny tiny ee
// teeny special purpose ee
class Emitter {
emitted = {
afterExit: false,
@@ -59,12 +59,17 @@ class Emitter {
}
emit(ev, code, signal) {
if (this.emitted[ev]) {
return;
return false;
}
this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) {
fn(code, signal);
ret = fn(code, signal) === true || ret;
}
if (ev === 'exit') {
ret = this.emit('afterExit', code, signal) || ret;
}
return ret;
}
}
class SignalExitBase {
@@ -118,18 +123,22 @@ class SignalExit extends SignalExitBase {
// exit v4 are not aware of each other, and each will attempt to let
// the other handle it, so neither of them do. To correct this, we
// detect if we're the only handler *except* for previous versions
// of signal-exit.
// of signal-exit, and increment by the count of listeners it has
// created.
/* c8 ignore start */
//@ts-ignore
if (typeof process.__signal_exit_emitter__ === 'object')
count++;
const p = process;
if (typeof p.__signal_exit_emitter__ === 'object' &&
typeof p.__signal_exit_emitter__.count === 'number') {
count += p.__signal_exit_emitter__.count;
}
/* c8 ignore stop */
if (listeners.length === count) {
this.unload();
this.#emitter.emit('exit', null, sig);
this.#emitter.emit('afterExit', null, sig);
const ret = this.#emitter.emit('exit', null, sig);
/* c8 ignore start */
process.kill(process.pid, sig === 'SIGHUP' ? this.#hupSig : sig);
const s = sig === 'SIGHUP' ? this.#hupSig : sig;
if (!ret)
process.kill(process.pid, s);
/* c8 ignore stop */
}
};
@@ -212,7 +221,6 @@ class SignalExit extends SignalExitBase {
this.#process.exitCode = code || 0;
/* c8 ignore stop */
this.#emitter.emit('exit', this.#process.exitCode, null);
this.#emitter.emit('afterExit', this.#process.exitCode, null);
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
}
#processEmit(ev, ...args) {
@@ -226,7 +234,6 @@ class SignalExit extends SignalExitBase {
const ret = og.call(this.#process, ev, ...args);
/* c8 ignore start */
this.#emitter.emit('exit', this.#process.exitCode, null);
this.#emitter.emit('afterExit', this.#process.exitCode, null);
/* c8 ignore stop */
return ret;
}

View File

@@ -1,6 +1,6 @@
{
"name": "signal-exit",
"version": "4.0.2",
"version": "4.1.0",
"description": "when you want to fire an event no matter how a process exits.",
"main": "./dist/cjs/index.js",
"module": "./dist/mjs/index.js",

Some files were not shown because too many files have changed in this diff Show More