vite-plugin-vue-gql
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -6,4 +6,6 @@ declare module 'vite-gql' { | ||
export function useQuery<T, V>(variables: UseQueryArgs.variables | null, options?: UseQueryOptions): UseQueryResponse<T, V> | ||
export function useQuery<T, V>(queryName?: string, variables: UseQueryArgs.variables, options?: UseQueryOptions): UseQueryResponse<T, V> | ||
export function useQuery<T, V>(variables?: UseQueryArgs.variables | null, options?: UseQueryOptions): UseQueryResponse<T, V> | ||
export function useQuery<T, V>(variables?: UseQueryArgs.variables | null, options?: UseQueryOptions): UseQueryResponse<T, V> | ||
export function useMutation<T, V>(query?: string): UseMutationResponse<T, V> | ||
} |
{ | ||
"name": "vite-plugin-vue-gql", | ||
"description": "Vue SFC GraphQL Block", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.mjs", |
# vite-plugin-vue-gql | ||
### **⚠️ This Plugin is still in Development** | ||
### **⚠️ This Plugin is still in Development and currently only works with the `<script setup>` format** | ||
This plugin allows you to use `gql` blocks in your Vue SFC with Vitejs | ||
### **⚠️ This plugin currently only works with the \<script setup> format** | ||
@@ -80,2 +79,68 @@ ## Install | ||
Multiple GQL Tags | ||
```html | ||
<!-- ExampleComponent.vue --> | ||
<script setup> | ||
import { useQuery } from 'vite-gql' | ||
const { fetching, error, data } = useQuery() | ||
const { fetching: userFetching, error: userError, data: userData } = useQuery('user', { name: 'Evan' }) | ||
</script> | ||
<template> | ||
... | ||
</template> | ||
<gql> | ||
query($name: String!) { | ||
info { | ||
date | ||
time | ||
} | ||
} | ||
</gql> | ||
<gql name="user"> | ||
query($name: String!) { | ||
user(name: $name) { | ||
username | ||
avatar | ||
bio { | ||
description | ||
} | ||
} | ||
} | ||
</gql> | ||
``` | ||
**Mutations** | ||
```html | ||
<!-- ExampleComponent.vue --> | ||
<script setup > | ||
import { useMutation } from 'vite-gql' | ||
const { executeMutation } = mutation() | ||
const createUser = (name) => { | ||
executeMutation({ name }) | ||
} | ||
</script> | ||
<template> | ||
... | ||
</template> | ||
<gql mutation> | ||
mutation($name: String!) { | ||
createUser(name: $name) { | ||
username | ||
created | ||
} | ||
} | ||
</gql> | ||
``` | ||
For more examples visit the `/examples/spa` directory in the repo | ||
@@ -87,4 +152,4 @@ | ||
## Roadmap | ||
- Support `useMutation` and `useSubscription` | ||
- Support multiple named gql tags(or allow them to be tagged as mutations or subscriptions) | ||
- Look into auto detecting used properties and auto-generating a GQL request | ||
- [x] Support `useMutation` and `useSubscription` | ||
- [x] Support multiple named gql tags(or allow them to be tagged as mutations or subscriptions) | ||
- [ ] Look into auto detecting used properties and auto-generating a GQL request |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
vite-plugin-dts |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2422857
68741
153
0