diff --git a/package.json b/package.json index 7ed4a50cab..ba123b2da9 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,9 @@ "vite-hot-client": "^0.2.2", "vue-tsc": "^1.8.13" }, + "resolutions": { + "@nuxt/telemetry": "^2.5.0" + }, "simple-git-hooks": { "pre-commit": "pnpm lint-staged" }, diff --git a/packages/devtools-kit/src/_types/options.ts b/packages/devtools-kit/src/_types/options.ts index cadf844a23..1cb8089b9f 100644 --- a/packages/devtools-kit/src/_types/options.ts +++ b/packages/devtools-kit/src/_types/options.ts @@ -82,6 +82,13 @@ export interface ModuleOptions { exclude?: (string | RegExp | ((item: Import) => boolean))[] } } + + /** + * Enable anonymous telemetry, helping us improve Nuxt DevTools. + * + * By default it will respect global Nuxt telemetry settings. + */ + telemetry?: boolean } export interface ModuleGlobalOptions { @@ -138,21 +145,24 @@ export interface VSCodeTunnelOptions { } export interface NuxtDevToolsOptions { + behavior: { + telemetry: boolean | null + } ui: { - componentsView: 'list' | 'graph' - componentsGraphShowNodeModules: boolean componentsGraphShowGlobalComponents: boolean - componentsGraphShowPages: boolean componentsGraphShowLayouts: boolean + componentsGraphShowNodeModules: boolean + componentsGraphShowPages: boolean componentsGraphShowWorkspace: boolean + componentsView: 'list' | 'graph' + hiddenTabCategories: string[] + hiddenTabs: string[] interactionCloseOnOutsideClick: boolean + minimizePanelInactive: number + pinnedTabs: string[] + scale: number showExperimentalFeatures: boolean showHelpButtons: boolean - scale: number - hiddenTabs: string[] - hiddenTabCategories: string[] - pinnedTabs: string[] - minimizePanelInactive: number sidebarExpanded: boolean sidebarScrollable: boolean } diff --git a/packages/devtools-kit/src/_types/rpc.ts b/packages/devtools-kit/src/_types/rpc.ts index 59d206ba9b..04f6bc1f17 100644 --- a/packages/devtools-kit/src/_types/rpc.ts +++ b/packages/devtools-kit/src/_types/rpc.ts @@ -60,6 +60,7 @@ export interface ServerFunctions { renameStaticAsset(token: string, oldPath: string, newPath: string): Promise // Actions + telemetryEvent(payload: object, immediate?: boolean): void customTabAction(name: string, action: number): Promise runWizard(token: string, name: T, ...args: GetWizardArgs): Promise openInEditor(filepath: string): Promise diff --git a/packages/devtools/client/app.vue b/packages/devtools/client/app.vue index bfc7e53949..232d8c7b73 100644 --- a/packages/devtools/client/app.vue +++ b/packages/devtools/client/app.vue @@ -32,7 +32,7 @@ setupClientRPC() const client = useClient() const route = useRoute() const colorMode = useColorMode() -const isUtilityView = computed(() => route.path.startsWith('/__')) +const isUtilityView = computed(() => route.path.startsWith('/__') || route.path === '/') const waiting = computed(() => !client.value && !showConnectionWarning.value) watch( diff --git a/packages/devtools/client/components/NuxtLogo.vue b/packages/devtools/client/components/NuxtLogo.vue index acf1396ef7..f7bb36d978 100644 --- a/packages/devtools/client/components/NuxtLogo.vue +++ b/packages/devtools/client/components/NuxtLogo.vue @@ -1,6 +1,36 @@ diff --git a/packages/devtools/client/components/PictureInPictureButton.vue b/packages/devtools/client/components/PictureInPictureButton.vue index d8365c59a4..e5db99cb7c 100644 --- a/packages/devtools/client/components/PictureInPictureButton.vue +++ b/packages/devtools/client/components/PictureInPictureButton.vue @@ -5,11 +5,19 @@ const isInPopup = window.__NUXT_DEVTOOLS_IS_POPUP__ const showInfo = ref(false) const copy = useCopy() + +function popup() { + const fn = client.value?.devtools?.popup + if (fn) { + telemetry('popup') + fn() + } +}