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

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,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 h35 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: h35.EventHandlerWithFetch<h35.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
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);
@@ -217,17 +217,59 @@ async function setupNitroGraphQL(nitro) {
217
217
  const chunkFiles = rollupConfig$1.output?.chunkFileNames;
218
218
  if (!rollupConfig$1.output.inlineDynamicImports) {
219
219
  rollupConfig$1.output.manualChunks = (id, meta) => {
220
- if (id.endsWith(".graphql") || id.endsWith(".gql")) return "schemas";
221
- if (id.endsWith(".resolver.ts")) return "resolvers";
220
+ if (id.endsWith(".graphql") || id.endsWith(".gql")) {
221
+ let graphqlIndex = id.indexOf("server/graphql/");
222
+ let baseLength = 15;
223
+ if (graphqlIndex === -1) {
224
+ graphqlIndex = id.indexOf("routes/graphql/");
225
+ baseLength = 15;
226
+ }
227
+ if (graphqlIndex !== -1) return id.slice(graphqlIndex + baseLength).replace(/\.(?:graphql|gql)$/, "-schema");
228
+ return "schemas";
229
+ }
230
+ if (id.endsWith(".resolver.ts")) {
231
+ let graphqlIndex = id.indexOf("server/graphql/");
232
+ let baseLength = 15;
233
+ if (graphqlIndex === -1) {
234
+ graphqlIndex = id.indexOf("routes/graphql/");
235
+ baseLength = 15;
236
+ }
237
+ if (graphqlIndex !== -1) return id.slice(graphqlIndex + baseLength).replace(/\.resolver\.ts$/, "");
238
+ return "resolvers";
239
+ }
222
240
  if (typeof manualChunks === "function") return manualChunks(id, meta);
223
241
  };
224
- rollupConfig$1.output.advancedChunks = { groups: [{
225
- name: "schemas",
226
- test: /\.(?:graphql|gql)$/
227
- }, {
228
- name: "resolvers",
229
- test: /\.resolver\.ts$/
230
- }] };
242
+ rollupConfig$1.output.advancedChunks = {
243
+ groups: [{
244
+ name: (moduleId) => {
245
+ if (!moduleId.endsWith(".graphql") && !moduleId.endsWith(".gql")) return;
246
+ let graphqlIndex = moduleId.indexOf("server/graphql/");
247
+ let baseLength = 15;
248
+ if (graphqlIndex === -1) {
249
+ graphqlIndex = moduleId.indexOf("routes/graphql/");
250
+ baseLength = 15;
251
+ }
252
+ if (graphqlIndex !== -1) return moduleId.slice(graphqlIndex + baseLength).replace(/\.(?:graphql|gql)$/, "-schema");
253
+ return "schemas";
254
+ },
255
+ test: /\.(?:graphql|gql)$/
256
+ }, {
257
+ name: (moduleId) => {
258
+ if (!moduleId.endsWith(".resolver.ts")) return;
259
+ let graphqlIndex = moduleId.indexOf("server/graphql/");
260
+ let baseLength = 15;
261
+ if (graphqlIndex === -1) {
262
+ graphqlIndex = moduleId.indexOf("routes/graphql/");
263
+ baseLength = 15;
264
+ }
265
+ if (graphqlIndex !== -1) return moduleId.slice(graphqlIndex + baseLength).replace(/\.resolver\.ts$/, "");
266
+ return "resolvers";
267
+ },
268
+ test: /\.resolver\.(?:ts|js)$/
269
+ }],
270
+ minSize: 0,
271
+ minShareCount: 1
272
+ };
231
273
  }
232
274
  rollupConfig$1.output.chunkFileNames = (chunkInfo) => {
233
275
  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.18",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,