Skip to content

What feature does plugins framegraph want #33

@CrabSAMA

Description

@CrabSAMA

I saw TODO in this file:

<!--
TODO: plugins framegraph
Two different views direction:
- plugins -> hooks -> modules
- modules -> hooks -> plugins
-->

And I saw this module flamegraph in module page:

Image

this graph show the module was handled by what hooks and plugins.

I guess the plugins framegraph should be presented from different perspectives, but I did not know what feature need in the plugins framegraph, anyone can give me some opinion?

IMO, if I am user, I want to see what plugin used in bundling, and each plugin uses which hooks, how much time is spent on each hook, and which files are processed.

I try to add a rpc function to group plugin details by plugin name

import { defineRpcFunction } from '../utils'

export const rolldownGetPluginDetails = defineRpcFunction({
  name: 'vite:rolldown:get-plugin-details',
  type: 'query',
  setup: ({ manager }) => {
    return {
      handler: async ({ session }: { session: string }) => {
        const reader = await manager.loadSession(session)
        const plugins = reader.meta?.plugins || []
        const events = reader.manager.events
        const map = new Map<string, any[]>()
        plugins.forEach(plugin => {
          map.set(plugin.name, [])
        })
        for (const event of events) {
          if (map.has(event.plugin_name)) {
            map.get(event.plugin_name)!.push(event)
          }
        }
        return map
      },
    }
  },
})
Image

and so on I can do some thing next on this map, if some thiing I can do, I will try to contribute in this project. Please let me know what feature does plugins framegraph want and what will do at the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions