Skip to content

refactor: replace querystring parse with URLSearchParams#5310

Merged
chenjiahan merged 1 commit intomainfrom
qs_parse_0526
May 26, 2025
Merged

refactor: replace querystring parse with URLSearchParams#5310
chenjiahan merged 1 commit intomainfrom
qs_parse_0526

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

Rplacing the Node.js querystring module with URLSearchParams and removing the import. The performance difference should be minimal in this scenario.

querystring is more performant than but is not a standardized API. Use when performance is not critical or when compatibility with browser code is desirable. See https://nodejs.org/api/querystring.html#query-string

Checklist

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

Copilot AI review requested due to automatic review settings May 26, 2025 07:38
@netlify
Copy link
Copy Markdown

netlify Bot commented May 26, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit ceaace0
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68341a5baa4a2200084359d3
😎 Deploy Preview https://deploy-preview-5310--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: 78 (🟢 up 14 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (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.

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 PR replaces the use of Node’s querystring.parse with the standardized URLSearchParams, removing the querystring import and updating query parsing logic.

  • Removed the deprecated querystring module import
  • Swapped parse(queryStr) calls for Object.fromEntries(new URLSearchParams(queryStr))
  • Minor whitespace adjustment after dynamic import
Comments suppressed due to low confidence (1)

packages/core/src/server/socketServer.ts:120

  • Consider adding unit tests for the new URLSearchParams parsing logic, especially for edge cases like duplicate keys or query strings starting with ? to ensure behavior matches the previous implementation.
queryStr ? Object.fromEntries(new URLSearchParams(queryStr)) : {}

Comment thread packages/core/src/server/socketServer.ts
@chenjiahan chenjiahan merged commit 4490d91 into main May 26, 2025
12 checks passed
@chenjiahan chenjiahan deleted the qs_parse_0526 branch May 26, 2025 07:45
@chenjiahan chenjiahan mentioned this pull request May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants