Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
16
node_modules/npm-pick-manifest/LICENSE.md
generated
vendored
Normal file
16
node_modules/npm-pick-manifest/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
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 COPYRIGHT HOLDER DISCLAIMS
|
||||
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER 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.
|
157
node_modules/npm-pick-manifest/README.md
generated
vendored
Normal file
157
node_modules/npm-pick-manifest/README.md
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
# npm-pick-manifest [](https://npm.im/npm-pick-manifest) [](https://npm.im/npm-pick-manifest) [](https://travis-ci.org/npm/npm-pick-manifest) [](https://coveralls.io/github/npm/npm-pick-manifest?branch=latest)
|
||||
|
||||
[`npm-pick-manifest`](https://github.com/npm/npm-pick-manifest) is a standalone
|
||||
implementation of [npm](https://npmjs.com)'s semver range resolution algorithm.
|
||||
|
||||
## Install
|
||||
|
||||
`$ npm install --save npm-pick-manifest`
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Example](#example)
|
||||
* [Features](#features)
|
||||
* [API](#api)
|
||||
* [`pickManifest()`](#pick-manifest)
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const pickManifest = require('npm-pick-manifest')
|
||||
|
||||
fetch('https://registry.npmjs.org/npm-pick-manifest').then(res => {
|
||||
return res.json()
|
||||
}).then(packument => {
|
||||
return pickManifest(packument, '^1.0.0')
|
||||
}) // get same manifest as npm would get if you `npm i npm-pick-manifest@^1.0.0`
|
||||
```
|
||||
|
||||
### Features
|
||||
|
||||
* Uses npm's exact [semver resolution algorithm](http://npm.im/semver).
|
||||
* Supports ranges, tags, and versions.
|
||||
* Prefers non-deprecated versions to deprecated versions.
|
||||
* Prefers versions whose `engines` requirements are satisfied over those
|
||||
that will raise a warning or error at install time.
|
||||
|
||||
### API
|
||||
|
||||
#### <a name="pick-manifest"></a> `> pickManifest(packument, selector, [opts]) -> manifest`
|
||||
|
||||
Returns the manifest that best matches `selector`, or throws an error.
|
||||
|
||||
Packuments are anything returned by metadata URLs from the npm registry. That
|
||||
is, they're objects with the following shape (only fields used by
|
||||
`npm-pick-manifest` included):
|
||||
|
||||
```javascript
|
||||
{
|
||||
name: 'some-package',
|
||||
'dist-tags': {
|
||||
foo: '1.0.1'
|
||||
},
|
||||
versions: {
|
||||
'1.0.0': { version: '1.0.0' },
|
||||
'1.0.1': { version: '1.0.1' },
|
||||
'1.0.2': { version: '1.0.2' },
|
||||
'2.0.0': { version: '2.0.0' }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The algorithm will follow npm's algorithm for semver resolution, and only
|
||||
`tag`, `range`, and `version` selectors are supported.
|
||||
|
||||
The function will throw `ETARGET` if there was no matching manifest, and
|
||||
`ENOVERSIONS` if the packument object has no valid versions in `versions`.
|
||||
If the only matching manifest is included in a `policyRestrictions` section
|
||||
of the packument, then an `E403` is raised.
|
||||
|
||||
#### <a name="pick-manifest-options"></a> Options
|
||||
|
||||
All options are optional.
|
||||
|
||||
* `includeStaged` - Boolean, default `false`. Include manifests in the
|
||||
`stagedVersions.versions` set, to support installing [staged
|
||||
packages](https://github.com/npm/rfcs/pull/92) when appropriate. Note
|
||||
that staged packages are always treated as lower priority than actual
|
||||
publishes, even when `includeStaged` is set.
|
||||
* `defaultTag` - String, default `'latest'`. The default `dist-tag` to
|
||||
install when no specifier is provided. Note that the version indicated
|
||||
by this specifier will be given top priority if it matches a supplied
|
||||
semver range.
|
||||
* `before` - String, Date, or Number, default `null`. This is passed to
|
||||
`new Date()`, so anything that works there will be valid. Do not
|
||||
consider _any_ manifests that were published after the date indicated.
|
||||
Note that this is only relevant when the packument includes a `time`
|
||||
field listing the publish date of all the packages.
|
||||
* `nodeVersion` - String, default `process.version`. The Node.js version
|
||||
to use when checking manifests for `engines` requirement satisfaction.
|
||||
* `npmVersion` - String, default `null`. The npm version to use when
|
||||
checking manifest for `engines` requirement satisfaction. (If `null`,
|
||||
then this particular check is skipped.)
|
||||
* `avoid` - String, default `null`. A SemVer range of
|
||||
versions that should be avoided. An avoided version MAY be selected if
|
||||
there is no other option, so when using this for version selection ensure
|
||||
that you check the result against the range to see if there was no
|
||||
alternative available.
|
||||
* `avoidStrict` Boolean, default `false`. If set to true, then
|
||||
`pickManifest` will never return a version in the `avoid` range. If the
|
||||
only available version in the `wanted` range is a version that should be
|
||||
avoided, then it will return a version _outside_ the `wanted` range,
|
||||
preferring to do so without making a SemVer-major jump, if possible. If
|
||||
there are no versions outside the `avoid` range, then throw an
|
||||
`ETARGET` error. It does this by calling pickManifest first with the
|
||||
`wanted` range, then with a `^` affixed to the version returned by the
|
||||
`wanted` range, and then with a `*` version range, and throwing if
|
||||
nothing could be found to satisfy the avoidance request.
|
||||
|
||||
Return value is the manifest as it exists in the packument, possibly
|
||||
decorated with the following boolean flags:
|
||||
|
||||
* `_shouldAvoid` The version is in the `avoid` range. Watch out!
|
||||
* `_outsideDependencyRange` The version is outside the `wanted` range,
|
||||
because `avoidStrict: true` was set.
|
||||
* `_isSemVerMajor` The `_outsideDependencyRange` result is a SemVer-major
|
||||
step up from the version returned by the `wanted` range.
|
||||
|
||||
### Algorithm
|
||||
|
||||
1. Create list of all versions in `versions`,
|
||||
`policyRestrictions.versions`, and (if `includeStaged` is set)
|
||||
`stagedVersions.versions`.
|
||||
2. If a `dist-tag` is requested,
|
||||
1. If the manifest is not after the specified `before` date, then
|
||||
select that from the set.
|
||||
2. If the manifest is after the specified `before` date, then re-start
|
||||
the selection looking for the highest SemVer range that is equal to
|
||||
or less than the `dist-tag` target.
|
||||
3. If a specific version is requested,
|
||||
1. If the manifest is not after the specified `before` date, then
|
||||
select the specified manifest.
|
||||
2. If the manifest is after the specified `before` date, then raise
|
||||
`ETARGET` error. (NB: this is a breaking change from v5, where a
|
||||
specified version would override the `before` setting.)
|
||||
4. (At this point we know a range is requested.)
|
||||
5. If the `defaultTag` refers to a `dist-tag` that satisfies the range (or
|
||||
if the range is `'*'` or `''`), and the manifest is published before the
|
||||
`before` setting, then select that manifest.
|
||||
6. If nothing is yet selected, sort by the following heuristics in order,
|
||||
and select the top item:
|
||||
1. Prioritize versions that are not in the `avoid` range over those
|
||||
that are.
|
||||
2. Prioritize versions that are not in `policyRestrictions` over those
|
||||
that are.
|
||||
3. Prioritize published versions over staged versions.
|
||||
4. Prioritize versions that are not deprecated, and which have a
|
||||
satisfied engines requirement, over those that are either deprecated
|
||||
or have an engines mismatch.
|
||||
5. Prioritize versions that have a satisfied engines requirement over
|
||||
those that do not.
|
||||
6. Prioritize versions that are not are not deprecated (but have a
|
||||
mismatched engines requirement) over those that are deprecated.
|
||||
7. Prioritize higher SemVer precedence over lower SemVer precedence.
|
||||
7. If no manifest was selected, raise an `ETARGET` error.
|
||||
8. If the selected item is in the `policyRestrictions.versions` list, raise
|
||||
an `E403` error.
|
||||
9. Return the selected manifest.
|
224
node_modules/npm-pick-manifest/lib/index.js
generated
vendored
Normal file
224
node_modules/npm-pick-manifest/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,224 @@
|
|||
'use strict'
|
||||
|
||||
const npa = require('npm-package-arg')
|
||||
const semver = require('semver')
|
||||
const { checkEngine } = require('npm-install-checks')
|
||||
const normalizeBin = require('npm-normalize-package-bin')
|
||||
|
||||
const engineOk = (manifest, npmVersion, nodeVersion) => {
|
||||
try {
|
||||
checkEngine(manifest, npmVersion, nodeVersion)
|
||||
return true
|
||||
} catch (_) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const isBefore = (verTimes, ver, time) =>
|
||||
!verTimes || !verTimes[ver] || Date.parse(verTimes[ver]) <= time
|
||||
|
||||
const avoidSemverOpt = { includePrerelease: true, loose: true }
|
||||
const shouldAvoid = (ver, avoid) =>
|
||||
avoid && semver.satisfies(ver, avoid, avoidSemverOpt)
|
||||
|
||||
const decorateAvoid = (result, avoid) =>
|
||||
result && shouldAvoid(result.version, avoid)
|
||||
? { ...result, _shouldAvoid: true }
|
||||
: result
|
||||
|
||||
const pickManifest = (packument, wanted, opts) => {
|
||||
const {
|
||||
defaultTag = 'latest',
|
||||
before = null,
|
||||
nodeVersion = process.version,
|
||||
npmVersion = null,
|
||||
includeStaged = false,
|
||||
avoid = null,
|
||||
avoidStrict = false,
|
||||
} = opts
|
||||
|
||||
const { name, time: verTimes } = packument
|
||||
const versions = packument.versions || {}
|
||||
|
||||
if (avoidStrict) {
|
||||
const looseOpts = {
|
||||
...opts,
|
||||
avoidStrict: false,
|
||||
}
|
||||
|
||||
const result = pickManifest(packument, wanted, looseOpts)
|
||||
if (!result || !result._shouldAvoid) {
|
||||
return result
|
||||
}
|
||||
|
||||
const caret = pickManifest(packument, `^${result.version}`, looseOpts)
|
||||
if (!caret || !caret._shouldAvoid) {
|
||||
return {
|
||||
...caret,
|
||||
_outsideDependencyRange: true,
|
||||
_isSemVerMajor: false,
|
||||
}
|
||||
}
|
||||
|
||||
const star = pickManifest(packument, '*', looseOpts)
|
||||
if (!star || !star._shouldAvoid) {
|
||||
return {
|
||||
...star,
|
||||
_outsideDependencyRange: true,
|
||||
_isSemVerMajor: true,
|
||||
}
|
||||
}
|
||||
|
||||
throw Object.assign(new Error(`No avoidable versions for ${name}`), {
|
||||
code: 'ETARGET',
|
||||
name,
|
||||
wanted,
|
||||
avoid,
|
||||
before,
|
||||
versions: Object.keys(versions),
|
||||
})
|
||||
}
|
||||
|
||||
const staged = (includeStaged && packument.stagedVersions &&
|
||||
packument.stagedVersions.versions) || {}
|
||||
const restricted = (packument.policyRestrictions &&
|
||||
packument.policyRestrictions.versions) || {}
|
||||
|
||||
const time = before && verTimes ? +(new Date(before)) : Infinity
|
||||
const spec = npa.resolve(name, wanted || defaultTag)
|
||||
const type = spec.type
|
||||
const distTags = packument['dist-tags'] || {}
|
||||
|
||||
if (type !== 'tag' && type !== 'version' && type !== 'range') {
|
||||
throw new Error('Only tag, version, and range are supported')
|
||||
}
|
||||
|
||||
// if the type is 'tag', and not just the implicit default, then it must
|
||||
// be that exactly, or nothing else will do.
|
||||
if (wanted && type === 'tag') {
|
||||
const ver = distTags[wanted]
|
||||
// if the version in the dist-tags is before the before date, then
|
||||
// we use that. Otherwise, we get the highest precedence version
|
||||
// prior to the dist-tag.
|
||||
if (isBefore(verTimes, ver, time)) {
|
||||
return decorateAvoid(versions[ver] || staged[ver] || restricted[ver], avoid)
|
||||
} else {
|
||||
return pickManifest(packument, `<=${ver}`, opts)
|
||||
}
|
||||
}
|
||||
|
||||
// similarly, if a specific version, then only that version will do
|
||||
if (wanted && type === 'version') {
|
||||
const ver = semver.clean(wanted, { loose: true })
|
||||
const mani = versions[ver] || staged[ver] || restricted[ver]
|
||||
return isBefore(verTimes, ver, time) ? decorateAvoid(mani, avoid) : null
|
||||
}
|
||||
|
||||
// ok, sort based on our heuristics, and pick the best fit
|
||||
const range = type === 'range' ? wanted : '*'
|
||||
|
||||
// if the range is *, then we prefer the 'latest' if available
|
||||
// but skip this if it should be avoided, in that case we have
|
||||
// to try a little harder.
|
||||
const defaultVer = distTags[defaultTag]
|
||||
if (defaultVer &&
|
||||
(range === '*' || semver.satisfies(defaultVer, range, { loose: true })) &&
|
||||
!restricted[defaultVer] &&
|
||||
!shouldAvoid(defaultVer, avoid)) {
|
||||
const mani = versions[defaultVer]
|
||||
const ok = mani &&
|
||||
isBefore(verTimes, defaultVer, time) &&
|
||||
engineOk(mani, npmVersion, nodeVersion) &&
|
||||
!mani.deprecated &&
|
||||
!staged[defaultVer]
|
||||
if (ok) {
|
||||
return mani
|
||||
}
|
||||
}
|
||||
|
||||
// ok, actually have to sort the list and take the winner
|
||||
const allEntries = Object.entries(versions)
|
||||
.concat(Object.entries(staged))
|
||||
.concat(Object.entries(restricted))
|
||||
.filter(([ver]) => isBefore(verTimes, ver, time))
|
||||
|
||||
if (!allEntries.length) {
|
||||
throw Object.assign(new Error(`No versions available for ${name}`), {
|
||||
code: 'ENOVERSIONS',
|
||||
name,
|
||||
type,
|
||||
wanted,
|
||||
before,
|
||||
versions: Object.keys(versions),
|
||||
})
|
||||
}
|
||||
|
||||
const sortSemverOpt = { loose: true }
|
||||
const entries = allEntries.filter(([ver]) =>
|
||||
semver.satisfies(ver, range, { loose: true }))
|
||||
.sort((a, b) => {
|
||||
const [vera, mania] = a
|
||||
const [verb, manib] = b
|
||||
const notavoida = !shouldAvoid(vera, avoid)
|
||||
const notavoidb = !shouldAvoid(verb, avoid)
|
||||
const notrestra = !restricted[vera]
|
||||
const notrestrb = !restricted[verb]
|
||||
const notstagea = !staged[vera]
|
||||
const notstageb = !staged[verb]
|
||||
const notdepra = !mania.deprecated
|
||||
const notdeprb = !manib.deprecated
|
||||
const enginea = engineOk(mania, npmVersion, nodeVersion)
|
||||
const engineb = engineOk(manib, npmVersion, nodeVersion)
|
||||
// sort by:
|
||||
// - not an avoided version
|
||||
// - not restricted
|
||||
// - not staged
|
||||
// - not deprecated and engine ok
|
||||
// - engine ok
|
||||
// - not deprecated
|
||||
// - semver
|
||||
return (notavoidb - notavoida) ||
|
||||
(notrestrb - notrestra) ||
|
||||
(notstageb - notstagea) ||
|
||||
((notdeprb && engineb) - (notdepra && enginea)) ||
|
||||
(engineb - enginea) ||
|
||||
(notdeprb - notdepra) ||
|
||||
semver.rcompare(vera, verb, sortSemverOpt)
|
||||
})
|
||||
|
||||
return decorateAvoid(entries[0] && entries[0][1], avoid)
|
||||
}
|
||||
|
||||
module.exports = (packument, wanted, opts = {}) => {
|
||||
const mani = pickManifest(packument, wanted, opts)
|
||||
const picked = mani && normalizeBin(mani)
|
||||
const policyRestrictions = packument.policyRestrictions
|
||||
const restricted = (policyRestrictions && policyRestrictions.versions) || {}
|
||||
|
||||
if (picked && !restricted[picked.version]) {
|
||||
return picked
|
||||
}
|
||||
|
||||
const { before = null, defaultTag = 'latest' } = opts
|
||||
const bstr = before ? new Date(before).toLocaleString() : ''
|
||||
const { name } = packument
|
||||
const pckg = `${name}@${wanted}` +
|
||||
(before ? ` with a date before ${bstr}` : '')
|
||||
|
||||
const isForbidden = picked && !!restricted[picked.version]
|
||||
const polMsg = isForbidden ? policyRestrictions.message : ''
|
||||
|
||||
const msg = !isForbidden ? `No matching version found for ${pckg}.`
|
||||
: `Could not download ${pckg} due to policy violations:\n${polMsg}`
|
||||
|
||||
const code = isForbidden ? 'E403' : 'ETARGET'
|
||||
throw Object.assign(new Error(msg), {
|
||||
code,
|
||||
type: npa.resolve(packument.name, wanted).type,
|
||||
wanted,
|
||||
versions: Object.keys(packument.versions ?? {}),
|
||||
name,
|
||||
distTags: packument['dist-tags'],
|
||||
defaultTag,
|
||||
})
|
||||
}
|
57
node_modules/npm-pick-manifest/package.json
generated
vendored
Normal file
57
node_modules/npm-pick-manifest/package.json
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"name": "npm-pick-manifest",
|
||||
"version": "9.1.0",
|
||||
"description": "Resolves a matching manifest from a package metadata document according to standard npm semver resolution rules.",
|
||||
"main": "./lib",
|
||||
"files": [
|
||||
"bin/",
|
||||
"lib/"
|
||||
],
|
||||
"scripts": {
|
||||
"coverage": "tap",
|
||||
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
|
||||
"test": "tap",
|
||||
"posttest": "npm run lint",
|
||||
"postlint": "template-oss-check",
|
||||
"lintfix": "npm run lint -- --fix",
|
||||
"snap": "tap",
|
||||
"template-oss-apply": "template-oss-apply --force"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/npm-pick-manifest.git"
|
||||
},
|
||||
"keywords": [
|
||||
"npm",
|
||||
"semver",
|
||||
"package manager"
|
||||
],
|
||||
"author": "GitHub Inc.",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"npm-install-checks": "^6.0.0",
|
||||
"npm-normalize-package-bin": "^3.0.0",
|
||||
"npm-package-arg": "^11.0.0",
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^4.0.0",
|
||||
"@npmcli/template-oss": "4.22.0",
|
||||
"tap": "^16.0.1"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true,
|
||||
"nyc-arg": [
|
||||
"--exclude",
|
||||
"tap-snapshots/**"
|
||||
]
|
||||
},
|
||||
"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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue