diff --git a/docs/content/2.module/3.migration-v4.md b/docs/content/2.module/3.migration-v4.md index d42177a39e..d3303d4016 100644 --- a/docs/content/2.module/3.migration-v4.md +++ b/docs/content/2.module/3.migration-v4.md @@ -303,7 +303,8 @@ The built-in VS Code integration is replaced by the Code Server plugin (`devtool - Global installs: `devtoolsGlobal`, the `-g` install flag and `NuxtDevtoolsInfo.isGlobalInstall`. - The `viteDevTools` module option; Vite DevTools is always on. On Vite 8.3+ Nuxt DevTools configures Vite's top-level `devtools` option, so `vite: { devtools: false }` turns it off. - `client.devtools.open()` / `close()` / `toggle()` still exist and now drive the Vite DevTools panel. +- The static assets RPCs `getStaticAssets`, `getImageMeta`, `getTextAssetContent`, `writeStaticAssets`, `deleteStaticAsset` and `renameStaticAsset`, together with the `AssetInfo`, `AssetEntry`, `AssetType` and `ImageMeta` types. The Assets tab is now [`@devframes/plugin-assets`](https://npmx.dev/package/@devframes/plugin-assets). ### Peer dependencies -`@nuxt/devtools` requires Vite `^8.1.5` (was `>=6.0`) and `@nuxt/kit` 4 or 5. Nitro v2 (`nitropack`, Nuxt 4) and Nitro v3 (`nitro`, Nuxt 5) are both optional peers; the one your user's Nuxt installs is the one that gets used. +`@nuxt/devtools` requires Vite `^8.1.5` (was `>=6.0`) and `@nuxt/kit` 4 or 5. Nitro v2 (`nitropack`, Nuxt 4) and Nitro v3 (`nitro`, Nuxt 5) are both optional peers; the one your user's Nuxt installs is the one that gets used. `unstorage` is an optional peer for the same reason: the Storage tab uses the copy that Nitro brings. diff --git a/packages/devtools-kit/src/_types/integrations.ts b/packages/devtools-kit/src/_types/integrations.ts index 1bb85ca41c..fca33871f3 100644 --- a/packages/devtools-kit/src/_types/integrations.ts +++ b/packages/devtools-kit/src/_types/integrations.ts @@ -11,14 +11,6 @@ export interface HookInfo { executions: number[] } -export interface ImageMeta { - width: number - height: number - orientation?: number - type?: string - mimeType?: string -} - export interface PackageUpdateInfo { name: string current: string @@ -196,25 +188,6 @@ export interface VueInspectorClient { export type VueInspectorData = VueInspectorClient['linkParams'] & Partial -export type AssetType = 'image' | 'font' | 'video' | 'audio' | 'text' | 'json' | 'other' - -export interface AssetInfo { - path: string - type: AssetType - publicPath: string - filePath: string - size: number - mtime: number - layer?: string -} - -export interface AssetEntry { - path: string - content: string - encoding?: BufferEncoding - override?: boolean -} - export interface CodeSnippet { code: string lang: string diff --git a/packages/devtools-kit/src/_types/rpc.ts b/packages/devtools-kit/src/_types/rpc.ts index 20476862d2..e50ea3397b 100644 --- a/packages/devtools-kit/src/_types/rpc.ts +++ b/packages/devtools-kit/src/_types/rpc.ts @@ -3,7 +3,7 @@ import type { StorageValue } from 'unstorage' import type { ResolvedConfig } from 'vite' import type { AnalyzeBuildsInfo } from './analyze-build' import type { ModuleCustomTab } from './custom-tabs' -import type { AssetEntry, AssetInfo, AutoImportsWithMetadata, ComponentRelationship, HookInfo, ImageMeta, NpmCommandOptions, NpmCommandType, PackageUpdateInfo, ScannedNitroTasks, ServerRouteInfo } from './integrations' +import type { AutoImportsWithMetadata, ComponentRelationship, HookInfo, NpmCommandOptions, NpmCommandType, PackageUpdateInfo, ScannedNitroTasks, ServerRouteInfo } from './integrations' import type { AnyNitro, AnyStorageMounts } from './nitro-compat' import type { NuxtDevtoolsNotifyInput } from './notify' import type { ModuleOptions, NuxtDevToolsOptions } from './options' @@ -23,12 +23,11 @@ export interface ServerFunctions { getModuleOptions: () => ModuleOptions getComponents: () => Component[] getComponentsRelationships: () => Promise - getAutoImports: () => AutoImportsWithMetadata + getAutoImports: () => Promise getServerPages: () => NuxtPage[] getCustomTabs: () => ModuleCustomTab[] getServerHooks: () => HookInfo[] getServerLayouts: () => NuxtLayout[] - getStaticAssets: () => Promise getServerRoutes: () => ServerRouteInfo[] getServerTasks: () => ScannedNitroTasks | null getServerApp: () => NuxtApp | undefined @@ -59,13 +58,6 @@ export interface ServerFunctions { startAnalyzeBuild: (name: string) => Promise clearAnalyzeBuilds: (names?: string[]) => Promise - // Queries - getImageMeta: (filepath: string) => Promise - getTextAssetContent: (filepath: string, limit?: number) => Promise - writeStaticAssets: (file: AssetEntry[], folder: string) => Promise - deleteStaticAsset: (filepath: string) => Promise - renameStaticAsset: (oldPath: string, newPath: string) => Promise - // Notifications notify: (input: NuxtDevtoolsNotifyInput) => Promise diff --git a/packages/devtools/client/nuxt.config.ts b/packages/devtools/client/nuxt.config.ts index 4a439827cc..3d1005003d 100644 --- a/packages/devtools/client/nuxt.config.ts +++ b/packages/devtools/client/nuxt.config.ts @@ -82,6 +82,12 @@ export default defineNuxtConfig({ '@nuxt/devtools-kit': resolver.resolve('../../devtools-kit/src/index'), }, + // A static SPA has no use for server sourcemaps, and Nuxt's Vite builder + // writes them to `/dist`, i.e. into the published `@nuxt/devtools` dist. + sourcemap: { + server: false, + }, + experimental: { watcher: 'parcel', payloadExtraction: 'client', diff --git a/packages/devtools/client/pages/modules/custom-[name].vue b/packages/devtools/client/pages/modules/custom-[name].vue index 73bedef4e5..e2a1604703 100644 --- a/packages/devtools/client/pages/modules/custom-[name].vue +++ b/packages/devtools/client/pages/modules/custom-[name].vue @@ -61,7 +61,7 @@ onMounted(() => { :title="tab.view.title || tab.title" :description="tab.view.description" :actions="tab.view.actions" - @action="idx => rpc.customTabAction(tab!.name, idx)" + @action="rpc.customTabAction(tab!.name, $event)" />