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

@anarchitects/nx-js

v0.1.0

Published

Anarchitects Nx JS plugin with enhanced secondary entry point support.

Readme

@anarchitects/nx-js

An Nx plugin that extends @nx/js with first-class secondary entry point generation for JavaScript and TypeScript libraries.

It provides a single generator that scaffolds the source files for a secondary entry point and automatically wires it into the library's build target — for all bundlers @nx/js supports, including libraries that rely on inferred targets.


Installation

Use nx add — the standard Nx way to adopt a plugin:

nx add @anarchitects/nx-js

Or install manually:

yarn add -D @anarchitects/nx-js
# or
npm install -D @anarchitects/nx-js

Compatibility: supports Nx >=21.6.4 <23.


Generators

secondary-entry-point

Adds a secondary export path to an existing library.

nx g @anarchitects/nx-js:secondary-entry-point --project=<project> --name=<segment>

Required options

| Option | Description | | --- | --- | | --project | Name of the Nx library project to add the entry point to. | | --name | Path segment for the new entry point (e.g. feature, data/access). |

Optional options

| Option | Default | Description | | --- | --- | --- | | --buildTarget | build | Name of the build target to update. | | --skipFormat | false | Skip formatting generated files. |

What it does

The generator always runs these steps:

  1. Validates --project and --name.
  2. Normalizes --name into path-safe segments (e.g. Data/Accessdata/access).
  3. Creates source files in the library:
    • src/<segment>/index.ts
    • src/<segment>/lib/<leaf-segment>.ts
  4. Fails if src/<segment>/index.ts already exists.
  5. Updates the build target configuration based on the bundler in use (see table below).

Bundler behavior

| Bundler | Executor | What is updated | Mutation | | --- | --- | --- | --- | | tsc | @nx/js:tsc | project.json | Appends to options.additionalEntryPoints[]; sets options.generateExportsField = true. | | swc | @nx/js:swc | project.json | Appends to options.additionalEntryPoints[]; sets options.generateExportsField = true. | | rollup | @nx/rollup:rollup | project.json | Appends to options.additionalEntryPoints[]; sets options.generateExportsField = true. | | esbuild | @nx/esbuild:esbuild | project.json | Appends to options.additionalEntryPoints[]; sets options.generateExportsField = true. | | vite | @nx/vite:build | vite.config.* | Adds "<segment>/index": "src/<segment>/index.ts" to build.lib.entry. Converts entry from a string to an object if needed. |

Inferred targets

For libraries that use Project Crystal inference (no explicit build target in project.json), the generator detects the bundler by checking for its config file:

  • rollup.config.js|ts|mjs|mts|cjs → treated as rollup; entry points are written into project.json.
  • vite.config.ts|mts|js|mjs|cjs → treated as vite; the config file is updated directly.

Additional notes

  • additionalEntryPoints is deduplicated and sorted on every update.
  • generateExportsField is forced to true so Nx emits secondary exports in the built package.json.
  • The generator never mutates the source package.json exports directly.
  • Unknown executors are skipped with a warning so you can configure entry points manually.

Example

nx g @anarchitects/nx-js:secondary-entry-point --project=my-lib --name=feature

Created files:

libs/my-lib/src/feature/index.ts
libs/my-lib/src/feature/lib/feature.ts

For tsc, swc, rollup, esbuildproject.json build options after the run:

{
  "options": {
    "additionalEntryPoints": ["libs/my-lib/src/feature/index.ts"],
    "generateExportsField": true
  }
}

For vitevite.config.* after the run:

entry: {
  index: 'src/index.ts',
  'feature/index': 'src/feature/index.ts',
}

Development

Build:

yarn nx build nx-js

Test:

yarn nx test nx-js

Lint:

yarn nx lint nx-js

License

This project is licensed under the Apache License 2.0.