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/config

v0.2.0

Published

Manifest fetcher, config resolver, flag filter, and preview resolver for Zonekit

Downloads

166

Readme

@zonekit/config

Manifest fetching and resolved-config assembly for Zonekit.

Use @zonekit/config when you already have config artifacts or manifests somewhere and need to turn them into a ResolvedConfig in a browser, Node service, or shell bootstrap path. This package fetches manifests, applies feature flags, builds resolved config, caches results, and can poll a version endpoint for refreshes.

If you need an HTTP server that exposes /resolve, /preview, or /version, use @zonekit/config-server.

Installation

pnpm add @zonekit/config

Quick start

import {
  createConfigRefresher,
  createConfigResolver,
  createManifestFetcher,
  createPreviewResolver,
} from "@zonekit/config";

const fetcher = createManifestFetcher({
  primaryBaseUrl: "https://cdn.example.com/manifests",
  buildPath: (dimensions) =>
    dimensions.map((dimension) => `${dimension.name}/${dimension.value}`).join("/") +
    "/manifest.json",
});

const resolver = createConfigResolver({
  fetcher,
  dimensions: [
    { name: "tenant", value: "acme" },
    { name: "region", value: "us-east" },
  ],
  flagProvider: {
    getFlags: async () => ({ "new-dashboard": true }),
  },
});

const resolvedConfig = await resolver.resolve();

const refresher = createConfigRefresher({
  versionUrl: "https://config.example.com/version",
  resolver,
  pollingIntervalMs: 30_000,
  onRefresh: (nextConfig) => {
    console.log("Config refreshed", nextConfig.configVersion);
  },
});

const previewResolver = createPreviewResolver(fetcher, {
  getFlags: async () => ({ "new-dashboard": true }),
});

const preview = await previewResolver.preview(
  [{ name: "tenant", value: "acme" }],
  { "new-dashboard": false },
);

void resolvedConfig;
void refresher;
void preview;

Recommended usage

  1. Use createManifestFetcher() to describe where manifests live.
  2. Use createConfigResolver() to build and cache a ResolvedConfig.
  3. Add createConfigRefresher() if clients need polling-based refresh.
  4. Add createPreviewResolver() when you need draft or flag-override previews.

Key exports

Resolution flow

  • createManifestFetcher(options) to fetch manifests from a CDN or config endpoint, with optional fallback behavior.
  • createConfigResolver(options) to resolve, cache, and invalidate ResolvedConfig.
  • createConfigRefresher(options) to poll a version endpoint and re-resolve on change.
  • createPreviewResolver(fetcher, flagProvider) to preview config with flag overrides and no cache reuse.

Validation

  • validateManifest(manifest) for manifest-level validation.
  • validateResolvedConfig(config) for resolved-config validation.
  • validateFlagSubtractOnly(manifestRoutes, resolvedRoutes) to assert flags only subtract routes.

Errors

  • FlagViolationError when flagged routing produces an invalid surface.
  • SchemaVersionMismatchError when fetched config has an incompatible schema version.

Notes

  • resolve() caches results. Use ttl for expiry or invalidate() after a version change.
  • fallbackFetcher on the resolver is the last-resort path if the primary fetcher fails.
  • createConfigRefresher() expects a version endpoint that returns a version field.
  • This package is SSR-safe. Inject your own fetch implementation when you are not using globalThis.fetch.

License

MIT

Read more: