mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-09-11 14:46:37 +03:00
Bad command-line for debugDiagnosticSeverity does not crashes Prepack anymore (#2545)
Summary: This can be a possible fix for https://github.com/facebook/prepack/issues/2509 I have removed the `invariant` method call and added a value check as used for the _invariantMode_ option. `node lib/prepack-cli.js --debugDiagnosticSeverity foo` will now generate `Unsupported debugDiagnosticSeverity: foo` Pull Request resolved: https://github.com/facebook/prepack/pull/2545 Differential Revision: D9800485 Pulled By: hermanventer fbshipit-source-id: edc24b4a812b4e32f9c48e05a0799bf4af431991
This commit is contained in:
parent
1e1c03c533
commit
0b434790d3
@ -33,6 +33,7 @@ export const InvariantModeValues = [
|
||||
"nativeLoggingHook+2",
|
||||
"nativeLoggingHook+3",
|
||||
];
|
||||
export const DiagnosticSeverityValues = ["FatalError", "RecoverableError", "Warning", "Information"];
|
||||
|
||||
export type ReactOutputTypes = "create-element" | "jsx" | "bytecode";
|
||||
export const ReactOutputValues = ["create-element", "jsx", "bytecode"];
|
||||
|
@ -19,6 +19,7 @@ import {
|
||||
ReactOutputValues,
|
||||
type InvariantModeTypes,
|
||||
InvariantModeValues,
|
||||
DiagnosticSeverityValues,
|
||||
} from "./options.js";
|
||||
import { type SerializedResult } from "./serializer/types.js";
|
||||
import { TextPrinter } from "./utils/TextPrinter.js";
|
||||
@ -299,6 +300,10 @@ function run(
|
||||
break;
|
||||
case "debugDiagnosticSeverity":
|
||||
arg = args.shift();
|
||||
if (!DiagnosticSeverityValues.includes(arg)) {
|
||||
console.error(`Unsupported debugDiagnosticSeverity: ${arg}`);
|
||||
process.exit(1);
|
||||
}
|
||||
invariant(
|
||||
arg === "FatalError" || arg === "RecoverableError" || arg === "Warning" || arg === "Information",
|
||||
`Invalid debugger diagnostic severity: ${arg}`
|
||||
|
Loading…
Reference in New Issue
Block a user