relay-compiler 0.0.0-main-e0f88a3b → 0.0.0-main-2087b512

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. package/bin/RelayCompilerBin.js.flow +2 -3
  2. package/bin/RelayCompilerMain.js.flow +12 -14
  3. package/bin/relay-compiler +5613 -5548
  4. package/codegen/CodegenDirectory.js.flow +4 -5
  5. package/codegen/CodegenRunner.js.flow +11 -13
  6. package/codegen/CodegenWatcher.js.flow +3 -4
  7. package/codegen/NormalizationCodeGenerator.js.flow +13 -14
  8. package/codegen/ReaderCodeGenerator.js.flow +14 -16
  9. package/codegen/RelayCodeGenerator.js.flow +7 -7
  10. package/codegen/RelayFileWriter.js.flow +20 -22
  11. package/codegen/compileRelayArtifacts.js.flow +5 -6
  12. package/codegen/writeRelayGeneratedFile.js.flow +7 -9
  13. package/core/ASTCache.js.flow +3 -4
  14. package/core/ASTConvert.js.flow +7 -8
  15. package/core/CompilerContext.js.flow +5 -7
  16. package/core/CompilerError.js.flow +2 -2
  17. package/core/DotGraphQLParser.js.flow +4 -6
  18. package/core/IR.js.flow +2 -2
  19. package/core/IRPrinter.js.flow +3 -4
  20. package/core/IRTransformer.js.flow +4 -5
  21. package/core/IRValidator.js.flow +3 -4
  22. package/core/IRVisitor.js.flow +2 -2
  23. package/core/JSModuleParser.js.flow +2 -2
  24. package/core/RelayCompilerScope.js.flow +2 -2
  25. package/core/RelayFindGraphQLTags.js.flow +6 -7
  26. package/core/RelayGraphQLEnumsGenerator.js.flow +2 -2
  27. package/core/RelayIRTransforms.js.flow +3 -3
  28. package/core/RelayParser.js.flow +16 -18
  29. package/core/RelaySourceModuleParser.js.flow +7 -9
  30. package/core/Schema.js.flow +24 -24
  31. package/core/SchemaUtils.js.flow +3 -3
  32. package/core/filterContextForNode.js.flow +2 -3
  33. package/core/getFieldDefinition.js.flow +3 -3
  34. package/core/getIdentifierForArgumentValue.js.flow +2 -2
  35. package/core/getIdentifierForSelection.js.flow +3 -4
  36. package/core/inferRootArgumentDefinitions.js.flow +5 -6
  37. package/index.js +1 -1
  38. package/index.js.flow +33 -35
  39. package/language/RelayLanguagePluginInterface.js.flow +3 -3
  40. package/language/javascript/FindGraphQLTags.js.flow +2 -3
  41. package/language/javascript/RelayFlowBabelFactories.js.flow +1 -1
  42. package/language/javascript/RelayFlowGenerator.js.flow +16 -19
  43. package/language/javascript/RelayFlowTypeTransformers.js.flow +3 -5
  44. package/language/javascript/RelayLanguagePluginJavaScript.js.flow +2 -3
  45. package/lib/bin/RelayCompilerBin.js +2 -2
  46. package/lib/bin/RelayCompilerMain.js +10 -10
  47. package/lib/codegen/CodegenDirectory.js +2 -3
  48. package/lib/codegen/CodegenRunner.js +9 -9
  49. package/lib/codegen/CodegenWatcher.js +2 -2
  50. package/lib/codegen/NormalizationCodeGenerator.js +11 -4
  51. package/lib/codegen/ReaderCodeGenerator.js +7 -6
  52. package/lib/codegen/RelayCodeGenerator.js +11 -4
  53. package/lib/codegen/RelayFileWriter.js +14 -14
  54. package/lib/codegen/compileRelayArtifacts.js +3 -3
  55. package/lib/codegen/writeRelayGeneratedFile.js +4 -4
  56. package/lib/core/CompilerContext.js +5 -5
  57. package/lib/core/CompilerError.js +2 -1
  58. package/lib/core/DotGraphQLParser.js +4 -4
  59. package/lib/core/IRPrinter.js +2 -2
  60. package/lib/core/IRTransformer.js +2 -2
  61. package/lib/core/IRValidator.js +2 -2
  62. package/lib/core/RelayCompilerScope.js +34 -0
  63. package/lib/core/RelayFindGraphQLTags.js +2 -2
  64. package/lib/core/RelayIRTransforms.js +4 -4
  65. package/lib/core/RelayParser.js +10 -10
  66. package/lib/core/RelaySourceModuleParser.js +5 -5
  67. package/lib/core/Schema.js +2 -2
  68. package/lib/core/filterContextForNode.js +2 -1
  69. package/lib/core/getIdentifierForArgumentValue.js +2 -1
  70. package/lib/core/getIdentifierForSelection.js +3 -2
  71. package/lib/core/inferRootArgumentDefinitions.js +3 -3
  72. package/lib/index.js +46 -46
  73. package/lib/language/RelayLanguagePluginInterface.js +13 -1
  74. package/lib/language/javascript/FindGraphQLTags.js +2 -2
  75. package/lib/language/javascript/RelayFlowBabelFactories.js +2 -2
  76. package/lib/language/javascript/RelayFlowGenerator.js +3 -3
  77. package/lib/language/javascript/RelayFlowTypeTransformers.js +2 -2
  78. package/lib/language/javascript/RelayLanguagePluginJavaScript.js +2 -2
  79. package/lib/runner/Artifacts.js +3 -3
  80. package/lib/runner/BufferedFilesystem.js +2 -1
  81. package/lib/runner/GraphQLASTNodeGroup.js +2 -2
  82. package/lib/runner/GraphQLNodeMap.js +2 -2
  83. package/lib/runner/Sources.js +2 -2
  84. package/lib/runner/compileArtifacts.js +2 -2
  85. package/lib/runner/extractAST.js +2 -2
  86. package/lib/transforms/ApplyFragmentArgumentTransform.js +6 -6
  87. package/lib/transforms/ClientExtensionsTransform.js +2 -2
  88. package/lib/transforms/ConnectionTransform.js +6 -6
  89. package/lib/transforms/DeclarativeConnectionMutationTransform.js +2 -2
  90. package/lib/transforms/DeferStreamTransform.js +4 -4
  91. package/lib/transforms/DisallowIdAsAlias.js +2 -2
  92. package/lib/transforms/DisallowTypenameOnRoot.js +2 -2
  93. package/lib/transforms/FilterDirectivesTransform.js +2 -1
  94. package/lib/transforms/FlattenTransform.js +6 -6
  95. package/lib/transforms/InlineDataFragmentTransform.js +2 -2
  96. package/lib/transforms/MaskTransform.js +4 -4
  97. package/lib/transforms/MatchTransform.js +4 -4
  98. package/lib/transforms/ReactFlightComponentTransform.js +4 -4
  99. package/lib/transforms/RefetchableFragmentTransform.js +4 -4
  100. package/lib/transforms/RelayDirectiveTransform.js +2 -2
  101. package/lib/transforms/RequiredFieldTransform.js +4 -4
  102. package/lib/transforms/SkipHandleFieldTransform.js +2 -1
  103. package/lib/transforms/SkipRedundantNodesTransform.js +11 -3
  104. package/lib/transforms/SkipUnusedVariablesTransform.js +2 -1
  105. package/lib/transforms/SplitModuleImportTransform.js +2 -2
  106. package/lib/transforms/TestOperationTransform.js +3 -3
  107. package/lib/transforms/ValidateGlobalVariablesTransform.js +3 -2
  108. package/lib/transforms/ValidateRequiredArgumentsTransform.js +2 -2
  109. package/lib/transforms/ValidateServerOnlyDirectivesTransform.js +2 -2
  110. package/lib/transforms/ValidateUnusedVariablesTransform.js +2 -2
  111. package/lib/transforms/query-generators/FetchableQueryGenerator.js +2 -2
  112. package/lib/transforms/query-generators/NodeQueryGenerator.js +4 -4
  113. package/lib/transforms/query-generators/index.js +3 -3
  114. package/lib/util/joinArgumentDefinitions.js +2 -1
  115. package/package.json +2 -2
  116. package/relay-compiler.js +4 -4
  117. package/relay-compiler.min.js +4 -4
  118. package/reporters/ConsoleReporter.js.flow +2 -2
  119. package/runner/Artifacts.js.flow +4 -5
  120. package/runner/BufferedFilesystem.js.flow +3 -3
  121. package/runner/GraphQLASTNodeGroup.js.flow +2 -3
  122. package/runner/GraphQLNodeMap.js.flow +3 -3
  123. package/runner/Sources.js.flow +5 -6
  124. package/runner/compileArtifacts.js.flow +5 -6
  125. package/runner/extractAST.js.flow +4 -6
  126. package/runner/getChangedNodeNames.js.flow +2 -2
  127. package/runner/getSchemaInstance.js.flow +3 -3
  128. package/transforms/ApplyFragmentArgumentTransform.js.flow +9 -11
  129. package/transforms/ClientExtensionsTransform.js.flow +3 -4
  130. package/transforms/ConnectionTransform.js.flow +11 -13
  131. package/transforms/DeclarativeConnectionMutationTransform.js.flow +3 -5
  132. package/transforms/DeferStreamTransform.js.flow +5 -7
  133. package/transforms/DisallowIdAsAlias.js.flow +3 -4
  134. package/transforms/DisallowTypenameOnRoot.js.flow +3 -4
  135. package/transforms/FieldHandleTransform.js.flow +3 -5
  136. package/transforms/FilterCompilerDirectivesTransform.js.flow +2 -2
  137. package/transforms/FilterDirectivesTransform.js.flow +2 -2
  138. package/transforms/FlattenTransform.js.flow +5 -7
  139. package/transforms/GenerateIDFieldTransform.js.flow +4 -5
  140. package/transforms/GenerateTypeNameTransform.js.flow +4 -6
  141. package/transforms/InlineDataFragmentTransform.js.flow +3 -4
  142. package/transforms/InlineFragmentsTransform.js.flow +3 -4
  143. package/transforms/MaskTransform.js.flow +6 -8
  144. package/transforms/MatchTransform.js.flow +7 -9
  145. package/transforms/ReactFlightComponentTransform.js.flow +5 -6
  146. package/transforms/RefetchableFragmentTransform.js.flow +7 -9
  147. package/transforms/RelayDirectiveTransform.js.flow +3 -4
  148. package/transforms/RequiredFieldTransform.js.flow +10 -12
  149. package/transforms/SkipClientExtensionsTransform.js.flow +2 -2
  150. package/transforms/SkipHandleFieldTransform.js.flow +2 -2
  151. package/transforms/SkipRedundantNodesTransform.js.flow +6 -8
  152. package/transforms/SkipSplitOperationTransform.js.flow +2 -2
  153. package/transforms/SkipUnreachableNodeTransform.js.flow +3 -4
  154. package/transforms/SkipUnusedVariablesTransform.js.flow +2 -2
  155. package/transforms/SplitModuleImportTransform.js.flow +4 -5
  156. package/transforms/TestOperationTransform.js.flow +2 -2
  157. package/transforms/ValidateGlobalVariablesTransform.js.flow +3 -4
  158. package/transforms/ValidateRequiredArgumentsTransform.js.flow +5 -6
  159. package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +3 -4
  160. package/transforms/ValidateUnusedVariablesTransform.js.flow +3 -4
  161. package/transforms/query-generators/FetchableQueryGenerator.js.flow +4 -5
  162. package/transforms/query-generators/NodeQueryGenerator.js.flow +5 -7
  163. package/transforms/query-generators/QueryQueryGenerator.js.flow +4 -4
  164. package/transforms/query-generators/ViewerQueryGenerator.js.flow +4 -4
  165. package/transforms/query-generators/index.js.flow +4 -5
  166. package/util/RelayCompilerCache.js.flow +0 -1
  167. package/util/TimeReporter.js.flow +2 -2
  168. package/util/argumentContainsVariables.js.flow +1 -1
  169. package/util/generateAbstractTypeRefinementKey.js.flow +2 -2
  170. package/util/getDefinitionNodeHash.js.flow +2 -3
  171. package/util/joinArgumentDefinitions.js.flow +2 -2
