refactor: fix typo and code improvements (#5344)

This commit is contained in:
Xin Du (Clark) 2022-06-08 20:49:11 +01:00 committed by GitHub
parent eafd92c457
commit 139fc11c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 12 additions and 12 deletions

View File

@ -20,7 +20,7 @@ Once you have installed the modules you can then add them to your `nuxt.config.t
```ts{}[nuxt.config.ts]
export default defineNuxtConfig({
modules: [
// Using package name (recommanded usage)
// Using package name (recommended usage)
'@nuxtjs/example',
// Load a local module

View File

@ -196,7 +196,7 @@ export default (req, res) => {
```
::alert{type=warning}
Legacy support is possible using [unjs/h3](https://github.com/unjs/h3) but it adviced to avoid legacy handlers as much as you can.
Legacy support is possible using [unjs/h3](https://github.com/unjs/h3) but it advised to avoid legacy handlers as much as you can.
::
```ts [/server/middleware/legacy.ts]

View File

@ -23,7 +23,7 @@ Nuxt provides the `<NuxtErrorBoundary>` component to handle client-side errors h
<NuxtErrorBoundary>
<!-- ... -->
<template #error="{ error }">
<p>An error occured: {{ error }}</p>
<p>An error occurred: {{ error }}</p>
</template>
</NuxtErrorBoundary>
</template>

View File

@ -8,6 +8,6 @@ The `init` command initializes a fresh Nuxt project.
Option | Default | Description
-------------------------|-----------------|------------------
`--verbose, -v` | `false` | Log informations about the installation process.
`--verbose, -v` | `false` | Log information about the installation process.
`--template, -t` | `nuxt/starter#v3` | Specify a Git repository to use as a template.
`dir` | `nuxt-app` | Name of the install directory.

View File

@ -22,7 +22,7 @@ export async function checkNuxtCompatibility (constraints: NuxtCompatibility, nu
// Bridge compatibility check
if (isNuxt2(nuxt)) {
const bridgeRequirement = constraints?.bridge
const bridgeRequirement = constraints.bridge
const hasBridge = !!(nuxt.options as any).bridge
if (bridgeRequirement === true && !hasBridge) {
issues.push({
@ -86,7 +86,7 @@ export function isNuxt3 (nuxt: Nuxt = useNuxt()) {
export function getNuxtVersion (nuxt: Nuxt | any = useNuxt() /* TODO: LegacyNuxt */) {
const version = (nuxt?._version || nuxt?.version || nuxt?.constructor?.version || '').replace(/^v/g, '')
if (!version) {
throw new Error('Cannot determine nuxt version! Is currect instance passed?')
throw new Error('Cannot determine nuxt version! Is current instance passed?')
}
return version
}

View File

@ -26,7 +26,7 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: Mo
// @ts-ignore TODO: Remove non-meta fallbacks in RC
definition.meta.name = definition.meta.name || definition.name
// @ts-ignore
definition.meta.configKey = definition.meta.configKey || definition.configKey || definition.meta.name
definition.meta.configKey = definition.configKey || definition.meta.name
}
// Resolves module options from inline options, [configKey] in nuxt.config, defaults and schema

View File

@ -119,7 +119,7 @@ async function initNuxt (nuxt: Nuxt) {
await nuxt.callHook('modules:done', { nuxt } as ModuleContainer)
await addModuleTranspiles()
addModuleTranspiles()
// Init nitro
await initNitro(nuxt)

View File

@ -50,8 +50,8 @@ function getManifest (server: ViteDevServer) {
function createViteNodeMiddleware (ctx: ViteBuildContext) {
const app = createApp()
app.use('/manifest', defineEventHandler(async () => {
const manifest = await getManifest(ctx.ssrServer)
app.use('/manifest', defineEventHandler(() => {
const manifest = getManifest(ctx.ssrServer)
return manifest
}))

View File

@ -60,7 +60,7 @@ export const getPostcssConfig = (nuxt: Nuxt) => {
return false
}
const configFile = nuxt.options.postcss?.config
const configFile = nuxt.options.postcss.config
if (configFile) {
return {
postcssOptions: {

View File

@ -18,7 +18,7 @@ import { createWebpackConfigContext, applyPresets, getWebpackConfig } from './ut
// const plugins: string[] = []
export async function bundle (nuxt: Nuxt) {
await registerVirtualModules()
registerVirtualModules()
const webpackConfigs = [client, ...nuxt.options.ssr ? [server] : []].map((preset) => {
const ctx = createWebpackConfigContext(nuxt)