Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

babel-parser.d.ts 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. // This file is auto-generated! Do not modify it directly.
  2. /* eslint-disable @typescript-eslint/consistent-type-imports, @typescript-eslint/no-redundant-type-constituents, prettier/prettier */
  3. import * as _babel_types from '@babel/types';
  4. type BABEL_8_BREAKING = false;
  5. type IF_BABEL_7<V> = false extends BABEL_8_BREAKING ? V : never;
  6. type Plugin =
  7. | "asyncDoExpressions"
  8. | IF_BABEL_7<"asyncGenerators">
  9. | IF_BABEL_7<"bigInt">
  10. | IF_BABEL_7<"classPrivateMethods">
  11. | IF_BABEL_7<"classPrivateProperties">
  12. | IF_BABEL_7<"classProperties">
  13. | IF_BABEL_7<"classStaticBlock">
  14. | "decimal"
  15. | "decorators-legacy"
  16. | "deferredImportEvaluation"
  17. | "decoratorAutoAccessors"
  18. | "destructuringPrivate"
  19. | "doExpressions"
  20. | IF_BABEL_7<"dynamicImport">
  21. | "explicitResourceManagement"
  22. | "exportDefaultFrom"
  23. | IF_BABEL_7<"exportNamespaceFrom">
  24. | "flow"
  25. | "flowComments"
  26. | "functionBind"
  27. | "functionSent"
  28. | "importMeta"
  29. | "jsx"
  30. | IF_BABEL_7<"logicalAssignment">
  31. | "importAssertions" // deprecated
  32. | "importAttributes"
  33. | "importReflection"
  34. | "moduleBlocks"
  35. | IF_BABEL_7<"moduleStringNames">
  36. | IF_BABEL_7<"nullishCoalescingOperator">
  37. | IF_BABEL_7<"numericSeparator">
  38. | IF_BABEL_7<"objectRestSpread">
  39. | IF_BABEL_7<"optionalCatchBinding">
  40. | IF_BABEL_7<"optionalChaining">
  41. | "partialApplication"
  42. | "placeholders"
  43. | IF_BABEL_7<"privateIn">
  44. | IF_BABEL_7<"regexpUnicodeSets">
  45. | "sourcePhaseImports"
  46. | "throwExpressions"
  47. | IF_BABEL_7<"topLevelAwait">
  48. | "v8intrinsic"
  49. | ParserPluginWithOptions[0];
  50. type ParserPluginWithOptions =
  51. | ["decorators", DecoratorsPluginOptions]
  52. | ["estree", { classFeatures?: boolean }]
  53. | ["importAttributes", { deprecatedAssertSyntax: boolean }]
  54. | IF_BABEL_7<["moduleAttributes", { version: "may-2020" }]>
  55. | ["optionalChainingAssign", { version: "2023-07" }]
  56. | ["pipelineOperator", PipelineOperatorPluginOptions]
  57. | ["recordAndTuple", RecordAndTuplePluginOptions]
  58. | ["flow", FlowPluginOptions]
  59. | ["typescript", TypeScriptPluginOptions];
  60. type PluginConfig = Plugin | ParserPluginWithOptions;
  61. interface DecoratorsPluginOptions {
  62. decoratorsBeforeExport?: boolean;
  63. allowCallParenthesized?: boolean;
  64. }
  65. interface PipelineOperatorPluginOptions {
  66. proposal: "minimal" | "fsharp" | "hack" | "smart";
  67. topicToken?: "%" | "#" | "@@" | "^^" | "^";
  68. }
  69. interface RecordAndTuplePluginOptions {
  70. syntaxType: "bar" | "hash";
  71. }
  72. interface FlowPluginOptions {
  73. all?: boolean;
  74. enums?: boolean;
  75. }
  76. interface TypeScriptPluginOptions {
  77. dts?: boolean;
  78. disallowAmbiguousJSXLike?: boolean;
  79. }
  80. // Type definitions for @babel/parser
  81. // Project: https://github.com/babel/babel/tree/main/packages/babel-parser
  82. // Definitions by: Troy Gerwien <https://github.com/yortus>
  83. // Marvin Hagemeister <https://github.com/marvinhagemeister>
  84. // Avi Vahl <https://github.com/AviVahl>
  85. // TypeScript Version: 2.9
  86. /**
  87. * Parse the provided code as an entire ECMAScript program.
  88. */
  89. declare function parse(
  90. input: string,
  91. options?: ParserOptions
  92. ): ParseResult<_babel_types.File>;
  93. /**
  94. * Parse the provided code as a single expression.
  95. */
  96. declare function parseExpression(
  97. input: string,
  98. options?: ParserOptions
  99. ): ParseResult<_babel_types.Expression>;
  100. interface ParserOptions {
  101. /**
  102. * By default, import and export declarations can only appear at a program's top level.
  103. * Setting this option to true allows them anywhere where a statement is allowed.
  104. */
  105. allowImportExportEverywhere?: boolean;
  106. /**
  107. * By default, await use is not allowed outside of an async function.
  108. * Set this to true to accept such code.
  109. */
  110. allowAwaitOutsideFunction?: boolean;
  111. /**
  112. * By default, a return statement at the top level raises an error.
  113. * Set this to true to accept such code.
  114. */
  115. allowReturnOutsideFunction?: boolean;
  116. /**
  117. * By default, new.target use is not allowed outside of a function or class.
  118. * Set this to true to accept such code.
  119. */
  120. allowNewTargetOutsideFunction?: boolean;
  121. allowSuperOutsideMethod?: boolean;
  122. /**
  123. * By default, exported identifiers must refer to a declared variable.
  124. * Set this to true to allow export statements to reference undeclared variables.
  125. */
  126. allowUndeclaredExports?: boolean;
  127. /**
  128. * By default, Babel parser JavaScript code according to Annex B syntax.
  129. * Set this to `false` to disable such behavior.
  130. */
  131. annexB?: boolean;
  132. /**
  133. * By default, Babel attaches comments to adjacent AST nodes.
  134. * When this option is set to false, comments are not attached.
  135. * It can provide up to 30% performance improvement when the input code has many comments.
  136. * @babel/eslint-parser will set it for you.
  137. * It is not recommended to use attachComment: false with Babel transform,
  138. * as doing so removes all the comments in output code, and renders annotations such as
  139. * /* istanbul ignore next *\/ nonfunctional.
  140. */
  141. attachComment?: boolean;
  142. /**
  143. * By default, Babel always throws an error when it finds some invalid code.
  144. * When this option is set to true, it will store the parsing error and
  145. * try to continue parsing the invalid input file.
  146. */
  147. errorRecovery?: boolean;
  148. /**
  149. * Indicate the mode the code should be parsed in.
  150. * Can be one of "script", "module", or "unambiguous". Defaults to "script".
  151. * "unambiguous" will make @babel/parser attempt to guess, based on the presence
  152. * of ES6 import or export statements.
  153. * Files with ES6 imports and exports are considered "module" and are otherwise "script".
  154. */
  155. sourceType?: "script" | "module" | "unambiguous";
  156. /**
  157. * Correlate output AST nodes with their source filename.
  158. * Useful when generating code and source maps from the ASTs of multiple input files.
  159. */
  160. sourceFilename?: string;
  161. /**
  162. * By default, the first line of code parsed is treated as line 1.
  163. * You can provide a line number to alternatively start with.
  164. * Useful for integration with other source tools.
  165. */
  166. startLine?: number;
  167. /**
  168. * By default, the parsed code is treated as if it starts from line 1, column 0.
  169. * You can provide a column number to alternatively start with.
  170. * Useful for integration with other source tools.
  171. */
  172. startColumn?: number;
  173. /**
  174. * Array containing the plugins that you want to enable.
  175. */
  176. plugins?: ParserPlugin[];
  177. /**
  178. * Should the parser work in strict mode.
  179. * Defaults to true if sourceType === 'module'. Otherwise, false.
  180. */
  181. strictMode?: boolean;
  182. /**
  183. * Adds a ranges property to each node: [node.start, node.end]
  184. */
  185. ranges?: boolean;
  186. /**
  187. * Adds all parsed tokens to a tokens property on the File node.
  188. */
  189. tokens?: boolean;
  190. /**
  191. * By default, the parser adds information about parentheses by setting
  192. * `extra.parenthesized` to `true` as needed.
  193. * When this option is `true` the parser creates `ParenthesizedExpression`
  194. * AST nodes instead of using the `extra` property.
  195. */
  196. createParenthesizedExpressions?: boolean;
  197. /**
  198. * The default is false in Babel 7 and true in Babel 8
  199. * Set this to true to parse it as an `ImportExpression` node.
  200. * Otherwise `import(foo)` is parsed as `CallExpression(Import, [Identifier(foo)])`.
  201. */
  202. createImportExpressions?: boolean;
  203. }
  204. type ParserPlugin = PluginConfig;
  205. declare const tokTypes: {
  206. // todo(flow->ts) real token type
  207. [name: string]: any;
  208. };
  209. interface ParseError {
  210. code: string;
  211. reasonCode: string;
  212. }
  213. type ParseResult<Result> = Result & {
  214. errors: ParseError[];
  215. };
  216. export { DecoratorsPluginOptions, FlowPluginOptions, ParseError, ParseResult, ParserOptions, ParserPlugin, ParserPluginWithOptions, PipelineOperatorPluginOptions, RecordAndTuplePluginOptions, TypeScriptPluginOptions, parse, parseExpression, tokTypes };