Skip to content

perf: use dynamic imports for exec and promisify#5307

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

perf: use dynamic imports for exec and promisify#5307
chenjiahan merged 1 commit intomainfrom
exec_dynamic_0526

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

This pull request refactors the openBrowser function to improve performance by deferring the loading of certain modules until they are needed.

Checklist

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

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

netlify Bot commented May 26, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 64dd366
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68340cb76a4fd10008b7e4bf
😎 Deploy Preview https://deploy-preview-5307--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: 53 (🔴 down 20 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 refactors the openBrowser function to improve performance by deferring the loading of node's child_process and util modules using dynamic imports.

  • Removed static imports for exec and promisify.
  • Moved dynamic import logic inside the if block for using AppleScript.
Comments suppressed due to low confidence (1)

packages/core/src/server/open.ts:70

  • [nitpick] The inline definition of getDefaultBrowserForAppleScript duplicates functionality that was previously defined at file scope. Consider centralizing this logic to reduce redundancy.
/**
     * Find the browser that is currently running
     */

Comment thread packages/core/src/server/open.ts
@chenjiahan chenjiahan merged commit 48bbd35 into main May 26, 2025
12 checks passed
@chenjiahan chenjiahan deleted the exec_dynamic_0526 branch May 26, 2025 06:51
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants