nodefony-check-externals

Audits drift between rolldown external lists and package.json peerDependencies in Nodefony packages.

Updated Dec 19, 2023
One-click install
npx skills add https://github.com/nodefony/nodefony-core --skill nodefony-check-externals-nodefony
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodefony-check-externals
Source: https://github.com/nodefony/nodefony-core/tree/main/.claude/skills/nodefony-check-externals
Command: npx skills add https://github.com/nodefony/nodefony-core --skill nodefony-check-externals-nodefony

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Nodefony packages maintain the same dependency list twice by hand: the external array in rolldown.config.ts and peerDependencies in package.json. This duplication drifts, causing peer dependencies to be silently bundled by rolldown, which breaks builds on native modules (e.g. @node-rs/bcrypt) or ships duplicated libraries in published packages. ## Core Features & Use Cases - Bundled-dependency proof: Scans dist/**/node_modules to show which packages were actually bundled, rather than guessing from config formats. - Drift detection: Flags manifest dependencies missing from external, distinguishing real defects (imported by bundled server code) from informational entries (frontend-only tools like vite or react). - Build-tool peer trap: Explains why build tools like vite or rolldown must never be declared as peerDependencies, since npm prune --omit=dev keeps them in production images. - Use Case: Before publishing to npm or when a build fails with a native-module error, run the audit to find which peerDep was swallowed by the bundler and get the exact fix. ## Quick Start Ask the assistant to run the externals audit on the Nodefony repository and report any peerDependencies that rolldown is bundling.

Frequently Asked Questions about nodefony-check-externals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if rolldown is bundling a peerDependency?

Run node scripts/check-externals.mjs in the repository root. The report's first section inspects dist output for bundled packages, and the second lists manifest dependencies missing from the external array, exiting with code 1 on defects.

Why does my rolldown build fail on a native module like @node-rs/bcrypt?

A peerDependency missing from the external list gets bundled, and rolldown follows its imports down to native modules that cannot be bundled. Add the missing package to the external array in rolldown.config.ts, then rebuild and rerun the audit.

Should vite or rolldown be declared as peerDependencies?

No. A peer dependency satisfied by a devDependency is kept in the production tree by npm prune --omit=dev, shipping the build tool in production images. Build-time-only tools belong in devDependencies, with the application declaring them itself.

Why does the externals audit report show packages as unproven?

The bundled-dependency proof only works on a fresh dist directory. Modules without dist output are reported as unproven rather than counted as passing, so rebuild with npx turbo run build --force --filter=<package> before concluding.

Can I derive the rolldown external list from package.json automatically?

Yes. Import package.json and build external from Object.keys of peerDependencies plus non-peer extras like tslib. This removes the duplication that causes drift, but requires editing every rolldown.config.ts, which is a protected file needing user approval.