Uh oh!
There was an error while loading. Please reload this page.
[rust-compiler] Switch to hmac-sha256 and bump napi/similar - #36809
Conversation
Hi @Boshen! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
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.4c2f42d to
5f91e06CompareUh oh!
There was an error while loading. Please reload this page.
) ## 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)
) ## 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)
) ## 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)
) ## 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)
) ## 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)
) ## 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)
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'screateHmac('sha256', code).digest('hex'). RustCrypto'ssha2+hmacpulled 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-sha256crate: 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_hmacpins the result against Node'screateHmac('sha256', code).digest('hex')for several inputs.Other bumps
napi/napi-derive2 → 3similar2 → 3 (dev-dependency)react_compiler_loweringdependency fromreact_compiler_ssacargo check --workspace --all-targetspasses, including the napi 3 native crate.