{"name":"codemirror-graphql","version":"2.0.0-next.2","license":"MIT","_id":"codemirror-graphql@2.0.0-next.2","maintainers":[{"name":"leebyron","email":"lee@leebyron.com"},{"name":"acao","email":"rikki.schulte@gmail.com"},{"name":"benjie","email":"npm@benjiegillam.com"},{"name":"fb","email":"opensource+npm@fb.com"},{"name":"i1g","email":"ivan.goncharov.ua@gmail.com"},{"name":"wincent","email":"greg@hurrell.net"},{"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":"http://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":"f37f199d0adb383b89f9d61c682605d89eeb44f8","tarball":"http://registry-npm.ywwl.com/codemirror-graphql/download/codemirror-graphql-2.0.0-next.2.tgz","fileCount":225,"integrity":"sha512-Szhn2YON/7ZSjuhr9XwzI5XQX7nQeCcXe/mGI3zYf3+FUUW6v+WCtWC4YMSCBU9oqJayjPtqLUibV/ovwiugSA==","signatures":[{"sig":"MEQCIC3zdiHvrK6hNPled8uIh/I+Mtez5OGrFXYc7cuo02TVAiAbjwmGcGO7uAYgy+Dqc3rTItmCkIygAzfK5mo660a52g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":449043,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi95APACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqRRA/+Ixj1GizMjwnlAJz5+X4au7vIVmHvsN4eILtQvTw5NsFVg0uG\r\nC8yLngreWvUnC2T0XCFWqfzyuc5Rgi8wR6Yxvmi9UW+KfTnvIrrnKM6hvKF1\r\n+uya3Ha9zA6gNK1BB+6p+ozrl0Wgko7DjvfYTrKyPY0S6+x7tBk5/m0xcgTO\r\nd2jmC8YJJqQ09M2ZA0maNeb13p9iBYa0ndNeQkCaq9N2sSvza3WX5Kb+5WLo\r\nb88/kzjOPWOpVGcoSZ+IZGPxeh6c1nCdPhXxsoqJQAaHidLRK3M2Npqs3m98\r\nhMZYUuNp7G0XFoJXgKfd2Zb+XXkp4PuqwfstFi+OYy6UEqIoxd+U8vjp5cn9\r\ndvvfDM4ZEIYefnv6Q+sDEfae2q+DnI73hBSQxYKIFApScfm1PpF9oFCLmGQs\r\nSSkhh7UIGyWSbQkaeQdzi/63cw8q8YLx9y59dKCBAYFlDiVHIsRNjDqXhXBz\r\nSFPovji/RDsDY//hTMst/3m8DJ0kFlp9ZFFt+PmpCEMrSVcQgkHf9Rzo70VL\r\n17swI1FDfhP2/wjvUUuy/fQgGkJ+mANx87mXUbBKImK8u2zSWOmFJTyABy+0\r\nx1NqeFZ0LqjugDkLJpp7mD1FlaZrzYrrn/UdBfsPs3PTkmAzLDSzai7qjZoW\r\nJ9RxCOTRyyrFpnqLtsWVb8GYE7i3PwCxFkc=\r\n=DPsQ\r\n-----END PGP SIGNATURE-----\r\n","size":63914,"noattachment":false,"key":"/codemirror-graphql/-/codemirror-graphql-2.0.0-next.2.tgz"},"main":"index.js","module":"esm/index.js","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\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 --save codemirror-graphql\n```\n\nCodeMirror helpers install themselves to the global CodeMirror when they\nare imported.\n\n```js\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 new 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 = `\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 `ValidationRule` interface.\n\n```js\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","gitHead":"5f4242062fac3343e7126c1be6a88cd788c22227","scripts":{"test":"jest","build":"yarn build-clean && yarn build-js && yarn build-esm && yarn build-flow .","watch":"babel --optional runtime resources/watch.js | node","build-js":"yarn tsc","build-esm":"cross-env ESM=true yarn tsc --project tsconfig.esm.json && node ../../scripts/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js","postbuild":"node ../../scripts/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js","build-flow":"node ../../scripts/buildFlow.js","build-clean":"rimraf {mode,hint,info,jump,lint}.{js,esm.js,js.flow,js.map,d.ts,d.ts.map} && rimraf esm results utils variables coverage cm6-legacy __tests__"},"_npmUser":{"name":"acao","email":"rikki.schulte@gmail.com"},"repository":{"url":"git+ssh://git@github.com/graphql/graphiql.git","type":"git","directory":"packages/codemirror-graphql"},"_npmVersion":"8.11.0","description":"GraphQL mode and helpers for CodeMirror.","directories":{},"_nodeVersion":"16.15.1","dependencies":{"graphql-language-service":"^5.0.6"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"sane":"2.0.0","rimraf":"^3.0.2","graphql":"^16.4.0","cross-env":"^7.0.2","codemirror":"^5.65.3","@codemirror/language":"^0.20.0"},"peerDependencies":{"graphql":"^15.5.0 || ^16.0.0","codemirror":"^5.65.3","@codemirror/language":"^0.20.0"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-graphql_2.0.0-next.2_1660391438741_0.5300666841384805","host":"s3://npm-registry-packages"},"publish_time":1660391439016,"_cnpm_publish_time":1660391439016,"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"}}