Skip to content

Commit

Permalink
Cleanup unnecessary peer dependencies (#3790)
Browse files Browse the repository at this point in the history
* fix(apollo-inline-trace): peer dependencies

* chore(dependencies): updated changesets for modified dependencies

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
ardatan and github-actions[bot] authored Feb 20, 2025
1 parent a1e7e7b commit 1d438ce
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@graphql-yoga/plugin-apollo-inline-trace": patch
---
dependencies updates:
- Removed dependency [`@graphql-tools/utils@^10.6.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.6.1) (from `peerDependencies`)
- Removed dependency [`@whatwg-node/fetch@^0.10.1` ↗︎](https://www.npmjs.com/package/@whatwg-node/fetch/v/0.10.1) (from `peerDependencies`)
2 changes: 0 additions & 2 deletions packages/plugins/apollo-inline-trace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
"check": "tsc --pretty --noEmit"
},
"peerDependencies": {
"@graphql-tools/utils": "^10.6.1",
"@whatwg-node/fetch": "^0.10.1",
"graphql": "^15.2.0 || ^16.0.0",
"graphql-yoga": "workspace:^"
},
Expand Down
9 changes: 7 additions & 2 deletions packages/plugins/apollo-inline-trace/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GraphQLError, ResponsePath } from 'graphql';
import {
createGraphQLError,
FetchAPI,
isAsyncIterable,
mapMaybePromise,
Plugin,
Expand All @@ -9,7 +10,6 @@ import {
} from 'graphql-yoga';
import { google, Trace } from '@apollo/usage-reporting-protobuf';
import { useOnResolve } from '@envelop/on-resolve';
import { btoa } from '@whatwg-node/fetch';

export interface ApolloInlineRequestTraceContext {
startHrTime: [number, number];
Expand Down Expand Up @@ -66,7 +66,12 @@ export function useApolloInlineTrace(
...options,
});

let fetchAPI: FetchAPI;

return {
onYogaInit({ yoga }) {
fetchAPI = yoga.fetchAPI;
},
onPluginInit({ addPlugin }) {
addPlugin(instrumentation);
addPlugin({
Expand All @@ -91,7 +96,7 @@ export function useApolloInlineTrace(
}

const encodedUint8Array = Trace.encode(ctx.trace).finish();
const base64 = btoa(String.fromCharCode(...encodedUint8Array));
const base64 = fetchAPI.btoa(String.fromCharCode(...encodedUint8Array));
setResult({
...result,
extensions: {
Expand Down
13 changes: 5 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1d438ce

Please sign in to comment.