+5
.changeset/three-weeks-taste.md
+5
.changeset/three-weeks-taste.md
+25
README.md
+25
README.md
···- `extraTypes` allows you to specify imports or declare types to help with `scalar` definitions+- `trackFieldUsage` this only works with the client-preset, when turned on it will warn you about···+Currently the tracking unused fields feature has a few caveats with regards to tracking, first and foremost+it will only track in the same file to encourage [fragment co-location](https://www.apollographql.com/docs/react/data/fragments/#colocating-fragments).+Lastly we don't track mutations/subscriptions as some folks will add additional fields to properly support
+3
-1
packages/example-external-generator/package.json
+3
-1
packages/example-external-generator/package.json
···
-6
packages/example-external-generator/src/Pokemon.tsx
-6
packages/example-external-generator/src/Pokemon.tsx
+3
-27
packages/example-external-generator/src/gql/gql.ts
+3
-27
packages/example-external-generator/src/gql/gql.ts
···'\n fragment pokemonFields on Pokemon {\n id\n name\n attacks {\n fast {\n damage\n name\n }\n }\n }\n':-'\n query Pok($limit: Int!) {\n pokemons(limit: $limit) {\n id\n name\n fleeRate\n classification\n ...pokemonFields\n ...weaknessFields\n __typename\n }\n }\n':+'\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n':···* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.-* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.-source: '\n query Pok($limit: Int!) {\n pokemons(limit: $limit) {\n id\n name\n fleeRate\n classification\n ...pokemonFields\n ...weaknessFields\n __typename\n }\n }\n'-): (typeof documents)['\n query Pok($limit: Int!) {\n pokemons(limit: $limit) {\n id\n name\n fleeRate\n classification\n ...pokemonFields\n ...weaknessFields\n __typename\n }\n }\n'];-* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.-): (typeof documents)['\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n __typename\n }\n }\n'];-* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.+source: '\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n'+): (typeof documents)['\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n'];
+69
-162
packages/example-external-generator/src/gql/graphql.ts
+69
-162
packages/example-external-generator/src/gql/graphql.ts
···············
+37
-31
packages/example-external-generator/src/index.tsx
+37
-31
packages/example-external-generator/src/index.tsx
···+console.log(result.data?.pokemon?.attacks && result.data?.pokemon?.attacks.special && result.data?.pokemon?.attacks.special[0] && result.data?.pokemon?.attacks.special[0].name)
+3
-1
packages/example-external-generator/tsconfig.json
+3
-1
packages/example-external-generator/tsconfig.json
···"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
+5
-212
packages/example/src/index.generated.ts
+5
-212
packages/example/src/index.generated.ts
······
-29
packages/example/src/index.ts
-29
packages/example/src/index.ts
······
+25
packages/graphqlsp/README.md
+25
packages/graphqlsp/README.md
···- `extraTypes` allows you to specify imports or declare types to help with `scalar` definitions+- `trackFieldUsage` this only works with the client-preset, when turned on it will warn you about···+Currently the tracking unused fields feature has a few caveats with regards to tracking, first and foremost+it will only track in the same file to encourage [fragment co-location](https://www.apollographql.com/docs/react/data/fragments/#colocating-fragments).+Lastly we don't track mutations/subscriptions as some folks will add additional fields to properly support
+302
-2
packages/graphqlsp/src/diagnostics.ts
+302
-2
packages/graphqlsp/src/diagnostics.ts
···············
+95
-9
pnpm-lock.yaml
+95
-9
pnpm-lock.yaml
·········resolution: {integrity: sha512-JBq2pWyDchE1vVjj/+c4dzZ8stbpew4RrzpZ3vYdn1WJFGHfYg6YIX1fDdMKtSXJJM9FUlsoDOxemr9WMM2p+A==}+resolution: {integrity: sha512-W3ezhHGfO0MS1PtGloaTpg0PbaT8aZSmmaerL7idtU5F7oCI+uu25k+MsMS31BVFlp4aMkHSrNRxiD72IlK8TA==}···resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}+resolution: {integrity: sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==}+resolution: {integrity: sha512-TtAxCNrlrBp8GoeEp1npd5g+d/OejJHFxS3OWmrPBMFaVQMSN0OFySozJio5BHxTuTeug00AVXVAjfDSfk+lUg==}+resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==}resolution: {integrity: sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==}···+resolution: {integrity: sha512-TP1kheq9bnrEdnVbJqh0g0ZY/wfdpPeAzjiiDK+Tm+Pbi0O1Xdu6+fUJ/wJo5QpHZzkIyya4/AecG63e6scFqQ==}···+resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}resolution: {integrity: sha512-w/T+rqR0vwvHqWs/1ZyMDWtHHSJaN06klRqJXBEpDJaM/+dZkso0OKh1VcuuYvK3XM53KysVNq8Ko/epCK8wOw==}···resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}-resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}···resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==}+resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==}resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==}······resolution: {integrity: sha512-WHN8KDQblxd32odxeIgo83rdVDE2bvdkb86it7bMhYZwWKJz0+O0RK/eZiHYnM+zgt/U7hAHOlCQGfjjvSkw2g==}+resolution: {integrity: sha512-meXJ2puOd64uCGKh7Fse2R7gPa8+ZpBOoA62jN7CPXXUt7SVZSdeXWSpB3HvlfzLUkEqsWbvshwrgeWRYNNGaQ==}resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}···resolution: {integrity: sha512-nJyGPcjuBiaLFn8QAlrHd+QjV9AlPO7snOWAhgx6aX0nQLMV6Wi0nqfrkmsXIH0efngbDOroOz2QyLnZMF16Hw==}+resolution: {integrity: sha512-CjpbqNtBGNAeyNS/9W6q3kSkKE52+FjIj7AkFlLr11s/VWGUu6a2CdYSdGxocIhIVjaW/zchesBQUKPVU69Cqg==}
+3
test/e2e/fixture-project-unused-fields/.vscode/settings.json
+3
test/e2e/fixture-project-unused-fields/.vscode/settings.json
+115
test/e2e/fixture-project-unused-fields/__generated__/baseGraphQLSP.ts
+115
test/e2e/fixture-project-unused-fields/__generated__/baseGraphQLSP.ts
···
+49
test/e2e/fixture-project-unused-fields/fixtures/destructuring.tsx
+49
test/e2e/fixture-project-unused-fields/fixtures/destructuring.tsx
···
+27
test/e2e/fixture-project-unused-fields/fixtures/fragment-destructuring.tsx
+27
test/e2e/fixture-project-unused-fields/fixtures/fragment-destructuring.tsx
···
+27
test/e2e/fixture-project-unused-fields/fixtures/fragment.tsx
+27
test/e2e/fixture-project-unused-fields/fixtures/fragment.tsx
···
+85
test/e2e/fixture-project-unused-fields/fixtures/gql/fragment-masking.ts
+85
test/e2e/fixture-project-unused-fields/fixtures/gql/fragment-masking.ts
···
+54
test/e2e/fixture-project-unused-fields/fixtures/gql/gql.ts
+54
test/e2e/fixture-project-unused-fields/fixtures/gql/gql.ts
···+* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.+'\n fragment pokemonFields on Pokemon {\n id\n name\n attacks {\n fast {\n damage\n name\n }\n }\n }\n':+'\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n':+* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.+* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.+source: '\n fragment pokemonFields on Pokemon {\n id\n name\n attacks {\n fast {\n damage\n name\n }\n }\n }\n'+): (typeof documents)['\n fragment pokemonFields on Pokemon {\n id\n name\n attacks {\n fast {\n damage\n name\n }\n }\n }\n'];+* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.+source: '\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n'+): (typeof documents)['\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n'];
+340
test/e2e/fixture-project-unused-fields/fixtures/gql/graphql.ts
+340
test/e2e/fixture-project-unused-fields/fixtures/gql/graphql.ts
···
+2
test/e2e/fixture-project-unused-fields/fixtures/gql/index.ts
+2
test/e2e/fixture-project-unused-fields/fixtures/gql/index.ts
+39
test/e2e/fixture-project-unused-fields/fixtures/immediate-destructuring.tsx
+39
test/e2e/fixture-project-unused-fields/fixtures/immediate-destructuring.tsx
···
+42
test/e2e/fixture-project-unused-fields/fixtures/property-access.tsx
+42
test/e2e/fixture-project-unused-fields/fixtures/property-access.tsx
···+console.log(result.data?.pokemon?.attacks && result.data?.pokemon?.attacks.special && result.data?.pokemon?.attacks.special[0] && result.data?.pokemon?.attacks.special[0].name)
+85
test/e2e/fixture-project-unused-fields/gql/fragment-masking.ts
+85
test/e2e/fixture-project-unused-fields/gql/fragment-masking.ts
···
+54
test/e2e/fixture-project-unused-fields/gql/gql.ts
+54
test/e2e/fixture-project-unused-fields/gql/gql.ts
···+* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.+'\n fragment pokemonFields on Pokemon {\n id\n name\n attacks {\n fast {\n damage\n name\n }\n }\n }\n':+'\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n':+* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.+* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.+source: '\n fragment pokemonFields on Pokemon {\n id\n name\n attacks {\n fast {\n damage\n name\n }\n }\n }\n'+): (typeof documents)['\n fragment pokemonFields on Pokemon {\n id\n name\n attacks {\n fast {\n damage\n name\n }\n }\n }\n'];+* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.+source: '\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n'+): (typeof documents)['\n query Po($id: ID!) {\n pokemon(id: $id) {\n id\n fleeRate\n ...pokemonFields\n attacks {\n special {\n name\n damage\n }\n }\n weight {\n minimum\n maximum\n }\n name\n __typename\n }\n }\n'];
+340
test/e2e/fixture-project-unused-fields/gql/graphql.ts
+340
test/e2e/fixture-project-unused-fields/gql/graphql.ts
···
+2
test/e2e/fixture-project-unused-fields/gql/index.ts
+2
test/e2e/fixture-project-unused-fields/gql/index.ts
+15
test/e2e/fixture-project-unused-fields/package.json
+15
test/e2e/fixture-project-unused-fields/package.json
···
+94
test/e2e/fixture-project-unused-fields/schema.graphql
+94
test/e2e/fixture-project-unused-fields/schema.graphql
···
+23
test/e2e/fixture-project-unused-fields/tsconfig.json
+23
test/e2e/fixture-project-unused-fields/tsconfig.json
···
+429
test/e2e/unused-fieds.test.ts
+429
test/e2e/unused-fieds.test.ts
···