$
This commit is contained in:
4
node_modules/normalize-package-data/AUTHORS
generated
vendored
Normal file
4
node_modules/normalize-package-data/AUTHORS
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# Names sorted by how much code was originally theirs.
|
||||
Isaac Z. Schlueter <i@izs.me>
|
||||
Meryn Stol <merynstol@gmail.com>
|
||||
Robert Kowalski <rok@kowalski.gd>
|
15
node_modules/normalize-package-data/LICENSE
generated
vendored
Normal file
15
node_modules/normalize-package-data/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
This package contains code originally written by Isaac Z. Schlueter.
|
||||
Used with permission.
|
||||
|
||||
Copyright (c) Meryn Stol ("Author")
|
||||
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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
108
node_modules/normalize-package-data/README.md
generated
vendored
Normal file
108
node_modules/normalize-package-data/README.md
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
# normalize-package-data
|
||||
|
||||
[](https://travis-ci.org/npm/normalize-package-data)
|
||||
|
||||
normalize-package-data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.
|
||||
|
||||
normalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install normalize-package-data
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Basic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.
|
||||
|
||||
```javascript
|
||||
normalizeData = require('normalize-package-data')
|
||||
packageData = require("./package.json")
|
||||
normalizeData(packageData)
|
||||
// packageData is now normalized
|
||||
```
|
||||
|
||||
#### Strict mode
|
||||
|
||||
You may activate strict validation by passing true as the second argument.
|
||||
|
||||
```javascript
|
||||
normalizeData = require('normalize-package-data')
|
||||
packageData = require("./package.json")
|
||||
normalizeData(packageData, true)
|
||||
// packageData is now normalized
|
||||
```
|
||||
|
||||
If strict mode is activated, only Semver 2.0 version strings are accepted. Otherwise, Semver 1.0 strings are accepted as well. Packages must have a name, and the name field must not have contain leading or trailing whitespace.
|
||||
|
||||
#### Warnings
|
||||
|
||||
Optionally, you may pass a "warning" function. It gets called whenever the `normalizeData` function encounters something that doesn't look right. It indicates less than perfect input data.
|
||||
|
||||
```javascript
|
||||
normalizeData = require('normalize-package-data')
|
||||
packageData = require("./package.json")
|
||||
warnFn = function(msg) { console.error(msg) }
|
||||
normalizeData(packageData, warnFn)
|
||||
// packageData is now normalized. Any number of warnings may have been logged.
|
||||
```
|
||||
|
||||
You may combine strict validation with warnings by passing `true` as the second argument, and `warnFn` as third.
|
||||
|
||||
When `private` field is set to `true`, warnings will be suppressed.
|
||||
|
||||
### Potential exceptions
|
||||
|
||||
If the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.
|
||||
|
||||
## What normalization (currently) entails
|
||||
|
||||
* The value of `name` field gets trimmed (unless in strict mode).
|
||||
* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).
|
||||
* If `name` and/or `version` fields are missing, they are set to empty strings.
|
||||
* If `files` field is not an array, it will be removed.
|
||||
* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.
|
||||
* If `man` field is a string, it will become an array with the original string as its sole member.
|
||||
* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\s+`.
|
||||
* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.
|
||||
* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.
|
||||
* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.
|
||||
* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.
|
||||
* As of v2: Dependencies that point at known hosted git providers (currently: github, bitbucket, gitlab) will have their URLs canonicalized, but protocols will be preserved.
|
||||
* As of v2: Dependencies that use shortcuts for hosted git providers (`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, `gist:docid`) will have the shortcut left in place. (In the case of github, the `org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING CHANGE FROM V1, where the shorcut was previously expanded to a URL.
|
||||
* If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.
|
||||
* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`.
|
||||
* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git+https://github.com/[owner-name]/[repo-name].git
|
||||
* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.
|
||||
* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.
|
||||
* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.
|
||||
* If `homepage` field is not a string, it will be removed.
|
||||
* If the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`.
|
||||
* If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]#readme . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.
|
||||
|
||||
### Rules for name field
|
||||
|
||||
If `name` field is given, the value of the name field must be a string. The string may not:
|
||||
|
||||
* start with a period.
|
||||
* contain the following characters: `/@\s+%`
|
||||
* contain any characters that would need to be encoded for use in urls.
|
||||
* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).
|
||||
|
||||
### Rules for version field
|
||||
|
||||
If `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).
|
||||
|
||||
### Rules for license field
|
||||
|
||||
The `license`/`licence` field should be a valid *SPDX license expression* or one of the special values allowed by [validate-npm-package-license](https://npmjs.com/package/validate-npm-package-license). See [documentation for the license field in package.json](https://docs.npmjs.com/files/package.json#license).
|
||||
|
||||
## Credits
|
||||
|
||||
This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson.
|
||||
|
||||
## License
|
||||
|
||||
normalize-package-data is released under the [BSD 2-Clause License](https://opensource.org/licenses/BSD-2-Clause).
|
||||
Copyright (c) 2013 Meryn Stol
|
22
node_modules/normalize-package-data/lib/extract_description.js
generated
vendored
Normal file
22
node_modules/normalize-package-data/lib/extract_description.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = extractDescription
|
||||
|
||||
// Extracts description from contents of a readme file in markdown format
|
||||
function extractDescription (d) {
|
||||
if (!d) {
|
||||
return
|
||||
}
|
||||
if (d === 'ERROR: No README data found!') {
|
||||
return
|
||||
}
|
||||
// the first block of text before the first heading
|
||||
// that isn't the first line heading
|
||||
d = d.trim().split('\n')
|
||||
for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s++) {
|
||||
;
|
||||
}
|
||||
var l = d.length
|
||||
for (var e = s + 1; e < l && d[e].trim(); e++) {
|
||||
;
|
||||
}
|
||||
return d.slice(s, e).join(' ').trim()
|
||||
}
|
474
node_modules/normalize-package-data/lib/fixer.js
generated
vendored
Normal file
474
node_modules/normalize-package-data/lib/fixer.js
generated
vendored
Normal file
@@ -0,0 +1,474 @@
|
||||
var isValidSemver = require('semver/functions/valid')
|
||||
var cleanSemver = require('semver/functions/clean')
|
||||
var validateLicense = require('validate-npm-package-license')
|
||||
var hostedGitInfo = require('hosted-git-info')
|
||||
var isBuiltinModule = require('is-core-module')
|
||||
var depTypes = ['dependencies', 'devDependencies', 'optionalDependencies']
|
||||
var extractDescription = require('./extract_description')
|
||||
var url = require('url')
|
||||
var typos = require('./typos.json')
|
||||
|
||||
module.exports = {
|
||||
// default warning function
|
||||
warn: function () {},
|
||||
|
||||
fixRepositoryField: function (data) {
|
||||
if (data.repositories) {
|
||||
this.warn('repositories')
|
||||
data.repository = data.repositories[0]
|
||||
}
|
||||
if (!data.repository) {
|
||||
return this.warn('missingRepository')
|
||||
}
|
||||
if (typeof data.repository === 'string') {
|
||||
data.repository = {
|
||||
type: 'git',
|
||||
url: data.repository,
|
||||
}
|
||||
}
|
||||
var r = data.repository.url || ''
|
||||
if (r) {
|
||||
var hosted = hostedGitInfo.fromUrl(r)
|
||||
if (hosted) {
|
||||
r = data.repository.url
|
||||
= hosted.getDefaultRepresentation() === 'shortcut' ? hosted.https() : hosted.toString()
|
||||
}
|
||||
}
|
||||
|
||||
if (r.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)) {
|
||||
this.warn('brokenGitUrl', r)
|
||||
}
|
||||
},
|
||||
|
||||
fixTypos: function (data) {
|
||||
Object.keys(typos.topLevel).forEach(function (d) {
|
||||
if (Object.prototype.hasOwnProperty.call(data, d)) {
|
||||
this.warn('typo', d, typos.topLevel[d])
|
||||
}
|
||||
}, this)
|
||||
},
|
||||
|
||||
fixScriptsField: function (data) {
|
||||
if (!data.scripts) {
|
||||
return
|
||||
}
|
||||
if (typeof data.scripts !== 'object') {
|
||||
this.warn('nonObjectScripts')
|
||||
delete data.scripts
|
||||
return
|
||||
}
|
||||
Object.keys(data.scripts).forEach(function (k) {
|
||||
if (typeof data.scripts[k] !== 'string') {
|
||||
this.warn('nonStringScript')
|
||||
delete data.scripts[k]
|
||||
} else if (typos.script[k] && !data.scripts[typos.script[k]]) {
|
||||
this.warn('typo', k, typos.script[k], 'scripts')
|
||||
}
|
||||
}, this)
|
||||
},
|
||||
|
||||
fixFilesField: function (data) {
|
||||
var files = data.files
|
||||
if (files && !Array.isArray(files)) {
|
||||
this.warn('nonArrayFiles')
|
||||
delete data.files
|
||||
} else if (data.files) {
|
||||
data.files = data.files.filter(function (file) {
|
||||
if (!file || typeof file !== 'string') {
|
||||
this.warn('invalidFilename', file)
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
},
|
||||
|
||||
fixBinField: function (data) {
|
||||
if (!data.bin) {
|
||||
return
|
||||
}
|
||||
if (typeof data.bin === 'string') {
|
||||
var b = {}
|
||||
var match
|
||||
if (match = data.name.match(/^@[^/]+[/](.*)$/)) {
|
||||
b[match[1]] = data.bin
|
||||
} else {
|
||||
b[data.name] = data.bin
|
||||
}
|
||||
data.bin = b
|
||||
}
|
||||
},
|
||||
|
||||
fixManField: function (data) {
|
||||
if (!data.man) {
|
||||
return
|
||||
}
|
||||
if (typeof data.man === 'string') {
|
||||
data.man = [data.man]
|
||||
}
|
||||
},
|
||||
fixBundleDependenciesField: function (data) {
|
||||
var bdd = 'bundledDependencies'
|
||||
var bd = 'bundleDependencies'
|
||||
if (data[bdd] && !data[bd]) {
|
||||
data[bd] = data[bdd]
|
||||
delete data[bdd]
|
||||
}
|
||||
if (data[bd] && !Array.isArray(data[bd])) {
|
||||
this.warn('nonArrayBundleDependencies')
|
||||
delete data[bd]
|
||||
} else if (data[bd]) {
|
||||
data[bd] = data[bd].filter(function (bd) {
|
||||
if (!bd || typeof bd !== 'string') {
|
||||
this.warn('nonStringBundleDependency', bd)
|
||||
return false
|
||||
} else {
|
||||
if (!data.dependencies) {
|
||||
data.dependencies = {}
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(data.dependencies, bd)) {
|
||||
this.warn('nonDependencyBundleDependency', bd)
|
||||
data.dependencies[bd] = '*'
|
||||
}
|
||||
return true
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
},
|
||||
|
||||
fixDependencies: function (data, strict) {
|
||||
objectifyDeps(data, this.warn)
|
||||
addOptionalDepsToDeps(data, this.warn)
|
||||
this.fixBundleDependenciesField(data)
|
||||
|
||||
;['dependencies', 'devDependencies'].forEach(function (deps) {
|
||||
if (!(deps in data)) {
|
||||
return
|
||||
}
|
||||
if (!data[deps] || typeof data[deps] !== 'object') {
|
||||
this.warn('nonObjectDependencies', deps)
|
||||
delete data[deps]
|
||||
return
|
||||
}
|
||||
Object.keys(data[deps]).forEach(function (d) {
|
||||
var r = data[deps][d]
|
||||
if (typeof r !== 'string') {
|
||||
this.warn('nonStringDependency', d, JSON.stringify(r))
|
||||
delete data[deps][d]
|
||||
}
|
||||
var hosted = hostedGitInfo.fromUrl(data[deps][d])
|
||||
if (hosted) {
|
||||
data[deps][d] = hosted.toString()
|
||||
}
|
||||
}, this)
|
||||
}, this)
|
||||
},
|
||||
|
||||
fixModulesField: function (data) {
|
||||
if (data.modules) {
|
||||
this.warn('deprecatedModules')
|
||||
delete data.modules
|
||||
}
|
||||
},
|
||||
|
||||
fixKeywordsField: function (data) {
|
||||
if (typeof data.keywords === 'string') {
|
||||
data.keywords = data.keywords.split(/,\s+/)
|
||||
}
|
||||
if (data.keywords && !Array.isArray(data.keywords)) {
|
||||
delete data.keywords
|
||||
this.warn('nonArrayKeywords')
|
||||
} else if (data.keywords) {
|
||||
data.keywords = data.keywords.filter(function (kw) {
|
||||
if (typeof kw !== 'string' || !kw) {
|
||||
this.warn('nonStringKeyword')
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
},
|
||||
|
||||
fixVersionField: function (data, strict) {
|
||||
// allow "loose" semver 1.0 versions in non-strict mode
|
||||
// enforce strict semver 2.0 compliance in strict mode
|
||||
var loose = !strict
|
||||
if (!data.version) {
|
||||
data.version = ''
|
||||
return true
|
||||
}
|
||||
if (!isValidSemver(data.version, loose)) {
|
||||
throw new Error('Invalid version: "' + data.version + '"')
|
||||
}
|
||||
data.version = cleanSemver(data.version, loose)
|
||||
return true
|
||||
},
|
||||
|
||||
fixPeople: function (data) {
|
||||
modifyPeople(data, unParsePerson)
|
||||
modifyPeople(data, parsePerson)
|
||||
},
|
||||
|
||||
fixNameField: function (data, options) {
|
||||
if (typeof options === 'boolean') {
|
||||
options = {strict: options}
|
||||
} else if (typeof options === 'undefined') {
|
||||
options = {}
|
||||
}
|
||||
var strict = options.strict
|
||||
if (!data.name && !strict) {
|
||||
data.name = ''
|
||||
return
|
||||
}
|
||||
if (typeof data.name !== 'string') {
|
||||
throw new Error('name field must be a string.')
|
||||
}
|
||||
if (!strict) {
|
||||
data.name = data.name.trim()
|
||||
}
|
||||
ensureValidName(data.name, strict, options.allowLegacyCase)
|
||||
if (isBuiltinModule(data.name)) {
|
||||
this.warn('conflictingName', data.name)
|
||||
}
|
||||
},
|
||||
|
||||
fixDescriptionField: function (data) {
|
||||
if (data.description && typeof data.description !== 'string') {
|
||||
this.warn('nonStringDescription')
|
||||
delete data.description
|
||||
}
|
||||
if (data.readme && !data.description) {
|
||||
data.description = extractDescription(data.readme)
|
||||
}
|
||||
if (data.description === undefined) {
|
||||
delete data.description
|
||||
}
|
||||
if (!data.description) {
|
||||
this.warn('missingDescription')
|
||||
}
|
||||
},
|
||||
|
||||
fixReadmeField: function (data) {
|
||||
if (!data.readme) {
|
||||
this.warn('missingReadme')
|
||||
data.readme = 'ERROR: No README data found!'
|
||||
}
|
||||
},
|
||||
|
||||
fixBugsField: function (data) {
|
||||
if (!data.bugs && data.repository && data.repository.url) {
|
||||
var hosted = hostedGitInfo.fromUrl(data.repository.url)
|
||||
if (hosted && hosted.bugs()) {
|
||||
data.bugs = {url: hosted.bugs()}
|
||||
}
|
||||
} else if (data.bugs) {
|
||||
var emailRe = /^.+@.*\..+$/
|
||||
if (typeof data.bugs === 'string') {
|
||||
if (emailRe.test(data.bugs)) {
|
||||
data.bugs = {email: data.bugs}
|
||||
/* eslint-disable-next-line node/no-deprecated-api */
|
||||
} else if (url.parse(data.bugs).protocol) {
|
||||
data.bugs = {url: data.bugs}
|
||||
} else {
|
||||
this.warn('nonEmailUrlBugsString')
|
||||
}
|
||||
} else {
|
||||
bugsTypos(data.bugs, this.warn)
|
||||
var oldBugs = data.bugs
|
||||
data.bugs = {}
|
||||
if (oldBugs.url) {
|
||||
/* eslint-disable-next-line node/no-deprecated-api */
|
||||
if (typeof (oldBugs.url) === 'string' && url.parse(oldBugs.url).protocol) {
|
||||
data.bugs.url = oldBugs.url
|
||||
} else {
|
||||
this.warn('nonUrlBugsUrlField')
|
||||
}
|
||||
}
|
||||
if (oldBugs.email) {
|
||||
if (typeof (oldBugs.email) === 'string' && emailRe.test(oldBugs.email)) {
|
||||
data.bugs.email = oldBugs.email
|
||||
} else {
|
||||
this.warn('nonEmailBugsEmailField')
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!data.bugs.email && !data.bugs.url) {
|
||||
delete data.bugs
|
||||
this.warn('emptyNormalizedBugs')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
fixHomepageField: function (data) {
|
||||
if (!data.homepage && data.repository && data.repository.url) {
|
||||
var hosted = hostedGitInfo.fromUrl(data.repository.url)
|
||||
if (hosted && hosted.docs()) {
|
||||
data.homepage = hosted.docs()
|
||||
}
|
||||
}
|
||||
if (!data.homepage) {
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof data.homepage !== 'string') {
|
||||
this.warn('nonUrlHomepage')
|
||||
return delete data.homepage
|
||||
}
|
||||
/* eslint-disable-next-line node/no-deprecated-api */
|
||||
if (!url.parse(data.homepage).protocol) {
|
||||
data.homepage = 'http://' + data.homepage
|
||||
}
|
||||
},
|
||||
|
||||
fixLicenseField: function (data) {
|
||||
const license = data.license || data.licence
|
||||
if (!license) {
|
||||
return this.warn('missingLicense')
|
||||
}
|
||||
if (
|
||||
typeof (license) !== 'string' ||
|
||||
license.length < 1 ||
|
||||
license.trim() === ''
|
||||
) {
|
||||
return this.warn('invalidLicense')
|
||||
}
|
||||
if (!validateLicense(license).validForNewPackages) {
|
||||
return this.warn('invalidLicense')
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function isValidScopedPackageName (spec) {
|
||||
if (spec.charAt(0) !== '@') {
|
||||
return false
|
||||
}
|
||||
|
||||
var 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 isCorrectlyEncodedName (spec) {
|
||||
return !spec.match(/[/@\s+%:]/) &&
|
||||
spec === encodeURIComponent(spec)
|
||||
}
|
||||
|
||||
function ensureValidName (name, strict, allowLegacyCase) {
|
||||
if (name.charAt(0) === '.' ||
|
||||
!(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) ||
|
||||
(strict && (!allowLegacyCase) && name !== name.toLowerCase()) ||
|
||||
name.toLowerCase() === 'node_modules' ||
|
||||
name.toLowerCase() === 'favicon.ico') {
|
||||
throw new Error('Invalid name: ' + JSON.stringify(name))
|
||||
}
|
||||
}
|
||||
|
||||
function modifyPeople (data, fn) {
|
||||
if (data.author) {
|
||||
data.author = fn(data.author)
|
||||
}['maintainers', 'contributors'].forEach(function (set) {
|
||||
if (!Array.isArray(data[set])) {
|
||||
return
|
||||
}
|
||||
data[set] = data[set].map(fn)
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
function unParsePerson (person) {
|
||||
if (typeof person === 'string') {
|
||||
return person
|
||||
}
|
||||
var name = person.name || ''
|
||||
var u = person.url || person.web
|
||||
var url = u ? (' (' + u + ')') : ''
|
||||
var e = person.email || person.mail
|
||||
var email = e ? (' <' + e + '>') : ''
|
||||
return name + email + url
|
||||
}
|
||||
|
||||
function parsePerson (person) {
|
||||
if (typeof person !== 'string') {
|
||||
return person
|
||||
}
|
||||
var name = person.match(/^([^(<]+)/)
|
||||
var url = person.match(/\(([^)]+)\)/)
|
||||
var email = person.match(/<([^>]+)>/)
|
||||
var obj = {}
|
||||
if (name && name[0].trim()) {
|
||||
obj.name = name[0].trim()
|
||||
}
|
||||
if (email) {
|
||||
obj.email = email[1]
|
||||
}
|
||||
if (url) {
|
||||
obj.url = url[1]
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
function addOptionalDepsToDeps (data, warn) {
|
||||
var o = data.optionalDependencies
|
||||
if (!o) {
|
||||
return
|
||||
}
|
||||
var d = data.dependencies || {}
|
||||
Object.keys(o).forEach(function (k) {
|
||||
d[k] = o[k]
|
||||
})
|
||||
data.dependencies = d
|
||||
}
|
||||
|
||||
function depObjectify (deps, type, warn) {
|
||||
if (!deps) {
|
||||
return {}
|
||||
}
|
||||
if (typeof deps === 'string') {
|
||||
deps = deps.trim().split(/[\n\r\s\t ,]+/)
|
||||
}
|
||||
if (!Array.isArray(deps)) {
|
||||
return deps
|
||||
}
|
||||
warn('deprecatedArrayDependencies', type)
|
||||
var o = {}
|
||||
deps.filter(function (d) {
|
||||
return typeof d === 'string'
|
||||
}).forEach(function (d) {
|
||||
d = d.trim().split(/(:?[@\s><=])/)
|
||||
var dn = d.shift()
|
||||
var dv = d.join('')
|
||||
dv = dv.trim()
|
||||
dv = dv.replace(/^@/, '')
|
||||
o[dn] = dv
|
||||
})
|
||||
return o
|
||||
}
|
||||
|
||||
function objectifyDeps (data, warn) {
|
||||
depTypes.forEach(function (type) {
|
||||
if (!data[type]) {
|
||||
return
|
||||
}
|
||||
data[type] = depObjectify(data[type], type, warn)
|
||||
})
|
||||
}
|
||||
|
||||
function bugsTypos (bugs, warn) {
|
||||
if (!bugs) {
|
||||
return
|
||||
}
|
||||
Object.keys(bugs).forEach(function (k) {
|
||||
if (typos.bugs[k]) {
|
||||
warn('typo', k, typos.bugs[k], 'bugs')
|
||||
bugs[typos.bugs[k]] = bugs[k]
|
||||
delete bugs[k]
|
||||
}
|
||||
})
|
||||
}
|
22
node_modules/normalize-package-data/lib/make_warning.js
generated
vendored
Normal file
22
node_modules/normalize-package-data/lib/make_warning.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
var util = require('util')
|
||||
var messages = require('./warning_messages.json')
|
||||
|
||||
module.exports = function () {
|
||||
var args = Array.prototype.slice.call(arguments, 0)
|
||||
var warningName = args.shift()
|
||||
if (warningName === 'typo') {
|
||||
return makeTypoWarning.apply(null, args)
|
||||
} else {
|
||||
var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'"
|
||||
args.unshift(msgTemplate)
|
||||
return util.format.apply(null, args)
|
||||
}
|
||||
}
|
||||
|
||||
function makeTypoWarning (providedName, probableName, field) {
|
||||
if (field) {
|
||||
providedName = field + "['" + providedName + "']"
|
||||
probableName = field + "['" + probableName + "']"
|
||||
}
|
||||
return util.format(messages.typo, providedName, probableName)
|
||||
}
|
48
node_modules/normalize-package-data/lib/normalize.js
generated
vendored
Normal file
48
node_modules/normalize-package-data/lib/normalize.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
module.exports = normalize
|
||||
|
||||
var fixer = require('./fixer')
|
||||
normalize.fixer = fixer
|
||||
|
||||
var makeWarning = require('./make_warning')
|
||||
|
||||
var fieldsToFix = ['name', 'version', 'description', 'repository', 'modules', 'scripts',
|
||||
'files', 'bin', 'man', 'bugs', 'keywords', 'readme', 'homepage', 'license']
|
||||
var otherThingsToFix = ['dependencies', 'people', 'typos']
|
||||
|
||||
var thingsToFix = fieldsToFix.map(function (fieldName) {
|
||||
return ucFirst(fieldName) + 'Field'
|
||||
})
|
||||
// two ways to do this in CoffeeScript on only one line, sub-70 chars:
|
||||
// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field"
|
||||
// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix)
|
||||
thingsToFix = thingsToFix.concat(otherThingsToFix)
|
||||
|
||||
function normalize (data, warn, strict) {
|
||||
if (warn === true) {
|
||||
warn = null
|
||||
strict = true
|
||||
}
|
||||
if (!strict) {
|
||||
strict = false
|
||||
}
|
||||
if (!warn || data.private) {
|
||||
warn = function (msg) { /* noop */ }
|
||||
}
|
||||
|
||||
if (data.scripts &&
|
||||
data.scripts.install === 'node-gyp rebuild' &&
|
||||
!data.scripts.preinstall) {
|
||||
data.gypfile = true
|
||||
}
|
||||
fixer.warn = function () {
|
||||
warn(makeWarning.apply(null, arguments))
|
||||
}
|
||||
thingsToFix.forEach(function (thingName) {
|
||||
fixer['fix' + ucFirst(thingName)](data, strict)
|
||||
})
|
||||
data._id = data.name + '@' + data.version
|
||||
}
|
||||
|
||||
function ucFirst (string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
||||
}
|
11
node_modules/normalize-package-data/lib/safe_format.js
generated
vendored
Normal file
11
node_modules/normalize-package-data/lib/safe_format.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var util = require('util')
|
||||
|
||||
module.exports = function () {
|
||||
var args = Array.prototype.slice.call(arguments, 0)
|
||||
args.forEach(function (arg) {
|
||||
if (!arg) {
|
||||
throw new TypeError('Bad arguments.')
|
||||
}
|
||||
})
|
||||
return util.format.apply(null, arguments)
|
||||
}
|
25
node_modules/normalize-package-data/lib/typos.json
generated
vendored
Normal file
25
node_modules/normalize-package-data/lib/typos.json
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"topLevel": {
|
||||
"dependancies": "dependencies"
|
||||
,"dependecies": "dependencies"
|
||||
,"depdenencies": "dependencies"
|
||||
,"devEependencies": "devDependencies"
|
||||
,"depends": "dependencies"
|
||||
,"dev-dependencies": "devDependencies"
|
||||
,"devDependences": "devDependencies"
|
||||
,"devDepenencies": "devDependencies"
|
||||
,"devdependencies": "devDependencies"
|
||||
,"repostitory": "repository"
|
||||
,"repo": "repository"
|
||||
,"prefereGlobal": "preferGlobal"
|
||||
,"hompage": "homepage"
|
||||
,"hampage": "homepage"
|
||||
,"autohr": "author"
|
||||
,"autor": "author"
|
||||
,"contributers": "contributors"
|
||||
,"publicationConfig": "publishConfig"
|
||||
,"script": "scripts"
|
||||
},
|
||||
"bugs": { "web": "url", "name": "url" },
|
||||
"script": { "server": "start", "tests": "test" }
|
||||
}
|
30
node_modules/normalize-package-data/lib/warning_messages.json
generated
vendored
Normal file
30
node_modules/normalize-package-data/lib/warning_messages.json
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"repositories": "'repositories' (plural) Not supported. Please pick one as the 'repository' field"
|
||||
,"missingRepository": "No repository field."
|
||||
,"brokenGitUrl": "Probably broken git url: %s"
|
||||
,"nonObjectScripts": "scripts must be an object"
|
||||
,"nonStringScript": "script values must be string commands"
|
||||
,"nonArrayFiles": "Invalid 'files' member"
|
||||
,"invalidFilename": "Invalid filename in 'files' list: %s"
|
||||
,"nonArrayBundleDependencies": "Invalid 'bundleDependencies' list. Must be array of package names"
|
||||
,"nonStringBundleDependency": "Invalid bundleDependencies member: %s"
|
||||
,"nonDependencyBundleDependency": "Non-dependency in bundleDependencies: %s"
|
||||
,"nonObjectDependencies": "%s field must be an object"
|
||||
,"nonStringDependency": "Invalid dependency: %s %s"
|
||||
,"deprecatedArrayDependencies": "specifying %s as array is deprecated"
|
||||
,"deprecatedModules": "modules field is deprecated"
|
||||
,"nonArrayKeywords": "keywords should be an array of strings"
|
||||
,"nonStringKeyword": "keywords should be an array of strings"
|
||||
,"conflictingName": "%s is also the name of a node core module."
|
||||
,"nonStringDescription": "'description' field should be a string"
|
||||
,"missingDescription": "No description"
|
||||
,"missingReadme": "No README data"
|
||||
,"missingLicense": "No license field."
|
||||
,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}"
|
||||
,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted."
|
||||
,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted."
|
||||
,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted."
|
||||
,"nonUrlHomepage": "homepage field must be a string url. Deleted."
|
||||
,"invalidLicense": "license should be a valid SPDX license expression"
|
||||
,"typo": "%s should probably be %s."
|
||||
}
|
12
node_modules/normalize-package-data/node_modules/.bin/semver
generated
vendored
Normal file
12
node_modules/normalize-package-data/node_modules/.bin/semver
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../semver/bin/semver.js" "$@"
|
||||
fi
|
17
node_modules/normalize-package-data/node_modules/.bin/semver.cmd
generated
vendored
Normal file
17
node_modules/normalize-package-data/node_modules/.bin/semver.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %*
|
28
node_modules/normalize-package-data/node_modules/.bin/semver.ps1
generated
vendored
Normal file
28
node_modules/normalize-package-data/node_modules/.bin/semver.ps1
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
15
node_modules/normalize-package-data/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
15
node_modules/normalize-package-data/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
@@ -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.
|
166
node_modules/normalize-package-data/node_modules/lru-cache/README.md
generated
vendored
Normal file
166
node_modules/normalize-package-data/node_modules/lru-cache/README.md
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
# lru cache
|
||||
|
||||
A cache object that deletes the least-recently-used items.
|
||||
|
||||
[](https://travis-ci.org/isaacs/node-lru-cache) [](https://coveralls.io/github/isaacs/node-lru-cache)
|
||||
|
||||
## Installation:
|
||||
|
||||
```javascript
|
||||
npm install lru-cache --save
|
||||
```
|
||||
|
||||
## Usage:
|
||||
|
||||
```javascript
|
||||
var LRU = require("lru-cache")
|
||||
, options = { max: 500
|
||||
, length: function (n, key) { return n * 2 + key.length }
|
||||
, dispose: function (key, n) { n.close() }
|
||||
, maxAge: 1000 * 60 * 60 }
|
||||
, cache = new LRU(options)
|
||||
, otherCache = new LRU(50) // sets just the max size
|
||||
|
||||
cache.set("key", "value")
|
||||
cache.get("key") // "value"
|
||||
|
||||
// non-string keys ARE fully supported
|
||||
// but note that it must be THE SAME object, not
|
||||
// just a JSON-equivalent object.
|
||||
var someObject = { a: 1 }
|
||||
cache.set(someObject, 'a value')
|
||||
// Object keys are not toString()-ed
|
||||
cache.set('[object Object]', 'a different value')
|
||||
assert.equal(cache.get(someObject), 'a value')
|
||||
// A similar object with same keys/values won't work,
|
||||
// because it's a different object identity
|
||||
assert.equal(cache.get({ a: 1 }), undefined)
|
||||
|
||||
cache.reset() // empty the cache
|
||||
```
|
||||
|
||||
If you put more stuff in it, then items will fall out.
|
||||
|
||||
If you try to put an oversized thing in it, then it'll fall out right
|
||||
away.
|
||||
|
||||
## Options
|
||||
|
||||
* `max` The maximum size of the cache, checked by applying the length
|
||||
function to all values in the cache. Not setting this is kind of
|
||||
silly, since that's the whole purpose of this lib, but it defaults
|
||||
to `Infinity`. Setting it to a non-number or negative number will
|
||||
throw a `TypeError`. Setting it to 0 makes it be `Infinity`.
|
||||
* `maxAge` Maximum age in ms. Items are not pro-actively pruned out
|
||||
as they age, but if you try to get an item that is too old, it'll
|
||||
drop it and return undefined instead of giving it to you.
|
||||
Setting this to a negative value will make everything seem old!
|
||||
Setting it to a non-number will throw a `TypeError`.
|
||||
* `length` Function that is used to calculate the length of stored
|
||||
items. If you're storing strings or buffers, then you probably want
|
||||
to do something like `function(n, key){return n.length}`. The default is
|
||||
`function(){return 1}`, which is fine if you want to store `max`
|
||||
like-sized things. The item is passed as the first argument, and
|
||||
the key is passed as the second argumnet.
|
||||
* `dispose` Function that is called on items when they are dropped
|
||||
from the cache. This can be handy if you want to close file
|
||||
descriptors or do other cleanup tasks when items are no longer
|
||||
accessible. Called with `key, value`. It's called *before*
|
||||
actually removing the item from the internal cache, so if you want
|
||||
to immediately put it back in, you'll have to do that in a
|
||||
`nextTick` or `setTimeout` callback or it won't do anything.
|
||||
* `stale` By default, if you set a `maxAge`, it'll only actually pull
|
||||
stale items out of the cache when you `get(key)`. (That is, it's
|
||||
not pre-emptively doing a `setTimeout` or anything.) If you set
|
||||
`stale:true`, it'll return the stale value before deleting it. If
|
||||
you don't set this, then it'll return `undefined` when you try to
|
||||
get a stale entry, as if it had already been deleted.
|
||||
* `noDisposeOnSet` By default, if you set a `dispose()` method, then
|
||||
it'll be called whenever a `set()` operation overwrites an existing
|
||||
key. If you set this option, `dispose()` will only be called when a
|
||||
key falls out of the cache, not when it is overwritten.
|
||||
* `updateAgeOnGet` When using time-expiring entries with `maxAge`,
|
||||
setting this to `true` will make each item's effective time update
|
||||
to the current time whenever it is retrieved from cache, causing it
|
||||
to not expire. (It can still fall out of cache based on recency of
|
||||
use, of course.)
|
||||
|
||||
## API
|
||||
|
||||
* `set(key, value, maxAge)`
|
||||
* `get(key) => value`
|
||||
|
||||
Both of these will update the "recently used"-ness of the key.
|
||||
They do what you think. `maxAge` is optional and overrides the
|
||||
cache `maxAge` option if provided.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
The key and val can be any value.
|
||||
|
||||
* `peek(key)`
|
||||
|
||||
Returns the key value (or `undefined` if not found) without
|
||||
updating the "recently used"-ness of the key.
|
||||
|
||||
(If you find yourself using this a lot, you *might* be using the
|
||||
wrong sort of data structure, but there are some use cases where
|
||||
it's handy.)
|
||||
|
||||
* `del(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
* `reset()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
* `has(key)`
|
||||
|
||||
Check if a key is in the cache, without updating the recent-ness
|
||||
or deleting it for being stale.
|
||||
|
||||
* `forEach(function(value,key,cache), [thisp])`
|
||||
|
||||
Just like `Array.prototype.forEach`. Iterates over all the keys
|
||||
in the cache, in order of recent-ness. (Ie, more recently used
|
||||
items are iterated over first.)
|
||||
|
||||
* `rforEach(function(value,key,cache), [thisp])`
|
||||
|
||||
The same as `cache.forEach(...)` but items are iterated over in
|
||||
reverse order. (ie, less recently used items are iterated over
|
||||
first.)
|
||||
|
||||
* `keys()`
|
||||
|
||||
Return an array of the keys in the cache.
|
||||
|
||||
* `values()`
|
||||
|
||||
Return an array of the values in the cache.
|
||||
|
||||
* `length`
|
||||
|
||||
Return total length of objects in cache taking into account
|
||||
`length` options function.
|
||||
|
||||
* `itemCount`
|
||||
|
||||
Return total quantity of objects currently in cache. Note, that
|
||||
`stale` (see options) items are returned as part of this item
|
||||
count.
|
||||
|
||||
* `dump()`
|
||||
|
||||
Return an array of the cache entries ready for serialization and usage
|
||||
with 'destinationCache.load(arr)`.
|
||||
|
||||
* `load(cacheEntriesArray)`
|
||||
|
||||
Loads another cache entries array, obtained with `sourceCache.dump()`,
|
||||
into the cache. The destination cache is reset before loading new entries
|
||||
|
||||
* `prune()`
|
||||
|
||||
Manually iterates over the entire cache proactively pruning old entries
|
334
node_modules/normalize-package-data/node_modules/lru-cache/index.js
generated
vendored
Normal file
334
node_modules/normalize-package-data/node_modules/lru-cache/index.js
generated
vendored
Normal file
@@ -0,0 +1,334 @@
|
||||
'use strict'
|
||||
|
||||
// A linked list to keep track of recently-used-ness
|
||||
const Yallist = require('yallist')
|
||||
|
||||
const MAX = Symbol('max')
|
||||
const LENGTH = Symbol('length')
|
||||
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
|
||||
const ALLOW_STALE = Symbol('allowStale')
|
||||
const MAX_AGE = Symbol('maxAge')
|
||||
const DISPOSE = Symbol('dispose')
|
||||
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
|
||||
const LRU_LIST = Symbol('lruList')
|
||||
const CACHE = Symbol('cache')
|
||||
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
|
||||
|
||||
const naiveLength = () => 1
|
||||
|
||||
// lruList is a yallist where the head is the youngest
|
||||
// item, and the tail is the oldest. the list contains the Hit
|
||||
// objects as the entries.
|
||||
// Each Hit object has a reference to its Yallist.Node. This
|
||||
// never changes.
|
||||
//
|
||||
// cache is a Map (or PseudoMap) that matches the keys to
|
||||
// the Yallist.Node object.
|
||||
class LRUCache {
|
||||
constructor (options) {
|
||||
if (typeof options === 'number')
|
||||
options = { max: options }
|
||||
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
if (options.max && (typeof options.max !== 'number' || options.max < 0))
|
||||
throw new TypeError('max must be a non-negative number')
|
||||
// Kind of weird to have a default max of Infinity, but oh well.
|
||||
const max = this[MAX] = options.max || Infinity
|
||||
|
||||
const lc = options.length || naiveLength
|
||||
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
|
||||
this[ALLOW_STALE] = options.stale || false
|
||||
if (options.maxAge && typeof options.maxAge !== 'number')
|
||||
throw new TypeError('maxAge must be a number')
|
||||
this[MAX_AGE] = options.maxAge || 0
|
||||
this[DISPOSE] = options.dispose
|
||||
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
|
||||
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
|
||||
this.reset()
|
||||
}
|
||||
|
||||
// resize the cache when the max changes.
|
||||
set max (mL) {
|
||||
if (typeof mL !== 'number' || mL < 0)
|
||||
throw new TypeError('max must be a non-negative number')
|
||||
|
||||
this[MAX] = mL || Infinity
|
||||
trim(this)
|
||||
}
|
||||
get max () {
|
||||
return this[MAX]
|
||||
}
|
||||
|
||||
set allowStale (allowStale) {
|
||||
this[ALLOW_STALE] = !!allowStale
|
||||
}
|
||||
get allowStale () {
|
||||
return this[ALLOW_STALE]
|
||||
}
|
||||
|
||||
set maxAge (mA) {
|
||||
if (typeof mA !== 'number')
|
||||
throw new TypeError('maxAge must be a non-negative number')
|
||||
|
||||
this[MAX_AGE] = mA
|
||||
trim(this)
|
||||
}
|
||||
get maxAge () {
|
||||
return this[MAX_AGE]
|
||||
}
|
||||
|
||||
// resize the cache when the lengthCalculator changes.
|
||||
set lengthCalculator (lC) {
|
||||
if (typeof lC !== 'function')
|
||||
lC = naiveLength
|
||||
|
||||
if (lC !== this[LENGTH_CALCULATOR]) {
|
||||
this[LENGTH_CALCULATOR] = lC
|
||||
this[LENGTH] = 0
|
||||
this[LRU_LIST].forEach(hit => {
|
||||
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
|
||||
this[LENGTH] += hit.length
|
||||
})
|
||||
}
|
||||
trim(this)
|
||||
}
|
||||
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
|
||||
|
||||
get length () { return this[LENGTH] }
|
||||
get itemCount () { return this[LRU_LIST].length }
|
||||
|
||||
rforEach (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (let walker = this[LRU_LIST].tail; walker !== null;) {
|
||||
const prev = walker.prev
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
|
||||
forEach (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (let walker = this[LRU_LIST].head; walker !== null;) {
|
||||
const next = walker.next
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = next
|
||||
}
|
||||
}
|
||||
|
||||
keys () {
|
||||
return this[LRU_LIST].toArray().map(k => k.key)
|
||||
}
|
||||
|
||||
values () {
|
||||
return this[LRU_LIST].toArray().map(k => k.value)
|
||||
}
|
||||
|
||||
reset () {
|
||||
if (this[DISPOSE] &&
|
||||
this[LRU_LIST] &&
|
||||
this[LRU_LIST].length) {
|
||||
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
|
||||
}
|
||||
|
||||
this[CACHE] = new Map() // hash of items by key
|
||||
this[LRU_LIST] = new Yallist() // list of items in order of use recency
|
||||
this[LENGTH] = 0 // length of items in the list
|
||||
}
|
||||
|
||||
dump () {
|
||||
return this[LRU_LIST].map(hit =>
|
||||
isStale(this, hit) ? false : {
|
||||
k: hit.key,
|
||||
v: hit.value,
|
||||
e: hit.now + (hit.maxAge || 0)
|
||||
}).toArray().filter(h => h)
|
||||
}
|
||||
|
||||
dumpLru () {
|
||||
return this[LRU_LIST]
|
||||
}
|
||||
|
||||
set (key, value, maxAge) {
|
||||
maxAge = maxAge || this[MAX_AGE]
|
||||
|
||||
if (maxAge && typeof maxAge !== 'number')
|
||||
throw new TypeError('maxAge must be a number')
|
||||
|
||||
const now = maxAge ? Date.now() : 0
|
||||
const len = this[LENGTH_CALCULATOR](value, key)
|
||||
|
||||
if (this[CACHE].has(key)) {
|
||||
if (len > this[MAX]) {
|
||||
del(this, this[CACHE].get(key))
|
||||
return false
|
||||
}
|
||||
|
||||
const node = this[CACHE].get(key)
|
||||
const item = node.value
|
||||
|
||||
// dispose of the old one before overwriting
|
||||
// split out into 2 ifs for better coverage tracking
|
||||
if (this[DISPOSE]) {
|
||||
if (!this[NO_DISPOSE_ON_SET])
|
||||
this[DISPOSE](key, item.value)
|
||||
}
|
||||
|
||||
item.now = now
|
||||
item.maxAge = maxAge
|
||||
item.value = value
|
||||
this[LENGTH] += len - item.length
|
||||
item.length = len
|
||||
this.get(key)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
const hit = new Entry(key, value, len, now, maxAge)
|
||||
|
||||
// oversized objects fall out of cache automatically.
|
||||
if (hit.length > this[MAX]) {
|
||||
if (this[DISPOSE])
|
||||
this[DISPOSE](key, value)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this[LENGTH] += hit.length
|
||||
this[LRU_LIST].unshift(hit)
|
||||
this[CACHE].set(key, this[LRU_LIST].head)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
has (key) {
|
||||
if (!this[CACHE].has(key)) return false
|
||||
const hit = this[CACHE].get(key).value
|
||||
return !isStale(this, hit)
|
||||
}
|
||||
|
||||
get (key) {
|
||||
return get(this, key, true)
|
||||
}
|
||||
|
||||
peek (key) {
|
||||
return get(this, key, false)
|
||||
}
|
||||
|
||||
pop () {
|
||||
const node = this[LRU_LIST].tail
|
||||
if (!node)
|
||||
return null
|
||||
|
||||
del(this, node)
|
||||
return node.value
|
||||
}
|
||||
|
||||
del (key) {
|
||||
del(this, this[CACHE].get(key))
|
||||
}
|
||||
|
||||
load (arr) {
|
||||
// reset the cache
|
||||
this.reset()
|
||||
|
||||
const now = Date.now()
|
||||
// A previous serialized cache has the most recent items first
|
||||
for (let l = arr.length - 1; l >= 0; l--) {
|
||||
const hit = arr[l]
|
||||
const expiresAt = hit.e || 0
|
||||
if (expiresAt === 0)
|
||||
// the item was created without expiration in a non aged cache
|
||||
this.set(hit.k, hit.v)
|
||||
else {
|
||||
const maxAge = expiresAt - now
|
||||
// dont add already expired items
|
||||
if (maxAge > 0) {
|
||||
this.set(hit.k, hit.v, maxAge)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prune () {
|
||||
this[CACHE].forEach((value, key) => get(this, key, false))
|
||||
}
|
||||
}
|
||||
|
||||
const get = (self, key, doUse) => {
|
||||
const node = self[CACHE].get(key)
|
||||
if (node) {
|
||||
const hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE])
|
||||
return undefined
|
||||
} else {
|
||||
if (doUse) {
|
||||
if (self[UPDATE_AGE_ON_GET])
|
||||
node.value.now = Date.now()
|
||||
self[LRU_LIST].unshiftNode(node)
|
||||
}
|
||||
}
|
||||
return hit.value
|
||||
}
|
||||
}
|
||||
|
||||
const isStale = (self, hit) => {
|
||||
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
|
||||
return false
|
||||
|
||||
const diff = Date.now() - hit.now
|
||||
return hit.maxAge ? diff > hit.maxAge
|
||||
: self[MAX_AGE] && (diff > self[MAX_AGE])
|
||||
}
|
||||
|
||||
const trim = self => {
|
||||
if (self[LENGTH] > self[MAX]) {
|
||||
for (let walker = self[LRU_LIST].tail;
|
||||
self[LENGTH] > self[MAX] && walker !== null;) {
|
||||
// We know that we're about to delete this one, and also
|
||||
// what the next least recently used key will be, so just
|
||||
// go ahead and set it now.
|
||||
const prev = walker.prev
|
||||
del(self, walker)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const del = (self, node) => {
|
||||
if (node) {
|
||||
const hit = node.value
|
||||
if (self[DISPOSE])
|
||||
self[DISPOSE](hit.key, hit.value)
|
||||
|
||||
self[LENGTH] -= hit.length
|
||||
self[CACHE].delete(hit.key)
|
||||
self[LRU_LIST].removeNode(node)
|
||||
}
|
||||
}
|
||||
|
||||
class Entry {
|
||||
constructor (key, value, length, now, maxAge) {
|
||||
this.key = key
|
||||
this.value = value
|
||||
this.length = length
|
||||
this.now = now
|
||||
this.maxAge = maxAge || 0
|
||||
}
|
||||
}
|
||||
|
||||
const forEachStep = (self, fn, node, thisp) => {
|
||||
let hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE])
|
||||
hit = undefined
|
||||
}
|
||||
if (hit)
|
||||
fn.call(thisp, hit.value, hit.key, self)
|
||||
}
|
||||
|
||||
module.exports = LRUCache
|
34
node_modules/normalize-package-data/node_modules/lru-cache/package.json
generated
vendored
Normal file
34
node_modules/normalize-package-data/node_modules/lru-cache/package.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "lru-cache",
|
||||
"description": "A cache object that deletes the least-recently-used items.",
|
||||
"version": "6.0.0",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me>",
|
||||
"keywords": [
|
||||
"mru",
|
||||
"lru",
|
||||
"cache"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags"
|
||||
},
|
||||
"main": "index.js",
|
||||
"repository": "git://github.com/isaacs/node-lru-cache.git",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"tap": "^14.10.7"
|
||||
},
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
}
|
15
node_modules/normalize-package-data/node_modules/semver/LICENSE
generated
vendored
Normal file
15
node_modules/normalize-package-data/node_modules/semver/LICENSE
generated
vendored
Normal file
@@ -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.
|
568
node_modules/normalize-package-data/node_modules/semver/README.md
generated
vendored
Normal file
568
node_modules/normalize-package-data/node_modules/semver/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
183
node_modules/normalize-package-data/node_modules/semver/bin/semver.js
generated
vendored
Normal file
183
node_modules/normalize-package-data/node_modules/semver/bin/semver.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
const argv = process.argv.slice(2)
|
||||
|
||||
let versions = []
|
||||
|
||||
const range = []
|
||||
|
||||
let inc = null
|
||||
|
||||
const version = require('../package.json').version
|
||||
|
||||
let loose = false
|
||||
|
||||
let includePrerelease = false
|
||||
|
||||
let coerce = false
|
||||
|
||||
let rtl = false
|
||||
|
||||
let identifier
|
||||
|
||||
const semver = require('../')
|
||||
|
||||
let reverse = false
|
||||
|
||||
let options = {}
|
||||
|
||||
const main = () => {
|
||||
if (!argv.length) {
|
||||
return help()
|
||||
}
|
||||
while (argv.length) {
|
||||
let a = argv.shift()
|
||||
const indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
const value = a.slice(indexOfEqualSign + 1)
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(value)
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '--rtl':
|
||||
rtl = true
|
||||
break
|
||||
case '--ltr':
|
||||
rtl = false
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
|
||||
|
||||
versions = versions.map((v) => {
|
||||
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
||||
}).filter((v) => {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) {
|
||||
return fail()
|
||||
}
|
||||
if (inc && (versions.length !== 1 || range.length)) {
|
||||
return failInc()
|
||||
}
|
||||
|
||||
for (let i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter((v) => {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) {
|
||||
return fail()
|
||||
}
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
const failInc = () => {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
const fail = () => process.exit(1)
|
||||
|
||||
const success = () => {
|
||||
const compare = reverse ? 'rcompare' : 'compare'
|
||||
versions.sort((a, b) => {
|
||||
return semver[compare](a, b, options)
|
||||
}).map((v) => {
|
||||
return semver.clean(v, options)
|
||||
}).map((v) => {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach((v, i, _) => {
|
||||
console.log(v)
|
||||
})
|
||||
}
|
||||
|
||||
const help = () => console.log(
|
||||
`SemVer ${version}
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.`)
|
||||
|
||||
main()
|
136
node_modules/normalize-package-data/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
136
node_modules/normalize-package-data/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
const ANY = Symbol('SemVer ANY')
|
||||
// hoisted class for cyclic dependency
|
||||
class Comparator {
|
||||
static get ANY () {
|
||||
return ANY
|
||||
}
|
||||
|
||||
constructor (comp, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (comp instanceof Comparator) {
|
||||
if (comp.loose === !!options.loose) {
|
||||
return comp
|
||||
} else {
|
||||
comp = comp.value
|
||||
}
|
||||
}
|
||||
|
||||
debug('comparator', comp, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.parse(comp)
|
||||
|
||||
if (this.semver === ANY) {
|
||||
this.value = ''
|
||||
} else {
|
||||
this.value = this.operator + this.semver.version
|
||||
}
|
||||
|
||||
debug('comp', this)
|
||||
}
|
||||
|
||||
parse (comp) {
|
||||
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
const m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid comparator: ${comp}`)
|
||||
}
|
||||
|
||||
this.operator = m[1] !== undefined ? m[1] : ''
|
||||
if (this.operator === '=') {
|
||||
this.operator = ''
|
||||
}
|
||||
|
||||
// if it literally is just '>' or '' then allow anything.
|
||||
if (!m[2]) {
|
||||
this.semver = ANY
|
||||
} else {
|
||||
this.semver = new SemVer(m[2], this.options.loose)
|
||||
}
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.value
|
||||
}
|
||||
|
||||
test (version) {
|
||||
debug('Comparator.test', version, this.options.loose)
|
||||
|
||||
if (this.semver === ANY || version === ANY) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.options)
|
||||
}
|
||||
|
||||
intersects (comp, options) {
|
||||
if (!(comp instanceof Comparator)) {
|
||||
throw new TypeError('a Comparator is required')
|
||||
}
|
||||
|
||||
if (!options || typeof options !== 'object') {
|
||||
options = {
|
||||
loose: !!options,
|
||||
includePrerelease: false,
|
||||
}
|
||||
}
|
||||
|
||||
if (this.operator === '') {
|
||||
if (this.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(comp.value, options).test(this.value)
|
||||
} else if (comp.operator === '') {
|
||||
if (comp.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(this.value, options).test(comp.semver)
|
||||
}
|
||||
|
||||
const sameDirectionIncreasing =
|
||||
(this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '>=' || comp.operator === '>')
|
||||
const sameDirectionDecreasing =
|
||||
(this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '<=' || comp.operator === '<')
|
||||
const sameSemVer = this.semver.version === comp.semver.version
|
||||
const differentDirectionsInclusive =
|
||||
(this.operator === '>=' || this.operator === '<=') &&
|
||||
(comp.operator === '>=' || comp.operator === '<=')
|
||||
const oppositeDirectionsLessThan =
|
||||
cmp(this.semver, '<', comp.semver, options) &&
|
||||
(this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '<=' || comp.operator === '<')
|
||||
const oppositeDirectionsGreaterThan =
|
||||
cmp(this.semver, '>', comp.semver, options) &&
|
||||
(this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '>=' || comp.operator === '>')
|
||||
|
||||
return (
|
||||
sameDirectionIncreasing ||
|
||||
sameDirectionDecreasing ||
|
||||
(sameSemVer && differentDirectionsInclusive) ||
|
||||
oppositeDirectionsLessThan ||
|
||||
oppositeDirectionsGreaterThan
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Comparator
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { re, t } = require('../internal/re')
|
||||
const cmp = require('../functions/cmp')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const Range = require('./range')
|
5
node_modules/normalize-package-data/node_modules/semver/classes/index.js
generated
vendored
Normal file
5
node_modules/normalize-package-data/node_modules/semver/classes/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
SemVer: require('./semver.js'),
|
||||
Range: require('./range.js'),
|
||||
Comparator: require('./comparator.js'),
|
||||
}
|
522
node_modules/normalize-package-data/node_modules/semver/classes/range.js
generated
vendored
Normal file
522
node_modules/normalize-package-data/node_modules/semver/classes/range.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
287
node_modules/normalize-package-data/node_modules/semver/classes/semver.js
generated
vendored
Normal file
287
node_modules/normalize-package-data/node_modules/semver/classes/semver.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
const debug = require('../internal/debug')
|
||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { compareIdentifiers } = require('../internal/identifiers')
|
||||
class SemVer {
|
||||
constructor (version, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === !!options.loose &&
|
||||
version.includePrerelease === !!options.includePrerelease) {
|
||||
return version
|
||||
} else {
|
||||
version = version.version
|
||||
}
|
||||
} else if (typeof version !== 'string') {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
throw new TypeError(
|
||||
`version is longer than ${MAX_LENGTH} characters`
|
||||
)
|
||||
}
|
||||
|
||||
debug('SemVer', version, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
// this isn't actually relevant for versions, but keep it so that we
|
||||
// don't run into trouble passing this.options around.
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
this.raw = version
|
||||
|
||||
// these are actually numbers
|
||||
this.major = +m[1]
|
||||
this.minor = +m[2]
|
||||
this.patch = +m[3]
|
||||
|
||||
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
||||
throw new TypeError('Invalid major version')
|
||||
}
|
||||
|
||||
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
||||
throw new TypeError('Invalid minor version')
|
||||
}
|
||||
|
||||
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
||||
throw new TypeError('Invalid patch version')
|
||||
}
|
||||
|
||||
// numberify any prerelease numeric ids
|
||||
if (!m[4]) {
|
||||
this.prerelease = []
|
||||
} else {
|
||||
this.prerelease = m[4].split('.').map((id) => {
|
||||
if (/^[0-9]+$/.test(id)) {
|
||||
const num = +id
|
||||
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
||||
return num
|
||||
}
|
||||
}
|
||||
return id
|
||||
})
|
||||
}
|
||||
|
||||
this.build = m[5] ? m[5].split('.') : []
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.version = `${this.major}.${this.minor}.${this.patch}`
|
||||
if (this.prerelease.length) {
|
||||
this.version += `-${this.prerelease.join('.')}`
|
||||
}
|
||||
return this.version
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.version
|
||||
}
|
||||
|
||||
compare (other) {
|
||||
debug('SemVer.compare', this.version, this.options, other)
|
||||
if (!(other instanceof SemVer)) {
|
||||
if (typeof other === 'string' && other === this.version) {
|
||||
return 0
|
||||
}
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
if (other.version === this.version) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other)
|
||||
}
|
||||
|
||||
compareMain (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
return (
|
||||
compareIdentifiers(this.major, other.major) ||
|
||||
compareIdentifiers(this.minor, other.minor) ||
|
||||
compareIdentifiers(this.patch, other.patch)
|
||||
)
|
||||
}
|
||||
|
||||
comparePre (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length) {
|
||||
return -1
|
||||
} else if (!this.prerelease.length && other.prerelease.length) {
|
||||
return 1
|
||||
} else if (!this.prerelease.length && !other.prerelease.length) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.prerelease[i]
|
||||
const b = other.prerelease[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
compareBuild (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.build[i]
|
||||
const b = other.build[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
inc (release, identifier) {
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor = 0
|
||||
this.major++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'preminor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0
|
||||
this.inc('patch', identifier)
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.inc('patch', identifier)
|
||||
}
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
|
||||
case 'major':
|
||||
// If this is a pre-major version, bump up to the same major version.
|
||||
// Otherwise increment major.
|
||||
// 1.0.0-5 bumps to 1.0.0
|
||||
// 1.1.0 bumps to 2.0.0
|
||||
if (
|
||||
this.minor !== 0 ||
|
||||
this.patch !== 0 ||
|
||||
this.prerelease.length === 0
|
||||
) {
|
||||
this.major++
|
||||
}
|
||||
this.minor = 0
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'minor':
|
||||
// If this is a pre-minor version, bump up to the same minor version.
|
||||
// Otherwise increment minor.
|
||||
// 1.2.0-5 bumps to 1.2.0
|
||||
// 1.2.1 bumps to 1.3.0
|
||||
if (this.patch !== 0 || this.prerelease.length === 0) {
|
||||
this.minor++
|
||||
}
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'patch':
|
||||
// If this is not a pre-release version, it will increment the patch.
|
||||
// If it is a pre-release it will bump up to the same patch version.
|
||||
// 1.2.0-5 patches to 1.2.0
|
||||
// 1.2.0 patches to 1.2.1
|
||||
if (this.prerelease.length === 0) {
|
||||
this.patch++
|
||||
}
|
||||
this.prerelease = []
|
||||
break
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.prerelease = [0]
|
||||
} else {
|
||||
let i = this.prerelease.length
|
||||
while (--i >= 0) {
|
||||
if (typeof this.prerelease[i] === 'number') {
|
||||
this.prerelease[i]++
|
||||
i = -2
|
||||
}
|
||||
}
|
||||
if (i === -1) {
|
||||
// didn't increment anything
|
||||
this.prerelease.push(0)
|
||||
}
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
||||
if (isNaN(this.prerelease[1])) {
|
||||
this.prerelease = [identifier, 0]
|
||||
}
|
||||
} else {
|
||||
this.prerelease = [identifier, 0]
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
throw new Error(`invalid increment argument: ${release}`)
|
||||
}
|
||||
this.format()
|
||||
this.raw = this.version
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SemVer
|
6
node_modules/normalize-package-data/node_modules/semver/functions/clean.js
generated
vendored
Normal file
6
node_modules/normalize-package-data/node_modules/semver/functions/clean.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
const parse = require('./parse')
|
||||
const clean = (version, options) => {
|
||||
const s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
||||
return s ? s.version : null
|
||||
}
|
||||
module.exports = clean
|
52
node_modules/normalize-package-data/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
52
node_modules/normalize-package-data/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
const eq = require('./eq')
|
||||
const neq = require('./neq')
|
||||
const gt = require('./gt')
|
||||
const gte = require('./gte')
|
||||
const lt = require('./lt')
|
||||
const lte = require('./lte')
|
||||
|
||||
const cmp = (a, op, b, loose) => {
|
||||
switch (op) {
|
||||
case '===':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a === b
|
||||
|
||||
case '!==':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a !== b
|
||||
|
||||
case '':
|
||||
case '=':
|
||||
case '==':
|
||||
return eq(a, b, loose)
|
||||
|
||||
case '!=':
|
||||
return neq(a, b, loose)
|
||||
|
||||
case '>':
|
||||
return gt(a, b, loose)
|
||||
|
||||
case '>=':
|
||||
return gte(a, b, loose)
|
||||
|
||||
case '<':
|
||||
return lt(a, b, loose)
|
||||
|
||||
case '<=':
|
||||
return lte(a, b, loose)
|
||||
|
||||
default:
|
||||
throw new TypeError(`Invalid operator: ${op}`)
|
||||
}
|
||||
}
|
||||
module.exports = cmp
|
52
node_modules/normalize-package-data/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
52
node_modules/normalize-package-data/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const parse = require('./parse')
|
||||
const { re, t } = require('../internal/re')
|
||||
|
||||
const coerce = (version, options) => {
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version === 'number') {
|
||||
version = String(version)
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
|
||||
let match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(re[t.COERCE])
|
||||
} else {
|
||||
// Find the right-most coercible string that does not share
|
||||
// a terminus with a more left-ward coercible string.
|
||||
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
||||
//
|
||||
// Walk through the string checking with a /g regexp
|
||||
// Manually set the index so as to pick up overlapping matches.
|
||||
// Stop when we get a match that ends at the string end, since no
|
||||
// coercible string can be more right-ward without the same terminus.
|
||||
let next
|
||||
while ((next = re[t.COERCERTL].exec(version)) &&
|
||||
(!match || match.index + match[0].length !== version.length)
|
||||
) {
|
||||
if (!match ||
|
||||
next.index + next[0].length !== match.index + match[0].length) {
|
||||
match = next
|
||||
}
|
||||
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
re[t.COERCERTL].lastIndex = -1
|
||||
}
|
||||
|
||||
if (match === null) {
|
||||
return null
|
||||
}
|
||||
|
||||
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
|
||||
}
|
||||
module.exports = coerce
|
7
node_modules/normalize-package-data/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
7
node_modules/normalize-package-data/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const compareBuild = (a, b, loose) => {
|
||||
const versionA = new SemVer(a, loose)
|
||||
const versionB = new SemVer(b, loose)
|
||||
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
||||
}
|
||||
module.exports = compareBuild
|
3
node_modules/normalize-package-data/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const compareLoose = (a, b) => compare(a, b, true)
|
||||
module.exports = compareLoose
|
5
node_modules/normalize-package-data/node_modules/semver/functions/compare.js
generated
vendored
Normal file
5
node_modules/normalize-package-data/node_modules/semver/functions/compare.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const compare = (a, b, loose) =>
|
||||
new SemVer(a, loose).compare(new SemVer(b, loose))
|
||||
|
||||
module.exports = compare
|
23
node_modules/normalize-package-data/node_modules/semver/functions/diff.js
generated
vendored
Normal file
23
node_modules/normalize-package-data/node_modules/semver/functions/diff.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
const parse = require('./parse')
|
||||
const eq = require('./eq')
|
||||
|
||||
const diff = (version1, version2) => {
|
||||
if (eq(version1, version2)) {
|
||||
return null
|
||||
} else {
|
||||
const v1 = parse(version1)
|
||||
const v2 = parse(version2)
|
||||
const hasPre = v1.prerelease.length || v2.prerelease.length
|
||||
const prefix = hasPre ? 'pre' : ''
|
||||
const defaultResult = hasPre ? 'prerelease' : ''
|
||||
for (const key in v1) {
|
||||
if (key === 'major' || key === 'minor' || key === 'patch') {
|
||||
if (v1[key] !== v2[key]) {
|
||||
return prefix + key
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultResult // may be undefined
|
||||
}
|
||||
}
|
||||
module.exports = diff
|
3
node_modules/normalize-package-data/node_modules/semver/functions/eq.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/eq.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const eq = (a, b, loose) => compare(a, b, loose) === 0
|
||||
module.exports = eq
|
3
node_modules/normalize-package-data/node_modules/semver/functions/gt.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/gt.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const gt = (a, b, loose) => compare(a, b, loose) > 0
|
||||
module.exports = gt
|
3
node_modules/normalize-package-data/node_modules/semver/functions/gte.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/gte.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const gte = (a, b, loose) => compare(a, b, loose) >= 0
|
||||
module.exports = gte
|
18
node_modules/normalize-package-data/node_modules/semver/functions/inc.js
generated
vendored
Normal file
18
node_modules/normalize-package-data/node_modules/semver/functions/inc.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const inc = (version, release, options, identifier) => {
|
||||
if (typeof (options) === 'string') {
|
||||
identifier = options
|
||||
options = undefined
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(
|
||||
version instanceof SemVer ? version.version : version,
|
||||
options
|
||||
).inc(release, identifier).version
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = inc
|
3
node_modules/normalize-package-data/node_modules/semver/functions/lt.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/lt.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const lt = (a, b, loose) => compare(a, b, loose) < 0
|
||||
module.exports = lt
|
3
node_modules/normalize-package-data/node_modules/semver/functions/lte.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/lte.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const lte = (a, b, loose) => compare(a, b, loose) <= 0
|
||||
module.exports = lte
|
3
node_modules/normalize-package-data/node_modules/semver/functions/major.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/major.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const major = (a, loose) => new SemVer(a, loose).major
|
||||
module.exports = major
|
3
node_modules/normalize-package-data/node_modules/semver/functions/minor.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/minor.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const minor = (a, loose) => new SemVer(a, loose).minor
|
||||
module.exports = minor
|
3
node_modules/normalize-package-data/node_modules/semver/functions/neq.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/neq.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const neq = (a, b, loose) => compare(a, b, loose) !== 0
|
||||
module.exports = neq
|
33
node_modules/normalize-package-data/node_modules/semver/functions/parse.js
generated
vendored
Normal file
33
node_modules/normalize-package-data/node_modules/semver/functions/parse.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
const { MAX_LENGTH } = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const parse = (version, options) => {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
return null
|
||||
}
|
||||
|
||||
const r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(version, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parse
|
3
node_modules/normalize-package-data/node_modules/semver/functions/patch.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/patch.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const patch = (a, loose) => new SemVer(a, loose).patch
|
||||
module.exports = patch
|
6
node_modules/normalize-package-data/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
6
node_modules/normalize-package-data/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
const parse = require('./parse')
|
||||
const prerelease = (version, options) => {
|
||||
const parsed = parse(version, options)
|
||||
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
||||
}
|
||||
module.exports = prerelease
|
3
node_modules/normalize-package-data/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compare = require('./compare')
|
||||
const rcompare = (a, b, loose) => compare(b, a, loose)
|
||||
module.exports = rcompare
|
3
node_modules/normalize-package-data/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compareBuild = require('./compare-build')
|
||||
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
|
||||
module.exports = rsort
|
10
node_modules/normalize-package-data/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
10
node_modules/normalize-package-data/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
const Range = require('../classes/range')
|
||||
const satisfies = (version, range, options) => {
|
||||
try {
|
||||
range = new Range(range, options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
return range.test(version)
|
||||
}
|
||||
module.exports = satisfies
|
3
node_modules/normalize-package-data/node_modules/semver/functions/sort.js
generated
vendored
Normal file
3
node_modules/normalize-package-data/node_modules/semver/functions/sort.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const compareBuild = require('./compare-build')
|
||||
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
|
||||
module.exports = sort
|
6
node_modules/normalize-package-data/node_modules/semver/functions/valid.js
generated
vendored
Normal file
6
node_modules/normalize-package-data/node_modules/semver/functions/valid.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
const parse = require('./parse')
|
||||
const valid = (version, options) => {
|
||||
const v = parse(version, options)
|
||||
return v ? v.version : null
|
||||
}
|
||||
module.exports = valid
|
88
node_modules/normalize-package-data/node_modules/semver/index.js
generated
vendored
Normal file
88
node_modules/normalize-package-data/node_modules/semver/index.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
// just pre-load all the stuff that index.js lazily exports
|
||||
const internalRe = require('./internal/re')
|
||||
const constants = require('./internal/constants')
|
||||
const SemVer = require('./classes/semver')
|
||||
const identifiers = require('./internal/identifiers')
|
||||
const parse = require('./functions/parse')
|
||||
const valid = require('./functions/valid')
|
||||
const clean = require('./functions/clean')
|
||||
const inc = require('./functions/inc')
|
||||
const diff = require('./functions/diff')
|
||||
const major = require('./functions/major')
|
||||
const minor = require('./functions/minor')
|
||||
const patch = require('./functions/patch')
|
||||
const prerelease = require('./functions/prerelease')
|
||||
const compare = require('./functions/compare')
|
||||
const rcompare = require('./functions/rcompare')
|
||||
const compareLoose = require('./functions/compare-loose')
|
||||
const compareBuild = require('./functions/compare-build')
|
||||
const sort = require('./functions/sort')
|
||||
const rsort = require('./functions/rsort')
|
||||
const gt = require('./functions/gt')
|
||||
const lt = require('./functions/lt')
|
||||
const eq = require('./functions/eq')
|
||||
const neq = require('./functions/neq')
|
||||
const gte = require('./functions/gte')
|
||||
const lte = require('./functions/lte')
|
||||
const cmp = require('./functions/cmp')
|
||||
const coerce = require('./functions/coerce')
|
||||
const Comparator = require('./classes/comparator')
|
||||
const Range = require('./classes/range')
|
||||
const satisfies = require('./functions/satisfies')
|
||||
const toComparators = require('./ranges/to-comparators')
|
||||
const maxSatisfying = require('./ranges/max-satisfying')
|
||||
const minSatisfying = require('./ranges/min-satisfying')
|
||||
const minVersion = require('./ranges/min-version')
|
||||
const validRange = require('./ranges/valid')
|
||||
const outside = require('./ranges/outside')
|
||||
const gtr = require('./ranges/gtr')
|
||||
const ltr = require('./ranges/ltr')
|
||||
const intersects = require('./ranges/intersects')
|
||||
const simplifyRange = require('./ranges/simplify')
|
||||
const subset = require('./ranges/subset')
|
||||
module.exports = {
|
||||
parse,
|
||||
valid,
|
||||
clean,
|
||||
inc,
|
||||
diff,
|
||||
major,
|
||||
minor,
|
||||
patch,
|
||||
prerelease,
|
||||
compare,
|
||||
rcompare,
|
||||
compareLoose,
|
||||
compareBuild,
|
||||
sort,
|
||||
rsort,
|
||||
gt,
|
||||
lt,
|
||||
eq,
|
||||
neq,
|
||||
gte,
|
||||
lte,
|
||||
cmp,
|
||||
coerce,
|
||||
Comparator,
|
||||
Range,
|
||||
satisfies,
|
||||
toComparators,
|
||||
maxSatisfying,
|
||||
minSatisfying,
|
||||
minVersion,
|
||||
validRange,
|
||||
outside,
|
||||
gtr,
|
||||
ltr,
|
||||
intersects,
|
||||
simplifyRange,
|
||||
subset,
|
||||
SemVer,
|
||||
re: internalRe.re,
|
||||
src: internalRe.src,
|
||||
tokens: internalRe.t,
|
||||
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
||||
compareIdentifiers: identifiers.compareIdentifiers,
|
||||
rcompareIdentifiers: identifiers.rcompareIdentifiers,
|
||||
}
|
17
node_modules/normalize-package-data/node_modules/semver/internal/constants.js
generated
vendored
Normal file
17
node_modules/normalize-package-data/node_modules/semver/internal/constants.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Note: this is the semver.org version of the spec that it implements
|
||||
// Not necessarily the package version of this code.
|
||||
const SEMVER_SPEC_VERSION = '2.0.0'
|
||||
|
||||
const MAX_LENGTH = 256
|
||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
||||
/* istanbul ignore next */ 9007199254740991
|
||||
|
||||
// Max safe segment length for coercion.
|
||||
const MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
|
||||
module.exports = {
|
||||
SEMVER_SPEC_VERSION,
|
||||
MAX_LENGTH,
|
||||
MAX_SAFE_INTEGER,
|
||||
MAX_SAFE_COMPONENT_LENGTH,
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user