pub fn register_ecosystems(
registry: &EcosystemRegistry,
cache: Arc<HttpCache>,
runtime: &EcosystemRuntime,
) -> Vec<&'static str>Expand description
Registers all enabled ecosystems.
cargo is special-cased (spec #443/#441, plan-1b §1.6): unlike register!’s generic
Ecosystem::new(cache) call, CargoEcosystem needs policy threaded through
CargoEcosystem::with_context so ServerState’s live-updatable
Arc<RegistryAccessPolicy> (see document::state::ServerState::registry_policy) is the
exact same handle every Cargo parse reads — initialize/did_change_configuration
updating it then takes effect immediately, with no need to reconstruct the ecosystem.
npm and deno are special-cased (#312): when both features are enabled, they share
one NpmRegistry instance — built once here and handed to both NpmEcosystem and
DenoEcosystem’s npm:-scheme half via with_registry/with_npm — instead of each
constructing its own. NpmRegistry is cheaply Clone (its HttpCache and
freshness-path publish-time map are both Arc-wrapped internally), so this dedupes the
freshness path’s full-packument fetch and its publish-time cache for a package
appearing in both package.json and a deno.json npm:-specifier dependency, on top
of the plain cached GETs the shared cache already dedupes.
Returns every ecosystem id this call threaded the live RegistryAccessPolicy handle
into (issue #592 security M1) — the single source of truth config::reparse_scope’s
caller consults to scope a registries.workspace_registries reparse, so that set can
never drift from what this function actually wires up. Adding a 6th policy-consuming
ecosystem means editing this function anyway (to thread policy through its parse
context); pushing its id onto the returned list at that same call site keeps the two
facts — “receives the policy” and “is in the reparse scope” — physically inseparable,
rather than duplicated across two independently-editable places.