diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 317d50a50c8ab..72f2032457f52 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -51,7 +51,6 @@ /@npmcli/package-json/node_modules/@npmcli/* !/@npmcli/package-json/node_modules/@npmcli/git !/@npmcli/package-json/node_modules/isexe -!/@npmcli/package-json/node_modules/npm-install-checks !/@npmcli/package-json/node_modules/npm-normalize-package-bin !/@npmcli/package-json/node_modules/npm-package-arg !/@npmcli/package-json/node_modules/npm-pick-manifest @@ -241,6 +240,9 @@ !/npm-package-arg/node_modules/hosted-git-info !/npm-packlist !/npm-pick-manifest +!/npm-pick-manifest/node_modules/ +/npm-pick-manifest/node_modules/* +!/npm-pick-manifest/node_modules/npm-install-checks !/npm-profile !/npm-registry-fetch !/npm-registry-fetch/node_modules/ diff --git a/node_modules/@npmcli/package-json/node_modules/npm-install-checks/lib/current-env.js b/node_modules/npm-install-checks/lib/current-env.js similarity index 100% rename from node_modules/@npmcli/package-json/node_modules/npm-install-checks/lib/current-env.js rename to node_modules/npm-install-checks/lib/current-env.js diff --git a/node_modules/@npmcli/package-json/node_modules/npm-install-checks/lib/dev-engines.js b/node_modules/npm-install-checks/lib/dev-engines.js similarity index 100% rename from node_modules/@npmcli/package-json/node_modules/npm-install-checks/lib/dev-engines.js rename to node_modules/npm-install-checks/lib/dev-engines.js diff --git a/node_modules/npm-install-checks/lib/index.js b/node_modules/npm-install-checks/lib/index.js index 545472b61dc60..7170292087308 100644 --- a/node_modules/npm-install-checks/lib/index.js +++ b/node_modules/npm-install-checks/lib/index.js @@ -1,4 +1,6 @@ const semver = require('semver') +const currentEnv = require('./current-env') +const { checkDevEngines } = require('./dev-engines') const checkEngine = (target, npmVer, nodeVer, force = false) => { const nodev = force ? null : nodeVer @@ -20,44 +22,29 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => { } } -const isMusl = (file) => file.includes('libc.musl-') || file.includes('ld-musl-') - const checkPlatform = (target, force = false, environment = {}) => { if (force) { return } - const platform = environment.os || process.platform - const arch = environment.cpu || process.arch - const osOk = target.os ? checkList(platform, target.os) : true - const cpuOk = target.cpu ? checkList(arch, target.cpu) : true + const os = environment.os || currentEnv.os() + const cpu = environment.cpu || currentEnv.cpu() + const libc = environment.libc || currentEnv.libc(os) - let libcOk = true - let libcFamily = null - if (target.libc) { - // libc checks only work in linux, any value is a failure if we aren't - if (environment.libc) { - libcOk = checkList(environment.libc, target.libc) - } else if (platform !== 'linux') { - libcOk = false - } else { - const report = process.report.getReport() - if (report.header?.glibcVersionRuntime) { - libcFamily = 'glibc' - } else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) { - libcFamily = 'musl' - } - libcOk = libcFamily ? checkList(libcFamily, target.libc) : false - } + const osOk = target.os ? checkList(os, target.os) : true + const cpuOk = target.cpu ? checkList(cpu, target.cpu) : true + let libcOk = target.libc ? checkList(libc, target.libc) : true + if (target.libc && !libc) { + libcOk = false } if (!osOk || !cpuOk || !libcOk) { throw Object.assign(new Error('Unsupported platform'), { pkgid: target._id, current: { - os: platform, - cpu: arch, - libc: libcFamily, + os, + cpu, + libc, }, required: { os: target.os, @@ -98,4 +85,6 @@ const checkList = (value, list) => { module.exports = { checkEngine, checkPlatform, + checkDevEngines, + currentEnv, } diff --git a/node_modules/npm-install-checks/package.json b/node_modules/npm-install-checks/package.json index 11a3b87750e25..e9e69575a6dc6 100644 --- a/node_modules/npm-install-checks/package.json +++ b/node_modules/npm-install-checks/package.json @@ -1,28 +1,29 @@ { "name": "npm-install-checks", - "version": "6.3.0", + "version": "7.1.0", "description": "Check the engines and platform fields in package.json", "main": "lib/index.js", "dependencies": { "semver": "^7.1.1" }, "devDependencies": { - "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.19.0", + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", "tap": "^16.0.1" }, "scripts": { "test": "tap", - "lint": "eslint \"**/*.js\"", + "lint": "npm run eslint", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", - "lintfix": "npm run lint -- --fix", + "lintfix": "npm run eslint -- --fix", "snap": "tap", - "posttest": "npm run lint" + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" }, "repository": { "type": "git", - "url": "https://github.com/npm/npm-install-checks.git" + "url": "git+https://github.com/npm/npm-install-checks.git" }, "keywords": [ "npm,", @@ -34,12 +35,12 @@ "lib/" ], "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" }, "author": "GitHub Inc.", "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.19.0", + "version": "4.23.3", "publish": "true" }, "tap": { diff --git a/node_modules/@npmcli/package-json/node_modules/npm-install-checks/LICENSE b/node_modules/npm-pick-manifest/node_modules/npm-install-checks/LICENSE similarity index 100% rename from node_modules/@npmcli/package-json/node_modules/npm-install-checks/LICENSE rename to node_modules/npm-pick-manifest/node_modules/npm-install-checks/LICENSE diff --git a/node_modules/@npmcli/package-json/node_modules/npm-install-checks/lib/index.js b/node_modules/npm-pick-manifest/node_modules/npm-install-checks/lib/index.js similarity index 62% rename from node_modules/@npmcli/package-json/node_modules/npm-install-checks/lib/index.js rename to node_modules/npm-pick-manifest/node_modules/npm-install-checks/lib/index.js index 7170292087308..545472b61dc60 100644 --- a/node_modules/@npmcli/package-json/node_modules/npm-install-checks/lib/index.js +++ b/node_modules/npm-pick-manifest/node_modules/npm-install-checks/lib/index.js @@ -1,6 +1,4 @@ const semver = require('semver') -const currentEnv = require('./current-env') -const { checkDevEngines } = require('./dev-engines') const checkEngine = (target, npmVer, nodeVer, force = false) => { const nodev = force ? null : nodeVer @@ -22,29 +20,44 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => { } } +const isMusl = (file) => file.includes('libc.musl-') || file.includes('ld-musl-') + const checkPlatform = (target, force = false, environment = {}) => { if (force) { return } - const os = environment.os || currentEnv.os() - const cpu = environment.cpu || currentEnv.cpu() - const libc = environment.libc || currentEnv.libc(os) + const platform = environment.os || process.platform + const arch = environment.cpu || process.arch + const osOk = target.os ? checkList(platform, target.os) : true + const cpuOk = target.cpu ? checkList(arch, target.cpu) : true - const osOk = target.os ? checkList(os, target.os) : true - const cpuOk = target.cpu ? checkList(cpu, target.cpu) : true - let libcOk = target.libc ? checkList(libc, target.libc) : true - if (target.libc && !libc) { - libcOk = false + let libcOk = true + let libcFamily = null + if (target.libc) { + // libc checks only work in linux, any value is a failure if we aren't + if (environment.libc) { + libcOk = checkList(environment.libc, target.libc) + } else if (platform !== 'linux') { + libcOk = false + } else { + const report = process.report.getReport() + if (report.header?.glibcVersionRuntime) { + libcFamily = 'glibc' + } else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) { + libcFamily = 'musl' + } + libcOk = libcFamily ? checkList(libcFamily, target.libc) : false + } } if (!osOk || !cpuOk || !libcOk) { throw Object.assign(new Error('Unsupported platform'), { pkgid: target._id, current: { - os, - cpu, - libc, + os: platform, + cpu: arch, + libc: libcFamily, }, required: { os: target.os, @@ -85,6 +98,4 @@ const checkList = (value, list) => { module.exports = { checkEngine, checkPlatform, - checkDevEngines, - currentEnv, } diff --git a/node_modules/@npmcli/package-json/node_modules/npm-install-checks/package.json b/node_modules/npm-pick-manifest/node_modules/npm-install-checks/package.json similarity index 68% rename from node_modules/@npmcli/package-json/node_modules/npm-install-checks/package.json rename to node_modules/npm-pick-manifest/node_modules/npm-install-checks/package.json index e9e69575a6dc6..11a3b87750e25 100644 --- a/node_modules/@npmcli/package-json/node_modules/npm-install-checks/package.json +++ b/node_modules/npm-pick-manifest/node_modules/npm-install-checks/package.json @@ -1,29 +1,28 @@ { "name": "npm-install-checks", - "version": "7.1.0", + "version": "6.3.0", "description": "Check the engines and platform fields in package.json", "main": "lib/index.js", "dependencies": { "semver": "^7.1.1" }, "devDependencies": { - "@npmcli/eslint-config": "^5.0.0", - "@npmcli/template-oss": "4.23.3", + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.19.0", "tap": "^16.0.1" }, "scripts": { "test": "tap", - "lint": "npm run eslint", + "lint": "eslint \"**/*.js\"", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", - "lintfix": "npm run eslint -- --fix", + "lintfix": "npm run lint -- --fix", "snap": "tap", - "posttest": "npm run lint", - "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + "posttest": "npm run lint" }, "repository": { "type": "git", - "url": "git+https://github.com/npm/npm-install-checks.git" + "url": "https://github.com/npm/npm-install-checks.git" }, "keywords": [ "npm,", @@ -35,12 +34,12 @@ "lib/" ], "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" }, "author": "GitHub Inc.", "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.23.3", + "version": "4.19.0", "publish": "true" }, "tap": { diff --git a/package-lock.json b/package-lock.json index d477ea7b321bf..64422e8abe332 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,7 +131,7 @@ "nopt": "^8.0.0", "normalize-package-data": "^7.0.0", "npm-audit-report": "^6.0.0", - "npm-install-checks": "^6.3.0", + "npm-install-checks": "^7.1.0", "npm-package-arg": "^11.0.3", "npm-pick-manifest": "^9.1.0", "npm-profile": "^10.0.0", @@ -1832,19 +1832,6 @@ "node": ">=16" } }, - "node_modules/@npmcli/package-json/node_modules/npm-install-checks": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-7.1.0.tgz", - "integrity": "sha512-bkTildVlofeMX7wiOaWk3PlW7YcBXAuEc7TWpOxwUgalG5ZvgT/ms+6OX9zt7iGLv4+VhKbRZhpOfgQJzk1YAw==", - "inBundle": true, - "license": "BSD-2-Clause", - "dependencies": { - "semver": "^7.1.1" - }, - "engines": { - "node": "^18.17.0 || >=20.5.0" - } - }, "node_modules/@npmcli/package-json/node_modules/npm-normalize-package-bin": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz", @@ -10271,16 +10258,16 @@ } }, "node_modules/npm-install-checks": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz", - "integrity": "sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-7.1.0.tgz", + "integrity": "sha512-bkTildVlofeMX7wiOaWk3PlW7YcBXAuEc7TWpOxwUgalG5ZvgT/ms+6OX9zt7iGLv4+VhKbRZhpOfgQJzk1YAw==", "inBundle": true, "license": "BSD-2-Clause", "dependencies": { "semver": "^7.1.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/npm-normalize-package-bin": { @@ -10351,6 +10338,19 @@ "node": "^16.14.0 || >=18.0.0" } }, + "node_modules/npm-pick-manifest/node_modules/npm-install-checks": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz", + "integrity": "sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm-profile": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-10.0.0.tgz", @@ -17041,7 +17041,7 @@ "lru-cache": "^10.2.2", "minimatch": "^9.0.4", "nopt": "^8.0.0", - "npm-install-checks": "^6.2.0", + "npm-install-checks": "^7.1.0", "npm-package-arg": "^11.0.2", "npm-pick-manifest": "^9.0.1", "npm-registry-fetch": "^17.0.1", diff --git a/package.json b/package.json index fbf6570368289..a9fb0a178572d 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "nopt": "^8.0.0", "normalize-package-data": "^7.0.0", "npm-audit-report": "^6.0.0", - "npm-install-checks": "^6.3.0", + "npm-install-checks": "^7.1.0", "npm-package-arg": "^11.0.3", "npm-pick-manifest": "^9.1.0", "npm-profile": "^10.0.0", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 9209e2c2a2916..b285ef8b1533b 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -23,7 +23,7 @@ "lru-cache": "^10.2.2", "minimatch": "^9.0.4", "nopt": "^8.0.0", - "npm-install-checks": "^6.2.0", + "npm-install-checks": "^7.1.0", "npm-package-arg": "^11.0.2", "npm-pick-manifest": "^9.0.1", "npm-registry-fetch": "^17.0.1",