From 5012012cb28c4b5d246ea7fc9b863db34fb3f7e7 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 10 Aug 2023 15:31:37 +0200 Subject: [PATCH] feat: filter for used/unused components, close #358 --- .../devtools-kit/src/_types/integrations.ts | 7 ++ .../src/components/NSelectTabs.vue | 2 +- .../client/components/ComponentItem.vue | 20 ++--- .../client/components/ComponentsList.vue | 74 ++++++++++++------- packages/devtools/client/composables/utils.ts | 20 ++++- .../devtools/client/pages/modules/imports.vue | 25 +++++-- 6 files changed, 97 insertions(+), 51 deletions(-) diff --git a/packages/devtools-kit/src/_types/integrations.ts b/packages/devtools-kit/src/_types/integrations.ts index 55cb4f19e..e446d60fc 100644 --- a/packages/devtools-kit/src/_types/integrations.ts +++ b/packages/devtools-kit/src/_types/integrations.ts @@ -1,5 +1,6 @@ import type { RouteRecordNormalized } from 'vue-router' import type { Import, UnimportMeta } from 'unimport' +import type { Component } from 'nuxt/schema' export interface HookInfo { name: string @@ -195,3 +196,9 @@ export interface ComponentRelationship { id: string deps: string[] } + +export interface ComponentWithRelationships { + component: Component + dependencies?: string[] + dependents?: string[] +} diff --git a/packages/devtools-ui-kit/src/components/NSelectTabs.vue b/packages/devtools-ui-kit/src/components/NSelectTabs.vue index d079510e3..c0ffaf44f 100644 --- a/packages/devtools-ui-kit/src/components/NSelectTabs.vue +++ b/packages/devtools-ui-kit/src/components/NSelectTabs.vue @@ -18,7 +18,7 @@ const input = useVModel(props, 'modelValue', emit, { passive: true })