(base: string, paths: string[])
| 120 | } |
| 121 | |
| 122 | export async function resolveNuxtModule (base: string, paths: string[]): Promise<string[]> { |
| 123 | const resolved: string[] = [] |
| 124 | const resolver = createResolver(base) |
| 125 | |
| 126 | for (const path of paths) { |
| 127 | if (path.startsWith(base)) { |
| 128 | resolved.push(path.split('/index.ts')[0]!) |
| 129 | continue |
| 130 | } |
| 131 | const resolvedPath = await resolver.resolvePath(path) |
| 132 | const dir = parseNodeModulePath(resolvedPath).dir |
| 133 | if (dir) { |
| 134 | resolved.push(dir) |
| 135 | continue |
| 136 | } |
| 137 | const index = resolvedPath.lastIndexOf(path) |
| 138 | resolved.push(index === -1 ? dirname(resolvedPath) : resolvedPath.slice(0, index + path.length)) |
| 139 | } |
| 140 | |
| 141 | return resolved |
| 142 | } |
| 143 | |
| 144 | // --- Internal --- |
| 145 |
no test coverage detected
searching dependent graphs…