nitro-graphql 2.0.0-beta.3 → 2.0.0-beta.6
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 +828 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +80 -26
- package/dist/rollup.js +157 -25
- package/dist/routes/apollo-server.d.ts +2 -2
- package/dist/routes/debug.d.ts +15 -0
- package/dist/routes/debug.js +449 -0
- package/dist/routes/graphql-yoga.d.ts +2 -2
- package/dist/types/index.d.ts +119 -1
- package/dist/types/standard-schema.d.ts +2 -2
- package/dist/utils/file-generator.d.ts +37 -0
- package/dist/utils/file-generator.js +72 -0
- package/dist/utils/index.js +62 -34
- package/dist/utils/path-resolver.d.ts +70 -0
- package/dist/utils/path-resolver.js +127 -0
- package/dist/utils/type-generation.js +111 -38
- package/dist/vite.d.ts +25 -0
- package/dist/vite.js +40 -0
- package/package.json +13 -5
package/dist/vite.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
|
|
3
|
+
//#region src/vite.ts
|
|
4
|
+
/**
|
|
5
|
+
* Vite plugin to load GraphQL files as strings
|
|
6
|
+
* This prevents Vite from trying to parse .graphql/.gql files as JavaScript
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { defineConfig } from 'vite'
|
|
11
|
+
* import { nitro } from 'nitro/vite'
|
|
12
|
+
* import { graphql } from 'nitro-graphql/vite'
|
|
13
|
+
*
|
|
14
|
+
* export default defineConfig({
|
|
15
|
+
* plugins: [
|
|
16
|
+
* graphql(), // Must be before nitro()
|
|
17
|
+
* nitro()
|
|
18
|
+
* ]
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function graphql() {
|
|
23
|
+
return {
|
|
24
|
+
name: "nitro-graphql:vite",
|
|
25
|
+
enforce: "pre",
|
|
26
|
+
async load(id) {
|
|
27
|
+
if (!/\.(?:graphql|gql)$/i.test(id)) return null;
|
|
28
|
+
try {
|
|
29
|
+
const content = await readFile(id, "utf-8");
|
|
30
|
+
return `export default ${JSON.stringify(content)}`;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return null;
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { graphql };
|
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.
|
|
4
|
+
"version": "2.0.0-beta.6",
|
|
5
5
|
"description": "GraphQL integration for Nitro",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
"./nuxt": {
|
|
52
52
|
"types": "./dist/ecosystem/nuxt.d.ts",
|
|
53
53
|
"import": "./dist/ecosystem/nuxt.js"
|
|
54
|
+
},
|
|
55
|
+
"./vite": {
|
|
56
|
+
"types": "./dist/vite.d.ts",
|
|
57
|
+
"import": "./dist/vite.js"
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
60
|
"module": "./dist/index.js",
|
|
@@ -107,17 +111,18 @@
|
|
|
107
111
|
"@antfu/eslint-config": "^6.0.0",
|
|
108
112
|
"@nuxt/kit": "^4.1.3",
|
|
109
113
|
"@nuxt/schema": "^4.1.3",
|
|
110
|
-
"@types/node": "^24.
|
|
114
|
+
"@types/node": "^24.9.1",
|
|
111
115
|
"bumpp": "^10.3.1",
|
|
112
116
|
"changelogen": "^0.6.2",
|
|
113
117
|
"crossws": "0.3.5",
|
|
114
|
-
"eslint": "^9.
|
|
118
|
+
"eslint": "^9.38.0",
|
|
115
119
|
"graphql": "16.11.0",
|
|
116
120
|
"graphql-yoga": "^5.16.0",
|
|
117
121
|
"h3": "^2.0.1-rc.2",
|
|
118
122
|
"nitro": "^3.0.1-alpha.0",
|
|
119
|
-
"tsdown": "^0.15.
|
|
120
|
-
"typescript": "^5.9.3"
|
|
123
|
+
"tsdown": "^0.15.9",
|
|
124
|
+
"typescript": "^5.9.3",
|
|
125
|
+
"vitepress-plugin-llms": "^1.8.1"
|
|
121
126
|
},
|
|
122
127
|
"resolutions": {
|
|
123
128
|
"nitro-graphql": "link:."
|
|
@@ -130,6 +135,9 @@
|
|
|
130
135
|
"playground:nitro": "cd playgrounds/nitro && pnpm install && pnpm dev",
|
|
131
136
|
"playground:nuxt": "cd playgrounds/nuxt && pnpm install && pnpm dev",
|
|
132
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",
|
|
133
141
|
"lint": "eslint .",
|
|
134
142
|
"lint:fix": "eslint . --fix"
|
|
135
143
|
}
|