UNPKG

1.02 kBTypeScriptView Raw
1import type FileState from '../FileState.js';
2import type { ComponentNodePath, ResolverClass } from './index.js';
3interface FindExportedDefinitionsResolverOptions {
4 limit?: number;
5}
6/**
7 * Given an AST, this function tries to find the exported component definitions.
8 *
9 * The component definitions are either the ObjectExpression passed to
10 * `React.createClass` or a `class` definition extending `React.Component` or
11 * having a `render()` method.
12 *
13 * If a definition is part of the following statements, it is considered to be
14 * exported:
15 *
16 * modules.exports = Definition;
17 * exports.foo = Definition;
18 * export default Definition;
19 * export var Definition = ...;
20 *
21 * limit can be used to limit the components to be found. When the limit is reached an error will be thrown
22 */
23export default class FindExportedDefinitionsResolver implements ResolverClass {
24 limit: number;
25 constructor({ limit }?: FindExportedDefinitionsResolverOptions);
26 resolve(file: FileState): ComponentNodePath[];
27}
28export {};