版博士V2.0程序
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

43 rindas
1.9 KiB

  1. import * as _babel_parser from '@babel/parser';
  2. import { ParserPlugin } from '@babel/parser';
  3. import * as _babel_types from '@babel/types';
  4. import { Node, Function, Identifier, VariableDeclaration } from '@babel/types';
  5. interface ParseOptions {
  6. filename?: string;
  7. parserPlugins?: ParserPlugin[];
  8. }
  9. type Scope = Record<string, Node>;
  10. interface WalkerContext {
  11. skip: () => void;
  12. remove: () => void;
  13. replace: (node: Node) => void;
  14. }
  15. interface ScopeContext {
  16. parent: Node;
  17. key: string;
  18. index: number;
  19. scope: Scope;
  20. scopes: Scope[];
  21. level: number;
  22. }
  23. interface WalkerHooks {
  24. enter?: (this: WalkerContext & ScopeContext, node: Node) => void;
  25. enterAfter?: (this: ScopeContext, node: Node) => void;
  26. leave?: (this: WalkerContext & ScopeContext, node: Node) => void;
  27. leaveAfter?: (this: ScopeContext, node: Node) => void;
  28. }
  29. declare const isNewScope: (node: Node) => boolean;
  30. declare function walkFunctionParams(node: Function, onIdent: (id: Identifier) => void): void;
  31. declare function extractIdentifiers(param: Node, nodes?: Identifier[]): Identifier[];
  32. declare function babelParse(code: string, filename?: string, parserPlugins?: ParserPlugin[]): _babel_parser.ParseResult<_babel_types.File>;
  33. declare function walkVariableDeclaration(stmt: VariableDeclaration, register: (id: Identifier) => void): void;
  34. declare function walkNewIdentifier(node: Node, register: (id: Identifier) => void): void;
  35. declare const walk: (code: string, walkHooks: WalkerHooks, { filename, parserPlugins }?: ParseOptions) => _babel_parser.ParseResult<_babel_types.File>;
  36. declare const walkAST: (node: Node | Node[], { enter, leave, enterAfter, leaveAfter }: WalkerHooks) => void;
  37. declare const getRootScope: (nodes: Node[]) => Scope;
  38. export { ParseOptions, Scope, ScopeContext, WalkerContext, WalkerHooks, babelParse, extractIdentifiers, getRootScope, isNewScope, walk, walkAST, walkFunctionParams, walkNewIdentifier, walkVariableDeclaration };