mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 21:14:45 +00:00
.
This commit is contained in:
parent
beb1329f9f
commit
2b95e76931
7736 changed files with 1874747 additions and 51184 deletions
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>
|
30
node_modules/normalize-package-data/LICENSE
generated
vendored
Normal file
30
node_modules/normalize-package-data/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
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 AUTHOR 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 AUTHOR 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.
|
106
node_modules/normalize-package-data/README.md
generated
vendored
Normal file
106
node_modules/normalize-package-data/README.md
generated
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
# 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` 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](http://opensource.org/licenses/MIT).
|
||||
Copyright (c) 2013 Meryn Stol
|
14
node_modules/normalize-package-data/lib/extract_description.js
generated
vendored
Normal file
14
node_modules/normalize-package-data/lib/extract_description.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
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()
|
||||
}
|
418
node_modules/normalize-package-data/lib/fixer.js
generated
vendored
Normal file
418
node_modules/normalize-package-data/lib/fixer.js
generated
vendored
Normal file
|
@ -0,0 +1,418 @@
|
|||
var semver = require("semver")
|
||||
var validateLicense = require('validate-npm-package-license');
|
||||
var hostedGitInfo = require("hosted-git-info")
|
||||
var isBuiltinModule = require("resolve").isCore
|
||||
var depTypes = ["dependencies","devDependencies","optionalDependencies"]
|
||||
var extractDescription = require("./extract_description")
|
||||
var url = require("url")
|
||||
var typos = require("./typos.json")
|
||||
|
||||
var fixer = 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 (data.hasOwnProperty(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 (!data.dependencies.hasOwnProperty(bd)) {
|
||||
this.warn("nonDependencyBundleDependency", bd)
|
||||
data.dependencies[bd] = "*"
|
||||
}
|
||||
return true
|
||||
}
|
||||
}, this)
|
||||
}
|
||||
}
|
||||
|
||||
, fixDependencies: function(data, strict) {
|
||||
var loose = !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 (!semver.valid(data.version, loose)) {
|
||||
throw new Error('Invalid version: "'+ data.version + '"')
|
||||
}
|
||||
data.version = semver.clean(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}
|
||||
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) {
|
||||
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
|
||||
}
|
||||
if(!url.parse(data.homepage).protocol) {
|
||||
data.homepage = "http://" + data.homepage
|
||||
}
|
||||
}
|
||||
|
||||
, fixLicenseField: function(data) {
|
||||
if (!data.license) {
|
||||
return this.warn("missingLicense")
|
||||
} else{
|
||||
if (
|
||||
typeof(data.license) !== 'string' ||
|
||||
data.license.length < 1 ||
|
||||
data.license.trim() === ''
|
||||
) {
|
||||
this.warn("invalidLicense")
|
||||
} else {
|
||||
if (!validateLicense(data.license).validForNewPackages)
|
||||
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]
|
||||
}
|
||||
})
|
||||
}
|
23
node_modules/normalize-package-data/lib/make_warning.js
generated
vendored
Normal file
23
node_modules/normalize-package-data/lib/make_warning.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
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)
|
||||
}
|
39
node_modules/normalize-package-data/lib/normalize.js
generated
vendored
Normal file
39
node_modules/normalize-package-data/lib/normalize.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
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);
|
||||
}
|
9
node_modules/normalize-package-data/lib/safe_format.js
generated
vendored
Normal file
9
node_modules/normalize-package-data/lib/safe_format.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
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."
|
||||
}
|
1
node_modules/normalize-package-data/node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/normalize-package-data/node_modules/.bin/semver
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../semver/bin/semver
|
39
node_modules/normalize-package-data/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
39
node_modules/normalize-package-data/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
# changes log
|
||||
|
||||
## 5.7
|
||||
|
||||
* Add `minVersion` method
|
||||
|
||||
## 5.6
|
||||
|
||||
* Move boolean `loose` param to an options object, with
|
||||
backwards-compatibility protection.
|
||||
* Add ability to opt out of special prerelease version handling with
|
||||
the `includePrerelease` option flag.
|
||||
|
||||
## 5.5
|
||||
|
||||
* Add version coercion capabilities
|
||||
|
||||
## 5.4
|
||||
|
||||
* Add intersection checking
|
||||
|
||||
## 5.3
|
||||
|
||||
* Add `minSatisfying` method
|
||||
|
||||
## 5.2
|
||||
|
||||
* Add `prerelease(v)` that returns prerelease components
|
||||
|
||||
## 5.1
|
||||
|
||||
* Add Backus-Naur for ranges
|
||||
* Remove excessively cute inspection methods
|
||||
|
||||
## 5.0
|
||||
|
||||
* Remove AMD/Browserified build artifacts
|
||||
* Fix ltr and gtr when using the `*` range
|
||||
* Fix for range `*` with a prerelease identifier
|
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.
|
411
node_modules/normalize-package-data/node_modules/semver/README.md
generated
vendored
Normal file
411
node_modules/normalize-package-data/node_modules/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,411 @@
|
|||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install --save semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
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)
|
||||
|
||||
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.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for the purpose of range
|
||||
matching) by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any version satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero digit in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can possibly match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the ranges comparators intersect
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver
|
||||
string to semver. It looks for the first digit in a string, and
|
||||
consumes all remaining characters which satisfy at least a partial semver
|
||||
(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters).
|
||||
Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).
|
||||
All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`).
|
||||
Only text which lacks digits will fail coercion (`version one` is not valid).
|
||||
The maximum length for any semver component considered for coercion is 16 characters;
|
||||
longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`).
|
||||
The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;
|
||||
higher value components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
160
node_modules/normalize-package-data/node_modules/semver/bin/semver
generated
vendored
Executable file
160
node_modules/normalize-package-data/node_modules/semver/bin/semver
generated
vendored
Executable file
|
@ -0,0 +1,160 @@
|
|||
#!/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.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
|
||||
var versions = []
|
||||
|
||||
var range = []
|
||||
|
||||
var inc = null
|
||||
|
||||
var version = require('../package.json').version
|
||||
|
||||
var loose = false
|
||||
|
||||
var includePrerelease = false
|
||||
|
||||
var coerce = false
|
||||
|
||||
var identifier
|
||||
|
||||
var semver = require('../semver')
|
||||
|
||||
var reverse = false
|
||||
|
||||
var options = {}
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(a.slice(indexOfEqualSign + 1))
|
||||
}
|
||||
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 '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v) || { version: v }).version : v
|
||||
}).filter(function (v) {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
|
||||
|
||||
for (var i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? 'rcompare' : 'compare'
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, options)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, options)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach(function (v, i, _) { console.log(v) })
|
||||
}
|
||||
|
||||
function 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)',
|
||||
'',
|
||||
'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.'
|
||||
].join('\n'))
|
||||
}
|
64
node_modules/normalize-package-data/node_modules/semver/package.json
generated
vendored
Normal file
64
node_modules/normalize-package-data/node_modules/semver/package.json
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"semver@5.7.0",
|
||||
"/Users/eric/repos/actions/setup-node"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "semver@5.7.0",
|
||||
"_id": "semver@5.7.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"_location": "/normalize-package-data/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "semver@5.7.0",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "5.7.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5.7.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/normalize-package-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||
"_spec": "5.7.0",
|
||||
"_where": "/Users/eric/repos/actions/setup-node",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^13.0.0-rc.18"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"range.bnf",
|
||||
"semver.js"
|
||||
],
|
||||
"homepage": "https://github.com/npm/node-semver#readme",
|
||||
"license": "ISC",
|
||||
"main": "semver.js",
|
||||
"name": "semver",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/node-semver.git"
|
||||
},
|
||||
"scripts": {
|
||||
"postpublish": "git push origin --all; git push origin --tags",
|
||||
"postversion": "npm publish",
|
||||
"preversion": "npm test",
|
||||
"test": "tap"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"version": "5.7.0"
|
||||
}
|
16
node_modules/normalize-package-data/node_modules/semver/range.bnf
generated
vendored
Normal file
16
node_modules/normalize-package-data/node_modules/semver/range.bnf
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
1483
node_modules/normalize-package-data/node_modules/semver/semver.js
generated
vendored
Normal file
1483
node_modules/normalize-package-data/node_modules/semver/semver.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
82
node_modules/normalize-package-data/package.json
generated
vendored
Normal file
82
node_modules/normalize-package-data/package.json
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"normalize-package-data@2.5.0",
|
||||
"/Users/eric/repos/actions/setup-node"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "normalize-package-data@2.5.0",
|
||||
"_id": "normalize-package-data@2.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
|
||||
"_location": "/normalize-package-data",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "normalize-package-data@2.5.0",
|
||||
"name": "normalize-package-data",
|
||||
"escapedName": "normalize-package-data",
|
||||
"rawSpec": "2.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/read-pkg",
|
||||
"/read-pkg-up/read-pkg"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
|
||||
"_spec": "2.5.0",
|
||||
"_where": "/Users/eric/repos/actions/setup-node",
|
||||
"author": {
|
||||
"name": "Meryn Stol",
|
||||
"email": "merynstol@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/normalize-package-data/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
{
|
||||
"name": "Meryn Stol",
|
||||
"email": "merynstol@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Robert Kowalski",
|
||||
"email": "rok@kowalski.gd"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"hosted-git-info": "^2.1.4",
|
||||
"resolve": "^1.10.0",
|
||||
"semver": "2 || 3 || 4 || 5",
|
||||
"validate-npm-package-license": "^3.0.1"
|
||||
},
|
||||
"description": "Normalizes data that can be found in package.json files.",
|
||||
"devDependencies": {
|
||||
"async": "^2.6.1",
|
||||
"tap": "^12.4.0",
|
||||
"underscore": "^1.8.3"
|
||||
},
|
||||
"files": [
|
||||
"lib/*.js",
|
||||
"lib/*.json",
|
||||
"AUTHORS"
|
||||
],
|
||||
"homepage": "https://github.com/npm/normalize-package-data#readme",
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "lib/normalize.js",
|
||||
"name": "normalize-package-data",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/npm/normalize-package-data.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "2.5.0"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue