npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lorion-org/provider-selection

v1.0.0-beta.8

Published

Framework-free capability provider selection primitives.

Readme

@lorion-org/provider-selection

Framework-free resolution of active provider slots.

An active slot may be unfilled when no active consumer requires its capability. A required slot must select exactly one provider. This separates three concerns that hosts commonly need independently: whether a slot participates in a composition, whether a consumer requires it, and which provider wins.

A provider declares which capability it implements. The public selection modes name why the provider won, in this order:

  1. explicit: a provider named directly as a composition root by the host
  2. dependency: a provider named as a descriptor dependency
  3. default: the provider declaring defaultFor

There is no implicit "first provider" fallback. Distinct providers requested at the same tier are an error, as is a request for an unknown provider. A winner at a higher tier records the lower-tier provider ids it overrides.

Install

pnpm add @lorion-org/provider-selection

Example

import {
  collectProviderRequests,
  resolveItemProviderSelection,
} from '@lorion-org/provider-selection';

const providers = [
  { id: 'keycloak', providesFor: 'auth' },
  { id: 'local-auth', providesFor: 'auth', defaultFor: 'auth' },
];

const result = resolveItemProviderSelection({
  items: providers,
  getCapabilityId: (provider) => provider.providesFor,
  getProviderId: (provider) => provider.id,
  requiredCapabilityIds: ['auth'],
  dependencyRequests: [{ capabilityId: 'auth', providerId: 'keycloak', sourceId: 'web' }],
  explicitRequests: collectProviderRequests({
    items: providers.filter((provider) => provider.id === 'local-auth'),
    getCapabilityId: (provider) => provider.providesFor,
    getProviderId: (provider) => provider.id,
    getSourceId: (provider) => provider.id,
  }),
  defaultRequests: [{ capabilityId: 'auth', providerId: 'local-auth', sourceId: 'local-auth' }],
});

The host explicitly selects local-auth. The selected slot has mode explicit, required: true, and reports keycloak in overriddenProviderIds. The result also exposes the collected providersByCapability and all excludedProviderIds.

Pass activeCapabilityIds for slots that participate without being required. If no request or default fills one, the result contains a deterministic slot such as:

{
  capabilityId: 'distribution',
  state: 'unfilled',
  required: false,
  candidateProviderIds: ['dist-a', 'dist-b'],
}

ProviderSelectionResolution.slots is a capability-sorted array, directly safe to serialize into reports, generated modules, or runtime config. Selected slots carry selectedProviderId, mode, and overriddenProviderIds; unfilled slots carry no invented winner. excludedProviderIds contains every non-winning candidate, including all candidates of an unfilled slot.

Selection modes

ProviderSelectionMode is 'explicit' | 'dependency' | 'default':

  • explicit: the host names the provider directly among its resolved composition roots. This includes roots from selected, baseDescriptors, a CLI or environment selection, and defaultSelection.
  • dependency: an active descriptor depends on the provider descriptor.
  • default: the provider declares defaultFor for the active capability. A default can fill a participating slot without making it required.

These are public provenance terms, not names for the graph algorithm. Internally, Lorion may call the input that starts graph resolution a selection seed; provider reports use explicit so consumers do not need that implementation vocabulary.

This package owns that vocabulary. ProviderSelection, composition reports, and the Nuxt public runtime config expose the values unchanged. Internal resolution may evolve behind them, but changing the mode field or one of its values is a coordinated breaking API and serialization change, not a local wording cleanup.

API

  • collectProvidersByCapability() groups candidates by capability.
  • collectProviderRequests() turns provider-like items into source-labelled selection requests.
  • resolveProviderSelection() resolves pre-grouped candidates. Its activeCapabilityIds participate in selection; its requiredCapabilityIds must be filled. Explicit and dependency requests activate and require their capability, while a default alone does not activate an otherwise inactive slot.
  • resolveItemProviderSelection() collects candidates and resolves them in one call.

Local commands

cd packages/provider-selection
pnpm build
pnpm test
pnpm coverage
pnpm typecheck
pnpm package:check