Components.d.ts 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. declare const _exports: typeof Components & {
  2. detect(rule: any): (context?: any) => {
  3. [_: string]: Function;
  4. };
  5. };
  6. export = _exports;
  7. /**
  8. * Components
  9. */
  10. declare class Components {
  11. /**
  12. * Add a node to the components list, or update it if it's already in the list
  13. *
  14. * @param {ASTNode} node The AST node being added.
  15. * @param {number} confidence Confidence in the component detection (0=banned, 1=maybe, 2=yes)
  16. * @returns {Object} Added component object
  17. */
  18. add(node: ASTNode, confidence: number): any;
  19. /**
  20. * Find a component in the list using its node
  21. *
  22. * @param {ASTNode} node The AST node being searched.
  23. * @returns {Object} Component object, undefined if the component is not found or has confidence value of 0.
  24. */
  25. get(node: ASTNode): any;
  26. /**
  27. * Update a component in the list
  28. *
  29. * @param {ASTNode} node The AST node being updated.
  30. * @param {Object} props Additional properties to add to the component.
  31. */
  32. set(node: ASTNode, props: any): void;
  33. /**
  34. * Return the components list
  35. * Components for which we are not confident are not returned
  36. *
  37. * @returns {Object} Components list
  38. */
  39. list(): any;
  40. /**
  41. * Return the length of the components list
  42. * Components for which we are not confident are not counted
  43. *
  44. * @returns {number} Components list length
  45. */
  46. length(): number;
  47. /**
  48. * Return the node naming the default React import
  49. * It can be used to determine the local name of import, even if it's imported
  50. * with an unusual name.
  51. *
  52. * @returns {ASTNode} React default import node
  53. */
  54. getDefaultReactImports(): ASTNode;
  55. /**
  56. * Return the nodes of all React named imports
  57. *
  58. * @returns {Object} The list of React named imports
  59. */
  60. getNamedReactImports(): any;
  61. /**
  62. * Add the default React import specifier to the scope
  63. *
  64. * @param {ASTNode} specifier The AST Node of the default React import
  65. * @returns {void}
  66. */
  67. addDefaultReactImport(specifier: ASTNode): void;
  68. /**
  69. * Add a named React import specifier to the scope
  70. *
  71. * @param {ASTNode} specifier The AST Node of a named React import
  72. * @returns {void}
  73. */
  74. addNamedReactImport(specifier: ASTNode): void;
  75. }
  76. //# sourceMappingURL=Components.d.ts.map