Skip to content

pin add tailwindcss fails: packument exceeds registries client 10 MiB cap #2

Description

@andrew
$ 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions