Skip to content

Commit 0a3f986

Browse files
authored
chore: improve assets and chunk details display (#96)
1 parent 524a8d0 commit 0a3f986

5 files changed

Lines changed: 22 additions & 15 deletions

File tree

packages/devtools-vite/src/app/components/data/AssetDetails.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import type { Asset as AssetInfo } from '@rolldown/debug'
33
import type { RolldownAssetInfo, RolldownChunkInfo, SessionContext } from '~~/shared/types'
4+
import { useRoute } from '#app/composables/router'
45
import { useRpc } from '#imports'
56
import { useAsyncState } from '@vueuse/core'
67
import { computed, ref } from 'vue'
@@ -18,6 +19,7 @@ const props = withDefaults(defineProps<{
1819
})
1920
2021
const rpc = useRpc()
22+
const route = useRoute()
2123
const showSource = ref(false)
2224
const { state } = useAsyncState(
2325
async () => {
@@ -81,6 +83,7 @@ function openInEditor() {
8183
<div i-ph-file-text />
8284
View source
8385
</button>
86+
<slot />
8487
</div>
8588
</div>
8689

@@ -110,14 +113,17 @@ function openInEditor() {
110113
<div op50>
111114
Chunks
112115
</div>
113-
<div v-for="chunk of assetChunks" :key="chunk.chunk_id" border="~ base rounded-lg" px2 py1>
116+
<NuxtLink
117+
v-for="chunk of assetChunks" :key="chunk.chunk_id" border="~ base rounded-lg" px2 py1
118+
:to="{ path: route.path, query: { chunk: chunk.chunk_id } }"
119+
>
114120
<DataChunkDetails
115121
:chunk="chunk"
116122
:session="session"
117123
:show-modules="false"
118124
:show-imports="false"
119125
/>
120-
</div>
126+
</NuxtLink>
121127
</div>
122128
<template v-if="_importers?.length || _imports?.length">
123129
<div flex="~ col gap-2">

packages/devtools-vite/src/app/components/data/AssetDetailsLoader.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ const { state } = useAsyncState(
5252
</script>
5353

5454
<template>
55-
<div v-if="state?.asset" p4 relative h-full w-full of-auto pt12 bg-glass z-panel-content>
56-
<DisplayCloseButton
57-
absolute right-2 top-1.5
58-
@click="emit('close')"
59-
/>
60-
<DataAssetDetails :asset="state.asset" :session="session" :chunks="state?.chunks" :importers="state?.importers" :imports="state?.imports" />
55+
<div v-if="state?.asset" p4 relative h-full w-full of-auto bg-glass z-panel-content>
56+
<DataAssetDetails :asset="state.asset" :session="session" :chunks="state?.chunks" :importers="state?.importers" :imports="state?.imports">
57+
<DisplayCloseButton
58+
@click="emit('close')"
59+
/>
60+
</DataAssetDetails>
6161
</div>
6262
</template>

packages/devtools-vite/src/app/components/data/ChunkDetails.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ withDefaults(defineProps<{
3333
<div i-ph-package-duotone />
3434
{{ chunk.modules.length }}
3535
</div>
36+
<slot />
3637
</div>
3738

3839
<template v-if="showImports && chunk.imports.length > 0">

packages/devtools-vite/src/app/components/data/ChunkDetailsLoader.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ const { state, isLoading } = useAsyncState(
2727
<template>
2828
<VisualLoading v-if="isLoading" />
2929

30-
<div v-if="state" p4 pt-12 relative h-full w-full of-auto z-panel-content>
31-
<DisplayCloseButton
32-
absolute right-2 top-1.5
33-
@click="emit('close')"
34-
/>
35-
<DataChunkDetails :session="session" :chunk="state" />
30+
<div v-if="state" p4 relative h-full w-full of-auto z-panel-content>
31+
<DataChunkDetails :session="session" :chunk="state">
32+
<DisplayCloseButton
33+
@click="emit('close')"
34+
/>
35+
</DataChunkDetails>
3636
</div>
3737
</template>

packages/devtools-vite/src/app/components/display/ModuleId.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const containerClass = computed(() => {
4949
<template>
5050
<component
5151
:is="link ? NuxtLink : 'div'"
52-
:to="link ? (typeof link === 'string' ? link : { path: route.path, query: { ...route.query, module: id }, hash: location.hash }) : undefined"
52+
:to="link ? (typeof link === 'string' ? link : { path: route.path, query: { ...route.query, module: id, chunk: undefined }, hash: location.hash }) : undefined"
5353
>
5454
<Tooltip
5555
my-auto text-sm font-mono block w-full

0 commit comments

Comments
 (0)