index.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. import type { Config } from '@jest/types';
  8. import type { FS as HasteFS } from 'jest-haste-map';
  9. import type { ResolveModuleConfig, ResolverType } from 'jest-resolve';
  10. import { SnapshotResolver } from 'jest-snapshot';
  11. declare namespace DependencyResolver {
  12. type ResolvedModule = {
  13. file: Config.Path;
  14. dependencies: Array<Config.Path>;
  15. };
  16. }
  17. /**
  18. * DependencyResolver is used to resolve the direct dependencies of a module or
  19. * to retrieve a list of all transitive inverse dependencies.
  20. */
  21. declare class DependencyResolver {
  22. private _hasteFS;
  23. private _resolver;
  24. private _snapshotResolver;
  25. constructor(resolver: ResolverType, hasteFS: HasteFS, snapshotResolver: SnapshotResolver);
  26. resolve(file: Config.Path, options?: ResolveModuleConfig): Array<Config.Path>;
  27. resolveInverseModuleMap(paths: Set<Config.Path>, filter: (file: Config.Path) => boolean, options?: ResolveModuleConfig): Array<DependencyResolver.ResolvedModule>;
  28. resolveInverse(paths: Set<Config.Path>, filter: (file: Config.Path) => boolean, options?: ResolveModuleConfig): Array<Config.Path>;
  29. }
  30. export = DependencyResolver;