github biomejs/biome @biomejs/js-api@6.0.0
JavaScript APIs v6.0.0

latest release: @biomejs/biome@2.5.0
6 hours ago

6.0.0

Minor Changes

  • #8944 8cd3da1 Thanks @ash1day! - Added a new spanInBytesToSpanInCodeUnits helper function to convert byte-based spans from Biome diagnostics to UTF-16 code unit spans.

    Biome internally uses UTF-8 byte offsets for spans, but JavaScript strings use UTF-16 code units. This causes incorrect text extraction when using string.slice() with non-ASCII content. The new helper function correctly handles this conversion, including surrogate pairs and unpaired surrogates.

    import { spanInBytesToSpanInCodeUnits } from "@biomejs/js-api";
    
    const [start, end] = spanInBytesToSpanInCodeUnits(
      diagnostic.location.span,
      content,
    );
    const text = content.slice(start, end); // Correctly extracts the text

Patch Changes

  • Updated dependencies []:
    • @biomejs/wasm-web@2.5.0
    • @biomejs/wasm-bundler@2.5.0
    • @biomejs/wasm-nodejs@2.5.0

What's Changed

New Contributors

Full Changelog: https://github.com/biomejs/biome/compare/@biomejs/biome@2.4.16...@biomejs/js-api@6.0.0

Don't miss a new biome release

NewReleases is sending notifications on new releases.