Skip to content

refactor: use helper for async file reading#6885

Merged
chenjiahan merged 3 commits intomainfrom
promisify_0103
Jan 4, 2026
Merged

refactor: use helper for async file reading#6885
chenjiahan merged 3 commits intomainfrom
promisify_0103

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

Added a new readFileAsync function to standardize async file reading using Rspack's filesystem, replacing the use of promisify.

Checklist

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

Copilot AI review requested due to automatic review settings January 3, 2026 01:34
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 3, 2026

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 8800728
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6959cc31b8751f000837a249
😎 Deploy Preview https://deploy-preview-6885--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: 62 (🟢 up 9 from production)
Accessibility: 100 (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.

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 refactors async file reading to use a new readFileAsync helper function that standardizes filesystem operations using Rspack's filesystem APIs, replacing the use of Node's promisify utility.

Key changes:

  • Introduces a new readFileAsync helper function in packages/core/src/helpers/fs.ts
  • Replaces promisify(fs.readFile) calls with the new helper across multiple files
  • Also refactors zlib.gzip to use manual Promise wrapping instead of promisify

Reviewed changes

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

Show a summary per file
File Description
packages/core/src/helpers/fs.ts Adds new readFileAsync helper function that wraps Rspack filesystem's readFile in a Promise
packages/core/src/server/browserLogs.ts Replaces promisify(fs.readFile) with readFileAsync for reading source maps
packages/core/src/rspack-plugins/RsbuildHtmlPlugin.ts Replaces promisify(compilation.inputFileSystem.readFile) with readFileAsync for reading favicon files
packages/core/src/plugins/appIcon.ts Replaces promisify(compilation.inputFileSystem.readFile) with readFileAsync for reading icon files
packages/core/src/plugins/fileSize.ts Replaces promisify(zlib.gzip) with manual Promise wrapper for gzip compression

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenjiahan chenjiahan merged commit bd0dacc into main Jan 4, 2026
10 checks passed
@chenjiahan chenjiahan deleted the promisify_0103 branch January 4, 2026 02:24
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