Skip to content

Conversation

@SoonIter
Copy link
Member

Summary

fix(fileCodeBlock): should support hmr

Related Issue

Checklist

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

Copilot AI review requested due to automatic review settings July 28, 2025 13:46
@netlify
Copy link

netlify bot commented Jul 28, 2025

Deploy Preview for rspress ready!

Name Link
🔨 Latest commit 156b1db
🔍 Latest deploy log https://app.netlify.com/projects/rspress/deploys/68877f30a751f2000887c1da
😎 Deploy Preview https://deploy-preview-2423--rspress.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: 70 (🔴 down 7 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (🟢 up 9 from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@netlify
Copy link

netlify bot commented Jul 28, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 156b1db
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/68877f305aaf0e0008b0f792
😎 Deploy Preview https://deploy-preview-2423--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link
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 adds Hot Module Replacement (HMR) support for file code blocks by enabling dependency tracking when external files are imported into markdown/MDX content. This ensures that changes to imported files trigger rebuilds during development.

  • Added addDependency parameter to the file code block processing pipeline
  • Modified the remark plugin to track file dependencies for HMR
  • Updated the MDX loader to pass the dependency tracking function through the processing chain

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/node/mdx/remarkPlugins/fileCodeBlock.ts Added dependency tracking when reading external files for code blocks
packages/core/src/node/mdx/processor.ts Updated compile function to accept and pass through addDependency parameter
packages/core/src/node/mdx/options.ts Modified createMDXOptions to accept and forward addDependency to remark plugins
packages/core/src/node/mdx/loader.ts Added addDependency from loader context to the compile options

@SoonIter SoonIter requested review from JounQin and Timeless0911 July 28, 2025 13:46
@SoonIter SoonIter enabled auto-merge (squash) July 29, 2025 03:27
@SoonIter SoonIter merged commit 2cba2f4 into main Jul 29, 2025
12 checks passed
@SoonIter SoonIter deleted the syt/file-code-block branch July 29, 2025 03:27
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.

4 participants