1 | declare const resolveCwd: {
|
2 | /**
|
3 | Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory.
|
4 |
|
5 | @param moduleId - What you would use in `require()`.
|
6 | @returns The resolved module path.
|
7 | @throws When the module can't be found.
|
8 |
|
9 | @example
|
10 | ```
|
11 | import resolveCwd = require('resolve-cwd');
|
12 |
|
13 | console.log(__dirname);
|
14 | //=> '/Users/sindresorhus/rainbow'
|
15 |
|
16 | console.log(process.cwd());
|
17 | //=> '/Users/sindresorhus/unicorn'
|
18 |
|
19 | console.log(resolveCwd('./foo'));
|
20 | //=> '/Users/sindresorhus/unicorn/foo.js'
|
21 | ```
|
22 | */
|
23 | (moduleId: string): string;
|
24 |
|
25 | /**
|
26 | Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory.
|
27 |
|
28 | @param moduleId - What you would use in `require()`.
|
29 | @returns The resolved module path. Returns `undefined` instead of throwing when the module can't be found.
|
30 |
|
31 | @example
|
32 | ```
|
33 | import resolveCwd = require('resolve-cwd');
|
34 |
|
35 | console.log(__dirname);
|
36 | //=> '/Users/sindresorhus/rainbow'
|
37 |
|
38 | console.log(process.cwd());
|
39 | //=> '/Users/sindresorhus/unicorn'
|
40 |
|
41 | console.log(resolveCwd.silent('./foo'));
|
42 | //=> '/Users/sindresorhus/unicorn/foo.js'
|
43 | ```
|
44 | */
|
45 | silent(moduleId: string): string | undefined;
|
46 | };
|
47 |
|
48 | export = resolveCwd;
|