@nuxt/docs-nightly 4.3.1-29506502.fff89925 → 4.3.1-29506576.cda2d0b4

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.
@@ -155,7 +155,7 @@ Nuxt uses `unhead` under the hood, and you can refer to [its full documentation]
155
155
 
156
156
  If you need more advanced control, you can intercept the rendered html with a hook and modify the head programmatically.
157
157
 
158
- Create a plugin in `~/server/plugins/my-plugin.ts` like this:
158
+ Create a plugin in `~~/server/plugins/my-plugin.ts` like this:
159
159
 
160
160
  <!-- TODO: figure out how to use twoslash to inject types for a different context -->
161
161
 
@@ -43,11 +43,11 @@ const { data } = await useFetch('/api/hello')
43
43
 
44
44
  ## Server Routes
45
45
 
46
- Files inside the `~/server/api` are automatically prefixed with `/api` in their route.
46
+ Files inside the `~~/server/api` are automatically prefixed with `/api` in their route.
47
47
 
48
48
  :video-accordion{title="Watch a video from Vue School on API routes" videoId="761468863" platform="vimeo"}
49
49
 
50
- To add server routes without `/api` prefix, put them into `~/server/routes` directory.
50
+ To add server routes without `/api` prefix, put them into `~~/server/routes` directory.
51
51
 
52
52
  **Example:**
53
53
 
@@ -63,7 +63,7 @@ Note that currently server routes do not support the full functionality of dynam
63
63
 
64
64
  ## Server Middleware
65
65
 
66
- Nuxt will automatically read in any file in the `~/server/middleware` to create server middleware for your project.
66
+ Nuxt will automatically read in any file in the `~~/server/middleware` to create server middleware for your project.
67
67
 
68
68
  Middleware handlers will run on every request before any other server route to add or check headers, log requests, or extend the event's request object.
69
69
 
