Skip to content

fix: import nuxt composables from #imports #1457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/admin/plugin.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type App as AdminApp } from 'firebase-admin/app'
import { ensureAdminApp } from 'vuefire/server'
import { defineNuxtPlugin, useRequestEvent, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRequestEvent, useRuntimeConfig } from '#imports'

export default defineNuxtPlugin(() => {
const event = useRequestEvent()
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/analytics/plugin.client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FirebaseApp } from 'firebase/app'
import { isSupported, initializeAnalytics } from 'firebase/analytics'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Plugin to initialize the analytics module.
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/app-check/plugin.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
type AppCheckOptions,
} from 'firebase/app-check'
import { VueFireAppCheck } from 'vuefire'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Plugin to initialize the appCheck module on the server.
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/app-check/plugin.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { App as FirebaseAdminApp } from 'firebase-admin/app'
import type { FirebaseApp } from 'firebase/app'
import { VueFireAppCheckServer } from 'vuefire/server'
import { defineNuxtPlugin } from '#app'
import { defineNuxtPlugin } from '#imports'

/**
* Makes AppCheck work on the server. This requires SSR and the admin SDK to be available
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/app/composables.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FirebaseApp } from 'firebase/app'
import { useNuxtApp } from '#app'
import { useNuxtApp } from '#imports'

/**
* Gets the firebase instance from the current Nuxt App. This can be used anywhere the `useNuxtApp()` can be used. Differently from `vuefire`'s `useFirebaseApp()`, this doesn't accept a name.
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/app/plugin.client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { initializeApp } from 'firebase/app'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Initializes the app and provides it to others.
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/app/plugin.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type DecodedIdToken } from 'firebase-admin/auth'
import { logger } from '../logging'
import { DECODED_ID_TOKEN_SYMBOL } from '../constants'
import { appCache } from './lru-cache'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Initializes the app and provides it to others.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
beforeAuthStateChanged,
type User,
} from 'firebase/auth'
import { defineNuxtPlugin } from '#app'
import { defineNuxtPlugin } from '#imports'

/**
* Sets up a watcher that mints a cookie based auth session. On the server, it reads the cookie to
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/auth/plugin-user-token.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { App as AdminApp } from 'firebase-admin/app'
import { decodeSessionCookie, AUTH_COOKIE_NAME } from 'vuefire/server'
import { getCookie } from 'h3'
import { DECODED_ID_TOKEN_SYMBOL } from '../constants'
import { defineNuxtPlugin, useRequestEvent } from '#app'
import { defineNuxtPlugin, useRequestEvent } from '#imports'

/**
* Decodes the user token if any. Should only be added on the server and before the firebase/app
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/auth/plugin.client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FirebaseApp } from 'firebase/app'
import type { User } from 'firebase/auth'
import { VueFireAuth } from 'vuefire'
import { defineNuxtPlugin } from '#app'
import { defineNuxtPlugin } from '#imports'

/**
* Setups VueFireAuth for the client. This version creates some listeners that shouldn't be set on server.
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/auth/plugin.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { App as AdminApp } from 'firebase-admin/app'
import { VueFireAuthServer } from 'vuefire/server'
import { DECODED_ID_TOKEN_SYMBOL, UserSymbol } from '../constants'
import { logger } from '../logging'
import { defineNuxtPlugin, useRequestEvent } from '#app'
import { defineNuxtPlugin, useRequestEvent } from '#imports'

/**
* Setups the auth state based on the cookie.
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/emulators/auth.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { connectAuthEmulator, getAuth } from 'firebase/auth'
import type { FirebaseApp } from 'firebase/app'
import { logger } from '../logging'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Setups the auth Emulators
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/emulators/database.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getDatabase, connectDatabaseEmulator } from 'firebase/database'
import type { FirebaseApp } from 'firebase/app'
import { logger } from '../logging'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Setups the Database Emulators
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/emulators/firestore.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getFirestore, connectFirestoreEmulator } from 'firebase/firestore'
import type { FirebaseApp } from 'firebase/app'
import { logger } from '../logging'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Setups the Firestore Emulators
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/emulators/functions.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getFunctions, connectFunctionsEmulator } from 'firebase/functions'
import type { FirebaseApp } from 'firebase/app'
import { logger } from '../logging'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Setups the Functions Emulators
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/emulators/storage.plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getStorage, connectStorageEmulator } from 'firebase/storage'
import type { FirebaseApp } from 'firebase/app'
import { logger } from '../logging'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
import { defineNuxtPlugin, useRuntimeConfig } from '#imports'

/**
* Setups the Storage Emulators
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/payload-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
definePayloadPlugin,
definePayloadReducer,
definePayloadReviver,
} from '#app'
} from '#imports'

/**
* Handles Firestore Timestamps, GeoPoint, and other types that needs special handling for serialization.
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/templates/plugin.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
VueFire,
useSSRInitialState,
} from 'vuefire'
import { defineNuxtPlugin } from '#app'
import { defineNuxtPlugin } from '#imports'

export default defineNuxtPlugin((nuxtApp) => {
const firebaseApp = nuxtApp.$firebaseApp
Expand Down