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/README.md +183 -1321
- package/dist/index.js +6 -3
- package/dist/routes/apollo-server.d.ts +2 -2
- package/dist/routes/graphql-yoga.d.ts +2 -2
- package/dist/utils/directive-parser.js +4 -2
- package/package.json +1 -1
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
1
|
+
import * as h33 from "h3";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/apollo-server.d.ts
|
|
4
|
-
declare const _default:
|
|
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
|
|
1
|
+
import * as h30 from "h3";
|
|
2
2
|
|
|
3
3
|
//#region src/routes/graphql-yoga.d.ts
|
|
4
|
-
declare const _default:
|
|
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");
|