module_graph_node.ts

view source

Declarations
#

2 declarations

create_node_module_graph
#

module_graph_node.ts view source

(options: NodeModuleGraphOptions): ModuleGraph import {create_node_module_graph} from '@fuzdev/gro/module_graph_node.js';

Creates the Node ModuleGraph, which watches watch.dir with chokidar and reads each module's imports, following them outside watch.dir, except a package's file. 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. Its implementation (with chokidar and the import parser) is imported on first use, so a task that never queries the graph never loads them.

Bare and # imports resolve with import.meta.resolve against their importer, which Node honors only under --experimental-import-meta-resolve, as the gro CLI and spawn_with_loader pass it. Without the flag Node resolves them as Gro's own module would, so one Gro can't resolve is an error through log when there is one and no edge, and one it can, like a package both depend on or Gro's own #lib/*, is an edge to Gro's file.

options

returns

ModuleGraph

NodeModuleGraphOptions
#

module_graph_node.ts view source

NodeModuleGraphOptions import type {NodeModuleGraphOptions} from '@fuzdev/gro/module_graph_node.js';

watch

What the graph watches, usually GroConfig.watch.

type WatchOptions

log?

The logger the graph reports through, like a file whose imports fail to parse, which also warns of a watch error, like EACCES reading a directory; absent, a watch error warns through console, and so does a failure processing a change, like an unexpected read error.

type Logger

Depends on
#

Imported by
#