nitro-graphql 1.7.0 → 1.7.1

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/index.mjs CHANGED
@@ -159,26 +159,7 @@ var src_default = defineNitroModule({
159
159
  borderStyle: "rounded"
160
160
  }
161
161
  });
162
- if (resolvers.length > 0) {
163
- const totalExports = resolvers.reduce((sum, r) => sum + r.imports.length, 0);
164
- const typeCount = {
165
- query: 0,
166
- mutation: 0,
167
- resolver: 0,
168
- type: 0,
169
- subscription: 0,
170
- directive: 0
171
- };
172
- for (const resolver of resolvers) for (const imp of resolver.imports) if (imp.type in typeCount) typeCount[imp.type]++;
173
- const breakdown = [];
174
- if (typeCount.query > 0) breakdown.push(`${typeCount.query} query`);
175
- if (typeCount.mutation > 0) breakdown.push(`${typeCount.mutation} mutation`);
176
- if (typeCount.resolver > 0) breakdown.push(`${typeCount.resolver} resolver`);
177
- if (typeCount.type > 0) breakdown.push(`${typeCount.type} type`);
178
- if (typeCount.subscription > 0) breakdown.push(`${typeCount.subscription} subscription`);
179
- if (typeCount.directive > 0) breakdown.push(`${typeCount.directive} directive`);
180
- if (breakdown.length > 0) consola.success(`[nitro-graphql] ${totalExports} resolver export(s): ${breakdown.join(", ")}`);
181
- } else consola.warn("[nitro-graphql] No resolvers found. Check /_nitro/graphql/debug for details.");
162
+ if (resolvers.length === 0) consola.warn("[nitro-graphql] No resolvers found. Check /_nitro/graphql/debug for details.");
182
163
  }
183
164
  });
184
165
  await rollupConfig(nitro);
@@ -225,14 +206,11 @@ var src_default = defineNitroModule({
225
206
  nitro.options.plugins.push(join(runtime, "ws-shutdown"));
226
207
  consola.info(`[nitro-graphql] WebSocket subscriptions enabled at: ${wsEndpoint}`);
227
208
  }
228
- if (nitro.options.dev) {
229
- nitro.options.handlers.push({
230
- route: "/_nitro/graphql/debug",
231
- handler: join(runtime, "debug"),
232
- method: "get"
233
- });
234
- consola.info("[nitro-graphql] Debug dashboard available at: /_nitro/graphql/debug");
235
- }
209
+ if (nitro.options.dev) nitro.options.handlers.push({
210
+ route: "/_nitro/graphql/debug",
211
+ handler: join(runtime, "debug"),
212
+ method: "get"
213
+ });
236
214
  if (nitro.options.imports) {
237
215
  nitro.options.imports.presets ??= [];
238
216
  nitro.options.imports.presets.push({
package/dist/rollup.mjs CHANGED
@@ -62,15 +62,13 @@ function virtualSchemas(app) {
62
62
  }
63
63
  const importStatements = imports.map((handler) => `import ${getImportId(handler)} from '${handler}';`);
64
64
  const schemaArray = imports.map((h) => `{ def: ${getImportId(h)} }`);
65
- const code = `
65
+ return `
66
66
  ${importStatements.join("\n")}
67
67
 
68
68
  export const schemas = [
69
69
  ${schemaArray.join(",\n")}
70
70
  ];
71
71
  `;
72
- if (app.options.dev) app.logger.success(`[nitro-graphql] Generated virtual schema module: ${imports.length} schema(s)`);
73
- return code;
74
72
  } catch (error) {
75
73
  app.logger.error("[nitro-graphql] Failed to generate virtual schema module:", error);
76
74
  return "export const schemas = []";
@@ -108,7 +106,7 @@ function virtualResolvers(app) {
108
106
  for (const msg of invalidImports) app.logger.warn(` - ${msg}`);
109
107
  }
110
108
  const data = imports.map(({ imports: importList }) => importList.map((i) => `{ resolver: ${i.as} }`).join(",\n")).filter(Boolean).join(",\n");
111
- const code = [
109
+ return [
112
110
  ...importsContent,
113
111
  "",
114
112
  "export const resolvers = [",
@@ -116,11 +114,6 @@ function virtualResolvers(app) {
116
114
  "]",
117
115
  ""
118
116
  ].join("\n");
119
- if (app.options.dev) {
120
- const totalExports = imports.reduce((sum, r) => sum + r.imports.length, 0);
121
- app.logger.success(`[nitro-graphql] Generated virtual resolver module: ${totalExports} export(s) from ${imports.length} file(s)`);
122
- }
123
- return code;
124
117
  } catch (error) {
125
118
  app.logger.error("[nitro-graphql] Failed to generate virtual resolver module:", error);
126
119
  return "export const resolvers = []";
@@ -155,7 +148,7 @@ function virtualDirectives(app) {
155
148
  for (const msg of invalidImports) app.logger.warn(` - ${msg}`);
156
149
  }
157
150
  const data = imports.map(({ imports: importList }) => importList.map((i) => `{ directive: ${i.as} }`).join(",\n")).filter(Boolean).join(",\n");
158
- const code = [
151
+ return [
159
152
  ...importsContent,
160
153
  "",
161
154
  "export const directives = [",
@@ -163,11 +156,6 @@ function virtualDirectives(app) {
163
156
  "]",
164
157
  ""
165
158
  ].join("\n");
166
- if (app.options.dev) {
167
- const totalExports = imports.reduce((sum, d) => sum + d.imports.length, 0);
168
- app.logger.success(`[nitro-graphql] Generated virtual directive module: ${totalExports} directive(s) from ${imports.length} file(s)`);
169
- }
170
- return code;
171
159
  } catch (error) {
172
160
  app.logger.error("[nitro-graphql] Failed to generate virtual directive module:", error);
173
161
  return "export const directives = []";
@@ -1,4 +1,4 @@
1
- import * as h39 from "h3";
1
+ import * as h33 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server-ws.d.ts
4
4
 
@@ -7,6 +7,6 @@ import * as h39 from "h3";
7
7
  * Called by the Nitro runtime plugin on server close.
8
8
  */
9
9
  declare function shutdownAllConnections(): Promise<void>;
10
- declare const _default: h39.EventHandler<h39.EventHandlerRequest, never>;
10
+ declare const _default: h33.EventHandler<h33.EventHandlerRequest, never>;
11
11
  //#endregion
12
12
  export { _default as default, shutdownAllConnections };
@@ -1,6 +1,6 @@
1
- import * as h35 from "h3";
1
+ import * as h39 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server.d.ts
4
- declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<any>>;
4
+ declare const _default: h39.EventHandler<h39.EventHandlerRequest, Promise<any>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,4 +1,4 @@
1
- import * as h30 from "h3";
1
+ import * as h35 from "h3";
2
2
 
3
3
  //#region src/routes/debug.d.ts
4
4
 
@@ -10,7 +10,7 @@ import * as h30 from "h3";
10
10
  * - /_nitro/graphql/debug - HTML dashboard
11
11
  * - /_nitro/graphql/debug?format=json - JSON API
12
12
  */
13
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<string | {
13
+ declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<string | {
14
14
  timestamp: string;
15
15
  environment: {
16
16
  dev: any;
@@ -1,4 +1,4 @@
1
- import * as h31 from "h3";
1
+ import * as h30 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga-ws.d.ts
4
4
 
@@ -7,6 +7,6 @@ import * as h31 from "h3";
7
7
  * Called by the Nitro runtime plugin on server close.
8
8
  */
9
9
  declare function shutdownAllConnections(): Promise<void>;
10
- declare const _default: h31.EventHandler<h31.EventHandlerRequest, never>;
10
+ declare const _default: h30.EventHandler<h30.EventHandlerRequest, never>;
11
11
  //#endregion
12
12
  export { _default as default, shutdownAllConnections };
@@ -1,6 +1,6 @@
1
- import * as h33 from "h3";
1
+ import * as h31 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga.d.ts
4
- declare const _default: h33.EventHandler<h33.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h31.EventHandler<h31.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -232,7 +232,6 @@ async function serverTypeGeneration(app) {
232
232
  if (serverTypesPath) {
233
233
  mkdirSync(dirname(serverTypesPath), { recursive: true });
234
234
  writeFileSync(serverTypesPath, data, "utf-8");
235
- consola.success(`[nitro-graphql] Generated server types at: ${serverTypesPath}`);
236
235
  }
237
236
  } catch (error) {
238
237
  consola.error("Server schema generation error:", error);
@@ -293,13 +292,11 @@ async function generateMainClientTypes(nitro) {
293
292
  if (clientTypesPath) {
294
293
  mkdirSync(dirname(clientTypesPath), { recursive: true });
295
294
  writeFileSync(clientTypesPath, types.types, "utf-8");
296
- consola.success(`[nitro-graphql] Generated client types at: ${clientTypesPath}`);
297
295
  }
298
296
  const sdkPath = resolveFilePath(sdkConfig.main, sdkConfig.enabled, true, "{clientGraphql}/default/sdk.ts", placeholders);
299
297
  if (sdkPath) {
300
298
  mkdirSync(dirname(sdkPath), { recursive: true });
301
299
  writeFileSync(sdkPath, types.sdk, "utf-8");
302
- consola.success(`[nitro-graphql] Generated SDK at: ${sdkPath}`);
303
300
  }
304
301
  if (nitro.options.framework?.name === "nuxt") {
305
302
  generateNuxtOfetchClient(nitro, nitro.graphql.clientDir, "default");
@@ -310,7 +307,6 @@ async function generateMainClientTypes(nitro) {
310
307
  async function generateExternalServicesTypes(nitro) {
311
308
  const externalServices = nitro.options.graphql?.externalServices || [];
312
309
  for (const service of externalServices) try {
313
- consola.info(`[graphql:${service.name}] Processing external service`);
314
310
  await downloadAndSaveSchema(service, nitro.options.buildDir);
315
311
  const schema = await loadExternalSchema(service, nitro.options.buildDir);
316
312
  if (!schema) {
@@ -344,16 +340,13 @@ async function generateExternalServicesTypes(nitro) {
344
340
  if (serviceTypesPath) {
345
341
  mkdirSync(dirname(serviceTypesPath), { recursive: true });
346
342
  writeFileSync(serviceTypesPath, types.types, "utf-8");
347
- consola.success(`[graphql:${service.name}] Generated types at: ${serviceTypesPath}`);
348
343
  }
349
344
  const serviceSdkPath = resolveFilePath(service.paths?.sdk ?? sdkConfig.external, sdkConfig.enabled, true, "{clientGraphql}/{serviceName}/sdk.ts", placeholders);
350
345
  if (serviceSdkPath) {
351
346
  mkdirSync(dirname(serviceSdkPath), { recursive: true });
352
347
  writeFileSync(serviceSdkPath, types.sdk, "utf-8");
353
- consola.success(`[graphql:${service.name}] Generated SDK at: ${serviceSdkPath}`);
354
348
  }
355
349
  if (nitro.options.framework?.name === "nuxt") generateExternalOfetchClient(nitro, service, service.endpoint);
356
- consola.success(`[graphql:${service.name}] External service types generated successfully`);
357
350
  } catch (error) {
358
351
  consola.error(`[graphql:${service.name}] External service generation failed:`, error);
359
352
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "1.7.0",
4
+ "version": "1.7.1",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "repository": {