docs(schema): grammar, punctuation and typo fixes (#6469)

Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com>
This commit is contained in:
Timur Bolotov 2022-08-12 03:25:35 +06:00 committed by GitHub
parent fb46c83d73
commit e55938fe6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 123 additions and 122 deletions

View File

@ -21,7 +21,7 @@ export default {
performance: { $resolve: (val, get) => val ?? get('dev') },
},
/**
* Options for the Vue compiler that will be passed at build time
* Options for the Vue compiler that will be passed at build time.
* @see [documentation](https://vuejs.org/api/application.html#app-config-compileroptions)
* @type {typeof import('@vue/compiler-core').CompilerOptions}
* @version 3
@ -60,12 +60,12 @@ export default {
/**
* An absolute URL to serve the public folder from (production-only).
*
* This can be set to a different value at runtime by setting the NUXT_APP_CDN_URL environment variable.
* This can be set to a different value at runtime by setting the `NUXT_APP_CDN_URL` environment variable.
* @example
* ```bash
* NUXT_APP_CDN_URL=https://mycdn.org/ node .output/server/index.mjs
* ```
*/
*/
cdnURL: {
$resolve: (val, get) => get('dev') ? '' : (process.env.NUXT_APP_CDN_URL ?? val) || ''
},
@ -123,11 +123,11 @@ export default {
return resolved
}
},
}
},
/**
* The path to a templated HTML file for rendering Nuxt responses.
* Uses `<srcDir>/app.html` if it exists or the Nuxt default template if not.
* The path to an HTML template file for rendering Nuxt responses.
* Uses `<srcDir>/app.html` if it exists, or the Nuxt's default template if not.
*
* @example
* ```html
@ -156,9 +156,9 @@ export default {
},
/**
* Enable or disable vuex store.
* Enable or disable Vuex store.
*
* By default it is enabled if there is a `store/` directory
* By default, it is enabled if there is a `store/` directory.
* @version 2
*/
store: {
@ -263,7 +263,7 @@ export default {
* @example
* ```js
* css: [
* // Load a Node.js module directly (here it's a Sass file)
* // Load a Node.js module directly (here it's a Sass file).
* 'bulma',
* // CSS file in the project
* '@/assets/css/main.css',
@ -282,7 +282,7 @@ export default {
/**
* An object where each key name maps to a path to a layout .vue file.
*
* Normally there is no need to configure this directly.
* Normally, there is no need to configure this directly.
* @type {Record<string, string>}
* @version 2
*/
@ -291,7 +291,7 @@ export default {
/**
* Set a custom error page layout.
*
* Normally there is no need to configure this directly.
* Normally, there is no need to configure this directly.
* @type {string}
* @version 2
*/
@ -304,11 +304,11 @@ export default {
* @version 2
*/
loading: {
/** CSS color of the progress bar */
/** CSS color of the progress bar. */
color: 'black',
/**
* CSS color of the progress bar when an error appended while rendering
* the route (if data or fetch sent back an error for example).
* the route (if data or fetch sent back an error, for example).
*/
failedColor: 'red',
/** Height of the progress bar (used in the style property of the progress bar). */
@ -327,7 +327,7 @@ export default {
continuous: false,
/** Set the direction of the progress bar from right to left. */
rtl: false,
/** Set to false to remove default progress bar styles (and add your own). */
/** Set to `false` to remove default progress bar styles (and add your own). */
css: true
},
@ -337,7 +337,7 @@ export default {
* Set to `false` to disable. Alternatively, you can pass a string name or an object for more
* configuration. The name can refer to an indicator from [SpinKit](https://tobiasahlin.com/spinkit/)
* or a path to an HTML template of the indicator source code (in this case, all the
* other options will be passed to the template.)
* other options will be passed to the template).
* @version 2
*/
loadingIndicator: {

View File

@ -8,7 +8,7 @@ import { RuntimeConfig } from '../types/config'
export default {
/**
* Extend nested configurations from multiple local or remote sources
* Extend nested configurations from multiple local or remote sources.
*
* Value should be either a string or array of strings pointing to source directories or config path relative to current config.
*
@ -38,7 +38,7 @@ export default {
/**
* Define the source directory of your Nuxt application.
*
* If a relative path is specified it will be relative to the `rootDir`.
* If a relative path is specified, it will be relative to the `rootDir`.
*
* @example
* ```js
@ -91,22 +91,22 @@ export default {
/**
* Whether Nuxt is running in development mode.
*
* Normally you should not need to set this.
* Normally, you should not need to set this.
* @version 2
* @version 3
*/
dev: Boolean(isDevelopment),
/**
* Whether your app is being unit tested
* Whether your app is being unit tested.
* @version 2
*/
test: Boolean(isDevelopment),
/**
* Set to true to enable debug mode.
* Set to `true` to enable debug mode.
*
* By default it's only enabled in development mode.
* By default, it's only enabled in development mode.
* @version 2
*/
debug: {
@ -114,9 +114,9 @@ export default {
},
/**
* The env property defines environment variables that should be available
* The `env` property defines environment variables that should be available
* throughout your app (server- and client-side). They can be assigned using
* server side environment variables.
* server-side environment variables.
*
* @note Nuxt uses webpack's `definePlugin` to define these environment variables.
* This means that the actual `process` or `process.env` from Node.js is neither
@ -185,7 +185,7 @@ export default {
ssr: true,
/**
* @deprecated use ssr option
* @deprecated use `ssr` option
*/
mode: {
$resolve: (val, get) => val || (get('ssr') ? 'spa' : 'universal'),
@ -216,7 +216,7 @@ export default {
modern: undefined,
/**
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations.
*
* 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.
@ -248,7 +248,7 @@ export default {
/**
* Modules that are only required during development and build time.
*
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations
* Modules are Nuxt extensions which can extend its core functionality and add endless integrations.
*
* 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.
@ -283,18 +283,18 @@ export default {
buildModules: [],
/**
* Built-in ad-hoc modules
* Built-in ad-hoc modules.
*
* @private
*/
_modules: [],
/**
* Installed module metadata
* Installed module metadata.
*
* @version 3
* @private
*/
*/
_installedModules: [],
/**
@ -333,8 +333,8 @@ export default {
* for an external server.
*
* You can pass a string, which can be the name of a node dependency or a path to a file. You
* can also pass an object with `path` and `handler` keys. (`handler` can be a path or a
* function.)
* can also pass an object with `path` and `handler` keys (`handler` can be a path or a
* function).
*
* @note If you pass a function directly, it will only run in development mode.
*
@ -434,7 +434,7 @@ export default {
},
/**
* Customize default directory structure used by nuxt.
* Customize default directory structure used by Nuxt.
*
* It is better to stick with defaults unless needed.
* @version 2
@ -442,7 +442,7 @@ export default {
*/
dir: {
/**
* The assets directory (aliased as `~assets` in your build)
* The assets directory (aliased as `~assets` in your build).
* @version 2
*/
assets: 'assets',
@ -737,7 +737,7 @@ export default {
* @type {typeof import('../src/types/config').PrivateRuntimeConfig}
* @version 2
* @version 3
* @deprecated Use `runtimeConfig` option
* @deprecated Use `runtimeConfig` option.
*/
privateRuntimeConfig: {},
@ -745,7 +745,7 @@ export default {
* @type {typeof import('../src/types/config').PublicRuntimeConfig}
* @version 2
* @version 3
* @deprecated Use `runtimeConfig` option with `public` key (`runtimeConfig.public.*`)
* @deprecated Use `runtimeConfig` option with `public` key (`runtimeConfig.public.*`).
*/
publicRuntimeConfig: {}
}

View File

@ -20,7 +20,7 @@ export default {
webpack: '@nuxt/webpack-builder',
}
return map[val] || (get('vite') === false ? map.webpack : map.vite)
},
}
},
/**
* Whether to generate sourcemaps.
@ -159,7 +159,7 @@ export default {
/**
* Enable caching for [`terser-webpack-plugin`](https://github.com/webpack-contrib/terser-webpack-plugin#options)
* and [`cache-loader`](https://github.com/webpack-contrib/cache-loader#cache-loader)
* and [`cache-loader`](https://github.com/webpack-contrib/cache-loader#cache-loader).
*
* @warning This is an unstable feature.
* @version 2
@ -167,7 +167,7 @@ export default {
cache: false,
/**
* Inline server bundle dependencies
* Inline server bundle dependencies.
*
* This mode bundles `node_modules` that are normally preserved as externals in the server build.
*
@ -618,7 +618,7 @@ export default {
]
},
/**
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin)
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin).
* @version 2
*/
friendlyErrors: true,

View File

@ -9,34 +9,34 @@ export default {
},
/**
* Use vite-node for on-demand server chunk loading
* Use `vite-node` for on-demand server chunk loading.
*/
viteNode: process.env.EXPERIMENTAL_VITE_NODE ? true : false,
/**
* Enable Vue's reactivity transform
* Enable Vue's reactivity transform.
* @see https://vuejs.org/guide/extras/reactivity-transform.html
*/
reactivityTransform: false,
/**
* Externalize `vue`, `@vue/*` and `vue-router` when build
* Externalize `vue`, `@vue/*` and `vue-router` when building.
* @see https://github.com/nuxt/framework/issues/4084
*/
externalVue: false,
/**
* Tree shakes contents of client-only components from server bundle
* Tree shakes contents of client-only components from server bundle.
* @see https://github.com/nuxt/framework/pull/5750
*/
treeshakeClientOnly: false,
/**
* Split server bundle into multiple chunks and dynamically import them
* Split server bundle into multiple chunks and dynamically import them.
*
*
* @see https://github.com/nuxt/framework/issues/6432
*/
viteServerDynamicImports: true,
viteServerDynamicImports: true
}
}

View File

@ -115,12 +115,12 @@ export default {
* routes can be rendered (on the client-side) by Nuxt.
*
* * If unset or set to a falsy value, the name of the fallback HTML file will be `200.html`.
* * If set to true, the filename will be `404.html`.
* * If set to `true`, the filename will be `404.html`.
* * If you provide a string as a value, it will be used instead.
*
* @note Multiple services (e.g. Netlify) detect a `404.html` automatically. If
* you configure your web server on your own, please consult its documentation
* to find out how to set up an error page (and set it to the 404.html file)
* to find out how to set up an error page (and set it to the `404.html` file).
*/
fallback: { $resolve: val => val === true ? '400.html' : (val || '200.html') },

View File

@ -1,17 +1,17 @@
export default {
/**
* Configuration for Nitro
* Configuration for Nitro.
*
* @see https://nitro.unjs.io/config/
*
* @type {typeof import('nitropack')['NitroConfig']}
* @version 2
* @version 3
*/
*/
nitro: {},
/**
* Nitro server handlers
* Nitro server handlers.
*
* @see https://nitro.unjs.io/guide/routing.html
*
@ -23,12 +23,12 @@ export default {
serverHandlers: [],
/**
* Nitro devevelopment-only server handlers
* Nitro development-only server handlers.
*
* @see https://nitro.unjs.io/guide/routing.html
*
* @type {typeof import('nitropack')['NitroDevEventHandler'][]}
* @version 3
*/
devServerHandlers: []
devServerHandlers: []
}

View File

@ -30,24 +30,24 @@ export default {
/**
* Whether to enable rendering of HTML - either dynamically (in server mode) or at generate time.
*
* This option is automatically set based on global ssr value if not provided.
* This can be useful to dynamically enable/disable SSR on runtime after image builds
* (with docker for example).
* This option is automatically set based on global SSR value if not provided.
* This can be useful to dynamically enable/disable SSR at runtime after image builds
* (with docker, for example).
*/
ssr: undefined,
/**
* Forward server-side logs to the browser for better debugging (only available in development)
* Forward server-side logs to the browser for better debugging (only available in development).
*
* Set to `collapsed` to collapse the logs, or false to disable.
* Set to `collapsed` to collapse the logs, or `false` to disable.
*/
ssrLog: { $resolve: (val, get) => get('dev') ? Boolean(val) : false },
/**
* Configuration for HTTP2 push headers
* Configuration for HTTP2 push headers.
*/
http2: {
/** Set to true to enable HTTP2 push headers */
/** Set to true to enable HTTP2 push headers. */
push: false,
/** @deprecated */
shouldPush: null,
@ -142,7 +142,7 @@ export default {
* to serve your SSR application.
*
* **Updating settings**:
* These settings are read by the Nuxt server directly from `nuxt.config.js`.
* These settings are read by the Nuxt server directly from `nuxt.config`.
* This means changes to these settings take effect when the server is restarted.
* There is no need to rebuild the application to update CSP settings.
*
@ -169,7 +169,7 @@ export default {
* for logging and analytic tracking.
*
* Review [this blog on Sentry.io](https://blog.sentry.io/2018/09/04/how-sentry-captures-csp-violations)
* To learn what tracking link you should use.
* to learn what tracking link you should use.
* @example
* ```js
* // PRIMARY_HOSTS = `loc.example-website.com`
@ -226,7 +226,7 @@ export default {
*/
addMeta: Boolean(get('target') === 'static'),
/**
* Set option `unsafeInlineCompatibility` to true if you want both hashes and
* Set option `unsafeInlineCompatibility` to `true` if you want both hashes and
* 'unsafe-inline' for CSPv1 compatibility. In that case the `<meta>` tag will
* still only contain the hashes of the inline `<script>` tags, and the policies
* defined under `csp.policies` will be used in the `Content-Security-Policy`
@ -272,14 +272,14 @@ export default {
*/
fallback: {
/**
* For routes matching the publicPath (`/_nuxt/*`)
* Disable by setting to false.
* For routes matching the publicPath (`/_nuxt/*`).
* Disable by setting to `false`.
*/
dist: {},
/**
* For all other routes (`/*`)
* Disable by setting to false.
* For all other routes (`/*`).
* Disable by setting to `false`.
*/
static: {
skipUnknown: true,

View File

@ -2,31 +2,30 @@ import { normalizeURL, withTrailingSlash } from 'ufo'
export default {
/**
* Additional options passed to vue-router
* Additional options passed to `vue-router`.
*
* Note: Only JSON serializable options should be passed by nuxt config.
*
* For more control, you can use `app/router.optionts.ts` file.
*
* @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html)
* @see [documentation](https://router.vuejs.org/api/interfaces/routeroptions.html).
* @type {import('../src/types/router').RouterConfigSerializable}
*
* @version 3
*/
options: {},
/**
* Configure the router mode.
*
* For server-side rendering it is not recommended to change it./**
* For server-side rendering it is not recommended to change it.
* @version 2
*/
mode: 'history',
/**
* The base URL of the app. For example, if the entire single page application is
* served under /app/, then base should use the value '/app/'.
* served under `/app/`, then base should use the value `'/app/'`.
*
* This can be useful if you need to serve Nuxt as a different context root, from
* within a bigger web site.
@ -75,7 +74,7 @@ export default {
linkExactActiveClass: 'nuxt-link-exact-active',
/**
* Globally configure `<nuxt-link>` default prefetch class (feature disabled by default)
* Globally configure `<nuxt-link>` default prefetch class (feature disabled by default).
* @version 2
*/
linkPrefetchedClass: false,
@ -105,9 +104,9 @@ export default {
/**
* The `scrollBehavior` option lets you define a custom behavior for the scroll
* position between the routes. This method is called every time a page is
* rendered. To learn more about it.
* rendered. To learn more about it, see the `vue-router` documentation.
*
* @see [vue-router `scrollBehavior` documentation](https://router.vuejs.org/guide/advanced/scroll-behavior.html)
* @see [vue-router `scrollBehavior` documentation](https://router.vuejs.org/guide/advanced/scroll-behavior.html).
* @version 2
*/
scrollBehavior: {
@ -130,9 +129,9 @@ export default {
/**
* Controls whether the router should fall back to hash mode when the browser
* does not support history.pushState but mode is set to history.
* does not support history.pushState, but mode is set to history.
*
* Setting this to false essentially makes every router-link navigation a full
* Setting this to `false` essentially makes every router-link navigation a full
* page refresh in IE9. This is useful when the app is server-rendered and needs
* to work in IE9, because a hash mode URL does not work with SSR.
* @version 2
@ -147,7 +146,7 @@ export default {
prefetchLinks: true,
/**
* When using nuxt generate with target: 'static', Nuxt will generate a
* When using `nuxt generate` with target: 'static', Nuxt will generate a
* payload.js for each page.
*
* With this option enabled, Nuxt will automatically prefetch the payload of the
@ -157,15 +156,15 @@ export default {
prefetchPayloads: true,
/**
* If this option is set to true, trailing slashes will be appended to every
* route. If set to false, they'll be removed.
* If this option is set to `true`, trailing slashes will be appended to every
* route. If set to `false`, they'll be removed.
*
* @warning This option should not be set without preparation and has to
* be tested thoroughly. When setting `trailingSlash` to something else than
* undefined, the opposite route will stop working. Thus 301 redirects should
* `undefined`, the opposite route will stop working. Thus, 301 redirects should
* be in place and your internal linking has to be adapted correctly. If you set
* `trailingSlash` to true, then only example.com/abc/ will work but not
* example.com/abc. On false, it's vice-versa
* `trailingSlash` to `true`, then only `example.com/abc/` will work, but not
* `example.com/abc`. On `false`, it's vice-versa.
* @version 2
*/
trailingSlash: undefined

View File

@ -23,7 +23,7 @@ export default {
typeCheck: false,
/**
* You can extend generated `.nuxt/tsconfig.json` using this option
* You can extend generated `.nuxt/tsconfig.json` using this option.
* @type {typeof import('pkg-types')['readPackageJSON']}
*/
tsConfig: {},

View File

@ -13,10 +13,10 @@ export default {
*/
vite: {
root: {
$resolve: (val, get) => val ?? get('srcDir'),
$resolve: (val, get) => val ?? get('srcDir')
},
mode: {
$resolve: (val, get) => val ?? (get('dev') ? 'development' : 'production'),
$resolve: (val, get) => val ?? (get('dev') ? 'development' : 'production')
},
logLevel: 'warn',
define: {
@ -26,27 +26,29 @@ export default {
})
},
resolve: {
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
},
publicDir: {
$resolve: (val, get) => val ?? resolve(get('srcDir'), get('dir').public),
$resolve: (val, get) => val ?? resolve(get('srcDir'), get('dir').public)
},
vue: {
isProduction: {
$resolve: (val, get) => val ?? !get('dev'),
},
template: { compilerOptions: {
$resolve: (val, get) => val ?? get('vue').compilerOptions }
$resolve: (val, get) => val ?? !get('dev')
},
template: {
compilerOptions: {
$resolve: (val, get) => val ?? get('vue').compilerOptions
}
}
},
optimizeDeps: {
exclude: {
$resolve: (val, get) => [
...val || [],
...get('build.transpile').filter(i => typeof i === 'string'),
'vue-demi'
],
},
...get('build.transpile').filter((i) => typeof i === 'string'),
'vue-demi'
]
}
},
esbuild: {
jsxFactory: 'h',
@ -56,9 +58,9 @@ export default {
clearScreen: false,
build: {
assetsDir: {
$resolve: (val, get) => val ?? withoutLeadingSlash(get('app').buildAssetsDir),
$resolve: (val, get) => val ?? withoutLeadingSlash(get('app').buildAssetsDir)
},
emptyOutDir: false,
emptyOutDir: false
},
server: {
fs: {

View File

@ -35,7 +35,7 @@ export default {
*
* It is normally enabled by CLI argument `--profile`.
*
* @see [webpackbar](https://github.com/unjs/webpackbar#profile)
* @see [webpackbar](https://github.com/unjs/webpackbar#profile).
*/
profile: process.argv.includes('--profile'),
@ -91,7 +91,7 @@ export default {
extractCSS: true,
/**
* Enables CSS source map support (defaults to true in development)
* Enables CSS source map support (defaults to `true` in development).
*/
cssSourceMap: {
$resolve: (val, get) => val ?? get('dev')
@ -211,7 +211,7 @@ export default {
*
* Set to false to disable this plugin, or pass an object of options.
*
* @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin)
* @see [terser-webpack-plugin documentation](https://github.com/webpack-contrib/terser-webpack-plugin).
*
* @note Enabling sourceMap will leave `//# sourceMappingURL` linking comment at
* the end of each output file if webpack `config.devtool` is set to `source-map`.
@ -246,7 +246,7 @@ export default {
*/
optimization: {
runtimeChunk: 'single',
/** Set minimize to false to disable all minimizers. (It is disabled in development by default) */
/** Set minimize to `false` to disable all minimizers. (It is disabled in development by default). */
minimize: { $resolve: (val, get) => val ?? !get('dev') },
/** You can set minimizer to a customized array of plugins. */
minimizer: undefined,
@ -288,7 +288,7 @@ export default {
*/
hotMiddleware: {},
/**
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin)
* Set to `false` to disable the overlay provided by [FriendlyErrorsWebpackPlugin](https://github.com/nuxt/friendly-errors-webpack-plugin).
*/
friendlyErrors: true,
/**

View File

@ -10,8 +10,8 @@ export interface NuxtCompatibility {
/**
* Bridge constraint for Nuxt 2 support.
*
* - `true`: When using Nuxt 2, using bridge module is required
* - `false`: When using Nuxt 2, using bridge module is not supported
* - `true`: When using Nuxt 2, using bridge module is required.
* - `false`: When using Nuxt 2, using bridge module is not supported.
*/
bridge?: boolean
}
@ -23,7 +23,7 @@ export interface NuxtCompatibilityIssue {
export interface NuxtCompatibilityIssues extends Array<NuxtCompatibilityIssue> {
/**
* Return formatted error message
* Return formatted error message.
*/
toString(): string
}

View File

@ -23,7 +23,7 @@ export interface Component {
export interface ScanDir {
/**
* Path (absolute or relative) to the directory containing your components.
* You can use Nuxt aliases (~ or @) to refer to directories inside project or directly use a npm package path similar to require.
* You can use Nuxt aliases (~ or @) to refer to directories inside project or directly use an npm package path similar to require.
*/
path: string
/**
@ -39,7 +39,7 @@ export interface ScanDir {
*/
prefix?: string
/**
* Prefix component name by it's path.
* Prefix component name by its path.
*/
pathPrefix?: boolean
/**
@ -62,7 +62,7 @@ export interface ScanDir {
*/
preload?: boolean
/**
* This flag indicates, component should be loaded async (with a seperate chunk) regardless of using Lazy prefix or not.
* This flag indicates, component should be loaded async (with a separate chunk) regardless of using Lazy prefix or not.
*/
isAsync?: boolean

View File

@ -2,7 +2,7 @@ import { UnimportOptions } from 'unimport'
export interface AutoImportsOptions extends UnimportOptions {
dirs?: string[]
global?: boolean,
global?: boolean
transform?: {
exclude?: RegExp[]
include?: RegExp[]

View File

@ -3,10 +3,10 @@ import type { Nuxt, NuxtTemplate } from "./nuxt"
import type { NuxtCompatibility } from './compatibility'
export interface ModuleMeta {
/** Module name */
/** Module name. */
name?: string
/** Module version */
/** Module version. */
version?: string
/**
@ -16,17 +16,17 @@ export interface ModuleMeta {
configKey?: string
/**
* Constraints for the versions of Nuxt or features this module requires
* Constraints for the versions of Nuxt or features this module requires.
*/
compatibility?: NuxtCompatibility
[key: string]: any
}
/** The options received */
/** The options received. */
export type ModuleOptions = Record<string, any>
/** Input module passed to defineNuxtModule */
/** Input module passed to defineNuxtModule. */
export interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
meta?: ModuleMeta
defaults?: T | ((nuxt: Nuxt) => T)
@ -35,7 +35,7 @@ export interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
setup?: (this: void, resolvedOptions: T, nuxt: Nuxt) => void | Promise<void>
}
/** Nuxt modules are always a simple function */
/** Nuxt modules are always a simple function. */
export interface NuxtModule<T extends ModuleOptions = ModuleOptions> {
(this: void, inlineOptions: T, nuxt: Nuxt): void | Promise<void>
getOptions?: (inlineOptions?: T, nuxt?: Nuxt) => Promise<T>
@ -58,10 +58,10 @@ export interface ModuleContainer {
/** Renders given template using lodash template during build into the project buildDir (`.nuxt`).*/
addTemplate(template: string | NuxtTemplate): NuxtTemplate
/** Register a custom layout. If its name is 'error' it will override the default error layout. */
/** Registers a custom layout. If its name is 'error' it will override the default error layout. */
addLayout(tmpl: NuxtTemplate, name: string): any
/** Set the layout that will render Nuxt errors. It should already have been added via addLayout or addTemplate. */
/** Sets the layout that will render Nuxt errors. It should already have been added via addLayout or addTemplate. */
addErrorLayout(dst: string): void
/** Adds a new server middleware to the end of the server middleware array. */
@ -73,9 +73,9 @@ export interface ModuleContainer {
/** Allows extending routes by chaining `options.router.extendRoutes` function. */
extendRoutes(fn): void
/** Registers a module */
/** Registers a module. */
requireModule(installOptions: any, opts: any): Promise<void>
/** Registers a module */
/** Registers a module. */
addModule(installOptions: any, opts: any): Promise<void>
}

View File

@ -4,7 +4,7 @@ import type { NuxtHooks, NuxtLayout, NuxtMiddleware } from './hooks'
import type { NuxtOptions } from './config'
export interface Nuxt {
// Private fields
// Private fields.
_version: string
_ignore?: Ignore
@ -18,7 +18,7 @@ export interface Nuxt {
ready: () => Promise<void>
close: () => Promise<void>
/** The production or development server */
/** The production or development server. */
server?: any
vfs: Record<string, string>
@ -37,7 +37,7 @@ export interface NuxtTemplate {
options?: Record<string, any>
/** The resolved path to the source file to be template */
src?: string
/** Provided compile option intead of src */
/** Provided compile option instead of src */
getContents?: (data: Record<string, any>) => string | Promise<string>
/** Write to filesystem */
write?: boolean