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
@@ -16,6 +16,10 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
16
16
 
17
17
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
18
18
 
19
+ var _require = require('../core/CompilerError'),
20
+ createCompilerError = _require.createCompilerError,
21
+ createUserError = _require.createUserError;
22
+
19
23
  var argumentContainsVariables = require('../util/argumentContainsVariables');
20
24
 
21
25
  var generateAbstractTypeRefinementKey = require('../util/generateAbstractTypeRefinementKey');
@@ -24,13 +28,16 @@ var partitionArray = require('../util/partitionArray');
24
28
 
25
29
  var sortObjectByKey = require('./sortObjectByKey');
26
30
 
27
- var _require = require('../core/CompilerError'),
28
- createCompilerError = _require.createCompilerError,
29
- createUserError = _require.createUserError;
30
-
31
31
  var _require2 = require('relay-runtime'),
32
32
  getStorageKey = _require2.getStorageKey,
33
33
  stableCopy = _require2.stableCopy;
34
+ /**
35
+ * @public
36
+ *
37
+ * Converts an IR node into a plain JS object representation that can be
38
+ * used at runtime.
39
+ */
40
+
34
41
 
35
42
  function generate(schema, node) {
36
43
  switch (node.kind) {
@@ -14,26 +14,27 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
14
14
 
15
15
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
16
 
17
- var CodeMarker = require('../util/CodeMarker');
17
+ var _require = require('../core/CompilerError'),
18
+ createCompilerError = _require.createCompilerError,
19
+ createUserError = _require.createUserError;
18
20
 
19
21
  var argumentContainsVariables = require('../util/argumentContainsVariables');
20
22
 
21
- var generateAbstractTypeRefinementKey = require('../util/generateAbstractTypeRefinementKey');
23
+ var CodeMarker = require('../util/CodeMarker');
22
24
 
23
- var _require = require('../core/CompilerError'),
24
- createCompilerError = _require.createCompilerError,
25
- createUserError = _require.createUserError;
25
+ var generateAbstractTypeRefinementKey = require('../util/generateAbstractTypeRefinementKey');
26
26
 
27
27
  var _require2 = require('relay-runtime'),
28
28
  getStorageKey = _require2.getStorageKey,
29
29
  stableCopy = _require2.stableCopy;
30
-
31
30
  /**
32
31
  * @public
33
32
  *
34
33
  * Converts an IR node into a plain JS object representation that can be
35
34
  * used at runtime.
36
35
  */
36
+
37
+
37
38
  function generate(schema, node) {
38
39
  if (node == null) {
39
40
  return node;
@@ -10,18 +10,25 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
+ var _require = require('../core/CompilerError'),
14
+ createCompilerError = _require.createCompilerError;
15
+
16
+ var md5 = require('../util/md5');
17
+
13
18
  var NormalizationCodeGenerator = require('./NormalizationCodeGenerator');
14
19
 
15
20
  var ReaderCodeGenerator = require('./ReaderCodeGenerator');
16
21
 
17
22
  var sortObjectByKey = require('./sortObjectByKey');
18
23
 
19
- var md5 = require('../util/md5');
20
-
21
24
  var nullthrows = require('nullthrows');
25
+ /**
26
+ * @public
27
+ *
28
+ * Converts an IR node into a plain JS object representation that can be
29
+ * used at runtime.
30
+ */
22
31
 
23
- var _require = require('../core/CompilerError'),
24
- createCompilerError = _require.createCompilerError;
25
32
 
26
33
  function generate(schema, node) {
27
34
  var _node$metadata;
@@ -20,37 +20,37 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
20
20
 
21
21
  var ASTConvert = require('../core/ASTConvert');
22
22
 
23
- var CodegenDirectory = require('./CodegenDirectory');
24
-
25
23
  var CompilerContext = require('../core/CompilerContext');
26
24
 
27
25
  var Profiler = require('../core/GraphQLCompilerProfiler');
28
26
 
29
- var RelayParser = require('../core/RelayParser');
30
-
31
- var compileRelayArtifacts = require('./compileRelayArtifacts');
27
+ var _require = require('../core/GraphQLDerivedFromMetadata'),
28
+ getReaderSourceDefinitionName = _require.getReaderSourceDefinitionName;
32
29
 
33
- var graphql = require('graphql');
30
+ var RelayParser = require('../core/RelayParser');
34
31
 
35
- var invariant = require('invariant');
32
+ var _require2 = require('../core/SchemaUtils'),
33
+ isExecutableDefinitionAST = _require2.isExecutableDefinitionAST;
36
34
 
37
35
  var md5 = require('../util/md5');
38
36
 
39
- var nullthrows = require('nullthrows');
37
+ var CodegenDirectory = require('./CodegenDirectory');
40
38
 
41
- var path = require('path');
39
+ var compileRelayArtifacts = require('./compileRelayArtifacts');
42
40
 
43
41
  var writeRelayGeneratedFile = require('./writeRelayGeneratedFile');
44
42
 
45
- var _require = require('../core/GraphQLDerivedFromMetadata'),
46
- getReaderSourceDefinitionName = _require.getReaderSourceDefinitionName;
47
-
48
- var _require2 = require('../core/SchemaUtils'),
49
- isExecutableDefinitionAST = _require2.isExecutableDefinitionAST;
43
+ var graphql = require('graphql');
50
44
 
51
45
  var _require3 = require('immutable'),
52
46
  ImmutableMap = _require3.Map;
53
47
 
48
+ var invariant = require('invariant');
49
+
50
+ var nullthrows = require('nullthrows');
51
+
52
+ var path = require('path');
53
+
54
54
  function compileAll(_ref) {
55
55
  var baseDir = _ref.baseDir,
56
56
  baseDocuments = _ref.baseDocuments,
@@ -16,13 +16,13 @@ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime
16
16
 
17
17
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
18
18
 
19
- var Printer = require('../core/IRPrinter');
19
+ var filterContextForNode = require('../core/filterContextForNode');
20
20
 
21
21
  var Profiler = require('../core/GraphQLCompilerProfiler');
22
22
 
23
- var RelayCodeGenerator = require('./RelayCodeGenerator');
23
+ var Printer = require('../core/IRPrinter');
24
24
 
25
- var filterContextForNode = require('../core/filterContextForNode');
25
+ var RelayCodeGenerator = require('./RelayCodeGenerator');
26
26
 
27
27
  function createFragmentContext(context, transforms, reporter) {
28
28
  // The fragment is used for reading data from the normalized store.
@@ -20,14 +20,14 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
20
20
 
21
21
  var CodeMarker = require('../util/CodeMarker');
22
22
 
23
- var createPrintRequireModuleDependency = require('./createPrintRequireModuleDependency');
24
-
25
23
  var dedupeJSONStringify = require('../util/dedupeJSONStringify');
26
24
 
27
- var invariant = require('invariant');
28
-
29
25
  var md5 = require('../util/md5');
30
26
 
27
+ var createPrintRequireModuleDependency = require('./createPrintRequireModuleDependency');
28
+
29
+ var invariant = require('invariant');
30
+
31
31
  var _require = require('relay-runtime'),
32
32
  RelayConcreteNode = _require.RelayConcreteNode;
33
33
 
@@ -10,17 +10,17 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var Profiler = require('./GraphQLCompilerProfiler');
14
-
15
- var invariant = require('invariant');
16
-
17
13
  var _require = require('./CompilerError'),
18
- createUserError = _require.createUserError; // $FlowFixMe[untyped-import] - immutable.js is not flow-typed
14
+ createUserError = _require.createUserError;
15
+
16
+ var Profiler = require('./GraphQLCompilerProfiler'); // $FlowFixMe[untyped-import] - immutable.js is not flow-typed
19
17
 
20
18
 
21
19
  var _require2 = require('immutable'),
22
20
  ImmutableOrderedMap = _require2.OrderedMap;
23
21
 
22
+ var invariant = require('invariant');
23
+
24
24
  /**
25
25
  * An immutable representation of a corpus of documents being compiled together.
26
26
  * For each document, the context stores the IR and any validation errors.
@@ -15,7 +15,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
15
15
  var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
16
16
 
17
17
  var _require = require('graphql'),
18
- GraphQLError = _require.GraphQLError;
18
+ GraphQLError = _require.GraphQLError; // Combined results of multiple user errors
19
+
19
20
 
20
21
  /**
21
22
  * Creates an error describing invalid application code (GraphQL/Schema)
@@ -14,11 +14,11 @@ var ASTCache = require('./ASTCache');
14
14
 
15
15
  var fs = require('fs');
16
16
 
17
- var path = require('path');
18
-
19
17
  var _require = require('graphql'),
20
- parse = _require.parse,
21
- Source = _require.Source;
18
+ Source = _require.Source,
19
+ parse = _require.parse;
20
+
21
+ var path = require('path');
22
22
 
23
23
  function parseFile(baseDir, file) {
24
24
  var text = fs.readFileSync(path.join(baseDir, file.relPath), 'utf8');
@@ -10,11 +10,11 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var invariant = require('invariant');
14
-
15
13
  var _require = require('../util/DefaultHandleKey'),
16
14
  DEFAULT_HANDLE_KEY = _require.DEFAULT_HANDLE_KEY;
17
15
 
16
+ var invariant = require('invariant');
17
+
18
18
  var INDENT = ' ';
19
19
  /**
20
20
  * Converts an IR node into a GraphQL string. Custom Relay
@@ -14,11 +14,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
14
14
 
15
15
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
16
 
17
- var invariant = require('invariant');
18
-
19
17
  var _require = require('./CompilerError'),
20
18
  eachWithCombinedError = _require.eachWithCombinedError;
21
19
 
20
+ var invariant = require('invariant');
21
+
22
22
  /**
23
23
  * @public
24
24
  *
@@ -10,11 +10,11 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var invariant = require('invariant');
14
-
15
13
  var _require = require('./CompilerError'),
16
14
  eachWithCombinedError = _require.eachWithCombinedError;
17
15
 
16
+ var invariant = require('invariant');
17
+
18
18
  /**
19
19
  * @public
20
20
  *
@@ -13,6 +13,40 @@
13
13
  var _require = require('./CompilerError'),
14
14
  createUserError = _require.createUserError,
15
15
  eachWithCombinedError = _require.eachWithCombinedError;
16
+ /**
17
+ * A scope is a mapping of the values for each argument defined by the nearest
18
+ * ancestor root or fragment of a given IR selection. A scope maps argument
19
+ * names to the argument's statically determined value, which can be either a
20
+ * variable or a literal.
21
+ *
22
+ * There are two categories of scopes: root scopes and fragment scopes.
23
+ *
24
+ * Root scopes apply to `Root` IR and their subselections, up until any fragment
25
+ * spreads. Root scopes have the property that any argument may be provided at
26
+ * runtime: even where a default value is defined, the compiler must consider
27
+ * the value to be variable. Therefore, root scopes are a mapping of argument
28
+ * name to variables of the same name:
29
+ *
30
+ * Map {
31
+ * foo: $foo
32
+ * }
33
+ *
34
+ * Fragment scopes apply to `Fragment` IR nodes and their subselections, up
35
+ * until any fragment spreads. Fragment scopes differ from root scopes in
36
+ * several ways:
37
+ * - Arguments may be overridden by the including fragment spread.
38
+ * - Arguments may import values from the root scope.
39
+ * - All other arguments must have their default values, or be null.
40
+ *
41
+ * Fragment scopes are also a mapping of argument name to value, but the value
42
+ * may also be a literal:
43
+ *
44
+ * Map {
45
+ * foo: $foo
46
+ * bar: 42
47
+ * }
48
+ */
49
+
16
50
 
17
51
  /**
18
52
  * Creates a scope for a `Root`, with each argument mapped to a variable of the
@@ -10,10 +10,10 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var RelayCompilerCache = require('../util/RelayCompilerCache');
14
-
15
13
  var getModuleName = require('../util/getModuleName');
16
14
 
15
+ var RelayCompilerCache = require('../util/RelayCompilerCache');
16
+
17
17
  var graphql = require('graphql');
18
18
 
19
19
  var path = require('path');
@@ -10,6 +10,8 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
+ var RelayFlowGenerator = require('../language/javascript/RelayFlowGenerator');
14
+
13
15
  var ApplyFragmentArgumentTransform = require('../transforms/ApplyFragmentArgumentTransform');
14
16
 
15
17
  var ClientExtensionsTransform = require('../transforms/ClientExtensionsTransform');
@@ -50,8 +52,6 @@ var RefetchableFragmentTransform = require('../transforms/RefetchableFragmentTra
50
52
 
51
53
  var RelayDirectiveTransform = require('../transforms/RelayDirectiveTransform');
52
54
 
53
- var RelayFlowGenerator = require('../language/javascript/RelayFlowGenerator');
54
-
55
55
  var RequiredFieldTransform = require('../transforms/RequiredFieldTransform');
56
56
 
57
57
  var SkipClientExtensionsTransform = require('../transforms/SkipClientExtensionsTransform');
@@ -74,9 +74,9 @@ var ValidateGlobalVariablesTransform = require('../transforms/ValidateGlobalVari
74
74
 
75
75
  var ValidateRequiredArgumentsTransform = require('../transforms/ValidateRequiredArgumentsTransform');
76
76
 
77
- var ValidateUnusedVariablesTransform = require('../transforms/ValidateUnusedVariablesTransform');
77
+ var ValidateUnusedVariablesTransform = require('../transforms/ValidateUnusedVariablesTransform'); // Transforms applied to the code used to process a query response.
78
+
78
79
 
79
- // Transforms applied to the code used to process a query response.
80
80
  var relaySchemaExtensions = [ConnectionTransform.SCHEMA_EXTENSION, DeclarativeConnectionMutationTransform.SCHEMA_EXTENSION, InlineDataFragmentTransform.SCHEMA_EXTENSION, MatchTransform.SCHEMA_EXTENSION, RequiredFieldTransform.SCHEMA_EXTENSION, RefetchableFragmentTransform.SCHEMA_EXTENSION, RelayDirectiveTransform.SCHEMA_EXTENSION, RelayFlowGenerator.SCHEMA_EXTENSION, TestOperationTransform.SCHEMA_EXTENSION, ValidateUnusedVariablesTransform.SCHEMA_EXTENSION]; // Transforms applied to both operations and fragments for both reading and
81
81
  // writing from the store.
82
82
 
@@ -18,31 +18,31 @@ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime
18
18
 
19
19
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
20
20
 
21
- var Profiler = require('./GraphQLCompilerProfiler');
21
+ var _require = require('../util/DefaultHandleKey'),
22
+ DEFAULT_HANDLE_KEY = _require.DEFAULT_HANDLE_KEY;
22
23
 
23
24
  var orList = require('../util/orList');
24
25
 
25
26
  var partitionArray = require('../util/partitionArray');
26
27
 
27
- var _require = require('../util/DefaultHandleKey'),
28
- DEFAULT_HANDLE_KEY = _require.DEFAULT_HANDLE_KEY;
29
-
30
28
  var _require2 = require('./CompilerError'),
31
29
  createCompilerError = _require2.createCompilerError,
32
30
  createUserError = _require2.createUserError,
33
31
  eachWithCombinedError = _require2.eachWithCombinedError;
34
32
 
35
- var _require3 = require('./SchemaUtils'),
36
- isExecutableDefinitionAST = _require3.isExecutableDefinitionAST;
33
+ var _require3 = require('./getFieldDefinition'),
34
+ getFieldDefinitionLegacy = _require3.getFieldDefinitionLegacy;
35
+
36
+ var Profiler = require('./GraphQLCompilerProfiler');
37
37
 
38
- var _require4 = require('./getFieldDefinition'),
39
- getFieldDefinitionLegacy = _require4.getFieldDefinitionLegacy;
38
+ var _require4 = require('./SchemaUtils'),
39
+ isExecutableDefinitionAST = _require4.isExecutableDefinitionAST;
40
40
 
41
41
  var _require5 = require('graphql'),
42
+ Source = _require5.Source,
42
43
  parseGraphQL = _require5.parse,
43
44
  parseType = _require5.parseType,
44
- print = _require5.print,
45
- Source = _require5.Source;
45
+ print = _require5.print;
46
46
 
47
47
  var ARGUMENT_DEFINITIONS = 'argumentDefinitions';
48
48
  var ARGUMENTS = 'arguments';
@@ -16,19 +16,19 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
16
16
 
17
17
  var ASTCache = require('./ASTCache');
18
18
 
19
- var GraphQL = require('graphql');
20
-
21
19
  var Profiler = require('./GraphQLCompilerProfiler');
22
20
 
21
+ var _require = require('./RelayFindGraphQLTags'),
22
+ memoizedFind = _require.memoizedFind;
23
+
23
24
  var fs = require('fs');
24
25
 
26
+ var GraphQL = require('graphql');
27
+
25
28
  var invariant = require('invariant');
26
29
 
27
30
  var path = require('path');
28
31
 
29
- var _require = require('./RelayFindGraphQLTags'),
30
- memoizedFind = _require.memoizedFind;
31
-
32
32
  var parseGraphQL = Profiler.instrument(GraphQL.parse, 'GraphQL.parse');
33
33
 
34
34
  module.exports = function (tagFinder, getFileFilter) {
@@ -24,11 +24,11 @@ var _require2 = require('./SchemaUtils'),
24
24
  isSchemaDefinitionAST = _require2.isSchemaDefinitionAST;
25
25
 
26
26
  var _require3 = require('graphql'),
27
+ GraphQLBoolean = _require3.GraphQLBoolean,
27
28
  GraphQLFloat = _require3.GraphQLFloat,
29
+ GraphQLID = _require3.GraphQLID,
28
30
  GraphQLInt = _require3.GraphQLInt,
29
- GraphQLBoolean = _require3.GraphQLBoolean,
30
31
  GraphQLString = _require3.GraphQLString,
31
- GraphQLID = _require3.GraphQLID,
32
32
  parse = _require3.parse,
33
33
  parseType = _require3.parseType,
34
34
  print = _require3.print,
@@ -14,11 +14,12 @@ var CompilerContext = require('./CompilerContext');
14
14
 
15
15
  var _require = require('./IRVisitor'),
16
16
  visit = _require.visit;
17
-
18
17
  /**
19
18
  * Returns a CompilerContext containing only the documents referenced
20
19
  * by and including the provided node.
21
20
  */
21
+
22
+
22
23
  function filterContextForNode(node, context) {
23
24
  var queue = [node];
24
25
  var filteredContext = new CompilerContext(context.getSchema()).add(node);
@@ -11,11 +11,12 @@
11
11
  'use strict';
12
12
 
13
13
  var invariant = require('invariant');
14
-
15
14
  /**
16
15
  * Generates an identifier for an argument value. The identifier is based on the
17
16
  * structure/order of items and keys in the value.
18
17
  */
18
+
19
+
19
20
  function getIdentifierForArgumentValue(value) {
20
21
  switch (value.kind) {
21
22
  case 'Variable':
@@ -10,17 +10,18 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- var invariant = require('invariant');
14
-
15
13
  var _require = require('./IRPrinter'),
16
14
  printArguments = _require.printArguments,
17
15
  printDirectives = _require.printDirectives;
18
16
 
17
+ var invariant = require('invariant');
19
18
  /**
20
19
  * Generates an identifier that is unique to a given selection: the alias for
21
20
  * fields, the type for inline fragments, and a summary of the condition
22
21
  * variable and passing value for conditions.
23
22
  */
23
+
24
+
24
25
  function getIdentifierForSelection(schema, node) {
25
26
  if (node.kind === 'LinkedField' || node.kind === 'ScalarField') {
26
27
  return 'Field: ' + node.directives.length === 0 ? node.alias : node.alias + printDirectives(schema, node.directives);
@@ -18,13 +18,13 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
18
18
 
19
19
  var CompilerContext = require('./CompilerContext');
20
20
 
21
+ var _require = require('./CompilerError'),
22
+ createCompilerError = _require.createCompilerError;
23
+
21
24
  var IRVisitor = require('./IRVisitor');
22
25
 
23
26
  var SchemaUtils = require('./SchemaUtils');
24
27
 
25
- var _require = require('./CompilerError'),
26
- createCompilerError = _require.createCompilerError;
27
-
28
28
  /**
29
29
  * Returns a transformed version of the input context where each document's
30
30
  * argument definitions are updated to accurately describe the root variables