nitro-graphql 1.4.0 → 1.4.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.js CHANGED
@@ -60,9 +60,12 @@ var src_default = defineNitroModule({
60
60
  const watchDirs = [];
61
61
  switch (nitro.options.framework.name) {
62
62
  case "nuxt": {
63
- watchDirs.push(join(nitro.options.rootDir, "app", "graphql"));
64
- nitro.graphql.clientDir = resolve(nitro.options.rootDir, "app", "graphql");
65
- nitro.graphql.dir.client = "app/graphql";
63
+ if (!nitro.graphql.clientDir) {
64
+ nitro.graphql.clientDir = resolve(nitro.options.rootDir, "app", "graphql");
65
+ nitro.graphql.dir.client = "app/graphql";
66
+ }
67
+ if (!nitro.options.graphql?.serverDir) nitro.graphql.serverDir = resolve(nitro.options.rootDir, "server", "graphql");
68
+ watchDirs.push(nitro.graphql.clientDir);
66
69
  const layerServerDirs = getLayerServerDirectories(nitro);
67
70
  const layerAppDirs = getLayerAppDirectories(nitro);
68
71
  for (const layerServerDir of layerServerDirs) watchDirs.push(join(layerServerDir, "graphql"));
@@ -1,6 +1,6 @@
1
- import * as h30 from "h3";
1
+ import * as h33 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server.d.ts
4
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<any>>;
4
+ declare const _default: h33.EventHandler<h33.EventHandlerRequest, Promise<any>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,6 +1,6 @@
1
- import * as h33 from "h3";
1
+ import * as h30 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: h30.EventHandler<h30.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -194,9 +194,9 @@ function generateDirectiveSchema(directive) {
194
194
  */
195
195
  async function generateDirectiveSchemas(nitro, directives) {
196
196
  if (directives.length === 0) return;
197
- const { existsSync, readFileSync, writeFileSync } = await import("node:fs");
197
+ const { existsSync, readFileSync, writeFileSync, mkdirSync } = await import("node:fs");
198
198
  const { readFile } = await import("node:fs/promises");
199
- const { resolve } = await import("pathe");
199
+ const { resolve, dirname } = await import("pathe");
200
200
  const directiveSchemas = [];
201
201
  const seenDirectives = /* @__PURE__ */ new Set();
202
202
  const parser = new DirectiveParser();
@@ -217,6 +217,8 @@ async function generateDirectiveSchemas(nitro, directives) {
217
217
  # To define custom directives, create .directive.ts files using defineDirective()
218
218
 
219
219
  ${directiveSchemas.join("\n\n")}`;
220
+ const targetDir = dirname(directivesPath);
221
+ if (!existsSync(targetDir)) mkdirSync(targetDir, { recursive: true });
220
222
  let shouldWrite = true;
221
223
  if (existsSync(directivesPath)) {
222
224
  const existingContent = readFileSync(directivesPath, "utf-8");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,