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

@zonekit/runtime

v0.2.0

Published

Flow engine, zone router, handoff execution, and federation loader for Zonekit

Downloads

119

Readme

@zonekit/runtime

Framework-agnostic runtime primitives for Zonekit shells and hosts.

Use @zonekit/runtime when you need config-driven routing, shell context, flow orchestration, handoffs, or federation loading outside the React bindings. Most teams start here for router and shell state, then add federation once their remote contract is stable.

Installation

pnpm add @zonekit/runtime

Quick start

import {
  createRouter,
  createShellContext,
  loadRemoteModule,
  resolveNavigation,
} from "@zonekit/runtime";

declare function scriptLoader(
  zoneId: string,
  moduleName: string,
  remoteEntryUrl: string,
): Promise<unknown>;

const resolvedConfig = {
  tenant: { dimensions: { product: "default", tenant: "acme" } },
  remotes: {
    dashboard: {
      url: "https://cdn.example.com/dashboard/remoteEntry.js",
      module: "dashboard",
    },
  },
  routes: [],
  navigation: [{ id: "dashboard", label: "Dashboard", route: "/dashboard" }],
  flags: { dashboard_enabled: true },
  resolvedAt: new Date().toISOString(),
};

const zones = [
  {
    id: "dashboard",
    type: "remote",
    basePath: "/dashboard",
    rendering: "client",
    federation: {
      exposes: {
        "./DashboardApp": "./src/DashboardApp.tsx",
      },
    },
  },
];

const shellContext = createShellContext({
  auth: { accessToken: "demo-token" },
  tenant: resolvedConfig.tenant,
  config: resolvedConfig,
});

const router = createRouter(
  {
    transitions: [
      {
        from: "shell",
        to: "dashboard",
        trigger: "open-dashboard",
        mode: "federated",
        federation: { module: "./DashboardApp" },
      },
    ],
  },
  "shell",
  {
    guardEvaluator: (guard) => resolvedConfig.flags[guard.featureFlag ?? ""] === true,
  },
);

const navigation = resolveNavigation(resolvedConfig.navigation, {
  flags: resolvedConfig.flags,
});

const dashboardModule = await loadRemoteModule("dashboard", "./DashboardApp", {
  zones,
  remotes: resolvedConfig.remotes,
  scriptLoader,
});

void shellContext;
void router;
void navigation;
void dashboardModule;

Recommended adoption order

  1. Start with createRouter, buildRouteTree, and resolveNavigation to prove your config-driven shell.
  2. Add createShellContext when remotes need auth, tenant information, or an event bus.
  3. Add loadRemoteModule or createResilientLoader when you are ready to compose remotes at runtime.
  4. Add flow and handoff APIs only where you have real cross-zone workflow needs.

Key exports

Zone routing

  • createRouter(config, currentZone, options) for guarded zone-to-zone transitions.
  • buildRouteTree(config) for indexing resolved routes.
  • resolveNavigation(items, options) for flag and guard-aware navigation.

Flow engine

  • createFlowEngine(flow, options) for step-based progression with skip or block guards.

Handoff strategies

  • buildHandoffPayload(input) for typed payload construction.
  • executeCookieHandoff, executeTokenRedirectHandoff, executeSessionHandoff, and executeInMemoryHandoff for transport-specific execution.
  • validateHandoffPayload(payload, options) and HandoffPayloadTooLargeError for payload safety checks.

Federation

  • loadRemoteModule(zoneId, module, options) for remote loading with cache reuse.
  • createResilientLoader(options) for timeout, retry, and circuit-breaker behavior.
  • clearModuleCache() for global or targeted cache eviction.
  • getRemoteEntryUrl(zoneId, options) and isRemoteAvailable(zoneId, options) for diagnostics.
  • generateFederationConfig(zone) and getFederationManifest(zoneId, options) for federation metadata.

Shell and context

  • createShellContext(options) for auth, tenant, config, and auth lifecycle state.
  • createEventBus() for cross-zone communication.

Resilience

  • createCircuitBreaker(options) for per-zone failure isolation.
  • createResilientLoader(options) for retries around remote loading.

Federation notes

  • Pass resolvedConfig.remotes when you have resolved remotes for the current tenant or product. That gives deterministic remote selection.
  • Use clearModuleCache({ zoneId, moduleName }) after a config change, remote URL change, or manual retry flow.
  • Use clearModuleCache({ zoneId, moduleName, remoteEntryUrl }) if you need to surgically evict one resolved remote entry without disturbing others.

All modules are SSR-safe -- no DOM or window access in core logic. Inject server-safe adapters via options.

License

MIT

Read more: