Repository: nuxt/nuxt
File: packages/schema/src/config/common.ts (TypeScript)

Code before:
  /**
   * Whether Nuxt is running in development mode.
   *
   * Normally, you should not need to set this.
   */
  dev: Boolean(isDevelopment),

  /**
   * Whether your app is being unit tested.
   */
  test: Boolean(isTest),

  /**
   * Set to `true` to enable debug mode.
   *
   * At the moment, it prints out hook names and timings on the server, and
   * logs hook arguments as well in the browser.
   *
   * You can also set this to an object to enable specific debug options.
   * ```js
   * {
   *   log: true, // Log additional information on terminal
   *   hooks: true, // Log hooks calls and timings
   *   nitro: true, // Set nitro debug mode
   *   browser: true, // Log additional information in browser console
   *   prod: true // Log additional information in production mode (hydration mismatch, etc.)
   * }
   * ```
   *
   * @type {boolean | { log?: boolean, hooks?: boolean, nitro?: boolean, browser?: boolean, prod?: boolean }}
   */
  debug: {
    $resolve: (val: boolean | { log?: boolean, hooks?: boolean, nitro?: boolean, browser?: boolean, prod?: boolean } | undefined) => {
      val ??= isDebug
      if (val === false) {
        return val
      }
      if (val === true) {
        return { log: true, hooks: true, nitro: true, browser: true, prod: true }
      }
      return val
    },
  },

  /**
   * Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time.
   * If set to `false` generated pages will have no content.
   */
  ssr: {
    $resolve: val => val ?? true,
  },

Review comment (bug):
I think we might need to rethink these very slightly as they overlap a little bit. we're logging, at the moment:

- timings for template compilation (server)
- timings for module setup (server)
- timings for watcher setup (server)
- timings for hooks (nitro server, nitro app, nuxt app on server)
- timings for hooks (nuxt app in browser)
- vue hydration debugging (browser)

maybe:

```ts
type DebugOption = {
  templates?: boolean
  modules?: boolean
  watchers?: boolean
  nitro?: NitroOptions['debug'] // to inherit in case nitro opts more complex type in future
  hooks?: boolean | 'server' | 'client'
  hydration?: boolean
}
```

Code after:

  /**
   * Whether Nuxt is running in development mode.
   *
   * Normally, you should not need to set this.
   */
  dev: {
    $resolve: val => val ?? Boolean(isDevelopment),
  },

  /**
   * Whether your app is being unit tested.
   */
  test: {
    $resolve: val => val ?? Boolean(isTest),
  },

  /**
   * Set to `true` to enable debug mode.
   *
   * At the moment, it prints out hook names and timings on the server, and
   * logs hook arguments as well in the browser.
   *
   * You can also set this to an object to enable specific debug options.
   *
   * @type {boolean | (typeof import('../src/types/debug').NuxtDebugOptions) | undefined}
   */
  debug: {
    $resolve: (val: boolean | NuxtDebugOptions | undefined) => {
      val ??= isDebug
      if (val === false) {
        return val
      }
      if (val === true) {
        return {
          templates: true,
          modules: true,
          watchers: true,
          hooks: {
            client: true,
            server: true,
          },
          nitro: true,
          router: true,
          hydration: true,
        } satisfies Required<NuxtDebugOptions>
      }
      return val
    },
  },