Skip to main content

Module module_state

Module module_state 

Source
Expand description

Project-wide state: the shared lookup tables built from all discovered packages.

ModuleState is the first thing an LSP session should create. Call ModuleState::build with the workspace root and it will:

  1. Walk all ancestor node_modules/ directories (via crate::discovery).
  2. Parse every package.json that has lsd: fields.
  3. Build three lookup tables consumed by the registries:
    • component_modules — maps module IRI → URL to components.jsonld
    • contexts — maps context IRI → parsed rdf_parsers::jsonld::convert::JsonLdVal
    • import_paths — maps IRI prefix → local directory URL (for resolving rdfs:seeAlso imports)

The state is read-only after construction; pass &state into crate::components::registry::ComponentRegistry and crate::config::registry::ConfigRegistry.

Structs§

ModuleState
Represents the fully-resolved state of all discoverable CJS modules. Mirrors the TypeScript IModuleState.