Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(workspace): upgrade ts (#136)

* ts v5

* update fragmetn tests

* tests

* last fixes

* fixes

* add changeset

authored by

Jovi De Croock and committed by
GitHub
3b3d9cb0 1ae3f924

+86 -134
+5
.changeset/big-paws-pump.md
··· 1 + --- 2 + '@0no-co/graphqlsp': patch 3 + --- 4 + 5 + Upgrade TypeScript dependency, this would normally not result in a changeset but it had us remove the normal auto-complete and quick-info and only do that logic when ours ends up in no results
+1 -1
package.json
··· 30 30 "lint-staged": "^15.0.0", 31 31 "prettier": "^2.8.7", 32 32 "rollup": "^3.20.2", 33 - "typescript": "^5.0.0", 33 + "typescript": "^5.3.3", 34 34 "vitest": "^0.34.6" 35 35 } 36 36 }
+1 -1
packages/example-external-generator/package.json
··· 19 19 "@graphql-codegen/cli": "^5.0.0", 20 20 "@graphql-codegen/client-preset": "^4.1.0", 21 21 "ts-node": "^10.9.1", 22 - "typescript": "^5.0.4" 22 + "typescript": "^5.3.3" 23 23 } 24 24 }
+1 -1
packages/example/package.json
··· 15 15 "@graphql-typed-document-node/core": "^3.2.0" 16 16 }, 17 17 "devDependencies": { 18 - "typescript": "^5.0.0", 18 + "typescript": "^5.3.3", 19 19 "@0no-co/graphqlsp": "file:../graphqlsp" 20 20 } 21 21 }
+1 -1
packages/graphqlsp/package.json
··· 37 37 "@types/node": "^18.15.11", 38 38 "@types/node-fetch": "^2.6.3", 39 39 "graphql": "^16.8.1", 40 - "typescript": "^5.0.0" 40 + "typescript": "^5.3.3" 41 41 }, 42 42 "dependencies": { 43 43 "@graphql-codegen/add": "^5.0.0",
+17 -20
packages/graphqlsp/src/index.ts
··· 91 91 info 92 92 ); 93 93 94 - const originalCompletions = info.languageService.getCompletionsAtPosition( 95 - filename, 96 - cursorPosition, 97 - options 98 - ) || { 99 - isGlobalCompletion: false, 100 - isMemberCompletion: false, 101 - isNewIdentifierLocation: false, 102 - entries: [], 103 - }; 104 - 105 - if (completions) { 106 - return { 107 - ...completions, 108 - entries: [...completions.entries, ...originalCompletions.entries], 109 - }; 94 + if (completions && completions.entries.length) { 95 + return completions; 110 96 } else { 111 - return originalCompletions; 97 + return ( 98 + info.languageService.getCompletionsAtPosition( 99 + filename, 100 + cursorPosition, 101 + options 102 + ) || { 103 + isGlobalCompletion: false, 104 + isMemberCompletion: false, 105 + isNewIdentifierLocation: false, 106 + entries: [], 107 + } 108 + ); 112 109 } 113 110 }; 114 111 ··· 120 117 info 121 118 ); 122 119 123 - const originalInfo = info.languageService.getQuickInfoAtPosition( 120 + if (quickInfo) return quickInfo; 121 + 122 + return info.languageService.getQuickInfoAtPosition( 124 123 filename, 125 124 cursorPosition 126 125 ); 127 - 128 - return quickInfo || originalInfo; 129 126 }; 130 127 131 128 logger('proxy: ' + JSON.stringify(proxy));
+29 -29
pnpm-lock.yaml
··· 19 19 version: 0.4.4(rollup@3.20.2) 20 20 '@rollup/plugin-typescript': 21 21 specifier: ^11.1.5 22 - version: 11.1.5(rollup@3.20.2)(typescript@5.0.4) 22 + version: 11.1.5(rollup@3.20.2)(typescript@5.3.3) 23 23 '@types/node': 24 24 specifier: ^18.15.11 25 25 version: 18.15.11 ··· 39 39 specifier: ^3.20.2 40 40 version: 3.20.2 41 41 typescript: 42 - specifier: ^5.0.0 43 - version: 5.0.4 42 + specifier: ^5.3.3 43 + version: 5.3.3 44 44 vitest: 45 45 specifier: ^0.34.6 46 46 version: 0.34.6 ··· 61 61 specifier: file:../graphqlsp 62 62 version: file:packages/graphqlsp(graphql@16.8.1) 63 63 typescript: 64 - specifier: ^5.0.0 65 - version: 5.0.4 64 + specifier: ^5.3.3 65 + version: 5.3.3 66 66 67 67 packages/example-external-generator: 68 68 dependencies: ··· 81 81 version: file:packages/graphqlsp(graphql@16.8.1) 82 82 '@graphql-codegen/cli': 83 83 specifier: ^5.0.0 84 - version: 5.0.0(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.0.4) 84 + version: 5.0.0(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.3.3) 85 85 '@graphql-codegen/client-preset': 86 86 specifier: ^4.1.0 87 87 version: 4.1.0(graphql@16.8.1) 88 88 ts-node: 89 89 specifier: ^10.9.1 90 - version: 10.9.1(@types/node@18.15.11)(typescript@5.0.4) 90 + version: 10.9.1(@types/node@18.15.11)(typescript@5.3.3) 91 91 typescript: 92 - specifier: ^5.0.4 93 - version: 5.0.4 92 + specifier: ^5.3.3 93 + version: 5.3.3 94 94 95 95 packages/graphqlsp: 96 96 dependencies: ··· 135 135 specifier: ^16.8.1 136 136 version: 16.8.1 137 137 typescript: 138 - specifier: ^5.0.0 139 - version: 5.0.4 138 + specifier: ^5.3.3 139 + version: 5.3.3 140 140 141 141 test/e2e/fixture-project: 142 142 dependencies: ··· 148 148 version: 4.0.4(graphql@16.8.1) 149 149 devDependencies: 150 150 typescript: 151 - specifier: ^5.0.4 152 - version: 5.0.4 151 + specifier: ^5.3.3 152 + version: 5.3.3 153 153 154 154 test/e2e/fixture-project-client-preset: 155 155 dependencies: ··· 167 167 version: 16.8.1 168 168 devDependencies: 169 169 typescript: 170 - specifier: ^5.0.4 171 - version: 5.0.4 170 + specifier: ^5.3.3 171 + version: 5.3.3 172 172 173 173 packages: 174 174 ··· 1341 1341 graphql: 16.8.1 1342 1342 tslib: 2.5.0 1343 1343 1344 - /@graphql-codegen/cli@5.0.0(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.0.4): 1344 + /@graphql-codegen/cli@5.0.0(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.3.3): 1345 1345 resolution: {integrity: sha512-A7J7+be/a6e+/ul2KI5sfJlpoqeqwX8EzktaKCeduyVKgOLA6W5t+NUGf6QumBDXU8PEOqXk3o3F+RAwCWOiqA==} 1346 1346 hasBin: true 1347 1347 peerDependencies: ··· 1368 1368 '@graphql-tools/utils': 10.0.1(graphql@16.8.1) 1369 1369 '@whatwg-node/fetch': 0.8.8 1370 1370 chalk: 4.1.2 1371 - cosmiconfig: 8.3.6(typescript@5.0.4) 1371 + cosmiconfig: 8.3.6(typescript@5.3.3) 1372 1372 debounce: 1.2.1 1373 1373 detect-indent: 6.1.0 1374 1374 graphql: 16.8.1 1375 - graphql-config: 5.0.3(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.0.4) 1375 + graphql-config: 5.0.3(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.3.3) 1376 1376 inquirer: 8.2.6 1377 1377 is-glob: 4.0.3 1378 1378 jiti: 1.21.0 ··· 2093 2093 terser: 5.22.0 2094 2094 dev: true 2095 2095 2096 - /@rollup/plugin-typescript@11.1.5(rollup@3.20.2)(typescript@5.0.4): 2096 + /@rollup/plugin-typescript@11.1.5(rollup@3.20.2)(typescript@5.3.3): 2097 2097 resolution: {integrity: sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==} 2098 2098 engines: {node: '>=14.0.0'} 2099 2099 peerDependencies: ··· 2109 2109 '@rollup/pluginutils': 5.0.2(rollup@3.20.2) 2110 2110 resolve: 1.22.2 2111 2111 rollup: 3.20.2 2112 - typescript: 5.0.4 2112 + typescript: 5.3.3 2113 2113 dev: true 2114 2114 2115 2115 /@rollup/pluginutils@5.0.2(rollup@3.20.2): ··· 2865 2865 resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} 2866 2866 dev: true 2867 2867 2868 - /cosmiconfig@8.3.6(typescript@5.0.4): 2868 + /cosmiconfig@8.3.6(typescript@5.3.3): 2869 2869 resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} 2870 2870 engines: {node: '>=14'} 2871 2871 peerDependencies: ··· 2878 2878 js-yaml: 4.1.0 2879 2879 parse-json: 5.2.0 2880 2880 path-type: 4.0.0 2881 - typescript: 5.0.4 2881 + typescript: 5.3.3 2882 2882 dev: true 2883 2883 2884 2884 /create-require@1.1.1: ··· 3482 3482 resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} 3483 3483 dev: true 3484 3484 3485 - /graphql-config@5.0.3(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.0.4): 3485 + /graphql-config@5.0.3(@types/node@18.15.11)(graphql@16.8.1)(typescript@5.3.3): 3486 3486 resolution: {integrity: sha512-BNGZaoxIBkv9yy6Y7omvsaBUHOzfFcII3UN++tpH8MGOKFPFkCPZuwx09ggANMt8FgyWP1Od8SWPmrUEZca4NQ==} 3487 3487 engines: {node: '>= 16.0.0'} 3488 3488 peerDependencies: ··· 3498 3498 '@graphql-tools/merge': 9.0.0(graphql@16.8.1) 3499 3499 '@graphql-tools/url-loader': 8.0.0(@types/node@18.15.11)(graphql@16.8.1) 3500 3500 '@graphql-tools/utils': 10.0.1(graphql@16.8.1) 3501 - cosmiconfig: 8.3.6(typescript@5.0.4) 3501 + cosmiconfig: 8.3.6(typescript@5.3.3) 3502 3502 graphql: 16.8.1 3503 3503 jiti: 1.21.0 3504 3504 minimatch: 4.2.3 ··· 5318 5318 resolution: {integrity: sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA==} 5319 5319 dev: true 5320 5320 5321 - /ts-node@10.9.1(@types/node@18.15.11)(typescript@5.0.4): 5321 + /ts-node@10.9.1(@types/node@18.15.11)(typescript@5.3.3): 5322 5322 resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} 5323 5323 hasBin: true 5324 5324 peerDependencies: ··· 5344 5344 create-require: 1.1.1 5345 5345 diff: 4.0.2 5346 5346 make-error: 1.3.6 5347 - typescript: 5.0.4 5347 + typescript: 5.3.3 5348 5348 v8-compile-cache-lib: 3.0.1 5349 5349 yn: 3.1.1 5350 5350 dev: true ··· 5408 5408 is-typed-array: 1.1.10 5409 5409 dev: true 5410 5410 5411 - /typescript@5.0.4: 5412 - resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==} 5413 - engines: {node: '>=12.20'} 5411 + /typescript@5.3.3: 5412 + resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} 5413 + engines: {node: '>=14.17'} 5414 5414 hasBin: true 5415 5415 dev: true 5416 5416
-55
test/e2e/client-preset.test.ts
··· 341 341 "name": "__typename", 342 342 "sortText": "14__typename", 343 343 }, 344 - { 345 - "kind": "string", 346 - "kindModifiers": "", 347 - "name": " 348 - fragment pokemonFields on Pokemon { 349 - id 350 - name 351 - attacks { 352 - fast { 353 - damage 354 - name 355 - } 356 - } 357 - } 358 - ", 359 - "replacementSpan": { 360 - "end": { 361 - "line": 10, 362 - "offset": 1, 363 - }, 364 - "start": { 365 - "line": 3, 366 - "offset": 39, 367 - }, 368 - }, 369 - "sortText": "11", 370 - }, 371 - { 372 - "kind": "string", 373 - "kindModifiers": "", 374 - "name": " 375 - query Pok($limit: Int!) { 376 - pokemons(limit: $limit) { 377 - id 378 - name 379 - fleeRate 380 - classification 381 - ...pokemonFields 382 - ...weaknessFields 383 - __typename 384 - } 385 - } 386 - ", 387 - "replacementSpan": { 388 - "end": { 389 - "line": 10, 390 - "offset": 1, 391 - }, 392 - "start": { 393 - "line": 3, 394 - "offset": 39, 395 - }, 396 - }, 397 - "sortText": "11", 398 - }, 399 344 ] 400 345 `); 401 346 }, 30000);
+1 -1
test/e2e/fixture-project-client-preset/package.json
··· 8 8 "@urql/core": "^4.0.4" 9 9 }, 10 10 "devDependencies": { 11 - "typescript": "^5.0.4" 11 + "typescript": "^5.3.3" 12 12 } 13 13 }
+1 -1
test/e2e/fixture-project/package.json
··· 6 6 "@urql/core": "^4.0.4" 7 7 }, 8 8 "devDependencies": { 9 - "typescript": "^5.0.4" 9 + "typescript": "^5.3.3" 10 10 } 11 11 }
+21 -16
test/e2e/fragments.test.ts
··· 68 68 tmpfile: outFilePost, 69 69 } satisfies ts.server.protocol.SavetoRequestArgs); 70 70 71 + await waitForExpect(() => { 72 + expect(fs.readFileSync(outFilePost, 'utf-8')).toContain( 73 + `as typeof import('./Post.generated').PostFieldsFragmentDoc` 74 + ); 75 + }); 76 + 77 + await waitForExpect(() => { 78 + const generatedPostFileContents = fs.readFileSync(genFilePost, 'utf-8'); 79 + expect(generatedPostFileContents).toContain( 80 + 'export const PostFieldsFragmentDoc = ' 81 + ); 82 + expect(generatedPostFileContents).toContain( 83 + 'import * as Types from "./__generated__/baseGraphQLSP"' 84 + ); 85 + }); 86 + 87 + server.sendCommand('saveto', { 88 + file: outFilePosts, 89 + tmpfile: outFilePosts, 90 + } satisfies ts.server.protocol.SavetoRequestArgs); 91 + 71 92 server.sendCommand('saveto', { 72 93 file: outFilePosts, 73 94 tmpfile: outFilePosts, ··· 85 106 'export const PostsListDocument = ' 86 107 ); 87 108 expect(generatedPostsFileContents).toContain( 88 - 'import * as Types from "./__generated__/baseGraphQLSP"' 89 - ); 90 - }); 91 - 92 - await waitForExpect(() => { 93 - expect(fs.readFileSync(outFilePost, 'utf-8')).toContain( 94 - `as typeof import('./Post.generated').PostFieldsFragmentDoc` 95 - ); 96 - }); 97 - 98 - await waitForExpect(() => { 99 - const generatedPostFileContents = fs.readFileSync(genFilePost, 'utf-8'); 100 - expect(generatedPostFileContents).toContain( 101 - 'export const PostFieldsFragmentDoc = ' 102 - ); 103 - expect(generatedPostFileContents).toContain( 104 109 'import * as Types from "./__generated__/baseGraphQLSP"' 105 110 ); 106 111 });
+6 -1
test/e2e/generate-types.test.ts
··· 122 122 tmpfile: outFileComplex, 123 123 } satisfies ts.server.protocol.SavetoRequestArgs); 124 124 125 + server.sendCommand('saveto', { 126 + file: outFileComplex, 127 + tmpfile: outFileComplex, 128 + } satisfies ts.server.protocol.SavetoRequestArgs); 129 + 125 130 await waitForExpect(() => { 126 131 const contents = fs.readFileSync(outFileComplex, 'utf-8'); 127 132 expect(contents).toContain(` id ··· 131 136 } 132 137 \` as typeof import('./rename-complex.generated').Post2FieldsFragmentDoc`); 133 138 }); 134 - }, 20000); 139 + }, 30000); 135 140 });
+1 -6
test/e2e/server.ts
··· 22 22 public projectPath: string, 23 23 public options: { debugLog?: boolean } = {} 24 24 ) { 25 - const tsserverPath = path.resolve( 26 - projectPath, 27 - '../../../node_modules/typescript/lib/tsserver.js' 28 - ); 29 - 30 - fs.lstatSync(tsserverPath); 25 + const tsserverPath = require.resolve('typescript/lib/tsserver'); 31 26 32 27 const server = fork(tsserverPath, ['--logVerbosity', 'verbose'], { 33 28 stdio: ['pipe', 'pipe', 'pipe', 'ipc'],
+1 -1
test/e2e/util.ts
··· 7 7 8 8 export const waitForExpect = async ( 9 9 expectFn: () => void, 10 - { interval = 500, timeout = 15000 }: WaitForExpectOptions = {} 10 + { interval = 2000, timeout = 30000 }: WaitForExpectOptions = {} 11 11 ) => { 12 12 // @sinonjs/fake-timers injects `clock` property into setTimeout 13 13 const usesFakeTimers = 'clock' in setTimeout;