Unverified Commit de4f197e authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

Turbopack `next/font`: Order weight variants numerically (#72043)

The Google fonts API requires this. Previously, `get_stylesheet_url`
trusted that the weight axis inputs were sorted correctly, which they
may not be.

This PR creates and uses two new enums:

- `FontAxesWeights`, to capture weights as ints, and moves the
responsibility of sorting weights into `get_stylesheet_url` itself.
- `VariantValue` to wrap each value for variants, as these can be either
a string (an expression representing a variable font weight range) or a
`u16`, representing a fixed font weight. This allows us to defer
stringifying these until format time while still comparing them for
ordering.

Test Plan: Added a unit test for `get_stylesheet_url`.


Closes PACK-3359
parent c32e2802
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment