Skip to content

[rust-compiler] Switch to hmac-sha256 and bump napi/similar - #36809

Merged
poteto merged 1 commit into
react:mainfrom
Boshen:fix-rust-cargo-check
Jun 17, 2026
Merged

[rust-compiler] Switch to hmac-sha256 and bump napi/similar#36809
poteto merged 1 commit into
react:mainfrom
Boshen:fix-rust-cargo-check

Conversation

@Boshen

@BoshenBoshen commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Dependency maintenance for the Rust compiler crates.

Fast Refresh hash: sha2 + hmac → hmac-sha256

The Fast Refresh source hash (enableResetCacheOnSourceFileChanges) only needs an HMAC-SHA256 of the source text, matching the TS compiler's createHmac('sha256', code).digest('hex'). RustCrypto's sha2 + hmac pulled in 11 crates (sha2, hmac, digest, block-buffer, typenum, crypto-common, hybrid-array, const-oid, cpufeatures, cmov, ctutils) — generic-hashing / constant-time machinery that is irrelevant for a non-security content fingerprint. This replaces them with the single zero-dependencyhmac-sha256 crate: a net reduction of 10 crates.

HMAC-SHA256 is a standardized deterministic algorithm, so the emitted hash is unchanged. A new unit test source_file_hash_matches_node_create_hmac pins the result against Node's createHmac('sha256', code).digest('hex') for several inputs.

Other bumps

  • napi / napi-derive 2 → 3
  • similar 2 → 3 (dev-dependency)
  • Drop the unused react_compiler_lowering dependency from react_compiler_ssa

cargo check --workspace --all-targets passes, including the napi 3 native crate.

@meta-cla

meta-claBot commented Jun 17, 2026

Copy link
Copy Markdown

