ref(nitro): Unify pluginPackages, add dashboard route, add includeFiles#148
ref(nitro): Unify pluginPackages, add dashboard route, add includeFiles#148
Conversation
Nitro declares jiti as an optional peer dependency for loading TypeScript config files via c12. Currently it resolves transitively through vite, but that is fragile. Make it explicit in the init scaffold and example app. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously pluginPackages had to be declared in both nitro.config.ts (for build-time file copying) and server.ts (for runtime discovery). Now declare it once in juniorNitro() and createApp() resolves it automatically via env var (dev) or config JSON file (production build). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Move the debug dashboard from the example app's index.html into a core route at /api/__junior/dashboard so it's available in all Junior apps automatically. Add includeFiles option to juniorNitro() for copying files that the bundler can't trace (e.g. dynamically imported pi-ai providers). The example app now uses this to bundle pi-ai provider files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b81b2bc. Configure here.
| /** | ||
| * Resolve a package subpath pattern like `@scope/pkg/dist/dir/*.js` | ||
| * and copy matching files into the server output under `node_modules/`. | ||
| */ |
There was a problem hiding this comment.
Orphaned JSDoc comment attached to wrong function
Low Severity
The JSDoc block on lines 100–103 ("Resolve a package subpath pattern…and copy matching files…") describes copyIncludedFiles (line 125), not resolvePackageDir (line 105). It's stacked directly above a second, correct JSDoc for resolvePackageDir, leaving copyIncludedFiles with no documentation and resolvePackageDir with a misleading extra comment.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b81b2bc. Configure here.
| while (dir !== path.dirname(dir)) { | ||
| if (path.basename(dir) === lastSeg) return dir; | ||
| dir = path.dirname(dir); | ||
| } |
There was a problem hiding this comment.
Directory walk can match wrong inner subdirectory
Low Severity
resolvePackageDir walks up from the resolved entry and returns the first directory whose basename matches the package name's last segment. If the package contains an internal subdirectory with that same name (e.g., a package @scope/lib whose entry resolves through a lib/ subdirectory), the walk finds the inner directory first and returns the wrong path. This would cause copyIncludedFiles to silently copy from (or miss) the wrong location.
Reviewed by Cursor Bugbot for commit b81b2bc. Configure here.


Three improvements to the Nitro integration:
Unify pluginPackages — Previously had to be declared in both
nitro.config.tsandserver.ts. Now declare once injuniorNitro()andcreateApp()resolves it automatically viaJUNIOR_PLUGIN_PACKAGESenv var (dev) or__junior_config.json(production build).Diagnostics dashboard — Moved the debug dashboard from the example app's
index.htmlinto a core route atGET /api/__junior/dashboard, available in all Junior apps.includeFiles option — New
juniorNitro({ includeFiles: [...] })option for copying files the bundler can't trace (e.g. dynamically imported pi-ai providers). Resolves packages viaimport.meta.resolveso it works across pnpm's strict isolation.