$ pin add tailwindcss@^3
fetch tailwindcss package metadata: unexpected end of JSON input
The full tailwindcss packument is 10,499,105 bytes (2549 versions). registries/client v0.6.0 wraps response bodies in io.LimitReader(resp.Body, 10<<20) and returns the truncated bytes without error, so GetJSON hands a cut-off document to json.Unmarshal.
The abbreviated packument (application/vnd.npm.install-v1+json) would be the obvious fix but it omits time, which min_release_age needs, and per-version publish timestamps aren't available anywhere else in the registry API. So pin has to fetch the full doc.
Fixes:
registries/client: error when the cap is hit instead of silently truncating, and expose the cap as an Option. npm packuments can approach 100 MB.
source/npm.fetchPackageDoc: set the cap high enough for real-world packuments (or stream-decode with json.Decoder so there's no buffered cap at all).
- Error string should name the limit so the failure is diagnosable.
Separately: tailwindcss v3 doesn't ship a browser bundle on npm (main is the Node entry, no jsdelivr/unpkg/browser fields), so once the fetch works pin add tailwindcss@^3 with no files: will hit the no-entrypoint path. The Play CDN build at cdn.tailwindcss.com isn't on npm.
The full tailwindcss packument is 10,499,105 bytes (2549 versions).
registries/clientv0.6.0 wraps response bodies inio.LimitReader(resp.Body, 10<<20)and returns the truncated bytes without error, soGetJSONhands a cut-off document tojson.Unmarshal.The abbreviated packument (
application/vnd.npm.install-v1+json) would be the obvious fix but it omitstime, whichmin_release_ageneeds, and per-version publish timestamps aren't available anywhere else in the registry API. So pin has to fetch the full doc.Fixes:
registries/client: error when the cap is hit instead of silently truncating, and expose the cap as anOption. npm packuments can approach 100 MB.source/npm.fetchPackageDoc: set the cap high enough for real-world packuments (or stream-decode withjson.Decoderso there's no buffered cap at all).Separately: tailwindcss v3 doesn't ship a browser bundle on npm (
mainis the Node entry, nojsdelivr/unpkg/browserfields), so once the fetch workspin add tailwindcss@^3with nofiles:will hit the no-entrypoint path. The Play CDN build at cdn.tailwindcss.com isn't on npm.