Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Enable Corepack
run: corepack enable npm

- name: Run API in background
working-directory: apollo
run: |
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ code in this repository.
### Development Setup

```sh
corepack enable npm # Use the npm version pinned in package.json (once per Node install)
npm install # Install dependencies
npm run dev:prepare # Generate types (required before development)
```
Expand Down
19,254 changes: 9,906 additions & 9,348 deletions package-lock.json

Large diffs are not rendered by default.

76 changes: 46 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@
"docs/configuration"
],
"engines": {
"node": ">=18.0.0"
"node": ">=22.0.0"
},
"packageManager": "npm@12.0.2+sha512.b885e890b9418fa1693544d05f53e64f9a73ec194837d4258b15fecdd692347b1dd2a517b1b0cbaf9d31cd8e92c3b70956bd2ecc72833a57b4b3098f5bfa7943",
"scripts": {
"prepack": "npm run styles:build && nuxt-module-build build && npm run client:build",
"dev": "PLAYGROUND_MODULE_BUILD=true nuxi dev playground --trace-warnings",
Expand Down Expand Up @@ -99,10 +100,11 @@
"dependencies": {
"@clack/core": "^0.4.2",
"@clack/prompts": "^0.11.0",
"@graphql-codegen/cli": "^6.1.0",
"@graphql-codegen/schema-ast": "^5.0.0",
"@graphql-tools/load": "^8.1.0",
"@graphql-tools/utils": "^10.11.0",
"@graphql-codegen/cli": "^7.4.6",
"@graphql-codegen/plugin-helpers": "^7.4.2",
"@graphql-codegen/schema-ast": "^6.1.1",
"@graphql-tools/load": "^8.1.20",
"@graphql-tools/utils": "^12.0.4",
"@nuxt/devtools-kit": "^3.2.4",
"graphql-typescript-deluxe": "^0.1.0",
"is-unicode-supported": "^2.1.0",
Expand All @@ -113,7 +115,7 @@
"peerDependencies": {
"@modelcontextprotocol/sdk": "^1.24.0",
"@nuxtjs/mcp-toolkit": "^0.5.2",
"graphql": "^16.0.0",
"graphql": "^16.14.2",
"zod": "^3.0.0 || ^4.0.0"
},
"peerDependenciesMeta": {
Expand All @@ -128,44 +130,58 @@
}
},
"devDependencies": {
"@iconify-json/carbon": "^1.2.15",
"@modelcontextprotocol/sdk": "^1.24.3",
"@iconify-json/carbon": "^1.2.28",
"@modelcontextprotocol/sdk": "^1.32.1",
"@nuxt/devtools": "^3.1.1",
"@nuxt/devtools-ui-kit": "^3.1.1",
"@nuxt/eslint": "^1.12.1",
"@nuxt/devtools-ui-kit": "^3.4.3",
"@nuxt/eslint": "^1.17.0",
"@nuxt/kit": "^4.4.2",
"@nuxt/module-builder": "^1.0.2",
"@nuxt/module-builder": "^1.0.3",
"@nuxt/schema": "^4.4.2",
"@nuxt/test-utils": "^3.21.0",
"@nuxt/test-utils": "^3.23.0",
"@nuxtjs/mcp-toolkit": "^0.5.2",
"@types/micromatch": "^4.0.10",
"commander": "^13.1.0",
"cypress": "^15.7.1",
"cypress": "^15.21.1",
"cypress-wait-until": "^3.0.2",
"eslint": "^9.39.2",
"eslint": "^10.12.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import-x": "^4.16.1",
"eslint-plugin-prettier": "^5.5.4",
"mermaid": "^11.12.2",
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-prettier": "^5.5.7",
"mermaid": "^11.17.2",
"minisearch": "^7.2.0",
"nuxt": "^4.4.2",
"postcss": "^8.5.6",
"postcss": "^8.5.30",
"postcss-cli": "^11.0.1",
"postcss-import": "^16.1.1",
"postcss-import": "^16.2.0",
"postcss-nested-import": "^1.3.0",
"postcss-prefix-selector": "^2.1.1",
"postcss-prefix-selector": "^2.2.1",
"postcss-replace": "^2.0.1",
"postcss-url": "^10.1.3",
"prettier": "^3.7.4",
"tailwindcss": "^3.4.17",
"tailwindcss-scoped-preflight": "^3.5.4",
"typedoc": "^0.28.15",
"typedoc-plugin-markdown": "^4.9.0",
"typedoc-vitepress-theme": "^1.1.2",
"postcss-url": "^10.1.4",
"prettier": "^3.9.10",
"tailwindcss": "^3.4.19",
"tailwindcss-scoped-preflight": "^3.5.9",
"typedoc": "^0.28.20",
"typedoc-plugin-markdown": "^4.14.0",
"typedoc-vitepress-theme": "^1.1.4",
"vitepress": "^1.6.4",
"vitepress-plugin-mermaid": "^2.0.17",
"vitest": "^3.2.4",
"vue-tsc": "^3.1.8",
"zod": "^4.0.0"
"vitest": "^3.2.7",
"vue-tsc": "^3.3.13",
"zod": "^4.6.7"
},
"overrides": {
"mkdist": {
"vue-sfc-transformer": "^0.2.3"
}
},
"allowScripts": {
"@parcel/watcher@2.6.0": true,
"cypress@15.21.1": true,
"esbuild@0.28.2": true,
"esbuild@0.25.12": true,
"esbuild@0.21.5": true,
"fsevents@2.3.3": true,
"unrs-resolver@1.12.2": true
}
}
3 changes: 2 additions & 1 deletion playground-layers/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"name": "nuxt-graphql-middleware-playground-layers"
"name": "nuxt-graphql-middleware-playground-layers",
"type": "module"
}
3 changes: 2 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"name": "nuxt-graphql-middleware-playground"
"name": "nuxt-graphql-middleware-playground",
"type": "module"
}
2 changes: 2 additions & 0 deletions src/build/Collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ export class Collector {
} catch (e) {
this.logError(e)

// The error has already been logged above.
// eslint-disable-next-line preserve-caught-error
throw new Error('GraphQL document validation failed.')
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/build/SchemaProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export class SchemaProvider {
logger.error(error)
const hasLoaded = await this.loadFromDiskFallback()
if (!hasLoaded) {
// The error has already been logged above.
// eslint-disable-next-line preserve-caught-error
throw new Error('Failed to load GraphQL schema.')
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/build/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useLogger } from '@nuxt/kit'
import type { ConsolaInstance } from 'consola'
import type { ModuleOptions } from '../types/options'

export const logger: ConsolaInstance = useLogger('nuxt-graphql-middleware')
// Nuxt >= 4.6 types this as NuxtLogger, but it's still a consola instance.
export const logger = useLogger('nuxt-graphql-middleware') as ConsolaInstance

export const defaultOptions: ModuleOptions = {
downloadSchema: true,
Expand Down
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ declare module 'vite/types/customEvent.d.ts' {
}
}

declare module 'nuxt/schema' {
declare module '@nuxt/schema' {
interface AppConfig {
graphqlMiddleware: {
/**
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/components/CodeFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class="nuxt-graphql-middleware-errors-code-line-number"
:class="{ 'ngm-is-highlighted': l.isHighlighted }"
>
<!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="l.lineNumber" />
</div>
</div>
Expand All @@ -17,6 +18,7 @@
class="nuxt-graphql-middleware-errors-code-code"
:class="{ 'ngm-is-highlighted': l.isHighlighted }"
>
<!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="l.code" />
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/composables/useAsyncGraphqlQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export function useAsyncGraphqlQuery<
| undefined
>

// The overloads only differ in the default of DefaultT (like Nuxt's useAsyncData).
// eslint-disable-next-line @typescript-eslint/unified-signatures
export function useAsyncGraphqlQuery<
Name extends keyof Query,
Operation extends Query[Name] = Query[Name],
Expand Down
16 changes: 9 additions & 7 deletions src/runtime/helpers/shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ export type MutationObjectArgs<
}

export type PickFrom<T, K extends Array<string>> =
T extends Array<any>
KeysOf<T> extends K
? T
: T extends Record<string, any>
? keyof T extends K[number]
? T
: K[number] extends never
: T extends Array<any>
? T
: T extends Record<string, any>
? keyof T extends K[number]
? T
: Pick<T, K[number]>
: T
: K[number] extends never
? T
: Pick<T, K[number]>
: T

export type KeysOf<T> = Array<
T extends T ? (keyof T extends string ? keyof T : never) : never
Expand Down
Loading