prepack/src/options.js
giftkugel 0b434790d3 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
2018-09-12 15:31:13 -07:00

82 lines
2.4 KiB
JavaScript

/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/* @flow strict-local */
import type { ErrorHandler } from "./errors.js";
export type Compatibility = "browser" | "jsc-600-1-4-17" | "mobile" | "node-source-maps" | "fb-www" | "node-react";
export const CompatibilityValues = ["browser", "jsc-600-1-4-17", "mobile", "node-source-maps", "fb-www", "node-react"];
export type InvariantModeTypes =
| "throw"
| "console.info"
| "console.warn"
| "console.error"
| "nativeLoggingHook+0"
| "nativeLoggingHook+1"
| "nativeLoggingHook+3"
| "nativeLoggingHook+2";
export const InvariantModeValues = [
"throw",
"console.info",
"console.warn",
"console.error",
"nativeLoggingHook+0",
"nativeLoggingHook+1",
"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"];
export type RealmOptions = {
check?: Array<number>,
compatibility?: Compatibility,
debugNames?: boolean,
errorHandler?: ErrorHandler,
mathRandomSeed?: string,
invariantLevel?: number,
invariantMode?: InvariantModeTypes,
emitConcreteModel?: boolean,
uniqueSuffix?: string,
serialize?: boolean,
strictlyMonotonicDateNow?: boolean,
timeout?: number,
maxStackDepth?: number,
instantRender?: boolean,
reactEnabled?: boolean,
reactOutput?: ReactOutputTypes,
reactVerbose?: boolean,
reactOptimizeNestedFunctions?: boolean,
stripFlow?: boolean,
abstractValueImpliesMax?: number,
arrayNestedOptimizedFunctionsEnabled?: boolean,
reactFailOnUnsupportedSideEffects?: boolean,
};
export type SerializerOptions = {
lazyObjectsRuntime?: string,
delayInitializations?: boolean,
initializeMoreModules?: boolean,
internalDebug?: boolean,
debugScopes?: boolean,
debugIdentifiers?: Array<string>,
logStatistics?: boolean,
logModules?: boolean,
profile?: boolean,
inlineExpressions?: boolean,
trace?: boolean,
heapGraphFormat?: "DotLanguage" | "VISJS",
};
export const defaultOptions = {};