From b77db72c1dfcf04f0adfc2acfaf63ac92c5da921 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Wed, 31 Oct 2018 12:24:06 -0700 Subject: [PATCH] github: remove some deps on github/graphql.js (#962) Summary: A number of modules depended on the legacy `github/graphql.js` module solely to get at the `Reactions` enum object. As of #961, that object is exposed from the much lighter-weight `graphqlTypes.js`. This patch switches over the relevant imports, reducing our dependencies on this legacy module and its large bundle size. Test Plan: It suffices to run `yarn flow` and verify that the two values being imported are identical. wchargin-branch: github-use-generated-enums --- src/plugins/github/createGraph.js | 3 +-- src/plugins/github/edges.js | 6 ++++-- src/plugins/github/edges.test.js | 2 +- src/plugins/github/graphView.js | 3 +-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/github/createGraph.js b/src/plugins/github/createGraph.js index 2f3cc9a..ffbc328 100644 --- a/src/plugins/github/createGraph.js +++ b/src/plugins/github/createGraph.js @@ -6,8 +6,7 @@ import * as N from "./nodes"; import * as R from "./relationalView"; import {createEdge} from "./edges"; import {findMentionsAuthorReferences} from "./heuristics/mentionsAuthorReference"; -// TODO(@decentralion): Opportunity to reduce bundle size -import {Reactions} from "./graphql"; +import {ReactionContent$Values as Reactions} from "./graphqlTypes"; export function createGraph(view: R.RelationalView): Graph { const creator = new GraphCreator(); diff --git a/src/plugins/github/edges.js b/src/plugins/github/edges.js index 5f4032d..97b69cb 100644 --- a/src/plugins/github/edges.js +++ b/src/plugins/github/edges.js @@ -9,8 +9,10 @@ import { import * as GithubNode from "./nodes"; import * as GitNode from "../git/nodes"; import type {MentionsAuthorReference} from "./heuristics/mentionsAuthorReference"; -// TODO(@decentralion): Opportunity to reduce bundle size (tree shaking?) -import {Reactions, type ReactionContent} from "./graphql"; +import { + type ReactionContent, + ReactionContent$Values as Reactions, +} from "./graphqlTypes"; export opaque type RawAddress: EdgeAddressT = EdgeAddressT; diff --git a/src/plugins/github/edges.test.js b/src/plugins/github/edges.test.js index 23fe51a..a19d2dc 100644 --- a/src/plugins/github/edges.test.js +++ b/src/plugins/github/edges.test.js @@ -5,7 +5,7 @@ import {createEdge, fromRaw, toRaw} from "./edges"; import * as GE from "./edges"; import * as GN from "./nodes"; import {COMMIT_TYPE} from "../git/nodes"; -import {Reactions} from "./graphql"; +import {ReactionContent$Values as Reactions} from "./graphqlTypes"; describe("plugins/github/edges", () => { const nodeExamples = { diff --git a/src/plugins/github/graphView.js b/src/plugins/github/graphView.js index d547115..3d99de3 100644 --- a/src/plugins/github/graphView.js +++ b/src/plugins/github/graphView.js @@ -7,8 +7,7 @@ import * as GN from "./nodes"; import * as GE from "./edges"; import * as GitNode from "../git/nodes"; -// TODO(@decentralion): Opportunity to reduce bundle size -import {Reactions} from "./graphql"; +import {ReactionContent$Values as Reactions} from "./graphqlTypes"; import { Graph,