Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new cname-prefix package and aligns testing dependencies across the monorepo.
- Bumps Vitest and coverage tooling in
image-shrink - Adds
packages/cname-prefixwith its source code, tests, build/config files, and documentation - Updates root
package.jsonand CI workflow to include the new package
Reviewed Changes
Copilot reviewed 20 out of 27 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/image-shrink/package.json | Upgraded Vitest from v1 to v3 and replaced coverage-istanbul |
| packages/cname-prefix/… | All new config, source, tests, and build files for package |
| package.json | Included packages/cname-prefix in the workspace |
| .github/workflows/checks.yml | Added cname-prefix paths to the CI job triggers |
Comments suppressed due to low confidence (1)
packages/cname-prefix/README.md:39
- Since
getCnamePrefixis async, the usage example shouldawaitthe call (const prefix = await getCnamePrefix(...)) or handle the returned Promise to avoid confusion.
const prefix = getCnamePrefix('demopublickey')
packages/cname-prefix/src/version.ts
Outdated
| @@ -0,0 +1 @@ | |||
| export default '6.2.1' | |||
There was a problem hiding this comment.
The version in version.ts ('6.2.1') does not match the package.json version ('6.14.3'), leading to inconsistent versioning. Please synchronize them.
Suggested change
| export default '6.2.1' | |
| export default '6.14.3' |
Comment on lines
+1
to
+8
| export const sha256Encode = async (data: string): Promise<number> => { | ||
| const msgUint8 = new TextEncoder().encode(data) | ||
| const hashBuffer = await window.crypto.subtle.digest('SHA-256', msgUint8) | ||
| const hashArray = Array.from(new Uint8Array(hashBuffer)) | ||
| const hashHexStr = hashArray | ||
| .map((b) => b.toString(16).padStart(2, '0')) | ||
| .join('') | ||
| const hashHexInt = parseInt(hashHexStr, 16) |
There was a problem hiding this comment.
Using parseInt on a full 256-bit hex string will exceed JavaScript's Number safe range, causing precision loss. Consider using BigInt('0x' + hashHexStr) or returning the hex string directly to preserve the full value.
Suggested change
| export const sha256Encode = async (data: string): Promise<number> => { | |
| const msgUint8 = new TextEncoder().encode(data) | |
| const hashBuffer = await window.crypto.subtle.digest('SHA-256', msgUint8) | |
| const hashArray = Array.from(new Uint8Array(hashBuffer)) | |
| const hashHexStr = hashArray | |
| .map((b) => b.toString(16).padStart(2, '0')) | |
| .join('') | |
| const hashHexInt = parseInt(hashHexStr, 16) | |
| export const sha256Encode = async (data: string): Promise<bigint> => { | |
| const msgUint8 = new TextEncoder().encode(data) | |
| const hashBuffer = await window.crypto.subtle.digest('SHA-256', msgUint8) | |
| const hashArray = Array.from(new Uint8Array(hashBuffer)) | |
| const hashHexStr = hashArray | |
| .map((b) => b.toString(16).padStart(2, '0')) | |
| .join('') | |
| const hashHexInt = BigInt('0x' + hashHexStr) |
egordidenko
approved these changes
Jun 19, 2025
e8c18da to
fe69159
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist