-
Notifications
You must be signed in to change notification settings - Fork 278
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
Test 1add v
itest in utils
#2848
Conversation
Caution Review failedThe pull request is closed. WalkthroughThis pull request encompasses a comprehensive refactoring of the utility packages, focusing on modularization, testing, and streamlining of various utility functions. The changes primarily involve restructuring import statements, removing deprecated logging and cryptography implementations, and introducing Vitest for testing. The modifications span across multiple packages, including utils, renderless, and vue components, with an emphasis on simplifying module exports and improving code organization. Changes
Sequence DiagramsequenceDiagram
participant Utils as Utility Package
participant Crypt as Cryptography Module
participant Log as Logging Module
participant Window as Window Context
Utils->>Crypt: Refactor SHA-256 implementation
Crypt->>Window: Use native crypto.subtle
Utils->>Log: Create new logging utility
Log->>Window: Access console via getWindow()
Utils->>Utils: Simplify module exports
Utils->>Utils: Remove deprecated implementations
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (20)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
WalkthroughThis pull request primarily focuses on refactoring and updating the utility functions within the Changes
🪧 TipsFor further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me. |
const msgUint8 = isArrayBuffer ? message : new TextEncoder().encode(message) // 编码为(utf-8)Uint8Array | ||
const hashBuffer = await window.crypto.subtle.digest(algo, msgUint8) // 计算消息的哈希值 | ||
const msgUint8 = isArrayBuffer ? message : new TextEncoder().encode(message as string) // 编码为(utf-8)Uint8Array | ||
const hashBuffer = await getWindow().crypto.subtle.digest('SHA-256', msgUint8) // 计算消息的哈希值 |
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 use of getWindow().crypto.subtle.digest
assumes that the crypto
API is available in the environment. Ensure that there is a fallback or error handling for environments where this API is not supported, as it may lead to runtime errors.
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Release Notes
New Features
Documentation
Refactors
Tests