mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 10:06:26 +00:00
Adding sign with google in NPM
This commit is contained in:
21
node_modules/simple-update-notifier/LICENSE
generated
vendored
Normal file
21
node_modules/simple-update-notifier/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Alex Brazier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
67
node_modules/simple-update-notifier/README.md
generated
vendored
Normal file
67
node_modules/simple-update-notifier/README.md
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# simple-update-notifier [](https://github.com/alexbrazier/simple-update-notifier/stargazers)
|
||||
|
||||
[](https://github.com/alexbrazier/simple-update-notifier/actions)
|
||||
[](https://www.npmjs.com/package/simple-update-notifier?activeTab=dependencies)
|
||||
[](https://www.npmjs.com/package/simple-update-notifier)
|
||||
[](https://bundlephobia.com/result?p=simple-update-notifier)
|
||||
[](https://www.npmjs.com/package/simple-update-notifier)
|
||||
[](./LICENSE)
|
||||
|
||||
Simple update notifier to check for npm updates for cli applications.
|
||||
|
||||
<img src="./.github/demo.png" alt="Demo in terminal showing an update is required">
|
||||
|
||||
Checks for updates for an npm module and outputs to the command line if there is one available. The result is cached for the specified time so it doesn't check every time the app runs.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install simple-update-notifier
|
||||
OR
|
||||
yarn add simple-update-notifier
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import updateNotifier from 'update-notifier';
|
||||
import packageJson from './package.json' assert { type: 'json' };
|
||||
|
||||
updateNotifier({ pkg: packageJson });
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
#### pkg
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### name
|
||||
|
||||
_Required_\
|
||||
Type: `string`
|
||||
|
||||
##### version
|
||||
|
||||
_Required_\
|
||||
Type: `string`
|
||||
|
||||
#### updateCheckInterval
|
||||
|
||||
Type: `number`\
|
||||
Default: `1000 * 60 * 60 * 24` _(1 day)_
|
||||
How often to check for updates.
|
||||
|
||||
#### shouldNotifyInNpmScript
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Allows notification to be shown when running as an npm script.
|
||||
|
||||
#### distTag
|
||||
|
||||
Type: `string`\
|
||||
Default: `'latest'`
|
||||
|
||||
Which [dist-tag](https://docs.npmjs.com/adding-dist-tags-to-packages) to use to find the latest version.
|
12
node_modules/simple-update-notifier/build/index.d.ts
generated
vendored
Normal file
12
node_modules/simple-update-notifier/build/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
interface IUpdate {
|
||||
pkg: {
|
||||
name: string;
|
||||
version: string;
|
||||
};
|
||||
updateCheckInterval?: number;
|
||||
shouldNotifyInNpmScript?: boolean;
|
||||
distTag?: string;
|
||||
alwaysRun?: boolean;
|
||||
}
|
||||
declare const simpleUpdateNotifier: (args: IUpdate) => Promise<void>;
|
||||
export { simpleUpdateNotifier as default };
|
202
node_modules/simple-update-notifier/build/index.js
generated
vendored
Normal file
202
node_modules/simple-update-notifier/build/index.js
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
'use strict';
|
||||
|
||||
var process$1 = require('process');
|
||||
var semver = require('semver');
|
||||
var os = require('os');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var https = require('https');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
var process__default = /*#__PURE__*/_interopDefaultLegacy(process$1);
|
||||
var semver__default = /*#__PURE__*/_interopDefaultLegacy(semver);
|
||||
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
||||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
||||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
||||
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
||||
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
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.
|
||||
***************************************************************************** */
|
||||
|
||||
function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
var packageJson = process__default["default"].env.npm_package_json;
|
||||
var userAgent = process__default["default"].env.npm_config_user_agent;
|
||||
var isNpm6 = Boolean(userAgent && userAgent.startsWith('npm'));
|
||||
var isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json'));
|
||||
var isNpm = isNpm6 || isNpm7;
|
||||
var isYarn = Boolean(userAgent && userAgent.startsWith('yarn'));
|
||||
var isNpmOrYarn = isNpm || isYarn;
|
||||
|
||||
var homeDirectory = os__default["default"].homedir();
|
||||
var configDir = process.env.XDG_CONFIG_HOME ||
|
||||
path__default["default"].join(homeDirectory, '.config', 'simple-update-notifier');
|
||||
var getConfigFile = function (packageName) {
|
||||
return path__default["default"].join(configDir, "".concat(packageName, ".json"));
|
||||
};
|
||||
var createConfigDir = function () {
|
||||
if (!fs__default["default"].existsSync(configDir)) {
|
||||
fs__default["default"].mkdirSync(configDir, { recursive: true });
|
||||
}
|
||||
};
|
||||
var getLastUpdate = function (packageName) {
|
||||
var configFile = getConfigFile(packageName);
|
||||
try {
|
||||
if (!fs__default["default"].existsSync(configFile)) {
|
||||
return undefined;
|
||||
}
|
||||
var file = JSON.parse(fs__default["default"].readFileSync(configFile, 'utf8'));
|
||||
return file.lastUpdateCheck;
|
||||
}
|
||||
catch (_a) {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
var saveLastUpdate = function (packageName) {
|
||||
var configFile = getConfigFile(packageName);
|
||||
fs__default["default"].writeFileSync(configFile, JSON.stringify({ lastUpdateCheck: new Date().getTime() }));
|
||||
};
|
||||
|
||||
var getDistVersion = function (packageName, distTag) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var url;
|
||||
return __generator(this, function (_a) {
|
||||
url = "https://registry.npmjs.org/-/package/".concat(packageName, "/dist-tags");
|
||||
return [2 /*return*/, new Promise(function (resolve, reject) {
|
||||
https__default["default"]
|
||||
.get(url, function (res) {
|
||||
var body = '';
|
||||
res.on('data', function (chunk) { return (body += chunk); });
|
||||
res.on('end', function () {
|
||||
try {
|
||||
var json = JSON.parse(body);
|
||||
var version = json[distTag];
|
||||
if (!version) {
|
||||
reject(new Error('Error getting version'));
|
||||
}
|
||||
resolve(version);
|
||||
}
|
||||
catch (_a) {
|
||||
reject(new Error('Could not parse version response'));
|
||||
}
|
||||
});
|
||||
})
|
||||
.on('error', function (err) { return reject(err); });
|
||||
})];
|
||||
});
|
||||
}); };
|
||||
|
||||
var hasNewVersion = function (_a) {
|
||||
var pkg = _a.pkg, _b = _a.updateCheckInterval, updateCheckInterval = _b === void 0 ? 1000 * 60 * 60 * 24 : _b, _c = _a.distTag, distTag = _c === void 0 ? 'latest' : _c, alwaysRun = _a.alwaysRun;
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var lastUpdateCheck, latestVersion;
|
||||
return __generator(this, function (_d) {
|
||||
switch (_d.label) {
|
||||
case 0:
|
||||
createConfigDir();
|
||||
lastUpdateCheck = getLastUpdate(pkg.name);
|
||||
if (!(alwaysRun ||
|
||||
!lastUpdateCheck ||
|
||||
lastUpdateCheck < new Date().getTime() - updateCheckInterval)) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, getDistVersion(pkg.name, distTag)];
|
||||
case 1:
|
||||
latestVersion = _d.sent();
|
||||
saveLastUpdate(pkg.name);
|
||||
if (semver__default["default"].gt(latestVersion, pkg.version)) {
|
||||
return [2 /*return*/, latestVersion];
|
||||
}
|
||||
return [2 /*return*/, false];
|
||||
case 2: return [2 /*return*/, false];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var borderedText = function (text) {
|
||||
var lines = text.split('\n');
|
||||
var width = Math.max.apply(Math, lines.map(function (l) { return l.length; }));
|
||||
var res = ["\u250C".concat('─'.repeat(width + 2), "\u2510")];
|
||||
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
|
||||
var line = lines_1[_i];
|
||||
res.push("\u2502 ".concat(line.padEnd(width), " \u2502"));
|
||||
}
|
||||
res.push("\u2514".concat('─'.repeat(width + 2), "\u2518"));
|
||||
return res.join('\n');
|
||||
};
|
||||
|
||||
var simpleUpdateNotifier = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var latestVersion;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
if (!args.alwaysRun &&
|
||||
(!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript))) {
|
||||
return [2 /*return*/];
|
||||
}
|
||||
_b.label = 1;
|
||||
case 1:
|
||||
_b.trys.push([1, 3, , 4]);
|
||||
return [4 /*yield*/, hasNewVersion(args)];
|
||||
case 2:
|
||||
latestVersion = _b.sent();
|
||||
if (latestVersion) {
|
||||
console.log(borderedText("New version of ".concat(args.pkg.name, " available!\nCurrent Version: ").concat(args.pkg.version, "\nLatest Version: ").concat(latestVersion)));
|
||||
}
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
_b.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); };
|
||||
|
||||
module.exports = simpleUpdateNotifier;
|
1
node_modules/simple-update-notifier/node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/simple-update-notifier/node_modules/.bin/semver
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
74
node_modules/simple-update-notifier/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
74
node_modules/simple-update-notifier/node_modules/semver/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# changes log
|
||||
|
||||
## 6.3.0
|
||||
|
||||
* Expose the token enum on the exports
|
||||
|
||||
## 6.2.0
|
||||
|
||||
* Coerce numbers to strings when passed to semver.coerce()
|
||||
* Add `rtl` option to coerce from right to left
|
||||
|
||||
## 6.1.3
|
||||
|
||||
* Handle X-ranges properly in includePrerelease mode
|
||||
|
||||
## 6.1.2
|
||||
|
||||
* Do not throw when testing invalid version strings
|
||||
|
||||
## 6.1.1
|
||||
|
||||
* Add options support for semver.coerce()
|
||||
* Handle undefined version passed to Range.test
|
||||
|
||||
## 6.1.0
|
||||
|
||||
* Add semver.compareBuild function
|
||||
* Support `*` in semver.intersects
|
||||
|
||||
## 6.0
|
||||
|
||||
* Fix `intersects` logic.
|
||||
|
||||
This is technically a bug fix, but since it is also a change to behavior
|
||||
that may require users updating their code, it is marked as a major
|
||||
version increment.
|
||||
|
||||
## 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/simple-update-notifier/node_modules/semver/LICENSE
generated
vendored
Normal file
15
node_modules/simple-update-notifier/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.
|
499
node_modules/simple-update-notifier/node_modules/semver/README.md
generated
vendored
Normal file
499
node_modules/simple-update-notifier/node_modules/semver/README.md
generated
vendored
Normal file
@ -0,0 +1,499 @@
|
||||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install 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)
|
||||
|
||||
--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.
|
||||
```
|
||||
|
||||
## 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 element 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()`.
|
||||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
|
||||
are equal. Sorts in ascending order if passed to `Array.sort()`.
|
||||
`v2` is greater. Sorts in ascending order if 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, options)`: 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 `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
|
||||
coercible tuple that does not share an ending index with a longer coercible
|
||||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
|
||||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
|
||||
any other overlapping SemVer tuple.
|
||||
|
||||
### Clean
|
||||
|
||||
* `clean(version)`: Clean a string to be a valid semver if possible
|
||||
|
||||
This will return a cleaned and trimmed semver version. If the provided
|
||||
version is not valid a null will be returned. This does not work for
|
||||
ranges.
|
||||
|
||||
ex.
|
||||
* `s.clean(' = v 2.1.5foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean(' = v 2.1.5-foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean('=v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' =v2.1.5')`: `2.1.5`
|
||||
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
|
||||
* `s.clean('~1.0.0')`: `null`
|
||||
|
||||
## Exported Modules
|
||||
|
||||
<!--
|
||||
TODO: Make sure that all of these items are documented (classes aren't,
|
||||
eg), and then pull the module name into the documentation for that specific
|
||||
thing.
|
||||
-->
|
||||
|
||||
You may pull in just the part of this semver utility that you need, if you
|
||||
are sensitive to packing and tree-shaking concerns. The main
|
||||
`require('semver')` export uses getter functions to lazily load the parts
|
||||
of the API that are used.
|
||||
|
||||
The following modules are available:
|
||||
|
||||
* `require('semver')`
|
||||
* `require('semver/classes')`
|
||||
* `require('semver/classes/comparator')`
|
||||
* `require('semver/classes/range')`
|
||||
* `require('semver/classes/semver')`
|
||||
* `require('semver/functions/clean')`
|
||||
* `require('semver/functions/cmp')`
|
||||
* `require('semver/functions/coerce')`
|
||||
* `require('semver/functions/compare')`
|
||||
* `require('semver/functions/compare-build')`
|
||||
* `require('semver/functions/compare-loose')`
|
||||
* `require('semver/functions/diff')`
|
||||
* `require('semver/functions/eq')`
|
||||
* `require('semver/functions/gt')`
|
||||
* `require('semver/functions/gte')`
|
||||
* `require('semver/functions/inc')`
|
||||
* `require('semver/functions/lt')`
|
||||
* `require('semver/functions/lte')`
|
||||
* `require('semver/functions/major')`
|
||||
* `require('semver/functions/minor')`
|
||||
* `require('semver/functions/neq')`
|
||||
* `require('semver/functions/parse')`
|
||||
* `require('semver/functions/patch')`
|
||||
* `require('semver/functions/prerelease')`
|
||||
* `require('semver/functions/rcompare')`
|
||||
* `require('semver/functions/rsort')`
|
||||
* `require('semver/functions/satisfies')`
|
||||
* `require('semver/functions/sort')`
|
||||
* `require('semver/functions/valid')`
|
||||
* `require('semver/ranges/gtr')`
|
||||
* `require('semver/ranges/intersects')`
|
||||
* `require('semver/ranges/ltr')`
|
||||
* `require('semver/ranges/max-satisfying')`
|
||||
* `require('semver/ranges/min-satisfying')`
|
||||
* `require('semver/ranges/min-version')`
|
||||
* `require('semver/ranges/outside')`
|
||||
* `require('semver/ranges/to-comparators')`
|
||||
* `require('semver/ranges/valid')`
|
173
node_modules/simple-update-notifier/node_modules/semver/bin/semver.js
generated
vendored
Executable file
173
node_modules/simple-update-notifier/node_modules/semver/bin/semver.js
generated
vendored
Executable file
@ -0,0 +1,173 @@
|
||||
#!/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
|
||||
|
||||
const options = {}
|
||||
|
||||
const main = () => {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
let a = argv.shift()
|
||||
const 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 '--rtl':
|
||||
rtl = true
|
||||
break
|
||||
case '--ltr':
|
||||
rtl = false
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const 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()
|
139
node_modules/simple-update-notifier/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
139
node_modules/simple-update-notifier/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
const ANY = Symbol('SemVer ANY')
|
||||
// hoisted class for cyclic dependency
|
||||
class Comparator {
|
||||
static get ANY () {
|
||||
return ANY
|
||||
}
|
||||
constructor (comp, options) {
|
||||
if (!options || typeof options !== 'object') {
|
||||
options = {
|
||||
loose: !!options,
|
||||
includePrerelease: false
|
||||
}
|
||||
}
|
||||
|
||||
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 {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/simple-update-notifier/node_modules/semver/classes/index.js
generated
vendored
Normal file
5
node_modules/simple-update-notifier/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')
|
||||
}
|
448
node_modules/simple-update-notifier/node_modules/semver/classes/range.js
generated
vendored
Normal file
448
node_modules/simple-update-notifier/node_modules/semver/classes/range.js
generated
vendored
Normal file
@ -0,0 +1,448 @@
|
||||
// hoisted class for cyclic dependency
|
||||
class Range {
|
||||
constructor (range, options) {
|
||||
if (!options || typeof options !== 'object') {
|
||||
options = {
|
||||
loose: !!options,
|
||||
includePrerelease: false
|
||||
}
|
||||
}
|
||||
|
||||
if (range instanceof Range) {
|
||||
if (
|
||||
range.loose === !!options.loose &&
|
||||
range.includePrerelease === !!options.includePrerelease
|
||||
) {
|
||||
return range
|
||||
} else {
|
||||
return new Range(range.raw, options)
|
||||
}
|
||||
}
|
||||
|
||||
if (range instanceof Comparator) {
|
||||
// just put it in the set and return
|
||||
this.raw = range.value
|
||||
this.set = [[range]]
|
||||
this.format()
|
||||
return this
|
||||
}
|
||||
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
// First, split based on boolean or ||
|
||||
this.raw = range
|
||||
this.set = range
|
||||
.split(/\s*\|\|\s*/)
|
||||
// map the range to a 2d array of comparators
|
||||
.map(range => this.parseRange(range.trim()))
|
||||
// throw out any comparator lists that are empty
|
||||
// this generally means that it was not a valid range, which is allowed
|
||||
// in loose mode, but will still throw if the WHOLE range is invalid.
|
||||
.filter(c => c.length)
|
||||
|
||||
if (!this.set.length) {
|
||||
throw new TypeError(`Invalid SemVer Range: ${range}`)
|
||||
}
|
||||
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.range = this.set
|
||||
.map((comps) => {
|
||||
return comps.join(' ').trim()
|
||||
})
|
||||
.join('||')
|
||||
.trim()
|
||||
return this.range
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.range
|
||||
}
|
||||
|
||||
parseRange (range) {
|
||||
const loose = this.options.loose
|
||||
range = range.trim()
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace)
|
||||
debug('hyphen replace', range)
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
|
||||
// normalize spaces
|
||||
range = range.split(/\s+/).join(' ')
|
||||
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
return range
|
||||
.split(' ')
|
||||
.map(comp => parseComparator(comp, this.options))
|
||||
.join(' ')
|
||||
.split(/\s+/)
|
||||
// in loose mode, throw out any that are not valid comparators
|
||||
.filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
|
||||
.map(comp => new Comparator(comp, this.options))
|
||||
}
|
||||
|
||||
intersects (range, options) {
|
||||
if (!(range instanceof Range)) {
|
||||
throw new TypeError('a Range is required')
|
||||
}
|
||||
|
||||
return this.set.some((thisComparators) => {
|
||||
return (
|
||||
isSatisfiable(thisComparators, options) &&
|
||||
range.set.some((rangeComparators) => {
|
||||
return (
|
||||
isSatisfiable(rangeComparators, options) &&
|
||||
thisComparators.every((thisComparator) => {
|
||||
return rangeComparators.every((rangeComparator) => {
|
||||
return thisComparator.intersects(rangeComparator, options)
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// if ANY of the sets match ALL of its comparators, then pass
|
||||
test (version) {
|
||||
if (!version) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version, this.options)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
module.exports = Range
|
||||
|
||||
const Comparator = require('./comparator')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const {
|
||||
re,
|
||||
t,
|
||||
comparatorTrimReplace,
|
||||
tildeTrimReplace,
|
||||
caretTrimReplace
|
||||
} = require('../internal/re')
|
||||
|
||||
// take a set of comparators and determine whether there
|
||||
// exists a version which can satisfy it
|
||||
const isSatisfiable = (comparators, options) => {
|
||||
let result = true
|
||||
const remainingComparators = comparators.slice()
|
||||
let testComparator = remainingComparators.pop()
|
||||
|
||||
while (result && remainingComparators.length) {
|
||||
result = remainingComparators.every((otherComparator) => {
|
||||
return testComparator.intersects(otherComparator, options)
|
||||
})
|
||||
|
||||
testComparator = remainingComparators.pop()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
||||
// already replaced the hyphen ranges
|
||||
// turn into a set of JUST comparators.
|
||||
const parseComparator = (comp, options) => {
|
||||
debug('comp', comp, options)
|
||||
comp = replaceCarets(comp, options)
|
||||
debug('caret', comp)
|
||||
comp = replaceTildes(comp, options)
|
||||
debug('tildes', comp)
|
||||
comp = replaceXRanges(comp, options)
|
||||
debug('xrange', comp)
|
||||
comp = replaceStars(comp, options)
|
||||
debug('stars', comp)
|
||||
return comp
|
||||
}
|
||||
|
||||
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
|
||||
|
||||
// ~, ~> --> * (any, kinda silly)
|
||||
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
||||
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
||||
const replaceTildes = (comp, options) =>
|
||||
comp.trim().split(/\s+/).map((comp) => {
|
||||
return replaceTilde(comp, options)
|
||||
}).join(' ')
|
||||
|
||||
const replaceTilde = (comp, options) => {
|
||||
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0 <${+M + 1}.0.0`
|
||||
} else if (isX(p)) {
|
||||
// ~1.2 == >=1.2.0 <1.3.0
|
||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0`
|
||||
} else if (pr) {
|
||||
debug('replaceTilde pr', pr)
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0`
|
||||
} else {
|
||||
// ~1.2.3 == >=1.2.3 <1.3.0
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${M}.${+m + 1}.0`
|
||||
}
|
||||
|
||||
debug('tilde return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// ^ --> * (any, kinda silly)
|
||||
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
||||
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
||||
// ^1.2.3 --> >=1.2.3 <2.0.0
|
||||
// ^1.2.0 --> >=1.2.0 <2.0.0
|
||||
const replaceCarets = (comp, options) =>
|
||||
comp.trim().split(/\s+/).map((comp) => {
|
||||
return replaceCaret(comp, options)
|
||||
}).join(' ')
|
||||
|
||||
const replaceCaret = (comp, options) => {
|
||||
debug('caret', comp, options)
|
||||
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0 <${+M + 1}.0.0`
|
||||
} else if (isX(p)) {
|
||||
if (M === '0') {
|
||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.0 <${+M + 1}.0.0`
|
||||
}
|
||||
} else if (pr) {
|
||||
debug('replaceCaret pr', pr)
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${m}.${+p + 1}`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${+M + 1}.0.0`
|
||||
}
|
||||
} else {
|
||||
debug('no pr')
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${M}.${m}.${+p + 1}`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${M}.${+m + 1}.0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${+M + 1}.0.0`
|
||||
}
|
||||
}
|
||||
|
||||
debug('caret return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
const replaceXRanges = (comp, options) => {
|
||||
debug('replaceXRanges', comp, options)
|
||||
return comp.split(/\s+/).map((comp) => {
|
||||
return replaceXRange(comp, options)
|
||||
}).join(' ')
|
||||
}
|
||||
|
||||
const replaceXRange = (comp, options) => {
|
||||
comp = comp.trim()
|
||||
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
const xM = isX(M)
|
||||
const xm = xM || isX(m)
|
||||
const xp = xm || isX(p)
|
||||
const anyX = xp
|
||||
|
||||
if (gtlt === '=' && anyX) {
|
||||
gtlt = ''
|
||||
}
|
||||
|
||||
// if we're including prereleases in the match, then we need
|
||||
// to fix this to -0, the lowest possible prerelease value
|
||||
pr = options.includePrerelease ? '-0' : ''
|
||||
|
||||
if (xM) {
|
||||
if (gtlt === '>' || gtlt === '<') {
|
||||
// nothing is allowed
|
||||
ret = '<0.0.0-0'
|
||||
} else {
|
||||
// nothing is forbidden
|
||||
ret = '*'
|
||||
}
|
||||
} else if (gtlt && anyX) {
|
||||
// we know patch is an x, because we have any x at all.
|
||||
// replace X with 0
|
||||
if (xm) {
|
||||
m = 0
|
||||
}
|
||||
p = 0
|
||||
|
||||
if (gtlt === '>') {
|
||||
// >1 => >=2.0.0
|
||||
// >1.2 => >=1.3.0
|
||||
gtlt = '>='
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
m = 0
|
||||
p = 0
|
||||
} else {
|
||||
m = +m + 1
|
||||
p = 0
|
||||
}
|
||||
} else if (gtlt === '<=') {
|
||||
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
||||
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
||||
gtlt = '<'
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
} else {
|
||||
m = +m + 1
|
||||
}
|
||||
}
|
||||
|
||||
ret = `${gtlt + M}.${m}.${p}${pr}`
|
||||
} else if (xm) {
|
||||
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0${pr}`
|
||||
} else if (xp) {
|
||||
ret = `>=${M}.${m}.0${pr
|
||||
} <${M}.${+m + 1}.0${pr}`
|
||||
}
|
||||
|
||||
debug('xRange return', ret)
|
||||
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// Because * is AND-ed with everything else in the comparator,
|
||||
// and '' means "any version", just remove the *s entirely.
|
||||
const replaceStars = (comp, options) => {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[t.STAR], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
// M, m, patch, prerelease, build
|
||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
||||
// 1.2 - 3.4 => >=1.2.0 <3.5.0
|
||||
const hyphenReplace = ($0,
|
||||
from, fM, fm, fp, fpr, fb,
|
||||
to, tM, tm, tp, tpr, tb) => {
|
||||
if (isX(fM)) {
|
||||
from = ''
|
||||
} else if (isX(fm)) {
|
||||
from = `>=${fM}.0.0`
|
||||
} else if (isX(fp)) {
|
||||
from = `>=${fM}.${fm}.0`
|
||||
} else {
|
||||
from = `>=${from}`
|
||||
}
|
||||
|
||||
if (isX(tM)) {
|
||||
to = ''
|
||||
} else if (isX(tm)) {
|
||||
to = `<${+tM + 1}.0.0`
|
||||
} else if (isX(tp)) {
|
||||
to = `<${tM}.${+tm + 1}.0`
|
||||
} else if (tpr) {
|
||||
to = `<=${tM}.${tm}.${tp}-${tpr}`
|
||||
} else {
|
||||
to = `<=${to}`
|
||||
}
|
||||
|
||||
return (`${from} ${to}`).trim()
|
||||
}
|
||||
|
||||
const testSet = (set, version, options) => {
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
if (!set[i].test(version)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (version.prerelease.length && !options.includePrerelease) {
|
||||
// Find the set of versions that are allowed to have prereleases
|
||||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
||||
// That should allow `1.2.3-pr.2` to pass.
|
||||
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
||||
// even though it's within the range set by the comparators.
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
debug(set[i].semver)
|
||||
if (set[i].semver === Comparator.ANY) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (set[i].semver.prerelease.length > 0) {
|
||||
const allowed = set[i].semver
|
||||
if (allowed.major === version.major &&
|
||||
allowed.minor === version.minor &&
|
||||
allowed.patch === version.patch) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Version has a -pre, but it's not one of the ones we like.
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
290
node_modules/simple-update-notifier/node_modules/semver/classes/semver.js
generated
vendored
Normal file
290
node_modules/simple-update-notifier/node_modules/semver/classes/semver.js
generated
vendored
Normal file
@ -0,0 +1,290 @@
|
||||
const debug = require('../internal/debug')
|
||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
|
||||
const { compareIdentifiers } = require('../internal/identifiers')
|
||||
class SemVer {
|
||||
constructor (version, options) {
|
||||
if (!options || typeof options !== 'object') {
|
||||
options = {
|
||||
loose: !!options,
|
||||
includePrerelease: false
|
||||
}
|
||||
}
|
||||
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 (this.prerelease[0] === identifier) {
|
||||
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/simple-update-notifier/node_modules/semver/functions/clean.js
generated
vendored
Normal file
6
node_modules/simple-update-notifier/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
|
48
node_modules/simple-update-notifier/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
48
node_modules/simple-update-notifier/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
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
|
51
node_modules/simple-update-notifier/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
51
node_modules/simple-update-notifier/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
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/simple-update-notifier/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
7
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/compare.js
generated
vendored
Normal file
5
node_modules/simple-update-notifier/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
|
25
node_modules/simple-update-notifier/node_modules/semver/functions/diff.js
generated
vendored
Normal file
25
node_modules/simple-update-notifier/node_modules/semver/functions/diff.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
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)
|
||||
let prefix = ''
|
||||
if (v1.prerelease.length || v2.prerelease.length) {
|
||||
prefix = 'pre'
|
||||
var defaultResult = '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/simple-update-notifier/node_modules/semver/functions/eq.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/gt.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/gte.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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
|
15
node_modules/simple-update-notifier/node_modules/semver/functions/inc.js
generated
vendored
Normal file
15
node_modules/simple-update-notifier/node_modules/semver/functions/inc.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const inc = (version, release, options, identifier) => {
|
||||
if (typeof (options) === 'string') {
|
||||
identifier = options
|
||||
options = undefined
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(version, options).inc(release, identifier).version
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = inc
|
3
node_modules/simple-update-notifier/node_modules/semver/functions/lt.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/lte.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/major.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/minor.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/neq.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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
|
37
node_modules/simple-update-notifier/node_modules/semver/functions/parse.js
generated
vendored
Normal file
37
node_modules/simple-update-notifier/node_modules/semver/functions/parse.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
const {MAX_LENGTH} = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const parse = (version, options) => {
|
||||
if (!options || typeof options !== 'object') {
|
||||
options = {
|
||||
loose: !!options,
|
||||
includePrerelease: false
|
||||
}
|
||||
}
|
||||
|
||||
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/simple-update-notifier/node_modules/semver/functions/patch.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
6
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
10
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/sort.js
generated
vendored
Normal file
3
node_modules/simple-update-notifier/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/simple-update-notifier/node_modules/semver/functions/valid.js
generated
vendored
Normal file
6
node_modules/simple-update-notifier/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
|
64
node_modules/simple-update-notifier/node_modules/semver/index.js
generated
vendored
Normal file
64
node_modules/simple-update-notifier/node_modules/semver/index.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
const lrCache = {}
|
||||
const lazyRequire = (path, subkey) => {
|
||||
const module = lrCache[path] || (lrCache[path] = require(path))
|
||||
return subkey ? module[subkey] : module
|
||||
}
|
||||
|
||||
const lazyExport = (key, path, subkey) => {
|
||||
Object.defineProperty(exports, key, {
|
||||
get: () => {
|
||||
const res = lazyRequire(path, subkey)
|
||||
Object.defineProperty(exports, key, {
|
||||
value: res,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
return res
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
})
|
||||
}
|
||||
|
||||
lazyExport('re', './internal/re', 're')
|
||||
lazyExport('src', './internal/re', 'src')
|
||||
lazyExport('tokens', './internal/re', 't')
|
||||
lazyExport('SEMVER_SPEC_VERSION', './internal/constants', 'SEMVER_SPEC_VERSION')
|
||||
lazyExport('SemVer', './classes/semver')
|
||||
lazyExport('compareIdentifiers', './internal/identifiers', 'compareIdentifiers')
|
||||
lazyExport('rcompareIdentifiers', './internal/identifiers', 'rcompareIdentifiers')
|
||||
lazyExport('parse', './functions/parse')
|
||||
lazyExport('valid', './functions/valid')
|
||||
lazyExport('clean', './functions/clean')
|
||||
lazyExport('inc', './functions/inc')
|
||||
lazyExport('diff', './functions/diff')
|
||||
lazyExport('major', './functions/major')
|
||||
lazyExport('minor', './functions/minor')
|
||||
lazyExport('patch', './functions/patch')
|
||||
lazyExport('prerelease', './functions/prerelease')
|
||||
lazyExport('compare', './functions/compare')
|
||||
lazyExport('rcompare', './functions/rcompare')
|
||||
lazyExport('compareLoose', './functions/compare-loose')
|
||||
lazyExport('compareBuild', './functions/compare-build')
|
||||
lazyExport('sort', './functions/sort')
|
||||
lazyExport('rsort', './functions/rsort')
|
||||
lazyExport('gt', './functions/gt')
|
||||
lazyExport('lt', './functions/lt')
|
||||
lazyExport('eq', './functions/eq')
|
||||
lazyExport('neq', './functions/neq')
|
||||
lazyExport('gte', './functions/gte')
|
||||
lazyExport('lte', './functions/lte')
|
||||
lazyExport('cmp', './functions/cmp')
|
||||
lazyExport('coerce', './functions/coerce')
|
||||
lazyExport('Comparator', './classes/comparator')
|
||||
lazyExport('Range', './classes/range')
|
||||
lazyExport('satisfies', './functions/satisfies')
|
||||
lazyExport('toComparators', './ranges/to-comparators')
|
||||
lazyExport('maxSatisfying', './ranges/max-satisfying')
|
||||
lazyExport('minSatisfying', './ranges/min-satisfying')
|
||||
lazyExport('minVersion', './ranges/min-version')
|
||||
lazyExport('validRange', './ranges/valid')
|
||||
lazyExport('outside', './ranges/outside')
|
||||
lazyExport('gtr', './ranges/gtr')
|
||||
lazyExport('ltr', './ranges/ltr')
|
||||
lazyExport('intersects', './ranges/intersects')
|
17
node_modules/simple-update-notifier/node_modules/semver/internal/constants.js
generated
vendored
Normal file
17
node_modules/simple-update-notifier/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
|
||||
}
|
9
node_modules/simple-update-notifier/node_modules/semver/internal/debug.js
generated
vendored
Normal file
9
node_modules/simple-update-notifier/node_modules/semver/internal/debug.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
const debug = (
|
||||
typeof process === 'object' &&
|
||||
process.env &&
|
||||
process.env.NODE_DEBUG &&
|
||||
/\bsemver\b/i.test(process.env.NODE_DEBUG)
|
||||
) ? (...args) => console.error('SEMVER', ...args)
|
||||
: () => {}
|
||||
|
||||
module.exports = debug
|
23
node_modules/simple-update-notifier/node_modules/semver/internal/identifiers.js
generated
vendored
Normal file
23
node_modules/simple-update-notifier/node_modules/semver/internal/identifiers.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
const numeric = /^[0-9]+$/
|
||||
const compareIdentifiers = (a, b) => {
|
||||
const anum = numeric.test(a)
|
||||
const bnum = numeric.test(b)
|
||||
|
||||
if (anum && bnum) {
|
||||
a = +a
|
||||
b = +b
|
||||
}
|
||||
|
||||
return a === b ? 0
|
||||
: (anum && !bnum) ? -1
|
||||
: (bnum && !anum) ? 1
|
||||
: a < b ? -1
|
||||
: 1
|
||||
}
|
||||
|
||||
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
|
||||
|
||||
module.exports = {
|
||||
compareIdentifiers,
|
||||
rcompareIdentifiers
|
||||
}
|
179
node_modules/simple-update-notifier/node_modules/semver/internal/re.js
generated
vendored
Normal file
179
node_modules/simple-update-notifier/node_modules/semver/internal/re.js
generated
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
const { MAX_SAFE_COMPONENT_LENGTH } = require('./constants')
|
||||
const debug = require('./debug')
|
||||
exports = module.exports = {}
|
||||
|
||||
// The actual regexps go on exports.re
|
||||
const re = exports.re = []
|
||||
const src = exports.src = []
|
||||
const t = exports.t = {}
|
||||
let R = 0
|
||||
|
||||
const createToken = (name, value, isGlobal) => {
|
||||
const index = R++
|
||||
debug(index, value)
|
||||
t[name] = index
|
||||
src[index] = value
|
||||
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
// ## Numeric Identifier
|
||||
// A single `0`, or a non-zero digit followed by zero or more digits.
|
||||
|
||||
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
|
||||
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
|
||||
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIER]})`)
|
||||
|
||||
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
||||
|
||||
// ## Pre-release Version Identifier
|
||||
// A numeric identifier, or a non-numeric identifier.
|
||||
|
||||
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
|
||||
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
||||
|
||||
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
|
||||
}|${src[t.NONNUMERICIDENTIFIER]})`)
|
||||
|
||||
// ## Pre-release Version
|
||||
// Hyphen, followed by one or more dot-separated pre-release version
|
||||
// identifiers.
|
||||
|
||||
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
||||
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
|
||||
|
||||
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
||||
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
|
||||
|
||||
// ## Build Metadata Identifier
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
// identifiers.
|
||||
|
||||
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
||||
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
|
||||
|
||||
// ## Full Version String
|
||||
// A main version, followed optionally by a pre-release version and
|
||||
// build metadata.
|
||||
|
||||
// Note that the only major, minor, patch, and pre-release sections of
|
||||
// the version string are capturing groups. The build metadata is not a
|
||||
// capturing group, because it should not ever be used in version
|
||||
// comparison.
|
||||
|
||||
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
||||
}${src[t.PRERELEASE]}?${
|
||||
src[t.BUILD]}?`)
|
||||
|
||||
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
|
||||
|
||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
||||
// common in the npm registry.
|
||||
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
||||
}${src[t.PRERELEASELOOSE]}?${
|
||||
src[t.BUILD]}?`)
|
||||
|
||||
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
|
||||
|
||||
createToken('GTLT', '((?:<|>)?=?)')
|
||||
|
||||
// Something like "2.*" or "1.2.x".
|
||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||
// Only the first item is strictly required.
|
||||
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
|
||||
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
|
||||
|
||||
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:${src[t.PRERELEASE]})?${
|
||||
src[t.BUILD]}?` +
|
||||
`)?)?`)
|
||||
|
||||
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:${src[t.PRERELEASELOOSE]})?${
|
||||
src[t.BUILD]}?` +
|
||||
`)?)?`)
|
||||
|
||||
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// Coercion.
|
||||
// Extract anything that could conceivably be a part of a valid semver
|
||||
createToken('COERCE', `${'(^|[^\\d])' +
|
||||
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
||||
`(?:$|[^\\d])`)
|
||||
createToken('COERCERTL', src[t.COERCE], true)
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
createToken('LONETILDE', '(?:~>?)')
|
||||
|
||||
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
|
||||
exports.tildeTrimReplace = '$1~'
|
||||
|
||||
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// Caret ranges.
|
||||
// Meaning is "at least and backwards compatible with"
|
||||
createToken('LONECARET', '(?:\\^)')
|
||||
|
||||
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
|
||||
exports.caretTrimReplace = '$1^'
|
||||
|
||||
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
||||
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
|
||||
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
|
||||
|
||||
// An expression to strip any whitespace between the gtlt and the thing
|
||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
||||
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
||||
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
|
||||
exports.comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
// Note that these all use the loose form, because they'll be
|
||||
// checked against either the strict or loose comparator form
|
||||
// later.
|
||||
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
||||
`\\s+-\\s+` +
|
||||
`(${src[t.XRANGEPLAIN]})` +
|
||||
`\\s*$`)
|
||||
|
||||
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
||||
`\\s+-\\s+` +
|
||||
`(${src[t.XRANGEPLAINLOOSE]})` +
|
||||
`\\s*$`)
|
||||
|
||||
// Star ranges basically just allow anything at all.
|
||||
createToken('STAR', '(<|>)?=?\\s*\\*')
|
34
node_modules/simple-update-notifier/node_modules/semver/package.json
generated
vendored
Normal file
34
node_modules/simple-update-notifier/node_modules/semver/package.json
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "semver",
|
||||
"version": "7.0.0",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --follow-tags"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^14.10.1"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": "https://github.com/npm/node-semver",
|
||||
"bin": {
|
||||
"semver": "./bin/semver.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"range.bnf",
|
||||
"classes",
|
||||
"functions",
|
||||
"internal",
|
||||
"ranges",
|
||||
"index.js"
|
||||
],
|
||||
"tap": {
|
||||
"check-coverage": true,
|
||||
"coverage-map": "map.js"
|
||||
}
|
||||
}
|
16
node_modules/simple-update-notifier/node_modules/semver/range.bnf
generated
vendored
Normal file
16
node_modules/simple-update-notifier/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]+
|
4
node_modules/simple-update-notifier/node_modules/semver/ranges/gtr.js
generated
vendored
Normal file
4
node_modules/simple-update-notifier/node_modules/semver/ranges/gtr.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
// Determine if version is greater than all the versions possible in the range.
|
||||
const outside = require('./outside')
|
||||
const gtr = (version, range, options) => outside(version, range, '>', options)
|
||||
module.exports = gtr
|
7
node_modules/simple-update-notifier/node_modules/semver/ranges/intersects.js
generated
vendored
Normal file
7
node_modules/simple-update-notifier/node_modules/semver/ranges/intersects.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const Range = require('../classes/range')
|
||||
const intersects = (r1, r2, options) => {
|
||||
r1 = new Range(r1, options)
|
||||
r2 = new Range(r2, options)
|
||||
return r1.intersects(r2)
|
||||
}
|
||||
module.exports = intersects
|
4
node_modules/simple-update-notifier/node_modules/semver/ranges/ltr.js
generated
vendored
Normal file
4
node_modules/simple-update-notifier/node_modules/semver/ranges/ltr.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
const outside = require('./outside')
|
||||
// Determine if version is less than all the versions possible in the range
|
||||
const ltr = (version, range, options) => outside(version, range, '<', options)
|
||||
module.exports = ltr
|
25
node_modules/simple-update-notifier/node_modules/semver/ranges/max-satisfying.js
generated
vendored
Normal file
25
node_modules/simple-update-notifier/node_modules/semver/ranges/max-satisfying.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
|
||||
const maxSatisfying = (versions, range, options) => {
|
||||
let max = null
|
||||
let maxSV = null
|
||||
let rangeObj = null
|
||||
try {
|
||||
rangeObj = new Range(range, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
versions.forEach((v) => {
|
||||
if (rangeObj.test(v)) {
|
||||
// satisfies(v, range, options)
|
||||
if (!max || maxSV.compare(v) === -1) {
|
||||
// compare(max, v, true)
|
||||
max = v
|
||||
maxSV = new SemVer(max, options)
|
||||
}
|
||||
}
|
||||
})
|
||||
return max
|
||||
}
|
||||
module.exports = maxSatisfying
|
24
node_modules/simple-update-notifier/node_modules/semver/ranges/min-satisfying.js
generated
vendored
Normal file
24
node_modules/simple-update-notifier/node_modules/semver/ranges/min-satisfying.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
const minSatisfying = (versions, range, options) => {
|
||||
let min = null
|
||||
let minSV = null
|
||||
let rangeObj = null
|
||||
try {
|
||||
rangeObj = new Range(range, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
versions.forEach((v) => {
|
||||
if (rangeObj.test(v)) {
|
||||
// satisfies(v, range, options)
|
||||
if (!min || minSV.compare(v) === 1) {
|
||||
// compare(min, v, true)
|
||||
min = v
|
||||
minSV = new SemVer(min, options)
|
||||
}
|
||||
}
|
||||
})
|
||||
return min
|
||||
}
|
||||
module.exports = minSatisfying
|
57
node_modules/simple-update-notifier/node_modules/semver/ranges/min-version.js
generated
vendored
Normal file
57
node_modules/simple-update-notifier/node_modules/semver/ranges/min-version.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
const gt = require('../functions/gt')
|
||||
|
||||
const minVersion = (range, loose) => {
|
||||
range = new Range(range, loose)
|
||||
|
||||
let minver = new SemVer('0.0.0')
|
||||
if (range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
minver = new SemVer('0.0.0-0')
|
||||
if (range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
minver = null
|
||||
for (let i = 0; i < range.set.length; ++i) {
|
||||
const comparators = range.set[i]
|
||||
|
||||
comparators.forEach((comparator) => {
|
||||
// Clone to avoid manipulating the comparator's semver object.
|
||||
const compver = new SemVer(comparator.semver.version)
|
||||
switch (comparator.operator) {
|
||||
case '>':
|
||||
if (compver.prerelease.length === 0) {
|
||||
compver.patch++
|
||||
} else {
|
||||
compver.prerelease.push(0)
|
||||
}
|
||||
compver.raw = compver.format()
|
||||
/* fallthrough */
|
||||
case '':
|
||||
case '>=':
|
||||
if (!minver || gt(minver, compver)) {
|
||||
minver = compver
|
||||
}
|
||||
break
|
||||
case '<':
|
||||
case '<=':
|
||||
/* Ignore maximum versions */
|
||||
break
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (minver && range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
module.exports = minVersion
|
80
node_modules/simple-update-notifier/node_modules/semver/ranges/outside.js
generated
vendored
Normal file
80
node_modules/simple-update-notifier/node_modules/semver/ranges/outside.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
const SemVer = require('../classes/semver')
|
||||
const Comparator = require('../classes/comparator')
|
||||
const {ANY} = Comparator
|
||||
const Range = require('../classes/range')
|
||||
const satisfies = require('../functions/satisfies')
|
||||
const gt = require('../functions/gt')
|
||||
const lt = require('../functions/lt')
|
||||
const lte = require('../functions/lte')
|
||||
const gte = require('../functions/gte')
|
||||
|
||||
const outside = (version, range, hilo, options) => {
|
||||
version = new SemVer(version, options)
|
||||
range = new Range(range, options)
|
||||
|
||||
let gtfn, ltefn, ltfn, comp, ecomp
|
||||
switch (hilo) {
|
||||
case '>':
|
||||
gtfn = gt
|
||||
ltefn = lte
|
||||
ltfn = lt
|
||||
comp = '>'
|
||||
ecomp = '>='
|
||||
break
|
||||
case '<':
|
||||
gtfn = lt
|
||||
ltefn = gte
|
||||
ltfn = gt
|
||||
comp = '<'
|
||||
ecomp = '<='
|
||||
break
|
||||
default:
|
||||
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
||||
}
|
||||
|
||||
// If it satisifes the range it is not outside
|
||||
if (satisfies(version, range, options)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// From now on, variable terms are as if we're in "gtr" mode.
|
||||
// but note that everything is flipped for the "ltr" function.
|
||||
|
||||
for (let i = 0; i < range.set.length; ++i) {
|
||||
const comparators = range.set[i]
|
||||
|
||||
let high = null
|
||||
let low = null
|
||||
|
||||
comparators.forEach((comparator) => {
|
||||
if (comparator.semver === ANY) {
|
||||
comparator = new Comparator('>=0.0.0')
|
||||
}
|
||||
high = high || comparator
|
||||
low = low || comparator
|
||||
if (gtfn(comparator.semver, high.semver, options)) {
|
||||
high = comparator
|
||||
} else if (ltfn(comparator.semver, low.semver, options)) {
|
||||
low = comparator
|
||||
}
|
||||
})
|
||||
|
||||
// If the edge version comparator has a operator then our version
|
||||
// isn't outside it
|
||||
if (high.operator === comp || high.operator === ecomp) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If the lowest version comparator has an operator and our version
|
||||
// is less than it then it isn't higher than the range
|
||||
if ((!low.operator || low.operator === comp) &&
|
||||
ltefn(version, low.semver)) {
|
||||
return false
|
||||
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = outside
|
8
node_modules/simple-update-notifier/node_modules/semver/ranges/to-comparators.js
generated
vendored
Normal file
8
node_modules/simple-update-notifier/node_modules/semver/ranges/to-comparators.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
const Range = require('../classes/range')
|
||||
|
||||
// Mostly just for testing and legacy API reasons
|
||||
const toComparators = (range, options) =>
|
||||
new Range(range, options).set
|
||||
.map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
|
||||
|
||||
module.exports = toComparators
|
11
node_modules/simple-update-notifier/node_modules/semver/ranges/valid.js
generated
vendored
Normal file
11
node_modules/simple-update-notifier/node_modules/semver/ranges/valid.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
const Range = require('../classes/range')
|
||||
const validRange = (range, options) => {
|
||||
try {
|
||||
// Return '*' instead of '' so that truthiness works.
|
||||
// This will throw if it's invalid anyway
|
||||
return new Range(range, options).range || '*'
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = validRange
|
97
node_modules/simple-update-notifier/package.json
generated
vendored
Normal file
97
node_modules/simple-update-notifier/package.json
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
{
|
||||
"name": "simple-update-notifier",
|
||||
"version": "1.0.7",
|
||||
"description": "Simple update notifier to check for npm updates for cli applications",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/alexbrazier/simple-update-notifier.git"
|
||||
},
|
||||
"homepage": "https://github.com/alexbrazier/simple-update-notifier.git",
|
||||
"author": "alexbrazier",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest src",
|
||||
"build": "rollup -c rollup.config.js",
|
||||
"prettier:check": "prettier --check src/**/*.ts",
|
||||
"prettier": "prettier --write src/**/*.ts",
|
||||
"eslint": "eslint src/**/*.ts",
|
||||
"lint": "yarn prettier:check && yarn eslint",
|
||||
"prepare": "yarn lint && yarn build",
|
||||
"release": "release-it"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": "~7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.18.2",
|
||||
"@babel/preset-typescript": "^7.17.12",
|
||||
"@release-it/conventional-changelog": "^5.0.0",
|
||||
"@types/jest": "^28.1.3",
|
||||
"@types/node": "^18.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
||||
"@typescript-eslint/parser": "^5.29.0",
|
||||
"eslint": "^8.18.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"jest": "^28.1.1",
|
||||
"prettier": "^2.7.1",
|
||||
"release-it": "^15.1.1",
|
||||
"rollup": "^2.75.7",
|
||||
"rollup-plugin-ts": "^3.0.2",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"files": [
|
||||
"build",
|
||||
"src"
|
||||
],
|
||||
"release-it": {
|
||||
"git": {
|
||||
"commitMessage": "chore: release ${version}",
|
||||
"tagName": "v${version}"
|
||||
},
|
||||
"npm": {
|
||||
"publish": true
|
||||
},
|
||||
"github": {
|
||||
"release": true
|
||||
},
|
||||
"plugins": {
|
||||
"@release-it/conventional-changelog": {
|
||||
"preset": "angular",
|
||||
"infile": "CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslintConfig": {
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"prettier"
|
||||
],
|
||||
"extends": [
|
||||
"prettier",
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"rules": {
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
"quoteProps": "consistent",
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "es5",
|
||||
"useTabs": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
12
node_modules/simple-update-notifier/src/borderedText.ts
generated
vendored
Normal file
12
node_modules/simple-update-notifier/src/borderedText.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
const borderedText = (text: string) => {
|
||||
const lines = text.split('\n');
|
||||
const width = Math.max(...lines.map((l) => l.length));
|
||||
const res = [`┌${'─'.repeat(width + 2)}┐`];
|
||||
for (const line of lines) {
|
||||
res.push(`│ ${line.padEnd(width)} │`);
|
||||
}
|
||||
res.push(`└${'─'.repeat(width + 2)}┘`);
|
||||
return res.join('\n');
|
||||
};
|
||||
|
||||
export default borderedText;
|
12
node_modules/simple-update-notifier/src/cache.spec.ts
generated
vendored
Normal file
12
node_modules/simple-update-notifier/src/cache.spec.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { createConfigDir, getLastUpdate, saveLastUpdate } from './cache';
|
||||
|
||||
createConfigDir();
|
||||
|
||||
jest.useFakeTimers().setSystemTime(new Date('2022-01-01'));
|
||||
|
||||
const fakeTime = new Date('2022-01-01').getTime();
|
||||
|
||||
test('can save update then get the update details', () => {
|
||||
saveLastUpdate('test');
|
||||
expect(getLastUpdate('test')).toBe(fakeTime);
|
||||
});
|
41
node_modules/simple-update-notifier/src/cache.ts
generated
vendored
Normal file
41
node_modules/simple-update-notifier/src/cache.ts
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const homeDirectory = os.homedir();
|
||||
const configDir =
|
||||
process.env.XDG_CONFIG_HOME ||
|
||||
path.join(homeDirectory, '.config', 'simple-update-notifier');
|
||||
|
||||
const getConfigFile = (packageName: string) => {
|
||||
return path.join(configDir, `${packageName}.json`);
|
||||
};
|
||||
|
||||
export const createConfigDir = () => {
|
||||
if (!fs.existsSync(configDir)) {
|
||||
fs.mkdirSync(configDir, { recursive: true });
|
||||
}
|
||||
};
|
||||
|
||||
export const getLastUpdate = (packageName: string) => {
|
||||
const configFile = getConfigFile(packageName);
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(configFile)) {
|
||||
return undefined;
|
||||
}
|
||||
const file = JSON.parse(fs.readFileSync(configFile, 'utf8'));
|
||||
return file.lastUpdateCheck as number;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
export const saveLastUpdate = (packageName: string) => {
|
||||
const configFile = getConfigFile(packageName);
|
||||
|
||||
fs.writeFileSync(
|
||||
configFile,
|
||||
JSON.stringify({ lastUpdateCheck: new Date().getTime() })
|
||||
);
|
||||
};
|
35
node_modules/simple-update-notifier/src/getDistVersion.spec.ts
generated
vendored
Normal file
35
node_modules/simple-update-notifier/src/getDistVersion.spec.ts
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import Stream from 'stream';
|
||||
import https from 'https';
|
||||
import getDistVersion from './getDistVersion';
|
||||
|
||||
jest.mock('https', () => ({
|
||||
get: jest.fn(),
|
||||
}));
|
||||
|
||||
test('Valid response returns version', async () => {
|
||||
const st = new Stream();
|
||||
(https.get as jest.Mock).mockImplementation((url, cb) => {
|
||||
cb(st);
|
||||
|
||||
st.emit('data', '{"latest":"1.0.0"}');
|
||||
st.emit('end');
|
||||
});
|
||||
|
||||
const version = await getDistVersion('test', 'latest');
|
||||
|
||||
expect(version).toEqual('1.0.0');
|
||||
});
|
||||
|
||||
test('Invalid response throws error', async () => {
|
||||
const st = new Stream();
|
||||
(https.get as jest.Mock).mockImplementation((url, cb) => {
|
||||
cb(st);
|
||||
|
||||
st.emit('data', 'some invalid json');
|
||||
st.emit('end');
|
||||
});
|
||||
|
||||
expect(getDistVersion('test', 'latest')).rejects.toThrow(
|
||||
'Could not parse version response'
|
||||
);
|
||||
});
|
29
node_modules/simple-update-notifier/src/getDistVersion.ts
generated
vendored
Normal file
29
node_modules/simple-update-notifier/src/getDistVersion.ts
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import https from 'https';
|
||||
|
||||
const getDistVersion = async (packageName: string, distTag: string) => {
|
||||
const url = `https://registry.npmjs.org/-/package/${packageName}/dist-tags`;
|
||||
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
https
|
||||
.get(url, (res) => {
|
||||
let body = '';
|
||||
|
||||
res.on('data', (chunk) => (body += chunk));
|
||||
res.on('end', () => {
|
||||
try {
|
||||
const json = JSON.parse(body);
|
||||
const version = json[distTag];
|
||||
if (!version) {
|
||||
reject(new Error('Error getting version'));
|
||||
}
|
||||
resolve(version);
|
||||
} catch {
|
||||
reject(new Error('Could not parse version response'));
|
||||
}
|
||||
});
|
||||
})
|
||||
.on('error', (err) => reject(err));
|
||||
});
|
||||
};
|
||||
|
||||
export default getDistVersion;
|
82
node_modules/simple-update-notifier/src/hasNewVersion.spec.ts
generated
vendored
Normal file
82
node_modules/simple-update-notifier/src/hasNewVersion.spec.ts
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
import hasNewVersion from './hasNewVersion';
|
||||
import { getLastUpdate } from './cache';
|
||||
import getDistVersion from './getDistVersion';
|
||||
|
||||
jest.mock('./getDistVersion', () => jest.fn().mockReturnValue('1.0.0'));
|
||||
jest.mock('./cache', () => ({
|
||||
getLastUpdate: jest.fn().mockReturnValue(undefined),
|
||||
createConfigDir: jest.fn(),
|
||||
saveLastUpdate: jest.fn(),
|
||||
}));
|
||||
|
||||
const pkg = { name: 'test', version: '1.0.0' };
|
||||
|
||||
afterEach(() => jest.clearAllMocks());
|
||||
|
||||
const defaultArgs = {
|
||||
pkg,
|
||||
shouldNotifyInNpmScript: true,
|
||||
alwaysRun: true,
|
||||
};
|
||||
|
||||
test('it should not trigger update for same version', async () => {
|
||||
const newVersion = await hasNewVersion(defaultArgs);
|
||||
|
||||
expect(newVersion).toBe(false);
|
||||
});
|
||||
|
||||
test('it should trigger update for patch version bump', async () => {
|
||||
(getDistVersion as jest.Mock).mockReturnValue('1.0.1');
|
||||
|
||||
const newVersion = await hasNewVersion(defaultArgs);
|
||||
|
||||
expect(newVersion).toBe('1.0.1');
|
||||
});
|
||||
|
||||
test('it should trigger update for minor version bump', async () => {
|
||||
(getDistVersion as jest.Mock).mockReturnValue('1.1.0');
|
||||
|
||||
const newVersion = await hasNewVersion(defaultArgs);
|
||||
|
||||
expect(newVersion).toBe('1.1.0');
|
||||
});
|
||||
|
||||
test('it should trigger update for major version bump', async () => {
|
||||
(getDistVersion as jest.Mock).mockReturnValue('2.0.0');
|
||||
|
||||
const newVersion = await hasNewVersion(defaultArgs);
|
||||
|
||||
expect(newVersion).toBe('2.0.0');
|
||||
});
|
||||
|
||||
test('it should not trigger update if version is lower', async () => {
|
||||
(getDistVersion as jest.Mock).mockReturnValue('0.0.9');
|
||||
|
||||
const newVersion = await hasNewVersion(defaultArgs);
|
||||
|
||||
expect(newVersion).toBe(false);
|
||||
});
|
||||
|
||||
it('should trigger update check if last update older than config', async () => {
|
||||
const TWO_WEEKS = new Date().getTime() - 1000 * 60 * 60 * 24 * 14;
|
||||
(getLastUpdate as jest.Mock).mockReturnValue(TWO_WEEKS);
|
||||
const newVersion = await hasNewVersion({
|
||||
pkg,
|
||||
shouldNotifyInNpmScript: true,
|
||||
});
|
||||
|
||||
expect(newVersion).toBe(false);
|
||||
expect(getDistVersion).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not trigger update check if last update is too recent', async () => {
|
||||
const TWELVE_HOURS = new Date().getTime() - 1000 * 60 * 60 * 12;
|
||||
(getLastUpdate as jest.Mock).mockReturnValue(TWELVE_HOURS);
|
||||
const newVersion = await hasNewVersion({
|
||||
pkg,
|
||||
shouldNotifyInNpmScript: true,
|
||||
});
|
||||
|
||||
expect(newVersion).toBe(false);
|
||||
expect(getDistVersion).not.toHaveBeenCalled();
|
||||
});
|
30
node_modules/simple-update-notifier/src/hasNewVersion.ts
generated
vendored
Normal file
30
node_modules/simple-update-notifier/src/hasNewVersion.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
import semver from 'semver';
|
||||
import { createConfigDir, getLastUpdate, saveLastUpdate } from './cache';
|
||||
import getDistVersion from './getDistVersion';
|
||||
import { IUpdate } from './types';
|
||||
|
||||
const hasNewVersion = async ({
|
||||
pkg,
|
||||
updateCheckInterval = 1000 * 60 * 60 * 24,
|
||||
distTag = 'latest',
|
||||
alwaysRun,
|
||||
}: IUpdate) => {
|
||||
createConfigDir();
|
||||
const lastUpdateCheck = getLastUpdate(pkg.name);
|
||||
if (
|
||||
alwaysRun ||
|
||||
!lastUpdateCheck ||
|
||||
lastUpdateCheck < new Date().getTime() - updateCheckInterval
|
||||
) {
|
||||
const latestVersion = await getDistVersion(pkg.name, distTag);
|
||||
saveLastUpdate(pkg.name);
|
||||
if (semver.gt(latestVersion, pkg.version)) {
|
||||
return latestVersion;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export default hasNewVersion;
|
27
node_modules/simple-update-notifier/src/index.spec.ts
generated
vendored
Normal file
27
node_modules/simple-update-notifier/src/index.spec.ts
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import simpleUpdateNotifier from '.';
|
||||
import hasNewVersion from './hasNewVersion';
|
||||
|
||||
const consoleSpy = jest.spyOn(console, 'log');
|
||||
|
||||
jest.mock('./hasNewVersion', () => jest.fn().mockResolvedValue('2.0.0'));
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
test('it logs message if update is available', async () => {
|
||||
await simpleUpdateNotifier({
|
||||
pkg: { name: 'test', version: '1.0.0' },
|
||||
alwaysRun: true,
|
||||
});
|
||||
|
||||
expect(consoleSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('it does not log message if update is not available', async () => {
|
||||
(hasNewVersion as jest.Mock).mockResolvedValue(false);
|
||||
await simpleUpdateNotifier({
|
||||
pkg: { name: 'test', version: '2.0.0' },
|
||||
alwaysRun: true,
|
||||
});
|
||||
|
||||
expect(consoleSpy).toHaveBeenCalledTimes(0);
|
||||
});
|
28
node_modules/simple-update-notifier/src/index.ts
generated
vendored
Normal file
28
node_modules/simple-update-notifier/src/index.ts
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
import isNpmOrYarn from './isNpmOrYarn';
|
||||
import hasNewVersion from './hasNewVersion';
|
||||
import { IUpdate } from './types';
|
||||
import borderedText from './borderedText';
|
||||
|
||||
const simpleUpdateNotifier = async (args: IUpdate) => {
|
||||
if (
|
||||
!args.alwaysRun &&
|
||||
(!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const latestVersion = await hasNewVersion(args);
|
||||
if (latestVersion) {
|
||||
console.log(
|
||||
borderedText(`New version of ${args.pkg.name} available!
|
||||
Current Version: ${args.pkg.version}
|
||||
Latest Version: ${latestVersion}`)
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
// Catch any network errors or cache writing errors so module doesn't cause a crash
|
||||
}
|
||||
};
|
||||
|
||||
export default simpleUpdateNotifier;
|
12
node_modules/simple-update-notifier/src/isNpmOrYarn.ts
generated
vendored
Normal file
12
node_modules/simple-update-notifier/src/isNpmOrYarn.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import process from 'process';
|
||||
|
||||
const packageJson = process.env.npm_package_json;
|
||||
const userAgent = process.env.npm_config_user_agent;
|
||||
const isNpm6 = Boolean(userAgent && userAgent.startsWith('npm'));
|
||||
const isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json'));
|
||||
|
||||
const isNpm = isNpm6 || isNpm7;
|
||||
const isYarn = Boolean(userAgent && userAgent.startsWith('yarn'));
|
||||
const isNpmOrYarn = isNpm || isYarn;
|
||||
|
||||
export default isNpmOrYarn;
|
7
node_modules/simple-update-notifier/src/types.ts
generated
vendored
Normal file
7
node_modules/simple-update-notifier/src/types.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
export interface IUpdate {
|
||||
pkg: { name: string; version: string };
|
||||
updateCheckInterval?: number;
|
||||
shouldNotifyInNpmScript?: boolean;
|
||||
distTag?: string;
|
||||
alwaysRun?: boolean;
|
||||
}
|
Reference in New Issue
Block a user