Hi @Boshen!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-claBot commented Jun 17, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Boshen added a commit to oxc-project/forked-react-compiler that referenced this pull request Jun 17, 2026
Apply react/react PR #36809 ("[rust-compiler] Bump dependencies and fix
cargo check") to the vendored tree via
patches/0001-backport-react-pr-36809-dep-bumps.patch:
- similar 2->3, sha2 0.10->0.11, hmac 0.12->0.13, napi/napi-derive 2->3
- drop the unused react_compiler_ssa -> react_compiler_lowering dep
- hmac 0.13 API fix in codegen_reactive_function.rs (KeyInit import +
manual hex formatting of the finalized MAC)
Skips the PR's cosmetic MEMO_CACHE_SENTINEL rustfmt hunk (its base carries
a `.into()` the currently-pinned upstream lacks; our line is already <100
cols). `cargo check --workspace` passes.
Temporary backport of an unmerged PR: remove the patch once #36809 merges
into react/react main (the next `just sync` will then make `git apply` fail
loudly, signalling removal).
Switch the Fast Refresh source hash from RustCrypto's sha2 + hmac
(11 crates) to the single zero-dependency hmac-sha256 crate -- a net
reduction of 10 crates. HMAC-SHA256 is deterministic, so the emitted
hash is unchanged; a new unit test pins source_file_hash against Node's
createHmac('sha256', code).digest('hex').
Also bump napi/napi-derive 2 -> 3 and similar 2 -> 3 (dev-dependency),
and drop the unused react_compiler_lowering dependency from
react_compiler_ssa.
@Boshen
Boshenforce-pushed the fix-rust-cargo-check branch from 4c2f42d to 5f91e06CompareJune 17, 2026 12:58
@BoshenBoshen changed the title [rust-compiler] Bump dependencies and fix cargo check[rust-compiler] Switch to hmac-sha256 and bump napi/similarJun 17, 2026
@poteto
poteto merged commit 560db51 into react:mainJun 17, 2026
18 of 19 checks passed
github-actionsBot pushed a commit to thought7878/react that referenced this pull request Jun 18, 2026
)
## Summary
Dependency maintenance for the Rust compiler crates.
### Fast Refresh hash: sha2 + hmac → hmac-sha256
The Fast Refresh source hash (`enableResetCacheOnSourceFileChanges`)
only needs an HMAC-SHA256 of the source text, matching the TS compiler's
`createHmac('sha256', code).digest('hex')`. RustCrypto's `sha2` + `hmac`
pulled in **11 crates** (`sha2`, `hmac`, `digest`, `block-buffer`,
`typenum`, `crypto-common`, `hybrid-array`, `const-oid`, `cpufeatures`,
`cmov`, `ctutils`) — generic-hashing / constant-time machinery that is
irrelevant for a non-security content fingerprint. This replaces them
with the single **zero-dependency** `hmac-sha256` crate: a net reduction
of **10 crates**.
HMAC-SHA256 is a standardized deterministic algorithm, so the emitted
hash is unchanged. A new unit test
`source_file_hash_matches_node_create_hmac` pins the result against
Node's `createHmac('sha256', code).digest('hex')` for several inputs.
### Other bumps
- `napi` / `napi-derive` 2 → 3
- `similar` 2 → 3 (dev-dependency)
- Drop the unused `react_compiler_lowering` dependency from
`react_compiler_ssa`
`cargo check --workspace --all-targets` passes, including the napi 3
native crate.
DiffTrain build for [560db51](react@560db51)
github-actionsBot pushed a commit to thought7878/react that referenced this pull request Jun 18, 2026
)
## Summary
Dependency maintenance for the Rust compiler crates.
### Fast Refresh hash: sha2 + hmac → hmac-sha256
The Fast Refresh source hash (`enableResetCacheOnSourceFileChanges`)
only needs an HMAC-SHA256 of the source text, matching the TS compiler's
`createHmac('sha256', code).digest('hex')`. RustCrypto's `sha2` + `hmac`
pulled in **11 crates** (`sha2`, `hmac`, `digest`, `block-buffer`,
`typenum`, `crypto-common`, `hybrid-array`, `const-oid`, `cpufeatures`,
`cmov`, `ctutils`) — generic-hashing / constant-time machinery that is
irrelevant for a non-security content fingerprint. This replaces them
with the single **zero-dependency** `hmac-sha256` crate: a net reduction
of **10 crates**.
HMAC-SHA256 is a standardized deterministic algorithm, so the emitted
hash is unchanged. A new unit test
`source_file_hash_matches_node_create_hmac` pins the result against
Node's `createHmac('sha256', code).digest('hex')` for several inputs.
### Other bumps
- `napi` / `napi-derive` 2 → 3
- `similar` 2 → 3 (dev-dependency)
- Drop the unused `react_compiler_lowering` dependency from
`react_compiler_ssa`
`cargo check --workspace --all-targets` passes, including the napi 3
native crate.
DiffTrain build for [560db51](react@560db51)
github-actionsBot pushed a commit to srpatcha/react that referenced this pull request Jun 18, 2026
)
## Summary
Dependency maintenance for the Rust compiler crates.
### Fast Refresh hash: sha2 + hmac → hmac-sha256
The Fast Refresh source hash (`enableResetCacheOnSourceFileChanges`)
only needs an HMAC-SHA256 of the source text, matching the TS compiler's
`createHmac('sha256', code).digest('hex')`. RustCrypto's `sha2` + `hmac`
pulled in **11 crates** (`sha2`, `hmac`, `digest`, `block-buffer`,
`typenum`, `crypto-common`, `hybrid-array`, `const-oid`, `cpufeatures`,
`cmov`, `ctutils`) — generic-hashing / constant-time machinery that is
irrelevant for a non-security content fingerprint. This replaces them
with the single **zero-dependency** `hmac-sha256` crate: a net reduction
of **10 crates**.
HMAC-SHA256 is a standardized deterministic algorithm, so the emitted
hash is unchanged. A new unit test
`source_file_hash_matches_node_create_hmac` pins the result against
Node's `createHmac('sha256', code).digest('hex')` for several inputs.
### Other bumps
- `napi` / `napi-derive` 2 → 3
- `similar` 2 → 3 (dev-dependency)
- Drop the unused `react_compiler_lowering` dependency from
`react_compiler_ssa`
`cargo check --workspace --all-targets` passes, including the napi 3
native crate.
DiffTrain build for [560db51](react@560db51)
github-actionsBot pushed a commit to srpatcha/react that referenced this pull request Jun 18, 2026
)
## Summary
Dependency maintenance for the Rust compiler crates.
### Fast Refresh hash: sha2 + hmac → hmac-sha256
The Fast Refresh source hash (`enableResetCacheOnSourceFileChanges`)
only needs an HMAC-SHA256 of the source text, matching the TS compiler's
`createHmac('sha256', code).digest('hex')`. RustCrypto's `sha2` + `hmac`
pulled in **11 crates** (`sha2`, `hmac`, `digest`, `block-buffer`,
`typenum`, `crypto-common`, `hybrid-array`, `const-oid`, `cpufeatures`,
`cmov`, `ctutils`) — generic-hashing / constant-time machinery that is
irrelevant for a non-security content fingerprint. This replaces them
with the single **zero-dependency** `hmac-sha256` crate: a net reduction
of **10 crates**.
HMAC-SHA256 is a standardized deterministic algorithm, so the emitted
hash is unchanged. A new unit test
`source_file_hash_matches_node_create_hmac` pins the result against
Node's `createHmac('sha256', code).digest('hex')` for several inputs.
### Other bumps
- `napi` / `napi-derive` 2 → 3
- `similar` 2 → 3 (dev-dependency)
- Drop the unused `react_compiler_lowering` dependency from
`react_compiler_ssa`
`cargo check --workspace --all-targets` passes, including the napi 3
native crate.
DiffTrain build for [560db51](react@560db51)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jun 21, 2026
)
## Summary
Dependency maintenance for the Rust compiler crates.
### Fast Refresh hash: sha2 + hmac → hmac-sha256
The Fast Refresh source hash (`enableResetCacheOnSourceFileChanges`)
only needs an HMAC-SHA256 of the source text, matching the TS compiler's
`createHmac('sha256', code).digest('hex')`. RustCrypto's `sha2` + `hmac`
pulled in **11 crates** (`sha2`, `hmac`, `digest`, `block-buffer`,
`typenum`, `crypto-common`, `hybrid-array`, `const-oid`, `cpufeatures`,
`cmov`, `ctutils`) — generic-hashing / constant-time machinery that is
irrelevant for a non-security content fingerprint. This replaces them
with the single **zero-dependency** `hmac-sha256` crate: a net reduction
of **10 crates**.
HMAC-SHA256 is a standardized deterministic algorithm, so the emitted
hash is unchanged. A new unit test
`source_file_hash_matches_node_create_hmac` pins the result against
Node's `createHmac('sha256', code).digest('hex')` for several inputs.
### Other bumps
- `napi` / `napi-derive` 2 → 3
- `similar` 2 → 3 (dev-dependency)
- Drop the unused `react_compiler_lowering` dependency from
`react_compiler_ssa`
`cargo check --workspace --all-targets` passes, including the napi 3
native crate.
DiffTrain build for [560db51](react@560db51)
github-actionsBot pushed a commit to code/lib-react that referenced this pull request Jun 21, 2026
)
## Summary
Dependency maintenance for the Rust compiler crates.
### Fast Refresh hash: sha2 + hmac → hmac-sha256
The Fast Refresh source hash (`enableResetCacheOnSourceFileChanges`)
only needs an HMAC-SHA256 of the source text, matching the TS compiler's
`createHmac('sha256', code).digest('hex')`. RustCrypto's `sha2` + `hmac`
pulled in **11 crates** (`sha2`, `hmac`, `digest`, `block-buffer`,
`typenum`, `crypto-common`, `hybrid-array`, `const-oid`, `cpufeatures`,
`cmov`, `ctutils`) — generic-hashing / constant-time machinery that is
irrelevant for a non-security content fingerprint. This replaces them
with the single **zero-dependency** `hmac-sha256` crate: a net reduction
of **10 crates**.
HMAC-SHA256 is a standardized deterministic algorithm, so the emitted
hash is unchanged. A new unit test
`source_file_hash_matches_node_create_hmac` pins the result against
Node's `createHmac('sha256', code).digest('hex')` for several inputs.
### Other bumps
- `napi` / `napi-derive` 2 → 3
- `similar` 2 → 3 (dev-dependency)
- Drop the unused `react_compiler_lowering` dependency from
`react_compiler_ssa`
`cargo check --workspace --all-targets` passes, including the napi 3
native crate.
DiffTrain build for [560db51](react@560db51)
Sign up for freeto 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

@Boshen@poteto