前端代码

This commit is contained in:
ChloeChen0423
2025-05-12 16:42:36 +09:00
commit 7c63f2f07b
4531 changed files with 656010 additions and 0 deletions

21
node_modules/localtunnel/.eslintrc.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
module.exports = {
parser: 'babel-eslint',
extends: ['airbnb', 'prettier', 'plugin:jest/recommended'],
plugins: ['prettier', 'jest'],
env: {
'jest/globals': true,
},
rules: {
'prettier/prettier': [
'warn',
{
printWidth: 100,
tabWidth: 2,
bracketSpacing: true,
trailingComma: 'es5',
singleQuote: true,
jsxBracketSameLine: false,
},
],
},
}

6
node_modules/localtunnel/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,6 @@
dist: xenial
language: node_js
node_js:
- "8"
- "10"
- "12"

81
node_modules/localtunnel/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,81 @@
# 2.0.2 (2021-09-18)
- Upgrade dependencies
# 2.0.1 (2021-01-09)
- Upgrade dependencies
# 2.0.0 (2019-09-16)
- Add support for tunneling a local HTTPS server
- Add support for localtunnel server with IP-based tunnel URLs
- Node.js client API is now Promise-based, with backwards compatibility to callback
- Major refactor of entire codebase using modern ES syntax (requires Node.js v8.3.0 or above)
# 1.9.2 (2019-06-01)
- Update debug to 4.1.1
- Update axios to 0.19.0
# 1.9.1 (2018-09-08)
- Update debug to 2.6.9
# 1.9.0 (2018-04-03)
- Add _request_ event to Tunnel emitter
- Update yargs to support config via environment variables
- Add basic request logging when --print-requests argument is used
# 1.8.3 (2017-06-11)
- update request dependency
- update debug dependency
- update openurl dependency
# 1.8.2 (2016-11-17)
- fix host header transform
- update request dependency
# 1.8.1 (2016-01-20)
- fix bug w/ HostHeaderTransformer and binary data
# 1.8.0 (2015-11-04)
- pass socket errors up to top level
# 1.7.0 (2015-07-22)
- add short arg options
# 1.6.0 (2015-05-15)
- keep sockets alive after connecting
- add --open param to CLI
# 1.5.0 (2014-10-25)
- capture all errors on remote socket and restart the tunnel
# 1.4.0 (2014-08-31)
- don't emit errors for ETIMEDOUT
# 1.2.0 / 2014-04-28
- return `client` from `localtunnel` API instantiation
# 1.1.0 / 2014-02-24
- add a host header transform to change the 'Host' header in requests
# 1.0.0 / 2014-02-14
- default to localltunnel.me for host
- remove exported `connect` method (just export one function that does the same thing)
- change localtunnel signature to (port, opt, fn)
# 0.2.2 / 2014-01-09

21
node_modules/localtunnel/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Roman Shtylman
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.

122
node_modules/localtunnel/README.md generated vendored Normal file
View File

