diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 13bfabaec7ad2..71acfd9361d5c 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -63,8 +63,10 @@ /@npmcli/run-script/node_modules/* !/@npmcli/run-script/node_modules/@npmcli/ /@npmcli/run-script/node_modules/@npmcli/* -!/@npmcli/run-script/node_modules/@npmcli/package-json -!/@npmcli/run-script/node_modules/@npmcli/promise-spawn +!/@npmcli/run-script/node_modules/@npmcli/node-gyp +!/@npmcli/run-script/node_modules/isexe +!/@npmcli/run-script/node_modules/proc-log +!/@npmcli/run-script/node_modules/which !/@pkgjs/ /@pkgjs/* !/@pkgjs/parseargs @@ -209,6 +211,7 @@ /pacote/node_modules/@npmcli/* !/pacote/node_modules/@npmcli/package-json !/pacote/node_modules/@npmcli/promise-spawn +!/pacote/node_modules/@npmcli/run-script !/parse-conflict-json !/path-key !/path-scurry diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/LICENSE b/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/LICENSE new file mode 100644 index 0000000000000..3609cabca4535 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/LICENSE @@ -0,0 +1,7 @@ +ISC License: + +Copyright (c) 2023 by GitHub Inc. + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/lib/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/lib/index.js new file mode 100644 index 0000000000000..cdf18560e0ca2 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/lib/index.js @@ -0,0 +1,14 @@ +const util = require('util') +const fs = require('fs') +const { stat } = fs.promises || { stat: util.promisify(fs.stat) } + +async function isNodeGypPackage (path) { + return await stat(`${path}/binding.gyp`) + .then(st => st.isFile()) + .catch(() => false) +} + +module.exports = { + isNodeGypPackage, + defaultGypInstallScript: 'node-gyp rebuild', +} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/package.json b/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/package.json similarity index 57% rename from node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/package.json rename to node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/package.json index 5fea06ace7a81..3be9663a39de0 100644 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/package.json +++ b/node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp/package.json @@ -1,56 +1,45 @@ { - "name": "@npmcli/package-json", - "version": "5.2.1", - "description": "Programmatic API to update package.json", - "main": "lib/index.js", - "files": [ - "bin/", - "lib/" - ], + "name": "@npmcli/node-gyp", + "version": "4.0.0", + "description": "Tools for dealing with node-gyp packages", "scripts": { - "snap": "tap", "test": "tap", "lint": "npm run eslint", - "lintfix": "npm run eslint -- --fix", - "posttest": "npm run lint", - "postsnap": "npm run lintfix --", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-gyp.git" + }, "keywords": [ "npm", - "oss" + "cli", + "node-gyp" + ], + "files": [ + "bin/", + "lib/" ], + "main": "lib/index.js", "author": "GitHub Inc.", "license": "ISC", "devDependencies": { - "@npmcli/eslint-config": "^4.0.0", + "@npmcli/eslint-config": "^5.0.0", "@npmcli/template-oss": "4.23.3", - "read-package-json": "^7.0.0", - "read-package-json-fast": "^3.0.2", "tap": "^16.0.1" }, - "dependencies": { - "@npmcli/git": "^5.0.0", - "glob": "^10.2.2", - "hosted-git-info": "^7.0.0", - "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^6.0.0", - "proc-log": "^4.0.0", - "semver": "^7.5.3" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/npm/package-json.git" - }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "version": "4.23.3", - "publish": "true" + "publish": true }, "tap": { "nyc-arg": [ diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/LICENSE b/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/LICENSE deleted file mode 100644 index 6a1f3708f6d70..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -ISC License - -Copyright GitHub Inc. - -Permission to use, copy, modify, and/or distribute this -software for any purpose with or without fee is hereby -granted, provided that the above copyright notice and this -permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL -WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO -EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE -USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/index.js deleted file mode 100644 index f165ee23b75ab..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/index.js +++ /dev/null @@ -1,278 +0,0 @@ -const { readFile, writeFile } = require('node:fs/promises') -const { resolve } = require('node:path') -const parseJSON = require('json-parse-even-better-errors') - -const updateDeps = require('./update-dependencies.js') -const updateScripts = require('./update-scripts.js') -const updateWorkspaces = require('./update-workspaces.js') -const normalize = require('./normalize.js') -const { read, parse } = require('./read-package.js') - -// a list of handy specialized helper functions that take -// care of special cases that are handled by the npm cli -const knownSteps = new Set([ - updateDeps, - updateScripts, - updateWorkspaces, -]) - -// list of all keys that are handled by "knownSteps" helpers -const knownKeys = new Set([ - ...updateDeps.knownKeys, - 'scripts', - 'workspaces', -]) - -class PackageJson { - static normalizeSteps = Object.freeze([ - '_id', - '_attributes', - 'bundledDependencies', - 'bundleDependencies', - 'optionalDedupe', - 'scripts', - 'funding', - 'bin', - ]) - - // npm pkg fix - static fixSteps = Object.freeze([ - 'binRefs', - 'bundleDependencies', - 'bundleDependenciesFalse', - 'fixNameField', - 'fixVersionField', - 'fixRepositoryField', - 'fixDependencies', - 'devDependencies', - 'scriptpath', - ]) - - static prepareSteps = Object.freeze([ - '_id', - '_attributes', - 'bundledDependencies', - 'bundleDependencies', - 'bundleDependenciesDeleteFalse', - 'gypfile', - 'serverjs', - 'scriptpath', - 'authors', - 'readme', - 'mans', - 'binDir', - 'gitHead', - 'fillTypes', - 'normalizeData', - 'binRefs', - ]) - - // create a new empty package.json, so we can save at the given path even - // though we didn't start from a parsed file - static async create (path, opts = {}) { - const p = new PackageJson() - await p.create(path) - if (opts.data) { - return p.update(opts.data) - } - return p - } - - // Loads a package.json at given path and JSON parses - static async load (path, opts = {}) { - const p = new PackageJson() - // Avoid try/catch if we aren't going to create - if (!opts.create) { - return p.load(path) - } - - try { - return await p.load(path) - } catch (err) { - if (!err.message.startsWith('Could not read package.json')) { - throw err - } - return await p.create(path) - } - } - - // npm pkg fix - static async fix (path, opts) { - const p = new PackageJson() - await p.load(path, true) - return p.fix(opts) - } - - // read-package-json compatible behavior - static async prepare (path, opts) { - const p = new PackageJson() - await p.load(path, true) - return p.prepare(opts) - } - - // read-package-json-fast compatible behavior - static async normalize (path, opts) { - const p = new PackageJson() - await p.load(path) - return p.normalize(opts) - } - - #path - #manifest - #readFileContent = '' - #canSave = true - - // Load content from given path - async load (path, parseIndex) { - this.#path = path - let parseErr - try { - this.#readFileContent = await read(this.filename) - } catch (err) { - if (!parseIndex) { - throw err - } - parseErr = err - } - - if (parseErr) { - const indexFile = resolve(this.path, 'index.js') - let indexFileContent - try { - indexFileContent = await readFile(indexFile, 'utf8') - } catch (err) { - throw parseErr - } - try { - this.fromComment(indexFileContent) - } catch (err) { - throw parseErr - } - // This wasn't a package.json so prevent saving - this.#canSave = false - return this - } - - return this.fromJSON(this.#readFileContent) - } - - // Load data from a JSON string/buffer - fromJSON (data) { - this.#manifest = parse(data) - return this - } - - fromContent (data) { - this.#manifest = data - this.#canSave = false - return this - } - - // Load data from a comment - // /**package { "name": "foo", "version": "1.2.3", ... } **/ - fromComment (data) { - data = data.split(/^\/\*\*package(?:\s|$)/m) - - if (data.length < 2) { - throw new Error('File has no package in comments') - } - data = data[1] - data = data.split(/\*\*\/$/m) - - if (data.length < 2) { - throw new Error('File has no package in comments') - } - data = data[0] - data = data.replace(/^\s*\*/mg, '') - - this.#manifest = parseJSON(data) - return this - } - - get content () { - return this.#manifest - } - - get path () { - return this.#path - } - - get filename () { - if (this.path) { - return resolve(this.path, 'package.json') - } - return undefined - } - - create (path) { - this.#path = path - this.#manifest = {} - return this - } - - // This should be the ONLY way to set content in the manifest - update (content) { - if (!this.content) { - throw new Error('Can not update without content. Please `load` or `create`') - } - - for (const step of knownSteps) { - this.#manifest = step({ content, originalContent: this.content }) - } - - // unknown properties will just be overwitten - for (const [key, value] of Object.entries(content)) { - if (!knownKeys.has(key)) { - this.content[key] = value - } - } - - return this - } - - async save () { - if (!this.#canSave) { - throw new Error('No package.json to save to') - } - const { - [Symbol.for('indent')]: indent, - [Symbol.for('newline')]: newline, - } = this.content - - const format = indent === undefined ? ' ' : indent - const eol = newline === undefined ? '\n' : newline - const fileContent = `${ - JSON.stringify(this.content, null, format) - }\n` - .replace(/\n/g, eol) - - if (fileContent.trim() !== this.#readFileContent.trim()) { - return await writeFile(this.filename, fileContent) - } - } - - async normalize (opts = {}) { - if (!opts.steps) { - opts.steps = this.constructor.normalizeSteps - } - await normalize(this, opts) - return this - } - - async prepare (opts = {}) { - if (!opts.steps) { - opts.steps = this.constructor.prepareSteps - } - await normalize(this, opts) - return this - } - - async fix (opts = {}) { - // This one is not overridable - opts.steps = this.constructor.fixSteps - await normalize(this, opts) - return this - } -} - -module.exports = PackageJson diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/normalize.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/normalize.js deleted file mode 100644 index 3adec0143f445..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/normalize.js +++ /dev/null @@ -1,615 +0,0 @@ -const valid = require('semver/functions/valid') -const clean = require('semver/functions/clean') -const fs = require('node:fs/promises') -const path = require('node:path') -const { log } = require('proc-log') - -/** - * @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) { - if (pkg.bin) { - if (typeof pkg.bin === 'string' && pkg.name) { - changes?.push('"bin" was converted to an object') - pkg.bin = { [pkg.name]: pkg.bin } - } else if (Array.isArray(pkg.bin)) { - changes?.push('"bin" was converted to an object') - pkg.bin = pkg.bin.reduce((acc, k) => { - acc[path.basename(k)] = k - return acc - }, {}) - } - if (typeof pkg.bin === 'object') { - for (const binKey in pkg.bin) { - if (typeof pkg.bin[binKey] !== 'string') { - delete pkg.bin[binKey] - changes?.push(`removed invalid "bin[${binKey}]"`) - continue - } - const base = path.basename(secureAndUnixifyPath(binKey)) - if (!base) { - delete pkg.bin[binKey] - changes?.push(`removed invalid "bin[${binKey}]"`) - continue - } - - const binTarget = secureAndUnixifyPath(pkg.bin[binKey]) - - if (!binTarget) { - delete pkg.bin[binKey] - changes?.push(`removed invalid "bin[${binKey}]"`) - continue - } - - if (base !== binKey) { - delete pkg.bin[binKey] - changes?.push(`"bin[${binKey}]" was renamed to "bin[${base}]"`) - } - if (binTarget !== pkg.bin[binKey]) { - changes?.push(`"bin[${base}]" script name was cleaned`) - } - pkg.bin[base] = binTarget - } - - if (Object.keys(pkg.bin).length === 0) { - changes?.push('empty "bin" was removed') - delete pkg.bin - } - - return pkg - } - } - delete pkg.bin -} - -function normalizePackageMan (pkg, changes) { - if (pkg.man) { - const mans = [] - for (const man of (Array.isArray(pkg.man) ? pkg.man : [pkg.man])) { - if (typeof man !== 'string') { - changes?.push(`removed invalid "man [${man}]"`) - } else { - mans.push(secureAndUnixifyPath(man)) - } - } - - if (!mans.length) { - changes?.push('empty "man" was removed') - } else { - pkg.man = mans - return pkg - } - } - delete pkg.man -} - -function isCorrectlyEncodedName (spec) { - return !spec.match(/[/@\s+%:]/) && - spec === encodeURIComponent(spec) -} - -function isValidScopedPackageName (spec) { - if (spec.charAt(0) !== '@') { - return false - } - - const rest = spec.slice(1).split('/') - if (rest.length !== 2) { - return false - } - - return rest[0] && rest[1] && - rest[0] === encodeURIComponent(rest[0]) && - rest[1] === encodeURIComponent(rest[1]) -} - -function unixifyPath (ref) { - return ref.replace(/\\|:/g, '/') -} - -function secureAndUnixifyPath (ref) { - const secured = unixifyPath(path.join('.', path.join('/', unixifyPath(ref)))) - return secured.startsWith('./') ? '' : secured -} - -// We don't want the `changes` array in here by default because this is a hot -// path for parsing packuments during install. So the calling method passes it -// in if it wants to track changes. -const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase }) => { - if (!pkg.content) { - throw new Error('Can not normalize without content') - } - const data = pkg.content - const scripts = data.scripts || {} - const pkgId = `${data.name ?? ''}@${data.version ?? ''}` - - // name and version are load bearing so we have to clean them up first - if (steps.includes('fixNameField') || steps.includes('normalizeData')) { - if (!data.name && !strict) { - changes?.push('Missing "name" field was set to an empty string') - data.name = '' - } else { - if (typeof data.name !== 'string') { - throw new Error('name field must be a string.') - } - if (!strict) { - const name = data.name.trim() - if (data.name !== name) { - changes?.push(`Whitespace was trimmed from "name"`) - data.name = name - } - } - - if (data.name.startsWith('.') || - !(isValidScopedPackageName(data.name) || isCorrectlyEncodedName(data.name)) || - (strict && (!allowLegacyCase) && data.name !== data.name.toLowerCase()) || - data.name.toLowerCase() === 'node_modules' || - data.name.toLowerCase() === 'favicon.ico') { - throw new Error('Invalid name: ' + JSON.stringify(data.name)) - } - } - } - - if (steps.includes('fixVersionField') || steps.includes('normalizeData')) { - // allow "loose" semver 1.0 versions in non-strict mode - // enforce strict semver 2.0 compliance in strict mode - const loose = !strict - if (!data.version) { - data.version = '' - } else { - if (!valid(data.version, loose)) { - throw new Error(`Invalid version: "${data.version}"`) - } - const version = clean(data.version, loose) - if (version !== data.version) { - changes?.push(`"version" was cleaned and set to "${version}"`) - data.version = version - } - } - } - // remove attributes that start with "_" - if (steps.includes('_attributes')) { - for (const key in data) { - if (key.startsWith('_')) { - changes?.push(`"${key}" was removed`) - delete pkg.content[key] - } - } - } - - // build the "_id" attribute - if (steps.includes('_id')) { - if (data.name && data.version) { - changes?.push(`"_id" was set to ${pkgId}`) - data._id = pkgId - } - } - - // fix bundledDependencies typo - // normalize bundleDependencies - if (steps.includes('bundledDependencies')) { - if (data.bundleDependencies === undefined && data.bundledDependencies !== undefined) { - data.bundleDependencies = data.bundledDependencies - } - changes?.push(`Deleted incorrect "bundledDependencies"`) - delete data.bundledDependencies - } - // expand "bundleDependencies: true or translate from object" - if (steps.includes('bundleDependencies')) { - const bd = data.bundleDependencies - if (bd === false && !steps.includes('bundleDependenciesDeleteFalse')) { - changes?.push(`"bundleDependencies" was changed from "false" to "[]"`) - data.bundleDependencies = [] - } else if (bd === true) { - changes?.push(`"bundleDependencies" was auto-populated from "dependencies"`) - data.bundleDependencies = Object.keys(data.dependencies || {}) - } else if (bd && typeof bd === 'object') { - if (!Array.isArray(bd)) { - changes?.push(`"bundleDependencies" was changed from an object to an array`) - data.bundleDependencies = Object.keys(bd) - } - } else if ('bundleDependencies' in data) { - changes?.push(`"bundleDependencies" was removed`) - delete data.bundleDependencies - } - } - - // it was once common practice to list deps both in optionalDependencies and - // in dependencies, to support npm versions that did not know about - // optionalDependencies. This is no longer a relevant need, so duplicating - // the deps in two places is unnecessary and excessive. - if (steps.includes('optionalDedupe')) { - if (data.dependencies && - data.optionalDependencies && typeof data.optionalDependencies === 'object') { - for (const name in data.optionalDependencies) { - changes?.push(`optionalDependencies."${name}" was removed`) - delete data.dependencies[name] - } - if (!Object.keys(data.dependencies).length) { - changes?.push(`Empty "optionalDependencies" was removed`) - delete data.dependencies - } - } - } - - // add "install" attribute if any "*.gyp" files exist - if (steps.includes('gypfile')) { - if (!scripts.install && !scripts.preinstall && data.gypfile !== false) { - const files = await lazyLoadGlob()('*.gyp', { cwd: pkg.path }) - if (files.length) { - scripts.install = 'node-gyp rebuild' - data.scripts = scripts - data.gypfile = true - changes?.push(`"scripts.install" was set to "node-gyp rebuild"`) - changes?.push(`"gypfile" was set to "true"`) - } - } - } - - // add "start" attribute if "server.js" exists - if (steps.includes('serverjs') && !scripts.start) { - try { - await fs.access(path.join(pkg.path, 'server.js')) - scripts.start = 'node server.js' - data.scripts = scripts - changes?.push('"scripts.start" was set to "node server.js"') - } catch { - // do nothing - } - } - - // strip "node_modules/.bin" from scripts entries - // remove invalid scripts entries (non-strings) - if ((steps.includes('scripts') || steps.includes('scriptpath')) && data.scripts !== undefined) { - const spre = /^(\.[/\\])?node_modules[/\\].bin[\\/]/ - if (typeof data.scripts === 'object') { - for (const name in data.scripts) { - if (typeof data.scripts[name] !== 'string') { - delete data.scripts[name] - changes?.push(`Invalid scripts."${name}" was removed`) - } else if (steps.includes('scriptpath') && spre.test(data.scripts[name])) { - data.scripts[name] = data.scripts[name].replace(spre, '') - changes?.push(`scripts entry "${name}" was fixed to remove node_modules/.bin reference`) - } - } - } else { - changes?.push(`Removed invalid "scripts"`) - delete data.scripts - } - } - - if (steps.includes('funding')) { - if (data.funding && typeof data.funding === 'string') { - data.funding = { url: data.funding } - changes?.push(`"funding" was changed to an object with a url attribute`) - } - } - - // populate "authors" attribute - if (steps.includes('authors') && !data.contributors) { - try { - const authorData = await fs.readFile(path.join(pkg.path, 'AUTHORS'), 'utf8') - const authors = authorData.split(/\r?\n/g) - .map(line => line.replace(/^\s*#.*$/, '').trim()) - .filter(line => line) - data.contributors = authors - changes?.push('"contributors" was auto-populated with the contents of the "AUTHORS" file') - } catch { - // do nothing - } - } - - // populate "readme" attribute - if (steps.includes('readme') && !data.readme) { - const mdre = /\.m?a?r?k?d?o?w?n?$/i - const files = await lazyLoadGlob()('{README,README.*}', { - cwd: pkg.path, - nocase: true, - mark: true, - }) - let readmeFile - for (const file of files) { - // don't accept directories. - if (!file.endsWith(path.sep)) { - if (file.match(mdre)) { - readmeFile = file - break - } - if (file.endsWith('README')) { - readmeFile = file - } - } - } - if (readmeFile) { - const readmeData = await fs.readFile(path.join(pkg.path, readmeFile), 'utf8') - data.readme = readmeData - data.readmeFilename = readmeFile - changes?.push(`"readme" was set to the contents of ${readmeFile}`) - changes?.push(`"readmeFilename" was set to ${readmeFile}`) - } - if (!data.readme) { - // this.warn('missingReadme') - data.readme = 'ERROR: No README data found!' - } - } - - // expand directories.man - if (steps.includes('mans')) { - if (data.directories?.man && !data.man) { - const manDir = secureAndUnixifyPath(data.directories.man) - const cwd = path.resolve(pkg.path, manDir) - const files = await lazyLoadGlob()('**/*.[0-9]', { cwd }) - data.man = files.map(man => - path.relative(pkg.path, path.join(cwd, man)).split(path.sep).join('/') - ) - } - normalizePackageMan(data, changes) - } - - if (steps.includes('bin') || steps.includes('binDir') || steps.includes('binRefs')) { - normalizePackageBin(data, changes) - } - - // expand "directories.bin" - if (steps.includes('binDir') && data.directories?.bin && !data.bin) { - const binsDir = path.resolve(pkg.path, secureAndUnixifyPath(data.directories.bin)) - const bins = await lazyLoadGlob()('**', { cwd: binsDir }) - data.bin = bins.reduce((acc, binFile) => { - if (binFile && !binFile.startsWith('.')) { - const binName = path.basename(binFile) - acc[binName] = path.join(data.directories.bin, binFile) - } - return acc - }, {}) - // *sigh* - normalizePackageBin(data, changes) - } - - // 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) { - try { - head = await fs.readFile(path.resolve(gitRoot, '.git/HEAD'), 'utf8') - } catch (err) { - // do nothing - } - } - let headData - if (head) { - if (head.startsWith('ref: ')) { - const headRef = head.replace(/^ref: /, '').trim() - const headFile = path.resolve(gitRoot, '.git', headRef) - try { - headData = await fs.readFile(headFile, 'utf8') - headData = headData.replace(/^ref: /, '').trim() - } catch (err) { - // do nothing - } - if (!headData) { - const packFile = path.resolve(gitRoot, '.git/packed-refs') - try { - let refs = await fs.readFile(packFile, 'utf8') - if (refs) { - refs = refs.split('\n') - for (let i = 0; i < refs.length; i++) { - const match = refs[i].match(/^([0-9a-f]{40}) (.+)$/) - if (match && match[2].trim() === headRef) { - headData = match[1] - break - } - } - } - } catch { - // do nothing - } - } - } else { - headData = head.trim() - } - } - if (headData) { - data.gitHead = headData - } - } - - // populate "types" attribute - if (steps.includes('fillTypes')) { - const index = data.main || 'index.js' - - if (typeof index !== 'string') { - throw new TypeError('The "main" attribute must be of type string.') - } - - // TODO exports is much more complicated than this in verbose format - // We need to support for instance - - // "exports": { - // ".": [ - // { - // "default": "./lib/npm.js" - // }, - // "./lib/npm.js" - // ], - // "./package.json": "./package.json" - // }, - // as well as conditional exports - - // if (data.exports && typeof data.exports === 'string') { - // index = data.exports - // } - - // if (data.exports && data.exports['.']) { - // index = data.exports['.'] - // if (typeof index !== 'string') { - // } - // } - const extless = path.join(path.dirname(index), path.basename(index, path.extname(index))) - const dts = `./${extless}.d.ts` - const hasDTSFields = 'types' in data || 'typings' in data - if (!hasDTSFields) { - try { - await fs.access(path.join(pkg.path, dts)) - data.types = dts.split(path.sep).join('/') - } catch { - // do nothing - } - } - } - - // "normalizeData" from "read-package-json", which was just a call through to - // "normalize-package-data". We only call the "fixer" functions because - // outside of that it was also clobbering _id (which we already conditionally - // do) and also adding the gypfile script (which we also already - // conditionally do) - - // Some steps are isolated so we can do a limited subset of these in `fix` - if (steps.includes('fixRepositoryField') || steps.includes('normalizeData')) { - if (data.repositories) { - /* eslint-disable-next-line max-len */ - changes?.push(`"repository" was set to the first entry in "repositories" (${data.repository})`) - data.repository = data.repositories[0] - } - if (data.repository) { - if (typeof data.repository === 'string') { - changes?.push('"repository" was changed from a string to an object') - data.repository = { - type: 'git', - url: data.repository, - } - } - if (data.repository.url) { - const hosted = lazyHostedGitInfo().fromUrl(data.repository.url) - let r - if (hosted) { - if (hosted.getDefaultRepresentation() === 'shortcut') { - r = hosted.https() - } else { - r = hosted.toString() - } - if (r !== data.repository.url) { - changes?.push(`"repository.url" was normalized to "${r}"`) - data.repository.url = r - } - } - } - } - } - - if (steps.includes('fixDependencies') || steps.includes('normalizeData')) { - // peerDependencies? - // devDependencies is meaningless here, it's ignored on an installed package - for (const type of ['dependencies', 'devDependencies', 'optionalDependencies']) { - if (data[type]) { - let secondWarning = true - if (typeof data[type] === 'string') { - changes?.push(`"${type}" was converted from a string into an object`) - data[type] = data[type].trim().split(/[\n\r\s\t ,]+/) - secondWarning = false - } - if (Array.isArray(data[type])) { - if (secondWarning) { - changes?.push(`"${type}" was converted from an array into an object`) - } - const o = {} - for (const d of data[type]) { - if (typeof d === 'string') { - const dep = d.trim().split(/(:?[@\s><=])/) - const dn = dep.shift() - const dv = dep.join('').replace(/^@/, '').trim() - o[dn] = dv - } - } - data[type] = o - } - } - } - // normalize-package-data used to put optional dependencies BACK into - // dependencies here, we no longer do this - - for (const deps of ['dependencies', 'devDependencies']) { - if (deps in data) { - if (!data[deps] || typeof data[deps] !== 'object') { - changes?.push(`Removed invalid "${deps}"`) - delete data[deps] - } else { - for (const d in data[deps]) { - const r = data[deps][d] - if (typeof r !== 'string') { - changes?.push(`Removed invalid "${deps}.${d}"`) - delete data[deps][d] - } - 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() - } - } - } - } - } - } - - 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)) - } - - const legacySteps = [ - 'fixDescriptionField', - 'fixModulesField', - 'fixFilesField', - 'fixManField', - 'fixBugsField', - 'fixKeywordsField', - 'fixBundleDependenciesField', - 'fixHomepageField', - 'fixReadmeField', - 'fixLicenseField', - 'fixPeople', - 'fixTypos', - ] - for (const legacyStep of legacySteps) { - legacyFixer[legacyStep](data) - } - } - - // Warn if the bin references don't point to anything. This might be better - // in normalize-package-data if it had access to the file path. - if (steps.includes('binRefs') && data.bin instanceof Object) { - for (const key in data.bin) { - try { - await fs.access(path.resolve(pkg.path, data.bin[key])) - } catch { - log.warn('package-json', pkgId, `No bin file found at ${data.bin[key]}`) - // XXX: should a future breaking change delete bin entries that cannot be accessed? - } - } - } -} - -module.exports = normalize diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/read-package.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/read-package.js deleted file mode 100644 index d6c86ce388e6c..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/read-package.js +++ /dev/null @@ -1,39 +0,0 @@ -// This is JUST the code needed to open a package.json file and parse it. -// It's isolated out so that code needing to parse a package.json file can do so in the same way as this module does, without needing to require the whole module, or needing to require the underlying parsing library. - -const { readFile } = require('fs/promises') -const parseJSON = require('json-parse-even-better-errors') - -async function read (filename) { - try { - const data = await readFile(filename, 'utf8') - return data - } catch (err) { - err.message = `Could not read package.json: ${err}` - throw err - } -} - -function parse (data) { - try { - const content = parseJSON(data) - return content - } catch (err) { - err.message = `Invalid package.json: ${err}` - throw err - } -} - -// This is what most external libs will use. -// PackageJson will call read and parse separately -async function readPackage (filename) { - const data = await read(filename) - const content = parse(data) - return content -} - -module.exports = { - read, - parse, - readPackage, -} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-dependencies.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-dependencies.js deleted file mode 100644 index 7259949ab661d..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-dependencies.js +++ /dev/null @@ -1,75 +0,0 @@ -const depTypes = new Set([ - 'dependencies', - 'optionalDependencies', - 'devDependencies', - 'peerDependencies', -]) - -// sort alphabetically all types of deps for a given package -const orderDeps = (content) => { - for (const type of depTypes) { - if (content && content[type]) { - content[type] = Object.keys(content[type]) - .sort((a, b) => a.localeCompare(b, 'en')) - .reduce((res, key) => { - res[key] = content[type][key] - return res - }, {}) - } - } - return content -} - -const updateDependencies = ({ content, originalContent }) => { - const pkg = orderDeps({ - ...content, - }) - - // optionalDependencies don't need to be repeated in two places - if (pkg.dependencies) { - if (pkg.optionalDependencies) { - for (const name of Object.keys(pkg.optionalDependencies)) { - delete pkg.dependencies[name] - } - } - } - - const result = { ...originalContent } - - // loop through all types of dependencies and update package json pkg - for (const type of depTypes) { - if (pkg[type]) { - result[type] = pkg[type] - } - - // prune empty type props from resulting object - const emptyDepType = - pkg[type] - && typeof pkg === 'object' - && Object.keys(pkg[type]).length === 0 - if (emptyDepType) { - delete result[type] - } - } - - // if original package.json had dep in peerDeps AND deps, preserve that. - const { dependencies: origProd, peerDependencies: origPeer } = - originalContent || {} - const { peerDependencies: newPeer } = result - if (origProd && origPeer && newPeer) { - // we have original prod/peer deps, and new peer deps - // copy over any that were in both in the original - for (const name of Object.keys(origPeer)) { - if (origProd[name] !== undefined && newPeer[name] !== undefined) { - result.dependencies = result.dependencies || {} - result.dependencies[name] = newPeer[name] - } - } - } - - return result -} - -updateDependencies.knownKeys = depTypes - -module.exports = updateDependencies diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-scripts.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-scripts.js deleted file mode 100644 index 30495e54cc3c7..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-scripts.js +++ /dev/null @@ -1,29 +0,0 @@ -const updateScripts = ({ content, originalContent = {} }) => { - const newScripts = content.scripts - - if (!newScripts) { - return originalContent - } - - // validate scripts content being appended - const hasInvalidScripts = () => - Object.entries(newScripts) - .some(([key, value]) => - typeof key !== 'string' || typeof value !== 'string') - if (hasInvalidScripts()) { - throw Object.assign( - new TypeError( - 'package.json scripts should be a key-value pair of strings.'), - { code: 'ESCRIPTSINVALID' } - ) - } - - return { - ...originalContent, - scripts: { - ...newScripts, - }, - } -} - -module.exports = updateScripts diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-workspaces.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-workspaces.js deleted file mode 100644 index 04bf63230636f..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/package-json/lib/update-workspaces.js +++ /dev/null @@ -1,26 +0,0 @@ -const updateWorkspaces = ({ content, originalContent = {} }) => { - const newWorkspaces = content.workspaces - - if (!newWorkspaces) { - return originalContent - } - - // validate workspaces content being appended - const hasInvalidWorkspaces = () => - newWorkspaces.some(w => !(typeof w === 'string')) - if (!newWorkspaces.length || hasInvalidWorkspaces()) { - throw Object.assign( - new TypeError('workspaces should be an array of strings.'), - { code: 'EWORKSPACESINVALID' } - ) - } - - return { - ...originalContent, - workspaces: [ - ...newWorkspaces, - ], - } -} - -module.exports = updateWorkspaces diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/LICENSE b/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/LICENSE deleted file mode 100644 index 8f90f96f4c6c5..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE NPM DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE NPM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, -OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/escape.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/escape.js deleted file mode 100644 index 9aca8bde70a6e..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/escape.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict' - -// eslint-disable-next-line max-len -// this code adapted from: https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ -const cmd = (input, doubleEscape) => { - if (!input.length) { - return '""' - } - - let result - if (!/[ \t\n\v"]/.test(input)) { - result = input - } else { - result = '"' - for (let i = 0; i <= input.length; ++i) { - let slashCount = 0 - while (input[i] === '\\') { - ++i - ++slashCount - } - - if (i === input.length) { - result += '\\'.repeat(slashCount * 2) - break - } - - if (input[i] === '"') { - result += '\\'.repeat(slashCount * 2 + 1) - result += input[i] - } else { - result += '\\'.repeat(slashCount) - result += input[i] - } - } - result += '"' - } - - // and finally, prefix shell meta chars with a ^ - result = result.replace(/[ !%^&()<>|"]/g, '^$&') - if (doubleEscape) { - result = result.replace(/[ !%^&()<>|"]/g, '^$&') - } - - return result -} - -const sh = (input) => { - if (!input.length) { - return `''` - } - - if (!/[\t\n\r "#$&'()*;<>?\\`|~]/.test(input)) { - return input - } - - // replace single quotes with '\'' and wrap the whole result in a fresh set of quotes - const result = `'${input.replace(/'/g, `'\\''`)}'` - // if the input string already had single quotes around it, clean those up - .replace(/^(?:'')+(?!$)/, '') - .replace(/\\'''/g, `\\'`) - - return result -} - -module.exports = { - cmd, - sh, -} diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/index.js b/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/index.js deleted file mode 100644 index e147cb8f9c746..0000000000000 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/lib/index.js +++ /dev/null @@ -1,206 +0,0 @@ -'use strict' - -const { spawn } = require('child_process') -const os = require('os') -const which = require('which') - -const escape = require('./escape.js') - -// 'extra' object is for decorating the error a bit more -const promiseSpawn = (cmd, args, opts = {}, extra = {}) => { - if (opts.shell) { - return spawnWithShell(cmd, args, opts, extra) - } - - let resolve, reject - const promise = new Promise((_resolve, _reject) => { - resolve = _resolve - reject = _reject - }) - - // Create error here so we have a more useful stack trace when rejecting - const closeError = new Error('command failed') - - const stdout = [] - const stderr = [] - - const getResult = (result) => ({ - cmd, - args, - ...result, - ...stdioResult(stdout, stderr, opts), - ...extra, - }) - const rejectWithOpts = (er, erOpts) => { - const resultError = getResult(erOpts) - reject(Object.assign(er, resultError)) - } - - const proc = spawn(cmd, args, opts) - promise.stdin = proc.stdin - promise.process = proc - - proc.on('error', rejectWithOpts) - - if (proc.stdout) { - proc.stdout.on('data', c => stdout.push(c)) - proc.stdout.on('error', rejectWithOpts) - } - - if (proc.stderr) { - proc.stderr.on('data', c => stderr.push(c)) - proc.stderr.on('error', rejectWithOpts) - } - - proc.on('close', (code, signal) => { - if (code || signal) { - rejectWithOpts(closeError, { code, signal }) - } else { - resolve(getResult({ code, signal })) - } - }) - - return promise -} - -const spawnWithShell = (cmd, args, opts, extra) => { - let command = opts.shell - // if shell is set to true, we use a platform default. we can't let the core - // spawn method decide this for us because we need to know what shell is in use - // ahead of time so that we can escape arguments properly. we don't need coverage here. - if (command === true) { - // istanbul ignore next - command = process.platform === 'win32' ? process.env.ComSpec : 'sh' - } - - const options = { ...opts, shell: false } - const realArgs = [] - let script = cmd - - // first, determine if we're in windows because if we are we need to know if we're - // running an .exe or a .cmd/.bat since the latter requires extra escaping - const isCmd = /(?:^|\\)cmd(?:\.exe)?$/i.test(command) - if (isCmd) { - let doubleEscape = false - - // find the actual command we're running - let initialCmd = '' - let insideQuotes = false - for (let i = 0; i < cmd.length; ++i) { - const char = cmd.charAt(i) - if (char === ' ' && !insideQuotes) { - break - } - - initialCmd += char - if (char === '"' || char === "'") { - insideQuotes = !insideQuotes - } - } - - let pathToInitial - try { - pathToInitial = which.sync(initialCmd, { - path: (options.env && findInObject(options.env, 'PATH')) || process.env.PATH, - pathext: (options.env && findInObject(options.env, 'PATHEXT')) || process.env.PATHEXT, - }).toLowerCase() - } catch (err) { - pathToInitial = initialCmd.toLowerCase() - } - - doubleEscape = pathToInitial.endsWith('.cmd') || pathToInitial.endsWith('.bat') - for (const arg of args) { - script += ` ${escape.cmd(arg, doubleEscape)}` - } - realArgs.push('/d', '/s', '/c', script) - options.windowsVerbatimArguments = true - } else { - for (const arg of args) { - script += ` ${escape.sh(arg)}` - } - realArgs.push('-c', script) - } - - return promiseSpawn(command, realArgs, options, extra) -} - -// open a file with the default application as defined by the user's OS -const open = (_args, opts = {}, extra = {}) => { - const options = { ...opts, shell: true } - const args = [].concat(_args) - - let platform = process.platform - // process.platform === 'linux' may actually indicate WSL, if that's the case - // we want to treat things as win32 anyway so the host can open the argument - if (platform === 'linux' && os.release().toLowerCase().includes('microsoft')) { - platform = 'win32' - } - - let command = options.command - if (!command) { - if (platform === 'win32') { - // spawnWithShell does not do the additional os.release() check, so we - // have to force the shell here to make sure we treat WSL as windows. - options.shell = process.env.ComSpec - // also, the start command accepts a title so to make sure that we don't - // accidentally interpret the first arg as the title, we stick an empty - // string immediately after the start command - command = 'start ""' - } else if (platform === 'darwin') { - command = 'open' - } else { - command = 'xdg-open' - } - } - - return spawnWithShell(command, args, options, extra) -} -promiseSpawn.open = open - -const isPipe = (stdio = 'pipe', fd) => { - if (stdio === 'pipe' || stdio === null) { - return true - } - - if (Array.isArray(stdio)) { - return isPipe(stdio[fd], fd) - } - - return false -} - -const stdioResult = (stdout, stderr, { stdioString = true, stdio }) => { - const result = { - stdout: null, - stderr: null, - } - - // stdio is [stdin, stdout, stderr] - if (isPipe(stdio, 1)) { - result.stdout = Buffer.concat(stdout) - if (stdioString) { - result.stdout = result.stdout.toString().trim() - } - } - - if (isPipe(stdio, 2)) { - result.stderr = Buffer.concat(stderr) - if (stdioString) { - result.stderr = result.stderr.toString().trim() - } - } - - return result -} - -// case insensitive lookup in an object -const findInObject = (obj, key) => { - key = key.toLowerCase() - for (const objKey of Object.keys(obj).sort()) { - if (objKey.toLowerCase() === key) { - return obj[objKey] - } - } -} - -module.exports = promiseSpawn diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/LICENSE b/node_modules/@npmcli/run-script/node_modules/isexe/LICENSE new file mode 100644 index 0000000000000..c925dbe826b67 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2016-2022 Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/index.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/index.js new file mode 100644 index 0000000000000..cefcb66b5c543 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/index.js @@ -0,0 +1,46 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = exports.posix = exports.win32 = void 0; +const posix = __importStar(require("./posix.js")); +exports.posix = posix; +const win32 = __importStar(require("./win32.js")); +exports.win32 = win32; +__exportStar(require("./options.js"), exports); +const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; +const impl = platform === 'win32' ? win32 : posix; +/** + * Determine whether a path is executable on the current platform. + */ +exports.isexe = impl.isexe; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +exports.sync = impl.sync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/options.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/options.js new file mode 100644 index 0000000000000..0dfad0762cc32 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/options.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/package.json b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/package.json new file mode 100644 index 0000000000000..5bbefffbabee3 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/posix.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/posix.js new file mode 100644 index 0000000000000..3bc5e79d7007e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/posix.js @@ -0,0 +1,67 @@ +"use strict"; +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = void 0; +const fs_1 = require("fs"); +const promises_1 = require("fs/promises"); +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.isexe = isexe; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, fs_1.statSync)(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.sync = sync; +const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); +const checkMode = (stat, options) => { + const myUid = options.uid ?? process.getuid?.(); + const myGroups = options.groups ?? process.getgroups?.() ?? []; + const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; + if (myUid === undefined || myGid === undefined) { + throw new Error('cannot get uid or gid'); + } + const groups = new Set([myGid, ...myGroups]); + const mod = stat.mode; + const uid = stat.uid; + const gid = stat.gid; + const u = parseInt('100', 8); + const g = parseInt('010', 8); + const o = parseInt('001', 8); + const ug = u | g; + return !!(mod & o || + (mod & g && groups.has(gid)) || + (mod & u && uid === myUid) || + (mod & ug && myUid === 0)); +}; +//# sourceMappingURL=posix.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/win32.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/win32.js new file mode 100644 index 0000000000000..fa7a4d2f7d240 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/cjs/win32.js @@ -0,0 +1,62 @@ +"use strict"; +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = void 0; +const fs_1 = require("fs"); +const promises_1 = require("fs/promises"); +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.isexe = isexe; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, fs_1.statSync)(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.sync = sync; +const checkPathExt = (path, options) => { + const { pathExt = process.env.PATHEXT || '' } = options; + const peSplit = pathExt.split(';'); + if (peSplit.indexOf('') !== -1) { + return true; + } + for (let i = 0; i < peSplit.length; i++) { + const p = peSplit[i].toLowerCase(); + const ext = path.substring(path.length - p.length).toLowerCase(); + if (p && ext === p) { + return true; + } + } + return false; +}; +const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); +//# sourceMappingURL=win32.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/index.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/index.js new file mode 100644 index 0000000000000..1e309acd7355e --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/index.js @@ -0,0 +1,16 @@ +import * as posix from './posix.js'; +import * as win32 from './win32.js'; +export * from './options.js'; +export { win32, posix }; +const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; +const impl = platform === 'win32' ? win32 : posix; +/** + * Determine whether a path is executable on the current platform. + */ +export const isexe = impl.isexe; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +export const sync = impl.sync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/options.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/options.js new file mode 100644 index 0000000000000..e9ded40bd5b2c --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/options.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/package.json b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/package.json new file mode 100644 index 0000000000000..3dbc1ca591c05 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/posix.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/posix.js new file mode 100644 index 0000000000000..c453776c0452f --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/posix.js @@ -0,0 +1,62 @@ +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +import { statSync } from 'fs'; +import { stat } from 'fs/promises'; +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +export const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await stat(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +export const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(statSync(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); +const checkMode = (stat, options) => { + const myUid = options.uid ?? process.getuid?.(); + const myGroups = options.groups ?? process.getgroups?.() ?? []; + const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; + if (myUid === undefined || myGid === undefined) { + throw new Error('cannot get uid or gid'); + } + const groups = new Set([myGid, ...myGroups]); + const mod = stat.mode; + const uid = stat.uid; + const gid = stat.gid; + const u = parseInt('100', 8); + const g = parseInt('010', 8); + const o = parseInt('001', 8); + const ug = u | g; + return !!(mod & o || + (mod & g && groups.has(gid)) || + (mod & u && uid === myUid) || + (mod & ug && myUid === 0)); +}; +//# sourceMappingURL=posix.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/win32.js b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/win32.js new file mode 100644 index 0000000000000..a354ee2a5115c --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/dist/mjs/win32.js @@ -0,0 +1,57 @@ +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +import { statSync } from 'fs'; +import { stat } from 'fs/promises'; +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +export const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await stat(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +export const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(statSync(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +const checkPathExt = (path, options) => { + const { pathExt = process.env.PATHEXT || '' } = options; + const peSplit = pathExt.split(';'); + if (peSplit.indexOf('') !== -1) { + return true; + } + for (let i = 0; i < peSplit.length; i++) { + const p = peSplit[i].toLowerCase(); + const ext = path.substring(path.length - p.length).toLowerCase(); + if (p && ext === p) { + return true; + } + } + return false; +}; +const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); +//# sourceMappingURL=win32.js.map \ No newline at end of file diff --git a/node_modules/@npmcli/run-script/node_modules/isexe/package.json b/node_modules/@npmcli/run-script/node_modules/isexe/package.json new file mode 100644 index 0000000000000..a0e2cd04bfdbf --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/isexe/package.json @@ -0,0 +1,96 @@ +{ + "name": "isexe", + "version": "3.1.1", + "description": "Minimal module to check if a file is executable.", + "main": "./dist/cjs/index.js", + "module": "./dist/mjs/index.js", + "types": "./dist/cjs/index.js", + "files": [ + "dist" + ], + "exports": { + ".": { + "import": { + "types": "./dist/mjs/index.d.ts", + "default": "./dist/mjs/index.js" + }, + "require": { + "types": "./dist/cjs/index.d.ts", + "default": "./dist/cjs/index.js" + } + }, + "./posix": { + "import": { + "types": "./dist/mjs/posix.d.ts", + "default": "./dist/mjs/posix.js" + }, + "require": { + "types": "./dist/cjs/posix.d.ts", + "default": "./dist/cjs/posix.js" + } + }, + "./win32": { + "import": { + "types": "./dist/mjs/win32.d.ts", + "default": "./dist/mjs/win32.js" + }, + "require": { + "types": "./dist/cjs/win32.d.ts", + "default": "./dist/cjs/win32.js" + } + }, + "./package.json": "./package.json" + }, + "devDependencies": { + "@types/node": "^20.4.5", + "@types/tap": "^15.0.8", + "c8": "^8.0.1", + "mkdirp": "^0.5.1", + "prettier": "^2.8.8", + "rimraf": "^2.5.0", + "sync-content": "^1.0.2", + "tap": "^16.3.8", + "ts-node": "^10.9.1", + "typedoc": "^0.24.8", + "typescript": "^5.1.6" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "prepare": "tsc -p tsconfig/cjs.json && tsc -p tsconfig/esm.json && bash ./scripts/fixup.sh", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "c8 tap", + "snap": "c8 tap", + "format": "prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache", + "typedoc": "typedoc --tsconfig tsconfig/esm.json ./src/*.ts" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "tap": { + "coverage": false, + "node-arg": [ + "--enable-source-maps", + "--no-warnings", + "--loader", + "ts-node/esm" + ], + "ts": false + }, + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "repository": "https://github.com/isaacs/isexe", + "engines": { + "node": ">=16" + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/proc-log/LICENSE b/node_modules/@npmcli/run-script/node_modules/proc-log/LICENSE new file mode 100644 index 0000000000000..83837797202b7 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/proc-log/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) GitHub, Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/proc-log/lib/index.js b/node_modules/@npmcli/run-script/node_modules/proc-log/lib/index.js new file mode 100644 index 0000000000000..86d90861078da --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/proc-log/lib/index.js @@ -0,0 +1,153 @@ +const META = Symbol('proc-log.meta') +module.exports = { + META: META, + output: { + LEVELS: [ + 'standard', + 'error', + 'buffer', + 'flush', + ], + KEYS: { + standard: 'standard', + error: 'error', + buffer: 'buffer', + flush: 'flush', + }, + standard: function (...args) { + return process.emit('output', 'standard', ...args) + }, + error: function (...args) { + return process.emit('output', 'error', ...args) + }, + buffer: function (...args) { + return process.emit('output', 'buffer', ...args) + }, + flush: function (...args) { + return process.emit('output', 'flush', ...args) + }, + }, + log: { + LEVELS: [ + 'notice', + 'error', + 'warn', + 'info', + 'verbose', + 'http', + 'silly', + 'timing', + 'pause', + 'resume', + ], + KEYS: { + notice: 'notice', + error: 'error', + warn: 'warn', + info: 'info', + verbose: 'verbose', + http: 'http', + silly: 'silly', + timing: 'timing', + pause: 'pause', + resume: 'resume', + }, + error: function (...args) { + return process.emit('log', 'error', ...args) + }, + notice: function (...args) { + return process.emit('log', 'notice', ...args) + }, + warn: function (...args) { + return process.emit('log', 'warn', ...args) + }, + info: function (...args) { + return process.emit('log', 'info', ...args) + }, + verbose: function (...args) { + return process.emit('log', 'verbose', ...args) + }, + http: function (...args) { + return process.emit('log', 'http', ...args) + }, + silly: function (...args) { + return process.emit('log', 'silly', ...args) + }, + timing: function (...args) { + return process.emit('log', 'timing', ...args) + }, + pause: function () { + return process.emit('log', 'pause') + }, + resume: function () { + return process.emit('log', 'resume') + }, + }, + time: { + LEVELS: [ + 'start', + 'end', + ], + KEYS: { + start: 'start', + end: 'end', + }, + start: function (name, fn) { + process.emit('time', 'start', name) + function end () { + return process.emit('time', 'end', name) + } + if (typeof fn === 'function') { + const res = fn() + if (res && res.finally) { + return res.finally(end) + } + end() + return res + } + return end + }, + end: function (name) { + return process.emit('time', 'end', name) + }, + }, + input: { + LEVELS: [ + 'start', + 'end', + 'read', + ], + KEYS: { + start: 'start', + end: 'end', + read: 'read', + }, + start: function (fn) { + process.emit('input', 'start') + function end () { + return process.emit('input', 'end') + } + if (typeof fn === 'function') { + const res = fn() + if (res && res.finally) { + return res.finally(end) + } + end() + return res + } + return end + }, + end: function () { + return process.emit('input', 'end') + }, + read: function (...args) { + let resolve, reject + const promise = new Promise((_resolve, _reject) => { + resolve = _resolve + reject = _reject + }) + process.emit('input', 'read', resolve, reject, ...args) + return promise + }, + }, +} diff --git a/node_modules/@npmcli/run-script/node_modules/proc-log/package.json b/node_modules/@npmcli/run-script/node_modules/proc-log/package.json new file mode 100644 index 0000000000000..957209d3954e5 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/proc-log/package.json @@ -0,0 +1,46 @@ +{ + "name": "proc-log", + "version": "5.0.0", + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "description": "just emit 'log' events on the process object", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/proc-log.git" + }, + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "posttest": "npm run lint", + "postsnap": "eslint index.js test/*.js --fix", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/which/LICENSE b/node_modules/@npmcli/run-script/node_modules/which/LICENSE new file mode 100644 index 0000000000000..19129e315fe59 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/which/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/@npmcli/run-script/node_modules/which/bin/which.js b/node_modules/@npmcli/run-script/node_modules/which/bin/which.js new file mode 100755 index 0000000000000..6df16f21acf93 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/which/bin/which.js @@ -0,0 +1,52 @@ +#!/usr/bin/env node + +const which = require('../lib') +const argv = process.argv.slice(2) + +const usage = (err) => { + if (err) { + console.error(`which: ${err}`) + } + console.error('usage: which [-as] program ...') + process.exit(1) +} + +if (!argv.length) { + return usage() +} + +let dashdash = false +const [commands, flags] = argv.reduce((acc, arg) => { + if (dashdash || arg === '--') { + dashdash = true + return acc + } + + if (!/^-/.test(arg)) { + acc[0].push(arg) + return acc + } + + for (const flag of arg.slice(1).split('')) { + if (flag === 's') { + acc[1].silent = true + } else if (flag === 'a') { + acc[1].all = true + } else { + usage(`illegal option -- ${flag}`) + } + } + + return acc +}, [[], {}]) + +for (const command of commands) { + try { + const res = which.sync(command, { all: flags.all }) + if (!flags.silent) { + console.log([].concat(res).join('\n')) + } + } catch (err) { + process.exitCode = 1 + } +} diff --git a/node_modules/@npmcli/run-script/node_modules/which/lib/index.js b/node_modules/@npmcli/run-script/node_modules/which/lib/index.js new file mode 100644 index 0000000000000..2fd358baf888f --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/which/lib/index.js @@ -0,0 +1,111 @@ +const { isexe, sync: isexeSync } = require('isexe') +const { join, delimiter, sep, posix } = require('path') + +const isWindows = process.platform === 'win32' + +// used to check for slashed in commands passed in. always checks for the posix +// seperator on all platforms, and checks for the current separator when not on +// a posix platform. don't use the isWindows check for this since that is mocked +// in tests but we still need the code to actually work when called. that is also +// why it is ignored from coverage. +/* istanbul ignore next */ +const rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? '' : sep}]`.replace(/(\\)/g, '\\$1')) +const rRel = new RegExp(`^\\.${rSlash.source}`) + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, { + path: optPath = process.env.PATH, + pathExt: optPathExt = process.env.PATHEXT, + delimiter: optDelimiter = delimiter, +}) => { + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + const pathEnv = cmd.match(rSlash) ? [''] : [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(optPath || /* istanbul ignore next: very unusual */ '').split(optDelimiter), + ] + + if (isWindows) { + const pathExtExe = optPathExt || + ['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter) + const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]) + if (cmd.includes('.') && pathExt[0] !== '') { + pathExt.unshift('') + } + return { pathEnv, pathExt, pathExtExe } + } + + return { pathEnv, pathExt: [''] } +} + +const getPathPart = (raw, cmd) => { + const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw + const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : '' + return prefix + join(pathPart, cmd) +} + +const which = async (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const envPart of pathEnv) { + const p = getPathPart(envPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + if (opt.all && found.length) { + return found + } + + if (opt.nothrow) { + return null + } + + throw getNotFoundError(cmd) +} + +const whichSync = (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const pathEnvPart of pathEnv) { + const p = getPathPart(pathEnvPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + if (opt.all && found.length) { + return found + } + + if (opt.nothrow) { + return null + } + + throw getNotFoundError(cmd) +} + +module.exports = which +which.sync = whichSync diff --git a/node_modules/@npmcli/run-script/node_modules/which/package.json b/node_modules/@npmcli/run-script/node_modules/which/package.json new file mode 100644 index 0000000000000..94184233c61c4 --- /dev/null +++ b/node_modules/@npmcli/run-script/node_modules/which/package.json @@ -0,0 +1,52 @@ +{ + "author": "GitHub Inc.", + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "5.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-which.git" + }, + "main": "lib/index.js", + "bin": { + "node-which": "./bin/which.js" + }, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "files": [ + "bin/", + "lib/" + ], + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": "true" + } +} diff --git a/node_modules/@npmcli/run-script/package.json b/node_modules/@npmcli/run-script/package.json index 8a83e726fbeb2..e5fd2fef62e5c 100644 --- a/node_modules/@npmcli/run-script/package.json +++ b/node_modules/@npmcli/run-script/package.json @@ -1,32 +1,32 @@ { "name": "@npmcli/run-script", - "version": "8.1.0", + "version": "9.0.1", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "GitHub Inc.", "license": "ISC", "scripts": { "test": "tap", - "eslint": "eslint", - "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", - "lintfix": "npm run lint -- --fix", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", "postlint": "template-oss-check", "snap": "tap", "posttest": "npm run lint", "template-oss-apply": "template-oss-apply --force" }, "devDependencies": { - "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.4", + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", "spawk": "^1.8.1", "tap": "^16.0.1" }, "dependencies": { - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^5.0.0", - "@npmcli/promise-spawn": "^7.0.0", + "@npmcli/node-gyp": "^4.0.0", + "@npmcli/package-json": "^6.0.0", + "@npmcli/promise-spawn": "^8.0.0", "node-gyp": "^10.0.0", - "proc-log": "^4.0.0", - "which": "^4.0.0" + "proc-log": "^5.0.0", + "which": "^5.0.0" }, "files": [ "bin/", @@ -35,14 +35,14 @@ "main": "lib/run-script.js", "repository": { "type": "git", - "url": "https://github.com/npm/run-script.git" + "url": "git+https://github.com/npm/run-script.git" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.4", + "version": "4.23.3", "publish": "true" }, "tap": { diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/LICENSE b/node_modules/pacote/node_modules/@npmcli/run-script/LICENSE new file mode 100644 index 0000000000000..19cec97b18468 --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) npm, Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/is-server-package.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/is-server-package.js new file mode 100644 index 0000000000000..c36c40d4898d5 --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/is-server-package.js @@ -0,0 +1,11 @@ +const { stat } = require('node:fs/promises') +const { resolve } = require('node:path') + +module.exports = async path => { + try { + const st = await stat(resolve(path, 'server.js')) + return st.isFile() + } catch (er) { + return false + } +} diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/make-spawn-args.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/make-spawn-args.js new file mode 100644 index 0000000000000..8a32d7198cb2e --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/make-spawn-args.js @@ -0,0 +1,40 @@ +/* eslint camelcase: "off" */ +const setPATH = require('./set-path.js') +const { resolve } = require('path') +const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js') + +const makeSpawnArgs = options => { + const { + event, + path, + scriptShell = true, + binPaths, + env, + stdio, + cmd, + args, + stdioString, + } = options + + const spawnEnv = setPATH(path, binPaths, { + // we need to at least save the PATH environment var + ...process.env, + ...env, + npm_package_json: resolve(path, 'package.json'), + npm_lifecycle_event: event, + npm_lifecycle_script: cmd, + npm_config_node_gyp, + }) + + const spawnOpts = { + env: spawnEnv, + stdioString, + stdio, + cwd: path, + shell: scriptShell, + } + + return [cmd, args, spawnOpts] +} + +module.exports = makeSpawnArgs diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp b/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp new file mode 100755 index 0000000000000..5bec64d961a3a --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +node "$npm_config_node_gyp" "$@" diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd b/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd new file mode 100755 index 0000000000000..4c6987ac9868b --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd @@ -0,0 +1 @@ +@node "%npm_config_node_gyp%" %* diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/package-envs.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/package-envs.js new file mode 100644 index 0000000000000..612f850fb076c --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/package-envs.js @@ -0,0 +1,29 @@ +const packageEnvs = (vals, prefix, env = {}) => { + for (const [key, val] of Object.entries(vals)) { + if (val === undefined) { + continue + } else if (val === null || val === false) { + env[`${prefix}${key}`] = '' + } else if (Array.isArray(val)) { + val.forEach((item, index) => { + packageEnvs({ [`${key}_${index}`]: item }, `${prefix}`, env) + }) + } else if (typeof val === 'object') { + packageEnvs(val, `${prefix}${key}_`, env) + } else { + env[`${prefix}${key}`] = String(val) + } + } + return env +} + +// https://github.com/npm/rfcs/pull/183 defines which fields we put into the environment +module.exports = pkg => { + return packageEnvs({ + name: pkg.name, + version: pkg.version, + config: pkg.config, + engines: pkg.engines, + bin: pkg.bin, + }, 'npm_package_') +} diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script-pkg.js new file mode 100644 index 0000000000000..9900c96315f85 --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -0,0 +1,112 @@ +const makeSpawnArgs = require('./make-spawn-args.js') +const promiseSpawn = require('@npmcli/promise-spawn') +const packageEnvs = require('./package-envs.js') +const { isNodeGypPackage, defaultGypInstallScript } = require('@npmcli/node-gyp') +const signalManager = require('./signal-manager.js') +const isServerPackage = require('./is-server-package.js') + +const runScriptPkg = async options => { + const { + event, + path, + scriptShell, + binPaths = false, + env = {}, + stdio = 'pipe', + pkg, + args = [], + stdioString, + // how long to wait for a process.kill signal + // only exposed here so that we can make the test go a bit faster. + signalTimeout = 500, + } = options + + const { scripts = {}, gypfile } = pkg + let cmd = null + if (options.cmd) { + cmd = options.cmd + } else if (pkg.scripts && pkg.scripts[event]) { + cmd = pkg.scripts[event] + } else if ( + // If there is no preinstall or install script, default to rebuilding node-gyp packages. + event === 'install' && + !scripts.install && + !scripts.preinstall && + gypfile !== false && + await isNodeGypPackage(path) + ) { + cmd = defaultGypInstallScript + } else if (event === 'start' && await isServerPackage(path)) { + cmd = 'node server.js' + } + + if (!cmd) { + return { code: 0, signal: null } + } + + let inputEnd = () => {} + if (stdio === 'inherit') { + let banner + if (pkg._id) { + banner = `\n> ${pkg._id} ${event}\n` + } else { + banner = `\n> ${event}\n` + } + banner += `> ${cmd.trim().replace(/\n/g, '\n> ')}` + if (args.length) { + banner += ` ${args.join(' ')}` + } + banner += '\n' + const { output, input } = require('proc-log') + output.standard(banner) + inputEnd = input.start() + } + + const [spawnShell, spawnArgs, spawnOpts] = makeSpawnArgs({ + event, + path, + scriptShell, + binPaths, + env: { ...env, ...packageEnvs(pkg) }, + stdio, + cmd, + args, + stdioString, + }) + + const p = promiseSpawn(spawnShell, spawnArgs, spawnOpts, { + event, + script: cmd, + pkgid: pkg._id, + path, + }) + + if (stdio === 'inherit') { + signalManager.add(p.process) + } + + if (p.stdin) { + p.stdin.end() + } + + return p.catch(er => { + const { signal } = er + // coverage disabled because win32 never emits signals + /* istanbul ignore next */ + if (stdio === 'inherit' && signal) { + // by the time we reach here, the child has already exited. we send the + // signal back to ourselves again so that npm will exit with the same + // status as the child + process.kill(process.pid, signal) + + // just in case we don't die, reject after 500ms + // this also keeps the node process open long enough to actually + // get the signal, rather than terminating gracefully. + return new Promise((res, rej) => setTimeout(() => rej(er), signalTimeout)) + } else { + throw er + } + }).finally(inputEnd) +} + +module.exports = runScriptPkg diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script.js new file mode 100644 index 0000000000000..b00304c8d6e7f --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script.js @@ -0,0 +1,15 @@ +const PackageJson = require('@npmcli/package-json') +const runScriptPkg = require('./run-script-pkg.js') +const validateOptions = require('./validate-options.js') +const isServerPackage = require('./is-server-package.js') + +const runScript = async options => { + validateOptions(options) + if (options.pkg) { + return runScriptPkg(options) + } + const { content: pkg } = await PackageJson.normalize(options.path) + return runScriptPkg({ ...options, pkg }) +} + +module.exports = Object.assign(runScript, { isServerPackage }) diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/set-path.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/set-path.js new file mode 100644 index 0000000000000..c59c270d9969a --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/set-path.js @@ -0,0 +1,45 @@ +const { resolve, dirname, delimiter } = require('path') +// the path here is relative, even though it does not need to be +// in order to make the posix tests pass in windows +const nodeGypPath = resolve(__dirname, '../lib/node-gyp-bin') + +// Windows typically calls its PATH environ 'Path', but this is not +// guaranteed, nor is it guaranteed to be the only one. Merge them +// all together in the order they appear in the object. +const setPATH = (projectPath, binPaths, env) => { + const PATH = Object.keys(env).filter(p => /^path$/i.test(p) && env[p]) + .map(p => env[p].split(delimiter)) + .reduce((set, p) => set.concat(p.filter(concatted => !set.includes(concatted))), []) + .join(delimiter) + + const pathArr = [] + if (binPaths) { + pathArr.push(...binPaths) + } + // unshift the ./node_modules/.bin from every folder + // walk up until dirname() does nothing, at the root + // XXX we should specify a cwd that we don't go above + let p = projectPath + let pp + do { + pathArr.push(resolve(p, 'node_modules', '.bin')) + pp = p + p = dirname(p) + } while (p !== pp) + pathArr.push(nodeGypPath, PATH) + + const pathVal = pathArr.join(delimiter) + + // XXX include the node-gyp-bin path somehow? Probably better for + // npm or arborist or whoever to just provide that by putting it in + // the PATH environ, since that's preserved anyway. + for (const key of Object.keys(env)) { + if (/^path$/i.test(key)) { + env[key] = pathVal + } + } + + return env +} + +module.exports = setPATH diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/signal-manager.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/signal-manager.js new file mode 100644 index 0000000000000..a099a4af2b9be --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/signal-manager.js @@ -0,0 +1,50 @@ +const runningProcs = new Set() +let handlersInstalled = false + +const forwardedSignals = [ + 'SIGINT', + 'SIGTERM', +] + +// no-op, this is so receiving the signal doesn't cause us to exit immediately +// instead, we exit after all children have exited when we re-send the signal +// to ourselves. see the catch handler at the bottom of run-script-pkg.js +const handleSignal = signal => { + for (const proc of runningProcs) { + proc.kill(signal) + } +} + +const setupListeners = () => { + for (const signal of forwardedSignals) { + process.on(signal, handleSignal) + } + handlersInstalled = true +} + +const cleanupListeners = () => { + if (runningProcs.size === 0) { + for (const signal of forwardedSignals) { + process.removeListener(signal, handleSignal) + } + handlersInstalled = false + } +} + +const add = proc => { + runningProcs.add(proc) + if (!handlersInstalled) { + setupListeners() + } + + proc.once('exit', () => { + runningProcs.delete(proc) + cleanupListeners() + }) +} + +module.exports = { + add, + handleSignal, + forwardedSignals, +} diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/validate-options.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/validate-options.js new file mode 100644 index 0000000000000..8d855916ecd15 --- /dev/null +++ b/node_modules/pacote/node_modules/@npmcli/run-script/lib/validate-options.js @@ -0,0 +1,39 @@ +const validateOptions = options => { + if (typeof options !== 'object' || !options) { + throw new TypeError('invalid options object provided to runScript') + } + + const { + event, + path, + scriptShell, + env = {}, + stdio = 'pipe', + args = [], + cmd, + } = options + + if (!event || typeof event !== 'string') { + throw new TypeError('valid event not provided to runScript') + } + if (!path || typeof path !== 'string') { + throw new TypeError('valid path not provided to runScript') + } + if (scriptShell !== undefined && typeof scriptShell !== 'string') { + throw new TypeError('invalid scriptShell option provided to runScript') + } + if (typeof env !== 'object' || !env) { + throw new TypeError('invalid env option provided to runScript') + } + if (typeof stdio !== 'string' && !Array.isArray(stdio)) { + throw new TypeError('invalid stdio option provided to runScript') + } + if (!Array.isArray(args) || args.some(a => typeof a !== 'string')) { + throw new TypeError('invalid args option provided to runScript') + } + if (cmd !== undefined && typeof cmd !== 'string') { + throw new TypeError('invalid cmd option provided to runScript') + } +} + +module.exports = validateOptions diff --git a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/package.json b/node_modules/pacote/node_modules/@npmcli/run-script/package.json similarity index 61% rename from node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/package.json rename to node_modules/pacote/node_modules/@npmcli/run-script/package.json index 1b633f84596d2..8a83e726fbeb2 100644 --- a/node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn/package.json +++ b/node_modules/pacote/node_modules/@npmcli/run-script/package.json @@ -1,50 +1,54 @@ { - "name": "@npmcli/promise-spawn", - "version": "7.0.2", - "files": [ - "bin/", - "lib/" - ], - "main": "./lib/index.js", - "description": "spawn processes the way the npm cli likes to do", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/promise-spawn.git" - }, + "name": "@npmcli/run-script", + "version": "8.1.0", + "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "GitHub Inc.", "license": "ISC", "scripts": { "test": "tap", - "snap": "tap", + "eslint": "eslint", "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", "lintfix": "npm run lint -- --fix", - "posttest": "npm run lint", - "postsnap": "npm run lintfix --", "postlint": "template-oss-check", + "snap": "tap", + "posttest": "npm run lint", "template-oss-apply": "template-oss-apply --force" }, - "tap": { - "check-coverage": true, - "nyc-arg": [ - "--exclude", - "tap-snapshots/**" - ] - }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.22.0", - "spawk": "^1.7.1", + "@npmcli/template-oss": "4.21.4", + "spawk": "^1.8.1", "tap": "^16.0.1" }, + "dependencies": { + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/package-json": "^5.0.0", + "@npmcli/promise-spawn": "^7.0.0", + "node-gyp": "^10.0.0", + "proc-log": "^4.0.0", + "which": "^4.0.0" + }, + "files": [ + "bin/", + "lib/" + ], + "main": "lib/run-script.js", + "repository": { + "type": "git", + "url": "https://github.com/npm/run-script.git" + }, "engines": { "node": "^16.14.0 || >=18.0.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.22.0", - "publish": true + "version": "4.21.4", + "publish": "true" }, - "dependencies": { - "which": "^4.0.0" + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] } } diff --git a/package-lock.json b/package-lock.json index 69c1489cd510d..a817b4ba67a8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -94,7 +94,7 @@ "@npmcli/package-json": "^6.0.1", "@npmcli/promise-spawn": "^8.0.1", "@npmcli/redact": "^3.0.0", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "@sigstore/tuf": "^2.3.4", "abbrev": "^2.0.0", "archy": "~1.0.0", @@ -1942,53 +1942,67 @@ } }, "node_modules/@npmcli/run-script": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-8.1.0.tgz", - "integrity": "sha512-y7efHHwghQfk28G2z3tlZ67pLG0XdfYbcVG26r7YIXALRsrVQcTq4/tdenSmdOrEsNahIYA/eh8aEVROWGFUDg==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-9.0.1.tgz", + "integrity": "sha512-q9C0uHrb6B6cm3qXVM32UmpqTKuFGbtP23O2K5sLvPMz2hilKd0ptqGXSpuunOuOmPQb/aT5F/kCXFc1P2gO/A==", "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^5.0.0", - "@npmcli/promise-spawn": "^7.0.0", + "@npmcli/node-gyp": "^4.0.0", + "@npmcli/package-json": "^6.0.0", + "@npmcli/promise-spawn": "^8.0.0", "node-gyp": "^10.0.0", - "proc-log": "^4.0.0", - "which": "^4.0.0" + "proc-log": "^5.0.0", + "which": "^5.0.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/@npmcli/run-script/node_modules/@npmcli/package-json": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-5.2.1.tgz", - "integrity": "sha512-f7zYC6kQautXHvNbLEWgD/uGu1+xCn9izgqBfgItWSx22U0ZDekxN08A1vM8cTxj/cRVe0Q94Ode+tdoYmIOOQ==", + "node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-4.0.0.tgz", + "integrity": "sha512-+t5DZ6mO/QFh78PByMq1fGSAub/agLJZDRfJRMeOSNCt8s9YVlTjmGpIPwPhvXTGUIJk+WszlT0rQa1W33yzNA==", "inBundle": true, "license": "ISC", - "dependencies": { - "@npmcli/git": "^5.0.0", - "glob": "^10.2.2", - "hosted-git-info": "^7.0.0", - "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^6.0.0", - "proc-log": "^4.0.0", - "semver": "^7.5.3" - }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-7.0.2.tgz", - "integrity": "sha512-xhfYPXoV5Dy4UkY0D+v2KkwvnDfiA/8Mt3sWCGI/hM03NsYIH8ZaG6QzS9x7pje5vHZBZJ2v6VRFVTWACnqcmQ==", + "node_modules/@npmcli/run-script/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=16" + } + }, + "node_modules/@npmcli/run-script/node_modules/proc-log": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz", + "integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", "inBundle": true, "license": "ISC", "dependencies": { - "which": "^4.0.0" + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/@npmcli/smoke-tests": { @@ -10526,6 +10540,24 @@ "node": "^16.14.0 || >=18.0.0" } }, + "node_modules/pacote/node_modules/@npmcli/run-script": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-8.1.0.tgz", + "integrity": "sha512-y7efHHwghQfk28G2z3tlZ67pLG0XdfYbcVG26r7YIXALRsrVQcTq4/tdenSmdOrEsNahIYA/eh8aEVROWGFUDg==", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/package-json": "^5.0.0", + "@npmcli/promise-spawn": "^7.0.0", + "node-gyp": "^10.0.0", + "proc-log": "^4.0.0", + "which": "^4.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -16125,7 +16157,7 @@ "@npmcli/package-json": "^6.0.1", "@npmcli/query": "^3.1.0", "@npmcli/redact": "^3.0.0", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "bin-links": "^4.0.4", "cacache": "^18.0.3", "common-ancestor-path": "^1.0.1", @@ -16237,7 +16269,7 @@ "license": "ISC", "dependencies": { "@npmcli/arborist": "^7.5.4", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "ci-info": "^4.0.0", "npm-package-arg": "^11.0.2", "pacote": "^18.0.6", @@ -16316,7 +16348,7 @@ "license": "ISC", "dependencies": { "@npmcli/arborist": "^7.5.4", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "npm-package-arg": "^11.0.2", "pacote": "^18.0.6" }, @@ -16394,7 +16426,7 @@ "license": "ISC", "dependencies": { "@npmcli/git": "^5.0.7", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "json-parse-even-better-errors": "^3.0.2", "proc-log": "^4.2.0", "semver": "^7.3.7" diff --git a/package.json b/package.json index 7d85fb85f1918..aa5fc54294cd0 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@npmcli/package-json": "^6.0.1", "@npmcli/promise-spawn": "^8.0.1", "@npmcli/redact": "^3.0.0", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "@sigstore/tuf": "^2.3.4", "abbrev": "^2.0.0", "archy": "~1.0.0", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 43d39699d4d45..e16b3e34ac18b 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -13,7 +13,7 @@ "@npmcli/package-json": "^6.0.1", "@npmcli/query": "^3.1.0", "@npmcli/redact": "^3.0.0", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "bin-links": "^4.0.4", "cacache": "^18.0.3", "common-ancestor-path": "^1.0.1", diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json index e6136878cc6a5..69ca864fb2372 100644 --- a/workspaces/libnpmexec/package.json +++ b/workspaces/libnpmexec/package.json @@ -61,7 +61,7 @@ }, "dependencies": { "@npmcli/arborist": "^7.5.4", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "ci-info": "^4.0.0", "npm-package-arg": "^11.0.2", "pacote": "^18.0.6", diff --git a/workspaces/libnpmpack/package.json b/workspaces/libnpmpack/package.json index 6307fb14f5462..bfc90ce2b199a 100644 --- a/workspaces/libnpmpack/package.json +++ b/workspaces/libnpmpack/package.json @@ -38,7 +38,7 @@ "homepage": "https://npmjs.com/package/libnpmpack", "dependencies": { "@npmcli/arborist": "^7.5.4", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "npm-package-arg": "^11.0.2", "pacote": "^18.0.6" }, diff --git a/workspaces/libnpmversion/package.json b/workspaces/libnpmversion/package.json index ece8df5f178ea..c697e9f98c90b 100644 --- a/workspaces/libnpmversion/package.json +++ b/workspaces/libnpmversion/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@npmcli/git": "^5.0.7", - "@npmcli/run-script": "^8.1.0", + "@npmcli/run-script": "^9.0.1", "json-parse-even-better-errors": "^3.0.2", "proc-log": "^4.2.0", "semver": "^7.3.7"