UNPKG

2.18 kBTypeScriptView Raw
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 */
7import { Config } from '@jest/types';
8import { ModuleMap } from 'jest-haste-map';
9import { ResolverConfig } from './types';
10declare type FindNodeModuleConfig = {
11 basedir: Config.Path;
12 browser?: boolean;
13 extensions?: Array<string>;
14 moduleDirectory?: Array<string>;
15 paths?: Array<Config.Path>;
16 resolver?: Config.Path | null;
17 rootDir?: Config.Path;
18};
19declare type BooleanObject = {
20 [key: string]: boolean;
21};
22declare namespace Resolver {
23 type ResolveModuleConfig = {
24 skipNodeResolution?: boolean;
25 paths?: Array<Config.Path>;
26 };
27}
28declare class Resolver {
29 private readonly _options;
30 private readonly _moduleMap;
31 private readonly _moduleIDCache;
32 private readonly _moduleNameCache;
33 private readonly _modulePathCache;
34 private readonly _supportsNativePlatform;
35 constructor(moduleMap: ModuleMap, options: ResolverConfig);
36 static findNodeModule(path: Config.Path, options: FindNodeModuleConfig): Config.Path | null;
37 resolveModuleFromDirIfExists(dirname: Config.Path, moduleName: string, options?: Resolver.ResolveModuleConfig): Config.Path | null;
38 resolveModule(from: Config.Path, moduleName: string, options?: Resolver.ResolveModuleConfig): Config.Path;
39 isCoreModule(moduleName: string): boolean;
40 getModule(name: string): Config.Path | null;
41 getModulePath(from: Config.Path, moduleName: string): string;
42 getPackage(name: string): Config.Path | null;
43 getMockModule(from: Config.Path, name: string): Config.Path | null;
44 getModulePaths(from: Config.Path): Array<Config.Path>;
45 getModuleID(virtualMocks: BooleanObject, from: Config.Path, _moduleName?: string): string;
46 private _getModuleType;
47 private _getAbsolutePath;
48 private _getMockPath;
49 private _getVirtualMockPath;
50 private _isModuleResolved;
51 resolveStubModuleName(from: Config.Path, moduleName: string): Config.Path | null;
52}
53export = Resolver;
54//# sourceMappingURL=index.d.ts.map
\No newline at end of file