mirror of
https://github.com/SamEyeBam/animate.git
synced 2026-11-18 10:07:46 +00:00
larry babby and threejs for glsl
This commit is contained in:
1 parent
87d5dc634d
commit
907ebae4c0
6474 files changed
+1279596
-8
No files matched your search
+18
@@ -0,0 +1,18 @@
|
||||
export interface Options {
|
||||
/**
|
||||
* A preferred port or an array of preferred ports to use.
|
||||
*/
|
||||
readonly port?: number | ReadonlyArray<number>,
|
||||
|
||||
/**
|
||||
* The host on which port resolution should be performed. Can be either an IPv4 or IPv6 address.
|
||||
*/
|
||||
readonly host?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an available TCP port number.
|
||||
*
|
||||
* @returns Port number.
|
||||
*/
|
||||
export default function getPort(options?: Options): Promise<number>;
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
const net = require('net');
|
||||
|
||||
const isAvailable = options => new Promise((resolve, reject) => {
|
||||
const server = net.createServer();
|
||||
server.unref();
|
||||
server.on('error', reject);
|
||||
server.listen(options, () => {
|
||||
const {port} = server.address();
|
||||
server.close(() => {
|
||||
resolve(port);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const getPort = options => {
|
||||
options = Object.assign({}, options);
|
||||
|
||||
if (typeof options.port === 'number') {
|
||||
options.port = [options.port];
|
||||
}
|
||||
|
||||
return (options.port || []).reduce(
|
||||
(seq, port) => seq.catch(
|
||||
() => isAvailable(Object.assign({}, options, {port}))
|
||||
),
|
||||
Promise.reject()
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = options => options ?
|
||||
getPort(options).catch(() => getPort(Object.assign(options, {port: 0}))) :
|
||||
getPort({port: 0});
|
||||
|
||||
module.exports.default = module.exports;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "get-port",
|
||||
"version": "4.2.0",
|
||||
"description": "Get an available port",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/get-port",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd-check"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"port",
|
||||
"find",
|
||||
"finder",
|
||||
"portfinder",
|
||||
"free",
|
||||
"available",
|
||||
"connection",
|
||||
"connect",
|
||||
"open",
|
||||
"net",
|
||||
"tcp",
|
||||
"scan",
|
||||
"random",
|
||||
"preferred",
|
||||
"chosen"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.2.1",
|
||||
"pify": "^3.0.0",
|
||||
"tsd-check": "^0.3.0",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
# get-port [](https://travis-ci.org/sindresorhus/get-port)
|
||||
|
||||
> Get an available [TCP port](https://en.wikipedia.org/wiki/Port_(computer_networking))
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install get-port
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const getPort = require('get-port');
|
||||
|
||||
(async () => {
|
||||
console.log(await getPort());
|
||||
//=> 51402
|
||||
})();
|
||||
```
|
||||
|
||||
Pass in a preferred port:
|
||||
|
||||
```js
|
||||
(async () => {
|
||||
console.log(await getPort({port: 3000}));
|
||||
// Will use 3000 if available, otherwise fall back to a random port
|
||||
})();
|
||||
```
|
||||
|
||||
Pass in an array of preferred ports:
|
||||
|
||||
```js
|
||||
(async () => {
|
||||
console.log(await getPort({port: [3000, 3001, 3002]}));
|
||||
// Will use any element in the preferred ports array if available, otherwise fall back to a random port
|
||||
})();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### getPort([options])
|
||||
|
||||
Returns a `Promise` for a port number.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### port
|
||||
|
||||
Type: `number | number[]`
|
||||
|
||||
A preferred port or an array of preferred ports to use.
|
||||
|
||||
##### host
|
||||
|
||||
Type: `string`
|
||||
|
||||
The host on which port resolution should be performed. Can be either an IPv4 or IPv6 address.
|
||||
|
||||
|
||||
## Beware
|
||||
|
||||
There is a very tiny chance of a race condition if another service starts using the same port number as you in between the time you get the port number and you actually start using it.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [get-port-cli](https://github.com/sindresorhus/get-port-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in new issue
Block a user