FileChange import type {FileChange} from '@fuzdev/gro/module_graph.js'; A file added, updated, or deleted, by absolute path.
type
type FileChangeType
id
type PathId
5 declarations
FileChange import type {FileChange} from '@fuzdev/gro/module_graph.js'; A file added, updated, or deleted, by absolute path.
typetype FileChangeType
idtype PathId
FileChangeCallback import type {FileChangeCallback} from '@fuzdev/gro/module_graph.js'; Receives each FileChange of a watch.
(call)type (change: FileChange): void
changevoidFileChangeType type "add" | "update" | "delete"
import type {FileChangeType} from '@fuzdev/gro/module_graph.js'; The kind of a FileChange.
ModuleGraph import type {ModuleGraph} from '@fuzdev/gro/module_graph.js'; The project's module graph: which files exist under the watched directory
and which import which. Tasks and plugins get one on their context.
Queries load the graph on first use, and close tears it down for good.
A load that fails stays failed: later queries reject with the same error.
modulesGets the ids of the project modules that exist on disk.
type (filter?: ((id: PathId) => boolean) | undefined): Promise<PathId[]>
filter?narrows the results
(id: PathId) => booleanPromise<PathId[]>dependentsGets every module that imports id, directly or transitively.
The filter narrows the results, not the traversal.
A package's file is never read, so its imports aren't edges: one a bare specifier
reaches, even when linked, and one whose path from the watched directory passes
through a node_modules directory, both from the directory as named and from its
real path.
type (id: PathId, filter?: ((id: PathId) => boolean) | undefined): Promise<Set<PathId>>
idthe module whose dependents to find
PathIdfilter?narrows the results
(id: PathId) => booleanPromise<Set<PathId>>the dependents, including of an imported path that doesn't exist yet; empty when nothing imports id
watchSubscribes to changes of project modules, first calling on_change
with an add for each module already in the graph.
Changes are content-based, so saving a file unchanged emits nothing.
type (on_change: FileChangeCallback): Promise<() => Promise<void>>
on_changecalled for each change
Promise<() => Promise<void>>a function that unsubscribes
closeStops watching and drops the graph. A graph that never loaded closes without loading.
Closing is permanent: later queries and watches reject, as do any pending when it's called.
A watch pending when it's called may already have delivered its initial adds before rejecting.
Every call returns the same teardown, so an awaited close means fully closed.
type (): Promise<void>
Promise<void>WatchOptions import type {WatchOptions} from '@fuzdev/gro/module_graph.js'; What a ModuleGraph watches, from GroConfig.watch.
dirThe directory to watch, which holds the project modules. Files outside it enter the graph only when a project module imports them.
type PathId
filterExcludes the paths it rejects from the change events and from the project modules.
It's called with absolute paths, unlike GroConfig.search_filters,
which get paths relative to the project root.
It filters events, not the directory walk: a rejected directory is still watched,
so each path below it is filtered on its own.
type (PathFilter) | null