Repository navigation
Description
Problem
The thin CommonJS entry is authored as src/cjs-shim.cjs and published as dist/index.cjs (tsup's onSuccess copies it under a new name). It sits next to src/index.mjs, the ESM entry it loads, so there's no reason for the names to differ.
The CLDMV library convention (as in CLDMV/llm-translator, and proposed for CLDMV/vitest-runner#98) gives the source and output the same name: src/index.mjs + src/index.cjs, published as dist/index.mjs + dist/index.cjs.
Proposal
git mv src/cjs-shim.cjs src/index.cjs(keeps history), thennpm run fix:headersfor the@Filenameheader.tsup.config.mjs:copyFileSync("src/index.cjs", "dist/index.cjs"), and update the file comment (lines ~20–26).package.json: change thewisp-devcondition'srequireto./src/index.cjs.tests/cjs-entry.test.vitest.mjs: update therequire.resolve/requirepaths, thedescribetitle and the file overview.- Update any coverage
exclude/ README / docs mention ofcjs-shim.cjs; leavedocs/changelog/**history alone. - Check that
dist/index.cjsis byte-identical to before and the full suite passes.
Check before merging: caller resolution
pickPrimaryBaseFile() in src/lib/resolve-from-caller.mjs finds the real caller by watching stack frames leave src//dist/ and leave index.* entry files (see #12). Today a CJS caller loading the package in dev mode (wisp-dev) has a src/cjs-shim.cjs frame, which doesn't match index.*. After the rename it will be src/index.cjs, which does. Add a test that resolves the caller through the CJS entry, in dev mode (src/index.cjs) and built (dist/index.cjs), and confirm it still returns the user's file.
Non-goals
- Changing what the CJS entry does, or settling pickPrimaryBaseFile(): "Flag 2" (exitedIndex) is tracked but never read to return early #12.
Related
- CLDMV/vitest-runner#98, and the matching issues in fix-headers, stubborn-tcp and mxnet-control.
Activity
cldmv-bot commentedon Nov 1, 2026
Marked
status: implemented— resolved by #65, merged intonext. This issue closes automatically when that work ships to the default branch.release: v1.0.9 - raise engines to the require(esm) floor ^20.19.0 ||…