@nuxt/docs-nightly 4.4.0-29548611.515aeeef → 4.4.0-29550724.be97f20e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -300,10 +300,6 @@ it('can also mount an app', async () => {
300
300
  })
301
301
  ```
302
302
 
303
- The options object accepts `@vue/test-utils` mount options and the following properties:
304
-
305
- - `route`: the initial route, or `false` to skip the initial route change (default `/`).
306
-
307
303
  #### `renderSuspended`
308
304
 
309
305
  `renderSuspended` allows you to render any Vue component within the Nuxt environment using `@testing-library/vue`, allowing async setup and access to injections from your Nuxt plugins.
@@ -356,10 +352,6 @@ it('can also render an app', async () => {
356
352
  })
357
353
  ```
358
354
 
359
- The options object accepts `@testing-library/vue` render options and the following properties:
360
-
361
- - `route`: the initial route, or `false` to skip the initial route change (default `/`).
362
-
363
355
  #### `mockNuxtImport`
364
356
 
365
357
  `mockNuxtImport` allows you to mock Nuxt's auto import functionality. For example, to mock `useStorage`, you can do so like this:
@@ -376,27 +368,6 @@ mockNuxtImport('useStorage', () => {
376
368
  // your tests here
377
369
  ```
378
370
 
379
- You can explicitly type the mock for type safety, and use the original implementation passed to the factory function when mocking complex functionality.
380
-
381
- ```ts twoslash
382
- import { mockNuxtImport } from '@nuxt/test-utils/runtime'
383
-
384
- mockNuxtImport<typeof useStorage>('useStorage', (original) => {
385
- return (...args) => {
386
- return { ...original(...args), value: 'mocked storage' }
387
- }
388
- })
389
-
390
- // or specify the target to mock
391
- mockNuxtImport(useStorage, (original) => {
392
- return (...args) => {
393
- return { ...original(...args), value: 'mocked storage' }
394
- }
395
- })
396
-
397
- // your tests here
398
- ```
399
-
400
371
  ::note
401
372
  `mockNuxtImport` can only be used once per mocked import per test file. It is actually a macro that gets transformed to `vi.mock` and `vi.mock` is hoisted, as described [in the Vitest docs](https://vitest.dev/api/vi#vi-mock).
402
373
  ::
@@ -425,25 +396,6 @@ useStorageMock.mockImplementation(() => {
425
396
  })
426
397
  ```
427
398
 
428
- If you need to mock behavior only inside a test, you can also use the following approach.
429
-
430
- ```ts twoslash
431
- import { beforeEach, vi } from 'vitest'
432
- import { mockNuxtImport } from '@nuxt/test-utils/runtime'
433
-
434
- mockNuxtImport(useRoute, original => vi.fn(original))
435
-
436
- beforeEach(() => {
437
- vi.resetAllMocks()
438
- })
439
-
440
- // Then, inside a test
441
- const useRouteOriginal = vi.mocked(useRoute).getMockImplementation()!
442
- vi.mocked(useRoute).mockImplementation(
443
- (...args) => ({ ...useRouteOriginal(...args), path: '/mocked' }),
444
- )
445
- ```
446
-
447
399
  #### `mockComponent`
448
400
 
449
401
  `mockComponent` allows you to mock Nuxt's component.
@@ -525,12 +477,6 @@ registerEndpoint('/test/', {
525
477
  })
526
478
  ```
527
479
 
528
- This object accepts the following properties:
529
-
530
- - `handler`: the event handler function
531
- - `method`: (optional) HTTP method to match (e.g., 'GET', 'POST')
532
- - `once`: (optional) if true, the handler will only be used for the first matching request and then automatically removed
533
-
534
480
  > **Note**: If your requests in a component go to an external API, you can use `baseURL` and then make it empty using [Nuxt Environment Override Config](/docs/4.x/getting-started/configuration#environment-overrides) (`$test`) so all your requests will go to Nitro server.
535
481
 
536
482
  #### Conflict with End-To-End Testing
@@ -61,7 +61,6 @@ When you set your `future.compatibilityVersion` to `5`, defaults throughout your
61
61
  - **Vite Environment API**: Automatically enables the new [Vite Environment API](/docs/4.x/getting-started/upgrade#migration-to-vite-environment-api) for improved build configuration
62
62
  - **Normalized Page Names**: Page component names will [match their route names](/docs/4.x/getting-started/upgrade#normalized-page-component-names) for consistent `<KeepAlive>` behavior
63
63
  - **`clearNuxtState` resets to defaults**: `clearNuxtState` will [reset state to its initial value](/docs/4.x/getting-started/upgrade#respect-defaults-when-clearing-usestate) instead of setting it to `undefined`
64
- - **Non-async `callHook`**: [`callHook` may return `void`](/docs/4.x/getting-started/upgrade#non-async-callhook) instead of always returning a `Promise`
65
64
  - Other Nuxt 5 improvements and changes as they become available
66
65
 
67
66
  ::note
@@ -181,52 +180,6 @@ addVitePlugin(() => ({
181
180
  Learn more about Vite's Environment API
182
181
  ::
183
182
 
184
- ### Non-Async `callHook`
185
-
186
- 🚦 **Impact Level**: Minimal
187
-
188
- #### What Changed
189
-
190
- With the upgrade to [hookable v6](https://github.com/unjs/hookable), `callHook` may now return `void` instead of always returning `Promise<void>`. This is a significant performance improvement that avoids unnecessary `Promise` allocations when there are no registered hooks or all hooks are synchronous.
191
-
192
- By default (with `compatibilityVersion: 4`), Nuxt wraps `callHook` with `Promise.resolve()` so that existing `.then()` and `.catch()` chaining continues to work. With `compatibilityVersion: 5`, this wrapper is removed.
193
-
194
- ::tip
195
- This affects both build-time Nuxt hooks (used by Nuxt modules) and runtime Nuxt hooks (which you might use in your application code).
196
- ::
197
-
198
- #### Reasons for Change
199
-
200
- Hookable v6's `callHook` is 20-40x faster because it avoids creating a `Promise` when one is not needed. This benefits applications with many hook call sites.
201
-
202
- #### Migration Steps
203
-
204
- If you or your modules use `callHook` with `.then()` or `.catch()` chaining, switch to `await`:
205
-
206
- ```diff
207
- - nuxtApp.callHook('my:hook', data).then(() => { ... })
208
- + await nuxtApp.callHook('my:hook', data)
209
- ```
210
-
211
- ```diff
212
- - nuxtApp.hooks.callHook('my:hook', data).catch(err => { ... })
213
- + try { await nuxtApp.hooks.callHook('my:hook', data) } catch (err) { ... }
214
- ```
215
-
216
- ::tip
217
- You can test this feature early by setting `future.compatibilityVersion: 5` (see [Testing Nuxt 5](/docs/4.x/getting-started/upgrade#testing-nuxt-5)) or by enabling it explicitly with `experimental.asyncCallHook: false`.
218
- ::
219
-
220
- Alternatively, you can ensure `callHook` always returns a `Promise` with:
221
-
222
- ```ts twoslash [nuxt.config.ts]
223
- export default defineNuxtConfig({
224
- experimental: {
225
- asyncCallHook: true,
226
- },
227
- })
228
- ```
229
-
230
183
  ## Migrating to Nuxt 4
231
184
 
232
185
  Nuxt 4 includes significant improvements and changes. This guide will help you migrate your existing Nuxt 3 application to Nuxt 4.
@@ -238,19 +238,12 @@ export default defineNuxtConfig({
238
238
 
239
239
  ## payloadExtraction
240
240
 
241
- Controls how payload data is delivered for prerendered and cached (ISR/SWR) pages.
242
-
243
- - `'client'` - Payload is inlined in HTML for the initial server render, and extracted to `_payload.json` files for client-side navigation. This avoids a separate network request on initial load while still enabling efficient client-side navigation.
244
- - `true` - Payload is extracted to a separate `_payload.json` file for both the initial server render and client-side navigation.
245
- - `false` - Payload extraction is disabled entirely. Payload is always inlined in HTML and no `_payload.json` files are generated.
246
-
247
- The default is `true`, or `'client'` when `compatibilityVersion: 5` is set.
241
+ Enables extraction of payloads of pages generated with `nuxt generate`.
248
242
 
249
243
  ```ts twoslash [nuxt.config.ts]
250
244
  export default defineNuxtConfig({
251
245
  experimental: {
252
- // Inline payload in HTML, extract for client-side navigation only
253
- payloadExtraction: 'client',
246
+ payloadExtraction: true,
254
247
  },
255
248
  })
256
249
  ```
@@ -260,7 +253,7 @@ Payload extraction also works for routes using ISR (Incremental Static Regenerat
260
253
  ```ts twoslash [nuxt.config.ts]
261
254
  export default defineNuxtConfig({
262
255
  experimental: {
263
- payloadExtraction: 'client',
256
+ payloadExtraction: true,
264
257
  },
265
258
  routeRules: {
266
259
  // Payload files will be generated for these cached routes
@@ -161,7 +161,6 @@ type AsyncDataRequestContext = {
161
161
 
162
162
  type AsyncData<DataT, ErrorT> = {
163
163
  data: Ref<DataT | undefined>
164
- pending: Ref<boolean>
165
164
  refresh: (opts?: AsyncDataExecuteOptions) => Promise<void>
166
165
  execute: (opts?: AsyncDataExecuteOptions) => Promise<void>
167
166
  clear: () => void
@@ -230,7 +229,6 @@ This only caches data when `experimental.payloadExtraction` in `nuxt.config` is
230
229
  | `execute` | `(opts?: AsyncDataExecuteOptions) => Promise<void>` | Alias for `refresh`. |
231
230
  | `error` | `Ref<ErrorT \| undefined>` | Error object if the data fetching failed. |
232
231
  | `status` | `Ref<'idle' \| 'pending' \| 'success' \| 'error'>` | Status of the data request. See below for possible values. |
233
- | `pending` | `Ref<boolean>` | Boolean flag indicating whether the current request is in progress. |
234
232
  | `clear` | `() => void` | Resets `data` to `undefined` (or the value of `options.default()` if provided), `error` to `undefined`, set `status` to `idle`, and cancels any pending requests. |
235
233
 
236
234
  ### Status values
@@ -76,7 +76,6 @@ Returns the same `AsyncData` object as [`useFetch`](/docs/4.x/api/composables/us
76
76
  | `execute` | `(opts?: AsyncDataExecuteOptions) => Promise<void>` | Alias for `refresh`. |
77
77
  | `error` | `Ref<ErrorT \| undefined>` | Error object if the data fetching failed. |
78
78
  | `status` | `Ref<'idle' \| 'pending' \| 'success' \| 'error'>` | Status of the data request. |
79
- | `pending` | `Ref<boolean>` | Boolean flag indicating whether the current request is in progress. |
80
79
  | `clear` | `() => void` | Resets `data` to `undefined`, `error` to `undefined`, sets `status` to `idle`, and cancels any pending requests. |
81
80
 
82
81
  :read-more{to="/docs/4.x/api/composables/use-fetch#return-values"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "4.4.0-29548611.515aeeef",
3
+ "version": "4.4.0-29550724.be97f20e",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",