@nuxt/docs-nightly 4.2.0-29336619.cf102e88 → 4.2.0-29344147.7bcc4ca3

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.
@@ -234,22 +234,30 @@ export default defineNuxtConfig({
234
234
 
235
235
  ## Multi-Layer Support for Nuxt Modules
236
236
 
237
- You can use the internal array `nuxt.options._layers` to support custom multi-layer handling for your modules.
237
+ You can use the [`getLayerDirectories`](/docs/api/kit/layers#getlayerdirectories) utility from Nuxt Kit to support custom multi-layer handling for your modules.
238
238
 
239
239
  ```ts [modules/my-module.ts]
240
+ import { defineNuxtModule, getLayerDirectories } from 'nuxt/kit'
241
+
240
242
  export default defineNuxtModule({
241
243
  setup (_options, nuxt) {
242
- for (const layer of nuxt.options._layers) {
243
- // You can check for a custom directory existence to extend for each layer
244
- console.log('Custom extension for', layer.cwd, layer.config)
244
+ const layerDirs = getLayerDirectories()
245
+
246
+ for (const [index, layer] of layerDirs.entries()) {
247
+ console.log(`Layer ${index}:`)
248
+ console.log(` Root: ${layer.root}`)
249
+ console.log(` App: ${layer.app}`)
250
+ console.log(` Server: ${layer.server}`)
251
+ console.log(` Pages: ${layer.appPages}`)
252
+ // ... other directories
245
253
  }
246
254
  },
247
255
  })
248
256
  ```
249
257
 
250
258
  **Notes:**
251
- - Earlier items in the `_layers` array have higher priority and override later ones
252
- - The user's project is the first item in the `_layers` array
259
+ - Earlier items in the array have higher priority and override later ones
260
+ - The user's project is the first item in the array
253
261
 
254
262
  ## Going Deeper
255
263
 
@@ -424,9 +424,60 @@ A unique identifier matching the build. This may contain the hash of the current
424
424
 
425
425
  The builder to use for bundling the Vue part of your application.
426
426
 
427
- - **Type**: `string`
427
+ Nuxt supports multiple builders for the client-side application. By default, Vite is used, but you can switch to webpack, Rspack, or even provide a custom builder implementation.
428
+
429
+ - **Type**: `'vite' | 'webpack' | 'rspack' | string | { bundle: (nuxt: Nuxt) => Promise<void> }`
428
430
  - **Default:** `"@nuxt/vite-builder"`
429
431
 
432
+ **Using supported builders:**
433
+
434
+ ```ts
435
+ export default defineNuxtConfig({
436
+ // default - uses @nuxt/vite-builder
437
+ // builder: 'vite',
438
+
439
+ // uses @nuxt/webpack-builder
440
+ // builder: 'webpack',
441
+
442
+ // uses @nuxt/rspack-builder
443
+ builder: 'rspack',
444
+ })
445
+ ```
446
+
447
+ If you are using `webpack` or `rspack` you will need to make sure `@nuxt/webpack-builder` or `@nuxt/rspack-builder` is explicitly installed in your project.
448
+
449
+ **Using a custom builder object:**
450
+
451
+ You can provide a custom builder by passing an object with a `bundle` function:
452
+
453
+ ```ts
454
+ export default defineNuxtConfig({
455
+ builder: {
456
+ async bundle (nuxt) {
457
+ const entry = await resolvePath(resolve(nuxt.options.appDir, 'entry'))
458
+
459
+ // Build client and server bundles
460
+ await buildClient(nuxt, entry)
461
+ if (nuxt.options.ssr) {
462
+ await buildServer(nuxt, entry)
463
+ }
464
+
465
+ // ... it's a bit more complicated than that, of course!
466
+ },
467
+ },
468
+ })
469
+ ```
470
+
471
+ **Creating a custom builder package:**
472
+
473
+ To create a custom builder as a separate package, it should export a `bundle` function. You can then specify the package name in your `nuxt.config.ts`:
474
+
475
+ ```ts
476
+ export default defineNuxtConfig({
477
+ builder: 'my-custom-builder',
478
+ })
479
+ ```
480
+
430
481
  ## compatibilityDate
431
482
 
432
483
  Specify a compatibility date for your app.
@@ -1218,6 +1269,23 @@ export default defineNuxtConfig({
1218
1269
  })
1219
1270
  ```
1220
1271
 
1272
+ ## server
1273
+
1274
+ Configuration for Nuxt's server builder.
1275
+
1276
+ ### `builder`
1277
+
1278
+ Specify the server builder to use for bundling the server part of your application.
1279
+
1280
+ By default, Nuxt uses `@nuxt/nitro-server`, which provides standalone Nitro integration. This architecture allows for different Nitro integration patterns, such as using Nitro as a Vite plugin (with the Vite Environment API).
1281
+
1282
+ - **Type**: `string | { bundle: (nuxt: Nuxt) => Promise<void> }`
1283
+ - **Default:** `"@nuxt/nitro-server"`
1284
+
1285
+ ::callout{type="warning"}
1286
+ This option is intended for internal use and the API is not finalized. Please open an issue before relying on the current implementation.
1287
+ ::
1288
+
1221
1289
  ## serverDir
1222
1290
 
1223
1291
  Define the server directory of your Nuxt application, where Nitro routes, middleware and plugins are kept.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "4.2.0-29336619.cf102e88",
3
+ "version": "4.2.0-29344147.7bcc4ca3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",