(nuxt: Nuxt, opts: { parentDirectories?: boolean } = {})
| 325 | } |
| 326 | |
| 327 | function resolvePathsToWatch (nuxt: Nuxt, opts: { parentDirectories?: boolean } = {}): Set<string> { |
| 328 | const pathsToWatch = new Set<string>() |
| 329 | for (const dirs of getLayerDirectories(nuxt)) { |
| 330 | if (!isIgnored(dirs.app)) { |
| 331 | pathsToWatch.add(dirs.app) |
| 332 | } |
| 333 | // Only add server if it's not inside app (avoid double-watching) |
| 334 | if (!isIgnored(dirs.server) && !dirs.server.startsWith(dirs.app.replace(/\/?$/, '/'))) { |
| 335 | pathsToWatch.add(dirs.server) |
| 336 | } |
| 337 | } |
| 338 | for (const pattern of nuxt.options.watch) { |
| 339 | if (typeof pattern !== 'string') { continue } |
| 340 | const path = opts?.parentDirectories |
| 341 | ? join(dirname(resolve(nuxt.options.srcDir, pattern)), '') |
| 342 | : resolve(nuxt.options.srcDir, pattern) |
| 343 | let shouldAdd = true |
| 344 | for (const w of [...pathsToWatch]) { |
| 345 | if (w.startsWith(path)) { |
| 346 | pathsToWatch.delete(w) |
| 347 | } |
| 348 | if (path.startsWith(w)) { |
| 349 | shouldAdd = false |
| 350 | } |
| 351 | } |
| 352 | if (shouldAdd) { |
| 353 | pathsToWatch.add(path) |
| 354 | } |
| 355 | } |
| 356 | return pathsToWatch |
| 357 | } |
no test coverage detected
searching dependent graphs…