ReviewOS

stacks/bun-router

fix(package): router CLI alias references unpublished sources

#887
Closed chris opened this 9 days ago ·
9 days ago

An isolated install of a tarball built from 006c24e exposes a broken published CLI alias. The package manifest maps bun-router to ./dist/cli.js but maps router to ./bin/cli.ts. That TypeScript wrapper imports ../src/cli/index, and the published files omit src.

Reproduced with a real build, bun pm pack, and bun install of the tarball into a fresh consumer outside the repository:

bun node_modules/.bin/router --help
error: Cannot find module '../src/cli/index' from '.../node_modules/@stacksjs/bun-router/bin/cli.ts'

bun node_modules/.bin/bun-router --help
router/0.1.11
Usage:
  $ router <command> [options]

The archive contains the TypeScript bin wrapper but not its source imports. Point both published aliases at the same built, shebang-equipped dist/cli.js; keep the source wrapper for development/compilation. Validate both aliases, root/container entry imports and real routing from a newly packed isolated installation. Do not add source files to the package just to hide the broken mapping.

Found while checking the package artifact for the unpublished routing optimizations tracked downstream in stacksjs/stacks#2450 and stacksjs/stacks#2462. Source tests alone did not cover the packaged alias.

9 days ago

Fixed in fc93fa8, pushed directly to origin/main. Both aliases now target the built, shebang-equipped dist/cli.js. The regenerated Bun lock mirrors the alias and existing optional peer metadata; no dependency versions changed.

The baseline artifact reproduced the missing-source failure in a clean consumer. A separately packed candidate installed into another clean consumer passes both router --help and bun-router --help. The package root and container subpath import successfully. Thirty real native/generic HTTP checks cover path/query preservation, concurrent async request-context isolation, weighted compression, small-body identity refusal and empty 406 responses. Optional ts-crypto is absent in that consumer, verifying the packed root loads without it.

All 545 source tests, both TypeScript projects, pickier lint, the build's emitted-entrypoint smoke checks, and separate Standards/Spec review pass.

This is a packaging fix discovered while preparing the unpublished performance work for adoption by Stacks. No registry release or git tag was created by this fix.

Sign in to comment on this issue.