mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
feat(nuxt)!: add <NuxtPage>
to #components
(#8145)
This commit is contained in:
parent
2083ed4a63
commit
23ad303f19
@ -1,5 +1,5 @@
|
|||||||
import { existsSync } from 'node:fs'
|
import { existsSync } from 'node:fs'
|
||||||
import { defineNuxtModule, addTemplate, addPlugin, addVitePlugin, addWebpackPlugin, findPath } from '@nuxt/kit'
|
import { defineNuxtModule, addTemplate, addPlugin, addVitePlugin, addWebpackPlugin, findPath, addComponent } from '@nuxt/kit'
|
||||||
import { relative, resolve } from 'pathe'
|
import { relative, resolve } from 'pathe'
|
||||||
import { genString, genImport, genObjectFromRawEntries } from 'knitwork'
|
import { genString, genImport, genObjectFromRawEntries } from 'knitwork'
|
||||||
import escapeRE from 'escape-string-regexp'
|
import escapeRE from 'escape-string-regexp'
|
||||||
@ -190,6 +190,12 @@ export default defineNuxtModule({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Add <NuxtPage>
|
||||||
|
addComponent({
|
||||||
|
name: 'NuxtPage',
|
||||||
|
filePath: resolve(distDir, 'pages/runtime/page')
|
||||||
|
})
|
||||||
|
|
||||||
// Add declarations for middleware keys
|
// Add declarations for middleware keys
|
||||||
nuxt.hook('prepare:types', ({ references }) => {
|
nuxt.hook('prepare:types', ({ references }) => {
|
||||||
references.push({ path: resolve(nuxt.options.buildDir, 'types/middleware.d.ts') })
|
references.push({ path: resolve(nuxt.options.buildDir, 'types/middleware.d.ts') })
|
||||||
|
@ -50,11 +50,6 @@ function createCurrentLocation (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||||
nuxtApp.vueApp.component('NuxtPage', NuxtPage)
|
|
||||||
// TODO: remove before release - present for backwards compatibility & intentionally undocumented
|
|
||||||
nuxtApp.vueApp.component('NuxtNestedPage', NuxtPage)
|
|
||||||
nuxtApp.vueApp.component('NuxtChild', NuxtPage)
|
|
||||||
|
|
||||||
let routerBase = useRuntimeConfig().app.baseURL
|
let routerBase = useRuntimeConfig().app.baseURL
|
||||||
if (routerOptions.hashMode && !routerBase.includes('#')) {
|
if (routerOptions.hashMode && !routerBase.includes('#')) {
|
||||||
// allow the user to provide a `#` in the middle: `/base/#/app`
|
// allow the user to provide a `#` in the middle: `/base/#/app`
|
||||||
|
Loading…
Reference in New Issue
Block a user