docs: fix typos (#18976)

This commit is contained in:
Lioness100 2023-02-12 14:16:42 -05:00 committed by GitHub
parent 7111b6cf44
commit b25b6c82c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 26 additions and 26 deletions

View File

@ -18,7 +18,7 @@ Hook | Arguments | Environment | Description
`app:error:cleared` | `{ redirect? }` | Server & Client | Called when a fatal error occurs.
`app:data:refresh` | `keys?` | Server & Client | (internal)
`vue:setup` | - | Server & Client | (internal)
`vue:error` | `err, target, info` | Server & Client | Called when a vue error propages to the root component. [Learn More](https://vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured).
`vue:error` | `err, target, info` | Server & Client | Called when a vue error propagates to the root component. [Learn More](https://vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured).
`app:rendered` | `renderContext` | Server | Called when SSR rendering is done.
`app:redirected` | - | Server | Called before SSR redirection.
`app:beforeMount` | `vueApp` | Client | Called before mounting the app, called only on client side.

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
// see ../compoables/locale.ts for the implementation
// see ../composables/locale.ts for the implementation
const locales = useLocales()
const locale = useLocale()
const date = useLocaleDate(new Date('2016-10-26') /* NUXT_BIRTHDAY */)

View File

@ -51,7 +51,7 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
for: opts.dev ? 'dev' : 'build',
configOverrides: opts.overrides,
ready: opts.ready,
envConfig: opts.dotenv // TODO: Backward format convertion
envConfig: opts.dotenv // TODO: Backward format conversion
})
return nuxt as Nuxt

View File

@ -1,7 +1,7 @@
<template>
<Suspense @resolve="onResolve">
<ErrorComponent v-if="error" :error="error" />
<IslandRendererer v-else-if="islandContext" :context="islandContext" />
<IslandRenderer v-else-if="islandContext" :context="islandContext" />
<AppComponent v-else />
</Suspense>
</template>
@ -14,7 +14,7 @@ import { useRoute } from '#app/composables/router'
import AppComponent from '#build/app-component.mjs'
const ErrorComponent = defineAsyncComponent(() => import('#build/error-component.mjs').then(r => r.default || r))
const IslandRendererer = process.server
const IslandRenderer = process.server
? defineAsyncComponent(() => import('./island-renderer').then(r => r.default || r))
: () => null

View File

@ -121,7 +121,7 @@ export function useAsyncData<
error: ref(nuxt.payload._errors[key] ? createError(nuxt.payload._errors[key]) : null)
}
}
// TODO: Else, Soemhow check for confliciting keys with different defaults or fetcher
// TODO: Else, somehow check for conflicting keys with different defaults or fetcher
const asyncData = { ...nuxt._asyncData[key] } as AsyncData<DataT, DataE>
asyncData.refresh = asyncData.execute = (opts = {}) => {

View File

@ -82,7 +82,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na
const toPath = typeof to === 'string' ? to : ((to as RouteLocationPathRaw).path || '/')
const isExternal = hasProtocol(toPath, true)
if (isExternal && !options?.external) {
throw new Error('Navigating to external URL is not allowed by default. Use `nagivateTo (url, { external: true })`.')
throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.')
}
if (isExternal && parseURL(toPath).protocol === 'script:') {
throw new Error('Cannot navigate to an URL with script protocol.')

View File

@ -5,7 +5,7 @@ import { useRouter } from '#app/composables/router'
export default defineNuxtPlugin((nuxtApp) => {
// Only enable behavior if initial page is prerendered
// TOOD: Support hybrid and dev
// TODO: Support hybrid and dev
if (!isPrerendered()) {
return
}

View File

@ -374,7 +374,7 @@ function renderHTMLDocument (html: NuxtRenderHTMLContext) {
</html>`
}
// TOOD: Move to external library
// TODO: Move to external library
const HTML_TAG_RE = /<(?<tag>[a-z]+)(?<rawAttrs> [^>]*)?>(?:(?<innerHTML>[\s\S]*?)<\/\k<tag>)?/g
const HTML_TAG_ATTR_RE = /(?<name>[a-z]+)="(?<value>[^"]*)"/g
function extractHTMLTags (html: string) {

View File

@ -50,7 +50,7 @@ export default defineNuxtModule({
schema = await resolveSchema()
})
// Writie schema after build to allow further modifications
// Write schema after build to allow further modifications
nuxt.hooks.hook('build:done', async () => {
await nuxt.hooks.callHook('schema:beforeWrite', schema)
await writeSchema(schema)
@ -112,7 +112,7 @@ export default defineNuxtModule({
)
// @ts-expect-error
// Merge after normalazation
// Merge after normalization
const schema = defu(...schemas)
// Allow hooking to extend resolved schema

View File

@ -95,40 +95,40 @@ describe('treeshake client only in ssr', () => {
const ssrResult = await SFCCompile(`SomeComponent${index}.vue`, WithClientOnly, state.options, true)
const treeshaked = await treeshake(ssrResult)
const treeshaken = await treeshake(ssrResult)
const [_, scopeId] = clientResult.match(/_pushScopeId\("(.*)"\)/)!
// ensure the id is correctly passed between server and client
expect(clientResult).toContain(`pushScopeId("${scopeId}")`)
expect(treeshaked).toContain(`<div ${scopeId}>`)
expect(treeshaken).toContain(`<div ${scopeId}>`)
expect(clientResult).toContain('should-be-treeshaken')
expect(treeshaked).not.toContain('should-be-treeshaken')
expect(treeshaken).not.toContain('should-be-treeshaken')
expect(treeshaked).not.toContain("import HelloWorld from '../HelloWorld.vue'")
expect(treeshaken).not.toContain("import HelloWorld from '../HelloWorld.vue'")
expect(clientResult).toContain("import HelloWorld from '../HelloWorld.vue'")
expect(treeshaked).not.toContain("import { Treeshaken } from 'somepath'")
expect(treeshaken).not.toContain("import { Treeshaken } from 'somepath'")
expect(clientResult).toContain("import { Treeshaken } from 'somepath'")
// remove resolved import
expect(treeshaked).not.toContain('const _component_ResolvedImport =')
expect(treeshaken).not.toContain('const _component_ResolvedImport =')
expect(clientResult).toContain('const _component_ResolvedImport =')
// expect import of ClientImport to be treeshaken but not Glob since it is also used outside <ClientOnly>
expect(treeshaked).not.toContain('ClientImport')
expect(treeshaked).toContain('import { Glob, } from \'#components\'')
expect(treeshaken).not.toContain('ClientImport')
expect(treeshaken).toContain('import { Glob, } from \'#components\'')
if (state.options.isProduction === false) {
// treeshake at inlined template
expect(treeshaked).not.toContain('ssrRenderComponent($setup["HelloWorld"]')
expect(treeshaked).toContain('ssrRenderComponent($setup["Glob"]')
expect(treeshaken).not.toContain('ssrRenderComponent($setup["HelloWorld"]')
expect(treeshaken).toContain('ssrRenderComponent($setup["Glob"]')
} else {
// treeshake unref
expect(treeshaked).not.toContain('ssrRenderComponent(_unref(HelloWorld')
expect(treeshaked).toContain('ssrRenderComponent(_unref(Glob')
expect(treeshaken).not.toContain('ssrRenderComponent(_unref(HelloWorld')
expect(treeshaken).toContain('ssrRenderComponent(_unref(Glob')
}
expect(treeshaked).toMatchSnapshot()
expect(treeshaken).toMatchSnapshot()
})
}
})

View File

@ -7,7 +7,7 @@ export async function createBrowser () {
let playwright: typeof import('playwright')
try {
// Workround for https://github.com/nuxt/nuxt/issues/13441
// Workaround for https://github.com/nuxt/nuxt/issues/13441
// TODO: Remove when upstream issue resolved
playwright = await import(String('playwright'))
} catch {

View File

@ -2,4 +2,4 @@ export function badSideEffect () {
// ...
}
throw new Error('composables/badSideEffect.ts should be tree-shaked')
throw new Error('composables/badSideEffect.ts should be tree-shaken')