Skip to content

Commit 92fd16e

Browse files
committed
chore(deps): upgrade graphql-request to v6
graphql-request v5.2.0 introduced a package.json `exports` field that blocks deep subpath imports, so the generated `import { ClientError } from 'graphql-request/dist/types'` stops resolving. Switch the generated import to the package root, which has exported `ClientError` consistently since v4. @graphql-codegen/typescript-graphql-request is bumped alongside it since its peerDependency on graphql-request jumps straight from `~5.1.0` to `^6.0.0` with no version that supports both in between.
1 parent e88c416 commit 92fd16e

4 files changed

Lines changed: 12 additions & 94 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@graphql-codegen/plugin-helpers": "^2.3.1",
4242
"@graphql-codegen/visitor-plugin-common": "^2.5.1",
4343
"@types/micromatch": "^4.0.1",
44-
"graphql-request": "^4.0.0",
44+
"graphql-request": "^6.1.0",
4545
"micromatch": "^4.0.4",
4646
"pascal-case": "^3.1.2",
4747
"swr": "^2.0.0",
@@ -51,7 +51,7 @@
5151
"@graphql-codegen/cli": "^2.16.5",
5252
"@graphql-codegen/testing": "^1.17.7",
5353
"@graphql-codegen/typescript": "^2.0.0",
54-
"@graphql-codegen/typescript-graphql-request": "^4.0.0",
54+
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
5555
"@graphql-codegen/typescript-operations": "^2.0.0",
5656
"@types/jest": "^29.0.0",
5757
"@types/node": "^18.0.0",

src/visitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class SWRVisitor extends ClientSideBaseVisitor<
113113
const typeImport = this.config.useTypeImports ? 'import type' : 'import'
114114

115115
this._additionalImports.push(
116-
`${typeImport} { ClientError } from 'graphql-request/dist/types';`
116+
`${typeImport} { ClientError } from 'graphql-request';`
117117
)
118118

119119
if (this.config.useTypeImports) {

tests/swr.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ async function test() {
275275

276276
const usage = basicUsage
277277
const output = await validate(content, config, docs, schema, usage)
278-
expect(output).toContain(
279-
"import { ClientError } from 'graphql-request/dist/types'"
280-
)
278+
expect(output).toContain("import { ClientError } from 'graphql-request'")
281279
expect(output).toContain(readOutput('rawRequest'))
282280
})
283281

yarn.lock

Lines changed: 8 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@
936936
"@graphql-tools/utils" "^9.1.1"
937937
tslib "~2.4.0"
938938

939-
"@graphql-codegen/plugin-helpers@^2.3.1", "@graphql-codegen/plugin-helpers@^2.7.2":
939+
"@graphql-codegen/plugin-helpers@^2.3.1":
940940
version "2.7.2"
941941
resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-2.7.2.tgz#6544f739d725441c826a8af6a49519f588ff9bed"
942942
integrity sha512-kln2AZ12uii6U59OQXdjLk5nOlh1pHis1R98cDZGFnfaiAbX9V3fxcZ1MMJkB7qFUymTALzyjZoXXdyVmPMfRg==
@@ -981,15 +981,15 @@
981981
nock "13.3.0"
982982
tslib "~2.4.0"
983983

984-
"@graphql-codegen/typescript-graphql-request@^4.0.0":
985-
version "4.5.9"
986-
resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-graphql-request/-/typescript-graphql-request-4.5.9.tgz#d8a9488b7419cabf2ca98ae3936e82b9d244f2e9"
987-
integrity sha512-Vtv5qymUXcR4UFdHOlJHzK5TN+CZUwMwFDGb3n4Gjcr4yln1BWbUb7DXgD0GHzpXwDIj5G2XmJnFtr0jihBfrg==
984+
"@graphql-codegen/typescript-graphql-request@^6.2.0":
985+
version "6.4.0"
986+
resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-graphql-request/-/typescript-graphql-request-6.4.0.tgz#ea4fa1a825b7712224a69df4e91879a8ea2af45b"
987+
integrity sha512-O51cfVFvteJQ9pfgRCyBcRE8FJgWLUYf9DR12FhRWYUbh+Qfd0h0t4DsarIWzAskMCHn3clxpAf44eZTTJ6Jew==
988988
dependencies:
989989
"@graphql-codegen/plugin-helpers" "^3.0.0"
990-
"@graphql-codegen/visitor-plugin-common" "2.13.1"
990+
"@graphql-codegen/visitor-plugin-common" "2.13.8"
991991
auto-bind "~4.0.0"
992-
tslib "~2.4.0"
992+
tslib "^2.8.1"
993993

994994
"@graphql-codegen/typescript-operations@^2.0.0":
995995
version "2.5.13"
@@ -1013,22 +1013,6 @@
10131013
auto-bind "~4.0.0"
10141014
tslib "~2.4.0"
10151015

1016-
"@graphql-codegen/visitor-plugin-common@2.13.1":
1017-
version "2.13.1"
1018-
resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-2.13.1.tgz#2228660f6692bcdb96b1f6d91a0661624266b76b"
1019-
integrity sha512-mD9ufZhDGhyrSaWQGrU1Q1c5f01TeWtSWy/cDwXYjJcHIj1Y/DG2x0tOflEfCvh5WcnmHNIw4lzDsg1W7iFJEg==
1020-
dependencies:
1021-
"@graphql-codegen/plugin-helpers" "^2.7.2"
1022-
"@graphql-tools/optimize" "^1.3.0"
1023-
"@graphql-tools/relay-operation-optimizer" "^6.5.0"
1024-
"@graphql-tools/utils" "^8.8.0"
1025-
auto-bind "~4.0.0"
1026-
change-case-all "1.0.14"
1027-
dependency-graph "^0.11.0"
1028-
graphql-tag "^2.11.0"
1029-
parse-filepath "^1.0.2"
1030-
tslib "~2.4.0"
1031-
10321016
"@graphql-codegen/visitor-plugin-common@2.13.8", "@graphql-codegen/visitor-plugin-common@^2.5.1":
10331017
version "2.13.8"
10341018
resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-2.13.8.tgz#09bc6317b227e5a278f394f4cef0d6c2d1910597"
@@ -2399,11 +2383,6 @@ astral-regex@^2.0.0:
23992383
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
24002384
integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==
24012385

2402-
asynckit@^0.4.0:
2403-
version "0.4.0"
2404-
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
2405-
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
2406-
24072386
auto-bind@~4.0.0:
24082387
version "4.0.0"
24092388
resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb"
@@ -2908,13 +2887,6 @@ colorette@^2.0.16:
29082887
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a"
29092888
integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==
29102889

2911-
combined-stream@^1.0.8:
2912-
version "1.0.8"
2913-
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
2914-
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
2915-
dependencies:
2916-
delayed-stream "~1.0.0"
2917-
29182890
common-tags@1.8.2, common-tags@^1.8.0:
29192891
version "1.8.2"
29202892
resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6"
@@ -2992,13 +2964,6 @@ create-require@^1.1.0:
29922964
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
29932965
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
29942966

2995-
cross-fetch@^3.0.6:
2996-
version "3.1.4"
2997-
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.4.tgz#9723f3a3a247bf8b89039f3a380a9244e8fa2f39"
2998-
integrity sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==
2999-
dependencies:
3000-
node-fetch "2.6.1"
3001-
30022967
cross-fetch@^3.1.5:
30032968
version "3.2.0"
30042969
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.2.0.tgz#34e9192f53bc757d6614304d9e5e6fb4edb782e3"
@@ -3129,11 +3094,6 @@ define-properties@^1.1.4:
31293094
has-property-descriptors "^1.0.0"
31303095
object-keys "^1.1.1"
31313096

3132-
delayed-stream@~1.0.0:
3133-
version "1.0.0"
3134-
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
3135-
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=
3136-
31373097
dependency-graph@^0.11.0:
31383098
version "0.11.0"
31393099
resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.11.0.tgz#ac0ce7ed68a54da22165a85e97a01d53f5eb2e27"
@@ -3655,11 +3615,6 @@ extract-files@^11.0.0:
36553615
resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-11.0.0.tgz#b72d428712f787eef1f5193aff8ab5351ca8469a"
36563616
integrity sha512-FuoE1qtbJ4bBVvv94CC7s0oTnKUGvQs+Rjf1L2SJFfS+HTVVjhPFtehPdQ0JiGPqVNfSSZvL5yzHHQq2Z4WNhQ==
36573617

3658-
extract-files@^9.0.0:
3659-
version "9.0.0"
3660-
resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a"
3661-
integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ==
3662-
36633618
fast-decode-uri-component@^1.0.1:
36643619
version "1.0.1"
36653620
resolved "https://registry.yarnpkg.com/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz#46f8b6c22b30ff7a81357d4f59abfae938202543"
@@ -3816,15 +3771,6 @@ for-each@^0.3.3:
38163771
dependencies:
38173772
is-callable "^1.1.3"
38183773

3819-
form-data@^3.0.0:
3820-
version "3.0.1"
3821-
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
3822-
integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
3823-
dependencies:
3824-
asynckit "^0.4.0"
3825-
combined-stream "^1.0.8"
3826-
mime-types "^2.1.12"
3827-
38283774
fs.realpath@^1.0.0:
38293775
version "1.0.0"
38303776
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -4058,16 +4004,7 @@ graphql-helix@1.13.0:
40584004
resolved "https://registry.yarnpkg.com/graphql-helix/-/graphql-helix-1.13.0.tgz#e64dad5ef5f622ef38c97fa033f56f3d953c0104"
40594005
integrity sha512-cqDKMoRywKjnL0ZWCTB0GOiBgsH6d3nU4JGDF6RuzAyd35tmalzKpSxkx3NNp4H5RvnKWnrukWzR51wUq277ng==
40604006

4061-
graphql-request@^4.0.0:
4062-
version "4.0.0"
4063-
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-4.0.0.tgz#5e4361d33df1a95ccd7ad23a8ebb6bbca9d5622f"
4064-
integrity sha512-cdqQLCXlBGkaLdkLYRl4LtkwaZU6TfpE7/tnUQFl3wXfUPWN74Ov+Q61VuIh+AltS789YfGB6whghmCmeXLvTw==
4065-
dependencies:
4066-
cross-fetch "^3.0.6"
4067-
extract-files "^9.0.0"
4068-
form-data "^3.0.0"
4069-
4070-
graphql-request@^6.0.0:
4007+
graphql-request@^6.0.0, graphql-request@^6.1.0:
40714008
version "6.1.0"
40724009
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-6.1.0.tgz#f4eb2107967af3c7a5907eb3131c671eac89be4f"
40734010
integrity sha512-p+XPfS4q7aIpKVcgmnZKhMNqhltk20hfXtkaIkTfjjmiKMJ5xrt5c743cL03y/K7y1rg3WrIC49xGiEQ4mxdNw==
@@ -5288,18 +5225,6 @@ micromatch@^4.0.4:
52885225
braces "^3.0.2"
52895226
picomatch "^2.3.1"
52905227

5291-
mime-db@1.51.0:
5292-
version "1.51.0"
5293-
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c"
5294-
integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==
5295-
5296-
mime-types@^2.1.12:
5297-
version "2.1.34"
5298-
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24"
5299-
integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==
5300-
dependencies:
5301-
mime-db "1.51.0"
5302-
53035228
mimic-fn@^2.1.0:
53045229
version "2.1.0"
53055230
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
@@ -5392,11 +5317,6 @@ nock@13.3.0:
53925317
lodash "^4.17.21"
53935318
propagate "^2.0.0"
53945319

5395-
node-fetch@2.6.1:
5396-
version "2.6.1"
5397-
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
5398-
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
5399-
54005320
node-fetch@^2.6.1, node-fetch@^2.7.0:
54015321
version "2.7.0"
54025322
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"

0 commit comments

Comments
 (0)