(
webpackMod: typeof webpack,
args: Record<string, WebpackArgument>,
configuration: RecordAny,
values: ProcessedArguments,
)
| 1330 | } |
| 1331 | |
| 1332 | #processArguments( |
| 1333 | webpackMod: typeof webpack, |
| 1334 | args: Record<string, WebpackArgument>, |
| 1335 | configuration: RecordAny, |
| 1336 | values: ProcessedArguments, |
| 1337 | ) { |
| 1338 | const problems = webpackMod.cli.processArguments(args, configuration, values); |
| 1339 | |
| 1340 | if (problems) { |
| 1341 | const groupBy = <K extends keyof Problem & StringsKeys<Problem>>(xs: Problem[], key: K) => |
| 1342 | xs.reduce( |
| 1343 | (rv, problem) => { |
| 1344 | const path = problem[key]; |
| 1345 | |
| 1346 | (rv[path] ||= []).push(problem); |
| 1347 | |
| 1348 | return rv; |
| 1349 | }, |
| 1350 | {} as Record<string, Problem[]>, |
| 1351 | ); |
| 1352 | const problemsByPath = groupBy<"path">(problems, "path"); |
| 1353 | |
| 1354 | for (const path in problemsByPath) { |
| 1355 | const problems = problemsByPath[path]; |
| 1356 | |
| 1357 | for (const problem of problems) { |
| 1358 | this.logger.error( |
| 1359 | `${this.capitalizeFirstLetter(problem.type.replaceAll("-", " "))}${ |
| 1360 | problem.value ? ` '${problem.value}'` : "" |
| 1361 | } for the '--${problem.argument.replaceAll(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}' option${ |
| 1362 | problem.index ? ` by index '${problem.index}'` : "" |
| 1363 | }`, |
| 1364 | ); |
| 1365 | |
| 1366 | if (problem.expected) { |
| 1367 | if (problem.expected === "true | false") { |
| 1368 | this.logger.error("Expected: without value or negative option"); |
| 1369 | } else { |
| 1370 | this.logger.error(`Expected: '${problem.expected}'`); |
| 1371 | } |
| 1372 | } |
| 1373 | } |
| 1374 | } |
| 1375 | |
| 1376 | process.exit(2); |
| 1377 | } |
| 1378 | } |
| 1379 | |
| 1380 | async #outputHelp( |
| 1381 | options: string[], |
no test coverage detected