nitro-graphql 1.2.0 → 1.2.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.
@@ -1,7 +1,7 @@
1
- import * as _nuxt_schema3 from "@nuxt/schema";
1
+ import * as _nuxt_schema1 from "@nuxt/schema";
2
2
 
3
3
  //#region src/ecosystem/nuxt.d.ts
4
4
  interface ModuleOptions {}
5
- declare const _default: _nuxt_schema3.NuxtModule<ModuleOptions, ModuleOptions, false>;
5
+ declare const _default: _nuxt_schema1.NuxtModule<ModuleOptions, ModuleOptions, false>;
6
6
  //#endregion
7
7
  export { ModuleOptions, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { StandardSchemaV1 } from "./types/standard-schema.js";
2
2
  import { CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, GenImport, GenericSdkConfig, NitroGraphQLOptions } from "./types/index.js";
3
- import * as nitropack2 from "nitropack";
3
+ import * as nitropack0 from "nitropack";
4
4
 
5
5
  //#region src/index.d.ts
6
- declare const _default: nitropack2.NitroModule;
6
+ declare const _default: nitropack0.NitroModule;
7
7
  //#endregion
8
8
  export { CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, GenImport, GenericSdkConfig, NitroGraphQLOptions, StandardSchemaV1, _default as default };
package/dist/index.js CHANGED
@@ -71,7 +71,8 @@ var src_default = defineNitroModule({
71
71
  }
72
72
  if (nitro.options.graphql?.externalServices?.length) {
73
73
  for (const service of nitro.options.graphql.externalServices) if (service.documents?.length) for (const pattern of service.documents) {
74
- const baseDir = pattern.split("**")[0].replace(/\/$/, "") || ".";
74
+ if (!pattern) continue;
75
+ const baseDir = pattern.split("**")[0]?.replace(/\/$/, "") || ".";
75
76
  const resolvedDir = resolve(nitro.options.rootDir, baseDir);
76
77
  if (!watchDirs.includes(resolvedDir)) watchDirs.push(resolvedDir);
77
78
  }
@@ -245,6 +246,23 @@ declare module 'h3' {
245
246
  consola.warn("nitro-graphql: Found context.d.ts file. Please rename it to context.ts for the new structure.");
246
247
  consola.info("The context file should now be context.ts instead of context.d.ts");
247
248
  }
249
+ if (nitro.options.framework.name === "nuxt") {
250
+ if (!existsSync(nitro.graphql.clientDir)) mkdirSync(nitro.graphql.clientDir, { recursive: true });
251
+ const defaultDir = join(nitro.graphql.clientDir, "default");
252
+ if (!existsSync(defaultDir)) mkdirSync(defaultDir, { recursive: true });
253
+ const sampleQueryFile = join(defaultDir, "queries.graphql");
254
+ if (!existsSync(sampleQueryFile)) writeFileSync(sampleQueryFile, `# Example GraphQL queries
255
+ # Add your GraphQL queries here
256
+
257
+ # query GetUser($id: ID!) {
258
+ # user(id: $id) {
259
+ # id
260
+ # name
261
+ # email
262
+ # }
263
+ # }
264
+ `, "utf-8");
265
+ }
248
266
  }
249
267
  });
250
268
 
@@ -1,6 +1,6 @@
1
- import * as h30 from "h3";
1
+ import * as h32 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: h32.EventHandler<h32.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,