(options)
| 50 | return fsExtra.ensureDirSync(path) |
| 51 | }, |
| 52 | watch(options) { |
| 53 | const { include, exclude, cwd, poll } = options |
| 54 | const coalesce = poll || process.platform === 'win32' |
| 55 | |
| 56 | const dirnames = globDirname(include) |
| 57 | const isValidPath = picomatch(include, { cwd, ignore: exclude }) |
| 58 | const workingDir = cwd || process.cwd() |
| 59 | |
| 60 | const watcher = chokidar.watch(dirnames, { |
| 61 | usePolling: poll, |
| 62 | cwd, |
| 63 | ignored(path, stats) { |
| 64 | const relativePath = relative(workingDir, path) |
| 65 | return !!stats?.isFile() && !isValidPath(relativePath) |
| 66 | }, |
| 67 | ignoreInitial: true, |
| 68 | ignorePermissionErrors: true, |
| 69 | awaitWriteFinish: coalesce ? { stabilityThreshold: 50, pollInterval: 10 } : false, |
| 70 | }) |
| 71 | |
| 72 | logger.debug('watch:file', `Watching [ ${dirnames.join(', ')} ]`) |
| 73 | |
| 74 | process.once('SIGINT', async () => { |
| 75 | await watcher.close() |
| 76 | }) |
| 77 | |
| 78 | return watcher |
| 79 | }, |
| 80 | }, |
| 81 | } |
| 82 |
nothing calls this directly
no test coverage detected