{"name":"codemirror-graphql","version":"1.2.7","license":"MIT","_id":"codemirror-graphql@1.2.7","maintainers":[{"name":"benjie","email":"npm@benjiegillam.com"},{"name":"leebyron","email":"lee@leebyron.com"},{"name":"acao","email":"rikki.schulte@gmail.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":"88432c93e296a54031649f030f1c51073a24d61e","tarball":"http://registry-npm.ywwl.com/codemirror-graphql/download/codemirror-graphql-1.2.7.tgz","fileCount":225,"integrity":"sha512-YE5gf5h+0R+wmQy2yjLf1i2kO3zEYLSiVQZYdLTh/ouHi+HSnThrDleyFihZKwoJmXAsEIpxqC26tBIUvu9JaA==","signatures":[{"sig":"MEQCIFtxlSb4LyCxgi3UaPFSRXf1sNwmyqHY6OQZIjYwpGkdAiAdrGMxWh20czTEYbkSu8eaaTnIDF2c8mGHwISAsXE0CQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":438808,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhriTqCRA9TVsSAnZWagAAKK4P/3+QY8w5c5edt76chHch\nETKSIj3ypdzENTEDKLYpPgrjEvNEb+KrcHVwU5aRHR+U2x9V4j1ZzjT8PkT8\ngYuaQfAedu1pDENY6XTB67CMJz+RvAIDhhBxeR5/gJ31EqBBnQYRsIk2oFRU\nwbYRdkq1NSnI97A+jqX4tCpGN7QEizuljpeMkOefpdOoa+tjIGDSZNJpp8JH\nWtK4sRtNFPt8T2lCCG7K0eBsZpc4szxRkOh+R/Mn7WzL8QzFj0zjlRGbzxFT\nTBsTKuqnC7ff27MqAeTymi7vdHhsxtjKMYY6L5mAQ89TEAhfBNlAXAK74jKM\nAgzO4YGzKzs5xx5m9lr9voPz1rqR/T4OXQ/SX9iegZNXtrxjJGGU0NeS+8Gr\nxSOOkwWwWDuF+xbcWP+2JzGuq+tHDrM1+0c7dLb3KZ2BggIqbLGxCanTHF9Q\n2/PjulKFXhO9OAbiTG9JaXwEqRX1xlSilly7HcHOe6uuKxtjHwoF7t2P7Efs\ng9i5nQWrwLEkEe3fkZchjG83iI6jX4YPMLFG2F0fE5InoCNCJyiPvBp989G+\nPPPuVtozydkpBo+CLhZN5n6yzLI5DHndE+60qqqRizxEt0FQJ0zZffGWaeQz\nwRUeTpVUlIORQUqGPiNY7Dx+HXVS35iDvm3S4rwwMQH5gvLHlnV/AGFGPgNK\nD+vM\r\n=EXwb\r\n-----END PGP SIGNATURE-----\r\n","size":62926,"noattachment":false,"key":"/codemirror-graphql/-/codemirror-graphql-1.2.7.tgz"},"main":"index.js","module":"esm/index.js","gitHead":"848da580f1083b67f367dea26c110b28b7d401cb","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 ../../resources/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js","postbuild":"node ../../resources/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js","build-flow":"node ../../resources/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+https://github.com/graphql/graphiql.git","type":"git"},"_npmVersion":"8.1.0","description":"GraphQL mode and helpers for CodeMirror.","directories":{},"_nodeVersion":"16.13.0","dependencies":{"graphql-language-service":"^4.1.0","@codemirror/stream-parser":"^0.19.2"},"_hasShrinkwrap":false,"devDependencies":{"sane":"2.0.0","jsdom":"^16.4.0","rimraf":"^3.0.2","graphql":"16.0.0-experimental-stream-defer.5","cross-env":"^7.0.2","codemirror":"^5.58.2"},"peerDependencies":{"graphql":"^15.5.0 || ^16.0.0","codemirror":"^5.58.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-graphql_1.2.7_1638802666297_0.7012474295684108","host":"s3://npm-registry-packages"},"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 --save 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":1638802666484,"_cnpm_publish_time":1638802666484,"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"}}