Skip to content

Commit

Permalink
docs: fix typos (nuxt#18976)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lioness100 authored Feb 12, 2023
1 parent 7111b6c commit b25b6c8
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/3.api/4.advanced/1.hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/other/locale/app.vue
Original file line number Diff line number Diff line change
@@ -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 */)
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/loader/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/src/app/components/nuxt-root.vue
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/composables/asyncData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/composables/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/app/plugins/payload.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/src/core/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions packages/nuxt/test/treeshake-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
}
})
2 changes: 1 addition & 1 deletion packages/test-utils/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/composables/badSideEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit b25b6c8

Please sign in to comment.