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

@bimo-dk/nexus-build

v0.2.1

Published

Auto-generate Native Federation config from @NexusRemote class decorators

Readme

@bimo-dk/nexus-build

Auto-generate Native Federation config from @NexusRemote class decorators. No more hand-editing federation.config.json — annotate one component and nexus-build figures out the rest.

Installation

npm install -D @bimo-dk/nexus-build

Usage (the only two changes you need)

1. Annotate your entry component

// src/app/remote-entry/entry.component.ts
import { Component } from '@angular/core';
import { NexusRemote } from '@bimo-dk/nexus-build';

@NexusRemote()
@Component({
  selector: 'app-checkout',
  template: `<h1>Checkout</h1>`,
})
export default class CheckoutComponent {}

That's it. No name, no route, no exposes block.

2. Run nexus-build before your Angular build

// package.json
{
  "scripts": {
    "prebuild": "nexus-build",
    "build": "ng build"
  }
}

When you npm run build, nexus-build scans src/**/*.ts, finds @NexusRemote, and writes:

{
  "name": "checkout",
  "exposes": {
    "./RemoteEntry": "./src/app/remote-entry/entry.component.ts"
  },
  "shared": { "@angular/core": { "singleton": true, ... } }
}

How auto-detection works

When you write @NexusRemote() without arguments, the name is resolved in this order:

  1. Explicit option@NexusRemote({ name: 'checkout' }) always wins.
  2. package.json#name — if it matches camelCase (e.g. "name": "checkout", or the unscoped tail of @bimo-dk/checkout).
  3. Class nameCheckoutComponent → strip Component/Entry suffix → camelCase → checkout.

The route is derived from the name by converting camelCase to kebab-case (checkoutPagecheckout-page), unless you set route explicitly.

Decorator options (all optional)

| Option | Type | Default | Description | |---|---|---|---| | name | string | inferred | Remote name (camelCase) | | route | string | inferred from name | Route path under the host shell (kebab-case) | | exposeAs | string | 'RemoteEntry' | Module name in the exposes block |

CLI

nexus-build                  # scan + write federation.config.json
nexus-build --dry-run        # print resolved config without writing
nexus-build scan             # list discovered remotes as JSON (no write)
nexus-build --root ./apps/checkout --src src

Programmatic API

import { scanForRemotes, writeFederationConfig } from '@bimo-dk/nexus-build';

const remotes = await scanForRemotes({ projectRoot: process.cwd() });
const result = await writeFederationConfig(remotes, process.cwd(), {
  shared: { '@angular/core': { singleton: true, requiredVersion: 'auto' } },
});
console.log(result.config);

How it fits into the Nexus build pipeline

ng build
  ├─ prebuild (npm-script)
  │    └─ nexus-build
  │         ├─ scan src/**/*.ts for @NexusRemote
  │         ├─ resolve name/route/exposeAs
  │         └─ write federation.config.json
  └─ ng build (reads federation.config.js -> federation.config.json)

federation.config.js stays as-is — it's Native Federation library convention. It just reads the JSON that nexus-build regenerates.

Conflict handling

  • Same exposeAs from two files -> error. Set distinct exposeAs values to disambiguate.
  • Two decorators with different names but same exposeAs -> error. Pick one name.
  • shared block already in federation.config.json -> preserved (not overwritten) unless you pass a shared override.