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.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/.circleci/config.yml +82 -0
- package/.eslintrc.js +10 -0
- package/.gitattributes +1 -0
- package/.github/workflows/build-prs.yml +57 -0
- package/.github/workflows/release.yml +114 -0
- package/.gitleaks.toml +26 -0
- package/.nvmrc +1 -0
- package/.prettierrc +5 -0
- package/.vscode/launch.json +61 -0
- package/.vscode/settings.json +16 -0
- package/.vscode/tasks.json +18 -0
- package/.vscodeignore +17 -1
- package/CHANGELOG.md +178 -1
- package/LICENSE +2 -2
- package/README.md +9 -9
- package/codegen.yml +12 -0
- package/images/IconRun.svg +8 -0
- package/jest.config.ts +11 -0
- package/package.json +102 -22
- package/renovate.json +23 -0
- package/src/__mocks__/fs.js +3 -0
- package/src/__tests__/statusBar.test.ts +8 -7
- package/src/debug.ts +2 -5
- package/src/env/fetch/fetch.ts +32 -0
- package/src/env/fetch/global.ts +30 -0
- package/src/env/fetch/index.d.ts +2 -0
- package/src/env/fetch/index.ts +2 -0
- package/src/env/fetch/url.ts +9 -0
- package/src/env/index.ts +4 -0
- package/src/env/polyfills/array.ts +17 -0
- package/src/env/polyfills/index.ts +2 -0
- package/src/env/polyfills/object.ts +7 -0
- package/src/env/typescript-utility-types.ts +2 -0
- package/src/extension.ts +106 -37
- package/src/language-server/__tests__/diagnostics.test.ts +86 -0
- package/src/language-server/__tests__/document.test.ts +187 -0
- package/src/language-server/__tests__/fileSet.test.ts +46 -0
- package/src/language-server/__tests__/fixtures/starwarsSchema.ts +1917 -0
- package/src/language-server/config/__tests__/config.ts +128 -0
- package/src/language-server/config/__tests__/loadConfig.ts +508 -0
- package/src/language-server/config/__tests__/utils.ts +106 -0
- package/src/language-server/config/config.ts +219 -0
- package/src/language-server/config/index.ts +3 -0
- package/src/language-server/config/loadConfig.ts +228 -0
- package/src/language-server/config/utils.ts +56 -0
- package/src/language-server/diagnostics.ts +109 -0
- package/src/language-server/document.ts +277 -0
- package/src/language-server/engine/GraphQLDataSource.ts +124 -0
- package/src/language-server/engine/index.ts +105 -0
- package/src/language-server/engine/operations/frontendUrlRoot.ts +7 -0
- package/src/language-server/engine/operations/schemaTagsAndFieldStats.ts +24 -0
- package/src/language-server/errors/__tests__/NoMissingClientDirectives.test.ts +220 -0
- package/src/language-server/errors/logger.ts +58 -0
- package/src/language-server/errors/validation.ts +277 -0
- package/src/language-server/fileSet.ts +65 -0
- package/src/language-server/format.ts +48 -0
- package/src/language-server/graphqlTypes.ts +7176 -0
- package/src/language-server/index.ts +29 -0
- package/src/language-server/languageProvider.ts +798 -0
- package/src/language-server/loadingHandler.ts +64 -0
- package/src/language-server/project/base.ts +399 -0
- package/src/language-server/project/client.ts +602 -0
- package/src/language-server/project/defaultClientSchema.ts +45 -0
- package/src/language-server/project/service.ts +48 -0
- package/src/language-server/providers/schema/__tests__/file.ts +150 -0
- package/src/language-server/providers/schema/base.ts +15 -0
- package/src/language-server/providers/schema/endpoint.ts +157 -0
- package/src/language-server/providers/schema/engine.ts +197 -0
- package/src/language-server/providers/schema/file.ts +167 -0
- package/src/language-server/providers/schema/index.ts +75 -0
- package/src/language-server/server.ts +252 -0
- package/src/language-server/typings/codemirror.d.ts +4 -0
- package/src/language-server/typings/graphql.d.ts +27 -0
- package/src/language-server/utilities/__tests__/graphql.test.ts +411 -0
- package/src/language-server/utilities/__tests__/uri.ts +55 -0
- package/src/language-server/utilities/debouncer.ts +8 -0
- package/src/language-server/utilities/debug.ts +89 -0
- package/src/language-server/utilities/graphql.ts +432 -0
- package/src/language-server/utilities/index.ts +3 -0
- package/src/language-server/utilities/source.ts +182 -0
- package/src/language-server/utilities/uri.ts +19 -0
- package/src/language-server/workspace.ts +262 -0
- package/src/languageServerClient.ts +19 -12
- package/src/messages.ts +84 -0
- package/src/statusBar.ts +5 -5
- package/src/tools/__tests__/buildServiceDefinition.test.ts +491 -0
- package/src/tools/__tests__/snapshotSerializers/astSerializer.ts +19 -0
- package/src/tools/__tests__/snapshotSerializers/graphQLTypeSerializer.ts +14 -0
- package/src/tools/buildServiceDefinition.ts +241 -0
- package/src/tools/index.ts +6 -0
- package/src/tools/schema/index.ts +2 -0
- package/src/tools/schema/resolveObject.ts +18 -0
- package/src/tools/schema/resolverMap.ts +23 -0
- package/src/tools/utilities/graphql.ts +22 -0
- package/src/tools/utilities/index.ts +3 -0
- package/src/tools/utilities/invariant.ts +5 -0
- package/src/tools/utilities/predicates.ts +5 -0
- package/src/utils.ts +1 -16
- package/syntaxes/graphql.js.json +3 -3
- package/syntaxes/graphql.json +13 -9
- package/syntaxes/graphql.lua.json +51 -0
- package/syntaxes/graphql.rb.json +1 -1
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +20 -7
- package/create-server-symlink.js +0 -8
- package/lib/debug.d.ts +0 -11
- package/lib/debug.d.ts.map +0 -1
- package/lib/debug.js +0 -48
- package/lib/debug.js.map +0 -1
- package/lib/extension.d.ts +0 -4
- package/lib/extension.d.ts.map +0 -1
- package/lib/extension.js +0 -187
- package/lib/extension.js.map +0 -1
- package/lib/languageServerClient.d.ts +0 -4
- package/lib/languageServerClient.d.ts.map +0 -1
- package/lib/languageServerClient.js +0 -57
- package/lib/languageServerClient.js.map +0 -1
- package/lib/statusBar.d.ts +0 -24
- package/lib/statusBar.d.ts.map +0 -1
- package/lib/statusBar.js +0 -46
- package/lib/statusBar.js.map +0 -1
- package/lib/testRunner/index.d.ts +0 -3
- package/lib/testRunner/index.d.ts.map +0 -1
- package/lib/testRunner/index.js +0 -49
- package/lib/testRunner/index.js.map +0 -1
- package/lib/testRunner/jest-config.d.ts +0 -14
- package/lib/testRunner/jest-config.d.ts.map +0 -1
- package/lib/testRunner/jest-config.js +0 -18
- package/lib/testRunner/jest-config.js.map +0 -1
- package/lib/testRunner/jest-vscode-environment.d.ts +0 -2
- package/lib/testRunner/jest-vscode-environment.d.ts.map +0 -1
- package/lib/testRunner/jest-vscode-environment.js +0 -19
- package/lib/testRunner/jest-vscode-environment.js.map +0 -1
- package/lib/testRunner/jest-vscode-framework-setup.d.ts +0 -1
- package/lib/testRunner/jest-vscode-framework-setup.d.ts.map +0 -1
- package/lib/testRunner/jest-vscode-framework-setup.js +0 -3
- package/lib/testRunner/jest-vscode-framework-setup.js.map +0 -1
- package/lib/testRunner/vscode-test-script.d.ts +0 -2
- package/lib/testRunner/vscode-test-script.d.ts.map +0 -1
- package/lib/testRunner/vscode-test-script.js +0 -23
- package/lib/testRunner/vscode-test-script.js.map +0 -1
- package/lib/utils.d.ts +0 -18
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -52
- package/lib/utils.js.map +0 -1
- package/src/testRunner/README.md +0 -23
- package/src/testRunner/index.ts +0 -72
- package/src/testRunner/jest-config.ts +0 -17
- package/src/testRunner/jest-vscode-environment.ts +0 -25
- package/src/testRunner/jest-vscode-framework-setup.ts +0 -10
- package/src/testRunner/jest.d.ts +0 -37
- package/src/testRunner/vscode-test-script.ts +0 -38
- package/tsconfig.test.json +0 -4
- package/tsconfig.tsbuildinfo +0 -2486
package/src/testRunner/README.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Jest TestRunner
|
|
2
|
-
|
|
3
|
-
Huge thanks to Unibeautify for their initial work on this. Most of the code in `/testRunner` is utilizing their work, barring some changes to configuration.
|
|
4
|
-
|
|
5
|
-
For reference, see:
|
|
6
|
-
https://github.com/Unibeautify/vscode/tree/master/test
|
|
7
|
-
|
|
8
|
-
## Notes
|
|
9
|
-
|
|
10
|
-
### .vscodeignore
|
|
11
|
-
|
|
12
|
-
The test runner itself must be compiled for VSCode to run it, so it lives in `src` and gets compiled to js. However, it's not included in the final build via the [.vscodeignore](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#.vscodeignore) file.
|
|
13
|
-
|
|
14
|
-
### ts-jest
|
|
15
|
-
|
|
16
|
-
The tests themselves don't need to be compiled due to `ts-jest`, so they're ignored in the `tsconfig.json`
|
|
17
|
-
|
|
18
|
-
### jest-config.ts
|
|
19
|
-
|
|
20
|
-
This is a standard Jest configuration object which is passed to the CLI. For a full reference, see [Jest Config](https://jestjs.io/docs/en/configuration.html). A couple noteworthy configuration options that are used:
|
|
21
|
-
|
|
22
|
-
- `testEnvironment`: This points to the custom test environment that's provided in order to run vscode. The environment extends `NodeEnvironment`, however it also adds `vscode` to the `global` object.
|
|
23
|
-
- `setupFilesAfterEnv`: Script to run for any initialization before tests are run. This mocks requests for the vscode module with the vscode object we've provided on the `global` object in the custom test environment.
|
package/src/testRunner/index.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wrapper around Jest's runCLI function. Responsible for passing in the config,
|
|
3
|
-
* executing, and passing along failures.
|
|
4
|
-
*/
|
|
5
|
-
import { ResultsObject, runCLI } from "jest";
|
|
6
|
-
import { resolve } from "path";
|
|
7
|
-
import { config } from "./jest-config";
|
|
8
|
-
|
|
9
|
-
export async function run(_testRoot: string, callback: TestRunnerCallback) {
|
|
10
|
-
const writeStreamRefs = forwardWriteStreams();
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const testDirectory = resolve(__dirname, "..", "..", "src");
|
|
14
|
-
const { results } = await runCLI(config, [testDirectory]);
|
|
15
|
-
|
|
16
|
-
restoreWriteStreams(writeStreamRefs);
|
|
17
|
-
|
|
18
|
-
const failures = collectTestFailureMessages(results);
|
|
19
|
-
|
|
20
|
-
if (failures.length > 0) {
|
|
21
|
-
callback(null, failures);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
callback(null);
|
|
26
|
-
} catch (e) {
|
|
27
|
-
callback(e);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Collect failure messages from Jest test results.
|
|
34
|
-
*
|
|
35
|
-
* @param results Jest test results.
|
|
36
|
-
*/
|
|
37
|
-
function collectTestFailureMessages(results: ResultsObject): string[] {
|
|
38
|
-
const failures = results.testResults.reduce<string[]>((acc, testResult) => {
|
|
39
|
-
if (testResult.failureMessage) acc.push(testResult.failureMessage);
|
|
40
|
-
return acc;
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
return failures;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Forward writes to process.stdout and process.stderr to console.log.
|
|
48
|
-
*
|
|
49
|
-
* For some reason this seems to be required for the Jest output to be streamed
|
|
50
|
-
* to the Debug Console.
|
|
51
|
-
*/
|
|
52
|
-
function forwardWriteStreams() {
|
|
53
|
-
const outRef = process.stdout.write;
|
|
54
|
-
const errRef = process.stderr.write;
|
|
55
|
-
|
|
56
|
-
process.stdout.write = logger;
|
|
57
|
-
process.stderr.write = logger;
|
|
58
|
-
|
|
59
|
-
return { outRef, errRef };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function restoreWriteStreams(refs: { outRef: any; errRef: any }) {
|
|
63
|
-
process.stdout.write = refs.outRef;
|
|
64
|
-
process.stderr.write = refs.errRef;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function logger(line: string) {
|
|
68
|
-
console.log(line);
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export type TestRunnerCallback = (error: Error | null, failures?: any) => void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Config to be handed off to jest
|
|
2
|
-
// @see: https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
|
|
5
|
-
export const config = {
|
|
6
|
-
preset: "ts-jest",
|
|
7
|
-
moduleFileExtensions: ["ts", "js"],
|
|
8
|
-
rootDir: resolve(__dirname, "..", "..", "src"),
|
|
9
|
-
testEnvironment: resolve(__dirname, "jest-vscode-environment.js"),
|
|
10
|
-
setupFilesAfterEnv: [resolve(__dirname, "jest-vscode-framework-setup.js")],
|
|
11
|
-
globals: {
|
|
12
|
-
"ts-jest": {
|
|
13
|
-
tsConfig: resolve(__dirname, "..", "..", "tsconfig.test.json"),
|
|
14
|
-
diagnostics: false
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exposes the Visual Studio Code extension API to the Jest testing environment.
|
|
3
|
-
* For custom environments reference:
|
|
4
|
-
* @see https://jestjs.io/docs/en/configuration.html#testenvironment-string
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// Using import here results in `jest_environment_node_1.default`
|
|
8
|
-
// The `.default` in this case doesn't exist. Interop issue with the built
|
|
9
|
-
// version of the package?
|
|
10
|
-
const NodeEnvironment = require("jest-environment-node");
|
|
11
|
-
import vscode from "vscode";
|
|
12
|
-
|
|
13
|
-
class VsCodeEnvironment extends NodeEnvironment {
|
|
14
|
-
public async setup() {
|
|
15
|
-
await super.setup();
|
|
16
|
-
this.global.vscode = vscode;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public async teardown() {
|
|
20
|
-
this.global.vscode = {};
|
|
21
|
-
return await super.teardown();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = VsCodeEnvironment;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Takes the Visual Studio Code extension API which was exposed on the sandbox's
|
|
3
|
-
* global object and uses it to create a virtual mock. This replaces vscode
|
|
4
|
-
* module imports with the vscode extension instance from the test runner's
|
|
5
|
-
* environment.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/Unibeautify/vscode/blob/61897cd6cd0567db2c8688c3c0b835f9b5c5b446/test/jest-vscode-framework-setup.ts
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
jest.mock("vscode", () => global.vscode, { virtual: true });
|
package/src/testRunner/jest.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
declare module "jest" {
|
|
2
|
-
/**
|
|
3
|
-
* Execute Jest and return a promise with the results.
|
|
4
|
-
*
|
|
5
|
-
* @see https://github.com/facebook/jest/blob/master/packages/jest-cli/src/cli/index.js
|
|
6
|
-
* @param jestConfig Jest configuration options.
|
|
7
|
-
* @param projects Paths to projects to run tests on.
|
|
8
|
-
*/
|
|
9
|
-
export function runCLI(
|
|
10
|
-
jestConfig: object,
|
|
11
|
-
projects: string[]
|
|
12
|
-
): Promise<{ globalConfig: object; results: ResultsObject }>;
|
|
13
|
-
|
|
14
|
-
export interface ResultsObject {
|
|
15
|
-
testResults: {
|
|
16
|
-
failureMessage?: string;
|
|
17
|
-
}[];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare module "jest-environment-node" {
|
|
22
|
-
export default class NodeEnvironment {
|
|
23
|
-
public global: any;
|
|
24
|
-
|
|
25
|
-
constructor(config: any);
|
|
26
|
-
|
|
27
|
-
public setup(): Promise<void>;
|
|
28
|
-
public teardown(): Promise<void>;
|
|
29
|
-
public runScript(script: any): any;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
declare namespace NodeJS {
|
|
34
|
-
interface Global {
|
|
35
|
-
vscode: any;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { resolve } from "path";
|
|
2
|
-
import { spawn } from "child_process";
|
|
3
|
-
|
|
4
|
-
const cp = spawn(
|
|
5
|
-
`node ${resolve(
|
|
6
|
-
process.cwd(),
|
|
7
|
-
"..",
|
|
8
|
-
"..",
|
|
9
|
-
"node_modules",
|
|
10
|
-
"vscode",
|
|
11
|
-
"bin",
|
|
12
|
-
"test"
|
|
13
|
-
)}`,
|
|
14
|
-
[],
|
|
15
|
-
{
|
|
16
|
-
shell: true,
|
|
17
|
-
env: {
|
|
18
|
-
CODE_TESTS_PATH: `${process.cwd()}/lib/testRunner`,
|
|
19
|
-
CODE_TESTS_WORKSPACE: process.cwd(),
|
|
20
|
-
DISPLAY: process.env.DISPLAY
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
cp.stdout.on("data", data => {
|
|
26
|
-
console.log(data.toString());
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
cp.stderr.on("data", err => {
|
|
30
|
-
// Useful for debugging, but generally more noisy than useful
|
|
31
|
-
// console.error({ err: err.toString() });
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
cp.on("close", code => {
|
|
35
|
-
if (code !== 0) {
|
|
36
|
-
process.exit(code);
|
|
37
|
-
}
|
|
38
|
-
});
|
package/tsconfig.test.json
DELETED