UNPKG

1.38 kBTypeScriptView Raw
1import CacheGroup = require('./cache-group');
2import Cache = require('./cache');
3/**
4 * Search each directory in the absolute path `baseDir`, from leaf to root, for
5 * a `package.json`, and return the first match, or `null` if no `package.json`
6 * was found.
7 *
8 * @public
9 * @param {string} baseDir - an absolute path in which to search for a `package.json`
10 * @param {CacheGroup|boolean} [_cache] (optional)
11 * * if true: will choose the default global cache
12 * * if false: will not cache
13 * * if undefined or omitted, will choose the default global cache
14 * * otherwise we assume the argument is an external cache of the form provided by resolve-package-path/lib/cache-group.js
15 *
16 * @return {string|null} a full path to the resolved package.json if found or null if not
17 */
18declare function _findUpPackagePath(baseDir: string, _cache?: Cache | boolean): string | null;
19export = resolvePackagePath;
20declare function resolvePackagePath(target: string, baseDir: string, _cache?: CacheGroup | boolean): string | null;
21declare namespace resolvePackagePath {
22 var _resetCache: () => void;
23 var getRealFilePath: (filePath: string) => string | null;
24 var getRealDirectoryPath: (directoryPath: string) => string | null;
25}
26declare module resolvePackagePath {
27 let _CACHE: CacheGroup;
28 let _FIND_UP_CACHE: Cache;
29 let findUpPackagePath: typeof _findUpPackagePath;
30}