+
diff --git a/packages/devtools-ui-kit/src/components/NSplitPane.vue b/packages/devtools-ui-kit/src/components/NSplitPane.vue
index 76d815887d..600d9aae5d 100644
--- a/packages/devtools-ui-kit/src/components/NSplitPane.vue
+++ b/packages/devtools-ui-kit/src/components/NSplitPane.vue
@@ -25,9 +25,9 @@ const DEFAULT = 30
const key = props.storageKey
const size = key
? computed({
- get: () => state.value[key] || props.leftSize || DEFAULT,
- set: (v) => { state.value[key] = v },
- })
+ get: () => state.value[key] || props.leftSize || DEFAULT,
+ set: (v) => { state.value[key] = v },
+ })
: ref(props.leftSize || DEFAULT)
diff --git a/packages/devtools-ui-kit/src/components/NSwitch.vue b/packages/devtools-ui-kit/src/components/NSwitch.vue
index f8eaf3ddc4..e3bc72a7ee 100644
--- a/packages/devtools-ui-kit/src/components/NSwitch.vue
+++ b/packages/devtools-ui-kit/src/components/NSwitch.vue
@@ -1,18 +1,16 @@
diff --git a/packages/devtools-ui-kit/src/components/NTextInput.vue b/packages/devtools-ui-kit/src/components/NTextInput.vue
index 0f5ba83412..75d51f32c4 100644
--- a/packages/devtools-ui-kit/src/components/NTextInput.vue
+++ b/packages/devtools-ui-kit/src/components/NTextInput.vue
@@ -18,7 +18,11 @@ const props = withDefaults(
},
)
-const emit = defineEmits<{ (...args: any): void }>()
+const emit = defineEmits<{
+ (name: 'keydown', event: KeyboardEvent): void
+ (name: 'keyup', event: KeyboardEvent): void
+ (name: 'change', event: Event): void
+}>()
const input = useVModel(props, 'modelValue', emit, { passive: true })
diff --git a/packages/devtools-wizard/package.json b/packages/devtools-wizard/package.json
index c64d1f3b10..ef19f5172e 100644
--- a/packages/devtools-wizard/package.json
+++ b/packages/devtools-wizard/package.json
@@ -1,7 +1,7 @@
{
"name": "@nuxt/devtools-wizard",
"type": "module",
- "version": "1.5.1",
+ "version": "2.0.0-beta.7",
"description": "CLI Wizard to toggle Nuxt DevTools",
"license": "MIT",
"homepage": "https://devtools.nuxt.com",
@@ -28,12 +28,10 @@
"consola": "catalog:",
"diff": "catalog:",
"execa": "catalog:",
- "global-directory": "catalog:",
"magicast": "catalog:",
"pathe": "catalog:",
"pkg-types": "catalog:",
"prompts": "catalog:",
- "rc9": "catalog:",
"semver": "catalog:"
},
"devDependencies": {
diff --git a/packages/devtools-wizard/src/builtin.ts b/packages/devtools-wizard/src/builtin.ts
index 20ec62f6c1..656c575aab 100644
--- a/packages/devtools-wizard/src/builtin.ts
+++ b/packages/devtools-wizard/src/builtin.ts
@@ -85,19 +85,11 @@ async function toggleConfig(cwd: string, value?: boolean) {
}
export async function enable(cwd: string) {
- if (await toggleConfig(cwd, true)) {
- // disable global devtools
- await import('./global').then(r => r.disableSilently(cwd))
- consola.success(colors.green('Nuxt DevTools is enabled! Restart your Nuxt app to start using it.'))
- }
+ await toggleConfig(cwd, true)
}
export async function disable(cwd: string) {
- if (await toggleConfig(cwd, false)) {
- // disable global devtools
- await import('./global').then(r => r.disableSilently(cwd))
- consola.success('Nuxt DevTools disabled for this project.')
- }
+ await toggleConfig(cwd, false)
}
// diff `from` and `to` by line and pretty print to console with line numbers, using the `diff` package
diff --git a/packages/devtools-wizard/src/global.ts b/packages/devtools-wizard/src/global.ts
deleted file mode 100644
index 99df1af188..0000000000
--- a/packages/devtools-wizard/src/global.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * This module is for installing Nuxt DevTools globally and enabling it for a project.
- *
- * Since Nuxt v3.4, Nuxt DevTools is shipped with Nuxt so we only using this for Nuxt below v3.4.
- */
-import fs from 'node:fs'
-import { consola } from 'consola'
-import { execa } from 'execa'
-import globalDirs from 'global-directory'
-import { resolve } from 'pathe'
-import { readUser, writeUser } from 'rc9'
-
-const moduleName = '@nuxt/devtools'
-
-type RC = ReturnType
-export const RC_PATH = '.nuxtrc'
-const pathRegex = /[\\/]@nuxt[\\/]devtools[\\/]/
-
-export async function enable(cwd: string) {
- const rc = readUser(RC_PATH)
- consola.info('Installed Nuxt DevTools...')
- await execa('npm', ['install', '-g', `${moduleName}@latest`], { stdio: 'inherit' })
-
- markEnable(rc, cwd)
- consola.info('Nuxt DevTools enabled! Restart your Nuxt app to start using it.')
-}
-
-function markEnable(rc: RC, path: string) {
- const modulePath = resolve(globalDirs.npm.packages, moduleName)
- const targetPath = resolve(modulePath, 'module.cjs').replace(/\\/g, '/')
-
- if (!fs.existsSync(targetPath))
- throw new Error('Failed to locate the global Nuxt DevTools module. You may try it again')
-
- // remove all entries
- removeModule(rc)
-
- if (!rc.modules?.includes(targetPath))
- rc.modules = [...rc.modules || [], targetPath]
-
- if (!rc.devtoolsGlobal)
- rc.devtoolsGlobal = {}
- if (!rc.devtoolsGlobal.projects)
- rc.devtoolsGlobal.projects = []
- if (!rc.devtoolsGlobal.projects.includes(path))
- rc.devtoolsGlobal.projects.push(path)
-
- writeUser(rc, RC_PATH)
-}
-
-export function disableSilently(cwd: string) {
- const rc = readUser(RC_PATH)
- if (markDisable(rc, cwd))
- writeUser(rc, RC_PATH)
-}
-
-export async function disable(cwd: string, args: string[]) {
- const rc = readUser(RC_PATH)
- const isRemove = args.includes('--remove')
-
- if (markDisable(rc, cwd))
- consola.success('Nuxt DevTools disabled for this project.')
- else if (!isRemove)
- consola.warn('Nuxt DevTools is not enabled for this project.')
-
- if (isRemove) {
- removeModule(rc)
- consola.success('Nuxt DevTools is removed globally')
- }
-
- writeUser(rc, RC_PATH)
-}
-
-function markDisable(rc: RC, path: string) {
- if (rc?.devtoolsGlobal?.projects?.includes(path)) {
- rc.devtoolsGlobal.projects = rc.devtoolsGlobal.projects.filter((p: string) => p !== path)
- return true
- }
- // remove module if no projects
- if (!rc?.devtoolsGlobal?.projects?.length)
- removeModule(rc)
- return false
-}
-
-export function removeModule(rc: RC) {
- if (Array.isArray(rc.modules))
- rc.modules = rc.modules.filter((p: string) => !p.match(pathRegex))
- return true
-}
diff --git a/packages/devtools-wizard/src/index.ts b/packages/devtools-wizard/src/index.ts
index 2aa51d545b..46cb902dab 100644
--- a/packages/devtools-wizard/src/index.ts
+++ b/packages/devtools-wizard/src/index.ts
@@ -1,7 +1,6 @@
import { consola } from 'consola'
import { colors } from 'consola/utils'
import { readPackageJSON } from 'pkg-types'
-import semver from 'semver'
import { name as moduleName, version } from '../package.json'
async function getNuxtVersion(path: string): Promise {
@@ -27,31 +26,21 @@ async function run() {
consola.log(`${colors.inverse(colors.bold(colors.green(' DevTools ')))} ${colors.green(`v${version}`)}`)
consola.log(`\n${colors.gray('Learn more at https://devtools.nuxt.com\n')}`)
- if (moduleName.endsWith('-edge'))
- throw new Error('Edge release of Nuxt DevTools requires to be installed locally. Learn more at https://github.com/nuxt/devtools/#edge-release-channel')
+ if (moduleName.endsWith('-edge') || moduleName.endsWith('-nightly'))
+ throw new Error('Nightly release of Nuxt DevTools requires to be installed locally. Learn more at https://github.com/nuxt/devtools/#nightly-release-channel')
const nuxtVersion = await getNuxtVersion(cwd)
if (!nuxtVersion) {
- consola.error('Unable to find any installed nuxt version icurrent directory')
+ consola.error('Unable to find any installed nuxt version in the current directory')
process.exit(1)
}
- // Nuxt 3.4.0 will have devtools built-in
- // https://github.com/nuxt/nuxt/pull/20126
- const isDevToolsBuiltIn = semver.gte(nuxtVersion, '3.4.0')
-
if (command === 'enable') {
consola.log(colors.green('Enabling Nuxt DevTools...'))
- if (isDevToolsBuiltIn)
- await import('./builtin').then(r => r.enable(cwd))
- else
- await import('./global').then(r => r.enable(cwd))
+ await import('./builtin').then(r => r.enable(cwd))
}
else if (command === 'disable') {
consola.log(colors.magenta('Disabling Nuxt DevTools...'))
- if (isDevToolsBuiltIn)
- await import('./builtin').then(r => r.disable(cwd))
- else
- await import('./global').then(r => r.disable(cwd, args))
+ await import('./builtin').then(r => r.disable(cwd))
}
else if (!command) {
consola.log(`npx ${moduleName} enable|disable`)
diff --git a/packages/devtools/.discoveryrc.cjs b/packages/devtools/.discoveryrc.cjs
new file mode 100644
index 0000000000..23a3ed4535
--- /dev/null
+++ b/packages/devtools/.discoveryrc.cjs
@@ -0,0 +1,13 @@
+const { join } = require('node:path')
+
+module.exports = {
+ name: 'Nuxt Server Data',
+ basedir: join(__dirname, 'discovery'),
+ embed: true,
+ // view: {
+ // assets: [
+ // './pages/common.css',
+ // './pages/default.js',
+ // ],
+ // },
+}
diff --git a/packages/devtools/client/app.config.ts b/packages/devtools/client/app.config.ts
index b02c4ee482..8498ea7330 100644
--- a/packages/devtools/client/app.config.ts
+++ b/packages/devtools/client/app.config.ts
@@ -1,3 +1,5 @@
+import { defineAppConfig } from '#imports'
+
export default defineAppConfig({
fixture1: 'from app.config.ts',
})
diff --git a/packages/devtools/client/app.vue b/packages/devtools/client/app.vue
index c7af7d500b..92d5582cb0 100644
--- a/packages/devtools/client/app.vue
+++ b/packages/devtools/client/app.vue
@@ -9,6 +9,7 @@ import { useCopy } from '~/composables/editor'
import { rpc } from '~/composables/rpc'
import { registerCommands } from '~/composables/state-commands'
import { splitScreenAvailable, splitScreenEnabled } from '~/composables/storage'
+import { useSchemaInput } from './composables/state-schema'
import { useDevToolsOptions } from './composables/storage-options'
import { setupClientRPC } from './setup/client-rpc'
import { setupVueDevTools } from './setup/vue-devtools'
@@ -65,7 +66,7 @@ useEventListener('keydown', (e) => {
})
const { scale, sidebarExpanded } = useDevToolsOptions('ui')
-// const dataSchema = useSchemaInput()
+const dataSchema = useSchemaInput()
onMounted(async () => {
const injectClient = useInjectionClient()
@@ -157,8 +158,8 @@ registerCommands(() => [
-
+