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/federation-preset

v0.2.0

Published

Shared dependency locking, preset builder, and compatibility validation for Module Federation

Downloads

88

Readme

@zonekit/federation-preset

Shared-dependency presets for Zonekit federation setups.

Use @zonekit/federation-preset when you want one place to define shared dependency rules for all remotes and hosts. It helps you lock shared dependency policy, validate zone configs against that policy, and convert a Zonekit federation config into bundler-specific plugin config for webpack, Vite, or Rspack.

This package does not install or register the federation plugin for you. It produces validated config objects that you pass into your bundler plugin setup.

Installation

pnpm add @zonekit/federation-preset

Install only the bundler peer dependency you actually use.

Quick start

import { createFederationPreset, createWebpackAdapter } from "@zonekit/federation-preset";

const preset = createFederationPreset({
  shared: {
    react: { singleton: true, requiredVersion: "^18.2.0", eager: true },
    "react-dom": { singleton: true, requiredVersion: "^18.2.0", eager: true },
  },
});

const zoneFederation = {
  name: "dashboard",
  exposes: { "./Widget": "./src/widget.tsx" },
  shared: {
    react: { singleton: true, requiredVersion: "^18.2.0" },
    "react-dom": { singleton: true, requiredVersion: "^18.2.0" },
  },
};

const applied = preset.apply(zoneFederation);
const validation = preset.validate(zoneFederation);
const pluginConfig = preset.toPluginConfig(zoneFederation, createWebpackAdapter());

void applied;
void validation;
void pluginConfig;

Recommended workflow

  1. Define one preset near the root of your workspace.
  2. Reuse it everywhere you generate bundler federation config.
  3. Validate each zone against the preset in CI so shared dependency drift is caught early.
  4. Use the bundler adapter that matches your host or remote build tool.

Key exports

Preset

  • createFederationPreset(options) creates a reusable preset with locked shared dependencies.
  • preset.apply(zone) merges preset shared dependencies into a zone federation config.
  • preset.extend(overrides) creates a derived preset with additional shared rules.
  • preset.validate(zone) checks one FederationConfig against preset rules.
  • preset.toPluginConfig(zone, adapter) produces bundler-specific plugin config from a FederationConfig.

Bundler adapters

  • createWebpackAdapter() for webpack ModuleFederationPlugin config objects.
  • createViteAdapter() for Vite federation plugin config objects.
  • createRspackAdapter() for Rspack Module Federation plugin config objects.

Validation

  • validatePresetCompatibility(preset, zones) validates multiple ZoneConfig entries in one call.
  • createPresetValidator(preset) creates a reusable validator function for CI or custom checks.

Notes

  • Validation errors are driven mostly by shared dependency semver compatibility and singleton rules.
  • A dependency that appears in a zone but not in the preset is reported as a warning, not an error.
  • toPluginConfig() returns plain config objects; you still need to wire them into the bundler plugin your stack uses.

Peer dependencies

All peer dependencies are optional -- install only the bundler you use:

| Package | Version | |---|---| | webpack | ^5.0.0 (optional) | | vite | ^5.0.0 \|\| ^6.0.0 (optional) | | @rspack/core | >=0.5.0 (optional) |

License

MIT

Read more: