From a7db856806ce5f1b91ae34cde1ec8d63ca423bc2 Mon Sep 17 00:00:00 2001 From: CrabSAMA <71915282@qq.com> Date: Thu, 14 Aug 2025 14:22:53 +0800 Subject: [PATCH 1/4] feat: add plugin flamegraph --- .../app/components/chart/PluginFlamegraph.vue | 170 ++++++++++++++++++ .../components/data/PluginDetailsLoader.vue | 5 + 2 files changed, 175 insertions(+) create mode 100644 packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue diff --git a/packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue b/packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue new file mode 100644 index 00000000..5ca24db7 --- /dev/null +++ b/packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue @@ -0,0 +1,170 @@ + + + diff --git a/packages/devtools-vite/src/app/components/data/PluginDetailsLoader.vue b/packages/devtools-vite/src/app/components/data/PluginDetailsLoader.vue index f8c216f9..936395ae 100644 --- a/packages/devtools-vite/src/app/components/data/PluginDetailsLoader.vue +++ b/packages/devtools-vite/src/app/components/data/PluginDetailsLoader.vue @@ -153,6 +153,11 @@ const totalDuration = computed(() => { :session="session" :build-metrics="state" /> +
From 7a35785f8b35b60677c2788304abdf1b4831cc90 Mon Sep 17 00:00:00 2001 From: CrabSAMA <71915282@qq.com> Date: Thu, 14 Aug 2025 19:48:37 +0800 Subject: [PATCH 2/4] chore: extract `normalizeTimestamp` function to common utils --- .../src/app/components/data/PluginDetailsTable.vue | 14 +------------- packages/devtools-vite/src/app/utils/format.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/devtools-vite/src/app/components/data/PluginDetailsTable.vue b/packages/devtools-vite/src/app/components/data/PluginDetailsTable.vue index f012e73a..d961859d 100644 --- a/packages/devtools-vite/src/app/components/data/PluginDetailsTable.vue +++ b/packages/devtools-vite/src/app/components/data/PluginDetailsTable.vue @@ -6,6 +6,7 @@ import { Menu as VMenu } from 'floating-vue' import { computed, ref } from 'vue' import { settings } from '~~/app/state/settings' import { parseReadablePath } from '~/utils/filepath' +import { normalizeTimestamp } from '~/utils/format' import { getFileTypeFromModuleId, ModuleTypeRules } from '~/utils/icon' const props = defineProps<{ @@ -63,19 +64,6 @@ function toggleModuleType(rule: FilterMatchRule) { settings.value.pluginDetailsModuleTypes = filterModuleTypes.value } -function normalizeTimestamp(timestamp: number) { - return new Date(timestamp).toLocaleString(undefined, { - hour12: false, - year: 'numeric', - month: '2-digit', - day: '2-digit', - hour: '2-digit', - minute: '2-digit', - second: '2-digit', - fractionalSecondDigits: 3, - }) -} - function toggleDurationSortType() { next() settings.value.pluginDetailsDurationSortType = durationSortType.value diff --git a/packages/devtools-vite/src/app/utils/format.ts b/packages/devtools-vite/src/app/utils/format.ts index d43162c2..1e528fea 100644 --- a/packages/devtools-vite/src/app/utils/format.ts +++ b/packages/devtools-vite/src/app/utils/format.ts @@ -57,3 +57,16 @@ export function toTree(modules: ModuleDest[], name: string) { return node } + +export function normalizeTimestamp(timestamp: number) { + return new Date(timestamp).toLocaleString(undefined, { + hour12: false, + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + fractionalSecondDigits: 3, + }) +} From 0ce9328e8f8954a35e27f1451671c2edd5063ce2 Mon Sep 17 00:00:00 2001 From: CrabSAMA <71915282@qq.com> Date: Thu, 14 Aug 2025 19:58:59 +0800 Subject: [PATCH 3/4] feat: add more information in plugin flamegraph hover content --- .../app/components/chart/PluginFlamegraph.vue | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue b/packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue index 5ca24db7..b9fc09da 100644 --- a/packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue +++ b/packages/devtools-vite/src/app/components/chart/PluginFlamegraph.vue @@ -1,9 +1,10 @@