{"name":"codemirror-graphql","version":"3.0.0-beta.0","license":"MIT","_id":"codemirror-graphql@3.0.0-beta.0","maintainers":[{"name":"benjie","email":"npm@benjiegillam.com"},{"name":"mjmahone","email":"mahoney.mattj@gmail.com"},{"name":"leebyron","email":"lee@leebyron.com"},{"name":"i1g","email":"ivan.goncharov.ua@gmail.com"},{"name":"acao","email":"rikki.schulte@gmail.com"},{"name":"fb","email":"opensource+npm@fb.com"},{"name":"kassens","email":"jkassens@fb.com"},{"name":"orta","email":"orta.therox@gmail.com"},{"name":"asiandrummer","email":"asiandrummer@gmail.com"},{"name":"ags-","email":"agomezs@fb.com"}],"contributors":[{"name":"Hyohyeon Jeong","email":"asiandrummer@fb.com"},{"url":"https://leebyron.com","name":"Lee Byron","email":"lee@leebyron.com"},{"name":"Angel Gomez Salazar","email":"agomezs@fb.com"}],"homepage":"https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql#readme","bugs":{"url":"https://github.com/graphql/graphiql/issues?q=issue+label:codemirror-graphql"},"dist":{"shasum":"1fc6f48abaff77565aac89cb47b671e52894ecbd","tarball":"http://registry-npm.ywwl.com/codemirror-graphql/download/codemirror-graphql-3.0.0-beta.0.tgz","fileCount":225,"integrity":"sha512-+EAKSldCRgqSMKhL8rMGHVE9DbpHn1HMTi9W18Li0B46ZQAslXQPdYZf4s+DAurXn/ET0w6+AqwEPRpbTSNerw==","signatures":[{"sig":"MEUCIE9kX0FoKftLANThG9K1JfvsiNilin4EWG6qrDViZdvXAiEA/FqrjYNfBdIHAh4KSgDkvx8L4DlCJ9q1OaLJsqqP5Sw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIH0FMtj/vw+tpEObunni/ufnXhSRMTVhtWL0ZwdFh0bIAiA27GLWxp+ymPpeR7Lhq5apcYbSwqwVHdoZLgUr5yzy/Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/codemirror-graphql@3.0.0-beta.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":446471,"size":62658,"noattachment":false,"key":"/codemirror-graphql/-/codemirror-graphql-3.0.0-beta.0.tgz"},"main":"index.js","_from":"file:codemirror-graphql-3.0.0-beta.0.tgz","module":"esm/index.js","scripts":{"test":"vitest run","build":"tsgo -p tsconfig.json && tsgo -p tsconfig.esm.json && node ../../scripts/renameFileExtensions.mts './esm/{**,!**/__tests__/}/*.js' . .esm.js","types:check":"tsgo --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:976cfd58-4be4-4ef3-936b-119fbccad8b8"}},"_resolved":"/tmp/cb5b9e1964a57d6846eebfb636dba041/codemirror-graphql-3.0.0-beta.0.tgz","_integrity":"sha512-+EAKSldCRgqSMKhL8rMGHVE9DbpHn1HMTi9W18Li0B46ZQAslXQPdYZf4s+DAurXn/ET0w6+AqwEPRpbTSNerw==","repository":{"url":"git+https://github.com/graphql/graphiql.git","type":"git","directory":"packages/codemirror-graphql"},"_npmVersion":"11.19.0","description":"GraphQL mode and helpers for CodeMirror.","directories":{},"_nodeVersion":"24.21.0","dependencies":{"@types/codemirror":"^0.0.90","graphql-language-service":"6.0.0-beta.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"sane":"2.0.0","graphql":"^16.14.2","codemirror":"^5.65.3","@codemirror/language":"^6.0.0","@typescript/native-preview":"^7.0.0-dev.20260707.2"},"peerDependencies":{"graphql":"^16.11.0 || ^17.0.0","codemirror":"^5.65.3","@codemirror/language":"6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-graphql_3.0.0-beta.0_1790435392550_0.4710946939820755","host":"s3://npm-registry-packages-npm-production"},"readme":"# GraphQL mode for CodeMirror\n\n[![NPM](https://img.shields.io/npm/v/codemirror-graphql.svg?style=flat-square)](https://npmjs.com/codemirror-graphql)\n![npm downloads](https://img.shields.io/npm/dm/codemirror-graphql?label=npm%20downloads)\n[![License](https://img.shields.io/npm/l/codemirror-graphql.svg?style=flat-square)](LICENSE)\n[Discord Channel](https://discord.gg/cffZwk8NJW)\n\n**NOTE: For CodeMirror 6, use [cm6-graphql](/packages/cm6-graphql/) instead**\n\nProvides CodeMirror with a parser mode for GraphQL along with a live linter and\ntypeahead hinter powered by your GraphQL Schema.\n\n![Demo .gif of GraphQL Codemirror Mode](https://raw.githubusercontent.com/graphql/graphiql/main/packages/codemirror-graphql/resources/example.gif)\n\n### Getting Started\n\n```sh\nnpm install codemirror-graphql\n```\n\nCodeMirror helpers install themselves to the global CodeMirror when they are\nimported.\n\n```ts\nimport type { ValidationContext, SDLValidationContext } from 'graphql';\n\nimport CodeMirror from 'codemirror';\nimport 'codemirror/addon/hint/show-hint';\nimport 'codemirror/addon/lint/lint';\nimport 'codemirror-graphql/hint';\nimport 'codemirror-graphql/lint';\nimport 'codemirror-graphql/mode';\n\nCodeMirror.fromTextArea(myTextarea, {\n  mode: 'graphql',\n  lint: {\n    schema: myGraphQLSchema,\n    validationRules: [ExampleRule],\n  },\n  hintOptions: {\n    schema: myGraphQLSchema,\n  },\n});\n```\n\n## External Fragments Example\n\nIf you want to have autocompletion for external fragment definitions, there's a\nnew configuration setting available\n\n```ts\nimport CodeMirror from 'codemirror';\nimport 'codemirror/addon/hint/show-hint';\nimport 'codemirror/addon/lint/lint';\nimport 'codemirror-graphql/hint';\nimport 'codemirror-graphql/lint';\nimport 'codemirror-graphql/mode';\n\nconst externalFragments = /* GraphQL */ `\n  fragment MyFragment on Example {\n    id: ID!\n    name: String!\n  }\n   fragment AnotherFragment on Example {\n    id: ID!\n    title: String!\n  }\n`;\n\nCodeMirror.fromTextArea(myTextarea, {\n  mode: 'graphql',\n  lint: {\n    schema: myGraphQLSchema,\n  },\n  hintOptions: {\n    schema: myGraphQLSchema,\n    // here we use a string, but\n    // you can also provide an array of FragmentDefinitionNodes\n    externalFragments,\n  },\n});\n```\n\n### Custom Validation Rules\n\nIf you want to show custom validation, you can do that too! It uses the\n`ValidationRule` interface.\n\n```ts\nimport type { ValidationRule } from 'graphql';\n\nimport CodeMirror from 'codemirror';\nimport 'codemirror/addon/hint/show-hint';\nimport 'codemirror/addon/lint/lint';\nimport 'codemirror-graphql/hint';\nimport 'codemirror-graphql/lint';\nimport 'codemirror-graphql/mode';\n\nconst ExampleRule: ValidationRule = context => {\n  // your custom rules here\n  const schema = context.getSchema();\n  const document = context.getDocument();\n  return {\n    NamedType(node) {\n      if (node.name.value !== node.name.value.toLowercase()) {\n        context.reportError('only lowercase type names allowed!');\n      }\n    },\n  };\n};\n\nCodeMirror.fromTextArea(myTextarea, {\n  mode: 'graphql',\n  lint: {\n    schema: myGraphQLSchema,\n    validationRules: [ExampleRule],\n  },\n  hintOptions: {\n    schema: myGraphQLSchema,\n  },\n});\n```\n\nBuild for the web with [webpack](http://webpack.github.io) or\n[browserify](http://browserify.org).\n","publish_time":1790435392634,"_cnpm_publish_time":1790435392634,"dist-tags":{"alpha":"2.0.9-alpha.1","beta":"3.0.0-beta.1","canary":"2.2.4-canary-be24c1cc.0","latest":"3.0.1","next":"2.0.0-next.2","rc":"3.0.0-rc.1"}}