vscode-apollo 1.19.3 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +14 -0
  3. package/.circleci/config.yml +82 -0
  4. package/.eslintrc.js +10 -0
  5. package/.gitattributes +1 -0
  6. package/.github/workflows/build-prs.yml +57 -0
  7. package/.github/workflows/release.yml +114 -0
  8. package/.gitleaks.toml +26 -0
  9. package/.nvmrc +1 -0
  10. package/.prettierrc +5 -0
  11. package/.vscode/launch.json +61 -0
  12. package/.vscode/settings.json +16 -0
  13. package/.vscode/tasks.json +18 -0
  14. package/.vscodeignore +17 -1
  15. package/CHANGELOG.md +178 -1
  16. package/LICENSE +2 -2
  17. package/README.md +9 -9
  18. package/codegen.yml +12 -0
  19. package/images/IconRun.svg +8 -0
  20. package/jest.config.ts +11 -0
  21. package/package.json +102 -22
  22. package/renovate.json +23 -0
  23. package/src/__mocks__/fs.js +3 -0
  24. package/src/__tests__/statusBar.test.ts +8 -7
  25. package/src/debug.ts +2 -5
  26. package/src/env/fetch/fetch.ts +32 -0
  27. package/src/env/fetch/global.ts +30 -0
  28. package/src/env/fetch/index.d.ts +2 -0
  29. package/src/env/fetch/index.ts +2 -0
  30. package/src/env/fetch/url.ts +9 -0
  31. package/src/env/index.ts +4 -0
  32. package/src/env/polyfills/array.ts +17 -0
  33. package/src/env/polyfills/index.ts +2 -0
  34. package/src/env/polyfills/object.ts +7 -0
  35. package/src/env/typescript-utility-types.ts +2 -0
  36. package/src/extension.ts +106 -37
  37. package/src/language-server/__tests__/diagnostics.test.ts +86 -0
  38. package/src/language-server/__tests__/document.test.ts +187 -0
  39. package/src/language-server/__tests__/fileSet.test.ts +46 -0
  40. package/src/language-server/__tests__/fixtures/starwarsSchema.ts +1917 -0
  41. package/src/language-server/config/__tests__/config.ts +128 -0
  42. package/src/language-server/config/__tests__/loadConfig.ts +508 -0
  43. package/src/language-server/config/__tests__/utils.ts +106 -0
  44. package/src/language-server/config/config.ts +219 -0
  45. package/src/language-server/config/index.ts +3 -0
  46. package/src/language-server/config/loadConfig.ts +228 -0
  47. package/src/language-server/config/utils.ts +56 -0
  48. package/src/language-server/diagnostics.ts +109 -0
  49. package/src/language-server/document.ts +277 -0
  50. package/src/language-server/engine/GraphQLDataSource.ts +124 -0
  51. package/src/language-server/engine/index.ts +105 -0
  52. package/src/language-server/engine/operations/frontendUrlRoot.ts +7 -0
  53. package/src/language-server/engine/operations/schemaTagsAndFieldStats.ts +24 -0
  54. package/src/language-server/errors/__tests__/NoMissingClientDirectives.test.ts +220 -0
  55. package/src/language-server/errors/logger.ts +58 -0
  56. package/src/language-server/errors/validation.ts +277 -0
  57. package/src/language-server/fileSet.ts +65 -0
  58. package/src/language-server/format.ts +48 -0
  59. package/src/language-server/graphqlTypes.ts +7176 -0
  60. package/src/language-server/index.ts +29 -0
  61. package/src/language-server/languageProvider.ts +798 -0
  62. package/src/language-server/loadingHandler.ts +64 -0
  63. package/src/language-server/project/base.ts +399 -0
  64. package/src/language-server/project/client.ts +602 -0
  65. package/src/language-server/project/defaultClientSchema.ts +45 -0
  66. package/src/language-server/project/service.ts +48 -0
  67. package/src/language-server/providers/schema/__tests__/file.ts +150 -0
  68. package/src/language-server/providers/schema/base.ts +15 -0
  69. package/src/language-server/providers/schema/endpoint.ts +157 -0
  70. package/src/language-server/providers/schema/engine.ts +197 -0
  71. package/src/language-server/providers/schema/file.ts +167 -0
  72. package/src/language-server/providers/schema/index.ts +75 -0
  73. package/src/language-server/server.ts +252 -0
  74. package/src/language-server/typings/codemirror.d.ts +4 -0
  75. package/src/language-server/typings/graphql.d.ts +27 -0
  76. package/src/language-server/utilities/__tests__/graphql.test.ts +411 -0
  77. package/src/language-server/utilities/__tests__/uri.ts +55 -0
  78. package/src/language-server/utilities/debouncer.ts +8 -0
  79. package/src/language-server/utilities/debug.ts +89 -0
  80. package/src/language-server/utilities/graphql.ts +432 -0
  81. package/src/language-server/utilities/index.ts +3 -0
  82. package/src/language-server/utilities/source.ts +182 -0
  83. package/src/language-server/utilities/uri.ts +19 -0
  84. package/src/language-server/workspace.ts +262 -0
  85. package/src/languageServerClient.ts +19 -12
  86. package/src/messages.ts +84 -0
  87. package/src/statusBar.ts +5 -5
  88. package/src/tools/__tests__/buildServiceDefinition.test.ts +491 -0
  89. package/src/tools/__tests__/snapshotSerializers/astSerializer.ts +19 -0
  90. package/src/tools/__tests__/snapshotSerializers/graphQLTypeSerializer.ts +14 -0
  91. package/src/tools/buildServiceDefinition.ts +241 -0
  92. package/src/tools/index.ts +6 -0
  93. package/src/tools/schema/index.ts +2 -0
  94. package/src/tools/schema/resolveObject.ts +18 -0
  95. package/src/tools/schema/resolverMap.ts +23 -0
  96. package/src/tools/utilities/graphql.ts +22 -0
  97. package/src/tools/utilities/index.ts +3 -0
  98. package/src/tools/utilities/invariant.ts +5 -0
  99. package/src/tools/utilities/predicates.ts +5 -0
  100. package/src/utils.ts +1 -16
  101. package/syntaxes/graphql.js.json +3 -3
  102. package/syntaxes/graphql.json +13 -9
  103. package/syntaxes/graphql.lua.json +51 -0
  104. package/syntaxes/graphql.rb.json +1 -1
  105. package/tsconfig.build.json +4 -0
  106. package/tsconfig.json +20 -7
  107. package/create-server-symlink.js +0 -8
  108. package/lib/debug.d.ts +0 -11
  109. package/lib/debug.d.ts.map +0 -1
  110. package/lib/debug.js +0 -48
  111. package/lib/debug.js.map +0 -1
  112. package/lib/extension.d.ts +0 -4
  113. package/lib/extension.d.ts.map +0 -1
  114. package/lib/extension.js +0 -187
  115. package/lib/extension.js.map +0 -1
  116. package/lib/languageServerClient.d.ts +0 -4
  117. package/lib/languageServerClient.d.ts.map +0 -1
  118. package/lib/languageServerClient.js +0 -57
  119. package/lib/languageServerClient.js.map +0 -1
  120. package/lib/statusBar.d.ts +0 -24
  121. package/lib/statusBar.d.ts.map +0 -1
  122. package/lib/statusBar.js +0 -46
  123. package/lib/statusBar.js.map +0 -1
  124. package/lib/testRunner/index.d.ts +0 -3
  125. package/lib/testRunner/index.d.ts.map +0 -1
  126. package/lib/testRunner/index.js +0 -49
  127. package/lib/testRunner/index.js.map +0 -1
  128. package/lib/testRunner/jest-config.d.ts +0 -14
  129. package/lib/testRunner/jest-config.d.ts.map +0 -1
  130. package/lib/testRunner/jest-config.js +0 -18
  131. package/lib/testRunner/jest-config.js.map +0 -1
  132. package/lib/testRunner/jest-vscode-environment.d.ts +0 -2
  133. package/lib/testRunner/jest-vscode-environment.d.ts.map +0 -1
  134. package/lib/testRunner/jest-vscode-environment.js +0 -19
  135. package/lib/testRunner/jest-vscode-environment.js.map +0 -1
  136. package/lib/testRunner/jest-vscode-framework-setup.d.ts +0 -1
  137. package/lib/testRunner/jest-vscode-framework-setup.d.ts.map +0 -1
  138. package/lib/testRunner/jest-vscode-framework-setup.js +0 -3
  139. package/lib/testRunner/jest-vscode-framework-setup.js.map +0 -1
  140. package/lib/testRunner/vscode-test-script.d.ts +0 -2
  141. package/lib/testRunner/vscode-test-script.d.ts.map +0 -1
  142. package/lib/testRunner/vscode-test-script.js +0 -23
  143. package/lib/testRunner/vscode-test-script.js.map +0 -1
  144. package/lib/utils.d.ts +0 -18
  145. package/lib/utils.d.ts.map +0 -1
  146. package/lib/utils.js +0 -52
  147. package/lib/utils.js.map +0 -1
  148. package/src/testRunner/README.md +0 -23
  149. package/src/testRunner/index.ts +0 -72
  150. package/src/testRunner/jest-config.ts +0 -17
  151. package/src/testRunner/jest-vscode-environment.ts +0 -25
  152. package/src/testRunner/jest-vscode-framework-setup.ts +0 -10
  153. package/src/testRunner/jest.d.ts +0 -37
  154. package/src/testRunner/vscode-test-script.ts +0 -38
  155. package/tsconfig.test.json +0 -4
  156. package/tsconfig.tsbuildinfo +0 -2486
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  GraphQL has the potential to create incredible developer experiences, thanks to its strongly typed schema and query language. The Apollo platform brings these possibilities to life by enhancing your editor with rich metadata from your graph API.
4
4
 
5
- ![demo](https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/jump-to-def.gif)
5
+ ![demo](https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/jump-to-def.gif)
6
6
 
7
7
  The Apollo GraphQL extension for VS Code brings an all-in-one tooling experience for developing apps with Apollo.
8
8
 
@@ -17,7 +17,7 @@ The Apollo GraphQL extension for VS Code brings an all-in-one tooling experience
17
17
 
18
18
  <h2 id="getting-started">Getting started</h2>
19
19
 
20
- Some features of this extension (like syntax highlighting) will work without any configuration, but to get all of the benefits of the VS Code experience, it's best to link the schema that is being developed against **before** installing the extension. The best way to do that is by [publishing a schema](https://www.apollographql.com/docs/platform/schema-registry.html#setup) to the Apollo schema registry. Once that is done, two steps are needed:
20
+ Some features of this extension (like syntax highlighting) will work without any configuration, but to get all of the benefits of the VS Code experience, it's best to link the schema that is being developed against **before** installing the extension. The best way to do that is by [publishing a schema](https://www.apollographql.com/docs/graphos/delivery/) to the Apollo schema registry. Once that is done, two steps are needed:
21
21
 
22
22
  1. Create an `apollo.config.js` at the root of the project
23
23
  2. Copy an API key from the Apollo Studio dashboard of the published graph
@@ -94,7 +94,7 @@ Once you have a config set up and a schema published, **install the Apollo Graph
94
94
 
95
95
  When a file open, clicking the status bar icon will open the output window and print stats about the project associated with that file. This is helpful when confirming the project is setup properly.
96
96
 
97
- <img src="https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/stats.gif" alt="Clicking the status bar icon to open the output pane">
97
+ <img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/stats.gif" alt="Clicking the status bar icon to open the output pane">
98
98
 
99
99
  <h2 id="features">Features</h2>
100
100
 
@@ -104,19 +104,19 @@ Apollo for VS Code brings many helpful features for working on a GraphQL project
104
104
 
105
105
  Once configured, VS Code has full knowledge of the schema clients are running operations against, including client-only schemas (for things like local state mutations). Because of this, it have the ability to autocomplete fields and arguments as you type.
106
106
 
107
- <img src="https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/autocomplete.gif" alt="vscode completing a field when typing">
107
+ <img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/autocomplete.gif" alt="vscode completing a field when typing">
108
108
 
109
109
  <h3 id="errors-and-warnings">Inline errors and warnings</h3>
110
110
 
111
111
  VS Code can use local or published schemas to validate operations before running them. **Syntax errors**, **invalid fields or arguments**, and even **deprecated fields** instantly appear as errors or warnings right in your editor, ensuring all developers are working with the most up-to-date production schemas.
112
112
 
113
- <img src="https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/warnings-and-errors.gif" alt="tooltip showing a field deprecation warning and error">
113
+ <img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/warnings-and-errors.gif" alt="tooltip showing a field deprecation warning and error">
114
114
 
115
115
  <h3 id="field-type-info">Inline field type information</h3>
116
116
 
117
117
  Because of GraphQL's strongly-typed schema, VS Code not only know about which fields and arguments are valid, but also what types are expected. Hover over any type in a valid GraphQL operation to see what type that field returns and whether or not it can be null.
118
118
 
119
- <img src="https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/type-info.png" style="max-width:800px;" alt="a tooltip showing a Boolean type for a field">
119
+ <img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/type-info.png" style="max-width:800px;" alt="a tooltip showing a Boolean type for a field">
120
120
 
121
121
  <h3 id="performance-insights">Performance insights</h3>
122
122
 
@@ -126,7 +126,7 @@ To turn on tracing for your GraphQL server, please visit our [guide](https://www
126
126
 
127
127
  The VS Code extension will show inline performance diagnostics when connected to a service with reported metrics in Apollo Studio. As operations are typed, any fields that take longer than 1ms to respond will be annotated to the right of the field inline! This gives team members a picture of how long the operation will take as more and more fields are added to operations or fragments.
128
128
 
129
- <img src="https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/perf-annotation.png" style="max-width:800px;" alt="Performance annotation next to a field">
129
+ <img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/perf-annotation.png" style="max-width:800px;" alt="Performance annotation next to a field">
130
130
 
131
131
  <h3 id="syntax">Syntax highlighting</h3>
132
132
 
@@ -136,7 +136,7 @@ Apollo's editor extension provides syntax highlighting for all things GraphQL, i
136
136
 
137
137
  Navigating large codebases can be difficult, but the Apollo GraphQL extension makes this easier than ever. Right-clicking on any field in operations or schemas gives you the ability to jump to (or peek at) definitions, as well as find any other references to that field in your project. Searching a project for any occurrence of a certain field is now a thing of the past!
138
138
 
139
- <img src="https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/jump-to-def.gif" alt="Using jump to definition on a fragment">
139
+ <img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/jump-to-def.gif" alt="Using jump to definition on a fragment">
140
140
 
141
141
  <h3 id="commands">Schema tag switching</h3>
142
142
 
@@ -151,6 +151,6 @@ Other errors may be caused from an old version of a published schema. To reload
151
151
 
152
152
  Sometimes errors will show up as a notification at the bottom of your editor. Other, less critical messages may be shown in the output pane of the editor. To open the output pane and get diagnostic information about the extension and the current service loaded (if working with a client project), just click the "Apollo GraphQL" icon in the status bar at the bottom.
153
153
 
154
- <img src="https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo/images/marketplace/stats.gif" alt="Clicking the status bar icon to open the output pane">
154
+ <img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/stats.gif" alt="Clicking the status bar icon to open the output pane">
155
155
 
156
156
  If problems persist or the error messages are unhelpful, an [issue](https://github.com/apollographql/apollo-tooling/issues) can be opened on the `apollo-tooling` repository.
package/codegen.yml ADDED
@@ -0,0 +1,12 @@
1
+ # Would be better to get the schema from the Studio registry once it can be a public variant.
2
+ schema: https://graphql.api.apollographql.com/api/graphql
3
+ generates:
4
+ ./src/language-server/graphqlTypes.ts:
5
+ documents:
6
+ - src/**/*.ts
7
+ - "!src/**/__tests__**/*.ts"
8
+ plugins:
9
+ - typescript
10
+ - typescript-operations
11
+ config:
12
+ avoidOptionals: true
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" viewBox="0 0 20 20" width="7" height="7">
2
+ <title>
3
+ Exported from Streamline App (https://app.streamlineicons.com)
4
+ </title>
5
+ <g transform="matrix(2.54 0 0 2.54 10 9.97)" id="LVKu-U2gXNoh456TxJx47" >
6
+ <path style="stroke: rgb(255,255,255); stroke-width: 1; stroke-dasharray: none; stroke-linecap: round; stroke-dashoffset: 0; stroke-linejoin: round; stroke-miterlimit: 4; fill: #2075D6; fill-rule: evenodd; opacity: 1;" vector-effect="non-scaling-stroke" transform=" translate(-10.25, -9.71)" d="M 7 6.502 L 7 12.926 C 7 13.293 7.317 13.534 7.592 13.379 L 13.259 10.166 C 13.408058725855952 10.063593398311438 13.49712261259461 9.89434694032026 13.49712261259461 9.7135 C 13.49712261259461 9.532653059679742 13.408058725855952 9.363406601688563 13.259 9.261000000000001 L 7.592 6.047 C 7.317 5.893 7 6.135 7 6.502 Z" stroke-linecap="round" />
7
+ </g>
8
+ </svg>
package/jest.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { Config } from '@jest/types';
2
+
3
+ const config: Config.InitialOptions = {
4
+ roots: ['<rootDir>/src'],
5
+ testMatch: ['**/__tests__/**/*.test.ts'],
6
+ transform: {
7
+ '^.+\\.(ts)$': 'ts-jest',
8
+ },
9
+ };
10
+
11
+ export default config;
package/package.json CHANGED
@@ -2,36 +2,93 @@
2
2
  "name": "vscode-apollo",
3
3
  "displayName": "Apollo GraphQL",
4
4
  "description": "Rich editor support for GraphQL client and server development that seamlessly integrates with the Apollo platform",
5
- "version": "1.19.3",
5
+ "version": "1.20.1",
6
6
  "referenceID": "87197759-7617-40d0-b32e-46d378e907c7",
7
7
  "author": "Apollo GraphQL <opensource@apollographql.com>",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/apollographql/apollo-tooling"
11
+ "url": "https://github.com/apollographql/vscode-graphql"
12
12
  },
13
- "homepage": "https://github.com/apollographql/apollo-tooling",
14
- "bugs": "https://github.com/apollographql/apollo-tooling/issues",
13
+ "homepage": "https://github.com/apollographql/vscode-graphql",
14
+ "bugs": "https://github.com/apollographql/vscode-graphql/issues",
15
15
  "main": "./lib/extension",
16
16
  "types": "lib/index.d.ts",
17
17
  "scripts": {
18
- "preinstall": "npx rimraf node_modules && mkdir node_modules",
19
- "postinstall": "npm run update-vscode && npm run create-server-symlink",
20
- "update-vscode": "node ../../node_modules/vscode/bin/install",
21
- "create-server-symlink": "npx rimraf node_modules && mkdir node_modules && node create-server-symlink.js",
22
- "_internal:prepare-extension": "npx rimraf node_modules && yarn install --force --production --ignore-scripts",
23
- "_internal:cleanup-extension": "git clean -dfqX -- ./node_modules ./yarn.lock && npm run create-server-symlink",
24
- "package-extension": "npm run _internal:prepare-extension && ../../node_modules/vsce/out/vsce package --yarn --baseContentUrl https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo && npm run _internal:cleanup-extension",
25
- "publish-extension": "npm run _internal:prepare-extension && ../../node_modules/vsce/out/vsce publish -p $VS_MARKETPLACE_TOKEN --yarn --baseContentUrl https://raw.githubusercontent.com/apollographql/apollo-tooling/master/packages/vscode-apollo && npm run _internal:cleanup-extension",
26
- "test": "node ./lib/testRunner/vscode-test-script.js"
18
+ "build": "tsc --build tsconfig.build.json",
19
+ "build:clean": "npm run build -- --clean",
20
+ "watch": "npm run build -- --watch",
21
+ "postinstall": "curl https://raw.githubusercontent.com/Microsoft/vscode/c6e592b2b5770e40a98cb9c2715a8ef89aec3d74/src/vs/vscode.d.ts -o node_modules/vscode/vscode.d.ts",
22
+ "changeset-version": "changeset version && npm ci --ignore-scripts",
23
+ "changeset-publish": "npm run build && changeset publish",
24
+ "typecheck": "tsc --noEmit",
25
+ "lint": "eslint src --ext .ts",
26
+ "test-unit": "jest",
27
+ "codegen": "graphql-codegen"
27
28
  },
28
29
  "engines": {
29
30
  "vscode": "^1.30.0"
30
31
  },
31
32
  "dependencies": {
32
- "apollo-env": "^0.10.0",
33
- "apollo-language-server": "^1.26.3",
34
- "vscode-languageclient": "^5.2.1"
33
+ "@apollo/federation": "^0.23.1",
34
+ "@endemolshinegroup/cosmiconfig-typescript-loader": "^1.0.0",
35
+ "@types/lz-string": "^1.3.34",
36
+ "@types/node-fetch": "2.5.10",
37
+ "apollo-datasource": "^0.8.0",
38
+ "apollo-link": "^1.2.3",
39
+ "apollo-link-context": "^1.0.9",
40
+ "apollo-link-error": "^1.1.1",
41
+ "apollo-link-http": "^1.5.5",
42
+ "apollo-server-errors": "^2.0.2",
43
+ "await-to-js": "^2.0.1",
44
+ "codemirror": "^5.63.3",
45
+ "core-js": "^3.0.1",
46
+ "cosmiconfig": "^5.0.6",
47
+ "dotenv": "^10.0.0",
48
+ "glob": "^7.1.3",
49
+ "graphql": "^15.5.0",
50
+ "graphql-language-service-interface": "^2.8.4",
51
+ "graphql-tag": "^2.10.1",
52
+ "lodash.debounce": "^4.0.8",
53
+ "lodash.merge": "^4.6.1",
54
+ "lz-string": "^1.4.4",
55
+ "minimatch": "^3.0.4",
56
+ "moment": "^2.29.1",
57
+ "node-fetch": "^2.2.0",
58
+ "query-string": "^7.0.1",
59
+ "resolve-from": "^5.0.0",
60
+ "sha.js": "^2.4.11",
61
+ "vscode-languageclient": "^5.2.1",
62
+ "vscode-languageserver": "^5.1.0",
63
+ "vscode-uri": "1.0.6"
64
+ },
65
+ "devDependencies": {
66
+ "@changesets/changelog-github": "^0.4.8",
67
+ "@changesets/cli": "^2.26.2",
68
+ "@graphql-codegen/cli": "^2.2.0",
69
+ "@graphql-codegen/typescript-operations": "^2.1.3",
70
+ "@types/cosmiconfig": "5.0.3",
71
+ "@types/glob": "7.1.1",
72
+ "@types/jest": "^26.0.24",
73
+ "@types/lodash.debounce": "4.0.6",
74
+ "@types/lodash.merge": "4.6.6",
75
+ "@types/node": "^14.14.41",
76
+ "@types/node-fetch": "2.5.10",
77
+ "@typescript-eslint/eslint-plugin": "^4.29.0",
78
+ "@typescript-eslint/parser": "^4.29.0",
79
+ "eslint": "^7.32.0",
80
+ "eslint-config-prettier": "^8.3.0",
81
+ "eslint-plugin-prettier": "^3.4.0",
82
+ "jest": "^27.0.6",
83
+ "jest-environment-node": "^26.6.2",
84
+ "jest-junit": "^12.2.0",
85
+ "memfs": "^3.2.2",
86
+ "prettier": "^2.3.2",
87
+ "rimraf": "^3.0.2",
88
+ "ts-jest": "^27.0.4",
89
+ "typescript": "^4.3.5",
90
+ "vsce": "^1.87.1",
91
+ "vscode": "^1.1.37"
35
92
  },
36
93
  "publisher": "apollographql",
37
94
  "categories": [
@@ -40,12 +97,13 @@
40
97
  ],
41
98
  "icon": "images/icon-apollo-blue-400x400.png",
42
99
  "activationEvents": [
43
- "workspaceContains:**/apollo.config.[jt]s"
100
+ "workspaceContains:**/apollo.config.[jt]s",
101
+ "workspaceContains:**/apollo.config.cjs"
44
102
  ],
45
103
  "contributes": {
46
104
  "configuration": {
47
105
  "type": "object",
48
- "title": "Configuration",
106
+ "title": "Apollo GraphQL",
49
107
  "properties": {
50
108
  "apollographql.trace.server": {
51
109
  "scope": "window",
@@ -57,6 +115,18 @@
57
115
  ],
58
116
  "default": "off",
59
117
  "description": "Traces the communication between VS Code and the language server."
118
+ },
119
+ "apollographql.debug.revealOutputOnLanguageServerError": {
120
+ "type": "boolean",
121
+ "default": true,
122
+ "markdownDescription": "Switches to the \"Output\" tab whenever an error occurs in the language server.",
123
+ "scope": "window"
124
+ },
125
+ "apollographql.display.showRunInStudioButton": {
126
+ "type": "boolean",
127
+ "default": true,
128
+ "markdownDescription": "Show a \"Run in Studio\" button to the right of Operation Signatures.",
129
+ "scope": "window"
60
130
  }
61
131
  }
62
132
  },
@@ -84,9 +154,10 @@
84
154
  "injectTo": [
85
155
  "source.js",
86
156
  "source.ts",
87
- "source.js.jsx",
157
+ "source.jsx",
88
158
  "source.tsx",
89
- "source.vue"
159
+ "source.vue",
160
+ "source.svelte"
90
161
  ],
91
162
  "scopeName": "inline.graphql",
92
163
  "path": "./syntaxes/graphql.js.json",
@@ -104,6 +175,16 @@
104
175
  "meta.embedded.block.graphql": "graphql"
105
176
  }
106
177
  },
