11<script setup lang="ts">
2- import type { RolldownModuleTransformInfo } from ' @@ /node/rpc/functions/rolldown-get-module-info'
2+ import type { RolldownModuleLoadInfo , RolldownModuleTransformInfo , RolldownResolveInfo } from ' ../../../.. /node/rpc/functions/rolldown-get-module-info'
33import { useRoute } from ' #app/composables/router'
44import PluginName from ' @/components/display/PluginName.vue'
55import { useAsyncState } from ' @vueuse/core'
@@ -11,7 +11,12 @@ const params = useRoute().params as {
1111}
1212const query = useRoute ().query
1313
14- const selected = ref <RolldownModuleTransformInfo | null >(null )
14+ const selected = ref <{
15+ type: ' load' | ' transform'
16+ plugin_name: string
17+ from: string | null
18+ to: string | null
19+ } | null >()
1520
1621const { state : info } = useAsyncState (
1722 async () => {
@@ -23,8 +28,26 @@ const { state: info } = useAsyncState(
2328 null ,
2429)
2530
26- function select(transform : RolldownModuleTransformInfo ) {
27- selected .value = transform
31+ function select(transform : RolldownModuleTransformInfo | RolldownModuleLoadInfo | RolldownResolveInfo ) {
32+ if (' source_from' in transform ) {
33+ selected .value = {
34+ type: ' transform' ,
35+ plugin_name: transform .plugin_name ,
36+ from: transform .source_from ,
37+ to: transform .source_to ,
38+ }
39+ }
40+ else if (' source' in transform ) {
41+ selected .value = {
42+ type: ' load' ,
43+ plugin_name: transform .plugin_name ,
44+ from: transform .source ,
45+ to: transform .source ,
46+ }
47+ }
48+ else {
49+ selected .value = null
50+ }
2851}
2952 </script >
3053
@@ -44,6 +67,52 @@ function select(transform: RolldownModuleTransformInfo) {
4467 </template >
4568 </FlowmapNode >
4669
70+ <FlowmapNode
71+ :lines =" { top: true , bottom: info .resolve_ids .length === 0 } " pl6 py2
72+ :class-node-outer =" info .resolve_ids .length === 0 ? ' border-dashed' : ' ' "
73+ >
74+ <template #content >
75+ <div i-ph-magnifying-glass-duotone /> Resolve Id
76+ <span op50 text-xs >({{ info.resolve_ids.length }})</span >
77+ </template >
78+ <template v-if =" info .resolve_ids .length > 0 " #inline-before >
79+ <button w-6 h-6 mr1 ml--7 mya rounded-full hover =" bg-active" flex =" ~ items-center justify-center" >
80+ <div i-ph-caret-down text-sm op50 />
81+ </button >
82+ </template >
83+ <template v-if =" info .resolve_ids .length > 0 " #inline-after >
84+ <div w-8 relative >
85+ <div absolute top =" 1/2" left-0 bottom--4 right =" 1/2" border =" t r base rounded-rt-2xl" z-flowmap-line />
86+ </div >
87+ </template >
88+ <template #after >
89+ <div pl-12 pt2 >
90+ <template v-for =" (resolve_id , idx ) of info .resolve_ids " :key =" resolve_id .plugin_name " >
91+ <FlowmapNode
92+ :lines =" { top: idx > 0 , bottom: idx < info .resolve_ids .length - 1 } "
93+ class-node-inline="gap-2 items-center"
94+ pl6 py1
95+ >
96+ <template #inner >
97+ <button
98+ px3 py1 hover =" bg-active" flex =" ~ inline gap-2 items-center"
99+ @click =" select(resolve_id)"
100+ >
101+ <DisplayPluginName :name =" resolve_id .plugin_name " class="font-mono text-sm" />
102+ </button >
103+ </template >
104+ <template #inline-after >
105+ <DisplayDuration :duration =" resolve_id .duration " :color =" true " :factor =" 5 " text-xs />
106+ <!-- <div v-if="resolve_id.source_from === resolve_id.source_to" text-xs op50>
107+ no changes
108+ </div> -->
109+ </template >
110+ </FlowmapNode >
111+ </template >
112+ </div >
113+ </template >
114+ </FlowmapNode >
115+
47116 <FlowmapNode
48117 :lines =" { top: true , bottom: info .loads .length === 0 } " pl6 py2
49118 :class-node-outer =" info .loads .length === 0 ? ' border-dashed' : ' ' "
@@ -66,8 +135,14 @@ function select(transform: RolldownModuleTransformInfo) {
66135 <div pl-12 pt2 >
67136 <template v-for =" (load , idx ) of info .loads " :key =" load .plugin_name " >
68137 <FlowmapNode :lines =" { top: idx > 0 , bottom: idx < info .loads .length - 1 } " pl6 py1>
69- <template #content >
70- <DisplayPluginName :name =" load .plugin_name " class="font-mono text-sm" />
138+ <template #inner >
139+ <button
140+ :class =" load.source ? '' : 'op75'"
141+ px3 py1 hover =" bg-active" flex =" ~ inline gap-2 items-center"
142+ @click =" select(load)"
143+ >
144+ <DisplayPluginName :name =" load .plugin_name " class="font-mono text-sm" />
145+ </button >
71146 </template >
72147 </FlowmapNode >
73148 </template >
@@ -144,16 +219,19 @@ function select(transform: RolldownModuleTransformInfo) {
144219 <div
145220 v-if =" selected"
146221 absolute right-5 top-5 bottom-5 w-200
147- border =" ~ base rounded-lg" bg-base of-hidden
222+ border =" ~ base rounded-lg" bg-glass of-hidden
148223 grid =" ~ rows-[max-content_1fr]"
149224 >
150- <div px2 p1 font-mono border =" b base" >
225+ <div px2 p1 font-mono border =" b base" flex = " ~ items-center gap-2 " >
151226 <PluginName :name =" selected .plugin_name " />
227+ <span text-xs op50 >
228+ {{ selected.type === 'load' ? 'Load' : 'Transform' }}
229+ </span >
152230 </div >
153231 <CodeDiffEditor
154232 v-if =" selected "
155- :from =" selected .source_from ?? ' ' "
156- :to =" selected .source_to ?? ' ' "
233+ :from =" selected .from ?? ' ' "
234+ :to =" selected .to ?? ' ' "
157235 :diff =" true "
158236 :one-column =" true "
159237 />
0 commit comments