From 89631410a99dc8f7bd3882f55edf5befc9c7586a Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 27 Sep 2023 10:54:05 +0800 Subject: [PATCH 1/2] feat(server-routes): send from app instead of devtools, close #253 --- .../devtools-kit/src/_types/client-api.ts | 2 + packages/devtools-kit/src/_types/options.ts | 1 + .../src/components/NSelect.vue | 5 +- .../client/components/ServerRouteDetails.vue | 72 ++++++++++++++----- packages/devtools/src/constant.ts | 1 + .../src/runtime/plugins/view/client.ts | 2 + 6 files changed, 62 insertions(+), 21 deletions(-) diff --git a/packages/devtools-kit/src/_types/client-api.ts b/packages/devtools-kit/src/_types/client-api.ts index 9dab59f546..f1e0a5d539 100644 --- a/packages/devtools-kit/src/_types/client-api.ts +++ b/packages/devtools-kit/src/_types/client-api.ts @@ -5,6 +5,7 @@ import type { NuxtApp } from 'nuxt/dist/app/nuxt' import type { Hookable } from 'hookable' import type { BirpcReturn } from 'birpc' import type { BuiltinLanguage } from 'shikiji' +import type { $Fetch } from 'ofetch' import type { ServerFunctions } from './rpc' import type { HookInfo, LoadingTimeMetric, PluginMetric, VueInspectorClient, VueInspectorData } from './integrations' import type { TimelineMetrics } from './timeline-metrics' @@ -94,6 +95,7 @@ export interface NuxtDevtoolsHostClient { appConfig: AppConfig colorMode: Ref<'dark' | 'light'> frameState: Ref + $fetch: $Fetch } metrics: { diff --git a/packages/devtools-kit/src/_types/options.ts b/packages/devtools-kit/src/_types/options.ts index 1cb8089b9f..376aa65c23 100644 --- a/packages/devtools-kit/src/_types/options.ts +++ b/packages/devtools-kit/src/_types/options.ts @@ -170,6 +170,7 @@ export interface NuxtDevToolsOptions { selectedRoute: ServerRouteInfo | null view: 'tree' | 'list' inputDefaults: Record + sendFrom: 'app' | 'devtools' } assets: { view: 'grid' | 'list' diff --git a/packages/devtools-ui-kit/src/components/NSelect.vue b/packages/devtools-ui-kit/src/components/NSelect.vue index f44fefe8ba..c4bfd69042 100644 --- a/packages/devtools-ui-kit/src/components/NSelect.vue +++ b/packages/devtools-ui-kit/src/components/NSelect.vue @@ -21,12 +21,13 @@ const input = useVModel(props, 'modelValue', emit, { passive: true })