diff --git a/docs/ecosystem/nuxt/schema.md b/docs/ecosystem/nuxt/schema.md index 1dc8d73..b1f21c5 100644 --- a/docs/ecosystem/nuxt/schema.md +++ b/docs/ecosystem/nuxt/schema.md @@ -27,11 +27,11 @@ export interface UseGQFnSchema< export interface UseGQFnSchemaWithWarning { endpoint?: string /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ gqfn: LoadGQFn /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ gqp: LoadGQP $enum: typeof $enum diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index 8149557..1995e47 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -27,8 +27,9 @@ export default defineNuxtModule({ const resolver = createResolver(import.meta.url) const logger = useLogger('@gqfn/nuxt', { level: options.silent ? 999 : undefined }) - addImportsDir(resolver.resolve('./runtime/composables')) - // addImportsDir(resolver.resolve('./runtime/utils')) + addImportsDir(resolver.resolve('./runtime/app/composables')) + // addImportsDir(resolver.resolve('./runtime/app/utils')) + addServerImportsDir(resolver.resolve('./runtime/server/utils')) const vfs = useTypeVfs('types/gqfn-schema') diff --git a/packages/nuxt/src/runtime/composables/schema.ts b/packages/nuxt/src/runtime/app/composables/schema.ts similarity index 75% rename from packages/nuxt/src/runtime/composables/schema.ts rename to packages/nuxt/src/runtime/app/composables/schema.ts index d7ff3bb..200fb65 100644 --- a/packages/nuxt/src/runtime/composables/schema.ts +++ b/packages/nuxt/src/runtime/app/composables/schema.ts @@ -1,11 +1,11 @@ import { useSchema } from '@gqfn/core' -import type { DollarEnum, Endpoints, ExactEndpoints, LoadGQFn, LoadGQP } from '../internal/utils/schema' -import type { UseGQFnSchema, UseGQFnSchemaWithWarning } from '../internal/types/composables/schema' +import type { DollarEnum, Endpoints, ExactEndpoints, LoadGQFn, LoadGQP } from '../../utils/schema' +import type { UseGQFnSchema, UseGQFnSchemaWithWarning } from '../../types/composables/schema' export function useGQFnSchema(): UseGQFnSchema export function useGQFnSchema(endpoint: T): UseGQFnSchema /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ export function useGQFnSchema(endpoint: string): UseGQFnSchemaWithWarning export function useGQFnSchema(endpoint?: T): UseGQFnSchema { diff --git a/packages/nuxt/src/runtime/composables/with-client.ts b/packages/nuxt/src/runtime/app/composables/with-client.ts similarity index 96% rename from packages/nuxt/src/runtime/composables/with-client.ts rename to packages/nuxt/src/runtime/app/composables/with-client.ts index 6105feb..7d7c555 100644 --- a/packages/nuxt/src/runtime/composables/with-client.ts +++ b/packages/nuxt/src/runtime/app/composables/with-client.ts @@ -2,10 +2,10 @@ import type { ResultOf, VariablesOf } from '@gqfn/core' import { hash } from 'ohash' import { type DocumentNode, Kind } from 'graphql' import type { ComputedRef } from 'vue' -import type { Endpoints } from '../internal/utils/schema' -import { type HandlerOptions, type SSEOptions, type WSOptions, createHandler, createSubscriptionHandler } from '../internal/utils/client' -import type { UseGQFnSchema } from '../internal/types/composables/schema' -import type { DefineAsyncQuery, DefineOperation, DefineSubscription, WithGQFnClient, WithGQFnClientOptions } from '../internal/types/composables/with-client' +import type { Endpoints } from '../../utils/schema' +import { type HandlerOptions, type SSEOptions, type WSOptions, createHandler, createSubscriptionHandler } from '../../utils/client' +import type { UseGQFnSchema } from '../../types/composables/schema' +import type { DefineAsyncQuery, DefineOperation, DefineSubscription, WithGQFnClient, WithGQFnClientOptions } from '../../types/composables/with-client' import { useAsyncData } from '#app/composables/asyncData' import { useState } from '#app' import { type MaybeRefOrGetter, readonly, toValue, watch } from '#imports' diff --git a/packages/nuxt/src/runtime/server/utils/schema.ts b/packages/nuxt/src/runtime/server/utils/schema.ts index 679d24b..d17b26d 100644 --- a/packages/nuxt/src/runtime/server/utils/schema.ts +++ b/packages/nuxt/src/runtime/server/utils/schema.ts @@ -1,6 +1,6 @@ import type { $enum } from '@gqfn/core' import { useSchema } from '@gqfn/core' -import type { DollarEnum, Endpoints, ExactEndpoints, LoadGQFn, LoadGQP } from '../../internal/utils/schema' +import type { DollarEnum, Endpoints, ExactEndpoints, LoadGQFn, LoadGQP } from '../../utils/schema' export interface ServerUseSchema< TEndpoint extends Endpoints, @@ -14,11 +14,11 @@ export interface ServerUseSchema< export interface ServerUseSchemaWithWarning { endpoint?: string /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ gqfn: LoadGQFn /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ gqp: LoadGQP $enum: typeof $enum @@ -27,7 +27,7 @@ export interface ServerUseSchemaWithWarning { export function useGQFnSchema(): ServerUseSchema export function useGQFnSchema(endpoint: T): ServerUseSchema /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ export function useGQFnSchema(endpoint: string): ServerUseSchemaWithWarning export function useGQFnSchema(endpoint?: T): ServerUseSchema { diff --git a/packages/nuxt/src/runtime/internal/types/composables/schema.ts b/packages/nuxt/src/runtime/types/composables/schema.ts similarity index 61% rename from packages/nuxt/src/runtime/internal/types/composables/schema.ts rename to packages/nuxt/src/runtime/types/composables/schema.ts index d830d53..9b92afc 100644 --- a/packages/nuxt/src/runtime/internal/types/composables/schema.ts +++ b/packages/nuxt/src/runtime/types/composables/schema.ts @@ -13,11 +13,11 @@ export interface UseGQFnSchema< export interface UseGQFnSchemaWithWarning { endpoint?: string /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ gqfn: LoadGQFn /** - * @deprecated It's not really deprecated. This deprecated is just a warning to let you know that the schema is not typed. + * @deprecated It's not really deprecated. The schema is not typed, maybe you input a wrong endpoint or forget to add it to nuxt config. */ gqp: LoadGQP $enum: typeof $enum diff --git a/packages/nuxt/src/runtime/internal/types/composables/with-client.ts b/packages/nuxt/src/runtime/types/composables/with-client.ts similarity index 100% rename from packages/nuxt/src/runtime/internal/types/composables/with-client.ts rename to packages/nuxt/src/runtime/types/composables/with-client.ts diff --git a/packages/nuxt/src/runtime/internal/utils/client.ts b/packages/nuxt/src/runtime/utils/client.ts similarity index 100% rename from packages/nuxt/src/runtime/internal/utils/client.ts rename to packages/nuxt/src/runtime/utils/client.ts diff --git a/packages/nuxt/src/runtime/internal/utils/schema.ts b/packages/nuxt/src/runtime/utils/schema.ts similarity index 100% rename from packages/nuxt/src/runtime/internal/utils/schema.ts rename to packages/nuxt/src/runtime/utils/schema.ts