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
This commit is contained in:
William Chargin 2018-10-31 12:24:06 -07:00 committed by GitHub
parent 2377f1980f
commit b77db72c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -6,8 +6,7 @@ import * as N from "./nodes";
import * as R from "./relationalView"; import * as R from "./relationalView";
import {createEdge} from "./edges"; import {createEdge} from "./edges";
import {findMentionsAuthorReferences} from "./heuristics/mentionsAuthorReference"; import {findMentionsAuthorReferences} from "./heuristics/mentionsAuthorReference";
// TODO(@decentralion): Opportunity to reduce bundle size import {ReactionContent$Values as Reactions} from "./graphqlTypes";
import {Reactions} from "./graphql";
export function createGraph(view: R.RelationalView): Graph { export function createGraph(view: R.RelationalView): Graph {
const creator = new GraphCreator(); const creator = new GraphCreator();

View File

@ -9,8 +9,10 @@ import {
import * as GithubNode from "./nodes"; import * as GithubNode from "./nodes";
import * as GitNode from "../git/nodes"; import * as GitNode from "../git/nodes";
import type {MentionsAuthorReference} from "./heuristics/mentionsAuthorReference"; import type {MentionsAuthorReference} from "./heuristics/mentionsAuthorReference";
// TODO(@decentralion): Opportunity to reduce bundle size (tree shaking?) import {
import {Reactions, type ReactionContent} from "./graphql"; type ReactionContent,
ReactionContent$Values as Reactions,
} from "./graphqlTypes";
export opaque type RawAddress: EdgeAddressT = EdgeAddressT; export opaque type RawAddress: EdgeAddressT = EdgeAddressT;

View File

@ -5,7 +5,7 @@ import {createEdge, fromRaw, toRaw} from "./edges";
import * as GE from "./edges"; import * as GE from "./edges";
import * as GN from "./nodes"; import * as GN from "./nodes";
import {COMMIT_TYPE} from "../git/nodes"; import {COMMIT_TYPE} from "../git/nodes";
import {Reactions} from "./graphql"; import {ReactionContent$Values as Reactions} from "./graphqlTypes";
describe("plugins/github/edges", () => { describe("plugins/github/edges", () => {
const nodeExamples = { const nodeExamples = {

View File

@ -7,8 +7,7 @@ import * as GN from "./nodes";
import * as GE from "./edges"; import * as GE from "./edges";
import * as GitNode from "../git/nodes"; import * as GitNode from "../git/nodes";
// TODO(@decentralion): Opportunity to reduce bundle size import {ReactionContent$Values as Reactions} from "./graphqlTypes";
import {Reactions} from "./graphql";
import { import {
Graph, Graph,