UNPKG

1.02 kBTypeScriptView Raw
1declare const resolveFrom: {
2 /**
3 Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path.
4
5 @param fromDirectory - Directory to resolve from.
6 @param moduleId - What you would use in `require()`.
7 @returns Resolved module path. Throws when the module can't be found.
8
9 @example
10 ```
11 import resolveFrom = require('resolve-from');
12
13 // There is a file at `./foo/bar.js`
14
15 resolveFrom('foo', './bar');
16 //=> '/Users/sindresorhus/dev/test/foo/bar.js'
17 ```
18 */
19 (fromDirectory: string, moduleId: string): string;
20
21 /**
22 Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path.
23
24 @param fromDirectory - Directory to resolve from.
25 @param moduleId - What you would use in `require()`.
26 @returns Resolved module path or `undefined` when the module can't be found.
27 */
28 silent(fromDirectory: string, moduleId: string): string | undefined;
29};
30
31export = resolveFrom;