mirror of
https://github.com/anchore/syft
synced 2024-11-13 23:57:07 +00:00
Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
parent
cba5b5723b
commit
ff828fbac2
116 changed files with 23778 additions and 5 deletions
|
@ -206,3 +206,8 @@ func parsePackageJSON(_ string, reader io.Reader) ([]pkg.Package, error) {
|
|||
func (p PackageJSON) hasNameAndVersionValues() bool {
|
||||
return p.Name != "" && p.Version != ""
|
||||
}
|
||||
|
||||
func pathContainsNodeModulesDirectory(path string) bool {
|
||||
isNodeModulesPath, _ := regexp.MatchString("[\\/]node_modules[\\/]", path)
|
||||
return isNodeModulesPath
|
||||
}
|
||||
|
|
|
@ -27,9 +27,15 @@ type Dependency struct {
|
|||
Requires map[string]string
|
||||
}
|
||||
|
||||
// parsePackageLock parses a package.lock and returns the discovered JavaScript packages.
|
||||
func parsePackageLock(_ string, reader io.Reader) ([]pkg.Package, error) {
|
||||
packages := make([]pkg.Package, 0)
|
||||
// parsePackageLock parses a package-lock.json and returns the discovered JavaScript packages.
|
||||
func parsePackageLock(path string, reader io.Reader) ([]pkg.Package, error) {
|
||||
// in the case we find package-lock.json files in the node_modules directories, skip those
|
||||
// as the whole purpose of the lock file is for the specific dependencies of the root project
|
||||
if pathContainsNodeModulesDirectory(path) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var packages []pkg.Package
|
||||
dec := json.NewDecoder(reader)
|
||||
|
||||
for {
|
||||
|
|
|
@ -34,9 +34,14 @@ const (
|
|||
noVersion = ""
|
||||
)
|
||||
|
||||
func parseYarnLock(_ string, reader io.Reader) ([]pkg.Package, error) {
|
||||
var packages []pkg.Package
|
||||
func parseYarnLock(path string, reader io.Reader) ([]pkg.Package, error) {
|
||||
// in the case we find yarn.lock files in the node_modules directories, skip those
|
||||
// as the whole purpose of the lock file is for the specific dependencies of the project
|
||||
if pathContainsNodeModulesDirectory(path) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var packages []pkg.Package
|
||||
scanner := bufio.NewScanner(reader)
|
||||
parsedPackages := internal.NewStringSet()
|
||||
currentPackage := noPackage
|
||||
|
|
51
test/integration/node_packages_test.go
Normal file
51
test/integration/node_packages_test.go
Normal file
|
@ -0,0 +1,51 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/anchore/syft/internal"
|
||||
"github.com/anchore/syft/syft/pkg"
|
||||
)
|
||||
|
||||
func TestNpmPackageLockDirectory(t *testing.T) {
|
||||
catalog, _, _ := catalogDirectory(t, "test-fixtures/npm-lock")
|
||||
|
||||
foundPackages := internal.NewStringSet()
|
||||
|
||||
for actualPkg := range catalog.Enumerate(pkg.NpmPkg) {
|
||||
for _, actualLocation := range actualPkg.Locations {
|
||||
if strings.Contains(actualLocation.RealPath, "node_modules") {
|
||||
t.Errorf("found packages from package-lock.json in node_modules: %s", actualLocation)
|
||||
}
|
||||
}
|
||||
foundPackages.Add(actualPkg.Name)
|
||||
}
|
||||
|
||||
// ensure that integration test commonTestCases stay in sync with the available catalogers
|
||||
const expectedPackageCount = 6
|
||||
if len(foundPackages) != expectedPackageCount {
|
||||
t.Errorf("found the wrong set of npm package-lock.json packages (expected: %d, actual: %d)", expectedPackageCount, len(foundPackages))
|
||||
}
|
||||
}
|
||||
|
||||
func TestYarnPackageLockDirectory(t *testing.T) {
|
||||
catalog, _, _ := catalogDirectory(t, "test-fixtures/yarn-lock")
|
||||
|
||||
foundPackages := internal.NewStringSet()
|
||||
|
||||
for actualPkg := range catalog.Enumerate(pkg.NpmPkg) {
|
||||
for _, actualLocation := range actualPkg.Locations {
|
||||
if strings.Contains(actualLocation.RealPath, "node_modules") {
|
||||
t.Errorf("found packages from yarn.lock in node_modules: %s", actualLocation)
|
||||
}
|
||||
}
|
||||
foundPackages.Add(actualPkg.Name)
|
||||
}
|
||||
|
||||
// ensure that integration test commonTestCases stay in sync with the available catalogers
|
||||
const expectedPackageCount = 5
|
||||
if len(foundPackages) != expectedPackageCount {
|
||||
t.Errorf("found the wrong set of yarn.lock packages (expected: %d, actual: %d)", expectedPackageCount, len(foundPackages))
|
||||
}
|
||||
}
|
7
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/index.d.ts
generated
vendored
Normal file
7
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Collapse whitespace to a single space.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {string}
|
||||
*/
|
||||
export function collapseWhiteSpace(value: string): string;
|
9
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/index.js
generated
vendored
Normal file
9
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/index.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Collapse whitespace to a single space.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {string}
|
||||
*/
|
||||
export function collapseWhiteSpace(value) {
|
||||
return String(value).replace(/\s+/g, ' ')
|
||||
}
|
22
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/license
generated
vendored
Normal file
22
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/license
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
|
||||
|
||||
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.
|
8360
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/package-lock.json
generated
vendored
Normal file
8360
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
109
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/package.json
generated
vendored
Normal file
109
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/package.json
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
{
|
||||
"_from": "collapse-white-space",
|
||||
"_id": "collapse-white-space@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-eh9krktAIMDL0KHuN7WTBJ/0PMv8KUvfQRBkIlGmW61idRM2DJjgd1qXEPr4wyk2PimZZeNww3RVYo6CMvDGlg==",
|
||||
"_location": "/collapse-white-space",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "collapse-white-space",
|
||||
"name": "collapse-white-space",
|
||||
"escapedName": "collapse-white-space",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.0.0.tgz",
|
||||
"_shasum": "37d8521344cdd36635db180a7c83e9d515ac281b",
|
||||
"_spec": "collapse-white-space",
|
||||
"_where": "/Users/kzantow/projects/syft/test/integration/test-fixtures/npm-lock",
|
||||
"author": {
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/wooorm/collapse-white-space/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Titus Wormer",
|
||||
"email": "tituswormer@gmail.com",
|
||||
"url": "https://wooorm.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Replace multiple white space characters with a single space",
|
||||
"devDependencies": {
|
||||
"@types/tape": "^4.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"xo": "^0.38.0"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
},
|
||||
"homepage": "https://github.com/wooorm/collapse-white-space#readme",
|
||||
"keywords": [
|
||||
"collapse",
|
||||
"white",
|
||||
"space"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "collapse-white-space",
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wooorm/collapse-white-space.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"prebuild": "rimraf \"*.d.ts\"",
|
||||
"prepublishOnly": "npm run build",
|
||||
"test": "npm run format && npm run build && npm run test-coverage",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"types": "index.d.ts",
|
||||
"version": "2.0.0",
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"rules": {
|
||||
"no-var": "off",
|
||||
"prefer-arrow-callback": "off"
|
||||
}
|
||||
}
|
||||
}
|
65
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/readme.md
generated
vendored
Normal file
65
test/integration/test-fixtures/npm-lock/node_modules/collapse-white-space/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
# collapse-white-space
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
Replace multiple whitespace characters with a single space.
|
||||
|
||||
## Install
|
||||
|
||||
This package is ESM only: Node 12+ is needed to use it and it must be `import`ed
|
||||
instead of `require`d.
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install collapse-white-space
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {collapseWhiteSpace} from 'collapse-white-space'
|
||||
|
||||
collapseWhiteSpace('\tfoo \n\tbar \t\r\nbaz') //=> ' foo bar baz'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the following identifiers: `collapseWhiteSpace`.
|
||||
There is no default export.
|
||||
|
||||
### `collapseWhiteSpace(value)`
|
||||
|
||||
Replace multiple whitespace characters in `value` (`string`) with a single
|
||||
space.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/wooorm/collapse-white-space/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/wooorm/collapse-white-space/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/collapse-white-space.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/collapse-white-space
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/collapse-white-space.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/collapse-white-space
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/collapse-white-space.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=collapse-white-space
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
21
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/LICENSE
generated
vendored
Normal file
21
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Mathias Buus
|
||||
|
||||
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.
|
54
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/README.md
generated
vendored
Normal file
54
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/README.md
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
# end-of-stream
|
||||
|
||||
A node module that calls a callback when a readable/writable/duplex stream has completed or failed.
|
||||
|
||||
npm install end-of-stream
|
||||
|
||||
[![Build status](https://travis-ci.org/mafintosh/end-of-stream.svg?branch=master)](https://travis-ci.org/mafintosh/end-of-stream)
|
||||
|
||||
## Usage
|
||||
|
||||
Simply pass a stream and a callback to the `eos`.
|
||||
Both legacy streams, streams2 and stream3 are supported.
|
||||
|
||||
``` js
|
||||
var eos = require('end-of-stream');
|
||||
|
||||
eos(readableStream, function(err) {
|
||||
// this will be set to the stream instance
|
||||
if (err) return console.log('stream had an error or closed early');
|
||||
console.log('stream has ended', this === readableStream);
|
||||
});
|
||||
|
||||
eos(writableStream, function(err) {
|
||||
if (err) return console.log('stream had an error or closed early');
|
||||
console.log('stream has finished', this === writableStream);
|
||||
});
|
||||
|
||||
eos(duplexStream, function(err) {
|
||||
if (err) return console.log('stream had an error or closed early');
|
||||
console.log('stream has ended and finished', this === duplexStream);
|
||||
});
|
||||
|
||||
eos(duplexStream, {readable:false}, function(err) {
|
||||
if (err) return console.log('stream had an error or closed early');
|
||||
console.log('stream has finished but might still be readable');
|
||||
});
|
||||
|
||||
eos(duplexStream, {writable:false}, function(err) {
|
||||
if (err) return console.log('stream had an error or closed early');
|
||||
console.log('stream has ended but might still be writable');
|
||||
});
|
||||
|
||||
eos(readableStream, {error:false}, function(err) {
|
||||
// do not treat emit('error', err) as a end-of-stream
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
## Related
|
||||
|
||||
`end-of-stream` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.
|
94
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/index.js
generated
vendored
Normal file
94
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/index.js
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
var once = require('once');
|
||||
|
||||
var noop = function() {};
|
||||
|
||||
var isRequest = function(stream) {
|
||||
return stream.setHeader && typeof stream.abort === 'function';
|
||||
};
|
||||
|
||||
var isChildProcess = function(stream) {
|
||||
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
|
||||
};
|
||||
|
||||
var eos = function(stream, opts, callback) {
|
||||
if (typeof opts === 'function') return eos(stream, null, opts);
|
||||
if (!opts) opts = {};
|
||||
|
||||
callback = once(callback || noop);
|
||||
|
||||
var ws = stream._writableState;
|
||||
var rs = stream._readableState;
|
||||
var readable = opts.readable || (opts.readable !== false && stream.readable);
|
||||
var writable = opts.writable || (opts.writable !== false && stream.writable);
|
||||
var cancelled = false;
|
||||
|
||||
var onlegacyfinish = function() {
|
||||
if (!stream.writable) onfinish();
|
||||
};
|
||||
|
||||
var onfinish = function() {
|
||||
writable = false;
|
||||
if (!readable) callback.call(stream);
|
||||
};
|
||||
|
||||
var onend = function() {
|
||||
readable = false;
|
||||
if (!writable) callback.call(stream);
|
||||
};
|
||||
|
||||
var onexit = function(exitCode) {
|
||||
callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
|
||||
};
|
||||
|
||||
var onerror = function(err) {
|
||||
callback.call(stream, err);
|
||||
};
|
||||
|
||||
var onclose = function() {
|
||||
process.nextTick(onclosenexttick);
|
||||
};
|
||||
|
||||
var onclosenexttick = function() {
|
||||
if (cancelled) return;
|
||||
if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
|
||||
if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
|
||||
};
|
||||
|
||||
var onrequest = function() {
|
||||
stream.req.on('finish', onfinish);
|
||||
};
|
||||
|
||||
if (isRequest(stream)) {
|
||||
stream.on('complete', onfinish);
|
||||
stream.on('abort', onclose);
|
||||
if (stream.req) onrequest();
|
||||
else stream.on('request', onrequest);
|
||||
} else if (writable && !ws) { // legacy streams
|
||||
stream.on('end', onlegacyfinish);
|
||||
stream.on('close', onlegacyfinish);
|
||||
}
|
||||
|
||||
if (isChildProcess(stream)) stream.on('exit', onexit);
|
||||
|
||||
stream.on('end', onend);
|
||||
stream.on('finish', onfinish);
|
||||
if (opts.error !== false) stream.on('error', onerror);
|
||||
stream.on('close', onclose);
|
||||
|
||||
return function() {
|
||||
cancelled = true;
|
||||
stream.removeListener('complete', onfinish);
|
||||
stream.removeListener('abort', onclose);
|
||||
stream.removeListener('request', onrequest);
|
||||
if (stream.req) stream.req.removeListener('finish', onfinish);
|
||||
stream.removeListener('end', onlegacyfinish);
|
||||
stream.removeListener('close', onlegacyfinish);
|
||||
stream.removeListener('finish', onfinish);
|
||||
stream.removeListener('exit', onexit);
|
||||
stream.removeListener('end', onend);
|
||||
stream.removeListener('error', onerror);
|
||||
stream.removeListener('close', onclose);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = eos;
|
65
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/package.json
generated
vendored
Normal file
65
test/integration/test-fixtures/npm-lock/node_modules/end-of-stream/package.json
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"_from": "end-of-stream@^1.1.0",
|
||||
"_id": "end-of-stream@1.4.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"_location": "/end-of-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "end-of-stream@^1.1.0",
|
||||
"name": "end-of-stream",
|
||||
"escapedName": "end-of-stream",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pump"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"_shasum": "5ae64a5f45057baf3626ec14da0ca5e4b2431eb0",
|
||||
"_spec": "end-of-stream@^1.1.0",
|
||||
"_where": "/Users/kzantow/projects/syft/test/integration/test-fixtures/npm-lock/node_modules/pump",
|
||||
"author": {
|
||||
"name": "Mathias Buus",
|
||||
"email": "mathiasbuus@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mafintosh/end-of-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Call a callback when a readable/writable/duplex stream has completed or failed.",
|
||||
"devDependencies": {
|
||||
"tape": "^4.11.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/mafintosh/end-of-stream",
|
||||
"keywords": [
|
||||
"stream",
|
||||
"streams",
|
||||
"callback",
|
||||
"finish",
|
||||
"close",
|
||||
"end",
|
||||
"wait"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "end-of-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mafintosh/end-of-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.4.4"
|
||||
}
|
18
test/integration/test-fixtures/npm-lock/node_modules/insert-css/LICENSE
generated
vendored
Normal file
18
test/integration/test-fixtures/npm-lock/node_modules/insert-css/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
This software is released under the MIT license:
|
||||
|
||||
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.
|
12
test/integration/test-fixtures/npm-lock/node_modules/insert-css/example.js
generated
vendored
Normal file
12
test/integration/test-fixtures/npm-lock/node_modules/insert-css/example.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
var on = require('dom-event');
|
||||
var insertCss = require('./');
|
||||
|
||||
document.querySelector('body').innerHTML = '<h1>insert-css example</h1><button id="blue">blue</button><button id="red">red</button>';
|
||||
|
||||
on(document.querySelector('#blue'), 'click', function() {
|
||||
insertCss('body{background: blue}');
|
||||
});
|
||||
|
||||
on(document.querySelector('#red'), 'click', function() {
|
||||
insertCss('body{background: red}');
|
||||
});
|
58
test/integration/test-fixtures/npm-lock/node_modules/insert-css/index.js
generated
vendored
Normal file
58
test/integration/test-fixtures/npm-lock/node_modules/insert-css/index.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
var containers = []; // will store container HTMLElement references
|
||||
var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
|
||||
|
||||
var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
|
||||
|
||||
function insertCss(css, options) {
|
||||
options = options || {};
|
||||
|
||||
if (css === undefined) {
|
||||
throw new Error(usage);
|
||||
}
|
||||
|
||||
var position = options.prepend === true ? 'prepend' : 'append';
|
||||
var container = options.container !== undefined ? options.container : document.querySelector('head');
|
||||
var containerId = containers.indexOf(container);
|
||||
|
||||
// first time we see this container, create the necessary entries
|
||||
if (containerId === -1) {
|
||||
containerId = containers.push(container) - 1;
|
||||
styleElements[containerId] = {};
|
||||
}
|
||||
|
||||
// try to get the correponding container + position styleElement, create it otherwise
|
||||
var styleElement;
|
||||
|
||||
if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
|
||||
styleElement = styleElements[containerId][position];
|
||||
} else {
|
||||
styleElement = styleElements[containerId][position] = createStyleElement();
|
||||
|
||||
if (position === 'prepend') {
|
||||
container.insertBefore(styleElement, container.childNodes[0]);
|
||||
} else {
|
||||
container.appendChild(styleElement);
|
||||
}
|
||||
}
|
||||
|
||||
// strip potential UTF-8 BOM if css was read from a file
|
||||
if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
|
||||
|
||||
// actually add the stylesheet
|
||||
if (styleElement.styleSheet) {
|
||||
styleElement.styleSheet.cssText += css
|
||||
} else {
|
||||
styleElement.textContent += css;
|
||||
}
|
||||
|
||||
return styleElement;
|
||||
};
|
||||
|
||||
function createStyleElement() {
|
||||
var styleElement = document.createElement('style');
|
||||
styleElement.setAttribute('type', 'text/css');
|
||||
return styleElement;
|
||||
}
|
||||
|
||||
module.exports = insertCss;
|
||||
module.exports.insertCss = insertCss;
|
85
test/integration/test-fixtures/npm-lock/node_modules/insert-css/package.json
generated
vendored
Normal file
85
test/integration/test-fixtures/npm-lock/node_modules/insert-css/package.json
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"_from": "insert-css",
|
||||
"_id": "insert-css@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-610Ql7dUL0x56jBg067gfQU4gPQ=",
|
||||
"_location": "/insert-css",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "insert-css",
|
||||
"name": "insert-css",
|
||||
"escapedName": "insert-css",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/insert-css/-/insert-css-2.0.0.tgz",
|
||||
"_shasum": "eb5d1097b7542f4c79ea3060d3aee07d053880f4",
|
||||
"_spec": "insert-css",
|
||||
"_where": "/Users/kzantow/projects/syft/test/integration/test-fixtures/npm-lock",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/insert-css/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "insert a string of css into the <head>",
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.1",
|
||||
"budo": "^8.3.0",
|
||||
"computed-style": "^0.3.0",
|
||||
"dom-event": "^1.0.0",
|
||||
"tape": "^4.6.0",
|
||||
"tape-run": "^2.1.4"
|
||||
},
|
||||
"homepage": "https://github.com/substack/insert-css",
|
||||
"keywords": [
|
||||
"css",
|
||||
"insert",
|
||||
"dom",
|
||||
"browser",
|
||||
"browserify",
|
||||
"inject",
|
||||
"styles",
|
||||
"stylesheet",
|
||||
"style",
|
||||
"html",
|
||||
"head",
|
||||
"link"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "insert-css",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/insert-css.git"
|
||||
},
|
||||
"scripts": {
|
||||
"example": "budo example.js",
|
||||
"test": "browserify test.js | tape-run"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test.js",
|
||||
"browsers": [
|
||||
"ie/6..latest",
|
||||
"chrome/20..latest",
|
||||
"firefox/10..latest",
|
||||
"safari/latest",
|
||||
"opera/11.0..latest",
|
||||
"iphone/6",
|
||||
"ipad/6"
|
||||
]
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
44
test/integration/test-fixtures/npm-lock/node_modules/insert-css/readme.markdown
generated
vendored
Normal file
44
test/integration/test-fixtures/npm-lock/node_modules/insert-css/readme.markdown
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
# insert-css
|
||||
|
||||
insert a string of css into the `<head>`
|
||||
|
||||
[![browser support](https://ci.testling.com/substack/insert-css.png)](https://ci.testling.com/substack/insert-css)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var insertCss = require('insert-css');
|
||||
var styleElement = insertCss('body { background:blue; }');
|
||||
```
|
||||
|
||||
# api
|
||||
|
||||
``` js
|
||||
var insertCss = require('insert-css');
|
||||
```
|
||||
|
||||
## var styleElement = insertCss(css, opts);
|
||||
|
||||
Insert some CSS into the page.
|
||||
|
||||
* `opts.container` - Which HTMLElement to use as the base mounting point, defaults to
|
||||
`document.querySelector('head')`.
|
||||
|
||||
* `opts.prepend` - Add the CSS at the top level of the container instead of at the bottom level (default).
|
||||
|
||||
This is particullary useful for library creators where you may want your default CSS to be prepended so it
|
||||
can be easily overriden by user styles.
|
||||
|
||||
# development
|
||||
|
||||
## example
|
||||
|
||||
``` sh
|
||||
npm run example
|
||||
```
|
||||
|
||||
## test
|
||||
|
||||
``` sh
|
||||
npm test
|
||||
```
|
78
test/integration/test-fixtures/npm-lock/node_modules/insert-css/test.js
generated
vendored
Normal file
78
test/integration/test-fixtures/npm-lock/node_modules/insert-css/test.js
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
var test = require('tape');
|
||||
|
||||
test(function (t) {
|
||||
var insertCss = require('./');
|
||||
var initialNbStyleTags = nbStyleTags();
|
||||
|
||||
// basic usage
|
||||
var baseStyle = 'body{position:relative;text-decoration:overline}';
|
||||
insertCss(baseStyle);
|
||||
t.equal(position(), 'relative', 'initial position is `relative`');
|
||||
|
||||
// adds one style tag
|
||||
t.equal(nbStyleTags(), initialNbStyleTags + 1, 'we added one style tag');
|
||||
|
||||
// default to appending style
|
||||
var appendStyle = 'body{position:absolute}';
|
||||
var appendStyleTag = insertCss(appendStyle);
|
||||
t.equal(position(), 'absolute', 'new position is `absolute`');
|
||||
|
||||
// reuse same style tag
|
||||
t.equal(nbStyleTags(), initialNbStyleTags + 1, 'we kept using the same style tag');
|
||||
|
||||
// prepend should add a new style tag before the append one
|
||||
t.equal(textDecoration(), 'overline', 'text-decoration is overline by default');
|
||||
var prependStyleTag = insertCss('body{text-decoration:underline !important}', {prepend: true});
|
||||
t.equal(nbStyleTags(), initialNbStyleTags + 2, 'we added a new style tag');
|
||||
t.equal(textDecoration(), 'underline', 'text-decoration is now underline');
|
||||
var tag = prependStyleTag;
|
||||
while (tag !== appendStyleTag) {
|
||||
tag = tag.nextSibling;
|
||||
}
|
||||
t.equal(tag, appendStyleTag, 'prepend mode should add a style tag before the append one');
|
||||
|
||||
// uses old school styleSheet prop when present (IE)
|
||||
if (!appendStyleTag.styleSheet) {
|
||||
appendStyleTag.styleSheet = {cssText: 'a'};
|
||||
insertCss('p{color:blue}');
|
||||
t.equal(appendStyleTag.styleSheet.cssText, 'ap{color:blue}', 'we use old school styleSheet prop');
|
||||
delete appendStyleTag.styleSheet;
|
||||
}
|
||||
|
||||
// allow re-adding added style
|
||||
insertCss(baseStyle);
|
||||
t.equal(position(), 'relative', 'position is again `relative`');
|
||||
|
||||
// allow using a custom container
|
||||
var customContainer = document.createElement('div');
|
||||
document.querySelector('body').appendChild(customContainer);
|
||||
t.equal(nbStyleTags(customContainer), 0, 'no style tag in custom container');
|
||||
insertCss('body{position:absolute}', {container: customContainer});
|
||||
t.equal(nbStyleTags(customContainer), 1, 'new style tag added in custom container');
|
||||
t.equal(position(), 'absolute', 'position is absolute again');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test(function testEmpty(t) {
|
||||
var insertCss = require('./');
|
||||
|
||||
t.equal(insertCss(), false, 'insertCss() with no arguments returns `false`');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
function position() {
|
||||
var getStyle = require('computed-style');
|
||||
return getStyle(document.querySelector('body'), 'position');
|
||||
}
|
||||
|
||||
function textDecoration() {
|
||||
var getStyle = require('computed-style');
|
||||
return getStyle(document.querySelector('body'), 'text-decoration');
|
||||
}
|
||||
|
||||
function nbStyleTags(container) {
|
||||
if (!container) container = document;
|
||||
return container.querySelectorAll('style').length
|
||||
}
|
15
test/integration/test-fixtures/npm-lock/node_modules/once/LICENSE
generated
vendored
Normal file
15
test/integration/test-fixtures/npm-lock/node_modules/once/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.
|
79
test/integration/test-fixtures/npm-lock/node_modules/once/README.md
generated
vendored
Normal file
79
test/integration/test-fixtures/npm-lock/node_modules/once/README.md
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
# once
|
||||
|
||||
Only call a function once.
|
||||
|
||||
## usage
|
||||
|
||||
```javascript
|
||||
var once = require('once')
|
||||
|
||||
function load (file, cb) {
|
||||
cb = once(cb)
|
||||
loader.load('file')
|
||||
loader.once('load', cb)
|
||||
loader.once('error', cb)
|
||||
}
|
||||
```
|
||||
|
||||
Or add to the Function.prototype in a responsible way:
|
||||
|
||||
```javascript
|
||||
// only has to be done once
|
||||
require('once').proto()
|
||||
|
||||
function load (file, cb) {
|
||||
cb = cb.once()
|
||||
loader.load('file')
|
||||
loader.once('load', cb)
|
||||
loader.once('error', cb)
|
||||
}
|
||||
```
|
||||
|
||||
Ironically, the prototype feature makes this module twice as
|
||||
complicated as necessary.
|
||||
|
||||
To check whether you function has been called, use `fn.called`. Once the
|
||||
function is called for the first time the return value of the original
|
||||
function is saved in `fn.value` and subsequent calls will continue to
|
||||
return this value.
|
||||
|
||||
```javascript
|
||||
var once = require('once')
|
||||
|
||||
function load (cb) {
|
||||
cb = once(cb)
|
||||
var stream = createStream()
|
||||
stream.once('data', cb)
|
||||
stream.once('end', function () {
|
||||
if (!cb.called) cb(new Error('not found'))
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## `once.strict(func)`
|
||||
|
||||
Throw an error if the function is called twice.
|
||||
|
||||
Some functions are expected to be called only once. Using `once` for them would
|
||||
potentially hide logical errors.
|
||||
|
||||
In the example below, the `greet` function has to call the callback only once:
|
||||
|
||||
```javascript
|
||||
function greet (name, cb) {
|
||||
// return is missing from the if statement
|
||||
// when no name is passed, the callback is called twice
|
||||
if (!name) cb('Hello anonymous')
|
||||
cb('Hello ' + name)
|
||||
}
|
||||
|
||||
function log (msg) {
|
||||
console.log(msg)
|
||||
}
|
||||
|
||||
// this will print 'Hello anonymous' but the logical error will be missed
|
||||
greet(null, once(msg))
|
||||
|
||||
// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time
|
||||
greet(null, once.strict(msg))
|
||||
```
|
42
test/integration/test-fixtures/npm-lock/node_modules/once/once.js
generated
vendored
Normal file
42
test/integration/test-fixtures/npm-lock/node_modules/once/once.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
var wrappy = require('wrappy')
|
||||
module.exports = wrappy(once)
|
||||
module.exports.strict = wrappy(onceStrict)
|
||||
|
||||
once.proto = once(function () {
|
||||
Object.defineProperty(Function.prototype, 'once', {
|
||||
value: function () {
|
||||
return once(this)
|
||||
},
|
||||
configurable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(Function.prototype, 'onceStrict', {
|
||||
value: function () {
|
||||
return onceStrict(this)
|
||||
},
|
||||
configurable: true
|
||||
})
|
||||
})
|
||||
|
||||
function once (fn) {
|
||||
var f = function () {
|
||||
if (f.called) return f.value
|
||||
f.called = true
|
||||
return f.value = fn.apply(this, arguments)
|
||||
}
|
||||
f.called = false
|
||||
return f
|
||||
}
|
||||
|
||||
function onceStrict (fn) {
|
||||
var f = function () {
|
||||
if (f.called)
|
||||
throw new Error(f.onceError)
|
||||
f.called = true
|
||||
return f.value = fn.apply(this, arguments)
|
||||
}
|
||||
var name = fn.name || 'Function wrapped with `once`'
|
||||
f.onceError = name + " shouldn't be called more than once"
|
||||
f.called = false
|
||||
return f
|
||||
}
|
67
test/integration/test-fixtures/npm-lock/node_modules/once/package.json
generated
vendored
Normal file
67
test/integration/test-fixtures/npm-lock/node_modules/once/package.json
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"_from": "once@^1.3.1",
|
||||
"_id": "once@1.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"_location": "/once",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "once@^1.3.1",
|
||||
"name": "once",
|
||||
"escapedName": "once",
|
||||
"rawSpec": "^1.3.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.3.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/end-of-stream",
|
||||
"/pump"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",
|
||||
"_spec": "once@^1.3.1",
|
||||
"_where": "/Users/kzantow/projects/syft/test/integration/test-fixtures/npm-lock/node_modules/pump",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/once/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Run a function exactly one time",
|
||||
"devDependencies": {
|
||||
"tap": "^7.0.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"once.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/once#readme",
|
||||
"keywords": [
|
||||
"once",
|
||||
"function",
|
||||
"one",
|
||||
"single"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "once.js",
|
||||
"name": "once",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/once.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
}
|
5
test/integration/test-fixtures/npm-lock/node_modules/pump/.travis.yml
generated
vendored
Normal file
5
test/integration/test-fixtures/npm-lock/node_modules/pump/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
|
||||
script: "npm test"
|
21
test/integration/test-fixtures/npm-lock/node_modules/pump/LICENSE
generated
vendored
Normal file
21
test/integration/test-fixtures/npm-lock/node_modules/pump/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Mathias Buus
|
||||
|
||||
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.
|
65
test/integration/test-fixtures/npm-lock/node_modules/pump/README.md
generated
vendored
Normal file
65
test/integration/test-fixtures/npm-lock/node_modules/pump/README.md
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
# pump
|
||||
|
||||
pump is a small node module that pipes streams together and destroys all of them if one of them closes.
|
||||
|
||||
```
|
||||
npm install pump
|
||||
```
|
||||
|
||||
[![build status](http://img.shields.io/travis/mafintosh/pump.svg?style=flat)](http://travis-ci.org/mafintosh/pump)
|
||||
|
||||
## What problem does it solve?
|
||||
|
||||
When using standard `source.pipe(dest)` source will _not_ be destroyed if dest emits close or an error.
|
||||
You are also not able to provide a callback to tell when then pipe has finished.
|
||||
|
||||
pump does these two things for you
|
||||
|
||||
## Usage
|
||||
|
||||
Simply pass the streams you want to pipe together to pump and add an optional callback
|
||||
|
||||
``` js
|
||||
var pump = require('pump')
|
||||
var fs = require('fs')
|
||||
|
||||
var source = fs.createReadStream('/dev/random')
|
||||
var dest = fs.createWriteStream('/dev/null')
|
||||
|
||||
pump(source, dest, function(err) {
|
||||
console.log('pipe finished', err)
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
dest.destroy() // when dest is closed pump will destroy source
|
||||
}, 1000)
|
||||
```
|
||||
|
||||
You can use pump to pipe more than two streams together as well
|
||||
|
||||
``` js
|
||||
var transform = someTransformStream()
|
||||
|
||||
pump(source, transform, anotherTransform, dest, function(err) {
|
||||
console.log('pipe finished', err)
|
||||
})
|
||||
```
|
||||
|
||||
If `source`, `transform`, `anotherTransform` or `dest` closes all of them will be destroyed.
|
||||
|
||||
Similarly to `stream.pipe()`, `pump()` returns the last stream passed in, so you can do:
|
||||
|
||||
```
|
||||
return pump(s1, s2) // returns s2
|
||||
```
|
||||
|
||||
If you want to return a stream that combines *both* s1 and s2 to a single stream use
|
||||
[pumpify](https://github.com/mafintosh/pumpify) instead.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
## Related
|
||||
|
||||
`pump` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.
|
82
test/integration/test-fixtures/npm-lock/node_modules/pump/index.js
generated
vendored
Normal file
82
test/integration/test-fixtures/npm-lock/node_modules/pump/index.js
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
var once = require('once')
|
||||
var eos = require('end-of-stream')
|
||||
var fs = require('fs') // we only need fs to get the ReadStream and WriteStream prototypes
|
||||
|
||||
var noop = function () {}
|
||||
var ancient = /^v?\.0/.test(process.version)
|
||||
|
||||
var isFn = function (fn) {
|
||||
return typeof fn === 'function'
|
||||
}
|
||||
|
||||
var isFS = function (stream) {
|
||||
if (!ancient) return false // newer node version do not need to care about fs is a special way
|
||||
if (!fs) return false // browser
|
||||
return (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close)
|
||||
}
|
||||
|
||||
var isRequest = function (stream) {
|
||||
return stream.setHeader && isFn(stream.abort)
|
||||
}
|
||||
|
||||
var destroyer = function (stream, reading, writing, callback) {
|
||||
callback = once(callback)
|
||||
|
||||
var closed = false
|
||||
stream.on('close', function () {
|
||||
closed = true
|
||||
})
|
||||
|
||||
eos(stream, {readable: reading, writable: writing}, function (err) {
|
||||
if (err) return callback(err)
|
||||
closed = true
|
||||
callback()
|
||||
})
|
||||
|
||||
var destroyed = false
|
||||
return function (err) {
|
||||
if (closed) return
|
||||
if (destroyed) return
|
||||
destroyed = true
|
||||
|
||||
if (isFS(stream)) return stream.close(noop) // use close for fs streams to avoid fd leaks
|
||||
if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want
|
||||
|
||||
if (isFn(stream.destroy)) return stream.destroy()
|
||||
|
||||
callback(err || new Error('stream was destroyed'))
|
||||
}
|
||||
}
|
||||
|
||||
var call = function (fn) {
|
||||
fn()
|
||||
}
|
||||
|
||||
var pipe = function (from, to) {
|
||||
return from.pipe(to)
|
||||
}
|
||||
|
||||
var pump = function () {
|
||||
var streams = Array.prototype.slice.call(arguments)
|
||||
var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop
|
||||
|
||||
if (Array.isArray(streams[0])) streams = streams[0]
|
||||
if (streams.length < 2) throw new Error('pump requires two streams per minimum')
|
||||
|
||||
var error
|
||||
var destroys = streams.map(function (stream, i) {
|
||||
var reading = i < streams.length - 1
|
||||
var writing = i > 0
|
||||
return destroyer(stream, reading, writing, function (err) {
|
||||
if (!error) error = err
|
||||
if (err) destroys.forEach(call)
|
||||
if (reading) return
|
||||
destroys.forEach(call)
|
||||
callback(error)
|
||||
})
|
||||
})
|
||||
|
||||
return streams.reduce(pipe)
|
||||
}
|
||||
|
||||
module.exports = pump
|
60
test/integration/test-fixtures/npm-lock/node_modules/pump/package.json
generated
vendored
Normal file
60
test/integration/test-fixtures/npm-lock/node_modules/pump/package.json
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"_from": "pump",
|
||||
"_id": "pump@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"_location": "/pump",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "pump",
|
||||
"name": "pump",
|
||||
"escapedName": "pump",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/",
|
||||
"#USER"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"_shasum": "b4a2116815bde2f4e1ea602354e8c75565107a64",
|
||||
"_spec": "pump",
|
||||
"_where": "/Users/kzantow/projects/syft/test/integration/test-fixtures/npm-lock",
|
||||
"author": {
|
||||
"name": "Mathias Buus Madsen",
|
||||
"email": "mathiasbuus@gmail.com"
|
||||
},
|
||||
"browser": {
|
||||
"fs": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mafintosh/pump/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "pipe streams together and close all of them if one of them closes",
|
||||
"homepage": "https://github.com/mafintosh/pump#readme",
|
||||
"keywords": [
|
||||
"streams",
|
||||
"pipe",
|
||||
"destroy",
|
||||
"callback"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "pump",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mafintosh/pump.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test-browser.js && node test-node.js"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
66
test/integration/test-fixtures/npm-lock/node_modules/pump/test-browser.js
generated
vendored
Normal file
66
test/integration/test-fixtures/npm-lock/node_modules/pump/test-browser.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
var stream = require('stream')
|
||||
var pump = require('./index')
|
||||
|
||||
var rs = new stream.Readable()
|
||||
var ws = new stream.Writable()
|
||||
|
||||
rs._read = function (size) {
|
||||
this.push(Buffer(size).fill('abc'))
|
||||
}
|
||||
|
||||
ws._write = function (chunk, encoding, cb) {
|
||||
setTimeout(function () {
|
||||
cb()
|
||||
}, 100)
|
||||
}
|
||||
|
||||
var toHex = function () {
|
||||
var reverse = new (require('stream').Transform)()
|
||||
|
||||
reverse._transform = function (chunk, enc, callback) {
|
||||
reverse.push(chunk.toString('hex'))
|
||||
callback()
|
||||
}
|
||||
|
||||
return reverse
|
||||
}
|
||||
|
||||
var wsClosed = false
|
||||
var rsClosed = false
|
||||
var callbackCalled = false
|
||||
|
||||
var check = function () {
|
||||
if (wsClosed && rsClosed && callbackCalled) {
|
||||
console.log('test-browser.js passes')
|
||||
clearTimeout(timeout)
|
||||
}
|
||||
}
|
||||
|
||||
ws.on('finish', function () {
|
||||
wsClosed = true
|
||||
check()
|
||||
})
|
||||
|
||||
rs.on('end', function () {
|
||||
rsClosed = true
|
||||
check()
|
||||
})
|
||||
|
||||
var res = pump(rs, toHex(), toHex(), toHex(), ws, function () {
|
||||
callbackCalled = true
|
||||
check()
|
||||
})
|
||||
|
||||
if (res !== ws) {
|
||||
throw new Error('should return last stream')
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
rs.push(null)
|
||||
rs.emit('close')
|
||||
}, 1000)
|
||||
|
||||
var timeout = setTimeout(function () {
|
||||
check()
|
||||
throw new Error('timeout')
|
||||
}, 5000)
|
53
test/integration/test-fixtures/npm-lock/node_modules/pump/test-node.js
generated
vendored
Normal file
53
test/integration/test-fixtures/npm-lock/node_modules/pump/test-node.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
var pump = require('./index')
|
||||
|
||||
var rs = require('fs').createReadStream('/dev/random')
|
||||
var ws = require('fs').createWriteStream('/dev/null')
|
||||
|
||||
var toHex = function () {
|
||||
var reverse = new (require('stream').Transform)()
|
||||
|
||||
reverse._transform = function (chunk, enc, callback) {
|
||||
reverse.push(chunk.toString('hex'))
|
||||
callback()
|
||||
}
|
||||
|
||||
return reverse
|
||||
}
|
||||
|
||||
var wsClosed = false
|
||||
var rsClosed = false
|
||||
var callbackCalled = false
|
||||
|
||||
var check = function () {
|
||||
if (wsClosed && rsClosed && callbackCalled) {
|
||||
console.log('test-node.js passes')
|
||||
clearTimeout(timeout)
|
||||
}
|
||||
}
|
||||
|
||||
ws.on('close', function () {
|
||||
wsClosed = true
|
||||
check()
|
||||
})
|
||||
|
||||
rs.on('close', function () {
|
||||
rsClosed = true
|
||||
check()
|
||||
})
|
||||
|
||||
var res = pump(rs, toHex(), toHex(), toHex(), ws, function () {
|
||||
callbackCalled = true
|
||||
check()
|
||||
})
|
||||
|
||||
if (res !== ws) {
|
||||
throw new Error('should return last stream')
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
rs.destroy()
|
||||
}, 1000)
|
||||
|
||||
var timeout = setTimeout(function () {
|
||||
throw new Error('timeout')
|
||||
}, 5000)
|
15
test/integration/test-fixtures/npm-lock/node_modules/wrappy/LICENSE
generated
vendored
Normal file
15
test/integration/test-fixtures/npm-lock/node_modules/wrappy/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.
|
36
test/integration/test-fixtures/npm-lock/node_modules/wrappy/README.md
generated
vendored
Normal file
36
test/integration/test-fixtures/npm-lock/node_modules/wrappy/README.md
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
# wrappy
|
||||
|
||||
Callback wrapping utility
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var wrappy = require("wrappy")
|
||||
|
||||
// var wrapper = wrappy(wrapperFunction)
|
||||
|
||||
// make sure a cb is called only once
|
||||
// See also: http://npm.im/once for this specific use case
|
||||
var once = wrappy(function (cb) {
|
||||
var called = false
|
||||
return function () {
|
||||
if (called) return
|
||||
called = true
|
||||
return cb.apply(this, arguments)
|
||||
}
|
||||
})
|
||||
|
||||
function printBoo () {
|
||||
console.log('boo')
|
||||
}
|
||||
// has some rando property
|
||||
printBoo.iAmBooPrinter = true
|
||||
|
||||
var onlyPrintOnce = once(printBoo)
|
||||
|
||||
onlyPrintOnce() // prints 'boo'
|
||||
onlyPrintOnce() // does nothing
|
||||
|
||||
// random property is retained!
|
||||
assert.equal(onlyPrintOnce.iAmBooPrinter, true)
|
||||
```
|
1859
test/integration/test-fixtures/npm-lock/node_modules/wrappy/package-lock.json
generated
vendored
Normal file
1859
test/integration/test-fixtures/npm-lock/node_modules/wrappy/package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
58
test/integration/test-fixtures/npm-lock/node_modules/wrappy/package.json
generated
vendored
Normal file
58
test/integration/test-fixtures/npm-lock/node_modules/wrappy/package.json
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"_from": "wrappy@1",
|
||||
"_id": "wrappy@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"_location": "/wrappy",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "wrappy@1",
|
||||
"name": "wrappy",
|
||||
"escapedName": "wrappy",
|
||||
"rawSpec": "1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/once"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"_shasum": "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
|
||||
"_spec": "wrappy@1",
|
||||
"_where": "/Users/kzantow/projects/syft/test/integration/test-fixtures/npm-lock/node_modules/once",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/wrappy/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Callback wrapping utility",
|
||||
"devDependencies": {
|
||||
"tap": "^2.3.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"wrappy.js"
|
||||
],
|
||||
"homepage": "https://github.com/npm/wrappy",
|
||||
"license": "ISC",
|
||||
"main": "wrappy.js",
|
||||
"name": "wrappy",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/wrappy.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap --coverage test/*.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
33
test/integration/test-fixtures/npm-lock/node_modules/wrappy/wrappy.js
generated
vendored
Normal file
33
test/integration/test-fixtures/npm-lock/node_modules/wrappy/wrappy.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Returns a wrapper function that returns a wrapped callback
|
||||
// The wrapper function should do some stuff, and return a
|
||||
// presumably different callback function.
|
||||
// This makes sure that own properties are retained, so that
|
||||
// decorations and such are not lost along the way.
|
||||
module.exports = wrappy
|
||||
function wrappy (fn, cb) {
|
||||
if (fn && cb) return wrappy(fn)(cb)
|
||||
|
||||
if (typeof fn !== 'function')
|
||||
throw new TypeError('need wrapper function')
|
||||
|
||||
Object.keys(fn).forEach(function (k) {
|
||||
wrapper[k] = fn[k]
|
||||
})
|
||||
|
||||
return wrapper
|
||||
|
||||
function wrapper() {
|
||||
var args = new Array(arguments.length)
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i]
|
||||
}
|
||||
var ret = fn.apply(this, args)
|
||||
var cb = args[args.length-1]
|
||||
if (typeof ret === 'function' && ret !== cb) {
|
||||
Object.keys(cb).forEach(function (k) {
|
||||
ret[k] = cb[k]
|
||||
})
|
||||
}
|
||||
return ret
|
||||
}
|
||||
}
|
52
test/integration/test-fixtures/npm-lock/package-lock.json
generated
Normal file
52
test/integration/test-fixtures/npm-lock/package-lock.json
generated
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "npm-lock",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"collapse-white-space": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.0.0.tgz",
|
||||
"integrity": "sha512-eh9krktAIMDL0KHuN7WTBJ/0PMv8KUvfQRBkIlGmW61idRM2DJjgd1qXEPr4wyk2PimZZeNww3RVYo6CMvDGlg=="
|
||||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"insert-css": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/insert-css/-/insert-css-2.0.0.tgz",
|
||||
"integrity": "sha1-610Ql7dUL0x56jBg067gfQU4gPQ="
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
18
test/integration/test-fixtures/npm-lock/package.json
Normal file
18
test/integration/test-fixtures/npm-lock/package.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "npm-lock",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"collapse-white-space": "^2.0.0",
|
||||
"insert-css": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"pump": "^3.0.0"
|
||||
}
|
||||
}
|
1
test/integration/test-fixtures/yarn-lock/node_modules/.bin/semver
generated
vendored
Symbolic link
1
test/integration/test-fixtures/yarn-lock/node_modules/.bin/semver
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../semver/bin/semver.js
|
22
test/integration/test-fixtures/yarn-lock/node_modules/.yarn-integrity
generated
vendored
Normal file
22
test/integration/test-fixtures/yarn-lock/node_modules/.yarn-integrity
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"systemParams": "darwin-x64-83",
|
||||
"modulesFolders": [
|
||||
"node_modules"
|
||||
],
|
||||
"flags": [],
|
||||
"linkedModules": [],
|
||||
"topLevelPatterns": [
|
||||
"collapse-white-space@^2.0.0",
|
||||
"merge-objects@^1.0.5",
|
||||
"semver@^7.3.5"
|
||||
],
|
||||
"lockfileEntries": {
|
||||
"collapse-white-space@^2.0.0": "https://registry.yarnpkg.com/collapse-white-space/-/collapse-white-space-2.0.0.tgz#37d8521344cdd36635db180a7c83e9d515ac281b",
|
||||
"lru-cache@^6.0.0": "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94",
|
||||
"merge-objects@^1.0.5": "https://registry.yarnpkg.com/merge-objects/-/merge-objects-1.0.5.tgz#ad923ff3910091acc1438f53eb75b8f37d862a86",
|
||||
"semver@^7.3.5": "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7",
|
||||
"yallist@^4.0.0": "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
||||
},
|
||||
"files": [],
|
||||
"artifacts": {}
|
||||
}
|
7
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/index.d.ts
generated
vendored
Normal file
7
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Collapse whitespace to a single space.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {string}
|
||||
*/
|
||||
export function collapseWhiteSpace(value: string): string;
|
9
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/index.js
generated
vendored
Normal file
9
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/index.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* Collapse whitespace to a single space.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {string}
|
||||
*/
|
||||
export function collapseWhiteSpace(value) {
|
||||
return String(value).replace(/\s+/g, ' ')
|
||||
}
|
22
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/license
generated
vendored
Normal file
22
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/license
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
|
||||
|
||||
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.
|
69
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/package.json
generated
vendored
Normal file
69
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/package.json
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"name": "collapse-white-space",
|
||||
"version": "2.0.0",
|
||||
"description": "Replace multiple white space characters with a single space",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"collapse",
|
||||
"white",
|
||||
"space"
|
||||
],
|
||||
"repository": "wooorm/collapse-white-space",
|
||||
"bugs": "https://github.com/wooorm/collapse-white-space/issues",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/tape": "^4.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-preset-wooorm": "^8.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"tape": "^5.0.0",
|
||||
"typescript": "^4.0.0",
|
||||
"xo": "^0.38.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run build",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"prebuild": "rimraf \"*.d.ts\"",
|
||||
"build": "tsc",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js",
|
||||
"test": "npm run format && npm run build && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"rules": {
|
||||
"no-var": "off",
|
||||
"prefer-arrow-callback": "off"
|
||||
}
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
65
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/readme.md
generated
vendored
Normal file
65
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
# collapse-white-space
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
|
||||
Replace multiple whitespace characters with a single space.
|
||||
|
||||
## Install
|
||||
|
||||
This package is ESM only: Node 12+ is needed to use it and it must be `import`ed
|
||||
instead of `require`d.
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install collapse-white-space
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
import {collapseWhiteSpace} from 'collapse-white-space'
|
||||
|
||||
collapseWhiteSpace('\tfoo \n\tbar \t\r\nbaz') //=> ' foo bar baz'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the following identifiers: `collapseWhiteSpace`.
|
||||
There is no default export.
|
||||
|
||||
### `collapseWhiteSpace(value)`
|
||||
|
||||
Replace multiple whitespace characters in `value` (`string`) with a single
|
||||
space.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/wooorm/collapse-white-space/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/wooorm/collapse-white-space/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/collapse-white-space.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/wooorm/collapse-white-space
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/collapse-white-space.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/collapse-white-space
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/collapse-white-space.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=collapse-white-space
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
5957
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/yarn.lock
generated
vendored
Normal file
5957
test/integration/test-fixtures/yarn-lock/node_modules/collapse-white-space/yarn.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
15
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
15
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
166
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/README.md
generated
vendored
Normal file
166
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/README.md
generated
vendored
Normal file
|
@ -0,0 +1,166 @@
|
|||
# lru cache
|
||||
|
||||
A cache object that deletes the least-recently-used items.
|
||||
|
||||
[![Build Status](https://travis-ci.org/isaacs/node-lru-cache.svg?branch=master)](https://travis-ci.org/isaacs/node-lru-cache) [![Coverage Status](https://coveralls.io/repos/isaacs/node-lru-cache/badge.svg?service=github)](https://coveralls.io/github/isaacs/node-lru-cache)
|
||||
|
||||
## Installation:
|
||||
|
||||
```javascript
|
||||
npm install lru-cache --save
|
||||
```
|
||||
|
||||
## Usage:
|
||||
|
||||
```javascript
|
||||
var LRU = require("lru-cache")
|
||||
, options = { max: 500
|
||||
, length: function (n, key) { return n * 2 + key.length }
|
||||
, dispose: function (key, n) { n.close() }
|
||||
, maxAge: 1000 * 60 * 60 }
|
||||
, cache = new LRU(options)
|
||||
, otherCache = new LRU(50) // sets just the max size
|
||||
|
||||
cache.set("key", "value")
|
||||
cache.get("key") // "value"
|
||||
|
||||
// non-string keys ARE fully supported
|
||||
// but note that it must be THE SAME object, not
|
||||
// just a JSON-equivalent object.
|
||||
var someObject = { a: 1 }
|
||||
cache.set(someObject, 'a value')
|
||||
// Object keys are not toString()-ed
|
||||
cache.set('[object Object]', 'a different value')
|
||||
assert.equal(cache.get(someObject), 'a value')
|
||||
// A similar object with same keys/values won't work,
|
||||
// because it's a different object identity
|
||||
assert.equal(cache.get({ a: 1 }), undefined)
|
||||
|
||||
cache.reset() // empty the cache
|
||||
```
|
||||
|
||||
If you put more stuff in it, then items will fall out.
|
||||
|
||||
If you try to put an oversized thing in it, then it'll fall out right
|
||||
away.
|
||||
|
||||
## Options
|
||||
|
||||
* `max` The maximum size of the cache, checked by applying the length
|
||||
function to all values in the cache. Not setting this is kind of
|
||||
silly, since that's the whole purpose of this lib, but it defaults
|
||||
to `Infinity`. Setting it to a non-number or negative number will
|
||||
throw a `TypeError`. Setting it to 0 makes it be `Infinity`.
|
||||
* `maxAge` Maximum age in ms. Items are not pro-actively pruned out
|
||||
as they age, but if you try to get an item that is too old, it'll
|
||||
drop it and return undefined instead of giving it to you.
|
||||
Setting this to a negative value will make everything seem old!
|
||||
Setting it to a non-number will throw a `TypeError`.
|
||||
* `length` Function that is used to calculate the length of stored
|
||||
items. If you're storing strings or buffers, then you probably want
|
||||
to do something like `function(n, key){return n.length}`. The default is
|
||||
`function(){return 1}`, which is fine if you want to store `max`
|
||||
like-sized things. The item is passed as the first argument, and
|
||||
the key is passed as the second argumnet.
|
||||
* `dispose` Function that is called on items when they are dropped
|
||||
from the cache. This can be handy if you want to close file
|
||||
descriptors or do other cleanup tasks when items are no longer
|
||||
accessible. Called with `key, value`. It's called *before*
|
||||
actually removing the item from the internal cache, so if you want
|
||||
to immediately put it back in, you'll have to do that in a
|
||||
`nextTick` or `setTimeout` callback or it won't do anything.
|
||||
* `stale` By default, if you set a `maxAge`, it'll only actually pull
|
||||
stale items out of the cache when you `get(key)`. (That is, it's
|
||||
not pre-emptively doing a `setTimeout` or anything.) If you set
|
||||
`stale:true`, it'll return the stale value before deleting it. If
|
||||
you don't set this, then it'll return `undefined` when you try to
|
||||
get a stale entry, as if it had already been deleted.
|
||||
* `noDisposeOnSet` By default, if you set a `dispose()` method, then
|
||||
it'll be called whenever a `set()` operation overwrites an existing
|
||||
key. If you set this option, `dispose()` will only be called when a
|
||||
key falls out of the cache, not when it is overwritten.
|
||||
* `updateAgeOnGet` When using time-expiring entries with `maxAge`,
|
||||
setting this to `true` will make each item's effective time update
|
||||
to the current time whenever it is retrieved from cache, causing it
|
||||
to not expire. (It can still fall out of cache based on recency of
|
||||
use, of course.)
|
||||
|
||||
## API
|
||||
|
||||
* `set(key, value, maxAge)`
|
||||
* `get(key) => value`
|
||||
|
||||
Both of these will update the "recently used"-ness of the key.
|
||||
They do what you think. `maxAge` is optional and overrides the
|
||||
cache `maxAge` option if provided.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
The key and val can be any value.
|
||||
|
||||
* `peek(key)`
|
||||
|
||||
Returns the key value (or `undefined` if not found) without
|
||||
updating the "recently used"-ness of the key.
|
||||
|
||||
(If you find yourself using this a lot, you *might* be using the
|
||||
wrong sort of data structure, but there are some use cases where
|
||||
it's handy.)
|
||||
|
||||
* `del(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
* `reset()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
* `has(key)`
|
||||
|
||||
Check if a key is in the cache, without updating the recent-ness
|
||||
or deleting it for being stale.
|
||||
|
||||
* `forEach(function(value,key,cache), [thisp])`
|
||||
|
||||
Just like `Array.prototype.forEach`. Iterates over all the keys
|
||||
in the cache, in order of recent-ness. (Ie, more recently used
|
||||
items are iterated over first.)
|
||||
|
||||
* `rforEach(function(value,key,cache), [thisp])`
|
||||
|
||||
The same as `cache.forEach(...)` but items are iterated over in
|
||||
reverse order. (ie, less recently used items are iterated over
|
||||
first.)
|
||||
|
||||
* `keys()`
|
||||
|
||||
Return an array of the keys in the cache.
|
||||
|
||||
* `values()`
|
||||
|
||||
Return an array of the values in the cache.
|
||||
|
||||
* `length`
|
||||
|
||||
Return total length of objects in cache taking into account
|
||||
`length` options function.
|
||||
|
||||
* `itemCount`
|
||||
|
||||
Return total quantity of objects currently in cache. Note, that
|
||||
`stale` (see options) items are returned as part of this item
|
||||
count.
|
||||
|
||||
* `dump()`
|
||||
|
||||
Return an array of the cache entries ready for serialization and usage
|
||||
with 'destinationCache.load(arr)`.
|
||||
|
||||
* `load(cacheEntriesArray)`
|
||||
|
||||
Loads another cache entries array, obtained with `sourceCache.dump()`,
|
||||
into the cache. The destination cache is reset before loading new entries
|
||||
|
||||
* `prune()`
|
||||
|
||||
Manually iterates over the entire cache proactively pruning old entries
|
334
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/index.js
generated
vendored
Normal file
334
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/index.js
generated
vendored
Normal file
|
@ -0,0 +1,334 @@
|
|||
'use strict'
|
||||
|
||||
// A linked list to keep track of recently-used-ness
|
||||
const Yallist = require('yallist')
|
||||
|
||||
const MAX = Symbol('max')
|
||||
const LENGTH = Symbol('length')
|
||||
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
|
||||
const ALLOW_STALE = Symbol('allowStale')
|
||||
const MAX_AGE = Symbol('maxAge')
|
||||
const DISPOSE = Symbol('dispose')
|
||||
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
|
||||
const LRU_LIST = Symbol('lruList')
|
||||
const CACHE = Symbol('cache')
|
||||
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
|
||||
|
||||
const naiveLength = () => 1
|
||||
|
||||
// lruList is a yallist where the head is the youngest
|
||||
// item, and the tail is the oldest. the list contains the Hit
|
||||
// objects as the entries.
|
||||
// Each Hit object has a reference to its Yallist.Node. This
|
||||
// never changes.
|
||||
//
|
||||
// cache is a Map (or PseudoMap) that matches the keys to
|
||||
// the Yallist.Node object.
|
||||
class LRUCache {
|
||||
constructor (options) {
|
||||
if (typeof options === 'number')
|
||||
options = { max: options }
|
||||
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
if (options.max && (typeof options.max !== 'number' || options.max < 0))
|
||||
throw new TypeError('max must be a non-negative number')
|
||||
// Kind of weird to have a default max of Infinity, but oh well.
|
||||
const max = this[MAX] = options.max || Infinity
|
||||
|
||||
const lc = options.length || naiveLength
|
||||
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
|
||||
this[ALLOW_STALE] = options.stale || false
|
||||
if (options.maxAge && typeof options.maxAge !== 'number')
|
||||
throw new TypeError('maxAge must be a number')
|
||||
this[MAX_AGE] = options.maxAge || 0
|
||||
this[DISPOSE] = options.dispose
|
||||
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
|
||||
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
|
||||
this.reset()
|
||||
}
|
||||
|
||||
// resize the cache when the max changes.
|
||||
set max (mL) {
|
||||
if (typeof mL !== 'number' || mL < 0)
|
||||
throw new TypeError('max must be a non-negative number')
|
||||
|
||||
this[MAX] = mL || Infinity
|
||||
trim(this)
|
||||
}
|
||||
get max () {
|
||||
return this[MAX]
|
||||
}
|
||||
|
||||
set allowStale (allowStale) {
|
||||
this[ALLOW_STALE] = !!allowStale
|
||||
}
|
||||
get allowStale () {
|
||||
return this[ALLOW_STALE]
|
||||
}
|
||||
|
||||
set maxAge (mA) {
|
||||
if (typeof mA !== 'number')
|
||||
throw new TypeError('maxAge must be a non-negative number')
|
||||
|
||||
this[MAX_AGE] = mA
|
||||
trim(this)
|
||||
}
|
||||
get maxAge () {
|
||||
return this[MAX_AGE]
|
||||
}
|
||||
|
||||
// resize the cache when the lengthCalculator changes.
|
||||
set lengthCalculator (lC) {
|
||||
if (typeof lC !== 'function')
|
||||
lC = naiveLength
|
||||
|
||||
if (lC !== this[LENGTH_CALCULATOR]) {
|
||||
this[LENGTH_CALCULATOR] = lC
|
||||
this[LENGTH] = 0
|
||||
this[LRU_LIST].forEach(hit => {
|
||||
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
|
||||
this[LENGTH] += hit.length
|
||||
})
|
||||
}
|
||||
trim(this)
|
||||
}
|
||||
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
|
||||
|
||||
get length () { return this[LENGTH] }
|
||||
get itemCount () { return this[LRU_LIST].length }
|
||||
|
||||
rforEach (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (let walker = this[LRU_LIST].tail; walker !== null;) {
|
||||
const prev = walker.prev
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
|
||||
forEach (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (let walker = this[LRU_LIST].head; walker !== null;) {
|
||||
const next = walker.next
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = next
|
||||
}
|
||||
}
|
||||
|
||||
keys () {
|
||||
return this[LRU_LIST].toArray().map(k => k.key)
|
||||
}
|
||||
|
||||
values () {
|
||||
return this[LRU_LIST].toArray().map(k => k.value)
|
||||
}
|
||||
|
||||
reset () {
|
||||
if (this[DISPOSE] &&
|
||||
this[LRU_LIST] &&
|
||||
this[LRU_LIST].length) {
|
||||
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
|
||||
}
|
||||
|
||||
this[CACHE] = new Map() // hash of items by key
|
||||
this[LRU_LIST] = new Yallist() // list of items in order of use recency
|
||||
this[LENGTH] = 0 // length of items in the list
|
||||
}
|
||||
|
||||
dump () {
|
||||
return this[LRU_LIST].map(hit =>
|
||||
isStale(this, hit) ? false : {
|
||||
k: hit.key,
|
||||
v: hit.value,
|
||||
e: hit.now + (hit.maxAge || 0)
|
||||
}).toArray().filter(h => h)
|
||||
}
|
||||
|
||||
dumpLru () {
|
||||
return this[LRU_LIST]
|
||||
}
|
||||
|
||||
set (key, value, maxAge) {
|
||||
maxAge = maxAge || this[MAX_AGE]
|
||||
|
||||
if (maxAge && typeof maxAge !== 'number')
|
||||
throw new TypeError('maxAge must be a number')
|
||||
|
||||
const now = maxAge ? Date.now() : 0
|
||||
const len = this[LENGTH_CALCULATOR](value, key)
|
||||
|
||||
if (this[CACHE].has(key)) {
|
||||
if (len > this[MAX]) {
|
||||
del(this, this[CACHE].get(key))
|
||||
return false
|
||||
}
|
||||
|
||||
const node = this[CACHE].get(key)
|
||||
const item = node.value
|
||||
|
||||
// dispose of the old one before overwriting
|
||||
// split out into 2 ifs for better coverage tracking
|
||||
if (this[DISPOSE]) {
|
||||
if (!this[NO_DISPOSE_ON_SET])
|
||||
this[DISPOSE](key, item.value)
|
||||
}
|
||||
|
||||
item.now = now
|
||||
item.maxAge = maxAge
|
||||
item.value = value
|
||||
this[LENGTH] += len - item.length
|
||||
item.length = len
|
||||
this.get(key)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
const hit = new Entry(key, value, len, now, maxAge)
|
||||
|
||||
// oversized objects fall out of cache automatically.
|
||||
if (hit.length > this[MAX]) {
|
||||
if (this[DISPOSE])
|
||||
this[DISPOSE](key, value)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this[LENGTH] += hit.length
|
||||
this[LRU_LIST].unshift(hit)
|
||||
this[CACHE].set(key, this[LRU_LIST].head)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
has (key) {
|
||||
if (!this[CACHE].has(key)) return false
|
||||
const hit = this[CACHE].get(key).value
|
||||
return !isStale(this, hit)
|
||||
}
|
||||
|
||||
get (key) {
|
||||
return get(this, key, true)
|
||||
}
|
||||
|
||||
peek (key) {
|
||||
return get(this, key, false)
|
||||
}
|
||||
|
||||
pop () {
|
||||
const node = this[LRU_LIST].tail
|
||||
if (!node)
|
||||
return null
|
||||
|
||||
del(this, node)
|
||||
return node.value
|
||||
}
|
||||
|
||||
del (key) {
|
||||
del(this, this[CACHE].get(key))
|
||||
}
|
||||
|
||||
load (arr) {
|
||||
// reset the cache
|
||||
this.reset()
|
||||
|
||||
const now = Date.now()
|
||||
// A previous serialized cache has the most recent items first
|
||||
for (let l = arr.length - 1; l >= 0; l--) {
|
||||
const hit = arr[l]
|
||||
const expiresAt = hit.e || 0
|
||||
if (expiresAt === 0)
|
||||
// the item was created without expiration in a non aged cache
|
||||
this.set(hit.k, hit.v)
|
||||
else {
|
||||
const maxAge = expiresAt - now
|
||||
// dont add already expired items
|
||||
if (maxAge > 0) {
|
||||
this.set(hit.k, hit.v, maxAge)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prune () {
|
||||
this[CACHE].forEach((value, key) => get(this, key, false))
|
||||
}
|
||||
}
|
||||
|
||||
const get = (self, key, doUse) => {
|
||||
const node = self[CACHE].get(key)
|
||||
if (node) {
|
||||
const hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE])
|
||||
return undefined
|
||||
} else {
|
||||
if (doUse) {
|
||||
if (self[UPDATE_AGE_ON_GET])
|
||||
node.value.now = Date.now()
|
||||
self[LRU_LIST].unshiftNode(node)
|
||||
}
|
||||
}
|
||||
return hit.value
|
||||
}
|
||||
}
|
||||
|
||||
const isStale = (self, hit) => {
|
||||
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
|
||||
return false
|
||||
|
||||
const diff = Date.now() - hit.now
|
||||
return hit.maxAge ? diff > hit.maxAge
|
||||
: self[MAX_AGE] && (diff > self[MAX_AGE])
|
||||
}
|
||||
|
||||
const trim = self => {
|
||||
if (self[LENGTH] > self[MAX]) {
|
||||
for (let walker = self[LRU_LIST].tail;
|
||||
self[LENGTH] > self[MAX] && walker !== null;) {
|
||||
// We know that we're about to delete this one, and also
|
||||
// what the next least recently used key will be, so just
|
||||
// go ahead and set it now.
|
||||
const prev = walker.prev
|
||||
del(self, walker)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const del = (self, node) => {
|
||||
if (node) {
|
||||
const hit = node.value
|
||||
if (self[DISPOSE])
|
||||
self[DISPOSE](hit.key, hit.value)
|
||||
|
||||
self[LENGTH] -= hit.length
|
||||
self[CACHE].delete(hit.key)
|
||||
self[LRU_LIST].removeNode(node)
|
||||
}
|
||||
}
|
||||
|
||||
class Entry {
|
||||
constructor (key, value, length, now, maxAge) {
|
||||
this.key = key
|
||||
this.value = value
|
||||
this.length = length
|
||||
this.now = now
|
||||
this.maxAge = maxAge || 0
|
||||
}
|
||||
}
|
||||
|
||||
const forEachStep = (self, fn, node, thisp) => {
|
||||
let hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE])
|
||||
hit = undefined
|
||||
}
|
||||
if (hit)
|
||||
fn.call(thisp, hit.value, hit.key, self)
|
||||
}
|
||||
|
||||
module.exports = LRUCache
|
34
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/package.json
generated
vendored
Normal file
34
test/integration/test-fixtures/yarn-lock/node_modules/lru-cache/package.json
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "lru-cache",
|
||||
"description": "A cache object that deletes the least-recently-used items.",
|
||||
"version": "6.0.0",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me>",
|
||||
"keywords": [
|
||||
"mru",
|
||||
"lru",
|
||||
"cache"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags"
|
||||
},
|
||||
"main": "index.js",
|
||||
"repository": "git://github.com/isaacs/node-lru-cache.git",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"tap": "^14.10.7"
|
||||
},
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
}
|
2
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/.npmignore
generated
vendored
Normal file
2
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.log
|
||||
.DS_Store
|
9
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/.travis.yml
generated
vendored
Normal file
9
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 4.0
|
||||
- 0.12
|
||||
- 0.11
|
||||
- 0.10
|
||||
- 0.9
|
||||
- 0.8
|
||||
- 0.6
|
19
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/LICENSE.md
generated
vendored
Normal file
19
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2015 Oleksii Shevchenko <shevaroller@gmail.com> (http://shevaroller.me)
|
||||
|
||||
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.
|
24
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/README.md
generated
vendored
Normal file
24
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/README.md
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# node-merge-objects
|
||||
|
||||
Merge two objects and concatenate arrays that are values of the same object key.
|
||||
|
||||
Similar to extend in JQuery, but with arrays concatenation. Does deep merging too.
|
||||
|
||||
[![Build Status](https://secure.travis-ci.org/shevaroller/node-merge-objects.png)](http://travis-ci.org/shevaroller/node-merge-objects)
|
||||
|
||||
|
||||
## Installation
|
||||
npm install merge-objects --save
|
||||
|
||||
## Usage
|
||||
var merge = require('merge-objects');
|
||||
|
||||
var object1 = {a: 1, b: [2, 3]};
|
||||
var object2 = {b: [4, 5], c: 6};
|
||||
|
||||
var result = merge(object1, object2);
|
||||
console.log(result); //logs {a: 1, b: [2, 3, 4, 5], c: 6}
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
42
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/lib/merge-objects.js
generated
vendored
Normal file
42
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/lib/merge-objects.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Merge two objects and concatenate arrays that are values of the same object key
|
||||
*
|
||||
* @author Oleksii Shevchenko <shevaroller@gmail.com> (http://shevaroller.me)
|
||||
* @since 6 September 2015
|
||||
*/
|
||||
|
||||
var mergeObjects;
|
||||
|
||||
mergeObjects = function(object1, object2) {
|
||||
var key;
|
||||
|
||||
// concatenate not objects into arrays
|
||||
if (typeof object1 !== 'object') {
|
||||
if (typeof object2 !== 'object') {
|
||||
return [object1, object2];
|
||||
}
|
||||
return object2.concat(object1);
|
||||
}
|
||||
if (typeof object2 !== 'object') {
|
||||
return object1.concat(object2);
|
||||
}
|
||||
|
||||
// merge object2 into object1
|
||||
for (key in object2) {
|
||||
if ((Array.isArray(object1[key])) && (Array.isArray(object2[key]))) {
|
||||
// concatenate arrays that are values of the same object key
|
||||
object1[key] = object1[key].concat(object2[key]);
|
||||
} else if (typeof object1[key] === 'object' && typeof object2[key] === 'object') {
|
||||
// deep merge object2 into object1
|
||||
object1[key] = mergeObjects(object1[key], object2[key]);
|
||||
} else {
|
||||
object1[key] = object2[key];
|
||||
}
|
||||
}
|
||||
return object1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Exports Module mergeObjects
|
||||
*/
|
||||
module.exports = mergeObjects;
|
23
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/package.json
generated
vendored
Normal file
23
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/package.json
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "merge-objects",
|
||||
"version": "1.0.5",
|
||||
"description": "Merge two objects and concatenate arrays that are values of the same object key.",
|
||||
"main": "lib/merge-objects.js",
|
||||
"scripts": {
|
||||
"test": "node test/test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:shevaroller/node-merge-objects.git"
|
||||
},
|
||||
"keywords": [
|
||||
"merge",
|
||||
"object",
|
||||
"extend",
|
||||
"concat",
|
||||
"array",
|
||||
"mixin"
|
||||
],
|
||||
"author": "Oleksii Shevchenko <shevaroller@gmail.com> (http://shevaroller.me)",
|
||||
"license": "MIT"
|
||||
}
|
53
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/test/test.js
generated
vendored
Normal file
53
test/integration/test-fixtures/yarn-lock/node_modules/merge-objects/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
var merge = require('../lib/merge-objects');
|
||||
var assert = require('assert');
|
||||
|
||||
var object1, object2, result;
|
||||
|
||||
/* Test not objects */
|
||||
object1 = 0;
|
||||
object2 = 'a string';
|
||||
result = merge(object1, object2);
|
||||
|
||||
assert.deepEqual(result, [0, 'a string'], 'two not objects');
|
||||
|
||||
/* Test one object and one not object */
|
||||
object1 = [0, 1];
|
||||
object2 = 'a string';
|
||||
result = merge(object1, object2);
|
||||
|
||||
assert.deepEqual(result, [0, 1, 'a string'], 'one object and one not object');
|
||||
|
||||
/* Test one not object and one object */
|
||||
object1 = 0;
|
||||
object2 = ['a string', 'string2'];
|
||||
result = merge(object1, object2);
|
||||
|
||||
assert.deepEqual(result, ['a string', 'string2', 0], 'one not object and one object');
|
||||
|
||||
/* Test two objects with no depth */
|
||||
object1 = {a: 1};
|
||||
object2 = {b: 2};
|
||||
result = merge(object1, object2);
|
||||
|
||||
assert.deepEqual(result, {a: 1, b: 2}, 'two objects with no depth');
|
||||
|
||||
/* Test two objects with equal keys */
|
||||
object1 = {a: 1};
|
||||
object2 = {a: 2};
|
||||
result = merge(object1, object2);
|
||||
|
||||
assert.deepEqual(result, {a: 2}, 'two objects with equal keys');
|
||||
|
||||
/* Test array concatenation inside objects */
|
||||
object1 = {a: 1, b: [2, 3]};
|
||||
object2 = {b: [4, 5], c: 6};
|
||||
result = merge(object1, object2);
|
||||
|
||||
assert.deepEqual(result, {a: 1, b: [2, 3, 4, 5], c: 6}, 'array concatenation inside objects');
|
||||
|
||||
/* Test two objects with depth and equal keys */
|
||||
object1 = {a: {b: [0, 1], c: 'a'}};
|
||||
object2 = {a: {b: [2, 3], c: 'b'}};
|
||||
result = merge(object1, object2);
|
||||
|
||||
assert.deepEqual(result, {a: {b: [0, 1, 2, 3], c: 'b'}}, 'two objects with depth and equal keys');
|
15
test/integration/test-fixtures/yarn-lock/node_modules/semver/LICENSE
generated
vendored
Normal file
15
test/integration/test-fixtures/yarn-lock/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.
|
566
test/integration/test-fixtures/yarn-lock/node_modules/semver/README.md
generated
vendored
Normal file
566
test/integration/test-fixtures/yarn-lock/node_modules/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,566 @@
|
|||
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'
|
||||
```
|
||||
|
||||
You can also just load the module for the function that you care about, if
|
||||
you'd like to minimize your footprint.
|
||||
|
||||
```js
|
||||
// load the whole API at once in a single object
|
||||
const semver = require('semver')
|
||||
|
||||
// or just load the bits you need
|
||||
// all of them listed here, just pick and choose what you want
|
||||
|
||||
// classes
|
||||
const SemVer = require('semver/classes/semver')
|
||||
const Comparator = require('semver/classes/comparator')
|
||||
const Range = require('semver/classes/range')
|
||||
|
||||
// functions for working with versions
|
||||
const semverParse = require('semver/functions/parse')
|
||||
const semverValid = require('semver/functions/valid')
|
||||
const semverClean = require('semver/functions/clean')
|
||||
const semverInc = require('semver/functions/inc')
|
||||
const semverDiff = require('semver/functions/diff')
|
||||
const semverMajor = require('semver/functions/major')
|
||||
const semverMinor = require('semver/functions/minor')
|
||||
const semverPatch = require('semver/functions/patch')
|
||||
const semverPrerelease = require('semver/functions/prerelease')
|
||||
const semverCompare = require('semver/functions/compare')
|
||||
const semverRcompare = require('semver/functions/rcompare')
|
||||
const semverCompareLoose = require('semver/functions/compare-loose')
|
||||
const semverCompareBuild = require('semver/functions/compare-build')
|
||||
const semverSort = require('semver/functions/sort')
|
||||
const semverRsort = require('semver/functions/rsort')
|
||||
|
||||
// low-level comparators between versions
|
||||
const semverGt = require('semver/functions/gt')
|
||||
const semverLt = require('semver/functions/lt')
|
||||
const semverEq = require('semver/functions/eq')
|
||||
const semverNeq = require('semver/functions/neq')
|
||||
const semverGte = require('semver/functions/gte')
|
||||
const semverLte = require('semver/functions/lte')
|
||||
const semverCmp = require('semver/functions/cmp')
|
||||
const semverCoerce = require('semver/functions/coerce')
|
||||
|
||||
// working with ranges
|
||||
const semverSatisfies = require('semver/functions/satisfies')
|
||||
const semverMaxSatisfying = require('semver/ranges/max-satisfying')
|
||||
const semverMinSatisfying = require('semver/ranges/min-satisfying')
|
||||
const semverToComparators = require('semver/ranges/to-comparators')
|
||||
const semverMinVersion = require('semver/ranges/min-version')
|
||||
const semverValidRange = require('semver/ranges/valid')
|
||||
const semverOutside = require('semver/ranges/outside')
|
||||
const semverGtr = require('semver/ranges/gtr')
|
||||
const semverLtr = require('semver/ranges/ltr')
|
||||
const semverIntersects = require('semver/ranges/intersects')
|
||||
const simplifyRange = require('semver/ranges/simplify')
|
||||
const rangeSubset = require('semver/ranges/subset')
|
||||
```
|
||||
|
||||
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-0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.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-0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0-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-0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-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-0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.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.
|
||||
|
||||
#### 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`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0-0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4-0`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.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-0` 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.0.x` := `>=0.0.0 <0.1.0-0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0-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`
|
||||
* `^0.x` := `>=0.0.0 <1.0.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
|
||||
* `simplifyRange(versions, range)`: Return a "simplified" range that
|
||||
matches the same items in `versions` list as the range specified. Note
|
||||
that it does *not* guarantee that it would match the same versions in all
|
||||
cases, only for the set of versions provided. This is useful when
|
||||
generating ranges by joining together multiple versions with `||`
|
||||
programmatically, to provide the user with something a bit more
|
||||
ergonomic. If the provided range is shorter in string-length than the
|
||||
generated range, then that is returned.
|
||||
* `subset(subRange, superRange)`: Return `true` if the `subRange` range is
|
||||
entirely contained by the `superRange` range.
|
||||
|
||||
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
test/integration/test-fixtures/yarn-lock/node_modules/semver/bin/semver.js
generated
vendored
Executable file
173
test/integration/test-fixtures/yarn-lock/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()
|
135
test/integration/test-fixtures/yarn-lock/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
135
test/integration/test-fixtures/yarn-lock/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
|
@ -0,0 +1,135 @@
|
|||
const ANY = Symbol('SemVer ANY')
|
||||
// hoisted class for cyclic dependency
|
||||
class Comparator {
|
||||
static get ANY () {
|
||||
return ANY
|
||||
}
|
||||
constructor (comp, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (comp instanceof Comparator) {
|
||||
if (comp.loose === !!options.loose) {
|
||||
return comp
|
||||
} else {
|
||||
comp = comp.value
|
||||
}
|
||||
}
|
||||
|
||||
debug('comparator', comp, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.parse(comp)
|
||||
|
||||
if (this.semver === ANY) {
|
||||
this.value = ''
|
||||
} else {
|
||||
this.value = this.operator + this.semver.version
|
||||
}
|
||||
|
||||
debug('comp', this)
|
||||
}
|
||||
|
||||
parse (comp) {
|
||||
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
const m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid comparator: ${comp}`)
|
||||
}
|
||||
|
||||
this.operator = m[1] !== undefined ? m[1] : ''
|
||||
if (this.operator === '=') {
|
||||
this.operator = ''
|
||||
}
|
||||
|
||||
// if it literally is just '>' or '' then allow anything.
|
||||
if (!m[2]) {
|
||||
this.semver = ANY
|
||||
} else {
|
||||
this.semver = new SemVer(m[2], this.options.loose)
|
||||
}
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.value
|
||||
}
|
||||
|
||||
test (version) {
|
||||
debug('Comparator.test', version, this.options.loose)
|
||||
|
||||
if (this.semver === ANY || version === ANY) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.options)
|
||||
}
|
||||
|
||||
intersects (comp, options) {
|
||||
if (!(comp instanceof Comparator)) {
|
||||
throw new TypeError('a Comparator is required')
|
||||
}
|
||||
|
||||
if (!options || typeof options !== 'object') {
|
||||
options = {
|
||||
loose: !!options,
|
||||
includePrerelease: false
|
||||
}
|
||||
}
|
||||
|
||||
if (this.operator === '') {
|
||||
if (this.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(comp.value, options).test(this.value)
|
||||
} else if (comp.operator === '') {
|
||||
if (comp.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(this.value, options).test(comp.semver)
|
||||
}
|
||||
|
||||
const sameDirectionIncreasing =
|
||||
(this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '>=' || comp.operator === '>')
|
||||
const sameDirectionDecreasing =
|
||||
(this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '<=' || comp.operator === '<')
|
||||
const sameSemVer = this.semver.version === comp.semver.version
|
||||
const differentDirectionsInclusive =
|
||||
(this.operator === '>=' || this.operator === '<=') &&
|
||||
(comp.operator === '>=' || comp.operator === '<=')
|
||||
const oppositeDirectionsLessThan =
|
||||
cmp(this.semver, '<', comp.semver, options) &&
|
||||
(this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '<=' || comp.operator === '<')
|
||||
const oppositeDirectionsGreaterThan =
|
||||
cmp(this.semver, '>', comp.semver, options) &&
|
||||
(this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '>=' || comp.operator === '>')
|
||||
|
||||
return (
|
||||
sameDirectionIncreasing ||
|
||||
sameDirectionDecreasing ||
|
||||
(sameSemVer && differentDirectionsInclusive) ||
|
||||
oppositeDirectionsLessThan ||
|
||||
oppositeDirectionsGreaterThan
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Comparator
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const {re, t} = require('../internal/re')
|
||||
const cmp = require('../functions/cmp')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const Range = require('./range')
|
5
test/integration/test-fixtures/yarn-lock/node_modules/semver/classes/index.js
generated
vendored
Normal file
5
test/integration/test-fixtures/yarn-lock/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')
|
||||
}
|
510
test/integration/test-fixtures/yarn-lock/node_modules/semver/classes/range.js
generated
vendored
Normal file
510
test/integration/test-fixtures/yarn-lock/node_modules/semver/classes/range.js
generated
vendored
Normal file
|
@ -0,0 +1,510 @@
|
|||
// hoisted class for cyclic dependency
|
||||
class Range {
|
||||
constructor (range, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
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}`)
|
||||
}
|
||||
|
||||
// if we have any that are not the null set, throw out null sets.
|
||||
if (this.set.length > 1) {
|
||||
// keep the first one, in case they're all null sets
|
||||
const first = this.set[0]
|
||||
this.set = this.set.filter(c => !isNullSet(c[0]))
|
||||
if (this.set.length === 0)
|
||||
this.set = [first]
|
||||
else if (this.set.length > 1) {
|
||||
// if we have any that are *, then the range is just *
|
||||
for (const c of this.set) {
|
||||
if (c.length === 1 && isAny(c[0])) {
|
||||
this.set = [c]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.range = this.set
|
||||
.map((comps) => {
|
||||
return comps.join(' ').trim()
|
||||
})
|
||||
.join('||')
|
||||
.trim()
|
||||
return this.range
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.range
|
||||
}
|
||||
|
||||
parseRange (range) {
|
||||
range = range.trim()
|
||||
|
||||
// memoize range parsing for performance.
|
||||
// this is a very hot path, and fully deterministic.
|
||||
const memoOpts = Object.keys(this.options).join(',')
|
||||
const memoKey = `parseRange:${memoOpts}:${range}`
|
||||
const cached = cache.get(memoKey)
|
||||
if (cached)
|
||||
return cached
|
||||
|
||||
const loose = this.options.loose
|
||||
// `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(this.options.includePrerelease))
|
||||
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]
|
||||
const rangeList = range
|
||||
.split(' ')
|
||||
.map(comp => parseComparator(comp, this.options))
|
||||
.join(' ')
|
||||
.split(/\s+/)
|
||||
// >=0.0.0 is equivalent to *
|
||||
.map(comp => replaceGTE0(comp, this.options))
|
||||
// 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))
|
||||
|
||||
// if any comparators are the null set, then replace with JUST null set
|
||||
// if more than one comparator, remove any * comparators
|
||||
// also, don't include the same comparator more than once
|
||||
const l = rangeList.length
|
||||
const rangeMap = new Map()
|
||||
for (const comp of rangeList) {
|
||||
if (isNullSet(comp))
|
||||
return [comp]
|
||||
rangeMap.set(comp.value, comp)
|
||||
}
|
||||
if (rangeMap.size > 1 && rangeMap.has(''))
|
||||
rangeMap.delete('')
|
||||
|
||||
const result = [...rangeMap.values()]
|
||||
cache.set(memoKey, result)
|
||||
return result
|
||||
}
|
||||
|
||||
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 LRU = require('lru-cache')
|
||||
const cache = new LRU({ max: 1000 })
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const Comparator = require('./comparator')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const {
|
||||
re,
|
||||
t,
|
||||
comparatorTrimReplace,
|
||||
tildeTrimReplace,
|
||||
caretTrimReplace
|
||||
} = require('../internal/re')
|
||||
|
||||
const isNullSet = c => c.value === '<0.0.0-0'
|
||||
const isAny = c => c.value === ''
|
||||
|
||||
// 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-0
|
||||
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
|
||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-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-0`
|
||||
} else if (isX(p)) {
|
||||
// ~1.2 == >=1.2.0 <1.3.0-0
|
||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
|
||||
} else if (pr) {
|
||||
debug('replaceTilde pr', pr)
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
// ~1.2.3 == >=1.2.3 <1.3.0-0
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
debug('tilde return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// ^ --> * (any, kinda silly)
|
||||
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
||||
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
||||
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
||||
// ^1.2.0 --> >=1.2.0 <2.0.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]
|
||||
const z = options.includePrerelease ? '-0' : ''
|
||||
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${z} <${+M + 1}.0.0-0`
|
||||
} else if (isX(p)) {
|
||||
if (M === '0') {
|
||||
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else if (pr) {
|
||||
debug('replaceCaret pr', pr)
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else {
|
||||
debug('no pr')
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${+M + 1}.0.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
|
||||
}
|
||||
}
|
||||
|
||||
if (gtlt === '<')
|
||||
pr = '-0'
|
||||
|
||||
ret = `${gtlt + M}.${m}.${p}${pr}`
|
||||
} else if (xm) {
|
||||
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
|
||||
} else if (xp) {
|
||||
ret = `>=${M}.${m}.0${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
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], '')
|
||||
}
|
||||
|
||||
const replaceGTE0 = (comp, options) => {
|
||||
debug('replaceGTE0', comp, options)
|
||||
return comp.trim()
|
||||
.replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
|
||||
}
|
||||
|
||||
// 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-0 Any 3.4.x will do
|
||||
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
||||
const hyphenReplace = incPr => ($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${incPr ? '-0' : ''}`
|
||||
} else if (isX(fp)) {
|
||||
from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
|
||||
} else if (fpr) {
|
||||
from = `>=${from}`
|
||||
} else {
|
||||
from = `>=${from}${incPr ? '-0' : ''}`
|
||||
}
|
||||
|
||||
if (isX(tM)) {
|
||||
to = ''
|
||||
} else if (isX(tm)) {
|
||||
to = `<${+tM + 1}.0.0-0`
|
||||
} else if (isX(tp)) {
|
||||
to = `<${tM}.${+tm + 1}.0-0`
|
||||
} else if (tpr) {
|
||||
to = `<=${tM}.${tm}.${tp}-${tpr}`
|
||||
} else if (incPr) {
|
||||
to = `<${tM}.${tm}.${+tp + 1}-0`
|
||||
} 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
|
||||
}
|
287
test/integration/test-fixtures/yarn-lock/node_modules/semver/classes/semver.js
generated
vendored
Normal file
287
test/integration/test-fixtures/yarn-lock/node_modules/semver/classes/semver.js
generated
vendored
Normal file
|
@ -0,0 +1,287 @@
|
|||
const debug = require('../internal/debug')
|
||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { compareIdentifiers } = require('../internal/identifiers')
|
||||
class SemVer {
|
||||
constructor (version, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === !!options.loose &&
|
||||
version.includePrerelease === !!options.includePrerelease) {
|
||||
return version
|
||||
} else {
|
||||
version = version.version
|
||||
}
|
||||
} else if (typeof version !== 'string') {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
throw new TypeError(
|
||||
`version is longer than ${MAX_LENGTH} characters`
|
||||
)
|
||||
}
|
||||
|
||||
debug('SemVer', version, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
// this isn't actually relevant for versions, but keep it so that we
|
||||
// don't run into trouble passing this.options around.
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
this.raw = version
|
||||
|
||||
// these are actually numbers
|
||||
this.major = +m[1]
|
||||
this.minor = +m[2]
|
||||
this.patch = +m[3]
|
||||
|
||||
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
||||
throw new TypeError('Invalid major version')
|
||||
}
|
||||
|
||||
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
||||
throw new TypeError('Invalid minor version')
|
||||
}
|
||||
|
||||
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
||||
throw new TypeError('Invalid patch version')
|
||||
}
|
||||
|
||||
// numberify any prerelease numeric ids
|
||||
if (!m[4]) {
|
||||
this.prerelease = []
|
||||
} else {
|
||||
this.prerelease = m[4].split('.').map((id) => {
|
||||
if (/^[0-9]+$/.test(id)) {
|
||||
const num = +id
|
||||
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
||||
return num
|
||||
}
|
||||
}
|
||||
return id
|
||||
})
|
||||
}
|
||||
|
||||
this.build = m[5] ? m[5].split('.') : []
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.version = `${this.major}.${this.minor}.${this.patch}`
|
||||
if (this.prerelease.length) {
|
||||
this.version += `-${this.prerelease.join('.')}`
|
||||
}
|
||||
return this.version
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.version
|
||||
}
|
||||
|
||||
compare (other) {
|
||||
debug('SemVer.compare', this.version, this.options, other)
|
||||
if (!(other instanceof SemVer)) {
|
||||
if (typeof other === 'string' && other === this.version) {
|
||||
return 0
|
||||
}
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
if (other.version === this.version) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other)
|
||||
}
|
||||
|
||||
compareMain (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
return (
|
||||
compareIdentifiers(this.major, other.major) ||
|
||||
compareIdentifiers(this.minor, other.minor) ||
|
||||
compareIdentifiers(this.patch, other.patch)
|
||||
)
|
||||
}
|
||||
|
||||
comparePre (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length) {
|
||||
return -1
|
||||
} else if (!this.prerelease.length && other.prerelease.length) {
|
||||
return 1
|
||||
} else if (!this.prerelease.length && !other.prerelease.length) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.prerelease[i]
|
||||
const b = other.prerelease[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
compareBuild (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.build[i]
|
||||
const b = other.build[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
inc (release, identifier) {
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor = 0
|
||||
this.major++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'preminor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor++
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0
|
||||
this.inc('patch', identifier)
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.inc('patch', identifier)
|
||||
}
|
||||
this.inc('pre', identifier)
|
||||
break
|
||||
|
||||
case 'major':
|
||||
// If this is a pre-major version, bump up to the same major version.
|
||||
// Otherwise increment major.
|
||||
// 1.0.0-5 bumps to 1.0.0
|
||||
// 1.1.0 bumps to 2.0.0
|
||||
if (
|
||||
this.minor !== 0 ||
|
||||
this.patch !== 0 ||
|
||||
this.prerelease.length === 0
|
||||
) {
|
||||
this.major++
|
||||
}
|
||||
this.minor = 0
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'minor':
|
||||
// If this is a pre-minor version, bump up to the same minor version.
|
||||
// Otherwise increment minor.
|
||||
// 1.2.0-5 bumps to 1.2.0
|
||||
// 1.2.1 bumps to 1.3.0
|
||||
if (this.patch !== 0 || this.prerelease.length === 0) {
|
||||
this.minor++
|
||||
}
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'patch':
|
||||
// If this is not a pre-release version, it will increment the patch.
|
||||
// If it is a pre-release it will bump up to the same patch version.
|
||||
// 1.2.0-5 patches to 1.2.0
|
||||
// 1.2.0 patches to 1.2.1
|
||||
if (this.prerelease.length === 0) {
|
||||
this.patch++
|
||||
}
|
||||
this.prerelease = []
|
||||
break
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.prerelease = [0]
|
||||
} else {
|
||||
let i = this.prerelease.length
|
||||
while (--i >= 0) {
|
||||
if (typeof this.prerelease[i] === 'number') {
|
||||
this.prerelease[i]++
|
||||
i = -2
|
||||
}
|
||||
}
|
||||
if (i === -1) {
|
||||
// didn't increment anything
|
||||
this.prerelease.push(0)
|
||||
}
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
if (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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/clean.js
generated
vendored
Normal file
6
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
48
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
51
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
7
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/compare.js
generated
vendored
Normal file
5
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/compare.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
const SemVer = require('../classes/semver')
|
||||
const compare = (a, b, loose) =>
|
||||
new SemVer(a, loose).compare(new SemVer(b, loose))
|
||||
|
||||
module.exports = compare
|
23
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/diff.js
generated
vendored
Normal file
23
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/diff.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
const parse = require('./parse')
|
||||
const eq = require('./eq')
|
||||
|
||||
const diff = (version1, version2) => {
|
||||
if (eq(version1, version2)) {
|
||||
return null
|
||||
} else {
|
||||
const v1 = parse(version1)
|
||||
const v2 = parse(version2)
|
||||
const hasPre = v1.prerelease.length || v2.prerelease.length
|
||||
const prefix = hasPre ? 'pre' : ''
|
||||
const defaultResult = hasPre ? 'prerelease' : ''
|
||||
for (const key in v1) {
|
||||
if (key === 'major' || key === 'minor' || key === 'patch') {
|
||||
if (v1[key] !== v2[key]) {
|
||||
return prefix + key
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultResult // may be undefined
|
||||
}
|
||||
}
|
||||
module.exports = diff
|
3
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/eq.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/gt.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/gte.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/inc.js
generated
vendored
Normal file
15
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/lt.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/lte.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/major.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/minor.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/neq.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/neq.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
const compare = require('./compare')
|
||||
const neq = (a, b, loose) => compare(a, b, loose) !== 0
|
||||
module.exports = neq
|
33
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/parse.js
generated
vendored
Normal file
33
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
const {MAX_LENGTH} = require('../internal/constants')
|
||||
const { re, t } = require('../internal/re')
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const parse = (version, options) => {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
return null
|
||||
}
|
||||
|
||||
const r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(version, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parse
|
3
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/patch.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
6
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
10
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/sort.js
generated
vendored
Normal file
3
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/functions/valid.js
generated
vendored
Normal file
6
test/integration/test-fixtures/yarn-lock/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
|
48
test/integration/test-fixtures/yarn-lock/node_modules/semver/index.js
generated
vendored
Normal file
48
test/integration/test-fixtures/yarn-lock/node_modules/semver/index.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
// just pre-load all the stuff that index.js lazily exports
|
||||
const internalRe = require('./internal/re')
|
||||
module.exports = {
|
||||
re: internalRe.re,
|
||||
src: internalRe.src,
|
||||
tokens: internalRe.t,
|
||||
SEMVER_SPEC_VERSION: require('./internal/constants').SEMVER_SPEC_VERSION,
|
||||
SemVer: require('./classes/semver'),
|
||||
compareIdentifiers: require('./internal/identifiers').compareIdentifiers,
|
||||
rcompareIdentifiers: require('./internal/identifiers').rcompareIdentifiers,
|
||||
parse: require('./functions/parse'),
|
||||
valid: require('./functions/valid'),
|
||||
clean: require('./functions/clean'),
|
||||
inc: require('./functions/inc'),
|
||||
diff: require('./functions/diff'),
|
||||
major: require('./functions/major'),
|
||||
minor: require('./functions/minor'),
|
||||
patch: require('./functions/patch'),
|
||||
prerelease: require('./functions/prerelease'),
|
||||
compare: require('./functions/compare'),
|
||||
rcompare: require('./functions/rcompare'),
|
||||
compareLoose: require('./functions/compare-loose'),
|
||||
compareBuild: require('./functions/compare-build'),
|
||||
sort: require('./functions/sort'),
|
||||
rsort: require('./functions/rsort'),
|
||||
gt: require('./functions/gt'),
|
||||
lt: require('./functions/lt'),
|
||||
eq: require('./functions/eq'),
|
||||
neq: require('./functions/neq'),
|
||||
gte: require('./functions/gte'),
|
||||
lte: require('./functions/lte'),
|
||||
cmp: require('./functions/cmp'),
|
||||
coerce: require('./functions/coerce'),
|
||||
Comparator: require('./classes/comparator'),
|
||||
Range: require('./classes/range'),
|
||||
satisfies: require('./functions/satisfies'),
|
||||
toComparators: require('./ranges/to-comparators'),
|
||||
maxSatisfying: require('./ranges/max-satisfying'),
|
||||
minSatisfying: require('./ranges/min-satisfying'),
|
||||
minVersion: require('./ranges/min-version'),
|
||||
validRange: require('./ranges/valid'),
|
||||
outside: require('./ranges/outside'),
|
||||
gtr: require('./ranges/gtr'),
|
||||
ltr: require('./ranges/ltr'),
|
||||
intersects: require('./ranges/intersects'),
|
||||
simplifyRange: require('./ranges/simplify'),
|
||||
subset: require('./ranges/subset'),
|
||||
}
|
17
test/integration/test-fixtures/yarn-lock/node_modules/semver/internal/constants.js
generated
vendored
Normal file
17
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/internal/debug.js
generated
vendored
Normal file
9
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/internal/identifiers.js
generated
vendored
Normal file
23
test/integration/test-fixtures/yarn-lock/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
|
||||
}
|
11
test/integration/test-fixtures/yarn-lock/node_modules/semver/internal/parse-options.js
generated
vendored
Normal file
11
test/integration/test-fixtures/yarn-lock/node_modules/semver/internal/parse-options.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
// parse out just the options we care about so we always get a consistent
|
||||
// obj with keys in a consistent order.
|
||||
const opts = ['includePrerelease', 'loose', 'rtl']
|
||||
const parseOptions = options =>
|
||||
!options ? {}
|
||||
: typeof options !== 'object' ? { loose: true }
|
||||
: opts.filter(k => options[k]).reduce((options, k) => {
|
||||
options[k] = true
|
||||
return options
|
||||
}, {})
|
||||
module.exports = parseOptions
|
182
test/integration/test-fixtures/yarn-lock/node_modules/semver/internal/re.js
generated
vendored
Normal file
182
test/integration/test-fixtures/yarn-lock/node_modules/semver/internal/re.js
generated
vendored
Normal file
|
@ -0,0 +1,182 @@
|
|||
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*\\*')
|
||||
// >=0.0.0 is like a star
|
||||
createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
|
||||
createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
|
41
test/integration/test-fixtures/yarn-lock/node_modules/semver/package.json
generated
vendored
Normal file
41
test/integration/test-fixtures/yarn-lock/node_modules/semver/package.json
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "semver",
|
||||
"version": "7.3.5",
|
||||
"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.7"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": "https://github.com/npm/node-semver",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"files": [
|
||||
"bin/**/*.js",
|
||||
"range.bnf",
|
||||
"classes/**/*.js",
|
||||
"functions/**/*.js",
|
||||
"internal/**/*.js",
|
||||
"ranges/**/*.js",
|
||||
"index.js",
|
||||
"preload.js"
|
||||
],
|
||||
"tap": {
|
||||
"check-coverage": true,
|
||||
"coverage-map": "map.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
}
|
||||
}
|
2
test/integration/test-fixtures/yarn-lock/node_modules/semver/preload.js
generated
vendored
Normal file
2
test/integration/test-fixtures/yarn-lock/node_modules/semver/preload.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// XXX remove in v8 or beyond
|
||||
module.exports = require('./index.js')
|
16
test/integration/test-fixtures/yarn-lock/node_modules/semver/range.bnf
generated
vendored
Normal file
16
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/ranges/gtr.js
generated
vendored
Normal file
4
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/ranges/intersects.js
generated
vendored
Normal file
7
test/integration/test-fixtures/yarn-lock/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
test/integration/test-fixtures/yarn-lock/node_modules/semver/ranges/ltr.js
generated
vendored
Normal file
4
test/integration/test-fixtures/yarn-lock/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
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue