nitro-graphql 2.0.0-beta.8 → 2.0.0-beta.9

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
@@ -1,7 +1,7 @@
1
1
  import { generateDirectiveSchemas } from "./utils/directive-parser.js";
2
2
  import { generateLayerIgnorePatterns, getLayerAppDirectories, getLayerServerDirectories, relativeWithDot, scanDirectives, scanDocs, scanResolvers, scanSchemas, validateExternalServices } from "./utils/index.js";
3
3
  import { writeFileIfNotExists } from "./utils/file-generator.js";
4
- import { getDefaultPaths, getScaffoldConfig, resolveFilePath, shouldGenerateScaffold } from "./utils/path-resolver.js";
4
+ import { getScaffoldConfig, resolveFilePath, shouldGenerateScaffold } from "./utils/path-resolver.js";
5
5
  import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.js";
6
6
  import { rollupConfig } from "./rollup.js";
7
7
  import { existsSync, mkdirSync } from "node:fs";
@@ -25,11 +25,13 @@ var src_default = defineNitroModule({
25
25
  }
26
26
  consola.info(`Configured ${nitro.options.graphql.externalServices.length} external GraphQL services`);
27
27
  }
28
+ const { getDefaultPaths: getDefaultPaths$1 } = await import("./utils/path-resolver.js");
29
+ const defaultPaths = getDefaultPaths$1(nitro);
28
30
  nitro.graphql ||= {
29
31
  buildDir: "",
30
32
  watchDirs: [],
31
- clientDir: "",
32
- serverDir: resolve(nitro.options.rootDir, "server", "graphql"),
33
+ clientDir: defaultPaths.clientGraphql,
34
+ serverDir: defaultPaths.serverGraphql,
33
35
  dir: {
34
36
  build: relative(nitro.options.rootDir, nitro.options.buildDir),
35
37
  client: "graphql",
@@ -61,11 +63,8 @@ var src_default = defineNitroModule({
61
63
  const watchDirs = [];
62
64
  switch (nitro.options.framework.name) {
63
65
  case "nuxt": {
64
- if (!nitro.graphql.clientDir) {
65
- nitro.graphql.clientDir = resolve(nitro.options.rootDir, "app", "graphql");
66
- nitro.graphql.dir.client = "app/graphql";
67
- }
68
- if (!nitro.options.graphql?.serverDir) nitro.graphql.serverDir = resolve(nitro.options.rootDir, "server", "graphql");
66
+ nitro.graphql.dir.client = relative(nitro.options.rootDir, nitro.graphql.clientDir);
67
+ nitro.graphql.dir.server = relative(nitro.options.rootDir, nitro.graphql.serverDir);
69
68
  watchDirs.push(nitro.graphql.clientDir);
70
69
  const layerServerDirs = getLayerServerDirectories(nitro);
71
70
  const layerAppDirs = getLayerAppDirectories(nitro);
@@ -74,9 +73,8 @@ var src_default = defineNitroModule({
74
73
  break;
75
74
  }
76
75
  case "nitro":
77
- if (!nitro.options.graphql?.serverDir) nitro.graphql.serverDir = resolve(nitro.options.rootDir, "server", "graphql");
78
- nitro.graphql.clientDir = resolve(nitro.options.rootDir, "graphql");
79
- nitro.graphql.dir.client = "graphql";
76
+ nitro.graphql.dir.client = relative(nitro.options.rootDir, nitro.graphql.clientDir);
77
+ nitro.graphql.dir.server = relative(nitro.options.rootDir, nitro.graphql.serverDir);
80
78
  watchDirs.push(nitro.graphql.clientDir);
81
79
  watchDirs.push(nitro.graphql.serverDir);
82
80
  break;
@@ -245,7 +243,7 @@ var src_default = defineNitroModule({
245
243
  if (nuxtOptions) nuxtOptions.nitroGraphqlExternalServices = nitro.options.graphql?.externalServices || [];
246
244
  });
247
245
  if (shouldGenerateScaffold(nitro)) {
248
- const placeholders = getDefaultPaths(nitro);
246
+ const placeholders = getDefaultPaths$1(nitro);
249
247
  const scaffoldConfig = getScaffoldConfig(nitro);
250
248
  const graphqlConfigPath = resolveFilePath(scaffoldConfig.graphqlConfig, scaffoldConfig.enabled, true, "graphql.config.ts", placeholders);
251
249
  if (graphqlConfigPath) writeFileIfNotExists(graphqlConfigPath, `
@@ -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.EventHandlerWithFetch<h30.EventHandlerRequest, Promise<any>>;
4
+ declare const _default: h33.EventHandlerWithFetch<h33.EventHandlerRequest, Promise<any>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,4 +1,4 @@
1
- import * as h35 from "h3";
1
+ import * as h30 from "h3";
2
2
 
3
3
  //#region src/routes/debug.d.ts
4
4
 
@@ -10,7 +10,7 @@ import * as h35 from "h3";
10
10
  * - /_nitro/graphql/debug - HTML dashboard
11
11
  * - /_nitro/graphql/debug?format=json - JSON API
12
12
  */
13
- declare const _default: h35.EventHandlerWithFetch<h35.EventHandlerRequest, Promise<string | {
13
+ declare const _default: h30.EventHandlerWithFetch<h30.EventHandlerRequest, Promise<string | {
14
14
  timestamp: string;
15
15
  environment: {
16
16
  dev: any;
@@ -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.EventHandlerWithFetch<h33.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h31.EventHandlerWithFetch<h31.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,7 +1,7 @@
1
- import * as h31 from "h3";
1
+ import * as h35 from "h3";
2
2
 
3
3
  //#region src/routes/health.d.ts
4
- declare const _default: h31.EventHandlerWithFetch<h31.EventHandlerRequest, Promise<{
4
+ declare const _default: h35.EventHandlerWithFetch<h35.EventHandlerRequest, Promise<{
5
5
  status: string;
6
6
  message: string;
7
7
  timestamp: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.8",
4
+ "version": "2.0.0-beta.9",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,