1// Type definitions for babylon 6.16 2// Project: https://github.com/babel/babylon, https://babeljs.io 3// Definitions by: Troy Gerwien <https://github.com/yortus> 4// Marvin Hagemeister <https://github.com/marvinhagemeister> 5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 6// TypeScript Version: 2.8 7 8import { Expression, File } from "babel-types"; 9 10export function parse(code: string, opts?: BabylonOptions): File; 11 12export function parseExpression(input: string, options?: BabylonOptions): Expression; 13 14export interface BabylonOptions { 15 /** 16 * By default, import and export declarations can only appear at a program's top level. 17 * Setting this option to true allows them anywhere where a statement is allowed. 18 */ 19 allowImportExportEverywhere?: boolean | undefined; 20 21 /** 22 * By default, a return statement at the top level raises an error. Set this to true to accept such code. 23 */ 24 allowReturnOutsideFunction?: boolean | undefined; 25 26 allowSuperOutsideMethod?: boolean | undefined; 27 28 /** 29 * Indicate the mode the code should be parsed in. Can be either "script" or "module". 30 */ 31 sourceType?: "script" | "module" | undefined; 32 33 /** 34 * Correlate output AST nodes with their source filename. Useful when 35 * generating code and source maps from the ASTs of multiple input files. 36 */ 37 sourceFilename?: string | undefined; 38 39 /** 40 * Array containing the plugins that you want to enable. 41 */ 42 plugins?: PluginName[] | undefined; 43} 44 45export type PluginName = 46 | "estree" 47 | "jsx" 48 | "flow" 49 | "typescript" 50 | "classConstructorCall" 51 | "doExpressions" 52 | "objectRestSpread" 53 | "decorators" 54 | "classProperties" 55 | "exportExtensions" 56 | "asyncGenerators" 57 | "functionBind" 58 | "functionSent" 59 | "dynamicImport"; 60