@@ -87,7 +87,7 @@ export default defineEventHandler((event) => {
87
87
 
88
88
  ## Server Plugins
89
89
 
90
- Nuxt will automatically read any files in the `~/server/plugins` directory and register them as Nitro plugins. This allows extending Nitro's runtime behavior and hooking into lifecycle events.
90
+ Nuxt will automatically read any files in the `~~/server/plugins` directory and register them as Nitro plugins. This allows extending Nitro's runtime behavior and hooking into lifecycle events.
91
91
 
92
92
  **Example:**
93
93
 
@@ -105,7 +105,7 @@ Server routes are powered by [h3js/h3](https://github.com/h3js/h3) which comes w
105
105
 
106
106
  :read-more{to="https://www.jsdocs.io/package/h3#package-index-functions" title="Available H3 Request Helpers" target="_blank"}
107
107
 
108
- You can add more helpers yourself inside the `~/server/utils` directory.
108
+ You can add more helpers yourself inside the `~~/server/utils` directory.
109
109
 
110
110
  For example, you can define a custom handler utility that wraps the original handler and performs additional operations before returning the final response.
111
111
 
@@ -218,7 +218,7 @@ export default defineEventHandler((event) => {
218
218
 
219
219
  Catch-all routes are helpful for fallback route handling.
220
220
 
221
- For example, creating a file named `~/server/api/foo/[...].ts` will register a catch-all route for all requests that do not match any route handler, such as `/api/foo/bar/baz`.
221
+ For example, creating a file named `~~/server/api/foo/[...].ts` will register a catch-all route for all requests that do not match any route handler, such as `/api/foo/bar/baz`.
222
222
 
223
223
  ```ts [server/api/foo/[...\\].ts]
224
224
  export default defineEventHandler((event) => {
@@ -228,7 +228,7 @@ export default defineEventHandler((event) => {
228
228
  })
229
229
  ```
230
230
 
231
- You can set a name for the catch-all route by using `~/server/api/foo/[...slug].ts` and access it via `event.context.params.slug`.
231
+ You can set a name for the catch-all route by using `~~/server/api/foo/[...slug].ts` and access it via `event.context.params.slug`.
232
232
 
233
233
  ```ts [server/api/foo/[...slug\\].ts]
234
234
  export default defineEventHandler((event) => {
@@ -57,7 +57,7 @@ Explore all available App hooks.
57
57
 
58
58
  These hooks are available for [server plugins](/docs/4.x/directory-structure/server#server-plugins) to hook into Nitro's runtime behavior.
59
59
 
60
- ```ts [~/server/plugins/test.ts]
60
+ ```ts [~~/server/plugins/test.ts]
61
61
  export default defineNitroPlugin((nitroApp) => {
62
62
  nitroApp.hooks.hook('render:html', (html, { event }) => {
63
63
  console.log('render:html', html)
@@ -426,10 +426,10 @@ export default defineEventHandler(() => {
426
426
  ## `addServerScanDir`
427
427
 
428
428
  Add directories to be scanned by Nitro. It will check for subdirectories, which will be registered
429
- just like the `~/server` folder is.
429
+ just like the `~~/server` folder is.
430
430
 
431
431
  ::note
432
- Only `~/server/api`, `~/server/routes`, `~/server/middleware`, and `~/server/utils` are scanned.
432
+ Only `~~/server/api`, `~~/server/routes`, `~~/server/middleware`, and `~~/server/utils` are scanned.
433
433
  ::
434
434
 
435
435
  ### Usage
@@ -373,7 +373,7 @@ export default defineNuxtConfig({
373
373
  build: {
374
374
  templates: [
375
375
  {
376
- src: '~/modules/support/plugin.js', // `src` can be absolute or relative
376
+ src: '~~/modules/support/plugin.js', // `src` can be absolute or relative
377
377
  dst: 'support.js', // `dst` is relative to project `.nuxt` dir
378
378
  },
379
379
  ],
@@ -881,7 +881,7 @@ Defaults to 'silent' when running in CI or when a TTY is not available. This opt
881
881
  Modules are Nuxt extensions which can extend its core functionality and add endless integrations.
882
882
 
883
883
  Each module is either a string (which can refer to a package, or be a path to a file), a tuple with the module as first string and the options as a second object, or an inline module function.
884
- Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used.
884
+ Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `rootDir` if `~~` alias is used.
885
885
 
886
886
  - **Type**: `array`
887
887
 
@@ -896,8 +896,8 @@ export default defineNuxtConfig({
896
896
  modules: [
897
897
  // Using package name
898
898
  '@nuxt/scripts',
899
- // Relative to your project srcDir
900
- '~/custom-modules/awesome.js',
899
+ // Relative to your project rootDir
900
+ '~~/custom-modules/awesome.js',
901
901
  // Providing options
902
902
  ['@nuxtjs/google-analytics', { ua: 'X1234567' }],
903
903
  // Inline definition
@@ -1298,7 +1298,7 @@ Define the server directory of your Nuxt application, where Nitro routes, middle
1298
1298
  If a relative path is specified, it will be relative to your `rootDir`.
1299
1299
 
1300
1300
  - **Type**: `string`
1301
- - **Default:** `"/<srcDir>/server"`
1301
+ - **Default:** `"/<rootDir>/server"`
1302
1302
 
1303
1303
  ## serverHandlers
1304
1304
 
@@ -1319,7 +1319,7 @@ Each handler accepts the following options:
1319
1319
  ```ts
1320
1320
  export default defineNuxtConfig({
1321
1321
  serverHandlers: [
1322
- { route: '/path/foo/**:name', handler: '~/server/foohandler.ts' },
1322
+ { route: '/path/foo/**:name', handler: '#server/foohandler.ts' },
1323
1323
  ],
1324
1324
  })
1325
1325
  ```
@@ -1409,22 +1409,27 @@ export default defineNuxtConfig({
1409
1409
  srcDir: 'app/',
1410
1410
  })
1411
1411
  ```
1412
+
1412
1413
  This expects the following folder structure:
1413
1414
  ```bash
1414
1415
  -| app/
1415
1416
  ---| assets/
1416
1417
  ---| components/
1418
+ ---| composables/
1417
1419
  ---| layouts/
1418
1420
  ---| middleware/
1419
1421
  ---| pages/
1420
1422
  ---| plugins/
1423
+ ---| utils/
1421
1424
  ---| app.config.ts
1422
1425
  ---| app.vue
1423
1426
  ---| error.vue
1424
1427
  -| server/
1428
+ -| shared/
1425
1429
  -| public/
1426
1430
  -| modules/
1427
- -| nuxt.config.js
1431
+ -| layers/
1432
+ -| nuxt.config.ts
1428
1433
  -| package.json
1429
1434
  ```
1430
1435
 
@@ -1693,7 +1698,7 @@ Please note that not all vite options are supported in Nuxt.
1693
1698
  ### `root`
1694
1699
 
1695
1700
  - **Type**: `string`
1696
- - **Default:** `"/<srcDir>"`
1701
+ - **Default:** `"/<rootDir>"`
1697
1702
 
1698
1703
  ### `server`
1699
1704
 
@@ -1706,7 +1711,7 @@ Please note that not all vite options are supported in Nuxt.
1706
1711
  ```json
1707
1712
  [
1708
1713
  "/<rootDir>/.nuxt",
1709
- "/<srcDir>",
1714
+ "/<rootDir>/app",
1710
1715
  "/<rootDir>",
1711
1716
  "/<workspaceDir>"
1712
1717
  ]
@@ -10,7 +10,7 @@ In a built Nuxt 3 application, there is no runtime Nuxt dependency. That means y
10
10
  ## Steps
11
11
 
12
12
  1. Remove the `render` key in your `nuxt.config`.
13
- 2. Any files in `~/server/api` and `~/server/middleware` will be automatically registered; you can remove them from your `serverMiddleware` array.
13
+ 2. Any files in `~~/server/api` and `~~/server/middleware` will be automatically registered; you can remove them from your `serverMiddleware` array.
14
14
  3. Update any other items in your `serverMiddleware` array to point to files or npm packages directly, rather than using inline functions.
15
15
 
16
16
  :read-more{to="/docs/4.x/directory-structure/server"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "4.3.1-29506502.fff89925",
3
+ "version": "4.3.1-29506576.cda2d0b4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",