vscode-apollo 1.20.0 → 2.0.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.
- package/.circleci/config.yml +27 -18
- package/.git-blame-ignore-revs +2 -0
- package/.nvmrc +1 -1
- package/.vscode/launch.json +9 -4
- package/.vscode/tasks.json +58 -16
- package/.vscodeignore +12 -1
- package/CHANGELOG.md +84 -0
- package/CODEOWNERS +4 -0
- package/README.md +97 -48
- package/graphql.configuration.json +5 -1
- package/images/marketplace/apollo-wordmark.png +0 -0
- package/jest.config.ts +14 -4
- package/jest.e2e.config.js +17 -0
- package/package.json +67 -68
- package/renovate.json +7 -0
- package/sampleWorkspace/clientSchema/apollo.config.cjs +10 -0
- package/sampleWorkspace/clientSchema/src/clientSchema.js +16 -0
- package/sampleWorkspace/clientSchema/src/test.js +18 -0
- package/sampleWorkspace/fixtures/starwarsSchema.graphql +299 -0
- package/sampleWorkspace/httpSchema/apollo.config.ts +8 -0
- package/sampleWorkspace/httpSchema/src/test.js +9 -0
- package/sampleWorkspace/localSchema/apollo.config.js +8 -0
- package/sampleWorkspace/localSchema/src/test.js +8 -0
- package/sampleWorkspace/localSchemaArray/apollo.config.js +12 -0
- package/sampleWorkspace/localSchemaArray/planets.graphql +20 -0
- package/sampleWorkspace/localSchemaArray/src/test.js +12 -0
- package/sampleWorkspace/sampleWorkspace.code-workspace +20 -0
- package/sampleWorkspace/spotifyGraph/apollo.config.mjs +5 -0
- package/sampleWorkspace/spotifyGraph/src/test.js +11 -0
- package/src/__e2e__/mockServer.js +117 -0
- package/src/__e2e__/mocks.js +13094 -0
- package/src/__e2e__/run.js +23 -0
- package/src/__e2e__/runTests.js +44 -0
- package/src/__e2e__/setup.js +1 -0
- package/src/__e2e__/vscode-environment.js +16 -0
- package/src/__e2e__/vscode.js +1 -0
- package/src/build.js +57 -0
- package/src/env/index.ts +0 -3
- package/src/extension.ts +251 -225
- package/src/language-server/__e2e__/clientSchema.e2e.ts +147 -0
- package/src/language-server/__e2e__/httpSchema.e2e.ts +21 -0
- package/src/language-server/__e2e__/localSchema.e2e.ts +25 -0
- package/src/language-server/__e2e__/localSchemaArray.e2e.ts +31 -0
- package/src/language-server/__e2e__/studioGraph.e2e.ts +65 -0
- package/src/language-server/__e2e__/utils.ts +151 -0
- package/src/language-server/__tests__/diagnostics.test.ts +8 -8
- package/src/language-server/__tests__/fileSet.test.ts +1 -1
- package/src/language-server/__tests__/fixtures/starwarsSchema.ts +2 -2
- package/src/language-server/config/__tests__/config.ts +22 -96
- package/src/language-server/config/__tests__/loadConfig.ts +120 -220
- package/src/language-server/config/__tests__/utils.ts +22 -29
- package/src/language-server/config/config.ts +221 -156
- package/src/language-server/config/loadConfig.ts +32 -153
- package/src/language-server/config/loadTsConfig.ts +70 -0
- package/src/language-server/config/utils.ts +5 -16
- package/src/language-server/diagnostics.ts +17 -8
- package/src/language-server/document.ts +16 -16
- package/src/language-server/engine/index.ts +57 -39
- package/src/language-server/engine/operations/frontendUrlRoot.ts +9 -1
- package/src/language-server/engine/operations/schemaTagsAndFieldStats.ts +9 -1
- package/src/language-server/errors/__tests__/NoMissingClientDirectives.test.ts +10 -5
- package/src/language-server/errors/logger.ts +1 -1
- package/src/language-server/errors/validation.ts +20 -23
- package/src/language-server/fileSet.ts +10 -12
- package/src/language-server/format.ts +1 -1
- package/src/language-server/graphqlTypes.ts +13020 -3455
- package/src/language-server/index.ts +0 -1
- package/src/language-server/languageProvider.ts +29 -32
- package/src/language-server/loadingHandler.ts +10 -27
- package/src/language-server/project/base.ts +32 -25
- package/src/language-server/project/client.ts +80 -114
- package/src/language-server/project/defaultClientSchema.ts +29 -4
- package/src/language-server/providers/schema/__tests__/file.ts +60 -19
- package/src/language-server/providers/schema/base.ts +2 -2
- package/src/language-server/providers/schema/endpoint.ts +15 -34
- package/src/language-server/providers/schema/engine.ts +25 -18
- package/src/language-server/providers/schema/file.ts +41 -32
- package/src/language-server/providers/schema/index.ts +5 -21
- package/src/language-server/server.ts +72 -50
- package/src/language-server/typings/graphql.d.ts +3 -3
- package/src/language-server/utilities/__tests__/graphql.test.ts +42 -54
- package/src/language-server/utilities/debouncer.ts +1 -1
- package/src/language-server/utilities/debug.ts +6 -5
- package/src/language-server/utilities/graphql.ts +17 -16
- package/src/language-server/utilities/source.ts +16 -16
- package/src/language-server/utilities/uri.ts +2 -2
- package/src/language-server/workspace.ts +29 -37
- package/src/languageServerClient.ts +4 -4
- package/src/messages.ts +38 -47
- package/src/tools/__tests__/buildServiceDefinition.test.ts +2 -2
- package/src/tools/buildServiceDefinition.ts +11 -11
- package/src/tools/schema/resolveObject.ts +1 -1
- package/src/tools/utilities/predicates.ts +1 -1
- package/src/utils.ts +7 -6
- package/syntaxes/graphql.dart.json +2 -4
- package/syntaxes/graphql.ex.json +1 -4
- package/tsconfig.build.json +8 -1
- package/tsconfig.json +5 -3
- package/src/env/fetch/fetch.ts +0 -32
- package/src/env/fetch/global.ts +0 -30
- package/src/env/fetch/index.d.ts +0 -2
- package/src/env/fetch/index.ts +0 -2
- package/src/env/fetch/url.ts +0 -9
- package/src/env/polyfills/array.ts +0 -17
- package/src/env/polyfills/index.ts +0 -2
- package/src/env/polyfills/object.ts +0 -7
- package/src/language-server/engine/GraphQLDataSource.ts +0 -124
- package/src/language-server/project/service.ts +0 -48
- package/src/language-server/typings/codemirror.d.ts +0 -4
package/.circleci/config.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
version: 2.1
|
|
2
2
|
|
|
3
3
|
orbs:
|
|
4
|
-
secops: apollo/circleci-secops-orb@2.0.
|
|
4
|
+
secops: apollo/circleci-secops-orb@2.0.7
|
|
5
5
|
|
|
6
6
|
executors:
|
|
7
7
|
node:
|
|
8
8
|
docker:
|
|
9
|
-
- image:
|
|
9
|
+
- image: cimg/node:22.6.0
|
|
10
10
|
working_directory: ~/vscode-graphql
|
|
11
11
|
|
|
12
12
|
commands:
|
|
@@ -31,14 +31,9 @@ jobs:
|
|
|
31
31
|
steps:
|
|
32
32
|
- checkout
|
|
33
33
|
- npm-install
|
|
34
|
-
- run:
|
|
35
|
-
name: Ensure test reports output dir exists
|
|
36
|
-
command: mkdir -p /tmp/test-reports/lint
|
|
37
34
|
- run:
|
|
38
35
|
name: Run lint (currenty prettier)
|
|
39
|
-
command: npm run lint
|
|
40
|
-
- store_test_results:
|
|
41
|
-
path: /tmp/test-reports
|
|
36
|
+
command: npm run lint
|
|
42
37
|
|
|
43
38
|
typescript:
|
|
44
39
|
executor: node
|
|
@@ -49,28 +44,37 @@ jobs:
|
|
|
49
44
|
name: TypeScript Check
|
|
50
45
|
command: npm run typecheck
|
|
51
46
|
|
|
52
|
-
test
|
|
47
|
+
test:
|
|
48
|
+
executor: node
|
|
49
|
+
steps:
|
|
50
|
+
- checkout
|
|
51
|
+
- npm-install
|
|
52
|
+
- run:
|
|
53
|
+
name: Test
|
|
54
|
+
command: npm run test -- --runInBand
|
|
55
|
+
|
|
56
|
+
E2E tests:
|
|
53
57
|
executor: node
|
|
54
58
|
steps:
|
|
55
59
|
- checkout
|
|
56
60
|
- npm-install
|
|
61
|
+
- run: sudo apt update && sudo apt install -y libasound2 libgbm1 libgtk-3-0 libnss3 xvfb
|
|
62
|
+
- run:
|
|
63
|
+
name: Build
|
|
64
|
+
command: npm run build:production
|
|
57
65
|
- run:
|
|
58
|
-
|
|
59
|
-
command: mkdir -p /tmp/test-reports/test-unit
|
|
66
|
+
command: echo 'APOLLO_KEY="service:bob-123:489fhseo4"' > ./sampleWorkspace/spotifyGraph/.env
|
|
60
67
|
- run:
|
|
61
|
-
name:
|
|
62
|
-
command:
|
|
63
|
-
environment:
|
|
64
|
-
JEST_JUNIT_OUTPUT_DIR: "/tmp/test-reports/test-unit"
|
|
65
|
-
- store_test_results:
|
|
66
|
-
path: /tmp/test-reports
|
|
68
|
+
name: E2E tests
|
|
69
|
+
command: xvfb-run -a npm run test:extension
|
|
67
70
|
|
|
68
71
|
workflows:
|
|
69
72
|
build-test-deploy:
|
|
70
73
|
jobs:
|
|
71
74
|
- lint
|
|
72
75
|
- typescript
|
|
73
|
-
- test
|
|
76
|
+
- test
|
|
77
|
+
- E2E tests
|
|
74
78
|
security-scans:
|
|
75
79
|
jobs:
|
|
76
80
|
- secops/gitleaks:
|
|
@@ -80,3 +84,8 @@ workflows:
|
|
|
80
84
|
- secops-oidc
|
|
81
85
|
git-base-revision: <<#pipeline.git.base_revision>><<pipeline.git.base_revision>><</pipeline.git.base_revision >>
|
|
82
86
|
git-revision: << pipeline.git.revision >>
|
|
87
|
+
- secops/semgrep:
|
|
88
|
+
context:
|
|
89
|
+
- secops-oidc
|
|
90
|
+
- github-orb
|
|
91
|
+
git-base-revision: <<#pipeline.git.base_revision>><<pipeline.git.base_revision>><</pipeline.git.base_revision >>
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v20
|
package/.vscode/launch.json
CHANGED
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
"name": "Launch VS Code Extension",
|
|
7
7
|
"type": "extensionHost",
|
|
8
8
|
"request": "launch",
|
|
9
|
-
"preLaunchTask": "
|
|
9
|
+
"preLaunchTask": "BuildAndStartWorkspace",
|
|
10
10
|
"runtimeExecutable": "${execPath}",
|
|
11
11
|
"args": [
|
|
12
|
-
"--extensionDevelopmentPath=${workspaceRoot}"
|
|
12
|
+
"--extensionDevelopmentPath=${workspaceRoot}",
|
|
13
|
+
"--disable-extensions",
|
|
14
|
+
"${workspaceFolder}/sampleWorkspace/sampleWorkspace.code-workspace"
|
|
13
15
|
],
|
|
14
|
-
"stopOnEntry": false,
|
|
15
16
|
"sourceMaps": true,
|
|
17
|
+
"env": { "APOLLO_ENGINE_ENDPOINT": "http://localhost:7096/apollo" },
|
|
16
18
|
"outFiles": ["${workspaceRoot}/lib/**/*.js"]
|
|
17
19
|
},
|
|
18
20
|
{
|
|
@@ -31,9 +33,12 @@
|
|
|
31
33
|
"args": [
|
|
32
34
|
"--disable-extensions",
|
|
33
35
|
"--extensionDevelopmentPath=${workspaceFolder}",
|
|
36
|
+
"--extensionTestsPath=${workspaceFolder}/src/__e2e__/run.js",
|
|
37
|
+
"${workspaceFolder}/sampleWorkspace/sampleWorkspace.code-workspace"
|
|
34
38
|
],
|
|
35
39
|
"outFiles": ["${workspaceFolder}/lib/**/*.js"],
|
|
36
|
-
"preLaunchTask": "
|
|
40
|
+
"preLaunchTask": "BuildAndStartWorkspace",
|
|
41
|
+
"env": { "APOLLO_ENGINE_ENDPOINT": "http://localhost:7096/apollo" }
|
|
37
42
|
},
|
|
38
43
|
{
|
|
39
44
|
"name": "Attach to Test Debugger",
|
package/.vscode/tasks.json
CHANGED
|
@@ -1,18 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "npm: watch",
|
|
6
|
+
"type": "npm",
|
|
7
|
+
"script": "watch",
|
|
8
|
+
"problemMatcher": {
|
|
9
|
+
"owner": "custom",
|
|
10
|
+
"pattern": [
|
|
11
|
+
{
|
|
12
|
+
"regexp": "never match this please",
|
|
13
|
+
"file": 1,
|
|
14
|
+
"location": 2,
|
|
15
|
+
"message": 3
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"background": {
|
|
19
|
+
"activeOnStart": true,
|
|
20
|
+
"beginsPattern": "^\\s*\\[watch\\] build started.*",
|
|
21
|
+
"endsPattern": "^\\s*\\[watch\\] build finished.*"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"isBackground": true,
|
|
25
|
+
"presentation": {
|
|
26
|
+
"reveal": "never"
|
|
27
|
+
},
|
|
28
|
+
"group": {
|
|
29
|
+
"kind": "build",
|
|
30
|
+
"isDefault": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "sampleWorkspace",
|
|
35
|
+
"type": "npm",
|
|
36
|
+
"script": "sampleWorkspace:run",
|
|
37
|
+
"isBackground": true,
|
|
38
|
+
"problemMatcher": {
|
|
39
|
+
"owner": "custom",
|
|
40
|
+
"pattern": [
|
|
41
|
+
{
|
|
42
|
+
"regexp": "never match this please",
|
|
43
|
+
"file": 1,
|
|
44
|
+
"location": 2,
|
|
45
|
+
"message": 3
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"background": {
|
|
49
|
+
"activeOnStart": true,
|
|
50
|
+
"beginsPattern": "^\\s*Starting server.*",
|
|
51
|
+
"endsPattern": "^\\s*Server ready at.*"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"label": "BuildAndStartWorkspace",
|
|
57
|
+
"dependsOn": ["npm: watch", "sampleWorkspace"]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
18
60
|
}
|
package/.vscodeignore
CHANGED
|
@@ -11,7 +11,18 @@ src
|
|
|
11
11
|
.gitattributes
|
|
12
12
|
codegen.yml
|
|
13
13
|
graphql.configuration.json
|
|
14
|
-
jest
|
|
14
|
+
jest.*.ts
|
|
15
|
+
jest.*.js
|
|
15
16
|
package-lock.json
|
|
16
17
|
tsconfig.build.json
|
|
17
18
|
tsconfig.json
|
|
19
|
+
node_modules
|
|
20
|
+
.git*
|
|
21
|
+
CODEOWNERS
|
|
22
|
+
*.tsbuildinfo
|
|
23
|
+
sampleWorkspace
|
|
24
|
+
.changeset
|
|
25
|
+
.github
|
|
26
|
+
renovate.json
|
|
27
|
+
images/**/*.gif
|
|
28
|
+
images/marketplace
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#171](https://github.com/apollographql/vscode-graphql/pull/171) [`37a2b292`](https://github.com/apollographql/vscode-graphql/commit/37a2b292c0de22ee76645fc2dcde03b8f4843051) Thanks [@phryneas](https://github.com/phryneas)! - Also try parsing `.ts` files as CommonJS, not only ESM.
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Remove Service projects
|
|
14
|
+
"Service"-type projects had almost no functionality in the Extension, so they were removed
|
|
15
|
+
|
|
16
|
+
- [#169](https://github.com/apollographql/vscode-graphql/pull/169) [`ff4f0de4`](https://github.com/apollographql/vscode-graphql/commit/ff4f0de4da4d80e8bd9ea9779a8c34678b47de0d) Thanks [@phryneas](https://github.com/phryneas)! - Bundle extension instead of just building it.
|
|
17
|
+
|
|
18
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Remove support for deprecated configuration environment variable `ENGINE_API_KEY`
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- [#153](https://github.com/apollographql/vscode-graphql/pull/153) [`a37cfaa6`](https://github.com/apollographql/vscode-graphql/commit/a37cfaa6bf20a8aa6ffd937e4a113ef808baf980) Thanks [@phryneas](https://github.com/phryneas)! - Add `@nonreactive` and `@defer` directives to Apollo Client schema
|
|
23
|
+
|
|
24
|
+
- [#149](https://github.com/apollographql/vscode-graphql/pull/149) [`a8fe79f6`](https://github.com/apollographql/vscode-graphql/commit/a8fe79f665f02f16e8df8d90e5134c7bc944a72e) Thanks [@phryneas](https://github.com/phryneas)! - Add support for `apollo.config.mjs`.
|
|
25
|
+
|
|
26
|
+
- [#148](https://github.com/apollographql/vscode-graphql/pull/148) [`39430fdf`](https://github.com/apollographql/vscode-graphql/commit/39430fdfd46557eff7615b3fa8e9a90ff3d6071f) Thanks [@phryneas](https://github.com/phryneas)! - Modernization:
|
|
27
|
+
|
|
28
|
+
- move from `apollo-link-*` packages to `@apollo/client` dependency
|
|
29
|
+
- move from `@apollo/federation` to `@apollo/subgraph`
|
|
30
|
+
- replace `apollo-graphql` usage with `@graphql-tools/schema`
|
|
31
|
+
- drop `core-js` dependency
|
|
32
|
+
- update internally-used `@graphql-codegen`
|
|
33
|
+
- update `graphql` to v16
|
|
34
|
+
- replace `graphql-language-service-*` packages with `graphql-language-service` package
|
|
35
|
+
- remove `apollo-server-errors` dependency
|
|
36
|
+
|
|
37
|
+
- [#164](https://github.com/apollographql/vscode-graphql/pull/164) [`54316f24`](https://github.com/apollographql/vscode-graphql/commit/54316f24dc598734da35d663c5a754060d40ee1c) Thanks [@phryneas](https://github.com/phryneas)! - Fix configuration error display
|
|
38
|
+
|
|
39
|
+
- [`a6e6b7c1`](https://github.com/apollographql/vscode-graphql/commit/a6e6b7c1f02bbf79291cdd0d3c79224276e2eca2) Thanks [@phryneas](https://github.com/phryneas)! - Try schema path resolution relative to configuration path.
|
|
40
|
+
|
|
41
|
+
- [#149](https://github.com/apollographql/vscode-graphql/pull/149) [`a8fe79f6`](https://github.com/apollographql/vscode-graphql/commit/a8fe79f665f02f16e8df8d90e5134c7bc944a72e) Thanks [@phryneas](https://github.com/phryneas)! - Modernization:
|
|
42
|
+
|
|
43
|
+
- update `cosmiconfig`
|
|
44
|
+
- drop now-obsolete `@endemolshinegroup/cosmiconfig-typescript-loader`
|
|
45
|
+
|
|
46
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Configuration parsing has been reworked based on `zod`.
|
|
47
|
+
|
|
48
|
+
- [#153](https://github.com/apollographql/vscode-graphql/pull/153) [`a37cfaa6`](https://github.com/apollographql/vscode-graphql/commit/a37cfaa6bf20a8aa6ffd937e4a113ef808baf980) Thanks [@phryneas](https://github.com/phryneas)! - Remove unused `clientOnlyDirectives`, `clientSchemaDirectives` and `addTypename` client project config options.
|
|
49
|
+
|
|
50
|
+
- [#146](https://github.com/apollographql/vscode-graphql/pull/146) [`0721afe9`](https://github.com/apollographql/vscode-graphql/commit/0721afe9108a7b8b540fd18e967b9b138aee58f5) Thanks [@phryneas](https://github.com/phryneas)! - Modernization:
|
|
51
|
+
|
|
52
|
+
- set minimum VSCode version to 1.90.0
|
|
53
|
+
- update build target to ES2020
|
|
54
|
+
- drop `node-fetch` and similar polyfills
|
|
55
|
+
- update `vscode-languageclient/-server` modules
|
|
56
|
+
- migrate from the deprecated `vscode` module to `@types/vscode`
|
|
57
|
+
- update `typescript` developement dependency to 5.5
|
|
58
|
+
|
|
59
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Remove support for unused configuration options
|
|
60
|
+
The configuration options `client.name`, `client.referenceId`, `client.version`, `client.statsWindow`, `client.clientOnlyDirectives`, and `client.clientSchemaDirectives` had no effect in the extension, so they have been removed.
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- [#150](https://github.com/apollographql/vscode-graphql/pull/150) [`eeed0b8e`](https://github.com/apollographql/vscode-graphql/commit/eeed0b8e2bbb109c5796b3cda5516c5a6817059a) Thanks [@phryneas](https://github.com/phryneas)! - Modernization
|
|
65
|
+
|
|
66
|
+
- update `glob`
|
|
67
|
+
- add E2E tests
|
|
68
|
+
|
|
69
|
+
- [#149](https://github.com/apollographql/vscode-graphql/pull/149) [`a8fe79f6`](https://github.com/apollographql/vscode-graphql/commit/a8fe79f665f02f16e8df8d90e5134c7bc944a72e) Thanks [@phryneas](https://github.com/phryneas)! - Fixed a bug where changes in `apollo.config.ts` or `apollo.config.cjs` would require a manual extension reload.
|
|
70
|
+
|
|
71
|
+
- [#160](https://github.com/apollographql/vscode-graphql/pull/160) [`5312c6e8`](https://github.com/apollographql/vscode-graphql/commit/5312c6e8cd1cddb0ad762843c30e62caf5169f1d) Thanks [@phryneas](https://github.com/phryneas)! - Replace `graphql-datasource` usage with `@apollo/client`
|
|
72
|
+
|
|
73
|
+
- [#161](https://github.com/apollographql/vscode-graphql/pull/161) [`7fd57310`](https://github.com/apollographql/vscode-graphql/commit/7fd57310e5483584068550b762d91491379b90a5) Thanks [@phryneas](https://github.com/phryneas)! - Only show "Run in Studio" gutter action for local graphs if an endpoint is configured.
|
|
74
|
+
|
|
75
|
+
- [#159](https://github.com/apollographql/vscode-graphql/pull/159) [`952ef37d`](https://github.com/apollographql/vscode-graphql/commit/952ef37df0cf035a1af46918ef1f38868a7aa282) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where unrelated project configurations could be merged into each other.
|
|
76
|
+
|
|
77
|
+
- [#161](https://github.com/apollographql/vscode-graphql/pull/161) [`7fd57310`](https://github.com/apollographql/vscode-graphql/commit/7fd57310e5483584068550b762d91491379b90a5) Thanks [@phryneas](https://github.com/phryneas)! - Modernization
|
|
78
|
+
|
|
79
|
+
- update `minimatch` and `lz-string`
|
|
80
|
+
- drop `await-to-js`, `resolve-from`, `sha.js`
|
|
81
|
+
- drop `query-string`
|
|
82
|
+
|
|
83
|
+
- [#161](https://github.com/apollographql/vscode-graphql/pull/161) [`7fd57310`](https://github.com/apollographql/vscode-graphql/commit/7fd57310e5483584068550b762d91491379b90a5) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where the "Run in Studio" button would link to a Studio Graph instead of Explorer for local projects.
|
|
84
|
+
|
|
85
|
+
- [#160](https://github.com/apollographql/vscode-graphql/pull/160) [`5312c6e8`](https://github.com/apollographql/vscode-graphql/commit/5312c6e8cd1cddb0ad762843c30e62caf5169f1d) Thanks [@phryneas](https://github.com/phryneas)! - Prevent accidental creation of multiple output channels
|
|
86
|
+
|
|
3
87
|
## 1.20.0
|
|
4
88
|
|
|
5
89
|
### Minor Changes
|
package/CODEOWNERS
ADDED
package/README.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://www.apollographql.com/"><img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/apollo-wordmark.png" height="100" alt=""></a>
|
|
5
|
+
</p>
|
|
6
|
+
<h1>Apollo GraphQL for VS Code</h1>
|
|
7
|
+
|
|
8
|
+
[](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo) [](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo) [](https://circleci.com/gh/apollographql/vscode-graphql) [](https://community.apollographql.com) [](https://discord.gg/graphos)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
2
11
|
|
|
3
12
|
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
13
|
|
|
@@ -6,52 +15,54 @@ GraphQL has the potential to create incredible developer experiences, thanks to
|
|
|
6
15
|
|
|
7
16
|
The Apollo GraphQL extension for VS Code brings an all-in-one tooling experience for developing apps with Apollo.
|
|
8
17
|
|
|
9
|
-
- Add [syntax highlighting](#syntax) for GraphQL files and gql templates inside JavaScript files
|
|
10
|
-
- Get instant feedback and [intelligent autocomplete](#autocomplete) for fields, arguments, types, and variables as you write queries
|
|
11
|
-
-
|
|
12
|
-
-
|
|
18
|
+
- Add [syntax highlighting](#syntax-highlighting) for GraphQL files and gql templates inside JavaScript files
|
|
19
|
+
- Get instant feedback and [intelligent autocomplete](#intelligent-autocomplete) for fields, arguments, types, and variables as you write queries
|
|
20
|
+
- Manage client side schema alongside remote schema
|
|
21
|
+
- See [performance information](#performance-insights) inline with your query definitions
|
|
13
22
|
- Validate field and argument usage in operations
|
|
14
|
-
- [Navigate projects](#navigating-projects)
|
|
23
|
+
- [Navigate projects more easily](#navigating-projects) with jump-to and peek-at definitions
|
|
15
24
|
- Manage [client-only](#client-only-schemas) schemas
|
|
16
|
-
- [Switch
|
|
25
|
+
- [Switch graph variants](#graph-variant-switching) to work with schemas running on different environments
|
|
17
26
|
|
|
18
27
|
<h2 id="getting-started">Getting started</h2>
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
To get all 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/publishing-schemas/) to the Apollo schema registry. After that's done:
|
|
21
30
|
|
|
22
|
-
1. Create an `apollo.config.js` at the root of the project
|
|
23
|
-
|
|
31
|
+
1. Create an `apollo.config.js` file at the root of the project.
|
|
32
|
+
Alternatively, you can create a `cjs`, `mjs`, or `ts` file with the same configuration.
|
|
33
|
+
2. Obtain a [Personal API key](https://www.apollographql.com/docs/graphos/api-keys) from GraphOS Studio.
|
|
24
34
|
|
|
25
35
|
<h3 id="apollo-config">Setting up an Apollo config</h3>
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
For the VS Code plugin to know how to find the schema, it needs to be linked to either a published schema or a local one. To link a project to a published schema, edit the `apollo.config.js` file to look like this:
|
|
28
38
|
|
|
29
39
|
```js
|
|
30
40
|
module.exports = {
|
|
31
41
|
client: {
|
|
32
|
-
service: "my-graphql-app"
|
|
33
|
-
}
|
|
42
|
+
service: "my-graphql-app",
|
|
43
|
+
},
|
|
34
44
|
};
|
|
35
45
|
```
|
|
36
46
|
|
|
37
|
-
The service name is the
|
|
47
|
+
The `service` name is the name of the graph you've created in [GraphOS Studio](https://studio.apollographql.com).
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
See [additional configuration options](#additional-apollo-config-options).
|
|
40
50
|
|
|
41
|
-
<h3 id="api-key">Setting up
|
|
42
|
-
To authenticate with Apollo to pull down the schema, create a file next to the `apollo.config.js` called `.env`. This should be an untracked file (i.e. don't push it to GitHub). Go to the settings page of the published service and create a new API key.
|
|
51
|
+
<h3 id="api-key">Setting up the <code>.env</code> file</h3>
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
To authenticate with GraphOS Studio to pull down your schema, create a `.env` file in the same directory as the `apollo.config.js` file. This should be an untracked file (that is, don't commit it to Git).
|
|
45
54
|
|
|
46
|
-
|
|
55
|
+
Then go to your [User Settings page](https://studio.apollographql.com/user-settings/api-keys?referrer=docs-content) in GraphOS Studio to create a new Personal API key.
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
> It is best practice to create a new API key for each member of the team and name the key so its easy to find and revoke if needed. This will be easier to manage in the future.
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
After the key is found, add the following line to the `.env` file:
|
|
60
|
+
|
|
61
|
+
```bash showLineNumbers=false
|
|
51
62
|
APOLLO_KEY=<enter copied key here>
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
After this is done, VS Code
|
|
65
|
+
After this is done, VS Code can be reloaded and the Apollo integration will connect to GraphOS Studio to provide autocomplete, validation, and more.
|
|
55
66
|
|
|
56
67
|
<h3 id="local-schemas">Local schemas</h3>
|
|
57
68
|
|
|
@@ -62,35 +73,52 @@ module.exports = {
|
|
|
62
73
|
client: {
|
|
63
74
|
service: {
|
|
64
75
|
name: "my-graphql-app",
|
|
65
|
-
url: "http://localhost:4000/graphql"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
76
|
+
url: "http://localhost:4000/graphql",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
68
79
|
};
|
|
69
80
|
```
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
Linking to the local schema won't provide all features, such as switching graph variants and performance metrics.
|
|
72
83
|
|
|
73
|
-
|
|
84
|
+
<h3 id="local-schema-files">Local schema files</h3>
|
|
85
|
+
|
|
86
|
+
You might not always have a running server to link to, so the extension also supports linking to a local schema file.
|
|
87
|
+
This is useful for working on a schema in isolation or for testing out new features.
|
|
88
|
+
To link to a local schema file, add the following to the `apollo.config.js` file:
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
module.exports = {
|
|
92
|
+
client: {
|
|
93
|
+
service: {
|
|
94
|
+
// can be a string pointing to a single file or an array of strings
|
|
95
|
+
localSchemaFile: "./path/to/schema.graphql",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
```
|
|
74
100
|
|
|
75
101
|
<h3 id="client-only-schemas">Client-only schemas</h3>
|
|
76
102
|
|
|
77
|
-
One of the best features of the VS Code extension is the automatic merging of remote schemas and local ones when using integrated state management with Apollo Client. This happens automatically whenever schema definitions are found within a client project. By default, the VS Code extension will look for all files under `./src` to find both the operations and schema definitions for building a complete schema for the application.
|
|
103
|
+
One of the best features of the VS Code extension is the automatic merging of remote schemas and local ones when using integrated state management with Apollo Client. This happens automatically whenever schema definitions are found within a client project. By default, the VS Code extension will look for all JavaScript, TypeScript and GraphQL files under `./src` to find both the operations and schema definitions for building a complete schema for the application.
|
|
78
104
|
|
|
79
|
-
Client
|
|
105
|
+
Client side schema definitions can be spread throughout the client app project and will be merged together to create one single schema. The default behavior can be controlled by adding specifications to the `apollo.config.js`:
|
|
80
106
|
|
|
81
107
|
```js
|
|
82
108
|
module.exports = {
|
|
83
109
|
client: {
|
|
84
|
-
service: "my-graphql-app"
|
|
110
|
+
service: "my-graphql-app",
|
|
111
|
+
// array of glob patterns
|
|
85
112
|
includes: ["./src/**/*.js"],
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
113
|
+
// array of glob patterns
|
|
114
|
+
excludes: ["**/__tests__/**"],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
89
117
|
```
|
|
90
118
|
|
|
91
119
|
<h3 id="get-the-extension">Get the extension</h3>
|
|
92
120
|
|
|
93
|
-
Once you have a config set up and a schema published,
|
|
121
|
+
Once you have a config set up and a schema published, [install the Apollo GraphQL extension](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo), then try opening a file containing a GraphQL operation.
|
|
94
122
|
|
|
95
123
|
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
124
|
|
|
@@ -100,7 +128,7 @@ When a file open, clicking the status bar icon will open the output window and p
|
|
|
100
128
|
|
|
101
129
|
Apollo for VS Code brings many helpful features for working on a GraphQL project.
|
|
102
130
|
|
|
103
|
-
<h3 id="autocomplete">Intelligent autocomplete</h3>
|
|
131
|
+
<h3 id="intelligent-autocomplete">Intelligent autocomplete</h3>
|
|
104
132
|
|
|
105
133
|
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
134
|
|
|
@@ -122,35 +150,56 @@ Because of GraphQL's strongly-typed schema, VS Code not only know about which fi
|
|
|
122
150
|
|
|
123
151
|
GraphQL's flexibility can make it difficult to predict the cost of an operation. Without insight into how expensive an operation is, developers can accidentally write queries that place strain on their graph API's underlying backends. Thanks to the Apollo platform's integration with VS Code and our trace warehouse, teams can avoid these performance issues altogether by instantly seeing the cost of a query right in their editor.
|
|
124
152
|
|
|
125
|
-
|
|
126
|
-
|
|
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.
|
|
153
|
+
The VS Code extension will show inline performance diagnostics when connected to a service with reported metrics in GraphOS Studio. As operations are typed, any fields that take longer than 1 ms 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
154
|
|
|
129
|
-
<img
|
|
155
|
+
<img
|
|
156
|
+
src="https://raw.githubusercontent.com/apollographql/vscode-graphql/80a6ca4ae59173b8cef25020345e4ebe202eec41/images/marketplace/perf-annotation.png"
|
|
157
|
+
width="80%"
|
|
158
|
+
style="margin: 5%"
|
|
159
|
+
alt="Performance annotation next to a field"
|
|
160
|
+
/>
|
|
130
161
|
|
|
131
|
-
<h3 id="syntax">Syntax highlighting</h3>
|
|
162
|
+
<h3 id="syntax-highlighting">Syntax highlighting</h3>
|
|
132
163
|
|
|
133
|
-
Apollo's editor extension provides syntax highlighting for all things GraphQL, including schema definitions in `.graphql` files, complex queries in TypeScript, and even client-only schema extensions. Syntax highlighting for GraphQL works out-of-the-box for `.graphql`, `.gql`, `.js` and `.ts` file types
|
|
164
|
+
Apollo's editor extension provides syntax highlighting for all things GraphQL, including schema definitions in `.graphql` files, complex queries in TypeScript, and even client-only schema extensions. Syntax highlighting for GraphQL works out-of-the-box for `.graphql`, `.gql`, `.js` and `.ts` file types.
|
|
134
165
|
|
|
135
166
|
<h3 id="navigating-projects">Navigating projects</h3>
|
|
136
167
|
|
|
137
|
-
Navigating large codebases can be difficult, but the Apollo GraphQL extension makes this easier
|
|
168
|
+
Navigating large codebases can be difficult, but the Apollo GraphQL extension makes this easier. 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.
|
|
138
169
|
|
|
139
170
|
<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
171
|
|
|
141
|
-
<h3 id="
|
|
172
|
+
<h3 id="graph-variant-switching">Schema tag switching</h3>
|
|
142
173
|
|
|
143
|
-
|
|
174
|
+
Apollo supports publishing multiple versions ([variants](https://www.apollographql.com/docs/graphos/graphs/#variants)) of a schema. This is useful for developing on a future development schema and preparing your clients to conform to that schema. To switch between graph variants, open the Command Palette (`cmd + shift + p` on mac), search "Apollo" and choose the "Apollo: Select Schema Tag" option.
|
|
144
175
|
|
|
145
176
|
<h2 id="troubleshooting">Troubleshooting</h2>
|
|
146
177
|
|
|
147
|
-
The most common errors are configuration errors, like a missing `.env` file
|
|
148
|
-
There is more information about configuring an Apollo projects [here](https://www.apollographql.com/docs/references/apollo-config.html).
|
|
178
|
+
The most common errors are configuration errors, like a missing `.env` file or incorrect service information in the `apollo.config.js` file. Please see [the Apollo config docs](https://www.apollographql.com/docs/devtools/apollo-config/) for more configuration guidance.
|
|
149
179
|
|
|
150
180
|
Other errors may be caused from an old version of a published schema. To reload a schema, open the Command Palette (`cmd + shift + p` on mac), search "Apollo" and choose the "Apollo: Reload Schema" option.
|
|
151
181
|
|
|
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.
|
|
182
|
+
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
183
|
|
|
154
184
|
<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
185
|
|
|
156
|
-
If problems persist or the error messages are unhelpful, an [issue](https://github.com/apollographql/
|
|
186
|
+
If problems persist or the error messages are unhelpful, open an [issue](https://github.com/apollographql/vscode-graphql/issues) in the `vscode-graphql` repository.
|
|
187
|
+
|
|
188
|
+
<h2 id="additional-apollo-config-options">Additional Apollo config options</h2>
|
|
189
|
+
|
|
190
|
+
You can add these configurations to your [Apollo config file](#setting-up-an-apollo-config).
|
|
191
|
+
|
|
192
|
+
<h3 id="option-client-tagName">client.tagName</h3>
|
|
193
|
+
|
|
194
|
+
_Optional_ - custom tagged template literal.
|
|
195
|
+
|
|
196
|
+
When using GraphQL with JavaScript or TypeScript projects, it is common to use the `gql` tagged template literal to write out operations. Apollo tools look through your files for the `gql` tag to extract your queries, so if you use a different template literal, you can configure it like so:
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
module.exports = {
|
|
200
|
+
client: {
|
|
201
|
+
tagName: "graphql", // highlight-line
|
|
202
|
+
service: ...
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
```
|
|
Binary file
|
package/jest.config.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import type { Config } from
|
|
1
|
+
import type { Config } from "@jest/types";
|
|
2
2
|
|
|
3
3
|
const config: Config.InitialOptions = {
|
|
4
|
-
roots: [
|
|
5
|
-
|
|
4
|
+
roots: ["<rootDir>/src"],
|
|
5
|
+
snapshotFormat: {
|
|
6
|
+
escapeString: true,
|
|
7
|
+
printBasicPrototype: true,
|
|
8
|
+
},
|
|
9
|
+
testMatch: ["**/__tests__/**/*.ts"],
|
|
10
|
+
testPathIgnorePatterns: [
|
|
11
|
+
"/node_modules/",
|
|
12
|
+
"/fixtures/",
|
|
13
|
+
"/snapshotSerializers/",
|
|
14
|
+
],
|
|
6
15
|
transform: {
|
|
7
|
-
|
|
16
|
+
"^.+\\.(ts)$": "ts-jest",
|
|
8
17
|
},
|
|
18
|
+
prettierPath: null,
|
|
9
19
|
};
|
|
10
20
|
|
|
11
21
|
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// see https://github.com/microsoft/vscode-test/issues/37#issuecomment-700167820
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
moduleFileExtensions: ["js", "ts"],
|
|
6
|
+
testMatch: ["<rootDir>/src/**/*.e2e.ts"],
|
|
7
|
+
testEnvironment: "./src/__e2e__/vscode-environment.js",
|
|
8
|
+
setupFiles: ["./src/__e2e__/setup.js"],
|
|
9
|
+
verbose: true,
|
|
10
|
+
moduleNameMapper: {
|
|
11
|
+
vscode: path.join(__dirname, "src", "__e2e__", "vscode.js"),
|
|
12
|
+
},
|
|
13
|
+
transform: {
|
|
14
|
+
"^.+\\.(ts)$": "ts-jest",
|
|
15
|
+
},
|
|
16
|
+
prettierPath: null,
|
|
17
|
+
};
|