(basedir: string)
| 237 | } |
| 238 | |
| 239 | export function findNearestNodeModules(basedir: string): string | null { |
| 240 | while (basedir) { |
| 241 | const pkgPath = path.join(basedir, 'node_modules') |
| 242 | if (tryStatSync(pkgPath)?.isDirectory()) { |
| 243 | return pkgPath |
| 244 | } |
| 245 | |
| 246 | const nextBasedir = path.dirname(basedir) |
| 247 | if (nextBasedir === basedir) break |
| 248 | basedir = nextBasedir |
| 249 | } |
| 250 | |
| 251 | return null |
| 252 | } |
| 253 | |
| 254 | export function watchPackageDataPlugin(packageCache: PackageCache): Plugin { |
| 255 | // a list of files to watch before the plugin is ready |
no test coverage detected