@ -0,0 +1,122 @@
# localtunnel
localtunnel exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.
Great for working with browser testing tools like browserling or external api callback services like twilio which require a public url for callbacks.
## Quickstart
```
npx localtunnel --port 8000
```
## Installation
### Globally
```
npm install -g localtunnel
```
### As a dependency in your project
```
yarn add localtunnel
```
## CLI usage
When localtunnel is installed globally, just use the `lt` command to start the tunnel.
```
lt --port 8000
```
Thats it! It will connect to the tunnel server, setup the tunnel, and tell you what url to use for your testing. This url will remain active for the duration of your session; so feel free to share it with others for happy fun time!
You can restart your local server all you want, `lt` is smart enough to detect this and reconnect once it is back.
### Arguments
Below are some common arguments. See `lt --help` for additional arguments
- `--subdomain` request a named subdomain on the localtunnel server (default is random characters)
- `--local-host` proxy to a hostname other than localhost
You may also specify arguments via env variables. E.x.
```
PORT=3000 lt
```
## API
The localtunnel client is also usable through an API (for test integration, automation, etc)
### localtunnel(port [,options][,callback])
Creates a new localtunnel to the specified local `port`. Will return a Promise that resolves once you have been assigned a public localtunnel url. `options` can be used to request a specific `subdomain`. A `callback` function can be passed, in which case it won't return a Promise. This exists for backwards compatibility with the old Node-style callback API. You may also pass a single options object with `port` as a property.
```js
const localtunnel = require('localtunnel');
(async () => {
const tunnel = await localtunnel({ port: 3000 });
// the assigned public url for your tunnel
// i.e. https://abcdefgjhij.localtunnel.me
tunnel.url;
tunnel.on('close', () => {
// tunnels are closed
});
})();
```
#### options
- `port` (number) [required] The local port number to expose through localtunnel.
- `subdomain` (string) Request a specific subdomain on the proxy server. **Note** You may not actually receive this name depending on availability.
- `host` (string) URL for the upstream proxy server. Defaults to `https://localtunnel.me`.
- `local_host` (string) Proxy to this hostname instead of `localhost`. This will also cause the `Host` header to be re-written to this value in proxied requests.
- `local_https` (boolean) Enable tunneling to local HTTPS server.
- `local_cert` (string) Path to certificate PEM file for local HTTPS server.
- `local_key` (string) Path to certificate key file for local HTTPS server.
- `local_ca` (string) Path to certificate authority file for self-signed certificates.
- `allow_invalid_cert` (boolean) Disable certificate checks for your local HTTPS server (ignore cert/key/ca options).
Refer to [tls.createSecureContext](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) for details on the certificate options.
### Tunnel
The `tunnel` instance returned to your callback emits the following events
| event | args | description |
| ------- | ---- | ------------------------------------------------------------------------------------ |
| request | info | fires when a request is processed by the tunnel, contains _method_ and _path_ fields |
| error | err | fires when an error happens on the tunnel |
| close | | fires when the tunnel has closed |
The `tunnel` instance has the following methods
| method | args | description |
| ------ | ---- | ---------------- |
| close | | close the tunnel |
## other clients
Clients in other languages
_go_ [gotunnelme](https://github.com/NoahShen/gotunnelme)
_go_ [go-localtunnel](https://github.com/localtunnel/go-localtunnel)
_C#/.NET_ [localtunnel-client](https://github.com/angelobreuer/localtunnel-client)
## server
See [localtunnel/server](//github.com/localtunnel/server) for details on the server that powers localtunnel.
## License
MIT

104
node_modules/localtunnel/bin/lt.js generated vendored Normal file
View File

@ -0,0 +1,104 @@
#!/usr/bin/env node
/* eslint-disable no-console */
const openurl = require('openurl');
const yargs = require('yargs');
const localtunnel = require('../localtunnel');
const { version } = require('../package');
const { argv } = yargs
.usage('Usage: lt --port [num] <options>')
.env(true)
.option('p', {
alias: 'port',
describe: 'Internal HTTP server port',
})
.option('h', {
alias: 'host',
describe: 'Upstream server providing forwarding',
default: 'https://localtunnel.me',
})
.option('s', {
alias: 'subdomain',
describe: 'Request this subdomain',
})
.option('l', {
alias: 'local-host',
describe: 'Tunnel traffic to this host instead of localhost, override Host header to this host',
})
.option('local-https', {
describe: 'Tunnel traffic to a local HTTPS server',
})
.option('local-cert', {
describe: 'Path to certificate PEM file for local HTTPS server',
})
.option('local-key', {
describe: 'Path to certificate key file for local HTTPS server',
})
.option('local-ca', {
describe: 'Path to certificate authority file for self-signed certificates',
})
.option('allow-invalid-cert', {
describe: 'Disable certificate checks for your local HTTPS server (ignore cert/key/ca options)',
})
.options('o', {
alias: 'open',
describe: 'Opens the tunnel URL in your browser',
})
.option('print-requests', {
describe: 'Print basic request info',
})
.require('port')
.boolean('local-https')
.boolean('allow-invalid-cert')
.boolean('print-requests')
.help('help', 'Show this help and exit')
.version(version);
if (typeof argv.port !== 'number') {
yargs.showHelp();
console.error('\nInvalid argument: `port` must be a number');
process.exit(1);
}
(async () => {
const tunnel = await localtunnel({
port: argv.port,
host: argv.host,
subdomain: argv.subdomain,
local_host: argv.localHost,
local_https: argv.localHttps,
local_cert: argv.localCert,
local_key: argv.localKey,
local_ca: argv.localCa,
allow_invalid_cert: argv.allowInvalidCert,
}).catch(err => {
throw err;
});
tunnel.on('error', err => {
throw err;
});
console.log('your url is: %s', tunnel.url);
/**
* `cachedUrl` is set when using a proxy server that support resource caching.
* This URL generally remains available after the tunnel itself has closed.
* @see https://github.com/localtunnel/localtunnel/pull/319#discussion_r319846289
*/
if (tunnel.cachedUrl) {
console.log('your cachedUrl is: %s', tunnel.cachedUrl);
}
if (argv.open) {
openurl.open(tunnel.url);
}
if (argv['print-requests']) {
tunnel.on('request', info => {
console.log(new Date().toString(), info.method, info.path);
});
}
})();

23
node_modules/localtunnel/lib/HeaderHostTransformer.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
const { Transform } = require('stream');
class HeaderHostTransformer extends Transform {
constructor(opts = {}) {
super(opts);
this.host = opts.host || 'localhost';
this.replaced = false;
}
_transform(data, encoding, callback) {
callback(
null,
this.replaced // after replacing the first instance of the Host header we just become a regular passthrough
? data
: data.toString().replace(/(\r\n[Hh]ost: )\S+/, (match, $1) => {
this.replaced = true;
return $1 + this.host;
})
);
}
}
module.exports = HeaderHostTransformer;

163
node_modules/localtunnel/lib/Tunnel.js generated vendored Normal file
View File

@ -0,0 +1,163 @@
/* eslint-disable consistent-return, no-underscore-dangle */
const { parse } = require('url');
const { EventEmitter } = require('events');
const axios = require('axios');
const debug = require('debug')('localtunnel:client');
const TunnelCluster = require('./TunnelCluster');
module.exports = class Tunnel extends EventEmitter {
constructor(opts = {}) {
super(opts);
this.opts = opts;
this.closed = false;
if (!this.opts.host) {
this.opts.host = 'https://localtunnel.me';
}
}
_getInfo(body) {
/* eslint-disable camelcase */
const { id, ip, port, url, cached_url, max_conn_count } = body;
const { host, port: local_port, local_host } = this.opts;
const { local_https, local_cert, local_key, local_ca, allow_invalid_cert } = this.opts;
return {
name: id,
url,
cached_url,
max_conn: max_conn_count || 1,
remote_host: parse(host).hostname,
remote_ip: ip,
remote_port: port,
local_port,
local_host,
local_https,
local_cert,
local_key,
local_ca,
allow_invalid_cert,
};
/* eslint-enable camelcase */
}
// initialize connection
// callback with connection info
_init(cb) {
const opt = this.opts;
const getInfo = this._getInfo.bind(this);
const params = {
responseType: 'json',
};
const baseUri = `${opt.host}/`;
// no subdomain at first, maybe use requested domain
const assignedDomain = opt.subdomain;
// where to quest
const uri = baseUri + (assignedDomain || '?new');
(function getUrl() {
axios
.get(uri, params)
.then(res => {
const body = res.data;
debug('got tunnel information', res.data);
if (res.status !== 200) {
const err = new Error(
(body && body.message) || 'localtunnel server returned an error, please try again'
);
return cb(err);
}
cb(null, getInfo(body));
})
.catch(err => {
debug(`tunnel server offline: ${err.message}, retry 1s`);
return setTimeout(getUrl, 1000);
});
})();
}
_establish(info) {
// increase max event listeners so that localtunnel consumers don't get
// warning messages as soon as they setup even one listener. See #71
this.setMaxListeners(info.max_conn + (EventEmitter.defaultMaxListeners || 10));
this.tunnelCluster = new TunnelCluster(info);
// only emit the url the first time
this.tunnelCluster.once('open', () => {
this.emit('url', info.url);
});
// re-emit socket error
this.tunnelCluster.on('error', err => {
debug('got socket error', err.message);
this.emit('error', err);
});
let tunnelCount = 0;
// track open count
this.tunnelCluster.on('open', tunnel => {
tunnelCount++;
debug('tunnel open [total: %d]', tunnelCount);
const closeHandler = () => {
tunnel.destroy();
};
if (this.closed) {
return closeHandler();
}
this.once('close', closeHandler);
tunnel.once('close', () => {
this.removeListener('close', closeHandler);
});
});
// when a tunnel dies, open a new one
this.tunnelCluster.on('dead', () => {
tunnelCount--;
debug('tunnel dead [total: %d]', tunnelCount);
if (this.closed) {
return;
}
this.tunnelCluster.open();
});
this.tunnelCluster.on('request', req => {
this.emit('request', req);
});
// establish as many tunnels as allowed
for (let count = 0; count < info.max_conn; ++count) {
this.tunnelCluster.open();
}
}
open(cb) {
this._init((err, info) => {
if (err) {
return cb(err);
}
this.clientId = info.name;
this.url = info.url;
// `cached_url` is only returned by proxy servers that support resource caching.
if (info.cached_url) {
this.cachedUrl = info.cached_url;
}
this._establish(info);
cb();
});
}
close() {
this.closed = true;
this.emit('close');
}
};

152
node_modules/localtunnel/lib/TunnelCluster.js generated vendored Normal file
View File

@ -0,0 +1,152 @@
const { EventEmitter } = require('events');
const debug = require('debug')('localtunnel:client');
const fs = require('fs');
const net = require('net');
const tls = require('tls');
const HeaderHostTransformer = require('./HeaderHostTransformer');
// manages groups of tunnels
module.exports = class TunnelCluster extends EventEmitter {
constructor(opts = {}) {
super(opts);
this.opts = opts;
}
open() {
const opt = this.opts;
// Prefer IP if returned by the server
const remoteHostOrIp = opt.remote_ip || opt.remote_host;
const remotePort = opt.remote_port;
const localHost = opt.local_host || 'localhost';
const localPort = opt.local_port;
const localProtocol = opt.local_https ? 'https' : 'http';
const allowInvalidCert = opt.allow_invalid_cert;
debug(
'establishing tunnel %s://%s:%s <> %s:%s',
localProtocol,
localHost,
localPort,
remoteHostOrIp,
remotePort
);
// connection to localtunnel server
const remote = net.connect({
host: remoteHostOrIp,
port: remotePort,
});
remote.setKeepAlive(true);
remote.on('error', err => {
debug('got remote connection error', err.message);
// emit connection refused errors immediately, because they
// indicate that the tunnel can't be established.
if (err.code === 'ECONNREFUSED') {
this.emit(
'error',
new Error(
`connection refused: ${remoteHostOrIp}:${remotePort} (check your firewall settings)`
)
);
}
remote.end();
});
const connLocal = () => {
if (remote.destroyed) {
debug('remote destroyed');
this.emit('dead');
return;
}
debug('connecting locally to %s://%s:%d', localProtocol, localHost, localPort);
remote.pause();
if (allowInvalidCert) {
debug('allowing invalid certificates');
}
const getLocalCertOpts = () =>
allowInvalidCert
? { rejectUnauthorized: false }
: {
cert: fs.readFileSync(opt.local_cert),
key: fs.readFileSync(opt.local_key),
ca: opt.local_ca ? [fs.readFileSync(opt.local_ca)] : undefined,
};
// connection to local http server
const local = opt.local_https
? tls.connect({ host: localHost, port: localPort, ...getLocalCertOpts() })
: net.connect({ host: localHost, port: localPort });
const remoteClose = () => {
debug('remote close');
this.emit('dead');
local.end();
};
remote.once('close', remoteClose);
// TODO some languages have single threaded servers which makes opening up
// multiple local connections impossible. We need a smarter way to scale
// and adjust for such instances to avoid beating on the door of the server
local.once('error', err => {
debug('local error %s', err.message);
local.end();
remote.removeListener('close', remoteClose);
if (err.code !== 'ECONNREFUSED') {
return remote.end();
}
// retrying connection to local server
setTimeout(connLocal, 1000);
});
local.once('connect', () => {
debug('connected locally');
remote.resume();
let stream = remote;
// if user requested specific local host
// then we use host header transform to replace the host header
if (opt.local_host) {
debug('transform Host header to %s', opt.local_host);
stream = remote.pipe(new HeaderHostTransformer({ host: opt.local_host }));
}
stream.pipe(local).pipe(remote);
// when local closes, also get a new remote
local.once('close', hadError => {
debug('local connection closed [%s]', hadError);
});
});
};
remote.on('data', data => {
const match = data.toString().match(/^(\w+) (\S+)/);
if (match) {
this.emit('request', {
method: match[1],
path: match[2],
});
}
});
// tunnel is considered open when remote connects
remote.once('connect', () => {
this.emit('open', remote);
connLocal();
});
}
};

14
node_modules/localtunnel/localtunnel.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
const Tunnel = require('./lib/Tunnel');
module.exports = function localtunnel(arg1, arg2, arg3) {
const options = typeof arg1 === 'object' ? arg1 : { ...arg2, port: arg1 };
const callback = typeof arg1 === 'object' ? arg2 : arg3;
const client = new Tunnel(options);
if (callback) {
client.open(err => (err ? callback(err) : callback(null, client)));
return client;
}
return new Promise((resolve, reject) =>
client.open(err => (err ? reject(err) : resolve(client)))
);
};

162
node_modules/localtunnel/localtunnel.spec.js generated vendored Normal file
View File

@ -0,0 +1,162 @@
/* eslint-disable no-console */
const crypto = require('crypto');
const http = require('http');
const https = require('https');
const url = require('url');
const assert = require('assert');
const localtunnel = require('./localtunnel');
let fakePort;
before(done => {
const server = http.createServer();
server.on('request', (req, res) => {
res.write(req.headers.host);
res.end();
});
server.listen(() => {
const { port } = server.address();
fakePort = port;
done();
});
});
it('query localtunnel server w/ ident', async done => {
const tunnel = await localtunnel({ port: fakePort });
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
const parsed = url.parse(tunnel.url);
const opt = {
host: parsed.host,
port: 443,
headers: { host: parsed.hostname },
path: '/',
};
const req = https.request(opt, res => {
res.setEncoding('utf8');
let body = '';
res.on('data', chunk => {
body += chunk;
});
res.on('end', () => {
assert(/.*[.]localtunnel[.]me/.test(body), body);
tunnel.close();
done();
});
});
req.end();
});
it('request specific domain', async () => {
const subdomain = Math.random()
.toString(36)
.substr(2);
const tunnel = await localtunnel({ port: fakePort, subdomain });
assert.ok(new RegExp(`^https://${subdomain}.localtunnel.me$`).test(tunnel.url));
tunnel.close();
});
describe('--local-host localhost', () => {
it('override Host header with local-host', async done => {
const tunnel = await localtunnel({ port: fakePort, local_host: 'localhost' });
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
const parsed = url.parse(tunnel.url);
const opt = {
host: parsed.host,
port: 443,
headers: { host: parsed.hostname },
path: '/',
};
const req = https.request(opt, res => {
res.setEncoding('utf8');
let body = '';
res.on('data', chunk => {
body += chunk;
});
res.on('end', () => {
assert.strictEqual(body, 'localhost');
tunnel.close();
done();
});
});
req.end();
});
});
describe('--local-host 127.0.0.1', () => {
it('override Host header with local-host', async done => {
const tunnel = await localtunnel({ port: fakePort, local_host: '127.0.0.1' });
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
const parsed = url.parse(tunnel.url);
const opt = {
host: parsed.host,
port: 443,
headers: {
host: parsed.hostname,
},
path: '/',
};
const req = https.request(opt, res => {
res.setEncoding('utf8');
let body = '';
res.on('data', chunk => {
body += chunk;
});
res.on('end', () => {
assert.strictEqual(body, '127.0.0.1');
tunnel.close();
done();
});
});
req.end();
});
it('send chunked request', async done => {
const tunnel = await localtunnel({ port: fakePort, local_host: '127.0.0.1' });
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
const parsed = url.parse(tunnel.url);
const opt = {
host: parsed.host,
port: 443,
headers: {
host: parsed.hostname,
'Transfer-Encoding': 'chunked',
},
path: '/',
};
const req = https.request(opt, res => {
res.setEncoding('utf8');
let body = '';
res.on('data', chunk => {
body += chunk;
});
res.on('end', () => {
assert.strictEqual(body, '127.0.0.1');
tunnel.close();
done();
});
});
req.end(crypto.randomBytes(1024 * 8).toString('base64'));
});
});

View File

@ -0,0 +1,121 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [7.0.4](https://www.github.com/yargs/cliui/compare/v7.0.3...v7.0.4) (2020-11-08)
### Bug Fixes
* **deno:** import UIOptions from definitions ([#97](https://www.github.com/yargs/cliui/issues/97)) ([f04f343](https://www.github.com/yargs/cliui/commit/f04f3439bc78114c7e90f82ff56f5acf16268ea8))
### [7.0.3](https://www.github.com/yargs/cliui/compare/v7.0.2...v7.0.3) (2020-10-16)
### Bug Fixes
* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#93](https://www.github.com/yargs/cliui/issues/93)) ([eca16fc](https://www.github.com/yargs/cliui/commit/eca16fc05d26255df3280906c36d7f0e5b05c6e9))
### [7.0.2](https://www.github.com/yargs/cliui/compare/v7.0.1...v7.0.2) (2020-10-14)
### Bug Fixes
* **exports:** node 13.0-13.6 require a string fallback ([#91](https://www.github.com/yargs/cliui/issues/91)) ([b529d7e](https://www.github.com/yargs/cliui/commit/b529d7e432901af1af7848b23ed6cf634497d961))
### [7.0.1](https://www.github.com/yargs/cliui/compare/v7.0.0...v7.0.1) (2020-08-16)
### Bug Fixes
* **build:** main should be build/index.cjs ([dc29a3c](https://www.github.com/yargs/cliui/commit/dc29a3cc617a410aa850e06337b5954b04f2cb4d))
## [7.0.0](https://www.github.com/yargs/cliui/compare/v6.0.0...v7.0.0) (2020-08-16)
### ⚠ BREAKING CHANGES
* tsc/ESM/Deno support (#82)
* modernize deps and build (#80)
### Build System
* modernize deps and build ([#80](https://www.github.com/yargs/cliui/issues/80)) ([339d08d](https://www.github.com/yargs/cliui/commit/339d08dc71b15a3928aeab09042af94db2f43743))
### Code Refactoring
* tsc/ESM/Deno support ([#82](https://www.github.com/yargs/cliui/issues/82)) ([4b777a5](https://www.github.com/yargs/cliui/commit/4b777a5fe01c5d8958c6708695d6aab7dbe5706c))
## [6.0.0](https://www.github.com/yargs/cliui/compare/v5.0.0...v6.0.0) (2019-11-10)
### ⚠ BREAKING CHANGES
* update deps, drop Node 6
### Code Refactoring
* update deps, drop Node 6 ([62056df](https://www.github.com/yargs/cliui/commit/62056df))
## [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10)
### Bug Fixes
* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae))
### BREAKING CHANGES
* Drop support for node < 6.
<a name="4.1.0"></a>
## [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
### Features
* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
<a name="4.0.0"></a>
## [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
### Bug Fixes
* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
### Chores
* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
### Features
* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
### BREAKING CHANGES
* officially drop support for Node < 4
<a name="3.2.0"></a>
## [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
### Bug Fixes
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
### Features
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))

View File

@ -0,0 +1,14 @@
Copyright (c) 2015, 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.

141
node_modules/localtunnel/node_modules/cliui/README.md generated vendored Normal file
View File

@ -0,0 +1,141 @@
# cliui
![ci](https://github.com/yargs/cliui/workflows/ci/badge.svg)
[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/cliui)
easily create complex multi-column command-line-interfaces.
## Example
```js
const ui = require('cliui')()
ui.div('Usage: $0 [command] [options]')
ui.div({
text: 'Options:',
padding: [2, 0, 1, 0]
})
ui.div(
{
text: "-f, --file",
width: 20,
padding: [0, 4, 0, 4]
},
{
text: "the file to load." +
chalk.green("(if this description is long it wraps).")
,
width: 20
},
{
text: chalk.red("[required]"),
align: 'right'
}
)
console.log(ui.toString())
```
## Deno/ESM Support
As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and
[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules):
```typescript
import cliui from "https://deno.land/x/cliui/deno.ts";
const ui = cliui({})
ui.div('Usage: $0 [command] [options]')
ui.div({
text: 'Options:',
padding: [2, 0, 1, 0]
})
ui.div({
text: "-f, --file",
width: 20,
padding: [0, 4, 0, 4]
})
console.log(ui.toString())
```
<img width="500" src="screenshot.png">
## Layout DSL
cliui exposes a simple layout DSL:
If you create a single `ui.div`, passing a string rather than an
object:
* `\n`: characters will be interpreted as new rows.
* `\t`: characters will be interpreted as new columns.
* `\s`: characters will be interpreted as padding.
**as an example...**
```js
var ui = require('./')({
width: 60
})
ui.div(
'Usage: node ./bin/foo.js\n' +
' <regex>\t provide a regex\n' +
' <glob>\t provide a glob\t [required]'
)
console.log(ui.toString())
```
**will output:**
```shell
Usage: node ./bin/foo.js
<regex> provide a regex
<glob> provide a glob [required]
```
## Methods
```js
cliui = require('cliui')
```
### cliui({width: integer})
Specify the maximum width of the UI being generated.
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
### cliui({wrap: boolean})
Enable or disable the wrapping of text in a column.
### cliui.div(column, column, column)
Create a row with any number of columns, a column
can either be a string, or an object with the following
options:
* **text:** some text to place in the column.
* **width:** the width of a column.
* **align:** alignment, `right` or `center`.
* **padding:** `[top, right, bottom, left]`.
* **border:** should a border be placed around the div?
### cliui.span(column, column, column)
Similar to `div`, except the next row will be appended without
a new line being created.
### cliui.resetOutput()
Resets the UI elements of the current cliui instance, maintaining the values
set for `width` and `wrap`.

View File

@ -0,0 +1,302 @@
'use strict';
const align = {
right: alignRight,
center: alignCenter
};
const top = 0;
const right = 1;
const bottom = 2;
const left = 3;
class UI {
constructor(opts) {
var _a;
this.width = opts.width;
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
this.rows = [];
}
span(...args) {
const cols = this.div(...args);
cols.span = true;
}
resetOutput() {
this.rows = [];
}
div(...args) {
if (args.length === 0) {
this.div('');
}
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
return this.applyLayoutDSL(args[0]);
}
const cols = args.map(arg => {
if (typeof arg === 'string') {
return this.colFromString(arg);
}
return arg;
});
this.rows.push(cols);
return cols;
}
shouldApplyLayoutDSL(...args) {
return args.length === 1 && typeof args[0] === 'string' &&
/[\t\n]/.test(args[0]);
}
applyLayoutDSL(str) {
const rows = str.split('\n').map(row => row.split('\t'));
let leftColumnWidth = 0;
// simple heuristic for layout, make sure the
// second column lines up along the left-hand.
// don't allow the first column to take up more
// than 50% of the screen.
rows.forEach(columns => {
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
}
});
// generate a table:
// replacing ' ' with padding calculations.
// using the algorithmically generated width.
rows.forEach(columns => {
this.div(...columns.map((r, i) => {
return {
text: r.trim(),
padding: this.measurePadding(r),
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
};
}));
});
return this.rows[this.rows.length - 1];
}
colFromString(text) {
return {
text,
padding: this.measurePadding(text)
};
}
measurePadding(str) {
// measure padding without ansi escape codes
const noAnsi = mixin.stripAnsi(str);
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
}
toString() {
const lines = [];
this.rows.forEach(row => {
this.rowToString(row, lines);
});
// don't display any lines with the
// hidden flag set.
return lines
.filter(line => !line.hidden)
.map(line => line.text)
.join('\n');
}
rowToString(row, lines) {
this.rasterize(row).forEach((rrow, r) => {
let str = '';
rrow.forEach((col, c) => {
const { width } = row[c]; // the width with padding.
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
let ts = col; // temporary string used during alignment/padding.
if (wrapWidth > mixin.stringWidth(col)) {
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
}
// align the string within its column.
if (row[c].align && row[c].align !== 'left' && this.wrap) {
const fn = align[row[c].align];
ts = fn(ts, wrapWidth);
if (mixin.stringWidth(ts) < wrapWidth) {
ts += ' '.repeat((width || 0) - mixin.stringWidth(ts) - 1);
}
}
// apply border and padding to string.
const padding = row[c].padding || [0, 0, 0, 0];
if (padding[left]) {
str += ' '.repeat(padding[left]);
}
str += addBorder(row[c], ts, '| ');
str += ts;
str += addBorder(row[c], ts, ' |');
if (padding[right]) {
str += ' '.repeat(padding[right]);
}
// if prior row is span, try to render the
// current row on the prior line.
if (r === 0 && lines.length > 0) {
str = this.renderInline(str, lines[lines.length - 1]);
}
});
// remove trailing whitespace.
lines.push({
text: str.replace(/ +$/, ''),
span: row.span
});
});
return lines;
}
// if the full 'source' can render in
// the target line, do so.
renderInline(source, previousLine) {
const match = source.match(/^ */);
const leadingWhitespace = match ? match[0].length : 0;
const target = previousLine.text;
const targetTextWidth = mixin.stringWidth(target.trimRight());
if (!previousLine.span) {
return source;
}
// if we're not applying wrapping logic,
// just always append to the span.
if (!this.wrap) {
previousLine.hidden = true;
return target + source;
}
if (leadingWhitespace < targetTextWidth) {
return source;
}
previousLine.hidden = true;
return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();
}
rasterize(row) {
const rrows = [];
const widths = this.columnWidths(row);
let wrapped;
// word wrap all columns, and create
// a data-structure that is easy to rasterize.
row.forEach((col, c) => {
// leave room for left and right padding.
col.width = widths[c];
if (this.wrap) {
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
}
else {
wrapped = col.text.split('\n');
}
if (col.border) {
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
}
// add top and bottom padding.
if (col.padding) {
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
}
wrapped.forEach((str, r) => {
if (!rrows[r]) {
rrows.push([]);
}
const rrow = rrows[r];
for (let i = 0; i < c; i++) {
if (rrow[i] === undefined) {
rrow.push('');
}
}
rrow.push(str);
});
});
return rrows;
}
negatePadding(col) {
let wrapWidth = col.width || 0;
if (col.padding) {
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
}
if (col.border) {
wrapWidth -= 4;
}
return wrapWidth;
}
columnWidths(row) {
if (!this.wrap) {
return row.map(col => {
return col.width || mixin.stringWidth(col.text);
});
}
let unset = row.length;
let remainingWidth = this.width;
// column widths can be set in config.
const widths = row.map(col => {
if (col.width) {
unset--;
remainingWidth -= col.width;
return col.width;
}
return undefined;
});
// any unset widths should be calculated.
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
return widths.map((w, i) => {
if (w === undefined) {
return Math.max(unsetWidth, _minWidth(row[i]));
}
return w;
});
}
}
function addBorder(col, ts, style) {
if (col.border) {
if (/[.']-+[.']/.test(ts)) {
return '';
}
if (ts.trim().length !== 0) {
return style;
}
return ' ';
}
return '';
}
// calculates the minimum width of
// a column, based on padding preferences.
function _minWidth(col) {
const padding = col.padding || [];
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
if (col.border) {
return minWidth + 4;
}
return minWidth;
}
function getWindowWidth() {
/* istanbul ignore next: depends on terminal */
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
return process.stdout.columns;
}
return 80;
}
function alignRight(str, width) {
str = str.trim();
const strWidth = mixin.stringWidth(str);
if (strWidth < width) {
return ' '.repeat(width - strWidth) + str;
}
return str;
}
function alignCenter(str, width) {
str = str.trim();
const strWidth = mixin.stringWidth(str);
/* istanbul ignore next */
if (strWidth >= width) {
return str;
}
return ' '.repeat((width - strWidth) >> 1) + str;
}
let mixin;
function cliui(opts, _mixin) {
mixin = _mixin;
return new UI({
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
});
}
// Bootstrap cliui with CommonJS dependencies:
const stringWidth = require('string-width');
const stripAnsi = require('strip-ansi');
const wrap = require('wrap-ansi');
function ui(opts) {
return cliui(opts, {
stringWidth,
stripAnsi,
wrap
});
}
module.exports = ui;

View File

@ -0,0 +1,287 @@
'use strict';
const align = {
right: alignRight,
center: alignCenter
};
const top = 0;
const right = 1;
const bottom = 2;
const left = 3;
export class UI {
constructor(opts) {
var _a;
this.width = opts.width;
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
this.rows = [];
}
span(...args) {
const cols = this.div(...args);
cols.span = true;
}
resetOutput() {
this.rows = [];
}
div(...args) {
if (args.length === 0) {
this.div('');
}
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') {
return this.applyLayoutDSL(args[0]);
}
const cols = args.map(arg => {
if (typeof arg === 'string') {
return this.colFromString(arg);
}
return arg;
});
this.rows.push(cols);
return cols;
}
shouldApplyLayoutDSL(...args) {
return args.length === 1 && typeof args[0] === 'string' &&
/[\t\n]/.test(args[0]);
}
applyLayoutDSL(str) {
const rows = str.split('\n').map(row => row.split('\t'));
let leftColumnWidth = 0;
// simple heuristic for layout, make sure the
// second column lines up along the left-hand.
// don't allow the first column to take up more
// than 50% of the screen.
rows.forEach(columns => {
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
}
});
// generate a table:
// replacing ' ' with padding calculations.
// using the algorithmically generated width.
rows.forEach(columns => {
this.div(...columns.map((r, i) => {
return {
text: r.trim(),
padding: this.measurePadding(r),
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
};
}));
});
return this.rows[this.rows.length - 1];
}
colFromString(text) {
return {
text,
padding: this.measurePadding(text)
};
}
measurePadding(str) {
// measure padding without ansi escape codes
const noAnsi = mixin.stripAnsi(str);
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
}
toString() {
const lines = [];
this.rows.forEach(row => {
this.rowToString(row, lines);
});
// don't display any lines with the
// hidden flag set.
return lines
.filter(line => !line.hidden)
.map(line => line.text)
.join('\n');
}
rowToString(row, lines) {
this.rasterize(row).forEach((rrow, r) => {
let str = '';
rrow.forEach((col, c) => {
const { width } = row[c]; // the width with padding.
const wrapWidth = this.negatePadding(row[c]); // the width without padding.
let ts = col; // temporary string used during alignment/padding.
if (wrapWidth > mixin.stringWidth(col)) {
ts += ' '.repeat(wrapWidth - mixin.stringWidth(col));
}
// align the string within its column.
if (row[c].align && row[c].align !== 'left' && this.wrap) {
const fn = align[row[c].align];
ts = fn(ts, wrapWidth);
if (mixin.stringWidth(ts) < wrapWidth) {
ts += ' '.repeat((width || 0) - mixin.stringWidth(ts) - 1);
}
}
// apply border and padding to string.
const padding = row[c].padding || [0, 0, 0, 0];
if (padding[left]) {
str += ' '.repeat(padding[left]);
}
str += addBorder(row[c], ts, '| ');
str += ts;
str += addBorder(row[c], ts, ' |');
if (padding[right]) {
str += ' '.repeat(padding[right]);
}
// if prior row is span, try to render the
// current row on the prior line.
if (r === 0 && lines.length > 0) {
str = this.renderInline(str, lines[lines.length - 1]);
}
});
// remove trailing whitespace.
lines.push({
text: str.replace(/ +$/, ''),
span: row.span
});
});
return lines;
}
// if the full 'source' can render in
// the target line, do so.
renderInline(source, previousLine) {
const match = source.match(/^ */);
const leadingWhitespace = match ? match[0].length : 0;
const target = previousLine.text;
const targetTextWidth = mixin.stringWidth(target.trimRight());
if (!previousLine.span) {
return source;
}
// if we're not applying wrapping logic,
// just always append to the span.
if (!this.wrap) {
previousLine.hidden = true;
return target + source;
}
if (leadingWhitespace < targetTextWidth) {
return source;
}
previousLine.hidden = true;
return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();
}
rasterize(row) {
const rrows = [];
const widths = this.columnWidths(row);
let wrapped;
// word wrap all columns, and create
// a data-structure that is easy to rasterize.
row.forEach((col, c) => {
// leave room for left and right padding.
col.width = widths[c];
if (this.wrap) {
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n');
}
else {
wrapped = col.text.split('\n');
}
if (col.border) {
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
}
// add top and bottom padding.
if (col.padding) {
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
}
wrapped.forEach((str, r) => {
if (!rrows[r]) {
rrows.push([]);
}
const rrow = rrows[r];
for (let i = 0; i < c; i++) {
if (rrow[i] === undefined) {
rrow.push('');
}
}
rrow.push(str);
});
});
return rrows;
}
negatePadding(col) {
let wrapWidth = col.width || 0;
if (col.padding) {
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
}
if (col.border) {
wrapWidth -= 4;
}
return wrapWidth;
}
columnWidths(row) {
if (!this.wrap) {
return row.map(col => {
return col.width || mixin.stringWidth(col.text);
});
}
let unset = row.length;
let remainingWidth = this.width;
// column widths can be set in config.
const widths = row.map(col => {
if (col.width) {
unset--;
remainingWidth -= col.width;
return col.width;
}
return undefined;
});
// any unset widths should be calculated.
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
return widths.map((w, i) => {
if (w === undefined) {
return Math.max(unsetWidth, _minWidth(row[i]));
}
return w;
});
}
}
function addBorder(col, ts, style) {
if (col.border) {
if (/[.']-+[.']/.test(ts)) {
return '';
}
if (ts.trim().length !== 0) {
return style;
}
return ' ';
}
return '';
}
// calculates the minimum width of
// a column, based on padding preferences.
function _minWidth(col) {
const padding = col.padding || [];
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
if (col.border) {
return minWidth + 4;
}
return minWidth;
}
function getWindowWidth() {
/* istanbul ignore next: depends on terminal */
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
return process.stdout.columns;
}
return 80;
}
function alignRight(str, width) {
str = str.trim();
const strWidth = mixin.stringWidth(str);
if (strWidth < width) {
return ' '.repeat(width - strWidth) + str;
}
return str;
}
function alignCenter(str, width) {
str = str.trim();
const strWidth = mixin.stringWidth(str);
/* istanbul ignore next */
if (strWidth >= width) {
return str;
}
return ' '.repeat((width - strWidth) >> 1) + str;
}
let mixin;
export function cliui(opts, _mixin) {
mixin = _mixin;
return new UI({
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
});
}

View File

@ -0,0 +1,27 @@
// Minimal replacement for ansi string helpers "wrap-ansi" and "strip-ansi".
// to facilitate ESM and Deno modules.
// TODO: look at porting https://www.npmjs.com/package/wrap-ansi to ESM.
// The npm application
// Copyright (c) npm, Inc. and Contributors
// Licensed on the terms of The Artistic License 2.0
// See: https://github.com/npm/cli/blob/4c65cd952bc8627811735bea76b9b110cc4fc80e/lib/utils/ansi-trim.js
const ansi = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' +
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g');
export function stripAnsi(str) {
return str.replace(ansi, '');
}
export function wrap(str, width) {
const [start, end] = str.match(ansi) || ['', ''];
str = stripAnsi(str);
let wrapped = '';
for (let i = 0; i < str.length; i++) {
if (i !== 0 && (i % width) === 0) {
wrapped += '\n';
}
wrapped += str.charAt(i);
}
if (start && end) {
wrapped = `${start}${wrapped}${end}`;
}
return wrapped;
}

13
node_modules/localtunnel/node_modules/cliui/index.mjs generated vendored Normal file
View File

@ -0,0 +1,13 @@
// Bootstrap cliui with CommonJS dependencies:
import { cliui } from './build/lib/index.js'
import { wrap, stripAnsi } from './build/lib/string-utils.js'
export default function ui (opts) {
return cliui(opts, {
stringWidth: (str) => {
return [...str].length
},
stripAnsi,
wrap
})
}

View File

@ -0,0 +1,83 @@
{
"name": "cliui",
"version": "7.0.4",
"description": "easily create complex multi-column command-line-interfaces",
"main": "build/index.cjs",
"exports": {
".": [
{
"import": "./index.mjs",
"require": "./build/index.cjs"
},
"./build/index.cjs"
]
},
"type": "module",
"module": "./index.mjs",
"scripts": {
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
"test": "c8 mocha ./test/*.cjs",
"test:esm": "c8 mocha ./test/esm/cliui-test.mjs",
"postest": "check",
"coverage": "c8 report --check-coverage",
"precompile": "rimraf build",
"compile": "tsc",
"postcompile": "npm run build:cjs",
"build:cjs": "rollup -c",
"prepare": "npm run compile"
},
"repository": "yargs/cliui",
"standard": {
"ignore": [
"**/example/**"
],
"globals": [
"it"
]
},
"keywords": [
"cli",
"command-line",
"layout",
"design",
"console",
"wrap",
"table"
],
"author": "Ben Coe <ben@npmjs.com>",
"license": "ISC",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
},
"devDependencies": {
"@types/node": "^14.0.27",
"@typescript-eslint/eslint-plugin": "^4.0.0",
"@typescript-eslint/parser": "^4.0.0",
"@wessberg/rollup-plugin-ts": "^1.3.2",
"c8": "^7.3.0",
"chai": "^4.2.0",
"chalk": "^4.1.0",
"cross-env": "^7.0.2",
"eslint": "^7.6.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"gts": "^3.0.0",
"mocha": "^8.1.1",
"rimraf": "^3.0.2",
"rollup": "^2.23.1",
"standardx": "^7.0.0",
"typescript": "^4.0.0"
},
"files": [
"build",
"index.mjs",
"!*.d.ts"
],
"engine": {
"node": ">=10"
}
}

19
node_modules/localtunnel/node_modules/debug/LICENSE generated vendored Normal file
View File

@ -0,0 +1,19 @@
(The MIT License)
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
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.

455
node_modules/localtunnel/node_modules/debug/README.md generated vendored Normal file
View File

@ -0,0 +1,455 @@
# debug
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
A tiny JavaScript debugging utility modelled after Node.js core's debugging
technique. Works in Node.js and web browsers.
## Installation
```bash
$ npm install debug
```
## Usage
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
Example [_app.js_](./examples/node/app.js):
```js
var debug = require('debug')('http')
, http = require('http')
, name = 'My App';
// fake app
debug('booting %o', name);
http.createServer(function(req, res){
debug(req.method + ' ' + req.url);
res.end('hello\n');
}).listen(3000, function(){
debug('listening');
});
// fake worker of some kind
require('./worker');
```
Example [_worker.js_](./examples/node/worker.js):
```js
var a = require('debug')('worker:a')
, b = require('debug')('worker:b');
function work() {
a('doing lots of uninteresting work');
setTimeout(work, Math.random() * 1000);
}
work();
function workb() {
b('doing some work');
setTimeout(workb, Math.random() * 2000);
}
workb();
```
The `DEBUG` environment variable is then used to enable these based on space or
comma-delimited names.
Here are some examples:
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
#### Windows command prompt notes
##### CMD
On Windows the environment variable is set using the `set` command.
```cmd
set DEBUG=*,-not_this
```
Example:
```cmd
set DEBUG=* & node app.js
```
##### PowerShell (VS Code default)
PowerShell uses different syntax to set environment variables.
```cmd
$env:DEBUG = "*,-not_this"
```
Example:
```cmd
$env:DEBUG='app';node app.js
```
Then, run the program to be debugged as usual.
npm script example:
```js
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
```
## Namespace Colors
Every debug instance has a color generated for it based on its namespace name.
This helps when visually parsing the debug output to identify which debug instance
a debug line belongs to.
#### Node.js
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
otherwise debug will only use a small handful of basic colors.
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
#### Web Browser
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
option. These are WebKit web inspectors, Firefox ([since version
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
and the Firebug plugin for Firefox (any version).
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
## Millisecond diff
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
## Conventions
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
## Wildcards
The `*` character may be used as a wildcard. Suppose for example your library has
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
instead of listing all three with
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
You can also exclude specific debuggers by prefixing them with a "-" character.
For example, `DEBUG=*,-connect:*` would include all debuggers except those
starting with "connect:".
## Environment Variables
When running through Node.js, you can set a few environment variables that will
change the behavior of the debug logging:
| Name | Purpose |
|-----------|-------------------------------------------------|
| `DEBUG` | Enables/disables specific debugging namespaces. |
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
| `DEBUG_DEPTH` | Object inspection depth. |
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
__Note:__ The environment variables beginning with `DEBUG_` end up being
converted into an Options object that gets used with `%o`/`%O` formatters.
See the Node.js documentation for
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
for the complete list.
## Formatters
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
Below are the officially supported formatters:
| Formatter | Representation |
|-----------|----------------|
| `%O` | Pretty-print an Object on multiple lines. |
| `%o` | Pretty-print an Object all on a single line. |
| `%s` | String. |
| `%d` | Number (both integer and float). |
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
| `%%` | Single percent sign ('%'). This does not consume an argument. |
### Custom formatters
You can add custom formatters by extending the `debug.formatters` object.
For example, if you wanted to add support for rendering a Buffer as hex with
`%h`, you could do something like:
```js
const createDebug = require('debug')
createDebug.formatters.h = (v) => {
return v.toString('hex')
}
// …elsewhere
const debug = createDebug('foo')
debug('this is hex: %h', new Buffer('hello world'))
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
```
## Browser Support
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
if you don't want to build it yourself.
Debug's enable state is currently persisted by `localStorage`.
Consider the situation shown below where you have `worker:a` and `worker:b`,
and wish to debug both. You can enable this using `localStorage.debug`:
```js
localStorage.debug = 'worker:*'
```
And then refresh the page.
```js
a = debug('worker:a');
b = debug('worker:b');
setInterval(function(){
a('doing some work');
}, 1000);
setInterval(function(){
b('doing some work');
}, 1200);
```
## Output streams
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
Example [_stdout.js_](./examples/node/stdout.js):
```js
var debug = require('debug');
var error = debug('app:error');
// by default stderr is used
error('goes to stderr!');
var log = debug('app:log');
// set this namespace to log via console.log
log.log = console.log.bind(console); // don't forget to bind to console!
log('goes to stdout');
error('still goes to stderr!');
// set all output to go via console.info
// overrides all per-namespace log settings
debug.log = console.info.bind(console);
error('now goes to stdout via console.info');
log('still goes to stdout, but via console.info now');
```
## Extend
You can simply extend debugger
```js
const log = require('debug')('auth');
//creates new debug instance with extended namespace
const logSign = log.extend('sign');
const logLogin = log.extend('login');
log('hello'); // auth hello
logSign('hello'); //auth:sign hello
logLogin('hello'); //auth:login hello
```
## Set dynamically
You can also enable debug dynamically by calling the `enable()` method :
```js
let debug = require('debug');
console.log(1, debug.enabled('test'));
debug.enable('test');
console.log(2, debug.enabled('test'));
debug.disable();
console.log(3, debug.enabled('test'));
```
print :
```
1 false
2 true
3 false
```
Usage :
`enable(namespaces)`
`namespaces` can include modes separated by a colon and wildcards.
Note that calling `enable()` completely overrides previously set DEBUG variable :
```
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
=> false
```
`disable()`
Will disable all namespaces. The functions returns the namespaces currently
enabled (and skipped). This can be useful if you want to disable debugging
temporarily without knowing what was enabled to begin with.
For example:
```js
let debug = require('debug');
debug.enable('foo:*,-foo:bar');
let namespaces = debug.disable();
debug.enable(namespaces);
```
Note: There is no guarantee that the string will be identical to the initial
enable string, but semantically they will be identical.
## Checking whether a debug target is enabled
After you've created a debug instance, you can determine whether or not it is
enabled by checking the `enabled` property:
```javascript
const debug = require('debug')('http');
if (debug.enabled) {
// do stuff...
}
```
You can also manually toggle this property to force the debug instance to be
enabled or disabled.
## Authors
- TJ Holowaychuk
- Nathan Rajlich
- Andrew Rhyne
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
## License
(The MIT License)
Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
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.

View File

@ -0,0 +1,59 @@
{
"name": "debug",
"version": "4.3.2",
"repository": {
"type": "git",
"url": "git://github.com/visionmedia/debug.git"
},
"description": "small debugging utility",
"keywords": [
"debug",
"log",
"debugger"
],
"files": [
"src",
"LICENSE",
"README.md"
],
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
"Andrew Rhyne <rhyneandrew@gmail.com>",
"Josh Junon <josh@junon.me>"
],
"license": "MIT",
"scripts": {
"lint": "xo",
"test": "npm run test:node && npm run test:browser && npm run lint",
"test:node": "istanbul cover _mocha -- test.js",
"test:browser": "karma start --single-run",
"test:coverage": "cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
"ms": "2.1.2"
},
"devDependencies": {
"brfs": "^2.0.1",
"browserify": "^16.2.3",
"coveralls": "^3.0.2",
"istanbul": "^0.4.5",
"karma": "^3.1.4",
"karma-browserify": "^6.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.2.0",
"xo": "^0.23.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
},
"main": "./src/index.js",
"browser": "./src/browser.js",
"engines": {
"node": ">=6.0"
}
}

View File

@ -0,0 +1,269 @@
/* eslint-env browser */
/**
* This is the web browser implementation of `debug()`.
*/
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
exports.destroy = (() => {
let warned = false;
return () => {
if (!warned) {
warned = true;
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
}
};
})();
/**
* Colors.
*/
exports.colors = [
'#0000CC',
'#0000FF',
'#0033CC',
'#0033FF',
'#0066CC',
'#0066FF',
'#0099CC',
'#0099FF',
'#00CC00',
'#00CC33',
'#00CC66',
'#00CC99',
'#00CCCC',
'#00CCFF',
'#3300CC',
'#3300FF',
'#3333CC',
'#3333FF',
'#3366CC',
'#3366FF',
'#3399CC',
'#3399FF',
'#33CC00',
'#33CC33',
'#33CC66',
'#33CC99',
'#33CCCC',
'#33CCFF',
'#6600CC',
'#6600FF',
'#6633CC',
'#6633FF',
'#66CC00',
'#66CC33',
'#9900CC',
'#9900FF',
'#9933CC',
'#9933FF',
'#99CC00',
'#99CC33',
'#CC0000',
'#CC0033',
'#CC0066',
'#CC0099',
'#CC00CC',
'#CC00FF',
'#CC3300',
'#CC3333',
'#CC3366',
'#CC3399',
'#CC33CC',
'#CC33FF',
'#CC6600',
'#CC6633',
'#CC9900',
'#CC9933',
'#CCCC00',
'#CCCC33',
'#FF0000',
'#FF0033',
'#FF0066',
'#FF0099',
'#FF00CC',
'#FF00FF',
'#FF3300',
'#FF3333',
'#FF3366',
'#FF3399',
'#FF33CC',
'#FF33FF',
'#FF6600',
'#FF6633',
'#FF9900',
'#FF9933',
'#FFCC00',
'#FFCC33'
];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
// eslint-disable-next-line complexity
function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
return true;
}
// Internet Explorer and Edge do not support colors.
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// Is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
// Double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs(args) {
args[0] = (this.useColors ? '%c' : '') +
this.namespace +
(this.useColors ? ' %c' : ' ') +
args[0] +
(this.useColors ? '%c ' : ' ') +
'+' + module.exports.humanize(this.diff);
if (!this.useColors) {
return;
}
const c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit');
// The final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
let index = 0;
let lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, match => {
if (match === '%%') {
return;
}
index++;
if (match === '%c') {
// We only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
}
/**
* Invokes `console.debug()` when available.
* No-op when `console.debug` is not a "function".
* If `console.debug` is not available, falls back
* to `console.log`.
*
* @api public
*/
exports.log = console.debug || console.log || (() => {});
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (namespaces) {
exports.storage.setItem('debug', namespaces);
} else {
exports.storage.removeItem('debug');
}
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
let r;
try {
r = exports.storage.getItem('debug');
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
return r;
}
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage() {
try {
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
// The Browser also has localStorage in the global context.
return localStorage;
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
}
module.exports = require('./common')(exports);
const {formatters} = module.exports;
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
formatters.j = function (v) {
try {
return JSON.stringify(v);
} catch (error) {
return '[UnexpectedJSONParseError]: ' + error.message;
}
};

View File

@ -0,0 +1,274 @@
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*/
function setup(env) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = require('ms');
createDebug.destroy = destroy;
Object.keys(env).forEach(key => {
createDebug[key] = env[key];
});
/**
* The currently active debug mode names, and names to skip.
*/
createDebug.names = [];
createDebug.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
createDebug.formatters = {};
/**
* Selects a color for a debug namespace
* @param {String} namespace The namespace string for the for the debug instance to be colored
* @return {Number|String} An ANSI color code for the given namespace
* @api private
*/
function selectColor(namespace) {
let hash = 0;
for (let i = 0; i < namespace.length; i++) {
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
}
createDebug.selectColor = selectColor;
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
let prevTime;
let enableOverride = null;
let namespacesCache;
let enabledCache;
function debug(...args) {
// Disabled?
if (!debug.enabled) {
return;
}
const self = debug;
// Set `diff` timestamp
const curr = Number(new Date());
const ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
args[0] = createDebug.coerce(args[0]);
if (typeof args[0] !== 'string') {
// Anything else let's inspect with %O
args.unshift('%O');
}
// Apply any `formatters` transformations
let index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
// If we encounter an escaped % then don't increase the array index
if (match === '%%') {
return '%';
}
index++;
const formatter = createDebug.formatters[format];
if (typeof formatter === 'function') {
const val = args[index];
match = formatter.call(self, val);
// Now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
});
// Apply env-specific formatting (colors, etc.)
createDebug.formatArgs.call(self, args);
const logFn = self.log || createDebug.log;
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.useColors = createDebug.useColors();
debug.color = createDebug.selectColor(namespace);
debug.extend = extend;
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
Object.defineProperty(debug, 'enabled', {
enumerable: true,
configurable: false,
get: () => {
if (enableOverride !== null) {
return enableOverride;
}
if (namespacesCache !== createDebug.namespaces) {
namespacesCache = createDebug.namespaces;
enabledCache = createDebug.enabled(namespace);
}
return enabledCache;
},
set: v => {
enableOverride = v;
}
});
// Env-specific initialization logic for debug instances
if (typeof createDebug.init === 'function') {
createDebug.init(debug);
}
return debug;
}
function extend(namespace, delimiter) {
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
newDebug.log = this.log;
return newDebug;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
createDebug.save(namespaces);
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];
let i;
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
const len = split.length;
for (i = 0; i < len; i++) {
if (!split[i]) {
// ignore empty strings
continue;
}
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
createDebug.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @return {String} namespaces
* @api public
*/
function disable() {
const namespaces = [
...createDebug.names.map(toNamespace),
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
].join(',');
createDebug.enable('');
return namespaces;
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
let i;
let len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Convert regexp to namespace
*
* @param {RegExp} regxep
* @return {String} namespace
* @api private
*/
function toNamespace(regexp) {
return regexp.toString()
.substring(2, regexp.toString().length - 2)
.replace(/\.\*\?$/, '*');
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) {
return val.stack || val.message;
}
return val;
}
/**
* XXX DO NOT USE. This is a temporary stub function.
* XXX It WILL be removed in the next major release.
*/
function destroy() {
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
}
createDebug.enable(createDebug.load());
return createDebug;
}
module.exports = setup;

View File

@ -0,0 +1,10 @@
/**
* Detect Electron renderer / nwjs process, which is node, but we should
* treat as a browser.
*/
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
module.exports = require('./browser.js');
} else {
module.exports = require('./node.js');
}

263
node_modules/localtunnel/node_modules/debug/src/node.js generated vendored Normal file
View File

@ -0,0 +1,263 @@
/**
* Module dependencies.
*/
const tty = require('tty');
const util = require('util');
/**
* This is the Node.js implementation of `debug()`.
*/
exports.init = init;
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.destroy = util.deprecate(
() => {},
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
);
/**
* Colors.
*/
exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
const supportsColor = require('supports-color');
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [
20,
21,
26,
27,
32,
33,
38,
39,
40,
41,
42,
43,
44,
45,
56,
57,
62,
63,
68,
69,
74,
75,
76,
77,
78,
79,
80,
81,
92,
93,
98,
99,
112,
113,
128,
129,
134,
135,
148,
149,
160,
161,
162,
163,
164,
165,
166,
167,
168,
169,
170,
171,
172,
173,
178,
179,
184,
185,
196,
197,
198,
199,
200,
201,
202,
203,
204,
205,
206,
207,
208,
209,
214,
215,
220,
221
];
}
} catch (error) {
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
}
/**
* Build up the default `inspectOpts` object from the environment variables.
*
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
*/
exports.inspectOpts = Object.keys(process.env).filter(key => {
return /^debug_/i.test(key);
}).reduce((obj, key) => {
// Camel-case
const prop = key
.substring(6)
.toLowerCase()
.replace(/_([a-z])/g, (_, k) => {
return k.toUpperCase();
});
// Coerce string value into JS value
let val = process.env[key];
if (/^(yes|on|true|enabled)$/i.test(val)) {
val = true;
} else if (/^(no|off|false|disabled)$/i.test(val)) {
val = false;
} else if (val === 'null') {
val = null;
} else {
val = Number(val);
}
obj[prop] = val;
return obj;
}, {});
/**
* Is stdout a TTY? Colored output is enabled when `true`.
*/
function useColors() {
return 'colors' in exports.inspectOpts ?
Boolean(exports.inspectOpts.colors) :
tty.isatty(process.stderr.fd);
}
/**
* Adds ANSI color escape codes if enabled.
*
* @api public
*/
function formatArgs(args) {
const {namespace: name, useColors} = this;
if (useColors) {
const c = this.color;
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
} else {
args[0] = getDate() + name + ' ' + args[0];
}
}
function getDate() {
if (exports.inspectOpts.hideDate) {
return '';
}
return new Date().toISOString() + ' ';
}
/**
* Invokes `util.format()` with the specified arguments and writes to stderr.
*/
function log(...args) {
return process.stderr.write(util.format(...args) + '\n');
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
if (namespaces) {
process.env.DEBUG = namespaces;
} else {
// If you set a process.env field to null or undefined, it gets cast to the
// string 'null' or 'undefined'. Just delete instead.
delete process.env.DEBUG;
}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
return process.env.DEBUG;
}
/**
* Init logic for `debug` instances.
*
* Create a new `inspectOpts` object in case `useColors` is set
* differently for a particular `debug` instance.
*/
function init(debug) {
debug.inspectOpts = {};
const keys = Object.keys(exports.inspectOpts);
for (let i = 0; i < keys.length; i++) {
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
}
}
module.exports = require('./common')(exports);
const {formatters} = module.exports;
/**
* Map %o to `util.inspect()`, all on a single line.
*/
formatters.o = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.split('\n')
.map(str => str.trim())
.join(' ');
};
/**
* Map %O to `util.inspect()`, allowing multiple lines if needed.
*/
formatters.O = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts);
};

162
node_modules/localtunnel/node_modules/ms/index.js generated vendored Normal file
View File

@ -0,0 +1,162 @@
/**
* Helpers.
*/
var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var w = d * 7;
var y = d * 365.25;
/**
* Parse or format the given `val`.
*
* Options:
*
* - `long` verbose formatting [false]
*
* @param {String|Number} val
* @param {Object} [options]
* @throws {Error} throw an error if val is not a non-empty string or a number
* @return {String|Number}
* @api public
*/
module.exports = function(val, options) {
options = options || {};
var type = typeof val;
if (type === 'string' && val.length > 0) {
return parse(val);
} else if (type === 'number' && isFinite(val)) {
return options.long ? fmtLong(val) : fmtShort(val);
}
throw new Error(
'val is not a non-empty string or a valid number. val=' +
JSON.stringify(val)
);
};
/**
* Parse the given `str` and return milliseconds.
*
* @param {String} str
* @return {Number}
* @api private
*/
function parse(str) {
str = String(str);
if (str.length > 100) {
return;
}
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
str
);
if (!match) {
return;
}
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
switch (type) {
case 'years':
case 'year':
case 'yrs':
case 'yr':
case 'y':
return n * y;
case 'weeks':
case 'week':
case 'w':
return n * w;
case 'days':
case 'day':
case 'd':
return n * d;
case 'hours':
case 'hour':
case 'hrs':
case 'hr':
case 'h':
return n * h;
case 'minutes':
case 'minute':
case 'mins':
case 'min':
case 'm':
return n * m;
case 'seconds':
case 'second':
case 'secs':
case 'sec':
case 's':
return n * s;
case 'milliseconds':
case 'millisecond':
case 'msecs':
case 'msec':
case 'ms':
return n;
default:
return undefined;
}
}
/**
* Short format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtShort(ms) {
var msAbs = Math.abs(ms);
if (msAbs >= d) {
return Math.round(ms / d) + 'd';
}
if (msAbs >= h) {
return Math.round(ms / h) + 'h';
}
if (msAbs >= m) {
return Math.round(ms / m) + 'm';
}
if (msAbs >= s) {
return Math.round(ms / s) + 's';
}
return ms + 'ms';
}
/**
* Long format for `ms`.
*
* @param {Number} ms
* @return {String}
* @api private
*/
function fmtLong(ms) {
var msAbs = Math.abs(ms);
if (msAbs >= d) {
return plural(ms, msAbs, d, 'day');
}
if (msAbs >= h) {
return plural(ms, msAbs, h, 'hour');
}
if (msAbs >= m) {
return plural(ms, msAbs, m, 'minute');
}
if (msAbs >= s) {
return plural(ms, msAbs, s, 'second');
}
return ms + ' ms';
}
/**
* Pluralization helper.
*/
function plural(ms, msAbs, n, name) {
var isPlural = msAbs >= n * 1.5;
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
}

21
node_modules/localtunnel/node_modules/ms/license.md generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Zeit, Inc.
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.

37
node_modules/localtunnel/node_modules/ms/package.json generated vendored Normal file
View File

@ -0,0 +1,37 @@
{
"name": "ms",
"version": "2.1.2",
"description": "Tiny millisecond conversion utility",
"repository": "zeit/ms",
"main": "./index",
"files": [
"index.js"
],
"scripts": {
"precommit": "lint-staged",
"lint": "eslint lib/* bin/*",
"test": "mocha tests.js"
},
"eslintConfig": {
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true
}
},
"lint-staged": {
"*.js": [
"npm run lint",
"prettier --single-quote --write",
"git add"
]
},
"license": "MIT",
"devDependencies": {
"eslint": "4.12.1",
"expect.js": "0.3.1",
"husky": "0.14.3",
"lint-staged": "5.0.0",
"mocha": "4.0.1"
}
}

60
node_modules/localtunnel/node_modules/ms/readme.md generated vendored Normal file
View File

@ -0,0 +1,60 @@
# ms
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
Use this package to easily convert various time formats to milliseconds.
## Examples
```js
ms('2 days') // 172800000
ms('1d') // 86400000
ms('10h') // 36000000
ms('2.5 hrs') // 9000000
ms('2h') // 7200000
ms('1m') // 60000
ms('5s') // 5000
ms('1y') // 31557600000
ms('100') // 100
ms('-3 days') // -259200000
ms('-1h') // -3600000
ms('-200') // -200
```
### Convert from Milliseconds
```js
ms(60000) // "1m"
ms(2 * 60000) // "2m"
ms(-3 * 60000) // "-3m"
ms(ms('10 hours')) // "10h"
```
### Time Format Written-Out
```js
ms(60000, { long: true }) // "1 minute"
ms(2 * 60000, { long: true }) // "2 minutes"
ms(-3 * 60000, { long: true }) // "-3 minutes"
ms(ms('10 hours'), { long: true }) // "10 hours"
```
## Features
- Works both in [Node.js](https://nodejs.org) and in the browser
- If a number is supplied to `ms`, a string with a unit is returned
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
## Related Packages
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
## Caught a Bug?
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
2. Link the package to the global module directory: `npm link`
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
As always, you can run the tests using: `npm test`

View File

@ -0,0 +1,263 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [20.2.9](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.8...yargs-parser-v20.2.9) (2021-06-20)
### Bug Fixes
* **build:** fixed automated release pipeline ([1fe9135](https://www.github.com/yargs/yargs-parser/commit/1fe9135884790a083615419b2861683e2597dac3))
### [20.2.8](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.7...yargs-parser-v20.2.8) (2021-06-20)
### Bug Fixes
* **locale:** Turkish camelize and decamelize issues with toLocaleLowerCase/toLocaleUpperCase ([2617303](https://www.github.com/yargs/yargs-parser/commit/261730383e02448562f737b94bbd1f164aed5143))
* **perf:** address slow parse when using unknown-options-as-args ([#394](https://www.github.com/yargs/yargs-parser/issues/394)) ([441f059](https://www.github.com/yargs/yargs-parser/commit/441f059d585d446551068ad213db79ac91daf83a))
* **string-utils:** detect [0,1] ranged values as numbers ([#388](https://www.github.com/yargs/yargs-parser/issues/388)) ([efcc32c](https://www.github.com/yargs/yargs-parser/commit/efcc32c2d6b09aba31abfa2db9bd947befe5586b))
### [20.2.7](https://www.github.com/yargs/yargs-parser/compare/v20.2.6...v20.2.7) (2021-03-10)
### Bug Fixes
* **deno:** force release for Deno ([6687c97](https://www.github.com/yargs/yargs-parser/commit/6687c972d0f3ca7865a97908dde3080b05f8b026))
### [20.2.6](https://www.github.com/yargs/yargs-parser/compare/v20.2.5...v20.2.6) (2021-02-22)
### Bug Fixes
* **populate--:** -- should always be array ([#354](https://www.github.com/yargs/yargs-parser/issues/354)) ([585ae8f](https://www.github.com/yargs/yargs-parser/commit/585ae8ffad74cc02974f92d788e750137fd65146))
### [20.2.5](https://www.github.com/yargs/yargs-parser/compare/v20.2.4...v20.2.5) (2021-02-13)
### Bug Fixes
* do not lowercase camel cased string ([#348](https://www.github.com/yargs/yargs-parser/issues/348)) ([5f4da1f](https://www.github.com/yargs/yargs-parser/commit/5f4da1f17d9d50542d2aaa206c9806ce3e320335))
### [20.2.4](https://www.github.com/yargs/yargs-parser/compare/v20.2.3...v20.2.4) (2020-11-09)
### Bug Fixes
* **deno:** address import issues in Deno ([#339](https://www.github.com/yargs/yargs-parser/issues/339)) ([3b54e5e](https://www.github.com/yargs/yargs-parser/commit/3b54e5eef6e9a7b7c6eec7c12bab3ba3b8ba8306))
### [20.2.3](https://www.github.com/yargs/yargs-parser/compare/v20.2.2...v20.2.3) (2020-10-16)
### Bug Fixes
* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#336](https://www.github.com/yargs/yargs-parser/issues/336)) ([3ae7242](https://www.github.com/yargs/yargs-parser/commit/3ae7242040ff876d28dabded60ac226e00150c88))
### [20.2.2](https://www.github.com/yargs/yargs-parser/compare/v20.2.1...v20.2.2) (2020-10-14)
### Bug Fixes
* **exports:** node 13.0-13.6 require a string fallback ([#333](https://www.github.com/yargs/yargs-parser/issues/333)) ([291aeda](https://www.github.com/yargs/yargs-parser/commit/291aeda06b685b7a015d83bdf2558e180b37388d))
### [20.2.1](https://www.github.com/yargs/yargs-parser/compare/v20.2.0...v20.2.1) (2020-10-01)
### Bug Fixes
* **deno:** update types for deno ^1.4.0 ([#330](https://www.github.com/yargs/yargs-parser/issues/330)) ([0ab92e5](https://www.github.com/yargs/yargs-parser/commit/0ab92e50b090f11196334c048c9c92cecaddaf56))
## [20.2.0](https://www.github.com/yargs/yargs-parser/compare/v20.1.0...v20.2.0) (2020-09-21)
### Features
* **string-utils:** export looksLikeNumber helper ([#324](https://www.github.com/yargs/yargs-parser/issues/324)) ([c8580a2](https://www.github.com/yargs/yargs-parser/commit/c8580a2327b55f6342acecb6e72b62963d506750))
### Bug Fixes
* **unknown-options-as-args:** convert positionals that look like numbers ([#326](https://www.github.com/yargs/yargs-parser/issues/326)) ([f85ebb4](https://www.github.com/yargs/yargs-parser/commit/f85ebb4face9d4b0f56147659404cbe0002f3dad))
## [20.1.0](https://www.github.com/yargs/yargs-parser/compare/v20.0.0...v20.1.0) (2020-09-20)
### Features
* adds parse-positional-numbers configuration ([#321](https://www.github.com/yargs/yargs-parser/issues/321)) ([9cec00a](https://www.github.com/yargs/yargs-parser/commit/9cec00a622251292ffb7dce6f78f5353afaa0d4c))
### Bug Fixes
* **build:** update release-please; make labels kick off builds ([#323](https://www.github.com/yargs/yargs-parser/issues/323)) ([09f448b](https://www.github.com/yargs/yargs-parser/commit/09f448b4cd66e25d2872544718df46dab8af062a))
## [20.0.0](https://www.github.com/yargs/yargs-parser/compare/v19.0.4...v20.0.0) (2020-09-09)
### ⚠ BREAKING CHANGES
* do not ship type definitions (#318)
### Bug Fixes
* only strip camel case if hyphenated ([#316](https://www.github.com/yargs/yargs-parser/issues/316)) ([95a9e78](https://www.github.com/yargs/yargs-parser/commit/95a9e785127b9bbf2d1db1f1f808ca1fb100e82a)), closes [#315](https://www.github.com/yargs/yargs-parser/issues/315)
### Code Refactoring
* do not ship type definitions ([#318](https://www.github.com/yargs/yargs-parser/issues/318)) ([8fbd56f](https://www.github.com/yargs/yargs-parser/commit/8fbd56f1d0b6c44c30fca62708812151ca0ce330))
### [19.0.4](https://www.github.com/yargs/yargs-parser/compare/v19.0.3...v19.0.4) (2020-08-27)
### Bug Fixes
* **build:** fixing publication ([#310](https://www.github.com/yargs/yargs-parser/issues/310)) ([5d3c6c2](https://www.github.com/yargs/yargs-parser/commit/5d3c6c29a9126248ba601920d9cf87c78e161ff5))
### [19.0.3](https://www.github.com/yargs/yargs-parser/compare/v19.0.2...v19.0.3) (2020-08-27)
### Bug Fixes
* **build:** switch to action for publish ([#308](https://www.github.com/yargs/yargs-parser/issues/308)) ([5c2f305](https://www.github.com/yargs/yargs-parser/commit/5c2f30585342bcd8aaf926407c863099d256d174))
### [19.0.2](https://www.github.com/yargs/yargs-parser/compare/v19.0.1...v19.0.2) (2020-08-27)
### Bug Fixes
* **types:** envPrefix should be optional ([#305](https://www.github.com/yargs/yargs-parser/issues/305)) ([ae3f180](https://www.github.com/yargs/yargs-parser/commit/ae3f180e14df2de2fd962145f4518f9aa0e76523))
### [19.0.1](https://www.github.com/yargs/yargs-parser/compare/v19.0.0...v19.0.1) (2020-08-09)
### Bug Fixes
* **build:** push tag created for deno ([2186a14](https://www.github.com/yargs/yargs-parser/commit/2186a14989749887d56189867602e39e6679f8b0))
## [19.0.0](https://www.github.com/yargs/yargs-parser/compare/v18.1.3...v19.0.0) (2020-08-09)
### ⚠ BREAKING CHANGES
* adds support for ESM and Deno (#295)
* **ts:** projects using `@types/yargs-parser` may see variations in type definitions.
* drops Node 6. begin following Node.js LTS schedule (#278)
### Features
* adds support for ESM and Deno ([#295](https://www.github.com/yargs/yargs-parser/issues/295)) ([195bc4a](https://www.github.com/yargs/yargs-parser/commit/195bc4a7f20c2a8f8e33fbb6ba96ef6e9a0120a1))
* expose camelCase and decamelize helpers ([#296](https://www.github.com/yargs/yargs-parser/issues/296)) ([39154ce](https://www.github.com/yargs/yargs-parser/commit/39154ceb5bdcf76b5f59a9219b34cedb79b67f26))
* **deps:** update to latest camelcase/decamelize ([#281](https://www.github.com/yargs/yargs-parser/issues/281)) ([8931ab0](https://www.github.com/yargs/yargs-parser/commit/8931ab08f686cc55286f33a95a83537da2be5516))
### Bug Fixes
* boolean numeric short option ([#294](https://www.github.com/yargs/yargs-parser/issues/294)) ([f600082](https://www.github.com/yargs/yargs-parser/commit/f600082c959e092076caf420bbbc9d7a231e2418))
* raise permission error for Deno if config load fails ([#298](https://www.github.com/yargs/yargs-parser/issues/298)) ([1174e2b](https://www.github.com/yargs/yargs-parser/commit/1174e2b3f0c845a1cd64e14ffc3703e730567a84))
* **deps:** update dependency decamelize to v3 ([#274](https://www.github.com/yargs/yargs-parser/issues/274)) ([4d98698](https://www.github.com/yargs/yargs-parser/commit/4d98698bc6767e84ec54a0842908191739be73b7))
* **types:** switch back to using Partial types ([#293](https://www.github.com/yargs/yargs-parser/issues/293)) ([bdc80ba](https://www.github.com/yargs/yargs-parser/commit/bdc80ba59fa13bc3025ce0a85e8bad9f9da24ea7))
### Build System
* drops Node 6. begin following Node.js LTS schedule ([#278](https://www.github.com/yargs/yargs-parser/issues/278)) ([9014ed7](https://www.github.com/yargs/yargs-parser/commit/9014ed722a32768b96b829e65a31705db5c1458a))
### Code Refactoring
* **ts:** move index.js to TypeScript ([#292](https://www.github.com/yargs/yargs-parser/issues/292)) ([f78d2b9](https://www.github.com/yargs/yargs-parser/commit/f78d2b97567ac4828624406e420b4047c710b789))
### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16)
### Bug Fixes
* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e))
### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26)
### Bug Fixes
* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13))
### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16)
### Bug Fixes
* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential
prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2))
## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07)
### Features
* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f))
## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02)
### ⚠ BREAKING CHANGES
* the narg count is now enforced when parsing arrays.
### Features
* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c))
## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01)
### Features
* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb))
### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29)
### Bug Fixes
* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba))
## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10)
### ⚠ BREAKING CHANGES
* this reverts parsing behavior of booleans to that of yargs@14
* objects used during parsing are now created with a null
prototype. There may be some scenarios where this change in behavior
leaks externally.
### Features
* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5))
* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732))
### Bug Fixes
* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346))
* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c))
* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de))
* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5))
## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01)
### ⚠ BREAKING CHANGES
* populate error if incompatible narg/count or array/count options are used (#191)
### Features
* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0))
* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9))
### Reverts
* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf))

View File

@ -0,0 +1,14 @@
Copyright (c) 2016, 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.

View File

@ -0,0 +1,518 @@
# yargs-parser
![ci](https://github.com/yargs/yargs-parser/workflows/ci/badge.svg)
[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/yargs-parser)
The mighty option parser used by [yargs](https://github.com/yargs/yargs).
visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs-parser/main/yargs-logo.png">
## Example
```sh
npm i yargs-parser --save
```
```js
const argv = require('yargs-parser')(process.argv.slice(2))
console.log(argv)
```
```console
$ node example.js --foo=33 --bar hello
{ _: [], foo: 33, bar: 'hello' }
```
_or parse a string!_
```js
const argv = require('yargs-parser')('--foo=99 --bar=33')
console.log(argv)
```
```console
{ _: [], foo: 99, bar: 33 }
```
Convert an array of mixed types before passing to `yargs-parser`:
```js
const parse = require('yargs-parser')
parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string
parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
```
## Deno Example
As of `v19` `yargs-parser` supports [Deno](https://github.com/denoland/deno):
```typescript
import parser from "https://deno.land/x/yargs_parser/deno.ts";
const argv = parser('--foo=99 --bar=9987930', {
string: ['bar']
})
console.log(argv)
```
## ESM Example
As of `v19` `yargs-parser` supports ESM (_both in Node.js and in the browser_):
**Node.js:**
```js
import parser from 'yargs-parser'
const argv = parser('--foo=99 --bar=9987930', {
string: ['bar']
})
console.log(argv)
```
**Browsers:**
```html
<!doctype html>
<body>
<script type="module">
import parser from "https://unpkg.com/yargs-parser@19.0.0/browser.js";
const argv = parser('--foo=99 --bar=9987930', {
string: ['bar']
})
console.log(argv)
</script>
</body>
```
## API
### parser(args, opts={})
Parses command line arguments returning a simple mapping of keys and values.
**expects:**
* `args`: a string or array of strings representing the options to parse.
* `opts`: provide a set of hints indicating how `args` should be parsed:
* `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.
* `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.<br>
Indicate that keys should be parsed as an array and coerced to booleans / numbers:<br>
`{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`.
* `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.
* `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided
(or throws an error). For arrays the function is called only once for the entire array:<br>
`{coerce: {foo: function (arg) {return modifiedArg}}}`.
* `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).
* `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:<br>
`{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`.
* `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).
* `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.
* `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.
* `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.
* `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`.
* `opts.normalize`: `path.normalize()` will be applied to values set to this key.
* `opts.number`: keys should be treated as numbers.
* `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).
**returns:**
* `obj`: an object representing the parsed value of `args`
* `key/value`: key value pairs for each argument and their aliases.
* `_`: an array representing the positional arguments.
* [optional] `--`: an array with arguments after the end-of-options flag `--`.
### require('yargs-parser').detailed(args, opts={})
Parses a command line string, returning detailed information required by the
yargs engine.
**expects:**
* `args`: a string or array of strings representing options to parse.
* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.
**returns:**
* `argv`: an object representing the parsed value of `args`
* `key/value`: key value pairs for each argument and their aliases.
* `_`: an array representing the positional arguments.
* [optional] `--`: an array with arguments after the end-of-options flag `--`.
* `error`: populated with an error object if an exception occurred during parsing.
* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.
* `newAliases`: any new aliases added via camel-case expansion:
* `boolean`: `{ fooBar: true }`
* `defaulted`: any new argument created by `opts.default`, no aliases included.
* `boolean`: `{ foo: true }`
* `configuration`: given by default settings and `opts.configuration`.
<a name="configuration"></a>
### Configuration
The yargs-parser applies several automated transformations on the keys provided
in `args`. These features can be turned on and off using the `configuration` field
of `opts`.
```js
var parsed = parser(['--no-dice'], {
configuration: {
'boolean-negation': false
}
})
```
### short option groups
* default: `true`.
* key: `short-option-groups`.
Should a group of short-options be treated as boolean flags?
```console
$ node example.js -abc
{ _: [], a: true, b: true, c: true }
```
_if disabled:_
```console
$ node example.js -abc
{ _: [], abc: true }
```
### camel-case expansion
* default: `true`.
* key: `camel-case-expansion`.
Should hyphenated arguments be expanded into camel-case aliases?
```console
$ node example.js --foo-bar
{ _: [], 'foo-bar': true, fooBar: true }
```
_if disabled:_
```console
$ node example.js --foo-bar
{ _: [], 'foo-bar': true }
```
### dot-notation
* default: `true`
* key: `dot-notation`
Should keys that contain `.` be treated as objects?
```console
$ node example.js --foo.bar
{ _: [], foo: { bar: true } }
```
_if disabled:_
```console
$ node example.js --foo.bar
{ _: [], "foo.bar": true }
```
### parse numbers
* default: `true`
* key: `parse-numbers`
Should keys that look like numbers be treated as such?
```console
$ node example.js --foo=99.3
{ _: [], foo: 99.3 }
```
_if disabled:_
```console
$ node example.js --foo=99.3
{ _: [], foo: "99.3" }
```
### parse positional numbers
* default: `true`
* key: `parse-positional-numbers`
Should positional keys that look like numbers be treated as such.
```console
$ node example.js 99.3
{ _: [99.3] }
```
_if disabled:_
```console
$ node example.js 99.3
{ _: ['99.3'] }
```
### boolean negation
* default: `true`
* key: `boolean-negation`
Should variables prefixed with `--no` be treated as negations?
```console
$ node example.js --no-foo
{ _: [], foo: false }
```
_if disabled:_
```console
$ node example.js --no-foo
{ _: [], "no-foo": true }
```
### combine arrays
* default: `false`
* key: `combine-arrays`
Should arrays be combined when provided by both command line arguments and
a configuration file.
### duplicate arguments array
* default: `true`
* key: `duplicate-arguments-array`
Should arguments be coerced into an array when duplicated:
```console
$ node example.js -x 1 -x 2
{ _: [], x: [1, 2] }
```
_if disabled:_
```console
$ node example.js -x 1 -x 2
{ _: [], x: 2 }
```
### flatten duplicate arrays
* default: `true`
* key: `flatten-duplicate-arrays`
Should array arguments be coerced into a single array when duplicated:
```console
$ node example.js -x 1 2 -x 3 4
{ _: [], x: [1, 2, 3, 4] }
```
_if disabled:_
```console
$ node example.js -x 1 2 -x 3 4
{ _: [], x: [[1, 2], [3, 4]] }
```
### greedy arrays
* default: `true`
* key: `greedy-arrays`
Should arrays consume more than one positional argument following their flag.
```console
$ node example --arr 1 2
{ _: [], arr: [1, 2] }
```
_if disabled:_
```console
$ node example --arr 1 2
{ _: [2], arr: [1] }
```
**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.**
### nargs eats options
* default: `false`
* key: `nargs-eats-options`
Should nargs consume dash options as well as positional arguments.
### negation prefix
* default: `no-`
* key: `negation-prefix`
The prefix to use for negated boolean variables.
```console
$ node example.js --no-foo
{ _: [], foo: false }
```
_if set to `quux`:_
```console
$ node example.js --quuxfoo
{ _: [], foo: false }
```
### populate --
* default: `false`.
* key: `populate--`
Should unparsed flags be stored in `--` or `_`.
_If disabled:_
```console
$ node example.js a -b -- x y
{ _: [ 'a', 'x', 'y' ], b: true }
```
_If enabled:_
```console
$ node example.js a -b -- x y
{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }
```
### set placeholder key
* default: `false`.
* key: `set-placeholder-key`.
Should a placeholder be added for keys not set via the corresponding CLI argument?
_If disabled:_
```console
$ node example.js -a 1 -c 2
{ _: [], a: 1, c: 2 }
```
_If enabled:_
```console
$ node example.js -a 1 -c 2
{ _: [], a: 1, b: undefined, c: 2 }
```
### halt at non-option
* default: `false`.
* key: `halt-at-non-option`.
Should parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line.
_If disabled:_
```console
$ node example.js -a run b -x y
{ _: [ 'b' ], a: 'run', x: 'y' }
```
_If enabled:_
```console
$ node example.js -a run b -x y
{ _: [ 'b', '-x', 'y' ], a: 'run' }
```
### strip aliased
* default: `false`
* key: `strip-aliased`
Should aliases be removed before returning results?
_If disabled:_
```console
$ node example.js --test-field 1
{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 }
```
_If enabled:_
```console
$ node example.js --test-field 1
{ _: [], 'test-field': 1, testField: 1 }
```
### strip dashed
* default: `false`
* key: `strip-dashed`
Should dashed keys be removed before returning results? This option has no effect if
`camel-case-expansion` is disabled.
_If disabled:_
```console
$ node example.js --test-field 1
{ _: [], 'test-field': 1, testField: 1 }
```
_If enabled:_
```console
$ node example.js --test-field 1
{ _: [], testField: 1 }
```
### unknown options as args
* default: `false`
* key: `unknown-options-as-args`
Should unknown options be treated like regular arguments? An unknown option is one that is not
configured in `opts`.
_If disabled_
```console
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true }
```
_If enabled_
```console
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' }
```
## Supported Node.js Versions
Libraries in this ecosystem make a best effort to track
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
## Special Thanks
The yargs project evolves from optimist and minimist. It owes its
existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/
## License
ISC

View File

@ -0,0 +1,29 @@
// Main entrypoint for ESM web browser environments. Avoids using Node.js
// specific libraries, such as "path".
//
// TODO: figure out reasonable web equivalents for "resolve", "normalize", etc.
import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js'
import { YargsParser } from './build/lib/yargs-parser.js'
const parser = new YargsParser({
cwd: () => { return '' },
format: (str, arg) => { return str.replace('%s', arg) },
normalize: (str) => { return str },
resolve: (str) => { return str },
require: () => {
throw Error('loading config from files not currently supported in browser')
},
env: () => {}
})
const yargsParser = function Parser (args, opts) {
const result = parser.parse(args.slice(), opts)
return result.argv
}
yargsParser.detailed = function (args, opts) {
return parser.parse(args.slice(), opts)
}
yargsParser.camelCase = camelCase
yargsParser.decamelize = decamelize
yargsParser.looksLikeNumber = looksLikeNumber
export default yargsParser

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
/**
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
* CJS and ESM environments.
*
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/
import { format } from 'util';
import { readFileSync } from 'fs';
import { normalize, resolve } from 'path';
import { camelCase, decamelize, looksLikeNumber } from './string-utils.js';
import { YargsParser } from './yargs-parser.js';
// See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our
// version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
? Number(process.env.YARGS_MIN_NODE_VERSION)
: 10;
if (process && process.version) {
const major = Number(process.version.match(/v([^.]+)/)[1]);
if (major < minNodeVersion) {
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
}
}
// Creates a yargs-parser instance using Node.js standard libraries:
const env = process ? process.env : {};
const parser = new YargsParser({
cwd: process.cwd,
env: () => {
return env;
},
format,
normalize,
resolve,
// TODO: figure out a way to combine ESM and CJS coverage, such that
// we can exercise all the lines below:
require: (path) => {
if (typeof require !== 'undefined') {
return require(path);
}
else if (path.match(/\.json$/)) {
return readFileSync(path, 'utf8');
}
else {
throw Error('only .json config files are supported in ESM');
}
}
});
const yargsParser = function Parser(args, opts) {
const result = parser.parse(args.slice(), opts);
return result.argv;
};
yargsParser.detailed = function (args, opts) {
return parser.parse(args.slice(), opts);
};
yargsParser.camelCase = camelCase;
yargsParser.decamelize = decamelize;
yargsParser.looksLikeNumber = looksLikeNumber;
export default yargsParser;

View File

@ -0,0 +1,65 @@
/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/
export function camelCase(str) {
// Handle the case where an argument is provided as camel case, e.g., fooBar.
// by ensuring that the string isn't already mixed case:
const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
if (!isCamelCase) {
str = str.toLowerCase();
}
if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
return str;
}
else {
let camelcase = '';
let nextChrUpper = false;
const leadingHyphens = str.match(/^-+/);
for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
let chr = str.charAt(i);
if (nextChrUpper) {
nextChrUpper = false;
chr = chr.toUpperCase();
}
if (i !== 0 && (chr === '-' || chr === '_')) {
nextChrUpper = true;
}
else if (chr !== '-' && chr !== '_') {
camelcase += chr;
}
}
return camelcase;
}
}
export function decamelize(str, joinString) {
const lowercase = str.toLowerCase();
joinString = joinString || '-';
let notCamelcase = '';
for (let i = 0; i < str.length; i++) {
const chrLower = lowercase.charAt(i);
const chrString = str.charAt(i);
if (chrLower !== chrString && i > 0) {
notCamelcase += `${joinString}${lowercase.charAt(i)}`;
}
else {
notCamelcase += chrString;
}
}
return notCamelcase;
}
export function looksLikeNumber(x) {
if (x === null || x === undefined)
return false;
// if loaded from config, may already be a number.
if (typeof x === 'number')
return true;
// hexadecimal.
if (/^0x[0-9a-f]+$/i.test(x))
return true;
// don't treat 0123 as a number; as it drops the leading '0'.
if (/^0[^.]/.test(x))
return false;
return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}

View File

@ -0,0 +1,40 @@
/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/
// take an un-split argv string and tokenize it.
export function tokenizeArgString(argString) {
if (Array.isArray(argString)) {
return argString.map(e => typeof e !== 'string' ? e + '' : e);
}
argString = argString.trim();
let i = 0;
let prevC = null;
let c = null;
let opening = null;
const args = [];
for (let ii = 0; ii < argString.length; ii++) {
prevC = c;
c = argString.charAt(ii);
// split on spaces unless we're in quotes.
if (c === ' ' && !opening) {
if (!(prevC === ' ')) {
i++;
}
continue;
}
// don't split the string if we're in matching
// opening or closing single and double quotes.
if (c === opening) {
opening = null;
}
else if ((c === "'" || c === '"') && !opening) {
opening = c;
}
if (!args[i])
args[i] = '';
args[i] += c;
}
return args;
}

View File

@ -0,0 +1,12 @@
/**
* @license
* Copyright (c) 2016, Contributors
* SPDX-License-Identifier: ISC
*/
export var DefaultValuesForTypeKey;
(function (DefaultValuesForTypeKey) {
DefaultValuesForTypeKey["BOOLEAN"] = "boolean";
DefaultValuesForTypeKey["STRING"] = "string";
DefaultValuesForTypeKey["NUMBER"] = "number";
DefaultValuesForTypeKey["ARRAY"] = "array";
})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
{
"name": "yargs-parser",
"version": "20.2.9",
"description": "the mighty option parser used by yargs",
"main": "build/index.cjs",
"exports": {
".": [
{
"import": "./build/lib/index.js",
"require": "./build/index.cjs"
},
"./build/index.cjs"
]
},
"type": "module",
"module": "./build/lib/index.js",
"scripts": {
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
"test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
"test:browser": "start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'",
"pretest:typescript": "npm run pretest",
"test:typescript": "c8 mocha ./build/test/typescript/*.js",
"coverage": "c8 report --check-coverage",
"precompile": "rimraf build",
"compile": "tsc",
"postcompile": "npm run build:cjs",
"build:cjs": "rollup -c",
"prepare": "npm run compile"
},
"repository": {
"type": "git",
"url": "https://github.com/yargs/yargs-parser.git"
},
"keywords": [
"argument",
"parser",
"yargs",
"command",
"cli",
"parsing",
"option",
"args",
"argument"
],
"author": "Ben Coe <ben@npmjs.com>",
"license": "ISC",
"devDependencies": {
"@types/chai": "^4.2.11",
"@types/mocha": "^8.0.0",
"@types/node": "^14.0.0",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"@wessberg/rollup-plugin-ts": "^1.2.28",
"c8": "^7.3.0",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"eslint": "^7.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"gts": "^3.0.0",
"mocha": "^9.0.0",
"puppeteer": "^10.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.22.1",
"rollup-plugin-cleanup": "^3.1.1",
"serve": "^12.0.0",
"standardx": "^7.0.0",
"start-server-and-test": "^1.11.2",
"ts-transform-default-export": "^1.0.2",
"typescript": "^4.0.0"
},
"files": [
"browser.js",
"build",
"!*.d.ts"
],
"engines": {
"node": ">=10"
},
"standardx": {
"ignore": [
"build"
]
}
}

View File

@ -0,0 +1,174 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [17.1.1](https://www.github.com/yargs/yargs/compare/v17.1.0...v17.1.1) (2021-08-13)
### Bug Fixes
* positional array defaults should not be combined with provided values ([#2006](https://www.github.com/yargs/yargs/issues/2006)) ([832222d](https://www.github.com/yargs/yargs/commit/832222d7777da49e5c9da6c5801c2dd90d7fa6a2))
## [17.1.0](https://www.github.com/yargs/yargs/compare/v17.0.1...v17.1.0) (2021-08-04)
### Features
* update Levenshtein to Damerau-Levenshtein ([#1973](https://www.github.com/yargs/yargs/issues/1973)) ([d2c121b](https://www.github.com/yargs/yargs/commit/d2c121b00f2e1eb2ea8cc3a23a5039b3a4425bea))
### Bug Fixes
* coerce middleware should be applied once ([#1978](https://www.github.com/yargs/yargs/issues/1978)) ([14bd6be](https://www.github.com/yargs/yargs/commit/14bd6bebc3027ae929106b20dd198b9dccdeec31))
* implies should not fail when implied key's value is 0, false or empty string ([#1985](https://www.github.com/yargs/yargs/issues/1985)) ([8010472](https://www.github.com/yargs/yargs/commit/80104727d5f2ec4c5b491c1bdec4c94b2db95d9c))
* positionals should not overwrite options ([#1992](https://www.github.com/yargs/yargs/issues/1992)) ([9d84309](https://www.github.com/yargs/yargs/commit/9d84309e53ce1d30b1c61035ed5c78827a89df86))
* strict should fail unknown arguments ([#1977](https://www.github.com/yargs/yargs/issues/1977)) ([c804f0d](https://www.github.com/yargs/yargs/commit/c804f0db78e56b44341cc7a91878c27b1b68b9f2))
* wrap(null) no longer causes strange indentation behavior ([#1988](https://www.github.com/yargs/yargs/issues/1988)) ([e1871aa](https://www.github.com/yargs/yargs/commit/e1871aa792de219b221179417d410931af70d405))
### [17.0.1](https://www.github.com/yargs/yargs/compare/v17.0.0...v17.0.1) (2021-05-03)
### Bug Fixes
* **build:** Node 12 is now minimum version ([#1936](https://www.github.com/yargs/yargs/issues/1936)) ([0924566](https://www.github.com/yargs/yargs/commit/09245666e57facb140e0b45a9e45ca704883e5dd))
## [17.0.0](https://www.github.com/yargs/yargs/compare/v16.2.0...v17.0.0) (2021-05-02)
### ⚠ BREAKING CHANGES
* **node:** drop Node 10 (#1919)
* implicitly private methods are now actually private
* deprecated reset() method is now private (call yargs() instead).
* **yargs-factory:** refactor yargs-factory to use class (#1895)
* .positional() now allowed at root level of yargs.
* **coerce:** coerce is now applied before validation.
* **async:** yargs now returns a promise if async or check are asynchronous.
* **middleware:** global middleware now applied when no command is configured.
* #1823 contains the following breaking API changes:
* now returns a promise if handler is async.
* onFinishCommand removed, in favor of being able to await promise.
* getCompletion now invokes callback with err and `completions, returns promise of completions.
### Features
* add commands alias (similar to options function) ([#1850](https://www.github.com/yargs/yargs/issues/1850)) ([00b74ad](https://www.github.com/yargs/yargs/commit/00b74adcb30ab89b4450ef7105ef1ad32d820ebf))
* add parseSync/parseAsync method ([#1898](https://www.github.com/yargs/yargs/issues/1898)) ([6130ad8](https://www.github.com/yargs/yargs/commit/6130ad89b85dc49e34190e596e14a2fd3e668781))
* add support for `showVersion`, similar to `showHelp` ([#1831](https://www.github.com/yargs/yargs/issues/1831)) ([1a1e2d5](https://www.github.com/yargs/yargs/commit/1a1e2d554dca3566bc174584394419be0120d207))
* adds support for async builder ([#1888](https://www.github.com/yargs/yargs/issues/1888)) ([ade29b8](https://www.github.com/yargs/yargs/commit/ade29b864abecaa8c4f8dcc3493f5eb24fb73d84)), closes [#1042](https://www.github.com/yargs/yargs/issues/1042)
* allow calling standard completion function from custom one ([#1855](https://www.github.com/yargs/yargs/issues/1855)) ([31765cb](https://www.github.com/yargs/yargs/commit/31765cbdce812ee5c16aaae70ab523a2c7e0fcec))
* allow default completion to be referenced and modified, in custom completion ([#1878](https://www.github.com/yargs/yargs/issues/1878)) ([01619f6](https://www.github.com/yargs/yargs/commit/01619f6191a3ab16bf6b77456d4e9dfa80533907))
* **async:** add support for async check and coerce ([#1872](https://www.github.com/yargs/yargs/issues/1872)) ([8b95f57](https://www.github.com/yargs/yargs/commit/8b95f57bb2a49b098c6bf23cea88c6f900a34f89))
* improve support for async/await ([#1823](https://www.github.com/yargs/yargs/issues/1823)) ([169b815](https://www.github.com/yargs/yargs/commit/169b815df7ae190965f04030f28adc3ab92bb4b5))
* **locale:** add Ukrainian locale ([#1893](https://www.github.com/yargs/yargs/issues/1893)) ([c872dfc](https://www.github.com/yargs/yargs/commit/c872dfc1d87ebaa7fcc79801f649318a16195495))
* **middleware:** async middleware can now be used before validation. ([e0f9363](https://www.github.com/yargs/yargs/commit/e0f93636e04fa7e02a2c3b1fe465b6a14aa1f06d))
* **middleware:** global middleware now applied when no command is configured. ([e0f9363](https://www.github.com/yargs/yargs/commit/e0f93636e04fa7e02a2c3b1fe465b6a14aa1f06d))
* **node:** drop Node 10 ([#1919](https://www.github.com/yargs/yargs/issues/1919)) ([5edeb9e](https://www.github.com/yargs/yargs/commit/5edeb9ea17b1f0190a3590508f2e7911b5f70659))
### Bug Fixes
* always cache help message when running commands ([#1865](https://www.github.com/yargs/yargs/issues/1865)) ([d57ca77](https://www.github.com/yargs/yargs/commit/d57ca7751d533d7e0f216cd9fbf7c2b0ec98f791)), closes [#1853](https://www.github.com/yargs/yargs/issues/1853)
* **async:** don't call parse callback until async ops complete ([#1896](https://www.github.com/yargs/yargs/issues/1896)) ([a93f5ff](https://www.github.com/yargs/yargs/commit/a93f5ff35d7c09b01e0ca93d7d855d2b26593165)), closes [#1888](https://www.github.com/yargs/yargs/issues/1888)
* **builder:** apply default builder for showHelp/getHelp ([#1913](https://www.github.com/yargs/yargs/issues/1913)) ([395bb67](https://www.github.com/yargs/yargs/commit/395bb67749787d269cabe80ffc3133c2f6958aeb)), closes [#1912](https://www.github.com/yargs/yargs/issues/1912)
* **builder:** nested builder is now awaited ([#1925](https://www.github.com/yargs/yargs/issues/1925)) ([b5accd6](https://www.github.com/yargs/yargs/commit/b5accd64ccbd3ffb800517fb40d0f59382515fbb))
* **coerce:** options using coerce now displayed in help ([#1911](https://www.github.com/yargs/yargs/issues/1911)) ([d2128cc](https://www.github.com/yargs/yargs/commit/d2128cc4ffd411eed7111e6a3c561948330e4f6f)), closes [#1909](https://www.github.com/yargs/yargs/issues/1909)
* completion script name clashing on bash ([#1903](https://www.github.com/yargs/yargs/issues/1903)) ([8f62d9a](https://www.github.com/yargs/yargs/commit/8f62d9a9e8bebf86f988c100ad3c417dc32b2471))
* **deno:** use actual names for keys instead of inferring ([#1891](https://www.github.com/yargs/yargs/issues/1891)) ([b96ef01](https://www.github.com/yargs/yargs/commit/b96ef01b16bc5377b79d7914dd5495068037fe7b))
* exclude positionals from default completion ([#1881](https://www.github.com/yargs/yargs/issues/1881)) ([0175677](https://www.github.com/yargs/yargs/commit/0175677b79ffe50a9c5477631288ae10120b8a32))
* https://github.com/yargs/yargs/issues/1841#issuecomment-804770453 ([b96ef01](https://www.github.com/yargs/yargs/commit/b96ef01b16bc5377b79d7914dd5495068037fe7b))
* showHelp() and .getHelp() now return same output for commands as --help ([#1826](https://www.github.com/yargs/yargs/issues/1826)) ([36abf26](https://www.github.com/yargs/yargs/commit/36abf26919b5a19f3adec08598539851c34b7086))
* zsh completion is now autoloadable ([#1856](https://www.github.com/yargs/yargs/issues/1856)) ([d731f9f](https://www.github.com/yargs/yargs/commit/d731f9f9adbc11f918e918443c5bff4149fc6681))
### Code Refactoring
* **coerce:** coerce is now applied before validation. ([8b95f57](https://www.github.com/yargs/yargs/commit/8b95f57bb2a49b098c6bf23cea88c6f900a34f89))
* deprecated reset() method is now private (call yargs() instead). ([376f892](https://www.github.com/yargs/yargs/commit/376f89242733dcd4ecb8040685c40ae1d622931d))
* implicitly private methods are now actually private ([376f892](https://www.github.com/yargs/yargs/commit/376f89242733dcd4ecb8040685c40ae1d622931d))
* **yargs-factory:** refactor yargs-factory to use class ([#1895](https://www.github.com/yargs/yargs/issues/1895)) ([376f892](https://www.github.com/yargs/yargs/commit/376f89242733dcd4ecb8040685c40ae1d622931d))
## [16.2.0](https://www.github.com/yargs/yargs/compare/v16.1.1...v16.2.0) (2020-12-05)
### Features
* command() now accepts an array of modules ([f415388](https://www.github.com/yargs/yargs/commit/f415388cc454d02786c65c50dd6c7a0cf9d8b842))
### Bug Fixes
* add package.json to module exports ([#1818](https://www.github.com/yargs/yargs/issues/1818)) ([d783a49](https://www.github.com/yargs/yargs/commit/d783a49a7f21c9bbd4eec2990268f3244c4d5662)), closes [#1817](https://www.github.com/yargs/yargs/issues/1817)
### [16.1.1](https://www.github.com/yargs/yargs/compare/v16.1.0...v16.1.1) (2020-11-15)
### Bug Fixes
* expose helpers for legacy versions of Node.js ([#1801](https://www.github.com/yargs/yargs/issues/1801)) ([107deaa](https://www.github.com/yargs/yargs/commit/107deaa4f68b7bc3f2386041e1f4fe0272b29c0a))
* **deno:** get yargs working on deno@1.5.x ([#1799](https://www.github.com/yargs/yargs/issues/1799)) ([cb01c98](https://www.github.com/yargs/yargs/commit/cb01c98c44e30f55c2dc9434caef524ae433d9a4))
## [16.1.0](https://www.github.com/yargs/yargs/compare/v16.0.3...v16.1.0) (2020-10-15)
### Features
* expose hideBin helper for CJS ([#1768](https://www.github.com/yargs/yargs/issues/1768)) ([63e1173](https://www.github.com/yargs/yargs/commit/63e1173bb47dc651c151973a16ef659082a9ae66))
### Bug Fixes
* **deno:** update types for deno ^1.4.0 ([#1772](https://www.github.com/yargs/yargs/issues/1772)) ([0801752](https://www.github.com/yargs/yargs/commit/080175207d281be63edf90adfe4f0568700b0bf5))
* **exports:** node 13.0-13.6 require a string fallback ([#1776](https://www.github.com/yargs/yargs/issues/1776)) ([b45c43a](https://www.github.com/yargs/yargs/commit/b45c43a5f64b565c3794f9792150eaeec4e00b69))
* **modules:** module path was incorrect ([#1759](https://www.github.com/yargs/yargs/issues/1759)) ([95a4a0a](https://www.github.com/yargs/yargs/commit/95a4a0ac573cfe158e6e4bc8c8682ebd1644a198))
* **positional:** positional strings no longer drop decimals ([#1761](https://www.github.com/yargs/yargs/issues/1761)) ([e1a300f](https://www.github.com/yargs/yargs/commit/e1a300f1293ad821c900284616337f080b207980))
* make positionals in -- count towards validation ([#1752](https://www.github.com/yargs/yargs/issues/1752)) ([eb2b29d](https://www.github.com/yargs/yargs/commit/eb2b29d34f1a41e0fd6c4e841960e5bfc329dc3c))
### [16.0.3](https://www.github.com/yargs/yargs/compare/v16.0.2...v16.0.3) (2020-09-10)
### Bug Fixes
* move yargs.cjs to yargs to fix Node 10 imports ([#1747](https://www.github.com/yargs/yargs/issues/1747)) ([5bfb85b](https://www.github.com/yargs/yargs/commit/5bfb85b33b85db8a44b5f7a700a8e4dbaf022df0))
### [16.0.2](https://www.github.com/yargs/yargs/compare/v16.0.1...v16.0.2) (2020-09-09)
### Bug Fixes
* **typescript:** yargs-parser was breaking @types/yargs ([#1745](https://www.github.com/yargs/yargs/issues/1745)) ([2253284](https://www.github.com/yargs/yargs/commit/2253284b233cceabd8db677b81c5bf1755eef230))
### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
### Bug Fixes
* code was not passed to process.exit ([#1742](https://www.github.com/yargs/yargs/issues/1742)) ([d1a9930](https://www.github.com/yargs/yargs/commit/d1a993035a2f76c138460052cf19425f9684b637))
## [16.0.0](https://www.github.com/yargs/yargs/compare/v15.4.2...v16.0.0) (2020-09-09)
### ⚠ BREAKING CHANGES
* tweaks to ESM/Deno API surface: now exports yargs function by default; getProcessArgvWithoutBin becomes hideBin; types now exported for Deno.
* find-up replaced with escalade; export map added (limits importable files in Node >= 12); yarser-parser@19.x.x (new decamelize/camelcase implementation).
* **usage:** single character aliases are now shown first in help output
* rebase helper is no longer provided on yargs instance.
* drop support for EOL Node 8 (#1686)
### Features
* adds strictOptions() ([#1738](https://www.github.com/yargs/yargs/issues/1738)) ([b215fba](https://www.github.com/yargs/yargs/commit/b215fba0ed6e124e5aad6cf22c8d5875661c63a3))
* **helpers:** rebase, Parser, applyExtends now blessed helpers ([#1733](https://www.github.com/yargs/yargs/issues/1733)) ([c7debe8](https://www.github.com/yargs/yargs/commit/c7debe8eb1e5bc6ea20b5ed68026c56e5ebec9e1))
* adds support for ESM and Deno ([#1708](https://www.github.com/yargs/yargs/issues/1708)) ([ac6d5d1](https://www.github.com/yargs/yargs/commit/ac6d5d105a75711fe703f6a39dad5181b383d6c6))
* drop support for EOL Node 8 ([#1686](https://www.github.com/yargs/yargs/issues/1686)) ([863937f](https://www.github.com/yargs/yargs/commit/863937f23c3102f804cdea78ee3097e28c7c289f))
* i18n for ESM and Deno ([#1735](https://www.github.com/yargs/yargs/issues/1735)) ([c71783a](https://www.github.com/yargs/yargs/commit/c71783a5a898a0c0e92ac501c939a3ec411ac0c1))
* tweaks to API surface based on user feedback ([#1726](https://www.github.com/yargs/yargs/issues/1726)) ([4151fee](https://www.github.com/yargs/yargs/commit/4151fee4c33a97d26bc40de7e623e5b0eb87e9bb))
* **usage:** single char aliases first in help ([#1574](https://www.github.com/yargs/yargs/issues/1574)) ([a552990](https://www.github.com/yargs/yargs/commit/a552990c120646c2d85a5c9b628e1ce92a68e797))
### Bug Fixes
* **yargs:** add missing command(module) signature ([#1707](https://www.github.com/yargs/yargs/issues/1707)) ([0f81024](https://www.github.com/yargs/yargs/commit/0f810245494ccf13a35b7786d021b30fc95ecad5)), closes [#1704](https://www.github.com/yargs/yargs/issues/1704)
[Older CHANGELOG Entries](https://github.com/yargs/yargs/blob/master/docs/CHANGELOG-historical.md)

21
node_modules/localtunnel/node_modules/yargs/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.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.

204
node_modules/localtunnel/node_modules/yargs/README.md generated vendored Normal file
View File

@ -0,0 +1,204 @@
<p align="center">
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs/master/yargs-logo.png">
</p>
<h1 align="center"> Yargs </h1>
<p align="center">
<b >Yargs be a node.js library fer hearties tryin' ter parse optstrings</b>
</p>
<br>
![ci](https://github.com/yargs/yargs/workflows/ci/badge.svg)
[![NPM version][npm-image]][npm-url]
[![js-standard-style][standard-image]][standard-url]
[![Coverage][coverage-image]][coverage-url]
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
[![Slack][slack-image]][slack-url]
## Description
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
It gives you:
* commands and (grouped) options (`my-program.js serve --port=5000`).
* a dynamically generated help menu based on your arguments:
```
mocha [spec..]
Run tests with Mocha
Commands
mocha inspect [spec..] Run tests with Mocha [default]
mocha init <path> create a client-side Mocha setup at <path>
Rules & Behavior
--allow-uncaught Allow uncaught errors to propagate [boolean]
--async-only, -A Require all tests to use a callback (async) or
return a Promise [boolean]
```
* bash-completion shortcuts for commands and options.
* and [tons more](/docs/api.md).
## Installation
Stable version:
```bash
npm i yargs
```
Bleeding edge version with the most recent features:
```bash
npm i yargs@next
```
## Usage
### Simple Example
```javascript
#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const argv = yargs(hideBin(process.argv)).argv
if (argv.ships > 3 && argv.distance < 53.5) {
console.log('Plunder more riffiwobbles!')
} else {
console.log('Retreat from the xupptumblers!')
}
```
```bash
$ ./plunder.js --ships=4 --distance=22
Plunder more riffiwobbles!
$ ./plunder.js --ships 12 --distance 98.7
Retreat from the xupptumblers!
```
> Note: `hideBin` is a shorthand for [`process.argv.slice(2)`](https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/). It has the benefit that it takes into account variations in some environments, e.g., [Electron](https://github.com/electron/electron/issues/4690).
### Complex Example
```javascript
#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
yargs(hideBin(process.argv))
.command('serve [port]', 'start the server', (yargs) => {
return yargs
.positional('port', {
describe: 'port to bind on',
default: 5000
})
}, (argv) => {
if (argv.verbose) console.info(`start server on :${argv.port}`)
serve(argv.port)
})
.option('verbose', {
alias: 'v',
type: 'boolean',
description: 'Run with verbose logging'
})
.argv
```
Run the example above with `--help` to see the help for the application.
## Supported Platforms
### TypeScript
yargs has type definitions at [@types/yargs][type-definitions].
```
npm i @types/yargs --save-dev
```
See usage examples in [docs](/docs/typescript.md).
### Deno
As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
```typescript
import yargs from 'https://deno.land/x/yargs/deno.ts'
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
yargs(Deno.args)
.command('download <files...>', 'download a list of files', (yargs: any) => {
return yargs.positional('files', {
describe: 'a list of files to do something with'
})
}, (argv: Arguments) => {
console.info(argv)
})
.strictCommands()
.demandCommand(1)
.argv
```
### ESM
As of `v16`,`yargs` supports ESM imports:
```js
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
yargs(hideBin(process.argv))
.command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => {
console.info(argv)
})
.demandCommand(1)
.argv
```
### Usage in Browser
See examples of using yargs in the browser in [docs](/docs/browser.md).
## Community
Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
## Documentation
### Table of Contents
* [Yargs' API](/docs/api.md)
* [Examples](/docs/examples.md)
* [Parsing Tricks](/docs/tricks.md)
* [Stop the Parser](/docs/tricks.md#stop)
* [Negating Boolean Arguments](/docs/tricks.md#negate)
* [Numbers](/docs/tricks.md#numbers)
* [Arrays](/docs/tricks.md#arrays)
* [Objects](/docs/tricks.md#objects)
* [Quotes](/docs/tricks.md#quotes)
* [Advanced Topics](/docs/advanced.md)
* [Composing Your App Using Commands](/docs/advanced.md#commands)
* [Building Configurable CLI Apps](/docs/advanced.md#configuration)
* [Customizing Yargs' Parser](/docs/advanced.md#customizing)
* [Bundling yargs](/docs/bundling.md)
* [Contributing](/contributing.md)
## Supported Node.js Versions
Libraries in this ecosystem make a best effort to track
[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
[npm-url]: https://www.npmjs.com/package/yargs
[npm-image]: https://img.shields.io/npm/v/yargs.svg
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[standard-url]: http://standardjs.com/
[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
[conventional-commits-url]: https://conventionalcommits.org/
[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
[slack-url]: http://devtoolscommunity.herokuapp.com
[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
[coverage-image]: https://img.shields.io/nycrc/yargs/yargs
[coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc

View File

@ -0,0 +1,7 @@
// Bootstrap yargs for browser:
import browserPlatformShim from './lib/platform-shims/browser.mjs';
import {YargsFactory} from './build/lib/yargs-factory.js';
const Yargs = YargsFactory(browserPlatformShim);
export default Yargs;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,62 @@
import { YError } from './yerror.js';
import { parseCommand } from './parse-command.js';
const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'];
export function argsert(arg1, arg2, arg3) {
function parseArgs() {
return typeof arg1 === 'object'
? [{ demanded: [], optional: [] }, arg1, arg2]
: [
parseCommand(`cmd ${arg1}`),
arg2,
arg3,
];
}
try {
let position = 0;
const [parsed, callerArguments, _length] = parseArgs();
const args = [].slice.call(callerArguments);
while (args.length && args[args.length - 1] === undefined)
args.pop();
const length = _length || args.length;
if (length < parsed.demanded.length) {
throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`);
}
const totalCommands = parsed.demanded.length + parsed.optional.length;
if (length > totalCommands) {
throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`);
}
parsed.demanded.forEach(demanded => {
const arg = args.shift();
const observedType = guessType(arg);
const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*');
if (matchingTypes.length === 0)
argumentTypeError(observedType, demanded.cmd, position);
position += 1;
});
parsed.optional.forEach(optional => {
if (args.length === 0)
return;
const arg = args.shift();
const observedType = guessType(arg);
const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*');
if (matchingTypes.length === 0)
argumentTypeError(observedType, optional.cmd, position);
position += 1;
});
}
catch (err) {
console.warn(err.stack);
}
}
function guessType(arg) {
if (Array.isArray(arg)) {
return 'array';
}
else if (arg === null) {
return 'null';
}
return typeof arg;
}
function argumentTypeError(observedType, allowedTypes, position) {
throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`);
}

View File

@ -0,0 +1,432 @@
import { assertNotStrictEqual, } from './typings/common-types.js';
import { isPromise } from './utils/is-promise.js';
import { applyMiddleware, commandMiddlewareFactory, } from './middleware.js';
import { parseCommand } from './parse-command.js';
import { isYargsInstance, } from './yargs-factory.js';
import { maybeAsyncResult } from './utils/maybe-async-result.js';
import whichModule from './utils/which-module.js';
const DEFAULT_MARKER = /(^\*)|(^\$0)/;
export class CommandInstance {
constructor(usage, validation, globalMiddleware, shim) {
this.requireCache = new Set();
this.handlers = {};
this.aliasMap = {};
this.frozens = [];
this.shim = shim;
this.usage = usage;
this.globalMiddleware = globalMiddleware;
this.validation = validation;
}
addDirectory(dir, req, callerFile, opts) {
opts = opts || {};
if (typeof opts.recurse !== 'boolean')
opts.recurse = false;
if (!Array.isArray(opts.extensions))
opts.extensions = ['js'];
const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o;
opts.visit = (obj, joined, filename) => {
const visited = parentVisit(obj, joined, filename);
if (visited) {
if (this.requireCache.has(joined))
return visited;
else
this.requireCache.add(joined);
this.addHandler(visited);
}
return visited;
};
this.shim.requireDirectory({ require: req, filename: callerFile }, dir, opts);
}
addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
let aliases = [];
const middlewares = commandMiddlewareFactory(commandMiddleware);
handler = handler || (() => { });
if (Array.isArray(cmd)) {
if (isCommandAndAliases(cmd)) {
[cmd, ...aliases] = cmd;
}
else {
for (const command of cmd) {
this.addHandler(command);
}
}
}
else if (isCommandHandlerDefinition(cmd)) {
let command = Array.isArray(cmd.command) || typeof cmd.command === 'string'
? cmd.command
: this.moduleName(cmd);
if (cmd.aliases)
command = [].concat(command).concat(cmd.aliases);
this.addHandler(command, this.extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
return;
}
else if (isCommandBuilderDefinition(builder)) {
this.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
return;
}
if (typeof cmd === 'string') {
const parsedCommand = parseCommand(cmd);
aliases = aliases.map(alias => parseCommand(alias).cmd);
let isDefault = false;
const parsedAliases = [parsedCommand.cmd].concat(aliases).filter(c => {
if (DEFAULT_MARKER.test(c)) {
isDefault = true;
return false;
}
return true;
});
if (parsedAliases.length === 0 && isDefault)
parsedAliases.push('$0');
if (isDefault) {
parsedCommand.cmd = parsedAliases[0];
aliases = parsedAliases.slice(1);
cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd);
}
aliases.forEach(alias => {
this.aliasMap[alias] = parsedCommand.cmd;
});
if (description !== false) {
this.usage.command(cmd, description, isDefault, aliases, deprecated);
}
this.handlers[parsedCommand.cmd] = {
original: cmd,
description,
handler,
builder: builder || {},
middlewares,
deprecated,
demanded: parsedCommand.demanded,
optional: parsedCommand.optional,
};
if (isDefault)
this.defaultCommand = this.handlers[parsedCommand.cmd];
}
}
getCommandHandlers() {
return this.handlers;
}
getCommands() {
return Object.keys(this.handlers).concat(Object.keys(this.aliasMap));
}
hasDefaultCommand() {
return !!this.defaultCommand;
}
runCommand(command, yargs, parsed, commandIndex, helpOnly, helpOrVersionSet) {
const commandHandler = this.handlers[command] ||
this.handlers[this.aliasMap[command]] ||
this.defaultCommand;
const currentContext = yargs.getInternalMethods().getContext();
const parentCommands = currentContext.commands.slice();
const isDefaultCommand = !command;
if (command) {
currentContext.commands.push(command);
currentContext.fullCommands.push(commandHandler.original);
}
const builderResult = this.applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, parsed.aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet);
return isPromise(builderResult)
? builderResult.then(result => this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, result.innerArgv, currentContext, helpOnly, result.aliases, yargs))
: this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, builderResult.innerArgv, currentContext, helpOnly, builderResult.aliases, yargs);
}
applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet) {
const builder = commandHandler.builder;
let innerYargs = yargs;
if (isCommandBuilderCallback(builder)) {
const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet);
if (isPromise(builderOutput)) {
return builderOutput.then(output => {
innerYargs = isYargsInstance(output) ? output : yargs;
return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
});
}
}
else if (isCommandBuilderOptionDefinitions(builder)) {
innerYargs = yargs.getInternalMethods().reset(aliases);
Object.keys(commandHandler.builder).forEach(key => {
innerYargs.option(key, builder[key]);
});
}
return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
}
parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly) {
if (isDefaultCommand)
innerYargs.getInternalMethods().getUsageInstance().unfreeze();
if (this.shouldUpdateUsage(innerYargs)) {
innerYargs
.getInternalMethods()
.getUsageInstance()
.usage(this.usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
}
const innerArgv = innerYargs
.getInternalMethods()
.runYargsParserAndExecuteCommands(null, undefined, true, commandIndex, helpOnly);
return isPromise(innerArgv)
? innerArgv.then(argv => ({
aliases: innerYargs.parsed.aliases,
innerArgv: argv,
}))
: {
aliases: innerYargs.parsed.aliases,
innerArgv: innerArgv,
};
}
shouldUpdateUsage(yargs) {
return (!yargs.getInternalMethods().getUsageInstance().getUsageDisabled() &&
yargs.getInternalMethods().getUsageInstance().getUsage().length === 0);
}
usageFromParentCommandsCommandHandler(parentCommands, commandHandler) {
const c = DEFAULT_MARKER.test(commandHandler.original)
? commandHandler.original.replace(DEFAULT_MARKER, '').trim()
: commandHandler.original;
const pc = parentCommands.filter(c => {
return !DEFAULT_MARKER.test(c);
});
pc.push(c);
return `$0 ${pc.join(' ')}`;
}
applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
let positionalMap = {};
if (helpOnly)
return innerArgv;
if (!yargs.getInternalMethods().getHasOutput()) {
positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
}
const middlewares = this.globalMiddleware
.getMiddleware()
.slice(0)
.concat(commandHandler.middlewares);
innerArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
if (!yargs.getInternalMethods().getHasOutput()) {
const validation = yargs
.getInternalMethods()
.runValidation(aliases, positionalMap, yargs.parsed.error, isDefaultCommand);
innerArgv = maybeAsyncResult(innerArgv, result => {
validation(result);
return result;
});
}
if (commandHandler.handler && !yargs.getInternalMethods().getHasOutput()) {
yargs.getInternalMethods().setHasOutput();
const populateDoubleDash = !!yargs.getOptions().configuration['populate--'];
yargs
.getInternalMethods()
.postProcess(innerArgv, populateDoubleDash, false, false);
innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false);
innerArgv = maybeAsyncResult(innerArgv, result => {
const handlerResult = commandHandler.handler(result);
return isPromise(handlerResult)
? handlerResult.then(() => result)
: result;
});
if (!isDefaultCommand) {
yargs.getInternalMethods().getUsageInstance().cacheHelpMessage();
}
if (isPromise(innerArgv) &&
!yargs.getInternalMethods().hasParseCallback()) {
innerArgv.catch(error => {
try {
yargs.getInternalMethods().getUsageInstance().fail(null, error);
}
catch (_err) {
}
});
}
}
if (!isDefaultCommand) {
currentContext.commands.pop();
currentContext.fullCommands.pop();
}
return innerArgv;
}
populatePositionals(commandHandler, argv, context, yargs) {
argv._ = argv._.slice(context.commands.length);
const demanded = commandHandler.demanded.slice(0);
const optional = commandHandler.optional.slice(0);
const positionalMap = {};
this.validation.positionalCount(demanded.length, argv._.length);
while (demanded.length) {
const demand = demanded.shift();
this.populatePositional(demand, argv, positionalMap);
}
while (optional.length) {
const maybe = optional.shift();
this.populatePositional(maybe, argv, positionalMap);
}
argv._ = context.commands.concat(argv._.map(a => '' + a));
this.postProcessPositionals(argv, positionalMap, this.cmdToParseOptions(commandHandler.original), yargs);
return positionalMap;
}
populatePositional(positional, argv, positionalMap) {
const cmd = positional.cmd[0];
if (positional.variadic) {
positionalMap[cmd] = argv._.splice(0).map(String);
}
else {
if (argv._.length)
positionalMap[cmd] = [String(argv._.shift())];
}
}
cmdToParseOptions(cmdString) {
const parseOptions = {
array: [],
default: {},
alias: {},
demand: {},
};
const parsed = parseCommand(cmdString);
parsed.demanded.forEach(d => {
const [cmd, ...aliases] = d.cmd;
if (d.variadic) {
parseOptions.array.push(cmd);
parseOptions.default[cmd] = [];
}
parseOptions.alias[cmd] = aliases;
parseOptions.demand[cmd] = true;
});
parsed.optional.forEach(o => {
const [cmd, ...aliases] = o.cmd;
if (o.variadic) {
parseOptions.array.push(cmd);
parseOptions.default[cmd] = [];
}
parseOptions.alias[cmd] = aliases;
});
return parseOptions;
}
postProcessPositionals(argv, positionalMap, parseOptions, yargs) {
const options = Object.assign({}, yargs.getOptions());
options.default = Object.assign(parseOptions.default, options.default);
for (const key of Object.keys(parseOptions.alias)) {
options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]);
}
options.array = options.array.concat(parseOptions.array);
options.config = {};
const unparsed = [];
Object.keys(positionalMap).forEach(key => {
positionalMap[key].map(value => {
if (options.configuration['unknown-options-as-args'])
options.key[key] = true;
unparsed.push(`--${key}`);
unparsed.push(value);
});
});
if (!unparsed.length)
return;
const config = Object.assign({}, options.configuration, {
'populate--': false,
});
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
configuration: config,
}));
if (parsed.error) {
yargs
.getInternalMethods()
.getUsageInstance()
.fail(parsed.error.message, parsed.error);
}
else {
const positionalKeys = Object.keys(positionalMap);
Object.keys(positionalMap).forEach(key => {
positionalKeys.push(...parsed.aliases[key]);
});
const defaults = yargs.getOptions().default;
Object.keys(parsed.argv).forEach(key => {
if (positionalKeys.includes(key)) {
if (!positionalMap[key])
positionalMap[key] = parsed.argv[key];
if (!Object.prototype.hasOwnProperty.call(defaults, key) &&
Object.prototype.hasOwnProperty.call(argv, key) &&
Object.prototype.hasOwnProperty.call(parsed.argv, key) &&
(Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) {
argv[key] = [].concat(argv[key], parsed.argv[key]);
}
else {
argv[key] = parsed.argv[key];
}
}
});
}
}
runDefaultBuilderOn(yargs) {
if (!this.defaultCommand)
return;
if (this.shouldUpdateUsage(yargs)) {
const commandString = DEFAULT_MARKER.test(this.defaultCommand.original)
? this.defaultCommand.original
: this.defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ');
yargs
.getInternalMethods()
.getUsageInstance()
.usage(commandString, this.defaultCommand.description);
}
const builder = this.defaultCommand.builder;
if (isCommandBuilderCallback(builder)) {
return builder(yargs, true);
}
else if (!isCommandBuilderDefinition(builder)) {
Object.keys(builder).forEach(key => {
yargs.option(key, builder[key]);
});
}
return undefined;
}
moduleName(obj) {
const mod = whichModule(obj);
if (!mod)
throw new Error(`No command name given for module: ${this.shim.inspect(obj)}`);
return this.commandFromFilename(mod.filename);
}
commandFromFilename(filename) {
return this.shim.path.basename(filename, this.shim.path.extname(filename));
}
extractDesc({ describe, description, desc }) {
for (const test of [describe, description, desc]) {
if (typeof test === 'string' || test === false)
return test;
assertNotStrictEqual(test, true, this.shim);
}
return false;
}
freeze() {
this.frozens.push({
handlers: this.handlers,
aliasMap: this.aliasMap,
defaultCommand: this.defaultCommand,
});
}
unfreeze() {
const frozen = this.frozens.pop();
assertNotStrictEqual(frozen, undefined, this.shim);
({
handlers: this.handlers,
aliasMap: this.aliasMap,
defaultCommand: this.defaultCommand,
} = frozen);
}
reset() {
this.handlers = {};
this.aliasMap = {};
this.defaultCommand = undefined;
this.requireCache = new Set();
return this;
}
}
export function command(usage, validation, globalMiddleware, shim) {
return new CommandInstance(usage, validation, globalMiddleware, shim);
}
export function isCommandBuilderDefinition(builder) {
return (typeof builder === 'object' &&
!!builder.builder &&
typeof builder.handler === 'function');
}
function isCommandAndAliases(cmd) {
return cmd.every(c => typeof c === 'string');
}
export function isCommandBuilderCallback(builder) {
return typeof builder === 'function';
}
function isCommandBuilderOptionDefinitions(builder) {
return typeof builder === 'object';
}
export function isCommandHandlerDefinition(cmd) {
return typeof cmd === 'object' && !Array.isArray(cmd);
}

View File

@ -0,0 +1,48 @@
export const completionShTemplate = `###-begin-{{app_name}}-completions-###
#
# yargs command completion script
#
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
#
_{{app_name}}_yargs_completions()
{
local cur_word args type_list
cur_word="\${COMP_WORDS[COMP_CWORD]}"
args=("\${COMP_WORDS[@]}")
# ask yargs to generate completions.
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
# if no match was found, fall back to filename completion
if [ \${#COMPREPLY[@]} -eq 0 ]; then
COMPREPLY=()
fi
return 0
}
complete -o default -F _{{app_name}}_yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
`;
export const completionZshTemplate = `#compdef {{app_name}}
###-begin-{{app_name}}-completions-###
#
# yargs command completion script
#
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
#
_{{app_name}}_yargs_completions()
{
local reply
local si=$IFS
IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
IFS=$si
_describe 'values' reply
}
compdef _{{app_name}}_yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
`;

View File

@ -0,0 +1,167 @@
import { isCommandBuilderCallback } from './command.js';
import { assertNotStrictEqual } from './typings/common-types.js';
import * as templates from './completion-templates.js';
import { isPromise } from './utils/is-promise.js';
import { parseCommand } from './parse-command.js';
export class Completion {
constructor(yargs, usage, command, shim) {
var _a, _b, _c;
this.yargs = yargs;
this.usage = usage;
this.command = command;
this.shim = shim;
this.completionKey = 'get-yargs-completions';
this.aliases = null;
this.customCompletionFunction = null;
this.zshShell =
(_c = (((_a = this.shim.getEnv('SHELL')) === null || _a === void 0 ? void 0 : _a.includes('zsh')) ||
((_b = this.shim.getEnv('ZSH_NAME')) === null || _b === void 0 ? void 0 : _b.includes('zsh')))) !== null && _c !== void 0 ? _c : false;
}
defaultCompletion(args, argv, current, done) {
const handlers = this.command.getCommandHandlers();
for (let i = 0, ii = args.length; i < ii; ++i) {
if (handlers[args[i]] && handlers[args[i]].builder) {
const builder = handlers[args[i]].builder;
if (isCommandBuilderCallback(builder)) {
const y = this.yargs.getInternalMethods().reset();
builder(y, true);
return y.argv;
}
}
}
const completions = [];
this.commandCompletions(completions, args, current);
this.optionCompletions(completions, args, argv, current);
done(null, completions);
}
commandCompletions(completions, args, current) {
const parentCommands = this.yargs
.getInternalMethods()
.getContext().commands;
if (!current.match(/^-/) &&
parentCommands[parentCommands.length - 1] !== current) {
this.usage.getCommands().forEach(usageCommand => {
const commandName = parseCommand(usageCommand[0]).cmd;
if (args.indexOf(commandName) === -1) {
if (!this.zshShell) {
completions.push(commandName);
}
else {
const desc = usageCommand[1] || '';
completions.push(commandName.replace(/:/g, '\\:') + ':' + desc);
}
}
});
}
}
optionCompletions(completions, args, argv, current) {
if (current.match(/^-/) || (current === '' && completions.length === 0)) {
const options = this.yargs.getOptions();
const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
Object.keys(options.key).forEach(key => {
const negable = !!options.configuration['boolean-negation'] &&
options.boolean.includes(key);
const isPositionalKey = positionalKeys.includes(key);
if (!isPositionalKey &&
!this.argsContainKey(args, argv, key, negable)) {
this.completeOptionKey(key, completions, current);
if (negable && !!options.default[key])
this.completeOptionKey(`no-${key}`, completions, current);
}
});
}
}
argsContainKey(args, argv, key, negable) {
if (args.indexOf(`--${key}`) !== -1)
return true;
if (negable && args.indexOf(`--no-${key}`) !== -1)
return true;
if (this.aliases) {
for (const alias of this.aliases[key]) {
if (argv[alias] !== undefined)
return true;
}
}
return false;
}
completeOptionKey(key, completions, current) {
const descs = this.usage.getDescriptions();
const startsByTwoDashes = (s) => /^--/.test(s);
const isShortOption = (s) => /^[^0-9]$/.test(s);
const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--';
if (!this.zshShell) {
completions.push(dashes + key);
}
else {
const desc = descs[key] || '';
completions.push(dashes +
`${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`);
}
}
customCompletion(args, argv, current, done) {
assertNotStrictEqual(this.customCompletionFunction, null, this.shim);
if (isSyncCompletionFunction(this.customCompletionFunction)) {
const result = this.customCompletionFunction(current, argv);
if (isPromise(result)) {
return result
.then(list => {
this.shim.process.nextTick(() => {
done(null, list);
});
})
.catch(err => {
this.shim.process.nextTick(() => {
done(err, undefined);
});
});
}
return done(null, result);
}
else if (isFallbackCompletionFunction(this.customCompletionFunction)) {
return this.customCompletionFunction(current, argv, (onCompleted = done) => this.defaultCompletion(args, argv, current, onCompleted), completions => {
done(null, completions);
});
}
else {
return this.customCompletionFunction(current, argv, completions => {
done(null, completions);
});
}
}
getCompletion(args, done) {
const current = args.length ? args[args.length - 1] : '';
const argv = this.yargs.parse(args, true);
const completionFunction = this.customCompletionFunction
? (argv) => this.customCompletion(args, argv, current, done)
: (argv) => this.defaultCompletion(args, argv, current, done);
return isPromise(argv)
? argv.then(completionFunction)
: completionFunction(argv);
}
generateCompletionScript($0, cmd) {
let script = this.zshShell
? templates.completionZshTemplate
: templates.completionShTemplate;
const name = this.shim.path.basename($0);
if ($0.match(/\.js$/))
$0 = `./${$0}`;
script = script.replace(/{{app_name}}/g, name);
script = script.replace(/{{completion_command}}/g, cmd);
return script.replace(/{{app_path}}/g, $0);
}
registerFunction(fn) {
this.customCompletionFunction = fn;
}
setParsed(parsed) {
this.aliases = parsed.aliases;
}
}
export function completion(yargs, usage, command, shim) {
return new Completion(yargs, usage, command, shim);
}
function isSyncCompletionFunction(completionFunction) {
return completionFunction.length < 3;
}
function isFallbackCompletionFunction(completionFunction) {
return completionFunction.length > 3;
}

View File

@ -0,0 +1,91 @@
import { argsert } from './argsert.js';
import { isPromise } from './utils/is-promise.js';
export class GlobalMiddleware {
constructor(yargs) {
this.globalMiddleware = [];
this.frozens = [];
this.yargs = yargs;
}
addMiddleware(callback, applyBeforeValidation, global = true, mutates = false) {
argsert('<array|function> [boolean] [boolean] [boolean]', [callback, applyBeforeValidation, global], arguments.length);
if (Array.isArray(callback)) {
for (let i = 0; i < callback.length; i++) {
if (typeof callback[i] !== 'function') {
throw Error('middleware must be a function');
}
const m = callback[i];
m.applyBeforeValidation = applyBeforeValidation;
m.global = global;
}
Array.prototype.push.apply(this.globalMiddleware, callback);
}
else if (typeof callback === 'function') {
const m = callback;
m.applyBeforeValidation = applyBeforeValidation;
m.global = global;
m.mutates = mutates;
this.globalMiddleware.push(callback);
}
return this.yargs;
}
addCoerceMiddleware(callback, option) {
const aliases = this.yargs.getAliases();
this.globalMiddleware = this.globalMiddleware.filter(m => {
const toCheck = [...(aliases[option] || []), option];
if (!m.option)
return true;
else
return !toCheck.includes(m.option);
});
callback.option = option;
return this.addMiddleware(callback, true, true, true);
}
getMiddleware() {
return this.globalMiddleware;
}
freeze() {
this.frozens.push([...this.globalMiddleware]);
}
unfreeze() {
const frozen = this.frozens.pop();
if (frozen !== undefined)
this.globalMiddleware = frozen;
}
reset() {
this.globalMiddleware = this.globalMiddleware.filter(m => m.global);
}
}
export function commandMiddlewareFactory(commandMiddleware) {
if (!commandMiddleware)
return [];
return commandMiddleware.map(middleware => {
middleware.applyBeforeValidation = false;
return middleware;
});
}
export function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
return middlewares.reduce((acc, middleware) => {
if (middleware.applyBeforeValidation !== beforeValidation) {
return acc;
}
if (middleware.mutates) {
if (middleware.applied)
return acc;
middleware.applied = true;
}
if (isPromise(acc)) {
return acc
.then(initialObj => Promise.all([
initialObj,
middleware(initialObj, yargs),
]))
.then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
}
else {
const result = middleware(acc, yargs);
return isPromise(result)
? result.then(middlewareObj => Object.assign(acc, middlewareObj))
: Object.assign(acc, result);
}
}, argv);
}

View File

@ -0,0 +1,32 @@
export function parseCommand(cmd) {
const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ');
const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/);
const bregex = /\.*[\][<>]/g;
const firstCommand = splitCommand.shift();
if (!firstCommand)
throw new Error(`No command found in: ${cmd}`);
const parsedCommand = {
cmd: firstCommand.replace(bregex, ''),
demanded: [],
optional: [],
};
splitCommand.forEach((cmd, i) => {
let variadic = false;
cmd = cmd.replace(/\s/g, '');
if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1)
variadic = true;
if (/^\[/.test(cmd)) {
parsedCommand.optional.push({
cmd: cmd.replace(bregex, '').split('|'),
variadic,
});
}
else {
parsedCommand.demanded.push({
cmd: cmd.replace(bregex, '').split('|'),
variadic,
});
}
});
return parsedCommand;
}

View File

@ -0,0 +1,9 @@
export function assertNotStrictEqual(actual, expected, shim, message) {
shim.assert.notStrictEqual(actual, expected, message);
}
export function assertSingleKey(actual, shim) {
shim.assert.strictEqual(typeof actual, 'string');
}
export function objectKeys(object) {
return Object.keys(object);
}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,567 @@
import { objFilter } from './utils/obj-filter.js';
import { YError } from './yerror.js';
import setBlocking from './utils/set-blocking.js';
function isBoolean(fail) {
return typeof fail === 'boolean';
}
export function usage(yargs, shim) {
const __ = shim.y18n.__;
const self = {};
const fails = [];
self.failFn = function failFn(f) {
fails.push(f);
};
let failMessage = null;
let showHelpOnFail = true;
self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
function parseFunctionArgs() {
return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
}
const [enabled, message] = parseFunctionArgs();
failMessage = message;
showHelpOnFail = enabled;
return self;
};
let failureOutput = false;
self.fail = function fail(msg, err) {
const logger = yargs.getInternalMethods().getLoggerInstance();
if (fails.length) {
for (let i = fails.length - 1; i >= 0; --i) {
const fail = fails[i];
if (isBoolean(fail)) {
if (err)
throw err;
else if (msg)
throw Error(msg);
}
else {
fail(msg, err, self);
}
}
}
else {
if (yargs.getExitProcess())
setBlocking(true);
if (!failureOutput) {
failureOutput = true;
if (showHelpOnFail) {
yargs.showHelp('error');
logger.error();
}
if (msg || err)
logger.error(msg || err);
if (failMessage) {
if (msg || err)
logger.error('');
logger.error(failMessage);
}
}
err = err || new YError(msg);
if (yargs.getExitProcess()) {
return yargs.exit(1);
}
else if (yargs.getInternalMethods().hasParseCallback()) {
return yargs.exit(1, err);
}
else {
throw err;
}
}
};
let usages = [];
let usageDisabled = false;
self.usage = (msg, description) => {
if (msg === null) {
usageDisabled = true;
usages = [];
return self;
}
usageDisabled = false;
usages.push([msg, description || '']);
return self;
};
self.getUsage = () => {
return usages;
};
self.getUsageDisabled = () => {
return usageDisabled;
};
self.getPositionalGroupName = () => {
return __('Positionals:');
};
let examples = [];
self.example = (cmd, description) => {
examples.push([cmd, description || '']);
};
let commands = [];
self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
if (isDefault) {
commands = commands.map(cmdArray => {
cmdArray[2] = false;
return cmdArray;
});
}
commands.push([cmd, description || '', isDefault, aliases, deprecated]);
};
self.getCommands = () => commands;
let descriptions = {};
self.describe = function describe(keyOrKeys, desc) {
if (Array.isArray(keyOrKeys)) {
keyOrKeys.forEach(k => {
self.describe(k, desc);
});
}
else if (typeof keyOrKeys === 'object') {
Object.keys(keyOrKeys).forEach(k => {
self.describe(k, keyOrKeys[k]);
});
}
else {
descriptions[keyOrKeys] = desc;
}
};
self.getDescriptions = () => descriptions;
let epilogs = [];
self.epilog = msg => {
epilogs.push(msg);
};
let wrapSet = false;
let wrap;
self.wrap = cols => {
wrapSet = true;
wrap = cols;
};
function getWrap() {
if (!wrapSet) {
wrap = windowWidth();
wrapSet = true;
}
return wrap;
}
const deferY18nLookupPrefix = '__yargsString__:';
self.deferY18nLookup = str => deferY18nLookupPrefix + str;
self.help = function help() {
if (cachedHelpMessage)
return cachedHelpMessage;
normalizeAliases();
const base$0 = yargs.customScriptName
? yargs.$0
: shim.path.basename(yargs.$0);
const demandedOptions = yargs.getDemandedOptions();
const demandedCommands = yargs.getDemandedCommands();
const deprecatedOptions = yargs.getDeprecatedOptions();
const groups = yargs.getGroups();
const options = yargs.getOptions();
let keys = [];
keys = keys.concat(Object.keys(descriptions));
keys = keys.concat(Object.keys(demandedOptions));
keys = keys.concat(Object.keys(demandedCommands));
keys = keys.concat(Object.keys(options.default));
keys = keys.filter(filterHiddenOptions);
keys = Object.keys(keys.reduce((acc, key) => {
if (key !== '_')
acc[key] = true;
return acc;
}, {}));
const theWrap = getWrap();
const ui = shim.cliui({
width: theWrap,
wrap: !!theWrap,
});
if (!usageDisabled) {
if (usages.length) {
usages.forEach(usage => {
ui.div({ text: `${usage[0].replace(/\$0/g, base$0)}` });
if (usage[1]) {
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
}
});
ui.div();
}
else if (commands.length) {
let u = null;
if (demandedCommands._) {
u = `${base$0} <${__('command')}>\n`;
}
else {
u = `${base$0} [${__('command')}]\n`;
}
ui.div(`${u}`);
}
}
if (commands.length > 1 || (commands.length === 1 && !commands[0][2])) {
ui.div(__('Commands:'));
const context = yargs.getInternalMethods().getContext();
const parentCommands = context.commands.length
? `${context.commands.join(' ')} `
: '';
if (yargs.getInternalMethods().getParserConfiguration()['sort-commands'] ===
true) {
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
}
commands.forEach(command => {
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`;
ui.span({
text: commandString,
padding: [0, 2, 0, 2],
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4,
}, { text: command[1] });
const hints = [];
if (command[2])
hints.push(`[${__('default')}]`);
if (command[3] && command[3].length) {
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
}
if (command[4]) {
if (typeof command[4] === 'string') {
hints.push(`[${__('deprecated: %s', command[4])}]`);
}
else {
hints.push(`[${__('deprecated')}]`);
}
}
if (hints.length) {
ui.div({
text: hints.join(' '),
padding: [0, 0, 0, 2],
align: 'right',
});
}
else {
ui.div();
}
});
ui.div();
}
const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []);
keys = keys.filter(key => !yargs.parsed.newAliases[key] &&
aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
const defaultGroup = __('Options:');
if (!groups[defaultGroup])
groups[defaultGroup] = [];
addUngroupedKeys(keys, options.alias, groups, defaultGroup);
const isLongSwitch = (sw) => /^--/.test(getText(sw));
const displayedGroups = Object.keys(groups)
.filter(groupName => groups[groupName].length > 0)
.map(groupName => {
const normalizedKeys = groups[groupName]
.filter(filterHiddenOptions)
.map(key => {
if (aliasKeys.includes(key))
return key;
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
if ((options.alias[aliasKey] || []).includes(key))
return aliasKey;
}
return key;
});
return { groupName, normalizedKeys };
})
.filter(({ normalizedKeys }) => normalizedKeys.length > 0)
.map(({ groupName, normalizedKeys }) => {
const switches = normalizedKeys.reduce((acc, key) => {
acc[key] = [key]
.concat(options.alias[key] || [])
.map(sw => {
if (groupName === self.getPositionalGroupName())
return sw;
else {
return ((/^[0-9]$/.test(sw)
? options.boolean.includes(key)
? '-'
: '--'
: sw.length > 1
? '--'
: '-') + sw);
}
})
.sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2)
? 0
: isLongSwitch(sw1)
? 1
: -1)
.join(', ');
return acc;
}, {});
return { groupName, normalizedKeys, switches };
});
const shortSwitchesUsed = displayedGroups
.filter(({ groupName }) => groupName !== self.getPositionalGroupName())
.some(({ normalizedKeys, switches }) => !normalizedKeys.every(key => isLongSwitch(switches[key])));
if (shortSwitchesUsed) {
displayedGroups
.filter(({ groupName }) => groupName !== self.getPositionalGroupName())
.forEach(({ normalizedKeys, switches }) => {
normalizedKeys.forEach(key => {
if (isLongSwitch(switches[key])) {
switches[key] = addIndentation(switches[key], '-x, '.length);
}
});
});
}
displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => {
ui.div(groupName);
normalizedKeys.forEach(key => {
const kswitch = switches[key];
let desc = descriptions[key] || '';
let type = null;
if (desc.includes(deferY18nLookupPrefix))
desc = __(desc.substring(deferY18nLookupPrefix.length));
if (options.boolean.includes(key))
type = `[${__('boolean')}]`;
if (options.count.includes(key))
type = `[${__('count')}]`;
if (options.string.includes(key))
type = `[${__('string')}]`;
if (options.normalize.includes(key))
type = `[${__('string')}]`;
if (options.array.includes(key))
type = `[${__('array')}]`;
if (options.number.includes(key))
type = `[${__('number')}]`;
const deprecatedExtra = (deprecated) => typeof deprecated === 'string'
? `[${__('deprecated: %s', deprecated)}]`
: `[${__('deprecated')}]`;
const extra = [
key in deprecatedOptions
? deprecatedExtra(deprecatedOptions[key])
: null,
type,
key in demandedOptions ? `[${__('required')}]` : null,
options.choices && options.choices[key]
? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]`
: null,
defaultString(options.default[key], options.defaultDescription[key]),
]
.filter(Boolean)
.join(' ');
ui.span({
text: getText(kswitch),
padding: [0, 2, 0, 2 + getIndentation(kswitch)],
width: maxWidth(switches, theWrap) + 4,
}, desc);
if (extra)
ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
else
ui.div();
});
ui.div();
});
if (examples.length) {
ui.div(__('Examples:'));
examples.forEach(example => {
example[0] = example[0].replace(/\$0/g, base$0);
});
examples.forEach(example => {
if (example[1] === '') {
ui.div({
text: example[0],
padding: [0, 2, 0, 2],
});
}
else {
ui.div({
text: example[0],
padding: [0, 2, 0, 2],
width: maxWidth(examples, theWrap) + 4,
}, {
text: example[1],
});
}
});
ui.div();
}
if (epilogs.length > 0) {
const e = epilogs
.map(epilog => epilog.replace(/\$0/g, base$0))
.join('\n');
ui.div(`${e}\n`);
}
return ui.toString().replace(/\s*$/, '');
};
function maxWidth(table, theWrap, modifier) {
let width = 0;
if (!Array.isArray(table)) {
table = Object.values(table).map(v => [v]);
}
table.forEach(v => {
width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width);
});
if (theWrap)
width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10));
return width;
}
function normalizeAliases() {
const demandedOptions = yargs.getDemandedOptions();
const options = yargs.getOptions();
(Object.keys(options.alias) || []).forEach(key => {
options.alias[key].forEach(alias => {
if (descriptions[alias])
self.describe(key, descriptions[alias]);
if (alias in demandedOptions)
yargs.demandOption(key, demandedOptions[alias]);
if (options.boolean.includes(alias))
yargs.boolean(key);
if (options.count.includes(alias))
yargs.count(key);
if (options.string.includes(alias))
yargs.string(key);
if (options.normalize.includes(alias))
yargs.normalize(key);
if (options.array.includes(alias))
yargs.array(key);
if (options.number.includes(alias))
yargs.number(key);
});
});
}
let cachedHelpMessage;
self.cacheHelpMessage = function () {
cachedHelpMessage = this.help();
};
self.clearCachedHelpMessage = function () {
cachedHelpMessage = undefined;
};
self.hasCachedHelpMessage = function () {
return !!cachedHelpMessage;
};
function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
let groupedKeys = [];
let toCheck = null;
Object.keys(groups).forEach(group => {
groupedKeys = groupedKeys.concat(groups[group]);
});
keys.forEach(key => {
toCheck = [key].concat(aliases[key]);
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
groups[defaultGroup].push(key);
}
});
return groupedKeys;
}
function filterHiddenOptions(key) {
return (yargs.getOptions().hiddenOptions.indexOf(key) < 0 ||
yargs.parsed.argv[yargs.getOptions().showHiddenOpt]);
}
self.showHelp = (level) => {
const logger = yargs.getInternalMethods().getLoggerInstance();
if (!level)
level = 'error';
const emit = typeof level === 'function' ? level : logger[level];
emit(self.help());
};
self.functionDescription = fn => {
const description = fn.name
? shim.Parser.decamelize(fn.name, '-')
: __('generated-value');
return ['(', description, ')'].join('');
};
self.stringifiedValues = function stringifiedValues(values, separator) {
let string = '';
const sep = separator || ', ';
const array = [].concat(values);
if (!values || !array.length)
return string;
array.forEach(value => {
if (string.length)
string += sep;
string += JSON.stringify(value);
});
return string;
};
function defaultString(value, defaultDescription) {
let string = `[${__('default:')} `;
if (value === undefined && !defaultDescription)
return null;
if (defaultDescription) {
string += defaultDescription;
}
else {
switch (typeof value) {
case 'string':
string += `"${value}"`;
break;
case 'object':
string += JSON.stringify(value);
break;
default:
string += value;
}
}
return `${string}]`;
}
function windowWidth() {
const maxWidth = 80;
if (shim.process.stdColumns) {
return Math.min(maxWidth, shim.process.stdColumns);
}
else {
return maxWidth;
}
}
let version = null;
self.version = ver => {
version = ver;
};
self.showVersion = level => {
const logger = yargs.getInternalMethods().getLoggerInstance();
if (!level)
level = 'error';
const emit = typeof level === 'function' ? level : logger[level];
emit(version);
};
self.reset = function reset(localLookup) {
failMessage = null;
failureOutput = false;
usages = [];
usageDisabled = false;
epilogs = [];
examples = [];
commands = [];
descriptions = objFilter(descriptions, k => !localLookup[k]);
return self;
};
const frozens = [];
self.freeze = function freeze() {
frozens.push({
failMessage,
failureOutput,
usages,
usageDisabled,
epilogs,
examples,
commands,
descriptions,
});
};
self.unfreeze = function unfreeze() {
const frozen = frozens.pop();
if (!frozen)
return;
({
failMessage,
failureOutput,
usages,
usageDisabled,
epilogs,
examples,
commands,
descriptions,
} = frozen);
};
return self;
}
function isIndentedText(text) {
return typeof text === 'object';
}
function addIndentation(text, indent) {
return isIndentedText(text)
? { text: text.text, indentation: text.indentation + indent }
: { text, indentation: indent };
}
function getIndentation(text) {
return isIndentedText(text) ? text.indentation : 0;
}
function getText(text) {
return isIndentedText(text) ? text.text : text;
}

View File

@ -0,0 +1,59 @@
import { YError } from '../yerror.js';
let previouslyVisitedConfigs = [];
let shim;
export function applyExtends(config, cwd, mergeExtends, _shim) {
shim = _shim;
let defaultConfig = {};
if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
if (typeof config.extends !== 'string')
return defaultConfig;
const isPath = /\.json|\..*rc$/.test(config.extends);
let pathToDefault = null;
if (!isPath) {
try {
pathToDefault = require.resolve(config.extends);
}
catch (_err) {
return config;
}
}
else {
pathToDefault = getPathToDefaultConfig(cwd, config.extends);
}
checkForCircularExtends(pathToDefault);
previouslyVisitedConfigs.push(pathToDefault);
defaultConfig = isPath
? JSON.parse(shim.readFileSync(pathToDefault, 'utf8'))
: require(config.extends);
delete config.extends;
defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
}
previouslyVisitedConfigs = [];
return mergeExtends
? mergeDeep(defaultConfig, config)
: Object.assign({}, defaultConfig, config);
}
function checkForCircularExtends(cfgPath) {
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
throw new YError(`Circular extended configurations: '${cfgPath}'.`);
}
}
function getPathToDefaultConfig(cwd, pathToExtend) {
return shim.path.resolve(cwd, pathToExtend);
}
function mergeDeep(config1, config2) {
const target = {};
function isObject(obj) {
return obj && typeof obj === 'object' && !Array.isArray(obj);
}
Object.assign(target, config1);
for (const key of Object.keys(config2)) {
if (isObject(config2[key]) && isObject(target[key])) {
target[key] = mergeDeep(config1[key], config2[key]);
}
else {
target[key] = config2[key];
}
}
return target;
}

View File

@ -0,0 +1,5 @@
export function isPromise(maybePromise) {
return (!!maybePromise &&
!!maybePromise.then &&
typeof maybePromise.then === 'function');
}

View File

@ -0,0 +1,34 @@
export function levenshtein(a, b) {
if (a.length === 0)
return b.length;
if (b.length === 0)
return a.length;
const matrix = [];
let i;
for (i = 0; i <= b.length; i++) {
matrix[i] = [i];
}
let j;
for (j = 0; j <= a.length; j++) {
matrix[0][j] = j;
}
for (i = 1; i <= b.length; i++) {
for (j = 1; j <= a.length; j++) {
if (b.charAt(i - 1) === a.charAt(j - 1)) {
matrix[i][j] = matrix[i - 1][j - 1];
}
else {
if (i > 1 &&
j > 1 &&
b.charAt(i - 2) === a.charAt(j - 1) &&
b.charAt(i - 1) === a.charAt(j - 2)) {
matrix[i][j] = matrix[i - 2][j - 2] + 1;
}
else {
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1));
}
}
}
}
return matrix[b.length][a.length];
}

View File

@ -0,0 +1,17 @@
import { isPromise } from './is-promise.js';
export function maybeAsyncResult(getResult, resultHandler, errorHandler = (err) => {
throw err;
}) {
try {
const result = isFunction(getResult) ? getResult() : getResult;
return isPromise(result)
? result.then((result) => resultHandler(result))
: resultHandler(result);
}
catch (err) {
return errorHandler(err);
}
}
function isFunction(arg) {
return typeof arg === 'function';
}

View File

@ -0,0 +1,10 @@
import { objectKeys } from '../typings/common-types.js';
export function objFilter(original = {}, filter = () => true) {
const obj = {};
objectKeys(original).forEach(key => {
if (filter(key, original[key])) {
obj[key] = original[key];
}
});
return obj;
}

View File

@ -0,0 +1,17 @@
function getProcessArgvBinIndex() {
if (isBundledElectronApp())
return 0;
return 1;
}
function isBundledElectronApp() {
return isElectronApp() && !process.defaultApp;
}
function isElectronApp() {
return !!process.versions.electron;
}
export function hideBin(argv) {
return argv.slice(getProcessArgvBinIndex() + 1);
}
export function getProcessArgvBin() {
return process.argv[getProcessArgvBinIndex()];
}

View File

@ -0,0 +1,12 @@
export default function setBlocking(blocking) {
if (typeof process === 'undefined')
return;
[process.stdout, process.stderr].forEach(_stream => {
const stream = _stream;
if (stream._handle &&
stream.isTTY &&
typeof stream._handle.setBlocking === 'function') {
stream._handle.setBlocking(blocking);
}
});
}

View File

@ -0,0 +1,10 @@
export default function whichModule(exported) {
if (typeof require === 'undefined')
return null;
for (let i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) {
mod = require.cache[files[i]];
if (mod.exports === exported)
return mod;
}
return null;
}

View File

@ -0,0 +1,294 @@
import { argsert } from './argsert.js';
import { assertNotStrictEqual, } from './typings/common-types.js';
import { levenshtein as distance } from './utils/levenshtein.js';
import { objFilter } from './utils/obj-filter.js';
const specialKeys = ['$0', '--', '_'];
export function validation(yargs, usage, shim) {
const __ = shim.y18n.__;
const __n = shim.y18n.__n;
const self = {};
self.nonOptionCount = function nonOptionCount(argv) {
const demandedCommands = yargs.getDemandedCommands();
const positionalCount = argv._.length + (argv['--'] ? argv['--'].length : 0);
const _s = positionalCount - yargs.getInternalMethods().getContext().commands.length;
if (demandedCommands._ &&
(_s < demandedCommands._.min || _s > demandedCommands._.max)) {
if (_s < demandedCommands._.min) {
if (demandedCommands._.minMsg !== undefined) {
usage.fail(demandedCommands._.minMsg
? demandedCommands._.minMsg
.replace(/\$0/g, _s.toString())
.replace(/\$1/, demandedCommands._.min.toString())
: null);
}
else {
usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s.toString(), demandedCommands._.min.toString()));
}
}
else if (_s > demandedCommands._.max) {
if (demandedCommands._.maxMsg !== undefined) {
usage.fail(demandedCommands._.maxMsg
? demandedCommands._.maxMsg
.replace(/\$0/g, _s.toString())
.replace(/\$1/, demandedCommands._.max.toString())
: null);
}
else {
usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s.toString(), demandedCommands._.max.toString()));
}
}
}
};
self.positionalCount = function positionalCount(required, observed) {
if (observed < required) {
usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed + '', required + ''));
}
};
self.requiredArguments = function requiredArguments(argv, demandedOptions) {
let missing = null;
for (const key of Object.keys(demandedOptions)) {
if (!Object.prototype.hasOwnProperty.call(argv, key) ||
typeof argv[key] === 'undefined') {
missing = missing || {};
missing[key] = demandedOptions[key];
}
}
if (missing) {
const customMsgs = [];
for (const key of Object.keys(missing)) {
const msg = missing[key];
if (msg && customMsgs.indexOf(msg) < 0) {
customMsgs.push(msg);
}
}
const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : '';
usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg));
}
};
self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) {
var _a;
const commandKeys = yargs
.getInternalMethods()
.getCommandInstance()
.getCommands();
const unknown = [];
const currentContext = yargs.getInternalMethods().getContext();
Object.keys(argv).forEach(key => {
if (!specialKeys.includes(key) &&
!Object.prototype.hasOwnProperty.call(positionalMap, key) &&
!Object.prototype.hasOwnProperty.call(yargs.getInternalMethods().getParseContext(), key) &&
!self.isValidAndSomeAliasIsNotNew(key, aliases)) {
unknown.push(key);
}
});
if (checkPositionals &&
(currentContext.commands.length > 0 ||
commandKeys.length > 0 ||
isDefaultCommand)) {
argv._.slice(currentContext.commands.length).forEach(key => {
if (!commandKeys.includes('' + key)) {
unknown.push('' + key);
}
});
}
if (checkPositionals) {
const demandedCommands = yargs.getDemandedCommands();
const maxNonOptDemanded = ((_a = demandedCommands._) === null || _a === void 0 ? void 0 : _a.max) || 0;
const expected = currentContext.commands.length + maxNonOptDemanded;
if (expected < argv._.length) {
argv._.slice(expected).forEach(key => {
key = String(key);
if (!currentContext.commands.includes(key) &&
!unknown.includes(key)) {
unknown.push(key);
}
});
}
}
if (unknown.length) {
usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.join(', ')));
}
};
self.unknownCommands = function unknownCommands(argv) {
const commandKeys = yargs
.getInternalMethods()
.getCommandInstance()
.getCommands();
const unknown = [];
const currentContext = yargs.getInternalMethods().getContext();
if (currentContext.commands.length > 0 || commandKeys.length > 0) {
argv._.slice(currentContext.commands.length).forEach(key => {
if (!commandKeys.includes('' + key)) {
unknown.push('' + key);
}
});
}
if (unknown.length > 0) {
usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', ')));
return true;
}
else {
return false;
}
};
self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) {
if (!Object.prototype.hasOwnProperty.call(aliases, key)) {
return false;
}
const newAliases = yargs.parsed.newAliases;
return [key, ...aliases[key]].some(a => !Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]);
};
self.limitedChoices = function limitedChoices(argv) {
const options = yargs.getOptions();
const invalid = {};
if (!Object.keys(options.choices).length)
return;
Object.keys(argv).forEach(key => {
if (specialKeys.indexOf(key) === -1 &&
Object.prototype.hasOwnProperty.call(options.choices, key)) {
[].concat(argv[key]).forEach(value => {
if (options.choices[key].indexOf(value) === -1 &&
value !== undefined) {
invalid[key] = (invalid[key] || []).concat(value);
}
});
}
});
const invalidKeys = Object.keys(invalid);
if (!invalidKeys.length)
return;
let msg = __('Invalid values:');
invalidKeys.forEach(key => {
msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`;
});
usage.fail(msg);
};
let implied = {};
self.implies = function implies(key, value) {
argsert('<string|object> [array|number|string]', [key, value], arguments.length);
if (typeof key === 'object') {
Object.keys(key).forEach(k => {
self.implies(k, key[k]);
});
}
else {
yargs.global(key);
if (!implied[key]) {
implied[key] = [];
}
if (Array.isArray(value)) {
value.forEach(i => self.implies(key, i));
}
else {
assertNotStrictEqual(value, undefined, shim);
implied[key].push(value);
}
}
};
self.getImplied = function getImplied() {
return implied;
};
function keyExists(argv, val) {
const num = Number(val);
val = isNaN(num) ? val : num;
if (typeof val === 'number') {
val = argv._.length >= val;
}
else if (val.match(/^--no-.+/)) {
val = val.match(/^--no-(.+)/)[1];
val = !Object.prototype.hasOwnProperty.call(argv, val);
}
else {
val = Object.prototype.hasOwnProperty.call(argv, val);
}
return val;
}
self.implications = function implications(argv) {
const implyFail = [];
Object.keys(implied).forEach(key => {
const origKey = key;
(implied[key] || []).forEach(value => {
let key = origKey;
const origValue = value;
key = keyExists(argv, key);
value = keyExists(argv, value);
if (key && !value) {
implyFail.push(` ${origKey} -> ${origValue}`);
}
});
});
if (implyFail.length) {
let msg = `${__('Implications failed:')}\n`;
implyFail.forEach(value => {
msg += value;
});
usage.fail(msg);
}
};
let conflicting = {};
self.conflicts = function conflicts(key, value) {
argsert('<string|object> [array|string]', [key, value], arguments.length);
if (typeof key === 'object') {
Object.keys(key).forEach(k => {
self.conflicts(k, key[k]);
});
}
else {
yargs.global(key);
if (!conflicting[key]) {
conflicting[key] = [];
}
if (Array.isArray(value)) {
value.forEach(i => self.conflicts(key, i));
}
else {
conflicting[key].push(value);
}
}
};
self.getConflicting = () => conflicting;
self.conflicting = function conflictingFn(argv) {
Object.keys(argv).forEach(key => {
if (conflicting[key]) {
conflicting[key].forEach(value => {
if (value && argv[key] !== undefined && argv[value] !== undefined) {
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
}
});
}
});
};
self.recommendCommands = function recommendCommands(cmd, potentialCommands) {
const threshold = 3;
potentialCommands = potentialCommands.sort((a, b) => b.length - a.length);
let recommended = null;
let bestDistance = Infinity;
for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
const d = distance(cmd, candidate);
if (d <= threshold && d < bestDistance) {
bestDistance = d;
recommended = candidate;
}
}
if (recommended)
usage.fail(__('Did you mean %s?', recommended));
};
self.reset = function reset(localLookup) {
implied = objFilter(implied, k => !localLookup[k]);
conflicting = objFilter(conflicting, k => !localLookup[k]);
return self;
};
const frozens = [];
self.freeze = function freeze() {
frozens.push({
implied,
conflicting,
});
};
self.unfreeze = function unfreeze() {
const frozen = frozens.pop();
assertNotStrictEqual(frozen, undefined, shim);
({ implied, conflicting } = frozen);
};
return self;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
export class YError extends Error {
constructor(msg) {
super(msg || 'yargs error');
this.name = 'YError';
Error.captureStackTrace(this, YError);
}
}

View File

@ -0,0 +1,10 @@
import {applyExtends as _applyExtends} from '../build/lib/utils/apply-extends.js';
import {hideBin} from '../build/lib/utils/process-argv.js';
import Parser from 'yargs-parser';
import shim from '../lib/platform-shims/esm.mjs';
const applyExtends = (config, cwd, mergeExtends) => {
return _applyExtends(config, cwd, mergeExtends, shim);
};
export {applyExtends, hideBin, Parser};

View File

@ -0,0 +1,14 @@
const {
applyExtends,
cjsPlatformShim,
Parser,
processArgv,
} = require('../build/index.cjs');
module.exports = {
applyExtends: (config, cwd, mergeExtends) => {
return applyExtends(config, cwd, mergeExtends, cjsPlatformShim);
},
hideBin: processArgv.hideBin,
Parser,
};

View File

@ -0,0 +1,3 @@
{
"type": "commonjs"
}

43
node_modules/localtunnel/node_modules/yargs/index.cjs generated vendored Normal file
View File

@ -0,0 +1,43 @@
'use strict';
// classic singleton yargs API, to use yargs
// without running as a singleton do:
// require('yargs/yargs')(process.argv.slice(2))
const {Yargs, processArgv} = require('./build/index.cjs');
Argv(processArgv.hideBin(process.argv));
module.exports = Argv;
function Argv(processArgs, cwd) {
const argv = Yargs(processArgs, cwd, require);
singletonify(argv);
// TODO(bcoe): warn if argv.parse() or argv.argv is used directly.
return argv;
}
/* Hack an instance of Argv with process.argv into Argv
so people can do
require('yargs')(['--beeble=1','-z','zizzle']).argv
to parse a list of args and
require('yargs').argv
to get a parsed version of process.argv.
*/
function singletonify(inst) {
[
...Object.keys(inst),
...Object.getOwnPropertyNames(inst.constructor.prototype),
].forEach(key => {
if (key === 'argv') {
Argv.__defineGetter__(key, inst.__lookupGetter__(key));
} else if (typeof inst[key] === 'function') {
Argv[key] = inst[key].bind(inst);
} else {
Argv.__defineGetter__('$0', () => {
return inst.$0;
});
Argv.__defineGetter__('parsed', () => {
return inst.parsed;
});
}
});
}

View File

@ -0,0 +1,8 @@
'use strict';
// Bootstraps yargs for ESM:
import esmPlatformShim from './lib/platform-shims/esm.mjs';
import {YargsFactory} from './build/lib/yargs-factory.js';
const Yargs = YargsFactory(esmPlatformShim);
export default Yargs;

View File

@ -0,0 +1,94 @@
/* eslint-disable no-unused-vars */
'use strict';
import cliui from 'https://unpkg.com/cliui@7.0.1/index.mjs'; // eslint-disable-line
import Parser from 'https://unpkg.com/yargs-parser@19.0.0/browser.js'; // eslint-disable-line
import {getProcessArgvBin} from '../../build/lib/utils/process-argv.js';
import {YError} from '../../build/lib/yerror.js';
const REQUIRE_ERROR = 'require is not supported in browser';
const REQUIRE_DIRECTORY_ERROR =
'loading a directory of commands is not supported in browser';
export default {
assert: {
notStrictEqual: (a, b) => {
// noop.
},
strictEqual: (a, b) => {
// noop.
},
},
cliui,
findUp: () => undefined,
getEnv: key => {
// There is no environment in browser:
return undefined;
},
inspect: console.log,
getCallerFile: () => {
throw new YError(REQUIRE_DIRECTORY_ERROR);
},
getProcessArgvBin,
mainFilename: 'yargs',
Parser,
path: {
basename: str => str,
dirname: str => str,
extname: str => str,
relative: str => str,
},
process: {
argv: () => [],
cwd: () => '',
execPath: () => '',
// exit is noop browser:
exit: () => {},
nextTick: cb => {
// eslint-disable-next-line no-undef
window.setTimeout(cb, 1);
},
stdColumns: 80,
},
readFileSync: () => {
return '';
},
require: () => {
throw new YError(REQUIRE_ERROR);
},
requireDirectory: () => {
throw new YError(REQUIRE_DIRECTORY_ERROR);
},
stringWidth: str => {
return [...str].length;
},
// TODO: replace this with y18n once it's ported to ESM:
y18n: {
__: (...str) => {
if (str.length === 0) return '';
const args = str.slice(1);
return sprintf(str[0], ...args);
},
__n: (str1, str2, count, ...args) => {
if (count === 1) {
return sprintf(str1, ...args);
} else {
return sprintf(str2, ...args);
}
},
getLocale: () => {
return 'en_US';
},
setLocale: () => {},
updateLocale: () => {},
},
};
function sprintf(_str, ...args) {
let str = '';
const split = _str.split('%s');
split.forEach((token, i) => {
str += `${token}${split[i + 1] !== undefined && args[i] ? args[i] : ''}`;
});
return str;
}

View File

@ -0,0 +1,67 @@
'use strict'
import { notStrictEqual, strictEqual } from 'assert'
import cliui from 'cliui'
import escalade from 'escalade/sync'
import { format, inspect } from 'util'
import { readFileSync } from 'fs'
import { fileURLToPath } from 'url';
import Parser from 'yargs-parser'
import { basename, dirname, extname, relative, resolve } from 'path'
import { getProcessArgvBin } from '../../build/lib/utils/process-argv.js'
import { YError } from '../../build/lib/yerror.js'
import y18n from 'y18n'
const REQUIRE_ERROR = 'require is not supported by ESM'
const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM'
const mainFilename = fileURLToPath(import.meta.url).split('node_modules')[0]
const __dirname = fileURLToPath(import.meta.url)
export default {
assert: {
notStrictEqual,
strictEqual
},
cliui,
findUp: escalade,
getEnv: (key) => {
return process.env[key]
},
inspect,
getCallerFile: () => {
throw new YError(REQUIRE_DIRECTORY_ERROR)
},
getProcessArgvBin,
mainFilename: mainFilename || process.cwd(),
Parser,
path: {
basename,
dirname,
extname,
relative,
resolve
},
process: {
argv: () => process.argv,
cwd: process.cwd,
execPath: () => process.execPath,
exit: process.exit,
nextTick: process.nextTick,
stdColumns: typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null
},
readFileSync,
require: () => {
throw new YError(REQUIRE_ERROR)
},
requireDirectory: () => {
throw new YError(REQUIRE_DIRECTORY_ERROR)
},
stringWidth: (str) => {
return [...str].length
},
y18n: y18n({
directory: resolve(__dirname, '../../../locales'),
updateFiles: false
})
}

View File

@ -0,0 +1,46 @@
{
"Commands:": "Каманды:",
"Options:": "Опцыі:",
"Examples:": "Прыклады:",
"boolean": "булевы тып",
"count": "падлік",
"string": "радковы тып",
"number": "лік",
"array": "масіў",
"required": "неабходна",
"default": "па змаўчанні",
"default:": "па змаўчанні:",
"choices:": "магчымасці:",
"aliases:": "аліасы:",
"generated-value": "згенераванае значэнне",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s",
"other": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s",
"other": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s"
},
"Missing argument value: %s": {
"one": "Не хапае значэння аргументу: %s",
"other": "Не хапае значэнняў аргументаў: %s"
},
"Missing required argument: %s": {
"one": "Не хапае неабходнага аргументу: %s",
"other": "Не хапае неабходных аргументаў: %s"
},
"Unknown argument: %s": {
"one": "Невядомы аргумент: %s",
"other": "Невядомыя аргументы: %s"
},
"Invalid values:": "Несапраўдныя значэння:",
"Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Дадзенае значэнне: %s, Магчымасці: %s",
"Argument check failed: %s": "Праверка аргументаў не ўдалася: %s",
"Implications failed:": "Дадзены аргумент патрабуе наступны дадатковы аргумент:",
"Not enough arguments following: %s": "Недастаткова наступных аргументаў: %s",
"Invalid JSON config file: %s": "Несапраўдны файл канфігурацыі JSON: %s",
"Path to JSON config file": "Шлях да файла канфігурацыі JSON",
"Show help": "Паказаць дапамогу",
"Show version number": "Паказаць нумар версіі",
"Did you mean %s?": "Вы мелі на ўвазе %s?"
}

View File

@ -0,0 +1,46 @@
{
"Commands:": "Kommandos:",
"Options:": "Optionen:",
"Examples:": "Beispiele:",
"boolean": "boolean",
"count": "Zähler",
"string": "string",
"number": "Zahl",
"array": "array",
"required": "erforderlich",
"default": "Standard",
"default:": "Standard:",
"choices:": "Möglichkeiten:",
"aliases:": "Aliase:",
"generated-value": "Generierter-Wert",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt",
"other": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt",
"other": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt"
},
"Missing argument value: %s": {
"one": "Fehlender Argumentwert: %s",
"other": "Fehlende Argumentwerte: %s"
},
"Missing required argument: %s": {
"one": "Fehlendes Argument: %s",
"other": "Fehlende Argumente: %s"
},
"Unknown argument: %s": {
"one": "Unbekanntes Argument: %s",
"other": "Unbekannte Argumente: %s"
},
"Invalid values:": "Unzulässige Werte:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s",
"Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s",
"Implications failed:": "Fehlende abhängige Argumente:",
"Not enough arguments following: %s": "Nicht genügend Argumente nach: %s",
"Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s",
"Path to JSON config file": "Pfad zur JSON-Config Datei",
"Show help": "Hilfe anzeigen",
"Show version number": "Version anzeigen",
"Did you mean %s?": "Meintest du %s?"
}

View File

@ -0,0 +1,51 @@
{
"Commands:": "Commands:",
"Options:": "Options:",
"Examples:": "Examples:",
"boolean": "boolean",
"count": "count",
"string": "string",
"number": "number",
"array": "array",
"required": "required",
"default": "default",
"default:": "default:",
"choices:": "choices:",
"aliases:": "aliases:",
"generated-value": "generated-value",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Not enough non-option arguments: got %s, need at least %s",
"other": "Not enough non-option arguments: got %s, need at least %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Too many non-option arguments: got %s, maximum of %s",
"other": "Too many non-option arguments: got %s, maximum of %s"
},
"Missing argument value: %s": {
"one": "Missing argument value: %s",
"other": "Missing argument values: %s"
},
"Missing required argument: %s": {
"one": "Missing required argument: %s",
"other": "Missing required arguments: %s"
},
"Unknown argument: %s": {
"one": "Unknown argument: %s",
"other": "Unknown arguments: %s"
},
"Invalid values:": "Invalid values:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s",
"Argument check failed: %s": "Argument check failed: %s",
"Implications failed:": "Missing dependent arguments:",
"Not enough arguments following: %s": "Not enough arguments following: %s",
"Invalid JSON config file: %s": "Invalid JSON config file: %s",
"Path to JSON config file": "Path to JSON config file",
"Show help": "Show help",
"Show version number": "Show version number",
"Did you mean %s?": "Did you mean %s?",
"Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive",
"Positionals:": "Positionals:",
"command": "command",
"deprecated": "deprecated",
"deprecated: %s": "deprecated: %s"
}

View File

@ -0,0 +1,46 @@
{
"Commands:": "Comandos:",
"Options:": "Opciones:",
"Examples:": "Ejemplos:",
"boolean": "booleano",
"count": "cuenta",
"string": "cadena de caracteres",
"number": "número",
"array": "tabla",
"required": "requerido",
"default": "defecto",
"default:": "defecto:",
"choices:": "selección:",
"aliases:": "alias:",
"generated-value": "valor-generado",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s",
"other": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s",
"other": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s"
},
"Missing argument value: %s": {
"one": "Falta argumento: %s",
"other": "Faltan argumentos: %s"
},
"Missing required argument: %s": {
"one": "Falta argumento requerido: %s",
"other": "Faltan argumentos requeridos: %s"
},
"Unknown argument: %s": {
"one": "Argumento desconocido: %s",
"other": "Argumentos desconocidos: %s"
},
"Invalid values:": "Valores inválidos:",
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Seleccionados: %s",
"Argument check failed: %s": "Verificación de argumento ha fallado: %s",
"Implications failed:": "Implicaciones fallidas:",
"Not enough arguments following: %s": "No hay suficientes argumentos después de: %s",
"Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s",
"Path to JSON config file": "Ruta al archivo de configuración JSON",
"Show help": "Muestra ayuda",
"Show version number": "Muestra número de versión",
"Did you mean %s?": "Quisiste decir %s?"
}

View File

@ -0,0 +1,49 @@
{
"Commands:": "Komennot:",
"Options:": "Valinnat:",
"Examples:": "Esimerkkejä:",
"boolean": "totuusarvo",
"count": "lukumäärä",
"string": "merkkijono",
"number": "numero",
"array": "taulukko",
"required": "pakollinen",
"default": "oletusarvo",
"default:": "oletusarvo:",
"choices:": "vaihtoehdot:",
"aliases:": "aliakset:",
"generated-value": "generoitu-arvo",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s",
"other": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s",
"other": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s"
},
"Missing argument value: %s": {
"one": "Argumentin arvo puuttuu: %s",
"other": "Argumentin arvot puuttuvat: %s"
},
"Missing required argument: %s": {
"one": "Pakollinen argumentti puuttuu: %s",
"other": "Pakollisia argumentteja puuttuu: %s"
},
"Unknown argument: %s": {
"one": "Tuntematon argumenttn: %s",
"other": "Tuntemattomia argumentteja: %s"
},
"Invalid values:": "Virheelliset arvot:",
"Argument: %s, Given: %s, Choices: %s": "Argumentti: %s, Annettu: %s, Vaihtoehdot: %s",
"Argument check failed: %s": "Argumentin tarkistus epäonnistui: %s",
"Implications failed:": "Riippuvia argumentteja puuttuu:",
"Not enough arguments following: %s": "Argumentin perässä ei ole tarpeeksi argumentteja: %s",
"Invalid JSON config file: %s": "Epävalidi JSON-asetustiedosto: %s",
"Path to JSON config file": "JSON-asetustiedoston polku",
"Show help": "Näytä ohje",
"Show version number": "Näytä versionumero",
"Did you mean %s?": "Tarkoititko %s?",
"Arguments %s and %s are mutually exclusive" : "Argumentit %s ja %s eivät ole yhteensopivat",
"Positionals:": "Sijaintiparametrit:",
"command": "komento"
}

View File

@ -0,0 +1,53 @@
{
"Commands:": "Commandes :",
"Options:": "Options :",
"Examples:": "Exemples :",
"boolean": "booléen",
"count": "compteur",
"string": "chaîne de caractères",
"number": "nombre",
"array": "tableau",
"required": "requis",
"default": "défaut",
"default:": "défaut :",
"choices:": "choix :",
"aliases:": "alias :",
"generated-value": "valeur générée",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Pas assez d'arguments (hors options) : reçu %s, besoin d'au moins %s",
"other": "Pas assez d'arguments (hors options) : reçus %s, besoin d'au moins %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Trop d'arguments (hors options) : reçu %s, maximum de %s",
"other": "Trop d'arguments (hors options) : reçus %s, maximum de %s"
},
"Missing argument value: %s": {
"one": "Argument manquant : %s",
"other": "Arguments manquants : %s"
},
"Missing required argument: %s": {
"one": "Argument requis manquant : %s",
"other": "Arguments requis manquants : %s"
},
"Unknown argument: %s": {
"one": "Argument inconnu : %s",
"other": "Arguments inconnus : %s"
},
"Unknown command: %s": {
"one": "Commande inconnue : %s",
"other": "Commandes inconnues : %s"
},
"Invalid values:": "Valeurs invalides :",
"Argument: %s, Given: %s, Choices: %s": "Argument : %s, donné : %s, choix : %s",
"Argument check failed: %s": "Echec de la vérification de l'argument : %s",
"Implications failed:": "Arguments dépendants manquants :",
"Not enough arguments following: %s": "Pas assez d'arguments après : %s",
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide : %s",
"Path to JSON config file": "Chemin du fichier de configuration JSON",
"Show help": "Affiche l'aide",
"Show version number": "Affiche le numéro de version",
"Did you mean %s?": "Vouliez-vous dire %s ?",
"Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs",
"Positionals:": "Arguments positionnels :",
"command": "commande"
}

View File

@ -0,0 +1,49 @@
{
"Commands:": "आदेश:",
"Options:": "विकल्प:",
"Examples:": "उदाहरण:",
"boolean": "सत्यता",
"count": "संख्या",
"string": "वर्णों का तार ",
"number": "अंक",
"array": "सरणी",
"required": "आवश्यक",
"default": "डिफॉल्ट",
"default:": "डिफॉल्ट:",
"choices:": "विकल्प:",
"aliases:": "उपनाम:",
"generated-value": "उत्पन्न-मूल्य",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है",
"other": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य",
"other": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य"
},
"Missing argument value: %s": {
"one": "कुछ तर्को के मूल्य गुम हैं: %s",
"other": "कुछ तर्को के मूल्य गुम हैं: %s"
},
"Missing required argument: %s": {
"one": "आवश्यक तर्क गुम हैं: %s",
"other": "आवश्यक तर्क गुम हैं: %s"
},
"Unknown argument: %s": {
"one": "अज्ञात तर्क प्राप्त: %s",
"other": "अज्ञात तर्क प्राप्त: %s"
},
"Invalid values:": "अमान्य मूल्य:",
"Argument: %s, Given: %s, Choices: %s": "तर्क: %s, प्राप्त: %s, विकल्प: %s",
"Argument check failed: %s": "तर्क जांच विफल: %s",
"Implications failed:": "दिए गए तर्क के लिए अतिरिक्त तर्क की अपेक्षा है:",
"Not enough arguments following: %s": "निम्नलिखित के बाद पर्याप्त तर्क नहीं प्राप्त: %s",
"Invalid JSON config file: %s": "अमान्य JSON config फाइल: %s",
"Path to JSON config file": "JSON config फाइल का पथ",
"Show help": "सहायता दिखाएँ",
"Show version number": "Version संख्या दिखाएँ",
"Did you mean %s?": "क्या आपका मतलब है %s?",
"Arguments %s and %s are mutually exclusive" : "तर्क %s और %s परस्पर अनन्य हैं",
"Positionals:": "स्थानीय:",
"command": "आदेश"
}

View File

@ -0,0 +1,46 @@
{
"Commands:": "Parancsok:",
"Options:": "Opciók:",
"Examples:": "Példák:",
"boolean": "boolean",
"count": "számláló",
"string": "szöveg",
"number": "szám",
"array": "tömb",
"required": "kötelező",
"default": "alapértelmezett",
"default:": "alapértelmezett:",
"choices:": "lehetőségek:",
"aliases:": "aliaszok:",
"generated-value": "generált-érték",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell",
"other": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet",
"other": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet"
},
"Missing argument value: %s": {
"one": "Hiányzó argumentum érték: %s",
"other": "Hiányzó argumentum értékek: %s"
},
"Missing required argument: %s": {
"one": "Hiányzó kötelező argumentum: %s",
"other": "Hiányzó kötelező argumentumok: %s"
},
"Unknown argument: %s": {
"one": "Ismeretlen argumentum: %s",
"other": "Ismeretlen argumentumok: %s"
},
"Invalid values:": "Érvénytelen érték:",
"Argument: %s, Given: %s, Choices: %s": "Argumentum: %s, Megadott: %s, Lehetőségek: %s",
"Argument check failed: %s": "Argumentum ellenőrzés sikertelen: %s",
"Implications failed:": "Implikációk sikertelenek:",
"Not enough arguments following: %s": "Nem elég argumentum követi: %s",
"Invalid JSON config file: %s": "Érvénytelen JSON konfigurációs file: %s",
"Path to JSON config file": "JSON konfigurációs file helye",
"Show help": "Súgo megjelenítése",
"Show version number": "Verziószám megjelenítése",
"Did you mean %s?": "Erre gondoltál %s?"
}

View File

@ -0,0 +1,50 @@
{
"Commands:": "Perintah:",
"Options:": "Pilihan:",
"Examples:": "Contoh:",
"boolean": "boolean",
"count": "jumlah",
"number": "nomor",
"string": "string",
"array": "larik",
"required": "diperlukan",
"default": "bawaan",
"default:": "bawaan:",
"aliases:": "istilah lain:",
"choices:": "pilihan:",
"generated-value": "nilai-yang-dihasilkan",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Argumen wajib kurang: hanya %s, minimal %s",
"other": "Argumen wajib kurang: hanya %s, minimal %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Terlalu banyak argumen wajib: ada %s, maksimal %s",
"other": "Terlalu banyak argumen wajib: ada %s, maksimal %s"
},
"Missing argument value: %s": {
"one": "Kurang argumen: %s",
"other": "Kurang argumen: %s"
},
"Missing required argument: %s": {
"one": "Kurang argumen wajib: %s",
"other": "Kurang argumen wajib: %s"
},
"Unknown argument: %s": {
"one": "Argumen tak diketahui: %s",
"other": "Argumen tak diketahui: %s"
},
"Invalid values:": "Nilai-nilai tidak valid:",
"Argument: %s, Given: %s, Choices: %s": "Argumen: %s, Diberikan: %s, Pilihan: %s",
"Argument check failed: %s": "Pemeriksaan argument gagal: %s",
"Implications failed:": "Implikasi gagal:",
"Not enough arguments following: %s": "Kurang argumen untuk: %s",
"Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s",
"Path to JSON config file": "Alamat berkas konfigurasi JSON",
"Show help": "Lihat bantuan",
"Show version number": "Lihat nomor versi",
"Did you mean %s?": "Maksud Anda: %s?",
"Arguments %s and %s are mutually exclusive" : "Argumen %s dan %s saling eksklusif",
"Positionals:": "Posisional-posisional:",
"command": "perintah"
}

View File

@ -0,0 +1,46 @@
{
"Commands:": "Comandi:",
"Options:": "Opzioni:",
"Examples:": "Esempi:",
"boolean": "booleano",
"count": "contatore",
"string": "stringa",
"number": "numero",
"array": "vettore",
"required": "richiesto",
"default": "predefinito",
"default:": "predefinito:",
"choices:": "scelte:",
"aliases:": "alias:",
"generated-value": "valore generato",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s",
"other": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s",
"other": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s"
},
"Missing argument value: %s": {
"one": "Argomento mancante: %s",
"other": "Argomenti mancanti: %s"
},
"Missing required argument: %s": {
"one": "Argomento richiesto mancante: %s",
"other": "Argomenti richiesti mancanti: %s"
},
"Unknown argument: %s": {
"one": "Argomento sconosciuto: %s",
"other": "Argomenti sconosciuti: %s"
},
"Invalid values:": "Valori non validi:",
"Argument: %s, Given: %s, Choices: %s": "Argomento: %s, Richiesto: %s, Scelte: %s",
"Argument check failed: %s": "Controllo dell'argomento fallito: %s",
"Implications failed:": "Argomenti dipendenti mancanti:",
"Not enough arguments following: %s": "Argomenti insufficienti dopo: %s",
"Invalid JSON config file: %s": "File di configurazione JSON non valido: %s",
"Path to JSON config file": "Percorso del file di configurazione JSON",
"Show help": "Mostra la schermata di aiuto",
"Show version number": "Mostra il numero di versione",
"Did you mean %s?": "Intendi forse %s?"
}

View File

@ -0,0 +1,51 @@
{
"Commands:": "コマンド:",
"Options:": "オプション:",
"Examples:": "例:",
"boolean": "真偽",
"count": "カウント",
"string": "文字列",
"number": "数値",
"array": "配列",
"required": "必須",
"default": "デフォルト",
"default:": "デフォルト:",
"choices:": "選択してください:",
"aliases:": "エイリアス:",
"generated-value": "生成された値",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:",
"other": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:",
"other": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:"
},
"Missing argument value: %s": {
"one": "引数の値が見つかりません: %s",
"other": "引数の値が見つかりません: %s"
},
"Missing required argument: %s": {
"one": "必須の引数が見つかりません: %s",
"other": "必須の引数が見つかりません: %s"
},
"Unknown argument: %s": {
"one": "未知の引数です: %s",
"other": "未知の引数です: %s"
},
"Invalid values:": "不正な値です:",
"Argument: %s, Given: %s, Choices: %s": "引数は %s です。与えられた値: %s, 選択してください: %s",
"Argument check failed: %s": "引数のチェックに失敗しました: %s",
"Implications failed:": "オプションの組み合わせで不正が生じました:",
"Not enough arguments following: %s": "次の引数が不足しています。: %s",
"Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s",
"Path to JSON config file": "JSONの設定ファイルまでのpath",
"Show help": "ヘルプを表示",
"Show version number": "バージョンを表示",
"Did you mean %s?": "もしかして %s?",
"Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません",
"Positionals:": "位置:",
"command": "コマンド",
"deprecated": "非推奨",
"deprecated: %s": "非推奨: %s"
}

View File

@ -0,0 +1,49 @@
{
"Commands:": "명령:",
"Options:": "옵션:",
"Examples:": "예시:",
"boolean": "여부",
"count": "개수",
"string": "문자열",
"number": "숫자",
"array": "배열",
"required": "필수",
"default": "기본",
"default:": "기본:",
"choices:": "선택:",
"aliases:": "별칭:",
"generated-value": "생성된 값",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다",
"other": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다",
"other": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다"
},
"Missing argument value: %s": {
"one": "인자값을 받지 못했습니다: %s",
"other": "인자값들을 받지 못했습니다: %s"
},
"Missing required argument: %s": {
"one": "필수 인자를 받지 못했습니다: %s",
"other": "필수 인자들을 받지 못했습니다: %s"
},
"Unknown argument: %s": {
"one": "알 수 없는 인자입니다: %s",
"other": "알 수 없는 인자들입니다: %s"
},
"Invalid values:": "잘못된 값입니다:",
"Argument: %s, Given: %s, Choices: %s": "인자: %s, 입력받은 값: %s, 선택지: %s",
"Argument check failed: %s": "유효하지 않은 인자입니다: %s",
"Implications failed:": "옵션의 조합이 잘못되었습니다:",
"Not enough arguments following: %s": "인자가 충분하게 주어지지 않았습니다: %s",
"Invalid JSON config file: %s": "유효하지 않은 JSON 설정파일입니다: %s",
"Path to JSON config file": "JSON 설정파일 경로",
"Show help": "도움말을 보여줍니다",
"Show version number": "버전 넘버를 보여줍니다",
"Did you mean %s?": "찾고계신게 %s입니까?",
"Arguments %s and %s are mutually exclusive" : "%s와 %s 인자는 같이 사용될 수 없습니다",
"Positionals:": "위치:",
"command": "명령"
}

View File

@ -0,0 +1,44 @@
{
"Commands:": "Kommandoer:",
"Options:": "Alternativer:",
"Examples:": "Eksempler:",
"boolean": "boolsk",
"count": "antall",
"string": "streng",
"number": "nummer",
"array": "matrise",
"required": "obligatorisk",
"default": "standard",
"default:": "standard:",
"choices:": "valg:",
"generated-value": "generert-verdi",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s",
"other": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s",
"other": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s"
},
"Missing argument value: %s": {
"one": "Mangler argument verdi: %s",
"other": "Mangler argument verdier: %s"
},
"Missing required argument: %s": {
"one": "Mangler obligatorisk argument: %s",
"other": "Mangler obligatoriske argumenter: %s"
},
"Unknown argument: %s": {
"one": "Ukjent argument: %s",
"other": "Ukjente argumenter: %s"
},
"Invalid values:": "Ugyldige verdier:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s",
"Argument check failed: %s": "Argumentsjekk mislyktes: %s",
"Implications failed:": "Konsekvensene mislyktes:",
"Not enough arguments following: %s": "Ikke nok følgende argumenter: %s",
"Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s",
"Path to JSON config file": "Bane til JSON konfigurasjonsfil",
"Show help": "Vis hjelp",
"Show version number": "Vis versjonsnummer"
}

View File

@ -0,0 +1,49 @@
{
"Commands:": "Commando's:",
"Options:": "Opties:",
"Examples:": "Voorbeelden:",
"boolean": "booleaans",
"count": "aantal",
"string": "string",
"number": "getal",
"array": "lijst",
"required": "verplicht",
"default": "standaard",
"default:": "standaard:",
"choices:": "keuzes:",
"aliases:": "aliassen:",
"generated-value": "gegenereerde waarde",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig",
"other": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s",
"other": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s"
},
"Missing argument value: %s": {
"one": "Missende argumentwaarde: %s",
"other": "Missende argumentwaarden: %s"
},
"Missing required argument: %s": {
"one": "Missend verplicht argument: %s",
"other": "Missende verplichte argumenten: %s"
},
"Unknown argument: %s": {
"one": "Onbekend argument: %s",
"other": "Onbekende argumenten: %s"
},
"Invalid values:": "Ongeldige waarden:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeven: %s, Keuzes: %s",
"Argument check failed: %s": "Argumentcontrole mislukt: %s",
"Implications failed:": "Ontbrekende afhankelijke argumenten:",
"Not enough arguments following: %s": "Niet genoeg argumenten na: %s",
"Invalid JSON config file: %s": "Ongeldig JSON-config-bestand: %s",
"Path to JSON config file": "Pad naar JSON-config-bestand",
"Show help": "Toon help",
"Show version number": "Toon versienummer",
"Did you mean %s?": "Bedoelde u misschien %s?",
"Arguments %s and %s are mutually exclusive": "Argumenten %s en %s kunnen niet tegelijk gebruikt worden",
"Positionals:": "Positie-afhankelijke argumenten",
"command": "commando"
}

View File

@ -0,0 +1,44 @@
{
"Commands:": "Kommandoar:",
"Options:": "Alternativ:",
"Examples:": "Døme:",
"boolean": "boolsk",
"count": "mengd",
"string": "streng",
"number": "nummer",
"array": "matrise",
"required": "obligatorisk",
"default": "standard",
"default:": "standard:",
"choices:": "val:",
"generated-value": "generert-verdi",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s",
"other": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "For mange ikkje-alternativ argument: fekk %s, maksimum %s",
"other": "For mange ikkje-alternativ argument: fekk %s, maksimum %s"
},
"Missing argument value: %s": {
"one": "Manglar argumentverdi: %s",
"other": "Manglar argumentverdiar: %s"
},
"Missing required argument: %s": {
"one": "Manglar obligatorisk argument: %s",
"other": "Manglar obligatoriske argument: %s"
},
"Unknown argument: %s": {
"one": "Ukjent argument: %s",
"other": "Ukjende argument: %s"
},
"Invalid values:": "Ugyldige verdiar:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gjeve: %s, Val: %s",
"Argument check failed: %s": "Argumentsjekk mislukkast: %s",
"Implications failed:": "Konsekvensane mislukkast:",
"Not enough arguments following: %s": "Ikkje nok fylgjande argument: %s",
"Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s",
"Path to JSON config file": "Bane til JSON konfigurasjonsfil",
"Show help": "Vis hjelp",
"Show version number": "Vis versjonsnummer"
}

View File

@ -0,0 +1,13 @@
{
"Commands:": "Choose yer command:",
"Options:": "Options for me hearties!",
"Examples:": "Ex. marks the spot:",
"required": "requi-yar-ed",
"Missing required argument: %s": {
"one": "Ye be havin' to set the followin' argument land lubber: %s",
"other": "Ye be havin' to set the followin' arguments land lubber: %s"
},
"Show help": "Parlay this here code of conduct",
"Show version number": "'Tis the version ye be askin' fer",
"Arguments %s and %s are mutually exclusive" : "Yon scurvy dogs %s and %s be as bad as rum and a prudish wench"
}

View File

@ -0,0 +1,49 @@
{
"Commands:": "Polecenia:",
"Options:": "Opcje:",
"Examples:": "Przykłady:",
"boolean": "boolean",
"count": "ilość",
"string": "ciąg znaków",
"number": "liczba",
"array": "tablica",
"required": "wymagany",
"default": "domyślny",
"default:": "domyślny:",
"choices:": "dostępne:",
"aliases:": "aliasy:",
"generated-value": "wygenerowana-wartość",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s",
"other": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s",
"other": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s"
},
"Missing argument value: %s": {
"one": "Brak wartości dla argumentu: %s",
"other": "Brak wartości dla argumentów: %s"
},
"Missing required argument: %s": {
"one": "Brak wymaganego argumentu: %s",
"other": "Brak wymaganych argumentów: %s"
},
"Unknown argument: %s": {
"one": "Nieznany argument: %s",
"other": "Nieznane argumenty: %s"
},
"Invalid values:": "Nieprawidłowe wartości:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Otrzymano: %s, Dostępne: %s",
"Argument check failed: %s": "Weryfikacja argumentów nie powiodła się: %s",
"Implications failed:": "Założenia nie zostały spełnione:",
"Not enough arguments following: %s": "Niewystarczająca ilość argumentów następujących po: %s",
"Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s",
"Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON",
"Show help": "Pokaż pomoc",
"Show version number": "Pokaż numer wersji",
"Did you mean %s?": "Czy chodziło Ci o %s?",
"Arguments %s and %s are mutually exclusive": "Argumenty %s i %s wzajemnie się wykluczają",
"Positionals:": "Pozycyjne:",
"command": "polecenie"
}

View File

@ -0,0 +1,45 @@
{
"Commands:": "Comandos:",
"Options:": "Opções:",
"Examples:": "Exemplos:",
"boolean": "boolean",
"count": "contagem",
"string": "cadeia de caracteres",
"number": "número",
"array": "arranjo",
"required": "requerido",
"default": "padrão",
"default:": "padrão:",
"choices:": "escolhas:",
"generated-value": "valor-gerado",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s",
"other": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Excesso de argumentos não opcionais: recebido %s, máximo de %s",
"other": "Excesso de argumentos não opcionais: recebido %s, máximo de %s"
},
"Missing argument value: %s": {
"one": "Falta valor de argumento: %s",
"other": "Falta valores de argumento: %s"
},
"Missing required argument: %s": {
"one": "Falta argumento obrigatório: %s",
"other": "Faltando argumentos obrigatórios: %s"
},
"Unknown argument: %s": {
"one": "Argumento desconhecido: %s",
"other": "Argumentos desconhecidos: %s"
},
"Invalid values:": "Valores inválidos:",
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s",
"Argument check failed: %s": "Verificação de argumento falhou: %s",
"Implications failed:": "Implicações falharam:",
"Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s",
"Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s",
"Path to JSON config file": "Caminho para o arquivo de configuração em JSON",
"Show help": "Mostra ajuda",
"Show version number": "Mostra número de versão",
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos"
}

View File

@ -0,0 +1,48 @@
{
"Commands:": "Comandos:",
"Options:": "Opções:",
"Examples:": "Exemplos:",
"boolean": "booleano",
"count": "contagem",
"string": "string",
"number": "número",
"array": "array",
"required": "obrigatório",
"default:": "padrão:",
"choices:": "opções:",
"aliases:": "sinônimos:",
"generated-value": "valor-gerado",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s",
"other": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Excesso de argumentos: recebido %s, máximo de %s",
"other": "Excesso de argumentos: recebido %s, máximo de %s"
},
"Missing argument value: %s": {
"one": "Falta valor de argumento: %s",
"other": "Falta valores de argumento: %s"
},
"Missing required argument: %s": {
"one": "Falta argumento obrigatório: %s",
"other": "Faltando argumentos obrigatórios: %s"
},
"Unknown argument: %s": {
"one": "Argumento desconhecido: %s",
"other": "Argumentos desconhecidos: %s"
},
"Invalid values:": "Valores inválidos:",
"Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Opções: %s",
"Argument check failed: %s": "Verificação de argumento falhou: %s",
"Implications failed:": "Implicações falharam:",
"Not enough arguments following: %s": "Argumentos insuficientes a seguir: %s",
"Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s",
"Path to JSON config file": "Caminho para o arquivo JSON de configuração",
"Show help": "Exibe ajuda",
"Show version number": "Exibe a versão",
"Did you mean %s?": "Você quis dizer %s?",
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos",
"Positionals:": "Posicionais:",
"command": "comando"
}

View File

@ -0,0 +1,46 @@
{
"Commands:": "Команды:",
"Options:": "Опции:",
"Examples:": "Примеры:",
"boolean": "булевый тип",
"count": "подсчет",
"string": "строковой тип",
"number": "число",
"array": "массив",
"required": "необходимо",
"default": "по умолчанию",
"default:": "по умолчанию:",
"choices:": "возможности:",
"aliases:": "алиасы:",
"generated-value": "генерированное значение",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s",
"other": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s",
"other": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s"
},
"Missing argument value: %s": {
"one": "Не хватает значения аргумента: %s",
"other": "Не хватает значений аргументов: %s"
},
"Missing required argument: %s": {
"one": "Не хватает необходимого аргумента: %s",
"other": "Не хватает необходимых аргументов: %s"
},
"Unknown argument: %s": {
"one": "Неизвестный аргумент: %s",
"other": "Неизвестные аргументы: %s"
},
"Invalid values:": "Недействительные значения:",
"Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Данное значение: %s, Возможности: %s",
"Argument check failed: %s": "Проверка аргументов не удалась: %s",
"Implications failed:": "Данный аргумент требует следующий дополнительный аргумент:",
"Not enough arguments following: %s": "Недостаточно следующих аргументов: %s",
"Invalid JSON config file: %s": "Недействительный файл конфигурации JSON: %s",
"Path to JSON config file": "Путь к файлу конфигурации JSON",
"Show help": "Показать помощь",
"Show version number": "Показать номер версии",
"Did you mean %s?": "Вы имели в виду %s?"
}

View File

@ -0,0 +1,46 @@
{
"Commands:": "คอมมาน",
"Options:": "ออฟชั่น",
"Examples:": "ตัวอย่าง",
"boolean": "บูลีน",
"count": "นับ",
"string": "สตริง",
"number": "ตัวเลข",
"array": "อาเรย์",
"required": "จำเป็น",
"default": "ค่าเริ่มต้",
"default:": "ค่าเริ่มต้น",
"choices:": "ตัวเลือก",
"aliases:": "เอเลียส",
"generated-value": "ค่าที่ถูกสร้างขึ้น",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า",
"other": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า",
"other": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า"
},
"Missing argument value: %s": {
"one": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s",
"other": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s"
},
"Missing required argument: %s": {
"one": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s",
"other": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s"
},
"Unknown argument: %s": {
"one": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s",
"other": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s"
},
"Invalid values:": "ค่าไม่ถูกต้อง:",
"Argument: %s, Given: %s, Choices: %s": "อาร์กิวเมนต์: %s, ได้รับ: %s, ตัวเลือก: %s",
"Argument check failed: %s": "ตรวจสอบพบอาร์กิวเมนต์ที่ไม่ถูกต้อง: %s",
"Implications failed:": "Implications ไม่สำเร็จ:",
"Not enough arguments following: %s": "ใส่อาร์กิวเมนต์ไม่ครบ: %s",
"Invalid JSON config file: %s": "ไฟล์คอนฟิค JSON ไม่ถูกต้อง: %s",
"Path to JSON config file": "พาทไฟล์คอนฟิค JSON",
"Show help": "ขอความช่วยเหลือ",
"Show version number": "แสดงตัวเลขเวอร์ชั่น",
"Did you mean %s?": "คุณหมายถึง %s?"
}

View File

@ -0,0 +1,48 @@
{
"Commands:": "Komutlar:",
"Options:": "Seçenekler:",
"Examples:": "Örnekler:",
"boolean": "boolean",
"count": "sayı",
"string": "string",
"number": "numara",
"array": "array",
"required": "zorunlu",
"default": "varsayılan",
"default:": "varsayılan:",
"choices:": "seçimler:",
"aliases:": "takma adlar:",
"generated-value": "oluşturulan-değer",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli",
"other": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s",
"other": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s"
},
"Missing argument value: %s": {
"one": "Eksik argüman değeri: %s",
"other": "Eksik argüman değerleri: %s"
},
"Missing required argument: %s": {
"one": "Eksik zorunlu argüman: %s",
"other": "Eksik zorunlu argümanlar: %s"
},
"Unknown argument: %s": {
"one": "Bilinmeyen argüman: %s",
"other": "Bilinmeyen argümanlar: %s"
},
"Invalid values:": "Geçersiz değerler:",
"Argument: %s, Given: %s, Choices: %s": "Argüman: %s, Verilen: %s, Seçimler: %s",
"Argument check failed: %s": "Argüman kontrolü başarısız oldu: %s",
"Implications failed:": "Sonuçlar başarısız oldu:",
"Not enough arguments following: %s": "%s için yeterli argüman bulunamadı",
"Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s",
"Path to JSON config file": "JSON yapılandırma dosya konumu",
"Show help": "Yardım detaylarını göster",
"Show version number": "Versiyon detaylarını göster",
"Did you mean %s?": "Bunu mu demek istediniz: %s?",
"Positionals:": "Sıralılar:",
"command": "komut"
}

View File

@ -0,0 +1,51 @@
{
"Commands:": "Команди:",
"Options:": "Опції:",
"Examples:": "Приклади:",
"boolean": "boolean",
"count": "кількість",
"string": "строка",
"number": "число",
"array": "масива",
"required": "обов'язково",
"default": "за замовчуванням",
"default:": "за замовчуванням:",
"choices:": "доступні варіанти:",
"aliases:": "псевдоніми:",
"generated-value": "згенероване значення",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "Недостатньо аргументів: наразі %s, потрібно %s або більше",
"other": "Недостатньо аргументів: наразі %s, потрібно %s або більше"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "Забагато аргументів: наразі %s, максимум %s",
"other": "Too many non-option arguments: наразі %s, максимум of %s"
},
"Missing argument value: %s": {
"one": "Відсутнє значення для аргументу: %s",
"other": "Відсутні значення для аргументу: %s"
},
"Missing required argument: %s": {
"one": "Відсутній обов'язковий аргумент: %s",
"other": "Відсутні обов'язкові аргументи: %s"
},
"Unknown argument: %s": {
"one": "Аргумент %s не підтримується",
"other": "Аргументи %s не підтримуються"
},
"Invalid values:": "Некоректні значення:",
"Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Введено: %s, Доступні варіанти: %s",
"Argument check failed: %s": "Аргумент не пройшов перевірку: %s",
"Implications failed:": "Відсутні залежні аргументи:",
"Not enough arguments following: %s": "Не достатньо аргументів після: %s",
"Invalid JSON config file: %s": "Некоректний JSON-файл конфігурації: %s",
"Path to JSON config file": "Шлях до JSON-файлу конфігурації",
"Show help": "Показати довідку",
"Show version number": "Показати версію",
"Did you mean %s?": "Можливо, ви мали на увазі %s?",
"Arguments %s and %s are mutually exclusive" : "Аргументи %s та %s взаємовиключні",
"Positionals:": "Позиційні:",
"command": "команда",
"deprecated": "застарілий",
"deprecated: %s": "застарілий: %s"
}

View File

@ -0,0 +1,48 @@
{
"Commands:": "命令:",
"Options:": "选项:",
"Examples:": "示例:",
"boolean": "布尔",
"count": "计数",
"string": "字符串",
"number": "数字",
"array": "数组",
"required": "必需",
"default": "默认值",
"default:": "默认值:",
"choices:": "可选值:",
"generated-value": "生成的值",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个",
"other": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个",
"other": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个"
},
"Missing argument value: %s": {
"one": "没有给此选项指定值:%s",
"other": "没有给这些选项指定值:%s"
},
"Missing required argument: %s": {
"one": "缺少必须的选项:%s",
"other": "缺少这些必须的选项:%s"
},
"Unknown argument: %s": {
"one": "无法识别的选项:%s",
"other": "无法识别这些选项:%s"
},
"Invalid values:": "无效的选项值:",
"Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s",
"Argument check failed: %s": "选项值验证失败:%s",
"Implications failed:": "缺少依赖的选项:",
"Not enough arguments following: %s": "没有提供足够的值给此选项:%s",
"Invalid JSON config file: %s": "无效的 JSON 配置文件:%s",
"Path to JSON config file": "JSON 配置文件的路径",
"Show help": "显示帮助信息",
"Show version number": "显示版本号",
"Did you mean %s?": "是指 %s?",
"Arguments %s and %s are mutually exclusive" : "选项 %s 和 %s 是互斥的",
"Positionals:": "位置:",
"command": "命令"
}

View File

@ -0,0 +1,51 @@
{
"Commands:": "命令:",
"Options:": "選項:",
"Examples:": "範例:",
"boolean": "布林",
"count": "次數",
"string": "字串",
"number": "數字",
"array": "陣列",
"required": "必填",
"default": "預設值",
"default:": "預設值:",
"choices:": "可選值:",
"aliases:": "別名:",
"generated-value": "生成的值",
"Not enough non-option arguments: got %s, need at least %s": {
"one": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個",
"other": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個"
},
"Too many non-option arguments: got %s, maximum of %s": {
"one": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個",
"other": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個"
},
"Missing argument value: %s": {
"one": "此引數無指定值:%s",
"other": "這些引數無指定值:%s"
},
"Missing required argument: %s": {
"one": "缺少必須的引數:%s",
"other": "缺少這些必須的引數:%s"
},
"Unknown argument: %s": {
"one": "未知的引數:%s",
"other": "未知的引數:%s"
},
"Invalid values:": "無效的選項值:",
"Argument: %s, Given: %s, Choices: %s": "引數名稱: %s, 傳入的值: %s, 可選的值:%s",
"Argument check failed: %s": "引數驗證失敗:%s",
"Implications failed:": "缺少依賴引數:",
"Not enough arguments following: %s": "沒有提供足夠的值給此引數:%s",
"Invalid JSON config file: %s": "無效的 JSON 設置文件:%s",
"Path to JSON config file": "JSON 設置文件的路徑",
"Show help": "顯示說明",
"Show version number": "顯示版本",
"Did you mean %s?": "您是指 %s 嗎?",
"Arguments %s and %s are mutually exclusive" : "引數 %s 和 %s 互斥",
"Positionals:": "位置:",
"command": "命令",
"deprecated": "已淘汰",
"deprecated: %s": "已淘汰:%s"
}

View File

@ -0,0 +1,116 @@
{
"name": "yargs",
"version": "17.1.1",
"description": "yargs the modern, pirate-themed, successor to optimist.",
"main": "./index.cjs",
"exports": {
"./package.json": "./package.json",
".": [
{
"import": "./index.mjs",
"require": "./index.cjs"
},
"./index.cjs"
],
"./helpers": {
"import": "./helpers/helpers.mjs",
"require": "./helpers/index.js"
},
"./yargs": [
{
"require": "./yargs"
},
"./yargs"
]
},
"type": "module",
"module": "./index.mjs",
"contributors": [
{
"name": "Yargs Contributors",
"url": "https://github.com/yargs/yargs/graphs/contributors"
}
],
"files": [
"browser.mjs",
"index.cjs",
"helpers/*.js",
"helpers/*",
"index.mjs",
"yargs",
"build",
"locales",
"LICENSE",
"lib/platform-shims/*.mjs",
"!*.d.ts",
"!**/*.d.ts"
],
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.0",
"y18n": "^5.0.5",
"yargs-parser": "^20.2.2"
},
"devDependencies": {
"@types/chai": "^4.2.11",
"@types/mocha": "^9.0.0",
"@types/node": "^14.11.2",
"@wessberg/rollup-plugin-ts": "^1.3.2",
"c8": "^7.7.0",
"chai": "^4.2.0",
"chalk": "^4.0.0",
"coveralls": "^3.0.9",
"cpr": "^3.0.1",
"cross-env": "^7.0.2",
"cross-spawn": "^7.0.0",
"eslint": "^7.23.0",
"gts": "^3.0.0",
"hashish": "0.0.4",
"mocha": "^9.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.23.0",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.0.2",
"which": "^2.0.0",
"yargs-test-extends": "^1.0.1"
},
"scripts": {
"fix": "gts fix && npm run fix:js",
"fix:js": "eslint . --ext cjs --ext mjs --ext js --fix",
"posttest": "npm run check",
"test": "c8 mocha --enable-source-maps ./test/*.cjs --require ./test/before.cjs --timeout=12000 --check-leaks",
"test:esm": "c8 mocha --enable-source-maps ./test/esm/*.mjs --check-leaks",
"coverage": "c8 report --check-coverage",
"prepare": "npm run compile",
"pretest": "npm run compile -- -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
"compile": "rimraf build && tsc",
"postcompile": "npm run build:cjs",
"build:cjs": "rollup -c rollup.config.cjs",
"postbuild:cjs": "rimraf ./build/index.cjs.d.ts",
"check": "gts lint && npm run check:js",
"check:js": "eslint . --ext cjs --ext mjs --ext js",
"clean": "gts clean"
},
"repository": {
"type": "git",
"url": "https://github.com/yargs/yargs.git"
},
"homepage": "https://yargs.js.org/",
"keywords": [
"argument",
"args",
"option",
"parser",
"parsing",
"cli",
"command"
],
"license": "MIT",
"engines": {
"node": ">=12"
}
}

9
node_modules/localtunnel/node_modules/yargs/yargs generated vendored Normal file
View File

@ -0,0 +1,9 @@
// TODO: consolidate on using a helpers file at some point in the future, which
// is the approach currently used to export Parser and applyExtends for ESM:
const {applyExtends, cjsPlatformShim, Parser, Yargs, processArgv} = require('./build/index.cjs')
Yargs.applyExtends = (config, cwd, mergeExtends) => {
return applyExtends(config, cwd, mergeExtends, cjsPlatformShim)
}
Yargs.hideBin = processArgv.hideBin
Yargs.Parser = Parser
module.exports = Yargs

Some files were not shown because too many files have changed in this diff Show More