Skip to content

refactor: socket message types#5735

Merged
chenjiahan merged 2 commits intomainfrom
socket_message_type_0801
Aug 2, 2025
Merged

refactor: socket message types#5735
chenjiahan merged 2 commits intomainfrom
socket_message_type_0801

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

This pull request introduces type safety improvements of socket messages. The primary changes include replacing loosely typed structures with a strongly typed SocketMessage union, updating related functions to use these types, and simplifying the codebase for better maintainability.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings August 2, 2025 00:26
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 pull request enhances type safety for socket messages by replacing loosely typed structures with strongly typed union types. The refactoring improves maintainability and provides better type checking throughout the socket communication system.

  • Replaced generic SocketMessage interface with specific typed variants for different message types
  • Updated socket write functions to use proper type constraints and data validation
  • Added type assertions and improved type safety in client-side message handling

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/core/src/server/socketServer.ts Defines new strongly typed socket message variants and adds conditional hash sending
packages/core/src/server/devServer.ts Updates SockWrite type to use type constraints and adds type assertion
packages/core/src/client/hmr.ts Imports socket message types and adds type annotation for message parsing

Comment thread packages/core/src/server/devServer.ts
Comment thread packages/core/src/server/socketServer.ts
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 2, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit fe72a6a
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/688d60e884e4090008d385ad
😎 Deploy Preview https://deploy-preview-5735--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 52 (🔴 down 22 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@chenjiahan chenjiahan merged commit 5257755 into main Aug 2, 2025
11 checks passed
@chenjiahan chenjiahan deleted the socket_message_type_0801 branch August 2, 2025 01:10
@chenjiahan chenjiahan mentioned this pull request Aug 3, 2025
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.

2 participants