Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// https://github.com/webpack/webpack-cli/blob/v3.3.9/bin/config/config-yargs.js
import supportsColor from 'supports-color';
import constants from 'webpack-cli/bin/utils/constants';
const {
CONFIG_GROUP,
BASIC_GROUP,
MODULE_GROUP,
OUTPUT_GROUP,
ADVANCED_GROUP,
RESOLVE_GROUP,
OPTIMIZE_GROUP,
DISPLAY_GROUP,
} = constants.GROUPS;
const options = {
config: {
type: 'string' as const,
describe: 'Path to the config file',
group: CONFIG_GROUP,
defaultDescription: 'webpack.config.js or webpackfile.js',
requiresArg: true,
},
'config-register': {
type: 'array' as const,
alias: 'r',
describe:
'Preload one or more modules before loading the webpack configuration',
group: CONFIG_GROUP,
defaultDescription: 'module id or path',
const NON_COMPILATION_CMD = process.argv.find(arg => {
if (arg === "serve") {
global.process.argv = global.process.argv.filter(a => a !== "serve");
process.argv = global.process.argv;
}
return NON_COMPILATION_ARGS.find(a => a === arg);
});
if (NON_COMPILATION_CMD) {
// eslint-disable-next-line
require("webpack-cli/lib/index")(NON_COMPILATION_CMD, process.argv);
return;
}
var VERSION = require("../package.json").version
+ " (webpack-cli " + require("webpack-cli/package.json").version
+ " webpack " + require("webpack/package.json").version
+ ")";
const yargs = require("yargs").usage(`udk ${VERSION}
Usage: udk [options]
udk [options] --entry --output <output>
udk [options] --output <output>
For more information, see https://webpack.js.org/api/cli/.`);
require("webpack-cli/bin/config-yargs")(yargs);
const DISPLAY_GROUP = "Stats options:";
const BASIC_GROUP = "Basic options:";
</output></output>
return;
}
if (argv.verbose) {
argv["display"] = "verbose";
}
let options;
try {
options = require("webpack-cli/bin/convert-argv")(argv);
} catch (err) {
if (err.name !== "ValidationError") {
throw err;
}
const stack = ErrorHelpers.cleanUpWebpackOptions(err.stack, err.message);
const message = err.message + "\n" + stack;
if (argv.color) {
console.error(`\u001b[1m\u001b[31m${message}\u001b[39m\u001b[22m`);
} else {
console.error(message);
}
process.exitCode = 1;
return;
}
/**
* When --silent flag is present, an object with a no-op write method is
* used in place of process.stout
*/