next.js
de4f197e - Turbopack `next/font`: Order weight variants numerically (#72043)

Commit
1 year ago
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
Author
Parents
Loading