You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(package_json): re-read file for serde_json fallback in simd implementation (#808)
## Summary
When `simd_json` fails to parse a `package.json` file, the fallback to
`serde_json` now re-reads the file from disk instead of using a cloned
byte buffer. This ensures accurate error messages with correct line and
column numbers.
## Problem
Previously, when `simd_json` parsing failed, the code used a cloned byte
buffer for the `serde_json` fallback. However, `simd_json` mutates the
buffer in-place during parsing, so even a cloned buffer taken before
parsing might not reflect the original file content if the mutation
happened before the clone.
## Solution
- Updated `PackageJson::parse` to accept a `FileSystem` parameter
- Modified the error fallback to re-read the file using
`fs.read_to_string(&realpath)` before parsing with `serde_json`
- This guarantees that error messages are based on the original,
unmodified file content
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments