nitro-graphql 0.0.8 → 0.0.10

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.
@@ -1,7 +1,7 @@
1
- import * as _nuxt_schema7 from "@nuxt/schema";
1
+ import * as _nuxt_schema2 from "@nuxt/schema";
2
2
 
3
3
  //#region src/ecosystem/nuxt.d.ts
4
4
  interface ModuleOptions {}
5
- declare const _default: _nuxt_schema7.NuxtModule<ModuleOptions, ModuleOptions, false>;
5
+ declare const _default: _nuxt_schema2.NuxtModule<ModuleOptions, ModuleOptions, false>;
6
6
  //#endregion
7
7
  export { ModuleOptions, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { StandardSchemaV1 } from "./types/standard-schema.js";
2
2
  import { CodegenClientConfig, CodegenServerConfig, GenImport, NitroGraphQLOptions } from "./types/index.js";
3
3
  import { defineGraphQLConfig, defineMutation, defineQuery, defineResolver, defineSchema, defineSubscription, defineType } from "./utils/define.js";
4
- import * as nitropack4 from "nitropack";
4
+ import * as nitropack5 from "nitropack";
5
5
 
6
6
  //#region src/index.d.ts
7
7
  interface Resolvers extends Record<string, any> {}
8
8
  interface CustomSchema extends Record<string, any> {}
9
9
  type GraphQLFramework = 'graphql-yoga';
10
- declare const _default: nitropack4.NitroModule;
10
+ declare const _default: nitropack5.NitroModule;
11
11
  //#endregion
12
12
  export { CodegenClientConfig, CodegenServerConfig, CustomSchema, GenImport, GraphQLFramework, NitroGraphQLOptions, Resolvers, StandardSchemaV1, _default as default, defineGraphQLConfig, defineMutation, defineQuery, defineResolver, defineSchema, defineSubscription, defineType };
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { defineGraphQLConfig, defineMutation, defineQuery, defineResolver, defin
5
5
  import { writeFileSync } from "node:fs";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { watch } from "chokidar";
8
+ import consola from "consola";
8
9
  import defu from "defu";
9
10
  import { defineNitroModule } from "nitropack/kit";
10
11
  import { dirname, join, resolve } from "pathe";
@@ -13,6 +14,10 @@ import { dirname, join, resolve } from "pathe";
13
14
  var src_default = defineNitroModule({
14
15
  name: "nitro-graphql",
15
16
  async setup(nitro) {
17
+ if (!nitro.options.graphql?.framework) {
18
+ consola.warn("No GraphQL framework specified. Please set graphql.framework to \"graphql-yoga\" or \"apollo-server\".");
19
+ return;
20
+ }
16
21
  nitro.graphql ||= {
17
22
  buildDir: "",
18
23
  watchDirs: [],
@@ -74,6 +79,10 @@ var src_default = defineNitroModule({
74
79
  await rollupConfig(nitro);
75
80
  await serverTypeGeneration(nitro);
76
81
  await clientTypeGeneration(nitro, nitro.graphql.clientDir);
82
+ nitro.hooks.hook("close", async () => {
83
+ await serverTypeGeneration(nitro);
84
+ await clientTypeGeneration(nitro, nitro.graphql.clientDir);
85
+ });
77
86
  const runtime = fileURLToPath(new URL("routes", import.meta.url));
78
87
  const methods = [
79
88
  "get",
@@ -1,6 +1,6 @@
1
- import * as h32 from "h3";
1
+ import * as h30 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server.d.ts
4
- declare const _default: h32.EventHandler<h32.EventHandlerRequest, any>;
4
+ declare const _default: h30.EventHandler<h30.EventHandlerRequest, any>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,6 +1,6 @@
1
- import * as h30 from "h3";
1
+ import * as h36 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga.d.ts
4
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h36.EventHandler<h36.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,7 +1,7 @@
1
- import * as h35 from "h3";
1
+ import * as h33 from "h3";
2
2
 
3
3
  //#region src/routes/health.d.ts
4
- declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<{
4
+ declare const _default: h33.EventHandler<h33.EventHandlerRequest, Promise<{
5
5
  status: string;
6
6
  message: string;
7
7
  timestamp: string;
@@ -1,8 +1,8 @@
1
1
  import { preset } from "../node_modules/.pnpm/@graphql-codegen_import-types-preset@3.0.1_graphql@16.11.0/node_modules/@graphql-codegen/import-types-preset/esm/index.js";
2
+ import { consola as consola$1 } from "consola";
2
3
  import { defu as defu$1 } from "defu";
3
4
  import { parse } from "graphql";
4
5
  import { printSchemaWithDirectives } from "@graphql-tools/utils";
5
- import { consola as consola$1 } from "consola";
6
6
  import { codegen } from "@graphql-codegen/core";
7
7
  import { plugin } from "@graphql-codegen/typescript";
8
8
  import { plugin as plugin$1 } from "@graphql-codegen/typescript-generic-sdk";
@@ -1,7 +1,7 @@
1
+ import consola from "consola";
1
2
  import { defu as defu$1 } from "defu";
2
3
  import { parse } from "graphql";
3
4
  import { printSchemaWithDirectives } from "@graphql-tools/utils";
4
- import consola from "consola";
5
5
  import { codegen } from "@graphql-codegen/core";
6
6
  import * as typescriptPlugin from "@graphql-codegen/typescript";
7
7
  import * as typescriptResolversPlugin from "@graphql-codegen/typescript-resolvers";
@@ -1,12 +1,12 @@
1
1
  import { generateClientTypes, loadGraphQLDocuments } from "./client-codegen.js";
2
2
  import { generateTypes } from "./server-codegen.js";
3
3
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
+ import consola from "consola";
4
5
  import { dirname, join, resolve } from "pathe";
5
6
  import { buildASTSchema, buildSchema } from "graphql";
6
7
  import { loadFilesSync } from "@graphql-tools/load-files";
7
8
  import { mergeTypeDefs } from "@graphql-tools/merge";
8
9
  import { printSchemaWithDirectives } from "@graphql-tools/utils";
9
- import consola from "consola";
10
10
 
11
11
  //#region src/utils/server-type-generation.ts
12
12
  async function serverTypeGeneration(app) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.0.10",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,