Summary
@stacksjs/bun-router@0.0.19 fails to import. The published bundle re-exports clearNamedRoutes from the barrel, but the function's definition was dropped from the bundle. Importing the package's main entry throws an ESM link-time SyntaxError before any code runs.
This is already fixed in 0.0.20 (the definition is present), but 0.0.19 remains installable on npm, and because caret pins 0.0.x exactly, a ^0.0.19 range resolves to the broken build with no auto-upgrade.
Reproduction
npm pack @stacksjs/bun-router@0.0.19
tar -xzf stacksjs-bun-router-0.0.19.tgz
bun -e "await import('./package/dist/index.js')"→
SyntaxError: Exported binding 'clearNamedRoutes' needs to refer to a top-level declared variable.The same import() against 0.0.20 loads cleanly.
Evidence
0.0.19 dist/index.js — clearNamedRoutes appears only in the export block:
11841: clearNamedRoutes,There is no function clearNamedRoutes / clearNamedRoutes = anywhere else in the bundle — the definition was dropped (tree-shaken) while the re-export survived, leaving an orphan export.
0.0.20 dist/index.js — the definition is present alongside the export:
4946: function clearNamedRoutes() {
13681: clearNamedRoutes,Impact
Any consumer whose graph resolves bun-router to exactly 0.0.19 and imports the main entry crashes at import time. This has already forced downstream 0.0.20 overrides in apps that transitively pinned ^0.0.19.
Suggested fix
- Deprecate the bad version so ranges skip it and installs warn:
npm deprecate @stacksjs/bun-router@0.0.19 "Broken publish — orphan clearNamedRoutes export throws SyntaxError on import; use >=0.0.20" - Add a CI import smoke-test that actually
import()s the built entry point. The build "succeeded" here yet shipped an unimportable bundle — a bundler tree-shake silently dropped a re-exported definition, which only a real import (nottsc/type checks) catches.