nitro-graphql 2.0.0-beta.16 → 2.0.0-beta.17

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,6 +1,6 @@
1
- import * as h30 from "h3";
1
+ import * as h31 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: h31.EventHandlerWithFetch<h31.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 h33 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: h33.EventHandlerWithFetch<h33.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 h30 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: h30.EventHandlerWithFetch<h30.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/dist/setup.js CHANGED
@@ -93,7 +93,7 @@ async function setupNitroGraphQL(nitro) {
93
93
  const watcher = watch(watchDirs, {
94
94
  persistent: true,
95
95
  ignoreInitial: true,
96
- ignored: [...nitro.options.ignore, ...generateLayerIgnorePatterns(nitro)]
96
+ ignored: [...nitro.options.ignore, ...generateLayerIgnorePatterns()]
97
97
  }).on("all", async (_, path) => {
98
98
  if (path.endsWith(".graphql") || path.endsWith(".gql")) if (path.includes(nitro.graphql.serverDir) || path.includes("server/graphql") || path.includes("server\\graphql")) {
99
99
  await serverTypeGeneration(nitro);
@@ -218,16 +218,39 @@ async function setupNitroGraphQL(nitro) {
218
218
  if (!rollupConfig$1.output.inlineDynamicImports) {
219
219
  rollupConfig$1.output.manualChunks = (id, meta) => {
220
220
  if (id.endsWith(".graphql") || id.endsWith(".gql")) return "schemas";
221
- if (id.endsWith(".resolver.ts")) return "resolvers";
221
+ if (id.endsWith(".resolver.ts")) {
222
+ let graphqlIndex = id.indexOf("server/graphql/");
223
+ let baseLength = 15;
224
+ if (graphqlIndex === -1) {
225
+ graphqlIndex = id.indexOf("routes/graphql/");
226
+ baseLength = 15;
227
+ }
228
+ if (graphqlIndex !== -1) return id.slice(graphqlIndex + baseLength).replace(/\.resolver\.ts$/, "");
229
+ return "resolvers";
230
+ }
222
231
  if (typeof manualChunks === "function") return manualChunks(id, meta);
223
232
  };
224
- rollupConfig$1.output.advancedChunks = { groups: [{
225
- name: "schemas",
226
- test: /\.(?:graphql|gql)$/
227
- }, {
228
- name: "resolvers",
229
- test: /\.resolver\.ts$/
230
- }] };
233
+ rollupConfig$1.output.advancedChunks = {
234
+ groups: [{
235
+ name: "schemas",
236
+ test: /\.(?:graphql|gql)$/
237
+ }, {
238
+ name: (moduleId) => {
239
+ if (!moduleId.endsWith(".resolver.ts")) return;
240
+ let graphqlIndex = moduleId.indexOf("server/graphql/");
241
+ let baseLength = 15;
242
+ if (graphqlIndex === -1) {
243
+ graphqlIndex = moduleId.indexOf("routes/graphql/");
244
+ baseLength = 15;
245
+ }
246
+ if (graphqlIndex !== -1) return moduleId.slice(graphqlIndex + baseLength).replace(/\.resolver\.ts$/, "");
247
+ return "resolvers";
248
+ },
249
+ test: /\.resolver\.(?:ts|js)$/
250
+ }],
251
+ minSize: 0,
252
+ minShareCount: 1
253
+ };
231
254
  }
232
255
  rollupConfig$1.output.chunkFileNames = (chunkInfo) => {
233
256
  if (chunkInfo.moduleIds && chunkInfo.moduleIds.some((id) => id.endsWith(".graphql") || id.endsWith(".resolver.ts") || id.endsWith(".gql"))) return `chunks/graphql/[name].mjs`;
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.16",
4
+ "version": "2.0.0-beta.17",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,