Skip to content
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

feat: update dependencies #536

Merged
merged 1 commit into from
Dec 27, 2024
Merged

feat: update dependencies #536

merged 1 commit into from
Dec 27, 2024

Conversation

dreamhunter2333
Copy link
Owner

@dreamhunter2333 dreamhunter2333 commented Dec 27, 2024

PR Type

enhancement, dependencies


Description

  • Added headers field to the parsedEmail object in common.ts.
  • Introduced MessageHeader struct and included headers in MessageResult struct in lib.rs.
  • Updated parse_message function to populate headers in lib.rs.
  • Updated multiple dependencies to their latest versions in pnpm-lock.yaml.
  • Updated frontend dependencies and added workbox-build in package.json.
  • Bumped version of mail-parser-wasm from 0.1.8 to 0.2.0.

Changes walkthrough 📝

Relevant files
Enhancement
2 files
common.ts
Add headers field to parsedEmail object                                   

worker/src/common.ts

  • Added headers field to the commented out parsedEmail object.
+1/-0     
lib.rs
Add headers to MessageResult struct and parse_message function

mail-parser-wasm/src/lib.rs

  • Added MessageHeader struct with key and value fields.
  • Included headers field in MessageResult struct.
  • Implemented getter methods for headers in MessageResult.
  • Updated parse_message function to populate headers.
  • +35/-0   
    Dependencies
    3 files
    pnpm-lock.yaml
    Update dependencies to latest versions                                     

    worker/pnpm-lock.yaml

  • Updated multiple dependencies to their latest versions.
  • Removed deprecated and unsupported dependencies.
  • +341/-440
    package.json
    Update frontend dependencies and add workbox-build             

    frontend/package.json

  • Updated several dependencies to their latest versions.
  • Added workbox-build as a new dependency.
  • +10/-9   
    package.json
    Bump version to 0.2.0                                                                       

    mail-parser-wasm/worker/package.json

    • Bumped version from 0.1.8 to 0.2.0.
    +1/-1     
    Additional files (token-limit)
    5 files
    pnpm-lock.yaml
    ...                                                                                                           

    frontend/pnpm-lock.yaml

    ...

    +460/-442
    pnpm-lock.yaml
    ...                                                                                                           

    vitepress-docs/pnpm-lock.yaml

    ...

    +13/-12 
    package.json
    ...                                                                                                           

    worker/package.json

    ...

    +5/-5     
    Cargo.toml
    ...                                                                                                           

    mail-parser-wasm/Cargo.toml

    ...

    +3/-3     
    mail_parser_wasm_worker.md
    ...                                                                                                           

    vitepress-docs/docs/zh/guide/feature/mail_parser_wasm_worker.md

    ...

    +1/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Possible Issue

    Ensure that the value field in MessageHeader handles non-text header values correctly. The current implementation uses header.value().as_text().unwrap_or(""), which may not handle all possible header value types.

    headers: message
        .headers()
        .iter()
        .map(|header| MessageHeader {
            key: header.name().to_owned(),
            value: header.value().as_text().unwrap_or("").to_owned(),
        })
        .collect(),

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Safely handle cases where the header value is not text to avoid potential issues

    Ensure that the header.value().as_text() method safely handles cases where the value
    is not text, as unwrap_or("") might hide potential issues.

    mail-parser-wasm/src/lib.rs [181]

    -value: header.value().as_text().unwrap_or("").to_owned(),
    +value: header.value().as_text().unwrap_or_else(|| "".to_owned()),
    Suggestion importance[1-10]: 7

    Why: The suggestion improves the safety of the code by using unwrap_or_else instead of unwrap_or, which can prevent potential issues when the header value is not text. This change enhances the robustness of the code.

    7

    @dreamhunter2333 dreamhunter2333 merged commit 43e5bdc into main Dec 27, 2024
    1 check passed
    @dreamhunter2333 dreamhunter2333 deleted the feature/dev branch December 27, 2024 16:32
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant