Skip to content

feat: add module and chunk graph visualization to REPL#38

Merged
sapphi-red merged 10 commits intomainfrom
copilot/add-visualization-panel
Feb 17, 2026
Merged

feat: add module and chunk graph visualization to REPL#38
sapphi-red merged 10 commits intomainfrom
copilot/add-visualization-panel

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Adds Mermaid-based graph visualization to visualize module dependencies and chunk composition during bundling.

Implementation

Graph extraction via plugin

const moduleGraphPlugin = {
  name: 'collect-module-graph',
  buildEnd() {
    const moduleIds = this.getModuleIds()
    for (const id of moduleIds) {
      const info = this.getModuleInfo(id)
      moduleInfoMap.set(id, {
        importedIds: info.importedIds,
        dynamicallyImportedIds: info.dynamicallyImportedIds,
        importers: info.importers,
        dynamicImporters: info.dynamicImporters,
        isEntry: info.isEntry,
      })
    }
  }
}

Components

  • GraphContainer.vue - Renders Mermaid flowcharts with Module/Chunk tabs
  • OutputView.vue - Adds Output/Graph tab switcher
  • graph-mermaid.ts - Generates Mermaid syntax from graph data

Mermaid integration

  • Dynamic import from npm (mermaid@11.12.2) for code splitting
  • Modern node syntax: note@{ shape: notch-rect, label: "..." }
  • Line breaks via <br/> tags

Visualization features

  • Module graph: Shows import relationships with solid arrows (static) and dashed arrows (dynamic)
  • Chunk graph: Shows composition with module counts
  • Color coding: Entry modules/chunks (green), dynamic entries (orange)

Dependencies

  • Added langium@3.3.1 to trustPolicyExclude in pnpm-workspace.yaml

Screenshots

Module Graph:
Module Graph

Chunk Graph:
Chunk Graph

Original prompt

add a panel to visualize the input module graph and the output chunk graph


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Feb 5, 2026

Deploy Preview for rolldown-repl ready!

Name Link
🔨 Latest commit da3f770
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-repl/deploys/69849f3445c56e00088e4e1f
😎 Deploy Preview https://deploy-preview-38--rolldown-repl.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.

Copilot AI and others added 4 commits February 5, 2026 11:21
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
…ops usage

Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title [WIP] Add panel to visualize input module and output chunk graphs Add Mermaid-based module and chunk graph visualization Feb 5, 2026
Copilot AI requested a review from sapphi-red February 5, 2026 11:33
@sapphi-red
Copy link
Member

@copilot we should have the arrows between the input modules. static imports should be a normal arrow and dynamic imports should be a dotted arrow.

Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 5, 2026

@copilot we should have the arrows between the input modules. static imports should be a normal arrow and dynamic imports should be a dotted arrow.

Added module import relationships to the graph visualization. The implementation now uses a plugin in the buildEnd hook to collect module information via getModuleInfo(), which includes importedIds and dynamicallyImportedIds for each module.

The module graph now displays:

  • Solid arrows (-->) for static imports
  • Dashed arrows (-.->) for dynamic imports

Commit: aeb4a33

Module Graph with Import Arrows

@sapphi-red sapphi-red marked this pull request as ready for review February 5, 2026 12:24
@sapphi-red sapphi-red marked this pull request as draft February 5, 2026 12:26
…exclusion

Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title Add Mermaid-based module and chunk graph visualization Replace Mermaid CDN loading with npm package and dynamic imports Feb 5, 2026
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title Replace Mermaid CDN loading with npm package and dynamic imports Fix literal \n rendering in chunk graph node labels Feb 5, 2026
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title Fix literal \n rendering in chunk graph node labels Add notch-rect shape to Mermaid note nodes Feb 5, 2026
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title Add notch-rect shape to Mermaid note nodes Add Mermaid-based module and chunk graph visualization to REPL Feb 5, 2026
Copilot AI changed the title Add Mermaid-based module and chunk graph visualization to REPL Add module and chunk graph visualization to REPL Feb 5, 2026
@sapphi-red sapphi-red changed the title Add module and chunk graph visualization to REPL feat: add module and chunk graph visualization to REPL Feb 5, 2026
@sapphi-red sapphi-red marked this pull request as ready for review February 5, 2026 13:53
@sapphi-red sapphi-red requested a review from sxzz February 5, 2026 13:53
@sapphi-red
Copy link
Member

Merging so that I can use it

@sapphi-red sapphi-red merged commit 533061a into main Feb 17, 2026
5 checks passed
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