@lewebsimple/nuxt-graphql 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-graphql",
3
3
  "configKey": "graphql",
4
- "version": "0.5.3",
4
+ "version": "0.5.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -19,15 +19,16 @@ const reset = "\x1B[0m";
19
19
 
20
20
  function renderContextTemplate({ contextModules }) {
21
21
  const imports = contextModules.map((module, index) => `import context${index} from ${JSON.stringify(module)};`);
22
- const types = contextModules.map((_, index) => `Awaited<ReturnType<typeof context${index}>>`);
22
+ const types = ["{}", ...contextModules.map((_, index) => `Awaited<ReturnType<typeof context${index}>>`)];
23
23
  return [
24
24
  `import type { H3Event } from "h3";`,
25
25
  ...imports,
26
26
  "",
27
- `export type GraphQLContext = ${types.join("\n & ")};`,
27
+ `export type GraphQLContext = ${types.join(" & ")};`,
28
28
  "",
29
29
  "export async function createContext(event: H3Event): Promise<GraphQLContext> {",
30
30
  " const parts = await Promise.all([",
31
+ " () => ({}),",
31
32
  ...contextModules.map((_, index) => ` context${index}(event),`),
32
33
  " ]);",
33
34
  " return Object.assign({}, ...parts) as GraphQLContext;",
@@ -384,7 +385,6 @@ const module$1 = defineNuxtModule({
384
385
  nuxt.options.alias ||= {};
385
386
  nuxt.options.alias["#graphql"] ||= resolveBuild("graphql");
386
387
  const contextModules = [
387
- resolveModule("./runtime/server/lib/default-context"),
388
388
  ...await Promise.all((options.yoga?.context || []).map((path) => resolveRootPath(path, true)))
389
389
  ];
390
390
  addTemplate({ filename: "graphql/context.ts", getContents: () => renderContextTemplate({ contextModules }), write: true });
@@ -1,6 +1,7 @@
1
+ import type { GraphQLContext } from "#graphql/context";
1
2
  /**
2
3
  * Get or create the singleton GraphQL Yoga instance.
3
4
  *
4
5
  * @returns GraphQL Yoga server instance.
5
6
  */
6
- export declare function getYogaInstance(): import("graphql-yoga").YogaServerInstance<{}, {}>;
7
+ export declare function getYogaInstance(): import("graphql-yoga").YogaServerInstance<GraphQLContext, {}>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lewebsimple/nuxt-graphql",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Opinionated Nuxt module for using GraphQL",
5
5
  "repository": "lewebsimple/nuxt-graphql",
6
6
  "license": "AGPL-3.0-only",
@@ -1,5 +0,0 @@
1
- /**
2
- * Default empty GraphQL context factory.
3
- */
4
- declare const _default: (event: import("h3").H3Event) => {} | Promise<{}>;
5
- export default _default;
@@ -1,2 +0,0 @@
1
- import { defineGraphQLContext } from "../utils/defineGraphQLContext.js";
2
- export default defineGraphQLContext(() => ({}));