@min-pack/sharp-x86-64-v1 0.33.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +6 -0
- package/index.js +1 -0
- package/package.json +7 -0
- package/pkg/lib/channel.js +174 -0
- package/pkg/lib/colour.js +180 -0
- package/pkg/lib/composite.js +210 -0
- package/pkg/lib/constructor.js +452 -0
- package/pkg/lib/index.js +16 -0
- package/pkg/lib/input.js +658 -0
- package/pkg/lib/is.js +169 -0
- package/pkg/lib/libvips.js +203 -0
- package/pkg/lib/operation.js +958 -0
- package/pkg/lib/output.js +1587 -0
- package/pkg/lib/resize.js +587 -0
- package/pkg/lib/sharp.js +114 -0
- package/pkg/lib/utility.js +296 -0
- package/pkg/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +1 -0
- package/pkg/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.42 +0 -0
- package/pkg/node_modules/@img/sharp-libvips-linux-x64/package.json +42 -0
- package/pkg/node_modules/@img/sharp-libvips-linux-x64/versions.json +30 -0
- package/pkg/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +1 -0
- package/pkg/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.42 +0 -0
- package/pkg/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +42 -0
- package/pkg/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +30 -0
- package/pkg/node_modules/@img/sharp-linux-x64/LICENSE +191 -0
- package/pkg/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
- package/pkg/node_modules/@img/sharp-linux-x64/package.json +46 -0
- package/pkg/node_modules/@img/sharp-linuxmusl-x64/LICENSE +191 -0
- package/pkg/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
- package/pkg/node_modules/@img/sharp-linuxmusl-x64/package.json +46 -0
- package/pkg/node_modules/color/LICENSE +21 -0
- package/pkg/node_modules/color/index.js +496 -0
- package/pkg/node_modules/color/package.json +47 -0
- package/pkg/node_modules/color-convert/LICENSE +21 -0
- package/pkg/node_modules/color-convert/conversions.js +839 -0
- package/pkg/node_modules/color-convert/index.js +81 -0
- package/pkg/node_modules/color-convert/package.json +48 -0
- package/pkg/node_modules/color-convert/route.js +97 -0
- package/pkg/node_modules/color-name/LICENSE +8 -0
- package/pkg/node_modules/color-name/index.js +152 -0
- package/pkg/node_modules/color-name/package.json +28 -0
- package/pkg/node_modules/color-string/LICENSE +21 -0
- package/pkg/node_modules/color-string/index.js +242 -0
- package/pkg/node_modules/color-string/package.json +39 -0
- package/pkg/node_modules/detect-libc/LICENSE +201 -0
- package/pkg/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/pkg/node_modules/detect-libc/lib/elf.js +39 -0
- package/pkg/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/pkg/node_modules/detect-libc/lib/process.js +24 -0
- package/pkg/node_modules/detect-libc/package.json +44 -0
- package/pkg/node_modules/is-arrayish/LICENSE +21 -0
- package/pkg/node_modules/is-arrayish/index.js +9 -0
- package/pkg/node_modules/is-arrayish/package.json +45 -0
- package/pkg/node_modules/semver/LICENSE +15 -0
- package/pkg/node_modules/semver/bin/semver.js +191 -0
- package/pkg/node_modules/semver/classes/comparator.js +143 -0
- package/pkg/node_modules/semver/classes/index.js +7 -0
- package/pkg/node_modules/semver/classes/range.js +557 -0
- package/pkg/node_modules/semver/classes/semver.js +333 -0
- package/pkg/node_modules/semver/functions/clean.js +8 -0
- package/pkg/node_modules/semver/functions/cmp.js +54 -0
- package/pkg/node_modules/semver/functions/coerce.js +62 -0
- package/pkg/node_modules/semver/functions/compare-build.js +9 -0
- package/pkg/node_modules/semver/functions/compare-loose.js +5 -0
- package/pkg/node_modules/semver/functions/compare.js +7 -0
- package/pkg/node_modules/semver/functions/diff.js +60 -0
- package/pkg/node_modules/semver/functions/eq.js +5 -0
- package/pkg/node_modules/semver/functions/gt.js +5 -0
- package/pkg/node_modules/semver/functions/gte.js +5 -0
- package/pkg/node_modules/semver/functions/inc.js +21 -0
- package/pkg/node_modules/semver/functions/lt.js +5 -0
- package/pkg/node_modules/semver/functions/lte.js +5 -0
- package/pkg/node_modules/semver/functions/major.js +5 -0
- package/pkg/node_modules/semver/functions/minor.js +5 -0
- package/pkg/node_modules/semver/functions/neq.js +5 -0
- package/pkg/node_modules/semver/functions/parse.js +18 -0
- package/pkg/node_modules/semver/functions/patch.js +5 -0
- package/pkg/node_modules/semver/functions/prerelease.js +8 -0
- package/pkg/node_modules/semver/functions/rcompare.js +5 -0
- package/pkg/node_modules/semver/functions/rsort.js +5 -0
- package/pkg/node_modules/semver/functions/satisfies.js +12 -0
- package/pkg/node_modules/semver/functions/sort.js +5 -0
- package/pkg/node_modules/semver/functions/valid.js +8 -0
- package/pkg/node_modules/semver/index.js +91 -0
- package/pkg/node_modules/semver/internal/constants.js +37 -0
- package/pkg/node_modules/semver/internal/debug.js +11 -0
- package/pkg/node_modules/semver/internal/identifiers.js +29 -0
- package/pkg/node_modules/semver/internal/lrucache.js +42 -0
- package/pkg/node_modules/semver/internal/parse-options.js +17 -0
- package/pkg/node_modules/semver/internal/re.js +223 -0
- package/pkg/node_modules/semver/package.json +78 -0
- package/pkg/node_modules/semver/preload.js +4 -0
- package/pkg/node_modules/semver/range.bnf +16 -0
- package/pkg/node_modules/semver/ranges/gtr.js +6 -0
- package/pkg/node_modules/semver/ranges/intersects.js +9 -0
- package/pkg/node_modules/semver/ranges/ltr.js +6 -0
- package/pkg/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/pkg/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/pkg/node_modules/semver/ranges/min-version.js +63 -0
- package/pkg/node_modules/semver/ranges/outside.js +82 -0
- package/pkg/node_modules/semver/ranges/simplify.js +49 -0
- package/pkg/node_modules/semver/ranges/subset.js +249 -0
- package/pkg/node_modules/semver/ranges/to-comparators.js +10 -0
- package/pkg/node_modules/semver/ranges/valid.js +13 -0
- package/pkg/node_modules/simple-swizzle/LICENSE +21 -0
- package/pkg/node_modules/simple-swizzle/index.js +29 -0
- package/pkg/node_modules/simple-swizzle/package.json +36 -0
- package/pkg/package.json +24 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "detect-libc",
|
|
3
|
+
"version": "2.1.2",
|
|
4
|
+
"description": "Node.js module to detect the C standard library (libc) implementation family and version",
|
|
5
|
+
"main": "lib/detect-libc.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib/",
|
|
8
|
+
"index.d.ts"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "semistandard && nyc --reporter=text --check-coverage --branches=100 ava test/unit.js",
|
|
12
|
+
"changelog": "conventional-changelog -i CHANGELOG.md -s",
|
|
13
|
+
"bench": "node benchmark/detect-libc",
|
|
14
|
+
"bench:calls": "node benchmark/call-familySync.js && sleep 1 && node benchmark/call-isNonGlibcLinuxSync.js && sleep 1 && node benchmark/call-versionSync.js"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git://github.com/lovell/detect-libc.git"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"libc",
|
|
22
|
+
"glibc",
|
|
23
|
+
"musl"
|
|
24
|
+
],
|
|
25
|
+
"author": "Lovell Fuller <npm@lovell.info>",
|
|
26
|
+
"contributors": [
|
|
27
|
+
"Niklas Salmoukas <niklas@salmoukas.com>",
|
|
28
|
+
"Vinícius Lourenço <vinyygamerlol@gmail.com>"
|
|
29
|
+
],
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"ava": "^2.4.0",
|
|
33
|
+
"benchmark": "^2.1.4",
|
|
34
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
35
|
+
"eslint-config-standard": "^13.0.1",
|
|
36
|
+
"nyc": "^15.1.0",
|
|
37
|
+
"proxyquire": "^2.1.3",
|
|
38
|
+
"semistandard": "^14.2.3"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=8"
|
|
42
|
+
},
|
|
43
|
+
"types": "index.d.ts"
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 JD Ballard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module.exports = function isArrayish(obj) {
|
|
2
|
+
if (!obj || typeof obj === 'string') {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
return obj instanceof Array || Array.isArray(obj) ||
|
|
7
|
+
(obj.length >= 0 && (obj.splice instanceof Function ||
|
|
8
|
+
(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
|
|
9
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "is-arrayish",
|
|
3
|
+
"description": "Determines if an object can be used as an array",
|
|
4
|
+
"version": "0.3.4",
|
|
5
|
+
"author": "Qix (http://github.com/qix-)",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"is",
|
|
8
|
+
"array",
|
|
9
|
+
"duck",
|
|
10
|
+
"type",
|
|
11
|
+
"arrayish",
|
|
12
|
+
"similar",
|
|
13
|
+
"proto",
|
|
14
|
+
"prototype",
|
|
15
|
+
"type"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "mocha --require coffeescript/register ./test/**/*.coffee",
|
|
20
|
+
"lint": "zeit-eslint --ext .jsx,.js .",
|
|
21
|
+
"lint-staged": "git diff --diff-filter=ACMRT --cached --name-only '*.js' '*.jsx' | xargs zeit-eslint"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/qix-/node-is-arrayish.git"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@zeit/eslint-config-node": "^0.3.0",
|
|
29
|
+
"@zeit/git-hooks": "^0.1.4",
|
|
30
|
+
"coffeescript": "^2.3.1",
|
|
31
|
+
"coveralls": "^3.0.1",
|
|
32
|
+
"eslint": "^4.19.1",
|
|
33
|
+
"istanbul": "^0.4.5",
|
|
34
|
+
"mocha": "^5.2.0",
|
|
35
|
+
"should": "^13.2.1"
|
|
36
|
+
},
|
|
37
|
+
"eslintConfig": {
|
|
38
|
+
"extends": [
|
|
39
|
+
"@zeit/eslint-config-node"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"git": {
|
|
43
|
+
"pre-commit": "lint-staged"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Standalone semver comparison program.
|
|
3
|
+
// Exits successfully and prints matching version(s) if
|
|
4
|
+
// any supplied version is valid and passes all tests.
|
|
5
|
+
|
|
6
|
+
'use strict'
|
|
7
|
+
|
|
8
|
+
const argv = process.argv.slice(2)
|
|
9
|
+
|
|
10
|
+
let versions = []
|
|
11
|
+
|
|
12
|
+
const range = []
|
|
13
|
+
|
|
14
|
+
let inc = null
|
|
15
|
+
|
|
16
|
+
const version = require('../package.json').version
|
|
17
|
+
|
|
18
|
+
let loose = false
|
|
19
|
+
|
|
20
|
+
let includePrerelease = false
|
|
21
|
+
|
|
22
|
+
let coerce = false
|
|
23
|
+
|
|
24
|
+
let rtl = false
|
|
25
|
+
|
|
26
|
+
let identifier
|
|
27
|
+
|
|
28
|
+
let identifierBase
|
|
29
|
+
|
|
30
|
+
const semver = require('../')
|
|
31
|
+
const parseOptions = require('../internal/parse-options')
|
|
32
|
+
|
|
33
|
+
let reverse = false
|
|
34
|
+
|
|
35
|
+
let options = {}
|
|
36
|
+
|
|
37
|
+
const main = () => {
|
|
38
|
+
if (!argv.length) {
|
|
39
|
+
return help()
|
|
40
|
+
}
|
|
41
|
+
while (argv.length) {
|
|
42
|
+
let a = argv.shift()
|
|
43
|
+
const indexOfEqualSign = a.indexOf('=')
|
|
44
|
+
if (indexOfEqualSign !== -1) {
|
|
45
|
+
const value = a.slice(indexOfEqualSign + 1)
|
|
46
|
+
a = a.slice(0, indexOfEqualSign)
|
|
47
|
+
argv.unshift(value)
|
|
48
|
+
}
|
|
49
|
+
switch (a) {
|
|
50
|
+
case '-rv': case '-rev': case '--rev': case '--reverse':
|
|
51
|
+
reverse = true
|
|
52
|
+
break
|
|
53
|
+
case '-l': case '--loose':
|
|
54
|
+
loose = true
|
|
55
|
+
break
|
|
56
|
+
case '-p': case '--include-prerelease':
|
|
57
|
+
includePrerelease = true
|
|
58
|
+
break
|
|
59
|
+
case '-v': case '--version':
|
|
60
|
+
versions.push(argv.shift())
|
|
61
|
+
break
|
|
62
|
+
case '-i': case '--inc': case '--increment':
|
|
63
|
+
switch (argv[0]) {
|
|
64
|
+
case 'major': case 'minor': case 'patch': case 'prerelease':
|
|
65
|
+
case 'premajor': case 'preminor': case 'prepatch':
|
|
66
|
+
case 'release':
|
|
67
|
+
inc = argv.shift()
|
|
68
|
+
break
|
|
69
|
+
default:
|
|
70
|
+
inc = 'patch'
|
|
71
|
+
break
|
|
72
|
+
}
|
|
73
|
+
break
|
|
74
|
+
case '--preid':
|
|
75
|
+
identifier = argv.shift()
|
|
76
|
+
break
|
|
77
|
+
case '-r': case '--range':
|
|
78
|
+
range.push(argv.shift())
|
|
79
|
+
break
|
|
80
|
+
case '-n':
|
|
81
|
+
identifierBase = argv.shift()
|
|
82
|
+
if (identifierBase === 'false') {
|
|
83
|
+
identifierBase = false
|
|
84
|
+
}
|
|
85
|
+
break
|
|
86
|
+
case '-c': case '--coerce':
|
|
87
|
+
coerce = true
|
|
88
|
+
break
|
|
89
|
+
case '--rtl':
|
|
90
|
+
rtl = true
|
|
91
|
+
break
|
|
92
|
+
case '--ltr':
|
|
93
|
+
rtl = false
|
|
94
|
+
break
|
|
95
|
+
case '-h': case '--help': case '-?':
|
|
96
|
+
return help()
|
|
97
|
+
default:
|
|
98
|
+
versions.push(a)
|
|
99
|
+
break
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
options = parseOptions({ loose, includePrerelease, rtl })
|
|
104
|
+
|
|
105
|
+
versions = versions.map((v) => {
|
|
106
|
+
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
|
107
|
+
}).filter((v) => {
|
|
108
|
+
return semver.valid(v)
|
|
109
|
+
})
|
|
110
|
+
if (!versions.length) {
|
|
111
|
+
return fail()
|
|
112
|
+
}
|
|
113
|
+
if (inc && (versions.length !== 1 || range.length)) {
|
|
114
|
+
return failInc()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (let i = 0, l = range.length; i < l; i++) {
|
|
118
|
+
versions = versions.filter((v) => {
|
|
119
|
+
return semver.satisfies(v, range[i], options)
|
|
120
|
+
})
|
|
121
|
+
if (!versions.length) {
|
|
122
|
+
return fail()
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
versions
|
|
126
|
+
.sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
|
|
127
|
+
.map(v => semver.clean(v, options))
|
|
128
|
+
.map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
|
|
129
|
+
.forEach(v => console.log(v))
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const failInc = () => {
|
|
133
|
+
console.error('--inc can only be used on a single version with no range')
|
|
134
|
+
fail()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const fail = () => process.exit(1)
|
|
138
|
+
|
|
139
|
+
const help = () => console.log(
|
|
140
|
+
`SemVer ${version}
|
|
141
|
+
|
|
142
|
+
A JavaScript implementation of the https://semver.org/ specification
|
|
143
|
+
Copyright Isaac Z. Schlueter
|
|
144
|
+
|
|
145
|
+
Usage: semver [options] <version> [<version> [...]]
|
|
146
|
+
Prints valid versions sorted by SemVer precedence
|
|
147
|
+
|
|
148
|
+
Options:
|
|
149
|
+
-r --range <range>
|
|
150
|
+
Print versions that match the specified range.
|
|
151
|
+
|
|
152
|
+
-i --increment [<level>]
|
|
153
|
+
Increment a version by the specified level. Level can
|
|
154
|
+
be one of: major, minor, patch, premajor, preminor,
|
|
155
|
+
prepatch, prerelease, or release. Default level is 'patch'.
|
|
156
|
+
Only one version may be specified.
|
|
157
|
+
|
|
158
|
+
--preid <identifier>
|
|
159
|
+
Identifier to be used to prefix premajor, preminor,
|
|
160
|
+
prepatch or prerelease version increments.
|
|
161
|
+
|
|
162
|
+
-l --loose
|
|
163
|
+
Interpret versions and ranges loosely
|
|
164
|
+
|
|
165
|
+
-p --include-prerelease
|
|
166
|
+
Always include prerelease versions in range matching
|
|
167
|
+
|
|
168
|
+
-c --coerce
|
|
169
|
+
Coerce a string into SemVer if possible
|
|
170
|
+
(does not imply --loose)
|
|
171
|
+
|
|
172
|
+
--rtl
|
|
173
|
+
Coerce version strings right to left
|
|
174
|
+
|
|
175
|
+
--ltr
|
|
176
|
+
Coerce version strings left to right (default)
|
|
177
|
+
|
|
178
|
+
-n <base>
|
|
179
|
+
Base number to be used for the prerelease identifier.
|
|
180
|
+
Can be either 0 or 1, or false to omit the number altogether.
|
|
181
|
+
Defaults to 0.
|
|
182
|
+
|
|
183
|
+
Program exits successfully if any valid version satisfies
|
|
184
|
+
all supplied ranges, and prints all satisfying versions.
|
|
185
|
+
|
|
186
|
+
If no satisfying versions are found, then exits failure.
|
|
187
|
+
|
|
188
|
+
Versions are printed in ascending order, so supplying
|
|
189
|
+
multiple versions to the utility will just sort them.`)
|
|
190
|
+
|
|
191
|
+
main()
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const ANY = Symbol('SemVer ANY')
|
|
4
|
+
// hoisted class for cyclic dependency
|
|
5
|
+
class Comparator {
|
|
6
|
+
static get ANY () {
|
|
7
|
+
return ANY
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
constructor (comp, options) {
|
|
11
|
+
options = parseOptions(options)
|
|
12
|
+
|
|
13
|
+
if (comp instanceof Comparator) {
|
|
14
|
+
if (comp.loose === !!options.loose) {
|
|
15
|
+
return comp
|
|
16
|
+
} else {
|
|
17
|
+
comp = comp.value
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
comp = comp.trim().split(/\s+/).join(' ')
|
|
22
|
+
debug('comparator', comp, options)
|
|
23
|
+
this.options = options
|
|
24
|
+
this.loose = !!options.loose
|
|
25
|
+
this.parse(comp)
|
|
26
|
+
|
|
27
|
+
if (this.semver === ANY) {
|
|
28
|
+
this.value = ''
|
|
29
|
+
} else {
|
|
30
|
+
this.value = this.operator + this.semver.version
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
debug('comp', this)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
parse (comp) {
|
|
37
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
|
38
|
+
const m = comp.match(r)
|
|
39
|
+
|
|
40
|
+
if (!m) {
|
|
41
|
+
throw new TypeError(`Invalid comparator: ${comp}`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
this.operator = m[1] !== undefined ? m[1] : ''
|
|
45
|
+
if (this.operator === '=') {
|
|
46
|
+
this.operator = ''
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// if it literally is just '>' or '' then allow anything.
|
|
50
|
+
if (!m[2]) {
|
|
51
|
+
this.semver = ANY
|
|
52
|
+
} else {
|
|
53
|
+
this.semver = new SemVer(m[2], this.options.loose)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
toString () {
|
|
58
|
+
return this.value
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
test (version) {
|
|
62
|
+
debug('Comparator.test', version, this.options.loose)
|
|
63
|
+
|
|
64
|
+
if (this.semver === ANY || version === ANY) {
|
|
65
|
+
return true
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof version === 'string') {
|
|
69
|
+
try {
|
|
70
|
+
version = new SemVer(version, this.options)
|
|
71
|
+
} catch (er) {
|
|
72
|
+
return false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return cmp(version, this.operator, this.semver, this.options)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
intersects (comp, options) {
|
|
80
|
+
if (!(comp instanceof Comparator)) {
|
|
81
|
+
throw new TypeError('a Comparator is required')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (this.operator === '') {
|
|
85
|
+
if (this.value === '') {
|
|
86
|
+
return true
|
|
87
|
+
}
|
|
88
|
+
return new Range(comp.value, options).test(this.value)
|
|
89
|
+
} else if (comp.operator === '') {
|
|
90
|
+
if (comp.value === '') {
|
|
91
|
+
return true
|
|
92
|
+
}
|
|
93
|
+
return new Range(this.value, options).test(comp.semver)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
options = parseOptions(options)
|
|
97
|
+
|
|
98
|
+
// Special cases where nothing can possibly be lower
|
|
99
|
+
if (options.includePrerelease &&
|
|
100
|
+
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
|
101
|
+
return false
|
|
102
|
+
}
|
|
103
|
+
if (!options.includePrerelease &&
|
|
104
|
+
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
|
105
|
+
return false
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Same direction increasing (> or >=)
|
|
109
|
+
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
|
110
|
+
return true
|
|
111
|
+
}
|
|
112
|
+
// Same direction decreasing (< or <=)
|
|
113
|
+
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
|
114
|
+
return true
|
|
115
|
+
}
|
|
116
|
+
// same SemVer and both sides are inclusive (<= or >=)
|
|
117
|
+
if (
|
|
118
|
+
(this.semver.version === comp.semver.version) &&
|
|
119
|
+
this.operator.includes('=') && comp.operator.includes('=')) {
|
|
120
|
+
return true
|
|
121
|
+
}
|
|
122
|
+
// opposite directions less than
|
|
123
|
+
if (cmp(this.semver, '<', comp.semver, options) &&
|
|
124
|
+
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
|
125
|
+
return true
|
|
126
|
+
}
|
|
127
|
+
// opposite directions greater than
|
|
128
|
+
if (cmp(this.semver, '>', comp.semver, options) &&
|
|
129
|
+
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
|
130
|
+
return true
|
|
131
|
+
}
|
|
132
|
+
return false
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
module.exports = Comparator
|
|
137
|
+
|
|
138
|
+
const parseOptions = require('../internal/parse-options')
|
|
139
|
+
const { safeRe: re, t } = require('../internal/re')
|
|
140
|
+
const cmp = require('../functions/cmp')
|
|
141
|
+
const debug = require('../internal/debug')
|
|
142
|
+
const SemVer = require('./semver')
|
|
143
|
+
const Range = require('./range')
|