MCPcopy Create free account
hub / github.com/contentlayerdev/contentlayer / make

Function make

packages/@contentlayer/utils/src/node/fs-watcher.ts:225–240  ·  view source on GitHub ↗
(
  paths: readonly string[] | string,
  options?: Chokidar.WatchOptions,
)

Source from the content-addressed store, hash-verified

223
224// export function make(paths: readonly string[] | string, options?: Chokidar.WatchOptions): T.UIO<FileWatcher> {
225export function make(
226 paths: readonly string[] | string,
227 options?: Chokidar.WatchOptions,
228): T.Effect<unknown, never, FileWatcher> {
229 return pipe(
230 T.succeedWith(() => Chokidar.watch(paths, options)),
231 // T.tap(() => T.succeedWith(() => console.log('start make'))),
232 T.chain((_) => Ref.makeRef<Chokidar.FSWatcher>(_)),
233 T.zip(H.makeUnbounded<Ex.Exit<never, E.Either<FileWatcherError, FileSystemEvent>>>()),
234 // T.tap(() => T.fail(new Error('test'))),
235 T.chain(({ tuple: [instance, hub] }) =>
236 T.succeedWith(() => new ConcreteFileWatcher(instance, hub, paths, options)),
237 ),
238 T.tap((_) => _.subscribeToEvents()),
239 )
240}
241
242// export const makeAndSubscribe = (
243// paths: readonly string[] | string,

Callers 1

makeAndSubscribeFunction · 0.70

Calls 1

subscribeToEventsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…