nitro-graphql 2.0.0-beta.6 → 2.0.0-beta.7
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.d.ts +2 -2
- package/dist/rollup.js +74 -43
- package/dist/routes/apollo-server.d.ts +2 -2
- package/dist/routes/apollo-server.js +5 -5
- package/dist/routes/debug.d.ts +48 -2
- package/dist/routes/debug.js +6 -6
- package/dist/routes/graphql-yoga.d.ts +2 -2
- package/dist/routes/graphql-yoga.js +5 -5
- package/dist/routes/health.d.ts +6 -2
- package/dist/types/standard-schema.d.ts +2 -2
- package/dist/virtual/debug-info.d.ts +9 -0
- package/dist/virtual/debug-info.js +26 -0
- package/dist/virtual/graphql-config.d.ts +9 -0
- package/dist/virtual/graphql-config.js +10 -0
- package/dist/virtual/module-config.d.ts +9 -0
- package/dist/virtual/module-config.js +10 -0
- package/dist/virtual/server-directives.d.ts +11 -0
- package/dist/virtual/server-directives.js +10 -0
- package/dist/virtual/server-resolvers.d.ts +11 -0
- package/dist/virtual/server-resolvers.js +10 -0
- package/dist/virtual/server-schemas.d.ts +11 -0
- package/dist/virtual/server-schemas.js +10 -0
- package/package.json +80 -54
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "./types/standard-schema.js";
|
|
2
2
|
import { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, GenImport, GenericSdkConfig, NitroGraphQLOptions, PathsConfig, ScaffoldConfig, SdkConfig, TypesConfig } from "./types/index.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as nitropack_types0 from "nitropack/types";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
|
-
declare const _default:
|
|
6
|
+
declare const _default: nitropack_types0.NitroModule;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { ClientUtilsConfig, CodegenClientConfig, CodegenServerConfig, ExternalGraphQLService, ExternalServicePaths, FederationConfig, FileGenerationConfig, GenImport, GenericSdkConfig, NitroGraphQLOptions, PathsConfig, ScaffoldConfig, SdkConfig, StandardSchemaV1, TypesConfig, _default as default };
|
package/dist/rollup.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getImportId, scanGraphql } from "./utils/index.js";
|
|
2
2
|
import { clientTypeGeneration, serverTypeGeneration } from "./utils/type-generation.js";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { resolve } from "pathe";
|
|
4
5
|
import { readFile } from "node:fs/promises";
|
|
5
6
|
import { parse } from "graphql";
|
|
@@ -18,29 +19,71 @@ async function rollupConfig(app) {
|
|
|
18
19
|
const { include = /\.(?:graphql|gql)$/i, exclude, validate = false } = app.options.graphql?.loader || {};
|
|
19
20
|
if (Array.isArray(rollupConfig$1.plugins)) {
|
|
20
21
|
rollupConfig$1.plugins.push({
|
|
21
|
-
name: "nitro-graphql",
|
|
22
|
-
resolveId
|
|
23
|
-
|
|
22
|
+
name: "nitro-graphql:virtual",
|
|
23
|
+
resolveId: {
|
|
24
|
+
order: "pre",
|
|
25
|
+
async handler(id, parent, options) {
|
|
26
|
+
if (id.startsWith("#nitro-graphql/")) return `\0virtual:${id}`;
|
|
27
|
+
if (parent?.startsWith("\0virtual:#nitro-graphql")) {
|
|
28
|
+
const runtimeDir = fileURLToPath(new URL("routes", import.meta.url));
|
|
29
|
+
const internalRes = await this.resolve(id, runtimeDir, {
|
|
30
|
+
skipSelf: true,
|
|
31
|
+
...options
|
|
32
|
+
});
|
|
33
|
+
if (internalRes) return internalRes;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
24
36
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
load: {
|
|
38
|
+
order: "pre",
|
|
39
|
+
handler(id) {
|
|
40
|
+
if (id.startsWith("\0virtual:#nitro-graphql/")) {
|
|
41
|
+
const moduleName = id.slice(9);
|
|
42
|
+
const generator = app.options.virtual?.[moduleName];
|
|
43
|
+
if (typeof generator === "function") try {
|
|
44
|
+
return generator();
|
|
45
|
+
} catch (error) {
|
|
46
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
+
this.error(`Failed to generate virtual module ${moduleName}: ${message}`);
|
|
48
|
+
}
|
|
49
|
+
else this.error(`No generator function found for virtual module ${moduleName}`);
|
|
50
|
+
}
|
|
36
51
|
}
|
|
37
52
|
}
|
|
38
53
|
});
|
|
39
54
|
rollupConfig$1.plugins.push({
|
|
55
|
+
name: "nitro-graphql",
|
|
56
|
+
resolveId: {
|
|
57
|
+
order: "pre",
|
|
58
|
+
handler(id) {
|
|
59
|
+
if (/\.(?:graphql|gql)$/i.test(id)) return null;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
load: {
|
|
63
|
+
order: "pre",
|
|
64
|
+
async handler(id) {
|
|
65
|
+
if (exclude?.test?.(id)) return null;
|
|
66
|
+
if (!include.test(id)) return null;
|
|
67
|
+
try {
|
|
68
|
+
const content = await readFile(id, "utf-8");
|
|
69
|
+
if (validate) parse(content);
|
|
70
|
+
return `export default ${JSON.stringify(content)}`;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return null;
|
|
73
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
74
|
+
this.error(`Failed to read GraphQL file ${id}: ${message}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
if (app.options.dev) rollupConfig$1.plugins.push({
|
|
40
80
|
name: "nitro-graphql-watcher",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
81
|
+
buildStart: {
|
|
82
|
+
order: "pre",
|
|
83
|
+
async handler() {
|
|
84
|
+
const graphqlFiles = await scanGraphql(nitro);
|
|
85
|
+
for (const file of graphqlFiles) this.addWatchFile(file);
|
|
86
|
+
}
|
|
44
87
|
}
|
|
45
88
|
});
|
|
46
89
|
}
|
|
@@ -53,7 +96,7 @@ async function rollupConfig(app) {
|
|
|
53
96
|
function virtualSchemas(app) {
|
|
54
97
|
const getSchemas = () => [...app.scanSchemas, ...app.options.graphql?.typedefs ?? []];
|
|
55
98
|
app.options.virtual ??= {};
|
|
56
|
-
app.options.virtual["#nitro-
|
|
99
|
+
app.options.virtual["#nitro-graphql/server-schemas"] = () => {
|
|
57
100
|
try {
|
|
58
101
|
const imports = getSchemas();
|
|
59
102
|
if (imports.length === 0) {
|
|
@@ -62,15 +105,13 @@ function virtualSchemas(app) {
|
|
|
62
105
|
}
|
|
63
106
|
const importStatements = imports.map((handler) => `import ${getImportId(handler)} from '${handler}';`);
|
|
64
107
|
const schemaArray = imports.map((h) => `{ def: ${getImportId(h)} }`);
|
|
65
|
-
|
|
108
|
+
return `
|
|
66
109
|
${importStatements.join("\n")}
|
|
67
110
|
|
|
68
111
|
export const schemas = [
|
|
69
112
|
${schemaArray.join(",\n")}
|
|
70
113
|
];
|
|
71
114
|
`;
|
|
72
|
-
if (app.options.dev) app.logger.success(`[nitro-graphql] Generated virtual schema module: ${imports.length} schema(s)`);
|
|
73
|
-
return code;
|
|
74
115
|
} catch (error) {
|
|
75
116
|
app.logger.error("[nitro-graphql] Failed to generate virtual schema module:", error);
|
|
76
117
|
return "export const schemas = []";
|
|
@@ -80,7 +121,7 @@ ${schemaArray.join(",\n")}
|
|
|
80
121
|
function virtualResolvers(app) {
|
|
81
122
|
const getResolvers = () => [...app.scanResolvers];
|
|
82
123
|
app.options.virtual ??= {};
|
|
83
|
-
app.options.virtual["#nitro-
|
|
124
|
+
app.options.virtual["#nitro-graphql/server-resolvers"] = () => {
|
|
84
125
|
try {
|
|
85
126
|
const imports = getResolvers();
|
|
86
127
|
if (imports.length === 0) {
|
|
@@ -106,7 +147,7 @@ function virtualResolvers(app) {
|
|
|
106
147
|
for (const msg of invalidImports) app.logger.warn(` - ${msg}`);
|
|
107
148
|
}
|
|
108
149
|
const data = imports.map(({ imports: importList }) => importList.map((i) => `{ resolver: ${i.as} }`).join(",\n")).filter(Boolean).join(",\n");
|
|
109
|
-
|
|
150
|
+
return [
|
|
110
151
|
...importsContent,
|
|
111
152
|
"",
|
|
112
153
|
"export const resolvers = [",
|
|
@@ -114,11 +155,6 @@ function virtualResolvers(app) {
|
|
|
114
155
|
"]",
|
|
115
156
|
""
|
|
116
157
|
].join("\n");
|
|
117
|
-
if (app.options.dev) {
|
|
118
|
-
const totalExports = imports.reduce((sum, r) => sum + r.imports.length, 0);
|
|
119
|
-
app.logger.success(`[nitro-graphql] Generated virtual resolver module: ${totalExports} export(s) from ${imports.length} file(s)`);
|
|
120
|
-
}
|
|
121
|
-
return code;
|
|
122
158
|
} catch (error) {
|
|
123
159
|
app.logger.error("[nitro-graphql] Failed to generate virtual resolver module:", error);
|
|
124
160
|
return "export const resolvers = []";
|
|
@@ -128,7 +164,7 @@ function virtualResolvers(app) {
|
|
|
128
164
|
function virtualDirectives(app) {
|
|
129
165
|
const getDirectives = () => app.scanDirectives || [];
|
|
130
166
|
app.options.virtual ??= {};
|
|
131
|
-
app.options.virtual["#nitro-
|
|
167
|
+
app.options.virtual["#nitro-graphql/server-directives"] = () => {
|
|
132
168
|
try {
|
|
133
169
|
const imports = getDirectives();
|
|
134
170
|
if (imports.length === 0) return "export const directives = []";
|
|
@@ -151,7 +187,7 @@ function virtualDirectives(app) {
|
|
|
151
187
|
for (const msg of invalidImports) app.logger.warn(` - ${msg}`);
|
|
152
188
|
}
|
|
153
189
|
const data = imports.map(({ imports: importList }) => importList.map((i) => `{ directive: ${i.as} }`).join(",\n")).filter(Boolean).join(",\n");
|
|
154
|
-
|
|
190
|
+
return [
|
|
155
191
|
...importsContent,
|
|
156
192
|
"",
|
|
157
193
|
"export const directives = [",
|
|
@@ -159,11 +195,6 @@ function virtualDirectives(app) {
|
|
|
159
195
|
"]",
|
|
160
196
|
""
|
|
161
197
|
].join("\n");
|
|
162
|
-
if (app.options.dev) {
|
|
163
|
-
const totalExports = imports.reduce((sum, d) => sum + d.imports.length, 0);
|
|
164
|
-
app.logger.success(`[nitro-graphql] Generated virtual directive module: ${totalExports} directive(s) from ${imports.length} file(s)`);
|
|
165
|
-
}
|
|
166
|
-
return code;
|
|
167
198
|
} catch (error) {
|
|
168
199
|
app.logger.error("[nitro-graphql] Failed to generate virtual directive module:", error);
|
|
169
200
|
return "export const directives = []";
|
|
@@ -173,7 +204,7 @@ function virtualDirectives(app) {
|
|
|
173
204
|
function getGraphQLConfig(app) {
|
|
174
205
|
const configPath = resolve(app.graphql.serverDir, "config.ts");
|
|
175
206
|
app.options.virtual ??= {};
|
|
176
|
-
app.options.virtual["#nitro-
|
|
207
|
+
app.options.virtual["#nitro-graphql/graphql-config"] = () => {
|
|
177
208
|
return `import config from '${configPath}'
|
|
178
209
|
const importedConfig = config
|
|
179
210
|
export { importedConfig }
|
|
@@ -182,41 +213,41 @@ export { importedConfig }
|
|
|
182
213
|
}
|
|
183
214
|
function virtualModuleConfig(app) {
|
|
184
215
|
app.options.virtual ??= {};
|
|
185
|
-
app.options.virtual["#nitro-
|
|
216
|
+
app.options.virtual["#nitro-graphql/module-config"] = () => {
|
|
186
217
|
const moduleConfig = app.options.graphql || {};
|
|
187
218
|
return `export const moduleConfig = ${JSON.stringify(moduleConfig, null, 2)};`;
|
|
188
219
|
};
|
|
189
220
|
}
|
|
190
221
|
function virtualDebugInfo(app) {
|
|
191
222
|
app.options.virtual ??= {};
|
|
192
|
-
app.options.virtual["#nitro-
|
|
223
|
+
app.options.virtual["#nitro-graphql/debug-info"] = () => {
|
|
193
224
|
const virtualModuleCodes = {};
|
|
194
225
|
try {
|
|
195
|
-
const schemasGenerator = app.options.virtual["#nitro-
|
|
226
|
+
const schemasGenerator = app.options.virtual["#nitro-graphql/server-schemas"];
|
|
196
227
|
if (schemasGenerator && typeof schemasGenerator === "function") virtualModuleCodes["server-schemas"] = schemasGenerator();
|
|
197
228
|
} catch (error) {
|
|
198
229
|
virtualModuleCodes["server-schemas"] = `// Error generating: ${error instanceof Error ? error.message : String(error)}`;
|
|
199
230
|
}
|
|
200
231
|
try {
|
|
201
|
-
const resolversGenerator = app.options.virtual["#nitro-
|
|
232
|
+
const resolversGenerator = app.options.virtual["#nitro-graphql/server-resolvers"];
|
|
202
233
|
if (resolversGenerator && typeof resolversGenerator === "function") virtualModuleCodes["server-resolvers"] = resolversGenerator();
|
|
203
234
|
} catch (error) {
|
|
204
235
|
virtualModuleCodes["server-resolvers"] = `// Error generating: ${error instanceof Error ? error.message : String(error)}`;
|
|
205
236
|
}
|
|
206
237
|
try {
|
|
207
|
-
const directivesGenerator = app.options.virtual["#nitro-
|
|
238
|
+
const directivesGenerator = app.options.virtual["#nitro-graphql/server-directives"];
|
|
208
239
|
if (directivesGenerator && typeof directivesGenerator === "function") virtualModuleCodes["server-directives"] = directivesGenerator();
|
|
209
240
|
} catch (error) {
|
|
210
241
|
virtualModuleCodes["server-directives"] = `// Error generating: ${error instanceof Error ? error.message : String(error)}`;
|
|
211
242
|
}
|
|
212
243
|
try {
|
|
213
|
-
const moduleConfigGenerator = app.options.virtual["#nitro-
|
|
244
|
+
const moduleConfigGenerator = app.options.virtual["#nitro-graphql/module-config"];
|
|
214
245
|
if (moduleConfigGenerator && typeof moduleConfigGenerator === "function") virtualModuleCodes["module-config"] = moduleConfigGenerator();
|
|
215
246
|
} catch (error) {
|
|
216
247
|
virtualModuleCodes["module-config"] = `// Error generating: ${error instanceof Error ? error.message : String(error)}`;
|
|
217
248
|
}
|
|
218
249
|
try {
|
|
219
|
-
const graphqlConfigGenerator = app.options.virtual["#nitro-
|
|
250
|
+
const graphqlConfigGenerator = app.options.virtual["#nitro-graphql/graphql-config"];
|
|
220
251
|
if (graphqlConfigGenerator && typeof graphqlConfigGenerator === "function") virtualModuleCodes["graphql-config"] = graphqlConfigGenerator();
|
|
221
252
|
} catch (error) {
|
|
222
253
|
virtualModuleCodes["graphql-config"] = `// Error generating: ${error instanceof Error ? error.message : String(error)}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as h30 from "h3";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/apollo-server.d.ts
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: h30.EventHandlerWithFetch<h30.EventHandlerRequest, Promise<any>>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { _default as default };
|
|
@@ -2,11 +2,11 @@ import { consola as consola$1 } from "consola";
|
|
|
2
2
|
import defu from "defu";
|
|
3
3
|
import { parse } from "graphql";
|
|
4
4
|
import { mergeResolvers, mergeTypeDefs } from "@graphql-tools/merge";
|
|
5
|
-
import { importedConfig } from "#nitro-
|
|
6
|
-
import { moduleConfig } from "#nitro-
|
|
7
|
-
import { directives } from "#nitro-
|
|
8
|
-
import { resolvers } from "#nitro-
|
|
9
|
-
import { schemas } from "#nitro-
|
|
5
|
+
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
6
|
+
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
7
|
+
import { directives } from "#nitro-graphql/server-directives";
|
|
8
|
+
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
9
|
+
import { schemas } from "#nitro-graphql/server-schemas";
|
|
10
10
|
import { ApolloServer } from "@apollo/server";
|
|
11
11
|
import { ApolloServerPluginLandingPageLocalDefault } from "@apollo/server/plugin/landingPage/default";
|
|
12
12
|
import { makeExecutableSchema } from "@graphql-tools/schema";
|
package/dist/routes/debug.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as h31 from "h3";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/debug.d.ts
|
|
4
4
|
|
|
@@ -10,6 +10,52 @@ 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:
|
|
13
|
+
declare const _default: h31.EventHandlerWithFetch<h31.EventHandlerRequest, Promise<string | {
|
|
14
|
+
timestamp: string;
|
|
15
|
+
environment: {
|
|
16
|
+
dev: any;
|
|
17
|
+
framework: any;
|
|
18
|
+
};
|
|
19
|
+
graphql: {
|
|
20
|
+
framework: any;
|
|
21
|
+
federation: any;
|
|
22
|
+
};
|
|
23
|
+
scanned: {
|
|
24
|
+
schemas: any;
|
|
25
|
+
schemaFiles: any;
|
|
26
|
+
resolvers: any;
|
|
27
|
+
resolverFiles: any;
|
|
28
|
+
directives: any;
|
|
29
|
+
directiveFiles: any;
|
|
30
|
+
documents: any;
|
|
31
|
+
documentFiles: any;
|
|
32
|
+
};
|
|
33
|
+
runtime: {
|
|
34
|
+
loadedResolvers: number;
|
|
35
|
+
loadedSchemas: number;
|
|
36
|
+
loadedDirectives: number;
|
|
37
|
+
};
|
|
38
|
+
virtualModules: any;
|
|
39
|
+
virtualModuleSamples: {
|
|
40
|
+
'server-resolvers': {
|
|
41
|
+
resolverCount: number;
|
|
42
|
+
sample: {
|
|
43
|
+
hasResolver: boolean;
|
|
44
|
+
resolverKeys: string[];
|
|
45
|
+
}[];
|
|
46
|
+
};
|
|
47
|
+
'server-schemas': {
|
|
48
|
+
schemaCount: number;
|
|
49
|
+
sample: {
|
|
50
|
+
defLength: number;
|
|
51
|
+
defPreview: string;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
'server-directives': {
|
|
55
|
+
directiveCount: number;
|
|
56
|
+
};
|
|
57
|
+
'module-config': Record<string, any>;
|
|
58
|
+
};
|
|
59
|
+
}>>;
|
|
14
60
|
//#endregion
|
|
15
61
|
export { _default as default };
|
package/dist/routes/debug.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { moduleConfig } from "#nitro-
|
|
2
|
-
import { directives } from "#nitro-
|
|
3
|
-
import { resolvers } from "#nitro-
|
|
4
|
-
import { schemas } from "#nitro-
|
|
1
|
+
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
2
|
+
import { directives } from "#nitro-graphql/server-directives";
|
|
3
|
+
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
4
|
+
import { schemas } from "#nitro-graphql/server-schemas";
|
|
5
5
|
import { defineEventHandler, getQuery, setResponseHeader } from "h3";
|
|
6
|
-
import { debugInfo } from "#nitro-
|
|
6
|
+
import { debugInfo } from "#nitro-graphql/debug-info";
|
|
7
7
|
|
|
8
8
|
//#region src/routes/debug.ts
|
|
9
9
|
/**
|
|
@@ -360,7 +360,7 @@ function generateHtmlDashboard(debugInfo$1) {
|
|
|
360
360
|
<div class="flex items-center gap-3">
|
|
361
361
|
<span class="${colorConfig.text} text-lg">▸</span>
|
|
362
362
|
<div>
|
|
363
|
-
<span class="font-mono text-sm ${colorConfig.text} font-semibold">#nitro-
|
|
363
|
+
<span class="font-mono text-sm ${colorConfig.text} font-semibold">#nitro-graphql/${moduleName}</span>
|
|
364
364
|
<div class="text-[10px] text-slate-500 mt-0.5">
|
|
365
365
|
${lineCount} lines · ${(byteSize / 1024).toFixed(2)} KB
|
|
366
366
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as h33 from "h3";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/graphql-yoga.d.ts
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: h33.EventHandlerWithFetch<h33.EventHandlerRequest, Promise<Response>>;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { _default as default };
|
|
@@ -2,11 +2,11 @@ import { consola as consola$1 } from "consola";
|
|
|
2
2
|
import defu from "defu";
|
|
3
3
|
import { parse } from "graphql";
|
|
4
4
|
import { mergeResolvers, mergeTypeDefs } from "@graphql-tools/merge";
|
|
5
|
-
import { importedConfig } from "#nitro-
|
|
6
|
-
import { moduleConfig } from "#nitro-
|
|
7
|
-
import { directives } from "#nitro-
|
|
8
|
-
import { resolvers } from "#nitro-
|
|
9
|
-
import { schemas } from "#nitro-
|
|
5
|
+
import { importedConfig } from "#nitro-graphql/graphql-config";
|
|
6
|
+
import { moduleConfig } from "#nitro-graphql/module-config";
|
|
7
|
+
import { directives } from "#nitro-graphql/server-directives";
|
|
8
|
+
import { resolvers } from "#nitro-graphql/server-resolvers";
|
|
9
|
+
import { schemas } from "#nitro-graphql/server-schemas";
|
|
10
10
|
import { makeExecutableSchema } from "@graphql-tools/schema";
|
|
11
11
|
import { defineEventHandler } from "h3";
|
|
12
12
|
import { createYoga } from "graphql-yoga";
|
package/dist/routes/health.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as h35 from "h3";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/health.d.ts
|
|
4
|
-
declare const _default:
|
|
4
|
+
declare const _default: h35.EventHandlerWithFetch<h35.EventHandlerRequest, Promise<{
|
|
5
|
+
status: string;
|
|
6
|
+
message: string;
|
|
7
|
+
timestamp: string;
|
|
8
|
+
}>>;
|
|
5
9
|
//#endregion
|
|
6
10
|
export { _default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//#region src/types/standard-schema.d.ts
|
|
2
2
|
/** The Standard Schema interface. */
|
|
3
|
-
interface StandardSchemaV1<Input
|
|
3
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
4
4
|
/** The Standard Schema properties. */
|
|
5
|
-
readonly '~standard': StandardSchemaV1.Props<Input
|
|
5
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
6
6
|
}
|
|
7
7
|
declare namespace StandardSchemaV1 {
|
|
8
8
|
/** The Standard Schema properties interface. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/virtual/debug-info.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/debug-info
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
declare const debugInfo: Record<string, any>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { debugInfo };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/virtual/debug-info.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/debug-info
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
const debugInfo = {
|
|
8
|
+
isDev: false,
|
|
9
|
+
framework: "",
|
|
10
|
+
graphqlFramework: "",
|
|
11
|
+
federation: {},
|
|
12
|
+
scanned: {
|
|
13
|
+
schemas: 0,
|
|
14
|
+
schemaFiles: [],
|
|
15
|
+
resolvers: 0,
|
|
16
|
+
resolverFiles: [],
|
|
17
|
+
directives: 0,
|
|
18
|
+
directiveFiles: [],
|
|
19
|
+
documents: 0,
|
|
20
|
+
documentFiles: []
|
|
21
|
+
},
|
|
22
|
+
virtualModules: {}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { debugInfo };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/virtual/graphql-config.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/graphql-config
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
declare const importedConfig: {};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { importedConfig };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/virtual/graphql-config.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/graphql-config
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
const importedConfig = {};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { importedConfig };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/virtual/module-config.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/module-config
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
declare const moduleConfig: Record<string, any>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { moduleConfig };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/virtual/module-config.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/module-config
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
const moduleConfig = {};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { moduleConfig };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/virtual/server-directives.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/server-directives
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
declare const directives: Array<{
|
|
8
|
+
directive: any;
|
|
9
|
+
}>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { directives };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/virtual/server-directives.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/server-directives
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
const directives = [];
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { directives };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/virtual/server-resolvers.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/server-resolvers
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
declare const resolvers: Array<{
|
|
8
|
+
resolver: any;
|
|
9
|
+
}>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { resolvers };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/virtual/server-resolvers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/server-resolvers
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
const resolvers = [];
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { resolvers };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/virtual/server-schemas.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/server-schemas
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
declare const schemas: Array<{
|
|
8
|
+
def: string;
|
|
9
|
+
}>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { schemas };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/virtual/server-schemas.ts
|
|
2
|
+
/**
|
|
3
|
+
* Virtual module stub for #nitro-graphql/server-schemas
|
|
4
|
+
* This file is only used during build/bundling to prevent import resolution errors.
|
|
5
|
+
* At runtime, Nitro will override this with the actual virtual module.
|
|
6
|
+
*/
|
|
7
|
+
const schemas = [];
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { schemas };
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-graphql",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.7",
|
|
5
|
+
"packageManager": "pnpm@10.20.0",
|
|
5
6
|
"description": "GraphQL integration for Nitro",
|
|
6
7
|
"license": "MIT",
|
|
7
8
|
"sideEffects": false,
|
|
@@ -9,6 +10,30 @@
|
|
|
9
10
|
"#graphql/server": {
|
|
10
11
|
"types": "./dist/graphql/server.d.ts",
|
|
11
12
|
"import": "./dist/graphql/server.js"
|
|
13
|
+
},
|
|
14
|
+
"#nitro-graphql/graphql-config": {
|
|
15
|
+
"types": "./dist/virtual/graphql-config.d.ts",
|
|
16
|
+
"import": "./dist/virtual/graphql-config.js"
|
|
17
|
+
},
|
|
18
|
+
"#nitro-graphql/server-schemas": {
|
|
19
|
+
"types": "./dist/virtual/server-schemas.d.ts",
|
|
20
|
+
"import": "./dist/virtual/server-schemas.js"
|
|
21
|
+
},
|
|
22
|
+
"#nitro-graphql/server-resolvers": {
|
|
23
|
+
"types": "./dist/virtual/server-resolvers.d.ts",
|
|
24
|
+
"import": "./dist/virtual/server-resolvers.js"
|
|
25
|
+
},
|
|
26
|
+
"#nitro-graphql/server-directives": {
|
|
27
|
+
"types": "./dist/virtual/server-directives.d.ts",
|
|
28
|
+
"import": "./dist/virtual/server-directives.js"
|
|
29
|
+
},
|
|
30
|
+
"#nitro-graphql/module-config": {
|
|
31
|
+
"types": "./dist/virtual/module-config.d.ts",
|
|
32
|
+
"import": "./dist/virtual/module-config.js"
|
|
33
|
+
},
|
|
34
|
+
"#nitro-graphql/debug-info": {
|
|
35
|
+
"types": "./dist/virtual/debug-info.d.ts",
|
|
36
|
+
"import": "./dist/virtual/debug-info.js"
|
|
12
37
|
}
|
|
13
38
|
},
|
|
14
39
|
"exports": {
|
|
@@ -62,6 +87,21 @@
|
|
|
62
87
|
"files": [
|
|
63
88
|
"dist"
|
|
64
89
|
],
|
|
90
|
+
"scripts": {
|
|
91
|
+
"prepack": "pnpm build",
|
|
92
|
+
"build": "tsdown",
|
|
93
|
+
"dev": "tsdown --watch",
|
|
94
|
+
"bumpp": "bumpp package.json",
|
|
95
|
+
"release": "pnpm build && pnpm bumpp && pnpm publish --no-git-checks --access public",
|
|
96
|
+
"playground:nitro": "cd playgrounds/nitro && pnpm install && pnpm dev",
|
|
97
|
+
"playground:nuxt": "cd playgrounds/nuxt && pnpm install && pnpm dev",
|
|
98
|
+
"playground:federation": "cd playgrounds/federation && pnpm install && pnpm dev",
|
|
99
|
+
"docs:dev": "cd .docs && pnpm install && pnpm dev",
|
|
100
|
+
"docs:build": "cd .docs && pnpm install && pnpm build",
|
|
101
|
+
"docs:preview": "cd .docs && pnpm preview",
|
|
102
|
+
"lint": "eslint .",
|
|
103
|
+
"lint:fix": "eslint . --fix"
|
|
104
|
+
},
|
|
65
105
|
"peerDependencies": {
|
|
66
106
|
"@apollo/server": "^5.0.0",
|
|
67
107
|
"@apollo/utils.withrequired": "^3.0.0",
|
|
@@ -82,63 +122,49 @@
|
|
|
82
122
|
}
|
|
83
123
|
},
|
|
84
124
|
"dependencies": {
|
|
85
|
-
"@apollo/subgraph": "
|
|
86
|
-
"@graphql-codegen/core": "
|
|
87
|
-
"@graphql-codegen/import-types-preset": "
|
|
88
|
-
"@graphql-codegen/typescript": "
|
|
89
|
-
"@graphql-codegen/typescript-generic-sdk": "
|
|
90
|
-
"@graphql-codegen/typescript-operations": "
|
|
91
|
-
"@graphql-codegen/typescript-resolvers": "
|
|
92
|
-
"@graphql-tools/graphql-file-loader": "
|
|
93
|
-
"@graphql-tools/load": "
|
|
94
|
-
"@graphql-tools/load-files": "
|
|
95
|
-
"@graphql-tools/merge": "
|
|
96
|
-
"@graphql-tools/schema": "
|
|
97
|
-
"@graphql-tools/url-loader": "
|
|
98
|
-
"@graphql-tools/utils": "
|
|
99
|
-
"chokidar": "
|
|
100
|
-
"consola": "
|
|
101
|
-
"defu": "
|
|
102
|
-
"graphql-config": "
|
|
103
|
-
"graphql-scalars": "
|
|
104
|
-
"knitwork": "
|
|
105
|
-
"ohash": "
|
|
106
|
-
"oxc-parser": "
|
|
107
|
-
"pathe": "
|
|
108
|
-
"tinyglobby": "
|
|
125
|
+
"@apollo/subgraph": "catalog:",
|
|
126
|
+
"@graphql-codegen/core": "catalog:",
|
|
127
|
+
"@graphql-codegen/import-types-preset": "catalog:",
|
|
128
|
+
"@graphql-codegen/typescript": "catalog:",
|
|
129
|
+
"@graphql-codegen/typescript-generic-sdk": "catalog:",
|
|
130
|
+
"@graphql-codegen/typescript-operations": "catalog:",
|
|
131
|
+
"@graphql-codegen/typescript-resolvers": "catalog:",
|
|
132
|
+
"@graphql-tools/graphql-file-loader": "catalog:",
|
|
133
|
+
"@graphql-tools/load": "catalog:",
|
|
134
|
+
"@graphql-tools/load-files": "catalog:",
|
|
135
|
+
"@graphql-tools/merge": "catalog:",
|
|
136
|
+
"@graphql-tools/schema": "catalog:",
|
|
137
|
+
"@graphql-tools/url-loader": "catalog:",
|
|
138
|
+
"@graphql-tools/utils": "catalog:",
|
|
139
|
+
"chokidar": "catalog:",
|
|
140
|
+
"consola": "catalog:",
|
|
141
|
+
"defu": "catalog:",
|
|
142
|
+
"graphql-config": "catalog:",
|
|
143
|
+
"graphql-scalars": "catalog:",
|
|
144
|
+
"knitwork": "catalog:",
|
|
145
|
+
"ohash": "catalog:",
|
|
146
|
+
"oxc-parser": "catalog:",
|
|
147
|
+
"pathe": "catalog:",
|
|
148
|
+
"tinyglobby": "catalog:"
|
|
109
149
|
},
|
|
110
150
|
"devDependencies": {
|
|
111
|
-
"@antfu/eslint-config": "
|
|
112
|
-
"@nuxt/kit": "
|
|
113
|
-
"@nuxt/schema": "
|
|
114
|
-
"@types/node": "
|
|
115
|
-
"bumpp": "
|
|
116
|
-
"changelogen": "
|
|
117
|
-
"crossws": "
|
|
118
|
-
"eslint": "
|
|
119
|
-
"graphql": "
|
|
120
|
-
"graphql-yoga": "
|
|
121
|
-
"h3": "
|
|
122
|
-
"nitro": "
|
|
123
|
-
"tsdown": "
|
|
124
|
-
"typescript": "
|
|
151
|
+
"@antfu/eslint-config": "catalog:",
|
|
152
|
+
"@nuxt/kit": "catalog:",
|
|
153
|
+
"@nuxt/schema": "catalog:",
|
|
154
|
+
"@types/node": "catalog:",
|
|
155
|
+
"bumpp": "catalog:",
|
|
156
|
+
"changelogen": "catalog:",
|
|
157
|
+
"crossws": "catalog:",
|
|
158
|
+
"eslint": "catalog:",
|
|
159
|
+
"graphql": "catalog:",
|
|
160
|
+
"graphql-yoga": "catalog:",
|
|
161
|
+
"h3": "catalog:",
|
|
162
|
+
"nitro": "catalog:",
|
|
163
|
+
"tsdown": "catalog:",
|
|
164
|
+
"typescript": "catalog:",
|
|
125
165
|
"vitepress-plugin-llms": "^1.8.1"
|
|
126
166
|
},
|
|
127
167
|
"resolutions": {
|
|
128
168
|
"nitro-graphql": "link:."
|
|
129
|
-
},
|
|
130
|
-
"scripts": {
|
|
131
|
-
"build": "tsdown",
|
|
132
|
-
"dev": "tsdown --watch",
|
|
133
|
-
"bumpp": "bumpp package.json",
|
|
134
|
-
"release": "pnpm build && pnpm bumpp && pnpm publish --no-git-checks --access public",
|
|
135
|
-
"playground:nitro": "cd playgrounds/nitro && pnpm install && pnpm dev",
|
|
136
|
-
"playground:nuxt": "cd playgrounds/nuxt && pnpm install && pnpm dev",
|
|
137
|
-
"playground:federation": "cd playgrounds/federation && pnpm install && pnpm dev",
|
|
138
|
-
"docs:dev": "cd .docs && pnpm install && pnpm dev",
|
|
139
|
-
"docs:build": "cd .docs && pnpm install && pnpm build",
|
|
140
|
-
"docs:preview": "cd .docs && pnpm preview",
|
|
141
|
-
"lint": "eslint .",
|
|
142
|
-
"lint:fix": "eslint . --fix"
|
|
143
169
|
}
|
|
144
|
-
}
|
|
170
|
+
}
|