Skip to content

Commit 4c54247

Browse files
danielroeantfu
andauthored
fix: use explicit imports of types (#715)
Co-authored-by: Anthony Fu <github@antfu.me>
1 parent 07a213b commit 4c54247

File tree

19 files changed

+792
-680
lines changed

19 files changed

+792
-680
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@nuxt/devtools": "^1.4.1",
1515
"@nuxt/fonts": "^0.7.2",
1616
"@nuxt/image": "1.8.0",
17-
"@nuxt/ui-pro": "^1.4.1",
17+
"@nuxt/ui-pro": "^1.4.2",
1818
"@nuxthq/studio": "^2.0.3",
1919
"@nuxtjs/plausible": "^1.0.2",
2020
"@vueuse/core": "^11.0.3",

docs/pnpm-lock.yaml

Lines changed: 562 additions & 359 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/devtools-kit/src/runtime/host-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { shallowRef } from 'vue'
2+
import type { NuxtDevtoolsHostClient } from '@nuxt/devtools-kit/types'
23
import type { Ref } from 'vue'
3-
import type { NuxtDevtoolsHostClient } from '../types'
44

55
let clientRef: Ref<NuxtDevtoolsHostClient | undefined> | undefined
66
const fns = [] as ((client: NuxtDevtoolsHostClient) => void)[]

packages/devtools-kit/src/runtime/iframe-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { shallowRef, triggerRef } from 'vue'
2+
import type { NuxtDevtoolsIframeClient } from '@nuxt/devtools-kit/types'
23
import type { Ref } from 'vue'
3-
import type { NuxtDevtoolsIframeClient } from '../types'
44

55
let clientRef: Ref<NuxtDevtoolsIframeClient | undefined> | undefined
66
const hasSetup = false

packages/devtools/client/pages/modules/virtual-files.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ function toShortPath(path: string) {
4040
const files = computed(() => {
4141
if (!data.value)
4242
return []
43-
return data
44-
.value
43+
return data.value
4544
.entries
46-
// Hide Nuxt dist files, as they are aliased as `#build`
4745
.filter(i => !i.id.startsWith(`${data.value?.rootDir || ''}/.nuxt/`))
4846
.sort((a, b) => a.id.localeCompare(b.id))
4947
})

packages/devtools/src/integrations/plugin-metrics.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,12 @@ function ${WRAPPER_KEY} (plugin, src) {
5757
.map(([, name, path]) => ({ name, path }))
5858

5959
content = content.replace(/\nexport default\s*\[([\s\S]*)\]/, (_, itemsRaw: string) => {
60-
const items = itemsRaw
61-
.split(',')
62-
.map(i => i.trim())
63-
.map((i) => {
64-
const importItem = imports.find(({ name }) => name === i)
65-
if (!importItem)
66-
return i
67-
return `${WRAPPER_KEY}(${i}, ${JSON.stringify(importItem.path)})`
68-
})
60+
const items = itemsRaw.split(',').map(i => i.trim()).map((i) => {
61+
const importItem = imports.find(({ name }) => name === i)
62+
if (!importItem)
63+
return i
64+
return `${WRAPPER_KEY}(${i}, ${JSON.stringify(importItem.path)})`
65+
})
6966
return `\n${snippets}\nexport default [\n${items.join(',\n')}\n]\n`
7067
})
7168

packages/devtools/src/runtime/function-metrics-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @unimport-disable
22
import { parse as parseStrackTrace } from 'error-stack-parser-es'
33
import { markRaw, reactive } from 'vue'
4+
import type { TimelineEventFunction, TimelineMetrics } from '@nuxt/devtools/types'
45
import { useObjectStorage } from './plugins/view/utils'
5-
import type { TimelineEventFunction, TimelineMetrics } from '../types'
66

77
const nonLiteralSymbol = Symbol('nuxt-devtools-fn-metrics-non-literal')
88

packages/devtools/src/runtime/plugins/devtools.client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { shallowReactive, watchEffect } from 'vue'
22

3+
import type { TimelineServerState } from '@nuxt/devtools/types'
34
import type { Router } from 'vue-router'
4-
import { setupHooksDebug } from '../shared/hooks'
55

6-
import type { TimelineServerState } from '../../types'
6+
import { setupHooksDebug } from '../shared/hooks'
77
// eslint-disable-next-line ts/ban-ts-comment
88
// @ts-ignore tsconfig
99
import { defineNuxtPlugin, useRouter, useState } from '#imports'

packages/devtools/src/runtime/plugins/devtools.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineNuxtPlugin, useState } from '#imports'
2-
import type { TimelineServerState } from '../../types'
2+
import type { TimelineServerState } from '@nuxt/devtools/types'
33

44
export default defineNuxtPlugin(() => {
55
// record ssr start time

packages/devtools/src/runtime/plugins/view/FrameBox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
22
import { ref, watchEffect } from 'vue'
3+
import type { NuxtDevtoolsHostClient } from '@nuxt/devtools/types'
34
import { PANEL_MAX, PANEL_MIN, popupWindow, state } from './state'
45
import { useEventListener } from './utils'
5-
import type { NuxtDevtoolsHostClient } from '../../../types'
66
77
const props = defineProps<{
88
client: NuxtDevtoolsHostClient

0 commit comments

Comments
 (0)