Repository navigation
Description
Problem
- There's no devcheck. Running from a checkout without
--conditions=fix-headers-devsilently loads the builtdist/(or fails if it isn't built) instead ofsrc/, and nothing says so. - The
fix-headers-devcondition on"."hastypesandimportbut norequire, sorequire("@cldmv/fix-headers")in a checkout always getsdist/index.cjs, even with the condition set.
The CLDMV library convention (reference implementation: CLDMV/llm-translator, PR #1) includes a root devcheck.mjs. Its canonical copy is @cldmv/uuid's:
- it reads
--conditions=x/--conditions x/-C xfrom bothNODE_OPTIONSandprocess.execArgv, and only an exact match counts; - it skips in CI and when installed under
node_modules; - it still nags when
dist/exists, and ignoresNODE_ENV; - it is never published.
Tasks
-
Add
devcheck.mjsat the repo root (@cldmv/uuid's version,uuid→fix-headers) and its 15-case test suite astests/devcheck.test.vitest.mjs. -
At the top of the ESM entry (
src/fix-header.mjs, orsrc/index.mjsonce Move the CJS entry out of src/cjs/ to src/index.cjs (and the ESM entry to src/index.mjs) #157 lands), add the async devcheck block:(async () => { try { await import("../devcheck.mjs"); } catch { // ignore - devcheck.mjs is not published } })();
Use uuid's comment: no top-level await, because the CJS entry loads this module through
require(esm). -
tsup.config.mjs:external: ["../devcheck.mjs"]on theindexentry and on the CLI entry (bin/fix-headers.mjs), so neither bundles devcheck. -
package.json:- add
require: ./src/index.cjsto thefix-headers-devcondition once Move the CJS entry out of src/cjs/ to src/index.cjs (and the ESM entry to src/index.mjs) #157 givessrc/index.cjsa siblingsrc/index.mjs(until then,./src/cjs/index.cjscan't load fromsrc/, so wait for Move the CJS entry out of src/cjs/ to src/index.cjs (and the ESM entry to src/index.mjs) #157) files: excludetypes/devcheck.d.mtsif it gets emitted
- add
-
Tests: pass
--conditions=fix-headers-devto vitest (resolve.conditions,ssr.resolve.conditions,test.nodeOptions) and to thenode --testCJS run. Add a check totests/cjs/entry.test.cjsthatdist/index.mjsimports../devcheck.mjsrather than bundling it.
Related
- Move the CJS entry out of src/cjs/ to src/index.cjs (and the ESM entry to src/index.mjs) #157: the entry rename (
src/cjs/index.cjs→src/index.cjs,src/fix-header.mjs→src/index.mjs). The dev-conditionrequiredepends on it.
Activity
fix: fixHeaders() waits for the devcheck before touching any file (#158)
fix: load the devcheck synchronously so it gates every export (#158)
test: mark the devcheck load's catch as unreachable from the suite (#158
fix: look up node:module at runtime so the devcheck block is bundler …
fix: raise the Node.js floor to 22.13.0 (#158)
fix: entry files are src/index.mjs and src/index.cjs, with a devcheck…
fix: fixHeaders() waits for the devcheck before touching any file (#158)
fix: load the devcheck synchronously so it gates every export (#158)
test: mark the devcheck load's catch as unreachable from the suite (#158
fix: look up node:module at runtime so the devcheck block is bundler …
fix: raise the Node.js floor to 22.13.0 (#158)
fix: entry files are src/index.mjs and src/index.cjs, with a devcheck…
release: v2.2.4 - find and keep # headers in CRLF and byte-order-mark…
Shinrai commentedon Nov 1, 2026
Shipped in v2.2.4 (#167), via #165. It didn't auto-close because the release notes said "fixes #157 and #158", and only the issue right after the keyword gets linked. Closing by hand.