178
+ {
179
+ "injectTo": [
180
+ "source.lua"
181
+ ],
182
+ "scopeName": "inline.graphql.lua",
183
+ "path": "./syntaxes/graphql.lua.json",
184
+ "embeddedLanguages": {
185
+ "meta.embedded.block.graphql": "graphql"
186
+ }
187
+ },
107
188
  {
108
189
  "injectTo": [
109
190
  "source.ruby"
@@ -166,6 +247,5 @@
166
247
  "galleryBanner": {
167
248
  "color": "#1d127d",
168
249
  "theme": "dark"
169
- },
170
- "gitHead": "7f77a11e5c3123137af9235b4a32ac76ec1aad39"
250
+ }
171
251
  }
package/renovate.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "extends": ["apollo-open-source"],
3
+ "dependencyDashboard": true,
4
+ "packageRules": [
5
+ {
6
+ "groupName": "all @types",
7
+ "groupSlug": "all-types",
8
+ "matchPackagePatterns": ["@types/*"]
9
+ },
10
+ {
11
+ "groupName": "all devDependencies",
12
+ "groupSlug": "all-dev",
13
+ "matchPackagePatterns": ["*"],
14
+ "matchDepTypes": ["devDependencies"]
15
+ },
16
+ {
17
+ "groupName": "all dependencies - patch updates",
18
+ "groupSlug": "all-patch",
19
+ "matchPackagePatterns": ["*"],
20
+ "matchUpdateTypes": ["patch"]
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,3 @@
1
+ const { fs } = require("memfs");
2
+
3
+ module.exports = fs;
@@ -1,11 +1,12 @@
1
- import StatusBar from "../statusBar";
1
+ // import StatusBar from "../statusBar";
2
2
 
3
- describe("statusBar", () => {
3
+ // TODO (jgzuke) disable this until we migrate away from `vscode`.
4
+ // https://code.visualstudio.com/api/working-with-extensions/testing-extension#migrating-from-vscode
5
+ describe.skip("statusBar", () => {
4
6
  it("only shows loaded state when it's supposed to", () => {
5
- const statusBar = new StatusBar({ hasActiveTextEditor: true });
6
-
7
- expect(statusBar.statusBarItem.text).toEqual(StatusBar.loadingStateText);
8
- statusBar.showLoadedState({ hasActiveTextEditor: true });
9
- expect(statusBar.statusBarItem.text).toEqual(StatusBar.loadedStateText);
7
+ // const statusBar = new StatusBar({ hasActiveTextEditor: true });
8
+ // expect(statusBar.statusBarItem.text).toEqual(StatusBar.loadingStateText);
9
+ // statusBar.showLoadedState({ hasActiveTextEditor: true });
10
+ // expect(statusBar.statusBarItem.text).toEqual(StatusBar.loadedStateText);
10
11
  });
11
12
  });
package/src/debug.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { window, workspace, OutputChannel } from "vscode";
1
+ import { OutputChannel } from "vscode";
2
2
 
3
3
  /**
4
4
  * for errors (and other logs in debug mode) we want to print
@@ -10,10 +10,7 @@ const createAndTrimStackTrace = () => {
10
10
  let stack: string | undefined = new Error().stack;
11
11
  // remove the lines in the stack from _this_ function and the caller (in this file) and shorten the trace
12
12
  return stack && stack.split("\n").length > 2
13
- ? stack
14
- .split("\n")
15
- .slice(3, 7)
16
- .join("\n")
13
+ ? stack.split("\n").slice(3, 7).join("\n")
17
14
  : stack;
18
15
  };
19
16
 
@@ -0,0 +1,32 @@
1
+ import { Agent as HttpAgent } from "http";
2
+ import { Agent as HttpsAgent } from "https";
3
+
4
+ export type RequestAgent = HttpAgent | HttpsAgent;
5
+
6
+ export type ReferrerPolicy =
7
+ | ""
8
+ | "no-referrer"
9
+ | "no-referrer-when-downgrade"
10
+ | "same-origin"
11
+ | "origin"
12
+ | "strict-origin"
13
+ | "origin-when-cross-origin"
14
+ | "strict-origin-when-cross-origin"
15
+ | "unsafe-url";
16
+
17
+ export {
18
+ default as fetch,
19
+ Request,
20
+ Response,
21
+ Headers,
22
+ ResponseInit,
23
+ BodyInit,
24
+ RequestInfo,
25
+ HeadersInit,
26
+ Body,
27
+ RequestInit,
28
+ RequestMode,
29
+ RequestCredentials,
30
+ RequestCache,
31
+ RequestRedirect,
32
+ } from "node-fetch";
@@ -0,0 +1,30 @@
1
+ declare function fetch(
2
+ input?: RequestInfo,
3
+ init?: RequestInit
4
+ ): Promise<Response>;
5
+
6
+ declare interface GlobalFetch {
7
+ fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
8
+ }
9
+
10
+ declare interface WindowOrWorkerGlobalScope {
11
+ fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
12
+ }
13
+
14
+ type RequestInfo = import("./fetch").RequestInfo;
15
+ type Headers = import("./fetch").Headers;
16
+ type HeadersInit = import("./fetch").HeadersInit;
17
+ type Body = import("./fetch").Body;
18
+ type Request = import("./fetch").Request;
19
+ type RequestAgent = import("./fetch").RequestAgent;
20
+ type RequestInit = import("./fetch").RequestInit;
21
+ type RequestMode = import("./fetch").RequestMode;
22
+ type RequestCredentials = import("./fetch").RequestCredentials;
23
+ type RequestCache = import("./fetch").RequestCache;
24
+ type RequestRedirect = import("./fetch").RequestRedirect;
25
+ type ReferrerPolicy = import("./fetch").ReferrerPolicy;
26
+ type Response = import("./fetch").Response;
27
+ type ResponseInit = import("./fetch").ResponseInit;
28
+ type BodyInit = import("./fetch").BodyInit;
29
+ type URLSearchParams = import("./url").URLSearchParams;
30
+ type URLSearchParamsInit = import("./url").URLSearchParamsInit;
@@ -0,0 +1,2 @@
1
+ export * from "./fetch";
2
+ export * from "./url";
@@ -0,0 +1,2 @@
1
+ export * from "./fetch";
2
+ export * from "./url";
@@ -0,0 +1,9 @@
1
+ import { URLSearchParams } from "url";
2
+ export { URL, URLSearchParams } from "url";
3
+
4
+ export type URLSearchParamsInit =
5
+ | URLSearchParams
6
+ | string
7
+ | { [key: string]: Object | Object[] | undefined }
8
+ | Iterable<[string, Object]>
9
+ | Array<[string, Object]>;
@@ -0,0 +1,4 @@
1
+ import "./polyfills";
2
+
3
+ export * from "./typescript-utility-types";
4
+ export * from "./fetch";
@@ -0,0 +1,17 @@
1
+ /// <reference lib="esnext.array" />
2
+ import "core-js/features/array/flat";
3
+ import "core-js/features/array/flat-map";
4
+
5
+ // The built-in Array.flat typings don't contain an overload for ReadonlyArray<U>[],
6
+ // which means the return type is inferred to be any[] instead of U[], hence this augmentation.
7
+ declare global {
8
+ interface Array<T> {
9
+ /**
10
+ * Returns a new array with all sub-array elements concatenated into it recursively up to the
11
+ * specified depth.
12
+ *
13
+ * @param depth The maximum recursion depth
14
+ */
15
+ flat<U>(this: ReadonlyArray<U>[], depth?: 1): U[];
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ import "./array";
2
+ import "./object";
@@ -0,0 +1,7 @@
1
+ import "core-js/features/object/from-entries";
2
+
3
+ declare global {
4
+ interface ObjectConstructor {
5
+ fromEntries<K extends string, V>(map: [K, V][]): Record<K, V>;
6
+ }
7
+ }
@@ -0,0 +1,2 @@
1
+ export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
2
+ export type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };