diff --git a/.eslintrc b/.eslintrc index 528bcc4a57..feb6e78660 100644 --- a/.eslintrc +++ b/.eslintrc @@ -70,6 +70,11 @@ "target": "packages/nuxt/src/app", "message": "app should not directly import from modules." }, + { + "from": "packages/nuxt/src/app/**/index.ts", + "target": "packages/nuxt/src", + "message": "should not import from barrel/index files" + }, { "from": "packages/nitro", "target": "packages/!(nitro)/**/*", diff --git a/docs/3.api/5.kit/10.templates.md b/docs/3.api/5.kit/10.templates.md index e02b76ff71..d748246942 100644 --- a/docs/3.api/5.kit/10.templates.md +++ b/docs/3.api/5.kit/10.templates.md @@ -112,7 +112,7 @@ export default defineNuxtModule({ ```ts [plugin.ts] import { createHead as createClientHead, createServerHead } from '@unhead/vue' -import { defineNuxtPlugin } from '#app' +import { defineNuxtPlugin } from '#imports' // @ts-ignore import metaConfig from '#build/meta.config.mjs' diff --git a/docs/3.api/5.kit/9.plugins.md b/docs/3.api/5.kit/9.plugins.md index da4940419d..483c516c1b 100644 --- a/docs/3.api/5.kit/9.plugins.md +++ b/docs/3.api/5.kit/9.plugins.md @@ -234,7 +234,7 @@ export default defineNuxtModule({ ```ts [runtime/plugin.ejs] import { VueFire, useSSRInitialState } from 'vuefire' -import { defineNuxtPlugin } from '#app' +import { defineNuxtPlugin } from '#imports' export default defineNuxtPlugin((nuxtApp) => { const firebaseApp = nuxtApp.$firebaseApp diff --git a/packages/nuxt/src/app/components/island-renderer.ts b/packages/nuxt/src/app/components/island-renderer.ts index 421e3863ab..62d83f1126 100644 --- a/packages/nuxt/src/app/components/island-renderer.ts +++ b/packages/nuxt/src/app/components/island-renderer.ts @@ -1,9 +1,10 @@ import type { defineAsyncComponent } from 'vue' import { createVNode, defineComponent } from 'vue' +import { createError } from '../composables/error' + // @ts-expect-error virtual file import * as islandComponents from '#build/components.islands.mjs' -import { createError } from '#app/composables/error' export default defineComponent({ props: { diff --git a/packages/nuxt/src/app/components/nuxt-error-boundary.ts b/packages/nuxt/src/app/components/nuxt-error-boundary.ts index cb8d2f6707..e038adab1a 100644 --- a/packages/nuxt/src/app/components/nuxt-error-boundary.ts +++ b/packages/nuxt/src/app/components/nuxt-error-boundary.ts @@ -1,5 +1,5 @@ import { defineComponent, onErrorCaptured, ref } from 'vue' -import { useNuxtApp } from '#app/nuxt' +import { useNuxtApp } from '../nuxt' export default defineComponent({ emits: { diff --git a/packages/nuxt/src/app/components/nuxt-island.ts b/packages/nuxt/src/app/components/nuxt-island.ts index 9ba2befc46..40162a15e3 100644 --- a/packages/nuxt/src/app/components/nuxt-island.ts +++ b/packages/nuxt/src/app/components/nuxt-island.ts @@ -9,9 +9,9 @@ import type { FetchResponse } from 'ofetch' // eslint-disable-next-line import/no-restricted-paths import type { NuxtIslandResponse } from '../../core/runtime/nitro/renderer' +import { useNuxtApp, useRuntimeConfig } from '../nuxt' +import { prerenderRoutes, useRequestEvent } from '../composables/ssr' import { getFragmentHTML, getSlotProps } from './utils' -import { useNuxtApp, useRuntimeConfig } from '#app/nuxt' -import { prerenderRoutes, useRequestEvent } from '#app/composables/ssr' // @ts-expect-error virtual file import { remoteComponentIslands } from '#build/nuxt.config.mjs' diff --git a/packages/nuxt/src/app/components/nuxt-layout.ts b/packages/nuxt/src/app/components/nuxt-layout.ts index 37cfa0d1e2..01a682dca2 100644 --- a/packages/nuxt/src/app/components/nuxt-layout.ts +++ b/packages/nuxt/src/app/components/nuxt-layout.ts @@ -1,12 +1,15 @@ import type { DefineComponent, MaybeRef, VNode } from 'vue' import { Suspense, Transition, computed, defineComponent, h, inject, mergeProps, nextTick, onMounted, provide, ref, unref } from 'vue' import type { RouteLocationNormalizedLoaded } from 'vue-router' + +// eslint-disable-next-line import/no-restricted-paths +import type { PageMeta } from '../../pages/runtime/composables' + +import { useRoute } from '../composables/router' +import { useNuxtApp } from '../nuxt' import { _wrapIf } from './utils' import { LayoutMetaSymbol, PageRouteSymbol } from './injections' -import type { PageMeta } from '#app' -import { useRoute } from '#app/composables/router' -import { useNuxtApp } from '#app/nuxt' // @ts-expect-error virtual file import { useRoute as useVueRouterRoute } from '#build/pages' // @ts-expect-error virtual file diff --git a/packages/nuxt/src/app/components/nuxt-loading-indicator.ts b/packages/nuxt/src/app/components/nuxt-loading-indicator.ts index bf5a11cbd3..01a58b5fd2 100644 --- a/packages/nuxt/src/app/components/nuxt-loading-indicator.ts +++ b/packages/nuxt/src/app/components/nuxt-loading-indicator.ts @@ -1,7 +1,7 @@ import { computed, defineComponent, h, onBeforeUnmount, ref } from 'vue' +import { useNuxtApp } from '../nuxt' +import { useRouter } from '../composables/router' import { isChangingPage } from './utils' -import { useNuxtApp } from '#app/nuxt' -import { useRouter } from '#app/composables/router' // @ts-expect-error virtual file import { globalMiddleware } from '#build/middleware' diff --git a/packages/nuxt/src/app/components/nuxt-root.vue b/packages/nuxt/src/app/components/nuxt-root.vue index 378c8ee59c..2d8501dcb7 100644 --- a/packages/nuxt/src/app/components/nuxt-root.vue +++ b/packages/nuxt/src/app/components/nuxt-root.vue @@ -9,10 +9,10 @@