Problem
The npm registry truncates the readme field in packument JSON responses at exactly 65,536 characters (2^16). This means packages with large READMEs (e.g., vue-data-ui at ~80KB) are rendered incomplete on npmx.dev — the content is silently cut off mid-document.
Reproduction
curl -s "https://registry.npmjs.org/vue-data-ui" | jq '.readme | length'
# Returns: 65536
The actual README is 80,712 bytes, so ~19% of the content is lost.
Root Cause
In server/api/registry/readme/[...pkg].get.ts, the handler reads packageData.readme from the npm packument as the primary source. The jsDelivr CDN fallback (fetchReadmeFromJsdelivr) only triggers when the packument readme is missing or the filename is non-standard — not when it's truncated.
Fix
Prefer fetching the README directly from jsDelivr CDN (which serves the actual file from the npm tarball, untruncated), and fall back to the packument readme field only when jsDelivr doesn't have the file.
Problem
The npm registry truncates the
readmefield in packument JSON responses at exactly 65,536 characters (2^16). This means packages with large READMEs (e.g.,vue-data-uiat ~80KB) are rendered incomplete on npmx.dev — the content is silently cut off mid-document.Reproduction
The actual README is 80,712 bytes, so ~19% of the content is lost.
Root Cause
In
server/api/registry/readme/[...pkg].get.ts, the handler readspackageData.readmefrom the npm packument as the primary source. The jsDelivr CDN fallback (fetchReadmeFromJsdelivr) only triggers when the packument readme is missing or the filename is non-standard — not when it's truncated.Fix
Prefer fetching the README directly from jsDelivr CDN (which serves the actual file from the npm tarball, untruncated), and fall back to the packument
readmefield only when jsDelivr doesn't have the file.