(root: string, ...pathSegments: string[])
| 48 | }; |
| 49 | |
| 50 | export function resolveNode(root: string, ...pathSegments: string[]): string | null { |
| 51 | try { |
| 52 | return require.resolve(pathSegments.join('/'), { paths: [root] }); |
| 53 | } catch (e) { |
| 54 | const path = [root, 'node_modules', ...pathSegments].join('/'); |
| 55 | if (existsSync(path)) { |
| 56 | return path; |
| 57 | } |
| 58 | return null; |
| 59 | } |
| 60 | } |
no test coverage detected