Repository: dprint/dprint (language: rust)

Issue:
GraphQL support
I've been replacing prettier with dprint in our ~large-ish code generation pipeline, and really enjoying seeing ~70-80% of the flamegraph go away. :-) Thank you!

The last file format I still need to go through prettier for is GraphQL, so it'd be great to see a `@dprint/graphql`.


Discussion / hints:
That would be nice and probably not too bad to do. Would just have to find the time.

Also, thanks for sponsoring, @stephenh!
I've made a GraphQL plugin: https://github.com/g-plane/pretty_graphql

Run

```bash
dprint config add g-plane/pretty_graphql
```

to install.
Awesome @g-plane , thank you! Fwiw if it could eventually be bundled as part of `dprint-node` (to avoid the wasm plugin load step), that would be even more amazing/out-of-the-box (just given how common GraphQL is). 

Fix patch:
diff --git a/README.md b/README.md
index a0c5af597..3e015f311 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,7 @@ Repos:
 - [dprint-plugin-exec](https://github.com/dprint/dprint-plugin-exec) - Formats code with any CLI executable.
 - [Malva](https://github.com/g-plane/malva) - CSS/SCSS/Sass/Less formatter
 - [markup_fmt](https://github.com/g-plane/markup_fmt) - HTML, Vue, Svelte, Astro, Angular, Jinja, Twig, Nunjucks, and Vento formatter.
+- [pretty_graphql](https://github.com/g-plane/pretty_graphql) - GraphQL formatter.
 - [pretty_yaml](https://github.com/g-plane/pretty_yaml) - YAML formatter.
 
 ## Notes
diff --git a/website/playground/src/plugins/getPluginUrls.ts b/website/playground/src/plugins/getPluginUrls.ts
index 0ef35b169..ff64b95b0 100644
--- a/website/playground/src/plugins/getPluginUrls.ts
+++ b/website/playground/src/plugins/getPluginUrls.ts
@@ -17,6 +17,7 @@ export async function getPluginUrls(signal: AbortSignal): Promise<string[]> {
   const malvaPlugin = json.latest.find((p: any) => p.configKey === "malva")!;
   const markupFmtPlugin = json.latest.find((p: any) => p.configKey === "markup")!;
   const prettyYamlPlugin = json.latest.find((p: any) => p.configKey === "yaml")!;
+  const prettyGraphqlPlugin = json.latest.find((p: any) => p.configKey === "graphql")!;
 
   return [
     typescriptPlugin.url,
@@ -29,6 +30,7 @@ export async function getPluginUrls(signal: AbortSignal): Promise<string[]> {
     malvaPlugin.url,
     markupFmtPlugin.url,
     prettyYamlPlugin.url,
+    prettyGraphqlPlugin.url,
   ];
 }
 
@@ -48,6 +50,7 @@ export function getPluginShortNameFromPluginUrl(url: string) {
     case "malva":
     case "markup_fmt":
     case "pretty_yaml":
+    case "pretty_graphql":
       return name;
     default:
       return undefined;
diff --git a/website/src/_includes/layouts/documentation.njk b/website/src/_includes/layouts/documentation.njk
index 483cbb650..6d3767bbb 100644
--- a/website/src/_includes/layouts/documentation.njk
+++ b/website/src/_includes/layouts/documentation.njk
@@ -28,6 +28,7 @@ layout: layouts/base.njk
         <li><a href="/plugins/markup_fmt">Markup_fmt (HTML/Vue/Svelte/Astro)</a></li>
         <li><a href="/plugins/prettier">Prettier</a></li>
         <li><a href="/plugins/biome">Biome (JS/TS/JSON)</a></li>
+        <li><a href="/plugins/pretty_graphql">Pretty GraphQL</a></li>
         <li><a href="/plugins/ruff">Ruff (Python)</a></li>
         <li><a href="/plugins/jupyter">Jupyter</a></li>
         <li><a href="/plugins/exec">Exec (Many CLIs)</a></li>
diff --git a/website/src/index.njk b/website/src/index.njk
index 71356008d..97537c339 100644
--- a/website/src/index.njk
+++ b/website/src/index.njk
@@ -62,6 +62,7 @@ layout: layouts/base.njk
               <li><a href="/plugins/prettier">Prettier</a></li>
               <li><a href="/plugins/biome">Biome (JS/TS/JSON)</a></li>
               <li><a href="/plugins/markup_fmt">markup_fmt (HTML/Vue/Svelte/Astro/...)</a></li>
+              <li><a href="/plugins/pretty_graphql">Pretty GraphQL</a></li>
               <li><a href="/plugins/pretty_yaml">Pretty YAML</a></li>
               <li><a href="/plugins/ruff">Ruff (Python)</a></li>
               <li><a href="/plugins/jupyter">Jupyter</a></li>
diff --git a/website/src/plugins.md b/website/src/plugins.md
index 8424993b6..4f3e8c022 100644
--- a/website/src/plugins.md
+++ b/website/src/plugins.md
@@ -25,6 +25,7 @@ The setup for both is the same except process plugins require a checksum to be s
 - [Biome](/plugins/biome) (JS/TS/JSON)
 - [Malva](/plugins/malva) (CSS/SCSS/Sass/Less)
 - [Markup_fmt](/plugins/markup_fmt) (HTML/Vue/Svelte/Astro/Angular/Jinja/Twig/Nunjucks/Vento)
+- [Pretty GraphQL](/plugins/pretty_graphql) (GraphQL)
 - [Pretty YAML](/plugins/pretty_yaml) (YAML)
 - [Ruff](/plugins/ruff) (Python)
 - [Jupyter](/plugins/jupyter)
diff --git a/website/src/plugins/pretty_graphql.md b/website/src/plugins/pretty_graphql.md
new file mode 100644
index 000000000..65d7f1487
--- /dev/null
+++ b/website/src/plugins/pretty_graphql.md
@@ -0,0 +1,45 @@
+---
+title: Pretty GraphQL Plugin
+description: Documentation on the GraphQL code formatting plugin for dprint.
+layout: layouts/documentation.njk
+---
+
+<nav class="breadcrumb" aria-label="breadcrumbs">
+  <ul>
+    <li><a href="/plugins">Plugins</a></li>
+    <li><a href="/plugins/pretty_graphql">Pretty GraphQL</a></li>
+  </ul>
+</nav>
+
+# Pretty GraphQL Plugin
+
+Adapter plugin that formats GraphQL files via [Pretty GraphQL](https://github.com/g-plane/pretty_graphql).
+
+## Install and Setup
+
+In your project's directory with a dprint.json file, run:
+
+```shellsession
+dprint config add g-plane/pretty_graphql
+```
+
+This will update your config file to have an entry for the plugin. Then optionally specify a `"graphql"` property to add configuration:
+
+```json
+{
+  "graphql": { // not "pretty_graphql"
+    // Pretty GraphQL config goes here
+  },
+  "plugins": [
+    "https://plugins.dprint.dev/g-plane/pretty_graphql-vx.x.x.wasm"
+  ]
+}
+```
+
+## Configuration
+
+See [Configuration](/plugins/pretty_graphql/config) or read [full documentation site](https://pretty-graphql.netlify.app/) with code examples.
+
+## Playground
+
+See [Playground](https://dprint.dev/playground#plugin/pretty_graphql)
diff --git a/website/src/plugins/pretty_graphql/config.md b/website/src/plugins/pretty_graphql/config.md
new file mode 100644
index 000000000..43142de55
--- /dev/null
+++ b/website/src/plugins/pretty_graphql/config.md
@@ -0,0 +1,19 @@
+---
+title: Configuration - Pretty GraphQL
+description: Documentation on the configuration file for the GraphQL formatting plugin for dprint.
+layout: layouts/documentation.njk
+---
+
+<nav class="breadcrumb" aria-label="breadcrumbs">
+  <ul>
+    <li><a href="/plugins">Plugins</a></li>
+    <li><a href="/plugins/pretty_graphql">Pretty GraphQL</a></li>
+    <li><a href="/plugins/pretty_graphql/config">Configuration</a></li>
+  </ul>
+</nav>
+
+# Pretty GraphQL - Configuration
+
+<div class="plugin-config-table" data-url="https://plugins.dprint.dev/g-plane/pretty_graphql/latest/schema.json">
+  Loading...
+</div>
diff --git a/website/src/scripts/plugin-url-replacer.js b/website/src/scripts/plugin-url-replacer.js
index 6c43e8f51..16c425362 100644
--- a/website/src/scripts/plugin-url-replacer.js
+++ b/website/src/scripts/plugin-url-replacer.js
@@ -10,6 +10,7 @@ const jupyterUrl = "https://plugins.dprint.dev/jupyter-x.x.x.wasm";
 const malvaUrl = "https://plugins.dprint.dev/g-plane/malva-vx.x.x.wasm";
 const markupFmtUrl = "https://plugins.dprint.dev/g-plane/markup_fmt-vx.x.x.wasm";
 const yamlUrl = "https://plugins.dprint.dev/g-plane/pretty_yaml-vx.x.x.wasm";
+const graphqlUrl = "https://plugins.dprint.dev/g-plane/pretty_graphql-vx.x.x.wasm";
 const pluginInfoUrl = "https://plugins.dprint.dev/info.json";
 const schemaVersion = 4;
 
@@ -53,6 +54,9 @@ export function replacePluginUrls() {
           case getWithQuotes(yamlUrl):
             element.textContent = getWithQuotes(urls["yaml"]);
             break;
+          case getWithQuotes(graphqlUrl):
+            element.textContent = getWithQuotes(urls["graphql"]);
+            break;
         }
       }
     });
@@ -76,6 +80,7 @@ function getPluginUrlElements() {
       case getWithQuotes(malvaUrl):
       case getWithQuotes(markupFmtUrl):
       case getWithQuotes(yamlUrl):
+      case getWithQuotes(graphqlUrl):
         result.push(stringElement);
         break;
     }
@@ -109,6 +114,7 @@ function getPluginInfo() {
         malva: getUrlForPlugin(data, "g-plane/malva"),
         markup_fmt: getUrlForPlugin(data, "g-plane/markup_fmt"),
         yaml: getUrlForPlugin(data, "g-plane/pretty_yaml"),
+        graphql: getUrlForPlugin(data, "g-plane/pretty_graphql"),
       };
     });
 


Test patch: