nav tabs on admin dashboard
This commit is contained in:
29
node_modules/webpack-dev-server/README.md
generated
vendored
29
node_modules/webpack-dev-server/README.md
generated
vendored
@@ -19,18 +19,20 @@ live reloading. This should be used for **development only**.
|
||||
It uses [webpack-dev-middleware][middleware-url] under the hood, which provides
|
||||
fast in-memory access to the webpack assets.
|
||||
|
||||
## Project in Maintenance
|
||||
## Table of Contents
|
||||
|
||||
**Please note that `webpack-dev-server` is presently in a maintenance-only mode**
|
||||
and will not be accepting any additional features in the near term. Most new feature
|
||||
requests can be accomplished with Express middleware; please look into using
|
||||
the [`before`](https://webpack.js.org/configuration/dev-server/#devserver-before)
|
||||
and [`after`](https://webpack.js.org/configuration/dev-server/#devserver-after)
|
||||
hooks in the documentation.
|
||||
1. [Getting Started](#getting-started)
|
||||
2. [Usage](#usage)
|
||||
3. [Browser Support](#browser-support)
|
||||
4. [Support](#support)
|
||||
5. [Contributing](#contributing)
|
||||
6. [Maintainers](#maintainers)
|
||||
7. [Attribution](#attribution)
|
||||
8. [License](#license)
|
||||
|
||||
## Getting Started
|
||||
|
||||
First thing's first, install the module:
|
||||
First things first, install the module:
|
||||
|
||||
```console
|
||||
npm install webpack-dev-server --save-dev
|
||||
@@ -53,6 +55,8 @@ The easiest way to use it is with the CLI. In the directory where your
|
||||
node_modules/.bin/webpack-dev-server
|
||||
```
|
||||
|
||||
_**Note**: Many CLI options are available with `webpack-dev-server`. Explore this [link](https://webpack.js.org/configuration/dev-server/)._
|
||||
|
||||
### With NPM Scripts
|
||||
|
||||
NPM package.json scripts are a convenient and useful means to run locally installed
|
||||
@@ -115,7 +119,7 @@ question. Remember; It's always much easier to answer questions that include you
|
||||
If you're twitter-savvy you can tweet [#webpack][hash-url] with your question
|
||||
and someone should be able to reach out and lend a hand.
|
||||
|
||||
If you have discovered a :bug:, have a feature suggestion, of would like to see
|
||||
If you have discovered a :bug:, have a feature suggestion, or would like to see
|
||||
a modification, please feel free to create an issue on Github. _Note: The issue
|
||||
template isn't optional, so please be sure not to remove it, and please fill it
|
||||
out completely._
|
||||
@@ -151,25 +155,18 @@ This project is heavily inspired by [peerigon/nof5](https://github.com/peerigon/
|
||||
|
||||
#### [MIT](./LICENSE)
|
||||
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/webpack-dev-server.svg
|
||||
[npm-url]: https://npmjs.com/package/webpack-dev-server
|
||||
|
||||
[node]: https://img.shields.io/node/v/webpack-dev-server.svg
|
||||
[node-url]: https://nodejs.org
|
||||
|
||||
[deps]: https://david-dm.org/webpack/webpack-dev-server.svg
|
||||
[deps-url]: https://david-dm.org/webpack/webpack-dev-server
|
||||
|
||||
[tests]: http://img.shields.io/travis/webpack/webpack-dev-server.svg
|
||||
[tests-url]: https://travis-ci.org/webpack/webpack-dev-server
|
||||
|
||||
[cover]: https://codecov.io/gh/webpack/webpack-dev-server/branch/master/graph/badge.svg
|
||||
[cover-url]: https://codecov.io/gh/webpack/webpack-dev-server
|
||||
|
||||
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
||||
[chat-url]: https://gitter.im/webpack/webpack
|
||||
|
||||
[docs-url]: https://webpack.js.org/configuration/dev-server/#devserver
|
||||
[hash-url]: https://twitter.com/search?q=webpack
|
||||
[middleware-url]: https://github.com/webpack/webpack-dev-middleware
|
||||
|
||||
556
node_modules/webpack-dev-server/bin/webpack-dev-server.js
generated
vendored
556
node_modules/webpack-dev-server/bin/webpack-dev-server.js
generated
vendored
@@ -2,494 +2,228 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
/* eslint global-require: off, import/order: off, no-console: off */
|
||||
require('../lib/polyfills');
|
||||
|
||||
/* eslint-disable
|
||||
import/order,
|
||||
no-shadow,
|
||||
no-console
|
||||
*/
|
||||
const debug = require('debug')('webpack-dev-server');
|
||||
|
||||
const fs = require('fs');
|
||||
const net = require('net');
|
||||
const path = require('path');
|
||||
const importLocal = require('import-local');
|
||||
const open = require('opn');
|
||||
|
||||
const portfinder = require('portfinder');
|
||||
const addDevServerEntrypoints = require('../lib/util/addDevServerEntrypoints');
|
||||
const createDomain = require('../lib/util/createDomain'); // eslint-disable-line
|
||||
const importLocal = require('import-local');
|
||||
|
||||
const yargs = require('yargs');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const options = require('./options');
|
||||
|
||||
const Server = require('../lib/Server');
|
||||
|
||||
const addEntries = require('../lib/utils/addEntries');
|
||||
const colors = require('../lib/utils/colors');
|
||||
const createConfig = require('../lib/utils/createConfig');
|
||||
const createDomain = require('../lib/utils/createDomain');
|
||||
const createLogger = require('../lib/utils/createLogger');
|
||||
const getVersions = require('../lib/utils/getVersions');
|
||||
const runBonjour = require('../lib/utils/runBonjour');
|
||||
const status = require('../lib/utils/status');
|
||||
|
||||
let server;
|
||||
|
||||
const signals = ['SIGINT', 'SIGTERM'];
|
||||
|
||||
signals.forEach((signal) => {
|
||||
process.on(signal, () => {
|
||||
if (server) {
|
||||
server.close(() => {
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit();
|
||||
});
|
||||
} else {
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Prefer the local installation of webpack-dev-server
|
||||
if (importLocal(__filename)) {
|
||||
debug('Using local install of webpack-dev-server');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const Server = require('../lib/Server');
|
||||
const webpack = require('webpack'); // eslint-disable-line
|
||||
try {
|
||||
require.resolve('webpack-cli');
|
||||
} catch (err) {
|
||||
console.error('The CLI moved into a separate package: webpack-cli');
|
||||
console.error(
|
||||
"Please install 'webpack-cli' in addition to webpack itself to use the CLI"
|
||||
);
|
||||
console.error('-> When using npm: npm i -D webpack-cli');
|
||||
console.error('-> When using yarn: yarn add -D webpack-cli');
|
||||
|
||||
function versionInfo() {
|
||||
return `webpack-dev-server ${require('../package.json').version}\n` +
|
||||
`webpack ${require('webpack/package.json').version}`;
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
function colorInfo(useColor, msg) {
|
||||
if (useColor) {
|
||||
// Make text blue and bold, so it *pops*
|
||||
return `\u001b[1m\u001b[34m${msg}\u001b[39m\u001b[22m`;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
yargs.usage(
|
||||
`${getVersions()}\nUsage: https://webpack.js.org/configuration/dev-server/`
|
||||
);
|
||||
|
||||
function colorError(useColor, msg) {
|
||||
if (useColor) {
|
||||
// Make text red and bold, so it *pops*
|
||||
return `\u001b[1m\u001b[31m${msg}\u001b[39m\u001b[22m`;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
const defaultTo = (value, def) => value == null ? def : value;
|
||||
|
||||
const yargs = require('yargs')
|
||||
.usage(`${versionInfo()}\nUsage: https://webpack.js.org/configuration/dev-server/`);
|
||||
|
||||
require('webpack/bin/config-yargs')(yargs);
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
require('webpack-cli/bin/config-yargs')(yargs);
|
||||
|
||||
// It is important that this is done after the webpack yargs config,
|
||||
// so it overrides webpack's version info.
|
||||
yargs
|
||||
.version(versionInfo());
|
||||
yargs.version(getVersions());
|
||||
yargs.options(options);
|
||||
|
||||
const ADVANCED_GROUP = 'Advanced options:';
|
||||
const DISPLAY_GROUP = 'Stats options:';
|
||||
const SSL_GROUP = 'SSL options:';
|
||||
const CONNECTION_GROUP = 'Connection options:';
|
||||
const RESPONSE_GROUP = 'Response options:';
|
||||
const BASIC_GROUP = 'Basic options:';
|
||||
const argv = yargs.argv;
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const config = require('webpack-cli/bin/convert-argv')(yargs, argv, {
|
||||
outputFilename: '/bundle.js',
|
||||
});
|
||||
|
||||
// Taken out of yargs because we must know if
|
||||
// it wasn't given by the user, in which case
|
||||
// we should use portfinder.
|
||||
const DEFAULT_PORT = 8080;
|
||||
|
||||
yargs.options({
|
||||
bonjour: {
|
||||
type: 'boolean',
|
||||
describe: 'Broadcasts the server via ZeroConf networking on start'
|
||||
},
|
||||
lazy: {
|
||||
type: 'boolean',
|
||||
describe: 'Lazy'
|
||||
},
|
||||
inline: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
describe: 'Inline mode (set to false to disable including client scripts like livereload)'
|
||||
},
|
||||
progress: {
|
||||
type: 'boolean',
|
||||
describe: 'Print compilation progress in percentage',
|
||||
group: BASIC_GROUP
|
||||
},
|
||||
'hot-only': {
|
||||
type: 'boolean',
|
||||
describe: 'Do not refresh page if HMR fails',
|
||||
group: ADVANCED_GROUP
|
||||
},
|
||||
stdin: {
|
||||
type: 'boolean',
|
||||
describe: 'close when stdin ends'
|
||||
},
|
||||
open: {
|
||||
type: 'string',
|
||||
describe: 'Open the default browser, or optionally specify a browser name'
|
||||
},
|
||||
useLocalIp: {
|
||||
type: 'boolean',
|
||||
describe: 'Open default browser with local IP'
|
||||
},
|
||||
'open-page': {
|
||||
type: 'string',
|
||||
describe: 'Open default browser with the specified page',
|
||||
requiresArg: true
|
||||
},
|
||||
color: {
|
||||
type: 'boolean',
|
||||
alias: 'colors',
|
||||
default: function supportsColor() {
|
||||
return require('supports-color');
|
||||
},
|
||||
group: DISPLAY_GROUP,
|
||||
describe: 'Enables/Disables colors on the console'
|
||||
},
|
||||
info: {
|
||||
type: 'boolean',
|
||||
group: DISPLAY_GROUP,
|
||||
default: true,
|
||||
describe: 'Info'
|
||||
},
|
||||
quiet: {
|
||||
type: 'boolean',
|
||||
group: DISPLAY_GROUP,
|
||||
describe: 'Quiet'
|
||||
},
|
||||
'client-log-level': {
|
||||
type: 'string',
|
||||
group: DISPLAY_GROUP,
|
||||
default: 'info',
|
||||
describe: 'Log level in the browser (info, warning, error or none)'
|
||||
},
|
||||
https: {
|
||||
type: 'boolean',
|
||||
group: SSL_GROUP,
|
||||
describe: 'HTTPS'
|
||||
},
|
||||
key: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL key.',
|
||||
group: SSL_GROUP
|
||||
},
|
||||
cert: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL certificate.',
|
||||
group: SSL_GROUP
|
||||
},
|
||||
cacert: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL CA certificate.',
|
||||
group: SSL_GROUP
|
||||
},
|
||||
pfx: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL pfx file.',
|
||||
group: SSL_GROUP
|
||||
},
|
||||
'pfx-passphrase': {
|
||||
type: 'string',
|
||||
describe: 'Passphrase for pfx file.',
|
||||
group: SSL_GROUP
|
||||
},
|
||||
'content-base': {
|
||||
type: 'string',
|
||||
describe: 'A directory or URL to serve HTML content from.',
|
||||
group: RESPONSE_GROUP
|
||||
},
|
||||
'watch-content-base': {
|
||||
type: 'boolean',
|
||||
describe: 'Enable live-reloading of the content-base.',
|
||||
group: RESPONSE_GROUP
|
||||
},
|
||||
'history-api-fallback': {
|
||||
type: 'boolean',
|
||||
describe: 'Fallback to /index.html for Single Page Applications.',
|
||||
group: RESPONSE_GROUP
|
||||
},
|
||||
compress: {
|
||||
type: 'boolean',
|
||||
describe: 'Enable gzip compression',
|
||||
group: RESPONSE_GROUP
|
||||
},
|
||||
port: {
|
||||
describe: 'The port',
|
||||
group: CONNECTION_GROUP
|
||||
},
|
||||
'disable-host-check': {
|
||||
type: 'boolean',
|
||||
describe: 'Will not check the host',
|
||||
group: CONNECTION_GROUP
|
||||
},
|
||||
socket: {
|
||||
type: 'String',
|
||||
describe: 'Socket to listen',
|
||||
group: CONNECTION_GROUP
|
||||
},
|
||||
public: {
|
||||
type: 'string',
|
||||
describe: 'The public hostname/ip address of the server',
|
||||
group: CONNECTION_GROUP
|
||||
},
|
||||
host: {
|
||||
type: 'string',
|
||||
default: 'localhost',
|
||||
describe: 'The hostname/ip address the server will bind to',
|
||||
group: CONNECTION_GROUP
|
||||
},
|
||||
'allowed-hosts': {
|
||||
type: 'string',
|
||||
describe: 'A comma-delimited string of hosts that are allowed to access the dev server',
|
||||
group: CONNECTION_GROUP
|
||||
}
|
||||
});
|
||||
|
||||
const argv = yargs.argv;
|
||||
const wpOpt = require('webpack/bin/convert-argv')(yargs, argv, {
|
||||
outputFilename: '/bundle.js'
|
||||
});
|
||||
|
||||
function processOptions(webpackOptions) {
|
||||
// process Promise
|
||||
if (typeof webpackOptions.then === 'function') {
|
||||
webpackOptions.then(processOptions).catch((err) => {
|
||||
function processOptions(config) {
|
||||
// processOptions {Promise}
|
||||
if (typeof config.then === 'function') {
|
||||
config.then(processOptions).catch((err) => {
|
||||
console.error(err.stack || err);
|
||||
process.exit(); // eslint-disable-line
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const firstWpOpt = Array.isArray(webpackOptions) ? webpackOptions[0] : webpackOptions;
|
||||
|
||||
const options = webpackOptions.devServer || firstWpOpt.devServer || {};
|
||||
|
||||
if (argv.bonjour) { options.bonjour = true; }
|
||||
|
||||
if (argv.host !== 'localhost' || !options.host) { options.host = argv.host; }
|
||||
|
||||
if (argv['allowed-hosts']) { options.allowedHosts = argv['allowed-hosts'].split(','); }
|
||||
|
||||
if (argv.public) { options.public = argv.public; }
|
||||
|
||||
if (argv.socket) { options.socket = argv.socket; }
|
||||
|
||||
if (argv.progress) { options.progress = argv.progress; }
|
||||
|
||||
if (!options.publicPath) {
|
||||
// eslint-disable-next-line
|
||||
options.publicPath = firstWpOpt.output && firstWpOpt.output.publicPath || '';
|
||||
if (!/^(https?:)?\/\//.test(options.publicPath) && options.publicPath[0] !== '/') {
|
||||
options.publicPath = `/${options.publicPath}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.filename) { options.filename = firstWpOpt.output && firstWpOpt.output.filename; }
|
||||
|
||||
if (!options.watchOptions) { options.watchOptions = firstWpOpt.watchOptions; }
|
||||
|
||||
if (argv.stdin) {
|
||||
process.stdin.on('end', () => {
|
||||
process.exit(0); // eslint-disable-line no-process-exit
|
||||
});
|
||||
process.stdin.resume();
|
||||
}
|
||||
|
||||
if (!options.hot) { options.hot = argv.hot; }
|
||||
|
||||
if (!options.hotOnly) { options.hotOnly = argv['hot-only']; }
|
||||
|
||||
if (!options.clientLogLevel) { options.clientLogLevel = argv['client-log-level']; }
|
||||
|
||||
// eslint-disable-next-line
|
||||
if (options.contentBase === undefined) {
|
||||
if (argv['content-base']) {
|
||||
options.contentBase = argv['content-base'];
|
||||
if (Array.isArray(options.contentBase)) {
|
||||
options.contentBase = options.contentBase.map(val => path.resolve(val));
|
||||
} else if (/^[0-9]$/.test(options.contentBase)) { options.contentBase = +options.contentBase; } else if (!/^(https?:)?\/\//.test(options.contentBase)) { options.contentBase = path.resolve(options.contentBase); }
|
||||
// It is possible to disable the contentBase by using `--no-content-base`, which results in arg["content-base"] = false
|
||||
} else if (argv['content-base'] === false) {
|
||||
options.contentBase = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (argv['watch-content-base']) { options.watchContentBase = true; }
|
||||
|
||||
if (!options.stats) {
|
||||
options.stats = {
|
||||
cached: false,
|
||||
cachedAssets: false
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof options.stats === 'object' && typeof options.stats.colors === 'undefined') {
|
||||
options.stats = Object.assign({}, options.stats, { colors: argv.color });
|
||||
}
|
||||
|
||||
if (argv.lazy) { options.lazy = true; }
|
||||
|
||||
if (!argv.info) { options.noInfo = true; }
|
||||
|
||||
if (argv.quiet) { options.quiet = true; }
|
||||
|
||||
if (argv.https) { options.https = true; }
|
||||
|
||||
if (argv.cert) { options.cert = fs.readFileSync(path.resolve(argv.cert)); }
|
||||
|
||||
if (argv.key) { options.key = fs.readFileSync(path.resolve(argv.key)); }
|
||||
|
||||
if (argv.cacert) { options.ca = fs.readFileSync(path.resolve(argv.cacert)); }
|
||||
|
||||
if (argv.pfx) { options.pfx = fs.readFileSync(path.resolve(argv.pfx)); }
|
||||
|
||||
if (argv['pfx-passphrase']) { options.pfxPassphrase = argv['pfx-passphrase']; }
|
||||
|
||||
if (argv.inline === false) { options.inline = false; }
|
||||
|
||||
if (argv['history-api-fallback']) { options.historyApiFallback = true; }
|
||||
|
||||
if (argv.compress) { options.compress = true; }
|
||||
|
||||
if (argv['disable-host-check']) { options.disableHostCheck = true; }
|
||||
|
||||
if (argv['open-page']) {
|
||||
options.open = true;
|
||||
options.openPage = argv['open-page'];
|
||||
}
|
||||
|
||||
if (typeof argv.open !== 'undefined') {
|
||||
options.open = argv.open !== '' ? argv.open : true;
|
||||
}
|
||||
|
||||
if (options.open && !options.openPage) { options.openPage = ''; }
|
||||
|
||||
if (argv.useLocalIp) { options.useLocalIp = true; }
|
||||
|
||||
// Kind of weird, but ensures prior behavior isn't broken in cases
|
||||
// that wouldn't throw errors. E.g. both argv.port and options.port
|
||||
// were specified, but since argv.port is 8080, options.port will be
|
||||
// tried first instead.
|
||||
options.port = argv.port === DEFAULT_PORT ? defaultTo(options.port, argv.port) : defaultTo(argv.port, options.port);
|
||||
|
||||
if (options.port != null) {
|
||||
startDevServer(webpackOptions, options);
|
||||
return;
|
||||
}
|
||||
const options = createConfig(config, argv, { port: DEFAULT_PORT });
|
||||
|
||||
portfinder.basePort = DEFAULT_PORT;
|
||||
|
||||
if (options.port != null) {
|
||||
startDevServer(config, options);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
portfinder.getPort((err, port) => {
|
||||
if (err) throw err;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
options.port = port;
|
||||
startDevServer(webpackOptions, options);
|
||||
|
||||
startDevServer(config, options);
|
||||
});
|
||||
}
|
||||
|
||||
function startDevServer(webpackOptions, options) {
|
||||
addDevServerEntrypoints(webpackOptions, options);
|
||||
function startDevServer(config, options) {
|
||||
const log = createLogger(options);
|
||||
|
||||
addEntries(config, options);
|
||||
|
||||
let compiler;
|
||||
|
||||
try {
|
||||
compiler = webpack(webpackOptions);
|
||||
} catch (e) {
|
||||
if (e instanceof webpack.WebpackOptionsValidationError) {
|
||||
console.error(colorError(options.stats.colors, e.message));
|
||||
process.exit(1); // eslint-disable-line
|
||||
compiler = webpack(config);
|
||||
} catch (err) {
|
||||
if (err instanceof webpack.WebpackOptionsValidationError) {
|
||||
log.error(colors.error(options.stats.colors, err.message));
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
}
|
||||
throw e;
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (options.progress) {
|
||||
compiler.apply(new webpack.ProgressPlugin({
|
||||
profile: argv.profile
|
||||
}));
|
||||
new webpack.ProgressPlugin({
|
||||
profile: argv.profile,
|
||||
}).apply(compiler);
|
||||
}
|
||||
|
||||
const suffix = (options.inline !== false || options.lazy === true ? '/' : '/webpack-dev-server/');
|
||||
const suffix =
|
||||
options.inline !== false || options.lazy === true
|
||||
? '/'
|
||||
: '/webpack-dev-server/';
|
||||
|
||||
let server;
|
||||
try {
|
||||
server = new Server(compiler, options);
|
||||
} catch (e) {
|
||||
const OptionsValidationError = require('../lib/OptionsValidationError');
|
||||
if (e instanceof OptionsValidationError) {
|
||||
console.error(colorError(options.stats.colors, e.message));
|
||||
process.exit(1); // eslint-disable-line
|
||||
server = new Server(compiler, options, log);
|
||||
} catch (err) {
|
||||
if (err.name === 'ValidationError') {
|
||||
log.error(colors.error(options.stats.colors, err.message));
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
['SIGINT', 'SIGTERM'].forEach((sig) => {
|
||||
process.on(sig, () => {
|
||||
server.close(() => {
|
||||
process.exit(); // eslint-disable-line no-process-exit
|
||||
});
|
||||
});
|
||||
});
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (options.socket) {
|
||||
server.listeningApp.on('error', (e) => {
|
||||
if (e.code === 'EADDRINUSE') {
|
||||
const clientSocket = new net.Socket();
|
||||
clientSocket.on('error', (clientError) => {
|
||||
if (clientError.code === 'ECONNREFUSED') {
|
||||
|
||||
clientSocket.on('error', (err) => {
|
||||
if (err.code === 'ECONNREFUSED') {
|
||||
// No other server listening on this socket so it can be safely removed
|
||||
fs.unlinkSync(options.socket);
|
||||
server.listen(options.socket, options.host, (err) => {
|
||||
if (err) throw err;
|
||||
|
||||
server.listen(options.socket, options.host, (error) => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
clientSocket.connect({ path: options.socket }, () => {
|
||||
throw new Error('This socket is already used');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(options.socket, options.host, (err) => {
|
||||
if (err) throw err;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
// chmod 666 (rw rw rw)
|
||||
const READ_WRITE = 438;
|
||||
fs.chmod(options.socket, READ_WRITE, (fsError) => {
|
||||
if (fsError) throw fsError;
|
||||
|
||||
fs.chmod(options.socket, READ_WRITE, (err) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
const uri = createDomain(options, server.listeningApp) + suffix;
|
||||
reportReadiness(uri, options);
|
||||
|
||||
status(uri, options, log, argv.color);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
server.listen(options.port, options.host, (err) => {
|
||||
if (err) throw err;
|
||||
if (options.bonjour) broadcastZeroconf(options);
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (options.bonjour) {
|
||||
runBonjour(options);
|
||||
}
|
||||
|
||||
const uri = createDomain(options, server.listeningApp) + suffix;
|
||||
reportReadiness(uri, options);
|
||||
|
||||
status(uri, options, log, argv.color);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function reportReadiness(uri, options) {
|
||||
const useColor = argv.color;
|
||||
const contentBase = Array.isArray(options.contentBase) ? options.contentBase.join(', ') : options.contentBase;
|
||||
|
||||
if (!options.quiet) {
|
||||
let startSentence = `Project is running at ${colorInfo(useColor, uri)}`;
|
||||
if (options.socket) {
|
||||
startSentence = `Listening to socket at ${colorInfo(useColor, options.socket)}`;
|
||||
}
|
||||
|
||||
console.log((options.progress ? '\n' : '') + startSentence);
|
||||
|
||||
console.log(`webpack output is served from ${colorInfo(useColor, options.publicPath)}`);
|
||||
|
||||
if (contentBase) { console.log(`Content not from webpack is served from ${colorInfo(useColor, contentBase)}`); }
|
||||
|
||||
if (options.historyApiFallback) { console.log(`404s will fallback to ${colorInfo(useColor, options.historyApiFallback.index || '/index.html')}`); }
|
||||
|
||||
if (options.bonjour) { console.log('Broadcasting "http" with subtype of "webpack" via ZeroConf DNS (Bonjour)'); }
|
||||
}
|
||||
|
||||
if (options.open) {
|
||||
let openOptions = {};
|
||||
let openMessage = 'Unable to open browser';
|
||||
|
||||
if (typeof options.open === 'string') {
|
||||
openOptions = { app: options.open };
|
||||
openMessage += `: ${options.open}`;
|
||||
}
|
||||
|
||||
open(uri + (options.openPage || ''), openOptions).catch(() => {
|
||||
console.log(`${openMessage}. If you are running in a headless environment, please do not use the open flag.`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function broadcastZeroconf(options) {
|
||||
const bonjour = require('bonjour')();
|
||||
bonjour.publish({
|
||||
name: 'Webpack Dev Server',
|
||||
port: options.port,
|
||||
type: 'http',
|
||||
subtypes: ['webpack']
|
||||
});
|
||||
process.on('exit', () => {
|
||||
bonjour.unpublishAll(() => {
|
||||
bonjour.destroy();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
processOptions(wpOpt);
|
||||
processOptions(config);
|
||||
|
||||
2
node_modules/webpack-dev-server/client/index.bundle.js
generated
vendored
2
node_modules/webpack-dev-server/client/index.bundle.js
generated
vendored
File diff suppressed because one or more lines are too long
95
node_modules/webpack-dev-server/client/index.js
generated
vendored
95
node_modules/webpack-dev-server/client/index.js
generated
vendored
@@ -1,12 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
/* global __resourceQuery WorkerGlobalScope self */
|
||||
|
||||
/* eslint prefer-destructuring: off */
|
||||
|
||||
var querystring = require('querystring');
|
||||
|
||||
var url = require('url');
|
||||
|
||||
var stripAnsi = require('strip-ansi');
|
||||
|
||||
var log = require('loglevel').getLogger('webpack-dev-server');
|
||||
|
||||
var socket = require('./socket');
|
||||
|
||||
var overlay = require('./overlay');
|
||||
|
||||
function getCurrentScriptSource() {
|
||||
@@ -14,30 +20,35 @@ function getCurrentScriptSource() {
|
||||
// but is not supported in all browsers.
|
||||
if (document.currentScript) {
|
||||
return document.currentScript.getAttribute('src');
|
||||
}
|
||||
// Fall back to getting all scripts in the document.
|
||||
} // Fall back to getting all scripts in the document.
|
||||
|
||||
|
||||
var scriptElements = document.scripts || [];
|
||||
var currentScript = scriptElements[scriptElements.length - 1];
|
||||
|
||||
if (currentScript) {
|
||||
return currentScript.getAttribute('src');
|
||||
}
|
||||
// Fail as there was no script to use.
|
||||
} // Fail as there was no script to use.
|
||||
|
||||
|
||||
throw new Error('[WDS] Failed to get current script source.');
|
||||
}
|
||||
|
||||
var urlParts = void 0;
|
||||
var urlParts;
|
||||
var hotReload = true;
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
var qs = window.location.search.toLowerCase();
|
||||
hotReload = qs.indexOf('hotreload=false') === -1;
|
||||
}
|
||||
|
||||
if (typeof __resourceQuery === 'string' && __resourceQuery) {
|
||||
// If this bundle is inlined, use the resource query to get the correct url.
|
||||
urlParts = url.parse(__resourceQuery.substr(1));
|
||||
} else {
|
||||
// Else, get the url from the <script> this file was called with.
|
||||
var scriptHost = getCurrentScriptSource();
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
var scriptHost = getCurrentScriptSource(); // eslint-disable-next-line no-useless-escape
|
||||
|
||||
scriptHost = scriptHost.replace(/\/[^\/]+$/, '');
|
||||
urlParts = url.parse(scriptHost || '/', false, true);
|
||||
}
|
||||
@@ -52,20 +63,17 @@ var currentHash = '';
|
||||
var useWarningOverlay = false;
|
||||
var useErrorOverlay = false;
|
||||
var useProgress = false;
|
||||
|
||||
var INFO = 'info';
|
||||
var WARNING = 'warning';
|
||||
var ERROR = 'error';
|
||||
var NONE = 'none';
|
||||
var NONE = 'none'; // Set the default log level
|
||||
|
||||
// Set the default log level
|
||||
log.setDefaultLevel(INFO);
|
||||
log.setDefaultLevel(INFO); // Send messages to the outside, so plugins can consume it.
|
||||
|
||||
// Send messages to the outside, so plugins can consume it.
|
||||
function sendMsg(type, data) {
|
||||
if (typeof self !== 'undefined' && (typeof WorkerGlobalScope === 'undefined' || !(self instanceof WorkerGlobalScope))) {
|
||||
self.postMessage({
|
||||
type: 'webpack' + type,
|
||||
type: "webpack".concat(type),
|
||||
data: data
|
||||
}, '*');
|
||||
}
|
||||
@@ -77,15 +85,14 @@ var onSocketMsg = {
|
||||
log.info('[WDS] Hot Module Replacement enabled.');
|
||||
},
|
||||
invalid: function invalid() {
|
||||
log.info('[WDS] App updated. Recompiling...');
|
||||
// fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
|
||||
log.info('[WDS] App updated. Recompiling...'); // fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
|
||||
|
||||
if (useWarningOverlay || useErrorOverlay) overlay.clear();
|
||||
sendMsg('Invalid');
|
||||
},
|
||||
hash: function hash(_hash) {
|
||||
currentHash = _hash;
|
||||
},
|
||||
|
||||
'still-ok': function stillOk() {
|
||||
log.info('[WDS] Nothing changed.');
|
||||
if (useWarningOverlay || useErrorOverlay) overlay.clear();
|
||||
@@ -93,23 +100,28 @@ var onSocketMsg = {
|
||||
},
|
||||
'log-level': function logLevel(level) {
|
||||
var hotCtx = require.context('webpack/hot', false, /^\.\/log$/);
|
||||
|
||||
if (hotCtx.keys().indexOf('./log') !== -1) {
|
||||
hotCtx('./log').setLogLevel(level);
|
||||
}
|
||||
|
||||
switch (level) {
|
||||
case INFO:
|
||||
case ERROR:
|
||||
log.setLevel(level);
|
||||
break;
|
||||
|
||||
case WARNING:
|
||||
// loglevel's warning name is different from webpack's
|
||||
log.setLevel('warn');
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
log.disableAll();
|
||||
break;
|
||||
|
||||
default:
|
||||
log.error('[WDS] Unknown clientLogLevel \'' + level + '\'');
|
||||
log.error("[WDS] Unknown clientLogLevel '".concat(level, "'"));
|
||||
}
|
||||
},
|
||||
overlay: function overlay(value) {
|
||||
@@ -128,44 +140,52 @@ var onSocketMsg = {
|
||||
useProgress = _progress;
|
||||
}
|
||||
},
|
||||
|
||||
'progress-update': function progressUpdate(data) {
|
||||
if (useProgress) log.info('[WDS] ' + data.percent + '% - ' + data.msg + '.');
|
||||
if (useProgress) log.info("[WDS] ".concat(data.percent, "% - ").concat(data.msg, "."));
|
||||
sendMsg('Progress', data);
|
||||
},
|
||||
ok: function ok() {
|
||||
sendMsg('Ok');
|
||||
if (useWarningOverlay || useErrorOverlay) overlay.clear();
|
||||
if (initial) return initial = false; // eslint-disable-line no-return-assign
|
||||
|
||||
reloadApp();
|
||||
},
|
||||
|
||||
'content-changed': function contentChanged() {
|
||||
log.info('[WDS] Content base changed. Reloading...');
|
||||
self.location.reload();
|
||||
},
|
||||
warnings: function warnings(_warnings) {
|
||||
log.warn('[WDS] Warnings while compiling.');
|
||||
|
||||
var strippedWarnings = _warnings.map(function (warning) {
|
||||
return stripAnsi(warning);
|
||||
});
|
||||
|
||||
sendMsg('Warnings', strippedWarnings);
|
||||
|
||||
for (var i = 0; i < strippedWarnings.length; i++) {
|
||||
log.warn(strippedWarnings[i]);
|
||||
}
|
||||
if (useWarningOverlay) overlay.showMessage(_warnings);
|
||||
|
||||
if (useWarningOverlay) overlay.showMessage(_warnings);
|
||||
if (initial) return initial = false; // eslint-disable-line no-return-assign
|
||||
|
||||
reloadApp();
|
||||
},
|
||||
errors: function errors(_errors) {
|
||||
log.error('[WDS] Errors while compiling. Reload prevented.');
|
||||
|
||||
var strippedErrors = _errors.map(function (error) {
|
||||
return stripAnsi(error);
|
||||
});
|
||||
|
||||
sendMsg('Errors', strippedErrors);
|
||||
|
||||
for (var i = 0; i < strippedErrors.length; i++) {
|
||||
log.error(strippedErrors[i]);
|
||||
}
|
||||
|
||||
if (useErrorOverlay) overlay.showMessage(_errors);
|
||||
initial = false;
|
||||
},
|
||||
@@ -177,11 +197,9 @@ var onSocketMsg = {
|
||||
sendMsg('Close');
|
||||
}
|
||||
};
|
||||
|
||||
var hostname = urlParts.hostname;
|
||||
var protocol = urlParts.protocol;
|
||||
var protocol = urlParts.protocol; // check ipv4 and ipv6 `all hostname`
|
||||
|
||||
// check ipv4 and ipv6 `all hostname`
|
||||
if (hostname === '0.0.0.0' || hostname === '::') {
|
||||
// why do we need this check?
|
||||
// hostname n/a for file protocol (example, when using electron, ionic)
|
||||
@@ -190,12 +208,12 @@ if (hostname === '0.0.0.0' || hostname === '::') {
|
||||
if (self.location.hostname && !!~self.location.protocol.indexOf('http')) {
|
||||
hostname = self.location.hostname;
|
||||
}
|
||||
}
|
||||
|
||||
// `hostname` can be empty when the script path is relative. In that case, specifying
|
||||
} // `hostname` can be empty when the script path is relative. In that case, specifying
|
||||
// a protocol would result in an invalid URL.
|
||||
// When https is used in the app, secure websockets are always necessary
|
||||
// because the browser doesn't accept non-secure websockets.
|
||||
|
||||
|
||||
if (hostname && (self.location.protocol === 'https:' || urlParts.hostname === '0.0.0.0')) {
|
||||
protocol = self.location.protocol;
|
||||
}
|
||||
@@ -205,11 +223,12 @@ var socketUrl = url.format({
|
||||
auth: urlParts.auth,
|
||||
hostname: hostname,
|
||||
port: urlParts.port,
|
||||
pathname: urlParts.path == null || urlParts.path === '/' ? '/sockjs-node' : urlParts.path
|
||||
// If sockPath is provided it'll be passed in via the __resourceQuery as a
|
||||
// query param so it has to be parsed out of the querystring in order for the
|
||||
// client to open the socket to the correct location.
|
||||
pathname: urlParts.path == null || urlParts.path === '/' ? '/sockjs-node' : querystring.parse(urlParts.path).sockPath || urlParts.path
|
||||
});
|
||||
|
||||
socket(socketUrl, onSocketMsg);
|
||||
|
||||
var isUnloading = false;
|
||||
self.addEventListener('beforeunload', function () {
|
||||
isUnloading = true;
|
||||
@@ -219,24 +238,28 @@ function reloadApp() {
|
||||
if (isUnloading || !hotReload) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_hot) {
|
||||
log.info('[WDS] App hot update...');
|
||||
// eslint-disable-next-line global-require
|
||||
log.info('[WDS] App hot update...'); // eslint-disable-next-line global-require
|
||||
|
||||
var hotEmitter = require('webpack/hot/emitter');
|
||||
|
||||
hotEmitter.emit('webpackHotUpdate', currentHash);
|
||||
|
||||
if (typeof self !== 'undefined' && self.window) {
|
||||
// broadcast update to window
|
||||
self.postMessage('webpackHotUpdate' + currentHash, '*');
|
||||
self.postMessage("webpackHotUpdate".concat(currentHash), '*');
|
||||
}
|
||||
} else {
|
||||
var rootWindow = self;
|
||||
// use parent window for reload (in case we're in an iframe with no valid src)
|
||||
var rootWindow = self; // use parent window for reload (in case we're in an iframe with no valid src)
|
||||
|
||||
var intervalId = self.setInterval(function () {
|
||||
if (rootWindow.location.protocol !== 'about:') {
|
||||
// reload immediately if protocol is valid
|
||||
applyReload(rootWindow, intervalId);
|
||||
} else {
|
||||
rootWindow = rootWindow.parent;
|
||||
|
||||
if (rootWindow.parent === rootWindow) {
|
||||
// if parent equals current window we've reached the root which would continue forever, so trigger a reload anyways
|
||||
applyReload(rootWindow, intervalId);
|
||||
|
||||
25
node_modules/webpack-dev-server/client/live.bundle.js
generated
vendored
25
node_modules/webpack-dev-server/client/live.bundle.js
generated
vendored
File diff suppressed because one or more lines are too long
39
node_modules/webpack-dev-server/client/overlay.js
generated
vendored
39
node_modules/webpack-dev-server/client/overlay.js
generated
vendored
@@ -1,13 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
// The error overlay is inspired (and mostly copied) from Create React App (https://github.com/facebookincubator/create-react-app)
|
||||
'use strict'; // The error overlay is inspired (and mostly copied) from Create React App (https://github.com/facebookincubator/create-react-app)
|
||||
// They, in turn, got inspired by webpack-hot-middleware (https://github.com/glenjamin/webpack-hot-middleware).
|
||||
|
||||
var ansiHTML = require('ansi-html');
|
||||
|
||||
var Entities = require('html-entities').AllHtmlEntities;
|
||||
|
||||
var entities = new Entities();
|
||||
|
||||
var colors = {
|
||||
reset: ['transparent', 'transparent'],
|
||||
black: '181818',
|
||||
@@ -71,34 +69,33 @@ function ensureOverlayDivExists(onOverlayDivReady) {
|
||||
// Everything is ready, call the callback right away.
|
||||
onOverlayDivReady(overlayDiv);
|
||||
return;
|
||||
}
|
||||
|
||||
// Creating an iframe may be asynchronous so we'll schedule the callback.
|
||||
} // Creating an iframe may be asynchronous so we'll schedule the callback.
|
||||
// In case of multiple calls, last callback wins.
|
||||
|
||||
|
||||
lastOnOverlayDivReady = onOverlayDivReady;
|
||||
|
||||
if (overlayIframe) {
|
||||
// We're already creating it.
|
||||
return;
|
||||
}
|
||||
} // Create iframe and, when it is ready, a div inside it.
|
||||
|
||||
|
||||
// Create iframe and, when it is ready, a div inside it.
|
||||
overlayIframe = createOverlayIframe(function () {
|
||||
overlayDiv = addOverlayDivTo(overlayIframe);
|
||||
// Now we can talk!
|
||||
lastOnOverlayDivReady(overlayDiv);
|
||||
});
|
||||
overlayDiv = addOverlayDivTo(overlayIframe); // Now we can talk!
|
||||
|
||||
// Zalgo alert: onIframeLoad() will be called either synchronously
|
||||
lastOnOverlayDivReady(overlayDiv);
|
||||
}); // Zalgo alert: onIframeLoad() will be called either synchronously
|
||||
// or asynchronously depending on the browser.
|
||||
// We delay adding it so `overlayIframe` is set when `onIframeLoad` fires.
|
||||
|
||||
document.body.appendChild(overlayIframe);
|
||||
}
|
||||
|
||||
function showMessageOverlay(message) {
|
||||
ensureOverlayDivExists(function (div) {
|
||||
// Make it look similar to our terminal.
|
||||
div.innerHTML = '<span style="color: #' + colors.red + '">Failed to compile.</span><br><br>' + ansiHTML(entities.encode(message));
|
||||
div.innerHTML = "<span style=\"color: #".concat(colors.red, "\">Failed to compile.</span><br><br>").concat(ansiHTML(entities.encode(message)));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,21 +103,21 @@ function destroyErrorOverlay() {
|
||||
if (!overlayDiv) {
|
||||
// It is not there in the first place.
|
||||
return;
|
||||
}
|
||||
} // Clean up and reset internal state.
|
||||
|
||||
|
||||
// Clean up and reset internal state.
|
||||
document.body.removeChild(overlayIframe);
|
||||
overlayDiv = null;
|
||||
overlayIframe = null;
|
||||
lastOnOverlayDivReady = null;
|
||||
}
|
||||
} // Successful compilation.
|
||||
|
||||
|
||||
// Successful compilation.
|
||||
exports.clear = function handleSuccess() {
|
||||
destroyErrorOverlay();
|
||||
};
|
||||
}; // Compilation with errors (e.g. syntax error or missing modules).
|
||||
|
||||
|
||||
// Compilation with errors (e.g. syntax error or missing modules).
|
||||
exports.showMessage = function handleMessage(messages) {
|
||||
showMessageOverlay(messages[0]);
|
||||
};
|
||||
9
node_modules/webpack-dev-server/client/socket.js
generated
vendored
9
node_modules/webpack-dev-server/client/socket.js
generated
vendored
@@ -15,19 +15,17 @@ var socket = function initSocket(url, handlers) {
|
||||
sock.onclose = function onclose() {
|
||||
if (retries === 0) {
|
||||
handlers.close();
|
||||
}
|
||||
} // Try to reconnect.
|
||||
|
||||
// Try to reconnect.
|
||||
sock = null;
|
||||
|
||||
// After 10 retries stop trying, to prevent logspam.
|
||||
sock = null; // After 10 retries stop trying, to prevent logspam.
|
||||
|
||||
if (retries <= 10) {
|
||||
// Exponentially increase timeout to reconnect.
|
||||
// Respectfully copied from the package `got`.
|
||||
// eslint-disable-next-line no-mixed-operators, no-restricted-properties
|
||||
var retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100;
|
||||
retries += 1;
|
||||
|
||||
setTimeout(function () {
|
||||
socket(url, handlers);
|
||||
}, retryInMs);
|
||||
@@ -37,6 +35,7 @@ var socket = function initSocket(url, handlers) {
|
||||
sock.onmessage = function onmessage(e) {
|
||||
// This assumes that all data sent via the websocket is JSON.
|
||||
var msg = JSON.parse(e.data);
|
||||
|
||||
if (handlers[msg.type]) {
|
||||
handlers[msg.type](msg.data);
|
||||
}
|
||||
|
||||
2
node_modules/webpack-dev-server/client/sockjs.bundle.js
generated
vendored
2
node_modules/webpack-dev-server/client/sockjs.bundle.js
generated
vendored
File diff suppressed because one or more lines are too long
152
node_modules/webpack-dev-server/lib/OptionsValidationError.js
generated
vendored
152
node_modules/webpack-dev-server/lib/OptionsValidationError.js
generated
vendored
@@ -1,152 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint no-param-reassign: 'off' */
|
||||
|
||||
const optionsSchema = require('./optionsSchema.json');
|
||||
|
||||
const indent = (str, prefix, firstLine) => {
|
||||
if (firstLine) {
|
||||
return prefix + str.replace(/\n(?!$)/g, `\n${prefix}`);
|
||||
}
|
||||
return str.replace(/\n(?!$)/g, `\n${prefix}`);
|
||||
};
|
||||
|
||||
const getSchemaPart = (path, parents, additionalPath) => {
|
||||
parents = parents || 0;
|
||||
path = path.split('/');
|
||||
path = path.slice(0, path.length - parents);
|
||||
if (additionalPath) {
|
||||
additionalPath = additionalPath.split('/');
|
||||
path = path.concat(additionalPath);
|
||||
}
|
||||
let schemaPart = optionsSchema;
|
||||
for (let i = 1; i < path.length; i++) {
|
||||
const inner = schemaPart[path[i]];
|
||||
if (inner) { schemaPart = inner; }
|
||||
}
|
||||
return schemaPart;
|
||||
};
|
||||
|
||||
const getSchemaPartText = (schemaPart, additionalPath) => {
|
||||
if (additionalPath) {
|
||||
for (let i = 0; i < additionalPath.length; i++) {
|
||||
const inner = schemaPart[additionalPath[i]];
|
||||
if (inner) { schemaPart = inner; }
|
||||
}
|
||||
}
|
||||
while (schemaPart.$ref) schemaPart = getSchemaPart(schemaPart.$ref);
|
||||
let schemaText = OptionsValidationError.formatSchema(schemaPart); // eslint-disable-line
|
||||
if (schemaPart.description) { schemaText += `\n${schemaPart.description}`; }
|
||||
return schemaText;
|
||||
};
|
||||
|
||||
class OptionsValidationError extends Error {
|
||||
constructor(validationErrors) {
|
||||
super();
|
||||
|
||||
if (Error.hasOwnProperty('captureStackTrace')) { // eslint-disable-line
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
this.name = 'WebpackDevServerOptionsValidationError';
|
||||
|
||||
this.message = `${'Invalid configuration object. ' +
|
||||
'webpack-dev-server has been initialised using a configuration object that does not match the API schema.\n'}${
|
||||
validationErrors.map(err => ` - ${indent(OptionsValidationError.formatValidationError(err), ' ', false)}`).join('\n')}`;
|
||||
this.validationErrors = validationErrors;
|
||||
}
|
||||
|
||||
static formatSchema(schema, prevSchemas) {
|
||||
prevSchemas = prevSchemas || [];
|
||||
|
||||
const formatInnerSchema = (innerSchema, addSelf) => {
|
||||
if (!addSelf) return OptionsValidationError.formatSchema(innerSchema, prevSchemas);
|
||||
if (prevSchemas.indexOf(innerSchema) >= 0) return '(recursive)';
|
||||
return OptionsValidationError.formatSchema(innerSchema, prevSchemas.concat(schema));
|
||||
};
|
||||
|
||||
if (schema.type === 'string') {
|
||||
if (schema.minLength === 1) { return 'non-empty string'; } else if (schema.minLength > 1) { return `string (min length ${schema.minLength})`; }
|
||||
return 'string';
|
||||
} else if (schema.type === 'boolean') {
|
||||
return 'boolean';
|
||||
} else if (schema.type === 'number') {
|
||||
return 'number';
|
||||
} else if (schema.type === 'object') {
|
||||
if (schema.properties) {
|
||||
const required = schema.required || [];
|
||||
return `object { ${Object.keys(schema.properties).map((property) => {
|
||||
if (required.indexOf(property) < 0) return `${property}?`;
|
||||
return property;
|
||||
}).concat(schema.additionalProperties ? ['...'] : []).join(', ')} }`;
|
||||
}
|
||||
if (schema.additionalProperties) {
|
||||
return `object { <key>: ${formatInnerSchema(schema.additionalProperties)} }`;
|
||||
}
|
||||
return 'object';
|
||||
} else if (schema.type === 'array') {
|
||||
return `[${formatInnerSchema(schema.items)}]`;
|
||||
}
|
||||
|
||||
switch (schema.instanceof) {
|
||||
case 'Function':
|
||||
return 'function';
|
||||
case 'RegExp':
|
||||
return 'RegExp';
|
||||
default:
|
||||
}
|
||||
|
||||
if (schema.$ref) return formatInnerSchema(getSchemaPart(schema.$ref), true);
|
||||
if (schema.allOf) return schema.allOf.map(formatInnerSchema).join(' & ');
|
||||
if (schema.oneOf) return schema.oneOf.map(formatInnerSchema).join(' | ');
|
||||
if (schema.anyOf) return schema.anyOf.map(formatInnerSchema).join(' | ');
|
||||
if (schema.enum) return schema.enum.map(item => JSON.stringify(item)).join(' | ');
|
||||
return JSON.stringify(schema, 0, 2);
|
||||
}
|
||||
|
||||
static formatValidationError(err) {
|
||||
const dataPath = `configuration${err.dataPath}`;
|
||||
if (err.keyword === 'additionalProperties') {
|
||||
return `${dataPath} has an unknown property '${err.params.additionalProperty}'. These properties are valid:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'oneOf' || err.keyword === 'anyOf') {
|
||||
if (err.children && err.children.length > 0) {
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}\n` +
|
||||
`Details:\n${err.children.map(e => ` * ${indent(OptionsValidationError.formatValidationError(e), ' ', false)}`).join('\n')}`;
|
||||
}
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'enum') {
|
||||
if (err.parentSchema && err.parentSchema.enum && err.parentSchema.enum.length === 1) {
|
||||
return `${dataPath} should be ${getSchemaPartText(err.parentSchema)}`;
|
||||
}
|
||||
return `${dataPath} should be one of these:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'allOf') {
|
||||
return `${dataPath} should be:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'type') {
|
||||
switch (err.params.type) {
|
||||
case 'object':
|
||||
return `${dataPath} should be an object.`;
|
||||
case 'string':
|
||||
return `${dataPath} should be a string.`;
|
||||
case 'boolean':
|
||||
return `${dataPath} should be a boolean.`;
|
||||
case 'number':
|
||||
return `${dataPath} should be a number.`;
|
||||
case 'array':
|
||||
return `${dataPath} should be an array:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
default:
|
||||
}
|
||||
return `${dataPath} should be ${err.params.type}:\n${getSchemaPartText(err.parentSchema)}`;
|
||||
} else if (err.keyword === 'instanceof') {
|
||||
return `${dataPath} should be an instance of ${getSchemaPartText(err.parentSchema)}.`;
|
||||
} else if (err.keyword === 'required') {
|
||||
const missingProperty = err.params.missingProperty.replace(/^\./, '');
|
||||
return `${dataPath} misses the property '${missingProperty}'.\n${getSchemaPartText(err.parentSchema, ['properties', missingProperty])}`;
|
||||
} else if (err.keyword === 'minLength' || err.keyword === 'minItems') {
|
||||
if (err.params.limit === 1) { return `${dataPath} should not be empty.`; }
|
||||
return `${dataPath} ${err.message}`;
|
||||
}
|
||||
// eslint-disable-line no-fallthrough
|
||||
return `${dataPath} ${err.message} (${JSON.stringify(err, 0, 2)}).\n${getSchemaPartText(err.parentSchema)}`;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OptionsValidationError;
|
||||
1581
node_modules/webpack-dev-server/lib/Server.js
generated
vendored
1581
node_modules/webpack-dev-server/lib/Server.js
generated
vendored
File diff suppressed because it is too large
Load Diff
336
node_modules/webpack-dev-server/lib/optionsSchema.json
generated
vendored
336
node_modules/webpack-dev-server/lib/optionsSchema.json
generated
vendored
@@ -1,336 +0,0 @@
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"hot": {
|
||||
"description": "Enables Hot Module Replacement.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"hotOnly": {
|
||||
"description": "Enables Hot Module Replacement without page refresh as fallback.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"lazy": {
|
||||
"description": "Disables watch mode and recompiles bundle only on a request.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"bonjour": {
|
||||
"description": "Publishes the ZeroConf DNS service",
|
||||
"type": "boolean"
|
||||
},
|
||||
"host": {
|
||||
"description": "The host the server listens to.",
|
||||
"type": "string"
|
||||
},
|
||||
"allowedHosts": {
|
||||
"description": "Specifies which hosts are allowed to access the dev server.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"filename": {
|
||||
"description": "The filename that needs to be requested in order to trigger a recompile (only in lazy mode).",
|
||||
"anyOf": [
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"publicPath": {
|
||||
"description": "URL path where the webpack files are served from.",
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"description": "The port the server listens to.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"socket": {
|
||||
"description": "The Unix socket to listen to (instead of on a host).",
|
||||
"type": "string"
|
||||
},
|
||||
"watchOptions": {
|
||||
"description": "Options for changing the watch behavior.",
|
||||
"type": "object"
|
||||
},
|
||||
"headers": {
|
||||
"description": "Response headers that are added to each response.",
|
||||
"type": "object"
|
||||
},
|
||||
"clientLogLevel": {
|
||||
"description": "Controls the log messages shown in the browser.",
|
||||
"enum": [
|
||||
"none",
|
||||
"info",
|
||||
"warning",
|
||||
"error"
|
||||
]
|
||||
},
|
||||
"overlay": {
|
||||
"description": "Shows an error overlay in browser.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errors": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"warnings": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"progress": {
|
||||
"description": "Shows compilation progress in browser console.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"key": {
|
||||
"description": "The contents of a SSL key.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cert": {
|
||||
"description": "The contents of a SSL certificate.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ca": {
|
||||
"description": "The contents of a SSL CA certificate.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pfx": {
|
||||
"description": "The contents of a SSL pfx file.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pfxPassphrase": {
|
||||
"description": "The passphrase to a (SSL) PFX file.",
|
||||
"type": "string"
|
||||
},
|
||||
"requestCert": {
|
||||
"description": "Enables request for client certificate. This is passed directly to the https server.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"inline": {
|
||||
"description": "Enable inline mode to include client scripts in bundle (CLI-only).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableHostCheck": {
|
||||
"description": "Disable the Host header check (Security).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"public": {
|
||||
"description": "The public hostname/ip address of the server.",
|
||||
"type": "string"
|
||||
},
|
||||
"https": {
|
||||
"description": "Enable HTTPS for server.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"contentBase": {
|
||||
"description": "A directory to serve files non-webpack files from.",
|
||||
"anyOf": [
|
||||
{
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": 1,
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
false
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"watchContentBase": {
|
||||
"description": "Watches the contentBase directory for changes.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"open": {
|
||||
"description": "Let the CLI open your browser with the URL.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"useLocalIp": {
|
||||
"description": "Let the browser open with your local IP.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"openPage": {
|
||||
"description": "Let the CLI open your browser to a specific page on the site.",
|
||||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"description": "The order of which the features will be triggered.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"compress": {
|
||||
"description": "Gzip compression for all requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"proxy": {
|
||||
"description": "Proxy requests to another server.",
|
||||
"anyOf": [
|
||||
{
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minItems": 1,
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"historyApiFallback": {
|
||||
"description": "404 fallback to a specified file.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"staticOptions": {
|
||||
"description": "Options for static files served with contentBase.",
|
||||
"type": "object"
|
||||
},
|
||||
"setup": {
|
||||
"description": "Exposes the Express server to add custom middleware or routes.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"before": {
|
||||
"description": "Exposes the Express server to add custom middleware or routes before webpack-dev-middleware will be added.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"after": {
|
||||
"description": "Exposes the Express server to add custom middleware or routes after webpack-dev-middleware got added.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"stats": {
|
||||
"description": "Decides what bundle information is displayed.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"none",
|
||||
"errors-only",
|
||||
"minimal",
|
||||
"normal",
|
||||
"verbose"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"reporter": {
|
||||
"description": "Customize what the console displays when compiling.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"reportTime": {
|
||||
"description": "Report time before and after compiling in console displays.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"noInfo": {
|
||||
"description": "Hide all info messages on console.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"quiet": {
|
||||
"description": "Hide all messages on console.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"serverSideRender": {
|
||||
"description": "Expose stats for server side rendering (experimental).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"index": {
|
||||
"description": "The filename that is considered the index file.",
|
||||
"type": "string"
|
||||
},
|
||||
"log": {
|
||||
"description": "Customize info logs for webpack-dev-middleware.",
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"warn": {
|
||||
"description": "Customize warn logs for webpack-dev-middleware.",
|
||||
"instanceof": "Function"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
8
node_modules/webpack-dev-server/lib/polyfills.js
generated
vendored
8
node_modules/webpack-dev-server/lib/polyfills.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/* polyfills for Node 4.8.x users */
|
||||
|
||||
// internal-ip@2.x uses [].includes
|
||||
const includes = require('array-includes');
|
||||
|
||||
includes.shim();
|
||||
40
node_modules/webpack-dev-server/lib/util/addDevServerEntrypoints.js
generated
vendored
40
node_modules/webpack-dev-server/lib/util/addDevServerEntrypoints.js
generated
vendored
@@ -1,40 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint no-param-reassign: 'off' */
|
||||
|
||||
const createDomain = require('./createDomain');
|
||||
|
||||
module.exports = function addDevServerEntrypoints(webpackOptions, devServerOptions, listeningApp) {
|
||||
if (devServerOptions.inline !== false) {
|
||||
// we're stubbing the app in this method as it's static and doesn't require
|
||||
// a listeningApp to be supplied. createDomain requires an app with the
|
||||
// address() signature.
|
||||
const app = listeningApp || {
|
||||
address() {
|
||||
return { port: devServerOptions.port };
|
||||
}
|
||||
};
|
||||
const domain = createDomain(devServerOptions, app);
|
||||
const devClient = [`${require.resolve('../../client/')}?${domain}`];
|
||||
|
||||
if (devServerOptions.hotOnly) { devClient.push('webpack/hot/only-dev-server'); } else if (devServerOptions.hot) { devClient.push('webpack/hot/dev-server'); }
|
||||
|
||||
const prependDevClient = (entry) => {
|
||||
if (typeof entry === 'function') {
|
||||
return () => Promise.resolve(entry()).then(prependDevClient);
|
||||
}
|
||||
if (typeof entry === 'object' && !Array.isArray(entry)) {
|
||||
const entryClone = {};
|
||||
Object.keys(entry).forEach((key) => {
|
||||
entryClone[key] = devClient.concat(entry[key]);
|
||||
});
|
||||
return entryClone;
|
||||
}
|
||||
return devClient.concat(entry);
|
||||
};
|
||||
|
||||
[].concat(webpackOptions).forEach((wpOpt) => {
|
||||
wpOpt.entry = prependDevClient(wpOpt.entry);
|
||||
});
|
||||
}
|
||||
};
|
||||
23
node_modules/webpack-dev-server/lib/util/createDomain.js
generated
vendored
23
node_modules/webpack-dev-server/lib/util/createDomain.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const url = require('url');
|
||||
const internalIp = require('internal-ip');
|
||||
|
||||
|
||||
module.exports = function createDomain(options, listeningApp) {
|
||||
const protocol = options.https ? 'https' : 'http';
|
||||
const appPort = listeningApp ? listeningApp.address().port : 0;
|
||||
const port = options.socket ? 0 : appPort;
|
||||
const hostname = options.useLocalIp ? internalIp.v4() : options.host;
|
||||
|
||||
// use explicitly defined public url (prefix with protocol if not explicitly given)
|
||||
if (options.public) {
|
||||
return /^[a-zA-Z]+:\/\//.test(options.public) ? `${options.public}` : `${protocol}://${options.public}`;
|
||||
}
|
||||
// the formatted domain (url without path) of the webpack server
|
||||
return url.format({
|
||||
protocol,
|
||||
hostname,
|
||||
port
|
||||
});
|
||||
};
|
||||
62
node_modules/webpack-dev-server/node_modules/camelcase/index.js
generated
vendored
62
node_modules/webpack-dev-server/node_modules/camelcase/index.js
generated
vendored
@@ -1,31 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
function preserveCamelCase(str) {
|
||||
var isLastCharLower = false;
|
||||
let isLastCharLower = false;
|
||||
let isLastCharUpper = false;
|
||||
let isLastLastCharUpper = false;
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var c = str.charAt(i);
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const c = str[i];
|
||||
|
||||
if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) {
|
||||
if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) {
|
||||
str = str.substr(0, i) + '-' + str.substr(i);
|
||||
isLastCharLower = false;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = true;
|
||||
i++;
|
||||
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) {
|
||||
str = str.substr(0, i - 1) + '-' + str.substr(i - 1);
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = false;
|
||||
isLastCharLower = true;
|
||||
} else {
|
||||
isLastCharLower = (c.toLowerCase() === c);
|
||||
isLastCharLower = c.toLowerCase() === c;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = c.toUpperCase() === c;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
var str = [].map.call(arguments, function (str) {
|
||||
return str.trim();
|
||||
}).filter(function (str) {
|
||||
return str.length;
|
||||
}).join('-');
|
||||
module.exports = function (str) {
|
||||
if (arguments.length > 1) {
|
||||
str = Array.from(arguments)
|
||||
.map(x => x.trim())
|
||||
.filter(x => x.length)
|
||||
.join('-');
|
||||
} else {
|
||||
str = str.trim();
|
||||
}
|
||||
|
||||
if (!str.length) {
|
||||
if (str.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -33,24 +47,18 @@ module.exports = function () {
|
||||
return str.toLowerCase();
|
||||
}
|
||||
|
||||
if (!(/[_.\- ]+/).test(str)) {
|
||||
if (str === str.toUpperCase()) {
|
||||
return str.toLowerCase();
|
||||
}
|
||||
|
||||
if (str[0] !== str[0].toLowerCase()) {
|
||||
return str[0].toLowerCase() + str.slice(1);
|
||||
}
|
||||
|
||||
if (/^[a-z0-9]+$/.test(str)) {
|
||||
return str;
|
||||
}
|
||||
|
||||
str = preserveCamelCase(str);
|
||||
const hasUpperCase = str !== str.toLowerCase();
|
||||
|
||||
if (hasUpperCase) {
|
||||
str = preserveCamelCase(str);
|
||||
}
|
||||
|
||||
return str
|
||||
.replace(/^[_.\- ]+/, '')
|
||||
.toLowerCase()
|
||||
.replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
|
||||
return p1.toUpperCase();
|
||||
});
|
||||
.replace(/^[_.\- ]+/, '')
|
||||
.toLowerCase()
|
||||
.replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase());
|
||||
};
|
||||
|
||||
30
node_modules/webpack-dev-server/node_modules/camelcase/package.json
generated
vendored
30
node_modules/webpack-dev-server/node_modules/camelcase/package.json
generated
vendored
@@ -1,32 +1,31 @@
|
||||
{
|
||||
"_from": "camelcase@^3.0.0",
|
||||
"_id": "camelcase@3.0.0",
|
||||
"_from": "camelcase@^4.1.0",
|
||||
"_id": "camelcase@4.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
|
||||
"_integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
|
||||
"_location": "/webpack-dev-server/camelcase",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "camelcase@^3.0.0",
|
||||
"raw": "camelcase@^4.1.0",
|
||||
"name": "camelcase",
|
||||
"escapedName": "camelcase",
|
||||
"rawSpec": "^3.0.0",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-dev-server/yargs",
|
||||
"/webpack-dev-server/yargs-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
|
||||
"_shasum": "32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a",
|
||||
"_spec": "camelcase@^3.0.0",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server\\node_modules\\yargs",
|
||||
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
|
||||
"_shasum": "d545635be1e33c542649c69173e5de6acfae34dd",
|
||||
"_spec": "camelcase@^4.1.0",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server\\node_modules\\yargs-parser",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/camelcase/issues"
|
||||
@@ -39,7 +38,7 @@
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
@@ -68,5 +67,8 @@
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
"version": "4.1.0",
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
|
||||
2
node_modules/webpack-dev-server/node_modules/camelcase/readme.md
generated
vendored
2
node_modules/webpack-dev-server/node_modules/camelcase/readme.md
generated
vendored
@@ -54,4 +54,4 @@ camelCase('__foo__', '--bar');
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
|
||||
46
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/index.js
generated
vendored
46
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/index.js
generated
vendored
@@ -1,46 +0,0 @@
|
||||
'use strict';
|
||||
var numberIsNan = require('number-is-nan');
|
||||
|
||||
module.exports = function (x) {
|
||||
if (numberIsNan(x)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
|
||||
|
||||
// code points are derived from:
|
||||
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
|
||||
if (x >= 0x1100 && (
|
||||
x <= 0x115f || // Hangul Jamo
|
||||
0x2329 === x || // LEFT-POINTING ANGLE BRACKET
|
||||
0x232a === x || // RIGHT-POINTING ANGLE BRACKET
|
||||
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
||||
(0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
|
||||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
||||
0x3250 <= x && x <= 0x4dbf ||
|
||||
// CJK Unified Ideographs .. Yi Radicals
|
||||
0x4e00 <= x && x <= 0xa4c6 ||
|
||||
// Hangul Jamo Extended-A
|
||||
0xa960 <= x && x <= 0xa97c ||
|
||||
// Hangul Syllables
|
||||
0xac00 <= x && x <= 0xd7a3 ||
|
||||
// CJK Compatibility Ideographs
|
||||
0xf900 <= x && x <= 0xfaff ||
|
||||
// Vertical Forms
|
||||
0xfe10 <= x && x <= 0xfe19 ||
|
||||
// CJK Compatibility Forms .. Small Form Variants
|
||||
0xfe30 <= x && x <= 0xfe6b ||
|
||||
// Halfwidth and Fullwidth Forms
|
||||
0xff01 <= x && x <= 0xff60 ||
|
||||
0xffe0 <= x && x <= 0xffe6 ||
|
||||
// Kana Supplement
|
||||
0x1b000 <= x && x <= 0x1b001 ||
|
||||
// Enclosed Ideographic Supplement
|
||||
0x1f200 <= x && x <= 0x1f251 ||
|
||||
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
||||
0x20000 <= x && x <= 0x3fffd)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
21
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/license
generated
vendored
21
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
77
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/package.json
generated
vendored
77
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/package.json
generated
vendored
@@ -1,77 +0,0 @@
|
||||
{
|
||||
"_from": "is-fullwidth-code-point@^1.0.0",
|
||||
"_id": "is-fullwidth-code-point@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||
"_location": "/webpack-dev-server/is-fullwidth-code-point",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-fullwidth-code-point@^1.0.0",
|
||||
"name": "is-fullwidth-code-point",
|
||||
"escapedName": "is-fullwidth-code-point",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-dev-server/string-width"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||
"_shasum": "ef9e31386f031a7f0d643af82fde50c457ef00cb",
|
||||
"_spec": "is-fullwidth-code-point@^1.0.0",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server\\node_modules\\string-width",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Check if the character represented by a given Unicode code point is fullwidth",
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4",
|
||||
"code-point-at": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme",
|
||||
"keywords": [
|
||||
"fullwidth",
|
||||
"full-width",
|
||||
"full",
|
||||
"width",
|
||||
"unicode",
|
||||
"character",
|
||||
"char",
|
||||
"string",
|
||||
"str",
|
||||
"codepoint",
|
||||
"code",
|
||||
"point",
|
||||
"is",
|
||||
"detect",
|
||||
"check"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "is-fullwidth-code-point",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
39
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/readme.md
generated
vendored
39
node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point/readme.md
generated
vendored
@@ -1,39 +0,0 @@
|
||||
# is-fullwidth-code-point [](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)
|
||||
|
||||
> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save is-fullwidth-code-point
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isFullwidthCodePoint = require('is-fullwidth-code-point');
|
||||
|
||||
isFullwidthCodePoint('谢'.codePointAt());
|
||||
//=> true
|
||||
|
||||
isFullwidthCodePoint('a'.codePointAt());
|
||||
//=> false
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### isFullwidthCodePoint(input)
|
||||
|
||||
#### input
|
||||
|
||||
Type: `number`
|
||||
|
||||
[Code point](https://en.wikipedia.org/wiki/Code_point) of a character.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
37
node_modules/webpack-dev-server/node_modules/string-width/index.js
generated
vendored
37
node_modules/webpack-dev-server/node_modules/string-width/index.js
generated
vendored
@@ -1,37 +0,0 @@
|
||||
'use strict';
|
||||
var stripAnsi = require('strip-ansi');
|
||||
var codePointAt = require('code-point-at');
|
||||
var isFullwidthCodePoint = require('is-fullwidth-code-point');
|
||||
|
||||
// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string' || str.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var width = 0;
|
||||
|
||||
str = stripAnsi(str);
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var code = codePointAt(str, i);
|
||||
|
||||
// ignore control characters
|
||||
if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// surrogates
|
||||
if (code >= 0x10000) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (isFullwidthCodePoint(code)) {
|
||||
width += 2;
|
||||
} else {
|
||||
width++;
|
||||
}
|
||||
}
|
||||
|
||||
return width;
|
||||
};
|
||||
21
node_modules/webpack-dev-server/node_modules/string-width/license
generated
vendored
21
node_modules/webpack-dev-server/node_modules/string-width/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
88
node_modules/webpack-dev-server/node_modules/string-width/package.json
generated
vendored
88
node_modules/webpack-dev-server/node_modules/string-width/package.json
generated
vendored
@@ -1,88 +0,0 @@
|
||||
{
|
||||
"_from": "string-width@^1.0.2",
|
||||
"_id": "string-width@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||
"_location": "/webpack-dev-server/string-width",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "string-width@^1.0.2",
|
||||
"name": "string-width",
|
||||
"escapedName": "string-width",
|
||||
"rawSpec": "^1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-dev-server/yargs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
"_shasum": "118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3",
|
||||
"_spec": "string-width@^1.0.2",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server\\node_modules\\yargs",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/string-width/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
"strip-ansi": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get the visual width of a string - the number of columns required to display it",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/string-width#readme",
|
||||
"keywords": [
|
||||
"string",
|
||||
"str",
|
||||
"character",
|
||||
"char",
|
||||
"unicode",
|
||||
"width",
|
||||
"visual",
|
||||
"column",
|
||||
"columns",
|
||||
"fullwidth",
|
||||
"full-width",
|
||||
"full",
|
||||
"ansi",
|
||||
"escape",
|
||||
"codes",
|
||||
"cli",
|
||||
"command-line",
|
||||
"terminal",
|
||||
"console",
|
||||
"cjk",
|
||||
"chinese",
|
||||
"japanese",
|
||||
"korean",
|
||||
"fixed-width"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "string-width",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/string-width.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
||||
42
node_modules/webpack-dev-server/node_modules/string-width/readme.md
generated
vendored
42
node_modules/webpack-dev-server/node_modules/string-width/readme.md
generated
vendored
@@ -1,42 +0,0 @@
|
||||
# string-width [](https://travis-ci.org/sindresorhus/string-width)
|
||||
|
||||
> Get the visual width of a string - the number of columns required to display it
|
||||
|
||||
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
||||
|
||||
Useful to be able to measure the actual width of command-line output.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save string-width
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const stringWidth = require('string-width');
|
||||
|
||||
stringWidth('古');
|
||||
//=> 2
|
||||
|
||||
stringWidth('\u001b[1m古\u001b[22m');
|
||||
//=> 2
|
||||
|
||||
stringWidth('a');
|
||||
//=> 1
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
|
||||
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
|
||||
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
199
node_modules/webpack-dev-server/node_modules/yargs-parser/CHANGELOG.md
generated
vendored
199
node_modules/webpack-dev-server/node_modules/yargs-parser/CHANGELOG.md
generated
vendored
@@ -2,6 +2,205 @@
|
||||
|
||||
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.
|
||||
|
||||
<a name="10.1.0"></a>
|
||||
# [10.1.0](https://github.com/yargs/yargs-parser/compare/v10.0.0...v10.1.0) (2018-06-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `set-placeholder-key` configuration ([#123](https://github.com/yargs/yargs-parser/issues/123)) ([19386ee](https://github.com/yargs/yargs-parser/commit/19386ee))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.0"></a>
|
||||
# [10.0.0](https://github.com/yargs/yargs-parser/compare/v9.0.2...v10.0.0) (2018-04-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not set boolean flags if not defined in `argv` ([#119](https://github.com/yargs/yargs-parser/issues/119)) ([f6e6599](https://github.com/yargs/yargs-parser/commit/f6e6599))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* `boolean` flags defined without a `default` value will now behave like other option type and won't be set in the parsed results when the user doesn't set the corresponding CLI arg.
|
||||
|
||||
Previous behavior:
|
||||
```js
|
||||
var parse = require('yargs-parser');
|
||||
|
||||
parse('--flag', {boolean: ['flag']});
|
||||
// => { _: [], flag: true }
|
||||
|
||||
parse('--no-flag', {boolean: ['flag']});
|
||||
// => { _: [], flag: false }
|
||||
|
||||
parse('', {boolean: ['flag']});
|
||||
// => { _: [], flag: false }
|
||||
```
|
||||
|
||||
New behavior:
|
||||
```js
|
||||
var parse = require('yargs-parser');
|
||||
|
||||
parse('--flag', {boolean: ['flag']});
|
||||
// => { _: [], flag: true }
|
||||
|
||||
parse('--no-flag', {boolean: ['flag']});
|
||||
// => { _: [], flag: false }
|
||||
|
||||
parse('', {boolean: ['flag']});
|
||||
// => { _: [] } => flag not set similarly to other option type
|
||||
```
|
||||
|
||||
|
||||
|
||||
<a name="9.0.2"></a>
|
||||
## [9.0.2](https://github.com/yargs/yargs-parser/compare/v9.0.1...v9.0.2) (2018-01-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* nargs was still aggressively consuming too many arguments ([9b28aad](https://github.com/yargs/yargs-parser/commit/9b28aad))
|
||||
|
||||
|
||||
|
||||
<a name="9.0.1"></a>
|
||||
## [9.0.1](https://github.com/yargs/yargs-parser/compare/v9.0.0...v9.0.1) (2018-01-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* nargs was consuming too many arguments ([4fef206](https://github.com/yargs/yargs-parser/commit/4fef206))
|
||||
|
||||
|
||||
|
||||
<a name="9.0.0"></a>
|
||||
# [9.0.0](https://github.com/yargs/yargs-parser/compare/v8.1.0...v9.0.0) (2018-01-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* narg arguments no longer consume flag arguments ([#114](https://github.com/yargs/yargs-parser/issues/114)) ([60bb9b3](https://github.com/yargs/yargs-parser/commit/60bb9b3))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* arguments of form --foo, -abc, will no longer be consumed by nargs
|
||||
|
||||
|
||||
|
||||
<a name="8.1.0"></a>
|
||||
# [8.1.0](https://github.com/yargs/yargs-parser/compare/v8.0.0...v8.1.0) (2017-12-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow null config values ([#108](https://github.com/yargs/yargs-parser/issues/108)) ([d8b14f9](https://github.com/yargs/yargs-parser/commit/d8b14f9))
|
||||
* ensure consistent parsing of dot-notation arguments ([#102](https://github.com/yargs/yargs-parser/issues/102)) ([c9bd79c](https://github.com/yargs/yargs-parser/commit/c9bd79c))
|
||||
* implement [@antoniom](https://github.com/antoniom)'s fix for camel-case expansion ([3087e1d](https://github.com/yargs/yargs-parser/commit/3087e1d))
|
||||
* only run coercion functions once, despite aliases. ([#76](https://github.com/yargs/yargs-parser/issues/76)) ([#103](https://github.com/yargs/yargs-parser/issues/103)) ([507aaef](https://github.com/yargs/yargs-parser/commit/507aaef))
|
||||
* scientific notation circumvented bounds check ([#110](https://github.com/yargs/yargs-parser/issues/110)) ([3571f57](https://github.com/yargs/yargs-parser/commit/3571f57))
|
||||
* tokenizer should ignore spaces at the beginning of the argString ([#106](https://github.com/yargs/yargs-parser/issues/106)) ([f34ead9](https://github.com/yargs/yargs-parser/commit/f34ead9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make combining arrays a configurable option ([#111](https://github.com/yargs/yargs-parser/issues/111)) ([c8bf536](https://github.com/yargs/yargs-parser/commit/c8bf536))
|
||||
* merge array from arguments with array from config ([#83](https://github.com/yargs/yargs-parser/issues/83)) ([806ddd6](https://github.com/yargs/yargs-parser/commit/806ddd6))
|
||||
|
||||
|
||||
|
||||
<a name="8.0.0"></a>
|
||||
# [8.0.0](https://github.com/yargs/yargs-parser/compare/v7.0.0...v8.0.0) (2017-10-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Ignore multiple spaces between arguments. ([#100](https://github.com/yargs/yargs-parser/issues/100)) ([d137227](https://github.com/yargs/yargs-parser/commit/d137227))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow configuration of prefix for boolean negation ([#94](https://github.com/yargs/yargs-parser/issues/94)) ([00bde7d](https://github.com/yargs/yargs-parser/commit/00bde7d))
|
||||
* reworking how numbers are parsed ([#104](https://github.com/yargs/yargs-parser/issues/104)) ([fba00eb](https://github.com/yargs/yargs-parser/commit/fba00eb))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* strings that fail `Number.isSafeInteger()` are no longer coerced into numbers.
|
||||
|
||||
|
||||
|
||||
<a name="7.0.0"></a>
|
||||
# [7.0.0](https://github.com/yargs/yargs-parser/compare/v6.0.1...v7.0.0) (2017-05-02)
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* revert populate-- logic ([#91](https://github.com/yargs/yargs-parser/issues/91)) ([6003e6d](https://github.com/yargs/yargs-parser/commit/6003e6d))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* populate-- now defaults to false.
|
||||
|
||||
|
||||
|
||||
<a name="6.0.1"></a>
|
||||
## [6.0.1](https://github.com/yargs/yargs-parser/compare/v6.0.0...v6.0.1) (2017-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* default '--' to undefined when not provided; this is closer to the array API ([#90](https://github.com/yargs/yargs-parser/issues/90)) ([4e739cc](https://github.com/yargs/yargs-parser/commit/4e739cc))
|
||||
|
||||
|
||||
|
||||
<a name="6.0.0"></a>
|
||||
# [6.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v6.0.0) (2017-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f))
|
||||
* parsing hints should apply for dot notation keys ([#86](https://github.com/yargs/yargs-parser/issues/86)) ([3e47d62](https://github.com/yargs/yargs-parser/commit/3e47d62))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade to newest version of camelcase ([#87](https://github.com/yargs/yargs-parser/issues/87)) ([f1903aa](https://github.com/yargs/yargs-parser/commit/f1903aa))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add -- option which allows arguments after the -- flag to be returned separated from positional arguments ([#84](https://github.com/yargs/yargs-parser/issues/84)) ([2572ca8](https://github.com/yargs/yargs-parser/commit/2572ca8))
|
||||
* when parsing stops, we now populate "--" by default ([#88](https://github.com/yargs/yargs-parser/issues/88)) ([cd666db](https://github.com/yargs/yargs-parser/commit/cd666db))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* rather than placing arguments in "_", when parsing is stopped via "--"; we now populate an array called "--" by default.
|
||||
* camelcase now requires Node 4+.
|
||||
* environment variables will now override config files (args, env, config-file, config-object)
|
||||
|
||||
|
||||
|
||||
<a name="5.0.0"></a>
|
||||
# [5.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v5.0.0) (2017-02-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* environment variables will now override config files (args, env, config-file, config-object)
|
||||
|
||||
|
||||
|
||||
<a name="4.2.1"></a>
|
||||
## [4.2.1](https://github.com/yargs/yargs-parser/compare/v4.2.0...v4.2.1) (2017-01-02)
|
||||
|
||||
|
||||
74
node_modules/webpack-dev-server/node_modules/yargs-parser/README.md
generated
vendored
74
node_modules/webpack-dev-server/node_modules/yargs-parser/README.md
generated
vendored
@@ -11,7 +11,7 @@ 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="yargs-logo.png">
|
||||
<img width="250" src="https://raw.githubusercontent.com/yargs/yargs-parser/master/yargs-logo.png">
|
||||
|
||||
## Example
|
||||
|
||||
@@ -72,12 +72,14 @@ Parses command line arguments returning a simple mapping of keys and values.
|
||||
* `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).
|
||||
* `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).
|
||||
* `opts.number`: keys should be treated as numbers.
|
||||
* `opts['--']`: arguments after the end-of-options flag `--` will be set to the `argv.['--']` array instead of being set to the `argv._` array.
|
||||
|
||||
**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={})
|
||||
|
||||
@@ -100,6 +102,7 @@ yargs engine.
|
||||
* `configuration`: the configuration loaded from the `yargs` stanza in package.json.
|
||||
|
||||
<a name="configuration"></a>
|
||||
|
||||
### Configuration
|
||||
|
||||
The yargs-parser applies several automated transformations on the keys provided
|
||||
@@ -209,6 +212,14 @@ 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`
|
||||
@@ -247,6 +258,67 @@ node example.js -x 1 2 -x 3 4
|
||||
{ _: [], x: [[1, 2], [3, 4]] }
|
||||
```
|
||||
|
||||
### negation prefix
|
||||
|
||||
* default: `no-`
|
||||
* key: `negation-prefix`
|
||||
|
||||
The prefix to use for negated boolean variables.
|
||||
|
||||
```sh
|
||||
node example.js --no-foo
|
||||
{ _: [], foo: false }
|
||||
```
|
||||
|
||||
_if set to `quux`:_
|
||||
|
||||
```sh
|
||||
node example.js --quuxfoo
|
||||
{ _: [], foo: false }
|
||||
```
|
||||
|
||||
### populate --
|
||||
|
||||
* default: `false`.
|
||||
* key: `populate--`
|
||||
|
||||
Should unparsed flags be stored in `--` or `_`.
|
||||
|
||||
_If disabled:_
|
||||
|
||||
```sh
|
||||
node example.js a -b -- x y
|
||||
{ _: [ 'a', 'x', 'y' ], b: true }
|
||||
```
|
||||
|
||||
_If enabled:_
|
||||
|
||||
```sh
|
||||
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:_
|
||||
|
||||
```sh
|
||||
node example.js -a 1 -c 2
|
||||
{ _: [], a: 1, c: 2 }
|
||||
```
|
||||
|
||||
_If enabled:_
|
||||
|
||||
```sh
|
||||
node example.js -a 1 -c 2
|
||||
{ _: [], a: 1, b: undefined, c: 2 }
|
||||
```
|
||||
|
||||
## Special Thanks
|
||||
|
||||
The yargs project evolves from optimist and minimist. It owes its
|
||||
|
||||
158
node_modules/webpack-dev-server/node_modules/yargs-parser/index.js
generated
vendored
158
node_modules/webpack-dev-server/node_modules/yargs-parser/index.js
generated
vendored
@@ -16,12 +16,18 @@ function parse (args, opts) {
|
||||
'dot-notation': true,
|
||||
'parse-numbers': true,
|
||||
'boolean-negation': true,
|
||||
'negation-prefix': 'no-',
|
||||
'duplicate-arguments-array': true,
|
||||
'flatten-duplicate-arrays': true
|
||||
'flatten-duplicate-arrays': true,
|
||||
'populate--': false,
|
||||
'combine-arrays': false,
|
||||
'set-placeholder-key': false
|
||||
}, opts.configuration)
|
||||
var defaults = opts.default || {}
|
||||
var configObjects = opts.configObjects || []
|
||||
var envPrefix = opts.envPrefix
|
||||
var notFlagsOption = configuration['populate--']
|
||||
var notFlagsArgv = notFlagsOption ? '--' : '_'
|
||||
var newAliases = {}
|
||||
// allow a i18n handler to be passed in, default to a fake one (util.format).
|
||||
var __ = opts.__ || function (str) {
|
||||
@@ -39,40 +45,50 @@ function parse (args, opts) {
|
||||
configs: {},
|
||||
defaulted: {},
|
||||
nargs: {},
|
||||
coercions: {}
|
||||
coercions: {},
|
||||
keys: []
|
||||
}
|
||||
var negative = /^-[0-9]+(\.[0-9]+)?/
|
||||
var negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)')
|
||||
|
||||
;[].concat(opts.array).filter(Boolean).forEach(function (key) {
|
||||
flags.arrays[key] = true
|
||||
flags.keys.push(key)
|
||||
})
|
||||
|
||||
;[].concat(opts.boolean).filter(Boolean).forEach(function (key) {
|
||||
flags.bools[key] = true
|
||||
flags.keys.push(key)
|
||||
})
|
||||
|
||||
;[].concat(opts.string).filter(Boolean).forEach(function (key) {
|
||||
flags.strings[key] = true
|
||||
flags.keys.push(key)
|
||||
})
|
||||
|
||||
;[].concat(opts.number).filter(Boolean).forEach(function (key) {
|
||||
flags.numbers[key] = true
|
||||
flags.keys.push(key)
|
||||
})
|
||||
|
||||
;[].concat(opts.count).filter(Boolean).forEach(function (key) {
|
||||
flags.counts[key] = true
|
||||
flags.keys.push(key)
|
||||
})
|
||||
|
||||
;[].concat(opts.normalize).filter(Boolean).forEach(function (key) {
|
||||
flags.normalize[key] = true
|
||||
flags.keys.push(key)
|
||||
})
|
||||
|
||||
Object.keys(opts.narg || {}).forEach(function (k) {
|
||||
flags.nargs[k] = opts.narg[k]
|
||||
flags.keys.push(k)
|
||||
})
|
||||
|
||||
Object.keys(opts.coerce || {}).forEach(function (k) {
|
||||
flags.coercions[k] = opts.coerce[k]
|
||||
flags.keys.push(k)
|
||||
})
|
||||
|
||||
if (Array.isArray(opts.config) || typeof opts.config === 'string') {
|
||||
@@ -99,8 +115,10 @@ function parse (args, opts) {
|
||||
var argv = { _: [] }
|
||||
|
||||
Object.keys(flags.bools).forEach(function (key) {
|
||||
setArg(key, !(key in defaults) ? false : defaults[key])
|
||||
setDefaulted(key)
|
||||
if (Object.prototype.hasOwnProperty.call(defaults, key)) {
|
||||
setArg(key, defaults[key])
|
||||
setDefaulted(key)
|
||||
}
|
||||
})
|
||||
|
||||
var notFlags = []
|
||||
@@ -138,8 +156,8 @@ function parse (args, opts) {
|
||||
} else {
|
||||
setArg(m[1], m[2])
|
||||
}
|
||||
} else if (arg.match(/^--no-.+/) && configuration['boolean-negation']) {
|
||||
key = arg.match(/^--no-(.+)/)[1]
|
||||
} else if (arg.match(negatedBoolean) && configuration['boolean-negation']) {
|
||||
key = arg.match(negatedBoolean)[1]
|
||||
setArg(key, false)
|
||||
|
||||
// -- seperated by space.
|
||||
@@ -265,46 +283,57 @@ function parse (args, opts) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
argv._.push(
|
||||
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
|
||||
)
|
||||
argv._.push(maybeCoerceNumber('_', arg))
|
||||
}
|
||||
}
|
||||
|
||||
// order of precedence:
|
||||
// 1. command line arg
|
||||
// 2. value from config file
|
||||
// 3. value from config objects
|
||||
// 4. value from env var
|
||||
// 2. value from env var
|
||||
// 3. value from config file
|
||||
// 4. value from config objects
|
||||
// 5. configured default value
|
||||
applyEnvVars(argv, true) // special case: check env vars that point to config file
|
||||
applyEnvVars(argv, false)
|
||||
setConfig(argv)
|
||||
setConfigObjects()
|
||||
applyEnvVars(argv, false)
|
||||
applyDefaultsAndAliases(argv, flags.aliases, defaults)
|
||||
applyCoercions(argv)
|
||||
if (configuration['set-placeholder-key']) setPlaceholderKeys(argv)
|
||||
|
||||
// for any counts either not in args or without an explicit default, set to 0
|
||||
Object.keys(flags.counts).forEach(function (key) {
|
||||
if (!hasKey(argv, key.split('.'))) setArg(key, 0)
|
||||
})
|
||||
|
||||
// '--' defaults to undefined.
|
||||
if (notFlagsOption && notFlags.length) argv[notFlagsArgv] = []
|
||||
notFlags.forEach(function (key) {
|
||||
argv._.push(key)
|
||||
argv[notFlagsArgv].push(key)
|
||||
})
|
||||
|
||||
// how many arguments should we consume, based
|
||||
// on the nargs option?
|
||||
function eatNargs (i, key, args) {
|
||||
var toEat = checkAllAliases(key, flags.nargs)
|
||||
var ii
|
||||
const toEat = checkAllAliases(key, flags.nargs)
|
||||
|
||||
if (args.length - (i + 1) < toEat) error = Error(__('Not enough arguments following: %s', key))
|
||||
// nargs will not consume flag arguments, e.g., -abc, --foo,
|
||||
// and terminates when one is observed.
|
||||
var available = 0
|
||||
for (ii = i + 1; ii < args.length; ii++) {
|
||||
if (!args[ii].match(/^-[^0-9]/)) available++
|
||||
else break
|
||||
}
|
||||
|
||||
for (var ii = i + 1; ii < (toEat + i + 1); ii++) {
|
||||
if (available < toEat) error = Error(__('Not enough arguments following: %s', key))
|
||||
|
||||
const consumed = Math.min(available, toEat)
|
||||
for (ii = i + 1; ii < (consumed + i + 1); ii++) {
|
||||
setArg(key, args[ii])
|
||||
}
|
||||
|
||||
return (i + toEat)
|
||||
return (i + consumed)
|
||||
}
|
||||
|
||||
// if an option is an array, eat all non-hyphenated arguments
|
||||
@@ -341,10 +370,8 @@ function parse (args, opts) {
|
||||
function setArg (key, val) {
|
||||
unsetDefaulted(key)
|
||||
|
||||
if (/-/.test(key) && !(flags.aliases[key] && flags.aliases[key].length) && configuration['camel-case-expansion']) {
|
||||
var c = camelCase(key)
|
||||
flags.aliases[key] = [c]
|
||||
newAliases[c] = true
|
||||
if (/-/.test(key) && configuration['camel-case-expansion']) {
|
||||
addNewAlias(key, camelCase(key))
|
||||
}
|
||||
|
||||
var value = processValue(key, val)
|
||||
@@ -389,17 +416,23 @@ function parse (args, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
function addNewAlias (key, alias) {
|
||||
if (!(flags.aliases[key] && flags.aliases[key].length)) {
|
||||
flags.aliases[key] = [alias]
|
||||
newAliases[alias] = true
|
||||
}
|
||||
if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
|
||||
addNewAlias(alias, key)
|
||||
}
|
||||
}
|
||||
|
||||
function processValue (key, val) {
|
||||
// handle parsing boolean arguments --foo=true --bar false.
|
||||
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
|
||||
if (typeof val === 'string') val = val === 'true'
|
||||
}
|
||||
|
||||
var value = val
|
||||
if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.coercions)) {
|
||||
if (isNumber(val)) value = Number(val)
|
||||
if (!isUndefined(val) && !isNumber(val) && checkAllAliases(key, flags.numbers)) value = NaN
|
||||
}
|
||||
var value = maybeCoerceNumber(key, val)
|
||||
|
||||
// increment a count given as arg (either no value or value parsed as boolean)
|
||||
if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
|
||||
@@ -414,6 +447,16 @@ function parse (args, opts) {
|
||||
return value
|
||||
}
|
||||
|
||||
function maybeCoerceNumber (key, value) {
|
||||
if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.coercions)) {
|
||||
const shouldCoerceNumber = isNumber(value) && configuration['parse-numbers'] && (
|
||||
Number.isSafeInteger(Math.floor(value))
|
||||
)
|
||||
if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) value = Number(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// set args from config.json file, this should be
|
||||
// applied last so that defaults can be applied.
|
||||
function setConfig (argv) {
|
||||
@@ -462,13 +505,13 @@ function parse (args, opts) {
|
||||
// if the value is an inner object and we have dot-notation
|
||||
// enabled, treat inner objects in config the same as
|
||||
// heavily nested dot notations (foo.bar.apple).
|
||||
if (typeof value === 'object' && !Array.isArray(value) && configuration['dot-notation']) {
|
||||
if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) {
|
||||
// if the value is an object but not an array, check nested object
|
||||
setConfigObject(value, fullKey)
|
||||
} else {
|
||||
// setting arguments via CLI takes precedence over
|
||||
// values within the config file.
|
||||
if (!hasKey(argv, fullKey.split('.')) || (flags.defaulted[fullKey])) {
|
||||
if (!hasKey(argv, fullKey.split('.')) || (flags.defaulted[fullKey]) || (flags.arrays[fullKey] && configuration['combine-arrays'])) {
|
||||
setArg(fullKey, value)
|
||||
}
|
||||
}
|
||||
@@ -506,18 +549,33 @@ function parse (args, opts) {
|
||||
|
||||
function applyCoercions (argv) {
|
||||
var coerce
|
||||
var applied = {}
|
||||
Object.keys(argv).forEach(function (key) {
|
||||
coerce = checkAllAliases(key, flags.coercions)
|
||||
if (typeof coerce === 'function') {
|
||||
try {
|
||||
argv[key] = coerce(argv[key])
|
||||
} catch (err) {
|
||||
error = err
|
||||
if (!applied.hasOwnProperty(key)) { // If we haven't already coerced this option via one of its aliases
|
||||
coerce = checkAllAliases(key, flags.coercions)
|
||||
if (typeof coerce === 'function') {
|
||||
try {
|
||||
var value = coerce(argv[key])
|
||||
;([].concat(flags.aliases[key] || [], key)).forEach(ali => {
|
||||
applied[ali] = argv[ali] = value
|
||||
})
|
||||
} catch (err) {
|
||||
error = err
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function setPlaceholderKeys (argv) {
|
||||
flags.keys.forEach((key) => {
|
||||
// don't set placeholder keys for dot notation options 'foo.bar'.
|
||||
if (~key.indexOf('.')) return
|
||||
if (typeof argv[key] === 'undefined') argv[key] = undefined
|
||||
})
|
||||
return argv
|
||||
}
|
||||
|
||||
function applyDefaultsAndAliases (obj, aliases, defaults) {
|
||||
Object.keys(defaults).forEach(function (key) {
|
||||
if (!hasKey(obj, key.split('.'))) {
|
||||
@@ -551,14 +609,29 @@ function parse (args, opts) {
|
||||
|
||||
if (!configuration['dot-notation']) keys = [keys.join('.')]
|
||||
|
||||
keys.slice(0, -1).forEach(function (key) {
|
||||
if (o[key] === undefined) o[key] = {}
|
||||
o = o[key]
|
||||
keys.slice(0, -1).forEach(function (key, index) {
|
||||
if (typeof o === 'object' && o[key] === undefined) {
|
||||
o[key] = {}
|
||||
}
|
||||
|
||||
if (typeof o[key] !== 'object' || Array.isArray(o[key])) {
|
||||
// ensure that o[key] is an array, and that the last item is an empty object.
|
||||
if (Array.isArray(o[key])) {
|
||||
o[key].push({})
|
||||
} else {
|
||||
o[key] = [o[key], {}]
|
||||
}
|
||||
|
||||
// we want to update the empty object at the end of the o[key] array, so set o to that object
|
||||
o = o[key][o[key].length - 1]
|
||||
} else {
|
||||
o = o[key]
|
||||
}
|
||||
})
|
||||
|
||||
var key = keys[keys.length - 1]
|
||||
|
||||
var isTypeArray = checkAllAliases(key, flags.arrays)
|
||||
var isTypeArray = checkAllAliases(keys.join('.'), flags.arrays)
|
||||
var isValueArray = Array.isArray(value)
|
||||
var duplicate = configuration['duplicate-arguments-array']
|
||||
|
||||
@@ -595,8 +668,10 @@ function parse (args, opts) {
|
||||
flags.aliases[key].concat(key).forEach(function (x) {
|
||||
if (/-/.test(x) && configuration['camel-case-expansion']) {
|
||||
var c = camelCase(x)
|
||||
flags.aliases[key].push(c)
|
||||
newAliases[c] = true
|
||||
if (c !== key && flags.aliases[key].indexOf(c) === -1) {
|
||||
flags.aliases[key].push(c)
|
||||
newAliases[c] = true
|
||||
}
|
||||
}
|
||||
})
|
||||
flags.aliases[key].forEach(function (x) {
|
||||
@@ -657,7 +732,6 @@ function parse (args, opts) {
|
||||
}
|
||||
|
||||
function isNumber (x) {
|
||||
if (!configuration['parse-numbers']) return false
|
||||
if (typeof x === 'number') return true
|
||||
if (/^0x[0-9a-f]+$/i.test(x)) return true
|
||||
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x)
|
||||
|
||||
8
node_modules/webpack-dev-server/node_modules/yargs-parser/lib/tokenize-arg-string.js
generated
vendored
8
node_modules/webpack-dev-server/node_modules/yargs-parser/lib/tokenize-arg-string.js
generated
vendored
@@ -2,17 +2,23 @@
|
||||
module.exports = function (argString) {
|
||||
if (Array.isArray(argString)) return argString
|
||||
|
||||
argString = argString.trim()
|
||||
|
||||
var i = 0
|
||||
var prevC = null
|
||||
var c = null
|
||||
var opening = null
|
||||
var args = []
|
||||
|
||||
for (var ii = 0; ii < argString.length; ii++) {
|
||||
prevC = c
|
||||
c = argString.charAt(ii)
|
||||
|
||||
// split on spaces unless we're in quotes.
|
||||
if (c === ' ' && !opening) {
|
||||
i++
|
||||
if (!(prevC === ' ')) {
|
||||
i++
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
30
node_modules/webpack-dev-server/node_modules/yargs-parser/package.json
generated
vendored
30
node_modules/webpack-dev-server/node_modules/yargs-parser/package.json
generated
vendored
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"_from": "yargs-parser@^4.2.0",
|
||||
"_id": "yargs-parser@4.2.1",
|
||||
"_from": "yargs-parser@^10.1.0",
|
||||
"_id": "yargs-parser@10.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=",
|
||||
"_integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==",
|
||||
"_location": "/webpack-dev-server/yargs-parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "yargs-parser@^4.2.0",
|
||||
"raw": "yargs-parser@^10.1.0",
|
||||
"name": "yargs-parser",
|
||||
"escapedName": "yargs-parser",
|
||||
"rawSpec": "^4.2.0",
|
||||
"rawSpec": "^10.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.2.0"
|
||||
"fetchSpec": "^10.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-dev-server/yargs"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz",
|
||||
"_shasum": "29cceac0dc4f03c6c87b4a9f217dd18c9f74871c",
|
||||
"_spec": "yargs-parser@^4.2.0",
|
||||
"_resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
|
||||
"_shasum": "7202265b89f7e9e9f2e5765e0fe735a905edbaa8",
|
||||
"_spec": "yargs-parser@^10.1.0",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server\\node_modules\\yargs",
|
||||
"author": {
|
||||
"name": "Ben Coe",
|
||||
@@ -31,7 +31,7 @@
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"camelcase": "^3.0.0"
|
||||
"camelcase": "^4.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "the mighty option parser used by yargs",
|
||||
@@ -39,9 +39,9 @@
|
||||
"chai": "^3.5.0",
|
||||
"coveralls": "^2.11.12",
|
||||
"mocha": "^3.0.1",
|
||||
"nyc": "^10.0.0",
|
||||
"standard": "^8.0.0",
|
||||
"standard-version": "^4.0.0"
|
||||
"nyc": "^11.4.1",
|
||||
"standard": "^10.0.2",
|
||||
"standard-version": "^4.3.0"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
@@ -67,9 +67,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"pretest": "standard",
|
||||
"posttest": "standard",
|
||||
"release": "standard-version",
|
||||
"test": "nyc mocha test/*.js"
|
||||
},
|
||||
"version": "4.2.1"
|
||||
"version": "10.1.0"
|
||||
}
|
||||
|
||||
356
node_modules/webpack-dev-server/node_modules/yargs/CHANGELOG.md
generated
vendored
356
node_modules/webpack-dev-server/node_modules/yargs/CHANGELOG.md
generated
vendored
@@ -2,6 +2,360 @@
|
||||
|
||||
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.
|
||||
|
||||
<a name="12.0.2"></a>
|
||||
## [12.0.2](https://github.com/yargs/yargs/compare/v12.0.1...v12.0.2) (2018-09-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* middleware should work regardless of when method is called ([664b265](https://github.com/yargs/yargs/commit/664b265)), closes [#1178](https://github.com/yargs/yargs/issues/1178)
|
||||
* translation not working when using __ with a single parameter ([#1183](https://github.com/yargs/yargs/issues/1183)) ([f449aea](https://github.com/yargs/yargs/commit/f449aea))
|
||||
* upgrade os-locale to version that addresses license issue ([#1195](https://github.com/yargs/yargs/issues/1195)) ([efc0970](https://github.com/yargs/yargs/commit/efc0970))
|
||||
|
||||
|
||||
|
||||
<a name="12.0.1"></a>
|
||||
## [12.0.1](https://github.com/yargs/yargs/compare/v12.0.0...v12.0.1) (2018-06-29)
|
||||
|
||||
|
||||
|
||||
<a name="12.0.0"></a>
|
||||
# [12.0.0](https://github.com/yargs/yargs/compare/v11.1.0...v12.0.0) (2018-06-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* .argv and .parse() now invoke identical code path ([#1126](https://github.com/yargs/yargs/issues/1126)) ([f13ebf4](https://github.com/yargs/yargs/commit/f13ebf4))
|
||||
* remove the trailing white spaces from the help output ([#1090](https://github.com/yargs/yargs/issues/1090)) ([3f0746c](https://github.com/yargs/yargs/commit/3f0746c))
|
||||
* **completion:** Avoid default command and recommendations during completion ([#1123](https://github.com/yargs/yargs/issues/1123)) ([036e7c5](https://github.com/yargs/yargs/commit/036e7c5))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* test Node.js 6, 8 and 10 ([#1160](https://github.com/yargs/yargs/issues/1160)) ([84f9d2b](https://github.com/yargs/yargs/commit/84f9d2b))
|
||||
* upgrade to version of yargs-parser that does not populate value for unset boolean ([#1104](https://github.com/yargs/yargs/issues/1104)) ([d4705f4](https://github.com/yargs/yargs/commit/d4705f4))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for global middleware, useful for shared tasks like metrics ([#1119](https://github.com/yargs/yargs/issues/1119)) ([9d71ac7](https://github.com/yargs/yargs/commit/9d71ac7))
|
||||
* allow setting scriptName $0 ([#1143](https://github.com/yargs/yargs/issues/1143)) ([a2f2eae](https://github.com/yargs/yargs/commit/a2f2eae))
|
||||
* remove `setPlaceholderKeys` ([#1105](https://github.com/yargs/yargs/issues/1105)) ([6ee2c82](https://github.com/yargs/yargs/commit/6ee2c82))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Options absent from `argv` (not set via CLI argument) are now absent from the parsed result object rather than being set with `undefined`
|
||||
* drop Node 4 from testing matrix, such that we'll gradually start drifting away from supporting Node 4.
|
||||
* yargs-parser does not populate 'false' when boolean flag is not passed
|
||||
* tests that assert against help output will need to be updated
|
||||
|
||||
|
||||
|
||||
<a name="11.1.0"></a>
|
||||
# [11.1.0](https://github.com/yargs/yargs/compare/v11.0.0...v11.1.0) (2018-03-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* choose correct config directory when require.main does not exist ([#1056](https://github.com/yargs/yargs/issues/1056)) ([a04678c](https://github.com/yargs/yargs/commit/a04678c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow hidden options to be displayed with --show-hidden ([#1061](https://github.com/yargs/yargs/issues/1061)) ([ea862ae](https://github.com/yargs/yargs/commit/ea862ae))
|
||||
* extend *.rc files in addition to json ([#1080](https://github.com/yargs/yargs/issues/1080)) ([11691a6](https://github.com/yargs/yargs/commit/11691a6))
|
||||
|
||||
|
||||
|
||||
<a name="11.0.0"></a>
|
||||
# [11.0.0](https://github.com/yargs/yargs/compare/v10.1.2...v11.0.0) (2018-01-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Set implicit nargs=1 when type=number requiresArg=true ([#1050](https://github.com/yargs/yargs/issues/1050)) ([2b56812](https://github.com/yargs/yargs/commit/2b56812))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* requiresArg is now simply an alias for nargs(1) ([#1054](https://github.com/yargs/yargs/issues/1054)) ([a3ddacc](https://github.com/yargs/yargs/commit/a3ddacc))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* requiresArg now has significantly different error output, matching nargs.
|
||||
|
||||
|
||||
|
||||
<a name="10.1.2"></a>
|
||||
## [10.1.2](https://github.com/yargs/yargs/compare/v10.1.1...v10.1.2) (2018-01-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* requiresArg should only be enforced if argument exists ([#1043](https://github.com/yargs/yargs/issues/1043)) ([fbf41ae](https://github.com/yargs/yargs/commit/fbf41ae))
|
||||
|
||||
|
||||
|
||||
<a name="10.1.1"></a>
|
||||
## [10.1.1](https://github.com/yargs/yargs/compare/v10.1.0...v10.1.1) (2018-01-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add `dirname` sanity check on `findUp` ([#1036](https://github.com/yargs/yargs/issues/1036)) ([331d103](https://github.com/yargs/yargs/commit/331d103))
|
||||
|
||||
|
||||
|
||||
<a name="10.1.0"></a>
|
||||
# [10.1.0](https://github.com/yargs/yargs/compare/v10.0.3...v10.1.0) (2018-01-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 'undefined' should be taken to mean no argument was provided ([#1015](https://github.com/yargs/yargs/issues/1015)) ([c679e90](https://github.com/yargs/yargs/commit/c679e90))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add missing simple chinese locale strings ([#1004](https://github.com/yargs/yargs/issues/1004)) ([3cc24ec](https://github.com/yargs/yargs/commit/3cc24ec))
|
||||
* add Norwegian Nynorsk translations ([#1028](https://github.com/yargs/yargs/issues/1028)) ([a5ac213](https://github.com/yargs/yargs/commit/a5ac213))
|
||||
* async command handlers ([#1001](https://github.com/yargs/yargs/issues/1001)) ([241124b](https://github.com/yargs/yargs/commit/241124b))
|
||||
* middleware ([#881](https://github.com/yargs/yargs/issues/881)) ([77b8dbc](https://github.com/yargs/yargs/commit/77b8dbc))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.3"></a>
|
||||
## [10.0.3](https://github.com/yargs/yargs/compare/v10.0.2...v10.0.3) (2017-10-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* parse array rather than string, so that quotes are safe ([#993](https://github.com/yargs/yargs/issues/993)) ([c351685](https://github.com/yargs/yargs/commit/c351685))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.2"></a>
|
||||
## [10.0.2](https://github.com/yargs/yargs/compare/v10.0.1...v10.0.2) (2017-10-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix tiny spacing issue with usage ([#992](https://github.com/yargs/yargs/issues/992)) ([7871327](https://github.com/yargs/yargs/commit/7871327))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.1"></a>
|
||||
## [10.0.1](https://github.com/yargs/yargs/compare/v10.0.0...v10.0.1) (2017-10-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* help strings for nested commands were missing parent commands ([#990](https://github.com/yargs/yargs/issues/990)) ([cd1ca15](https://github.com/yargs/yargs/commit/cd1ca15))
|
||||
* use correct completion command in generated completion script ([#988](https://github.com/yargs/yargs/issues/988)) ([3c8ac1d](https://github.com/yargs/yargs/commit/3c8ac1d))
|
||||
|
||||
|
||||
|
||||
<a name="10.0.0"></a>
|
||||
# [10.0.0](https://github.com/yargs/yargs/compare/v9.1.0...v10.0.0) (2017-10-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* config and normalize can be disabled with false ([#952](https://github.com/yargs/yargs/issues/952)) ([3bb8771](https://github.com/yargs/yargs/commit/3bb8771))
|
||||
* less eager help command execution ([#972](https://github.com/yargs/yargs/issues/972)) ([8c1d7bf](https://github.com/yargs/yargs/commit/8c1d7bf))
|
||||
* the positional argument parse was clobbering global flag arguments ([#984](https://github.com/yargs/yargs/issues/984)) ([7e58453](https://github.com/yargs/yargs/commit/7e58453))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* .usage() can now be used to configure a default command ([#975](https://github.com/yargs/yargs/issues/975)) ([7269531](https://github.com/yargs/yargs/commit/7269531))
|
||||
* hidden options are now explicitly indicated using "hidden" flag ([#962](https://github.com/yargs/yargs/issues/962)) ([280d0d6](https://github.com/yargs/yargs/commit/280d0d6))
|
||||
* introduce .positional() for configuring positional arguments ([#967](https://github.com/yargs/yargs/issues/967)) ([cb16460](https://github.com/yargs/yargs/commit/cb16460))
|
||||
* replace $0 with file basename ([#983](https://github.com/yargs/yargs/issues/983)) ([20bb99b](https://github.com/yargs/yargs/commit/20bb99b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* .usage() no longer accepts an options object as the second argument. It can instead be used as an alias for configuring a default command.
|
||||
* previously hidden options were simply implied using a falsy description
|
||||
* help command now only executes if it's the last positional in argv._
|
||||
|
||||
|
||||
|
||||
<a name="9.1.0"></a>
|
||||
# [9.1.0](https://github.com/yargs/yargs/compare/v9.0.1...v9.1.0) (2017-09-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **command:** Run default cmd even if the only cmd ([#950](https://github.com/yargs/yargs/issues/950)) ([7b22203](https://github.com/yargs/yargs/commit/7b22203))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* multiple usage calls are now collected, not replaced ([#958](https://github.com/yargs/yargs/issues/958)) ([74a38b2](https://github.com/yargs/yargs/commit/74a38b2))
|
||||
|
||||
|
||||
|
||||
<a name="9.0.1"></a>
|
||||
## [9.0.1](https://github.com/yargs/yargs/compare/v9.0.0...v9.0.1) (2017-09-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* implications fails only displayed once ([#954](https://github.com/yargs/yargs/issues/954)) ([ac8088b](https://github.com/yargs/yargs/commit/ac8088b))
|
||||
|
||||
|
||||
|
||||
<a name="9.0.0"></a>
|
||||
# [9.0.0](https://github.com/yargs/yargs/compare/v8.0.2...v9.0.0) (2017-09-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 'undefined' default value for choices resulted in validation failing ([782b896](https://github.com/yargs/yargs/commit/782b896))
|
||||
* address bug with handling of arrays of implications ([c240661](https://github.com/yargs/yargs/commit/c240661))
|
||||
* defaulting keys to 'undefined' interfered with conflicting key logic ([a8e0cff](https://github.com/yargs/yargs/commit/a8e0cff))
|
||||
* don't bother calling JSON.stringify() on string default values ([#891](https://github.com/yargs/yargs/issues/891)) ([628be21](https://github.com/yargs/yargs/commit/628be21))
|
||||
* exclude positional arguments from completion output ([#927](https://github.com/yargs/yargs/issues/927)) ([71c7ec7](https://github.com/yargs/yargs/commit/71c7ec7))
|
||||
* strict mode should not fail for hidden options ([#949](https://github.com/yargs/yargs/issues/949)) ([0e0c58d](https://github.com/yargs/yargs/commit/0e0c58d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow implies and conflicts to accept array values ([#922](https://github.com/yargs/yargs/issues/922)) ([abdc7da](https://github.com/yargs/yargs/commit/abdc7da))
|
||||
* allow parse with no arguments as alias for yargs.argv ([#944](https://github.com/yargs/yargs/issues/944)) ([a9f03e7](https://github.com/yargs/yargs/commit/a9f03e7))
|
||||
* enable .help() and .version() by default ([#912](https://github.com/yargs/yargs/issues/912)) ([1ef44e0](https://github.com/yargs/yargs/commit/1ef44e0))
|
||||
* to allow both undefined and nulls, for benefit of TypeScript ([#945](https://github.com/yargs/yargs/issues/945)) ([792564d](https://github.com/yargs/yargs/commit/792564d))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* version() and help() are now enabled by default, and show up in help output; the implicit help command can no longer be enabled/disabled independently from the help command itself (which can now be disabled).
|
||||
* parse() now behaves as an alias for .argv, unless a parseCallback is provided.
|
||||
|
||||
|
||||
|
||||
<a name="8.0.2"></a>
|
||||
## [8.0.2](https://github.com/yargs/yargs/compare/v8.0.1...v8.0.2) (2017-06-12)
|
||||
|
||||
|
||||
|
||||
<a name="8.0.1"></a>
|
||||
## [8.0.1](https://github.com/yargs/yargs/compare/v8.0.0...v8.0.1) (2017-05-02)
|
||||
|
||||
|
||||
|
||||
<a name="8.0.0"></a>
|
||||
# [8.0.0](https://github.com/yargs/yargs/compare/v7.1.0...v8.0.0) (2017-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* commands are now applied in order, from left to right ([#857](https://github.com/yargs/yargs/issues/857)) ([baba863](https://github.com/yargs/yargs/commit/baba863))
|
||||
* help now takes precedence over command recommendation ([#866](https://github.com/yargs/yargs/issues/866)) ([17e3567](https://github.com/yargs/yargs/commit/17e3567))
|
||||
* positional arguments now work if no handler is provided to inner command ([#864](https://github.com/yargs/yargs/issues/864)) ([e28ded3](https://github.com/yargs/yargs/commit/e28ded3))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* upgrade yargs-parser ([#867](https://github.com/yargs/yargs/issues/867)) ([8f9c6c6](https://github.com/yargs/yargs/commit/8f9c6c6))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow extends to inherit from a module ([#865](https://github.com/yargs/yargs/issues/865)) ([89456d9](https://github.com/yargs/yargs/commit/89456d9))
|
||||
* allow strict mode to be disabled ([#840](https://github.com/yargs/yargs/issues/840)) ([6f78c05](https://github.com/yargs/yargs/commit/6f78c05))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* extends functionality now always loads the JSON provided, rather than reading from a specific key
|
||||
* Node 4+ is now required; this will allow us to start updating our dependencies.
|
||||
* the first argument to strict() is now used to enable/disable its functionality, rather than controlling whether or not it is global.
|
||||
|
||||
|
||||
|
||||
<a name="7.1.0"></a>
|
||||
# [7.1.0](https://github.com/yargs/yargs/compare/v7.0.2...v7.1.0) (2017-04-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix demandOption no longer treats 'false' as truthy ([#829](https://github.com/yargs/yargs/issues/829)) ([c748dd2](https://github.com/yargs/yargs/commit/c748dd2))
|
||||
* get terminalWidth in non interactive mode no longer causes a validation exception ([#837](https://github.com/yargs/yargs/issues/837)) ([360e301](https://github.com/yargs/yargs/commit/360e301))
|
||||
* we shouldn't output help if we've printed a prior help-like message ([#847](https://github.com/yargs/yargs/issues/847)) ([17e89bd](https://github.com/yargs/yargs/commit/17e89bd))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for numeric commands ([#825](https://github.com/yargs/yargs/issues/825)) ([fde0564](https://github.com/yargs/yargs/commit/fde0564))
|
||||
|
||||
|
||||
|
||||
<a name="7.0.2"></a>
|
||||
## [7.0.2](https://github.com/yargs/yargs/compare/v7.0.1...v7.0.2) (2017-03-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* populating placeholder arguments broke validation ([b3eb2fe](https://github.com/yargs/yargs/commit/b3eb2fe))
|
||||
|
||||
|
||||
|
||||
<a name="7.0.1"></a>
|
||||
## [7.0.1](https://github.com/yargs/yargs/compare/v7.0.0...v7.0.1) (2017-03-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* --help with default command should print top-level help ([#810](https://github.com/yargs/yargs/issues/810)) ([9c03fa4](https://github.com/yargs/yargs/commit/9c03fa4))
|
||||
|
||||
|
||||
|
||||
<a name="7.0.0"></a>
|
||||
# [7.0.0](https://github.com/yargs/yargs/compare/v6.6.0...v7.0.0) (2017-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address min/max validation message regression ([#750](https://github.com/yargs/yargs/issues/750)) ([2e5ce0f](https://github.com/yargs/yargs/commit/2e5ce0f))
|
||||
* address positional argument strict() bug introduced in [#766](https://github.com/yargs/yargs/issues/766) ([#784](https://github.com/yargs/yargs/issues/784)) ([a8528e6](https://github.com/yargs/yargs/commit/a8528e6))
|
||||
* console.warn() rather than throwing errors when api signatures are incorrect ([#804](https://github.com/yargs/yargs/issues/804)) ([a607061](https://github.com/yargs/yargs/commit/a607061))
|
||||
* context should override parsed argv ([#786](https://github.com/yargs/yargs/issues/786)) ([0997288](https://github.com/yargs/yargs/commit/0997288))
|
||||
* context variables are now recognized in strict() mode ([#796](https://github.com/yargs/yargs/issues/796)) ([48575cd](https://github.com/yargs/yargs/commit/48575cd))
|
||||
* errors were not bubbling appropriately from sub-commands to top-level ([#802](https://github.com/yargs/yargs/issues/802)) ([8a992f5](https://github.com/yargs/yargs/commit/8a992f5))
|
||||
* positional arguments of sub-commands threw strict() exception ([#805](https://github.com/yargs/yargs/issues/805)) ([f3f074b](https://github.com/yargs/yargs/commit/f3f074b))
|
||||
* pull in yargs-parser with modified env precedence ([#787](https://github.com/yargs/yargs/issues/787)) ([e0fbbe5](https://github.com/yargs/yargs/commit/e0fbbe5))
|
||||
* running parse() multiple times on the same yargs instance caused exception if help() enabled ([#790](https://github.com/yargs/yargs/issues/790)) ([07e39b7](https://github.com/yargs/yargs/commit/07e39b7))
|
||||
* use path.resolve() to support node 0.10 ([#797](https://github.com/yargs/yargs/issues/797)) ([49a93fc](https://github.com/yargs/yargs/commit/49a93fc))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add conflicts and implies shorthands. ([#753](https://github.com/yargs/yargs/issues/753)) ([bd1472b](https://github.com/yargs/yargs/commit/bd1472b))
|
||||
* add traditional Chinese translation ([#780](https://github.com/yargs/yargs/issues/780)) ([6ab6a95](https://github.com/yargs/yargs/commit/6ab6a95))
|
||||
* allow provided config object to extend other configs ([#779](https://github.com/yargs/yargs/issues/779)) ([3280dd0](https://github.com/yargs/yargs/commit/3280dd0))
|
||||
* function argument validation ([#773](https://github.com/yargs/yargs/issues/773)) ([22ed9bb](https://github.com/yargs/yargs/commit/22ed9bb))
|
||||
* if only one column is provided for examples, allow it to take up the entire line ([#749](https://github.com/yargs/yargs/issues/749)) ([7931652](https://github.com/yargs/yargs/commit/7931652))
|
||||
* introduce custom yargs error object ([#765](https://github.com/yargs/yargs/issues/765)) ([8308efa](https://github.com/yargs/yargs/commit/8308efa))
|
||||
* introduces support for default commands, using the '*' identifier ([#785](https://github.com/yargs/yargs/issues/785)) ([d78a0f5](https://github.com/yargs/yargs/commit/d78a0f5))
|
||||
* rethink how options are inherited by commands ([#766](https://github.com/yargs/yargs/issues/766)) ([ab1fa4b](https://github.com/yargs/yargs/commit/ab1fa4b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* `extends` key in config file is now used for extending other config files
|
||||
* environment variables now take precedence over config files.
|
||||
* context now takes precedence over argv and defaults
|
||||
* the arguments passed to functions are now validated, there's a good chance this will throw exceptions for a few folks who are using the API in an unexpected way.
|
||||
* by default options, and many of yargs' parsing helpers will now default to being applied globally; such that they are no-longer reset before being passed into commands.
|
||||
* yargs will no longer aggressively suppress errors, allowing errors that are not generated internally to bubble.
|
||||
|
||||
|
||||
|
||||
<a name="6.6.0"></a>
|
||||
# [6.6.0](https://github.com/yargs/yargs/compare/v6.5.0...v6.6.0) (2016-12-29)
|
||||
|
||||
@@ -349,7 +703,7 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
- [#308](https://github.com/bcoe/yargs/pull/308) Yargs now handles environment variables (@nexdrew)
|
||||
- [#302](https://github.com/bcoe/yargs/pull/302) Add Indonesian translation (@rilut)
|
||||
- [#300](https://github.com/bcoe/yargs/pull/300) Add Turkish translation (@feyzo)
|
||||
- [#298](https://github.com/bcoe/yargs/pull/298) Add Norwegian Bokmål translation (@sindresorhus)
|
||||
- [#298](https://github.com/bcoe/yargs/pull/298) Add Norwegian Bokmål translation (@sindresorhus)
|
||||
- [#297](https://github.com/bcoe/yargs/pull/297) Fix for layout of cjk characters (@disjukr)
|
||||
- [#296](https://github.com/bcoe/yargs/pull/296) Add Korean translation (@disjukr)
|
||||
|
||||
|
||||
2016
node_modules/webpack-dev-server/node_modules/yargs/README.md
generated
vendored
2016
node_modules/webpack-dev-server/node_modules/yargs/README.md
generated
vendored
File diff suppressed because it is too large
Load Diff
4
node_modules/webpack-dev-server/node_modules/yargs/completion.sh.hbs
generated
vendored
4
node_modules/webpack-dev-server/node_modules/yargs/completion.sh.hbs
generated
vendored
@@ -2,8 +2,8 @@
|
||||
#
|
||||
# yargs command completion script
|
||||
#
|
||||
# Installation: {{app_path}} completion >> ~/.bashrc
|
||||
# or {{app_path}} completion >> ~/.bash_profile on OSX.
|
||||
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
|
||||
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
|
||||
#
|
||||
_yargs_completions()
|
||||
{
|
||||
|
||||
3
node_modules/webpack-dev-server/node_modules/yargs/index.js
generated
vendored
3
node_modules/webpack-dev-server/node_modules/yargs/index.js
generated
vendored
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
// classic singleton yargs API, to use yargs
|
||||
// without running as a singleton do:
|
||||
// require('yargs/yargs')(process.argv.slice(2))
|
||||
@@ -21,7 +22,7 @@ function Argv (processArgs, cwd) {
|
||||
to get a parsed version of process.argv.
|
||||
*/
|
||||
function singletonify (inst) {
|
||||
Object.keys(inst).forEach(function (key) {
|
||||
Object.keys(inst).forEach((key) => {
|
||||
if (key === 'argv') {
|
||||
Argv.__defineGetter__(key, inst.__lookupGetter__(key))
|
||||
} else {
|
||||
|
||||
15
node_modules/webpack-dev-server/node_modules/yargs/lib/assign.js
generated
vendored
15
node_modules/webpack-dev-server/node_modules/yargs/lib/assign.js
generated
vendored
@@ -1,15 +0,0 @@
|
||||
// lazy Object.assign logic that only works for merging
|
||||
// two objects; eventually we should replace this with Object.assign.
|
||||
module.exports = function assign (defaults, configuration) {
|
||||
var o = {}
|
||||
configuration = configuration || {}
|
||||
|
||||
Object.keys(defaults).forEach(function (k) {
|
||||
o[k] = defaults[k]
|
||||
})
|
||||
Object.keys(configuration).forEach(function (k) {
|
||||
o[k] = configuration[k]
|
||||
})
|
||||
|
||||
return o
|
||||
}
|
||||
374
node_modules/webpack-dev-server/node_modules/yargs/lib/command.js
generated
vendored
374
node_modules/webpack-dev-server/node_modules/yargs/lib/command.js
generated
vendored
@@ -1,63 +1,100 @@
|
||||
const path = require('path')
|
||||
'use strict'
|
||||
|
||||
const inspect = require('util').inspect
|
||||
const camelCase = require('camelcase')
|
||||
const path = require('path')
|
||||
const Parser = require('yargs-parser')
|
||||
|
||||
const DEFAULT_MARKER = /(^\*)|(^\$0)/
|
||||
|
||||
// handles parsing positional arguments,
|
||||
// and populating argv with said positional
|
||||
// arguments.
|
||||
module.exports = function (yargs, usage, validation) {
|
||||
module.exports = function command (yargs, usage, validation, globalMiddleware) {
|
||||
const self = {}
|
||||
|
||||
var handlers = {}
|
||||
var aliasMap = {}
|
||||
self.addHandler = function (cmd, description, builder, handler) {
|
||||
var aliases = []
|
||||
let handlers = {}
|
||||
let aliasMap = {}
|
||||
let defaultCommand
|
||||
globalMiddleware = globalMiddleware || []
|
||||
self.addHandler = function addHandler (cmd, description, builder, handler, middlewares) {
|
||||
let aliases = []
|
||||
handler = handler || (() => {})
|
||||
middlewares = middlewares || []
|
||||
globalMiddleware.push(...middlewares)
|
||||
middlewares = globalMiddleware
|
||||
if (Array.isArray(cmd)) {
|
||||
aliases = cmd.slice(1)
|
||||
cmd = cmd[0]
|
||||
} else if (typeof cmd === 'object') {
|
||||
var command = (Array.isArray(cmd.command) || typeof cmd.command === 'string') ? cmd.command : moduleName(cmd)
|
||||
let command = (Array.isArray(cmd.command) || typeof cmd.command === 'string') ? cmd.command : moduleName(cmd)
|
||||
if (cmd.aliases) command = [].concat(command).concat(cmd.aliases)
|
||||
self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler)
|
||||
self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares)
|
||||
return
|
||||
}
|
||||
|
||||
// allow a module to be provided instead of separate builder and handler
|
||||
if (typeof builder === 'object' && builder.builder && typeof builder.handler === 'function') {
|
||||
self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler)
|
||||
self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares)
|
||||
return
|
||||
}
|
||||
|
||||
var parsedCommand = parseCommand(cmd)
|
||||
aliases = aliases.map(function (alias) {
|
||||
alias = parseCommand(alias).cmd // remove positional args
|
||||
// parse positionals out of cmd string
|
||||
const parsedCommand = self.parseCommand(cmd)
|
||||
|
||||
// remove positional args from aliases only
|
||||
aliases = aliases.map(alias => self.parseCommand(alias).cmd)
|
||||
|
||||
// check for default and filter out '*''
|
||||
let isDefault = false
|
||||
const parsedAliases = [parsedCommand.cmd].concat(aliases).filter((c) => {
|
||||
if (DEFAULT_MARKER.test(c)) {
|
||||
isDefault = true
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
// standardize on $0 for default command.
|
||||
if (parsedAliases.length === 0 && isDefault) parsedAliases.push('$0')
|
||||
|
||||
// shift cmd and aliases after filtering out '*'
|
||||
if (isDefault) {
|
||||
parsedCommand.cmd = parsedAliases[0]
|
||||
aliases = parsedAliases.slice(1)
|
||||
cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd)
|
||||
}
|
||||
|
||||
// populate aliasMap
|
||||
aliases.forEach((alias) => {
|
||||
aliasMap[alias] = parsedCommand.cmd
|
||||
return alias
|
||||
})
|
||||
|
||||
if (description !== false) {
|
||||
usage.command(cmd, description, aliases)
|
||||
usage.command(cmd, description, isDefault, aliases)
|
||||
}
|
||||
|
||||
handlers[parsedCommand.cmd] = {
|
||||
original: cmd,
|
||||
handler: handler,
|
||||
description: description,
|
||||
handler,
|
||||
builder: builder || {},
|
||||
middlewares: middlewares || [],
|
||||
demanded: parsedCommand.demanded,
|
||||
optional: parsedCommand.optional
|
||||
}
|
||||
|
||||
if (isDefault) defaultCommand = handlers[parsedCommand.cmd]
|
||||
}
|
||||
|
||||
self.addDirectory = function (dir, context, req, callerFile, opts) {
|
||||
self.addDirectory = function addDirectory (dir, context, req, callerFile, opts) {
|
||||
opts = opts || {}
|
||||
// disable recursion to support nested directories of subcommands
|
||||
if (typeof opts.recurse !== 'boolean') opts.recurse = false
|
||||
// exclude 'json', 'coffee' from require-directory defaults
|
||||
if (!Array.isArray(opts.extensions)) opts.extensions = ['js']
|
||||
// allow consumer to define their own visitor function
|
||||
const parentVisit = typeof opts.visit === 'function' ? opts.visit : function (o) { return o }
|
||||
const parentVisit = typeof opts.visit === 'function' ? opts.visit : o => o
|
||||
// call addHandler via visitor function
|
||||
opts.visit = function (obj, joined, filename) {
|
||||
opts.visit = function visit (obj, joined, filename) {
|
||||
const visited = parentVisit(obj, joined, filename)
|
||||
// allow consumer to skip modules with their own visitor
|
||||
if (visited) {
|
||||
@@ -77,7 +114,7 @@ module.exports = function (yargs, usage, validation) {
|
||||
// if module was not require()d and no name given, throw error
|
||||
function moduleName (obj) {
|
||||
const mod = require('which-module')(obj)
|
||||
if (!mod) throw new Error('No command name given for module: ' + inspect(obj))
|
||||
if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`)
|
||||
return commandFromFilename(mod.filename)
|
||||
}
|
||||
|
||||
@@ -87,161 +124,286 @@ module.exports = function (yargs, usage, validation) {
|
||||
}
|
||||
|
||||
function extractDesc (obj) {
|
||||
for (var keys = ['describe', 'description', 'desc'], i = 0, l = keys.length, test; i < l; i++) {
|
||||
for (let keys = ['describe', 'description', 'desc'], i = 0, l = keys.length, test; i < l; i++) {
|
||||
test = obj[keys[i]]
|
||||
if (typeof test === 'string' || typeof test === 'boolean') return test
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function parseCommand (cmd) {
|
||||
var extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ')
|
||||
var splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/)
|
||||
var bregex = /\.*[\][<>]/g
|
||||
var parsedCommand = {
|
||||
self.parseCommand = function parseCommand (cmd) {
|
||||
const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ')
|
||||
const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/)
|
||||
const bregex = /\.*[\][<>]/g
|
||||
const parsedCommand = {
|
||||
cmd: (splitCommand.shift()).replace(bregex, ''),
|
||||
demanded: [],
|
||||
optional: []
|
||||
}
|
||||
splitCommand.forEach(function (cmd, i) {
|
||||
var variadic = false
|
||||
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: variadic
|
||||
variadic
|
||||
})
|
||||
} else {
|
||||
parsedCommand.demanded.push({
|
||||
cmd: cmd.replace(bregex, '').split('|'),
|
||||
variadic: variadic
|
||||
variadic
|
||||
})
|
||||
}
|
||||
})
|
||||
return parsedCommand
|
||||
}
|
||||
|
||||
self.getCommands = function () {
|
||||
return Object.keys(handlers).concat(Object.keys(aliasMap))
|
||||
}
|
||||
self.getCommands = () => Object.keys(handlers).concat(Object.keys(aliasMap))
|
||||
|
||||
self.getCommandHandlers = function () {
|
||||
return handlers
|
||||
}
|
||||
self.getCommandHandlers = () => handlers
|
||||
|
||||
self.runCommand = function (command, yargs, parsed) {
|
||||
var argv = parsed.argv
|
||||
var commandHandler = handlers[command] || handlers[aliasMap[command]]
|
||||
var innerArgv = argv
|
||||
var currentContext = yargs.getContext()
|
||||
var numFiles = currentContext.files.length
|
||||
var parentCommands = currentContext.commands.slice()
|
||||
currentContext.commands.push(command)
|
||||
self.hasDefaultCommand = () => !!defaultCommand
|
||||
|
||||
self.runCommand = function runCommand (command, yargs, parsed, commandIndex) {
|
||||
let aliases = parsed.aliases
|
||||
const commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand
|
||||
const currentContext = yargs.getContext()
|
||||
let numFiles = currentContext.files.length
|
||||
const parentCommands = currentContext.commands.slice()
|
||||
|
||||
// what does yargs look like after the buidler is run?
|
||||
let innerArgv = parsed.argv
|
||||
let innerYargs = null
|
||||
let positionalMap = {}
|
||||
if (command) {
|
||||
currentContext.commands.push(command)
|
||||
currentContext.fullCommands.push(commandHandler.original)
|
||||
}
|
||||
if (typeof commandHandler.builder === 'function') {
|
||||
// a function can be provided, which builds
|
||||
// up a yargs chain and possibly returns it.
|
||||
innerArgv = commandHandler.builder(yargs.reset(parsed.aliases))
|
||||
innerYargs = commandHandler.builder(yargs.reset(parsed.aliases))
|
||||
// if the builder function did not yet parse argv with reset yargs
|
||||
// and did not explicitly set a usage() string, then apply the
|
||||
// original command string as usage() for consistent behavior with
|
||||
// options object below
|
||||
// options object below.
|
||||
if (yargs.parsed === false) {
|
||||
if (typeof yargs.getUsageInstance().getUsage() === 'undefined') {
|
||||
yargs.usage('$0 ' + (parentCommands.length ? parentCommands.join(' ') + ' ' : '') + commandHandler.original)
|
||||
if (shouldUpdateUsage(yargs)) {
|
||||
yargs.getUsageInstance().usage(
|
||||
usageFromParentCommandsCommandHandler(parentCommands, commandHandler),
|
||||
commandHandler.description
|
||||
)
|
||||
}
|
||||
innerArgv = innerArgv ? innerArgv.argv : yargs.argv
|
||||
innerArgv = innerYargs ? innerYargs._parseArgs(null, null, true, commandIndex) : yargs._parseArgs(null, null, true, commandIndex)
|
||||
} else {
|
||||
innerArgv = yargs.parsed.argv
|
||||
}
|
||||
|
||||
if (innerYargs && yargs.parsed === false) aliases = innerYargs.parsed.aliases
|
||||
else aliases = yargs.parsed.aliases
|
||||
} else if (typeof commandHandler.builder === 'object') {
|
||||
// as a short hand, an object can instead be provided, specifying
|
||||
// the options that a command takes.
|
||||
innerArgv = yargs.reset(parsed.aliases)
|
||||
innerArgv.usage('$0 ' + (parentCommands.length ? parentCommands.join(' ') + ' ' : '') + commandHandler.original)
|
||||
Object.keys(commandHandler.builder).forEach(function (key) {
|
||||
innerArgv.option(key, commandHandler.builder[key])
|
||||
innerYargs = yargs.reset(parsed.aliases)
|
||||
if (shouldUpdateUsage(innerYargs)) {
|
||||
innerYargs.getUsageInstance().usage(
|
||||
usageFromParentCommandsCommandHandler(parentCommands, commandHandler),
|
||||
commandHandler.description
|
||||
)
|
||||
}
|
||||
Object.keys(commandHandler.builder).forEach((key) => {
|
||||
innerYargs.option(key, commandHandler.builder[key])
|
||||
})
|
||||
innerArgv = innerArgv.argv
|
||||
innerArgv = innerYargs._parseArgs(null, null, true, commandIndex)
|
||||
aliases = innerYargs.parsed.aliases
|
||||
}
|
||||
if (!yargs._hasOutput()) populatePositionals(commandHandler, innerArgv, currentContext, yargs)
|
||||
|
||||
if (!yargs._hasOutput()) {
|
||||
positionalMap = populatePositionals(commandHandler, innerArgv, currentContext, yargs)
|
||||
}
|
||||
|
||||
// we apply validation post-hoc, so that custom
|
||||
// checks get passed populated positional arguments.
|
||||
if (!yargs._hasOutput()) yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error)
|
||||
|
||||
if (commandHandler.handler && !yargs._hasOutput()) {
|
||||
commandHandler.handler(innerArgv)
|
||||
yargs._setHasOutput()
|
||||
if (commandHandler.middlewares.length > 0) {
|
||||
const middlewareArgs = commandHandler.middlewares.reduce(function (initialObj, middleware) {
|
||||
return Object.assign(initialObj, middleware(innerArgv))
|
||||
}, {})
|
||||
Object.assign(innerArgv, middlewareArgs)
|
||||
}
|
||||
const handlerResult = commandHandler.handler(innerArgv)
|
||||
if (handlerResult && typeof handlerResult.then === 'function') {
|
||||
handlerResult.then(
|
||||
null,
|
||||
(error) => yargs.getUsageInstance().fail(null, error)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (command) {
|
||||
currentContext.commands.pop()
|
||||
currentContext.fullCommands.pop()
|
||||
}
|
||||
currentContext.commands.pop()
|
||||
numFiles = currentContext.files.length - numFiles
|
||||
if (numFiles > 0) currentContext.files.splice(numFiles * -1, numFiles)
|
||||
|
||||
return innerArgv
|
||||
}
|
||||
|
||||
function shouldUpdateUsage (yargs) {
|
||||
return !yargs.getUsageInstance().getUsageDisabled() &&
|
||||
yargs.getUsageInstance().getUsage().length === 0
|
||||
}
|
||||
|
||||
function 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(' ')}`
|
||||
}
|
||||
|
||||
self.runDefaultBuilderOn = function (yargs) {
|
||||
if (shouldUpdateUsage(yargs)) {
|
||||
// build the root-level command string from the default string.
|
||||
const commandString = DEFAULT_MARKER.test(defaultCommand.original)
|
||||
? defaultCommand.original : defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ')
|
||||
yargs.getUsageInstance().usage(
|
||||
commandString,
|
||||
defaultCommand.description
|
||||
)
|
||||
}
|
||||
const builder = defaultCommand.builder
|
||||
if (typeof builder === 'function') {
|
||||
builder(yargs)
|
||||
} else {
|
||||
Object.keys(builder).forEach((key) => {
|
||||
yargs.option(key, builder[key])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// transcribe all positional arguments "command <foo> <bar> [apple]"
|
||||
// onto argv.
|
||||
function populatePositionals (commandHandler, argv, context, yargs) {
|
||||
argv._ = argv._.slice(context.commands.length) // nuke the current commands
|
||||
var demanded = commandHandler.demanded.slice(0)
|
||||
var optional = commandHandler.optional.slice(0)
|
||||
const demanded = commandHandler.demanded.slice(0)
|
||||
const optional = commandHandler.optional.slice(0)
|
||||
const positionalMap = {}
|
||||
|
||||
validation.positionalCount(demanded.length, argv._.length)
|
||||
|
||||
while (demanded.length) {
|
||||
var demand = demanded.shift()
|
||||
populatePositional(demand, argv, yargs)
|
||||
const demand = demanded.shift()
|
||||
populatePositional(demand, argv, positionalMap)
|
||||
}
|
||||
|
||||
while (optional.length) {
|
||||
var maybe = optional.shift()
|
||||
populatePositional(maybe, argv, yargs)
|
||||
const maybe = optional.shift()
|
||||
populatePositional(maybe, argv, positionalMap)
|
||||
}
|
||||
|
||||
argv._ = context.commands.concat(argv._)
|
||||
|
||||
postProcessPositionals(argv, positionalMap, self.cmdToParseOptions(commandHandler.original))
|
||||
|
||||
return positionalMap
|
||||
}
|
||||
|
||||
// populate a single positional argument and its
|
||||
// aliases onto argv.
|
||||
function populatePositional (positional, argv, yargs) {
|
||||
// "positional" consists of the positional.cmd, an array representing
|
||||
// the positional's name and aliases, and positional.variadic
|
||||
// indicating whether or not it is a variadic array.
|
||||
var variadics = null
|
||||
var value = null
|
||||
for (var i = 0, cmd; (cmd = positional.cmd[i]) !== undefined; i++) {
|
||||
if (positional.variadic) {
|
||||
if (variadics) argv[cmd] = variadics.slice(0)
|
||||
else argv[cmd] = variadics = argv._.splice(0)
|
||||
} else {
|
||||
if (!value && !argv._.length) continue
|
||||
if (value) argv[cmd] = value
|
||||
else argv[cmd] = value = argv._.shift()
|
||||
function populatePositional (positional, argv, positionalMap, parseOptions) {
|
||||
const cmd = positional.cmd[0]
|
||||
if (positional.variadic) {
|
||||
positionalMap[cmd] = argv._.splice(0).map(String)
|
||||
} else {
|
||||
if (argv._.length) positionalMap[cmd] = [String(argv._.shift())]
|
||||
}
|
||||
}
|
||||
|
||||
// we run yargs-parser against the positional arguments
|
||||
// applying the same parsing logic used for flags.
|
||||
function postProcessPositionals (argv, positionalMap, parseOptions) {
|
||||
// combine the parsing hints we've inferred from the command
|
||||
// string with explicitly configured parsing hints.
|
||||
const options = Object.assign({}, yargs.getOptions())
|
||||
options.default = Object.assign(parseOptions.default, options.default)
|
||||
options.alias = Object.assign(parseOptions.alias, options.alias)
|
||||
options.array = options.array.concat(parseOptions.array)
|
||||
|
||||
const unparsed = []
|
||||
Object.keys(positionalMap).forEach((key) => {
|
||||
positionalMap[key].map((value) => {
|
||||
unparsed.push(`--${key}`)
|
||||
unparsed.push(value)
|
||||
})
|
||||
})
|
||||
|
||||
// short-circuit parse.
|
||||
if (!unparsed.length) return
|
||||
|
||||
const parsed = Parser.detailed(unparsed, options)
|
||||
|
||||
if (parsed.error) {
|
||||
yargs.getUsageInstance().fail(parsed.error.message, parsed.error)
|
||||
} else {
|
||||
// only copy over positional keys (don't overwrite
|
||||
// flag arguments that were already parsed).
|
||||
const positionalKeys = Object.keys(positionalMap)
|
||||
Object.keys(positionalMap).forEach((key) => {
|
||||
[].push.apply(positionalKeys, parsed.aliases[key])
|
||||
})
|
||||
|
||||
Object.keys(parsed.argv).forEach((key) => {
|
||||
if (positionalKeys.indexOf(key) !== -1) {
|
||||
argv[key] = parsed.argv[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
self.cmdToParseOptions = function (cmdString) {
|
||||
const parseOptions = {
|
||||
array: [],
|
||||
default: {},
|
||||
alias: {},
|
||||
demand: {}
|
||||
}
|
||||
|
||||
const parsed = self.parseCommand(cmdString)
|
||||
parsed.demanded.forEach((d) => {
|
||||
const cmds = d.cmd.slice(0)
|
||||
const cmd = cmds.shift()
|
||||
if (d.variadic) {
|
||||
parseOptions.array.push(cmd)
|
||||
parseOptions.default[cmd] = []
|
||||
}
|
||||
postProcessPositional(yargs, argv, cmd)
|
||||
addCamelCaseExpansions(argv, cmd)
|
||||
}
|
||||
}
|
||||
cmds.forEach((c) => {
|
||||
parseOptions.alias[cmd] = c
|
||||
})
|
||||
parseOptions.demand[cmd] = true
|
||||
})
|
||||
|
||||
// TODO move positional arg logic to yargs-parser and remove this duplication
|
||||
function postProcessPositional (yargs, argv, key) {
|
||||
var coerce = yargs.getOptions().coerce[key]
|
||||
if (typeof coerce === 'function') {
|
||||
try {
|
||||
argv[key] = coerce(argv[key])
|
||||
} catch (err) {
|
||||
yargs.getUsageInstance().fail(err.message, err)
|
||||
parsed.optional.forEach((o) => {
|
||||
const cmds = o.cmd.slice(0)
|
||||
const cmd = cmds.shift()
|
||||
if (o.variadic) {
|
||||
parseOptions.array.push(cmd)
|
||||
parseOptions.default[cmd] = []
|
||||
}
|
||||
}
|
||||
cmds.forEach((c) => {
|
||||
parseOptions.alias[cmd] = c
|
||||
})
|
||||
})
|
||||
|
||||
return parseOptions
|
||||
}
|
||||
|
||||
function addCamelCaseExpansions (argv, option) {
|
||||
if (/-/.test(option)) {
|
||||
const cc = camelCase(option)
|
||||
if (typeof argv[option] === 'object') argv[cc] = argv[option].slice(0)
|
||||
else argv[cc] = argv[option]
|
||||
}
|
||||
}
|
||||
|
||||
self.reset = function () {
|
||||
self.reset = () => {
|
||||
handlers = {}
|
||||
aliasMap = {}
|
||||
defaultCommand = undefined
|
||||
return self
|
||||
}
|
||||
|
||||
@@ -249,15 +411,17 @@ module.exports = function (yargs, usage, validation) {
|
||||
// the state of commands such that
|
||||
// we can apply .parse() multiple times
|
||||
// with the same yargs instance.
|
||||
var frozen
|
||||
self.freeze = function () {
|
||||
let frozen
|
||||
self.freeze = () => {
|
||||
frozen = {}
|
||||
frozen.handlers = handlers
|
||||
frozen.aliasMap = aliasMap
|
||||
frozen.defaultCommand = defaultCommand
|
||||
}
|
||||
self.unfreeze = function () {
|
||||
self.unfreeze = () => {
|
||||
handlers = frozen.handlers
|
||||
aliasMap = frozen.aliasMap
|
||||
defaultCommand = frozen.defaultCommand
|
||||
frozen = undefined
|
||||
}
|
||||
|
||||
|
||||
58
node_modules/webpack-dev-server/node_modules/yargs/lib/completion.js
generated
vendored
58
node_modules/webpack-dev-server/node_modules/yargs/lib/completion.js
generated
vendored
@@ -1,16 +1,17 @@
|
||||
'use strict'
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
// add bash completions to your
|
||||
// yargs-powered applications.
|
||||
module.exports = function (yargs, usage, command) {
|
||||
module.exports = function completion (yargs, usage, command) {
|
||||
const self = {
|
||||
completionKey: 'get-yargs-completions'
|
||||
}
|
||||
|
||||
// get a list of completion commands.
|
||||
// 'args' is the array of strings from the line to be completed
|
||||
self.getCompletion = function (args, done) {
|
||||
self.getCompletion = function getCompletion (args, done) {
|
||||
const completions = []
|
||||
const current = args.length ? args[args.length - 1] : ''
|
||||
const argv = yargs.parse(args, true)
|
||||
@@ -20,14 +21,14 @@ module.exports = function (yargs, usage, command) {
|
||||
// to completion().
|
||||
if (completionFunction) {
|
||||
if (completionFunction.length < 3) {
|
||||
var result = completionFunction(current, argv)
|
||||
const result = completionFunction(current, argv)
|
||||
|
||||
// promise based completion function.
|
||||
if (typeof result.then === 'function') {
|
||||
return result.then(function (list) {
|
||||
process.nextTick(function () { done(list) })
|
||||
}).catch(function (err) {
|
||||
process.nextTick(function () { throw err })
|
||||
return result.then((list) => {
|
||||
process.nextTick(() => { done(list) })
|
||||
}).catch((err) => {
|
||||
process.nextTick(() => { throw err })
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,36 +36,40 @@ module.exports = function (yargs, usage, command) {
|
||||
return done(result)
|
||||
} else {
|
||||
// asynchronous completion function
|
||||
return completionFunction(current, argv, function (completions) {
|
||||
return completionFunction(current, argv, (completions) => {
|
||||
done(completions)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var handlers = command.getCommandHandlers()
|
||||
for (var i = 0, ii = args.length; i < ii; ++i) {
|
||||
const handlers = command.getCommandHandlers()
|
||||
for (let i = 0, ii = args.length; i < ii; ++i) {
|
||||
if (handlers[args[i]] && handlers[args[i]].builder) {
|
||||
return handlers[args[i]].builder(yargs.reset()).argv
|
||||
const builder = handlers[args[i]].builder
|
||||
if (typeof builder === 'function') {
|
||||
const y = yargs.reset()
|
||||
builder(y)
|
||||
return y.argv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!current.match(/^-/)) {
|
||||
usage.getCommands().forEach(function (command) {
|
||||
if (args.indexOf(command[0]) === -1) {
|
||||
completions.push(command[0])
|
||||
usage.getCommands().forEach((usageCommand) => {
|
||||
const commandName = command.parseCommand(usageCommand[0]).cmd
|
||||
if (args.indexOf(commandName) === -1) {
|
||||
completions.push(commandName)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (current.match(/^-/)) {
|
||||
Object.keys(yargs.getOptions().key).forEach(function (key) {
|
||||
Object.keys(yargs.getOptions().key).forEach((key) => {
|
||||
// If the key and its aliases aren't in 'args', add the key to 'completions'
|
||||
var keyAndAliases = [key].concat(aliases[key] || [])
|
||||
var notInArgs = keyAndAliases.every(function (val) {
|
||||
return args.indexOf('--' + val) === -1
|
||||
})
|
||||
const keyAndAliases = [key].concat(aliases[key] || [])
|
||||
const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1)
|
||||
if (notInArgs) {
|
||||
completions.push('--' + key)
|
||||
completions.push(`--${key}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -73,25 +78,26 @@ module.exports = function (yargs, usage, command) {
|
||||
}
|
||||
|
||||
// generate the completion script to add to your .bashrc.
|
||||
self.generateCompletionScript = function ($0) {
|
||||
var script = fs.readFileSync(
|
||||
self.generateCompletionScript = function generateCompletionScript ($0, cmd) {
|
||||
let script = fs.readFileSync(
|
||||
path.resolve(__dirname, '../completion.sh.hbs'),
|
||||
'utf-8'
|
||||
)
|
||||
var name = path.basename($0)
|
||||
const name = path.basename($0)
|
||||
|
||||
// add ./to applications not yet installed as bin.
|
||||
if ($0.match(/\.js$/)) $0 = './' + $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)
|
||||
}
|
||||
|
||||
// register a function to perform your own custom
|
||||
// completions., this function can be either
|
||||
// synchrnous or asynchronous.
|
||||
var completionFunction = null
|
||||
self.registerFunction = function (fn) {
|
||||
let completionFunction = null
|
||||
self.registerFunction = (fn) => {
|
||||
completionFunction = fn
|
||||
}
|
||||
|
||||
|
||||
14
node_modules/webpack-dev-server/node_modules/yargs/lib/levenshtein.js
generated
vendored
14
node_modules/webpack-dev-server/node_modules/yargs/lib/levenshtein.js
generated
vendored
@@ -10,22 +10,22 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
// levenshtein distance algorithm, pulled from Andrei Mackenzie's MIT licensed.
|
||||
// gist, which can be found here: https://gist.github.com/andrei-m/982927
|
||||
|
||||
'use strict'
|
||||
// Compute the edit distance between the two given strings
|
||||
module.exports = function (a, b) {
|
||||
module.exports = function levenshtein (a, b) {
|
||||
if (a.length === 0) return b.length
|
||||
if (b.length === 0) return a.length
|
||||
|
||||
var matrix = []
|
||||
const matrix = []
|
||||
|
||||
// increment along the first column of each row
|
||||
var i
|
||||
let i
|
||||
for (i = 0; i <= b.length; i++) {
|
||||
matrix[i] = [i]
|
||||
}
|
||||
|
||||
// increment each column in the first row
|
||||
var j
|
||||
let j
|
||||
for (j = 0; j <= a.length; j++) {
|
||||
matrix[0][j] = j
|
||||
}
|
||||
@@ -37,8 +37,8 @@ module.exports = function (a, b) {
|
||||
matrix[i][j] = matrix[i - 1][j - 1]
|
||||
} else {
|
||||
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
|
||||
Math.min(matrix[i][j - 1] + 1, // insertion
|
||||
matrix[i - 1][j] + 1)) // deletion
|
||||
Math.min(matrix[i][j - 1] + 1, // insertion
|
||||
matrix[i - 1][j] + 1)) // deletion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
7
node_modules/webpack-dev-server/node_modules/yargs/lib/obj-filter.js
generated
vendored
7
node_modules/webpack-dev-server/node_modules/yargs/lib/obj-filter.js
generated
vendored
@@ -1,7 +1,8 @@
|
||||
module.exports = function (original, filter) {
|
||||
'use strict'
|
||||
module.exports = function objFilter (original, filter) {
|
||||
const obj = {}
|
||||
filter = filter || function (k, v) { return true }
|
||||
Object.keys(original || {}).forEach(function (key) {
|
||||
filter = filter || ((k, v) => true)
|
||||
Object.keys(original || {}).forEach((key) => {
|
||||
if (filter(key, original[key])) {
|
||||
obj[key] = original[key]
|
||||
}
|
||||
|
||||
371
node_modules/webpack-dev-server/node_modules/yargs/lib/usage.js
generated
vendored
371
node_modules/webpack-dev-server/node_modules/yargs/lib/usage.js
generated
vendored
@@ -1,22 +1,25 @@
|
||||
'use strict'
|
||||
// this file handles outputting usage instructions,
|
||||
// failures, etc. keeps logging in one place.
|
||||
const stringWidth = require('string-width')
|
||||
const objFilter = require('./obj-filter')
|
||||
const path = require('path')
|
||||
const setBlocking = require('set-blocking')
|
||||
const YError = require('./yerror')
|
||||
|
||||
module.exports = function (yargs, y18n) {
|
||||
module.exports = function usage (yargs, y18n) {
|
||||
const __ = y18n.__
|
||||
const self = {}
|
||||
|
||||
// methods for ouputting/building failure message.
|
||||
var fails = []
|
||||
self.failFn = function (f) {
|
||||
const fails = []
|
||||
self.failFn = function failFn (f) {
|
||||
fails.push(f)
|
||||
}
|
||||
|
||||
var failMessage = null
|
||||
var showHelpOnFail = true
|
||||
self.showHelpOnFail = function (enabled, message) {
|
||||
let failMessage = null
|
||||
let showHelpOnFail = true
|
||||
self.showHelpOnFail = function showHelpOnFailFn (enabled, message) {
|
||||
if (typeof enabled === 'string') {
|
||||
message = enabled
|
||||
enabled = true
|
||||
@@ -28,12 +31,12 @@ module.exports = function (yargs, y18n) {
|
||||
return self
|
||||
}
|
||||
|
||||
var failureOutput = false
|
||||
self.fail = function (msg, err) {
|
||||
let failureOutput = false
|
||||
self.fail = function fail (msg, err) {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
|
||||
if (fails.length) {
|
||||
for (var i = fails.length - 1; i >= 0; --i) {
|
||||
for (let i = fails.length - 1; i >= 0; --i) {
|
||||
fails[i](msg, err, self)
|
||||
}
|
||||
} else {
|
||||
@@ -42,15 +45,18 @@ module.exports = function (yargs, y18n) {
|
||||
// don't output failure message more than once
|
||||
if (!failureOutput) {
|
||||
failureOutput = true
|
||||
if (showHelpOnFail) yargs.showHelp('error')
|
||||
if (msg) logger.error(msg)
|
||||
if (showHelpOnFail) {
|
||||
yargs.showHelp('error')
|
||||
logger.error()
|
||||
}
|
||||
if (msg || err) logger.error(msg || err)
|
||||
if (failMessage) {
|
||||
if (msg) logger.error('')
|
||||
if (msg || err) logger.error('')
|
||||
logger.error(failMessage)
|
||||
}
|
||||
}
|
||||
|
||||
err = err || new Error(msg)
|
||||
err = err || new YError(msg)
|
||||
if (yargs.getExitProcess()) {
|
||||
return yargs.exit(1)
|
||||
} else if (yargs._hasParseCallback()) {
|
||||
@@ -62,49 +68,67 @@ module.exports = function (yargs, y18n) {
|
||||
}
|
||||
|
||||
// methods for ouputting/building help (usage) message.
|
||||
var usage
|
||||
self.usage = function (msg) {
|
||||
usage = msg
|
||||
let usages = []
|
||||
let usageDisabled = false
|
||||
self.usage = (msg, description) => {
|
||||
if (msg === null) {
|
||||
usageDisabled = true
|
||||
usages = []
|
||||
return
|
||||
}
|
||||
usageDisabled = false
|
||||
usages.push([msg, description || ''])
|
||||
return self
|
||||
}
|
||||
self.getUsage = function () {
|
||||
return usage
|
||||
self.getUsage = () => {
|
||||
return usages
|
||||
}
|
||||
self.getUsageDisabled = () => {
|
||||
return usageDisabled
|
||||
}
|
||||
|
||||
var examples = []
|
||||
self.example = function (cmd, description) {
|
||||
self.getPositionalGroupName = () => {
|
||||
return __('Positionals:')
|
||||
}
|
||||
|
||||
let examples = []
|
||||
self.example = (cmd, description) => {
|
||||
examples.push([cmd, description || ''])
|
||||
}
|
||||
|
||||
var commands = []
|
||||
self.command = function (cmd, description, aliases) {
|
||||
commands.push([cmd, description || '', aliases])
|
||||
}
|
||||
self.getCommands = function () {
|
||||
return commands
|
||||
let commands = []
|
||||
self.command = function command (cmd, description, isDefault, aliases) {
|
||||
// the last default wins, so cancel out any previously set default
|
||||
if (isDefault) {
|
||||
commands = commands.map((cmdArray) => {
|
||||
cmdArray[2] = false
|
||||
return cmdArray
|
||||
})
|
||||
}
|
||||
commands.push([cmd, description || '', isDefault, aliases])
|
||||
}
|
||||
self.getCommands = () => commands
|
||||
|
||||
var descriptions = {}
|
||||
self.describe = function (key, desc) {
|
||||
let descriptions = {}
|
||||
self.describe = function describe (key, desc) {
|
||||
if (typeof key === 'object') {
|
||||
Object.keys(key).forEach(function (k) {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.describe(k, key[k])
|
||||
})
|
||||
} else {
|
||||
descriptions[key] = desc
|
||||
}
|
||||
}
|
||||
self.getDescriptions = function () {
|
||||
return descriptions
|
||||
}
|
||||
self.getDescriptions = () => descriptions
|
||||
|
||||
var epilog
|
||||
self.epilog = function (msg) {
|
||||
let epilog
|
||||
self.epilog = (msg) => {
|
||||
epilog = msg
|
||||
}
|
||||
|
||||
var wrapSet = false
|
||||
var wrap
|
||||
self.wrap = function (cols) {
|
||||
let wrapSet = false
|
||||
let wrap
|
||||
self.wrap = (cols) => {
|
||||
wrapSet = true
|
||||
wrap = cols
|
||||
}
|
||||
@@ -118,41 +142,64 @@ module.exports = function (yargs, y18n) {
|
||||
return wrap
|
||||
}
|
||||
|
||||
var deferY18nLookupPrefix = '__yargsString__:'
|
||||
self.deferY18nLookup = function (str) {
|
||||
return deferY18nLookupPrefix + str
|
||||
}
|
||||
const deferY18nLookupPrefix = '__yargsString__:'
|
||||
self.deferY18nLookup = str => deferY18nLookupPrefix + str
|
||||
|
||||
var defaultGroup = 'Options:'
|
||||
self.help = function () {
|
||||
const defaultGroup = 'Options:'
|
||||
self.help = function help () {
|
||||
normalizeAliases()
|
||||
|
||||
// handle old demanded API
|
||||
var demandedOptions = yargs.getDemandedOptions()
|
||||
var demandedCommands = yargs.getDemandedCommands()
|
||||
var groups = yargs.getGroups()
|
||||
var options = yargs.getOptions()
|
||||
var keys = Object.keys(
|
||||
Object.keys(descriptions)
|
||||
.concat(Object.keys(demandedOptions))
|
||||
.concat(Object.keys(demandedCommands))
|
||||
.concat(Object.keys(options.default))
|
||||
.reduce(function (acc, key) {
|
||||
if (key !== '_') acc[key] = true
|
||||
return acc
|
||||
}, {})
|
||||
)
|
||||
const base$0 = path.basename(yargs.$0)
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
const demandedCommands = yargs.getDemandedCommands()
|
||||
const groups = yargs.getGroups()
|
||||
const options = yargs.getOptions()
|
||||
|
||||
var theWrap = getWrap()
|
||||
var ui = require('cliui')({
|
||||
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(key => {
|
||||
if (options.hiddenOptions.indexOf(key) < 0) {
|
||||
return true
|
||||
} else if (yargs.parsed.argv[options.showHiddenOpt]) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
keys = Object.keys(keys.reduce((acc, key) => {
|
||||
if (key !== '_') acc[key] = true
|
||||
return acc
|
||||
}, {}))
|
||||
|
||||
const theWrap = getWrap()
|
||||
const ui = require('cliui')({
|
||||
width: theWrap,
|
||||
wrap: !!theWrap
|
||||
})
|
||||
|
||||
// the usage string.
|
||||
if (usage) {
|
||||
var u = usage.replace(/\$0/g, yargs.$0)
|
||||
ui.div(u + '\n')
|
||||
if (!usageDisabled) {
|
||||
if (usages.length) {
|
||||
// user-defined usage.
|
||||
usages.forEach((usage) => {
|
||||
ui.div(`${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
|
||||
// demonstrate how commands are used.
|
||||
if (demandedCommands._) {
|
||||
u = `${base$0} <${__('command')}>\n`
|
||||
} else {
|
||||
u = `${base$0} [${__('command')}]\n`
|
||||
}
|
||||
ui.div(`${u}`)
|
||||
}
|
||||
}
|
||||
|
||||
// your application's commands, i.e., non-option
|
||||
@@ -160,13 +207,26 @@ module.exports = function (yargs, y18n) {
|
||||
if (commands.length) {
|
||||
ui.div(__('Commands:'))
|
||||
|
||||
commands.forEach(function (command) {
|
||||
const context = yargs.getContext()
|
||||
const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''
|
||||
|
||||
commands.forEach((command) => {
|
||||
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}` // drop $0 from default commands.
|
||||
ui.span(
|
||||
{text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands, theWrap) + 4},
|
||||
{
|
||||
text: commandString,
|
||||
padding: [0, 2, 0, 2],
|
||||
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
|
||||
},
|
||||
{text: command[1]}
|
||||
)
|
||||
if (command[2] && command[2].length) {
|
||||
ui.div({text: '[' + __('aliases:') + ' ' + command[2].join(', ') + ']', padding: [0, 0, 0, 2], align: 'right'})
|
||||
const hints = []
|
||||
if (command[2]) hints.push(`[${__('default:').slice(0, -1)}]`) // TODO hacking around i18n here
|
||||
if (command[3] && command[3].length) {
|
||||
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`)
|
||||
}
|
||||
if (hints.length) {
|
||||
ui.div({text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right'})
|
||||
} else {
|
||||
ui.div()
|
||||
}
|
||||
@@ -177,14 +237,10 @@ module.exports = function (yargs, y18n) {
|
||||
|
||||
// perform some cleanup on the keys array, making it
|
||||
// only include top-level keys not their aliases.
|
||||
var aliasKeys = (Object.keys(options.alias) || [])
|
||||
const aliasKeys = (Object.keys(options.alias) || [])
|
||||
.concat(Object.keys(yargs.parsed.newAliases) || [])
|
||||
|
||||
keys = keys.filter(function (key) {
|
||||
return !yargs.parsed.newAliases[key] && aliasKeys.every(function (alias) {
|
||||
return (options.alias[alias] || []).indexOf(key) === -1
|
||||
})
|
||||
})
|
||||
keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1))
|
||||
|
||||
// populate 'Options:' group with any keys that have not
|
||||
// explicitly had a group set.
|
||||
@@ -192,51 +248,54 @@ module.exports = function (yargs, y18n) {
|
||||
addUngroupedKeys(keys, options.alias, groups)
|
||||
|
||||
// display 'Options:' table along with any custom tables:
|
||||
Object.keys(groups).forEach(function (groupName) {
|
||||
Object.keys(groups).forEach((groupName) => {
|
||||
if (!groups[groupName].length) return
|
||||
|
||||
ui.div(__(groupName))
|
||||
|
||||
// if we've grouped the key 'f', but 'f' aliases 'foobar',
|
||||
// normalizedKeys should contain only 'foobar'.
|
||||
var normalizedKeys = groups[groupName].map(function (key) {
|
||||
const normalizedKeys = groups[groupName].map((key) => {
|
||||
if (~aliasKeys.indexOf(key)) return key
|
||||
for (var i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
||||
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
||||
if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey
|
||||
}
|
||||
return key
|
||||
})
|
||||
|
||||
// actually generate the switches string --foo, -f, --bar.
|
||||
var switches = normalizedKeys.reduce(function (acc, key) {
|
||||
const switches = normalizedKeys.reduce((acc, key) => {
|
||||
acc[key] = [ key ].concat(options.alias[key] || [])
|
||||
.map(function (sw) {
|
||||
return (sw.length > 1 ? '--' : '-') + sw
|
||||
.map(sw => {
|
||||
// for the special positional group don't
|
||||
// add '--' or '-' prefix.
|
||||
if (groupName === self.getPositionalGroupName()) return sw
|
||||
else return (sw.length > 1 ? '--' : '-') + sw
|
||||
})
|
||||
.join(', ')
|
||||
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
normalizedKeys.forEach(function (key) {
|
||||
var kswitch = switches[key]
|
||||
var desc = descriptions[key] || ''
|
||||
var type = null
|
||||
normalizedKeys.forEach((key) => {
|
||||
const kswitch = switches[key]
|
||||
let desc = descriptions[key] || ''
|
||||
let type = null
|
||||
|
||||
if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length))
|
||||
|
||||
if (~options.boolean.indexOf(key)) type = '[' + __('boolean') + ']'
|
||||
if (~options.count.indexOf(key)) type = '[' + __('count') + ']'
|
||||
if (~options.string.indexOf(key)) type = '[' + __('string') + ']'
|
||||
if (~options.normalize.indexOf(key)) type = '[' + __('string') + ']'
|
||||
if (~options.array.indexOf(key)) type = '[' + __('array') + ']'
|
||||
if (~options.number.indexOf(key)) type = '[' + __('number') + ']'
|
||||
if (~options.boolean.indexOf(key)) type = `[${__('boolean')}]`
|
||||
if (~options.count.indexOf(key)) type = `[${__('count')}]`
|
||||
if (~options.string.indexOf(key)) type = `[${__('string')}]`
|
||||
if (~options.normalize.indexOf(key)) type = `[${__('string')}]`
|
||||
if (~options.array.indexOf(key)) type = `[${__('array')}]`
|
||||
if (~options.number.indexOf(key)) type = `[${__('number')}]`
|
||||
|
||||
var extra = [
|
||||
const extra = [
|
||||
type,
|
||||
demandedOptions[key] ? '[' + __('required') + ']' : null,
|
||||
options.choices && options.choices[key] ? '[' + __('choices:') + ' ' +
|
||||
self.stringifiedValues(options.choices[key]) + ']' : null,
|
||||
(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(' ')
|
||||
|
||||
@@ -256,15 +315,29 @@ module.exports = function (yargs, y18n) {
|
||||
if (examples.length) {
|
||||
ui.div(__('Examples:'))
|
||||
|
||||
examples.forEach(function (example) {
|
||||
example[0] = example[0].replace(/\$0/g, yargs.$0)
|
||||
examples.forEach((example) => {
|
||||
example[0] = example[0].replace(/\$0/g, base$0)
|
||||
})
|
||||
|
||||
examples.forEach(function (example) {
|
||||
ui.div(
|
||||
{text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples, theWrap) + 4},
|
||||
example[1]
|
||||
)
|
||||
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()
|
||||
@@ -272,28 +345,30 @@ module.exports = function (yargs, y18n) {
|
||||
|
||||
// the usage string.
|
||||
if (epilog) {
|
||||
var e = epilog.replace(/\$0/g, yargs.$0)
|
||||
ui.div(e + '\n')
|
||||
const e = epilog.replace(/\$0/g, base$0)
|
||||
ui.div(`${e}\n`)
|
||||
}
|
||||
|
||||
return ui.toString()
|
||||
// Remove the trailing white spaces
|
||||
return ui.toString().replace(/\s*$/, '')
|
||||
}
|
||||
|
||||
// return the maximum width of a string
|
||||
// in the left-hand column of a table.
|
||||
function maxWidth (table, theWrap) {
|
||||
var width = 0
|
||||
function maxWidth (table, theWrap, modifier) {
|
||||
let width = 0
|
||||
|
||||
// table might be of the form [leftColumn],
|
||||
// or {key: leftColumn}
|
||||
if (!Array.isArray(table)) {
|
||||
table = Object.keys(table).map(function (key) {
|
||||
return [table[key]]
|
||||
})
|
||||
table = Object.keys(table).map(key => [table[key]])
|
||||
}
|
||||
|
||||
table.forEach(function (v) {
|
||||
width = Math.max(stringWidth(v[0]), width)
|
||||
table.forEach((v) => {
|
||||
width = Math.max(
|
||||
stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]),
|
||||
width
|
||||
)
|
||||
})
|
||||
|
||||
// if we've enabled 'wrap' we should limit
|
||||
@@ -307,15 +382,15 @@ module.exports = function (yargs, y18n) {
|
||||
// are copied to the keys being aliased.
|
||||
function normalizeAliases () {
|
||||
// handle old demanded API
|
||||
var demandedOptions = yargs.getDemandedOptions()
|
||||
var options = yargs.getOptions()
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
const options = yargs.getOptions()
|
||||
|
||||
;(Object.keys(options.alias) || []).forEach(function (key) {
|
||||
options.alias[key].forEach(function (alias) {
|
||||
;(Object.keys(options.alias) || []).forEach((key) => {
|
||||
options.alias[key].forEach((alias) => {
|
||||
// copy descriptions.
|
||||
if (descriptions[alias]) self.describe(key, descriptions[alias])
|
||||
// copy demanded.
|
||||
if (demandedOptions[alias]) yargs.demandOption(key, demandedOptions[alias].msg)
|
||||
if (alias in demandedOptions) yargs.demandOption(key, demandedOptions[alias])
|
||||
// type messages.
|
||||
if (~options.boolean.indexOf(alias)) yargs.boolean(key)
|
||||
if (~options.count.indexOf(alias)) yargs.count(key)
|
||||
@@ -330,43 +405,41 @@ module.exports = function (yargs, y18n) {
|
||||
// given a set of keys, place any keys that are
|
||||
// ungrouped under the 'Options:' grouping.
|
||||
function addUngroupedKeys (keys, aliases, groups) {
|
||||
var groupedKeys = []
|
||||
var toCheck = null
|
||||
Object.keys(groups).forEach(function (group) {
|
||||
let groupedKeys = []
|
||||
let toCheck = null
|
||||
Object.keys(groups).forEach((group) => {
|
||||
groupedKeys = groupedKeys.concat(groups[group])
|
||||
})
|
||||
|
||||
keys.forEach(function (key) {
|
||||
keys.forEach((key) => {
|
||||
toCheck = [key].concat(aliases[key])
|
||||
if (!toCheck.some(function (k) {
|
||||
return groupedKeys.indexOf(k) !== -1
|
||||
})) {
|
||||
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
|
||||
groups[defaultGroup].push(key)
|
||||
}
|
||||
})
|
||||
return groupedKeys
|
||||
}
|
||||
|
||||
self.showHelp = function (level) {
|
||||
self.showHelp = (level) => {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
if (!level) level = 'error'
|
||||
var emit = typeof level === 'function' ? level : logger[level]
|
||||
const emit = typeof level === 'function' ? level : logger[level]
|
||||
emit(self.help())
|
||||
}
|
||||
|
||||
self.functionDescription = function (fn) {
|
||||
var description = fn.name ? require('decamelize')(fn.name, '-') : __('generated-value')
|
||||
self.functionDescription = (fn) => {
|
||||
const description = fn.name ? require('decamelize')(fn.name, '-') : __('generated-value')
|
||||
return ['(', description, ')'].join('')
|
||||
}
|
||||
|
||||
self.stringifiedValues = function (values, separator) {
|
||||
var string = ''
|
||||
var sep = separator || ', '
|
||||
var array = [].concat(values)
|
||||
self.stringifiedValues = function stringifiedValues (values, separator) {
|
||||
let string = ''
|
||||
const sep = separator || ', '
|
||||
const array = [].concat(values)
|
||||
|
||||
if (!values || !array.length) return string
|
||||
|
||||
array.forEach(function (value) {
|
||||
array.forEach((value) => {
|
||||
if (string.length) string += sep
|
||||
string += JSON.stringify(value)
|
||||
})
|
||||
@@ -377,7 +450,7 @@ module.exports = function (yargs, y18n) {
|
||||
// format the default-value-string displayed in
|
||||
// the right-hand column.
|
||||
function defaultString (value, defaultDescription) {
|
||||
var string = '[' + __('default:') + ' '
|
||||
let string = `[${__('default:')} `
|
||||
|
||||
if (value === undefined && !defaultDescription) return null
|
||||
|
||||
@@ -386,7 +459,7 @@ module.exports = function (yargs, y18n) {
|
||||
} else {
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
string += JSON.stringify(value)
|
||||
string += `"${value}"`
|
||||
break
|
||||
case 'object':
|
||||
string += JSON.stringify(value)
|
||||
@@ -396,12 +469,12 @@ module.exports = function (yargs, y18n) {
|
||||
}
|
||||
}
|
||||
|
||||
return string + ']'
|
||||
return `${string}]`
|
||||
}
|
||||
|
||||
// guess the width of the console window, max-width 80.
|
||||
function windowWidth () {
|
||||
var maxWidth = 80
|
||||
const maxWidth = 80
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
||||
return Math.min(maxWidth, process.stdout.columns)
|
||||
} else {
|
||||
@@ -410,47 +483,47 @@ module.exports = function (yargs, y18n) {
|
||||
}
|
||||
|
||||
// logic for displaying application version.
|
||||
var version = null
|
||||
self.version = function (ver) {
|
||||
let version = null
|
||||
self.version = (ver) => {
|
||||
version = ver
|
||||
}
|
||||
|
||||
self.showVersion = function () {
|
||||
self.showVersion = () => {
|
||||
const logger = yargs._getLoggerInstance()
|
||||
if (typeof version === 'function') logger.log(version())
|
||||
else logger.log(version)
|
||||
logger.log(version)
|
||||
}
|
||||
|
||||
self.reset = function (globalLookup) {
|
||||
self.reset = function reset (localLookup) {
|
||||
// do not reset wrap here
|
||||
// do not reset fails here
|
||||
failMessage = null
|
||||
failureOutput = false
|
||||
usage = undefined
|
||||
usages = []
|
||||
usageDisabled = false
|
||||
epilog = undefined
|
||||
examples = []
|
||||
commands = []
|
||||
descriptions = objFilter(descriptions, function (k, v) {
|
||||
return globalLookup[k]
|
||||
})
|
||||
descriptions = objFilter(descriptions, (k, v) => !localLookup[k])
|
||||
return self
|
||||
}
|
||||
|
||||
var frozen
|
||||
self.freeze = function () {
|
||||
let frozen
|
||||
self.freeze = function freeze () {
|
||||
frozen = {}
|
||||
frozen.failMessage = failMessage
|
||||
frozen.failureOutput = failureOutput
|
||||
frozen.usage = usage
|
||||
frozen.usages = usages
|
||||
frozen.usageDisabled = usageDisabled
|
||||
frozen.epilog = epilog
|
||||
frozen.examples = examples
|
||||
frozen.commands = commands
|
||||
frozen.descriptions = descriptions
|
||||
}
|
||||
self.unfreeze = function () {
|
||||
self.unfreeze = function unfreeze () {
|
||||
failMessage = frozen.failMessage
|
||||
failureOutput = frozen.failureOutput
|
||||
usage = frozen.usage
|
||||
usages = frozen.usages
|
||||
usageDisabled = frozen.usageDisabled
|
||||
epilog = frozen.epilog
|
||||
examples = frozen.examples
|
||||
commands = frozen.commands
|
||||
|
||||
278
node_modules/webpack-dev-server/node_modules/yargs/lib/validation.js
generated
vendored
278
node_modules/webpack-dev-server/node_modules/yargs/lib/validation.js
generated
vendored
@@ -1,15 +1,18 @@
|
||||
'use strict'
|
||||
const argsert = require('./argsert')
|
||||
const objFilter = require('./obj-filter')
|
||||
const specialKeys = ['$0', '--', '_']
|
||||
|
||||
// validation-type-stuff, missing params,
|
||||
// bad implications, custom checks.
|
||||
module.exports = function (yargs, usage, y18n) {
|
||||
module.exports = function validation (yargs, usage, y18n) {
|
||||
const __ = y18n.__
|
||||
const __n = y18n.__n
|
||||
const self = {}
|
||||
|
||||
// validate appropriate # of non-option
|
||||
// arguments were provided, i.e., '_'.
|
||||
self.nonOptionCount = function (argv) {
|
||||
self.nonOptionCount = function nonOptionCount (argv) {
|
||||
const demandedCommands = yargs.getDemandedCommands()
|
||||
// don't count currently executing commands
|
||||
const _s = argv._.length - yargs.getContext().commands.length
|
||||
@@ -34,7 +37,7 @@ module.exports = function (yargs, usage, y18n) {
|
||||
)
|
||||
} else {
|
||||
usage.fail(
|
||||
__('Too many non-option arguments: got %s, maximum of %s', _s, demandedCommands._.max)
|
||||
__('Too many non-option arguments: got %s, maximum of %s', _s, demandedCommands._.max)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -43,7 +46,7 @@ module.exports = function (yargs, usage, y18n) {
|
||||
|
||||
// validate the appropriate # of <required>
|
||||
// positional arguments were provided:
|
||||
self.positionalCount = function (required, observed) {
|
||||
self.positionalCount = function positionalCount (required, observed) {
|
||||
if (observed < required) {
|
||||
usage.fail(
|
||||
__('Not enough non-option arguments: got %s, need at least %s', observed, required)
|
||||
@@ -51,45 +54,13 @@ module.exports = function (yargs, usage, y18n) {
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that any args that require an
|
||||
// value (--foo=bar), have a value.
|
||||
self.missingArgumentValue = function (argv) {
|
||||
const defaultValues = [true, false, '']
|
||||
const options = yargs.getOptions()
|
||||
|
||||
if (options.requiresArg.length > 0) {
|
||||
const missingRequiredArgs = []
|
||||
|
||||
options.requiresArg.forEach(function (key) {
|
||||
const value = argv[key]
|
||||
|
||||
// if a value is explicitly requested,
|
||||
// flag argument as missing if it does not
|
||||
// look like foo=bar was entered.
|
||||
if (~defaultValues.indexOf(value) ||
|
||||
(Array.isArray(value) && !value.length)) {
|
||||
missingRequiredArgs.push(key)
|
||||
}
|
||||
})
|
||||
|
||||
if (missingRequiredArgs.length > 0) {
|
||||
usage.fail(__n(
|
||||
'Missing argument value: %s',
|
||||
'Missing argument values: %s',
|
||||
missingRequiredArgs.length,
|
||||
missingRequiredArgs.join(', ')
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make sure all the required arguments are present.
|
||||
self.requiredArguments = function (argv) {
|
||||
self.requiredArguments = function requiredArguments (argv) {
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
var missing = null
|
||||
let missing = null
|
||||
|
||||
Object.keys(demandedOptions).forEach(function (key) {
|
||||
if (!argv.hasOwnProperty(key)) {
|
||||
Object.keys(demandedOptions).forEach((key) => {
|
||||
if (!argv.hasOwnProperty(key) || typeof argv[key] === 'undefined') {
|
||||
missing = missing || {}
|
||||
missing[key] = demandedOptions[key]
|
||||
}
|
||||
@@ -97,14 +68,14 @@ module.exports = function (yargs, usage, y18n) {
|
||||
|
||||
if (missing) {
|
||||
const customMsgs = []
|
||||
Object.keys(missing).forEach(function (key) {
|
||||
const msg = missing[key].msg
|
||||
Object.keys(missing).forEach((key) => {
|
||||
const msg = missing[key]
|
||||
if (msg && customMsgs.indexOf(msg) < 0) {
|
||||
customMsgs.push(msg)
|
||||
}
|
||||
})
|
||||
|
||||
const customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : ''
|
||||
const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : ''
|
||||
|
||||
usage.fail(__n(
|
||||
'Missing required argument: %s',
|
||||
@@ -116,31 +87,23 @@ module.exports = function (yargs, usage, y18n) {
|
||||
}
|
||||
|
||||
// check for unknown arguments (strict-mode).
|
||||
self.unknownArguments = function (argv, aliases) {
|
||||
const aliasLookup = {}
|
||||
const descriptions = usage.getDescriptions()
|
||||
const demandedOptions = yargs.getDemandedOptions()
|
||||
self.unknownArguments = function unknownArguments (argv, aliases, positionalMap) {
|
||||
const commandKeys = yargs.getCommandInstance().getCommands()
|
||||
const unknown = []
|
||||
const currentContext = yargs.getContext()
|
||||
|
||||
Object.keys(aliases).forEach(function (key) {
|
||||
aliases[key].forEach(function (alias) {
|
||||
aliasLookup[alias] = key
|
||||
})
|
||||
})
|
||||
|
||||
Object.keys(argv).forEach(function (key) {
|
||||
if (key !== '$0' && key !== '_' &&
|
||||
!descriptions.hasOwnProperty(key) &&
|
||||
!demandedOptions.hasOwnProperty(key) &&
|
||||
!aliasLookup.hasOwnProperty(key)) {
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
!positionalMap.hasOwnProperty(key) &&
|
||||
!yargs._getParseContext().hasOwnProperty(key) &&
|
||||
!aliases.hasOwnProperty(key)
|
||||
) {
|
||||
unknown.push(key)
|
||||
}
|
||||
})
|
||||
|
||||
if (commandKeys.length > 0) {
|
||||
argv._.slice(currentContext.commands.length).forEach(function (key) {
|
||||
argv._.slice(currentContext.commands.length).forEach((key) => {
|
||||
if (commandKeys.indexOf(key) === -1) {
|
||||
unknown.push(key)
|
||||
}
|
||||
@@ -158,18 +121,19 @@ module.exports = function (yargs, usage, y18n) {
|
||||
}
|
||||
|
||||
// validate arguments limited to enumerated choices
|
||||
self.limitedChoices = function (argv) {
|
||||
self.limitedChoices = function limitedChoices (argv) {
|
||||
const options = yargs.getOptions()
|
||||
const invalid = {}
|
||||
|
||||
if (!Object.keys(options.choices).length) return
|
||||
|
||||
Object.keys(argv).forEach(function (key) {
|
||||
if (key !== '$0' && key !== '_' &&
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (specialKeys.indexOf(key) === -1 &&
|
||||
options.choices.hasOwnProperty(key)) {
|
||||
[].concat(argv[key]).forEach(function (value) {
|
||||
[].concat(argv[key]).forEach((value) => {
|
||||
// TODO case-insensitive configurability
|
||||
if (options.choices[key].indexOf(value) === -1) {
|
||||
if (options.choices[key].indexOf(value) === -1 &&
|
||||
value !== undefined) {
|
||||
invalid[key] = (invalid[key] || []).concat(value)
|
||||
}
|
||||
})
|
||||
@@ -180,36 +144,40 @@ module.exports = function (yargs, usage, y18n) {
|
||||
|
||||
if (!invalidKeys.length) return
|
||||
|
||||
var msg = __('Invalid values:')
|
||||
invalidKeys.forEach(function (key) {
|
||||
msg += '\n ' + __(
|
||||
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)
|
||||
}
|
||||
|
||||
// custom checks, added using the `check` option on yargs.
|
||||
var checks = []
|
||||
self.check = function (f) {
|
||||
checks.push(f)
|
||||
let checks = []
|
||||
self.check = function check (f, global) {
|
||||
checks.push({
|
||||
func: f,
|
||||
global
|
||||
})
|
||||
}
|
||||
|
||||
self.customChecks = function (argv, aliases) {
|
||||
for (var i = 0, f; (f = checks[i]) !== undefined; i++) {
|
||||
var result = null
|
||||
self.customChecks = function customChecks (argv, aliases) {
|
||||
for (let i = 0, f; (f = checks[i]) !== undefined; i++) {
|
||||
const func = f.func
|
||||
let result = null
|
||||
try {
|
||||
result = f(argv, aliases)
|
||||
result = func(argv, aliases)
|
||||
} catch (err) {
|
||||
usage.fail(err.message ? err.message : err, err)
|
||||
continue
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
usage.fail(__('Argument check failed: %s', f.toString()))
|
||||
usage.fail(__('Argument check failed: %s', func.toString()))
|
||||
} else if (typeof result === 'string' || result instanceof Error) {
|
||||
usage.fail(result.toString(), result)
|
||||
}
|
||||
@@ -217,105 +185,129 @@ module.exports = function (yargs, usage, y18n) {
|
||||
}
|
||||
|
||||
// check implications, argument foo implies => argument bar.
|
||||
var implied = {}
|
||||
self.implies = function (key, value) {
|
||||
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(function (k) {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.implies(k, key[k])
|
||||
})
|
||||
} else {
|
||||
implied[key] = value
|
||||
yargs.global(key)
|
||||
if (!implied[key]) {
|
||||
implied[key] = []
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((i) => self.implies(key, i))
|
||||
} else {
|
||||
implied[key].push(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.getImplied = function () {
|
||||
self.getImplied = function getImplied () {
|
||||
return implied
|
||||
}
|
||||
|
||||
self.implications = function (argv) {
|
||||
self.implications = function implications (argv) {
|
||||
const implyFail = []
|
||||
|
||||
Object.keys(implied).forEach(function (key) {
|
||||
var num
|
||||
Object.keys(implied).forEach((key) => {
|
||||
const origKey = key
|
||||
var value = implied[key]
|
||||
;(implied[key] || []).forEach((value) => {
|
||||
let num
|
||||
let key = origKey
|
||||
const origValue = value
|
||||
|
||||
// convert string '1' to number 1
|
||||
num = Number(key)
|
||||
key = isNaN(num) ? key : num
|
||||
// convert string '1' to number 1
|
||||
num = Number(key)
|
||||
key = isNaN(num) ? key : num
|
||||
|
||||
if (typeof key === 'number') {
|
||||
// check length of argv._
|
||||
key = argv._.length >= key
|
||||
} else if (key.match(/^--no-.+/)) {
|
||||
// check if key doesn't exist
|
||||
key = key.match(/^--no-(.+)/)[1]
|
||||
key = !argv[key]
|
||||
} else {
|
||||
// check if key exists
|
||||
key = argv[key]
|
||||
}
|
||||
if (typeof key === 'number') {
|
||||
// check length of argv._
|
||||
key = argv._.length >= key
|
||||
} else if (key.match(/^--no-.+/)) {
|
||||
// check if key doesn't exist
|
||||
key = key.match(/^--no-(.+)/)[1]
|
||||
key = !argv[key]
|
||||
} else {
|
||||
// check if key exists
|
||||
key = argv[key]
|
||||
}
|
||||
|
||||
num = Number(value)
|
||||
value = isNaN(num) ? value : num
|
||||
num = Number(value)
|
||||
value = isNaN(num) ? value : num
|
||||
|
||||
if (typeof value === 'number') {
|
||||
value = argv._.length >= value
|
||||
} else if (value.match(/^--no-.+/)) {
|
||||
value = value.match(/^--no-(.+)/)[1]
|
||||
value = !argv[value]
|
||||
} else {
|
||||
value = argv[value]
|
||||
}
|
||||
|
||||
if (key && !value) {
|
||||
implyFail.push(origKey)
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
value = argv._.length >= value
|
||||
} else if (value.match(/^--no-.+/)) {
|
||||
value = value.match(/^--no-(.+)/)[1]
|
||||
value = !argv[value]
|
||||
} else {
|
||||
value = argv[value]
|
||||
}
|
||||
if (key && !value) {
|
||||
implyFail.push(` ${origKey} -> ${origValue}`)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
if (implyFail.length) {
|
||||
var msg = __('Implications failed:') + '\n'
|
||||
let msg = `${__('Implications failed:')}\n`
|
||||
|
||||
implyFail.forEach(function (key) {
|
||||
msg += (' ' + key + ' -> ' + implied[key])
|
||||
implyFail.forEach((value) => {
|
||||
msg += (value)
|
||||
})
|
||||
|
||||
usage.fail(msg)
|
||||
}
|
||||
}
|
||||
|
||||
var conflicting = {}
|
||||
self.conflicts = function (key, value) {
|
||||
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(function (k) {
|
||||
Object.keys(key).forEach((k) => {
|
||||
self.conflicts(k, key[k])
|
||||
})
|
||||
} else {
|
||||
conflicting[key] = value
|
||||
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 = function () {
|
||||
return conflicting
|
||||
}
|
||||
self.getConflicting = () => conflicting
|
||||
|
||||
self.conflicting = function (argv) {
|
||||
var args = Object.getOwnPropertyNames(argv)
|
||||
|
||||
args.forEach(function (arg) {
|
||||
if (conflicting[arg] && args.indexOf(conflicting[arg]) !== -1) {
|
||||
usage.fail(__('Arguments %s and %s are mutually exclusive', arg, conflicting[arg]))
|
||||
self.conflicting = function conflictingFn (argv) {
|
||||
Object.keys(argv).forEach((key) => {
|
||||
if (conflicting[key]) {
|
||||
conflicting[key].forEach((value) => {
|
||||
// we default keys to 'undefined' that have been configured, we should not
|
||||
// apply conflicting check unless they are a value other than 'undefined'.
|
||||
if (value && argv[key] !== undefined && argv[value] !== undefined) {
|
||||
usage.fail(__('Arguments %s and %s are mutually exclusive', key, value))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
self.recommendCommands = function (cmd, potentialCommands) {
|
||||
self.recommendCommands = function recommendCommands (cmd, potentialCommands) {
|
||||
const distance = require('./levenshtein')
|
||||
const threshold = 3 // if it takes more than three edits, let's move on.
|
||||
potentialCommands = potentialCommands.sort(function (a, b) { return b.length - a.length })
|
||||
potentialCommands = potentialCommands.sort((a, b) => b.length - a.length)
|
||||
|
||||
var recommended = null
|
||||
var bestDistance = Infinity
|
||||
for (var i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
|
||||
var d = distance(cmd, candidate)
|
||||
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
|
||||
@@ -324,23 +316,21 @@ module.exports = function (yargs, usage, y18n) {
|
||||
if (recommended) usage.fail(__('Did you mean %s?', recommended))
|
||||
}
|
||||
|
||||
self.reset = function (globalLookup) {
|
||||
implied = objFilter(implied, function (k, v) {
|
||||
return globalLookup[k]
|
||||
})
|
||||
checks = []
|
||||
conflicting = {}
|
||||
self.reset = function reset (localLookup) {
|
||||
implied = objFilter(implied, (k, v) => !localLookup[k])
|
||||
conflicting = objFilter(conflicting, (k, v) => !localLookup[k])
|
||||
checks = checks.filter(c => c.global)
|
||||
return self
|
||||
}
|
||||
|
||||
var frozen
|
||||
self.freeze = function () {
|
||||
let frozen
|
||||
self.freeze = function freeze () {
|
||||
frozen = {}
|
||||
frozen.implied = implied
|
||||
frozen.checks = checks
|
||||
frozen.conflicting = conflicting
|
||||
}
|
||||
self.unfreeze = function () {
|
||||
self.unfreeze = function unfreeze () {
|
||||
implied = frozen.implied
|
||||
checks = frozen.checks
|
||||
conflicting = frozen.conflicting
|
||||
|
||||
4
node_modules/webpack-dev-server/node_modules/yargs/locales/en.json
generated
vendored
4
node_modules/webpack-dev-server/node_modules/yargs/locales/en.json
generated
vendored
@@ -36,5 +36,7 @@
|
||||
"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"
|
||||
"Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive",
|
||||
"Positionals:": "Positionals:",
|
||||
"command": "command"
|
||||
}
|
||||
|
||||
5
node_modules/webpack-dev-server/node_modules/yargs/locales/hi.json
generated
vendored
5
node_modules/webpack-dev-server/node_modules/yargs/locales/hi.json
generated
vendored
@@ -35,5 +35,8 @@
|
||||
"Path to JSON config file": "JSON config फाइल का पथ",
|
||||
"Show help": "सहायता दिखाएँ",
|
||||
"Show version number": "Version संख्या दिखाएँ",
|
||||
"Did you mean %s?": "क्या आपका मतलब है %s?"
|
||||
"Did you mean %s?": "क्या आपका मतलब है %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "तर्क %s और %s परस्पर अनन्य हैं",
|
||||
"Positionals:": "स्थानीय:",
|
||||
"command": "आदेश"
|
||||
}
|
||||
|
||||
5
node_modules/webpack-dev-server/node_modules/yargs/locales/id.json
generated
vendored
5
node_modules/webpack-dev-server/node_modules/yargs/locales/id.json
generated
vendored
@@ -36,5 +36,8 @@
|
||||
"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?"
|
||||
"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"
|
||||
}
|
||||
|
||||
5
node_modules/webpack-dev-server/node_modules/yargs/locales/ja.json
generated
vendored
5
node_modules/webpack-dev-server/node_modules/yargs/locales/ja.json
generated
vendored
@@ -35,5 +35,8 @@
|
||||
"Path to JSON config file": "JSONの設定ファイルまでのpath",
|
||||
"Show help": "ヘルプを表示",
|
||||
"Show version number": "バージョンを表示",
|
||||
"Did you mean %s?": "もしかして %s?"
|
||||
"Did you mean %s?": "もしかして %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません",
|
||||
"Positionals:": "位置:",
|
||||
"command": "コマンド"
|
||||
}
|
||||
|
||||
5
node_modules/webpack-dev-server/node_modules/yargs/locales/ko.json
generated
vendored
5
node_modules/webpack-dev-server/node_modules/yargs/locales/ko.json
generated
vendored
@@ -35,5 +35,8 @@
|
||||
"Path to JSON config file": "JSON 설정파일 경로",
|
||||
"Show help": "도움말을 보여줍니다",
|
||||
"Show version number": "버전 넘버를 보여줍니다",
|
||||
"Did you mean %s?": "찾고계신게 %s입니까?"
|
||||
"Did you mean %s?": "찾고계신게 %s입니까?",
|
||||
"Arguments %s and %s are mutually exclusive" : "%s와 %s 인자는 같이 사용될 수 없습니다",
|
||||
"Positionals:": "위치:",
|
||||
"command": "명령"
|
||||
}
|
||||
|
||||
5
node_modules/webpack-dev-server/node_modules/yargs/locales/nl.json
generated
vendored
5
node_modules/webpack-dev-server/node_modules/yargs/locales/nl.json
generated
vendored
@@ -35,5 +35,8 @@
|
||||
"Path to JSON config file": "Pad naar JSON configuratiebestand",
|
||||
"Show help": "Toon help",
|
||||
"Show version number": "Toon versie nummer",
|
||||
"Did you mean %s?": "Bedoelde u misschien %s?"
|
||||
"Did you mean %s?": "Bedoelde u misschien %s?",
|
||||
"Arguments %s and %s are mutually exclusive": "Argumenten %s en %s zijn onderling uitsluitend",
|
||||
"Positionals:": "Positie-afhankelijke argumenten",
|
||||
"command": "commando"
|
||||
}
|
||||
|
||||
3
node_modules/webpack-dev-server/node_modules/yargs/locales/pirate.json
generated
vendored
3
node_modules/webpack-dev-server/node_modules/yargs/locales/pirate.json
generated
vendored
@@ -8,5 +8,6 @@
|
||||
"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"
|
||||
"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"
|
||||
}
|
||||
|
||||
5
node_modules/webpack-dev-server/node_modules/yargs/locales/pl.json
generated
vendored
5
node_modules/webpack-dev-server/node_modules/yargs/locales/pl.json
generated
vendored
@@ -35,5 +35,8 @@
|
||||
"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?"
|
||||
"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"
|
||||
}
|
||||
|
||||
6
node_modules/webpack-dev-server/node_modules/yargs/locales/pt_BR.json
generated
vendored
6
node_modules/webpack-dev-server/node_modules/yargs/locales/pt_BR.json
generated
vendored
@@ -2,7 +2,7 @@
|
||||
"Commands:": "Comandos:",
|
||||
"Options:": "Opções:",
|
||||
"Examples:": "Exemplos:",
|
||||
"boolean": "boolean",
|
||||
"boolean": "booleano",
|
||||
"count": "contagem",
|
||||
"string": "string",
|
||||
"number": "número",
|
||||
@@ -36,5 +36,7 @@
|
||||
"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"
|
||||
"Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos",
|
||||
"Positionals:": "Posicionais:",
|
||||
"command": "comando"
|
||||
}
|
||||
|
||||
4
node_modules/webpack-dev-server/node_modules/yargs/locales/tr.json
generated
vendored
4
node_modules/webpack-dev-server/node_modules/yargs/locales/tr.json
generated
vendored
@@ -35,5 +35,7 @@
|
||||
"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?"
|
||||
"Did you mean %s?": "Bunu mu demek istediniz: %s?",
|
||||
"Positionals:": "Sıralılar:",
|
||||
"command": "komut"
|
||||
}
|
||||
|
||||
6
node_modules/webpack-dev-server/node_modules/yargs/locales/zh_CN.json
generated
vendored
6
node_modules/webpack-dev-server/node_modules/yargs/locales/zh_CN.json
generated
vendored
@@ -33,5 +33,9 @@
|
||||
"Invalid JSON config file: %s": "无效的 JSON 配置文件:%s",
|
||||
"Path to JSON config file": "JSON 配置文件的路径",
|
||||
"Show help": "显示帮助信息",
|
||||
"Show version number": "显示版本号"
|
||||
"Show version number": "显示版本号",
|
||||
"Did you mean %s?": "是指 %s?",
|
||||
"Arguments %s and %s are mutually exclusive" : "选项 %s 和 %s 是互斥的",
|
||||
"Positionals:": "位置:",
|
||||
"command": "命令"
|
||||
}
|
||||
|
||||
63
node_modules/webpack-dev-server/node_modules/yargs/package.json
generated
vendored
63
node_modules/webpack-dev-server/node_modules/yargs/package.json
generated
vendored
@@ -1,65 +1,65 @@
|
||||
{
|
||||
"_from": "yargs@6.6.0",
|
||||
"_id": "yargs@6.6.0",
|
||||
"_from": "yargs@12.0.2",
|
||||
"_id": "yargs@12.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=",
|
||||
"_integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==",
|
||||
"_location": "/webpack-dev-server/yargs",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "yargs@6.6.0",
|
||||
"raw": "yargs@12.0.2",
|
||||
"name": "yargs",
|
||||
"escapedName": "yargs",
|
||||
"rawSpec": "6.6.0",
|
||||
"rawSpec": "12.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "6.6.0"
|
||||
"fetchSpec": "12.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/webpack-dev-server"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz",
|
||||
"_shasum": "782ec21ef403345f830a808ca3d513af56065208",
|
||||
"_spec": "yargs@6.6.0",
|
||||
"_resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz",
|
||||
"_shasum": "fe58234369392af33ecbef53819171eff0f5aadc",
|
||||
"_spec": "yargs@12.0.2",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\webpack-dev-server",
|
||||
"bugs": {
|
||||
"url": "https://github.com/yargs/yargs/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"camelcase": "^3.0.0",
|
||||
"cliui": "^3.2.0",
|
||||
"decamelize": "^1.1.1",
|
||||
"cliui": "^4.0.0",
|
||||
"decamelize": "^2.0.0",
|
||||
"find-up": "^3.0.0",
|
||||
"get-caller-file": "^1.0.1",
|
||||
"os-locale": "^1.4.0",
|
||||
"read-pkg-up": "^1.0.1",
|
||||
"os-locale": "^3.0.0",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^1.0.1",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^1.0.2",
|
||||
"which-module": "^1.0.0",
|
||||
"y18n": "^3.2.1",
|
||||
"yargs-parser": "^4.2.0"
|
||||
"string-width": "^2.0.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^3.2.1 || ^4.0.0",
|
||||
"yargs-parser": "^10.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "yargs the modern, pirate-themed, successor to optimist.",
|
||||
"devDependencies": {
|
||||
"chai": "^3.4.1",
|
||||
"chai": "^4.1.2",
|
||||
"chalk": "^1.1.3",
|
||||
"coveralls": "^2.11.11",
|
||||
"coveralls": "^3.0.2",
|
||||
"cpr": "^2.0.0",
|
||||
"cross-spawn": "^5.0.1",
|
||||
"cross-spawn": "^6.0.4",
|
||||
"es6-promise": "^4.0.2",
|
||||
"hashish": "0.0.4",
|
||||
"mocha": "^3.0.1",
|
||||
"nyc": "^10.0.0",
|
||||
"mocha": "^5.1.1",
|
||||
"nyc": "^11.7.3",
|
||||
"rimraf": "^2.5.0",
|
||||
"standard": "^8.6.0",
|
||||
"standard-version": "^3.0.0",
|
||||
"which": "^1.2.9"
|
||||
"standard": "^11.0.1",
|
||||
"standard-version": "^4.2.0",
|
||||
"which": "^1.2.9",
|
||||
"yargs-test-extends": "^1.0.1"
|
||||
},
|
||||
"engine": {
|
||||
"node": ">=0.10"
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
@@ -69,13 +69,6 @@
|
||||
"completion.sh.hbs",
|
||||
"LICENSE"
|
||||
],
|
||||
"greenkeeper": {
|
||||
"ignore": [
|
||||
"string-width",
|
||||
"read-pkg-up",
|
||||
"camelcase"
|
||||
]
|
||||
},
|
||||
"homepage": "http://yargs.js.org/",
|
||||
"keywords": [
|
||||
"argument",
|
||||
@@ -104,5 +97,5 @@
|
||||
"**/example/**"
|
||||
]
|
||||
},
|
||||
"version": "6.6.0"
|
||||
"version": "12.0.2"
|
||||
}
|
||||
|
||||
1065
node_modules/webpack-dev-server/node_modules/yargs/yargs.js
generated
vendored
1065
node_modules/webpack-dev-server/node_modules/yargs/yargs.js
generated
vendored
File diff suppressed because it is too large
Load Diff
173
node_modules/webpack-dev-server/package.json
generated
vendored
173
node_modules/webpack-dev-server/package.json
generated
vendored
@@ -1,40 +1,42 @@
|
||||
{
|
||||
"_from": "webpack-dev-server@^2.11.1",
|
||||
"_id": "webpack-dev-server@2.11.3",
|
||||
"_from": "webpack-dev-server@^3.1.14",
|
||||
"_id": "webpack-dev-server@3.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Qz22YEFhWx+M2vvJ+rQppRv39JA0h5NNbOOdODApdX6iZ52Diz7vTPXjF7kJlfn+Uc24Qr48I3SZ9yncQwRycg==",
|
||||
"_integrity": "sha512-sjuE4mnmx6JOh9kvSbPYw3u/6uxCLHNWfhWaIPwcXWsvWOPN+nc5baq4i9jui3oOBRXGonK9+OI0jVkaz6/rCw==",
|
||||
"_location": "/webpack-dev-server",
|
||||
"_phantomChildren": {
|
||||
"cliui": "3.2.0",
|
||||
"code-point-at": "1.1.0",
|
||||
"decamelize": "1.2.0",
|
||||
"ajv": "6.10.0",
|
||||
"ajv-errors": "1.0.1",
|
||||
"ajv-keywords": "3.4.0",
|
||||
"cliui": "4.1.0",
|
||||
"find-up": "3.0.0",
|
||||
"get-caller-file": "1.0.3",
|
||||
"number-is-nan": "1.0.1",
|
||||
"os-locale": "1.4.0",
|
||||
"read-pkg-up": "1.0.1",
|
||||
"has-flag": "3.0.0",
|
||||
"os-locale": "3.1.0",
|
||||
"require-directory": "2.1.1",
|
||||
"require-main-filename": "1.0.1",
|
||||
"set-blocking": "2.0.0",
|
||||
"strip-ansi": "3.0.1",
|
||||
"which-module": "1.0.0",
|
||||
"y18n": "3.2.1"
|
||||
"string-width": "2.1.1",
|
||||
"which-module": "2.0.0",
|
||||
"xregexp": "4.0.0",
|
||||
"y18n": "4.0.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "webpack-dev-server@^2.11.1",
|
||||
"raw": "webpack-dev-server@^3.1.14",
|
||||
"name": "webpack-dev-server",
|
||||
"escapedName": "webpack-dev-server",
|
||||
"rawSpec": "^2.11.1",
|
||||
"rawSpec": "^3.1.14",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.11.1"
|
||||
"fetchSpec": "^3.1.14"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/laravel-mix"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.11.3.tgz",
|
||||
"_shasum": "3fd48a402164a6569d94d3d17f131432631b4873",
|
||||
"_spec": "webpack-dev-server@^2.11.1",
|
||||
"_resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.2.1.tgz",
|
||||
"_shasum": "1b45ce3ecfc55b6ebe5e36dab2777c02bc508c4e",
|
||||
"_spec": "webpack-dev-server@^3.1.14",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\laravel-mix",
|
||||
"author": {
|
||||
"name": "Tobias Koppers @sokra"
|
||||
@@ -48,108 +50,119 @@
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"ansi-html": "0.0.7",
|
||||
"array-includes": "^3.0.3",
|
||||
"bonjour": "^3.5.0",
|
||||
"chokidar": "^2.0.0",
|
||||
"compression": "^1.5.2",
|
||||
"connect-history-api-fallback": "^1.3.0",
|
||||
"debug": "^3.1.0",
|
||||
"debug": "^4.1.1",
|
||||
"del": "^3.0.0",
|
||||
"express": "^4.16.2",
|
||||
"html-entities": "^1.2.0",
|
||||
"http-proxy-middleware": "~0.17.4",
|
||||
"import-local": "^1.0.0",
|
||||
"internal-ip": "1.2.0",
|
||||
"http-proxy-middleware": "^0.19.1",
|
||||
"import-local": "^2.0.0",
|
||||
"internal-ip": "^4.2.0",
|
||||
"ip": "^1.1.5",
|
||||
"killable": "^1.0.0",
|
||||
"loglevel": "^1.4.1",
|
||||
"opn": "^5.1.0",
|
||||
"portfinder": "^1.0.9",
|
||||
"schema-utils": "^1.0.0",
|
||||
"selfsigned": "^1.9.1",
|
||||
"semver": "^5.6.0",
|
||||
"serve-index": "^1.7.2",
|
||||
"sockjs": "0.3.19",
|
||||
"sockjs-client": "1.1.5",
|
||||
"spdy": "^3.4.1",
|
||||
"sockjs-client": "1.3.0",
|
||||
"spdy": "^4.0.0",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"supports-color": "^5.1.0",
|
||||
"webpack-dev-middleware": "1.12.2",
|
||||
"yargs": "6.6.0"
|
||||
"supports-color": "^6.1.0",
|
||||
"url": "^0.11.0",
|
||||
"webpack-dev-middleware": "^3.5.1",
|
||||
"webpack-log": "^2.0.0",
|
||||
"yargs": "12.0.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Serves a webpack app. Updates the browser on changes.",
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"codecov.io": "^0.1.6",
|
||||
"copy-webpack-plugin": "^4.3.1",
|
||||
"css-loader": "^0.28.5",
|
||||
"eslint": "^4.5.0",
|
||||
"@babel/cli": "^7.2.3",
|
||||
"@babel/core": "^7.2.2",
|
||||
"@babel/preset-env": "^7.3.1",
|
||||
"babel-loader": "^8.0.5",
|
||||
"copy-webpack-plugin": "^5.0.0",
|
||||
"css-loader": "^2.1.0",
|
||||
"eslint": "^5.4.0",
|
||||
"eslint-config-prettier": "^4.0.0",
|
||||
"eslint-config-webpack": "^1.2.5",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"execa": "^0.8.0",
|
||||
"file-loader": "^1.1.6",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"eslint-plugin-import": "^2.9.0",
|
||||
"eslint-plugin-prettier": "^3.0.1",
|
||||
"execa": "^1.0.0",
|
||||
"file-loader": "^3.0.1",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^3.0.6",
|
||||
"husky": "^1.3.1",
|
||||
"jest": "^24.0.0",
|
||||
"jquery": "^3.2.1",
|
||||
"less": "^2.5.1",
|
||||
"less-loader": "^4.0.5",
|
||||
"marked": "^0.3.9",
|
||||
"mocha": "^3.5.3",
|
||||
"mocha-sinon": "^2.0.0",
|
||||
"pug": "^2.0.0-beta5",
|
||||
"pug-loader": "^2.3.0",
|
||||
"semver": "^5.4.1",
|
||||
"should": "^13.2.0",
|
||||
"sinon": "^4.1.3",
|
||||
"style-loader": "^0.19.1",
|
||||
"less": "^3.7.1",
|
||||
"less-loader": "^4.1.0",
|
||||
"lint-staged": "^8.1.1",
|
||||
"marked": "^0.6.1",
|
||||
"nyc": "^13.3.0",
|
||||
"prettier": "^1.16.3",
|
||||
"rimraf": "^2.6.2",
|
||||
"standard-version": "^5.0.0",
|
||||
"style-loader": "^0.23.1",
|
||||
"supertest": "^3.0.0",
|
||||
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
|
||||
"url-loader": "^0.6.2",
|
||||
"webpack": "^3.10.0",
|
||||
"ws": "^4.0.0"
|
||||
"url-loader": "^1.1.1",
|
||||
"webpack": "^4.29.0",
|
||||
"webpack-cli": "^3.2.1",
|
||||
"ws": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.7"
|
||||
"node": ">= 6.11.5"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"bin",
|
||||
"client/",
|
||||
"ssl/"
|
||||
"lib",
|
||||
"ssl",
|
||||
"client"
|
||||
],
|
||||
"homepage": "https://github.com/webpack/webpack-dev-server",
|
||||
"license": "MIT",
|
||||
"main": "lib/Server.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Andrew Powell",
|
||||
"email": "andrew@shellscape.org",
|
||||
"url": "shellscape.org"
|
||||
"homepage": "https://github.com/webpack/webpack-dev-server#readme",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
],
|
||||
},
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --fix",
|
||||
"prettier --write",
|
||||
"git add"
|
||||
],
|
||||
"*.{css,md,json,yml}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "lib/Server.js",
|
||||
"name": "webpack-dev-server",
|
||||
"peerDependencies": {
|
||||
"webpack": "^2.2.0 || ^3.0.0"
|
||||
"webpack": "^4.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/webpack/webpack-dev-server.git"
|
||||
},
|
||||
"scripts": {
|
||||
"beautify": "npm run lint -- --fix",
|
||||
"build:index": "webpack ./client-src/default/index.js client/index.bundle.js --color --config client-src/default/webpack.config.js",
|
||||
"build:live": "webpack ./client-src/live/index.js client/live.bundle.js --color --config client-src/live/webpack.config.js",
|
||||
"build:sockjs": "webpack ./client-src/sockjs/index.js client/sockjs.bundle.js --color --config client-src/sockjs/webpack.config.js",
|
||||
"ci": "npm run cover -- --report lcovonly && npm run test",
|
||||
"cover": "istanbul cover node_modules/mocha/bin/_mocha",
|
||||
"build:index": "webpack ./client-src/default/index.js -o client/index.bundle.js --color --config client-src/default/webpack.config.js",
|
||||
"build:live": "webpack ./client-src/live/index.js -o client/live.bundle.js --color --config client-src/live/webpack.config.js",
|
||||
"build:sockjs": "webpack ./client-src/sockjs/index.js -o client/sockjs.bundle.js --color --config client-src/sockjs/webpack.config.js",
|
||||
"lint": "eslint bin lib test examples client-src",
|
||||
"mocha": "mocha --full-trace --check-leaks",
|
||||
"prepublish": "(rm ssl/*.pem || true) && npm run -s transpile:index && npm run -s build:live && npm run -s build:index && npm run -s build:sockjs",
|
||||
"test": "npm run lint && npm run mocha",
|
||||
"prepare": "rimraf ./ssl/*.pem && npm run -s transpile:index && npm run -s build:live && npm run -s build:index && npm run -s build:sockjs",
|
||||
"pretty": "prettier --loglevel warn --write \"**/*.{js,css,md,json,yml}\"",
|
||||
"release": "standard-version",
|
||||
"test": "jest --config jest.config.json --runInBand",
|
||||
"transpile:index": "babel client-src/default --out-dir client --ignore *.config.js",
|
||||
"webpack-dev-server": "cd $INIT_CWD && node ../../../bin/webpack-dev-server.js"
|
||||
},
|
||||
"version": "2.11.3"
|
||||
"version": "3.2.1"
|
||||
}
|
||||
|
||||
BIN
node_modules/webpack-dev-server/ssl/.DS_Store
generated
vendored
BIN
node_modules/webpack-dev-server/ssl/.DS_Store
generated
vendored
Binary file not shown.
Reference in New Issue
Block a user