@@ -12,14 +12,13 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
15
+ import type CompilerContext from '../core/CompilerContext';
16
+ import type {Fragment, FragmentSpread} from '../core/IR';
16
17
 
17
18
  const getLiteralArgumentValues = require('../core/getLiteralArgumentValues');
19
+ const IRTransformer = require('../core/IRTransformer');
18
20
  const invariant = require('invariant');
19
21
 
20
- import type CompilerContext from '../core/CompilerContext';
21
- import type {Fragment, FragmentSpread} from '../core/IR';
22
-
23
22
  const RELAY = 'relay';
24
23
  const SCHEMA_EXTENSION = `
25
24
  directive @relay(
@@ -12,27 +12,25 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
16
-
17
- const partitionArray = require('../util/partitionArray');
18
-
19
- const {createUserError, createCompilerError} = require('../core/CompilerError');
20
- const {RelayFeatureFlags} = require('relay-runtime');
21
-
22
15
  import type CompilerContext from '../core/CompilerContext';
23
16
  import type {
24
- LinkedField,
25
- ScalarField,
26
17
  Field,
27
- Location,
28
- InlineFragment,
29
18
  Fragment,
30
- Root,
19
+ InlineFragment,
20
+ LinkedField,
21
+ Location,
31
22
  Metadata,
23
+ Root,
24
+ ScalarField,
32
25
  } from '../core/IR';
33
26
  import type {Schema} from '../core/Schema';
34
27
  import type {RequiredFieldAction} from 'relay-runtime';
35
28
 
29
+ const {createCompilerError, createUserError} = require('../core/CompilerError');
30
+ const IRTransformer = require('../core/IRTransformer');
31
+ const partitionArray = require('../util/partitionArray');
32
+ const {RelayFeatureFlags} = require('relay-runtime');
33
+
36
34
  type Path = string;
37
35
  type Alias = string;
38
36
 
@@ -12,11 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
16
-
17
15
  import type CompilerContext from '../core/CompilerContext';
18
16
  import type {ClientExtension, Fragment, FragmentSpread} from '../core/IR';
19
17
 
18
+ const IRTransformer = require('../core/IRTransformer');
19
+
20
20
  function skipClientExtensionTransform(
21
21
  context: CompilerContext,
22
22
  ): CompilerContext {
@@ -12,11 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
16
-
17
15
  import type CompilerContext from '../core/CompilerContext';
18
16
  import type {Field} from '../core/IR';
19
17
 
18
+ const IRTransformer = require('../core/IRTransformer');
19
+
20
20
  /**
21
21
  * A transform that removes field `handles`. Intended for use when e.g.
22
22
  * printing queries to send to a GraphQL server.
@@ -12,17 +12,15 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
16
-
17
15
  import type CompilerContext from '../core/CompilerContext';
18
- const IMap = require('immutable').Map;
19
- const partitionArray = require('../util/partitionArray');
20
- const getIdentifierForSelection = require('../core/getIdentifierForSelection');
21
- const invariant = require('invariant');
22
-
16
+ import type {Fragment, Node, Root, Selection, SplitOperation} from '../core/IR';
23
17
  import type {Schema} from '../core/Schema';
24
18
 
25
- import type {Fragment, Node, Root, SplitOperation, Selection} from '../core/IR';
19
+ const getIdentifierForSelection = require('../core/getIdentifierForSelection');
20
+ const IRTransformer = require('../core/IRTransformer');
21
+ const partitionArray = require('../util/partitionArray');
22
+ const IMap = require('immutable').Map;
23
+ const invariant = require('invariant');
26
24
 
27
25
  /**
28
26
  * A simplified representation of a document: keys in the map are unique
@@ -12,10 +12,10 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
16
-
17
15
  import type CompilerContext from '../core/CompilerContext';
18
16
 
17
+ const IRTransformer = require('../core/IRTransformer');
18
+
19
19
  function skipNode() {
20
20
  return null;
21
21
  }
@@ -12,13 +12,12 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
16
-
17
- const invariant = require('invariant');
18
-
19
15
  import type CompilerContext from '../core/CompilerContext';
20
16
  import type {Condition, Fragment, Node, Selection} from '../core/IR';
21
17
 
18
+ const IRTransformer = require('../core/IRTransformer');
19
+ const invariant = require('invariant');
20
+
22
21
  type ConditionResult = 'fail' | 'pass' | 'variable';
23
22
 
24
23
  const FAIL = 'fail';
@@ -12,11 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const inferRootArgumentDefinitions = require('../core/inferRootArgumentDefinitions');
16
-
17
15
  import type CompilerContext from '../core/CompilerContext';
18
16
  import type {Root} from '../core/IR';
19
17
 
18
+ const inferRootArgumentDefinitions = require('../core/inferRootArgumentDefinitions');
19
+
20
20
  /**
21
21
  * Refines the argument definitions for operations to remove unused arguments
22
22
  * due to statically pruned conditional branches (e.g. because of overriding
@@ -12,19 +12,18 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRTransformer = require('../core/IRTransformer');
16
-
17
- const getNormalizationOperationName = require('../core/getNormalizationOperationName');
18
-
19
15
  import type CompilerContext from '../core/CompilerContext';
20
16
  import type {
21
- LinkedField,
22
17
  InlineFragment,
18
+ LinkedField,
23
19
  ModuleImport,
24
20
  SplitOperation,
25
21
  } from '../core/IR';
26
22
  import type {CompositeTypeID} from '../core/Schema';
27
23
 
24
+ const getNormalizationOperationName = require('../core/getNormalizationOperationName');
25
+ const IRTransformer = require('../core/IRTransformer');
26
+
28
27
  type State = {|
29
28
  parentType: CompositeTypeID,
30
29
  splitOperations: Map<string, SplitOperation>,
@@ -13,12 +13,12 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const IRTransformer = require('../core/IRTransformer');
17
-
18
16
  import type CompilerContext from '../core/CompilerContext';
19
17
  import type {Root} from '../core/IR';
20
18
  import type {Schema, TypeID} from '../core/Schema';
21
19
 
20
+ const IRTransformer = require('../core/IRTransformer');
21
+
22
22
  // The purpose of this directive is to add GraphQL type inform for fields in
23
23
  // the operation selection in order to use in in RelayMockPayloadGenerator
24
24
  // to generate better mock values, and expand the API of MockResolvers
@@ -12,15 +12,14 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const inferRootArgumentDefinitions = require('../core/inferRootArgumentDefinitions');
15
+ import type CompilerContext from '../core/CompilerContext';
16
+ import type {ArgumentDefinition} from '../core/IR';
16
17
 
17
18
  const {
18
19
  createUserError,
19
20
  eachWithCombinedError,
20
21
  } = require('../core/CompilerError');
21
-
22
- import type CompilerContext from '../core/CompilerContext';
23
- import type {ArgumentDefinition} from '../core/IR';
22
+ const inferRootArgumentDefinitions = require('../core/inferRootArgumentDefinitions');
24
23
 
25
24
  /**
26
25
  * Validates that all global variables used in operations are defined at the
@@ -12,11 +12,6 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRValidator = require('../core/IRValidator');
16
-
17
- const {createUserError} = require('../core/CompilerError');
18
- const {getFieldDefinitionStrict} = require('../core/getFieldDefinition');
19
-
20
15
  import type CompilerContext from '../core/CompilerContext';
21
16
  import type {
22
17
  Directive,
@@ -25,7 +20,11 @@ import type {
25
20
  Root,
26
21
  SplitOperation,
27
22
  } from '../core/IR';
28
- import type {Schema, TypeID, Argument} from '../core/Schema';
23
+ import type {Argument, Schema, TypeID} from '../core/Schema';
24
+
25
+ const {createUserError} = require('../core/CompilerError');
26
+ const {getFieldDefinitionStrict} = require('../core/getFieldDefinition');
27
+ const IRValidator = require('../core/IRValidator');
29
28
 
30
29
  type State = {|
31
30
  +rootNode: Fragment | Root | SplitOperation,
@@ -12,10 +12,6 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const IRValidator = require('../core/IRValidator');
16
-
17
- const {createUserError} = require('../core/CompilerError');
18
-
19
15
  import type CompilerContext from '../core/CompilerContext';
20
16
  import type {
21
17
  ClientExtension,
@@ -25,6 +21,9 @@ import type {
25
21
  Stream,
26
22
  } from '../core/IR';
27
23
 
24
+ const {createUserError} = require('../core/CompilerError');
25
+ const IRValidator = require('../core/IRValidator');
26
+
28
27
  type State = {rootClientSelection: ?Selection, ...};
29
28
 
30
29
  const NODEKIND_DIRECTIVE_MAP = {
@@ -12,15 +12,14 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const inferRootArgumentDefinitions = require('../core/inferRootArgumentDefinitions');
15
+ import type CompilerContext from '../core/CompilerContext';
16
+ import type {ArgumentDefinition} from '../core/IR';
16
17
 
17
18
  const {
18
19
  createUserError,
19
20
  eachWithCombinedError,
20
21
  } = require('../core/CompilerError');
21
-
22
- import type CompilerContext from '../core/CompilerContext';
23
- import type {ArgumentDefinition} from '../core/IR';
22
+ const inferRootArgumentDefinitions = require('../core/inferRootArgumentDefinitions');
24
23
 
25
24
  const SCHEMA_EXTENSION =
26
25
  'directive @DEPRECATED__relay_ignore_unused_variables_error on QUERY | MUTATION | SUBSCRIPTION';
@@ -12,18 +12,17 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const SchemaUtils = require('../../core/SchemaUtils');
15
+ import type {QueryGenerator, RefetchRoot} from '.';
16
+ import type {Fragment} from '../../core/IR';
17
+ import type {Schema} from '../../core/Schema';
16
18
 
17
19
  const {createUserError} = require('../../core/CompilerError');
20
+ const SchemaUtils = require('../../core/SchemaUtils');
18
21
  const {
19
22
  buildFragmentSpread,
20
23
  buildOperationArgumentDefinitions,
21
24
  } = require('./utils');
22
25
 
23
- import type {Fragment} from '../../core/IR';
24
- import type {Schema} from '../../core/Schema';
25
- import type {QueryGenerator, RefetchRoot} from '.';
26
-
27
26
  function buildRefetchOperation(
28
27
  schema: Schema,
29
28
  fragment: Fragment,
@@ -12,19 +12,17 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const SchemaUtils = require('../../core/SchemaUtils');
16
-
17
- const nullthrows = require('nullthrows');
15
+ import type {QueryGenerator, RefetchRoot} from '.';
16
+ import type {Fragment} from '../../core/IR';
17
+ import type {Schema} from '../../core/Schema';
18
18
 
19
19
  const {createUserError} = require('../../core/CompilerError');
20
+ const SchemaUtils = require('../../core/SchemaUtils');
20
21
  const {
21
22
  buildFragmentSpread,
22
23
  buildOperationArgumentDefinitions,
23
24
  } = require('./utils');
24
-
25
- import type {Fragment} from '../../core/IR';
26
- import type {Schema} from '../../core/Schema';
27
- import type {QueryGenerator, RefetchRoot} from '.';
25
+ const nullthrows = require('nullthrows');
28
26
 
29
27
  const NODE_TYPE_NAME = 'Node';
30
28
  const NODE_FIELD_NAME = 'node';
@@ -12,15 +12,15 @@
12
12
 
13
13
  'use strict';
14
14
 
15
+ import type {QueryGenerator, RefetchRoot} from '.';
16
+ import type {Fragment} from '../../core/IR';
17
+ import type {Schema} from '../../core/Schema';
18
+
15
19
  const {
16
20
  buildFragmentSpread,
17
21
  buildOperationArgumentDefinitions,
18
22
  } = require('./utils');
19
23
 
20
- import type {Fragment} from '../../core/IR';
21
- import type {Schema} from '../../core/Schema';
22
- import type {QueryGenerator, RefetchRoot} from '.';
23
-
24
24
  function buildRefetchOperation(
25
25
  schema: Schema,
26
26
  fragment: Fragment,
@@ -12,16 +12,16 @@
12
12
 
13
13
  'use strict';
14
14
 
15
+ import type {QueryGenerator, RefetchRoot} from '.';
16
+ import type {Fragment} from '../../core/IR';
17
+ import type {Schema} from '../../core/Schema';
18
+
15
19
  const {createUserError} = require('../../core/CompilerError');
16
20
  const {
17
21
  buildFragmentSpread,
18
22
  buildOperationArgumentDefinitions,
19
23
  } = require('./utils');
20
24
 
21
- import type {Fragment} from '../../core/IR';
22
- import type {Schema} from '../../core/Schema';
23
- import type {QueryGenerator, RefetchRoot} from '.';
24
-
25
25
  const VIEWER_TYPE_NAME = 'Viewer';
26
26
  const VIEWER_FIELD_NAME = 'viewer';
27
27
 
@@ -12,16 +12,15 @@
12
12
 
13
13
  'use strict';
14
14
 
15
+ import type {Fragment, Root} from '../../core/IR';
16
+ import type {Schema} from '../../core/Schema';
17
+
18
+ const {createUserError} = require('../../core/CompilerError');
15
19
  const FetchableQueryGenerator = require('./FetchableQueryGenerator');
16
20
  const NodeQueryGenerator = require('./NodeQueryGenerator');
17
21
  const QueryQueryGenerator = require('./QueryQueryGenerator');
18
22
  const ViewerQueryGenerator = require('./ViewerQueryGenerator');
19
23
 
20
- const {createUserError} = require('../../core/CompilerError');
21
-
22
- import type {Fragment, Root} from '../../core/IR';
23
- import type {Schema} from '../../core/Schema';
24
-
25
24
  export type RefetchRoot = {|
26
25
  identifierField: ?string,
27
26
  path: $ReadOnlyArray<string>,
@@ -13,7 +13,6 @@
13
13
  'use strict';
14
14
 
15
15
  const Profiler = require('../core/GraphQLCompilerProfiler');
16
-
17
16
  const crypto = require('crypto');
18
17
  const fs = require('fs');
19
18
  const os = require('os');
@@ -13,10 +13,10 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const {isPromise} = require('relay-runtime');
17
-
18
16
  import type {Reporter} from '../reporters/Reporter';
19
17
 
18
+ const {isPromise} = require('relay-runtime');
19
+
20
20
  function reportTime<T>(reporter: Reporter, message: string, fn: () => T): T {
21
21
  return reportAndReturnTime(reporter, message, fn)[0];
22
22
  }
@@ -12,7 +12,7 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- import type {ReaderArgument, NormalizationArgument} from 'relay-runtime';
15
+ import type {NormalizationArgument, ReaderArgument} from 'relay-runtime';
16
16
 
17
17
  function argumentContainsVariables(
18
18
  arg: ?(ReaderArgument | NormalizationArgument),
@@ -12,10 +12,10 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const {createCompilerError} = require('../core/CompilerError');
16
-
17
15
  import type {Schema, TypeID} from '../core/Schema';
18
16
 
17
+ const {createCompilerError} = require('../core/CompilerError');
18
+
19
19
  function generateAbstractTypeRefinementKey(
20
20
  schema: Schema,
21
21
  type: TypeID,
@@ -12,12 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const md5 = require('./md5');
15
+ import type {ExecutableDefinitionNode} from 'graphql';
16
16
 
17
+ const md5 = require('./md5');
17
18
  const {print} = require('graphql');
18
19
 
19
- import type {ExecutableDefinitionNode} from 'graphql';
20
-
21
20
  function getDefinitionNodeHash(node: ExecutableDefinitionNode): string {
22
21
  return md5(print(node));
23
22
  }
@@ -12,11 +12,11 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const {createUserError} = require('../core/CompilerError');
16
-
17
15
  import type {ArgumentDefinition, Fragment} from '../core/IR';
18
16
  import type {Schema} from '../core/Schema';
19
17
 
18
+ const {createUserError} = require('../core/CompilerError');
19
+
20
20
  /**
21
21
  * Attempts to join the argument definitions for a root fragment
22
22
  * and any unmasked fragment spreads reachable from that root fragment,