• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

LICENSED24-Sep-20231.1 KiB2217

README.mdD24-Sep-20232.5 KiB8064

index.d.tsD24-Sep-20231.8 KiB6026

package.jsonD24-Sep-2023994 3232

README.md

1# Installation
2> `npm install --save @types/babylon`
3
4# Summary
5This package contains type definitions for babylon (https://github.com/babel/babylon).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babylon.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babylon/index.d.ts)
10````ts
11// Type definitions for babylon 6.16
12// Project: https://github.com/babel/babylon, https://babeljs.io
13// Definitions by: Troy Gerwien <https://github.com/yortus>
14//                 Marvin Hagemeister <https://github.com/marvinhagemeister>
15// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
16// TypeScript Version: 2.8
17
18import { Expression, File } from "babel-types";
19
20export function parse(code: string, opts?: BabylonOptions): File;
21
22export function parseExpression(input: string, options?: BabylonOptions): Expression;
23
24export interface BabylonOptions {
25    /**
26     * By default, import and export declarations can only appear at a program's top level.
27     * Setting this option to true allows them anywhere where a statement is allowed.
28     */
29    allowImportExportEverywhere?: boolean | undefined;
30
31    /**
32     * By default, a return statement at the top level raises an error. Set this to true to accept such code.
33     */
34    allowReturnOutsideFunction?: boolean | undefined;
35
36    allowSuperOutsideMethod?: boolean | undefined;
37
38    /**
39     * Indicate the mode the code should be parsed in. Can be either "script" or "module".
40     */
41    sourceType?: "script" | "module" | undefined;
42
43    /**
44     * Correlate output AST nodes with their source filename. Useful when
45     * generating code and source maps from the ASTs of multiple input files.
46     */
47    sourceFilename?: string | undefined;
48
49    /**
50     * Array containing the plugins that you want to enable.
51     */
52    plugins?: PluginName[] | undefined;
53}
54
55export type PluginName =
56    | "estree"
57    | "jsx"
58    | "flow"
59    | "typescript"
60    | "classConstructorCall"
61    | "doExpressions"
62    | "objectRestSpread"
63    | "decorators"
64    | "classProperties"
65    | "exportExtensions"
66    | "asyncGenerators"
67    | "functionBind"
68    | "functionSent"
69    | "dynamicImport";
70
71````
72
73### Additional Details
74 * Last updated: Fri, 15 Sep 2023 19:06:48 GMT
75 * Dependencies: [@types/babel-types](https://npmjs.com/package/@types/babel-types)
76 * Global values: none
77
78# Credits
79These definitions were written by [Troy Gerwien](https://github.com/yortus), and [Marvin Hagemeister](https://github.com/marvinhagemeister).
80