import type { Plugin } from "unified"; import type { Program } from "estree"; export type TestFunction = (componentName: string) => boolean | undefined | null; /** * It is a recma plugin which transforms the esAST / esTree. * * This recma plugin sets the default value `() => null` for the Components in case them missing or not provided. * in order "eval of the MDX compiled source" NOT to throw an error. * * The "recma-mdx-escape-missing-components" basically: * * inserts the Empty Component definition into code * * const _EmptyComponent = () => null; * * looks for a declaration statement in an object pattern initiated by the `_components` * * const { Component1, Component2 } = _components; * * converts it as the destructed properties (Components) having a default value * * const { Component1 = _EmptyComponent, Component2 = _EmptyComponent } = _components; * * [test] * if "undefined", all components pass the check * if "string", check if the component name matches with the string * if "string[]", check if the component name is included in the string array * if "TestFunction", check if the test function returns true. * * if check is true meaningly passed, set the default value `() => null` for that component * */ declare const plugin: Plugin<[TestFunction?], Program>; export default plugin; //# sourceMappingURL=index.d.ts.map