-
Notifications
You must be signed in to change notification settings - Fork 14
feat: add cname-prefix package
#534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 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' | |||
Copilot
AI
Jun 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| export default '6.2.1' | |
| export default '6.14.3' |
| 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) |
Copilot
AI
Jun 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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) |
e8c18da to
fe69159
Compare
Description
Checklist