diff --git a/deps/npm/docs/content/commands/npm-audit.md b/deps/npm/docs/content/commands/npm-audit.md
index 7ab0c182d2db96..a7e0db7474315a 100644
--- a/deps/npm/docs/content/commands/npm-audit.md
+++ b/deps/npm/docs/content/commands/npm-audit.md
@@ -90,7 +90,7 @@ The `sig` is generated using the following template: `${package.name}@${package.
Keys response:
-- `expires`: null or a simplified extended [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601"): `YYYY-MM-DDTHH:mm:ss.sssZ`
+- `expires`: null or a simplified extended [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDTHH:mm:ss.sssZ`
- `keydid`: sha256 fingerprint of the public key
- `keytype`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI
- `scheme`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI
diff --git a/deps/npm/docs/content/commands/npm-ls.md b/deps/npm/docs/content/commands/npm-ls.md
index 0c6bfe1bf8ac26..9c761e13fa34f0 100644
--- a/deps/npm/docs/content/commands/npm-ls.md
+++ b/deps/npm/docs/content/commands/npm-ls.md
@@ -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.5.1 /path/to/npm
+npm@10.5.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```
diff --git a/deps/npm/docs/content/commands/npm.md b/deps/npm/docs/content/commands/npm.md
index d69d753e245b27..0e44e3e35e73f6 100644
--- a/deps/npm/docs/content/commands/npm.md
+++ b/deps/npm/docs/content/commands/npm.md
@@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.
### Version
-10.5.1
+10.5.2
### Description
diff --git a/deps/npm/docs/output/commands/npm-audit.html b/deps/npm/docs/output/commands/npm-audit.html
index ab20ea72c65208..5e8e9d66bb2e59 100644
--- a/deps/npm/docs/output/commands/npm-audit.html
+++ b/deps/npm/docs/output/commands/npm-audit.html
@@ -209,7 +209,7 @@
Audit Signatures
Keys response:
-expires
: null or a simplified extended ISO 8601 format: YYYY-MM-DDTHH:mm:ss.sssZ
+expires
: null or a simplified extended ISO 8601 format: YYYY-MM-DDTHH:mm:ss.sssZ
keydid
: sha256 fingerprint of the public key
keytype
: only ecdsa-sha2-nistp256
is currently supported by the npm CLI
scheme
: only ecdsa-sha2-nistp256
is currently supported by the npm CLI
diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html
index 0f4beb45d09397..7449728edf37fe 100644
--- a/deps/npm/docs/output/commands/npm-ls.html
+++ b/deps/npm/docs/output/commands/npm-ls.html
@@ -160,7 +160,7 @@ Description
the results to only the paths to the packages named. Note that nested
packages will also show the paths to the specified packages. For
example, running npm ls promzard
in npm's source tree will show:
-
npm@10.5.1 /path/to/npm
+npm@10.5.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html
index 4be373a7159e9f..d79ded11c70ba2 100644
--- a/deps/npm/docs/output/commands/npm.html
+++ b/deps/npm/docs/output/commands/npm.html
@@ -150,7 +150,7 @@ Table of contents
Note: This command is unaware of workspaces.
Version
-10.5.1
+10.5.2
Description
npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
diff --git a/deps/npm/lib/base-command.js b/deps/npm/lib/base-command.js
index e4a7bbbec724a6..cdf7971b5aaf92 100644
--- a/deps/npm/lib/base-command.js
+++ b/deps/npm/lib/base-command.js
@@ -3,7 +3,6 @@
const { relative } = require('path')
const { definitions } = require('@npmcli/config/lib/definitions')
-const getWorkspaces = require('./workspaces/get-workspaces.js')
const { aliases: cmdAliases } = require('./utils/cmd-list')
const log = require('./utils/log-shim.js')
@@ -170,6 +169,7 @@ class BaseCommand {
const relativeFrom = prefixInsideCwd ? this.npm.localPrefix : process.cwd()
const filters = this.npm.config.get('workspace')
+ const getWorkspaces = require('./workspaces/get-workspaces.js')
const ws = await getWorkspaces(filters, {
path: this.npm.localPrefix,
includeWorkspaceRoot,
diff --git a/deps/npm/lib/commands/owner.js b/deps/npm/lib/commands/owner.js
index 5b54dd41f3d607..e530e1c51c8e1f 100644
--- a/deps/npm/lib/commands/owner.js
+++ b/deps/npm/lib/commands/owner.js
@@ -5,6 +5,7 @@ const log = require('../utils/log-shim')
const otplease = require('../utils/otplease.js')
const pkgJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
+const { redact } = require('@npmcli/redact')
const readJson = async (path) => {
try {
@@ -119,7 +120,7 @@ class Owner extends BaseCommand {
this.npm.output(maintainers.map(m => `${m.name} <${m.email}>`).join('\n'))
}
} catch (err) {
- log.error('owner ls', "Couldn't get owner data", npmFetch.cleanUrl(pkg))
+ log.error('owner ls', "Couldn't get owner data", redact(pkg))
throw err
}
}
diff --git a/deps/npm/lib/commands/ping.js b/deps/npm/lib/commands/ping.js
index c79e6a96cee405..2d60f5d69a8da6 100644
--- a/deps/npm/lib/commands/ping.js
+++ b/deps/npm/lib/commands/ping.js
@@ -1,4 +1,4 @@
-const { cleanUrl } = require('npm-registry-fetch')
+const { redact } = require('@npmcli/redact')
const log = require('../utils/log-shim')
const pingUtil = require('../utils/ping.js')
const BaseCommand = require('../base-command.js')
@@ -9,7 +9,7 @@ class Ping extends BaseCommand {
static name = 'ping'
async exec (args) {
- const cleanRegistry = cleanUrl(this.npm.config.get('registry'))
+ const cleanRegistry = redact(this.npm.config.get('registry'))
log.notice('PING', cleanRegistry)
const start = Date.now()
const details = await pingUtil({ ...this.npm.flatOptions })
diff --git a/deps/npm/lib/commands/publish.js b/deps/npm/lib/commands/publish.js
index 0456fd7e8320e6..cf6b50cce3c21c 100644
--- a/deps/npm/lib/commands/publish.js
+++ b/deps/npm/lib/commands/publish.js
@@ -220,7 +220,12 @@ class Publish extends BaseCommand {
})
}
if (manifest.publishConfig) {
- flatten(manifest.publishConfig, opts)
+ const cliFlags = this.npm.config.data.get('cli').raw
+ // Filter out properties set in CLI flags to prioritize them over
+ // corresponding `publishConfig` settings
+ const filteredPublishConfig = Object.fromEntries(
+ Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags)))
+ flatten(filteredPublishConfig, opts)
}
return manifest
}
diff --git a/deps/npm/lib/commands/unpublish.js b/deps/npm/lib/commands/unpublish.js
index a9c20900534c3a..a4d445a035b622 100644
--- a/deps/npm/lib/commands/unpublish.js
+++ b/deps/npm/lib/commands/unpublish.js
@@ -141,7 +141,12 @@ class Unpublish extends BaseCommand {
// If localPrefix has a package.json with a name that matches the package
// being unpublished, load up the publishConfig
if (manifest?.name === spec.name && manifest.publishConfig) {
- flatten(manifest.publishConfig, opts)
+ const cliFlags = this.npm.config.data.get('cli').raw
+ // Filter out properties set in CLI flags to prioritize them over
+ // corresponding `publishConfig` settings
+ const filteredPublishConfig = Object.fromEntries(
+ Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags)))
+ flatten(filteredPublishConfig, opts)
}
const versions = await Unpublish.getKeysOfVersions(spec.name, opts)
diff --git a/deps/npm/lib/utils/error-message.js b/deps/npm/lib/utils/error-message.js
index fc7be8301662e1..348bb63e2d5abd 100644
--- a/deps/npm/lib/utils/error-message.js
+++ b/deps/npm/lib/utils/error-message.js
@@ -1,6 +1,5 @@
const { format } = require('util')
const { resolve } = require('path')
-const nameValidator = require('validate-npm-package-name')
const { redactLog: replaceInfo } = require('@npmcli/redact')
const { report } = require('./explain-eresolve.js')
const log = require('./log-shim')
@@ -215,6 +214,7 @@ const errorMessage = (er, npm) => {
detail.push(['404', ''])
detail.push(['404', '', `'${replaceInfo(er.pkgid)}' is not in this registry.`])
+ const nameValidator = require('validate-npm-package-name')
const valResult = nameValidator(pkg)
if (!valResult.validForNewPackages) {
diff --git a/deps/npm/lib/utils/log-file.js b/deps/npm/lib/utils/log-file.js
index 8c06f5647e761e..1a46b7da0d6604 100644
--- a/deps/npm/lib/utils/log-file.js
+++ b/deps/npm/lib/utils/log-file.js
@@ -1,7 +1,6 @@
const os = require('os')
const { join, dirname, basename } = require('path')
const { format } = require('util')
-const { glob } = require('glob')
const { Minipass } = require('minipass')
const fsMiniPass = require('fs-minipass')
const fs = require('fs/promises')
@@ -9,7 +8,6 @@ const log = require('./log-shim')
const Display = require('./display')
const padZero = (n, length) => n.toString().padStart(length.toString().length, '0')
-const globify = pattern => pattern.split('\\').join('/')
class LogFiles {
// Default to a plain minipass stream so we can buffer
@@ -199,17 +197,41 @@ class LogFiles {
try {
const logPath = this.#getLogFilePath()
- const logGlob = join(dirname(logPath), basename(logPath)
+ const patternFileName = basename(logPath)
// tell glob to only match digits
- .replace(/\d/g, '[0123456789]')
+ .replace(/\d/g, 'd')
// Handle the old (prior to 8.2.0) log file names which did not have a
// counter suffix
- .replace(/-\.log$/, '*.log')
- )
+ .replace('-.log', '')
+
+ let files = await fs.readdir(
+ dirname(logPath), {
+ withFileTypes: true,
+ encoding: 'utf-8',
+ })
+ files = files.sort((a, b) => basename(a.name).localeCompare(basename(b.name), 'en'))
+
+ const logFiles = []
+
+ for (const file of files) {
+ if (!file.isFile()) {
+ continue
+ }
+
+ const genericFileName = file.name.replace(/\d/g, 'd')
+ const filePath = join(dirname(logPath), basename(file.name))
+
+ // Always ignore the currently written files
+ if (
+ genericFileName.includes(patternFileName)
+ && genericFileName.endsWith('.log')
+ && !this.#files.includes(filePath)
+ ) {
+ logFiles.push(filePath)
+ }
+ }
- // Always ignore the currently written files
- const files = await glob(globify(logGlob), { ignore: this.#files.map(globify), silent: true })
- const toDelete = files.length - this.#logsMax
+ const toDelete = logFiles.length - this.#logsMax
if (toDelete <= 0) {
return
@@ -217,7 +239,7 @@ class LogFiles {
log.silly('logfile', `start cleaning logs, removing ${toDelete} files`)
- for (const file of files.slice(0, toDelete)) {
+ for (const file of logFiles.slice(0, toDelete)) {
try {
await fs.rm(file, { force: true })
} catch (e) {
diff --git a/deps/npm/lib/utils/update-notifier.js b/deps/npm/lib/utils/update-notifier.js
index 7c9611e4773f97..7481b65d562217 100644
--- a/deps/npm/lib/utils/update-notifier.js
+++ b/deps/npm/lib/utils/update-notifier.js
@@ -3,7 +3,9 @@
// Check daily for betas, and weekly otherwise.
const ciInfo = require('ci-info')
-const semver = require('semver')
+const gt = require('semver/functions/gt')
+const gte = require('semver/functions/gte')
+const parse = require('semver/functions/parse')
const { stat, writeFile } = require('fs/promises')
const { resolve } = require('path')
@@ -38,12 +40,12 @@ const updateCheck = async (npm, spec, version, current) => {
// and should get the updates from that release train.
// Note that this isn't another http request over the network, because
// the packument will be cached by pacote from previous request.
- if (semver.gt(version, latest) && spec === 'latest') {
+ if (gt(version, latest) && spec === 'latest') {
return updateNotifier(npm, `^${version}`)
}
// if we already have something >= the desired spec, then we're done
- if (semver.gte(version, latest)) {
+ if (gte(version, latest)) {
return null
}
@@ -53,7 +55,7 @@ const updateCheck = async (npm, spec, version, current) => {
// ok! notify the user about this update they should get.
// The message is saved for printing at process exit so it will not get
// lost in any other messages being printed as part of the command.
- const update = semver.parse(mani.version)
+ const update = parse(mani.version)
const type = update.major !== current.major ? 'major'
: update.minor !== current.minor ? 'minor'
: update.patch !== current.patch ? 'patch'
@@ -79,7 +81,7 @@ const updateNotifier = async (npm, spec = 'latest') => {
// if we're on a prerelease train, then updates are coming fast
// check for a new one daily. otherwise, weekly.
const { version } = npm
- const current = semver.parse(version)
+ const current = parse(version)
// if we're on a beta train, always get the next beta
if (current.prerelease.length) {
diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1
index e8d71147400c45..5832cb09ff9980 100644
--- a/deps/npm/man/man1/npm-audit.1
+++ b/deps/npm/man/man1/npm-audit.1
@@ -80,7 +80,7 @@ Public signing keys are provided at \fBregistry-host.tld/-/npm/v1/keys\fR in the
Keys response:
.RS 0
.IP \(bu 4
-\fBexpires\fR: null or a simplified extended \fBISO 8601 format\fR \fI\(lahttps://en.wikipedia.org/wiki/ISO_8601"\(ra\fR: \fBYYYY-MM-DDTHH:mm:ss.sssZ\fR
+\fBexpires\fR: null or a simplified extended \fBISO 8601 format\fR \fI\(lahttps://en.wikipedia.org/wiki/ISO_8601\(ra\fR: \fBYYYY-MM-DDTHH:mm:ss.sssZ\fR
.IP \(bu 4
\fBkeydid\fR: sha256 fingerprint of the public key
.IP \(bu 4
diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
index a9f7e4af68b87b..9c8a25d0c9237a 100644
--- a/deps/npm/man/man1/npm-ls.1
+++ b/deps/npm/man/man1/npm-ls.1
@@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit
.P
.RS 2
.nf
-npm@10.5.1 /path/to/npm
+npm@10.5.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
.fi
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index 6ac1a88baf121d..0df8bb7e2a1962 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -12,7 +12,7 @@ npm
Note: This command is unaware of workspaces.
.SS "Version"
.P
-10.5.1
+10.5.2
.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.
diff --git a/deps/npm/node_modules/@npmcli/agent/lib/agents.js b/deps/npm/node_modules/@npmcli/agent/lib/agents.js
index ffd299f3d2ba69..c541b93001517e 100644
--- a/deps/npm/node_modules/@npmcli/agent/lib/agents.js
+++ b/deps/npm/node_modules/@npmcli/agent/lib/agents.js
@@ -65,7 +65,10 @@ module.exports = class Agent extends AgentBase {
ProxyAgent = this.isSecureEndpoint(options) ? ProxyAgent[1] : ProxyAgent[0]
}
- const proxyAgent = new ProxyAgent(proxy, this.#options)
+ const proxyAgent = new ProxyAgent(proxy, {
+ ...this.#options,
+ socketOptions: { family: this.#options.family },
+ })
proxyCache.set(cacheKey, proxyAgent)
return proxyAgent
diff --git a/deps/npm/node_modules/@npmcli/agent/package.json b/deps/npm/node_modules/@npmcli/agent/package.json
index ce240b283a42c9..ef5b4e3228cc46 100644
--- a/deps/npm/node_modules/@npmcli/agent/package.json
+++ b/deps/npm/node_modules/@npmcli/agent/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/agent",
- "version": "2.2.1",
+ "version": "2.2.2",
"description": "the http/https agent used by the npm cli",
"main": "lib/index.js",
"scripts": {
@@ -36,7 +36,7 @@
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.1",
"lru-cache": "^10.0.1",
- "socks-proxy-agent": "^8.0.1"
+ "socks-proxy-agent": "^8.0.3"
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
index 8ceb6b72123f68..75e4d373259a09 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
@@ -12,7 +12,7 @@ const { readdirScoped } = require('@npmcli/fs')
const { lstat, readlink } = require('fs/promises')
const { depth } = require('treeverse')
const log = require('proc-log')
-const { cleanUrl } = require('npm-registry-fetch')
+const { redact } = require('@npmcli/redact')
const {
OK,
@@ -1213,7 +1213,7 @@ This is a one-time fix-up, please be patient...
if (this.#manifests.has(spec.raw)) {
return this.#manifests.get(spec.raw)
} else {
- const cleanRawSpec = cleanUrl(spec.rawSpec)
+ const cleanRawSpec = redact(spec.rawSpec)
log.silly('fetch manifest', spec.raw.replace(spec.rawSpec, cleanRawSpec))
const o = {
...options,
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/place-dep.js b/deps/npm/node_modules/@npmcli/arborist/lib/place-dep.js
index e757d0c38a6d70..bf0fef6525343a 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/place-dep.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/place-dep.js
@@ -9,7 +9,7 @@
const localeCompare = require('@isaacs/string-locale-compare')('en')
const log = require('proc-log')
-const { cleanUrl } = require('npm-registry-fetch')
+const { redact } = require('@npmcli/redact')
const deepestNestingTarget = require('./deepest-nesting-target.js')
const CanPlaceDep = require('./can-place-dep.js')
const {
@@ -188,7 +188,7 @@ class PlaceDep {
`${this.dep.name}@${this.dep.version}`,
this.canPlace.description,
`for: ${this.edge.from.package._id || this.edge.from.location}`,
- `want: ${cleanUrl(this.edge.spec || '*')}`
+ `want: ${redact(this.edge.spec || '*')}`
)
const placementType = this.canPlace.canPlace === CONFLICT
diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index d7c393d99dfa57..3a92e669d4bb68 100644
--- a/deps/npm/node_modules/@npmcli/arborist/package.json
+++ b/deps/npm/node_modules/@npmcli/arborist/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/arborist",
- "version": "7.4.1",
+ "version": "7.4.2",
"description": "Manage node_modules trees",
"dependencies": {
"@isaacs/string-locale-compare": "^1.1.0",
@@ -12,6 +12,7 @@
"@npmcli/node-gyp": "^3.0.0",
"@npmcli/package-json": "^5.0.0",
"@npmcli/query": "^3.1.0",
+ "@npmcli/redact": "^1.1.0",
"@npmcli/run-script": "^7.0.2",
"bin-links": "^4.0.1",
"cacache": "^18.0.0",
diff --git a/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js b/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js
index 09b0eceeea6b21..3565cdb4feb44b 100644
--- a/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js
+++ b/deps/npm/node_modules/@npmcli/config/lib/definitions/definitions.js
@@ -1,11 +1,8 @@
-const definitions = {}
-module.exports = definitions
-
const Definition = require('./definition.js')
const ciInfo = require('ci-info')
-const querystring = require('querystring')
-const { join } = require('path')
+const querystring = require('node:querystring')
+const { join } = require('node:path')
const isWindows = process.platform === 'win32'
@@ -91,20 +88,12 @@ const cache = `${cacheRoot}/${cacheExtra}`
// weird to pull out of the config module.
// TODO: use better type definition/validation API, nopt's is so weird.
const {
- semver: { type: semver },
+ semver: { type: Semver },
Umask: { type: Umask },
url: { type: url },
path: { type: path },
} = require('../type-defs.js')
-const define = (key, def) => {
- /* istanbul ignore if - this should never happen, prevents mistakes below */
- if (definitions[key]) {
- throw new Error(`defining key more than once: ${key}`)
- }
- definitions[key] = new Definition(key, def)
-}
-
// basic flattening function, just copy it over camelCase
const flatten = (key, obj, flatOptions) => {
const camel = key.replace(/-([a-z])/g, (_0, _1) => _1.toUpperCase())
@@ -135,12 +124,20 @@ const flatten = (key, obj, flatOptions) => {
// while fixing some Arborist bug, we won't have to hunt through too
// many places.
-// Define all config keys we know about
+// XXX: We should really deprecate all these `--save-blah` switches
+// in favor of a single `--save-type` option. The unfortunate shortcut
+// we took for `--save-peer --save-optional` being `--save-type=peerOptional`
+// makes this tricky, and likely a breaking change.
+
+// Define all config keys we know about. They are indexed by their own key for
+// ease of lookup later. This duplication is an optimization so that we don't
+// have to do an extra function call just to "reuse" the key in both places.
-define('_auth', {
- default: null,
- type: [null, String],
- description: `
+const definitions = {
+ _auth: new Definition('_auth', {
+ default: null,
+ type: [null, String],
+ description: `
A basic-auth string to use when authenticating against the npm registry.
This will ONLY be used to authenticate against the npm registry. For other
registries you will need to scope it like "//other-registry.tld/:_auth"
@@ -149,16 +146,15 @@ define('_auth', {
is safer to use a registry-provided authentication bearer token stored in
the ~/.npmrc file by running \`npm login\`.
`,
- flatten,
-})
-
-define('access', {
- default: null,
- defaultDescription: `
+ flatten,
+ }),
+ access: new Definition('access', {
+ default: null,
+ defaultDescription: `
'public' for new packages, existing packages it will not change the current level
`,
- type: [null, 'restricted', 'public'],
- description: `
+ type: [null, 'restricted', 'public'],
+ description: `
If you do not want your scoped package to be publicly viewable (and
installable) set \`--access=restricted\`.
@@ -169,131 +165,121 @@ define('access', {
publish will change the access for an existing package the same way that
\`npm access set status\` would.
`,
- flatten,
-})
-
-define('all', {
- default: false,
- type: Boolean,
- short: 'a',
- description: `
+ flatten,
+ }),
+ all: new Definition('all', {
+ default: false,
+ type: Boolean,
+ short: 'a',
+ description: `
When running \`npm outdated\` and \`npm ls\`, setting \`--all\` will show
all outdated or installed packages, rather than only those directly
depended upon by the current project.
`,
- flatten,
-})
-
-define('allow-same-version', {
- default: false,
- type: Boolean,
- description: `
+ flatten,
+ }),
+ 'allow-same-version': new Definition('allow-same-version', {
+ default: false,
+ type: Boolean,
+ description: `
Prevents throwing an error when \`npm version\` is used to set the new
version to the same value as the current version.
`,
- flatten,
-})
-
-define('also', {
- default: null,
- type: [null, 'dev', 'development'],
- description: `
- When set to \`dev\` or \`development\`, this is an alias for
- \`--include=dev\`.
- `,
- deprecated: 'Please use --include=dev instead.',
- flatten (key, obj, flatOptions) {
- definitions.omit.flatten('omit', obj, flatOptions)
- },
-})
-
-define('audit', {
- default: true,
- type: Boolean,
- description: `
- When "true" submit audit reports alongside the current npm command to the
- default registry and all registries configured for scopes. See the
- documentation for [\`npm audit\`](/commands/npm-audit) for details on what
- is submitted.
- `,
- flatten,
-})
-
-define('audit-level', {
- default: null,
- type: [null, 'info', 'low', 'moderate', 'high', 'critical', 'none'],
- description: `
+ flatten,
+ }),
+ also: new Definition('also', {
+ default: null,
+ type: [null, 'dev', 'development'],
+ description: `
+ When set to \`dev\` or \`development\`, this is an alias for
+ \`--include=dev\`.
+ `,
+ deprecated: 'Please use --include=dev instead.',
+ flatten (key, obj, flatOptions) {
+ definitions.omit.flatten('omit', obj, flatOptions)
+ },
+ }),
+ audit: new Definition('audit', {
+ default: true,
+ type: Boolean,
+ description: `
+ When "true" submit audit reports alongside the current npm command to the
+ default registry and all registries configured for scopes. See the
+ documentation for [\`npm audit\`](/commands/npm-audit) for details on what
+ is submitted.
+ `,
+ flatten,
+ }),
+ 'audit-level': new Definition('audit-level', {
+ default: null,
+ type: [null, 'info', 'low', 'moderate', 'high', 'critical', 'none'],
+ description: `
The minimum level of vulnerability for \`npm audit\` to exit with
a non-zero exit code.
- `,
- flatten,
-})
-
-define('auth-type', {
- default: 'web',
- type: ['legacy', 'web'],
- description: `
- What authentication strategy to use with \`login\`.
- Note that if an \`otp\` config is given, this value will always be set to \`legacy\`.
- `,
- flatten,
-})
-
-define('before', {
- default: null,
- type: [null, Date],
- description: `
- If passed to \`npm install\`, will rebuild the npm tree such that only
- versions that were available **on or before** the \`--before\` time get
- installed. If there's no versions available for the current set of
- direct dependencies, the command will error.
-
- If the requested version is a \`dist-tag\` and the given tag does not
- pass the \`--before\` filter, the most recent version less than or equal
- to that tag will be used. For example, \`foo@latest\` might install
- \`foo@1.2\` even though \`latest\` is \`2.0\`.
- `,
- flatten,
-})
-
-define('bin-links', {
- default: true,
- type: Boolean,
- description: `
- Tells npm to create symlinks (or \`.cmd\` shims on Windows) for package
- executables.
-
- Set to false to have it not do this. This can be used to work around the
- fact that some file systems don't support symlinks, even on ostensibly
- Unix systems.
- `,
- flatten,
-})
-
-define('browser', {
- default: null,
- defaultDescription: `
+ `,
+ flatten,
+ }),
+ 'auth-type': new Definition('auth-type', {
+ default: 'web',
+ type: ['legacy', 'web'],
+ description: `
+ What authentication strategy to use with \`login\`.
+ Note that if an \`otp\` config is given, this value will always be set to \`legacy\`.
+ `,
+ flatten,
+ }),
+ before: new Definition('before', {
+ default: null,
+ type: [null, Date],
+ description: `
+ If passed to \`npm install\`, will rebuild the npm tree such that only
+ versions that were available **on or before** the \`--before\` time get
+ installed. If there's no versions available for the current set of
+ direct dependencies, the command will error.
+
+ If the requested version is a \`dist-tag\` and the given tag does not
+ pass the \`--before\` filter, the most recent version less than or equal
+ to that tag will be used. For example, \`foo@latest\` might install
+ \`foo@1.2\` even though \`latest\` is \`2.0\`.
+ `,
+ flatten,
+ }),
+ 'bin-links': new Definition('bin-links', {
+ default: true,
+ type: Boolean,
+ description: `
+ Tells npm to create symlinks (or \`.cmd\` shims on Windows) for package
+ executables.
+
+ Set to false to have it not do this. This can be used to work around the
+ fact that some file systems don't support symlinks, even on ostensibly
+ Unix systems.
+ `,
+ flatten,
+ }),
+ browser: new Definition('browser', {
+ default: null,
+ defaultDescription: `
OS X: \`"open"\`, Windows: \`"start"\`, Others: \`"xdg-open"\`
- `,
- type: [null, Boolean, String],
- description: `
+ `,
+ type: [null, Boolean, String],
+ description: `
The browser that is called by npm commands to open websites.
Set to \`false\` to suppress browser behavior and instead print urls to
terminal.
Set to \`true\` to use default system URL opener.
- `,
- flatten,
-})
-
-define('ca', {
- default: null,
- type: [null, String, Array],
- description: `
+ `,
+ flatten,
+ }),
+ ca: new Definition('ca', {
+ default: null,
+ type: [null, String, Array],
+ description: `
The Certificate Authority signing certificate that is trusted for SSL
connections to the registry. Values should be in PEM format (Windows
- calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the
+ calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the
string "\\n". For example:
\`\`\`ini
@@ -312,2124 +298,1979 @@ define('ca', {
See also the \`strict-ssl\` config.
`,
- flatten,
-})
-
-define('cache', {
- default: cache,
- defaultDescription: `
- Windows: \`%LocalAppData%\\npm-cache\`, Posix: \`~/.npm\`
- `,
- type: path,
- description: `
- The location of npm's cache directory.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.cache = join(obj.cache, '_cacache')
- flatOptions.npxCache = join(obj.cache, '_npx')
- flatOptions.tufCache = join(obj.cache, '_tuf')
- },
-})
-
-define('cache-max', {
- default: Infinity,
- type: Number,
- description: `
- \`--cache-max=0\` is an alias for \`--prefer-online\`
- `,
- deprecated: `
- This option has been deprecated in favor of \`--prefer-online\`
- `,
- flatten (key, obj, flatOptions) {
- if (obj[key] <= 0) {
- flatOptions.preferOnline = true
- }
- },
-})
-
-define('cache-min', {
- default: 0,
- type: Number,
- description: `
- \`--cache-min=9999 (or bigger)\` is an alias for \`--prefer-offline\`.
- `,
- deprecated: `
- This option has been deprecated in favor of \`--prefer-offline\`.
- `,
- flatten (key, obj, flatOptions) {
- if (obj[key] >= 9999) {
- flatOptions.preferOffline = true
- }
- },
-})
-
-define('cafile', {
- default: null,
- type: path,
- description: `
- A path to a file containing one or multiple Certificate Authority signing
- certificates. Similar to the \`ca\` setting, but allows for multiple
- CA's, as well as for the CA information to be stored in a file on disk.
- `,
- flatten (key, obj, flatOptions) {
- // always set to null in defaults
- if (!obj.cafile) {
- return
- }
-
- const raw = maybeReadFile(obj.cafile)
- if (!raw) {
- return
- }
-
- const delim = '-----END CERTIFICATE-----'
- flatOptions.ca = raw.replace(/\r\n/g, '\n').split(delim)
- .filter(section => section.trim())
- .map(section => section.trimLeft() + delim)
- },
-})
-
-define('call', {
- default: '',
- type: String,
- short: 'c',
- description: `
- Optional companion option for \`npm exec\`, \`npx\` that allows for
- specifying a custom command to be run along with the installed packages.
-
- \`\`\`bash
- npm exec --package yo --package generator-node --call "yo node"
- \`\`\`
- `,
- flatten,
-})
-
-define('cert', {
- default: null,
- type: [null, String],
- description: `
- A client certificate to pass when accessing the registry. Values should
- be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with
- newlines replaced by the string "\\n". For example:
-
- \`\`\`ini
- cert="-----BEGIN CERTIFICATE-----\\nXXXX\\nXXXX\\n-----END CERTIFICATE-----"
- \`\`\`
-
- It is _not_ the path to a certificate file, though you can set a registry-scoped
- "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem".
- `,
- deprecated: `
- \`key\` and \`cert\` are no longer used for most registry operations.
- Use registry scoped \`keyfile\` and \`certfile\` instead.
- Example:
- //other-registry.tld/:keyfile=/path/to/key.pem
- //other-registry.tld/:certfile=/path/to/cert.crt
- `,
- flatten,
-})
-
-define('cidr', {
- default: null,
- type: [null, String, Array],
- description: `
- This is a list of CIDR address to be used when configuring limited access
- tokens with the \`npm token create\` command.
- `,
- flatten,
-})
-
-// This should never be directly used, the flattened value is the derived value
-// and is sent to other modules, and is also exposed as `npm.color` for use
-// inside npm itself.
-define('color', {
- default: !process.env.NO_COLOR || process.env.NO_COLOR === '0',
- usage: '--color|--no-color|--color always',
- defaultDescription: `
- true unless the NO_COLOR environ is set to something other than '0'
- `,
- type: ['always', Boolean],
- description: `
- If false, never shows colors. If \`"always"\` then always shows colors.
- If true, then only prints color codes for tty file descriptors.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.color = !obj.color ? false
- : obj.color === 'always' ? true
- : !!process.stdout.isTTY
- flatOptions.logColor = !obj.color ? false
- : obj.color === 'always' ? true
- : !!process.stderr.isTTY
- },
-})
-
-define('commit-hooks', {
- default: true,
- type: Boolean,
- description: `
- Run git commit hooks when using the \`npm version\` command.
- `,
- flatten,
-})
-
-define('cpu', {
- default: null,
- type: [null, String],
- description: `
- Override CPU architecture of native modules to install.
- Acceptable values are same as \`cpu\` field of package.json,
- which comes from \`process.arch\`.
- `,
- flatten,
-})
-
-define('os', {
- default: null,
- type: [null, String],
- description: `
- Override OS of native modules to install.
- Acceptable values are same as \`os\` field of package.json,
- which comes from \`process.platform\`.
- `,
- flatten,
-})
-
-define('libc', {
- default: null,
- type: [null, String],
- description: `
- Override libc of native modules to install.
- Acceptable values are same as \`libc\` field of package.json
- `,
- flatten,
-})
-
-define('depth', {
- default: null,
- defaultDescription: `
- \`Infinity\` if \`--all\` is set, otherwise \`1\`
- `,
- type: [null, Number],
- description: `
- The depth to go when recursing packages for \`npm ls\`.
-
- If not set, \`npm ls\` will show only the immediate dependencies of the
- root project. If \`--all\` is set, then npm will show all dependencies
- by default.
- `,
- flatten,
-})
-
-define('description', {
- default: true,
- type: Boolean,
- usage: '--no-description',
- description: `
- Show the description in \`npm search\`
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.search = flatOptions.search || { limit: 20 }
- flatOptions.search[key] = obj[key]
- },
-})
-
-define('dev', {
- default: false,
- type: Boolean,
- description: `
- Alias for \`--include=dev\`.
- `,
- deprecated: 'Please use --include=dev instead.',
- flatten (key, obj, flatOptions) {
- definitions.omit.flatten('omit', obj, flatOptions)
- },
-})
-
-define('diff', {
- default: [],
- hint: '',
- type: [String, Array],
- description: `
- Define arguments to compare in \`npm diff\`.
- `,
- flatten,
-})
-
-define('diff-ignore-all-space', {
- default: false,
- type: Boolean,
- description: `
- Ignore whitespace when comparing lines in \`npm diff\`.
- `,
- flatten,
-})
-
-define('diff-name-only', {
- default: false,
- type: Boolean,
- description: `
- Prints only filenames when using \`npm diff\`.
- `,
- flatten,
-})
-
-define('diff-no-prefix', {
- default: false,
- type: Boolean,
- description: `
- Do not show any source or destination prefix in \`npm diff\` output.
-
- Note: this causes \`npm diff\` to ignore the \`--diff-src-prefix\` and
- \`--diff-dst-prefix\` configs.
- `,
- flatten,
-})
-
-define('diff-dst-prefix', {
- default: 'b/',
- hint: '',
- type: String,
- description: `
- Destination prefix to be used in \`npm diff\` output.
- `,
- flatten,
-})
-
-define('diff-src-prefix', {
- default: 'a/',
- hint: '',
- type: String,
- description: `
- Source prefix to be used in \`npm diff\` output.
- `,
- flatten,
-})
-
-define('diff-text', {
- default: false,
- type: Boolean,
- description: `
- Treat all files as text in \`npm diff\`.
- `,
- flatten,
-})
-
-define('diff-unified', {
- default: 3,
- type: Number,
- description: `
- The number of lines of context to print in \`npm diff\`.
- `,
- flatten,
-})
-
-define('dry-run', {
- default: false,
- type: Boolean,
- description: `
- Indicates that you don't want npm to make any changes and that it should
- only report what it would have done. This can be passed into any of the
- commands that modify your local installation, eg, \`install\`,
- \`update\`, \`dedupe\`, \`uninstall\`, as well as \`pack\` and
- \`publish\`.
-
- Note: This is NOT honored by other network related commands, eg
- \`dist-tags\`, \`owner\`, etc.
- `,
- flatten,
-})
-
-define('editor', {
- default: editor,
- defaultDescription: `
- The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\\notepad.exe' on Windows,
- or 'vi' on Unix systems
- `,
- type: String,
- description: `
- The command to run for \`npm edit\` and \`npm config edit\`.
- `,
- flatten,
-})
-
-define('engine-strict', {
- default: false,
- type: Boolean,
- description: `
- If set to true, then npm will stubbornly refuse to install (or even
- consider installing) any package that claims to not be compatible with
- the current Node.js version.
-
- This can be overridden by setting the \`--force\` flag.
- `,
- flatten,
-})
-
-define('expect-results', {
- default: null,
- type: [null, Boolean],
- exclusive: ['expect-result-count'],
- description: `
- Tells npm whether or not to expect results from the command.
- Can be either true (expect some results) or false (expect no results).
- `,
-})
-
-define('expect-result-count', {
- default: null,
- type: [null, Number],
- hint: '',
- exclusive: ['expect-results'],
- description: `
- Tells to expect a specific number of results from the command.
- `,
-})
-
-define('fetch-retries', {
- default: 2,
- type: Number,
- description: `
- The "retries" config for the \`retry\` module to use when fetching
- packages from the registry.
-
- npm will retry idempotent read requests to the registry in the case
- of network failures or 5xx HTTP errors.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.retry = flatOptions.retry || {}
- flatOptions.retry.retries = obj[key]
- },
-})
-
-define('fetch-retry-factor', {
- default: 10,
- type: Number,
- description: `
- The "factor" config for the \`retry\` module to use when fetching
- packages.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.retry = flatOptions.retry || {}
- flatOptions.retry.factor = obj[key]
- },
-})
-
-define('fetch-retry-maxtimeout', {
- default: 60000,
- defaultDescription: '60000 (1 minute)',
- type: Number,
- description: `
- The "maxTimeout" config for the \`retry\` module to use when fetching
- packages.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.retry = flatOptions.retry || {}
- flatOptions.retry.maxTimeout = obj[key]
- },
-})
-
-define('fetch-retry-mintimeout', {
- default: 10000,
- defaultDescription: '10000 (10 seconds)',
- type: Number,
- description: `
- The "minTimeout" config for the \`retry\` module to use when fetching
- packages.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.retry = flatOptions.retry || {}
- flatOptions.retry.minTimeout = obj[key]
- },
-})
-
-define('fetch-timeout', {
- default: 5 * 60 * 1000,
- defaultDescription: `${5 * 60 * 1000} (5 minutes)`,
- type: Number,
- description: `
- The maximum amount of time to wait for HTTP requests to complete.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.timeout = obj[key]
- },
-})
-
-define('force', {
- default: false,
- type: Boolean,
- short: 'f',
- description: `
- Removes various protections against unfortunate side effects, common
- mistakes, unnecessary performance degradation, and malicious input.
-
- * Allow clobbering non-npm files in global installs.
- * Allow the \`npm version\` command to work on an unclean git repository.
- * Allow deleting the cache folder with \`npm cache clean\`.
- * Allow installing packages that have an \`engines\` declaration
- requiring a different version of npm.
- * Allow installing packages that have an \`engines\` declaration
- requiring a different version of \`node\`, even if \`--engine-strict\`
- is enabled.
- * Allow \`npm audit fix\` to install modules outside your stated
- dependency range (including SemVer-major changes).
- * Allow unpublishing all versions of a published package.
- * Allow conflicting peerDependencies to be installed in the root project.
- * Implicitly set \`--yes\` during \`npm init\`.
- * Allow clobbering existing values in \`npm pkg\`
- * Allow unpublishing of entire packages (not just a single version).
-
- If you don't have a clear idea of what you want to do, it is strongly
- recommended that you do not use this option!
- `,
- flatten,
-})
-
-define('foreground-scripts', {
- default: false,
- defaultDescription: `\`false\` unless when using \`npm pack\` or \`npm publish\` where it
- defaults to \`true\``,
- type: Boolean,
- description: `
- Run all build scripts (ie, \`preinstall\`, \`install\`, and
- \`postinstall\`) scripts for installed packages in the foreground
- process, sharing standard input, output, and error with the main npm
- process.
-
- Note that this will generally make installs run slower, and be much
- noisier, but can be useful for debugging.
- `,
- flatten,
-})
-
-define('format-package-lock', {
- default: true,
- type: Boolean,
- description: `
- Format \`package-lock.json\` or \`npm-shrinkwrap.json\` as a human
- readable file.
- `,
- flatten,
-})
-
-define('fund', {
- default: true,
- type: Boolean,
- description: `
- When "true" displays the message at the end of each \`npm install\`
- acknowledging the number of dependencies looking for funding.
- See [\`npm fund\`](/commands/npm-fund) for details.
- `,
- flatten,
-})
-
-define('git', {
- default: 'git',
- type: String,
- description: `
- The command to use for git commands. If git is installed on the
- computer, but is not in the \`PATH\`, then set this to the full path to
- the git binary.
- `,
- flatten,
-})
-
-define('git-tag-version', {
- default: true,
- type: Boolean,
- description: `
- Tag the commit when using the \`npm version\` command. Setting this to
- false results in no commit being made at all.
- `,
- flatten,
-})
-
-define('global', {
- default: false,
- type: Boolean,
- short: 'g',
- description: `
- Operates in "global" mode, so that packages are installed into the
- \`prefix\` folder instead of the current working directory. See
- [folders](/configuring-npm/folders) for more on the differences in
- behavior.
-
- * packages are installed into the \`{prefix}/lib/node_modules\` folder,
- instead of the current working directory.
- * bin files are linked to \`{prefix}/bin\`
- * man pages are linked to \`{prefix}/share/man\`
- `,
- flatten: (key, obj, flatOptions) => {
- flatten(key, obj, flatOptions)
- if (flatOptions.global) {
- flatOptions.location = 'global'
- }
- },
-})
-
-// the globalconfig has its default defined outside of this module
-define('globalconfig', {
- type: path,
- default: '',
- defaultDescription: `
- The global --prefix setting plus 'etc/npmrc'. For example,
- '/usr/local/etc/npmrc'
- `,
- description: `
- The config file to read for global config options.
- `,
- flatten,
-})
-
-define('global-style', {
- default: false,
- type: Boolean,
- description: `
- Only install direct dependencies in the top level \`node_modules\`,
- but hoist on deeper dependencies.
- Sets \`--install-strategy=shallow\`.
- `,
- deprecated: `
- This option has been deprecated in favor of \`--install-strategy=shallow\`
- `,
- flatten (key, obj, flatOptions) {
- if (obj[key]) {
- obj['install-strategy'] = 'shallow'
- flatOptions.installStrategy = 'shallow'
- }
- },
-})
-
-define('heading', {
- default: 'npm',
- type: String,
- description: `
- The string that starts all the debugging log output.
- `,
- flatten,
-})
-
-define('https-proxy', {
- default: null,
- type: [null, url],
- description: `
- A proxy to use for outgoing https requests. If the \`HTTPS_PROXY\` or
- \`https_proxy\` or \`HTTP_PROXY\` or \`http_proxy\` environment variables
- are set, proxy settings will be honored by the underlying
- \`make-fetch-happen\` library.
- `,
- flatten,
-})
-
-define('if-present', {
- default: false,
- type: Boolean,
- envExport: false,
- description: `
- If true, npm will not exit with an error code when \`run-script\` is
- invoked for a script that isn't defined in the \`scripts\` section of
- \`package.json\`. This option can be used when it's desirable to
- optionally run a script when it's present and fail if the script fails.
- This is useful, for example, when running scripts that may only apply for
- some builds in an otherwise generic CI setup.
- `,
- flatten,
-})
-
-define('ignore-scripts', {
- default: false,
- type: Boolean,
- description: `
- If true, npm does not run scripts specified in package.json files.
-
- Note that commands explicitly intended to run a particular script, such
- as \`npm start\`, \`npm stop\`, \`npm restart\`, \`npm test\`, and \`npm
- run-script\` will still run their intended script if \`ignore-scripts\` is
- set, but they will *not* run any pre- or post-scripts.
- `,
- flatten,
-})
-
-define('include', {
- default: [],
- type: [Array, 'prod', 'dev', 'optional', 'peer'],
- description: `
- Option that allows for defining which types of dependencies to install.
-
- This is the inverse of \`--omit=\`.
-
- Dependency types specified in \`--include\` will not be omitted,
- regardless of the order in which omit/include are specified on the
- command-line.
- `,
- flatten (key, obj, flatOptions) {
- // just call the omit flattener, it reads from obj.include
- definitions.omit.flatten('omit', obj, flatOptions)
- },
-})
-
-define('include-staged', {
- default: false,
- type: Boolean,
- description: `
- Allow installing "staged" published packages, as defined by [npm RFC PR
- #92](https://github.com/npm/rfcs/pull/92).
-
- This is experimental, and not implemented by the npm public registry.
- `,
- flatten,
-})
-
-define('include-workspace-root', {
- default: false,
- type: Boolean,
- envExport: false,
- description: `
- Include the workspace root when workspaces are enabled for a command.
-
- When false, specifying individual workspaces via the \`workspace\` config,
- or all workspaces via the \`workspaces\` flag, will cause npm to operate only
- on the specified workspaces, and not on the root project.
- `,
- flatten,
-})
-
-define('init-author-email', {
- default: '',
- hint: '',
- type: String,
- description: `
- The value \`npm init\` should use by default for the package author's
- email.
- `,
-})
-
-define('init-author-name', {
- default: '',
- hint: '',
- type: String,
- description: `
- The value \`npm init\` should use by default for the package author's name.
- `,
-})
-
-define('init-author-url', {
- default: '',
- type: ['', url],
- hint: '',
- description: `
- The value \`npm init\` should use by default for the package author's homepage.
- `,
-})
-
-define('init-license', {
- default: 'ISC',
- hint: '',
- type: String,
- description: `
- The value \`npm init\` should use by default for the package license.
- `,
-})
-
-define('init-module', {
- default: '~/.npm-init.js',
- type: path,
- hint: '',
- description: `
- A module that will be loaded by the \`npm init\` command. See the
- documentation for the
- [init-package-json](https://github.com/npm/init-package-json) module for
- more information, or [npm init](/commands/npm-init).
- `,
-})
-
-define('init-version', {
- default: '1.0.0',
- type: semver,
- hint: '',
- description: `
- The value that \`npm init\` should use by default for the package
- version number, if not already set in package.json.
- `,
-})
-
-// these "aliases" are historically supported in .npmrc files, unfortunately
-// They should be removed in a future npm version.
-define('init.author.email', {
- default: '',
- type: String,
- deprecated: `
- Use \`--init-author-email\` instead.`,
- description: `
- Alias for \`--init-author-email\`
- `,
-})
-
-define('init.author.name', {
- default: '',
- type: String,
- deprecated: `
- Use \`--init-author-name\` instead.
- `,
- description: `
- Alias for \`--init-author-name\`
- `,
-})
-
-define('init.author.url', {
- default: '',
- type: ['', url],
- deprecated: `
- Use \`--init-author-url\` instead.
- `,
- description: `
- Alias for \`--init-author-url\`
- `,
-})
-
-define('init.license', {
- default: 'ISC',
- type: String,
- deprecated: `
- Use \`--init-license\` instead.
- `,
- description: `
- Alias for \`--init-license\`
- `,
-})
-
-define('init.module', {
- default: '~/.npm-init.js',
- type: path,
- deprecated: `
- Use \`--init-module\` instead.
- `,
- description: `
- Alias for \`--init-module\`
- `,
-})
-
-define('init.version', {
- default: '1.0.0',
- type: semver,
- deprecated: `
- Use \`--init-version\` instead.
- `,
- description: `
- Alias for \`--init-version\`
- `,
-})
-
-define('install-links', {
- default: false,
- type: Boolean,
- description: `
- When set file: protocol dependencies will be packed and installed as
- regular dependencies instead of creating a symlink. This option has
- no effect on workspaces.
- `,
- flatten,
-})
-
-define('install-strategy', {
- default: 'hoisted',
- type: ['hoisted', 'nested', 'shallow', 'linked'],
- description: `
- Sets the strategy for installing packages in node_modules.
- hoisted (default): Install non-duplicated in top-level, and duplicated as
- necessary within directory structure.
- nested: (formerly --legacy-bundling) install in place, no hoisting.
- shallow (formerly --global-style) only install direct deps at top-level.
- linked: (experimental) install in node_modules/.store, link in place,
- unhoisted.
- `,
- flatten,
-})
-
-define('json', {
- default: false,
- type: Boolean,
- description: `
- Whether or not to output JSON data, rather than the normal output.
-
- * In \`npm pkg set\` it enables parsing set values with JSON.parse()
- before saving them to your \`package.json\`.
-
- Not supported by all npm commands.
- `,
- flatten,
-})
-
-define('key', {
- default: null,
- type: [null, String],
- description: `
- A client key to pass when accessing the registry. Values should be in
- PEM format with newlines replaced by the string "\\n". For example:
-
- \`\`\`ini
- key="-----BEGIN PRIVATE KEY-----\\nXXXX\\nXXXX\\n-----END PRIVATE KEY-----"
- \`\`\`
-
- It is _not_ the path to a key file, though you can set a registry-scoped
- "keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem".
- `,
- deprecated: `
- \`key\` and \`cert\` are no longer used for most registry operations.
- Use registry scoped \`keyfile\` and \`certfile\` instead.
- Example:
- //other-registry.tld/:keyfile=/path/to/key.pem
- //other-registry.tld/:certfile=/path/to/cert.crt
- `,
- flatten,
-})
-
-define('legacy-bundling', {
- default: false,
- type: Boolean,
- description: `
- Instead of hoisting package installs in \`node_modules\`, install packages
- in the same manner that they are depended on. This may cause very deep
- directory structures and duplicate package installs as there is no
- de-duplicating.
- Sets \`--install-strategy=nested\`.
- `,
- deprecated: `
- This option has been deprecated in favor of \`--install-strategy=nested\`
- `,
- flatten (key, obj, flatOptions) {
- if (obj[key]) {
- obj['install-strategy'] = 'nested'
- flatOptions.installStrategy = 'nested'
- }
- },
-})
-
-define('legacy-peer-deps', {
- default: false,
- type: Boolean,
- description: `
- Causes npm to completely ignore \`peerDependencies\` when building a
- package tree, as in npm versions 3 through 6.
-
- If a package cannot be installed because of overly strict
- \`peerDependencies\` that collide, it provides a way to move forward
- resolving the situation.
-
- This differs from \`--omit=peer\`, in that \`--omit=peer\` will avoid
- unpacking \`peerDependencies\` on disk, but will still design a tree such
- that \`peerDependencies\` _could_ be unpacked in a correct place.
-
- Use of \`legacy-peer-deps\` is not recommended, as it will not enforce
- the \`peerDependencies\` contract that meta-dependencies may rely on.
- `,
- flatten,
-})
-
-define('link', {
- default: false,
- type: Boolean,
- description: `
- Used with \`npm ls\`, limiting output to only those packages that are
- linked.
- `,
-})
-
-define('local-address', {
- default: null,
- type: getLocalAddresses(),
- typeDescription: 'IP Address',
- description: `
- The IP address of the local interface to use when making connections to
- the npm registry. Must be IPv4 in versions of Node prior to 0.12.
- `,
- flatten,
-})
-
-define('sbom-format', {
- default: null,
- type: [
- 'cyclonedx',
- 'spdx',
- ],
- description: `
- SBOM format to use when generating SBOMs.
- `,
- flatten,
-})
-
-define('sbom-type', {
- default: 'library',
- type: [
- 'library',
- 'application',
- 'framework',
- ],
- description: `
- The type of package described by the generated SBOM. For SPDX, this is the
- value for the \`primaryPackagePurpose\` field. For CycloneDX, this is the
- value for the \`type\` field.
- `,
- flatten,
-})
-
-define('location', {
- default: 'user',
- short: 'L',
- type: [
- 'global',
- 'user',
- 'project',
- ],
- defaultDescription: `
- "user" unless \`--global\` is passed, which will also set this value to "global"
- `,
- description: `
- When passed to \`npm config\` this refers to which config file to use.
-
- When set to "global" mode, packages are installed into the \`prefix\` folder
- instead of the current working directory. See
- [folders](/configuring-npm/folders) for more on the differences in behavior.
-
- * packages are installed into the \`{prefix}/lib/node_modules\` folder,
- instead of the current working directory.
- * bin files are linked to \`{prefix}/bin\`
- * man pages are linked to \`{prefix}/share/man\`
- `,
- flatten: (key, obj, flatOptions) => {
- flatten(key, obj, flatOptions)
- if (flatOptions.global) {
- flatOptions.location = 'global'
- }
- if (obj.location === 'global') {
- flatOptions.global = true
- }
- },
-})
-
-define('lockfile-version', {
- default: null,
- type: [null, 1, 2, 3, '1', '2', '3'],
- defaultDescription: `
- Version 3 if no lockfile, auto-converting v1 lockfiles to v3, otherwise
- maintain current lockfile version.`,
- description: `
- Set the lockfile format version to be used in package-lock.json and
- npm-shrinkwrap-json files. Possible options are:
-
- 1: The lockfile version used by npm versions 5 and 6. Lacks some data that
- is used during the install, resulting in slower and possibly less
- deterministic installs. Prevents lockfile churn when interoperating with
- older npm versions.
-
- 2: The default lockfile version used by npm version 7 and 8. Includes both
- the version 1 lockfile data and version 3 lockfile data, for maximum
- determinism and interoperability, at the expense of more bytes on disk.
-
- 3: Only the new lockfile information introduced in npm version 7. Smaller
- on disk than lockfile version 2, but not interoperable with older npm
- versions. Ideal if all users are on npm version 7 and higher.
- `,
- flatten: (key, obj, flatOptions) => {
- flatOptions.lockfileVersion = obj[key] && parseInt(obj[key], 10)
- },
-})
-
-define('loglevel', {
- default: 'notice',
- type: [
- 'silent',
- 'error',
- 'warn',
- 'notice',
- 'http',
- 'info',
- 'verbose',
- 'silly',
- ],
- description: `
- What level of logs to report. All logs are written to a debug log,
- with the path to that file printed if the execution of a command fails.
-
- Any logs of a higher level than the setting are shown. The default is
- "notice".
-
- See also the \`foreground-scripts\` config.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.silent = obj[key] === 'silent'
- },
-})
-
-define('logs-dir', {
- default: null,
- type: [null, path],
- defaultDescription: `
- A directory named \`_logs\` inside the cache
-`,
- description: `
- The location of npm's log directory. See [\`npm
- logging\`](/using-npm/logging) for more information.
- `,
-})
-
-define('logs-max', {
- default: 10,
- type: Number,
- description: `
- The maximum number of log files to store.
-
- If set to 0, no log files will be written for the current run.
- `,
-})
-
-define('long', {
- default: false,
- type: Boolean,
- short: 'l',
- description: `
- Show extended information in \`ls\`, \`search\`, and \`help-search\`.
- `,
-})
-
-define('maxsockets', {
- default: 15,
- type: Number,
- description: `
- The maximum number of connections to use per origin (protocol/host/port
- combination).
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.maxSockets = obj[key]
- },
-})
-
-define('message', {
- default: '%s',
- type: String,
- short: 'm',
- description: `
- Commit message which is used by \`npm version\` when creating version commit.
-
- Any "%s" in the message will be replaced with the version number.
- `,
- flatten,
-})
-
-define('node-options', {
- default: null,
- type: [null, String],
- description: `
- Options to pass through to Node.js via the \`NODE_OPTIONS\` environment
- variable. This does not impact how npm itself is executed but it does
- impact how lifecycle scripts are called.
- `,
-})
-
-define('noproxy', {
- default: '',
- defaultDescription: `
- The value of the NO_PROXY environment variable
- `,
- type: [String, Array],
- description: `
- Domain extensions that should bypass any proxies.
-
- Also accepts a comma-delimited string.
- `,
- flatten (key, obj, flatOptions) {
- if (Array.isArray(obj[key])) {
- flatOptions.noProxy = obj[key].join(',')
- } else {
- flatOptions.noProxy = obj[key]
- }
- },
-})
-
-define('offline', {
- default: false,
- type: Boolean,
- description: `
- Force offline mode: no network requests will be done during install. To allow
- the CLI to fill in missing cache data, see \`--prefer-offline\`.
- `,
- flatten,
-})
-
-define('omit', {
- default: process.env.NODE_ENV === 'production' ? ['dev'] : [],
- defaultDescription: `
- 'dev' if the \`NODE_ENV\` environment variable is set to 'production',
- otherwise empty.
- `,
- type: [Array, 'dev', 'optional', 'peer'],
- description: `
- Dependency types to omit from the installation tree on disk.
-
- Note that these dependencies _are_ still resolved and added to the
- \`package-lock.json\` or \`npm-shrinkwrap.json\` file. They are just
- not physically installed on disk.
-
- If a package type appears in both the \`--include\` and \`--omit\`
- lists, then it will be included.
-
- If the resulting omit list includes \`'dev'\`, then the \`NODE_ENV\`
- environment variable will be set to \`'production'\` for all lifecycle
- scripts.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.omit = buildOmitList(obj)
- },
-})
-
-define('omit-lockfile-registry-resolved', {
- default: false,
- type: Boolean,
- description: `
- This option causes npm to create lock files without a \`resolved\` key for
- registry dependencies. Subsequent installs will need to resolve tarball
- endpoints with the configured registry, likely resulting in a longer install
- time.
- `,
- flatten,
-})
-
-define('only', {
- default: null,
- type: [null, 'prod', 'production'],
- deprecated: `
- Use \`--omit=dev\` to omit dev dependencies from the install.
- `,
- description: `
- When set to \`prod\` or \`production\`, this is an alias for
- \`--omit=dev\`.
- `,
- flatten (key, obj, flatOptions) {
- definitions.omit.flatten('omit', obj, flatOptions)
- },
-})
-
-define('optional', {
- default: null,
- type: [null, Boolean],
- deprecated: `
- Use \`--omit=optional\` to exclude optional dependencies, or
- \`--include=optional\` to include them.
-
- Default value does install optional deps unless otherwise omitted.
- `,
- description: `
- Alias for --include=optional or --omit=optional
- `,
- flatten (key, obj, flatOptions) {
- definitions.omit.flatten('omit', obj, flatOptions)
- },
-})
-
-define('otp', {
- default: null,
- type: [null, String],
- description: `
- This is a one-time password from a two-factor authenticator. It's needed
- when publishing or changing package permissions with \`npm access\`.
-
- If not set, and a registry response fails with a challenge for a one-time
- password, npm will prompt on the command line for one.
- `,
- flatten (key, obj, flatOptions) {
- flatten(key, obj, flatOptions)
- if (obj.otp) {
- obj['auth-type'] = 'legacy'
- flatten('auth-type', obj, flatOptions)
- }
- },
-})
-
-define('package', {
- default: [],
- hint: '',
- type: [String, Array],
- description: `
- The package or packages to install for [\`npm exec\`](/commands/npm-exec)
- `,
- flatten,
-})
-
-define('package-lock', {
- default: true,
- type: Boolean,
- description: `
- If set to false, then ignore \`package-lock.json\` files when installing.
- This will also prevent _writing_ \`package-lock.json\` if \`save\` is
- true.
- `,
- flatten: (key, obj, flatOptions) => {
- flatten(key, obj, flatOptions)
- if (flatOptions.packageLockOnly) {
- flatOptions.packageLock = true
- }
- },
-})
-
-define('package-lock-only', {
- default: false,
- type: Boolean,
- description: `
- If set to true, the current operation will only use the \`package-lock.json\`,
- ignoring \`node_modules\`.
-
- For \`update\` this means only the \`package-lock.json\` will be updated,
- instead of checking \`node_modules\` and downloading dependencies.
-
- For \`list\` this means the output will be based on the tree described by the
- \`package-lock.json\`, rather than the contents of \`node_modules\`.
- `,
- flatten: (key, obj, flatOptions) => {
- flatten(key, obj, flatOptions)
- if (flatOptions.packageLockOnly) {
- flatOptions.packageLock = true
- }
- },
-})
-
-define('pack-destination', {
- default: '.',
- type: String,
- description: `
- Directory in which \`npm pack\` will save tarballs.
- `,
- flatten,
-})
-
-define('parseable', {
- default: false,
- type: Boolean,
- short: 'p',
- description: `
- Output parseable results from commands that write to standard output. For
- \`npm search\`, this will be tab-separated table format.
- `,
- flatten,
-})
-
-define('prefer-dedupe', {
- default: false,
- type: Boolean,
- description: `
- Prefer to deduplicate packages if possible, rather than
- choosing a newer version of a dependency.
- `,
- flatten,
-})
-
-define('prefer-offline', {
- default: false,
- type: Boolean,
- description: `
- If true, staleness checks for cached data will be bypassed, but missing
- data will be requested from the server. To force full offline mode, use
- \`--offline\`.
- `,
- flatten,
-})
-
-define('prefer-online', {
- default: false,
- type: Boolean,
- description: `
- If true, staleness checks for cached data will be forced, making the CLI
- look for updates immediately even for fresh package data.
- `,
- flatten,
-})
-
-// `prefix` has its default defined outside of this module
-define('prefix', {
- type: path,
- short: 'C',
- default: '',
- defaultDescription: `
- In global mode, the folder where the node executable is installed.
- Otherwise, the nearest parent folder containing either a package.json
- file or a node_modules folder.
- `,
- description: `
- The location to install global items. If set on the command line, then
- it forces non-global commands to run in the specified folder.
- `,
-})
-
-define('preid', {
- default: '',
- hint: 'prerelease-id',
- type: String,
- description: `
- The "prerelease identifier" to use as a prefix for the "prerelease" part
- of a semver. Like the \`rc\` in \`1.2.0-rc.8\`.
- `,
- flatten,
-})
-
-define('production', {
- default: null,
- type: [null, Boolean],
- deprecated: 'Use `--omit=dev` instead.',
- description: 'Alias for `--omit=dev`',
- flatten (key, obj, flatOptions) {
- definitions.omit.flatten('omit', obj, flatOptions)
- },
-})
-
-define('progress', {
- default: !ciInfo.isCI,
- defaultDescription: `
- \`true\` unless running in a known CI system
- `,
- type: Boolean,
- description: `
- When set to \`true\`, npm will display a progress bar during time
- intensive operations, if \`process.stderr\` is a TTY.
-
- Set to \`false\` to suppress the progress bar.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.progress = !obj.progress ? false
- : !!process.stderr.isTTY && process.env.TERM !== 'dumb'
- },
-})
-
-define('provenance', {
- default: false,
- type: Boolean,
- exclusive: ['provenance-file'],
- description: `
- When publishing from a supported cloud CI/CD system, the package will be
- publicly linked to where it was built and published from.
- `,
- flatten,
-})
-
-define('provenance-file', {
- default: null,
- type: path,
- hint: '',
- exclusive: ['provenance'],
- description: `
- When publishing, the provenance bundle at the given path will be used.
- `,
- flatten,
-})
-
-define('proxy', {
- default: null,
- type: [null, false, url], // allow proxy to be disabled explicitly
- description: `
- A proxy to use for outgoing http requests. If the \`HTTP_PROXY\` or
- \`http_proxy\` environment variables are set, proxy settings will be
- honored by the underlying \`request\` library.
- `,
- flatten,
-})
-
-define('read-only', {
- default: false,
- type: Boolean,
- description: `
- This is used to mark a token as unable to publish when configuring
- limited access tokens with the \`npm token create\` command.
- `,
- flatten,
-})
-
-define('rebuild-bundle', {
- default: true,
- type: Boolean,
- description: `
- Rebuild bundled dependencies after installation.
- `,
- flatten,
-})
-
-define('registry', {
- default: 'https://registry.npmjs.org/',
- type: url,
- description: `
- The base URL of the npm registry.
- `,
- flatten,
-})
-
-define('replace-registry-host', {
- default: 'npmjs',
- hint: ' | hostname',
- type: ['npmjs', 'never', 'always', String],
- description: `
- Defines behavior for replacing the registry host in a lockfile with the
- configured registry.
-
- The default behavior is to replace package dist URLs from the default
- registry (https://registry.npmjs.org) to the configured registry. If set to
- "never", then use the registry value. If set to "always", then replace the
- registry host with the configured host every time.
-
- You may also specify a bare hostname (e.g., "registry.npmjs.org").
- `,
- flatten,
-})
-
-define('save', {
- default: true,
- defaultDescription: `\`true\` unless when using \`npm update\` where it
- defaults to \`false\``,
- usage: '-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle',
- type: Boolean,
- short: 'S',
- description: `
- Save installed packages to a \`package.json\` file as dependencies.
-
- When used with the \`npm rm\` command, removes the dependency from
- \`package.json\`.
-
- Will also prevent writing to \`package-lock.json\` if set to \`false\`.
- `,
- flatten,
-})
-
-define('save-bundle', {
- default: false,
- type: Boolean,
- short: 'B',
- description: `
- If a package would be saved at install time by the use of \`--save\`,
- \`--save-dev\`, or \`--save-optional\`, then also put it in the
- \`bundleDependencies\` list.
-
- Ignored if \`--save-peer\` is set, since peerDependencies cannot be bundled.
- `,
- flatten (key, obj, flatOptions) {
- // XXX update arborist to just ignore it if resulting saveType is peer
- // otherwise this won't have the expected effect:
- //
- // npm config set save-peer true
- // npm i foo --save-bundle --save-prod <-- should bundle
- flatOptions.saveBundle = obj['save-bundle'] && !obj['save-peer']
- },
-})
+ flatten,
+ }),
+ cache: new Definition('cache', {
+ default: cache,
+ defaultDescription: `
+ Windows: \`%LocalAppData%\\npm-cache\`, Posix: \`~/.npm\`
+ `,
+ type: path,
+ description: `
+ The location of npm's cache directory.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.cache = join(obj.cache, '_cacache')
+ flatOptions.npxCache = join(obj.cache, '_npx')
+ flatOptions.tufCache = join(obj.cache, '_tuf')
+ },
+ }),
+ 'cache-max': new Definition('cache-max', {
+ default: Infinity,
+ type: Number,
+ description: `
+ \`--cache-max=0\` is an alias for \`--prefer-online\`
+ `,
+ deprecated: `
+ This option has been deprecated in favor of \`--prefer-online\`
+ `,
+ flatten (key, obj, flatOptions) {
+ if (obj[key] <= 0) {
+ flatOptions.preferOnline = true
+ }
+ },
+ }),
+ 'cache-min': new Definition('cache-min', {
+ default: 0,
+ type: Number,
+ description: `
+ \`--cache-min=9999 (or bigger)\` is an alias for \`--prefer-offline\`.
+ `,
+ deprecated: `
+ This option has been deprecated in favor of \`--prefer-offline\`.
+ `,
+ flatten (key, obj, flatOptions) {
+ if (obj[key] >= 9999) {
+ flatOptions.preferOffline = true
+ }
+ },
+ }),
+ cafile: new Definition('cafile', {
+ default: null,
+ type: path,
+ description: `
+ A path to a file containing one or multiple Certificate Authority signing
+ certificates. Similar to the \`ca\` setting, but allows for multiple
+ CA's, as well as for the CA information to be stored in a file on disk.
+ `,
+ flatten (key, obj, flatOptions) {
+ // always set to null in defaults
+ if (!obj.cafile) {
+ return
+ }
-// XXX: We should really deprecate all these `--save-blah` switches
-// in favor of a single `--save-type` option. The unfortunate shortcut
-// we took for `--save-peer --save-optional` being `--save-type=peerOptional`
-// makes this tricky, and likely a breaking change.
+ const raw = maybeReadFile(obj.cafile)
+ if (!raw) {
+ return
+ }
-define('save-dev', {
- default: false,
- type: Boolean,
- short: 'D',
- description: `
- Save installed packages to a package.json file as \`devDependencies\`.
- `,
- flatten (key, obj, flatOptions) {
- if (!obj[key]) {
- if (flatOptions.saveType === 'dev') {
- delete flatOptions.saveType
+ const delim = '-----END CERTIFICATE-----'
+ flatOptions.ca = raw.replace(/\r\n/g, '\n').split(delim)
+ .filter(section => section.trim())
+ .map(section => section.trimLeft() + delim)
+ },
+ }),
+ call: new Definition('call', {
+ default: '',
+ type: String,
+ short: 'c',
+ description: `
+ Optional companion option for \`npm exec\`, \`npx\` that allows for
+ specifying a custom command to be run along with the installed packages.
+
+ \`\`\`bash
+ npm exec --package yo --package generator-node --call "yo node"
+ \`\`\`
+ `,
+ flatten,
+ }),
+ cert: new Definition('cert', {
+ default: null,
+ type: [null, String],
+ description: `
+ A client certificate to pass when accessing the registry. Values should
+ be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with
+ newlines replaced by the string "\\n". For example:
+
+ \`\`\`ini
+ cert="-----BEGIN CERTIFICATE-----\\nXXXX\\nXXXX\\n-----END CERTIFICATE-----"
+ \`\`\`
+
+ It is _not_ the path to a certificate file, though you can set a registry-scoped
+ "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem".
+ `,
+ deprecated: `
+ \`key\` and \`cert\` are no longer used for most registry operations.
+ Use registry scoped \`keyfile\` and \`certfile\` instead.
+ Example:
+ //other-registry.tld/:keyfile=/path/to/key.pem
+ //other-registry.tld/:certfile=/path/to/cert.crt
+ `,
+ flatten,
+ }),
+ cidr: new Definition('cidr', {
+ default: null,
+ type: [null, String, Array],
+ description: `
+ This is a list of CIDR address to be used when configuring limited access
+ tokens with the \`npm token create\` command.
+ `,
+ flatten,
+ }),
+ // This should never be directly used, the flattened value is the derived value
+ // and is sent to other modules, and is also exposed as `npm.color` for use
+ // inside npm itself.
+ color: new Definition('color', {
+ default: !process.env.NO_COLOR || process.env.NO_COLOR === '0',
+ usage: '--color|--no-color|--color always',
+ defaultDescription: `
+ true unless the NO_COLOR environ is set to something other than '0'
+ `,
+ type: ['always', Boolean],
+ description: `
+ If false, never shows colors. If \`"always"\` then always shows colors.
+ If true, then only prints color codes for tty file descriptors.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.color = !obj.color ? false
+ : obj.color === 'always' ? true
+ : !!process.stdout.isTTY
+ flatOptions.logColor = !obj.color ? false
+ : obj.color === 'always' ? true
+ : !!process.stderr.isTTY
+ },
+ }),
+ 'commit-hooks': new Definition('commit-hooks', {
+ default: true,
+ type: Boolean,
+ description: `
+ Run git commit hooks when using the \`npm version\` command.
+ `,
+ flatten,
+ }),
+ cpu: new Definition('cpu', {
+ default: null,
+ type: [null, String],
+ description: `
+ Override CPU architecture of native modules to install.
+ Acceptable values are same as \`cpu\` field of package.json,
+ which comes from \`process.arch\`.
+ `,
+ flatten,
+ }),
+ depth: new Definition('depth', {
+ default: null,
+ defaultDescription: `
+ \`Infinity\` if \`--all\` is set, otherwise \`1\`
+ `,
+ type: [null, Number],
+ description: `
+ The depth to go when recursing packages for \`npm ls\`.
+
+ If not set, \`npm ls\` will show only the immediate dependencies of the
+ root project. If \`--all\` is set, then npm will show all dependencies
+ by default.
+ `,
+ flatten,
+ }),
+ description: new Definition('description', {
+ default: true,
+ type: Boolean,
+ usage: '--no-description',
+ description: `
+ Show the description in \`npm search\`
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.search = flatOptions.search || { limit: 20 }
+ flatOptions.search[key] = obj[key]
+ },
+ }),
+ dev: new Definition('dev', {
+ default: false,
+ type: Boolean,
+ description: `
+ Alias for \`--include=dev\`.
+ `,
+ deprecated: 'Please use --include=dev instead.',
+ flatten (key, obj, flatOptions) {
+ definitions.omit.flatten('omit', obj, flatOptions)
+ },
+ }),
+ diff: new Definition('diff', {
+ default: [],
+ hint: '',
+ type: [String, Array],
+ description: `
+ Define arguments to compare in \`npm diff\`.
+ `,
+ flatten,
+ }),
+ 'diff-ignore-all-space': new Definition('diff-ignore-all-space', {
+ default: false,
+ type: Boolean,
+ description: `
+ Ignore whitespace when comparing lines in \`npm diff\`.
+ `,
+ flatten,
+ }),
+ 'diff-name-only': new Definition('diff-name-only', {
+ default: false,
+ type: Boolean,
+ description: `
+ Prints only filenames when using \`npm diff\`.
+ `,
+ flatten,
+ }),
+ 'diff-no-prefix': new Definition('diff-no-prefix', {
+ default: false,
+ type: Boolean,
+ description: `
+ Do not show any source or destination prefix in \`npm diff\` output.
+
+ Note: this causes \`npm diff\` to ignore the \`--diff-src-prefix\` and
+ \`--diff-dst-prefix\` configs.
+ `,
+ flatten,
+ }),
+ 'diff-dst-prefix': new Definition('diff-dst-prefix', {
+ default: 'b/',
+ hint: '',
+ type: String,
+ description: `
+ Destination prefix to be used in \`npm diff\` output.
+ `,
+ flatten,
+ }),
+ 'diff-src-prefix': new Definition('diff-src-prefix', {
+ default: 'a/',
+ hint: '',
+ type: String,
+ description: `
+ Source prefix to be used in \`npm diff\` output.
+ `,
+ flatten,
+ }),
+ 'diff-text': new Definition('diff-text', {
+ default: false,
+ type: Boolean,
+ description: `
+ Treat all files as text in \`npm diff\`.
+ `,
+ flatten,
+ }),
+ 'diff-unified': new Definition('diff-unified', {
+ default: 3,
+ type: Number,
+ description: `
+ The number of lines of context to print in \`npm diff\`.
+ `,
+ flatten,
+ }),
+ 'dry-run': new Definition('dry-run', {
+ default: false,
+ type: Boolean,
+ description: `
+ Indicates that you don't want npm to make any changes and that it should
+ only report what it would have done. This can be passed into any of the
+ commands that modify your local installation, eg, \`install\`,
+ \`update\`, \`dedupe\`, \`uninstall\`, as well as \`pack\` and
+ \`publish\`.
+
+ Note: This is NOT honored by other network related commands, eg
+ \`dist-tags\`, \`owner\`, etc.
+ `,
+ flatten,
+ }),
+ editor: new Definition('editor', {
+ default: editor,
+ defaultDescription: `
+ The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\\notepad.exe' on Windows,
+ or 'vi' on Unix systems
+ `,
+ type: String,
+ description: `
+ The command to run for \`npm edit\` and \`npm config edit\`.
+ `,
+ flatten,
+ }),
+ 'engine-strict': new Definition('engine-strict', {
+ default: false,
+ type: Boolean,
+ description: `
+ If set to true, then npm will stubbornly refuse to install (or even
+ consider installing) any package that claims to not be compatible with
+ the current Node.js version.
+
+ This can be overridden by setting the \`--force\` flag.
+ `,
+ flatten,
+ }),
+ 'expect-result-count': new Definition('expect-result-count', {
+ default: null,
+ type: [null, Number],
+ hint: '',
+ exclusive: ['expect-results'],
+ description: `
+ Tells to expect a specific number of results from the command.
+ `,
+ }),
+ 'expect-results': new Definition('expect-results', {
+ default: null,
+ type: [null, Boolean],
+ exclusive: ['expect-result-count'],
+ description: `
+ Tells npm whether or not to expect results from the command.
+ Can be either true (expect some results) or false (expect no results).
+ `,
+ }),
+ 'fetch-retries': new Definition('fetch-retries', {
+ default: 2,
+ type: Number,
+ description: `
+ The "retries" config for the \`retry\` module to use when fetching
+ packages from the registry.
+
+ npm will retry idempotent read requests to the registry in the case
+ of network failures or 5xx HTTP errors.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.retry = flatOptions.retry || {}
+ flatOptions.retry.retries = obj[key]
+ },
+ }),
+ 'fetch-retry-factor': new Definition('fetch-retry-factor', {
+ default: 10,
+ type: Number,
+ description: `
+ The "factor" config for the \`retry\` module to use when fetching
+ packages.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.retry = flatOptions.retry || {}
+ flatOptions.retry.factor = obj[key]
+ },
+ }),
+ 'fetch-retry-maxtimeout': new Definition('fetch-retry-maxtimeout', {
+ default: 60000,
+ defaultDescription: '60000 (1 minute)',
+ type: Number,
+ description: `
+ The "maxTimeout" config for the \`retry\` module to use when fetching
+ packages.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.retry = flatOptions.retry || {}
+ flatOptions.retry.maxTimeout = obj[key]
+ },
+ }),
+ 'fetch-retry-mintimeout': new Definition('fetch-retry-mintimeout', {
+ default: 10000,
+ defaultDescription: '10000 (10 seconds)',
+ type: Number,
+ description: `
+ The "minTimeout" config for the \`retry\` module to use when fetching
+ packages.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.retry = flatOptions.retry || {}
+ flatOptions.retry.minTimeout = obj[key]
+ },
+ }),
+ 'fetch-timeout': new Definition('fetch-timeout', {
+ default: 5 * 60 * 1000,
+ defaultDescription: `${5 * 60 * 1000} (5 minutes)`,
+ type: Number,
+ description: `
+ The maximum amount of time to wait for HTTP requests to complete.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.timeout = obj[key]
+ },
+ }),
+ force: new Definition('force', {
+ default: false,
+ type: Boolean,
+ short: 'f',
+ description: `
+ Removes various protections against unfortunate side effects, common
+ mistakes, unnecessary performance degradation, and malicious input.
+
+ * Allow clobbering non-npm files in global installs.
+ * Allow the \`npm version\` command to work on an unclean git repository.
+ * Allow deleting the cache folder with \`npm cache clean\`.
+ * Allow installing packages that have an \`engines\` declaration
+ requiring a different version of npm.
+ * Allow installing packages that have an \`engines\` declaration
+ requiring a different version of \`node\`, even if \`--engine-strict\`
+ is enabled.
+ * Allow \`npm audit fix\` to install modules outside your stated
+ dependency range (including SemVer-major changes).
+ * Allow unpublishing all versions of a published package.
+ * Allow conflicting peerDependencies to be installed in the root project.
+ * Implicitly set \`--yes\` during \`npm init\`.
+ * Allow clobbering existing values in \`npm pkg\`
+ * Allow unpublishing of entire packages (not just a single version).
+
+ If you don't have a clear idea of what you want to do, it is strongly
+ recommended that you do not use this option!
+ `,
+ flatten,
+ }),
+ 'foreground-scripts': new Definition('foreground-scripts', {
+ default: false,
+ defaultDescription: `\`false\` unless when using \`npm pack\` or \`npm publish\` where it
+ defaults to \`true\``,
+ type: Boolean,
+ description: `
+ Run all build scripts (ie, \`preinstall\`, \`install\`, and
+ \`postinstall\`) scripts for installed packages in the foreground
+ process, sharing standard input, output, and error with the main npm
+ process.
+
+ Note that this will generally make installs run slower, and be much
+ noisier, but can be useful for debugging.
+ `,
+ flatten,
+ }),
+ 'format-package-lock': new Definition('format-package-lock', {
+ default: true,
+ type: Boolean,
+ description: `
+ Format \`package-lock.json\` or \`npm-shrinkwrap.json\` as a human
+ readable file.
+ `,
+ flatten,
+ }),
+ fund: new Definition('fund', {
+ default: true,
+ type: Boolean,
+ description: `
+ When "true" displays the message at the end of each \`npm install\`
+ acknowledging the number of dependencies looking for funding.
+ See [\`npm fund\`](/commands/npm-fund) for details.
+ `,
+ flatten,
+ }),
+ git: new Definition('git', {
+ default: 'git',
+ type: String,
+ description: `
+ The command to use for git commands. If git is installed on the
+ computer, but is not in the \`PATH\`, then set this to the full path to
+ the git binary.
+ `,
+ flatten,
+ }),
+ 'git-tag-version': new Definition('git-tag-version', {
+ default: true,
+ type: Boolean,
+ description: `
+ Tag the commit when using the \`npm version\` command. Setting this to
+ false results in no commit being made at all.
+ `,
+ flatten,
+ }),
+ global: new Definition('global', {
+ default: false,
+ type: Boolean,
+ short: 'g',
+ description: `
+ Operates in "global" mode, so that packages are installed into the
+ \`prefix\` folder instead of the current working directory. See
+ [folders](/configuring-npm/folders) for more on the differences in
+ behavior.
+
+ * packages are installed into the \`{prefix}/lib/node_modules\` folder,
+ instead of the current working directory.
+ * bin files are linked to \`{prefix}/bin\`
+ * man pages are linked to \`{prefix}/share/man\`
+ `,
+ flatten: (key, obj, flatOptions) => {
+ flatten(key, obj, flatOptions)
+ if (flatOptions.global) {
+ flatOptions.location = 'global'
+ }
+ },
+ }),
+ // the globalconfig has its default defined outside of this module
+ globalconfig: new Definition('globalconfig', {
+ type: path,
+ default: '',
+ defaultDescription: `
+ The global --prefix setting plus 'etc/npmrc'. For example,
+ '/usr/local/etc/npmrc'
+ `,
+ description: `
+ The config file to read for global config options.
+ `,
+ flatten,
+ }),
+ 'global-style': new Definition('global-style', {
+ default: false,
+ type: Boolean,
+ description: `
+ Only install direct dependencies in the top level \`node_modules\`,
+ but hoist on deeper dependencies.
+ Sets \`--install-strategy=shallow\`.
+ `,
+ deprecated: `
+ This option has been deprecated in favor of \`--install-strategy=shallow\`
+ `,
+ flatten (key, obj, flatOptions) {
+ if (obj[key]) {
+ obj['install-strategy'] = 'shallow'
+ flatOptions.installStrategy = 'shallow'
+ }
+ },
+ }),
+ heading: new Definition('heading', {
+ default: 'npm',
+ type: String,
+ description: `
+ The string that starts all the debugging log output.
+ `,
+ flatten,
+ }),
+ 'https-proxy': new Definition('https-proxy', {
+ default: null,
+ type: [null, url],
+ description: `
+ A proxy to use for outgoing https requests. If the \`HTTPS_PROXY\` or
+ \`https_proxy\` or \`HTTP_PROXY\` or \`http_proxy\` environment variables
+ are set, proxy settings will be honored by the underlying
+ \`make-fetch-happen\` library.
+ `,
+ flatten,
+ }),
+ 'if-present': new Definition('if-present', {
+ default: false,
+ type: Boolean,
+ envExport: false,
+ description: `
+ If true, npm will not exit with an error code when \`run-script\` is
+ invoked for a script that isn't defined in the \`scripts\` section of
+ \`package.json\`. This option can be used when it's desirable to
+ optionally run a script when it's present and fail if the script fails.
+ This is useful, for example, when running scripts that may only apply for
+ some builds in an otherwise generic CI setup.
+ `,
+ flatten,
+ }),
+ 'ignore-scripts': new Definition('ignore-scripts', {
+ default: false,
+ type: Boolean,
+ description: `
+ If true, npm does not run scripts specified in package.json files.
+
+ Note that commands explicitly intended to run a particular script, such
+ as \`npm start\`, \`npm stop\`, \`npm restart\`, \`npm test\`, and \`npm
+ run-script\` will still run their intended script if \`ignore-scripts\` is
+ set, but they will *not* run any pre- or post-scripts.
+ `,
+ flatten,
+ }),
+ include: new Definition('include', {
+ default: [],
+ type: [Array, 'prod', 'dev', 'optional', 'peer'],
+ description: `
+ Option that allows for defining which types of dependencies to install.
+
+ This is the inverse of \`--omit=\`.
+
+ Dependency types specified in \`--include\` will not be omitted,
+ regardless of the order in which omit/include are specified on the
+ command-line.
+ `,
+ flatten (key, obj, flatOptions) {
+ // just call the omit flattener, it reads from obj.include
+ definitions.omit.flatten('omit', obj, flatOptions)
+ },
+ }),
+ 'include-staged': new Definition('include-staged', {
+ default: false,
+ type: Boolean,
+ description: `
+ Allow installing "staged" published packages, as defined by [npm RFC PR
+ #92](https://github.com/npm/rfcs/pull/92).
+
+ This is experimental, and not implemented by the npm public registry.
+ `,
+ flatten,
+ }),
+ 'include-workspace-root': new Definition('include-workspace-root', {
+ default: false,
+ type: Boolean,
+ envExport: false,
+ description: `
+ Include the workspace root when workspaces are enabled for a command.
+
+ When false, specifying individual workspaces via the \`workspace\` config,
+ or all workspaces via the \`workspaces\` flag, will cause npm to operate only
+ on the specified workspaces, and not on the root project.
+ `,
+ flatten,
+ }),
+ 'init-author-email': new Definition('init-author-email', {
+ default: '',
+ hint: '',
+ type: String,
+ description: `
+ The value \`npm init\` should use by default for the package author's
+ email.
+ `,
+ }),
+ 'init-author-name': new Definition('init-author-name', {
+ default: '',
+ hint: '',
+ type: String,
+ description: `
+ The value \`npm init\` should use by default for the package author's name.
+ `,
+ }),
+ 'init-author-url': new Definition('init-author-url', {
+ default: '',
+ type: ['', url],
+ hint: '',
+ description: `
+ The value \`npm init\` should use by default for the package author's homepage.
+ `,
+ }),
+ 'init-license': new Definition('init-license', {
+ default: 'ISC',
+ hint: '',
+ type: String,
+ description: `
+ The value \`npm init\` should use by default for the package license.
+ `,
+ }),
+ 'init-module': new Definition('init-module', {
+ default: '~/.npm-init.js',
+ type: path,
+ hint: '',
+ description: `
+ A module that will be loaded by the \`npm init\` command. See the
+ documentation for the
+ [init-package-json](https://github.com/npm/init-package-json) module for
+ more information, or [npm init](/commands/npm-init).
+ `,
+ }),
+ 'init-version': new Definition('init-version', {
+ default: '1.0.0',
+ type: Semver,
+ hint: '',
+ description: `
+ The value that \`npm init\` should use by default for the package
+ version number, if not already set in package.json.
+ `,
+ }),
+ // these "aliases" are historically supported in .npmrc files, unfortunately
+ // They should be removed in a future npm version.
+ 'init.author.email': new Definition('init.author.email', {
+ default: '',
+ type: String,
+ deprecated: `
+ Use \`--init-author-email\` instead.`,
+ description: `
+ Alias for \`--init-author-email\`
+ `,
+ }),
+ 'init.author.name': new Definition('init.author.name', {
+ default: '',
+ type: String,
+ deprecated: `
+ Use \`--init-author-name\` instead.
+ `,
+ description: `
+ Alias for \`--init-author-name\`
+ `,
+ }),
+ 'init.author.url': new Definition('init.author.url', {
+ default: '',
+ type: ['', url],
+ deprecated: `
+ Use \`--init-author-url\` instead.
+ `,
+ description: `
+ Alias for \`--init-author-url\`
+ `,
+ }),
+ 'init.license': new Definition('init.license', {
+ default: 'ISC',
+ type: String,
+ deprecated: `
+ Use \`--init-license\` instead.
+ `,
+ description: `
+ Alias for \`--init-license\`
+ `,
+ }),
+ 'init.module': new Definition('init.module', {
+ default: '~/.npm-init.js',
+ type: path,
+ deprecated: `
+ Use \`--init-module\` instead.
+ `,
+ description: `
+ Alias for \`--init-module\`
+ `,
+ }),
+ 'init.version': new Definition('init.version', {
+ default: '1.0.0',
+ type: Semver,
+ deprecated: `
+ Use \`--init-version\` instead.
+ `,
+ description: `
+ Alias for \`--init-version\`
+ `,
+ }),
+ 'install-links': new Definition('install-links', {
+ default: false,
+ type: Boolean,
+ description: `
+ When set file: protocol dependencies will be packed and installed as
+ regular dependencies instead of creating a symlink. This option has
+ no effect on workspaces.
+ `,
+ flatten,
+ }),
+ 'install-strategy': new Definition('install-strategy', {
+ default: 'hoisted',
+ type: ['hoisted', 'nested', 'shallow', 'linked'],
+ description: `
+ Sets the strategy for installing packages in node_modules.
+ hoisted (default): Install non-duplicated in top-level, and duplicated as
+ necessary within directory structure.
+ nested: (formerly --legacy-bundling) install in place, no hoisting.
+ shallow (formerly --global-style) only install direct deps at top-level.
+ linked: (experimental) install in node_modules/.store, link in place,
+ unhoisted.
+ `,
+ flatten,
+ }),
+ json: new Definition('json', {
+ default: false,
+ type: Boolean,
+ description: `
+ Whether or not to output JSON data, rather than the normal output.
+
+ * In \`npm pkg set\` it enables parsing set values with JSON.parse()
+ before saving them to your \`package.json\`.
+
+ Not supported by all npm commands.
+ `,
+ flatten,
+ }),
+ key: new Definition('key', {
+ default: null,
+ type: [null, String],
+ description: `
+ A client key to pass when accessing the registry. Values should be in
+ PEM format with newlines replaced by the string "\\n". For example:
+
+ \`\`\`ini
+ key="-----BEGIN PRIVATE KEY-----\\nXXXX\\nXXXX\\n-----END PRIVATE KEY-----"
+ \`\`\`
+
+ It is _not_ the path to a key file, though you can set a registry-scoped
+ "keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem".
+ `,
+ deprecated: `
+ \`key\` and \`cert\` are no longer used for most registry operations.
+ Use registry scoped \`keyfile\` and \`certfile\` instead.
+ Example:
+ //other-registry.tld/:keyfile=/path/to/key.pem
+ //other-registry.tld/:certfile=/path/to/cert.crt
+ `,
+ flatten,
+ }),
+ 'legacy-bundling': new Definition('legacy-bundling', {
+ default: false,
+ type: Boolean,
+ description: `
+ Instead of hoisting package installs in \`node_modules\`, install packages
+ in the same manner that they are depended on. This may cause very deep
+ directory structures and duplicate package installs as there is no
+ de-duplicating.
+ Sets \`--install-strategy=nested\`.
+ `,
+ deprecated: `
+ This option has been deprecated in favor of \`--install-strategy=nested\`
+ `,
+ flatten (key, obj, flatOptions) {
+ if (obj[key]) {
+ obj['install-strategy'] = 'nested'
+ flatOptions.installStrategy = 'nested'
+ }
+ },
+ }),
+ 'legacy-peer-deps': new Definition('legacy-peer-deps', {
+ default: false,
+ type: Boolean,
+ description: `
+ Causes npm to completely ignore \`peerDependencies\` when building a
+ package tree, as in npm versions 3 through 6.
+
+ If a package cannot be installed because of overly strict
+ \`peerDependencies\` that collide, it provides a way to move forward
+ resolving the situation.
+
+ This differs from \`--omit=peer\`, in that \`--omit=peer\` will avoid
+ unpacking \`peerDependencies\` on disk, but will still design a tree such
+ that \`peerDependencies\` _could_ be unpacked in a correct place.
+
+ Use of \`legacy-peer-deps\` is not recommended, as it will not enforce
+ the \`peerDependencies\` contract that meta-dependencies may rely on.
+ `,
+ flatten,
+ }),
+ libc: new Definition('libc', {
+ default: null,
+ type: [null, String],
+ description: `
+ Override libc of native modules to install.
+ Acceptable values are same as \`libc\` field of package.json
+ `,
+ flatten,
+ }),
+ link: new Definition('link', {
+ default: false,
+ type: Boolean,
+ description: `
+ Used with \`npm ls\`, limiting output to only those packages that are
+ linked.
+ `,
+ }),
+ 'local-address': new Definition('local-address', {
+ default: null,
+ type: getLocalAddresses(),
+ typeDescription: 'IP Address',
+ description: `
+ The IP address of the local interface to use when making connections to
+ the npm registry. Must be IPv4 in versions of Node prior to 0.12.
+ `,
+ flatten,
+ }),
+ location: new Definition('location', {
+ default: 'user',
+ short: 'L',
+ type: [
+ 'global',
+ 'user',
+ 'project',
+ ],
+ defaultDescription: `
+ "user" unless \`--global\` is passed, which will also set this value to "global"
+ `,
+ description: `
+ When passed to \`npm config\` this refers to which config file to use.
+
+ When set to "global" mode, packages are installed into the \`prefix\` folder
+ instead of the current working directory. See
+ [folders](/configuring-npm/folders) for more on the differences in behavior.
+
+ * packages are installed into the \`{prefix}/lib/node_modules\` folder,
+ instead of the current working directory.
+ * bin files are linked to \`{prefix}/bin\`
+ * man pages are linked to \`{prefix}/share/man\`
+ `,
+ flatten: (key, obj, flatOptions) => {
+ flatten(key, obj, flatOptions)
+ if (flatOptions.global) {
+ flatOptions.location = 'global'
+ }
+ if (obj.location === 'global') {
+ flatOptions.global = true
+ }
+ },
+ }),
+ 'lockfile-version': new Definition('lockfile-version', {
+ default: null,
+ type: [null, 1, 2, 3, '1', '2', '3'],
+ defaultDescription: `
+ Version 3 if no lockfile, auto-converting v1 lockfiles to v3, otherwise
+ maintain current lockfile version.`,
+ description: `
+ Set the lockfile format version to be used in package-lock.json and
+ npm-shrinkwrap-json files. Possible options are:
+
+ 1: The lockfile version used by npm versions 5 and 6. Lacks some data that
+ is used during the install, resulting in slower and possibly less
+ deterministic installs. Prevents lockfile churn when interoperating with
+ older npm versions.
+
+ 2: The default lockfile version used by npm version 7 and 8. Includes both
+ the version 1 lockfile data and version 3 lockfile data, for maximum
+ determinism and interoperability, at the expense of more bytes on disk.
+
+ 3: Only the new lockfile information introduced in npm version 7. Smaller
+ on disk than lockfile version 2, but not interoperable with older npm
+ versions. Ideal if all users are on npm version 7 and higher.
+ `,
+ flatten: (key, obj, flatOptions) => {
+ flatOptions.lockfileVersion = obj[key] && parseInt(obj[key], 10)
+ },
+ }),
+ loglevel: new Definition('loglevel', {
+ default: 'notice',
+ type: [
+ 'silent',
+ 'error',
+ 'warn',
+ 'notice',
+ 'http',
+ 'info',
+ 'verbose',
+ 'silly',
+ ],
+ description: `
+ What level of logs to report. All logs are written to a debug log,
+ with the path to that file printed if the execution of a command fails.
+
+ Any logs of a higher level than the setting are shown. The default is
+ "notice".
+
+ See also the \`foreground-scripts\` config.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.silent = obj[key] === 'silent'
+ },
+ }),
+ 'logs-dir': new Definition('logs-dir', {
+ default: null,
+ type: [null, path],
+ defaultDescription: `
+ A directory named \`_logs\` inside the cache
+ `,
+ description: `
+ The location of npm's log directory. See [\`npm
+ logging\`](/using-npm/logging) for more information.
+ `,
+ }),
+ 'logs-max': new Definition('logs-max', {
+ default: 10,
+ type: Number,
+ description: `
+ The maximum number of log files to store.
+
+ If set to 0, no log files will be written for the current run.
+ `,
+ }),
+ long: new Definition('long', {
+ default: false,
+ type: Boolean,
+ short: 'l',
+ description: `
+ Show extended information in \`ls\`, \`search\`, and \`help-search\`.
+ `,
+ }),
+ maxsockets: new Definition('maxsockets', {
+ default: 15,
+ type: Number,
+ description: `
+ The maximum number of connections to use per origin (protocol/host/port
+ combination).
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.maxSockets = obj[key]
+ },
+ }),
+ message: new Definition('message', {
+ default: '%s',
+ type: String,
+ short: 'm',
+ description: `
+ Commit message which is used by \`npm version\` when creating version commit.
+
+ Any "%s" in the message will be replaced with the version number.
+ `,
+ flatten,
+ }),
+ 'node-options': new Definition('node-options', {
+ default: null,
+ type: [null, String],
+ description: `
+ Options to pass through to Node.js via the \`NODE_OPTIONS\` environment
+ variable. This does not impact how npm itself is executed but it does
+ impact how lifecycle scripts are called.
+ `,
+ }),
+ noproxy: new Definition('noproxy', {
+ default: '',
+ defaultDescription: `
+ The value of the NO_PROXY environment variable
+ `,
+ type: [String, Array],
+ description: `
+ Domain extensions that should bypass any proxies.
+
+ Also accepts a comma-delimited string.
+ `,
+ flatten (key, obj, flatOptions) {
+ if (Array.isArray(obj[key])) {
+ flatOptions.noProxy = obj[key].join(',')
+ } else {
+ flatOptions.noProxy = obj[key]
+ }
+ },
+ }),
+ offline: new Definition('offline', {
+ default: false,
+ type: Boolean,
+ description: `
+ Force offline mode: no network requests will be done during install. To allow
+ the CLI to fill in missing cache data, see \`--prefer-offline\`.
+ `,
+ flatten,
+ }),
+ omit: new Definition('omit', {
+ default: process.env.NODE_ENV === 'production' ? ['dev'] : [],
+ defaultDescription: `
+ 'dev' if the \`NODE_ENV\` environment variable is set to 'production',
+ otherwise empty.
+ `,
+ type: [Array, 'dev', 'optional', 'peer'],
+ description: `
+ Dependency types to omit from the installation tree on disk.
+
+ Note that these dependencies _are_ still resolved and added to the
+ \`package-lock.json\` or \`npm-shrinkwrap.json\` file. They are just
+ not physically installed on disk.
+
+ If a package type appears in both the \`--include\` and \`--omit\`
+ lists, then it will be included.
+
+ If the resulting omit list includes \`'dev'\`, then the \`NODE_ENV\`
+ environment variable will be set to \`'production'\` for all lifecycle
+ scripts.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.omit = buildOmitList(obj)
+ },
+ }),
+ 'omit-lockfile-registry-resolved': new Definition('omit-lockfile-registry-resolved', {
+ default: false,
+ type: Boolean,
+ description: `
+ This option causes npm to create lock files without a \`resolved\` key for
+ registry dependencies. Subsequent installs will need to resolve tarball
+ endpoints with the configured registry, likely resulting in a longer install
+ time.
+ `,
+ flatten,
+ }),
+ only: new Definition('only', {
+ default: null,
+ type: [null, 'prod', 'production'],
+ deprecated: `
+ Use \`--omit=dev\` to omit dev dependencies from the install.
+ `,
+ description: `
+ When set to \`prod\` or \`production\`, this is an alias for
+ \`--omit=dev\`.
+ `,
+ flatten (key, obj, flatOptions) {
+ definitions.omit.flatten('omit', obj, flatOptions)
+ },
+ }),
+ optional: new Definition('optional', {
+ default: null,
+ type: [null, Boolean],
+ deprecated: `
+ Use \`--omit=optional\` to exclude optional dependencies, or
+ \`--include=optional\` to include them.
+
+ Default value does install optional deps unless otherwise omitted.
+ `,
+ description: `
+ Alias for --include=optional or --omit=optional
+ `,
+ flatten (key, obj, flatOptions) {
+ definitions.omit.flatten('omit', obj, flatOptions)
+ },
+ }),
+ os: new Definition('os', {
+ default: null,
+ type: [null, String],
+ description: `
+ Override OS of native modules to install.
+ Acceptable values are same as \`os\` field of package.json,
+ which comes from \`process.platform\`.
+ `,
+ flatten,
+ }),
+ otp: new Definition('otp', {
+ default: null,
+ type: [null, String],
+ description: `
+ This is a one-time password from a two-factor authenticator. It's needed
+ when publishing or changing package permissions with \`npm access\`.
+
+ If not set, and a registry response fails with a challenge for a one-time
+ password, npm will prompt on the command line for one.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatten(key, obj, flatOptions)
+ if (obj.otp) {
+ obj['auth-type'] = 'legacy'
+ flatten('auth-type', obj, flatOptions)
+ }
+ },
+ }),
+ package: new Definition('package', {
+ default: [],
+ hint: '',
+ type: [String, Array],
+ description: `
+ The package or packages to install for [\`npm exec\`](/commands/npm-exec)
+ `,
+ flatten,
+ }),
+ 'package-lock': new Definition('package-lock', {
+ default: true,
+ type: Boolean,
+ description: `
+ If set to false, then ignore \`package-lock.json\` files when installing.
+ This will also prevent _writing_ \`package-lock.json\` if \`save\` is
+ true.
+ `,
+ flatten: (key, obj, flatOptions) => {
+ flatten(key, obj, flatOptions)
+ if (flatOptions.packageLockOnly) {
+ flatOptions.packageLock = true
+ }
+ },
+ }),
+ 'package-lock-only': new Definition('package-lock-only', {
+ default: false,
+ type: Boolean,
+ description: `
+ If set to true, the current operation will only use the \`package-lock.json\`,
+ ignoring \`node_modules\`.
+
+ For \`update\` this means only the \`package-lock.json\` will be updated,
+ instead of checking \`node_modules\` and downloading dependencies.
+
+ For \`list\` this means the output will be based on the tree described by the
+ \`package-lock.json\`, rather than the contents of \`node_modules\`.
+ `,
+ flatten: (key, obj, flatOptions) => {
+ flatten(key, obj, flatOptions)
+ if (flatOptions.packageLockOnly) {
+ flatOptions.packageLock = true
+ }
+ },
+ }),
+ 'pack-destination': new Definition('pack-destination', {
+ default: '.',
+ type: String,
+ description: `
+ Directory in which \`npm pack\` will save tarballs.
+ `,
+ flatten,
+ }),
+ parseable: new Definition('parseable', {
+ default: false,
+ type: Boolean,
+ short: 'p',
+ description: `
+ Output parseable results from commands that write to standard output. For
+ \`npm search\`, this will be tab-separated table format.
+ `,
+ flatten,
+ }),
+ 'prefer-dedupe': new Definition('prefer-dedupe', {
+ default: false,
+ type: Boolean,
+ description: `
+ Prefer to deduplicate packages if possible, rather than
+ choosing a newer version of a dependency.
+ `,
+ flatten,
+ }),
+ 'prefer-offline': new Definition('prefer-offline', {
+ default: false,
+ type: Boolean,
+ description: `
+ If true, staleness checks for cached data will be bypassed, but missing
+ data will be requested from the server. To force full offline mode, use
+ \`--offline\`.
+ `,
+ flatten,
+ }),
+ 'prefer-online': new Definition('prefer-online', {
+ default: false,
+ type: Boolean,
+ description: `
+ If true, staleness checks for cached data will be forced, making the CLI
+ look for updates immediately even for fresh package data.
+ `,
+ flatten,
+ }),
+ // `prefix` has its default defined outside of this module
+ prefix: new Definition('prefix', {
+ type: path,
+ short: 'C',
+ default: '',
+ defaultDescription: `
+ In global mode, the folder where the node executable is installed.
+ Otherwise, the nearest parent folder containing either a package.json
+ file or a node_modules folder.
+ `,
+ description: `
+ The location to install global items. If set on the command line, then
+ it forces non-global commands to run in the specified folder.
+ `,
+ }),
+ preid: new Definition('preid', {
+ default: '',
+ hint: 'prerelease-id',
+ type: String,
+ description: `
+ The "prerelease identifier" to use as a prefix for the "prerelease" part
+ of a semver. Like the \`rc\` in \`1.2.0-rc.8\`.
+ `,
+ flatten,
+ }),
+ production: new Definition('production', {
+ default: null,
+ type: [null, Boolean],
+ deprecated: 'Use `--omit=dev` instead.',
+ description: 'Alias for `--omit=dev`',
+ flatten (key, obj, flatOptions) {
+ definitions.omit.flatten('omit', obj, flatOptions)
+ },
+ }),
+ progress: new Definition('progress', {
+ default: !ciInfo.isCI,
+ defaultDescription: `
+ \`true\` unless running in a known CI system
+ `,
+ type: Boolean,
+ description: `
+ When set to \`true\`, npm will display a progress bar during time
+ intensive operations, if \`process.stderr\` is a TTY.
+
+ Set to \`false\` to suppress the progress bar.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.progress = !obj.progress ? false
+ : !!process.stderr.isTTY && process.env.TERM !== 'dumb'
+ },
+ }),
+ provenance: new Definition('provenance', {
+ default: false,
+ type: Boolean,
+ exclusive: ['provenance-file'],
+ description: `
+ When publishing from a supported cloud CI/CD system, the package will be
+ publicly linked to where it was built and published from.
+ `,
+ flatten,
+ }),
+ 'provenance-file': new Definition('provenance-file', {
+ default: null,
+ type: path,
+ hint: '',
+ exclusive: ['provenance'],
+ description: `
+ When publishing, the provenance bundle at the given path will be used.
+ `,
+ flatten,
+ }),
+ proxy: new Definition('proxy', {
+ default: null,
+ type: [null, false, url], // allow proxy to be disabled explicitly
+ description: `
+ A proxy to use for outgoing http requests. If the \`HTTP_PROXY\` or
+ \`http_proxy\` environment variables are set, proxy settings will be
+ honored by the underlying \`request\` library.
+ `,
+ flatten,
+ }),
+ 'read-only': new Definition('read-only', {
+ default: false,
+ type: Boolean,
+ description: `
+ This is used to mark a token as unable to publish when configuring
+ limited access tokens with the \`npm token create\` command.
+ `,
+ flatten,
+ }),
+ 'rebuild-bundle': new Definition('rebuild-bundle', {
+ default: true,
+ type: Boolean,
+ description: `
+ Rebuild bundled dependencies after installation.
+ `,
+ flatten,
+ }),
+ registry: new Definition('registry', {
+ default: 'https://registry.npmjs.org/',
+ type: url,
+ description: `
+ The base URL of the npm registry.
+ `,
+ flatten,
+ }),
+ 'replace-registry-host': new Definition('replace-registry-host', {
+ default: 'npmjs',
+ hint: ' | hostname',
+ type: ['npmjs', 'never', 'always', String],
+ description: `
+ Defines behavior for replacing the registry host in a lockfile with the
+ configured registry.
+
+ The default behavior is to replace package dist URLs from the default
+ registry (https://registry.npmjs.org) to the configured registry. If set to
+ "never", then use the registry value. If set to "always", then replace the
+ registry host with the configured host every time.
+
+ You may also specify a bare hostname (e.g., "registry.npmjs.org").
+ `,
+ flatten,
+ }),
+ save: new Definition('save', {
+ default: true,
+ defaultDescription: `\`true\` unless when using \`npm update\` where it
+ defaults to \`false\``,
+ usage: '-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle',
+ type: Boolean,
+ short: 'S',
+ description: `
+ Save installed packages to a \`package.json\` file as dependencies.
+
+ When used with the \`npm rm\` command, removes the dependency from
+ \`package.json\`.
+
+ Will also prevent writing to \`package-lock.json\` if set to \`false\`.
+ `,
+ flatten,
+ }),
+ 'save-bundle': new Definition('save-bundle', {
+ default: false,
+ type: Boolean,
+ short: 'B',
+ description: `
+ If a package would be saved at install time by the use of \`--save\`,
+ \`--save-dev\`, or \`--save-optional\`, then also put it in the
+ \`bundleDependencies\` list.
+
+ Ignored if \`--save-peer\` is set, since peerDependencies cannot be bundled.
+ `,
+ flatten (key, obj, flatOptions) {
+ // XXX update arborist to just ignore it if resulting saveType is peer
+ // otherwise this won't have the expected effect:
+ //
+ // npm config set save-peer true
+ // npm i foo --save-bundle --save-prod <-- should bundle
+ flatOptions.saveBundle = obj['save-bundle'] && !obj['save-peer']
+ },
+ }),
+ 'save-dev': new Definition('save-dev', {
+ default: false,
+ type: Boolean,
+ short: 'D',
+ description: `
+ Save installed packages to a package.json file as \`devDependencies\`.
+ `,
+ flatten (key, obj, flatOptions) {
+ if (!obj[key]) {
+ if (flatOptions.saveType === 'dev') {
+ delete flatOptions.saveType
+ }
+ return
}
- return
- }
- flatOptions.saveType = 'dev'
- },
-})
-
-define('save-exact', {
- default: false,
- type: Boolean,
- short: 'E',
- description: `
- Dependencies saved to package.json will be configured with an exact
- version rather than using npm's default semver range operator.
- `,
- flatten (key, obj, flatOptions) {
- // just call the save-prefix flattener, it reads from obj['save-exact']
- definitions['save-prefix'].flatten('save-prefix', obj, flatOptions)
- },
-})
-
-define('save-optional', {
- default: false,
- type: Boolean,
- short: 'O',
- description: `
- Save installed packages to a package.json file as
- \`optionalDependencies\`.
- `,
- flatten (key, obj, flatOptions) {
- if (!obj[key]) {
- if (flatOptions.saveType === 'optional') {
- delete flatOptions.saveType
- } else if (flatOptions.saveType === 'peerOptional') {
- flatOptions.saveType = 'peer'
+ flatOptions.saveType = 'dev'
+ },
+ }),
+ 'save-exact': new Definition('save-exact', {
+ default: false,
+ type: Boolean,
+ short: 'E',
+ description: `
+ Dependencies saved to package.json will be configured with an exact
+ version rather than using npm's default semver range operator.
+ `,
+ flatten (key, obj, flatOptions) {
+ // just call the save-prefix flattener, it reads from obj['save-exact']
+ definitions['save-prefix'].flatten('save-prefix', obj, flatOptions)
+ },
+ }),
+ 'save-optional': new Definition('save-optional', {
+ default: false,
+ type: Boolean,
+ short: 'O',
+ description: `
+ Save installed packages to a package.json file as
+ \`optionalDependencies\`.
+ `,
+ flatten (key, obj, flatOptions) {
+ if (!obj[key]) {
+ if (flatOptions.saveType === 'optional') {
+ delete flatOptions.saveType
+ } else if (flatOptions.saveType === 'peerOptional') {
+ flatOptions.saveType = 'peer'
+ }
+ return
}
- return
- }
- if (flatOptions.saveType === 'peerOptional') {
- return
- }
+ if (flatOptions.saveType === 'peerOptional') {
+ return
+ }
- if (flatOptions.saveType === 'peer') {
- flatOptions.saveType = 'peerOptional'
- } else {
- flatOptions.saveType = 'optional'
- }
- },
-})
-
-define('save-peer', {
- default: false,
- type: Boolean,
- description: `
- Save installed packages to a package.json file as \`peerDependencies\`
- `,
- flatten (key, obj, flatOptions) {
- if (!obj[key]) {
if (flatOptions.saveType === 'peer') {
- delete flatOptions.saveType
- } else if (flatOptions.saveType === 'peerOptional') {
+ flatOptions.saveType = 'peerOptional'
+ } else {
flatOptions.saveType = 'optional'
}
- return
- }
-
- if (flatOptions.saveType === 'peerOptional') {
- return
- }
-
- if (flatOptions.saveType === 'optional') {
- flatOptions.saveType = 'peerOptional'
- } else {
- flatOptions.saveType = 'peer'
- }
- },
-})
-
-define('save-prefix', {
- default: '^',
- type: String,
- description: `
- Configure how versions of packages installed to a package.json file via
- \`--save\` or \`--save-dev\` get prefixed.
-
- For example if a package has version \`1.2.3\`, by default its version is
- set to \`^1.2.3\` which allows minor upgrades for that package, but after
- \`npm config set save-prefix='~'\` it would be set to \`~1.2.3\` which
- only allows patch upgrades.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.savePrefix = obj['save-exact'] ? '' : obj['save-prefix']
- obj['save-prefix'] = flatOptions.savePrefix
- },
-})
-
-define('save-prod', {
- default: false,
- type: Boolean,
- short: 'P',
- description: `
- Save installed packages into \`dependencies\` specifically. This is
- useful if a package already exists in \`devDependencies\` or
- \`optionalDependencies\`, but you want to move it to be a non-optional
- production dependency.
-
- This is the default behavior if \`--save\` is true, and neither
- \`--save-dev\` or \`--save-optional\` are true.
- `,
- flatten (key, obj, flatOptions) {
- if (!obj[key]) {
- if (flatOptions.saveType === 'prod') {
- delete flatOptions.saveType
+ },
+ }),
+ 'save-peer': new Definition('save-peer', {
+ default: false,
+ type: Boolean,
+ description: `
+ Save installed packages to a package.json file as \`peerDependencies\`
+ `,
+ flatten (key, obj, flatOptions) {
+ if (!obj[key]) {
+ if (flatOptions.saveType === 'peer') {
+ delete flatOptions.saveType
+ } else if (flatOptions.saveType === 'peerOptional') {
+ flatOptions.saveType = 'optional'
+ }
+ return
}
- return
- }
-
- flatOptions.saveType = 'prod'
- },
-})
-
-define('scope', {
- default: '',
- defaultDescription: `
- the scope of the current project, if any, or ""
- `,
- type: String,
- hint: '<@scope>',
- description: `
- Associate an operation with a scope for a scoped registry.
-
- Useful when logging in to or out of a private registry:
-
- \`\`\`
- # log in, linking the scope to the custom registry
- npm login --scope=@mycorp --registry=https://registry.mycorp.com
- # log out, removing the link and the auth token
- npm logout --scope=@mycorp
- \`\`\`
-
- This will cause \`@mycorp\` to be mapped to the registry for future
- installation of packages specified according to the pattern
- \`@mycorp/package\`.
-
- This will also cause \`npm init\` to create a scoped package.
-
- \`\`\`
- # accept all defaults, and create a package named "@foo/whatever",
- # instead of just named "whatever"
- npm init --scope=@foo --yes
- \`\`\`
- `,
- flatten (key, obj, flatOptions) {
- const value = obj[key]
- const scope = value && !/^@/.test(value) ? `@${value}` : value
- flatOptions.scope = scope
- // projectScope is kept for compatibility with npm-registry-fetch
- flatOptions.projectScope = scope
- },
-})
-
-define('script-shell', {
- default: null,
- defaultDescription: `
- '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
- `,
- type: [null, String],
- description: `
- The shell to use for scripts run with the \`npm exec\`,
- \`npm run\` and \`npm init \` commands.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.scriptShell = obj[key] || undefined
- },
-})
-
-define('searchexclude', {
- default: '',
- type: String,
- description: `
- Space-separated options that limit the results from search.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.search = flatOptions.search || { limit: 20 }
- flatOptions.search.exclude = obj[key].toLowerCase()
- },
-})
-
-define('searchlimit', {
- default: 20,
- type: Number,
- description: `
- Number of items to limit search results to. Will not apply at all to
- legacy searches.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.search = flatOptions.search || {}
- flatOptions.search.limit = obj[key]
- },
-})
-
-define('searchopts', {
- default: '',
- type: String,
- description: `
- Space-separated options that are always passed to search.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.search = flatOptions.search || { limit: 20 }
- flatOptions.search.opts = querystring.parse(obj[key])
- },
-})
-
-define('searchstaleness', {
- default: 15 * 60,
- type: Number,
- description: `
- The age of the cache, in seconds, before another registry request is made
- if using legacy search endpoint.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.search = flatOptions.search || { limit: 20 }
- flatOptions.search.staleness = obj[key]
- },
-})
-
-define('shell', {
- default: shell,
- defaultDescription: `
- SHELL environment variable, or "bash" on Posix, or "cmd.exe" on Windows
- `,
- type: String,
- description: `
- The shell to run for the \`npm explore\` command.
- `,
- flatten,
-})
-
-define('shrinkwrap', {
- default: true,
- type: Boolean,
- deprecated: `
- Use the --package-lock setting instead.
- `,
- description: `
- Alias for --package-lock
- `,
- flatten (key, obj, flatOptions) {
- obj['package-lock'] = obj.shrinkwrap
- definitions['package-lock'].flatten('package-lock', obj, flatOptions)
- },
-})
-
-define('sign-git-commit', {
- default: false,
- type: Boolean,
- description: `
- If set to true, then the \`npm version\` command will commit the new
- package version using \`-S\` to add a signature.
-
- Note that git requires you to have set up GPG keys in your git configs
- for this to work properly.
- `,
- flatten,
-})
-
-define('sign-git-tag', {
- default: false,
- type: Boolean,
- description: `
- If set to true, then the \`npm version\` command will tag the version
- using \`-s\` to add a signature.
-
- Note that git requires you to have set up GPG keys in your git configs
- for this to work properly.
- `,
- flatten,
-})
-
-define('strict-peer-deps', {
- default: false,
- type: Boolean,
- description: `
- If set to \`true\`, and \`--legacy-peer-deps\` is not set, then _any_
- conflicting \`peerDependencies\` will be treated as an install failure,
- even if npm could reasonably guess the appropriate resolution based on
- non-peer dependency relationships.
-
- By default, conflicting \`peerDependencies\` deep in the dependency graph
- will be resolved using the nearest non-peer dependency specification,
- even if doing so will result in some packages receiving a peer dependency
- outside the range set in their package's \`peerDependencies\` object.
-
- When such an override is performed, a warning is printed, explaining the
- conflict and the packages involved. If \`--strict-peer-deps\` is set,
- then this warning is treated as a failure.
- `,
- flatten,
-})
-
-define('strict-ssl', {
- default: true,
- type: Boolean,
- description: `
- Whether or not to do SSL key validation when making requests to the
- registry via https.
-
- See also the \`ca\` config.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.strictSSL = obj[key]
- },
-})
-
-define('tag', {
- default: 'latest',
- type: String,
- description: `
- If you ask npm to install a package and don't tell it a specific version,
- then it will install the specified tag.
-
- Also the tag that is added to the package@version specified by the \`npm
- tag\` command, if no explicit tag is given.
-
- When used by the \`npm diff\` command, this is the tag used to fetch the
- tarball that will be compared with the local files by default.
- `,
- flatten (key, obj, flatOptions) {
- flatOptions.defaultTag = obj[key]
- },
-})
-
-define('tag-version-prefix', {
- default: 'v',
- type: String,
- description: `
- If set, alters the prefix used when tagging a new version when performing
- a version increment using \`npm version\`. To remove the prefix
- altogether, set it to the empty string: \`""\`.
-
- Because other tools may rely on the convention that npm version tags look
- like \`v1.0.0\`, _only use this property if it is absolutely necessary_.
- In particular, use care when overriding this setting for public packages.
- `,
- flatten,
-})
-
-define('timing', {
- default: false,
- type: Boolean,
- description: `
- If true, writes timing information to a process specific json file in
- the cache or \`logs-dir\`. The file name ends with \`-timing.json\`.
-
- You can quickly view it with this [json](https://npm.im/json) command
- line: \`cat ~/.npm/_logs/*-timing.json | npm exec -- json -g\`.
-
- Timing information will also be reported in the terminal. To suppress this
- while still writing the timing file, use \`--silent\`.
- `,
-})
-
-define('umask', {
- default: 0,
- type: Umask,
- description: `
- The "umask" value to use when setting the file creation mode on files and
- folders.
-
- Folders and executables are given a mode which is \`0o777\` masked
- against this value. Other files are given a mode which is \`0o666\`
- masked against this value.
-
- Note that the underlying system will _also_ apply its own umask value to
- files and folders that are created, and npm does not circumvent this, but
- rather adds the \`--umask\` config to it.
-
- Thus, the effective default umask value on most POSIX systems is 0o22,
- meaning that folders and executables are created with a mode of 0o755 and
- other files are created with a mode of 0o644.
- `,
- flatten,
-})
-
-define('unicode', {
- default: unicode,
- defaultDescription: `
- false on windows, true on mac/unix systems with a unicode locale, as
- defined by the \`LC_ALL\`, \`LC_CTYPE\`, or \`LANG\` environment variables.
- `,
- type: Boolean,
- description: `
- When set to true, npm uses unicode characters in the tree output. When
- false, it uses ascii characters instead of unicode glyphs.
- `,
- flatten,
-})
-
-define('update-notifier', {
- default: true,
- type: Boolean,
- description: `
- Set to false to suppress the update notification when using an older
- version of npm than the latest.
- `,
-})
-
-define('usage', {
- default: false,
- type: Boolean,
- short: ['?', 'H', 'h'],
- description: `
- Show short usage output about the command specified.
- `,
-})
-
-define('user-agent', {
- default: 'npm/{npm-version} ' +
- 'node/{node-version} ' +
- '{platform} ' +
- '{arch} ' +
- 'workspaces/{workspaces} ' +
- '{ci}',
- type: String,
- description: `
- Sets the User-Agent request header. The following fields are replaced
- with their actual counterparts:
-
- * \`{npm-version}\` - The npm version in use
- * \`{node-version}\` - The Node.js version in use
- * \`{platform}\` - The value of \`process.platform\`
- * \`{arch}\` - The value of \`process.arch\`
- * \`{workspaces}\` - Set to \`true\` if the \`workspaces\` or \`workspace\`
- options are set.
- * \`{ci}\` - The value of the \`ci-name\` config, if set, prefixed with
- \`ci/\`, or an empty string if \`ci-name\` is empty.
- `,
- flatten (key, obj, flatOptions) {
- const value = obj[key]
- const ciName = ciInfo.name?.toLowerCase().split(' ').join('-') || null
- let inWorkspaces = false
- if (obj.workspaces || obj.workspace && obj.workspace.length) {
- inWorkspaces = true
- }
- flatOptions.userAgent =
- value.replace(/\{node-version\}/gi, process.version)
- .replace(/\{npm-version\}/gi, obj['npm-version'])
- .replace(/\{platform\}/gi, process.platform)
- .replace(/\{arch\}/gi, process.arch)
- .replace(/\{workspaces\}/gi, inWorkspaces)
- .replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
- .trim()
-
- // We can't clobber the original or else subsequent flattening will fail
- // (i.e. when we change the underlying config values)
- // obj[key] = flatOptions.userAgent
-
- // user-agent is a unique kind of config item that gets set from a template
- // and ends up translated. Because of this, the normal "should we set this
- // to process.env also doesn't work
- process.env.npm_config_user_agent = flatOptions.userAgent
- },
-})
-
-define('userconfig', {
- default: '~/.npmrc',
- type: path,
- description: `
- The location of user-level configuration settings.
-
- This may be overridden by the \`npm_config_userconfig\` environment
- variable or the \`--userconfig\` command line option, but may _not_
- be overridden by settings in the \`globalconfig\` file.
- `,
-})
-
-define('version', {
- default: false,
- type: Boolean,
- short: 'v',
- description: `
- If true, output the npm version and exit successfully.
-
- Only relevant when specified explicitly on the command line.
- `,
-})
-
-define('versions', {
- default: false,
- type: Boolean,
- description: `
- If true, output the npm version as well as node's \`process.versions\`
- map and the version in the current working directory's \`package.json\`
- file if one exists, and exit successfully.
+ if (flatOptions.saveType === 'peerOptional') {
+ return
+ }
- Only relevant when specified explicitly on the command line.
- `,
-})
+ if (flatOptions.saveType === 'optional') {
+ flatOptions.saveType = 'peerOptional'
+ } else {
+ flatOptions.saveType = 'peer'
+ }
+ },
+ }),
+ 'save-prefix': new Definition('save-prefix', {
+ default: '^',
+ type: String,
+ description: `
+ Configure how versions of packages installed to a package.json file via
+ \`--save\` or \`--save-dev\` get prefixed.
+
+ For example if a package has version \`1.2.3\`, by default its version is
+ set to \`^1.2.3\` which allows minor upgrades for that package, but after
+ \`npm config set save-prefix='~'\` it would be set to \`~1.2.3\` which
+ only allows patch upgrades.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.savePrefix = obj['save-exact'] ? '' : obj['save-prefix']
+ obj['save-prefix'] = flatOptions.savePrefix
+ },
+ }),
+ 'save-prod': new Definition('save-prod', {
+ default: false,
+ type: Boolean,
+ short: 'P',
+ description: `
+ Save installed packages into \`dependencies\` specifically. This is
+ useful if a package already exists in \`devDependencies\` or
+ \`optionalDependencies\`, but you want to move it to be a non-optional
+ production dependency.
+
+ This is the default behavior if \`--save\` is true, and neither
+ \`--save-dev\` or \`--save-optional\` are true.
+ `,
+ flatten (key, obj, flatOptions) {
+ if (!obj[key]) {
+ if (flatOptions.saveType === 'prod') {
+ delete flatOptions.saveType
+ }
+ return
+ }
-define('viewer', {
- default: isWindows ? 'browser' : 'man',
- defaultDescription: `
- "man" on Posix, "browser" on Windows
- `,
- type: String,
- description: `
- The program to use to view help content.
+ flatOptions.saveType = 'prod'
+ },
+ }),
+ 'sbom-format': new Definition('sbom-format', {
+ default: null,
+ type: [
+ 'cyclonedx',
+ 'spdx',
+ ],
+ description: `
+ SBOM format to use when generating SBOMs.
+ `,
+ flatten,
+ }),
+ 'sbom-type': new Definition('sbom-type', {
+ default: 'library',
+ type: [
+ 'library',
+ 'application',
+ 'framework',
+ ],
+ description: `
+ The type of package described by the generated SBOM. For SPDX, this is the
+ value for the \`primaryPackagePurpose\` field. For CycloneDX, this is the
+ value for the \`type\` field.
+ `,
+ flatten,
+ }),
+ scope: new Definition('scope', {
+ default: '',
+ defaultDescription: `
+ the scope of the current project, if any, or ""
+ `,
+ type: String,
+ hint: '<@scope>',
+ description: `
+ Associate an operation with a scope for a scoped registry.
+
+ Useful when logging in to or out of a private registry:
+
+ \`\`\`
+ # log in, linking the scope to the custom registry
+ npm login --scope=@mycorp --registry=https://registry.mycorp.com
+
+ # log out, removing the link and the auth token
+ npm logout --scope=@mycorp
+ \`\`\`
+
+ This will cause \`@mycorp\` to be mapped to the registry for future
+ installation of packages specified according to the pattern
+ \`@mycorp/package\`.
+
+ This will also cause \`npm init\` to create a scoped package.
+
+ \`\`\`
+ # accept all defaults, and create a package named "@foo/whatever",
+ # instead of just named "whatever"
+ npm init --scope=@foo --yes
+ \`\`\`
+ `,
+ flatten (key, obj, flatOptions) {
+ const value = obj[key]
+ const scope = value && !/^@/.test(value) ? `@${value}` : value
+ flatOptions.scope = scope
+ // projectScope is kept for compatibility with npm-registry-fetch
+ flatOptions.projectScope = scope
+ },
+ }),
+ 'script-shell': new Definition('script-shell', {
+ default: null,
+ defaultDescription: `
+ '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
+ `,
+ type: [null, String],
+ description: `
+ The shell to use for scripts run with the \`npm exec\`,
+ \`npm run\` and \`npm init \` commands.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.scriptShell = obj[key] || undefined
+ },
+ }),
+ searchexclude: new Definition('searchexclude', {
+ default: '',
+ type: String,
+ description: `
+ Space-separated options that limit the results from search.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.search = flatOptions.search || { limit: 20 }
+ flatOptions.search.exclude = obj[key].toLowerCase()
+ },
+ }),
+ searchlimit: new Definition('searchlimit', {
+ default: 20,
+ type: Number,
+ description: `
+ Number of items to limit search results to. Will not apply at all to
+ legacy searches.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.search = flatOptions.search || {}
+ flatOptions.search.limit = obj[key]
+ },
+ }),
+ searchopts: new Definition('searchopts', {
+ default: '',
+ type: String,
+ description: `
+ Space-separated options that are always passed to search.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.search = flatOptions.search || { limit: 20 }
+ flatOptions.search.opts = querystring.parse(obj[key])
+ },
+ }),
+ searchstaleness: new Definition('searchstaleness', {
+ default: 15 * 60,
+ type: Number,
+ description: `
+ The age of the cache, in seconds, before another registry request is made
+ if using legacy search endpoint.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.search = flatOptions.search || { limit: 20 }
+ flatOptions.search.staleness = obj[key]
+ },
+ }),
+ shell: new Definition('shell', {
+ default: shell,
+ defaultDescription: `
+ SHELL environment variable, or "bash" on Posix, or "cmd.exe" on Windows
+ `,
+ type: String,
+ description: `
+ The shell to run for the \`npm explore\` command.
+ `,
+ flatten,
+ }),
+ shrinkwrap: new Definition('shrinkwrap', {
+ default: true,
+ type: Boolean,
+ deprecated: `
+ Use the --package-lock setting instead.
+ `,
+ description: `
+ Alias for --package-lock
+ `,
+ flatten (key, obj, flatOptions) {
+ obj['package-lock'] = obj.shrinkwrap
+ definitions['package-lock'].flatten('package-lock', obj, flatOptions)
+ },
+ }),
+ 'sign-git-commit': new Definition('sign-git-commit', {
+ default: false,
+ type: Boolean,
+ description: `
+ If set to true, then the \`npm version\` command will commit the new
+ package version using \`-S\` to add a signature.
+
+ Note that git requires you to have set up GPG keys in your git configs
+ for this to work properly.
+ `,
+ flatten,
+ }),
+ 'sign-git-tag': new Definition('sign-git-tag', {
+ default: false,
+ type: Boolean,
+ description: `
+ If set to true, then the \`npm version\` command will tag the version
+ using \`-s\` to add a signature.
+
+ Note that git requires you to have set up GPG keys in your git configs
+ for this to work properly.
+ `,
+ flatten,
+ }),
+ 'strict-peer-deps': new Definition('strict-peer-deps', {
+ default: false,
+ type: Boolean,
+ description: `
+ If set to \`true\`, and \`--legacy-peer-deps\` is not set, then _any_
+ conflicting \`peerDependencies\` will be treated as an install failure,
+ even if npm could reasonably guess the appropriate resolution based on
+ non-peer dependency relationships.
+
+ By default, conflicting \`peerDependencies\` deep in the dependency graph
+ will be resolved using the nearest non-peer dependency specification,
+ even if doing so will result in some packages receiving a peer dependency
+ outside the range set in their package's \`peerDependencies\` object.
+
+ When such an override is performed, a warning is printed, explaining the
+ conflict and the packages involved. If \`--strict-peer-deps\` is set,
+ then this warning is treated as a failure.
+ `,
+ flatten,
+ }),
+ 'strict-ssl': new Definition('strict-ssl', {
+ default: true,
+ type: Boolean,
+ description: `
+ Whether or not to do SSL key validation when making requests to the
+ registry via https.
+
+ See also the \`ca\` config.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.strictSSL = obj[key]
+ },
+ }),
+ tag: new Definition('tag', {
+ default: 'latest',
+ type: String,
+ description: `
+ If you ask npm to install a package and don't tell it a specific version,
+ then it will install the specified tag.
+
+ Also the tag that is added to the package@version specified by the \`npm
+ tag\` command, if no explicit tag is given.
+
+ When used by the \`npm diff\` command, this is the tag used to fetch the
+ tarball that will be compared with the local files by default.
+ `,
+ flatten (key, obj, flatOptions) {
+ flatOptions.defaultTag = obj[key]
+ },
+ }),
+ 'tag-version-prefix': new Definition('tag-version-prefix', {
+ default: 'v',
+ type: String,
+ description: `
+ If set, alters the prefix used when tagging a new version when performing
+ a version increment using \`npm version\`. To remove the prefix
+ altogether, set it to the empty string: \`""\`.
+
+ Because other tools may rely on the convention that npm version tags look
+ like \`v1.0.0\`, _only use this property if it is absolutely necessary_.
+ In particular, use care when overriding this setting for public packages.
+ `,
+ flatten,
+ }),
+ timing: new Definition('timing', {
+ default: false,
+ type: Boolean,
+ description: `
+ If true, writes timing information to a process specific json file in
+ the cache or \`logs-dir\`. The file name ends with \`-timing.json\`.
+
+ You can quickly view it with this [json](https://npm.im/json) command
+ line: \`cat ~/.npm/_logs/*-timing.json | npm exec -- json -g\`.
+
+ Timing information will also be reported in the terminal. To suppress this
+ while still writing the timing file, use \`--silent\`.
+ `,
+ }),
+ umask: new Definition('umask', {
+ default: 0,
+ type: Umask,
+ description: `
+ The "umask" value to use when setting the file creation mode on files and
+ folders.
+
+ Folders and executables are given a mode which is \`0o777\` masked
+ against this value. Other files are given a mode which is \`0o666\`
+ masked against this value.
+
+ Note that the underlying system will _also_ apply its own umask value to
+ files and folders that are created, and npm does not circumvent this, but
+ rather adds the \`--umask\` config to it.
+
+ Thus, the effective default umask value on most POSIX systems is 0o22,
+ meaning that folders and executables are created with a mode of 0o755 and
+ other files are created with a mode of 0o644.
+ `,
+ flatten,
+ }),
+ unicode: new Definition('unicode', {
+ default: unicode,
+ defaultDescription: `
+ false on windows, true on mac/unix systems with a unicode locale, as
+ defined by the \`LC_ALL\`, \`LC_CTYPE\`, or \`LANG\` environment variables.
+ `,
+ type: Boolean,
+ description: `
+ When set to true, npm uses unicode characters in the tree output. When
+ false, it uses ascii characters instead of unicode glyphs.
+ `,
+ flatten,
+ }),
+ 'update-notifier': new Definition('update-notifier', {
+ default: true,
+ type: Boolean,
+ description: `
+ Set to false to suppress the update notification when using an older
+ version of npm than the latest.
+ `,
+ }),
+ usage: new Definition('usage', {
+ default: false,
+ type: Boolean,
+ short: ['?', 'H', 'h'],
+ description: `
+ Show short usage output about the command specified.
+ `,
+ }),
+ 'user-agent': new Definition('user-agent', {
+ default: 'npm/{npm-version} ' +
+ 'node/{node-version} ' +
+ '{platform} ' +
+ '{arch} ' +
+ 'workspaces/{workspaces} ' +
+ '{ci}',
+ type: String,
+ description: `
+ Sets the User-Agent request header. The following fields are replaced
+ with their actual counterparts:
+
+ * \`{npm-version}\` - The npm version in use
+ * \`{node-version}\` - The Node.js version in use
+ * \`{platform}\` - The value of \`process.platform\`
+ * \`{arch}\` - The value of \`process.arch\`
+ * \`{workspaces}\` - Set to \`true\` if the \`workspaces\` or \`workspace\`
+ options are set.
+ * \`{ci}\` - The value of the \`ci-name\` config, if set, prefixed with
+ \`ci/\`, or an empty string if \`ci-name\` is empty.
+ `,
+ flatten (key, obj, flatOptions) {
+ const value = obj[key]
+ const ciName = ciInfo.name?.toLowerCase().split(' ').join('-') || null
+ let inWorkspaces = false
+ if (obj.workspaces || obj.workspace && obj.workspace.length) {
+ inWorkspaces = true
+ }
+ flatOptions.userAgent =
+ value.replace(/\{node-version\}/gi, process.version)
+ .replace(/\{npm-version\}/gi, obj['npm-version'])
+ .replace(/\{platform\}/gi, process.platform)
+ .replace(/\{arch\}/gi, process.arch)
+ .replace(/\{workspaces\}/gi, inWorkspaces)
+ .replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
+ .trim()
+
+ // We can't clobber the original or else subsequent flattening will fail
+ // (i.e. when we change the underlying config values)
+ // obj[key] = flatOptions.userAgent
+
+ // user-agent is a unique kind of config item that gets set from a template
+ // and ends up translated. Because of this, the normal "should we set this
+ // to process.env also doesn't work
+ process.env.npm_config_user_agent = flatOptions.userAgent
+ },
+ }),
+ userconfig: new Definition('userconfig', {
+ default: '~/.npmrc',
+ type: path,
+ description: `
+ The location of user-level configuration settings.
+
+ This may be overridden by the \`npm_config_userconfig\` environment
+ variable or the \`--userconfig\` command line option, but may _not_
+ be overridden by settings in the \`globalconfig\` file.
+ `,
+ }),
+ version: new Definition('version', {
+ default: false,
+ type: Boolean,
+ short: 'v',
+ description: `
+ If true, output the npm version and exit successfully.
+
+ Only relevant when specified explicitly on the command line.
+ `,
+ }),
+ versions: new Definition('versions', {
+ default: false,
+ type: Boolean,
+ description: `
+ If true, output the npm version as well as node's \`process.versions\`
+ map and the version in the current working directory's \`package.json\`
+ file if one exists, and exit successfully.
+
+ Only relevant when specified explicitly on the command line.
+ `,
+ }),
+ viewer: new Definition('viewer', {
+ default: isWindows ? 'browser' : 'man',
+ defaultDescription: `
+ "man" on Posix, "browser" on Windows
+ `,
+ type: String,
+ description: `
+ The program to use to view help content.
+
+ Set to \`"browser"\` to view html help content in the default web browser.
+ `,
+ }),
+ which: new Definition('which', {
+ default: null,
+ hint: '',
+ type: [null, Number],
+ description: `
+ If there are multiple funding sources, which 1-indexed source URL to open.
+ `,
+ }),
+ workspace: new Definition('workspace', {
+ default: [],
+ type: [String, Array],
+ hint: '',
+ short: 'w',
+ envExport: false,
+ description: `
+ Enable running a command in the context of the configured workspaces of the
+ current project while filtering by running only the workspaces defined by
+ this configuration option.
+
+ Valid values for the \`workspace\` config are either:
+
+ * Workspace names
+ * Path to a workspace directory
+ * Path to a parent workspace directory (will result in selecting all
+ workspaces within that folder)
+
+ When set for the \`npm init\` command, this may be set to the folder of
+ a workspace which does not yet exist, to create the folder and set it
+ up as a brand new workspace within the project.
+ `,
+ flatten: (key, obj, flatOptions) => {
+ definitions['user-agent'].flatten('user-agent', obj, flatOptions)
+ },
+ }),
+ workspaces: new Definition('workspaces', {
+ default: null,
+ type: [null, Boolean],
+ short: 'ws',
+ envExport: false,
+ description: `
+ Set to true to run the command in the context of **all** configured
+ workspaces.
+
+ Explicitly setting this to false will cause commands like \`install\` to
+ ignore workspaces altogether.
+ When not set explicitly:
+
+ - Commands that operate on the \`node_modules\` tree (install, update,
+ etc.) will link workspaces into the \`node_modules\` folder.
+ - Commands that do other things (test, exec, publish, etc.) will operate
+ on the root project, _unless_ one or more workspaces are specified in
+ the \`workspace\` config.
+ `,
+ flatten: (key, obj, flatOptions) => {
+ definitions['user-agent'].flatten('user-agent', obj, flatOptions)
+
+ // TODO: this is a derived value, and should be reworked when we have a
+ // pattern for derived value
+
+ // workspacesEnabled is true whether workspaces is null or true
+ // commands contextually work with workspaces or not regardless of
+ // configuration, so we need an option specifically to disable workspaces
+ flatOptions.workspacesEnabled = obj[key] !== false
+ },
+ }),
+ 'workspaces-update': new Definition('workspaces-update', {
+ default: true,
+ type: Boolean,
+ description: `
+ If set to true, the npm cli will run an update after operations that may
+ possibly change the workspaces installed to the \`node_modules\` folder.
+ `,
+ flatten,
+ }),
+ yes: new Definition('yes', {
+ default: null,
+ type: [null, Boolean],
+ short: 'y',
+ description: `
+ Automatically answer "yes" to any prompts that npm might print on
+ the command line.
+ `,
+ }),
+}
- Set to \`"browser"\` to view html help content in the default web browser.
- `,
-})
-
-define('which', {
- default: null,
- hint: '',
- type: [null, Number],
- description: `
- If there are multiple funding sources, which 1-indexed source URL to open.
- `,
-})
-
-define('workspace', {
- default: [],
- type: [String, Array],
- hint: '',
- short: 'w',
- envExport: false,
- description: `
- Enable running a command in the context of the configured workspaces of the
- current project while filtering by running only the workspaces defined by
- this configuration option.
-
- Valid values for the \`workspace\` config are either:
-
- * Workspace names
- * Path to a workspace directory
- * Path to a parent workspace directory (will result in selecting all
- workspaces within that folder)
-
- When set for the \`npm init\` command, this may be set to the folder of
- a workspace which does not yet exist, to create the folder and set it
- up as a brand new workspace within the project.
- `,
- flatten: (key, obj, flatOptions) => {
- definitions['user-agent'].flatten('user-agent', obj, flatOptions)
- },
-})
-
-define('workspaces', {
- default: null,
- type: [null, Boolean],
- short: 'ws',
- envExport: false,
- description: `
- Set to true to run the command in the context of **all** configured
- workspaces.
-
- Explicitly setting this to false will cause commands like \`install\` to
- ignore workspaces altogether.
- When not set explicitly:
-
- - Commands that operate on the \`node_modules\` tree (install, update,
- etc.) will link workspaces into the \`node_modules\` folder.
- - Commands that do other things (test, exec, publish, etc.) will operate
- on the root project, _unless_ one or more workspaces are specified in
- the \`workspace\` config.
- `,
- flatten: (key, obj, flatOptions) => {
- definitions['user-agent'].flatten('user-agent', obj, flatOptions)
-
- // TODO: this is a derived value, and should be reworked when we have a
- // pattern for derived value
-
- // workspacesEnabled is true whether workspaces is null or true
- // commands contextually work with workspaces or not regardless of
- // configuration, so we need an option specifically to disable workspaces
- flatOptions.workspacesEnabled = obj[key] !== false
- },
-})
-
-define('workspaces-update', {
- default: true,
- type: Boolean,
- description: `
- If set to true, the npm cli will run an update after operations that may
- possibly change the workspaces installed to the \`node_modules\` folder.
- `,
- flatten,
-})
-
-define('yes', {
- default: null,
- type: [null, Boolean],
- short: 'y',
- description: `
- Automatically answer "yes" to any prompts that npm might print on
- the command line.
- `,
-})
+module.exports = definitions
diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js
index b09ecc478f64fd..1ff19c128696ca 100644
--- a/deps/npm/node_modules/@npmcli/config/lib/index.js
+++ b/deps/npm/node_modules/@npmcli/config/lib/index.js
@@ -2,12 +2,10 @@
const { walkUp } = require('walk-up-path')
const ini = require('ini')
const nopt = require('nopt')
-const mapWorkspaces = require('@npmcli/map-workspaces')
-const rpj = require('read-package-json-fast')
const log = require('proc-log')
-const { resolve, dirname, join } = require('path')
-const { homedir } = require('os')
+const { resolve, dirname, join } = require('node:path')
+const { homedir } = require('node:os')
const {
readFile,
writeFile,
@@ -28,35 +26,12 @@ const dirExists = (...p) => stat(resolve(...p))
const hasOwnProperty = (obj, key) =>
Object.prototype.hasOwnProperty.call(obj, key)
-// define a custom getter, but turn into a normal prop
-// if we set it. otherwise it can't be set on child objects
-const settableGetter = (obj, key, get) => {
- Object.defineProperty(obj, key, {
- get,
- set (value) {
- Object.defineProperty(obj, key, {
- value,
- configurable: true,
- writable: true,
- enumerable: true,
- })
- },
- configurable: true,
- enumerable: true,
- })
-}
-
const typeDefs = require('./type-defs.js')
const nerfDart = require('./nerf-dart.js')
const envReplace = require('./env-replace.js')
const parseField = require('./parse-field.js')
-const typeDescription = require('./type-description.js')
const setEnvs = require('./set-envs.js')
-const {
- ErrInvalidAuth,
-} = require('./errors.js')
-
// types that can be saved back to
const confFileTypes = new Set([
'global',
@@ -329,7 +304,21 @@ class Config {
// default the globalconfig file to that location, instead of the default
// global prefix. It's weird that `npm get globalconfig --prefix=/foo`
// returns `/foo/etc/npmrc`, but better to not change it at this point.
- settableGetter(data, 'globalconfig', () => resolve(this.#get('prefix'), 'etc/npmrc'))
+ // define a custom getter, but turn into a normal prop
+ // if we set it. otherwise it can't be set on child objects
+ Object.defineProperty(data, 'globalconfig', {
+ get: () => resolve(this.#get('prefix'), 'etc/npmrc'),
+ set (value) {
+ Object.defineProperty(data, 'globalconfig', {
+ value,
+ configurable: true,
+ writable: true,
+ enumerable: true,
+ })
+ },
+ configurable: true,
+ enumerable: true,
+ })
}
loadHome () {
@@ -444,6 +433,7 @@ class Config {
}
if (authProblems.length) {
+ const { ErrInvalidAuth } = require('./errors.js')
throw new ErrInvalidAuth(authProblems)
}
@@ -512,6 +502,7 @@ class Config {
}
invalidHandler (k, val, type, source, where) {
+ const typeDescription = require('./type-description.js')
log.warn(
'invalid config',
k + '=' + JSON.stringify(val),
@@ -696,6 +687,7 @@ class Config {
}
if (this.localPrefix && hasPackageJson) {
+ const rpj = require('read-package-json-fast')
// if we already set localPrefix but this dir has a package.json
// then we need to see if `p` is a workspace root by reading its package.json
// however, if reading it fails then we should just move on
@@ -704,6 +696,7 @@ class Config {
continue
}
+ const mapWorkspaces = require('@npmcli/map-workspaces')
const workspaces = await mapWorkspaces({ cwd: p, pkg })
for (const w of workspaces.values()) {
if (w === this.localPrefix) {
diff --git a/deps/npm/node_modules/@npmcli/config/lib/nerf-dart.js b/deps/npm/node_modules/@npmcli/config/lib/nerf-dart.js
index d6ae4aa2aa7e2a..030d92a82270d2 100644
--- a/deps/npm/node_modules/@npmcli/config/lib/nerf-dart.js
+++ b/deps/npm/node_modules/@npmcli/config/lib/nerf-dart.js
@@ -1,4 +1,4 @@
-const { URL } = require('url')
+const { URL } = require('node:url')
/**
* Maps a URL to an identifier.
diff --git a/deps/npm/node_modules/@npmcli/config/lib/parse-field.js b/deps/npm/node_modules/@npmcli/config/lib/parse-field.js
index 099b0b4eaf1a83..9ac3d21cae8b71 100644
--- a/deps/npm/node_modules/@npmcli/config/lib/parse-field.js
+++ b/deps/npm/node_modules/@npmcli/config/lib/parse-field.js
@@ -1,7 +1,7 @@
// Parse a field, coercing it to the best type available.
const typeDefs = require('./type-defs.js')
const envReplace = require('./env-replace.js')
-const { resolve } = require('path')
+const { resolve } = require('node:path')
const { parse: umaskParse } = require('./umask.js')
diff --git a/deps/npm/node_modules/@npmcli/config/lib/type-defs.js b/deps/npm/node_modules/@npmcli/config/lib/type-defs.js
index 20a827c3d164e9..3c9dfe19ded113 100644
--- a/deps/npm/node_modules/@npmcli/config/lib/type-defs.js
+++ b/deps/npm/node_modules/@npmcli/config/lib/type-defs.js
@@ -1,10 +1,12 @@
const nopt = require('nopt')
-const { Umask, validate: validateUmask } = require('./umask.js')
+const { validate: validateUmask } = require('./umask.js')
-const semver = require('semver')
+class Umask {}
+class Semver {}
+const semverValid = require('semver/functions/valid')
const validateSemver = (data, k, val) => {
- const valid = semver.valid(val)
+ const valid = semverValid(val)
if (!valid) {
return false
}
@@ -23,7 +25,7 @@ const validatePath = (data, k, val) => {
module.exports = {
...nopt.typeDefs,
semver: {
- type: semver,
+ type: Semver,
validate: validateSemver,
description: 'full valid SemVer string',
},
diff --git a/deps/npm/node_modules/@npmcli/config/lib/umask.js b/deps/npm/node_modules/@npmcli/config/lib/umask.js
index 4d9ebbdc965451..2ddc5ca7822326 100644
--- a/deps/npm/node_modules/@npmcli/config/lib/umask.js
+++ b/deps/npm/node_modules/@npmcli/config/lib/umask.js
@@ -1,4 +1,3 @@
-class Umask {}
const parse = val => {
// this is run via nopt and parse field where everything is
// converted to a string first, ignoring coverage for now
@@ -33,4 +32,4 @@ const validate = (data, k, val) => {
}
}
-module.exports = { Umask, parse, validate }
+module.exports = { parse, validate }
diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json
index b5c73e1b13a9b1..797c32f7ee4a63 100644
--- a/deps/npm/node_modules/@npmcli/config/package.json
+++ b/deps/npm/node_modules/@npmcli/config/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/config",
- "version": "8.2.1",
+ "version": "8.2.2",
"files": [
"bin/",
"lib/"
diff --git a/deps/npm/node_modules/@npmcli/git/lib/is.js b/deps/npm/node_modules/@npmcli/git/lib/is.js
index e2542f21577272..f5a0e8754f10dc 100644
--- a/deps/npm/node_modules/@npmcli/git/lib/is.js
+++ b/deps/npm/node_modules/@npmcli/git/lib/is.js
@@ -1,6 +1,4 @@
// not an airtight indicator, but a good gut-check to even bother trying
-const { promisify } = require('util')
-const fs = require('fs')
-const stat = promisify(fs.stat)
+const { stat } = require('fs/promises')
module.exports = ({ cwd = process.cwd() } = {}) =>
stat(cwd + '/.git').then(() => true, () => false)
diff --git a/deps/npm/node_modules/@npmcli/git/package.json b/deps/npm/node_modules/@npmcli/git/package.json
index 485c1f43dddb90..7493ec7fb0effb 100644
--- a/deps/npm/node_modules/@npmcli/git/package.json
+++ b/deps/npm/node_modules/@npmcli/git/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/git",
- "version": "5.0.4",
+ "version": "5.0.5",
"main": "lib/index.js",
"files": [
"bin/",
diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js b/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js
index 501dad870a2b75..b20bf5de5d631e 100644
--- a/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js
+++ b/deps/npm/node_modules/@npmcli/map-workspaces/lib/index.js
@@ -5,23 +5,49 @@ const { minimatch } = require('minimatch')
const rpj = require('read-package-json-fast')
const { glob } = require('glob')
-function appendNegatedPatterns (patterns) {
- const results = []
- for (let pattern of patterns) {
+function appendNegatedPatterns (allPatterns) {
+ const patterns = []
+ const negatedPatterns = []
+ for (let pattern of allPatterns) {
const excl = pattern.match(/^!+/)
if (excl) {
pattern = pattern.slice(excl[0].length)
}
- // strip off any / from the start of the pattern. /foo => foo
- pattern = pattern.replace(/^\/+/, '')
+ // strip off any / or ./ from the start of the pattern. /foo => foo
+ pattern = pattern.replace(/^\.?\/+/, '')
// an odd number of ! means a negated pattern. !!foo ==> foo
const negate = excl && excl[0].length % 2 === 1
- results.push({ pattern, negate })
+ if (negate) {
+ negatedPatterns.push(pattern)
+ } else {
+ // remove negated patterns that appeared before this pattern to avoid
+ // ignoring paths that were matched afterwards
+ // e.g: ['packages/**', '!packages/b/**', 'packages/b/a']
+ // in the above list, the last pattern overrides the negated pattern
+ // right before it. In effect, the above list would become:
+ // ['packages/**', 'packages/b/a']
+ // The order matters here which is why we must do it inside the loop
+ // as opposed to doing it all together at the end.
+ for (let i = 0; i < negatedPatterns.length; ++i) {
+ const negatedPattern = negatedPatterns[i]
+ if (minimatch(pattern, negatedPattern)) {
+ negatedPatterns.splice(i, 1)
+ }
+ }
+ patterns.push(pattern)
+ }
}
- return results
+ // use the negated patterns to eagerly remove all the patterns that
+ // can be removed to avoid unnecessary crawling
+ for (const negated of negatedPatterns) {
+ for (const pattern of minimatch.match(patterns, negated)) {
+ patterns.splice(patterns.indexOf(pattern), 1)
+ }
+ }
+ return { patterns, negatedPatterns }
}
function getPatterns (workspaces) {
@@ -77,11 +103,11 @@ async function mapWorkspaces (opts = {}) {
}
const { workspaces = [] } = opts.pkg
- const patterns = getPatterns(workspaces)
+ const { patterns, negatedPatterns } = getPatterns(workspaces)
const results = new Map()
const seen = new Map()
- if (!patterns.length) {
+ if (!patterns.length && !negatedPatterns.length) {
return results
}
@@ -89,52 +115,54 @@ async function mapWorkspaces (opts = {}) {
...opts,
ignore: [
...opts.ignore || [],
- ...['**/node_modules/**'],
+ '**/node_modules/**',
+ // just ignore the negated patterns to avoid unnecessary crawling
+ ...negatedPatterns,
],
})
const getPackagePathname = pkgPathmame(opts)
- for (const item of patterns) {
- let matches = await glob(getGlobPattern(item.pattern), getGlobOpts())
- // preserves glob@8 behavior
- matches = matches.sort((a, b) => a.localeCompare(b, 'en'))
-
- for (const match of matches) {
- let pkg
- const packageJsonPathname = getPackagePathname(match, 'package.json')
- const packagePathname = path.dirname(packageJsonPathname)
-
- try {
- pkg = await rpj(packageJsonPathname)
- } catch (err) {
- if (err.code === 'ENOENT') {
- continue
- } else {
- throw err
- }
- }
+ let matches = await glob(patterns.map((p) => getGlobPattern(p)), getGlobOpts())
+ // preserves glob@8 behavior
+ matches = matches.sort((a, b) => a.localeCompare(b, 'en'))
+
+ // we must preserve the order of results according to the given list of
+ // workspace patterns
+ const orderedMatches = []
+ for (const pattern of patterns) {
+ orderedMatches.push(...matches.filter((m) => {
+ return minimatch(m, pattern, { partial: true, windowsPathsNoEscape: true })
+ }))
+ }
- const name = getPackageName(pkg, packagePathname)
+ for (const match of orderedMatches) {
+ let pkg
+ const packageJsonPathname = getPackagePathname(match, 'package.json')
- let seenPackagePathnames = seen.get(name)
- if (!seenPackagePathnames) {
- seenPackagePathnames = new Set()
- seen.set(name, seenPackagePathnames)
- }
- if (item.negate) {
- seenPackagePathnames.delete(packagePathname)
+ try {
+ pkg = await rpj(packageJsonPathname)
+ } catch (err) {
+ if (err.code === 'ENOENT') {
+ continue
} else {
- seenPackagePathnames.add(packagePathname)
+ throw err
}
}
+
+ const packagePathname = path.dirname(packageJsonPathname)
+ const name = getPackageName(pkg, packagePathname)
+
+ let seenPackagePathnames = seen.get(name)
+ if (!seenPackagePathnames) {
+ seenPackagePathnames = new Set()
+ seen.set(name, seenPackagePathnames)
+ }
+ seenPackagePathnames.add(packagePathname)
}
const errorMessageArray = ['must not have multiple workspaces with the same name']
for (const [packageName, seenPackagePathnames] of seen) {
- if (seenPackagePathnames.size === 0) {
- continue
- }
if (seenPackagePathnames.size > 1) {
addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames)
} else {
@@ -177,30 +205,25 @@ mapWorkspaces.virtual = function (opts = {}) {
const { workspaces = [] } = packages[''] || {}
// uses a pathname-keyed map in order to negate the exact items
const results = new Map()
- const patterns = getPatterns(workspaces)
- if (!patterns.length) {
+ const { patterns, negatedPatterns } = getPatterns(workspaces)
+ if (!patterns.length && !negatedPatterns.length) {
return results
}
- patterns.push({ pattern: '**/node_modules/**', negate: true })
-
- const getPackagePathname = pkgPathmame(opts)
+ negatedPatterns.push('**/node_modules/**')
- for (const packageKey of Object.keys(packages)) {
- if (packageKey === '') {
- continue
+ const packageKeys = Object.keys(packages)
+ for (const pattern of negatedPatterns) {
+ for (const packageKey of minimatch.match(packageKeys, pattern)) {
+ packageKeys.splice(packageKeys.indexOf(packageKey), 1)
}
+ }
- for (const item of patterns) {
- if (minimatch(packageKey, item.pattern)) {
- const packagePathname = getPackagePathname(packageKey)
- const name = getPackageName(packages[packageKey], packagePathname)
-
- if (item.negate) {
- results.delete(packagePathname)
- } else {
- results.set(packagePathname, name)
- }
- }
+ const getPackagePathname = pkgPathmame(opts)
+ for (const pattern of patterns) {
+ for (const packageKey of minimatch.match(packageKeys, pattern)) {
+ const packagePathname = getPackagePathname(packageKey)
+ const name = getPackageName(packages[packageKey], packagePathname)
+ results.set(packagePathname, name)
}
}
diff --git a/deps/npm/node_modules/@npmcli/map-workspaces/package.json b/deps/npm/node_modules/@npmcli/map-workspaces/package.json
index 64cb7f9d3f1177..e6292b06bd2b43 100644
--- a/deps/npm/node_modules/@npmcli/map-workspaces/package.json
+++ b/deps/npm/node_modules/@npmcli/map-workspaces/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/map-workspaces",
- "version": "3.0.4",
+ "version": "3.0.6",
"main": "lib/index.js",
"files": [
"bin/",
@@ -25,7 +25,7 @@
"author": "GitHub Inc.",
"license": "ISC",
"scripts": {
- "lint": "eslint \"**/*.js\"",
+ "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
"pretest": "npm run lint",
"test": "tap",
"snap": "tap",
@@ -43,7 +43,7 @@
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
- "@npmcli/template-oss": "4.14.1",
+ "@npmcli/template-oss": "4.21.3",
"tap": "^16.0.1"
},
"dependencies": {
@@ -54,7 +54,7 @@
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
- "version": "4.14.1",
+ "version": "4.21.3",
"publish": "true"
}
}
diff --git a/deps/npm/node_modules/@npmcli/package-json/lib/normalize.js b/deps/npm/node_modules/@npmcli/package-json/lib/normalize.js
index 204d4d8a8e7dd6..350b3f3d7cb8f0 100644
--- a/deps/npm/node_modules/@npmcli/package-json/lib/normalize.js
+++ b/deps/npm/node_modules/@npmcli/package-json/lib/normalize.js
@@ -1,12 +1,30 @@
-const semver = require('semver')
+const valid = require('semver/functions/valid')
+const clean = require('semver/functions/clean')
const fs = require('fs/promises')
-const { glob } = require('glob')
-const legacyFixer = require('normalize-package-data/lib/fixer.js')
-const legacyMakeWarning = require('normalize-package-data/lib/make_warning.js')
const path = require('path')
const log = require('proc-log')
-const git = require('@npmcli/git')
-const hostedGitInfo = require('hosted-git-info')
+
+/**
+ * @type {import('hosted-git-info')}
+ */
+let _hostedGitInfo
+function lazyHostedGitInfo () {
+ if (!_hostedGitInfo) {
+ _hostedGitInfo = require('hosted-git-info')
+ }
+ return _hostedGitInfo
+}
+
+/**
+ * @type {import('glob').glob}
+ */
+let _glob
+function lazyLoadGlob () {
+ if (!_glob) {
+ _glob = require('glob').glob
+ }
+ return _glob
+}
// used to be npm-normalize-package-bin
function normalizePackageBin (pkg, changes) {
@@ -130,10 +148,10 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
if (!data.version) {
data.version = ''
} else {
- if (!semver.valid(data.version, loose)) {
+ if (!valid(data.version, loose)) {
throw new Error(`Invalid version: "${data.version}"`)
}
- const version = semver.clean(data.version, loose)
+ const version = clean(data.version, loose)
if (version !== data.version) {
changes?.push(`"version" was cleaned and set to "${version}"`)
data.version = version
@@ -208,7 +226,7 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
// add "install" attribute if any "*.gyp" files exist
if (steps.includes('gypfile')) {
if (!scripts.install && !scripts.preinstall && data.gypfile !== false) {
- const files = await glob('*.gyp', { cwd: pkg.path })
+ const files = await lazyLoadGlob()('*.gyp', { cwd: pkg.path })
if (files.length) {
scripts.install = 'node-gyp rebuild'
data.scripts = scripts
@@ -275,7 +293,11 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
// populate "readme" attribute
if (steps.includes('readme') && !data.readme) {
const mdre = /\.m?a?r?k?d?o?w?n?$/i
- const files = await glob('{README,README.*}', { cwd: pkg.path, nocase: true, mark: true })
+ const files = await lazyLoadGlob()('{README,README.*}', {
+ cwd: pkg.path,
+ nocase: true,
+ mark: true,
+ })
let readmeFile
for (const file of files) {
// don't accept directories.
@@ -306,7 +328,7 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
if (steps.includes('mans') && !data.man && data.directories?.man) {
const manDir = data.directories.man
const cwd = path.resolve(pkg.path, manDir)
- const files = await glob('**/*.[0-9]', { cwd })
+ const files = await lazyLoadGlob()('**/*.[0-9]', { cwd })
data.man = files.map(man =>
path.relative(pkg.path, path.join(cwd, man)).split(path.sep).join('/')
)
@@ -319,7 +341,7 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
// expand "directories.bin"
if (steps.includes('binDir') && data.directories?.bin && !data.bin) {
const binsDir = path.resolve(pkg.path, path.join('.', path.join('/', data.directories.bin)))
- const bins = await glob('**', { cwd: binsDir })
+ const bins = await lazyLoadGlob()('**', { cwd: binsDir })
data.bin = bins.reduce((acc, binFile) => {
if (binFile && !binFile.startsWith('.')) {
const binName = path.basename(binFile)
@@ -333,6 +355,7 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
// populate "gitHead" attribute
if (steps.includes('gitHead') && !data.gitHead) {
+ const git = require('@npmcli/git')
const gitRoot = await git.find({ cwd: pkg.path, root })
let head
if (gitRoot) {
@@ -446,7 +469,7 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
}
}
if (data.repository.url) {
- const hosted = hostedGitInfo.fromUrl(data.repository.url)
+ const hosted = lazyHostedGitInfo().fromUrl(data.repository.url)
let r
if (hosted) {
if (hosted.getDefaultRepresentation() === 'shortcut') {
@@ -506,7 +529,7 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
changes?.push(`Removed invalid "${deps}.${d}"`)
delete data[deps][d]
}
- const hosted = hostedGitInfo.fromUrl(data[deps][d])?.toString()
+ const hosted = lazyHostedGitInfo().fromUrl(data[deps][d])?.toString()
if (hosted && hosted !== data[deps][d]) {
changes?.push(`Normalized git reference to "${deps}.${d}"`)
data[deps][d] = hosted.toString()
@@ -518,6 +541,8 @@ const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase })
}
if (steps.includes('normalizeData')) {
+ const legacyFixer = require('normalize-package-data/lib/fixer.js')
+ const legacyMakeWarning = require('normalize-package-data/lib/make_warning.js')
legacyFixer.warn = function () {
changes?.push(legacyMakeWarning.apply(null, arguments))
}
diff --git a/deps/npm/node_modules/@npmcli/package-json/package.json b/deps/npm/node_modules/@npmcli/package-json/package.json
index ab320e8695ca3d..4f7a29d2e4c597 100644
--- a/deps/npm/node_modules/@npmcli/package-json/package.json
+++ b/deps/npm/node_modules/@npmcli/package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/package-json",
- "version": "5.0.0",
+ "version": "5.0.2",
"description": "Programmatic API to update package.json",
"main": "lib/index.js",
"files": [
@@ -10,7 +10,7 @@
"scripts": {
"snap": "tap",
"test": "tap",
- "lint": "eslint \"**/*.js\"",
+ "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint",
"postsnap": "npm run lintfix --",
@@ -25,8 +25,8 @@
"license": "ISC",
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
- "@npmcli/template-oss": "4.18.0",
- "read-package-json": "^6.0.4",
+ "@npmcli/template-oss": "4.21.3",
+ "read-package-json": "^7.0.0",
"read-package-json-fast": "^3.0.2",
"tap": "^16.0.1"
},
@@ -48,14 +48,8 @@
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
- "version": "4.18.0",
- "publish": "true",
- "ciVersions": [
- "16.14.0",
- "16.x",
- "18.0.0",
- "18.x"
- ]
+ "version": "4.21.3",
+ "publish": "true"
},
"tap": {
"nyc-arg": [
diff --git a/deps/npm/node_modules/@sigstore/bundle/dist/build.js b/deps/npm/node_modules/@sigstore/bundle/dist/build.js
index 6990f5451a2d33..65c71b100ad58f 100644
--- a/deps/npm/node_modules/@sigstore/bundle/dist/build.js
+++ b/deps/npm/node_modules/@sigstore/bundle/dist/build.js
@@ -21,7 +21,9 @@ const bundle_1 = require("./bundle");
// Message signature bundle - $case: 'messageSignature'
function toMessageSignatureBundle(options) {
return {
- mediaType: bundle_1.BUNDLE_V02_MEDIA_TYPE,
+ mediaType: options.singleCertificate
+ ? bundle_1.BUNDLE_V03_MEDIA_TYPE
+ : bundle_1.BUNDLE_V02_MEDIA_TYPE,
content: {
$case: 'messageSignature',
messageSignature: {
@@ -39,7 +41,9 @@ exports.toMessageSignatureBundle = toMessageSignatureBundle;
// DSSE envelope bundle - $case: 'dsseEnvelope'
function toDSSEBundle(options) {
return {
- mediaType: bundle_1.BUNDLE_V02_MEDIA_TYPE,
+ mediaType: options.singleCertificate
+ ? bundle_1.BUNDLE_V03_MEDIA_TYPE
+ : bundle_1.BUNDLE_V02_MEDIA_TYPE,
content: {
$case: 'dsseEnvelope',
dsseEnvelope: toEnvelope(options),
@@ -71,12 +75,20 @@ function toVerificationMaterial(options) {
}
function toKeyContent(options) {
if (options.certificate) {
- return {
- $case: 'x509CertificateChain',
- x509CertificateChain: {
- certificates: [{ rawBytes: options.certificate }],
- },
- };
+ if (options.singleCertificate) {
+ return {
+ $case: 'certificate',
+ certificate: { rawBytes: options.certificate },
+ };
+ }
+ else {
+ return {
+ $case: 'x509CertificateChain',
+ x509CertificateChain: {
+ certificates: [{ rawBytes: options.certificate }],
+ },
+ };
+ }
}
else {
return {
diff --git a/deps/npm/node_modules/@sigstore/bundle/dist/bundle.js b/deps/npm/node_modules/@sigstore/bundle/dist/bundle.js
index 60574b309c09cb..dbd35df2ca2bb3 100644
--- a/deps/npm/node_modules/@sigstore/bundle/dist/bundle.js
+++ b/deps/npm/node_modules/@sigstore/bundle/dist/bundle.js
@@ -1,9 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.isBundleWithDsseEnvelope = exports.isBundleWithMessageSignature = exports.isBundleWithPublicKey = exports.isBundleWithCertificateChain = exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = void 0;
+exports.isBundleWithDsseEnvelope = exports.isBundleWithMessageSignature = exports.isBundleWithPublicKey = exports.isBundleWithCertificateChain = exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = void 0;
exports.BUNDLE_V01_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.1';
exports.BUNDLE_V02_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.2';
-exports.BUNDLE_V03_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.3';
+exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.3';
+exports.BUNDLE_V03_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle.v0.3+json';
// Type guards for bundle variants.
function isBundleWithCertificateChain(b) {
return b.verificationMaterial.content.$case === 'x509CertificateChain';
diff --git a/deps/npm/node_modules/@sigstore/bundle/dist/index.js b/deps/npm/node_modules/@sigstore/bundle/dist/index.js
index f2b50994e9b1f5..1b012acad4d85b 100644
--- a/deps/npm/node_modules/@sigstore/bundle/dist/index.js
+++ b/deps/npm/node_modules/@sigstore/bundle/dist/index.js
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.isBundleV01 = exports.assertBundleV02 = exports.assertBundleV01 = exports.assertBundleLatest = exports.assertBundle = exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = exports.ValidationError = exports.isBundleWithPublicKey = exports.isBundleWithMessageSignature = exports.isBundleWithDsseEnvelope = exports.isBundleWithCertificateChain = exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = exports.toMessageSignatureBundle = exports.toDSSEBundle = void 0;
+exports.isBundleV01 = exports.assertBundleV02 = exports.assertBundleV01 = exports.assertBundleLatest = exports.assertBundle = exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = exports.ValidationError = exports.isBundleWithPublicKey = exports.isBundleWithMessageSignature = exports.isBundleWithDsseEnvelope = exports.isBundleWithCertificateChain = exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = exports.toMessageSignatureBundle = exports.toDSSEBundle = void 0;
/*
Copyright 2023 The Sigstore Authors.
@@ -22,6 +22,7 @@ Object.defineProperty(exports, "toMessageSignatureBundle", { enumerable: true, g
var bundle_1 = require("./bundle");
Object.defineProperty(exports, "BUNDLE_V01_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V01_MEDIA_TYPE; } });
Object.defineProperty(exports, "BUNDLE_V02_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V02_MEDIA_TYPE; } });
+Object.defineProperty(exports, "BUNDLE_V03_LEGACY_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V03_LEGACY_MEDIA_TYPE; } });
Object.defineProperty(exports, "BUNDLE_V03_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V03_MEDIA_TYPE; } });
Object.defineProperty(exports, "isBundleWithCertificateChain", { enumerable: true, get: function () { return bundle_1.isBundleWithCertificateChain; } });
Object.defineProperty(exports, "isBundleWithDsseEnvelope", { enumerable: true, get: function () { return bundle_1.isBundleWithDsseEnvelope; } });
diff --git a/deps/npm/node_modules/@sigstore/bundle/dist/validate.js b/deps/npm/node_modules/@sigstore/bundle/dist/validate.js
index 6a59ecc230f4ac..67079cd1f680a9 100644
--- a/deps/npm/node_modules/@sigstore/bundle/dist/validate.js
+++ b/deps/npm/node_modules/@sigstore/bundle/dist/validate.js
@@ -74,7 +74,8 @@ function validateBundleBase(b) {
const invalidValues = [];
// Media type validation
if (b.mediaType === undefined ||
- !b.mediaType.startsWith('application/vnd.dev.sigstore.bundle+json;version=')) {
+ (!b.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\+json;version=\d\.\d/) &&
+ !b.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\.v\d\.\d\+json/))) {
invalidValues.push('mediaType');
}
// Content-related validation
diff --git a/deps/npm/node_modules/@sigstore/bundle/package.json b/deps/npm/node_modules/@sigstore/bundle/package.json
index 2cac185f73895b..ab96ba7e8b2ca6 100644
--- a/deps/npm/node_modules/@sigstore/bundle/package.json
+++ b/deps/npm/node_modules/@sigstore/bundle/package.json
@@ -1,6 +1,6 @@
{
"name": "@sigstore/bundle",
- "version": "2.2.0",
+ "version": "2.3.1",
"description": "Sigstore bundle type",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
"provenance": true
},
"dependencies": {
- "@sigstore/protobuf-specs": "^0.3.0"
+ "@sigstore/protobuf-specs": "^0.3.1"
},
"engines": {
"node": "^16.14.0 || >=18.0.0"
diff --git a/deps/npm/node_modules/@sigstore/core/dist/crypto.js b/deps/npm/node_modules/@sigstore/core/dist/crypto.js
index c5d899d003e1d4..dbe65b165d3574 100644
--- a/deps/npm/node_modules/@sigstore/core/dist/crypto.js
+++ b/deps/npm/node_modules/@sigstore/core/dist/crypto.js
@@ -21,12 +21,12 @@ limitations under the License.
*/
const crypto_1 = __importDefault(require("crypto"));
const SHA256_ALGORITHM = 'sha256';
-function createPublicKey(key) {
+function createPublicKey(key, type = 'spki') {
if (typeof key === 'string') {
return crypto_1.default.createPublicKey(key);
}
else {
- return crypto_1.default.createPublicKey({ key, format: 'der', type: 'spki' });
+ return crypto_1.default.createPublicKey({ key, format: 'der', type: type });
}
}
exports.createPublicKey = createPublicKey;
diff --git a/deps/npm/node_modules/@sigstore/core/package.json b/deps/npm/node_modules/@sigstore/core/package.json
index b9f901652ef0fd..621ff1715bcd1c 100644
--- a/deps/npm/node_modules/@sigstore/core/package.json
+++ b/deps/npm/node_modules/@sigstore/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@sigstore/core",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "Base library for Sigstore",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js b/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js
index 05e566767cdb24..9984f7879c73f1 100644
--- a/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js
+++ b/deps/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.TrustedRoot = exports.CertificateAuthority = exports.TransparencyLogInstance = void 0;
+exports.ClientTrustConfig = exports.SigningConfig = exports.TrustedRoot = exports.CertificateAuthority = exports.TransparencyLogInstance = void 0;
/* eslint-disable */
const sigstore_common_1 = require("./sigstore_common");
function createBaseTransparencyLogInstance() {
@@ -98,6 +98,58 @@ exports.TrustedRoot = {
return obj;
},
};
+function createBaseSigningConfig() {
+ return { caUrl: "", oidcUrl: "", tlogUrls: [], tsaUrls: [] };
+}
+exports.SigningConfig = {
+ fromJSON(object) {
+ return {
+ caUrl: isSet(object.caUrl) ? String(object.caUrl) : "",
+ oidcUrl: isSet(object.oidcUrl) ? String(object.oidcUrl) : "",
+ tlogUrls: Array.isArray(object?.tlogUrls) ? object.tlogUrls.map((e) => String(e)) : [],
+ tsaUrls: Array.isArray(object?.tsaUrls) ? object.tsaUrls.map((e) => String(e)) : [],
+ };
+ },
+ toJSON(message) {
+ const obj = {};
+ message.caUrl !== undefined && (obj.caUrl = message.caUrl);
+ message.oidcUrl !== undefined && (obj.oidcUrl = message.oidcUrl);
+ if (message.tlogUrls) {
+ obj.tlogUrls = message.tlogUrls.map((e) => e);
+ }
+ else {
+ obj.tlogUrls = [];
+ }
+ if (message.tsaUrls) {
+ obj.tsaUrls = message.tsaUrls.map((e) => e);
+ }
+ else {
+ obj.tsaUrls = [];
+ }
+ return obj;
+ },
+};
+function createBaseClientTrustConfig() {
+ return { mediaType: "", trustedRoot: undefined, signingConfig: undefined };
+}
+exports.ClientTrustConfig = {
+ fromJSON(object) {
+ return {
+ mediaType: isSet(object.mediaType) ? String(object.mediaType) : "",
+ trustedRoot: isSet(object.trustedRoot) ? exports.TrustedRoot.fromJSON(object.trustedRoot) : undefined,
+ signingConfig: isSet(object.signingConfig) ? exports.SigningConfig.fromJSON(object.signingConfig) : undefined,
+ };
+ },
+ toJSON(message) {
+ const obj = {};
+ message.mediaType !== undefined && (obj.mediaType = message.mediaType);
+ message.trustedRoot !== undefined &&
+ (obj.trustedRoot = message.trustedRoot ? exports.TrustedRoot.toJSON(message.trustedRoot) : undefined);
+ message.signingConfig !== undefined &&
+ (obj.signingConfig = message.signingConfig ? exports.SigningConfig.toJSON(message.signingConfig) : undefined);
+ return obj;
+ },
+};
function isSet(value) {
return value !== null && value !== undefined;
}
diff --git a/deps/npm/node_modules/@sigstore/protobuf-specs/package.json b/deps/npm/node_modules/@sigstore/protobuf-specs/package.json
index 047a67a7a2e208..4fefe51c761fd8 100644
--- a/deps/npm/node_modules/@sigstore/protobuf-specs/package.json
+++ b/deps/npm/node_modules/@sigstore/protobuf-specs/package.json
@@ -1,6 +1,6 @@
{
"name": "@sigstore/protobuf-specs",
- "version": "0.3.0",
+ "version": "0.3.1",
"description": "code-signing for npm packages",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -21,11 +21,11 @@
},
"homepage": "https://github.com/sigstore/protobuf-specs#readme",
"devDependencies": {
- "@tsconfig/node14": "^1.0.3",
+ "@tsconfig/node16": "^16.1.1",
"@types/node": "^18.14.0",
"typescript": "^4.9.5"
},
"engines": {
- "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ "node": "^16.14.0 || >=18.0.0"
}
}
diff --git a/deps/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js b/deps/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js
index f01aac252b304a..7c2ca9164f0dfe 100644
--- a/deps/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js
+++ b/deps/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js
@@ -56,7 +56,7 @@ function toMessageSignatureBundle(artifact, signature) {
}
exports.toMessageSignatureBundle = toMessageSignatureBundle;
// DSSE envelope bundle - $case: 'dsseEnvelope'
-function toDSSEBundle(artifact, signature) {
+function toDSSEBundle(artifact, signature, singleCertificate) {
return sigstore.toDSSEBundle({
artifact: artifact.data,
artifactType: artifact.type,
@@ -65,6 +65,7 @@ function toDSSEBundle(artifact, signature) {
? util_1.pem.toDER(signature.key.certificate)
: undefined,
keyHint: signature.key.$case === 'publicKey' ? signature.key.hint : undefined,
+ singleCertificate,
});
}
exports.toDSSEBundle = toDSSEBundle;
diff --git a/deps/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js b/deps/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js
index 486d289aea38cb..621700df93842a 100644
--- a/deps/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js
+++ b/deps/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js
@@ -23,6 +23,7 @@ const bundle_1 = require("./bundle");
class DSSEBundleBuilder extends base_1.BaseBundleBuilder {
constructor(options) {
super(options);
+ this.singleCertificate = options.singleCertificate ?? false;
}
// DSSE requires the artifact to be pre-encoded with the payload type
// before the signature is generated.
@@ -32,7 +33,7 @@ class DSSEBundleBuilder extends base_1.BaseBundleBuilder {
}
// Packages the artifact and signature into a DSSE bundle
async package(artifact, signature) {
- return (0, bundle_1.toDSSEBundle)(artifactDefaults(artifact), signature);
+ return (0, bundle_1.toDSSEBundle)(artifactDefaults(artifact), signature, this.singleCertificate);
}
}
exports.DSSEBundleBuilder = DSSEBundleBuilder;
diff --git a/deps/npm/node_modules/@sigstore/sign/package.json b/deps/npm/node_modules/@sigstore/sign/package.json
index 4302f6e07a2a82..09eea0a39e8771 100644
--- a/deps/npm/node_modules/@sigstore/sign/package.json
+++ b/deps/npm/node_modules/@sigstore/sign/package.json
@@ -1,6 +1,6 @@
{
"name": "@sigstore/sign",
- "version": "2.2.3",
+ "version": "2.3.0",
"description": "Sigstore signing library",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -27,14 +27,14 @@
},
"devDependencies": {
"@sigstore/jest": "^0.0.0",
- "@sigstore/mock": "^0.6.5",
+ "@sigstore/mock": "^0.7.0",
"@sigstore/rekor-types": "^2.0.0",
"@types/make-fetch-happen": "^10.0.4"
},
"dependencies": {
- "@sigstore/bundle": "^2.2.0",
+ "@sigstore/bundle": "^2.3.0",
"@sigstore/core": "^1.0.0",
- "@sigstore/protobuf-specs": "^0.3.0",
+ "@sigstore/protobuf-specs": "^0.3.1",
"make-fetch-happen": "^13.0.0"
},
"engines": {
diff --git a/deps/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js b/deps/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js
index e706887a95043a..74c7f50d763e1d 100644
--- a/deps/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js
+++ b/deps/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js
@@ -42,11 +42,12 @@ function verifyIntoto002TLogBody(tlogEntry, content) {
// Signature is double-base64-encoded in the tlog entry
const tlogSig = base64Decode(tlogEntry.spec.content.envelope.signatures[0].sig);
// Ensure that the signature in the bundle's DSSE matches tlog entry
- if (!content.compareSignature(Buffer.from(tlogSig, 'base64')))
+ if (!content.compareSignature(Buffer.from(tlogSig, 'base64'))) {
throw new error_1.VerificationError({
code: 'TLOG_BODY_ERROR',
message: 'tlog entry signature mismatch',
});
+ }
// Ensure the digest of the bundle's DSSE payload matches the digest in the
// tlog entry
const tlogHash = tlogEntry.spec.content.payloadHash?.value || '';
diff --git a/deps/npm/node_modules/@sigstore/verify/dist/trust/index.js b/deps/npm/node_modules/@sigstore/verify/dist/trust/index.js
index 7991f351949a00..954de558415902 100644
--- a/deps/npm/node_modules/@sigstore/verify/dist/trust/index.js
+++ b/deps/npm/node_modules/@sigstore/verify/dist/trust/index.js
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
const core_1 = require("@sigstore/core");
+const protobuf_specs_1 = require("@sigstore/protobuf-specs");
const error_1 = require("../error");
const BEGINNING_OF_TIME = new Date(0);
const END_OF_TIME = new Date(8640000000000000);
@@ -35,9 +36,17 @@ function toTrustMaterial(root, keys) {
}
exports.toTrustMaterial = toTrustMaterial;
function createTLogAuthority(tlogInstance) {
+ const keyDetails = tlogInstance.publicKey.keyDetails;
+ const keyType = keyDetails === protobuf_specs_1.PublicKeyDetails.PKCS1_RSA_PKCS1V5 ||
+ keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V5 ||
+ keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256 ||
+ keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256 ||
+ keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256
+ ? 'pkcs1'
+ : 'spki';
return {
logID: tlogInstance.logId.keyId,
- publicKey: core_1.crypto.createPublicKey(tlogInstance.publicKey.rawBytes),
+ publicKey: core_1.crypto.createPublicKey(tlogInstance.publicKey.rawBytes, keyType),
validFor: {
start: tlogInstance.publicKey.validFor?.start || BEGINNING_OF_TIME,
end: tlogInstance.publicKey.validFor?.end || END_OF_TIME,
diff --git a/deps/npm/node_modules/@sigstore/verify/package.json b/deps/npm/node_modules/@sigstore/verify/package.json
index dcfb587e084a6c..edd6566e10ece7 100644
--- a/deps/npm/node_modules/@sigstore/verify/package.json
+++ b/deps/npm/node_modules/@sigstore/verify/package.json
@@ -1,6 +1,6 @@
{
"name": "@sigstore/verify",
- "version": "1.1.0",
+ "version": "1.2.0",
"description": "Verification of Sigstore signatures",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -26,9 +26,9 @@
"provenance": true
},
"dependencies": {
- "@sigstore/protobuf-specs": "^0.3.0",
- "@sigstore/bundle": "^2.2.0",
- "@sigstore/core": "^1.0.0"
+ "@sigstore/protobuf-specs": "^0.3.1",
+ "@sigstore/bundle": "^2.3.1",
+ "@sigstore/core": "^1.1.0"
},
"engines": {
"node": "^16.14.0 || >=18.0.0"
diff --git a/deps/npm/node_modules/builtins/index.js b/deps/npm/node_modules/builtins/index.js
index b715278437cbcf..01d23876aae325 100644
--- a/deps/npm/node_modules/builtins/index.js
+++ b/deps/npm/node_modules/builtins/index.js
@@ -1,6 +1,6 @@
'use strict'
-const semver = require('semver')
+const satisfies = require('semver/functions/satisfies')
const permanentModules = [
'assert',
@@ -60,7 +60,7 @@ module.exports = ({ version = process.version, experimental = false } = {}) => {
const builtins = [...permanentModules]
for (const [name, semverRange] of Object.entries(versionLockedModules)) {
- if (version === '*' || semver.satisfies(version, semverRange)) {
+ if (version === '*' || satisfies(version, semverRange)) {
builtins.push(name)
}
}
@@ -69,7 +69,7 @@ module.exports = ({ version = process.version, experimental = false } = {}) => {
for (const [name, semverRange] of Object.entries(experimentalModules)) {
if (
!builtins.includes(name) &&
- (version === '*' || semver.satisfies(version, semverRange))
+ (version === '*' || satisfies(version, semverRange))
) {
builtins.push(name)
}
diff --git a/deps/npm/node_modules/builtins/package.json b/deps/npm/node_modules/builtins/package.json
index 1c43660c7483fe..d37e02e0768180 100644
--- a/deps/npm/node_modules/builtins/package.json
+++ b/deps/npm/node_modules/builtins/package.json
@@ -1,20 +1,19 @@
{
"name": "builtins",
- "version": "5.0.1",
+ "version": "5.1.0",
"description": "List of node.js builtin modules",
"repository": "juliangruber/builtins",
"license": "MIT",
"main": "index.js",
"files": [],
"scripts": {
- "test": "prettier-standard && standard && node-core-test"
+ "test": "standard --fix && node--test"
},
"dependencies": {
"semver": "^7.0.0"
},
"devDependencies": {
- "node-core-test": "^1.4.0",
- "prettier-standard": "^15.0.1",
- "standard": "^14.3.4"
+ "standard": "^17.0.0",
+ "test": "^3.0.0"
}
}
diff --git a/deps/npm/node_modules/cidr-regex/package.json b/deps/npm/node_modules/cidr-regex/package.json
index 4f743464075e3e..262da56e2ee676 100644
--- a/deps/npm/node_modules/cidr-regex/package.json
+++ b/deps/npm/node_modules/cidr-regex/package.json
@@ -1,6 +1,6 @@
{
"name": "cidr-regex",
- "version": "4.0.3",
+ "version": "4.0.5",
"description": "Regular expression for matching IP addresses in CIDR notation",
"author": "silverwind ",
"contributors": [
@@ -22,11 +22,12 @@
"ip-regex": "^5.0.0"
},
"devDependencies": {
- "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"
+ "eslint": "8.57.0",
+ "eslint-config-silverwind": "83.0.1",
+ "tsd": "0.31.0",
+ "updates": "16.0.0",
+ "versions": "12.0.1",
+ "vitest": "1.4.0",
+ "vitest-config-silverwind": "7.0.3"
}
}
diff --git a/deps/npm/node_modules/hasown/package.json b/deps/npm/node_modules/hasown/package.json
index 1b03e9d3018bde..8502e13dd5c835 100644
--- a/deps/npm/node_modules/hasown/package.json
+++ b/deps/npm/node_modules/hasown/package.json
@@ -1,6 +1,6 @@
{
"name": "hasown",
- "version": "2.0.1",
+ "version": "2.0.2",
"description": "A robust, ES3 compatible, \"has own property\" predicate.",
"main": "index.js",
"exports": {
@@ -18,6 +18,7 @@
"postlint": "npm run tsc",
"pretest": "npm run lint",
"tsc": "tsc -p .",
+ "posttsc": "attw -P",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production",
@@ -50,7 +51,9 @@
"function-bind": "^1.1.2"
},
"devDependencies": {
+ "@arethetypeswrong/cli": "^0.15.1",
"@ljharb/eslint-config": "^21.1.0",
+ "@ljharb/tsconfig": "^0.2.0",
"@types/function-bind": "^1.1.10",
"@types/mock-property": "^1.0.2",
"@types/tape": "^5.6.4",
@@ -63,7 +66,7 @@
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
- "tape": "^5.7.4",
+ "tape": "^5.7.5",
"typescript": "next"
},
"engines": {
diff --git a/deps/npm/node_modules/hasown/tsconfig.json b/deps/npm/node_modules/hasown/tsconfig.json
index fdab34fe311577..0930c565850326 100644
--- a/deps/npm/node_modules/hasown/tsconfig.json
+++ b/deps/npm/node_modules/hasown/tsconfig.json
@@ -1,49 +1,6 @@
{
- "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. */
- },
+ "extends": "@ljharb/tsconfig",
"exclude": [
- "coverage"
- ]
+ "coverage",
+ ],
}
diff --git a/deps/npm/node_modules/is-cidr/LICENSE b/deps/npm/node_modules/is-cidr/LICENSE
deleted file mode 100644
index 9669c20f85511d..00000000000000
--- a/deps/npm/node_modules/is-cidr/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) silverwind
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/deps/npm/node_modules/is-cidr/package.json b/deps/npm/node_modules/is-cidr/package.json
index d6971b3b33bd83..baf6fa55fe4522 100644
--- a/deps/npm/node_modules/is-cidr/package.json
+++ b/deps/npm/node_modules/is-cidr/package.json
@@ -1,6 +1,6 @@
{
"name": "is-cidr",
- "version": "5.0.3",
+ "version": "5.0.5",
"description": "Check if a string is an IP address in CIDR notation",
"author": "silverwind ",
"contributors": [
@@ -19,14 +19,15 @@
"index.d.ts"
],
"dependencies": {
- "cidr-regex": "4.0.3"
+ "cidr-regex": "^4.0.4"
},
"devDependencies": {
- "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"
+ "eslint": "8.57.0",
+ "eslint-config-silverwind": "83.0.1",
+ "tsd": "0.31.0",
+ "updates": "16.0.0",
+ "versions": "12.0.1",
+ "vitest": "1.4.0",
+ "vitest-config-silverwind": "7.0.3"
}
}
diff --git a/deps/npm/node_modules/libnpmdiff/package.json b/deps/npm/node_modules/libnpmdiff/package.json
index f6ad40b482a934..98229e99bd5618 100644
--- a/deps/npm/node_modules/libnpmdiff/package.json
+++ b/deps/npm/node_modules/libnpmdiff/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmdiff",
- "version": "6.0.8",
+ "version": "6.0.9",
"description": "The registry diff",
"repository": {
"type": "git",
diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json
index 8b6a9d217a00d0..39f12270e35a7e 100644
--- a/deps/npm/node_modules/libnpmexec/package.json
+++ b/deps/npm/node_modules/libnpmexec/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmexec",
- "version": "7.0.9",
+ "version": "7.0.10",
"files": [
"bin/",
"lib/"
diff --git a/deps/npm/node_modules/libnpmfund/package.json b/deps/npm/node_modules/libnpmfund/package.json
index 994538c89fce17..978252999e92eb 100644
--- a/deps/npm/node_modules/libnpmfund/package.json
+++ b/deps/npm/node_modules/libnpmfund/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmfund",
- "version": "5.0.6",
+ "version": "5.0.7",
"main": "lib/index.js",
"files": [
"bin/",
diff --git a/deps/npm/node_modules/libnpmpack/package.json b/deps/npm/node_modules/libnpmpack/package.json
index d49a17aa39f838..1782ab7143186a 100644
--- a/deps/npm/node_modules/libnpmpack/package.json
+++ b/deps/npm/node_modules/libnpmpack/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmpack",
- "version": "6.0.8",
+ "version": "6.0.9",
"description": "Programmatic API for the bits behind npm pack",
"author": "GitHub Inc.",
"main": "lib/index.js",
diff --git a/deps/npm/node_modules/postcss-selector-parser/package.json b/deps/npm/node_modules/postcss-selector-parser/package.json
index d1f6be84cc5c77..0d1af5d373f20e 100644
--- a/deps/npm/node_modules/postcss-selector-parser/package.json
+++ b/deps/npm/node_modules/postcss-selector-parser/package.json
@@ -1,6 +1,6 @@
{
"name": "postcss-selector-parser",
- "version": "6.0.15",
+ "version": "6.0.16",
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
@@ -33,7 +33,8 @@
"!**/__tests__"
],
"scripts": {
- "pretest": "eslint src && tsc --noEmit postcss-selector-parser.d.ts",
+ "typecheck": "tsc --noEmit --strict postcss-selector-parser.d.ts postcss-selector-parser.test.ts",
+ "pretest": "eslint src && npm run typecheck",
"prepare": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
"lintfix": "eslint --fix src",
"report": "nyc report --reporter=html",
diff --git a/deps/npm/node_modules/sigstore/package.json b/deps/npm/node_modules/sigstore/package.json
index 3dca00636b8d9d..f39fc63b5a91de 100644
--- a/deps/npm/node_modules/sigstore/package.json
+++ b/deps/npm/node_modules/sigstore/package.json
@@ -1,6 +1,6 @@
{
"name": "sigstore",
- "version": "2.2.2",
+ "version": "2.3.0",
"description": "code-signing for npm packages",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -29,17 +29,17 @@
"devDependencies": {
"@sigstore/rekor-types": "^2.0.0",
"@sigstore/jest": "^0.0.0",
- "@sigstore/mock": "^0.6.5",
+ "@sigstore/mock": "^0.7.0",
"@tufjs/repo-mock": "^2.0.0",
"@types/make-fetch-happen": "^10.0.4"
},
"dependencies": {
- "@sigstore/bundle": "^2.2.0",
+ "@sigstore/bundle": "^2.3.1",
"@sigstore/core": "^1.0.0",
- "@sigstore/protobuf-specs": "^0.3.0",
- "@sigstore/sign": "^2.2.3",
+ "@sigstore/protobuf-specs": "^0.3.1",
+ "@sigstore/sign": "^2.3.0",
"@sigstore/tuf": "^2.3.1",
- "@sigstore/verify": "^1.1.0"
+ "@sigstore/verify": "^1.2.0"
},
"engines": {
"node": "^16.14.0 || >=18.0.0"
diff --git a/deps/npm/node_modules/socks-proxy-agent/LICENSE b/deps/npm/node_modules/socks-proxy-agent/LICENSE
new file mode 100644
index 00000000000000..008728cb51847d
--- /dev/null
+++ b/deps/npm/node_modules/socks-proxy-agent/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2013 Nathan Rajlich
+
+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.
\ No newline at end of file
diff --git a/deps/npm/node_modules/socks-proxy-agent/dist/index.js b/deps/npm/node_modules/socks-proxy-agent/dist/index.js
index 102ecd64c0b9d6..efd03ec9a7fe76 100644
--- a/deps/npm/node_modules/socks-proxy-agent/dist/index.js
+++ b/deps/npm/node_modules/socks-proxy-agent/dist/index.js
@@ -94,6 +94,7 @@ class SocksProxyAgent extends agent_base_1.Agent {
this.shouldLookup = lookup;
this.proxy = proxy;
this.timeout = opts?.timeout ?? null;
+ this.socketOptions = opts?.socketOptions ?? null;
}
/**
* Initiates a SOCKS connection to the specified SOCKS proxy server,
@@ -128,6 +129,9 @@ class SocksProxyAgent extends agent_base_1.Agent {
},
command: 'connect',
timeout: timeout ?? undefined,
+ // @ts-expect-error the type supplied by socks for socket_options is wider
+ // than necessary since socks will always override the host and port
+ socket_options: this.socketOptions ?? undefined,
};
const cleanup = (tlsSocket) => {
req.destroy();
diff --git a/deps/npm/node_modules/socks-proxy-agent/package.json b/deps/npm/node_modules/socks-proxy-agent/package.json
index 6e1c2c12de3674..090ec3e46b2798 100644
--- a/deps/npm/node_modules/socks-proxy-agent/package.json
+++ b/deps/npm/node_modules/socks-proxy-agent/package.json
@@ -1,6 +1,6 @@
{
"name": "socks-proxy-agent",
- "version": "8.0.2",
+ "version": "8.0.3",
"description": "A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -107,7 +107,7 @@
"socks5h"
],
"dependencies": {
- "agent-base": "^7.0.2",
+ "agent-base": "^7.1.1",
"debug": "^4.3.4",
"socks": "^2.7.1"
},
diff --git a/deps/npm/node_modules/socks/build/common/helpers.js b/deps/npm/node_modules/socks/build/common/helpers.js
index 65bd95bdc62215..1ae44e4159a155 100644
--- a/deps/npm/node_modules/socks/build/common/helpers.js
+++ b/deps/npm/node_modules/socks/build/common/helpers.js
@@ -152,7 +152,11 @@ function ipToBuffer(ip) {
else if (net.isIPv6(ip)) {
// Handle IPv6 addresses
const address = new ip_address_1.Address6(ip);
- return Buffer.from(address.toByteArray());
+ return Buffer.from(address
+ .canonicalForm()
+ .split(':')
+ .map((segment) => segment.padStart(4, '0'))
+ .join(''), 'hex');
}
else {
throw new Error('Invalid IP address format');
diff --git a/deps/npm/node_modules/socks/package.json b/deps/npm/node_modules/socks/package.json
index dbda909fd0787c..5cc2a6836072e5 100644
--- a/deps/npm/node_modules/socks/package.json
+++ b/deps/npm/node_modules/socks/package.json
@@ -1,7 +1,7 @@
{
"name": "socks",
"private": false,
- "version": "2.8.0",
+ "version": "2.8.3",
"description": "Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.",
"main": "build/index.js",
"typings": "typings/index.d.ts",
@@ -23,7 +23,7 @@
"socks5"
],
"engines": {
- "node": ">= 16.0.0",
+ "node": ">= 10.0.0",
"npm": ">= 3.0.0"
},
"author": "Josh Glazebrook",
@@ -52,6 +52,7 @@
"test": "NODE_ENV=test mocha --recursive --require ts-node/register test/**/*.ts",
"prettier": "prettier --write ./src/**/*.ts --config .prettierrc.yaml",
"lint": "eslint 'src/**/*.ts'",
- "build": "rm -rf build typings && prettier --write ./src/**/*.ts --config .prettierrc.yaml && tsc -p ."
+ "build": "rm -rf build typings && prettier --write ./src/**/*.ts --config .prettierrc.yaml && tsc -p .",
+ "build-raw": "rm -rf build typings && tsc -p ."
}
}
diff --git a/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS
new file mode 100644
index 00000000000000..257a76b9484c12
--- /dev/null
+++ b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS
@@ -0,0 +1,4 @@
+C. Scott Ananian (http://cscott.net)
+Kyle E. Mitchell (https://kemitchell.com)
+Shinnosuke Watanabe
+Antoine Motet
diff --git a/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE
new file mode 100644
index 00000000000000..831618eaba6c89
--- /dev/null
+++ b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE
@@ -0,0 +1,22 @@
+The MIT License
+
+Copyright (c) 2015 Kyle E. Mitchell & other authors listed in AUTHORS
+
+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.
diff --git a/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js
new file mode 100644
index 00000000000000..52fab560aea707
--- /dev/null
+++ b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js
@@ -0,0 +1,8 @@
+'use strict'
+
+var scan = require('./scan')
+var parse = require('./parse')
+
+module.exports = function (source) {
+ return parse(scan(source))
+}
diff --git a/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json
new file mode 100644
index 00000000000000..c9edc9f939cdf6
--- /dev/null
+++ b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "spdx-expression-parse",
+ "description": "parse SPDX license expressions",
+ "version": "3.0.1",
+ "author": "Kyle E. Mitchell (https://kemitchell.com)",
+ "files": [
+ "AUTHORS",
+ "index.js",
+ "parse.js",
+ "scan.js"
+ ],
+ "dependencies": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ },
+ "devDependencies": {
+ "defence-cli": "^3.0.1",
+ "replace-require-self": "^1.0.0",
+ "standard": "^14.1.0"
+ },
+ "keywords": [
+ "SPDX",
+ "law",
+ "legal",
+ "license",
+ "metadata",
+ "package",
+ "package.json",
+ "standards"
+ ],
+ "license": "MIT",
+ "repository": "jslicense/spdx-expression-parse.js",
+ "scripts": {
+ "lint": "standard",
+ "test:readme": "defence -i javascript README.md | replace-require-self | node",
+ "test:suite": "node test.js",
+ "test": "npm run test:suite && npm run test:readme"
+ }
+}
diff --git a/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js
new file mode 100644
index 00000000000000..5a00b45c5799c4
--- /dev/null
+++ b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js
@@ -0,0 +1,138 @@
+'use strict'
+
+// The ABNF grammar in the spec is totally ambiguous.
+//
+// This parser follows the operator precedence defined in the
+// `Order of Precedence and Parentheses` section.
+
+module.exports = function (tokens) {
+ var index = 0
+
+ function hasMore () {
+ return index < tokens.length
+ }
+
+ function token () {
+ return hasMore() ? tokens[index] : null
+ }
+
+ function next () {
+ if (!hasMore()) {
+ throw new Error()
+ }
+ index++
+ }
+
+ function parseOperator (operator) {
+ var t = token()
+ if (t && t.type === 'OPERATOR' && operator === t.string) {
+ next()
+ return t.string
+ }
+ }
+
+ function parseWith () {
+ if (parseOperator('WITH')) {
+ var t = token()
+ if (t && t.type === 'EXCEPTION') {
+ next()
+ return t.string
+ }
+ throw new Error('Expected exception after `WITH`')
+ }
+ }
+
+ function parseLicenseRef () {
+ // TODO: Actually, everything is concatenated into one string
+ // for backward-compatibility but it could be better to return
+ // a nice structure.
+ var begin = index
+ var string = ''
+ var t = token()
+ if (t.type === 'DOCUMENTREF') {
+ next()
+ string += 'DocumentRef-' + t.string + ':'
+ if (!parseOperator(':')) {
+ throw new Error('Expected `:` after `DocumentRef-...`')
+ }
+ }
+ t = token()
+ if (t.type === 'LICENSEREF') {
+ next()
+ string += 'LicenseRef-' + t.string
+ return { license: string }
+ }
+ index = begin
+ }
+
+ function parseLicense () {
+ var t = token()
+ if (t && t.type === 'LICENSE') {
+ next()
+ var node = { license: t.string }
+ if (parseOperator('+')) {
+ node.plus = true
+ }
+ var exception = parseWith()
+ if (exception) {
+ node.exception = exception
+ }
+ return node
+ }
+ }
+
+ function parseParenthesizedExpression () {
+ var left = parseOperator('(')
+ if (!left) {
+ return
+ }
+
+ var expr = parseExpression()
+
+ if (!parseOperator(')')) {
+ throw new Error('Expected `)`')
+ }
+
+ return expr
+ }
+
+ function parseAtom () {
+ return (
+ parseParenthesizedExpression() ||
+ parseLicenseRef() ||
+ parseLicense()
+ )
+ }
+
+ function makeBinaryOpParser (operator, nextParser) {
+ return function parseBinaryOp () {
+ var left = nextParser()
+ if (!left) {
+ return
+ }
+
+ if (!parseOperator(operator)) {
+ return left
+ }
+
+ var right = parseBinaryOp()
+ if (!right) {
+ throw new Error('Expected expression')
+ }
+ return {
+ left: left,
+ conjunction: operator.toLowerCase(),
+ right: right
+ }
+ }
+ }
+
+ var parseAnd = makeBinaryOpParser('AND', parseAtom)
+ var parseExpression = makeBinaryOpParser('OR', parseAnd)
+
+ var node = parseExpression()
+ if (!node || hasMore()) {
+ throw new Error('Syntax error')
+ }
+ return node
+}
diff --git a/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js
new file mode 100644
index 00000000000000..b74fce2e2c6632
--- /dev/null
+++ b/deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js
@@ -0,0 +1,131 @@
+'use strict'
+
+var licenses = []
+ .concat(require('spdx-license-ids'))
+ .concat(require('spdx-license-ids/deprecated'))
+var exceptions = require('spdx-exceptions')
+
+module.exports = function (source) {
+ var index = 0
+
+ function hasMore () {
+ return index < source.length
+ }
+
+ // `value` can be a regexp or a string.
+ // If it is recognized, the matching source string is returned and
+ // the index is incremented. Otherwise `undefined` is returned.
+ function read (value) {
+ if (value instanceof RegExp) {
+ var chars = source.slice(index)
+ var match = chars.match(value)
+ if (match) {
+ index += match[0].length
+ return match[0]
+ }
+ } else {
+ if (source.indexOf(value, index) === index) {
+ index += value.length
+ return value
+ }
+ }
+ }
+
+ function skipWhitespace () {
+ read(/[ ]*/)
+ }
+
+ function operator () {
+ var string
+ var possibilities = ['WITH', 'AND', 'OR', '(', ')', ':', '+']
+ for (var i = 0; i < possibilities.length; i++) {
+ string = read(possibilities[i])
+ if (string) {
+ break
+ }
+ }
+
+ if (string === '+' && index > 1 && source[index - 2] === ' ') {
+ throw new Error('Space before `+`')
+ }
+
+ return string && {
+ type: 'OPERATOR',
+ string: string
+ }
+ }
+
+ function idstring () {
+ return read(/[A-Za-z0-9-.]+/)
+ }
+
+ function expectIdstring () {
+ var string = idstring()
+ if (!string) {
+ throw new Error('Expected idstring at offset ' + index)
+ }
+ return string
+ }
+
+ function documentRef () {
+ if (read('DocumentRef-')) {
+ var string = expectIdstring()
+ return { type: 'DOCUMENTREF', string: string }
+ }
+ }
+
+ function licenseRef () {
+ if (read('LicenseRef-')) {
+ var string = expectIdstring()
+ return { type: 'LICENSEREF', string: string }
+ }
+ }
+
+ function identifier () {
+ var begin = index
+ var string = idstring()
+
+ if (licenses.indexOf(string) !== -1) {
+ return {
+ type: 'LICENSE',
+ string: string
+ }
+ } else if (exceptions.indexOf(string) !== -1) {
+ return {
+ type: 'EXCEPTION',
+ string: string
+ }
+ }
+
+ index = begin
+ }
+
+ // Tries to read the next token. Returns `undefined` if no token is
+ // recognized.
+ function parseToken () {
+ // Ordering matters
+ return (
+ operator() ||
+ documentRef() ||
+ licenseRef() ||
+ identifier()
+ )
+ }
+
+ var tokens = []
+ while (hasMore()) {
+ skipWhitespace()
+ if (!hasMore()) {
+ break
+ }
+
+ var token = parseToken()
+ if (!token) {
+ throw new Error('Unexpected `' + source[index] +
+ '` at offset ' + index)
+ }
+
+ tokens.push(token)
+ }
+ return tokens
+}
diff --git a/deps/npm/node_modules/spdx-expression-parse/package.json b/deps/npm/node_modules/spdx-expression-parse/package.json
index c9edc9f939cdf6..c3a22afcf7dfcb 100644
--- a/deps/npm/node_modules/spdx-expression-parse/package.json
+++ b/deps/npm/node_modules/spdx-expression-parse/package.json
@@ -1,7 +1,7 @@
{
"name": "spdx-expression-parse",
"description": "parse SPDX license expressions",
- "version": "3.0.1",
+ "version": "4.0.0",
"author": "Kyle E. Mitchell (https://kemitchell.com)",
"files": [
"AUTHORS",
diff --git a/deps/npm/node_modules/spdx-expression-parse/scan.js b/deps/npm/node_modules/spdx-expression-parse/scan.js
index b74fce2e2c6632..528522282703c6 100644
--- a/deps/npm/node_modules/spdx-expression-parse/scan.js
+++ b/deps/npm/node_modules/spdx-expression-parse/scan.js
@@ -37,7 +37,7 @@ module.exports = function (source) {
function operator () {
var string
- var possibilities = ['WITH', 'AND', 'OR', '(', ')', ':', '+']
+ var possibilities = [/^WITH/i, /^AND/i, /^OR/i, '(', ')', ':', '+']
for (var i = 0; i < possibilities.length; i++) {
string = read(possibilities[i])
if (string) {
@@ -51,7 +51,7 @@ module.exports = function (source) {
return string && {
type: 'OPERATOR',
- string: string
+ string: string.toUpperCase()
}
}
diff --git a/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS
new file mode 100644
index 00000000000000..257a76b9484c12
--- /dev/null
+++ b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS
@@ -0,0 +1,4 @@
+C. Scott Ananian (http://cscott.net)
+Kyle E. Mitchell (https://kemitchell.com)
+Shinnosuke Watanabe
+Antoine Motet
diff --git a/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE
new file mode 100644
index 00000000000000..831618eaba6c89
--- /dev/null
+++ b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE
@@ -0,0 +1,22 @@
+The MIT License
+
+Copyright (c) 2015 Kyle E. Mitchell & other authors listed in AUTHORS
+
+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.
diff --git a/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js
new file mode 100644
index 00000000000000..52fab560aea707
--- /dev/null
+++ b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js
@@ -0,0 +1,8 @@
+'use strict'
+
+var scan = require('./scan')
+var parse = require('./parse')
+
+module.exports = function (source) {
+ return parse(scan(source))
+}
diff --git a/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json
new file mode 100644
index 00000000000000..c9edc9f939cdf6
--- /dev/null
+++ b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "spdx-expression-parse",
+ "description": "parse SPDX license expressions",
+ "version": "3.0.1",
+ "author": "Kyle E. Mitchell (https://kemitchell.com)",
+ "files": [
+ "AUTHORS",
+ "index.js",
+ "parse.js",
+ "scan.js"
+ ],
+ "dependencies": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ },
+ "devDependencies": {
+ "defence-cli": "^3.0.1",
+ "replace-require-self": "^1.0.0",
+ "standard": "^14.1.0"
+ },
+ "keywords": [
+ "SPDX",
+ "law",
+ "legal",
+ "license",
+ "metadata",
+ "package",
+ "package.json",
+ "standards"
+ ],
+ "license": "MIT",
+ "repository": "jslicense/spdx-expression-parse.js",
+ "scripts": {
+ "lint": "standard",
+ "test:readme": "defence -i javascript README.md | replace-require-self | node",
+ "test:suite": "node test.js",
+ "test": "npm run test:suite && npm run test:readme"
+ }
+}
diff --git a/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js
new file mode 100644
index 00000000000000..5a00b45c5799c4
--- /dev/null
+++ b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js
@@ -0,0 +1,138 @@
+'use strict'
+
+// The ABNF grammar in the spec is totally ambiguous.
+//
+// This parser follows the operator precedence defined in the
+// `Order of Precedence and Parentheses` section.
+
+module.exports = function (tokens) {
+ var index = 0
+
+ function hasMore () {
+ return index < tokens.length
+ }
+
+ function token () {
+ return hasMore() ? tokens[index] : null
+ }
+
+ function next () {
+ if (!hasMore()) {
+ throw new Error()
+ }
+ index++
+ }
+
+ function parseOperator (operator) {
+ var t = token()
+ if (t && t.type === 'OPERATOR' && operator === t.string) {
+ next()
+ return t.string
+ }
+ }
+
+ function parseWith () {
+ if (parseOperator('WITH')) {
+ var t = token()
+ if (t && t.type === 'EXCEPTION') {
+ next()
+ return t.string
+ }
+ throw new Error('Expected exception after `WITH`')
+ }
+ }
+
+ function parseLicenseRef () {
+ // TODO: Actually, everything is concatenated into one string
+ // for backward-compatibility but it could be better to return
+ // a nice structure.
+ var begin = index
+ var string = ''
+ var t = token()
+ if (t.type === 'DOCUMENTREF') {
+ next()
+ string += 'DocumentRef-' + t.string + ':'
+ if (!parseOperator(':')) {
+ throw new Error('Expected `:` after `DocumentRef-...`')
+ }
+ }
+ t = token()
+ if (t.type === 'LICENSEREF') {
+ next()
+ string += 'LicenseRef-' + t.string
+ return { license: string }
+ }
+ index = begin
+ }
+
+ function parseLicense () {
+ var t = token()
+ if (t && t.type === 'LICENSE') {
+ next()
+ var node = { license: t.string }
+ if (parseOperator('+')) {
+ node.plus = true
+ }
+ var exception = parseWith()
+ if (exception) {
+ node.exception = exception
+ }
+ return node
+ }
+ }
+
+ function parseParenthesizedExpression () {
+ var left = parseOperator('(')
+ if (!left) {
+ return
+ }
+
+ var expr = parseExpression()
+
+ if (!parseOperator(')')) {
+ throw new Error('Expected `)`')
+ }
+
+ return expr
+ }
+
+ function parseAtom () {
+ return (
+ parseParenthesizedExpression() ||
+ parseLicenseRef() ||
+ parseLicense()
+ )
+ }
+
+ function makeBinaryOpParser (operator, nextParser) {
+ return function parseBinaryOp () {
+ var left = nextParser()
+ if (!left) {
+ return
+ }
+
+ if (!parseOperator(operator)) {
+ return left
+ }
+
+ var right = parseBinaryOp()
+ if (!right) {
+ throw new Error('Expected expression')
+ }
+ return {
+ left: left,
+ conjunction: operator.toLowerCase(),
+ right: right
+ }
+ }
+ }
+
+ var parseAnd = makeBinaryOpParser('AND', parseAtom)
+ var parseExpression = makeBinaryOpParser('OR', parseAnd)
+
+ var node = parseExpression()
+ if (!node || hasMore()) {
+ throw new Error('Syntax error')
+ }
+ return node
+}
diff --git a/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js
new file mode 100644
index 00000000000000..b74fce2e2c6632
--- /dev/null
+++ b/deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js
@@ -0,0 +1,131 @@
+'use strict'
+
+var licenses = []
+ .concat(require('spdx-license-ids'))
+ .concat(require('spdx-license-ids/deprecated'))
+var exceptions = require('spdx-exceptions')
+
+module.exports = function (source) {
+ var index = 0
+
+ function hasMore () {
+ return index < source.length
+ }
+
+ // `value` can be a regexp or a string.
+ // If it is recognized, the matching source string is returned and
+ // the index is incremented. Otherwise `undefined` is returned.
+ function read (value) {
+ if (value instanceof RegExp) {
+ var chars = source.slice(index)
+ var match = chars.match(value)
+ if (match) {
+ index += match[0].length
+ return match[0]
+ }
+ } else {
+ if (source.indexOf(value, index) === index) {
+ index += value.length
+ return value
+ }
+ }
+ }
+
+ function skipWhitespace () {
+ read(/[ ]*/)
+ }
+
+ function operator () {
+ var string
+ var possibilities = ['WITH', 'AND', 'OR', '(', ')', ':', '+']
+ for (var i = 0; i < possibilities.length; i++) {
+ string = read(possibilities[i])
+ if (string) {
+ break
+ }
+ }
+
+ if (string === '+' && index > 1 && source[index - 2] === ' ') {
+ throw new Error('Space before `+`')
+ }
+
+ return string && {
+ type: 'OPERATOR',
+ string: string
+ }
+ }
+
+ function idstring () {
+ return read(/[A-Za-z0-9-.]+/)
+ }
+
+ function expectIdstring () {
+ var string = idstring()
+ if (!string) {
+ throw new Error('Expected idstring at offset ' + index)
+ }
+ return string
+ }
+
+ function documentRef () {
+ if (read('DocumentRef-')) {
+ var string = expectIdstring()
+ return { type: 'DOCUMENTREF', string: string }
+ }
+ }
+
+ function licenseRef () {
+ if (read('LicenseRef-')) {
+ var string = expectIdstring()
+ return { type: 'LICENSEREF', string: string }
+ }
+ }
+
+ function identifier () {
+ var begin = index
+ var string = idstring()
+
+ if (licenses.indexOf(string) !== -1) {
+ return {
+ type: 'LICENSE',
+ string: string
+ }
+ } else if (exceptions.indexOf(string) !== -1) {
+ return {
+ type: 'EXCEPTION',
+ string: string
+ }
+ }
+
+ index = begin
+ }
+
+ // Tries to read the next token. Returns `undefined` if no token is
+ // recognized.
+ function parseToken () {
+ // Ordering matters
+ return (
+ operator() ||
+ documentRef() ||
+ licenseRef() ||
+ identifier()
+ )
+ }
+
+ var tokens = []
+ while (hasMore()) {
+ skipWhitespace()
+ if (!hasMore()) {
+ break
+ }
+
+ var token = parseToken()
+ if (!token) {
+ throw new Error('Unexpected `' + source[index] +
+ '` at offset ' + index)
+ }
+
+ tokens.push(token)
+ }
+ return tokens
+}
diff --git a/deps/npm/package.json b/deps/npm/package.json
index 5fcd785d31bffd..d157883a10bbc7 100644
--- a/deps/npm/package.json
+++ b/deps/npm/package.json
@@ -1,5 +1,5 @@
{
- "version": "10.5.1",
+ "version": "10.5.2",
"name": "npm",
"description": "a package manager for JavaScript",
"workspaces": [
@@ -55,8 +55,8 @@
"@npmcli/arborist": "^7.2.1",
"@npmcli/config": "^8.0.2",
"@npmcli/fs": "^3.1.0",
- "@npmcli/map-workspaces": "^3.0.4",
- "@npmcli/package-json": "^5.0.0",
+ "@npmcli/map-workspaces": "^3.0.6",
+ "@npmcli/package-json": "^5.0.2",
"@npmcli/promise-spawn": "^7.0.1",
"@npmcli/redact": "^1.1.0",
"@npmcli/run-script": "^7.0.4",
@@ -76,7 +76,7 @@
"hosted-git-info": "^7.0.1",
"ini": "^4.1.2",
"init-package-json": "^6.0.2",
- "is-cidr": "^5.0.3",
+ "is-cidr": "^5.0.5",
"json-parse-even-better-errors": "^3.0.1",
"libnpmaccess": "^8.0.1",
"libnpmdiff": "^6.0.3",
@@ -112,7 +112,7 @@
"qrcode-terminal": "^0.12.0",
"read": "^3.0.1",
"semver": "^7.6.0",
- "spdx-expression-parse": "^3.0.1",
+ "spdx-expression-parse": "^4.0.0",
"ssri": "^10.0.5",
"supports-color": "^9.4.0",
"tar": "^6.2.1",
@@ -199,7 +199,7 @@
"devDependencies": {
"@npmcli/docs": "^1.0.0",
"@npmcli/eslint-config": "^4.0.2",
- "@npmcli/git": "^5.0.4",
+ "@npmcli/git": "^5.0.5",
"@npmcli/mock-globals": "^1.0.0",
"@npmcli/mock-registry": "^1.0.0",
"@npmcli/template-oss": "4.21.3",
diff --git a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs
index 79518c2b8c8670..9d67091f7a0d4e 100644
--- a/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/commands/config.js.test.cjs
@@ -34,8 +34,6 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"color": true,
"commit-hooks": true,
"cpu": null,
- "os": null,
- "libc": null,
"depth": null,
"description": true,
"dev": false,
@@ -50,8 +48,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"dry-run": false,
"editor": "{EDITOR}",
"engine-strict": false,
- "expect-results": null,
"expect-result-count": null,
+ "expect-results": null,
"fetch-retries": 2,
"fetch-retry-factor": 10,
"fetch-retry-maxtimeout": 60000,
@@ -90,10 +88,9 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"key": null,
"legacy-bundling": false,
"legacy-peer-deps": false,
+ "libc": null,
"link": false,
"local-address": null,
- "sbom-format": null,
- "sbom-type": "library",
"location": "user",
"lockfile-version": null,
"loglevel": "notice",
@@ -111,6 +108,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"omit-lockfile-registry-resolved": false,
"only": null,
"optional": null,
+ "os": null,
"otp": null,
"package": [],
"package-lock": true,
@@ -138,6 +136,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"save-peer": false,
"save-prefix": "^",
"save-prod": false,
+ "sbom-format": null,
+ "sbom-type": "library",
"scope": "",
"script-shell": null,
"searchexclude": "",
diff --git a/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs b/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs
index 45406c994002aa..4f947be5cf5dec 100644
--- a/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/commands/publish.js.test.cjs
@@ -350,6 +350,10 @@ Array [
]
`
+exports[`test/lib/commands/publish.js TAP prioritize CLI flags over publishConfig > new package version 1`] = `
++ test-package@1.0.0
+`
+
exports[`test/lib/commands/publish.js TAP public access > must match snapshot 1`] = `
Array [
Array [
diff --git a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs
index e396fce2475ea3..64dad96903ec32 100644
--- a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs
@@ -2078,8 +2078,6 @@ Array [
"color",
"commit-hooks",
"cpu",
- "os",
- "libc",
"depth",
"description",
"dev",
@@ -2094,8 +2092,8 @@ Array [
"dry-run",
"editor",
"engine-strict",
- "expect-results",
"expect-result-count",
+ "expect-results",
"fetch-retries",
"fetch-retry-factor",
"fetch-retry-maxtimeout",
@@ -2135,10 +2133,9 @@ Array [
"key",
"legacy-bundling",
"legacy-peer-deps",
+ "libc",
"link",
"local-address",
- "sbom-format",
- "sbom-type",
"location",
"lockfile-version",
"loglevel",
@@ -2154,6 +2151,7 @@ Array [
"omit-lockfile-registry-resolved",
"only",
"optional",
+ "os",
"otp",
"package",
"package-lock",
@@ -2182,6 +2180,8 @@ Array [
"save-peer",
"save-prefix",
"save-prod",
+ "sbom-format",
+ "sbom-type",
"scope",
"script-shell",
"searchexclude",
@@ -2238,8 +2238,6 @@ Array [
"color",
"commit-hooks",
"cpu",
- "os",
- "libc",
"depth",
"description",
"dev",
@@ -2281,9 +2279,8 @@ Array [
"key",
"legacy-bundling",
"legacy-peer-deps",
+ "libc",
"local-address",
- "sbom-format",
- "sbom-type",
"location",
"lockfile-version",
"loglevel",
@@ -2295,6 +2292,7 @@ Array [
"omit-lockfile-registry-resolved",
"only",
"optional",
+ "os",
"otp",
"package",
"package-lock",
@@ -2322,6 +2320,8 @@ Array [
"save-peer",
"save-prefix",
"save-prod",
+ "sbom-format",
+ "sbom-type",
"scope",
"script-shell",
"searchexclude",
@@ -2347,8 +2347,8 @@ Array [
exports[`test/lib/docs.js TAP config > keys that are not flattened 1`] = `
Array [
- "expect-results",
"expect-result-count",
+ "expect-results",
"init-author-email",
"init-author-name",
"init-author-url",
diff --git a/deps/npm/test/lib/commands/publish.js b/deps/npm/test/lib/commands/publish.js
index ec7299e9eec530..751cd97d8acf6e 100644
--- a/deps/npm/test/lib/commands/publish.js
+++ b/deps/npm/test/lib/commands/publish.js
@@ -131,6 +131,58 @@ t.test('re-loads publishConfig.registry if added during script process', async t
t.matchSnapshot(joinedOutput(), 'new package version')
})
+t.test('prioritize CLI flags over publishConfig', async t => {
+ const publishConfig = { registry: 'http://publishconfig' }
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ [`${alternateRegistry.slice(6)}/:_authToken`]: 'test-other-token',
+ },
+ prefixDir: {
+ 'package.json': JSON.stringify({
+ ...pkgJson,
+ scripts: {
+ prepare: 'cp new.json package.json',
+ },
+ }, null, 2),
+ 'new.json': JSON.stringify({
+ ...pkgJson,
+ publishConfig,
+ }),
+ },
+ argv: ['--registry', alternateRegistry],
+ })
+ const registry = new MockRegistry({
+ tap: t,
+ registry: alternateRegistry,
+ authorization: 'test-other-token',
+ })
+ registry.nock.put(`/${pkg}`, body => {
+ return t.match(body, {
+ _id: pkg,
+ name: pkg,
+ 'dist-tags': { latest: '1.0.0' },
+ access: null,
+ versions: {
+ '1.0.0': {
+ name: pkg,
+ version: '1.0.0',
+ _id: `${pkg}@1.0.0`,
+ dist: {
+ shasum: /\.*/,
+ tarball: `http:${alternateRegistry.slice(6)}/test-package/-/test-package-1.0.0.tgz`,
+ },
+ publishConfig,
+ },
+ },
+ _attachments: {
+ [`${pkg}-1.0.0.tgz`]: {},
+ },
+ })
+ }).reply(200, {})
+ await npm.exec('publish', [])
+ t.matchSnapshot(joinedOutput(), 'new package version')
+})
+
t.test('json', async t => {
const { joinedOutput, npm, logs } = await loadMockNpm(t, {
config: {
diff --git a/deps/npm/test/lib/commands/unpublish.js b/deps/npm/test/lib/commands/unpublish.js
index 097309393a2585..31dc77ea46cd0c 100644
--- a/deps/npm/test/lib/commands/unpublish.js
+++ b/deps/npm/test/lib/commands/unpublish.js
@@ -408,6 +408,36 @@ t.test('publishConfig no spec', async t => {
t.equal(joinedOutput(), '- test-package')
})
+t.test('prioritize CLI flags over publishConfig no spec', async t => {
+ const alternateRegistry = 'https://other.registry.npmjs.org'
+ const publishConfig = { registry: 'http://publishconfig' }
+ const { joinedOutput, npm } = await loadMockNpm(t, {
+ config: {
+ force: true,
+ '//other.registry.npmjs.org/:_authToken': 'test-other-token',
+ },
+ prefixDir: {
+ 'package.json': JSON.stringify({
+ name: pkg,
+ version: '1.0.0',
+ publishConfig,
+ }, null, 2),
+ },
+ argv: ['--registry', alternateRegistry],
+ })
+
+ const registry = new MockRegistry({
+ tap: t,
+ registry: alternateRegistry,
+ authorization: 'test-other-token',
+ })
+ const manifest = registry.manifest({ name: pkg })
+ await registry.package({ manifest, query: { write: true }, times: 2 })
+ registry.unpublish({ manifest })
+ await npm.exec('unpublish', [])
+ t.equal(joinedOutput(), '- test-package')
+})
+
t.test('publishConfig with spec', async t => {
const alternateRegistry = 'https://other.registry.npmjs.org'
const { joinedOutput, npm } = await loadMockNpm(t, {
diff --git a/deps/npm/test/lib/utils/log-file.js b/deps/npm/test/lib/utils/log-file.js
index c02f338a84ee01..f34dda8f524337 100644
--- a/deps/npm/test/lib/utils/log-file.js
+++ b/deps/npm/test/lib/utils/log-file.js
@@ -57,8 +57,10 @@ const loadLogFile = async (t, { buffer = [], mocks, testdir = {}, ...options } =
logFile,
LogFile,
readLogs: async () => {
- const logDir = await fs.readdir(root)
- const logFiles = logDir.map((f) => path.join(root, f))
+ const logDir = await fs.readdir(root, { withFileTypes: true })
+ const logFiles = logDir
+ .filter(f => f.isFile())
+ .map((f) => path.join(root, f.name))
.filter((f) => _fs.existsSync(f))
return Promise.all(logFiles.map(async (f) => {
const content = await fs.readFile(f, 'utf8')
@@ -202,6 +204,22 @@ t.test('cleans logs', async t => {
t.equal(logs.length, logsMax + 1)
})
+t.test('cleans logs even when find folder inside logs folder', async t => {
+ const logsMax = 5
+ const { readLogs } = await loadLogFile(t, {
+ logsMax,
+ testdir: {
+ ...makeOldLogs(10),
+ ignore_folder: {
+ 'ignored-file.txt': 'hello',
+ },
+ },
+ })
+
+ const logs = await readLogs()
+ t.equal(logs.length, logsMax + 1)
+})
+
t.test('doesnt clean current log by default', async t => {
const logsMax = 1
const { readLogs, logFile } = await loadLogFile(t, {
@@ -240,35 +258,6 @@ t.test('doesnt need to clean', async t => {
t.equal(logs.length, oldLogs + 1)
})
-t.test('glob error', async t => {
- const { readLogs } = await loadLogFile(t, {
- logsMax: 5,
- mocks: {
- glob: { glob: () => {
- throw new Error('bad glob')
- } },
- },
- })
-
- const logs = await readLogs()
- t.equal(logs.length, 1)
- t.match(last(logs).content, /error cleaning log files .* bad glob/)
-})
-
-t.test('do not log cleaning errors when logging is disabled', async t => {
- const { readLogs } = await loadLogFile(t, {
- logsMax: 0,
- mocks: {
- glob: () => {
- throw new Error('should not be logged')
- },
- },
- })
-
- const logs = await readLogs()
- t.equal(logs.length, 0)
-})
-
t.test('cleans old style logs too', async t => {
const logsMax = 5
const oldLogs = 10
@@ -290,6 +279,7 @@ t.test('rimraf error', async t => {
testdir: makeOldLogs(oldLogs),
mocks: {
'fs/promises': {
+ readdir: fs.readdir,
rm: async (...args) => {
if (count >= 3) {
throw new Error('bad rimraf')