From 014bf01efc11f7ac9ad41d2cfc28ee964bfc922f Mon Sep 17 00:00:00 2001 From: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:46:46 -0400 Subject: [PATCH 01/98] lib: replace string prototype usage with alternatives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52440 Reviewed-By: Matteo Collina Reviewed-By: Moshe Atlow Reviewed-By: Vinícius Lourenço Claro Cardoso Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rafael Gonzaga Reviewed-By: Antoine du Hamel --- lib/internal/options.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/internal/options.js b/lib/internal/options.js index effe3249888efd..5cecdc00e5ce95 100644 --- a/lib/internal/options.js +++ b/lib/internal/options.js @@ -5,6 +5,10 @@ const { getEmbedderOptions: getEmbedderOptionsFromBinding, } = internalBinding('options'); +const { + StringPrototypeSlice, +} = primordials; + let warnOnAllowUnauthorized = true; let optionsMap; @@ -43,8 +47,15 @@ function refreshOptions() { function getOptionValue(optionName) { const options = getCLIOptionsFromBinding(); - if (optionName.startsWith('--no-')) { - const option = options.get('--' + optionName.slice(5)); + if ( + optionName.length > 5 && + optionName[0] === '-' && + optionName[1] === '-' && + optionName[2] === 'n' && + optionName[3] === 'o' && + optionName[4] === '-' + ) { + const option = options.get('--' + StringPrototypeSlice(optionName, 5)); return option && !option.value; } return options.get(optionName)?.value; From 61e1ac0b8c9a48a5bfea4f937e3e80274a3f42b7 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 12 Apr 2024 01:29:55 +0200 Subject: [PATCH 02/98] crypto: enable NODE_EXTRA_CA_CERTS with BoringSSL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52217 Reviewed-By: Tobias Nießen Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca --- src/node.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node.cc b/src/node.cc index 64ade90dfa7e86..5d730985bfea4a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1084,7 +1084,8 @@ InitializeOncePerProcessInternal(const std::vector& args, } if (!(flags & ProcessInitializationFlags::kNoInitOpenSSL)) { -#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL) +#if HAVE_OPENSSL +#ifndef OPENSSL_IS_BORINGSSL auto GetOpenSSLErrorString = []() -> std::string { std::string ret; ERR_print_errors_cb( @@ -1184,13 +1185,13 @@ InitializeOncePerProcessInternal(const std::vector& args, CHECK(crypto::CSPRNG(buffer, length).is_ok()); return true; }); - +#endif // !defined(OPENSSL_IS_BORINGSSL) { std::string extra_ca_certs; if (credentials::SafeGetenv("NODE_EXTRA_CA_CERTS", &extra_ca_certs)) crypto::UseExtraCaCerts(extra_ca_certs); } -#endif // HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL) +#endif // HAVE_OPENSSL } if (!(flags & ProcessInitializationFlags::kNoInitializeNodeV8Platform)) { From 8738b89971d5591160ac8785aa15cd266ac723ce Mon Sep 17 00:00:00 2001 From: npm CLI robot Date: Thu, 11 Apr 2024 18:24:57 -0700 Subject: [PATCH 03/98] deps: upgrade npm to 10.5.2 PR-URL: https://github.com/nodejs/node/pull/52458 Reviewed-By: Luigi Pinca Reviewed-By: Marco Ippolito Reviewed-By: Mohammed Keyvanzadeh --- deps/npm/docs/content/commands/npm-audit.md | 2 +- deps/npm/docs/content/commands/npm-ls.md | 2 +- deps/npm/docs/content/commands/npm.md | 2 +- deps/npm/docs/output/commands/npm-audit.html | 2 +- deps/npm/docs/output/commands/npm-ls.html | 2 +- deps/npm/docs/output/commands/npm.html | 2 +- deps/npm/lib/base-command.js | 2 +- deps/npm/lib/commands/owner.js | 3 +- deps/npm/lib/commands/ping.js | 4 +- deps/npm/lib/commands/publish.js | 7 +- deps/npm/lib/commands/unpublish.js | 7 +- deps/npm/lib/utils/error-message.js | 2 +- deps/npm/lib/utils/log-file.js | 42 +- deps/npm/lib/utils/update-notifier.js | 12 +- deps/npm/man/man1/npm-audit.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 2 +- deps/npm/man/man1/npm.1 | 2 +- .../node_modules/@npmcli/agent/lib/agents.js | 5 +- .../node_modules/@npmcli/agent/package.json | 4 +- .../arborist/lib/arborist/build-ideal-tree.js | 4 +- .../@npmcli/arborist/lib/place-dep.js | 4 +- .../@npmcli/arborist/package.json | 3 +- .../config/lib/definitions/definitions.js | 4321 ++++++++--------- .../node_modules/@npmcli/config/lib/index.js | 49 +- .../@npmcli/config/lib/nerf-dart.js | 2 +- .../@npmcli/config/lib/parse-field.js | 2 +- .../@npmcli/config/lib/type-defs.js | 10 +- .../node_modules/@npmcli/config/lib/umask.js | 3 +- .../node_modules/@npmcli/config/package.json | 2 +- deps/npm/node_modules/@npmcli/git/lib/is.js | 4 +- .../npm/node_modules/@npmcli/git/package.json | 2 +- .../@npmcli/map-workspaces/lib/index.js | 143 +- .../@npmcli/map-workspaces/package.json | 8 +- .../@npmcli/package-json/lib/normalize.js | 53 +- .../@npmcli/package-json/package.json | 18 +- .../@sigstore/bundle/dist/build.js | 28 +- .../@sigstore/bundle/dist/bundle.js | 5 +- .../@sigstore/bundle/dist/index.js | 3 +- .../@sigstore/bundle/dist/validate.js | 3 +- .../@sigstore/bundle/package.json | 4 +- .../@sigstore/core/dist/crypto.js | 4 +- .../node_modules/@sigstore/core/package.json | 2 +- .../dist/__generated__/sigstore_trustroot.js | 54 +- .../@sigstore/protobuf-specs/package.json | 6 +- .../@sigstore/sign/dist/bundler/bundle.js | 3 +- .../@sigstore/sign/dist/bundler/dsse.js | 3 +- .../node_modules/@sigstore/sign/package.json | 8 +- .../@sigstore/verify/dist/tlog/intoto.js | 3 +- .../@sigstore/verify/dist/trust/index.js | 11 +- .../@sigstore/verify/package.json | 8 +- deps/npm/node_modules/builtins/index.js | 6 +- deps/npm/node_modules/builtins/package.json | 9 +- deps/npm/node_modules/cidr-regex/package.json | 15 +- deps/npm/node_modules/hasown/package.json | 7 +- deps/npm/node_modules/hasown/tsconfig.json | 49 +- deps/npm/node_modules/is-cidr/LICENSE | 22 - deps/npm/node_modules/is-cidr/package.json | 17 +- deps/npm/node_modules/libnpmdiff/package.json | 2 +- deps/npm/node_modules/libnpmexec/package.json | 2 +- deps/npm/node_modules/libnpmfund/package.json | 2 +- deps/npm/node_modules/libnpmpack/package.json | 2 +- .../postcss-selector-parser/package.json | 5 +- deps/npm/node_modules/sigstore/package.json | 12 +- .../node_modules/socks-proxy-agent/LICENSE | 22 + .../socks-proxy-agent/dist/index.js | 4 + .../socks-proxy-agent/package.json | 4 +- .../socks/build/common/helpers.js | 6 +- deps/npm/node_modules/socks/package.json | 7 +- .../spdx-expression-parse/AUTHORS | 4 + .../spdx-expression-parse/LICENSE | 22 + .../spdx-expression-parse/index.js | 8 + .../spdx-expression-parse/package.json | 39 + .../spdx-expression-parse/parse.js | 138 + .../spdx-expression-parse/scan.js | 131 + .../spdx-expression-parse/package.json | 2 +- .../spdx-expression-parse/scan.js | 4 +- .../spdx-expression-parse/AUTHORS | 4 + .../spdx-expression-parse/LICENSE | 22 + .../spdx-expression-parse/index.js | 8 + .../spdx-expression-parse/package.json | 39 + .../spdx-expression-parse/parse.js | 138 + .../spdx-expression-parse/scan.js | 131 + deps/npm/package.json | 12 +- .../test/lib/commands/config.js.test.cjs | 10 +- .../test/lib/commands/publish.js.test.cjs | 4 + .../tap-snapshots/test/lib/docs.js.test.cjs | 20 +- deps/npm/test/lib/commands/publish.js | 52 + deps/npm/test/lib/commands/unpublish.js | 30 + deps/npm/test/lib/utils/log-file.js | 52 +- 89 files changed, 3333 insertions(+), 2609 deletions(-) delete mode 100644 deps/npm/node_modules/is-cidr/LICENSE create mode 100644 deps/npm/node_modules/socks-proxy-agent/LICENSE create mode 100644 deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS create mode 100644 deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE create mode 100644 deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js create mode 100644 deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json create mode 100644 deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js create mode 100644 deps/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js create mode 100644 deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS create mode 100644 deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE create mode 100644 deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js create mode 100644 deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json create mode 100644 deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js create mode 100644 deps/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js 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') From 44ee04cf9fc08d3a1bdde737e02a7ff033b2d430 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 11 Apr 2024 22:50:25 -0400 Subject: [PATCH 04/98] buffer: improve `base64` and `base64url` performance Co-authored-by: Daniel Lemire PR-URL: https://github.com/nodejs/node/pull/52428 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- src/string_bytes.cc | 133 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 119 insertions(+), 14 deletions(-) diff --git a/src/string_bytes.cc b/src/string_bytes.cc index b3c0a90b548c70..c6ebcf89c4058b 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -346,17 +346,113 @@ size_t StringBytes::Write(Isolate* isolate, } case BASE64URL: - // Fall through - case BASE64: - if (str->IsExternalOneByte()) { + if (str->IsExternalOneByte()) { // 8-bit case auto ext = str->GetExternalOneByteStringResource(); - nbytes = base64_decode(buf, buflen, ext->data(), ext->length()); + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( + ext->data(), ext->length(), buf, written_len, simdutf::base64_url); + if (result.error == simdutf::error_code::SUCCESS) { + nbytes = written_len; + } else { + // The input does not follow the WHATWG forgiving-base64 specification + // adapted for base64url + // https://infra.spec.whatwg.org/#forgiving-base64-decode + nbytes = base64_decode(buf, buflen, ext->data(), ext->length()); + } + } else if (str->IsOneByte()) { + MaybeStackBuffer stack_buf(str->Length()); + str->WriteOneByte(isolate, + stack_buf.out(), + 0, + str->Length(), + String::NO_NULL_TERMINATION); + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( + reinterpret_cast(*stack_buf), + stack_buf.length(), + buf, + written_len, + simdutf::base64_url); + if (result.error == simdutf::error_code::SUCCESS) { + nbytes = written_len; + } else { + // The input does not follow the WHATWG forgiving-base64 specification + // (adapted for base64url with + and / replaced by - and _). + // https://infra.spec.whatwg.org/#forgiving-base64-decode + nbytes = base64_decode(buf, buflen, *stack_buf, stack_buf.length()); + } } else { String::Value value(isolate, str); - nbytes = base64_decode(buf, buflen, *value, value.length()); + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( + reinterpret_cast(*value), + value.length(), + buf, + written_len, + simdutf::base64_url); + if (result.error == simdutf::error_code::SUCCESS) { + nbytes = written_len; + } else { + // The input does not follow the WHATWG forgiving-base64 specification + // (adapted for base64url with + and / replaced by - and _). + // https://infra.spec.whatwg.org/#forgiving-base64-decode + nbytes = base64_decode(buf, buflen, *value, value.length()); + } } break; + case BASE64: { + if (str->IsExternalOneByte()) { // 8-bit case + auto ext = str->GetExternalOneByteStringResource(); + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( + ext->data(), ext->length(), buf, written_len); + if (result.error == simdutf::error_code::SUCCESS) { + nbytes = written_len; + } else { + // The input does not follow the WHATWG forgiving-base64 specification + // https://infra.spec.whatwg.org/#forgiving-base64-decode + nbytes = base64_decode(buf, buflen, ext->data(), ext->length()); + } + } else if (str->IsOneByte()) { + MaybeStackBuffer stack_buf(str->Length()); + str->WriteOneByte(isolate, + stack_buf.out(), + 0, + str->Length(), + String::NO_NULL_TERMINATION); + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( + reinterpret_cast(*stack_buf), + stack_buf.length(), + buf, + written_len); + if (result.error == simdutf::error_code::SUCCESS) { + nbytes = written_len; + } else { + // The input does not follow the WHATWG forgiving-base64 specification + // (adapted for base64url with + and / replaced by - and _). + // https://infra.spec.whatwg.org/#forgiving-base64-decode + nbytes = base64_decode(buf, buflen, *stack_buf, stack_buf.length()); + } + } else { + String::Value value(isolate, str); + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( + reinterpret_cast(*value), + value.length(), + buf, + written_len); + if (result.error == simdutf::error_code::SUCCESS) { + nbytes = written_len; + } else { + // The input does not follow the WHATWG base64 specification + // https://infra.spec.whatwg.org/#forgiving-base64-decode + nbytes = base64_decode(buf, buflen, *value, value.length()); + } + } + break; + } case HEX: if (str->IsExternalOneByte()) { auto ext = str->GetExternalOneByteStringResource(); @@ -411,9 +507,12 @@ Maybe StringBytes::StorageSize(Isolate* isolate, break; case BASE64URL: - // Fall through + data_size = simdutf::base64_length_from_binary(str->Length(), + simdutf::base64_url); + break; + case BASE64: - data_size = base64_decoded_size_fast(str->Length()); + data_size = simdutf::base64_length_from_binary(str->Length()); break; case HEX: @@ -452,11 +551,15 @@ Maybe StringBytes::Size(Isolate* isolate, case UCS2: return Just(str->Length() * sizeof(uint16_t)); - case BASE64URL: - // Fall through + case BASE64URL: { + String::Value value(isolate, str); + return Just(simdutf::base64_length_from_binary(value.length(), + simdutf::base64_url)); + } + case BASE64: { String::Value value(isolate, str); - return Just(base64_decoded_size(*value, value.length())); + return Just(simdutf::base64_length_from_binary(value.length())); } case HEX: @@ -609,28 +712,30 @@ MaybeLocal StringBytes::Encode(Isolate* isolate, return ExternOneByteString::NewFromCopy(isolate, buf, buflen, error); case BASE64: { - size_t dlen = base64_encoded_size(buflen); + size_t dlen = simdutf::base64_length_from_binary(buflen); char* dst = node::UncheckedMalloc(dlen); if (dst == nullptr) { *error = node::ERR_MEMORY_ALLOCATION_FAILED(isolate); return MaybeLocal(); } - size_t written = base64_encode(buf, buflen, dst, dlen); + size_t written = simdutf::binary_to_base64(buf, buflen, dst); CHECK_EQ(written, dlen); return ExternOneByteString::New(isolate, dst, dlen, error); } case BASE64URL: { - size_t dlen = base64_encoded_size(buflen, Base64Mode::URL); + size_t dlen = + simdutf::base64_length_from_binary(buflen, simdutf::base64_url); char* dst = node::UncheckedMalloc(dlen); if (dst == nullptr) { *error = node::ERR_MEMORY_ALLOCATION_FAILED(isolate); return MaybeLocal(); } - size_t written = base64_encode(buf, buflen, dst, dlen, Base64Mode::URL); + size_t written = + simdutf::binary_to_base64(buf, buflen, dst, simdutf::base64_url); CHECK_EQ(written, dlen); return ExternOneByteString::New(isolate, dst, dlen, error); From f6145aa2ca3fa34a2fad2318b41f7284c2c76af4 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Fri, 12 Apr 2024 15:39:56 +0100 Subject: [PATCH 05/98] lib: convert WeakMaps in cjs loader with private symbol properties Symbol properties are typically more GC-efficient than using WeakMaps, since WeakMap requires ephemeron GC. `module[kModuleExportNames]` would be easier to read than `importedCJSCache.get(module).exportNames` as well. PR-URL: https://github.com/nodejs/node/pull/52095 Reviewed-By: Geoffrey Booth Reviewed-By: Joyee Cheung Reviewed-By: Antoine du Hamel --- lib/internal/modules/cjs/loader.js | 107 ++++++++++++++---------- lib/internal/modules/esm/translators.js | 21 +++-- src/env_properties.h | 5 ++ 3 files changed, 79 insertions(+), 54 deletions(-) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index cacabb771f7115..a81f180958aebf 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -50,7 +50,6 @@ const { ReflectSet, RegExpPrototypeExec, SafeMap, - SafeWeakMap, String, StringPrototypeCharAt, StringPrototypeCharCodeAt, @@ -62,16 +61,39 @@ const { StringPrototypeStartsWith, Symbol, } = primordials; +const { + privateSymbols: { + module_source_private_symbol, + module_export_names_private_symbol, + module_circular_visited_private_symbol, + module_export_private_symbol, + module_parent_private_symbol, + }, +} = internalBinding('util'); const { kEvaluated } = internalBinding('module_wrap'); -// Map used to store CJS parsing data or for ESM loading. -const importedCJSCache = new SafeWeakMap(); +// Internal properties for Module instances. +/** + * Cached {@link Module} source string. + */ +const kModuleSource = module_source_private_symbol; +/** + * Cached {@link Module} export names for ESM loader. + */ +const kModuleExportNames = module_export_names_private_symbol; +/** + * {@link Module} circular dependency visited flag. + */ +const kModuleCircularVisited = module_circular_visited_private_symbol; /** - * Map of already-loaded CJS modules to use. + * {@link Module} export object snapshot for ESM loader. */ -const cjsExportsCache = new SafeWeakMap(); -const requiredESMSourceCache = new SafeWeakMap(); +const kModuleExport = module_export_private_symbol; +/** + * {@link Module} parent module. + */ +const kModuleParent = module_parent_private_symbol; const kIsMainSymbol = Symbol('kIsMainSymbol'); const kIsCachedByESMLoader = Symbol('kIsCachedByESMLoader'); @@ -79,8 +101,10 @@ const kRequiredModuleSymbol = Symbol('kRequiredModuleSymbol'); const kIsExecuting = Symbol('kIsExecuting'); // Set first due to cycle with ESM loader functions. module.exports = { - cjsExportsCache, - importedCJSCache, + kModuleSource, + kModuleExport, + kModuleExportNames, + kModuleCircularVisited, initializeCJS, entryPointSource: undefined, // Set below. Module, @@ -257,8 +281,6 @@ function reportModuleNotFoundToWatchMode(basePath, extensions) { } } -/** @type {Map} */ -const moduleParentCache = new SafeWeakMap(); /** * Create a new module instance. * @param {string} id @@ -268,7 +290,7 @@ function Module(id = '', parent) { this.id = id; this.path = path.dirname(id); setOwnProperty(this, 'exports', {}); - moduleParentCache.set(this, parent); + this[kModuleParent] = parent; updateChildren(parent, this, false); this.filename = null; this.loaded = false; @@ -356,17 +378,19 @@ ObjectDefineProperty(BuiltinModule.prototype, 'isPreloading', isPreloadingDesc); /** * Get the parent of the current module from our cache. + * @this {Module} */ function getModuleParent() { - return moduleParentCache.get(this); + return this[kModuleParent]; } /** * Set the parent of the current module in our cache. + * @this {Module} * @param {Module} value */ function setModuleParent(value) { - moduleParentCache.set(this, value); + this[kModuleParent] = value; } let debug = require('internal/util/debuglog').debuglog('module', (fn) => { @@ -955,7 +979,7 @@ function getExportsForCircularRequire(module) { const requiredESM = module[kRequiredModuleSymbol]; if (requiredESM && requiredESM.getStatus() !== kEvaluated) { let message = `Cannot require() ES Module ${module.id} in a cycle.`; - const parent = moduleParentCache.get(module); + const parent = module[kModuleParent]; if (parent) { message += ` (from ${parent.filename})`; } @@ -1028,25 +1052,24 @@ Module._load = function(request, parent, isMain) { const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); - if (!cachedModule.loaded) { - // If it's not cached by the ESM loader, the loading request - // comes from required CJS, and we can consider it a circular - // dependency when it's cached. - if (!cachedModule[kIsCachedByESMLoader]) { - return getExportsForCircularRequire(cachedModule); - } - // If it's cached by the ESM loader as a way to indirectly pass - // the module in to avoid creating it twice, the loading request - // come from imported CJS. In that case use the importedCJSCache - // to determine if it's loading or not. - const importedCJSMetadata = importedCJSCache.get(cachedModule); - if (importedCJSMetadata.loading) { - return getExportsForCircularRequire(cachedModule); - } - importedCJSMetadata.loading = true; - } else { + if (cachedModule.loaded) { return cachedModule.exports; } + // If it's not cached by the ESM loader, the loading request + // comes from required CJS, and we can consider it a circular + // dependency when it's cached. + if (!cachedModule[kIsCachedByESMLoader]) { + return getExportsForCircularRequire(cachedModule); + } + // If it's cached by the ESM loader as a way to indirectly pass + // the module in to avoid creating it twice, the loading request + // come from imported CJS. In that case use the kModuleCircularVisited + // to determine if it's loading or not. + if (cachedModule[kModuleCircularVisited]) { + return getExportsForCircularRequire(cachedModule); + } + // This is an ESM loader created cache entry, mark it as visited and fallthrough to loading the module. + cachedModule[kModuleCircularVisited] = true; } if (BuiltinModule.canBeRequiredWithoutScheme(filename)) { @@ -1190,7 +1213,7 @@ Module._resolveFilename = function(request, parent, isMain, options) { const requireStack = []; for (let cursor = parent; cursor; - cursor = moduleParentCache.get(cursor)) { + cursor = cursor[kModuleParent]) { ArrayPrototypePush(requireStack, cursor.filename || cursor.id); } let message = `Cannot find module '${request}'`; @@ -1268,9 +1291,7 @@ Module.prototype.load = function(filename) { // Create module entry at load time to snapshot exports correctly const exports = this.exports; // Preemptively cache for ESM loader. - if (!cjsExportsCache.has(this)) { - cjsExportsCache.set(this, exports); - } + this[kModuleExport] = exports; }; /** @@ -1313,7 +1334,7 @@ function loadESMFromCJS(mod, filename) { const isMain = mod[kIsMainSymbol]; // TODO(joyeecheung): we may want to invent optional special handling for default exports here. // For now, it's good enough to be identical to what `import()` returns. - mod.exports = cascadedLoader.importSyncForRequire(mod, filename, source, isMain, moduleParentCache.get(mod)); + mod.exports = cascadedLoader.importSyncForRequire(mod, filename, source, isMain, mod[kModuleParent]); } /** @@ -1406,7 +1427,7 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) { // Only modules being require()'d really need to avoid TLA. if (loadAsESM) { // Pass the source into the .mjs extension handler indirectly through the cache. - requiredESMSourceCache.set(this, content); + this[kModuleSource] = content; loadESMFromCJS(this, filename); return; } @@ -1467,15 +1488,15 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) { * @returns {string} */ function getMaybeCachedSource(mod, filename) { - const cached = importedCJSCache.get(mod); + // If already analyzed the source, then it will be cached. let content; - if (cached?.source) { - content = cached.source; - cached.source = undefined; + if (mod[kModuleSource] !== undefined) { + content = mod[kModuleSource]; + mod[kModuleSource] = undefined; } else { // TODO(joyeecheung): we can read a buffer instead to speed up // compilation. - content = requiredESMSourceCache.get(mod) ?? fs.readFileSync(filename, 'utf8'); + content = fs.readFileSync(filename, 'utf8'); } return content; } @@ -1499,7 +1520,7 @@ Module._extensions['.js'] = function(module, filename) { } // This is an error path because `require` of a `.js` file in a `"type": "module"` scope is not allowed. - const parent = moduleParentCache.get(module); + const parent = module[kModuleParent]; const parentPath = parent?.filename; const packageJsonPath = path.resolve(pkg.path, 'package.json'); const usesEsm = containsModuleSyntax(content, filename); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 7cb4350b675ba9..4bdee1b843fbd5 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -43,10 +43,11 @@ const { stripBOM, } = require('internal/modules/helpers'); const { - cjsExportsCache, - importedCJSCache, kIsCachedByESMLoader, Module: CJSModule, + kModuleSource, + kModuleExport, + kModuleExportNames, } = require('internal/modules/cjs/loader'); const { fileURLToPath, pathToFileURL, URL } = require('internal/url'); let debug = require('internal/util/debuglog').debuglog('esm', (fn) => { @@ -285,9 +286,9 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { } let exports; - if (cjsExportsCache.has(module)) { - exports = cjsExportsCache.get(module); - cjsExportsCache.delete(module); + if (module[kModuleExport] !== undefined) { + exports = module[kModuleExport]; + module[kModuleExport] = undefined; } else { ({ exports } = module); } @@ -366,11 +367,8 @@ translators.set('commonjs', async function commonjsStrategy(url, source, function cjsPreparseModuleExports(filename, source) { // TODO: Do we want to keep hitting the user mutable CJS loader here? let module = CJSModule._cache[filename]; - if (module) { - const cached = importedCJSCache.get(module); - if (cached) { - return { module, exportNames: cached.exportNames }; - } + if (module && module[kModuleExportNames] !== undefined) { + return { module, exportNames: module[kModuleExportNames] }; } const loaded = Boolean(module); if (!loaded) { @@ -378,6 +376,7 @@ function cjsPreparseModuleExports(filename, source) { module.filename = filename; module.paths = CJSModule._nodeModulePaths(module.path); module[kIsCachedByESMLoader] = true; + module[kModuleSource] = source; CJSModule._cache[filename] = module; } @@ -392,7 +391,7 @@ function cjsPreparseModuleExports(filename, source) { const exportNames = new SafeSet(new SafeArrayIterator(exports)); // Set first for cycles. - importedCJSCache.set(module, { source, exportNames }); + module[kModuleExportNames] = exportNames; if (reexports.length) { module.filename = filename; diff --git a/src/env_properties.h b/src/env_properties.h index 55ca60d9f4992b..c28878486e4ac2 100644 --- a/src/env_properties.h +++ b/src/env_properties.h @@ -26,6 +26,11 @@ V(js_transferable_wrapper_private_symbol, "node:js_transferable_wrapper") \ V(entry_point_module_private_symbol, "node:entry_point_module") \ V(entry_point_promise_private_symbol, "node:entry_point_promise") \ + V(module_source_private_symbol, "node:module_source") \ + V(module_export_names_private_symbol, "node:module_export_names") \ + V(module_circular_visited_private_symbol, "node:module_circular_visited") \ + V(module_export_private_symbol, "node:module_export") \ + V(module_parent_private_symbol, "node:module_parent") \ V(napi_type_tag, "node:napi:type_tag") \ V(napi_wrapper, "node:napi:wrapper") \ V(untransferable_object_private_symbol, "node:untransferableObject") \ From fdcde845ee0f9fbfd3624ef6bea229c37755a29c Mon Sep 17 00:00:00 2001 From: Victor Chen Date: Sat, 13 Apr 2024 01:54:42 +0800 Subject: [PATCH 06/98] lib: refactor lazy loading of undici for fetch method Object.defineProperty is updated to lazily load the undici dependency for the fetch method. This change allows for simpler and more reliable mocking of the fetch method for testing purposes, resolving issues encountered with premature method invocation during testing. Fixes: https://github.com/nodejs/node/issues/52015 PR-URL: https://github.com/nodejs/node/pull/52275 Reviewed-By: Moshe Atlow Reviewed-By: Matteo Collina Reviewed-By: Chemi Atlow Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- .../bootstrap/web/exposed-window-or-worker.js | 41 +++++++------------ test/parallel/test-fetch-mock.js | 20 +++++++++ 2 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 test/parallel/test-fetch-mock.js diff --git a/lib/internal/bootstrap/web/exposed-window-or-worker.js b/lib/internal/bootstrap/web/exposed-window-or-worker.js index 2459bee85bb8b0..82888b3cd9512e 100644 --- a/lib/internal/bootstrap/web/exposed-window-or-worker.js +++ b/lib/internal/bootstrap/web/exposed-window-or-worker.js @@ -57,32 +57,21 @@ defineReplaceableLazyAttribute(globalThis, 'perf_hooks', ['performance']); const { installObjectURLMethods } = require('internal/url'); installObjectURLMethods(); -{ - // https://fetch.spec.whatwg.org/#fetch-method - function set(value) { - ObjectDefineProperty(globalThis, 'fetch', { - __proto__: null, - writable: true, - value, - }); - } - ObjectDefineProperty(globalThis, 'fetch', { - __proto__: null, - configurable: true, - enumerable: true, - set, - get() { - function fetch(input, init = undefined) { - // Loading undici alone lead to promises which breaks lots of tests so we - // have to load it really lazily for now. - const { fetch: impl } = require('internal/deps/undici/undici'); - return impl(input, init); - } - set(fetch); - return fetch; - }, - }); -} +let fetchImpl; +// https://fetch.spec.whatwg.org/#fetch-method +ObjectDefineProperty(globalThis, 'fetch', { + __proto__: null, + configurable: true, + enumerable: true, + writable: true, + value: function value(input, init = undefined) { + if (!fetchImpl) { // Implement lazy loading of undici module for fetch function + const undiciModule = require('internal/deps/undici/undici'); + fetchImpl = undiciModule.fetch; + } + return fetchImpl(input, init); + }, +}); // https://xhr.spec.whatwg.org/#interface-formdata // https://fetch.spec.whatwg.org/#headers-class diff --git a/test/parallel/test-fetch-mock.js b/test/parallel/test-fetch-mock.js new file mode 100644 index 00000000000000..b457745f1c4c90 --- /dev/null +++ b/test/parallel/test-fetch-mock.js @@ -0,0 +1,20 @@ +'use strict'; +require('../common'); +const { mock, test } = require('node:test'); +const assert = require('node:assert'); + +test('should correctly stub globalThis.fetch', async () => { + const customFetch = async (url) => { + return { + text: async () => 'foo', + }; + }; + + mock.method(globalThis, 'fetch', customFetch); + + const response = await globalThis.fetch('some-url'); + const text = await response.text(); + + assert.strictEqual(text, 'foo'); + mock.restoreAll(); +}); From 9b18df9dcbfcc9307812427619c8f3a9c6f34f31 Mon Sep 17 00:00:00 2001 From: Ali Hassan <24819103+thisalihassan@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:57:12 +0500 Subject: [PATCH 07/98] url: implement parse method for safer URL parsing Implement the static parse method as per the WHATWG URL specification. Unlike the URL constructor, URL.parse does not throw on invalid input, instead returning null. This behavior allows safer parsing of URLs without the need for try-catch blocks around constructor calls. The implementation follows the steps outlined in the WHATWG URL standard, ensuring compatibility and consistency with web platform URL parsing APIs. Fixes: https://github.com/nodejs/node/issues/52208 Refs: https://github.com/whatwg/url/pull/825 PR-URL: https://github.com/nodejs/node/pull/52280 Reviewed-By: Yagiz Nizipli Reviewed-By: Matteo Collina Reviewed-By: Daniel Lemire Reviewed-By: Benjamin Gruenbaum --- lib/internal/url.js | 24 ++- src/node_url.cc | 11 +- test/fixtures/wpt/README.md | 2 +- .../wpt/url/resources/urltestdata.json | 185 ++++++++++++++++++ .../fixtures/wpt/url/url-statics-parse.any.js | 50 +++++ test/fixtures/wpt/versions.json | 2 +- 6 files changed, 268 insertions(+), 6 deletions(-) create mode 100644 test/fixtures/wpt/url/url-statics-parse.any.js diff --git a/lib/internal/url.js b/lib/internal/url.js index 0e69ff52b5edef..39d79392bd86bc 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -769,6 +769,14 @@ function isURL(self) { return Boolean(self?.href && self.protocol && self.auth === undefined && self.path === undefined); } +/** + * A unique symbol used as a private identifier to safely invoke the URL constructor + * with a special parsing behavior. When passed as the third argument to the URL + * constructor, it signals that the constructor should not throw an exception + * for invalid URL inputs. + */ +const kParseURLSymbol = Symbol('kParseURL'); + class URL { #context = new URLContext(); #searchParams; @@ -787,7 +795,7 @@ class URL { }; } - constructor(input, base = undefined) { + constructor(input, base = undefined, parseSymbol = undefined) { markTransferMode(this, false, false); if (arguments.length === 0) { @@ -801,7 +809,19 @@ class URL { base = `${base}`; } - this.#updateContext(bindingUrl.parse(input, base)); + const raiseException = parseSymbol !== kParseURLSymbol; + const href = bindingUrl.parse(input, base, raiseException); + if (href) { + this.#updateContext(href); + } + } + + static parse(input, base = undefined) { + if (arguments.length === 0) { + throw new ERR_MISSING_ARGS('url'); + } + const parsedURLObject = new URL(input, base, kParseURLSymbol); + return parsedURLObject.href ? parsedURLObject : null; } [inspect.custom](depth, opts) { diff --git a/src/node_url.cc b/src/node_url.cc index 95d15c78407359..74b639c23084b5 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -233,6 +233,9 @@ void BindingData::Parse(const FunctionCallbackInfo& args) { CHECK_GE(args.Length(), 1); CHECK(args[0]->IsString()); // input // args[1] // base url + // args[2] // raise Exception + + const bool raise_exception = args.Length() > 2 && args[2]->IsTrue(); Realm* realm = Realm::GetCurrent(args); BindingData* binding_data = realm->GetBindingData(); @@ -245,16 +248,20 @@ void BindingData::Parse(const FunctionCallbackInfo& args) { if (args[1]->IsString()) { base_ = Utf8Value(isolate, args[1]).ToString(); base = ada::parse(*base_); - if (!base) { + if (!base && raise_exception) { return ThrowInvalidURL(realm->env(), input.ToStringView(), base_); + } else if (!base) { + return; } base_pointer = &base.value(); } auto out = ada::parse(input.ToStringView(), base_pointer); - if (!out) { + if (!out && raise_exception) { return ThrowInvalidURL(realm->env(), input.ToStringView(), base_); + } else if (!out) { + return; } binding_data->UpdateComponents(out->get_components(), out->type); diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index a4ca98dc7ffa4f..3a2bb782480ef6 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -28,7 +28,7 @@ Last update: - resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing - resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources - streams: https://github.com/web-platform-tests/wpt/tree/3df6d94318/streams -- url: https://github.com/web-platform-tests/wpt/tree/c2d7e70b52/url +- url: https://github.com/web-platform-tests/wpt/tree/0f550ab9f5/url - user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json index 287a84b467a48b..9f1be0449c63d3 100644 --- a/test/fixtures/wpt/url/resources/urltestdata.json +++ b/test/fixtures/wpt/url/resources/urltestdata.json @@ -734,6 +734,36 @@ "search": "", "hash": "" }, + { + "input": "http://a:b@c\\", + "base": null, + "href": "http://a:b@c/", + "origin": "http://c", + "protocol": "http:", + "username": "a", + "password": "b", + "host": "c", + "hostname": "c", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "ws://a@b\\c", + "base": null, + "href": "ws://a@b/c", + "origin": "ws://b", + "protocol": "ws:", + "username": "a", + "password": "", + "host": "b", + "hostname": "b", + "port": "", + "pathname": "/c", + "search": "", + "hash": "" + }, { "input": "foo:/", "base": "http://example.org/foo/bar", @@ -9529,5 +9559,160 @@ "pathname": "", "search": "", "hash": "" + }, + "Scheme relative path starting with multiple slashes", + { + "input": "///test", + "base": "http://example.org/", + "href": "http://test/", + "protocol": "http:", + "username": "", + "password": "", + "host": "test", + "hostname": "test", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "///\\//\\//test", + "base": "http://example.org/", + "href": "http://test/", + "protocol": "http:", + "username": "", + "password": "", + "host": "test", + "hostname": "test", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "///example.org/path", + "base": "http://example.org/", + "href": "http://example.org/path", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/path", + "search": "", + "hash": "" + }, + { + "input": "///example.org/../path", + "base": "http://example.org/", + "href": "http://example.org/path", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/path", + "search": "", + "hash": "" + }, + { + "input": "///example.org/../../", + "base": "http://example.org/", + "href": "http://example.org/", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "///example.org/../path/../../", + "base": "http://example.org/", + "href": "http://example.org/", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "///example.org/../path/../../path", + "base": "http://example.org/", + "href": "http://example.org/path", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/path", + "search": "", + "hash": "" + }, + { + "input": "/\\/\\//example.org/../path", + "base": "http://example.org/", + "href": "http://example.org/path", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/path", + "search": "", + "hash": "" + }, + { + "input": "///abcdef/../", + "base": "file:///", + "href": "file:///", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "/\\//\\/a/../", + "base": "file:///", + "href": "file://////", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "////", + "search": "", + "hash": "" + }, + { + "input": "//a/../", + "base": "file:///", + "href": "file://a/", + "protocol": "file:", + "username": "", + "password": "", + "host": "a", + "hostname": "a", + "port": "", + "pathname": "/", + "search": "", + "hash": "" } ] diff --git a/test/fixtures/wpt/url/url-statics-parse.any.js b/test/fixtures/wpt/url/url-statics-parse.any.js new file mode 100644 index 00000000000000..0822e9da07af6a --- /dev/null +++ b/test/fixtures/wpt/url/url-statics-parse.any.js @@ -0,0 +1,50 @@ +// This intentionally does not use resources/urltestdata.json to preserve resources. +[ + { + "url": undefined, + "base": undefined, + "expected": false + }, + { + "url": "aaa:b", + "base": undefined, + "expected": true + }, + { + "url": undefined, + "base": "aaa:b", + "expected": false + }, + { + "url": "aaa:/b", + "base": undefined, + "expected": true + }, + { + "url": undefined, + "base": "aaa:/b", + "expected": true + }, + { + "url": "https://test:test", + "base": undefined, + "expected": false + }, + { + "url": "a", + "base": "https://b/", + "expected": true + } +].forEach(({ url, base, expected }) => { + test(() => { + if (expected == false) { + assert_equals(URL.parse(url, base), null); + } else { + assert_equals(URL.parse(url, base).href, new URL(url, base).href); + } + }, `URL.parse(${url}, ${base})`); +}); + +test(() => { + assert_not_equals(URL.parse("https://example/"), URL.parse("https://example/")); +}, `URL.parse() should return a unique object`); diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index a7c655125b5c22..5f65dd1a829c58 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -72,7 +72,7 @@ "path": "streams" }, "url": { - "commit": "c2d7e70b52cbd9a5b938aa32f37078d7a71e0b21", + "commit": "0f550ab9f5a07ed293926a306e914866164b346b", "path": "url" }, "user-timing": { From 8ae1507ae10e9316d43a0e3edaec56bdbe3e2bff Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sat, 13 Apr 2024 17:03:43 +0200 Subject: [PATCH 08/98] tools: add a linter for README lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52476 Reviewed-By: Moshe Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Yagiz Nizipli Reviewed-By: Chengzhong Wu Reviewed-By: Marco Ippolito Reviewed-By: Tobias Nießen Reviewed-By: Michael Dawson Reviewed-By: Rafael Gonzaga Reviewed-By: Ulises Gascón --- .github/workflows/linters.yml | 7 +++++ README.md | 20 +++++++-------- tools/lint-readme-lists.mjs | 48 +++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 10 deletions(-) create mode 100755 tools/lint-readme-lists.mjs diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index bfc1cd66785863..dd1f9ee1ae6533 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -179,3 +179,10 @@ jobs: persist-credentials: false # GH Actions squashes all PR commits, HEAD^ refers to the base branch. - run: git diff HEAD^ HEAD -G"pr-url:" -- "*.md" | ./tools/lint-pr-url.mjs ${{ github.event.pull_request.html_url }} + lint-readme: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + persist-credentials: false + - run: tools/lint-readme-lists.mjs diff --git a/README.md b/README.md index a3ee8b7444bfb4..04df77247f8867 100644 --- a/README.md +++ b/README.md @@ -343,10 +343,10 @@ For information about the governance of the Node.js project, see **Erick Wendel** <> (he/him) * [Ethan-Arrowood](https://github.com/Ethan-Arrowood) - **Ethan Arrowood** <> (he/him) -* [fhinkel](https://github.com/fhinkel) - - **Franziska Hinkelmann** <> (she/her) * [F3n67u](https://github.com/F3n67u) - **Feng Yu** <> (he/him) +* [fhinkel](https://github.com/fhinkel) - + **Franziska Hinkelmann** <> (she/her) * [Flarna](https://github.com/Flarna) - **Gerhard Stöbich** <> (he/they) * [gabrielschulhof](https://github.com/gabrielschulhof) - @@ -429,12 +429,12 @@ For information about the governance of the Node.js project, see **Stephen Belanger** <> (he/him) * [RafaelGSS](https://github.com/RafaelGSS) - **Rafael Gonzaga** <> (he/him) -* [rluvaton](https://github.com/rluvaton) - - **Raz Luvaton** <> (he/him) * [richardlau](https://github.com/richardlau) - **Richard Lau** <> * [rickyes](https://github.com/rickyes) - **Ricky Zhou** <<0x19951125@gmail.com>> (he/him) +* [rluvaton](https://github.com/rluvaton) - + **Raz Luvaton** <> (he/him) * [ronag](https://github.com/ronag) - **Robert Nagy** <> * [ruyadorno](https://github.com/ruyadorno) - @@ -477,10 +477,10 @@ For information about the governance of the Node.js project, see **Khaidi Chu** <> (he/him) * [yashLadha](https://github.com/yashLadha) - **Yash Ladha** <> (he/him) -* [ZYSzys](https://github.com/ZYSzys) - - **Yongsheng Zhang** <> (he/him) * [zcbenz](https://github.com/zcbenz) - **Cheng Zhao** <> (he/him) +* [ZYSzys](https://github.com/ZYSzys) - + **Yongsheng Zhang** <> (he/him)

    @@ -495,10 +495,10 @@ For information about the governance of the Node.js project, see **Aleksei Koziatinskii** <> * [andrasq](https://github.com/andrasq) - **Andras** <> -* [AnnaMag](https://github.com/AnnaMag) - - **Anna M. Kedzierska** <> * [AndreasMadsen](https://github.com/AndreasMadsen) - **Andreas Madsen** <> (he/him) +* [AnnaMag](https://github.com/AnnaMag) - + **Anna M. Kedzierska** <> * [aqrln](https://github.com/aqrln) - **Alexey Orlenko** <> (he/him) * [bcoe](https://github.com/bcoe) - @@ -741,10 +741,10 @@ maintaining the Node.js project. **Mert Can Altin** <> * [Mesteery](https://github.com/Mesteery) - **Mestery** <> (he/him) -* [preveen-stack](https://github.com/preveen-stack) - - **Preveen Padmanabhan** <> (he/him) * [PoojaDurgad](https://github.com/PoojaDurgad) - **Pooja Durgad** <> +* [preveen-stack](https://github.com/preveen-stack) - + **Preveen Padmanabhan** <> (he/him) * [VoltrexKeyva](https://github.com/VoltrexKeyva) - **Mohammed Keyvanzadeh** <> (he/him) diff --git a/tools/lint-readme-lists.mjs b/tools/lint-readme-lists.mjs new file mode 100755 index 00000000000000..8859d2097c4e79 --- /dev/null +++ b/tools/lint-readme-lists.mjs @@ -0,0 +1,48 @@ +#!/usr/bin/env node + +// Validates the list in the README are in the correct order. + +import { open } from 'node:fs/promises'; + +const lists = [ + 'TSC voting members', + 'TSC regular members', + 'TSC emeriti members', + 'Collaborators', + 'Collaborator emeriti', + 'Triagers', +]; +const tscMembers = new Set(); + +const readme = await open(new URL('../README.md', import.meta.url), 'r'); + +let currentList = null; +let previousGithubHandle; +let lineNumber = 0; + +for await (const line of readme.readLines()) { + lineNumber++; + if (line.startsWith('### ')) { + currentList = lists[lists.indexOf(line.slice(4))]; + previousGithubHandle = null; + } else if (line.startsWith('#### ')) { + currentList = lists[lists.indexOf(line.slice(5))]; + previousGithubHandle = null; + } else if (currentList && line.startsWith('* [')) { + const currentGithubHandle = line.slice(3, line.indexOf(']')).toLowerCase(); + if (previousGithubHandle && previousGithubHandle >= currentGithubHandle) { + throw new Error(`${currentGithubHandle} should be listed before ${previousGithubHandle} in the ${currentList} list (README.md:${lineNumber})`); + } + + if (currentList === 'TSC voting members' || currentList === 'TSC regular members') { + tscMembers.add(currentGithubHandle); + } else if (currentList === 'Collaborators') { + tscMembers.delete(currentGithubHandle); + } + previousGithubHandle = currentGithubHandle; + } +} + +if (tscMembers.size !== 0) { + throw new Error(`Some TSC members are not listed as Collaborators: ${Array.from(tscMembers)}`); +} From dfda6fed61ccd90fc96a06e722cd570f3bd71f53 Mon Sep 17 00:00:00 2001 From: Jungku Lee Date: Sun, 14 Apr 2024 01:04:48 +0900 Subject: [PATCH 09/98] buffer: add missing ARG_TYPE(ArrayBuffer) for isUtf8 PR-URL: https://github.com/nodejs/node/pull/52477 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Deokjin Kim Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca --- lib/buffer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/buffer.js b/lib/buffer.js index d66d5650f30e73..fb0697d69adf79 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -1284,7 +1284,7 @@ function isUtf8(input) { return bindingIsUtf8(input); } - throw new ERR_INVALID_ARG_TYPE('input', ['TypedArray', 'Buffer'], input); + throw new ERR_INVALID_ARG_TYPE('input', ['ArrayBuffer', 'Buffer', 'TypedArray'], input); } function isAscii(input) { From 7b82c17f226a7245d1dd8878564f0688c847fbec Mon Sep 17 00:00:00 2001 From: Ali Hassan Date: Thu, 11 Apr 2024 00:41:37 +0500 Subject: [PATCH 10/98] benchmark: add ipc support to spawn stdio config Enabled inter-process communication (ipc) in the stdio configuration of the spawn function within the benchmark subsystem. This change allows for improved data exchange between parent and benchmarked child processes, addressing limitations in performance testing scenarios. Fixes: https://github.com/nodejs/node/issues/52233 Refs: https://github.com/nodejs/performance/pull/161 PR-URL: https://github.com/nodejs/node/pull/52456 Reviewed-By: Matteo Collina Reviewed-By: Raz Luvaton --- benchmark/compare.js | 2 +- benchmark/run.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/compare.js b/benchmark/compare.js index 1efff9e85c072f..0c53d90def371b 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -83,7 +83,7 @@ if (showProgress) { const spawnArgs = ['-c', cpuCore, cli.optional[job.binary], resolvedPath, ...cli.optional.set]; child = spawn('taskset', spawnArgs, { env: process.env, - stdio: ['inherit', 'pipe', 'pipe'], + stdio: ['inherit', 'pipe', 'pipe', 'ipc'], }); child.stdout.pipe(process.stdout); diff --git a/benchmark/run.js b/benchmark/run.js index 11f95d8e71f035..ff2d41e6056aa2 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -54,7 +54,7 @@ if (format === 'csv') { let child; if (cpuCore !== null) { child = spawn('taskset', ['-c', cpuCore, 'node', scriptPath, ...args], { - stdio: ['inherit', 'pipe', 'pipe'], + stdio: ['inherit', 'pipe', 'pipe', 'ipc'], }); child.stdout.pipe(process.stdout); From 7cdfe8a3fcb68a4e73f0dd4966cb12e8f86628d7 Mon Sep 17 00:00:00 2001 From: Ali Hassan Date: Thu, 11 Apr 2024 01:35:58 +0500 Subject: [PATCH 11/98] benchmark: inherit stdio/stderr instead of pipe PR-URL: https://github.com/nodejs/node/pull/52456 Fixes: https://github.com/nodejs/node/issues/52233 Refs: https://github.com/nodejs/performance/pull/161 Reviewed-By: Matteo Collina Reviewed-By: Raz Luvaton --- benchmark/compare.js | 5 +---- benchmark/run.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/benchmark/compare.js b/benchmark/compare.js index 0c53d90def371b..ad3084db390414 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -83,11 +83,8 @@ if (showProgress) { const spawnArgs = ['-c', cpuCore, cli.optional[job.binary], resolvedPath, ...cli.optional.set]; child = spawn('taskset', spawnArgs, { env: process.env, - stdio: ['inherit', 'pipe', 'pipe', 'ipc'], + stdio: ['inherit', 'inherit', 'inherit', 'ipc'], }); - - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); } else { child = fork(resolvedPath, cli.optional.set, { execPath: cli.optional[job.binary], diff --git a/benchmark/run.js b/benchmark/run.js index ff2d41e6056aa2..6a61df71221710 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -54,11 +54,8 @@ if (format === 'csv') { let child; if (cpuCore !== null) { child = spawn('taskset', ['-c', cpuCore, 'node', scriptPath, ...args], { - stdio: ['inherit', 'pipe', 'pipe', 'ipc'], + stdio: ['inherit', 'inherit', 'inherit', 'ipc'], }); - - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); } else { child = fork( scriptPath, From b00766d9e74c4c75bd7723bacbb163a446713cdf Mon Sep 17 00:00:00 2001 From: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com> Date: Sat, 13 Apr 2024 21:41:20 +0200 Subject: [PATCH 12/98] module: tidy code and comments PR-URL: https://github.com/nodejs/node/pull/52437 Reviewed-By: Geoffrey Booth Reviewed-By: Yagiz Nizipli Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: Moshe Atlow Reviewed-By: Antoine du Hamel Reviewed-By: Feng Yu --- doc/api/errors.md | 2 +- lib/internal/modules/cjs/loader.js | 2 +- lib/internal/modules/esm/loader.js | 28 ++++++++++++++++++------- lib/internal/modules/esm/translators.js | 5 +++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index e4a6e953a21174..d2a74b230db60d 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2501,7 +2501,7 @@ This is not allowed because ES Modules cannot be evaluated while they are already being evaluated. To avoid the cycle, the `require()` call involved in a cycle should not happen -at the top-level of either a ES Module (via `createRequire()`) or a CommonJS +at the top-level of either an ES Module (via `createRequire()`) or a CommonJS module, and should be done lazily in an inner function. diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index a81f180958aebf..b8263a793578f4 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -1063,7 +1063,7 @@ Module._load = function(request, parent, isMain) { } // If it's cached by the ESM loader as a way to indirectly pass // the module in to avoid creating it twice, the loading request - // come from imported CJS. In that case use the kModuleCircularVisited + // came from imported CJS. In that case use the kModuleCircularVisited // to determine if it's loading or not. if (cachedModule[kModuleCircularVisited]) { return getExportsForCircularRequire(cachedModule); diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index df7a26c9337c39..5af25d28ea8a40 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -42,6 +42,10 @@ const { } = require('internal/modules/helpers'); let defaultResolve, defaultLoad, defaultLoadSync, importMetaInitializer; +/** + * @typedef {import('url').URL} URL + */ + /** * Lazy loads the module_map module and returns a new instance of ResolveCache. * @returns {import('./module_map.js').ResolveCache')} @@ -77,6 +81,10 @@ function getTranslators() { */ let hooksProxy; +/** + * @typedef {import('../cjs/loader.js').Module} CJSModule + */ + /** * @typedef {Record} ModuleExports */ @@ -257,11 +265,11 @@ class ModuleLoader { /** * This constructs (creates, instantiates and evaluates) a module graph that * is require()'d. - * @param {import('../cjs/loader.js').Module} mod CJS module wrapper of the ESM. + * @param {CJSModule} mod CJS module wrapper of the ESM. * @param {string} filename Resolved filename of the module being require()'d * @param {string} source Source code. TODO(joyeecheung): pass the raw buffer. * @param {string} isMain Whether this module is a main module. - * @param {import('../cjs/loader.js').Module|undefined} parent Parent module, if any. + * @param {CJSModule|undefined} parent Parent module, if any. * @returns {{ModuleWrap}} */ importSyncForRequire(mod, filename, source, isMain, parent) { @@ -343,7 +351,7 @@ class ModuleLoader { } throw new ERR_REQUIRE_CYCLE_MODULE(message); } - // Othersie the module could be imported before but the evaluation may be already + // Otherwise the module could be imported before but the evaluation may be already // completed (e.g. the require call is lazy) so it's okay. We will return the // module now and check asynchronicity of the entire graph later, after the // graph is instantiated. @@ -352,8 +360,12 @@ class ModuleLoader { defaultLoadSync ??= require('internal/modules/esm/load').defaultLoadSync; const loadResult = defaultLoadSync(url, { format, importAttributes }); - const { responseURL, source } = loadResult; - const { format: finalFormat } = loadResult; + const { + format: finalFormat, + responseURL, + source, + } = loadResult; + this.validateLoadResult(url, finalFormat); if (finalFormat === 'wasm') { assert.fail('WASM is currently unsupported by require(esm)'); @@ -725,11 +737,11 @@ function getOrInitializeCascadedLoader() { /** * Register a single loader programmatically. - * @param {string|import('url').URL} specifier - * @param {string|import('url').URL} [parentURL] Base to use when resolving `specifier`; optional if + * @param {string|URL} specifier + * @param {string|URL} [parentURL] Base to use when resolving `specifier`; optional if * `specifier` is absolute. Same as `options.parentUrl`, just inline * @param {object} [options] Additional options to apply, described below. - * @param {string|import('url').URL} [options.parentURL] Base to use when resolving `specifier` + * @param {string|URL} [options.parentURL] Base to use when resolving `specifier` * @param {any} [options.data] Arbitrary data passed to the loader's `initialize` hook * @param {any[]} [options.transferList] Objects in `data` that are changing ownership * @returns {void} We want to reserve the return value for potential future extension of the API. diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 4bdee1b843fbd5..8f4b6b25d88896 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -41,6 +41,7 @@ const { dirname, extname, isAbsolute } = require('path'); const { loadBuiltinModule, stripBOM, + urlToFilename, } = require('internal/modules/helpers'); const { kIsCachedByESMLoader, @@ -243,7 +244,7 @@ function loadCJSModule(module, source, url, filename) { } } const { url: resolvedURL } = cascadedLoader.resolveSync(specifier, url, kEmptyObject); - return StringPrototypeStartsWith(resolvedURL, 'file://') ? fileURLToPath(resolvedURL) : resolvedURL; + return urlToFilename(resolvedURL); }); setOwnProperty(requireFn, 'main', process.mainModule); @@ -265,7 +266,7 @@ const cjsCache = new SafeMap(); function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { debug(`Translating CJSModule ${url}`); - const filename = StringPrototypeStartsWith(url, 'file://') ? fileURLToPath(url) : url; + const filename = urlToFilename(url); // In case the source was not provided by the `load` step, we need fetch it now. source = stringify(source ?? getSource(new URL(url)).source); From b4ccb6c626256c0abc29b67427460a51c8b68595 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 11 Apr 2024 20:52:20 -0400 Subject: [PATCH 13/98] test_runner: move end of work check to finalize() This commit moves the end of work check from postRun() to finalize(). The reasoning is that finalize() is guaranteed to run in the order that the tests are defined, while postRun() is not. This makes the check a little simpler. PR-URL: https://github.com/nodejs/node/pull/52488 Reviewed-By: Yagiz Nizipli Reviewed-By: Chemi Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Marco Ippolito Reviewed-By: Moshe Atlow --- lib/internal/test_runner/test.js | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 9c7d95f9420de5..8bf63654bf1f21 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -829,29 +829,9 @@ class Test extends AsyncResource { this.parent.activeSubtests--; } - // The call to processPendingSubtests() below can change the number of - // pending subtests. When detecting if we are done running tests, we want - // to check if there are no pending subtests both before and after - // calling processPendingSubtests(). Otherwise, it is possible to call - // root.run() multiple times (which is harmless but can trigger an - // EventEmitter leak warning). - const pendingSiblingCount = this.parent.pendingSubtests.length; - this.parent.addReadySubtest(this); this.parent.processReadySubtestRange(false); this.parent.processPendingSubtests(); - - if (this.parent === this.root && - pendingSiblingCount === 0 && - this.root.activeSubtests === 0 && - this.root.pendingSubtests.length === 0 && - this.root.readySubtests.size === 0) { - // At this point all of the tests have finished running. However, there - // might be ref'ed handles keeping the event loop alive. This gives the - // global after() hook a chance to clean them up. The user may also - // want to force the test runner to exit despite ref'ed handles. - this.root.run(); - } } else if (!this.reported) { const { diagnostics, @@ -914,6 +894,15 @@ class Test extends AsyncResource { this.report(); this.parent.waitingOn++; this.finished = true; + + if (this.parent === this.root && + this.root.waitingOn > this.root.subtests.length) { + // At this point all of the tests have finished running. However, there + // might be ref'ed handles keeping the event loop alive. This gives the + // global after() hook a chance to clean them up. The user may also + // want to force the test runner to exit despite ref'ed handles. + this.root.run(); + } } duration() { From 328755341db9df3ec1740c9801971454aaf8d9c1 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 11 Apr 2024 21:05:33 -0400 Subject: [PATCH 14/98] test_runner: don't exceed call stack when filtering This commit updates filteredRun() to call postRun() after a microtask instead of synchronously. Currently, if approximately 1,545 subtests are filtered, enough synchronous calls can be made to cause a call stack exceeded exception. PR-URL: https://github.com/nodejs/node/pull/52488 Reviewed-By: Yagiz Nizipli Reviewed-By: Chemi Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Marco Ippolito Reviewed-By: Moshe Atlow --- lib/internal/test_runner/test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 8bf63654bf1f21..9e8851bb55e62c 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -29,6 +29,7 @@ const { } = primordials; const { getCallerLocation } = internalBinding('util'); const { addAbortListener } = require('internal/events/abort_listener'); +const { queueMicrotask } = require('internal/process/task_queues'); const { AsyncResource } = require('async_hooks'); const { AbortController } = require('internal/abort_controller'); const { @@ -673,7 +674,7 @@ class Test extends AsyncResource { this.pass(); this.subtests = []; this.report = noop; - this.postRun(); + queueMicrotask(() => this.postRun()); } async run() { From e70d8a4fa9714bcbcaf37f1dc8603c88cc202292 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 14 Apr 2024 12:02:30 +0300 Subject: [PATCH 15/98] meta: move one or more collaborators to emeritus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52457 Reviewed-By: Michaël Zasso Reviewed-By: Michael Dawson Reviewed-By: Yagiz Nizipli Reviewed-By: Trivikram Kamat Reviewed-By: Luigi Pinca Reviewed-By: Paolo Insogna Reviewed-By: Moshe Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel Reviewed-By: Ash Cripps Reviewed-By: Masashi Hirano Reviewed-By: Zeyu "Alex" Yang --- README.md | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 04df77247f8867..c8931ebcb2ae2f 100644 --- a/README.md +++ b/README.md @@ -209,8 +209,6 @@ For information about the governance of the Node.js project, see **Beth Griggs** <> (she/her) * [bnoordhuis](https://github.com/bnoordhuis) - **Ben Noordhuis** <> -* [ChALkeR](https://github.com/ChALkeR) - - **Сковорода Никита Андреевич** <> (he/him) * [cjihrig](https://github.com/cjihrig) - **Colin Ihrig** <> (he/him) * [codebytere](https://github.com/codebytere) - @@ -232,6 +230,8 @@ For information about the governance of the Node.js project, see * [addaleax](https://github.com/addaleax) - **Anna Henningsen** <> (she/her) +* [ChALkeR](https://github.com/ChALkeR) - + **Сковорода Никита Андреевич** <> (he/him) * [chrisdickinson](https://github.com/chrisdickinson) - **Chris Dickinson** <> * [danbev](https://github.com/danbev) - @@ -291,12 +291,8 @@ For information about the governance of the Node.js project, see **Antoine du Hamel** <> (he/him) * [anonrig](https://github.com/anonrig) - **Yagiz Nizipli** <> (he/him) -* [antsmartian](https://github.com/antsmartian) - - **Anto Aravinth** <> (he/him) * [apapirovski](https://github.com/apapirovski) - **Anatoli Papirovski** <> (he/him) -* [AshCripps](https://github.com/AshCripps) - - **Ash Cripps** <> * [atlowChemi](https://github.com/atlowChemi) - **Chemi Atlow** <> (he/him) * [Ayase-252](https://github.com/Ayase-252) - @@ -307,8 +303,6 @@ For information about the governance of the Node.js project, see **Benjamin Gruenbaum** <> * [BethGriggs](https://github.com/BethGriggs) - **Beth Griggs** <> (she/her) -* [bmeck](https://github.com/bmeck) - - **Bradley Farias** <> * [bnb](https://github.com/bnb) - **Tierney Cyren** <> (they/them) * [bnoordhuis](https://github.com/bnoordhuis) - @@ -317,8 +311,6 @@ For information about the governance of the Node.js project, see **Ruben Bridgewater** <> (he/him) * [cclauss](https://github.com/cclauss) - **Christian Clauss** <> (he/him) -* [ChALkeR](https://github.com/ChALkeR) - - **Сковорода Никита Андреевич** <> (he/him) * [cjihrig](https://github.com/cjihrig) - **Colin Ihrig** <> (he/him) * [codebytere](https://github.com/codebytere) - @@ -327,16 +319,12 @@ For information about the governance of the Node.js project, see **Kohei Ueno** <> (he/him) * [daeyeon](https://github.com/daeyeon) - **Daeyeon Jeong** <> (he/him) -* [danbev](https://github.com/danbev) - - **Daniel Bevenius** <> (he/him) * [danielleadams](https://github.com/danielleadams) - **Danielle Adams** <> (she/her) * [debadree25](https://github.com/debadree25) - **Debadree Chatterjee** <> (he/him) * [deokjinkim](https://github.com/deokjinkim) - **Deokjin Kim** <> (he/him) -* [devsnek](https://github.com/devsnek) - - **Gus Caplan** <> (they/them) * [edsadr](https://github.com/edsadr) - **Adrian Estrada** <> (he/him) * [erickwendel](https://github.com/erickwendel) - @@ -417,8 +405,6 @@ For information about the governance of the Node.js project, see **Moshe Atlow** <> (he/him) * [MrJithil](https://github.com/MrJithil) - **Jithil P Ponnan** <> (he/him) -* [mscdex](https://github.com/mscdex) - - **Brian White** <> * [MylesBorins](https://github.com/MylesBorins) - **Myles Borins** <> (he/him) * [ovflowd](https://github.com/ovflowd) - @@ -431,20 +417,14 @@ For information about the governance of the Node.js project, see **Rafael Gonzaga** <> (he/him) * [richardlau](https://github.com/richardlau) - **Richard Lau** <> -* [rickyes](https://github.com/rickyes) - - **Ricky Zhou** <<0x19951125@gmail.com>> (he/him) * [rluvaton](https://github.com/rluvaton) - **Raz Luvaton** <> (he/him) * [ronag](https://github.com/ronag) - **Robert Nagy** <> * [ruyadorno](https://github.com/ruyadorno) - **Ruy Adorno** <> (he/him) -* [ryzokuken](https://github.com/ryzokuken) - - **Ujjwal Sharma** <> (he/him) * [santigimeno](https://github.com/santigimeno) - **Santiago Gimeno** <> -* [shisama](https://github.com/shisama) - - **Masashi Hirano** <> (he/him) * [ShogunPanda](https://github.com/ShogunPanda) - **Paolo Insogna** <> (he/him) * [srl295](https://github.com/srl295) - @@ -465,8 +445,6 @@ For information about the governance of the Node.js project, see **Rich Trott** <> (he/him) * [UlisesGascon](https://github.com/ulisesgascon) - **Ulises Gascón** <> (he/him) -* [vdeturckheim](https://github.com/vdeturckheim) - - **Vladimir de Turckheim** <> (he/him) * [vmoroz](https://github.com/vmoroz) - **Vladimir Morozov** <> (he/him) * [VoltrexKeyva](https://github.com/VoltrexKeyva) - @@ -499,10 +477,16 @@ For information about the governance of the Node.js project, see **Andreas Madsen** <> (he/him) * [AnnaMag](https://github.com/AnnaMag) - **Anna M. Kedzierska** <> +* [antsmartian](https://github.com/antsmartian) - + **Anto Aravinth** <> (he/him) * [aqrln](https://github.com/aqrln) - **Alexey Orlenko** <> (he/him) +* [AshCripps](https://github.com/AshCripps) - + **Ash Cripps** <> * [bcoe](https://github.com/bcoe) - **Ben Coe** <> (he/him) +* [bmeck](https://github.com/bmeck) - + **Bradley Farias** <> * [bmeurer](https://github.com/bmeurer) - **Benedikt Meurer** <> * [boneskull](https://github.com/boneskull) - @@ -513,16 +497,22 @@ For information about the governance of the Node.js project, see **Bartosz Sosnowski** <> * [calvinmetcalf](https://github.com/calvinmetcalf) - **Calvin Metcalf** <> +* [ChALkeR](https://github.com/ChALkeR) - + **Сковорода Никита Андреевич** <> (he/him) * [chrisdickinson](https://github.com/chrisdickinson) - **Chris Dickinson** <> * [claudiorodriguez](https://github.com/claudiorodriguez) - **Claudio Rodriguez** <> +* [danbev](https://github.com/danbev) - + **Daniel Bevenius** <> (he/him) * [DavidCai1993](https://github.com/DavidCai1993) - **David Cai** <> (he/him) * [davisjam](https://github.com/davisjam) - **Jamie Davis** <> (he/him) * [devnexen](https://github.com/devnexen) - **David Carlier** <> +* [devsnek](https://github.com/devsnek) - + **Gus Caplan** <> (they/them) * [digitalinfinity](https://github.com/digitalinfinity) - **Hitesh Kanwathirtha** <> (he/him) * [dmabupt](https://github.com/dmabupt) - @@ -617,6 +607,8 @@ For information about the governance of the Node.js project, see **Christopher Monsanto** <> * [MoonBall](https://github.com/MoonBall) - **Chen Gang** <> +* [mscdex](https://github.com/mscdex) - + **Brian White** <> * [not-an-aardvark](https://github.com/not-an-aardvark) - **Teddy Katz** <> (he/him) * [ofrobots](https://github.com/ofrobots) - @@ -651,6 +643,8 @@ For information about the governance of the Node.js project, see **Refael Ackermann (רפאל פלחי)** <> (he/him/הוא/אתה) * [rexagod](https://github.com/rexagod) - **Pranshu Srivastava** <> (he/him) +* [rickyes](https://github.com/rickyes) - + **Ricky Zhou** <<0x19951125@gmail.com>> (he/him) * [rlidwka](https://github.com/rlidwka) - **Alex Kocharin** <> * [rmg](https://github.com/rmg) - @@ -667,6 +661,8 @@ For information about the governance of the Node.js project, see **Sam Ruby** <> * [rvagg](https://github.com/rvagg) - **Rod Vagg** <> +* [ryzokuken](https://github.com/ryzokuken) - + **Ujjwal Sharma** <> (he/him) * [saghul](https://github.com/saghul) - **Saúl Ibarra Corretgé** <> * [sam-github](https://github.com/sam-github) - @@ -677,6 +673,8 @@ For information about the governance of the Node.js project, see **Nikolai Vavilov** <> * [shigeki](https://github.com/shigeki) - **Shigeki Ohtsu** <> (he/him) +* [shisama](https://github.com/shisama) - + **Masashi Hirano** <> (he/him) * [silverwind](https://github.com/silverwind) - **Roman Reiss** <> * [starkwang](https://github.com/starkwang) - @@ -693,6 +691,8 @@ For information about the governance of the Node.js project, see **Trevor Norris** <> * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe** <> +* [vdeturckheim](https://github.com/vdeturckheim) - + **Vladimir de Turckheim** <> (he/him) * [vkurchatkin](https://github.com/vkurchatkin) - **Vladimir Kurchatkin** <> * [vsemozhetbyt](https://github.com/vsemozhetbyt) - From dc399ddd037e2f197fcca22a3ba4ba13872afaf4 Mon Sep 17 00:00:00 2001 From: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com> Date: Sun, 14 Apr 2024 06:30:31 -0400 Subject: [PATCH 16/98] lib, doc: rename readme.md to README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52471 Reviewed-By: Antoine du Hamel Reviewed-By: Deokjin Kim Reviewed-By: Luigi Pinca Reviewed-By: Ulises Gascón Reviewed-By: Marco Ippolito --- lib/internal/{readme.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/internal/{readme.md => README.md} (100%) diff --git a/lib/internal/readme.md b/lib/internal/README.md similarity index 100% rename from lib/internal/readme.md rename to lib/internal/README.md From 15c568638103aefe9206ccb464f321040089916b Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Mon, 15 Apr 2024 06:42:40 +0200 Subject: [PATCH 17/98] tools: update minimatch index path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/52523 Fixes: https://github.com/nodejs/node/issues/52520 Reviewed-By: Michaël Zasso Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: Moshe Atlow --- tools/dep_updaters/update-minimatch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dep_updaters/update-minimatch.sh b/tools/dep_updaters/update-minimatch.sh index 2e6fdd0c11890b..d487eb760632cb 100755 --- a/tools/dep_updaters/update-minimatch.sh +++ b/tools/dep_updaters/update-minimatch.sh @@ -54,7 +54,7 @@ cd package "$NODE" "$NPM" install esbuild --save-dev -"$NODE" "$NPM" pkg set scripts.node-build="esbuild ./dist/cjs/index.js --bundle --platform=node --outfile=index.js" +"$NODE" "$NPM" pkg set scripts.node-build="esbuild ./dist/commonjs/index.js --bundle --platform=node --outfile=index.js" "$NODE" "$NPM" run node-build From e34e0a9ba12a9208216600231da748e9b6c881aa Mon Sep 17 00:00:00 2001 From: "Sinan Sonmez (Chaush)" <37421564+sinansonmez@users.noreply.github.com> Date: Mon, 15 Apr 2024 10:55:21 +0200 Subject: [PATCH 18/98] test: write tests for assertIsArray http2 util PR-URL: https://github.com/nodejs/node/pull/52511 Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca Reviewed-By: Benjamin Gruenbaum --- test/parallel/test-http2-misc-util.js | 31 ++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-http2-misc-util.js b/test/parallel/test-http2-misc-util.js index 53eed542e2a605..d2416afab1c85b 100644 --- a/test/parallel/test-http2-misc-util.js +++ b/test/parallel/test-http2-misc-util.js @@ -9,7 +9,8 @@ const assert = require('assert'); const { assertIsObject, assertWithinRange, - sessionName + sessionName, + assertIsArray } = require('internal/http2/util'); // Code coverage for sessionName utility function @@ -49,3 +50,31 @@ assert.throws( }); assertIsObject({}, 'test'); + +assert.throws( + () => assertIsArray('foo', 'test'), { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError', + message: 'The "test" argument must be an instance of Array. Received type ' + + "string ('foo')" + } +); + +assert.throws( + () => assertIsArray({}, 'test'), { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError', + message: 'The "test" argument must be an instance of Array. Received an instance of Object' + } +); + +assert.throws( + () => assertIsArray(1, 'test'), { + code: 'ERR_INVALID_ARG_TYPE', + name: 'TypeError', + message: 'The "test" argument must be an instance of Array. Received type ' + + 'number (1)' + } +); + +assertIsArray([], 'test'); From e066ba2ae434d1d125babec3804e0f1561b5d263 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Mon, 15 Apr 2024 05:27:17 -0500 Subject: [PATCH 19/98] test_runner: better error handing for test hook Co-authored-by: Colin Ihrig PR-URL: https://github.com/nodejs/node/pull/52401 Fixes: https://github.com/nodejs/node/issues/52399 Reviewed-By: Moshe Atlow Reviewed-By: Chemi Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig --- lib/internal/test_runner/harness.js | 16 ++++++++--- .../test-runner/async-error-in-test-hook.mjs | 27 +++++++++++++++++++ .../test-runner/output/describe_it.snapshot | 12 ++++----- .../output/junit_reporter.snapshot | 14 +++++----- .../test-runner/output/output.snapshot | 14 +++++----- .../test-runner/output/output_cli.snapshot | 14 +++++----- .../test-runner/output/spec_reporter.snapshot | 14 +++++----- .../output/spec_reporter_cli.snapshot | 14 +++++----- .../test-runner-extraneous-async-activity.js | 21 +++++++++++++-- test/parallel/test-runner-output.mjs | 2 ++ 10 files changed, 101 insertions(+), 47 deletions(-) create mode 100644 test/fixtures/test-runner/async-error-in-test-hook.mjs diff --git a/lib/internal/test_runner/harness.js b/lib/internal/test_runner/harness.js index 5f43e846f29585..3a00e5a3fcceab 100644 --- a/lib/internal/test_runner/harness.js +++ b/lib/internal/test_runner/harness.js @@ -10,6 +10,7 @@ const { createHook, executionAsyncId, } = require('async_hooks'); +const { relative } = require('path'); const { codes: { ERR_TEST_FAILURE, @@ -52,19 +53,26 @@ function createProcessEventHandler(eventName, rootTest) { throw err; } - // Check if this error is coming from a test. If it is, fail the test. - if (!test || test.finished) { + // Check if this error is coming from a test or test hook. If it is, fail the test. + if (!test || test.finished || test.hookType) { // If the test is already finished or the resource that created the error // is not mapped to a Test, report this as a top level diagnostic. let msg; if (test) { - msg = `Warning: Test "${test.name}" generated asynchronous ` + + const name = test.hookType ? `Test hook "${test.hookType}"` : `Test "${test.name}"`; + let locInfo = ''; + if (test.loc) { + const relPath = relative(process.cwd(), test.loc.file); + locInfo = ` at ${relPath}:${test.loc.line}:${test.loc.column}`; + } + + msg = `Error: ${name}${locInfo} generated asynchronous ` + 'activity after the test ended. This activity created the error ' + `"${err}" and would have caused the test to fail, but instead ` + `triggered an ${eventName} event.`; } else { - msg = 'Warning: A resource generated asynchronous activity after ' + + msg = 'Error: A resource generated asynchronous activity after ' + `the test ended. This activity created the error "${err}" which ` + `triggered an ${eventName} event, caught by the test runner.`; } diff --git a/test/fixtures/test-runner/async-error-in-test-hook.mjs b/test/fixtures/test-runner/async-error-in-test-hook.mjs new file mode 100644 index 00000000000000..5dca1ada75dada --- /dev/null +++ b/test/fixtures/test-runner/async-error-in-test-hook.mjs @@ -0,0 +1,27 @@ +import { after, afterEach, before, beforeEach, test } from 'node:test' + +before(() => { + setTimeout(() => { + throw new Error('before') + }, 100) +}) + +beforeEach(() => { + setTimeout(() => { + throw new Error('beforeEach') + }, 100) +}) + +after(() => { + setTimeout(() => { + throw new Error('after') + }, 100) +}) + +afterEach(() => { + setTimeout(() => { + throw new Error('afterEach') + }, 100) +}) + +test('ok', () => {}) diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot index f6fed1a481908b..e9ff58e7beb0f9 100644 --- a/test/fixtures/test-runner/output/describe_it.snapshot +++ b/test/fixtures/test-runner/output/describe_it.snapshot @@ -691,12 +691,12 @@ not ok 58 - invalid subtest fail * ... 1..58 -# Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: Test "immediate throw - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. -# Warning: Test "immediate reject - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: Test "callback called twice in different ticks" generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. -# Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/describe_it.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/describe_it.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/describe_it.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/describe_it.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/describe_it.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "callback async throw after done" at test/fixtures/test-runner/output/describe_it.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. # tests 67 # suites 11 # pass 31 diff --git a/test/fixtures/test-runner/output/junit_reporter.snapshot b/test/fixtures/test-runner/output/junit_reporter.snapshot index f29f72e6ddb2ed..d244e7dd594bb3 100644 --- a/test/fixtures/test-runner/output/junit_reporter.snapshot +++ b/test/fixtures/test-runner/output/junit_reporter.snapshot @@ -514,13 +514,13 @@ Error [ERR_TEST_FAILURE]: test could not be started because its parent finished } - - - - - - - + + + + + + + diff --git a/test/fixtures/test-runner/output/output.snapshot b/test/fixtures/test-runner/output/output.snapshot index 905acaa498bffb..0acb6573bc6710 100644 --- a/test/fixtures/test-runner/output/output.snapshot +++ b/test/fixtures/test-runner/output/output.snapshot @@ -711,13 +711,13 @@ not ok 62 - invalid subtest fail * ... 1..62 -# Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. -# Warning: Test "immediate throw - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. -# Warning: Test "immediate reject - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: Test "callback called twice in different ticks" generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. -# Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. +# Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. # tests 76 # suites 0 # pass 35 diff --git a/test/fixtures/test-runner/output/output_cli.snapshot b/test/fixtures/test-runner/output/output_cli.snapshot index 37c85137e4eb7f..d04dc0a0a905ad 100644 --- a/test/fixtures/test-runner/output/output_cli.snapshot +++ b/test/fixtures/test-runner/output/output_cli.snapshot @@ -710,13 +710,13 @@ not ok 62 - invalid subtest fail stack: |- * ... -# Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. -# Warning: Test "immediate throw - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. -# Warning: Test "immediate reject - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. -# Warning: Test "callback called twice in different ticks" generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. -# Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. +# Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. +# Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. +# Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. # Subtest: last test ok 63 - last test --- diff --git a/test/fixtures/test-runner/output/spec_reporter.snapshot b/test/fixtures/test-runner/output/spec_reporter.snapshot index 8162dafcdc0350..f37d7f35b8a7d6 100644 --- a/test/fixtures/test-runner/output/spec_reporter.snapshot +++ b/test/fixtures/test-runner/output/spec_reporter.snapshot @@ -297,13 +297,13 @@ invalid subtest fail (*ms) 'test could not be started because its parent finished' - Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Warning: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. - Warning: Test "immediate throw - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. - Warning: Test "immediate reject - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Warning: Test "callback called twice in different ticks" generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. - Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:72:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:76:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. + Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:80:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:86:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:251:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:269:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. tests 76 suites 0 pass 35 diff --git a/test/fixtures/test-runner/output/spec_reporter_cli.snapshot b/test/fixtures/test-runner/output/spec_reporter_cli.snapshot index 9386a6db82753f..d8648bfe03a8be 100644 --- a/test/fixtures/test-runner/output/spec_reporter_cli.snapshot +++ b/test/fixtures/test-runner/output/spec_reporter_cli.snapshot @@ -297,13 +297,13 @@ invalid subtest fail (*ms) 'test could not be started because its parent finished' - Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Warning: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. - Warning: Test "immediate throw - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. - Warning: Test "immediate reject - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. - Warning: Test "callback called twice in different ticks" generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. - Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:72:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:76:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner. + Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:80:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:86:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. + Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:251:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. + Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:269:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. tests 76 suites 0 pass 35 diff --git a/test/parallel/test-runner-extraneous-async-activity.js b/test/parallel/test-runner-extraneous-async-activity.js index a95925dbb75414..68db109b292f15 100644 --- a/test/parallel/test-runner-extraneous-async-activity.js +++ b/test/parallel/test-runner-extraneous-async-activity.js @@ -10,7 +10,7 @@ const { spawnSync } = require('child_process'); fixtures.path('test-runner', 'extraneous_set_immediate_async.mjs'), ]); const stdout = child.stdout.toString(); - assert.match(stdout, /^# Warning: Test "extraneous async activity test" generated asynchronous activity after the test ended/m); + assert.match(stdout, /^# Error: Test "extraneous async activity test" at .+extraneous_set_immediate_async\.mjs:3:1 generated asynchronous activity after the test ended/m); assert.match(stdout, /^# pass 1/m); assert.match(stdout, /^# fail 1$/m); assert.match(stdout, /^# cancelled 0$/m); @@ -24,7 +24,24 @@ const { spawnSync } = require('child_process'); fixtures.path('test-runner', 'extraneous_set_timeout_async.mjs'), ]); const stdout = child.stdout.toString(); - assert.match(stdout, /^# Warning: Test "extraneous async activity test" generated asynchronous activity after the test ended/m); + assert.match(stdout, /^# Error: Test "extraneous async activity test" at .+extraneous_set_timeout_async\.mjs:3:1 generated asynchronous activity after the test ended/m); + assert.match(stdout, /^# pass 1$/m); + assert.match(stdout, /^# fail 1$/m); + assert.match(stdout, /^# cancelled 0$/m); + assert.strictEqual(child.status, 1); + assert.strictEqual(child.signal, null); +} + +{ + const child = spawnSync(process.execPath, [ + '--test', + fixtures.path('test-runner', 'async-error-in-test-hook.mjs'), + ]); + const stdout = child.stdout.toString(); + assert.match(stdout, /^# Error: Test hook "before" at .+async-error-in-test-hook\.mjs:3:1 generated asynchronous activity after the test ended/m); + assert.match(stdout, /^# Error: Test hook "beforeEach" at .+async-error-in-test-hook\.mjs:9:1 generated asynchronous activity after the test ended/m); + assert.match(stdout, /^# Error: Test hook "after" at .+async-error-in-test-hook\.mjs:15:1 generated asynchronous activity after the test ended/m); + assert.match(stdout, /^# Error: Test hook "afterEach" at .+async-error-in-test-hook\.mjs:21:1 generated asynchronous activity after the test ended/m); assert.match(stdout, /^# pass 1$/m); assert.match(stdout, /^# fail 1$/m); assert.match(stdout, /^# cancelled 0$/m); diff --git a/test/parallel/test-runner-output.mjs b/test/parallel/test-runner-output.mjs index abc3d7c97b4879..df1067ec04a4e0 100644 --- a/test/parallel/test-runner-output.mjs +++ b/test/parallel/test-runner-output.mjs @@ -70,11 +70,13 @@ const specTransform = snapshot.transform( replaceSpecDuration, snapshot.replaceWindowsLineEndings, snapshot.replaceStackTrace, + snapshot.replaceWindowsPaths, ); const junitTransform = snapshot.transform( replaceJunitDuration, snapshot.replaceWindowsLineEndings, snapshot.replaceStackTrace, + snapshot.replaceWindowsPaths, ); const lcovTransform = snapshot.transform( snapshot.replaceWindowsLineEndings, From 4e5ce3afb744682ec83ab8bc165137ad15b09c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 15 Apr 2024 17:08:10 +0200 Subject: [PATCH 20/98] tools: use stylistic ESLint plugin for formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://eslint.org/blog/2023/10/deprecating-formatting-rules/ PR-URL: https://github.com/nodejs/node/pull/50714 Reviewed-By: Yagiz Nizipli Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina Reviewed-By: Trivikram Kamat Reviewed-By: Marco Ippolito Reviewed-By: Rafael Gonzaga Reviewed-By: Tobias Nießen Reviewed-By: Ruben Bridgewater --- .eslintrc.js | 137 +- doc/.eslintrc.yaml | 4 +- doc/api/dns.md | 8 +- doc/api/http.md | 2 +- doc/api/http2.md | 2 +- doc/api/os.md | 2 +- doc/api/process.md | 4 +- doc/api/zlib.md | 2 +- lib/.eslintrc.yaml | 9 +- test/.eslintrc.yaml | 6 +- test/common/dns.js | 2 +- test/parallel/test-assert.js | 18 +- .../test-internal-validators-validateoneof.js | 6 +- test/parallel/test-policy-integrity-flag.js | 4 +- test/parallel/test-repl-colors.js | 2 +- test/parallel/test-runner-coverage.js | 8 +- test/parallel/test-runner-run.mjs | 4 +- test/parallel/test-util-inspect.js | 12 +- .../test-webcrypto-export-import-ec.js | 4 +- test/parallel/test-zlib-brotli-16GB.js | 2 +- tools/dep_updaters/update-eslint.sh | 6 +- tools/eslint-rules/prefer-proto.js | 2 +- .../@ampproject/remapping/dist/remapping.mjs | 34 +- .../remapping/dist/remapping.umd.js | 32 +- .../@ampproject/remapping/package.json | 6 +- .../@babel/code-frame/lib/index.js | 37 +- .../node_modules/ansi-styles/index.js | 165 --- .../node_modules/ansi-styles/license | 9 - .../node_modules/ansi-styles/package.json | 56 - .../node_modules/ansi-styles/readme.md | 147 -- .../code-frame/node_modules/chalk/index.js | 228 ---- .../node_modules/chalk/index.js.flow | 93 -- .../code-frame/node_modules/chalk/license | 9 - .../node_modules/chalk/package.json | 71 - .../code-frame/node_modules/chalk/readme.md | 314 ----- .../node_modules/chalk/templates.js | 128 -- .../node_modules/color-convert/LICENSE | 21 - .../node_modules/color-convert/conversions.js | 868 ------------ .../node_modules/color-convert/index.js | 78 -- .../node_modules/color-convert/package.json | 46 - .../node_modules/color-convert/route.js | 97 -- .../node_modules/color-name/LICENSE | 8 - .../node_modules/color-name/index.js | 152 --- .../node_modules/color-name/package.json | 25 - .../escape-string-regexp/index.js | 11 - .../escape-string-regexp/package.json | 41 - .../escape-string-regexp/readme.md | 27 - .../code-frame/node_modules/has-flag/index.js | 8 - .../code-frame/node_modules/has-flag/license | 9 - .../node_modules/has-flag/package.json | 44 - .../node_modules/has-flag/readme.md | 70 - .../node_modules/supports-color/browser.js | 5 - .../node_modules/supports-color/index.js | 131 -- .../node_modules/supports-color/license | 9 - .../node_modules/supports-color/package.json | 53 - .../node_modules/supports-color/readme.md | 66 - .../@babel/code-frame/package.json | 6 +- .../compat-data/data/overlapping-plugins.json | 6 +- .../compat-data/data/plugin-bugfixes.json | 12 + .../@babel/compat-data/data/plugins.json | 12 + .../@babel/compat-data/package.json | 2 +- .../node_modules/@babel/core/cjs-proxy.cjs | 8 +- .../@babel/core/lib/config/config-chain.js | 2 +- .../core/lib/config/files/module-types.js | 33 +- .../core/lib/config/helpers/config-api.js | 2 +- .../config/validation/option-assertions.js | 2 +- .../core/lib/config/validation/options.js | 7 +- .../node_modules/@babel/core/lib/index.js | 2 +- .../@babel/core/lib/parser/index.js | 2 +- .../lib/parser/util/missing-plugin-helper.js | 12 +- .../lib/transformation/block-hoist-plugin.js | 39 +- .../core/lib/transformation/file/file.js | 33 +- .../node_modules/@babel/core/package.json | 30 +- .../eslint-parser/lib/analyze-scope.cjs | 17 +- .../@babel/eslint-parser/lib/client.cjs | 96 +- .../eslint-parser/lib/experimental-worker.cjs | 2 +- .../@babel/eslint-parser/lib/index.cjs | 2 +- .../@babel/eslint-parser/lib/parse.cjs | 2 +- .../@babel/eslint-parser/package.json | 4 +- .../generator/lib/generators/typescript.js | 11 +- .../@babel/generator/package.json | 12 +- .../lib/import-injector.js | 100 +- .../@babel/helper-module-imports/package.json | 8 +- .../@babel/helper-plugin-utils/lib/index.js | 8 +- .../@babel/helper-plugin-utils/package.json | 2 +- .../@babel/helper-string-parser/package.json | 2 +- .../@babel/helpers/lib/helpers-generated.js | 31 +- .../@babel/helpers/lib/helpers.js | 49 +- .../helpers/lib/helpers/applyDecs2311.js | 236 ++++ .../helpers/lib/helpers/assertClassBrand.js | 14 + .../lib/helpers/classPrivateFieldGet2.js | 12 + .../lib/helpers/classPrivateFieldSet2.js | 13 + .../helpers/lib/helpers/classPrivateGetter.js | 12 + .../helpers/lib/helpers/classPrivateSetter.js | 13 + .../@babel/helpers/lib/helpers/toSetter.js | 18 + .../node_modules/@babel/helpers/lib/index.js | 4 +- .../node_modules/@babel/helpers/package.json | 14 +- .../helpers/scripts/generate-helpers.js | 12 +- .../@babel/highlight/lib/index.js | 64 +- .../@babel/highlight/package.json | 5 +- .../node_modules/@babel/parser/lib/index.js | 20 +- .../node_modules/@babel/parser/package.json | 8 +- .../package.json | 6 +- .../@babel/template/lib/literal.js | 2 +- .../@babel/template/lib/populate.js | 2 +- .../node_modules/@babel/template/package.json | 6 +- .../@babel/traverse/lib/context.js | 9 +- .../@babel/traverse/lib/path/evaluation.js | 2 +- .../@babel/traverse/lib/path/introspection.js | 12 + .../@babel/traverse/lib/scope/index.js | 20 +- .../node_modules/@babel/traverse/package.json | 14 +- .../@babel/types/lib/clone/cloneNode.js | 24 +- .../types/lib/definitions/placeholders.js | 2 +- .../types/lib/definitions/typescript.js | 6 +- .../@babel/types/lib/index.js.flow | 1 + .../node_modules/@babel/types/package.json | 4 +- .../@humanwhocodes/object-schema/package.json | 7 +- .../gen-mapping/dist/gen-mapping.mjs | 27 +- .../gen-mapping/dist/gen-mapping.umd.js | 24 +- .../@jridgewell/gen-mapping/package.json | 6 +- .../@jridgewell/set-array/dist/set-array.mjs | 85 +- .../set-array/dist/set-array.umd.js | 87 +- .../@jridgewell/set-array/package.json | 7 +- .../trace-mapping/dist/trace-mapping.mjs | 55 +- .../trace-mapping/dist/trace-mapping.umd.js | 54 +- .../@jridgewell/trace-mapping/package.json | 2 +- .../eslint-plugin-js/LICENSE} | 13 +- .../dist/array-bracket-newline.js | 148 ++ .../dist/array-bracket-spacing.js | 144 ++ .../dist/array-element-newline.js | 177 +++ .../eslint-plugin-js/dist/arrow-parens.js | 96 ++ .../eslint-plugin-js/dist/arrow-spacing.js | 106 ++ .../eslint-plugin-js/dist/block-spacing.js | 102 ++ .../eslint-plugin-js/dist/brace-style.js | 138 ++ .../eslint-plugin-js/dist/comma-dangle.js | 231 ++++ .../eslint-plugin-js/dist/comma-spacing.js | 101 ++ .../eslint-plugin-js/dist/comma-style.js | 195 +++ .../dist/computed-property-spacing.js | 133 ++ .../eslint-plugin-js/dist/configs.js | 249 ++++ .../eslint-plugin-js/dist/dot-location.js | 69 + .../eslint-plugin-js/dist/eol-last.js | 80 ++ .../dist/function-call-argument-newline.js | 84 ++ .../dist/function-call-spacing.js | 144 ++ .../dist/function-paren-newline.js | 194 +++ .../dist/generator-star-spacing.js | 132 ++ .../dist/implicit-arrow-linebreak.js | 56 + .../eslint-plugin-js/dist/indent.js | 1197 +++++++++++++++++ .../@stylistic/eslint-plugin-js/dist/index.js | 78 ++ .../eslint-plugin-js/dist/jsx-quotes.js | 65 + .../eslint-plugin-js/dist/key-spacing.js | 450 +++++++ .../eslint-plugin-js/dist/keyword-spacing.js | 335 +++++ .../eslint-plugin-js/dist/linebreak-style.js | 67 + .../dist/lines-around-comment.js | 257 ++++ .../dist/lines-between-class-members.js | 147 ++ .../eslint-plugin-js/dist/max-len.js | 237 ++++ .../dist/max-statements-per-line.js | 128 ++ .../dist/multiline-ternary.js | 144 ++ .../eslint-plugin-js/dist/new-parens.js | 63 + .../dist/newline-per-chained-call.js | 85 ++ .../dist/no-confusing-arrow.js | 51 + .../eslint-plugin-js/dist/no-extra-parens.js | 630 +++++++++ .../eslint-plugin-js/dist/no-extra-semi.js | 78 ++ .../dist/no-floating-decimal.js | 48 + .../dist/no-mixed-operators.js | 130 ++ .../dist/no-mixed-spaces-and-tabs.js | 84 ++ .../eslint-plugin-js/dist/no-multi-spaces.js | 90 ++ .../dist/no-multiple-empty-lines.js | 103 ++ .../eslint-plugin-js/dist/no-tabs.js | 59 + .../dist/no-trailing-spaces.js | 107 ++ .../dist/no-whitespace-before-property.js | 62 + .../dist/nonblock-statement-body-position.js | 85 ++ .../dist/object-curly-newline.js | 199 +++ .../dist/object-curly-spacing.js | 176 +++ .../dist/object-property-newline.js | 73 + .../dist/one-var-declaration-per-line.js | 53 + .../dist/operator-linebreak.js | 155 +++ .../eslint-plugin-js/dist/padded-blocks.js | 214 +++ .../dist/padding-line-between-statements.js | 313 +++++ .../eslint-plugin-js/dist/quote-props.js | 213 +++ .../eslint-plugin-js/dist/quotes.js | 198 +++ .../dist/rest-spread-spacing.js | 82 ++ .../eslint-plugin-js/dist/semi-spacing.js | 157 +++ .../eslint-plugin-js/dist/semi-style.js | 100 ++ .../@stylistic/eslint-plugin-js/dist/semi.js | 226 ++++ .../dist/space-before-blocks.js | 129 ++ .../dist/space-before-function-paren.js | 109 ++ .../eslint-plugin-js/dist/space-in-parens.js | 183 +++ .../eslint-plugin-js/dist/space-infix-ops.js | 108 ++ .../eslint-plugin-js/dist/space-unary-ops.js | 201 +++ .../eslint-plugin-js/dist/spaced-comment.js | 228 ++++ .../dist/switch-colon-spacing.js | 81 ++ .../dist/template-curly-spacing.js | 101 ++ .../dist/template-tag-spacing.js | 69 + .../@stylistic/eslint-plugin-js/dist/utils.js | 1113 +++++++++++++++ .../eslint-plugin-js/dist/wrap-iife.js | 112 ++ .../eslint-plugin-js/dist/wrap-regex.js | 41 + .../dist/yield-star-spacing.js | 87 ++ .../@stylistic/eslint-plugin-js/package.json | 124 ++ .../eslint/node_modules/@types/eslint/LICENSE | 21 + .../node_modules/@types/eslint/package.json | 70 + .../eslint/node_modules/@types/estree/LICENSE | 21 + .../node_modules/@types/estree/package.json | 26 + .../node_modules/@types/json-schema/LICENSE | 21 + .../@types/json-schema/package.json | 40 + .../node_modules/caniuse-lite/data/agents.js | 2 +- .../caniuse-lite/data/browserVersions.js | 2 +- .../caniuse-lite/data/features.js | 2 +- .../caniuse-lite/data/features/aac.js | 2 +- .../data/features/abortcontroller.js | 2 +- .../caniuse-lite/data/features/ac3-ec3.js | 2 +- .../data/features/accelerometer.js | 2 +- .../data/features/addeventlistener.js | 2 +- .../data/features/alternate-stylesheet.js | 2 +- .../data/features/ambient-light.js | 2 +- .../caniuse-lite/data/features/apng.js | 2 +- .../data/features/array-find-index.js | 2 +- .../caniuse-lite/data/features/array-find.js | 2 +- .../caniuse-lite/data/features/array-flat.js | 2 +- .../data/features/array-includes.js | 2 +- .../data/features/arrow-functions.js | 2 +- .../caniuse-lite/data/features/asmjs.js | 2 +- .../data/features/async-clipboard.js | 2 +- .../data/features/async-functions.js | 2 +- .../caniuse-lite/data/features/atob-btoa.js | 2 +- .../caniuse-lite/data/features/audio-api.js | 2 +- .../caniuse-lite/data/features/audio.js | 2 +- .../caniuse-lite/data/features/audiotracks.js | 2 +- .../caniuse-lite/data/features/autofocus.js | 2 +- .../caniuse-lite/data/features/auxclick.js | 2 +- .../caniuse-lite/data/features/av1.js | 2 +- .../caniuse-lite/data/features/avif.js | 2 +- .../data/features/background-attachment.js | 2 +- .../data/features/background-clip-text.js | 2 +- .../data/features/background-img-opts.js | 2 +- .../data/features/background-position-x-y.js | 2 +- .../features/background-repeat-round-space.js | 2 +- .../data/features/background-sync.js | 2 +- .../data/features/battery-status.js | 2 +- .../caniuse-lite/data/features/beacon.js | 2 +- .../data/features/beforeafterprint.js | 2 +- .../caniuse-lite/data/features/bigint.js | 2 +- .../caniuse-lite/data/features/blobbuilder.js | 2 +- .../caniuse-lite/data/features/bloburls.js | 2 +- .../data/features/border-image.js | 2 +- .../data/features/border-radius.js | 2 +- .../data/features/broadcastchannel.js | 2 +- .../caniuse-lite/data/features/brotli.js | 2 +- .../caniuse-lite/data/features/calc.js | 2 +- .../data/features/canvas-blending.js | 2 +- .../caniuse-lite/data/features/canvas-text.js | 2 +- .../caniuse-lite/data/features/canvas.js | 2 +- .../caniuse-lite/data/features/ch-unit.js | 2 +- .../data/features/chacha20-poly1305.js | 2 +- .../data/features/channel-messaging.js | 2 +- .../data/features/childnode-remove.js | 2 +- .../caniuse-lite/data/features/classlist.js | 2 +- .../client-hints-dpr-width-viewport.js | 2 +- .../caniuse-lite/data/features/clipboard.js | 2 +- .../caniuse-lite/data/features/colr-v1.js | 2 +- .../caniuse-lite/data/features/colr.js | 2 +- .../data/features/comparedocumentposition.js | 2 +- .../data/features/console-basic.js | 2 +- .../data/features/console-time.js | 2 +- .../caniuse-lite/data/features/const.js | 2 +- .../data/features/constraint-validation.js | 2 +- .../data/features/contenteditable.js | 2 +- .../data/features/contentsecuritypolicy.js | 2 +- .../data/features/contentsecuritypolicy2.js | 2 +- .../data/features/cookie-store-api.js | 2 +- .../caniuse-lite/data/features/cors.js | 2 +- .../data/features/createimagebitmap.js | 2 +- .../data/features/credential-management.js | 2 +- .../data/features/cryptography.js | 2 +- .../caniuse-lite/data/features/css-all.js | 2 +- .../data/features/css-anchor-positioning.js | 2 +- .../data/features/css-animation.js | 2 +- .../data/features/css-any-link.js | 2 +- .../data/features/css-appearance.js | 2 +- .../data/features/css-at-counter-style.js | 2 +- .../data/features/css-autofill.js | 2 +- .../data/features/css-backdrop-filter.js | 2 +- .../data/features/css-background-offsets.js | 2 +- .../data/features/css-backgroundblendmode.js | 2 +- .../data/features/css-boxdecorationbreak.js | 2 +- .../data/features/css-boxshadow.js | 2 +- .../caniuse-lite/data/features/css-canvas.js | 2 +- .../data/features/css-caret-color.js | 2 +- .../data/features/css-cascade-layers.js | 2 +- .../data/features/css-cascade-scope.js | 2 +- .../data/features/css-case-insensitive.js | 2 +- .../data/features/css-clip-path.js | 2 +- .../data/features/css-color-adjust.js | 2 +- .../data/features/css-color-function.js | 2 +- .../data/features/css-conic-gradients.js | 2 +- .../features/css-container-queries-style.js | 2 +- .../data/features/css-container-queries.js | 2 +- .../features/css-container-query-units.js | 2 +- .../data/features/css-containment.js | 2 +- .../data/features/css-content-visibility.js | 2 +- .../data/features/css-counters.js | 2 +- .../data/features/css-crisp-edges.js | 2 +- .../data/features/css-cross-fade.js | 2 +- .../data/features/css-default-pseudo.js | 2 +- .../data/features/css-descendant-gtgt.js | 2 +- .../data/features/css-deviceadaptation.js | 2 +- .../data/features/css-dir-pseudo.js | 2 +- .../data/features/css-display-contents.js | 2 +- .../data/features/css-element-function.js | 2 +- .../data/features/css-env-function.js | 2 +- .../data/features/css-exclusions.js | 2 +- .../data/features/css-featurequeries.js | 2 +- .../data/features/css-file-selector-button.js | 2 +- .../data/features/css-filter-function.js | 2 +- .../caniuse-lite/data/features/css-filters.js | 2 +- .../data/features/css-first-letter.js | 2 +- .../data/features/css-first-line.js | 2 +- .../caniuse-lite/data/features/css-fixed.js | 2 +- .../data/features/css-focus-visible.js | 2 +- .../data/features/css-focus-within.js | 2 +- .../data/features/css-font-palette.js | 2 +- .../features/css-font-rendering-controls.js | 2 +- .../data/features/css-font-stretch.js | 2 +- .../data/features/css-gencontent.js | 2 +- .../data/features/css-gradients.js | 2 +- .../data/features/css-grid-animation.js | 2 +- .../caniuse-lite/data/features/css-grid.js | 2 +- .../data/features/css-hanging-punctuation.js | 2 +- .../caniuse-lite/data/features/css-has.js | 2 +- .../caniuse-lite/data/features/css-hyphens.js | 2 +- .../data/features/css-image-orientation.js | 2 +- .../data/features/css-image-set.js | 2 +- .../data/features/css-in-out-of-range.js | 2 +- .../data/features/css-indeterminate-pseudo.js | 2 +- .../data/features/css-initial-letter.js | 2 +- .../data/features/css-initial-value.js | 2 +- .../caniuse-lite/data/features/css-lch-lab.js | 2 +- .../data/features/css-letter-spacing.js | 2 +- .../data/features/css-line-clamp.js | 2 +- .../data/features/css-logical-props.js | 2 +- .../data/features/css-marker-pseudo.js | 2 +- .../caniuse-lite/data/features/css-masks.js | 2 +- .../data/features/css-matches-pseudo.js | 2 +- .../data/features/css-math-functions.js | 2 +- .../data/features/css-media-interaction.js | 2 +- .../data/features/css-media-range-syntax.js | 2 +- .../data/features/css-media-resolution.js | 2 +- .../data/features/css-media-scripting.js | 2 +- .../data/features/css-mediaqueries.js | 2 +- .../data/features/css-mixblendmode.js | 2 +- .../data/features/css-module-scripts.js | 1 + .../data/features/css-motion-paths.js | 2 +- .../data/features/css-namespaces.js | 2 +- .../caniuse-lite/data/features/css-nesting.js | 2 +- .../data/features/css-not-sel-list.js | 2 +- .../data/features/css-nth-child-of.js | 2 +- .../caniuse-lite/data/features/css-opacity.js | 2 +- .../data/features/css-optional-pseudo.js | 2 +- .../data/features/css-overflow-anchor.js | 2 +- .../data/features/css-overflow-overlay.js | 2 +- .../data/features/css-overflow.js | 2 +- .../data/features/css-overscroll-behavior.js | 2 +- .../data/features/css-page-break.js | 2 +- .../data/features/css-paged-media.js | 2 +- .../data/features/css-paint-api.js | 2 +- .../data/features/css-placeholder-shown.js | 2 +- .../data/features/css-placeholder.js | 2 +- .../data/features/css-print-color-adjust.js | 2 +- .../data/features/css-read-only-write.js | 2 +- .../data/features/css-rebeccapurple.js | 2 +- .../data/features/css-reflections.js | 2 +- .../caniuse-lite/data/features/css-regions.js | 2 +- .../data/features/css-relative-colors.js | 2 +- .../data/features/css-repeating-gradients.js | 2 +- .../caniuse-lite/data/features/css-resize.js | 2 +- .../data/features/css-revert-value.js | 2 +- .../data/features/css-rrggbbaa.js | 2 +- .../data/features/css-scroll-behavior.js | 2 +- .../data/features/css-scroll-timeline.js | 2 +- .../data/features/css-scrollbar.js | 2 +- .../caniuse-lite/data/features/css-sel2.js | 2 +- .../caniuse-lite/data/features/css-sel3.js | 2 +- .../data/features/css-selection.js | 2 +- .../caniuse-lite/data/features/css-shapes.js | 2 +- .../data/features/css-snappoints.js | 2 +- .../caniuse-lite/data/features/css-sticky.js | 2 +- .../caniuse-lite/data/features/css-subgrid.js | 2 +- .../data/features/css-supports-api.js | 2 +- .../caniuse-lite/data/features/css-table.js | 2 +- .../data/features/css-text-align-last.js | 2 +- .../data/features/css-text-box-trim.js | 2 +- .../data/features/css-text-indent.js | 2 +- .../data/features/css-text-justify.js | 2 +- .../data/features/css-text-orientation.js | 2 +- .../data/features/css-text-spacing.js | 2 +- .../data/features/css-text-wrap-balance.js | 2 +- .../data/features/css-textshadow.js | 2 +- .../data/features/css-touch-action.js | 2 +- .../data/features/css-transitions.js | 2 +- .../data/features/css-unicode-bidi.js | 2 +- .../data/features/css-unset-value.js | 2 +- .../data/features/css-variables.js | 2 +- .../data/features/css-when-else.js | 2 +- .../data/features/css-widows-orphans.js | 2 +- .../data/features/css-width-stretch.js | 2 +- .../data/features/css-writing-mode.js | 2 +- .../caniuse-lite/data/features/css-zoom.js | 2 +- .../caniuse-lite/data/features/css3-attr.js | 2 +- .../data/features/css3-boxsizing.js | 2 +- .../caniuse-lite/data/features/css3-colors.js | 2 +- .../data/features/css3-cursors-grab.js | 2 +- .../data/features/css3-cursors-newer.js | 2 +- .../data/features/css3-cursors.js | 2 +- .../data/features/css3-tabsize.js | 2 +- .../data/features/currentcolor.js | 2 +- .../data/features/custom-elements.js | 2 +- .../data/features/custom-elementsv1.js | 2 +- .../caniuse-lite/data/features/customevent.js | 2 +- .../caniuse-lite/data/features/datalist.js | 2 +- .../caniuse-lite/data/features/dataset.js | 2 +- .../caniuse-lite/data/features/datauri.js | 2 +- .../data/features/date-tolocaledatestring.js | 2 +- .../data/features/declarative-shadow-dom.js | 2 +- .../caniuse-lite/data/features/decorators.js | 2 +- .../caniuse-lite/data/features/details.js | 2 +- .../data/features/deviceorientation.js | 2 +- .../data/features/devicepixelratio.js | 2 +- .../caniuse-lite/data/features/dialog.js | 2 +- .../data/features/dispatchevent.js | 2 +- .../caniuse-lite/data/features/dnssec.js | 2 +- .../data/features/do-not-track.js | 2 +- .../data/features/document-currentscript.js | 2 +- .../data/features/document-evaluate-xpath.js | 2 +- .../data/features/document-execcommand.js | 2 +- .../data/features/document-policy.js | 2 +- .../features/document-scrollingelement.js | 2 +- .../data/features/documenthead.js | 2 +- .../data/features/dom-manip-convenience.js | 2 +- .../caniuse-lite/data/features/dom-range.js | 2 +- .../data/features/domcontentloaded.js | 2 +- .../caniuse-lite/data/features/dommatrix.js | 2 +- .../caniuse-lite/data/features/download.js | 2 +- .../caniuse-lite/data/features/dragndrop.js | 2 +- .../data/features/element-closest.js | 2 +- .../data/features/element-from-point.js | 2 +- .../data/features/element-scroll-methods.js | 2 +- .../caniuse-lite/data/features/eme.js | 2 +- .../caniuse-lite/data/features/eot.js | 2 +- .../caniuse-lite/data/features/es5.js | 2 +- .../caniuse-lite/data/features/es6-class.js | 2 +- .../data/features/es6-generators.js | 2 +- .../features/es6-module-dynamic-import.js | 2 +- .../caniuse-lite/data/features/es6-module.js | 2 +- .../caniuse-lite/data/features/es6-number.js | 2 +- .../data/features/es6-string-includes.js | 2 +- .../caniuse-lite/data/features/es6.js | 2 +- .../caniuse-lite/data/features/eventsource.js | 2 +- .../data/features/extended-system-fonts.js | 2 +- .../data/features/feature-policy.js | 2 +- .../caniuse-lite/data/features/fetch.js | 2 +- .../data/features/fieldset-disabled.js | 2 +- .../caniuse-lite/data/features/fileapi.js | 2 +- .../caniuse-lite/data/features/filereader.js | 2 +- .../data/features/filereadersync.js | 2 +- .../caniuse-lite/data/features/filesystem.js | 2 +- .../caniuse-lite/data/features/flac.js | 2 +- .../caniuse-lite/data/features/flexbox-gap.js | 2 +- .../caniuse-lite/data/features/flexbox.js | 2 +- .../caniuse-lite/data/features/flow-root.js | 2 +- .../data/features/focusin-focusout-events.js | 2 +- .../data/features/font-family-system-ui.js | 2 +- .../data/features/font-feature.js | 2 +- .../data/features/font-kerning.js | 2 +- .../data/features/font-loading.js | 2 +- .../data/features/font-size-adjust.js | 2 +- .../caniuse-lite/data/features/font-smooth.js | 2 +- .../data/features/font-unicode-range.js | 2 +- .../data/features/font-variant-alternates.js | 2 +- .../data/features/font-variant-numeric.js | 2 +- .../caniuse-lite/data/features/fontface.js | 2 +- .../data/features/form-attribute.js | 2 +- .../data/features/form-submit-attributes.js | 2 +- .../data/features/form-validation.js | 2 +- .../caniuse-lite/data/features/forms.js | 2 +- .../caniuse-lite/data/features/fullscreen.js | 2 +- .../caniuse-lite/data/features/gamepad.js | 2 +- .../caniuse-lite/data/features/geolocation.js | 2 +- .../data/features/getboundingclientrect.js | 2 +- .../data/features/getcomputedstyle.js | 2 +- .../data/features/getelementsbyclassname.js | 2 +- .../data/features/getrandomvalues.js | 2 +- .../caniuse-lite/data/features/gyroscope.js | 2 +- .../data/features/hardwareconcurrency.js | 2 +- .../caniuse-lite/data/features/hashchange.js | 2 +- .../caniuse-lite/data/features/heif.js | 2 +- .../caniuse-lite/data/features/hevc.js | 2 +- .../caniuse-lite/data/features/hidden.js | 2 +- .../data/features/high-resolution-time.js | 2 +- .../caniuse-lite/data/features/history.js | 2 +- .../data/features/html-media-capture.js | 2 +- .../data/features/html5semantic.js | 2 +- .../data/features/http-live-streaming.js | 2 +- .../caniuse-lite/data/features/http2.js | 2 +- .../caniuse-lite/data/features/http3.js | 2 +- .../data/features/iframe-sandbox.js | 2 +- .../data/features/iframe-seamless.js | 2 +- .../data/features/iframe-srcdoc.js | 2 +- .../data/features/imagecapture.js | 2 +- .../caniuse-lite/data/features/ime.js | 2 +- .../img-naturalwidth-naturalheight.js | 2 +- .../caniuse-lite/data/features/import-maps.js | 2 +- .../caniuse-lite/data/features/imports.js | 2 +- .../data/features/indeterminate-checkbox.js | 2 +- .../caniuse-lite/data/features/indexeddb.js | 2 +- .../caniuse-lite/data/features/indexeddb2.js | 2 +- .../data/features/inline-block.js | 2 +- .../caniuse-lite/data/features/innertext.js | 2 +- .../data/features/input-autocomplete-onoff.js | 2 +- .../caniuse-lite/data/features/input-color.js | 2 +- .../data/features/input-datetime.js | 2 +- .../data/features/input-email-tel-url.js | 2 +- .../caniuse-lite/data/features/input-event.js | 2 +- .../data/features/input-file-accept.js | 2 +- .../data/features/input-file-directory.js | 2 +- .../data/features/input-file-multiple.js | 2 +- .../data/features/input-inputmode.js | 2 +- .../data/features/input-minlength.js | 2 +- .../data/features/input-number.js | 2 +- .../data/features/input-pattern.js | 2 +- .../data/features/input-placeholder.js | 2 +- .../caniuse-lite/data/features/input-range.js | 2 +- .../data/features/input-search.js | 2 +- .../data/features/input-selection.js | 2 +- .../data/features/insert-adjacent.js | 2 +- .../data/features/insertadjacenthtml.js | 2 +- .../data/features/internationalization.js | 2 +- .../data/features/intersectionobserver-v2.js | 2 +- .../data/features/intersectionobserver.js | 2 +- .../data/features/intl-pluralrules.js | 2 +- .../data/features/intrinsic-width.js | 2 +- .../caniuse-lite/data/features/jpeg2000.js | 2 +- .../caniuse-lite/data/features/jpegxl.js | 2 +- .../caniuse-lite/data/features/jpegxr.js | 2 +- .../data/features/js-regexp-lookbehind.js | 2 +- .../caniuse-lite/data/features/json.js | 2 +- .../features/justify-content-space-evenly.js | 2 +- .../data/features/kerning-pairs-ligatures.js | 2 +- .../data/features/keyboardevent-charcode.js | 2 +- .../data/features/keyboardevent-code.js | 2 +- .../keyboardevent-getmodifierstate.js | 2 +- .../data/features/keyboardevent-key.js | 2 +- .../data/features/keyboardevent-location.js | 2 +- .../data/features/keyboardevent-which.js | 2 +- .../caniuse-lite/data/features/lazyload.js | 2 +- .../caniuse-lite/data/features/let.js | 2 +- .../data/features/link-icon-png.js | 2 +- .../data/features/link-icon-svg.js | 2 +- .../data/features/link-rel-dns-prefetch.js | 2 +- .../data/features/link-rel-modulepreload.js | 2 +- .../data/features/link-rel-preconnect.js | 2 +- .../data/features/link-rel-prefetch.js | 2 +- .../data/features/link-rel-preload.js | 2 +- .../data/features/link-rel-prerender.js | 2 +- .../data/features/loading-lazy-attr.js | 2 +- .../data/features/localecompare.js | 2 +- .../data/features/magnetometer.js | 2 +- .../data/features/matchesselector.js | 2 +- .../caniuse-lite/data/features/matchmedia.js | 2 +- .../caniuse-lite/data/features/mathml.js | 2 +- .../caniuse-lite/data/features/maxlength.js | 2 +- .../mdn-css-backdrop-pseudo-element.js | 2 +- .../mdn-css-unicode-bidi-isolate-override.js | 2 +- .../features/mdn-css-unicode-bidi-isolate.js | 2 +- .../mdn-css-unicode-bidi-plaintext.js | 2 +- .../features/mdn-text-decoration-color.js | 2 +- .../data/features/mdn-text-decoration-line.js | 2 +- .../features/mdn-text-decoration-shorthand.js | 2 +- .../features/mdn-text-decoration-style.js | 2 +- .../data/features/media-fragments.js | 2 +- .../data/features/mediacapture-fromelement.js | 2 +- .../data/features/mediarecorder.js | 2 +- .../caniuse-lite/data/features/mediasource.js | 2 +- .../caniuse-lite/data/features/menu.js | 2 +- .../data/features/meta-theme-color.js | 2 +- .../caniuse-lite/data/features/meter.js | 2 +- .../caniuse-lite/data/features/midi.js | 2 +- .../caniuse-lite/data/features/minmaxwh.js | 2 +- .../caniuse-lite/data/features/mp3.js | 2 +- .../caniuse-lite/data/features/mpeg-dash.js | 2 +- .../caniuse-lite/data/features/mpeg4.js | 2 +- .../data/features/multibackgrounds.js | 2 +- .../caniuse-lite/data/features/multicolumn.js | 2 +- .../data/features/mutation-events.js | 2 +- .../data/features/mutationobserver.js | 2 +- .../data/features/namevalue-storage.js | 2 +- .../data/features/native-filesystem-api.js | 2 +- .../caniuse-lite/data/features/nav-timing.js | 2 +- .../caniuse-lite/data/features/netinfo.js | 2 +- .../data/features/notifications.js | 2 +- .../data/features/object-entries.js | 2 +- .../caniuse-lite/data/features/object-fit.js | 2 +- .../data/features/object-observe.js | 2 +- .../data/features/object-values.js | 2 +- .../caniuse-lite/data/features/objectrtc.js | 2 +- .../data/features/offline-apps.js | 2 +- .../data/features/offscreencanvas.js | 2 +- .../caniuse-lite/data/features/ogg-vorbis.js | 2 +- .../caniuse-lite/data/features/ogv.js | 2 +- .../caniuse-lite/data/features/ol-reversed.js | 2 +- .../data/features/once-event-listener.js | 2 +- .../data/features/online-status.js | 2 +- .../caniuse-lite/data/features/opus.js | 2 +- .../data/features/orientation-sensor.js | 2 +- .../caniuse-lite/data/features/outline.js | 2 +- .../data/features/pad-start-end.js | 2 +- .../data/features/page-transition-events.js | 2 +- .../data/features/pagevisibility.js | 2 +- .../data/features/passive-event-listener.js | 2 +- .../caniuse-lite/data/features/passkeys.js | 2 +- .../data/features/passwordrules.js | 2 +- .../caniuse-lite/data/features/path2d.js | 2 +- .../data/features/payment-request.js | 2 +- .../caniuse-lite/data/features/pdf-viewer.js | 2 +- .../data/features/permissions-api.js | 2 +- .../data/features/permissions-policy.js | 2 +- .../data/features/picture-in-picture.js | 2 +- .../caniuse-lite/data/features/picture.js | 2 +- .../caniuse-lite/data/features/ping.js | 2 +- .../caniuse-lite/data/features/png-alpha.js | 2 +- .../data/features/pointer-events.js | 2 +- .../caniuse-lite/data/features/pointer.js | 2 +- .../caniuse-lite/data/features/pointerlock.js | 2 +- .../caniuse-lite/data/features/portals.js | 2 +- .../data/features/prefers-color-scheme.js | 2 +- .../data/features/prefers-reduced-motion.js | 2 +- .../caniuse-lite/data/features/progress.js | 2 +- .../data/features/promise-finally.js | 2 +- .../caniuse-lite/data/features/promises.js | 2 +- .../caniuse-lite/data/features/proximity.js | 2 +- .../caniuse-lite/data/features/proxy.js | 2 +- .../data/features/publickeypinning.js | 2 +- .../caniuse-lite/data/features/push-api.js | 2 +- .../data/features/queryselector.js | 2 +- .../data/features/readonly-attr.js | 2 +- .../data/features/referrer-policy.js | 2 +- .../data/features/registerprotocolhandler.js | 2 +- .../data/features/rel-noopener.js | 2 +- .../data/features/rel-noreferrer.js | 2 +- .../caniuse-lite/data/features/rellist.js | 2 +- .../caniuse-lite/data/features/rem.js | 2 +- .../data/features/requestanimationframe.js | 2 +- .../data/features/requestidlecallback.js | 2 +- .../data/features/resizeobserver.js | 2 +- .../data/features/resource-timing.js | 2 +- .../data/features/rest-parameters.js | 2 +- .../data/features/rtcpeerconnection.js | 2 +- .../caniuse-lite/data/features/ruby.js | 2 +- .../caniuse-lite/data/features/run-in.js | 2 +- .../features/same-site-cookie-attribute.js | 2 +- .../data/features/screen-orientation.js | 2 +- .../data/features/script-async.js | 2 +- .../data/features/script-defer.js | 2 +- .../data/features/scrollintoview.js | 2 +- .../data/features/scrollintoviewifneeded.js | 2 +- .../caniuse-lite/data/features/sdch.js | 2 +- .../data/features/selection-api.js | 2 +- .../caniuse-lite/data/features/selectlist.js | 2 +- .../data/features/server-timing.js | 2 +- .../data/features/serviceworkers.js | 2 +- .../data/features/setimmediate.js | 2 +- .../caniuse-lite/data/features/shadowdom.js | 2 +- .../caniuse-lite/data/features/shadowdomv1.js | 2 +- .../data/features/sharedarraybuffer.js | 2 +- .../data/features/sharedworkers.js | 2 +- .../caniuse-lite/data/features/sni.js | 2 +- .../caniuse-lite/data/features/spdy.js | 2 +- .../data/features/speech-recognition.js | 2 +- .../data/features/speech-synthesis.js | 2 +- .../data/features/spellcheck-attribute.js | 2 +- .../caniuse-lite/data/features/sql-storage.js | 2 +- .../caniuse-lite/data/features/srcset.js | 2 +- .../caniuse-lite/data/features/stream.js | 2 +- .../caniuse-lite/data/features/streams.js | 2 +- .../data/features/stricttransportsecurity.js | 2 +- .../data/features/style-scoped.js | 2 +- .../data/features/subresource-bundling.js | 2 +- .../data/features/subresource-integrity.js | 2 +- .../caniuse-lite/data/features/svg-css.js | 2 +- .../caniuse-lite/data/features/svg-filters.js | 2 +- .../caniuse-lite/data/features/svg-fonts.js | 2 +- .../data/features/svg-fragment.js | 2 +- .../caniuse-lite/data/features/svg-html.js | 2 +- .../caniuse-lite/data/features/svg-html5.js | 2 +- .../caniuse-lite/data/features/svg-img.js | 2 +- .../caniuse-lite/data/features/svg-smil.js | 2 +- .../caniuse-lite/data/features/svg.js | 2 +- .../caniuse-lite/data/features/sxg.js | 2 +- .../data/features/tabindex-attr.js | 2 +- .../data/features/template-literals.js | 2 +- .../caniuse-lite/data/features/template.js | 2 +- .../caniuse-lite/data/features/temporal.js | 2 +- .../caniuse-lite/data/features/testfeat.js | 2 +- .../data/features/text-decoration.js | 2 +- .../data/features/text-emphasis.js | 2 +- .../data/features/text-overflow.js | 2 +- .../data/features/text-size-adjust.js | 2 +- .../caniuse-lite/data/features/text-stroke.js | 2 +- .../caniuse-lite/data/features/textcontent.js | 2 +- .../caniuse-lite/data/features/textencoder.js | 2 +- .../caniuse-lite/data/features/tls1-1.js | 2 +- .../caniuse-lite/data/features/tls1-2.js | 2 +- .../caniuse-lite/data/features/tls1-3.js | 2 +- .../caniuse-lite/data/features/touch.js | 2 +- .../data/features/transforms2d.js | 2 +- .../data/features/transforms3d.js | 2 +- .../data/features/trusted-types.js | 2 +- .../caniuse-lite/data/features/ttf.js | 2 +- .../caniuse-lite/data/features/typedarrays.js | 2 +- .../caniuse-lite/data/features/u2f.js | 2 +- .../data/features/unhandledrejection.js | 2 +- .../data/features/upgradeinsecurerequests.js | 2 +- .../features/url-scroll-to-text-fragment.js | 2 +- .../caniuse-lite/data/features/url.js | 2 +- .../data/features/urlsearchparams.js | 2 +- .../caniuse-lite/data/features/use-strict.js | 2 +- .../data/features/user-select-none.js | 2 +- .../caniuse-lite/data/features/user-timing.js | 2 +- .../data/features/variable-fonts.js | 2 +- .../data/features/vector-effect.js | 2 +- .../caniuse-lite/data/features/vibration.js | 2 +- .../caniuse-lite/data/features/video.js | 2 +- .../caniuse-lite/data/features/videotracks.js | 2 +- .../data/features/view-transitions.js | 2 +- .../data/features/viewport-unit-variants.js | 2 +- .../data/features/viewport-units.js | 2 +- .../caniuse-lite/data/features/wai-aria.js | 2 +- .../caniuse-lite/data/features/wake-lock.js | 2 +- .../caniuse-lite/data/features/wasm-bigint.js | 1 + .../data/features/wasm-bulk-memory.js | 1 + .../data/features/wasm-extended-const.js | 1 + .../caniuse-lite/data/features/wasm-gc.js | 1 + .../data/features/wasm-multi-memory.js | 1 + .../data/features/wasm-multi-value.js | 1 + .../data/features/wasm-mutable-globals.js | 1 + .../data/features/wasm-nontrapping-fptoint.js | 1 + .../data/features/wasm-reference-types.js | 2 +- .../data/features/wasm-relaxed-simd.js | 1 + .../data/features/wasm-signext.js | 1 + .../caniuse-lite/data/features/wasm-simd.js | 1 + .../data/features/wasm-tail-calls.js | 1 + .../data/features/wasm-threads.js | 1 + .../caniuse-lite/data/features/wasm.js | 2 +- .../caniuse-lite/data/features/wav.js | 2 +- .../caniuse-lite/data/features/wbr-element.js | 2 +- .../data/features/web-animation.js | 2 +- .../data/features/web-app-manifest.js | 2 +- .../data/features/web-bluetooth.js | 2 +- .../caniuse-lite/data/features/web-serial.js | 2 +- .../caniuse-lite/data/features/web-share.js | 2 +- .../caniuse-lite/data/features/webauthn.js | 2 +- .../caniuse-lite/data/features/webcodecs.js | 2 +- .../caniuse-lite/data/features/webgl.js | 2 +- .../caniuse-lite/data/features/webgl2.js | 2 +- .../caniuse-lite/data/features/webgpu.js | 2 +- .../caniuse-lite/data/features/webhid.js | 2 +- .../data/features/webkit-user-drag.js | 2 +- .../caniuse-lite/data/features/webm.js | 2 +- .../caniuse-lite/data/features/webnfc.js | 2 +- .../caniuse-lite/data/features/webp.js | 2 +- .../caniuse-lite/data/features/websockets.js | 2 +- .../data/features/webtransport.js | 2 +- .../caniuse-lite/data/features/webusb.js | 2 +- .../caniuse-lite/data/features/webvr.js | 2 +- .../caniuse-lite/data/features/webvtt.js | 2 +- .../caniuse-lite/data/features/webworkers.js | 2 +- .../caniuse-lite/data/features/webxr.js | 2 +- .../caniuse-lite/data/features/will-change.js | 2 +- .../caniuse-lite/data/features/woff.js | 2 +- .../caniuse-lite/data/features/woff2.js | 2 +- .../caniuse-lite/data/features/word-break.js | 2 +- .../caniuse-lite/data/features/wordwrap.js | 2 +- .../data/features/x-doc-messaging.js | 2 +- .../data/features/x-frame-options.js | 2 +- .../caniuse-lite/data/features/xhr2.js | 2 +- .../caniuse-lite/data/features/xhtml.js | 2 +- .../caniuse-lite/data/features/xhtmlsmil.js | 2 +- .../data/features/xml-serializer.js | 2 +- .../caniuse-lite/data/features/zstd.js | 2 +- .../caniuse-lite/data/regions/AD.js | 2 +- .../caniuse-lite/data/regions/AE.js | 2 +- .../caniuse-lite/data/regions/AF.js | 2 +- .../caniuse-lite/data/regions/AG.js | 2 +- .../caniuse-lite/data/regions/AI.js | 2 +- .../caniuse-lite/data/regions/AL.js | 2 +- .../caniuse-lite/data/regions/AM.js | 2 +- .../caniuse-lite/data/regions/AO.js | 2 +- .../caniuse-lite/data/regions/AR.js | 2 +- .../caniuse-lite/data/regions/AS.js | 2 +- .../caniuse-lite/data/regions/AT.js | 2 +- .../caniuse-lite/data/regions/AU.js | 2 +- .../caniuse-lite/data/regions/AW.js | 2 +- .../caniuse-lite/data/regions/AX.js | 2 +- .../caniuse-lite/data/regions/AZ.js | 2 +- .../caniuse-lite/data/regions/BA.js | 2 +- .../caniuse-lite/data/regions/BB.js | 2 +- .../caniuse-lite/data/regions/BD.js | 2 +- .../caniuse-lite/data/regions/BE.js | 2 +- .../caniuse-lite/data/regions/BF.js | 2 +- .../caniuse-lite/data/regions/BG.js | 2 +- .../caniuse-lite/data/regions/BH.js | 2 +- .../caniuse-lite/data/regions/BI.js | 2 +- .../caniuse-lite/data/regions/BJ.js | 2 +- .../caniuse-lite/data/regions/BM.js | 2 +- .../caniuse-lite/data/regions/BN.js | 2 +- .../caniuse-lite/data/regions/BO.js | 2 +- .../caniuse-lite/data/regions/BR.js | 2 +- .../caniuse-lite/data/regions/BS.js | 2 +- .../caniuse-lite/data/regions/BT.js | 2 +- .../caniuse-lite/data/regions/BW.js | 2 +- .../caniuse-lite/data/regions/BY.js | 2 +- .../caniuse-lite/data/regions/BZ.js | 2 +- .../caniuse-lite/data/regions/CA.js | 2 +- .../caniuse-lite/data/regions/CD.js | 2 +- .../caniuse-lite/data/regions/CF.js | 2 +- .../caniuse-lite/data/regions/CG.js | 2 +- .../caniuse-lite/data/regions/CH.js | 2 +- .../caniuse-lite/data/regions/CI.js | 2 +- .../caniuse-lite/data/regions/CK.js | 2 +- .../caniuse-lite/data/regions/CL.js | 2 +- .../caniuse-lite/data/regions/CM.js | 2 +- .../caniuse-lite/data/regions/CN.js | 2 +- .../caniuse-lite/data/regions/CO.js | 2 +- .../caniuse-lite/data/regions/CR.js | 2 +- .../caniuse-lite/data/regions/CU.js | 2 +- .../caniuse-lite/data/regions/CV.js | 2 +- .../caniuse-lite/data/regions/CX.js | 2 +- .../caniuse-lite/data/regions/CY.js | 2 +- .../caniuse-lite/data/regions/CZ.js | 2 +- .../caniuse-lite/data/regions/DE.js | 2 +- .../caniuse-lite/data/regions/DJ.js | 2 +- .../caniuse-lite/data/regions/DK.js | 2 +- .../caniuse-lite/data/regions/DM.js | 2 +- .../caniuse-lite/data/regions/DO.js | 2 +- .../caniuse-lite/data/regions/DZ.js | 2 +- .../caniuse-lite/data/regions/EC.js | 2 +- .../caniuse-lite/data/regions/EE.js | 2 +- .../caniuse-lite/data/regions/EG.js | 2 +- .../caniuse-lite/data/regions/ER.js | 2 +- .../caniuse-lite/data/regions/ES.js | 2 +- .../caniuse-lite/data/regions/ET.js | 2 +- .../caniuse-lite/data/regions/FI.js | 2 +- .../caniuse-lite/data/regions/FJ.js | 2 +- .../caniuse-lite/data/regions/FK.js | 2 +- .../caniuse-lite/data/regions/FM.js | 2 +- .../caniuse-lite/data/regions/FO.js | 2 +- .../caniuse-lite/data/regions/FR.js | 2 +- .../caniuse-lite/data/regions/GA.js | 2 +- .../caniuse-lite/data/regions/GB.js | 2 +- .../caniuse-lite/data/regions/GD.js | 2 +- .../caniuse-lite/data/regions/GE.js | 2 +- .../caniuse-lite/data/regions/GF.js | 2 +- .../caniuse-lite/data/regions/GG.js | 2 +- .../caniuse-lite/data/regions/GH.js | 2 +- .../caniuse-lite/data/regions/GI.js | 2 +- .../caniuse-lite/data/regions/GL.js | 2 +- .../caniuse-lite/data/regions/GM.js | 2 +- .../caniuse-lite/data/regions/GN.js | 2 +- .../caniuse-lite/data/regions/GP.js | 2 +- .../caniuse-lite/data/regions/GQ.js | 2 +- .../caniuse-lite/data/regions/GR.js | 2 +- .../caniuse-lite/data/regions/GT.js | 2 +- .../caniuse-lite/data/regions/GU.js | 2 +- .../caniuse-lite/data/regions/GW.js | 2 +- .../caniuse-lite/data/regions/GY.js | 2 +- .../caniuse-lite/data/regions/HK.js | 2 +- .../caniuse-lite/data/regions/HN.js | 2 +- .../caniuse-lite/data/regions/HR.js | 2 +- .../caniuse-lite/data/regions/HT.js | 2 +- .../caniuse-lite/data/regions/HU.js | 2 +- .../caniuse-lite/data/regions/ID.js | 2 +- .../caniuse-lite/data/regions/IE.js | 2 +- .../caniuse-lite/data/regions/IL.js | 2 +- .../caniuse-lite/data/regions/IM.js | 2 +- .../caniuse-lite/data/regions/IN.js | 2 +- .../caniuse-lite/data/regions/IQ.js | 2 +- .../caniuse-lite/data/regions/IR.js | 2 +- .../caniuse-lite/data/regions/IS.js | 2 +- .../caniuse-lite/data/regions/IT.js | 2 +- .../caniuse-lite/data/regions/JE.js | 2 +- .../caniuse-lite/data/regions/JM.js | 2 +- .../caniuse-lite/data/regions/JO.js | 2 +- .../caniuse-lite/data/regions/JP.js | 2 +- .../caniuse-lite/data/regions/KE.js | 2 +- .../caniuse-lite/data/regions/KG.js | 2 +- .../caniuse-lite/data/regions/KH.js | 2 +- .../caniuse-lite/data/regions/KI.js | 2 +- .../caniuse-lite/data/regions/KM.js | 2 +- .../caniuse-lite/data/regions/KN.js | 2 +- .../caniuse-lite/data/regions/KP.js | 2 +- .../caniuse-lite/data/regions/KR.js | 2 +- .../caniuse-lite/data/regions/KW.js | 2 +- .../caniuse-lite/data/regions/KY.js | 2 +- .../caniuse-lite/data/regions/KZ.js | 2 +- .../caniuse-lite/data/regions/LA.js | 2 +- .../caniuse-lite/data/regions/LB.js | 2 +- .../caniuse-lite/data/regions/LC.js | 2 +- .../caniuse-lite/data/regions/LI.js | 2 +- .../caniuse-lite/data/regions/LK.js | 2 +- .../caniuse-lite/data/regions/LR.js | 2 +- .../caniuse-lite/data/regions/LS.js | 2 +- .../caniuse-lite/data/regions/LT.js | 2 +- .../caniuse-lite/data/regions/LU.js | 2 +- .../caniuse-lite/data/regions/LV.js | 2 +- .../caniuse-lite/data/regions/LY.js | 2 +- .../caniuse-lite/data/regions/MA.js | 2 +- .../caniuse-lite/data/regions/MC.js | 2 +- .../caniuse-lite/data/regions/MD.js | 2 +- .../caniuse-lite/data/regions/ME.js | 2 +- .../caniuse-lite/data/regions/MG.js | 2 +- .../caniuse-lite/data/regions/MH.js | 2 +- .../caniuse-lite/data/regions/MK.js | 2 +- .../caniuse-lite/data/regions/ML.js | 2 +- .../caniuse-lite/data/regions/MM.js | 2 +- .../caniuse-lite/data/regions/MN.js | 2 +- .../caniuse-lite/data/regions/MO.js | 2 +- .../caniuse-lite/data/regions/MP.js | 2 +- .../caniuse-lite/data/regions/MQ.js | 2 +- .../caniuse-lite/data/regions/MR.js | 2 +- .../caniuse-lite/data/regions/MS.js | 2 +- .../caniuse-lite/data/regions/MT.js | 2 +- .../caniuse-lite/data/regions/MU.js | 2 +- .../caniuse-lite/data/regions/MV.js | 2 +- .../caniuse-lite/data/regions/MW.js | 2 +- .../caniuse-lite/data/regions/MX.js | 2 +- .../caniuse-lite/data/regions/MY.js | 2 +- .../caniuse-lite/data/regions/MZ.js | 2 +- .../caniuse-lite/data/regions/NA.js | 2 +- .../caniuse-lite/data/regions/NC.js | 2 +- .../caniuse-lite/data/regions/NE.js | 2 +- .../caniuse-lite/data/regions/NF.js | 2 +- .../caniuse-lite/data/regions/NG.js | 2 +- .../caniuse-lite/data/regions/NI.js | 2 +- .../caniuse-lite/data/regions/NL.js | 2 +- .../caniuse-lite/data/regions/NO.js | 2 +- .../caniuse-lite/data/regions/NP.js | 2 +- .../caniuse-lite/data/regions/NR.js | 2 +- .../caniuse-lite/data/regions/NU.js | 2 +- .../caniuse-lite/data/regions/NZ.js | 2 +- .../caniuse-lite/data/regions/OM.js | 2 +- .../caniuse-lite/data/regions/PA.js | 2 +- .../caniuse-lite/data/regions/PE.js | 2 +- .../caniuse-lite/data/regions/PF.js | 2 +- .../caniuse-lite/data/regions/PG.js | 2 +- .../caniuse-lite/data/regions/PH.js | 2 +- .../caniuse-lite/data/regions/PK.js | 2 +- .../caniuse-lite/data/regions/PL.js | 2 +- .../caniuse-lite/data/regions/PM.js | 2 +- .../caniuse-lite/data/regions/PN.js | 2 +- .../caniuse-lite/data/regions/PR.js | 2 +- .../caniuse-lite/data/regions/PS.js | 2 +- .../caniuse-lite/data/regions/PT.js | 2 +- .../caniuse-lite/data/regions/PW.js | 2 +- .../caniuse-lite/data/regions/PY.js | 2 +- .../caniuse-lite/data/regions/QA.js | 2 +- .../caniuse-lite/data/regions/RE.js | 2 +- .../caniuse-lite/data/regions/RO.js | 2 +- .../caniuse-lite/data/regions/RS.js | 2 +- .../caniuse-lite/data/regions/RU.js | 2 +- .../caniuse-lite/data/regions/RW.js | 2 +- .../caniuse-lite/data/regions/SA.js | 2 +- .../caniuse-lite/data/regions/SB.js | 2 +- .../caniuse-lite/data/regions/SC.js | 2 +- .../caniuse-lite/data/regions/SD.js | 2 +- .../caniuse-lite/data/regions/SE.js | 2 +- .../caniuse-lite/data/regions/SG.js | 2 +- .../caniuse-lite/data/regions/SH.js | 2 +- .../caniuse-lite/data/regions/SI.js | 2 +- .../caniuse-lite/data/regions/SK.js | 2 +- .../caniuse-lite/data/regions/SL.js | 2 +- .../caniuse-lite/data/regions/SM.js | 2 +- .../caniuse-lite/data/regions/SN.js | 2 +- .../caniuse-lite/data/regions/SO.js | 2 +- .../caniuse-lite/data/regions/SR.js | 2 +- .../caniuse-lite/data/regions/ST.js | 2 +- .../caniuse-lite/data/regions/SV.js | 2 +- .../caniuse-lite/data/regions/SY.js | 2 +- .../caniuse-lite/data/regions/SZ.js | 2 +- .../caniuse-lite/data/regions/TC.js | 2 +- .../caniuse-lite/data/regions/TD.js | 2 +- .../caniuse-lite/data/regions/TG.js | 2 +- .../caniuse-lite/data/regions/TH.js | 2 +- .../caniuse-lite/data/regions/TJ.js | 2 +- .../caniuse-lite/data/regions/TL.js | 2 +- .../caniuse-lite/data/regions/TM.js | 2 +- .../caniuse-lite/data/regions/TN.js | 2 +- .../caniuse-lite/data/regions/TO.js | 2 +- .../caniuse-lite/data/regions/TR.js | 2 +- .../caniuse-lite/data/regions/TT.js | 2 +- .../caniuse-lite/data/regions/TV.js | 2 +- .../caniuse-lite/data/regions/TW.js | 2 +- .../caniuse-lite/data/regions/TZ.js | 2 +- .../caniuse-lite/data/regions/UA.js | 2 +- .../caniuse-lite/data/regions/UG.js | 2 +- .../caniuse-lite/data/regions/US.js | 2 +- .../caniuse-lite/data/regions/UY.js | 2 +- .../caniuse-lite/data/regions/UZ.js | 2 +- .../caniuse-lite/data/regions/VA.js | 2 +- .../caniuse-lite/data/regions/VC.js | 2 +- .../caniuse-lite/data/regions/VE.js | 2 +- .../caniuse-lite/data/regions/VG.js | 2 +- .../caniuse-lite/data/regions/VI.js | 2 +- .../caniuse-lite/data/regions/VN.js | 2 +- .../caniuse-lite/data/regions/VU.js | 2 +- .../caniuse-lite/data/regions/WF.js | 2 +- .../caniuse-lite/data/regions/WS.js | 2 +- .../caniuse-lite/data/regions/YE.js | 2 +- .../caniuse-lite/data/regions/YT.js | 2 +- .../caniuse-lite/data/regions/ZA.js | 2 +- .../caniuse-lite/data/regions/ZM.js | 2 +- .../caniuse-lite/data/regions/ZW.js | 2 +- .../caniuse-lite/data/regions/alt-af.js | 2 +- .../caniuse-lite/data/regions/alt-an.js | 2 +- .../caniuse-lite/data/regions/alt-as.js | 2 +- .../caniuse-lite/data/regions/alt-eu.js | 2 +- .../caniuse-lite/data/regions/alt-na.js | 2 +- .../caniuse-lite/data/regions/alt-oc.js | 2 +- .../caniuse-lite/data/regions/alt-sa.js | 2 +- .../caniuse-lite/data/regions/alt-ww.js | 2 +- .../node_modules/caniuse-lite/package.json | 2 +- .../electron-to-chromium/chromium-versions.js | 3 +- .../chromium-versions.json | 2 +- .../full-chromium-versions.js | 109 +- .../full-chromium-versions.json | 2 +- .../electron-to-chromium/full-versions.js | 71 +- .../electron-to-chromium/full-versions.json | 2 +- .../electron-to-chromium/package.json | 2 +- .../electron-to-chromium/versions.js | 6 +- .../electron-to-chromium/versions.json | 2 +- .../dist/defaultTagOrder.cjs | 2 +- .../eslint-plugin-jsdoc/dist/exportParser.cjs | 6 +- .../dist/rules/validTypes.cjs | 3 +- .../eslint-plugin-jsdoc/dist/tagNames.cjs | 2 + .../eslint-plugin-jsdoc/package.json | 2 +- .../src/defaultTagOrder.js | 1 + .../eslint-plugin-jsdoc/src/exportParser.js | 15 +- .../src/rules/validTypes.js | 12 +- .../eslint-plugin-jsdoc/src/tagNames.js | 3 + .../eslint-plugin-markdown/lib/index.js | 91 +- .../eslint-plugin-markdown/lib/processor.js | 32 +- .../eslint-plugin-markdown/package.json | 29 +- 1049 files changed, 14778 insertions(+), 4478 deletions(-) delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js.flow delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/templates.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-convert/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-convert/conversions.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-convert/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-convert/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-convert/route.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-name/LICENSE delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-name/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/color-name/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/escape-string-regexp/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/escape-string-regexp/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/escape-string-regexp/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/has-flag/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/has-flag/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/has-flag/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/has-flag/readme.md delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/supports-color/browser.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/supports-color/index.js delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/supports-color/license delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/supports-color/package.json delete mode 100644 tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/supports-color/readme.md create mode 100644 tools/node_modules/eslint/node_modules/@babel/helpers/lib/helpers/applyDecs2311.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helpers/lib/helpers/assertClassBrand.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helpers/lib/helpers/classPrivateFieldGet2.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helpers/lib/helpers/classPrivateFieldSet2.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helpers/lib/helpers/classPrivateGetter.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helpers/lib/helpers/classPrivateSetter.js create mode 100644 tools/node_modules/eslint/node_modules/@babel/helpers/lib/helpers/toSetter.js rename tools/node_modules/eslint/node_modules/{@babel/code-frame/node_modules/escape-string-regexp/license => @stylistic/eslint-plugin-js/LICENSE} (79%) create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/array-bracket-newline.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/array-bracket-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/array-element-newline.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/arrow-parens.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/arrow-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/block-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/brace-style.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/comma-dangle.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/comma-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/comma-style.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/computed-property-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/configs.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/dot-location.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/eol-last.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/function-call-argument-newline.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/function-call-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/function-paren-newline.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/generator-star-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/implicit-arrow-linebreak.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/indent.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/index.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/jsx-quotes.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/key-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/keyword-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/linebreak-style.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/lines-around-comment.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/lines-between-class-members.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/max-len.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/max-statements-per-line.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/multiline-ternary.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/new-parens.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/newline-per-chained-call.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-confusing-arrow.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-extra-parens.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-extra-semi.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-floating-decimal.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-mixed-operators.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-mixed-spaces-and-tabs.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-multi-spaces.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-multiple-empty-lines.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-tabs.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-trailing-spaces.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/no-whitespace-before-property.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/nonblock-statement-body-position.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/object-curly-newline.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/object-curly-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/object-property-newline.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/one-var-declaration-per-line.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/operator-linebreak.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/padded-blocks.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/padding-line-between-statements.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/quote-props.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/quotes.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/rest-spread-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/semi-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/semi-style.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/semi.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/space-before-blocks.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/space-before-function-paren.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/space-in-parens.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/space-infix-ops.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/space-unary-ops.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/spaced-comment.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/switch-colon-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/template-curly-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/template-tag-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/utils.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/wrap-iife.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/wrap-regex.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/dist/yield-star-spacing.js create mode 100644 tools/node_modules/eslint/node_modules/@stylistic/eslint-plugin-js/package.json create mode 100644 tools/node_modules/eslint/node_modules/@types/eslint/LICENSE create mode 100644 tools/node_modules/eslint/node_modules/@types/eslint/package.json create mode 100644 tools/node_modules/eslint/node_modules/@types/estree/LICENSE create mode 100644 tools/node_modules/eslint/node_modules/@types/estree/package.json create mode 100644 tools/node_modules/eslint/node_modules/@types/json-schema/LICENSE create mode 100644 tools/node_modules/eslint/node_modules/@types/json-schema/package.json create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/css-module-scripts.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-bigint.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-bulk-memory.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-extended-const.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-gc.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-multi-memory.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-multi-value.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-mutable-globals.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-nontrapping-fptoint.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-relaxed-simd.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-signext.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-simd.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-tail-calls.js create mode 100644 tools/node_modules/eslint/node_modules/caniuse-lite/data/features/wasm-threads.js diff --git a/.eslintrc.js b/.eslintrc.js index a154d00794ab4d..0ba5c0b076b90c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,6 +19,7 @@ const hacks = [ 'eslint-plugin-markdown', '@babel/eslint-parser', '@babel/plugin-syntax-import-attributes', + '@stylistic/eslint-plugin-js', ]; Module._findPath = (request, paths, isMain) => { const r = ModuleFindPath(request, paths, isMain); @@ -39,7 +40,7 @@ module.exports = { es2022: true, }, extends: ['eslint:recommended', 'plugin:jsdoc/recommended'], - plugins: ['jsdoc', 'markdown', 'node-core'], + plugins: ['jsdoc', 'markdown', 'node-core', '@stylistic/js'], parser: '@babel/eslint-parser', parserOptions: { babelOptions: { @@ -133,11 +134,7 @@ module.exports = { // https://eslint.org/docs/rules/ 'accessor-pairs': 'error', 'array-callback-return': 'error', - 'arrow-parens': 'error', - 'arrow-spacing': 'error', 'block-scoped-var': 'error', - 'block-spacing': 'error', - 'brace-style': ['error', '1tbs', { allowSingleLine: true }], 'capitalized-comments': ['error', 'always', { line: { // Ignore all lines that have less characters than 20 and all lines that @@ -150,49 +147,17 @@ module.exports = { ignorePattern: '.*', }, }], - 'comma-dangle': ['error', 'always-multiline'], - 'comma-spacing': 'error', - 'comma-style': 'error', - 'computed-property-spacing': 'error', 'default-case-last': 'error', - 'dot-location': ['error', 'property'], 'dot-notation': 'error', - 'eol-last': 'error', 'eqeqeq': ['error', 'smart'], - 'func-call-spacing': 'error', 'func-name-matching': 'error', 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], - 'indent': ['error', 2, { - ArrayExpression: 'first', - CallExpression: { arguments: 'first' }, - FunctionDeclaration: { parameters: 'first' }, - FunctionExpression: { parameters: 'first' }, - MemberExpression: 'off', - ObjectExpression: 'first', - SwitchCase: 1, - }], - 'key-spacing': 'error', - 'keyword-spacing': 'error', - 'linebreak-style': 'error', - 'max-len': ['error', { - code: 120, - ignorePattern: '^// Flags:', - ignoreRegExpLiterals: true, - ignoreTemplateLiterals: true, - ignoreUrls: true, - tabWidth: 2, - }], - 'new-parens': 'error', - 'no-confusing-arrow': 'error', 'no-constant-condition': ['error', { checkLoops: false }], 'no-constructor-return': 'error', 'no-duplicate-imports': 'error', 'no-else-return': 'error', - 'no-extra-parens': ['error', 'functions'], 'no-lonely-if': 'error', 'no-mixed-requires': 'error', - 'no-multi-spaces': ['error', { ignoreEOLComments: true }], - 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }], 'no-new-require': 'error', 'no-path-concat': 'error', 'no-proto': 'error', @@ -257,10 +222,8 @@ module.exports = { }, ], 'no-self-compare': 'error', - 'no-tabs': 'error', 'no-template-curly-in-string': 'error', 'no-throw-literal': 'error', - 'no-trailing-spaces': 'error', 'no-undef': ['error', { typeof: true }], 'no-undef-init': 'error', 'no-unused-expressions': ['error', { allowShortCircuit: true }], @@ -276,39 +239,11 @@ module.exports = { 'no-useless-return': 'error', 'no-var': 'error', 'no-void': 'error', - 'no-whitespace-before-property': 'error', - 'object-curly-newline': 'error', - 'object-curly-spacing': ['error', 'always'], 'one-var': ['error', { initialized: 'never' }], - 'one-var-declaration-per-line': 'error', - 'operator-linebreak': ['error', 'after'], - 'padding-line-between-statements': [ - 'error', - { blankLine: 'always', prev: 'function', next: 'function' }, - ], 'prefer-const': ['error', { ignoreReadBeforeAssign: true }], 'prefer-object-has-own': 'error', - 'quotes': ['error', 'single', { avoidEscape: true }], - 'quote-props': ['error', 'consistent'], - 'rest-spread-spacing': 'error', - 'semi': 'error', - 'semi-spacing': 'error', - 'space-before-blocks': ['error', 'always'], - 'space-before-function-paren': ['error', { - anonymous: 'never', - named: 'never', - asyncArrow: 'always', - }], - 'space-in-parens': 'error', - 'space-infix-ops': 'error', - 'space-unary-ops': 'error', - 'spaced-comment': ['error', 'always', { - 'block': { 'balanced': true }, - 'exceptions': ['-'], - }], 'strict': ['error', 'global'], 'symbol-description': 'error', - 'template-curly-spacing': 'error', 'unicode-bom': 'error', 'valid-typeof': ['error', { requireStringLiterals: true }], @@ -327,6 +262,74 @@ module.exports = { 'jsdoc/check-tag-names': 'off', 'jsdoc/require-returns': 'off', + // Stylistic rules + '@stylistic/js/arrow-parens': 'error', + '@stylistic/js/arrow-spacing': 'error', + '@stylistic/js/block-spacing': 'error', + '@stylistic/js/brace-style': ['error', '1tbs', { allowSingleLine: true }], + '@stylistic/js/comma-dangle': ['error', 'always-multiline'], + '@stylistic/js/comma-spacing': 'error', + '@stylistic/js/comma-style': 'error', + '@stylistic/js/computed-property-spacing': 'error', + '@stylistic/js/dot-location': ['error', 'property'], + '@stylistic/js/eol-last': 'error', + '@stylistic/js/func-call-spacing': 'error', + '@stylistic/js/indent': ['error', 2, { + ArrayExpression: 'first', + CallExpression: { arguments: 'first' }, + FunctionDeclaration: { parameters: 'first' }, + FunctionExpression: { parameters: 'first' }, + MemberExpression: 'off', + ObjectExpression: 'first', + SwitchCase: 1, + }], + '@stylistic/js/key-spacing': 'error', + '@stylistic/js/keyword-spacing': 'error', + '@stylistic/js/linebreak-style': 'error', + '@stylistic/js/max-len': ['error', { + code: 120, + ignorePattern: '^// Flags:', + ignoreRegExpLiterals: true, + ignoreTemplateLiterals: true, + ignoreUrls: true, + tabWidth: 2, + }], + '@stylistic/js/new-parens': 'error', + '@stylistic/js/no-confusing-arrow': 'error', + '@stylistic/js/no-extra-parens': ['error', 'functions'], + '@stylistic/js/no-multi-spaces': ['error', { ignoreEOLComments: true }], + '@stylistic/js/no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }], + '@stylistic/js/no-tabs': 'error', + '@stylistic/js/no-trailing-spaces': 'error', + '@stylistic/js/no-whitespace-before-property': 'error', + '@stylistic/js/object-curly-newline': 'error', + '@stylistic/js/object-curly-spacing': ['error', 'always'], + '@stylistic/js/one-var-declaration-per-line': 'error', + '@stylistic/js/operator-linebreak': ['error', 'after'], + '@stylistic/js/padding-line-between-statements': [ + 'error', + { blankLine: 'always', prev: 'function', next: 'function' }, + ], + '@stylistic/js/quotes': ['error', 'single', { avoidEscape: true }], + '@stylistic/js/quote-props': ['error', 'consistent'], + '@stylistic/js/rest-spread-spacing': 'error', + '@stylistic/js/semi': 'error', + '@stylistic/js/semi-spacing': 'error', + '@stylistic/js/space-before-blocks': ['error', 'always'], + '@stylistic/js/space-before-function-paren': ['error', { + anonymous: 'never', + named: 'never', + asyncArrow: 'always', + }], + '@stylistic/js/space-in-parens': 'error', + '@stylistic/js/space-infix-ops': 'error', + '@stylistic/js/space-unary-ops': 'error', + '@stylistic/js/spaced-comment': ['error', 'always', { + 'block': { 'balanced': true }, + 'exceptions': ['-'], + }], + '@stylistic/js/template-curly-spacing': 'error', + // Custom rules from eslint-plugin-node-core 'node-core/no-unescaped-regexp-dot': 'error', 'node-core/no-duplicate-requires': 'error', diff --git a/doc/.eslintrc.yaml b/doc/.eslintrc.yaml index e8d24adb6e00aa..bdb3b88721edad 100644 --- a/doc/.eslintrc.yaml +++ b/doc/.eslintrc.yaml @@ -13,5 +13,5 @@ rules: prefer-rest-params: error prefer-template: error - # Stylistic Issues - no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}] + # Stylistic rules + '@stylistic/js/no-multiple-empty-lines': [error, {max: 1, maxEOF: 0, maxBOF: 0}] diff --git a/doc/api/dns.md b/doc/api/dns.md index 00a109937448bf..f589c04ef28389 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -163,7 +163,7 @@ Returns an array of IP address strings, formatted according to [RFC 5952][], that are currently configured for DNS resolution. A string will include a port section if a custom port is used. - + ```js [ @@ -468,7 +468,7 @@ will be present on the object: Here is an example of the `ret` object passed to the callback: - + ```js [ { type: 'A', address: '127.0.0.1', ttl: 299 }, @@ -934,7 +934,7 @@ Returns an array of IP address strings, formatted according to [RFC 5952][], that are currently configured for DNS resolution. A string will include a port section if a custom port is used. - + ```js [ @@ -1135,7 +1135,7 @@ present on the object: Here is an example of the result object: - + ```js [ { type: 'A', address: '127.0.0.1', ttl: 299 }, diff --git a/doc/api/http.md b/doc/api/http.md index abcae04adddbee..48aee202a14eb5 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -38,7 +38,7 @@ property, which is an array of `[key, value, key2, value2, ...]`. For example, the previous message header object might have a `rawHeaders` list like the following: - + ```js [ 'ConTent-Length', '123456', diff --git a/doc/api/http2.md b/doc/api/http2.md index d93ffbc5285ce8..ae143c8bbdd448 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -3587,7 +3587,7 @@ Accept: text/plain Then `request.url` will be: - + ```js '/status?name=ryan' diff --git a/doc/api/os.md b/doc/api/os.md index ce66dd25401609..ff2e5e4d243837 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -91,7 +91,7 @@ The properties included on each object include: * `idle` {number} The number of milliseconds the CPU has spent in idle mode. * `irq` {number} The number of milliseconds the CPU has spent in irq mode. - + ```js [ diff --git a/doc/api/process.md b/doc/api/process.md index 1c928045fe1047..7cdc649d435f6d 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1722,7 +1722,7 @@ Results in `process.execArgv`: And `process.argv`: - + ```js ['/usr/local/bin/node', 'script.js', '--version'] @@ -1742,7 +1742,7 @@ added: v0.1.100 The `process.execPath` property returns the absolute pathname of the executable that started the Node.js process. Symbolic links, if any, are resolved. - + ```js '/usr/local/bin/node' diff --git a/doc/api/zlib.md b/doc/api/zlib.md index a33de3833cbe9f..d5daa16a007f9f 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -264,7 +264,7 @@ From `zlib/zconf.h`, modified for Node.js usage: The memory requirements for deflate are (in bytes): - + ```js (1 << (windowBits + 2)) + (1 << (memLevel + 9)) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 072ad66006ffbc..42cdb19cffc553 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -4,9 +4,6 @@ env: rules: prefer-object-spread: error no-buffer-constructor: error - no-mixed-operators: - - error - - groups: [['&&', '||']] no-restricted-syntax: # Config copied from .eslintrc.js - error @@ -181,6 +178,12 @@ rules: - error - name: url message: Require `internal/url` instead of `url`. + + # Stylistic rules + '@stylistic/js/no-mixed-operators': + - error + - groups: [['&&', '||']] + # Custom rules in tools/eslint-rules node-core/avoid-prototype-pollution: error node-core/lowercase-name-for-primitive: error diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 1c1cfd4ef93e9a..c5f30b45229e04 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -8,7 +8,6 @@ rules: multiline-comment-style: [error, separate-lines] prefer-const: error symbol-description: off - comma-dangle: [error, always-multiline] no-restricted-syntax: # Config copied from .eslintrc.js @@ -54,6 +53,9 @@ rules: - selector: Identifier[name='webcrypto'] message: Use `globalThis.crypto`. + # Stylistic rules + '@stylistic/js/comma-dangle': [error, always-multiline] + # Custom rules in tools/eslint-rules node-core/prefer-assert-iferror: error node-core/prefer-assert-methods: error @@ -83,7 +85,7 @@ overrides: - sequential/*.js - sequential/*.mjs rules: - comma-dangle: [error, { + '@stylistic/js/comma-dangle': [error, { arrays: always-multiline, exports: always-multiline, functions: only-multiline, diff --git a/test/common/dns.js b/test/common/dns.js index 578f823684bbf9..d854c73629a07c 100644 --- a/test/common/dns.js +++ b/test/common/dns.js @@ -40,7 +40,7 @@ function readDomainFromPacket(buffer, offset) { } // Pointer to another part of the packet. assert.strictEqual(length & 0xC0, 0xC0); - // eslint-disable-next-line space-infix-ops, space-unary-ops + // eslint-disable-next-line @stylistic/js/space-infix-ops, @stylistic/js/space-unary-ops const pointeeOffset = buffer.readUInt16BE(offset) &~ 0xC000; return { nread: 2, diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 3132c52504421d..4c4073699f0548 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -730,7 +730,7 @@ assert.throws( // before the assertion causes any wrong assertion message. // Therefore, don't reformat the following code. // Refs: https://github.com/nodejs/node/issues/30872 - try { assert.ok(0); // eslint-disable-line no-useless-catch, brace-style + try { assert.ok(0); // eslint-disable-line no-useless-catch, @stylistic/js/brace-style } catch (err) { throw err; } @@ -767,7 +767,7 @@ assert.throws( // before the assertion causes any wrong assertion message. // Therefore, don't reformat the following code. // Refs: https://github.com/nodejs/node/issues/30872 - function test() { assert.ok(0); // eslint-disable-line brace-style + function test() { assert.ok(0); // eslint-disable-line @stylistic/js/brace-style } test(); }, @@ -804,7 +804,7 @@ assert.throws( () => { a( (() => 'string')() - // eslint-disable-next-line operator-linebreak + // eslint-disable-next-line @stylistic/js/operator-linebreak === 123 instanceof Buffer @@ -816,7 +816,7 @@ assert.throws( message: 'The expression evaluated to a falsy value:\n\n' + ' a(\n' + ' (() => \'string\')()\n' + - ' // eslint-disable-next-line operator-linebreak\n' + + ' // eslint-disable-next-line @stylistic/js/operator-linebreak\n' + ' ===\n' + ' 123 instanceof\n' + ' Buffer\n' + @@ -828,7 +828,7 @@ assert.throws( () => { a( (() => 'string')() - // eslint-disable-next-line operator-linebreak + // eslint-disable-next-line @stylistic/js/operator-linebreak === 123 instanceof Buffer @@ -840,7 +840,7 @@ assert.throws( message: 'The expression evaluated to a falsy value:\n\n' + ' a(\n' + ' (() => \'string\')()\n' + - ' // eslint-disable-next-line operator-linebreak\n' + + ' // eslint-disable-next-line @stylistic/js/operator-linebreak\n' + ' ===\n' + ' 123 instanceof\n' + ' Buffer\n' + @@ -848,7 +848,7 @@ assert.throws( } ); -/* eslint-disable indent */ +/* eslint-disable @stylistic/js/indent */ assert.throws(() => { a(( () => 'string')() === @@ -866,7 +866,7 @@ Buffer ' )\n' } ); -/* eslint-enable indent */ +/* eslint-enable @stylistic/js/indent */ assert.throws( () => { @@ -894,7 +894,7 @@ assert.throws( ); assert.throws( - // eslint-disable-next-line dot-notation, quotes + // eslint-disable-next-line dot-notation, @stylistic/js/quotes () => assert['ok']["apply"](null, [0]), { code: 'ERR_ASSERTION', diff --git a/test/parallel/test-internal-validators-validateoneof.js b/test/parallel/test-internal-validators-validateoneof.js index 5c5a62ef893726..116770a5d5e173 100644 --- a/test/parallel/test-internal-validators-validateoneof.js +++ b/test/parallel/test-internal-validators-validateoneof.js @@ -10,7 +10,7 @@ const { validateOneOf } = require('internal/validators'); const allowed = [2, 3]; assert.throws(() => validateOneOf(1, 'name', allowed), { code: 'ERR_INVALID_ARG_VALUE', - // eslint-disable-next-line quotes + // eslint-disable-next-line @stylistic/js/quotes message: `The argument 'name' must be one of: 2, 3. Received 1` }); } @@ -25,7 +25,7 @@ const { validateOneOf } = require('internal/validators'); const allowed = ['b', 'c']; assert.throws(() => validateOneOf('a', 'name', allowed), { code: 'ERR_INVALID_ARG_VALUE', - // eslint-disable-next-line quotes + // eslint-disable-next-line @stylistic/js/quotes message: `The argument 'name' must be one of: 'b', 'c'. Received 'a'` }); } @@ -40,7 +40,7 @@ const { validateOneOf } = require('internal/validators'); const allowed = [Symbol.for('b'), Symbol.for('c')]; assert.throws(() => validateOneOf(Symbol.for('a'), 'name', allowed), { code: 'ERR_INVALID_ARG_VALUE', - // eslint-disable-next-line quotes + // eslint-disable-next-line @stylistic/js/quotes message: `The argument 'name' must be one of: Symbol(b), Symbol(c). ` + 'Received Symbol(a)' }); diff --git a/test/parallel/test-policy-integrity-flag.js b/test/parallel/test-policy-integrity-flag.js index ddcd02236d27c0..1b4b013b900edd 100644 --- a/test/parallel/test-policy-integrity-flag.js +++ b/test/parallel/test-policy-integrity-flag.js @@ -21,12 +21,12 @@ const emptySRI = `sha512-${emptyHash.digest('base64')}`; const policyHash = crypto.createHash('sha512'); policyHash.update(fs.readFileSync(depPolicy)); -/* eslint-disable max-len */ +/* eslint-disable @stylistic/js/max-len */ // When using \n only const nixPolicySRI = 'sha512-u/nXI6UacK5fKDC2bopcgnuQY4JXJKlK3dESO3GIKKxwogVHjJqpF9rgk7Zw+TJXIc96xBUWKHuUgOzic8/4tQ=='; // When \n is turned into \r\n const windowsPolicySRI = 'sha512-OeyCPRo4OZMosHyquZXDHpuU1F4KzG9UHFnn12FMaHsvqFUt3TFZ+7wmZE7ThZ5rsQWkUjc9ZH0knGZ2e8BYPQ=='; -/* eslint-enable max-len */ +/* eslint-enable @stylistic/js/max-len */ const depPolicySRI = `${nixPolicySRI} ${windowsPolicySRI}`; { diff --git a/test/parallel/test-repl-colors.js b/test/parallel/test-repl-colors.js index dd1bdb1a08ee9e..e4187679039e20 100644 --- a/test/parallel/test-repl-colors.js +++ b/test/parallel/test-repl-colors.js @@ -1,4 +1,4 @@ -/* eslint-disable quotes */ +/* eslint-disable @stylistic/js/quotes */ 'use strict'; require('../common'); const { Duplex } = require('stream'); diff --git a/test/parallel/test-runner-coverage.js b/test/parallel/test-runner-coverage.js index 62338c2c3f7c33..c059e0ed8df936 100644 --- a/test/parallel/test-runner-coverage.js +++ b/test/parallel/test-runner-coverage.js @@ -22,7 +22,7 @@ function findCoverageFileForPid(pid) { } function getTapCoverageFixtureReport() { - /* eslint-disable max-len */ + /* eslint-disable @stylistic/js/max-len */ const report = [ '# start of coverage report', '# -------------------------------------------------------------------------------------------------------------------', @@ -36,7 +36,7 @@ function getTapCoverageFixtureReport() { '# -------------------------------------------------------------------------------------------------------------------', '# end of coverage report', ].join('\n'); - /* eslint-enable max-len */ + /* eslint-enable @stylistic/js/max-len */ if (common.isWindows) { return report.replaceAll('/', '\\'); @@ -46,7 +46,7 @@ function getTapCoverageFixtureReport() { } function getSpecCoverageFixtureReport() { - /* eslint-disable max-len */ + /* eslint-disable @stylistic/js/max-len */ const report = [ '\u2139 start of coverage report', '\u2139 -------------------------------------------------------------------------------------------------------------------', @@ -60,7 +60,7 @@ function getSpecCoverageFixtureReport() { '\u2139 -------------------------------------------------------------------------------------------------------------------', '\u2139 end of coverage report', ].join('\n'); - /* eslint-enable max-len */ + /* eslint-enable @stylistic/js/max-len */ if (common.isWindows) { return report.replaceAll('/', '\\'); diff --git a/test/parallel/test-runner-run.mjs b/test/parallel/test-runner-run.mjs index 4c974ac8641992..dd98b5a2d050db 100644 --- a/test/parallel/test-runner-run.mjs +++ b/test/parallel/test-runner-run.mjs @@ -345,7 +345,7 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { }), { name: 'RangeError', code: 'ERR_OUT_OF_RANGE', - // eslint-disable-next-line max-len + // eslint-disable-next-line @stylistic/js/max-len message: 'The value of "options.shard.index" is out of range. It must be >= 1 && <= 6 ("options.shard.total"). Received 0' }); }); @@ -360,7 +360,7 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { }), { name: 'RangeError', code: 'ERR_OUT_OF_RANGE', - // eslint-disable-next-line max-len + // eslint-disable-next-line @stylistic/js/max-len message: 'The value of "options.shard.index" is out of range. It must be >= 1 && <= 6 ("options.shard.total"). Received 7' }); }); diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index ba5b6f9fe84bb3..b95d1c3784728b 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -1462,7 +1462,7 @@ if (typeof Symbol !== 'undefined') { } { - const x = new function() {}; // eslint-disable-line new-parens + const x = new function() {}; // eslint-disable-line @stylistic/js/new-parens assert.strictEqual(util.inspect(x), '{}'); } @@ -2056,7 +2056,7 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); // Verify that classes are properly inspected. [ - /* eslint-disable spaced-comment, no-multi-spaces, brace-style */ + /* eslint-disable @stylistic/js/spaced-comment, @stylistic/js/no-multi-spaces, @stylistic/js/brace-style */ // The whitespace is intentional. [class { }, '[class (anonymous)]'], [class extends Error { log() {} }, '[class (anonymous) extends Error]'], @@ -2064,14 +2064,14 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); '[class A]'], [class // Random { // comments /* */ are part of the toString() result - /* eslint-disable-next-line space-before-blocks */ + /* eslint-disable-next-line @stylistic/js/space-before-blocks */ äß/**/extends/*{*/TypeError{}, '[class äß extends TypeError]'], /* The whitespace and new line is intended! */ // Foobar !!! [class X extends /****/ Error // More comments {}, '[class X extends Error]'], - /* eslint-enable spaced-comment, no-multi-spaces, brace-style */ + /* eslint-enable @stylistic/js/spaced-comment, @stylistic/js/no-multi-spaces, @stylistic/js/brace-style */ ].forEach(([clazz, string]) => { const inspected = util.inspect(clazz); assert.strictEqual(inspected, string); @@ -2111,7 +2111,7 @@ assert.strictEqual(util.inspect('"\'${a}'), "'\"\\'${a}'"); // "class" properties should not be detected as "class". { - // eslint-disable-next-line space-before-function-paren + // eslint-disable-next-line @stylistic/js/space-before-function-paren let obj = { class () {} }; assert.strictEqual( util.inspect(obj), @@ -3215,7 +3215,7 @@ assert.strictEqual( '[GeneratorFunction: generator] {\n' + ' [length]: 0,\n' + " [name]: 'generator',\n" + - " [prototype]: Object [Generator] { [Symbol(Symbol.toStringTag)]: 'Generator' },\n" + // eslint-disable-line max-len + " [prototype]: Object [Generator] { [Symbol(Symbol.toStringTag)]: 'Generator' },\n" + // eslint-disable-line @stylistic/js/max-len " [Symbol(Symbol.toStringTag)]: 'GeneratorFunction'\n" + '}' ); diff --git a/test/parallel/test-webcrypto-export-import-ec.js b/test/parallel/test-webcrypto-export-import-ec.js index d0548f56662f94..27c37715be1838 100644 --- a/test/parallel/test-webcrypto-export-import-ec.js +++ b/test/parallel/test-webcrypto-export-import-ec.js @@ -380,8 +380,8 @@ async function testImportRaw({ name, publicUsages }, namedCurve) { // https://github.com/nodejs/node/issues/45859 (async function() { - const compressed = Buffer.from([48, 57, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 34, 0, 2, 210, 16, 176, 166, 249, 217, 240, 18, 134, 128, 88, 180, 63, 164, 244, 113, 1, 133, 67, 187, 160, 12, 146, 80, 223, 146, 87, 194, 172, 174, 93, 209]); // eslint-disable-line max-len - const uncompressed = Buffer.from([48, 89, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 66, 0, 4, 210, 16, 176, 166, 249, 217, 240, 18, 134, 128, 88, 180, 63, 164, 244, 113, 1, 133, 67, 187, 160, 12, 146, 80, 223, 146, 87, 194, 172, 174, 93, 209, 206, 3, 117, 82, 212, 129, 69, 12, 227, 155, 77, 16, 149, 112, 27, 23, 91, 250, 179, 75, 142, 108, 9, 158, 24, 241, 193, 152, 53, 131, 97, 232]); // eslint-disable-line max-len + const compressed = Buffer.from([48, 57, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 34, 0, 2, 210, 16, 176, 166, 249, 217, 240, 18, 134, 128, 88, 180, 63, 164, 244, 113, 1, 133, 67, 187, 160, 12, 146, 80, 223, 146, 87, 194, 172, 174, 93, 209]); // eslint-disable-line @stylistic/js/max-len + const uncompressed = Buffer.from([48, 89, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 66, 0, 4, 210, 16, 176, 166, 249, 217, 240, 18, 134, 128, 88, 180, 63, 164, 244, 113, 1, 133, 67, 187, 160, 12, 146, 80, 223, 146, 87, 194, 172, 174, 93, 209, 206, 3, 117, 82, 212, 129, 69, 12, 227, 155, 77, 16, 149, 112, 27, 23, 91, 250, 179, 75, 142, 108, 9, 158, 24, 241, 193, 152, 53, 131, 97, 232]); // eslint-disable-line @stylistic/js/max-len for (const name of ['ECDH', 'ECDSA']) { const options = { name, namedCurve: 'P-256' }; const key = await subtle.importKey('spki', compressed, options, true, []); diff --git a/test/parallel/test-zlib-brotli-16GB.js b/test/parallel/test-zlib-brotli-16GB.js index 1c2712c32c91ee..9b894320e91ebd 100644 --- a/test/parallel/test-zlib-brotli-16GB.js +++ b/test/parallel/test-zlib-brotli-16GB.js @@ -7,7 +7,7 @@ const { getDefaultHighWaterMark } = require('stream'); // This tiny HEX string is a 16GB file. // This test verifies that the stream actually stops. -/* eslint-disable max-len */ +/* eslint-disable @stylistic/js/max-len */ const content = 'cfffff7ff82700e2b14020f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c32200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bffcfffff7ff82700e2b00040f7fe9ffffffff04f00c4610180eefd3fffffffe19f0088c30200ddfb7ffeffffc33f0110870500baf7fffcffff877f02200e0b0074effff9ffff0fff04401c1600e8defff3ffff1ffe0980382c00d0bdffe7ffff3ffc1300715800a07bff3f'; const buf = Buffer.from(content, 'hex'); diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh index 60292fb505d293..dc429cabb647b4 100755 --- a/tools/dep_updaters/update-eslint.sh +++ b/tools/dep_updaters/update-eslint.sh @@ -47,7 +47,8 @@ rm -rf ../node_modules/eslint eslint-plugin-markdown \ @babel/core \ @babel/eslint-parser \ - @babel/plugin-syntax-import-attributes + @babel/plugin-syntax-import-attributes \ + @stylistic/eslint-plugin-js ) ( cd node_modules/eslint @@ -62,7 +63,8 @@ rm -rf ../node_modules/eslint eslint-plugin-markdown \ @babel/core \ @babel/eslint-parser \ - @babel/plugin-syntax-import-attributes + @babel/plugin-syntax-import-attributes \ + @stylistic/eslint-plugin-js ) # Use dmn to remove some unneeded files. "$NODE" "$NPM" exec --package=dmn@2.2.2 --yes -- dmn -f clean diff --git a/tools/eslint-rules/prefer-proto.js b/tools/eslint-rules/prefer-proto.js index 7273c1af294b02..fd992cbec3bf98 100644 --- a/tools/eslint-rules/prefer-proto.js +++ b/tools/eslint-rules/prefer-proto.js @@ -27,7 +27,7 @@ module.exports = { }, create(context) { return { - /* eslint max-len: 0 */ + /* eslint @stylistic/js/max-len: 0 */ 'CallExpression[arguments.length=1]:matches(\ [callee.type="Identifier"][callee.name="ObjectCreate"],\ [callee.type="MemberExpression"][callee.object.name="Object"][callee.property.name="create"]\ diff --git a/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.mjs b/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.mjs index b5eddeda5a7802..f3875999c027f7 100644 --- a/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.mjs +++ b/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.mjs @@ -1,17 +1,18 @@ import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping'; -import { GenMapping, maybeAddSegment, setSourceContent, toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping'; +import { GenMapping, maybeAddSegment, setSourceContent, setIgnore, toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping'; -const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null); +const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null, false); const EMPTY_SOURCES = []; -function SegmentObject(source, line, column, name, content) { - return { source, line, column, name, content }; +function SegmentObject(source, line, column, name, content, ignore) { + return { source, line, column, name, content, ignore }; } -function Source(map, sources, source, content) { +function Source(map, sources, source, content, ignore) { return { map, sources, source, content, + ignore, }; } /** @@ -19,14 +20,14 @@ function Source(map, sources, source, content) { * (which may themselves be SourceMapTrees). */ function MapSource(map, sources) { - return Source(map, sources, '', null); + return Source(map, sources, '', null, false); } /** * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive * segment tracing ends at the `OriginalSource`. */ -function OriginalSource(source, content) { - return Source(null, EMPTY_SOURCES, source, content); +function OriginalSource(source, content, ignore) { + return Source(null, EMPTY_SOURCES, source, content, ignore); } /** * traceMappings is only called on the root level SourceMapTree, and begins the process of @@ -55,10 +56,12 @@ function traceMappings(tree) { if (traced == null) continue; } - const { column, line, name, content, source } = traced; + const { column, line, name, content, source, ignore } = traced; maybeAddSegment(gen, i, genCol, source, line, column, name); if (source && content != null) setSourceContent(gen, source, content); + if (ignore) + setIgnore(gen, source, true); } } return gen; @@ -69,7 +72,7 @@ function traceMappings(tree) { */ function originalPositionFor(source, line, column, name) { if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content); + return SegmentObject(source.source, line, column, name, source.content, source.ignore); } const segment = traceSegment(source.map, line, column); // If we couldn't find a segment, then this doesn't exist in the sourcemap. @@ -114,7 +117,7 @@ function buildSourceMapTree(input, loader) { return tree; } function build(map, loader, importer, importerDepth) { - const { resolvedSources, sourcesContent } = map; + const { resolvedSources, sourcesContent, ignoreList } = map; const depth = importerDepth + 1; const children = resolvedSources.map((sourceFile, i) => { // The loading context gives the loader more information about why this file is being loaded @@ -126,20 +129,22 @@ function build(map, loader, importer, importerDepth) { depth, source: sourceFile || '', content: undefined, + ignore: undefined, }; // Use the provided loader callback to retrieve the file's sourcemap. // TODO: We should eventually support async loading of sourcemap files. const sourceMap = loader(ctx.source, ctx); - const { source, content } = ctx; + const { source, content, ignore } = ctx; // If there is a sourcemap, then we need to recurse into it to load its source files. if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth); - // Else, it's an an unmodified source file. + // Else, it's an unmodified source file. // The contents of this unmodified source file can be overridden via the loader context, // allowing it to be explicitly null or a string. If it remains undefined, we fall back to // the importing sourcemap's `sourcesContent` field. const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null; - return OriginalSource(source, sourceContent); + const ignored = ignore !== undefined ? ignore : ignoreList ? ignoreList.includes(i) : false; + return OriginalSource(source, sourceContent, ignored); }); return MapSource(map, children); } @@ -155,6 +160,7 @@ class SourceMap { this.file = out.file; this.mappings = out.mappings; this.names = out.names; + this.ignoreList = out.ignoreList; this.sourceRoot = out.sourceRoot; this.sources = out.sources; if (!options.excludeContent) { diff --git a/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.umd.js b/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.umd.js index e292d4c37f8035..6b7b3bb520a45d 100644 --- a/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.umd.js +++ b/tools/node_modules/eslint/node_modules/@ampproject/remapping/dist/remapping.umd.js @@ -4,17 +4,18 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remapping = factory(global.traceMapping, global.genMapping)); })(this, (function (traceMapping, genMapping) { 'use strict'; - const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null); + const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null, false); const EMPTY_SOURCES = []; - function SegmentObject(source, line, column, name, content) { - return { source, line, column, name, content }; + function SegmentObject(source, line, column, name, content, ignore) { + return { source, line, column, name, content, ignore }; } - function Source(map, sources, source, content) { + function Source(map, sources, source, content, ignore) { return { map, sources, source, content, + ignore, }; } /** @@ -22,14 +23,14 @@ * (which may themselves be SourceMapTrees). */ function MapSource(map, sources) { - return Source(map, sources, '', null); + return Source(map, sources, '', null, false); } /** * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive * segment tracing ends at the `OriginalSource`. */ - function OriginalSource(source, content) { - return Source(null, EMPTY_SOURCES, source, content); + function OriginalSource(source, content, ignore) { + return Source(null, EMPTY_SOURCES, source, content, ignore); } /** * traceMappings is only called on the root level SourceMapTree, and begins the process of @@ -58,10 +59,12 @@ if (traced == null) continue; } - const { column, line, name, content, source } = traced; + const { column, line, name, content, source, ignore } = traced; genMapping.maybeAddSegment(gen, i, genCol, source, line, column, name); if (source && content != null) genMapping.setSourceContent(gen, source, content); + if (ignore) + genMapping.setIgnore(gen, source, true); } } return gen; @@ -72,7 +75,7 @@ */ function originalPositionFor(source, line, column, name) { if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content); + return SegmentObject(source.source, line, column, name, source.content, source.ignore); } const segment = traceMapping.traceSegment(source.map, line, column); // If we couldn't find a segment, then this doesn't exist in the sourcemap. @@ -117,7 +120,7 @@ return tree; } function build(map, loader, importer, importerDepth) { - const { resolvedSources, sourcesContent } = map; + const { resolvedSources, sourcesContent, ignoreList } = map; const depth = importerDepth + 1; const children = resolvedSources.map((sourceFile, i) => { // The loading context gives the loader more information about why this file is being loaded @@ -129,20 +132,22 @@ depth, source: sourceFile || '', content: undefined, + ignore: undefined, }; // Use the provided loader callback to retrieve the file's sourcemap. // TODO: We should eventually support async loading of sourcemap files. const sourceMap = loader(ctx.source, ctx); - const { source, content } = ctx; + const { source, content, ignore } = ctx; // If there is a sourcemap, then we need to recurse into it to load its source files. if (sourceMap) return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth); - // Else, it's an an unmodified source file. + // Else, it's an unmodified source file. // The contents of this unmodified source file can be overridden via the loader context, // allowing it to be explicitly null or a string. If it remains undefined, we fall back to // the importing sourcemap's `sourcesContent` field. const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null; - return OriginalSource(source, sourceContent); + const ignored = ignore !== undefined ? ignore : ignoreList ? ignoreList.includes(i) : false; + return OriginalSource(source, sourceContent, ignored); }); return MapSource(map, children); } @@ -158,6 +163,7 @@ this.file = out.file; this.mappings = out.mappings; this.names = out.names; + this.ignoreList = out.ignoreList; this.sourceRoot = out.sourceRoot; this.sources = out.sources; if (!options.excludeContent) { diff --git a/tools/node_modules/eslint/node_modules/@ampproject/remapping/package.json b/tools/node_modules/eslint/node_modules/@ampproject/remapping/package.json index bf3dad29b5c235..091224c6730b07 100644 --- a/tools/node_modules/eslint/node_modules/@ampproject/remapping/package.json +++ b/tools/node_modules/eslint/node_modules/@ampproject/remapping/package.json @@ -1,6 +1,6 @@ { "name": "@ampproject/remapping", - "version": "2.2.1", + "version": "2.3.0", "description": "Remap sequential sourcemaps through transformations to point at the original source code", "keywords": [ "source", @@ -69,7 +69,7 @@ "typescript": "4.6.3" }, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" } } diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js b/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js index 2f900ebacdc6cd..85ef5d6cda3b78 100644 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js +++ b/tools/node_modules/eslint/node_modules/@babel/code-frame/lib/index.js @@ -6,27 +6,26 @@ Object.defineProperty(exports, "__esModule", { exports.codeFrameColumns = codeFrameColumns; exports.default = _default; var _highlight = require("@babel/highlight"); -var _chalk = _interopRequireWildcard(require("chalk"), true); +var _picocolors = _interopRequireWildcard(require("picocolors"), true); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } -let chalkWithForcedColor = undefined; -function getChalk(forceColor) { +const colors = typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? (0, _picocolors.createColors)(false) : _picocolors.default; +const compose = (f, g) => v => f(g(v)); +let pcWithForcedColor = undefined; +function getColors(forceColor) { if (forceColor) { - var _chalkWithForcedColor; - (_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new _chalk.default.constructor({ - enabled: true, - level: 1 - }); - return chalkWithForcedColor; + var _pcWithForcedColor; + (_pcWithForcedColor = pcWithForcedColor) != null ? _pcWithForcedColor : pcWithForcedColor = (0, _picocolors.createColors)(true); + return pcWithForcedColor; } - return _chalk.default; + return colors; } let deprecationWarningShown = false; -function getDefs(chalk) { +function getDefs(colors) { return { - gutter: chalk.grey, - marker: chalk.red.bold, - message: chalk.red.bold + gutter: colors.gray, + marker: compose(colors.red, colors.bold), + message: compose(colors.red, colors.bold) }; } const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; @@ -88,10 +87,10 @@ function getMarkerLines(loc, source, opts) { } function codeFrameColumns(rawLines, loc, opts = {}) { const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts); - const chalk = getChalk(opts.forceColor); - const defs = getDefs(chalk); - const maybeHighlight = (chalkFn, string) => { - return highlighted ? chalkFn(string) : string; + const colors = getColors(opts.forceColor); + const defs = getDefs(colors); + const maybeHighlight = (fmt, string) => { + return highlighted ? fmt(string) : string; }; const lines = rawLines.split(NEWLINE); const { @@ -127,7 +126,7 @@ function codeFrameColumns(rawLines, loc, opts = {}) { frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`; } if (highlighted) { - return chalk.reset(frame); + return colors.reset(frame); } else { return frame; } diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/index.js b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/index.js deleted file mode 100644 index 90a871c4d78f6f..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/index.js +++ /dev/null @@ -1,165 +0,0 @@ -'use strict'; -const colorConvert = require('color-convert'); - -const wrapAnsi16 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${code + offset}m`; -}; - -const wrapAnsi256 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};5;${code}m`; -}; - -const wrapAnsi16m = (fn, offset) => function () { - const rgb = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; - -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], - - // Bright color - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; - - // Fix humans - styles.color.grey = styles.color.gray; - - for (const groupName of Object.keys(styles)) { - const group = styles[groupName]; - - for (const styleName of Object.keys(group)) { - const style = group[styleName]; - - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; - - group[styleName] = styles[styleName]; - - codes.set(style[0], style[1]); - } - - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); - - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); - } - - const ansi2ansi = n => n; - const rgb2rgb = (r, g, b) => [r, g, b]; - - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; - - styles.color.ansi = { - ansi: wrapAnsi16(ansi2ansi, 0) - }; - styles.color.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 0) - }; - styles.color.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 0) - }; - - styles.bgColor.ansi = { - ansi: wrapAnsi16(ansi2ansi, 10) - }; - styles.bgColor.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 10) - }; - styles.bgColor.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 10) - }; - - for (let key of Object.keys(colorConvert)) { - if (typeof colorConvert[key] !== 'object') { - continue; - } - - const suite = colorConvert[key]; - - if (key === 'ansi16') { - key = 'ansi'; - } - - if ('ansi16' in suite) { - styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); - styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); - } - - if ('ansi256' in suite) { - styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); - styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); - } - - if ('rgb' in suite) { - styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); - styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); - } - } - - return styles; -} - -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/license b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/package.json b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/package.json deleted file mode 100644 index 65edb48c399c5c..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "ansi-styles", - "version": "3.2.1", - "description": "ANSI escape codes for styling strings in the terminal", - "license": "MIT", - "repository": "chalk/ansi-styles", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && ava", - "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "color-convert": "^1.9.0" - }, - "devDependencies": { - "ava": "*", - "babel-polyfill": "^6.23.0", - "svg-term-cli": "^2.1.1", - "xo": "*" - }, - "ava": { - "require": "babel-polyfill" - } -} diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/readme.md b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/readme.md deleted file mode 100644 index 3158e2df59ce66..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/ansi-styles/readme.md +++ /dev/null @@ -1,147 +0,0 @@ -# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/ansi-styles) - -> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal - -You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. - - - - -## Install - -``` -$ npm install ansi-styles -``` - - -## Usage - -```js -const style = require('ansi-styles'); - -console.log(`${style.green.open}Hello world!${style.green.close}`); - - -// Color conversion between 16/256/truecolor -// NOTE: If conversion goes to 16 colors or 256 colors, the original color -// may be degraded to fit that color palette. This means terminals -// that do not support 16 million colors will best-match the -// original color. -console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close); -console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close); -console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close); -``` - -## API - -Each style has an `open` and `close` property. - - -## Styles - -### Modifiers - -- `reset` -- `bold` -- `dim` -- `italic` *(Not widely supported)* -- `underline` -- `inverse` -- `hidden` -- `strikethrough` *(Not widely supported)* - -### Colors - -- `black` -- `red` -- `green` -- `yellow` -- `blue` -- `magenta` -- `cyan` -- `white` -- `gray` ("bright black") -- `redBright` -- `greenBright` -- `yellowBright` -- `blueBright` -- `magentaBright` -- `cyanBright` -- `whiteBright` - -### Background colors - -- `bgBlack` -- `bgRed` -- `bgGreen` -- `bgYellow` -- `bgBlue` -- `bgMagenta` -- `bgCyan` -- `bgWhite` -- `bgBlackBright` -- `bgRedBright` -- `bgGreenBright` -- `bgYellowBright` -- `bgBlueBright` -- `bgMagentaBright` -- `bgCyanBright` -- `bgWhiteBright` - - -## Advanced usage - -By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. - -- `style.modifier` -- `style.color` -- `style.bgColor` - -###### Example - -```js -console.log(style.color.green.open); -``` - -Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values. - -###### Example - -```js -console.log(style.codes.get(36)); -//=> 39 -``` - - -## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728) - -`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors. - -To use these, call the associated conversion function with the intended output, for example: - -```js -style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code -style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code - -style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code -style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code - -style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code -style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code -``` - - -## Related - -- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - -## License - -MIT diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js deleted file mode 100644 index 1cc5fa89a95159..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js +++ /dev/null @@ -1,228 +0,0 @@ -'use strict'; -const escapeStringRegexp = require('escape-string-regexp'); -const ansiStyles = require('ansi-styles'); -const stdoutColor = require('supports-color').stdout; - -const template = require('./templates.js'); - -const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); - -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; - -// `color-convert` models to exclude from the Chalk API due to conflicts and such -const skipModels = new Set(['gray']); - -const styles = Object.create(null); - -function applyOptions(obj, options) { - options = options || {}; - - // Detect level if not set manually - const scLevel = stdoutColor ? stdoutColor.level : 0; - obj.level = options.level === undefined ? scLevel : options.level; - obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0; -} - -function Chalk(options) { - // We check for this.template here since calling `chalk.constructor()` - // by itself will have a `this` of a previously constructed chalk object - if (!this || !(this instanceof Chalk) || this.template) { - const chalk = {}; - applyOptions(chalk, options); - - chalk.template = function () { - const args = [].slice.call(arguments); - return chalkTag.apply(null, [chalk.template].concat(args)); - }; - - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); - - chalk.template.constructor = Chalk; - - return chalk.template; - } - - applyOptions(this, options); -} - -// Use bright blue on Windows as the normal blue color is illegible -if (isSimpleWindowsTerm) { - ansiStyles.blue.open = '\u001B[94m'; -} - -for (const key of Object.keys(ansiStyles)) { - ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - - styles[key] = { - get() { - const codes = ansiStyles[key]; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key); - } - }; -} - -styles.visible = { - get() { - return build.call(this, this._styles || [], true, 'visible'); - } -}; - -ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g'); -for (const model of Object.keys(ansiStyles.color.ansi)) { - if (skipModels.has(model)) { - continue; - } - - styles[model] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.color.close, - closeRe: ansiStyles.color.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g'); -for (const model of Object.keys(ansiStyles.bgColor.ansi)) { - if (skipModels.has(model)) { - continue; - } - - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const level = this.level; - return function () { - const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments); - const codes = { - open, - close: ansiStyles.bgColor.close, - closeRe: ansiStyles.bgColor.closeRe - }; - return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model); - }; - } - }; -} - -const proto = Object.defineProperties(() => {}, styles); - -function build(_styles, _empty, key) { - const builder = function () { - return applyStyle.apply(builder, arguments); - }; - - builder._styles = _styles; - builder._empty = _empty; - - const self = this; - - Object.defineProperty(builder, 'level', { - enumerable: true, - get() { - return self.level; - }, - set(level) { - self.level = level; - } - }); - - Object.defineProperty(builder, 'enabled', { - enumerable: true, - get() { - return self.enabled; - }, - set(enabled) { - self.enabled = enabled; - } - }); - - // See below for fix regarding invisible grey/dim combination on Windows - builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; - - // `__proto__` is used because we must return a function, but there is - // no way to create a function with a different prototype - builder.__proto__ = proto; // eslint-disable-line no-proto - - return builder; -} - -function applyStyle() { - // Support varags, but simply cast to string in case there's only one arg - const args = arguments; - const argsLen = args.length; - let str = String(arguments[0]); - - if (argsLen === 0) { - return ''; - } - - if (argsLen > 1) { - // Don't slice `arguments`, it prevents V8 optimizations - for (let a = 1; a < argsLen; a++) { - str += ' ' + args[a]; - } - } - - if (!this.enabled || this.level <= 0 || !str) { - return this._empty ? '' : str; - } - - // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe, - // see https://github.com/chalk/chalk/issues/58 - // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop. - const originalDim = ansiStyles.dim.open; - if (isSimpleWindowsTerm && this.hasGrey) { - ansiStyles.dim.open = ''; - } - - for (const code of this._styles.slice().reverse()) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - str = code.open + str.replace(code.closeRe, code.open) + code.close; - - // Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS - // https://github.com/chalk/chalk/pull/92 - str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`); - } - - // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue - ansiStyles.dim.open = originalDim; - - return str; -} - -function chalkTag(chalk, strings) { - if (!Array.isArray(strings)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return [].slice.call(arguments, 1).join(' '); - } - - const args = [].slice.call(arguments, 2); - const parts = [strings.raw[0]]; - - for (let i = 1; i < strings.length; i++) { - parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&')); - parts.push(String(strings.raw[i])); - } - - return template(chalk, parts.join('')); -} - -Object.defineProperties(Chalk.prototype, styles); - -module.exports = Chalk(); // eslint-disable-line new-cap -module.exports.supportsColor = stdoutColor; -module.exports.default = module.exports; // For TypeScript diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js.flow b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js.flow deleted file mode 100644 index 622caaa2e803f3..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/index.js.flow +++ /dev/null @@ -1,93 +0,0 @@ -// @flow strict - -type TemplateStringsArray = $ReadOnlyArray; - -export type Level = $Values<{ - None: 0, - Basic: 1, - Ansi256: 2, - TrueColor: 3 -}>; - -export type ChalkOptions = {| - enabled?: boolean, - level?: Level -|}; - -export type ColorSupport = {| - level: Level, - hasBasic: boolean, - has256: boolean, - has16m: boolean -|}; - -export interface Chalk { - (...text: string[]): string, - (text: TemplateStringsArray, ...placeholders: string[]): string, - constructor(options?: ChalkOptions): Chalk, - enabled: boolean, - level: Level, - rgb(r: number, g: number, b: number): Chalk, - hsl(h: number, s: number, l: number): Chalk, - hsv(h: number, s: number, v: number): Chalk, - hwb(h: number, w: number, b: number): Chalk, - bgHex(color: string): Chalk, - bgKeyword(color: string): Chalk, - bgRgb(r: number, g: number, b: number): Chalk, - bgHsl(h: number, s: number, l: number): Chalk, - bgHsv(h: number, s: number, v: number): Chalk, - bgHwb(h: number, w: number, b: number): Chalk, - hex(color: string): Chalk, - keyword(color: string): Chalk, - - +reset: Chalk, - +bold: Chalk, - +dim: Chalk, - +italic: Chalk, - +underline: Chalk, - +inverse: Chalk, - +hidden: Chalk, - +strikethrough: Chalk, - - +visible: Chalk, - - +black: Chalk, - +red: Chalk, - +green: Chalk, - +yellow: Chalk, - +blue: Chalk, - +magenta: Chalk, - +cyan: Chalk, - +white: Chalk, - +gray: Chalk, - +grey: Chalk, - +blackBright: Chalk, - +redBright: Chalk, - +greenBright: Chalk, - +yellowBright: Chalk, - +blueBright: Chalk, - +magentaBright: Chalk, - +cyanBright: Chalk, - +whiteBright: Chalk, - - +bgBlack: Chalk, - +bgRed: Chalk, - +bgGreen: Chalk, - +bgYellow: Chalk, - +bgBlue: Chalk, - +bgMagenta: Chalk, - +bgCyan: Chalk, - +bgWhite: Chalk, - +bgBlackBright: Chalk, - +bgRedBright: Chalk, - +bgGreenBright: Chalk, - +bgYellowBright: Chalk, - +bgBlueBright: Chalk, - +bgMagentaBright: Chalk, - +bgCyanBright: Chalk, - +bgWhiteBrigh: Chalk, - - supportsColor: ColorSupport -}; - -declare module.exports: Chalk; diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/license b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/license deleted file mode 100644 index e7af2f77107d73..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/package.json b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/package.json deleted file mode 100644 index bc324685a7625f..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "chalk", - "version": "2.4.2", - "description": "Terminal string styling done right", - "license": "MIT", - "repository": "chalk/chalk", - "engines": { - "node": ">=4" - }, - "scripts": { - "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava", - "bench": "matcha benchmark.js", - "coveralls": "nyc report --reporter=text-lcov | coveralls" - }, - "files": [ - "index.js", - "templates.js", - "types/index.d.ts", - "index.js.flow" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "str", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "devDependencies": { - "ava": "*", - "coveralls": "^3.0.0", - "execa": "^0.9.0", - "flow-bin": "^0.68.0", - "import-fresh": "^2.0.0", - "matcha": "^0.7.0", - "nyc": "^11.0.2", - "resolve-from": "^4.0.0", - "typescript": "^2.5.3", - "xo": "*" - }, - "types": "types/index.d.ts", - "xo": { - "envs": [ - "node", - "mocha" - ], - "ignores": [ - "test/_flow.js" - ] - } -} diff --git a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/readme.md deleted file mode 100644 index d298e2c48d64a0..00000000000000 --- a/tools/node_modules/eslint/node_modules/@babel/code-frame/node_modules/chalk/readme.md +++ /dev/null @@ -1,314 +0,0 @@ -

    -
    -
    - Chalk -
    -
    -
    -

    - -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs) - -### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0) - - - - -## Highlights - -- Expressive API -- Highly performant -- Ability to nest styles -- [256/Truecolor color support](#256-and-truecolor-color-support) -- Auto-detects color support -- Doesn't extend `String.prototype` -- Clean and focused -- Actively maintained -- [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017 - - -## Install - -```console -$ npm install chalk -``` - - - - - - -## Usage - -```js -const chalk = require('chalk'); - -console.log(chalk.blue('Hello world!')); -``` - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -const chalk = require('chalk'); -const log = console.log; - -// Combine styled and normal strings -log(chalk.blue('Hello') + ' World' + chalk.red('!')); - -// Compose multiple styles using the chainable API -log(chalk.blue.bgRed.bold('Hello world!')); - -// Pass in multiple arguments -log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); - -// Nest styles -log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); - -// Nest styles of the same type even (color, underline, background) -log(chalk.green( - 'I am a green line ' + - chalk.blue.underline.bold('with a blue substring') + - ' that becomes green again!' -)); - -// ES2015 template literal -log(` -CPU: ${chalk.red('90%')} -RAM: ${chalk.green('40%')} -DISK: ${chalk.yellow('70%')} -`); - -// ES2015 tagged template literal -log(chalk` -CPU: {red ${cpu.totalPercent}%} -RAM: {green ${ram.used / ram.total * 100}%} -DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} -`); - -// Use RGB colors in terminal emulators that support it. -log(chalk.keyword('orange')('Yay for orange colored text!')); -log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); -log(chalk.hex('#DEADED').bold('Bold gray!')); -``` - -Easily define your own themes: - -```js -const chalk = require('chalk'); - -const error = chalk.bold.red; -const warning = chalk.keyword('orange'); - -console.log(error('Error!')); -console.log(warning('Warning!')); -``` - -Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): - -```js -const name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> 'Hello Sindre' -``` - - -## API - -### chalk.`