Skip to content

Conversation

@stormslowly
Copy link
Contributor

Summary

  • replace the serde-based shim with a local simd-json value implementation and helper macros that avoid the serde_impl feature
  • update package.json, tsconfig parsing, and supporting code to use the new value API and manual conversions
  • adjust benches and tests to serialize through the new helpers instead of the removed simd_json::serde module

Testing

  • CARGO_NET_OFFLINE=true cargo test -p rspack_resolver

https://chatgpt.com/codex/tasks/task_e_68f5a951159c8326a66ea2760df20dbf

Copilot AI review requested due to automatic review settings October 20, 2025 17:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates from serde_json to simd_json for JSON parsing, specifically avoiding the serde_impl feature by implementing manual value conversions. The change removes the dependency on serde-based deserialization and instead uses simd_json::OwnedValue with custom parsing logic.

Key Changes:

  • Replaced serde_json with simd-json using only the value feature (without serde_impl)
  • Implemented manual JSON object parsing for TsConfig and PackageJson instead of serde deserialization
  • Updated all test fixtures to use simd_json::json! macro and serialization helpers

Reviewed Changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Cargo.toml Updated dependency from serde_json to simd-json with custom patch configuration
src/tsconfig.rs Replaced serde deserialization with manual simd_json::OwnedValue parsing helpers
src/package_json.rs Changed signature to accept mutable string slice for in-place parsing
src/cache.rs Updated error handling and function calls to use simd_json types
src/error.rs Renamed helper function and updated documentation references
src/lib.rs Changed JSONValue type alias to simd_json::OwnedValue
src/tests/tsconfig_paths.rs Converted test fixtures to use simd_json serialization
src/tests/imports_field.rs Simplified helper to directly extract object from value
src/tests/exports_field.rs Updated type signatures to use simd_json::OwnedValue
benches/resolver.rs Updated benchmark to use mutable string for parsing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Cargo.toml Outdated
debug = false# set to `true` for debug information
panic = "abort"
[patch.crates-io]
simd-json = { path = "vendor/simd-json" }
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch configuration references a local vendor path that likely doesn't exist in the repository. This will cause build failures for other developers or CI systems. Consider either: (1) removing this patch if it was used only for local development, or (2) documenting the vendor directory requirement in the PR description or README.

Suggested change
simd-json = { path = "vendor/simd-json" }

Copilot uses AI. Check for mistakes.
json: &str,
) -> Result<Self, serde_json::Error> {
let mut raw_json: JSONValue = serde_json::from_str(json)?;
json: &mut str,
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the parameter from &str to &mut str is a breaking API change that may affect external callers. The mutability requirement comes from simd_json::to_owned_value modifying the input string for performance. Consider documenting this requirement in the function's documentation comment, explaining that the input string will be modified during parsing.

Copilot uses AI. Check for mistakes.
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 20, 2025

CodSpeed Performance Report

Merging #111 will not alter performance

Comparing codex/replace-serde-with-simd_json-for-parsing (b8f5173) with main (8124bf3)

Summary

✅ 5 untouched

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants