MCPcopy Create free account
hub / github.com/chakra-ui/panda / watch

Function watch

packages/node/src/node-runtime.ts:52–79  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

globDirnameFunction · 0.90
cwdMethod · 0.65
watchMethod · 0.65
joinMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected