{"name":"monaco-graphql","version":"1.9.0","license":"MIT","_id":"monaco-graphql@1.9.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"}],"contributors":[{"url":"https://github.com/rebornix","name":"Peng Lyu"},{"url":"https://github.com/acao","name":"Rikki Schulte"}],"homepage":"https://github.com/graphql/graphiql#readme","bugs":{"url":"https://github.com/graphql/graphiql/issues"},"dist":{"shasum":"e4f32e9b62a28055c5a90e1f409cfab9f2b25273","tarball":"http://registry-npm.ywwl.com/monaco-graphql/download/monaco-graphql-1.9.0.tgz","fileCount":131,"integrity":"sha512-zIK4Abg7KpJ6E0nis75wktpQ6vgDTKOEMwtrqa2mMIv7D+Q2n42cr75LCuWfO144xqbTjxyav7MbI2ViIy6q3w==","signatures":[{"sig":"MEUCIQDTNAtMtj9jLNPz5D5gWnwZAUNlzf+s6arZeGot2Ok/oQIgA5A/gYoIk+7Ier3EHSCIEe+v3YOZUbPlzFT/8g4t0u4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/monaco-graphql@1.9.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":228595,"size":38322,"noattachment":false,"key":"/monaco-graphql/-/monaco-graphql-1.9.0.tgz"},"main":"dist/monaco.contribution.js","types":"esm/monaco.contribution.d.ts","module":"esm/monaco.contribution.js","exports":{".":{"types":"./esm/monaco.contribution.d.ts","import":"./esm/monaco.contribution.js","default":"./dist/monaco.contribution.js","require":"./dist/monaco.contribution.js"},"./*":{"types":"./*","import":"./*","default":"./*","require":"./*"},"./lite":{"types":"./esm/lite.d.ts","import":"./esm/lite.js","default":"./dist/lite.js","require":"./dist/lite.js"},"./monaco-editor":{"types":"./esm/monaco-editor.d.ts","import":"./esm/monaco-editor.js","default":"./dist/monaco-editor.js","require":"./dist/monaco-editor.js"},"./graphql.worker":{"types":"./esm/graphql.worker.d.ts","import":"./esm/graphql.worker.js","default":"./dist/graphql.worker.js","require":"./dist/graphql.worker.js"},"./initializeMode":{"types":"./esm/initializeMode.d.ts","import":"./esm/initializeMode.js","default":"./dist/initializeMode.js","require":"./dist/initializeMode.js"},"./esm/graphql.worker":{"types":"./esm/graphql.worker.d.ts","import":"./esm/graphql.worker.js","require":"./dist/graphql.worker.js"}},"gitHead":"bffd89e964c5c37b061d200491f7aa3b4ce1086c","scripts":{"test":"vitest run","types:check":"tsgo --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:41359da7-b3d7-41e0-a922-9c66fb7b33af"}},"repository":{"url":"git+https://github.com/graphql/graphiql.git","directory":"packages/monaco-graphql"},"_npmVersion":"11.17.0","description":"full service, official monaco mode for GraphQL","directories":{},"_nodeVersion":"24.19.0","dependencies":{"picomatch-browser":"^2.2.6","graphql-language-service":"^5.7.0"},"_hasShrinkwrap":false,"devDependencies":{"execa":"^7.1.1","graphql":"^16.9.0","prettier":"3.3.2","monaco-editor":"0.52.2","vscode-languageserver-types":"^3.17.1"},"peerDependencies":{"graphql":"^15.5.0 || ^16.0.0 || ^17.0.0","prettier":"^2.8.0 || ^3.0.0","monaco-editor":">= 0.20.0 < 0.53"},"_npmOperationalInternal":{"tmp":"tmp/monaco-graphql_1.9.0_1788119400326_0.6659643059645111","host":"s3://npm-registry-packages-npm-production"},"readme":"[Changelog](https://github.com/graphql/graphiql/blob/main/packages/monaco-graphql/CHANGELOG.md)\n|\n[API Docs](https://graphiql-test.netlify.app/typedoc/modules/graphql_language_service_server.html)\n| [Discord Channel](https://discord.gg/r4BxrAG6fN)\n\nGraphQL language plugin for the Monaco Editor. You can use it to build\nvscode/codespaces-like web or desktop IDEs using whatever frontend javascript\nlibraries or frameworks you want, or none!\n\n- [webpack example](https://github.com/graphql/graphiql/tree/main/examples/monaco-graphql-webpack/)\n  using plain javascript, shows how to change schemas\n- [vite + react example](https://stackblitz.com/edit/monaco-graphql-react-vite?file=src%2FApp.tsx&terminal=dev) -\n  minimal example with variables (C)JSON support using react\n- [live demo](https://monaco-graphql.netlify.com) of the monaco webpack example\n  (prompts for GitHub access token!)\n\n> **NOTE:** This is in pre-release state as we build towards GraphiQL 2.0.x.\n> [`codemirror-graphql`](https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql)\n> has more features (such as JSON variables validation) and is more stable.\n\n## Features\n\nIt provides the following features while editing GraphQL files:\n\n- Configurable multi-model, multi-schema language worker with `fileMatch`\n  expressions\n- Code completion (schema driven) for Operation and SDL types\n  - Automatic expansion & completion on leaf type completion\n- Hover (schema driven) with markdown support\n- Validation (schema driven)\n- JSON Variables validation and language features (schema driven)\n- Formatting - using prettier\n- Syntax Highlighting & Basic Languages provided by `monaco-editor` basic\n  languages support\n- Configurable formatting options\n- Providing external fragments\n- create custom workers for custom language service options - parser, validation\n  rules, schemaBuilder, etc\n\n## Usage\n\nFor now, we use `language` id of `graphql` until we can ensure we can dovetail\nnicely with the official `graphql` language ID.\n\n`monaco-graphql@2` supports `monaco-editor` 0.56 and 0.57. Applications must\nconfigure\n`globalThis.MonacoEnvironment.getWorker` to return the GraphQL worker when the\nworker label is `graphql`.\n\nTo use with webpack, here is an example to get you started:\n\n```sh\nyarn add monaco-graphql\n```\n\n## Sync Example\n\n```ts\nimport * as monaco from 'monaco-graphql/monaco-editor';\n\nimport { initializeMode } from 'monaco-graphql/initializeMode'; // `monaco-graphql/esm/initializeMode` is deprecated but still works\n\n// you can also configure these using the webpack or vite plugins for `monaco-editor`\nimport GraphQLWorker from 'worker-loader!monaco-graphql/esm/graphql.worker';\n\n// instantiates the worker & language features with the schema!\nconst MonacoGraphQLAPI = initializeMode({\n  // Opt in only when the connected server supports fragment arguments.\n  experimentalFragmentArguments: true,\n  schemas: [\n    {\n      schema: myGraphqlSchema as GraphQLSchema,\n      // anything that monaco.URI.from() is compatible with\n      uri: 'https://my-schema.com',\n      uri: '/my-schema.graphql',\n      // match the monaco file uris for this schema.\n      // accepts specific uris and anything `picomatch` supports.\n      // (everything except bracket regular expressions)\n      fileMatch: ['**/*.graphql'],\n      // note: not sure if ^ works if the graphql model is using urls for uris?\n    },\n  ],\n});\n\nglobalThis.MonacoEnvironment = {\n  getWorker(_workerId: string, label: string) {\n    if (label === 'graphql') {\n      return new GraphQLWorker();\n    }\n    // if you are using vite or webpack plugin, it will be found here\n    return new Worker('editor.worker.js');\n  },\n};\nmonaco.editor.create(document.getElementById('someElementId'), {\n  value: 'query { }',\n  language: 'graphql',\n  formatOnPaste: true,\n});\n```\n\n## Lazy Example\n\nThe existing API works as before in terms of instantiating the schema.\nTo avoid manually calling getWorker(), you can use the monaco editor plugins for webpack or vite (see examples, and below)\n\n```ts\nimport * as monaco from 'monaco-graphql/monaco-editor';\n// enables our language worker right away, despite no schema\nimport 'monaco-graphql';\n\n// you can also configure these using the webpack or vite plugins for `monaco-editor`\nimport GraphQLWorker from 'worker-loader!monaco-graphql/esm/graphql.worker';\n\n// lazily invoke the api config methods whenever we want!\nmonaco.languages.graphql.setSchemaConfig([\n  {\n    schema: myGraphqlSchema as GraphQLSchema,\n    // anything that monaco.URI.from() is compatible with\n    uri: 'https://my-schema.com',\n    uri: '/my-schema.graphql',\n    // match the monaco file uris for this schema.\n    // accepts specific uris and anything `picomatch` supports.\n    // (everything except bracket regular expressions)\n    fileMatch: ['**/*.graphql'],\n    // note: not sure if ^ works if the graphql model is using urls for uris?\n  },\n]);\n\nglobalThis.MonacoEnvironment = {\n  getWorker(_workerId: string, label: string) {\n    if (label === 'graphql') {\n      return new GraphQLWorker();\n    }\n    return new Worker('editor.worker.js');\n  },\n};\nmonaco.editor.create(document.getElementById('someElementId'), {\n  value: 'query { }',\n  language: 'graphql',\n  formatOnPaste: true,\n});\n```\n\nThis will cover the basics, making an HTTP POST with the default\n`introspectionQuery()` operation. To customize the entire fetcher, see\n[advanced customization](<>) below. For more customization options, see the\n[Monaco Editor API Docs](https://microsoft.github.io/monaco-editor/api/index.html)\n\n## Advanced Usage\n\n### Variables JSON Support!\n\nIn `monaco-graphql@0.5.0` we introduced a method `getVariablesJSONSchema` that\nallows you to retrieve a `JSONSchema` description for the declared variables for\nany given set of operations\n\n## Full Sync Demo with Variables JSON\n\n```ts\nimport * as monaco from 'monaco-graphql/monaco-editor';\n\nimport { initializeMode } from 'monaco-graphql/initializeMode';\n\nimport GraphQLWorker from 'worker-loader!monaco-graphql/esm/graphql.worker';\n\nglobalThis.MonacoEnvironment = {\n  getWorker(_workerId: string, label: string) {\n    if (label === 'graphql') {\n      return new GraphQLWorker();\n    }\n    return new Worker('editor.worker.js');\n  },\n};\n\n// the language service will be instantiated once the schema is available\nconst MonacoGraphQLAPI = initializeMode({\n  schemas: [\n    {\n      // anything that monaco.URI.from() is compatible with\n      uri: 'https://my-schema.com',\n      // match the monaco file uris for this schema.\n      // accepts specific filenames and anything `picomatch` supports.\n      fileMatch: ['**/*.graphql'],\n      schema: myGraphqlSchema as GraphQLSchema,\n    },\n  ],\n});\n\nconst operationModel = monaco.editor.createModel(\n  'query {}',\n  'graphql',\n  '/operation.graphql',\n);\n\nconst operationEditor = monaco.editor.create(\n  document.getElementById('someElementId'),\n  {\n    model: operationModel,\n    language: 'graphql',\n    formatOnPaste: true,\n  },\n);\n\nconst variablesSchemaUri = monaco.editor.URI.file('/variables-schema.json');\n\nconst variablesModel = monaco.editor.createModel(\n  '{}',\n  'json',\n  '/variables.json',\n);\n\nconst variablesEditor = monaco.editor.create(\n  document.getElementById('someElementId'),\n  {\n    model: variablesModel,\n    language: 'graphql',\n    formatOnPaste: true,\n  },\n);\n\n// high-level method for configuring json variables validation\nMonacoGraphQLAPI.setDiagnosticSettings({\n  validateVariablesJson: {\n    // Urls, uris, anything that monaco.URI.from() is compatible with.\n    // Match operation model to variables editor,\n    // and the language service will automatically listen for changes,\n    // and compute the json schema using the GraphQLWorker.\n    // This is in the main process is applied to the global monaco json settings\n    // for validation, completion and more using monaco-json's built-in JSON Schema support.\n    [operationModel.uri.toString()]: [variablesModel.uri.toString()],\n  },\n  jsonDiagnosticSettings: {\n    allowComments: true, // allow json, parse with a jsonc parser to make requests\n  },\n});\n\nMonacoGraphQL.setCompletionSettings({\n  // this auto-fills NonNull leaf fields\n  // it used to be on by default, but is annoying when\n  // fields contain required argument.\n  // hoping to fix that soon!\n  __experimental__fillLeafsOnComplete: true,\n});\n```\n\nYou can also experiment with the built-in `jsonc`? (JSON\nsyntax that allows comments and trailing commas, for `tsconfig.json`, etc.) and the 3rd party `monaco-yaml` language modes\nfor completion of other types of variable input. you can also experiment with\neditor methods to parse detected input into different formats, etc (`yaml`\npastes as `json`, etc.)\n\nYou could of course prefer to generate a `jsonschema` form for variables input\nusing a framework of your choice, instead of an editor. Enjoy!\n\n## `monaco-graphql/lite`\n\nYou can also import a \"lite\" version, and manually enable only the monaco features you want!\n\nWarning: by default, completion and other features will not work, only highlighting and validation.\n\n```ts\nimport { initializeMode } from 'monaco-graphql/lite';\n\n// enable completion\nimport 'monaco-editor/features/inlineCompletions/register';\n\nconst api = initializeMode({\n  schemas: [\n    {\n      // anything that monaco.URI.from() is compatible with\n      uri: 'schema.graphql',\n      // match the monaco file uris for this schema.\n      // accepts specific filenames and anything `picomatch` supports.\n      fileMatch: ['operation.graphql'],\n      schema: myGraphqlSchema as GraphQLSchema,\n    },\n  ],\n});\n```\n\n## `MonacoGraphQLAPI` ([typedoc](https://graphiql-test.netlify.app/typedoc/classes/monaco_graphql.monacoMonacoGraphQLAPI.html))\n\nIf you call any of these API methods to modify the language service\nconfiguration at any point at runtime, the webworker will reload relevant\nlanguage features.\n\nIf you `import 'monaco-graphql'` synchronously, you can access the api via\n`monaco.languages.graphql.api`.\n\n```ts\nimport 'monaco-graphql';\n// now the api will be available on the `monaco.languages` global\nconst { api } = monaco.languages.graphql;\n```\n\n```ts\nimport 'monaco-graphql';\n\n// also this\nimport { languages } from 'monaco-editor';\n// now the api will be available on the `monaco.languages` global\nconst { api } = languages.graphql;\n```\n\nOtherwise, you can, like in the sync demo above:\n\n```ts\nimport { initializeMode } from 'monaco-graphql/initializeMode';\n\nconst api = initializeMode(config);\n```\n\n### `monaco.languages.graphql.api.setSchemaConfig([SchemaConfig])`\n\nsame as the above, except it overwrites the entire schema config.\n\nyou can provide multiple, and use `fileMatch` to map to various uri \"directory\"\nglobs or specific files. `uri` can be an url or file path, anything parsable\n\n```ts\n// you can load it lazily\nimport 'monaco-graphql';\n\nmonaco.languages.graphql.api.setSchemaConfig([\n  {\n    schema: GraphQLSchema,\n    fileMatch: ['**/*.graphql'],\n    uri: 'my-schema.graphql',\n  },\n]);\n```\n\nor you can load the language features only when you have your schema\n\n```ts\nimport { initializeMode } from 'monaco-graphql/initializeMode';\n\nconst schemas = [\n  {\n    schema: GraphQLSchema,\n    fileMatch: ['operations/*.graphql'],\n    uri: 'my-schema.graphql',\n  },\n];\nconst api = initializeMode({ schemas });\n\n// add another schema. this will cause language workers and features to reset\napi.setSchemaConfig([\n  ...schemas,\n  {\n    introspectionJSON: myIntrospectionJSON,\n    fileMatch: ['specific/monaco/uri.graphql'],\n    uri: 'another-schema.graphql',\n  },\n]);\n```\n\nor if you want, replace the entire configuration with a single schema. this will\ncause the worker to be entirely re-created and language services reset\n\n```ts\napi.setSchemaConfig([\n  {\n    introspectionJSON: myIntrospectionJSON,\n    fileMatch: ['**/*.graphql'],\n    uri: 'my-schema.graphql',\n  },\n]);\n```\n\n### `monaco.languages.graphql.api.setModeConfiguration()`\n\nThis is where you can toggle monaco language features. all are enabled by\ndefault.\n\n```ts\nmonaco.languages.graphql.api.setModeConfiguration({\n  documentFormattingEdits: true,\n  completionItems: true,\n  hovers: true,\n  documentSymbols: true,\n  diagnostics: true,\n});\n```\n\n### `monaco.languages.graphql.api.setFormattingOptions()`\n\nthis accepts an object `{ prettierConfig: prettier.Options }`, which accepts\n[any prettier option](https://prettier.io/docs/en/options.html). it will not\nre-load the schema or language features, however the new prettier options will\ntake effect.\n\nthis method overwrites the previous configuration, and will only accept static\nvalues that can be passed between the main/worker process boundary.\n\n```ts\nmonaco.languages.graphql.api.setFormattingOptions({\n  // if you wanna be like that\n  prettierOptions: { tabWidth: 2, useTabs: true },\n});\n```\n\n### `monaco.languages.graphql.api.setExternalFragmentDefinitions()`\n\nAppend external fragments to be used by autocomplete and other language\nfeatures.\n\nThis accepts either a string that contains fragment definitions, or\n`TypeDefinitionNode[]`\n\n### `monaco.languages.graphql.api.getDiagnosticOptions`\n\n```ts\nmonaco.languages.graphql.api.setDiagnosticSettings({\n  validateVariablesJson: {\n    // Urls, uris, anything that monaco.URI.from() is compatible with.\n    // Match operation model to variables editor,\n    // and the language service will automatically listen for changes,\n    // and compute the json schema using the GraphQLWorker.\n    // This is in the main process is applied to the global monaco json settings\n    // for validation, completion and more using monaco-json's built-in JSON Schema support.\n    [operationModel.uri.toString()]: [variablesModel.uri.toString()],\n  },\n  jsonDiagnosticSettings: {\n    allowComments: true, // allow json, parse with a jsonc parser to make requests\n  },\n});\n```\n\n## Bundlers\n\n### Webpack\n\nyou'll can refer to the webpack configuration in the\n[full monaco webpack example](/examples/monaco-graphql-webpack#readme) to see\nhow it works with webpack and the official `monaco-editor-webpack-plugin`. there\nis probably an easier way to configure webpack `worker-loader` for this.\n\n**Notes:**\n\n- for additional features, please specify them in `features` for the webpack plugin, or import them directly\n- if you are trying to add `typescript` as a language, there is an outstanding [bug with the webpack plugin](https://github.com/microsoft/monaco-editor/issues/2738), see our [next.js example](../../examples/monaco-graphql-nextjs/next.config.js) for the workaround. do not specify `languages: ['typescript']` or `javascript`\n\n### Vite\n\nYou can configure vite to load `monaco-editor` json mode and even the language\neditor worker using\n[the example for our mode](https://github.com/vdesjs/vite-plugin-monaco-editor#options)\n\nBe sure to import additional editor features and language modes manually, as the vite plugin only allows you to specify `languageWorkers`.\nSee the vite example to see how to add typescript support\n\n## Web Frameworks\n\nthe plain javascript\n[webpack example](https://github.com/graphql/graphiql/tree/main/examples/monaco-graphql-webpack/)\nshould give you a starting point to see how to implement it with\n\n### React\n\n- [`use-monaco`](https://www.npmjs.com/package/use-monaco) seems to support the\n  custom language worker configuration we want, and seems to be well built! we\n  hope to help them build their\n- when loading it yourself, either dynamic import the mode and/or instantiate it\n  yourself using `useEffect` on `didMount` to prevent breaking SSR.\n- it may work with other libraries by using a similar strategy to\n  [this](https://github.com/graphql/graphiql/blob/9df315b44896efa313ed6744445fc8f9e702ebc3/examples/monaco-graphql-webpack/src/editors.ts#L15).\n  configure `MonacoEnvironment.getWorker` to return your pre-built worker.\n\n## Custom Webworker (for passing non-static config to worker)\n\nIf you want to pass a custom parser and/or validation rules, it is supported,\nhowever the setup is a bit more complicated.\n\nYou can add any `LanguageServiceConfig`\n([typedoc](https://graphiql-test.netlify.app/typedoc/modules/graphql_language_service.html#graphqllanguageconfig-1))\nconfiguration options you like here to `languageConfig` as below.\n\nThis is because we can't pass non-static configuration to the existing worker\nprogrammatically, so you must import these and build the worker custom with\nthose functions. Part of the (worthwhile) cost of crossing runtimes!\n\nyou'll want to create your own `my-graphql.worker.ts` file, and add your custom\nconfig such as `schemaLoader` to `createData`:\n\n```ts\n// my-graphql.worker.ts\nimport type * as monaco from 'monaco-editor';\nimport type { ICreateData } from 'monaco-graphql';\n// @ts-expect-error -- ignore missing types\nimport { initialize } from 'monaco-editor/editor/editor.worker';\nimport { GraphQLWorker } from 'monaco-graphql/esm/GraphQLWorker';\nimport { GraphQLError, ValidationRule } from 'graphql';\n\nconst RequireOperationNameRule: ValidationRule = context => {\n  return {\n    OperationDefinition(node) {\n      if (node.name) {\n        return;\n      }\n      context.reportError(\n        new GraphQLError('Oops, all operations must be named.', {\n          nodes: [node],\n        }),\n      );\n    },\n  };\n};\n\nclass CustomGraphQLWorker extends GraphQLWorker {\n  override initialize(createData: ICreateData) {\n    createData.languageConfig.customValidationRules = [\n      RequireOperationNameRule,\n    ];\n    super.initialize(createData);\n  }\n}\n\ninitialize((ctx: monaco.worker.IWorkerContext) => new CustomGraphQLWorker(ctx));\n```\n\nthen, in your application:\n\n```ts\n// Vite query suffixes https://vite.dev/guide/features.html#import-with-query-suffixes\nimport EditorWorker from 'monaco-editor/editor/editor.worker?worker';\nimport GraphQLWorker from './my-graphql.worker?worker';\n\nglobalThis.MonacoEnvironment = {\n  getWorker(_workerId: string, label: string) {\n    return label === 'graphql' ? new GraphQLWorker() : new EditorWorker();\n  },\n};\n```\n\nor, if you have webpack configured for it:\n\n```ts\nglobalThis.MonacoEnvironment = {\n  getWorker(_workerId: string, label: string) {\n    return new Worker(\n      new URL(\n        label === 'graphql'\n          ? './my-graphql.worker.js'\n          : 'monaco-editor/editor/editor.worker.js',\n        import.meta.url,\n      ),\n    );\n  },\n};\n```\n\nwith vite you just need:\n\n```ts\nimport { defineConfig } from 'vite';\nimport monacoEditorPlugin from 'vite-plugin-monaco-editor';\n\nexport default defineConfig({\n  plugins: [\n    monacoEditorPlugin({\n      customWorker: [\n        {\n          label: 'graphql',\n          entry: 'my-graphql.worker.js',\n        },\n      ],\n    }),\n  ],\n});\n```\n\n## Monaco Editor Tips\n\nIf you are familiar with Codemirror/Atom-era terminology and features, here's\nsome gotchas:\n\n- \"hinting\" => \"code completion\" in LSP terminology\n- \"linting\" => \"diagnostics\" in lsp terminology\n- the default keymap is different, more vscode like\n- command palette and right click context menu are important\n- you can extend the provided standard completion, linting, etc. for example,\n  `editor.setModelMarkers()`\n- [Monaco Editor API Docs](https://microsoft.github.io/monaco-editor/api/index.html)\n- [Monaco Editor Samples](https://github.com/Microsoft/monaco-editor-samples)\n  repository is great for tips on implementing with different bundlers,\n  runtimes, etc.\n\n## Avoid Bundle All `monaco-editor`'s Languages\n\nWhile importing `monaco-editor` in your project, you silently import 83 builtin\nlanguages, such as `typescript`, `html`, `css`, `json` and others. You can found\na full list of\n[basic-languages](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages)\nand\n[languages](https://github.com/microsoft/monaco-editor/tree/main/src/language).\n\nFor `monaco-graphql`, you need only 2 languages - `graphql` and `json`.\nIn version `monaco-graphql@1.3.0` and later, you can replace all `monaco-editor`'s\nimports with `monaco-graphql/monaco-editor` to improve performance, load\nonly `graphql` and `json` languages, and skip loading unused languages.\n\n```diff\n-import { ... } from 'monaco-editor'\n+import { ... } from 'monaco-graphql/monaco-editor'\n```\n\n> The `monaco-graphql/esm/*` import pattern is deprecated. It is retained for\n> backwards compatibility but the wildcard export that enables it is planned\n> for removal in the next major version. New code should use the canonical\n> subpaths: `monaco-graphql/monaco-editor`, `monaco-graphql/initializeMode`,\n> `monaco-graphql/graphql.worker`, `monaco-graphql/lite`.\n\n### Catch Future Import Mistakes with ESLint\n\nTo prevent mis-importing of `monaco-editor`, you can set up default\n`no-restricted-imports` rule for JavaScript projects or\n`@typescript-eslint/no-restricted-imports` for TypeScript projects.\n\n```json5\n{\n  rules: {\n    // or @typescript-eslint/no-restricted-imports\n    'no-restricted-imports': [\n      'error',\n      {\n        name: 'monaco-editor',\n        message: '`monaco-editor` imports all languages; use `monaco-graphql/monaco-editor` instead to import only `json` and `graphql` languages',\n      },\n    ],\n  },\n}\n```\n\n## Inspiration\n\n`microsoft/monaco-json` was our inspiration from the outset, when it was still a\nstandalone repository. @acao actually wholesale copied many files, you could\nalmost say it was a fork!\n\n## TODO\n\n- [x] variables JSON validation\n- [x] variables completion\n- [ ] Symbols & Definitions\n- [x] file uri-driven schema loading\n- [x] op -> schema & schema -> schema references\n- [x] `insertText` for field and argument completion\n","publish_time":1788119400475,"_cnpm_publish_time":1788119400475,"dist-tags":{"alpha":"1.2.4-alpha.0","beta":"2.0.0-beta.1","canary":"1.7.3-canary-67317292.0","latest":"2.0.1","next":"0.3.1-alpha.3","rc":"2.0.0-rc.1"}}