Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
27
my-app/node_modules/npm-install-checks/LICENSE
generated
vendored
Executable file
27
my-app/node_modules/npm-install-checks/LICENSE
generated
vendored
Executable file
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) Robert Kowalski and Isaac Z. Schlueter ("Authors")
|
||||
All rights reserved.
|
||||
|
||||
The BSD License
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
my-app/node_modules/npm-install-checks/README.md
generated
vendored
Executable file
30
my-app/node_modules/npm-install-checks/README.md
generated
vendored
Executable file
|
@ -0,0 +1,30 @@
|
|||
# npm-install-checks
|
||||
|
||||
Check the engines and platform fields in package.json
|
||||
|
||||
## API
|
||||
|
||||
Both functions will throw an error if the check fails, or return
|
||||
`undefined` if everything is ok.
|
||||
|
||||
Errors have a `required` and `current` fields.
|
||||
|
||||
### .checkEngine(pkg, npmVer, nodeVer, force = false)
|
||||
|
||||
Check if a package's `engines.node` and `engines.npm` match the running system.
|
||||
|
||||
`force` argument will override the node version check, but not the npm
|
||||
version check, as this typically would indicate that the current version of
|
||||
npm is unable to install the package properly for some reason.
|
||||
|
||||
Error code: 'EBADENGINE'
|
||||
|
||||
### .checkPlatform(pkg, force, environment)
|
||||
|
||||
Check if a package's `os`, `cpu` and `libc` match the running system.
|
||||
|
||||
`force` argument skips all checks.
|
||||
|
||||
`environment` overrides the execution environment which comes from `process.platform` `process.arch` and current `libc` environment by default. `environment.os` `environment.cpu` and `environment.libc` are available.
|
||||
|
||||
Error code: 'EBADPLATFORM'
|
101
my-app/node_modules/npm-install-checks/lib/index.js
generated
vendored
Executable file
101
my-app/node_modules/npm-install-checks/lib/index.js
generated
vendored
Executable file
|
@ -0,0 +1,101 @@
|
|||
const semver = require('semver')
|
||||
|
||||
const checkEngine = (target, npmVer, nodeVer, force = false) => {
|
||||
const nodev = force ? null : nodeVer
|
||||
const eng = target.engines
|
||||
const opt = { includePrerelease: true }
|
||||
if (!eng) {
|
||||
return
|
||||
}
|
||||
|
||||
const nodeFail = nodev && eng.node && !semver.satisfies(nodev, eng.node, opt)
|
||||
const npmFail = npmVer && eng.npm && !semver.satisfies(npmVer, eng.npm, opt)
|
||||
if (nodeFail || npmFail) {
|
||||
throw Object.assign(new Error('Unsupported engine'), {
|
||||
pkgid: target._id,
|
||||
current: { node: nodeVer, npm: npmVer },
|
||||
required: eng,
|
||||
code: 'EBADENGINE',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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: platform,
|
||||
cpu: arch,
|
||||
libc: libcFamily,
|
||||
},
|
||||
required: {
|
||||
os: target.os,
|
||||
cpu: target.cpu,
|
||||
libc: target.libc,
|
||||
},
|
||||
code: 'EBADPLATFORM',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const checkList = (value, list) => {
|
||||
if (typeof list === 'string') {
|
||||
list = [list]
|
||||
}
|
||||
if (list.length === 1 && list[0] === 'any') {
|
||||
return true
|
||||
}
|
||||
// match none of the negated values, and at least one of the
|
||||
// non-negated values, if any are present.
|
||||
let negated = 0
|
||||
let match = false
|
||||
for (const entry of list) {
|
||||
const negate = entry.charAt(0) === '!'
|
||||
const test = negate ? entry.slice(1) : entry
|
||||
if (negate) {
|
||||
negated++
|
||||
if (value === test) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
match = match || value === test
|
||||
}
|
||||
}
|
||||
return match || negated === list.length
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
checkEngine,
|
||||
checkPlatform,
|
||||
}
|
51
my-app/node_modules/npm-install-checks/package.json
generated
vendored
Executable file
51
my-app/node_modules/npm-install-checks/package.json
generated
vendored
Executable file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "npm-install-checks",
|
||||
"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": "^4.0.0",
|
||||
"@npmcli/template-oss": "4.19.0",
|
||||
"tap": "^16.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"lint": "eslint \"**/*.js\"",
|
||||
"postlint": "template-oss-check",
|
||||
"template-oss-apply": "template-oss-apply --force",
|
||||
"lintfix": "npm run lint -- --fix",
|
||||
"snap": "tap",
|
||||
"posttest": "npm run lint"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/npm/npm-install-checks.git"
|
||||
},
|
||||
"keywords": [
|
||||
"npm,",
|
||||
"install"
|
||||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"files": [
|
||||
"bin/",
|
||||
"lib/"
|
||||
],
|
||||
"engines": {
|
||||
"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.19.0",
|
||||
"publish": "true"
|
||||
},
|
||||
"tap": {
|
||||
"nyc-arg": [
|
||||
"--exclude",
|
||||
"tap-snapshots/**"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue