{"name":"codemirror-graphql","version":"0.12.1","license":"MIT","_id":"codemirror-graphql@0.12.1","maintainers":[{"name":"ags-","email":"agomezs@fb.com"},{"name":"asiandrummer","email":"asiandrummer@gmail.com"},{"name":"kassens","email":"jkassens@fb.com"},{"name":"leebyron","email":"lee@leebyron.com"},{"name":"wincent","email":"greg@hurrell.net"}],"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":"02ce19ffe15397c049ca87c195ac13080d2abe8f","tarball":"http://registry-npm.ywwl.com/codemirror-graphql/download/codemirror-graphql-0.12.1.tgz","fileCount":45,"integrity":"sha512-PlOCTpfBBUwDZXQo60ZfzD/nGZsaJoE1tA07Uf9xJN7R0kBDGJeD4AVfdUTprZr27p0JIntJzmL6mt/G4Zkzeg==","signatures":[{"sig":"MEQCICi4I5sD6cq1wqwL+v91Ucj94avhq7XIa2Awc6wK4h8kAiArBADEyhcSy3VXYqxDFd26Ez3Ei4u7wUZyL0rI++2Eww==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":171488,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfLGo5CRA9TVsSAnZWagAAs+oP/ij/fdTqX4xjh+teOrUE\nwOXh8NC2BDK78MwsZkvMGhCBG8Onh9Zmmo4LPw8gzPOzZYM4N4LnogEh+1T9\nLamniNdNRuLoYx2x2EPrBdZJeO9oNtFdMOZP96vc63ubBurSeWo6w96hpXSJ\nkp4LSkCvMC9hdwwB9oIFffBKj3jFHXFsE98hhQ3DYnR60FqdU5mniMa+W9xD\n678qJhO7WQF9bTF4Z+LE7YmBC7McTYbIkjmi5/Nbws7y5q8coc8LLQVavXVC\nFEJaMEOMp0TVnnDF6i8lgyyR+ysH9l5Ma33dvqnWMLL5X6s79m4IBH1HV8an\nJPk55mYr8hnUTBD4MACWZsK34LDIoHbpWtJfITcMf5MXqQo2sEY9H2tteINz\na9CVpnrnjwbwiihgmimGId2SF1DzwL2dhABZBpPFE880W3g8t8j7e4waZdu+\nLW1SaNsxHS6q6zeSr2tD1SXwGFnvhYm+0VZmVOjyr4v8CtuWjf2nXsW1EvFN\nkHloSSRjsSGzsMf5NFJEKhidChXdVdQKLD3KFWIZsbvJiU7nqP+5Pli7T6oO\nKoo3YNw3Sr6jWTd8IHOvpgP9iaItvB1yP1WVlD5yFthAlFP2lXUhnYmn/krB\nRrKIB5DVI1IOVNztXM5R6ImGMgGIGfR8asRjeMHmAkZ/TAu4XfHA0VZAnuAW\nbgjN\r\n=4/eS\r\n-----END PGP SIGNATURE-----\r\n","size":26939,"noattachment":false,"key":"/codemirror-graphql/-/codemirror-graphql-0.12.1.tgz"},"gitHead":"0fc7c7caac890198118c6a19ae77f10944987ed2","options":{"mocha":"--full-trace --require resources/mochaBootload **/*-test.js"},"scripts":{"test":"nyc --require @babel/polyfill --reporter lcov --reporter text mocha $npm_package_options_mocha","build":"yarn build-clean && yarn build-js && yarn build-esm && yarn build-flow .","watch":"babel --optional runtime resources/watch.js | node","build-js":"babel src --root-mode upward --ignore **/__tests__/**,**/__mocks__/** --out-dir .","build-esm":"cross-env ESM=true babel src --root-mode upward  --ignore **/__tests__/**,**/__mocks__/** --out-dir esm && 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} && rimraf esm results utils variables coverage __tests__"},"_npmUser":{"name":"acao","email":"rikki.schulte@gmail.com"},"repository":{"url":"git+https://github.com/graphql/graphiql.git","type":"git"},"_npmVersion":"lerna/3.20.2/node@v14.5.0+x64 (linux)","description":"GraphQL mode and helpers for CodeMirror.","directories":{},"_nodeVersion":"14.5.0","dependencies":{"graphql-language-service-parser":"^1.6.1","graphql-language-service-interface":"^2.4.1"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.0.1","chai":"4.2.0","sane":"2.0.0","jsdom":"^16.1.0","mocha":"7.1.1","rimraf":"^3.0.0","graphql":"15.0.0","cross-env":"^7.0.2","codemirror":"^5.52.2","chai-subset":"1.6.0"},"peerDependencies":{"graphql":"^14.0.0 || ^15.0.0","codemirror":"^5.54.0"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-graphql_0.12.1_1596746297177_0.5100535881780215","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":1596746297310,"_cnpm_publish_time":1596746297310,"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"}}