Skip to content

Commit deb3d5b

Browse files
committed
feat: support imports meta
1 parent 602a94a commit deb3d5b

10 files changed

Lines changed: 1011 additions & 1097 deletions

File tree

packages/devtools/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"url": "git+https://github.com/vitejs/vite-devtools.git"
1212
},
1313
"bugs": "https://github.com/vitejs/vite-devtools/issues",
14-
"keywords": [],
14+
"keywords": [
15+
"vite",
16+
"devtools"
17+
],
1518
"sideEffects": false,
1619
"exports": {
1720
".": "./dist/index.mjs"

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import type { ModuleImport } from '@rolldown/debug'
23
import type { SessionContext } from '../../types/data'
34
import { NuxtLink } from '#components'
45
import { Tooltip } from 'floating-vue'
@@ -12,6 +13,7 @@ const props = withDefaults(
1213
icon?: boolean
1314
link?: boolean
1415
minimal?: boolean
16+
kind?: ModuleImport['kind']
1517
session: SessionContext
1618
}>(),
1719
{
@@ -59,6 +61,11 @@ const containerClass = computed(() => {
5961
<DisplayHighlightedPath :path="relativePath" :minimal="minimal" />
6062
</span>
6163
<slot />
64+
<DisplayBadge
65+
v-if="kind"
66+
class="ml1"
67+
:text="kind"
68+
/>
6269
<!-- <DisplayBadge
6370
v-if="isVirtual"
6471
class="ml1"

packages/devtools/src/app/components/flowmap/ModuleFlow.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ const codeDisplay = computed(() => {
167167
<div p2 flex="~ col gap-1">
168168
<DisplayModuleId
169169
v-for="imp of info.imports"
170-
:id="imp"
171-
:key="imp"
170+
:id="imp.id"
171+
:key="imp.id"
172+
:kind="imp.kind"
172173
:session="session"
173174
:link="true"
174175
class="hover:bg-active"

packages/devtools/src/app/components/flowmap/NodeModuleInfo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
2-
import type { SessionContext } from '@/types/data'
32
import type { RolldownModuleFlowNode } from '../../../node/rpc/functions/rolldown-get-module-info'
3+
import type { SessionContext } from '@/types/data'
44
import { computed } from 'vue'
55
import { isFlowmapSwapping } from '../../state/flowmap'
66

packages/devtools/src/app/types/data.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import type { ModuleImport } from '@rolldown/debug'
2+
13
export interface ModuleListItem {
24
id: string
35
fileType: string
4-
imports: string[]
6+
imports: ModuleImport[]
57
importers: string[]
68
}
79

packages/devtools/src/node/rolldown/events-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class RolldownEventsManager {
3030
for (const module of event.modules) {
3131
this.modules.set(module.id, module)
3232
module.importers = Array.from(new Set(module.importers || [])).sort((a, b) => a.localeCompare(b))
33-
module.imports = Array.from(new Set(module.imports || [])).sort((a, b) => a.localeCompare(b))
33+
module.imports = Array.from(new Set(module.imports || [])).sort((a, b) => a.id.localeCompare(b.id))
3434
}
3535
}
3636

packages/devtools/src/node/rpc/functions/rolldown-get-module-info.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { HookResolveIdCallStart } from '@rolldown/debug'
1+
import type { HookResolveIdCallStart, ModuleImport } from '@rolldown/debug'
22
import { diffLines } from 'diff'
33
import { join } from 'pathe'
44
import { RolldownEventsReader } from '../../rolldown/events-reader'
@@ -9,7 +9,7 @@ export interface ModuleInfo {
99
loads: RolldownModuleLoadInfo[]
1010
transforms: RolldownModuleTransformInfo[]
1111
resolve_ids: RolldownResolveInfo[]
12-
imports: string[] | null
12+
imports: ModuleImport[] | null
1313
importers: string[] | null
1414
}
1515

packages/devtools/src/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const NUXT_DEBUG_BUILD = !!process.env.NUXT_DEBUG_BUILD
55
const backend = process.env.NMI_BACKEND ?? 'dev'
66
const isWebContainer = backend === 'webcontainer'
77

8-
const headers = isWebContainer
8+
const headers: Record<string, string> = isWebContainer
99
? {
1010
'Cross-Origin-Embedder-Policy': 'require-corp',
1111
'Cross-Origin-Opener-Policy': 'same-origin',

0 commit comments

Comments
 (0)