Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAudrey Eschright <audrey@npmjs.com>2019-01-09 00:21:32 +0300
committerAudrey Eschright <audrey@npmjs.com>2019-01-09 00:21:32 +0300
commit3f40251c5868feaacbcdbcb1360877ce76998f5e (patch)
tree52c6ca761cd4eec14244d712d75617adb7e3114c /node_modules/npm-pick-manifest
parent455476c8d148ca83a4e030e96e93dcf1c7f0ff5f (diff)
npm-pick-manifest@2.2.3
Diffstat (limited to 'node_modules/npm-pick-manifest')
-rw-r--r--node_modules/npm-pick-manifest/CHANGELOG.md40
-rw-r--r--node_modules/npm-pick-manifest/README.md8
-rw-r--r--node_modules/npm-pick-manifest/index.js62
-rw-r--r--node_modules/npm-pick-manifest/package.json40
4 files changed, 119 insertions, 31 deletions
diff --git a/node_modules/npm-pick-manifest/CHANGELOG.md b/node_modules/npm-pick-manifest/CHANGELOG.md
index 5f53e8fce..2112665f7 100644
--- a/node_modules/npm-pick-manifest/CHANGELOG.md
+++ b/node_modules/npm-pick-manifest/CHANGELOG.md
@@ -2,6 +2,46 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+<a name="2.2.3"></a>
+## [2.2.3](https://github.com/zkat/npm-pick-manifest/compare/v2.2.2...v2.2.3) (2018-10-31)
+
+
+### Bug Fixes
+
+* **enjoyBy:** rework semantics for enjoyBy again ([5e89b62](https://github.com/zkat/npm-pick-manifest/commit/5e89b62))
+
+
+
+<a name="2.2.2"></a>
+## [2.2.2](https://github.com/zkat/npm-pick-manifest/compare/v2.2.1...v2.2.2) (2018-10-31)
+
+
+### Bug Fixes
+
+* **enjoyBy:** rework semantics for enjoyBy ([5684f45](https://github.com/zkat/npm-pick-manifest/commit/5684f45))
+
+
+
+<a name="2.2.1"></a>
+## [2.2.1](https://github.com/zkat/npm-pick-manifest/compare/v2.2.0...v2.2.1) (2018-10-30)
+
+
+
+<a name="2.2.0"></a>
+# [2.2.0](https://github.com/zkat/npm-pick-manifest/compare/v2.1.0...v2.2.0) (2018-10-30)
+
+
+### Bug Fixes
+
+* **audit:** npm audit fix --force ([d5ae6c4](https://github.com/zkat/npm-pick-manifest/commit/d5ae6c4))
+
+
+### Features
+
+* **enjoyBy:** add opts.enjoyBy option to filter versions by date ([0b8a790](https://github.com/zkat/npm-pick-manifest/commit/0b8a790))
+
+
+
<a name="2.1.0"></a>
# [2.1.0](https://github.com/zkat/npm-pick-manifest/compare/v2.0.1...v2.1.0) (2017-10-18)
diff --git a/node_modules/npm-pick-manifest/README.md b/node_modules/npm-pick-manifest/README.md
index 206af2f31..a9a027bfc 100644
--- a/node_modules/npm-pick-manifest/README.md
+++ b/node_modules/npm-pick-manifest/README.md
@@ -74,3 +74,11 @@ The function will throw `ETARGET` if there was no matching manifest, and
If `opts.defaultTag` is provided, it will be used instead of `latest`. That is,
if that tag matches the selector, it will be used, even if a higher available
version matches the range.
+
+If `opts.enjoyBy` is provided, it should be something that can be passed to `new
+Date(x)`, such as a `Date` object or a timestamp string. It will be used to
+filter the selected versions such that only versions less than or equal to
+`enjoyBy` are considered.
+
+If `opts.includeDeprecated` passed in as true, deprecated versions will be
+selected. By default, deprecated versions other than `defaultTag` are ignored.
diff --git a/node_modules/npm-pick-manifest/index.js b/node_modules/npm-pick-manifest/index.js
index 133b62723..d9a8373e5 100644
--- a/node_modules/npm-pick-manifest/index.js
+++ b/node_modules/npm-pick-manifest/index.js
@@ -1,19 +1,35 @@
'use strict'
+const figgyPudding = require('figgy-pudding')
const npa = require('npm-package-arg')
const semver = require('semver')
+const PickerOpts = figgyPudding({
+ defaultTag: { default: 'latest' },
+ enjoyBy: {},
+ includeDeprecated: { default: false }
+})
+
module.exports = pickManifest
function pickManifest (packument, wanted, opts) {
- opts = opts || {}
+ opts = PickerOpts(opts)
+ const time = opts.enjoyBy && packument.time && +(new Date(opts.enjoyBy))
const spec = npa.resolve(packument.name, wanted)
const type = spec.type
if (type === 'version' || type === 'range') {
wanted = semver.clean(wanted, true) || wanted
}
const distTags = packument['dist-tags'] || {}
- const versions = Object.keys(packument.versions || {}).filter(v => semver.valid(v, true))
- const undeprecated = versions.filter(v => !packument.versions[v].deprecated)
+ const versions = Object.keys(packument.versions || {}).filter(v => {
+ return semver.valid(v, true)
+ })
+
+ function enjoyableBy (v) {
+ return !time || (
+ packument.time[v] && time >= +(new Date(packument.time[v]))
+ )
+ }
+
let err
if (!versions.length) {
@@ -27,43 +43,69 @@ function pickManifest (packument, wanted, opts) {
let target
- if (type === 'tag') {
+ if (type === 'tag' && enjoyableBy(distTags[wanted])) {
target = distTags[wanted]
} else if (type === 'version') {
target = wanted
- } else if (type !== 'range') {
+ } else if (type !== 'range' && enjoyableBy(distTags[wanted])) {
throw new Error('Only tag, version, and range are supported')
}
- const tagVersion = distTags[opts.defaultTag || 'latest']
+ const tagVersion = distTags[opts.defaultTag]
if (
!target &&
tagVersion &&
packument.versions[tagVersion] &&
+ enjoyableBy(tagVersion) &&
semver.satisfies(tagVersion, wanted, true)
) {
target = tagVersion
}
if (!target && !opts.includeDeprecated) {
+ const undeprecated = versions.filter(v => !packument.versions[v].deprecated && enjoyableBy(v)
+ )
target = semver.maxSatisfying(undeprecated, wanted, true)
}
if (!target) {
- target = semver.maxSatisfying(versions, wanted, true)
+ const stillFresh = versions.filter(enjoyableBy)
+ target = semver.maxSatisfying(stillFresh, wanted, true)
}
- if (!target && wanted === '*') {
+ if (!target && wanted === '*' && enjoyableBy(tagVersion)) {
// This specific corner is meant for the case where
// someone is using `*` as a selector, but all versions
// are pre-releases, which don't match ranges at all.
target = tagVersion
}
- const manifest = target && packument.versions[target]
+ if (
+ !target &&
+ time &&
+ type === 'tag' &&
+ distTags[wanted] &&
+ !enjoyableBy(distTags[wanted])
+ ) {
+ const stillFresh = versions.filter(v =>
+ enjoyableBy(v) && semver.lte(v, distTags[wanted], true)
+ ).sort(semver.rcompare)
+ target = stillFresh[0]
+ }
+
+ const manifest = (
+ target &&
+ packument.versions[target]
+ )
if (!manifest) {
err = new Error(
- `No matching version found for ${packument.name}@${wanted}`
+ `No matching version found for ${packument.name}@${wanted}${
+ opts.enjoyBy
+ ? ` with an Enjoy By date of ${
+ new Date(opts.enjoyBy).toLocaleString()
+ }. Maybe try a different date?`
+ : ''
+ }`
)
err.code = 'ETARGET'
err.name = packument.name
diff --git a/node_modules/npm-pick-manifest/package.json b/node_modules/npm-pick-manifest/package.json
index 4cf8bf1a1..a80c76d37 100644
--- a/node_modules/npm-pick-manifest/package.json
+++ b/node_modules/npm-pick-manifest/package.json
@@ -1,33 +1,28 @@
{
- "_args": [
- [
- "npm-pick-manifest@2.1.0",
- "/Users/rebecca/code/npm"
- ]
- ],
- "_from": "npm-pick-manifest@2.1.0",
- "_id": "npm-pick-manifest@2.1.0",
+ "_from": "npm-pick-manifest@2.2.3",
+ "_id": "npm-pick-manifest@2.2.3",
"_inBundle": false,
- "_integrity": "sha512-q9zLP8cTr8xKPmMZN3naxp1k/NxVFsjxN6uWuO1tiw9gxg7wZWQ/b5UTfzD0ANw2q1lQxdLKTeCCksq+bPSgbQ==",
+ "_integrity": "sha512-+IluBC5K201+gRU85vFlUwX3PFShZAbAgDNp2ewJdWMVSppdo/Zih0ul2Ecky/X7b51J7LrrUAP+XOmOCvYZqA==",
"_location": "/npm-pick-manifest",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
- "raw": "npm-pick-manifest@2.1.0",
+ "raw": "npm-pick-manifest@2.2.3",
"name": "npm-pick-manifest",
"escapedName": "npm-pick-manifest",
- "rawSpec": "2.1.0",
+ "rawSpec": "2.2.3",
"saveSpec": null,
- "fetchSpec": "2.1.0"
+ "fetchSpec": "2.2.3"
},
"_requiredBy": [
- "/",
- "/pacote"
+ "#USER",
+ "/"
],
- "_resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-2.1.0.tgz",
- "_spec": "2.1.0",
- "_where": "/Users/rebecca/code/npm",
+ "_resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-2.2.3.tgz",
+ "_shasum": "32111d2a9562638bb2c8f2bf27f7f3092c8fae40",
+ "_spec": "npm-pick-manifest@2.2.3",
+ "_where": "/Users/aeschright/code/cli",
"author": {
"name": "Kat Marchán",
"email": "kzm@sykosomatic.org"
@@ -35,6 +30,7 @@
"bugs": {
"url": "https://github.com/zkat/npm-pick-manifest/issues"
},
+ "bundleDependencies": false,
"config": {
"nyc": {
"exclude": [
@@ -44,15 +40,17 @@
}
},
"dependencies": {
+ "figgy-pudding": "^3.5.1",
"npm-package-arg": "^6.0.0",
"semver": "^5.4.1"
},
+ "deprecated": false,
"description": "Resolves a matching manifest from a package metadata document according to standard npm semver resolution rules.",
"devDependencies": {
- "nyc": "^11.2.1",
+ "nyc": "^13.1.0",
"standard": "^10.0.3",
- "standard-version": "^4.2.0",
- "tap": "^10.7.0",
+ "standard-version": "^4.4.0",
+ "tap": "^12.0.1",
"weallbehave": "^1.2.0",
"weallcontribute": "^1.0.8"
},
@@ -81,5 +79,5 @@
"update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
"update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
},
- "version": "2.1.0"
+ "version": "2.2.3"
}