main.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /// <reference types="node" resolution-mode="require"/>
  2. import * as builtinHandlers from './handlers/index.js';
  3. import * as builtinResolvers from './resolver/index.js';
  4. import { makeFsImporter } from './importer/index.js';
  5. import * as utils from './utils/index.js';
  6. import type { Documentation } from './Documentation.js';
  7. import type DocumentationBuilder from './Documentation.js';
  8. import type { Resolver, ResolverClass, ResolverFunction } from './resolver/index.js';
  9. import type { Importer } from './importer/index.js';
  10. import type { Handler } from './handlers/index.js';
  11. import type FileState from './FileState.js';
  12. import type { Config } from './config.js';
  13. import { defaultHandlers } from './config.js';
  14. import { ERROR_CODES } from './error.js';
  15. declare const builtinImporters: {
  16. fsImporter: Importer;
  17. ignoreImporter: Importer;
  18. };
  19. declare module '@babel/traverse' {
  20. interface HubInterface {
  21. file: FileState;
  22. parse: typeof FileState.prototype.parse;
  23. import: typeof FileState.prototype.import;
  24. }
  25. interface Hub {
  26. file: FileState;
  27. parse: typeof FileState.prototype.parse;
  28. import: typeof FileState.prototype.import;
  29. }
  30. }
  31. /**
  32. * Parse the *src* and scan for react components based on the config
  33. * that gets supplied.
  34. *
  35. * The default resolvers look for *exported* react components.
  36. *
  37. * By default all handlers are applied, so that all possible
  38. * different use cases are covered.
  39. *
  40. * The default importer is the fs-importer that tries to resolve
  41. * files based on the nodejs resolve algorithm.
  42. */
  43. declare function defaultParse(src: Buffer | string, config?: Config): Documentation[];
  44. export type { NodePath } from '@babel/traverse';
  45. export type * as babelTypes from '@babel/types';
  46. export { builtinHandlers, builtinResolvers, builtinImporters, defaultHandlers, makeFsImporter, defaultParse as parse, utils, ERROR_CODES, };
  47. export type { Importer, Handler, Resolver, ResolverClass, ResolverFunction, FileState, Config, Documentation, DocumentationBuilder, };