forked from enviPath/enviPy
Current Dev State
This commit is contained in:
21
static/js/ketcher2/node_modules/get-ports/LICENSE.md
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/get-ports/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Jam3
|
||||
|
||||
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.
|
||||
|
||||
48
static/js/ketcher2/node_modules/get-ports/README.md
generated
vendored
Normal file
48
static/js/ketcher2/node_modules/get-ports/README.md
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
# get-ports
|
||||
|
||||
[](http://github.com/badges/stability-badges)
|
||||
|
||||
Finds multiple open ports after your specified base ports, and below the max range.
|
||||
|
||||
Unlike [getport](https://github.com/mikeal/getport) or [get-port](https://github.com/sindresorhus/get-port), this is useful for situations where you need multiple servers to run on open ports.
|
||||
|
||||
If not all ports could be found, the error callback is triggered.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install get-ports --save
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
The resulting `ports` array is parallel to your input (base) ports.
|
||||
|
||||
For example, if port `8000` and `9966` are already in use:
|
||||
|
||||
```js
|
||||
var getPorts = require('get-ports')
|
||||
|
||||
getPorts([ 8000, 9966 ], function (err, ports) {
|
||||
if (err) throw new Error('could not open servers')
|
||||
|
||||
console.log(ports)
|
||||
//=> [ 8001, 9967 ]
|
||||
})
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
[](https://www.npmjs.com/package/get-ports)
|
||||
|
||||
#### `getPorts(basePorts, [maxPort], callback)`
|
||||
|
||||
For the given array of `basePorts`, tries to find the next available port from each one. This keeps track of available ports to ensure there are no conflicts in the final result.
|
||||
|
||||
If the finite number `maxPort` is specified, the portfinding will fail when it reaches that maximum port. Defaults to 60000.
|
||||
|
||||
The callback is called with `(err, ports)`, where `err` will be an Error if any of the portfindings failed (i.e. no open ports within range). If successful, `err` will be null and `ports` will be an array, parallel to `basePorts`, with the found port numbers.
|
||||
|
||||
## License
|
||||
|
||||
MIT, see [LICENSE.md](http://github.com/Jam3/get-ports/blob/master/LICENSE.md) for details.
|
||||
50
static/js/ketcher2/node_modules/get-ports/index.js
generated
vendored
Normal file
50
static/js/ketcher2/node_modules/get-ports/index.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
var mapLimit = require('map-limit')
|
||||
var net = require('net')
|
||||
var DEFAULT_MAX_PORT = 65535
|
||||
|
||||
module.exports = getPorts
|
||||
function getPorts (basePorts, maxPort, cb) {
|
||||
if (!Array.isArray(basePorts)) {
|
||||
throw new TypeError('must provide array of ports as first argument')
|
||||
}
|
||||
if (typeof maxPort !== 'number') {
|
||||
cb = maxPort
|
||||
maxPort = DEFAULT_MAX_PORT
|
||||
}
|
||||
if (typeof cb !== 'function') {
|
||||
throw new TypeError('must provide callback function')
|
||||
}
|
||||
if (!isFinite(maxPort)) {
|
||||
throw new TypeError('maxPort must be a finite number')
|
||||
}
|
||||
|
||||
var usedPorts = []
|
||||
mapLimit(basePorts, 1, function (base, next) {
|
||||
getNextPort(base, function (err, port) {
|
||||
if (err) return next(new Error('no ports found after ' + base))
|
||||
next(null, port)
|
||||
})
|
||||
}, cb)
|
||||
|
||||
function getNextPort (basePort, cb) {
|
||||
// skip used ports
|
||||
while (basePort < maxPort && usedPorts.indexOf(basePort) >= 0) {
|
||||
basePort++
|
||||
}
|
||||
|
||||
if (basePort >= maxPort) {
|
||||
return process.nextTick(function () {
|
||||
cb(new Error('no open ports'))
|
||||
})
|
||||
}
|
||||
|
||||
var c = net.connect(basePort, function () {
|
||||
c.destroy()
|
||||
getNextPort(basePort + 1, cb)
|
||||
})
|
||||
c.on('error', function () {
|
||||
usedPorts.push(basePort)
|
||||
cb(null, basePort)
|
||||
})
|
||||
}
|
||||
}
|
||||
68
static/js/ketcher2/node_modules/get-ports/package.json
generated
vendored
Normal file
68
static/js/ketcher2/node_modules/get-ports/package.json
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "get-ports@^1.0.2",
|
||||
"_id": "get-ports@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-9AvVgKyn7A77e5bL/L6wPviUteg=",
|
||||
"_location": "/get-ports",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "get-ports@^1.0.2",
|
||||
"name": "get-ports",
|
||||
"escapedName": "get-ports",
|
||||
"rawSpec": "^1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/budo"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/get-ports/-/get-ports-1.0.3.tgz",
|
||||
"_shasum": "f40bd580aca7ec0efb7b96cbfcbeb03ef894b5e8",
|
||||
"_spec": "get-ports@^1.0.2",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/budo",
|
||||
"author": {
|
||||
"name": "Matt DesLauriers",
|
||||
"email": "dave.des@gmail.com",
|
||||
"url": "https://github.com/mattdesl"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Jam3/get-ports/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"map-limit": "0.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "gets multiple open ports",
|
||||
"devDependencies": {
|
||||
"faucet": "0.0.1",
|
||||
"standard": "^5.3.1",
|
||||
"tape": "^4.2.1"
|
||||
},
|
||||
"homepage": "https://github.com/Jam3/get-ports",
|
||||
"keywords": [
|
||||
"get",
|
||||
"port",
|
||||
"find",
|
||||
"portfind",
|
||||
"finding",
|
||||
"finds",
|
||||
"gets",
|
||||
"portfinding",
|
||||
"portfinder",
|
||||
"multiple"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "get-ports",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Jam3/get-ports.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test.js | faucet"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
||||
Reference in New Issue
Block a user