Commit 550d591
authored
fix(pnpm): Parse integrity hash from package.json packageManager if provided (#2596)
When specifying `pnpm_version` and `pnpm_version_integrity` directly in
MODULE.bazel, both version and integrity were used correctly. However,
when using `pnpm_version_from` to read from package.json's
`packageManager` field, the integrity hash was being discarded.
The `packageManager` field is the standard way to pin package manager
versions in the Node.js ecosystem. This fix ensures that projects using
the standard `packageManager` format can use the same package.json with
both local Node.js tooling and Bazel tooling.
Changes:
- Modified the `packageManager` parsing logic to extract and store the
integrity hash when present. The hash format is converted from
+sha512.xxx (npm/corepack format) to sha512-xxx
- Updated `from_package_json_with_hash_test` to verify hash extraction,
as `from_package_json_simple_test` covers the case without it1 parent 1481d42 commit 550d591
2 files changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | | - | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
0 commit comments