relay-compiler 11.0.2 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/bin/relay-compiler +92 -34
  2. package/codegen/NormalizationCodeGenerator.js.flow +1 -6
  3. package/codegen/createPrintRequireModuleDependency.js.flow +2 -4
  4. package/codegen/writeRelayGeneratedFile.js.flow +1 -1
  5. package/index.js +1 -1
  6. package/language/javascript/RelayFlowTypeTransformers.js.flow +3 -3
  7. package/lib/codegen/NormalizationCodeGenerator.js +2 -3
  8. package/lib/codegen/createPrintRequireModuleDependency.js +2 -2
  9. package/lib/codegen/writeRelayGeneratedFile.js +1 -1
  10. package/lib/transforms/ClientExtensionsTransform.js +1 -0
  11. package/lib/transforms/ConnectionTransform.js +6 -2
  12. package/lib/transforms/DeclarativeConnectionMutationTransform.js +5 -2
  13. package/lib/transforms/DeferStreamTransform.js +2 -1
  14. package/lib/transforms/DisallowIdAsAlias.js +2 -1
  15. package/lib/transforms/FieldHandleTransform.js +3 -1
  16. package/lib/transforms/FlattenTransform.js +3 -1
  17. package/lib/transforms/GenerateIDFieldTransform.js +3 -1
  18. package/lib/transforms/GenerateTypeNameTransform.js +9 -3
  19. package/lib/transforms/InlineDataFragmentTransform.js +6 -2
  20. package/lib/transforms/InlineFragmentsTransform.js +4 -2
  21. package/lib/transforms/MaskTransform.js +7 -3
  22. package/lib/transforms/MatchTransform.js +5 -1
  23. package/lib/transforms/ReactFlightComponentTransform.js +3 -0
  24. package/lib/transforms/RelayDirectiveTransform.js +3 -1
  25. package/lib/transforms/RequiredFieldTransform.js +6 -2
  26. package/lib/transforms/SkipClientExtensionsTransform.js +3 -0
  27. package/lib/transforms/SkipHandleFieldTransform.js +1 -0
  28. package/lib/transforms/SkipRedundantNodesTransform.js +2 -1
  29. package/lib/transforms/SplitModuleImportTransform.js +4 -1
  30. package/lib/transforms/TestOperationTransform.js +1 -0
  31. package/lib/transforms/ValidateRequiredArgumentsTransform.js +5 -1
  32. package/lib/transforms/ValidateServerOnlyDirectivesTransform.js +4 -1
  33. package/lib/util/areEqualArgValues.js +2 -1
  34. package/package.json +7 -7
  35. package/relay-compiler.js +3 -3
  36. package/relay-compiler.min.js +3 -3
  37. package/transforms/ClientExtensionsTransform.js.flow +1 -0
  38. package/transforms/ConnectionTransform.js.flow +4 -0
  39. package/transforms/DeclarativeConnectionMutationTransform.js.flow +3 -0
  40. package/transforms/DeferStreamTransform.js.flow +1 -0
  41. package/transforms/DisallowIdAsAlias.js.flow +1 -0
  42. package/transforms/FieldHandleTransform.js.flow +2 -0
  43. package/transforms/FlattenTransform.js.flow +2 -0
  44. package/transforms/GenerateIDFieldTransform.js.flow +2 -0
  45. package/transforms/GenerateTypeNameTransform.js.flow +6 -0
  46. package/transforms/InlineDataFragmentTransform.js.flow +4 -0
  47. package/transforms/InlineFragmentsTransform.js.flow +2 -0
  48. package/transforms/MaskTransform.js.flow +4 -0
  49. package/transforms/MatchTransform.js.flow +4 -0
  50. package/transforms/ReactFlightComponentTransform.js.flow +3 -0
  51. package/transforms/RelayDirectiveTransform.js.flow +2 -0
  52. package/transforms/RequiredFieldTransform.js.flow +4 -0
  53. package/transforms/SkipClientExtensionsTransform.js.flow +3 -0
  54. package/transforms/SkipHandleFieldTransform.js.flow +1 -0
  55. package/transforms/SkipRedundantNodesTransform.js.flow +1 -0
  56. package/transforms/SplitModuleImportTransform.js.flow +3 -0
  57. package/transforms/TestOperationTransform.js.flow +1 -0
  58. package/transforms/ValidateRequiredArgumentsTransform.js.flow +4 -0
  59. package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +3 -0
  60. package/util/areEqualArgValues.js.flow +1 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Relay v11.0.2
3
+ * Relay v12.0.0
4
4
  *
5
5
  * Copyright (c) Facebook, Inc. and its affiliates.
6
6
  *
@@ -5153,6 +5153,7 @@ function flattenTransformImpl(context, options) {
5153
5153
 
5154
5154
  function memoizedFlattenSelection(cache) {
5155
5155
  return function flattenSelectionsFn(node, state) {
5156
+ // $FlowFixMe[incompatible-use]
5156
5157
  var context = this.getContext();
5157
5158
  var nodeCache = cache.get(node);
5158
5159
 
@@ -5183,7 +5184,8 @@ function memoizedFlattenSelection(cache) {
5183
5184
  var flattenedNode = hasFlattened ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, node), {}, {
5184
5185
  selections: Array.from(nextSelections.values())
5185
5186
  }) : node;
5186
- state.parentType = type;
5187
+ state.parentType = type; // $FlowFixMe[incompatible-use]
5188
+
5187
5189
  var deeplyFlattenedNode = this.traverse(flattenedNode, state);
5188
5190
  state.parentType = parentType;
5189
5191
  nodeCache.set(parentType, deeplyFlattenedNode);
@@ -5533,13 +5535,15 @@ function maskTransform(context) {
5533
5535
  }
5534
5536
 
5535
5537
  function visitFragment(fragment, state) {
5538
+ // $FlowFixMe[incompatible-use]
5536
5539
  var result = this.traverse(fragment, state);
5537
5540
 
5538
5541
  if (state.reachableArguments.length === 0) {
5539
5542
  return result;
5540
5543
  }
5541
5544
 
5542
- var joinedArgumentDefinitions = joinArgumentDefinitions(this.getContext().getSchema(), fragment, state.reachableArguments, '@relay(unmask: true)');
5545
+ var joinedArgumentDefinitions = joinArgumentDefinitions( // $FlowFixMe[incompatible-use]
5546
+ this.getContext().getSchema(), fragment, state.reachableArguments, '@relay(unmask: true)');
5543
5547
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, result), {}, {
5544
5548
  argumentDefinitions: joinedArgumentDefinitions
5545
5549
  });
@@ -5550,7 +5554,8 @@ function visitFragmentSpread(fragmentSpread, state) {
5550
5554
  return fragmentSpread;
5551
5555
  }
5552
5556
 
5553
- !(fragmentSpread.args.length === 0) ? true ? invariant(false, 'MaskTransform: Cannot unmask fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : undefined : void 0;
5557
+ !(fragmentSpread.args.length === 0) ? true ? invariant(false, 'MaskTransform: Cannot unmask fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : undefined : void 0; // $FlowFixMe[incompatible-use]
5558
+
5554
5559
  var context = this.getContext();
5555
5560
  var fragment = context.getFragment(fragmentSpread.name);
5556
5561
  var result = {
@@ -5586,7 +5591,8 @@ function visitFragmentSpread(fragmentSpread, state) {
5586
5591
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
5587
5592
  var argDef = _step.value;
5588
5593
  state.reachableArguments.push(argDef);
5589
- }
5594
+ } // $FlowFixMe[incompatible-use]
5595
+
5590
5596
  } catch (err) {
5591
5597
  _iterator.e(err);
5592
5598
  } finally {
@@ -5675,12 +5681,14 @@ function matchTransform(context) {
5675
5681
  }
5676
5682
 
5677
5683
  function visitInlineFragment(node, state) {
5684
+ // $FlowFixMe[incompatible-use]
5678
5685
  return this.traverse(node, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
5679
5686
  parentType: node.typeCondition
5680
5687
  }));
5681
5688
  }
5682
5689
 
5683
5690
  function visitScalarField(field) {
5691
+ // $FlowFixMe[incompatible-use]
5684
5692
  var context = this.getContext();
5685
5693
  var schema = context.getSchema();
5686
5694
 
@@ -5700,6 +5708,7 @@ function visitScalarField(field) {
5700
5708
  }
5701
5709
 
5702
5710
  function visitLinkedField(node, state) {
5711
+ // $FlowFixMe[incompatible-use]
5703
5712
  var context = this.getContext();
5704
5713
  var schema = context.getSchema();
5705
5714
  var matchDirective = node.directives.find(function (directive) {
@@ -5721,7 +5730,8 @@ function visitLinkedField(node, state) {
5721
5730
  }
5722
5731
  }
5723
5732
 
5724
- state.path.push(node);
5733
+ state.path.push(node); // $FlowFixMe[incompatible-use]
5734
+
5725
5735
  var transformedNode = this.traverse(node, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
5726
5736
  moduleKey: moduleKey,
5727
5737
  parentType: node.type
@@ -6375,11 +6385,13 @@ function visitRelayMetadata(metadataFn) {
6375
6385
  });
6376
6386
 
6377
6387
  if (!relayDirective) {
6388
+ // $FlowFixMe[incompatible-use]
6378
6389
  return this.traverse(node);
6379
6390
  }
6380
6391
 
6381
6392
  var argValues = getLiteralArgumentValues(relayDirective.args);
6382
- var metadata = metadataFn(argValues);
6393
+ var metadata = metadataFn(argValues); // $FlowFixMe[incompatible-use]
6394
+
6383
6395
  return this.traverse((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, node), {}, {
6384
6396
  directives: node.directives.filter(function (directive) {
6385
6397
  return directive !== relayDirective;
@@ -7343,10 +7355,12 @@ function requiredFieldTransform(context) {
7343
7355
  }
7344
7356
 
7345
7357
  function visitFragment(fragment, state) {
7358
+ // $FlowFixMe[incompatible-use]
7346
7359
  return addChildrenCanBubbleMetadata(this.traverse(fragment, state), state);
7347
7360
  }
7348
7361
 
7349
7362
  function visitRoot(root, state) {
7363
+ // $FlowFixMe[incompatible-use]
7350
7364
  return addChildrenCanBubbleMetadata(this.traverse(root, state), state);
7351
7365
  }
7352
7366
 
@@ -7356,7 +7370,8 @@ function visitInlineFragment(fragment, state) {
7356
7370
  // Ideally we could allow @required when the direct parent inline fragment was
7357
7371
  // on a concrete type, but we would need to solve this bug in our Flow type
7358
7372
  // generation first: T65695438
7359
- var parentAbstractInlineFragment = (_state$parentAbstract = state.parentAbstractInlineFragment) !== null && _state$parentAbstract !== void 0 ? _state$parentAbstract : getAbstractInlineFragment(fragment, state.schema);
7373
+ var parentAbstractInlineFragment = (_state$parentAbstract = state.parentAbstractInlineFragment) !== null && _state$parentAbstract !== void 0 ? _state$parentAbstract : getAbstractInlineFragment(fragment, state.schema); // $FlowFixMe[incompatible-use]
7374
+
7360
7375
  return this.traverse(fragment, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
7361
7376
  parentAbstractInlineFragment: parentAbstractInlineFragment
7362
7377
  }));
@@ -7396,7 +7411,8 @@ function visitLinkedField(field, state) {
7396
7411
  currentNodeRequiredChildren: new Map(),
7397
7412
  path: path,
7398
7413
  parentAbstractInlineFragment: null
7399
- });
7414
+ }); // $FlowFixMe[incompatible-use]
7415
+
7400
7416
  var newField = this.traverse(field, newState);
7401
7417
  var pathName = path.join('.');
7402
7418
  assertCompatibleRequiredChildren(field, pathName, newState);
@@ -12260,6 +12276,7 @@ function generateModuleImport(node) {
12260
12276
  }
12261
12277
 
12262
12278
  return {
12279
+ args: null,
12263
12280
  documentName: node.key,
12264
12281
  fragmentName: fragmentName,
12265
12282
  fragmentPropName: fragmentPropName,
@@ -12343,9 +12360,7 @@ function generateStream(schema, node) {
12343
12360
  "if": node["if"] != null && node["if"].kind === 'Variable' ? node["if"].variableName : null,
12344
12361
  kind: 'Stream',
12345
12362
  label: node.label,
12346
- metadata: sortObjectByKey(node.metadata),
12347
- selections: generateSelections(schema, node.selections),
12348
- useCustomizedBatch: node.useCustomizedBatch != null && node.useCustomizedBatch.kind === 'Variable' ? node.useCustomizedBatch.variableName : null
12363
+ selections: generateSelections(schema, node.selections)
12349
12364
  };
12350
12365
  }
12351
12366
 
@@ -13046,7 +13061,7 @@ function getConcreteType(node) {
13046
13061
  }
13047
13062
 
13048
13063
  function writeRelayGeneratedFile(schema, codegenDir, definition, _generatedNode, formatModule, typeText, _persistQuery, sourceHash, extension) {
13049
- var printModuleDependency = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : createPrintRequireModuleDependency(extension);
13064
+ var printModuleDependency = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : createPrintRequireModuleDependency();
13050
13065
  var shouldRepersist = arguments.length > 10 ? arguments[10] : undefined;
13051
13066
  var writeQueryParameters = arguments.length > 11 ? arguments[11] : undefined;
13052
13067
  var languagePlugin = arguments.length > 12 ? arguments[12] : undefined;
@@ -13224,9 +13239,9 @@ module.exports = require("@babel/runtime/helpers/objectWithoutPropertiesLoose");
13224
13239
  // flowlint ambiguous-object-type:error
13225
13240
 
13226
13241
 
13227
- function createPrintRequireModuleDependency(extension) {
13242
+ function createPrintRequireModuleDependency() {
13228
13243
  return function (moduleName) {
13229
- return "require('./".concat(moduleName, ".").concat(extension, "')");
13244
+ return "require('./".concat(moduleName, "')");
13230
13245
  };
13231
13246
  }
13232
13247
 
@@ -14145,6 +14160,7 @@ function clientExtensionTransform(context) {
14145
14160
  }
14146
14161
 
14147
14162
  function traverseDefinition(node) {
14163
+ // $FlowFixMe[incompatible-use]
14148
14164
  var compilerContext = this.getContext();
14149
14165
  var schema = compilerContext.getSchema();
14150
14166
  var rootType;
@@ -14412,6 +14428,7 @@ var SCHEMA_EXTENSION = "\n directive @connection(\n key: String!\n filter
14412
14428
  */
14413
14429
 
14414
14430
  function visitFragmentOrRoot(node, options) {
14431
+ // $FlowFixMe[incompatible-use]
14415
14432
  var transformedNode = this.traverse(node, options);
14416
14433
  var connectionMetadata = options.connectionMetadata;
14417
14434
 
@@ -14433,11 +14450,13 @@ function visitFragmentOrRoot(node, options) {
14433
14450
  function visitLinkedField(field, options) {
14434
14451
  var _connectionArguments$;
14435
14452
 
14453
+ // $FlowFixMe[incompatible-use]
14436
14454
  var context = this.getContext();
14437
14455
  var schema = context.getSchema();
14438
14456
  var nullableType = schema.getNullableType(field.type);
14439
14457
  var isPlural = schema.isList(nullableType);
14440
- var path = options.path.concat(isPlural ? null : field.alias || field.name);
14458
+ var path = options.path.concat(isPlural ? null : field.alias || field.name); // $FlowFixMe[incompatible-use]
14459
+
14441
14460
  var transformedField = this.traverse(field, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, options), {}, {
14442
14461
  path: path
14443
14462
  }));
@@ -14467,7 +14486,8 @@ function visitLinkedField(field, options) {
14467
14486
  var direction = connectionMetadata.direction;
14468
14487
 
14469
14488
  if (direction != null) {
14470
- var selections = transformConnectionSelections(this.getContext(), transformedField, schema.assertCompositeType(nullableType), direction, connectionArguments, connectionDirective.loc, options.documentName);
14489
+ var selections = transformConnectionSelections( // $FlowFixMe[incompatible-use]
14490
+ this.getContext(), transformedField, schema.assertCompositeType(nullableType), direction, connectionArguments, connectionDirective.loc, options.documentName);
14471
14491
  transformedField = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, transformedField), {}, {
14472
14492
  selections: selections
14473
14493
  });
@@ -15057,7 +15077,8 @@ function visitScalarField(field) {
15057
15077
 
15058
15078
  if (targetDirective == null) {
15059
15079
  return field;
15060
- }
15080
+ } // $FlowFixMe[incompatible-use]
15081
+
15061
15082
 
15062
15083
  var schema = this.getContext().getSchema();
15063
15084
 
@@ -15084,6 +15105,7 @@ function visitScalarField(field) {
15084
15105
  }
15085
15106
 
15086
15107
  function visitLinkedField(field) {
15108
+ // $FlowFixMe[incompatible-use]
15087
15109
  var transformedField = this.traverse(field);
15088
15110
  var deleteDirective = transformedField.directives.find(function (directive) {
15089
15111
  return directive.name === DELETE_RECORD;
@@ -15115,7 +15137,8 @@ function visitLinkedField(field) {
15115
15137
 
15116
15138
  if (connectionsArg == null) {
15117
15139
  throw createUserError("Expected the 'connections' argument to be defined on @".concat(targetDirective.name, "."), [targetDirective.loc]);
15118
- }
15140
+ } // $FlowFixMe[incompatible-use]
15141
+
15119
15142
 
15120
15143
  var schema = this.getContext().getSchema();
15121
15144
 
@@ -15347,7 +15370,8 @@ function visitScalarField(field, state) {
15347
15370
 
15348
15371
  if (streamDirective != null) {
15349
15372
  throw createUserError("Invalid use of @stream on scalar field '".concat(field.name, "'"), [streamDirective.loc]);
15350
- }
15373
+ } // $FlowFixMe[incompatible-use]
15374
+
15351
15375
 
15352
15376
  return this.traverse(field, state);
15353
15377
  }
@@ -15477,7 +15501,8 @@ var _require = __webpack_require__(1),
15477
15501
  function visitField(field) {
15478
15502
  if (field.alias === 'id' && field.name !== 'id') {
15479
15503
  throw createUserError('Relay does not allow aliasing fields to `id`. ' + 'This name is reserved for the globally unique `id` field on ' + '`Node`.', [field.loc]);
15480
- }
15504
+ } // $FlowFixMe[incompatible-use]
15505
+
15481
15506
 
15482
15507
  return this.traverse(field);
15483
15508
  }
@@ -15601,6 +15626,7 @@ function fieldHandleTransform(context) {
15601
15626
 
15602
15627
 
15603
15628
  function visitField(field) {
15629
+ // $FlowFixMe[incompatible-use]
15604
15630
  var nextField = field.kind === 'LinkedField' ? this.traverse(field) : field;
15605
15631
  var handles = nextField.handles;
15606
15632
 
@@ -15609,7 +15635,8 @@ function visitField(field) {
15609
15635
  } // ensure exactly one handle
15610
15636
 
15611
15637
 
15612
- !(handles.length === 1) ? true ? invariant(false, 'FieldHandleTransform: Expected fields to have at most one ' + '"handle" property, got `%s`.', handles.join(', ')) : undefined : void 0;
15638
+ !(handles.length === 1) ? true ? invariant(false, 'FieldHandleTransform: Expected fields to have at most one ' + '"handle" property, got `%s`.', handles.join(', ')) : undefined : void 0; // $FlowFixMe[incompatible-use]
15639
+
15613
15640
  var context = this.getContext();
15614
15641
  var schema = context.getSchema();
15615
15642
  var alias = nextField.alias;
@@ -15777,7 +15804,8 @@ function eq(a, b, aStack, bStack) {
15777
15804
 
15778
15805
  if (typeof a !== 'object' || typeof b !== 'object') {
15779
15806
  return false;
15780
- }
15807
+ } // $FlowFixMe[method-unbinding] added when improving typing for this parameters
15808
+
15781
15809
 
15782
15810
  var objToStr = Object.prototype.toString;
15783
15811
  var className = objToStr.call(a);
@@ -15951,11 +15979,13 @@ function generateIDFieldTransform(context) {
15951
15979
  }
15952
15980
 
15953
15981
  function visitLinkedField(field, state) {
15982
+ // $FlowFixMe[incompatible-use]
15954
15983
  var transformedNode = this.traverse(field, state); // If the field already has an unaliased `id` field, do nothing
15955
15984
 
15956
15985
  if (hasUnaliasedSelection(field, ID)) {
15957
15986
  return transformedNode;
15958
- }
15987
+ } // $FlowFixMe[incompatible-use]
15988
+
15959
15989
 
15960
15990
  var context = this.getContext();
15961
15991
  var schema = context.getSchema();
@@ -16070,8 +16100,10 @@ function generateTypeNameTransform(context) {
16070
16100
  }
16071
16101
 
16072
16102
  function visitFragment(fragment, state) {
16103
+ // $FlowFixMe[incompatible-use]
16073
16104
  var schema = this.getContext().getSchema();
16074
- var rawType = schema.getRawType(fragment.type);
16105
+ var rawType = schema.getRawType(fragment.type); // $FlowFixMe[incompatible-use]
16106
+
16075
16107
  var transformedNode = this.traverse(fragment, state);
16076
16108
  var isClientType = !schema.isServerType(rawType);
16077
16109
 
@@ -16100,6 +16132,7 @@ function visitFragment(fragment, state) {
16100
16132
  }
16101
16133
 
16102
16134
  function visitInlineFragment(fragment, state) {
16135
+ // $FlowFixMe[incompatible-use]
16103
16136
  var schema = this.getContext().getSchema();
16104
16137
  var transformedNode = cache.get(fragment);
16105
16138
 
@@ -16107,7 +16140,8 @@ function visitInlineFragment(fragment, state) {
16107
16140
  return transformedNode;
16108
16141
  }
16109
16142
 
16110
- var rawType = schema.getRawType(fragment.typeCondition);
16143
+ var rawType = schema.getRawType(fragment.typeCondition); // $FlowFixMe[incompatible-use]
16144
+
16111
16145
  transformedNode = this.traverse(fragment, state);
16112
16146
  var isClientType = !schema.isServerType(rawType);
16113
16147
 
@@ -16137,12 +16171,14 @@ function visitInlineFragment(fragment, state) {
16137
16171
  }
16138
16172
 
16139
16173
  function visitLinkedField(field, state) {
16174
+ // $FlowFixMe[incompatible-use]
16140
16175
  var schema = this.getContext().getSchema();
16141
16176
  var transformedNode = cache.get(field);
16142
16177
 
16143
16178
  if (transformedNode != null && transformedNode.kind === 'LinkedField') {
16144
16179
  return transformedNode;
16145
- }
16180
+ } // $FlowFixMe[incompatible-use]
16181
+
16146
16182
 
16147
16183
  transformedNode = this.traverse(field, state);
16148
16184
 
@@ -16203,6 +16239,7 @@ function inlineDataFragmentTransform(context) {
16203
16239
  }
16204
16240
 
16205
16241
  function visitFragment(fragment) {
16242
+ // $FlowFixMe[incompatible-use]
16206
16243
  var transformedFragment = this.traverse(fragment);
16207
16244
  var inlineDirective = transformedFragment.directives.find(function (directive) {
16208
16245
  return directive.name === 'inline';
@@ -16223,7 +16260,9 @@ function visitFragment(fragment) {
16223
16260
  }
16224
16261
 
16225
16262
  function visitFragmentSpread(fragmentSpread) {
16226
- var transformedFragmentSpread = this.traverse(fragmentSpread);
16263
+ // $FlowFixMe[incompatible-use]
16264
+ var transformedFragmentSpread = this.traverse(fragmentSpread); // $FlowFixMe[incompatible-use]
16265
+
16227
16266
  var context = this.getContext();
16228
16267
  var fragment = context.get(transformedFragmentSpread.name);
16229
16268
 
@@ -16239,7 +16278,8 @@ function visitFragmentSpread(fragmentSpread) {
16239
16278
 
16240
16279
  if (transformedFragmentSpread.directives.length > 0) {
16241
16280
  throw createUserError('Directives on fragment spreads for @inline fragments are not yet ' + 'supported', [transformedFragmentSpread.loc]);
16242
- }
16281
+ } // $FlowFixMe[incompatible-use]
16282
+
16243
16283
 
16244
16284
  var transformedFragment = this.visit(fragment);
16245
16285
  return {
@@ -16310,7 +16350,8 @@ function fragmentSpreadVisitor(cache) {
16310
16350
  return traverseResult;
16311
16351
  }
16312
16352
 
16313
- !(fragmentSpread.args.length === 0) ? true ? invariant(false, 'InlineFragmentsTransform: Cannot flatten fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : undefined : void 0;
16353
+ !(fragmentSpread.args.length === 0) ? true ? invariant(false, 'InlineFragmentsTransform: Cannot flatten fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : undefined : void 0; // $FlowFixMe[incompatible-use]
16354
+
16314
16355
  var fragment = this.getContext().getFragment(fragmentSpread.name, fragmentSpread.loc);
16315
16356
  var result = {
16316
16357
  kind: 'InlineFragment',
@@ -16322,7 +16363,8 @@ function fragmentSpreadVisitor(cache) {
16322
16363
  metadata: fragmentSpread.metadata,
16323
16364
  selections: fragment.selections,
16324
16365
  typeCondition: fragment.type
16325
- };
16366
+ }; // $FlowFixMe[incompatible-use]
16367
+
16326
16368
  traverseResult = this.traverse(result);
16327
16369
  cache.set(fragmentSpread, traverseResult);
16328
16370
  return traverseResult;
@@ -16474,6 +16516,7 @@ function reactFlightComponentTransform(context) {
16474
16516
  function visitInlineFragment(fragment, state) {
16475
16517
  var _fragment$typeConditi;
16476
16518
 
16519
+ // $FlowFixMe[incompatible-use]
16477
16520
  return this.traverse(fragment, {
16478
16521
  parentType: (_fragment$typeConditi = fragment.typeCondition) !== null && _fragment$typeConditi !== void 0 ? _fragment$typeConditi : state.parentType,
16479
16522
  types: state.types
@@ -16481,6 +16524,7 @@ function visitInlineFragment(fragment, state) {
16481
16524
  }
16482
16525
 
16483
16526
  function visitLinkedField(field, state) {
16527
+ // $FlowFixMe[incompatible-use]
16484
16528
  return this.traverse(field, {
16485
16529
  parentType: field.type,
16486
16530
  types: state.types
@@ -16489,6 +16533,7 @@ function visitLinkedField(field, state) {
16489
16533
 
16490
16534
  function visitScalarField(field, state) {
16491
16535
  // use the return type to quickly determine if this is a flight field
16536
+ // $FlowFixMe[incompatible-use]
16492
16537
  var schema = this.getContext().getSchema();
16493
16538
 
16494
16539
  if (schema.getRawType(field.type) !== state.types.componentType) {
@@ -17266,9 +17311,11 @@ function skipClientExtensionTransform(context) {
17266
17311
  }
17267
17312
 
17268
17313
  function visitFragment(node) {
17314
+ // $FlowFixMe[incompatible-use]
17269
17315
  var context = this.getContext();
17270
17316
 
17271
17317
  if (context.getSchema().isServerType(node.type)) {
17318
+ // $FlowFixMe[incompatible-use]
17272
17319
  return this.traverse(node);
17273
17320
  }
17274
17321
 
@@ -17276,6 +17323,7 @@ function visitFragment(node) {
17276
17323
  }
17277
17324
 
17278
17325
  function vistFragmentSpread(node) {
17326
+ // $FlowFixMe[incompatible-use]
17279
17327
  var context = this.getContext();
17280
17328
  var fragment = context.getFragment(node.name, node.loc);
17281
17329
  var isServer = context.getSchema().isServerType(fragment.type);
@@ -17325,6 +17373,7 @@ function skipHandleFieldTransform(context) {
17325
17373
  }
17326
17374
 
17327
17375
  function visitField(field) {
17376
+ // $FlowFixMe[incompatible-use]
17328
17377
  var transformedNode = this.traverse(field);
17329
17378
 
17330
17379
  if (transformedNode.handles) {
@@ -17475,7 +17524,8 @@ function skipRedundantNodesTransform(context) {
17475
17524
  var cache = new Map();
17476
17525
 
17477
17526
  function visitNode(node) {
17478
- cache = new Map();
17527
+ cache = new Map(); // $FlowFixMe[incompatible-use]
17528
+
17479
17529
  var context = this.getContext();
17480
17530
  return transformNode(context.getSchema(), node, new IMap()).node;
17481
17531
  }
@@ -17922,6 +17972,7 @@ function splitMatchTransform(context) {
17922
17972
  }
17923
17973
 
17924
17974
  function visitLinkedField(field, state) {
17975
+ // $FlowFixMe[incompatible-use]
17925
17976
  return this.traverse(field, {
17926
17977
  parentType: field.type,
17927
17978
  splitOperations: state.splitOperations
@@ -17929,6 +17980,7 @@ function visitLinkedField(field, state) {
17929
17980
  }
17930
17981
 
17931
17982
  function visitInlineFragment(fragment, state) {
17983
+ // $FlowFixMe[incompatible-use]
17932
17984
  return this.traverse(fragment, {
17933
17985
  parentType: fragment.typeCondition,
17934
17986
  splitOperations: state.splitOperations
@@ -17945,7 +17997,8 @@ function visitModuleImport(node, state) {
17945
17997
  if (createdSplitOperation) {
17946
17998
  createdSplitOperation.parentSources.add(node.sourceDocument);
17947
17999
  return node;
17948
- }
18000
+ } // $FlowFixMe[incompatible-use]
18001
+
17949
18002
 
17950
18003
  var transformedNode = this.traverse(node, state);
17951
18004
  var splitOperation = {
@@ -18025,6 +18078,7 @@ function getTypeDetails(schema, fieldType) {
18025
18078
  }
18026
18079
 
18027
18080
  function visitRoot(node) {
18081
+ // $FlowFixMe[incompatible-use]
18028
18082
  var schema = this.getContext().getSchema();
18029
18083
  var testDirective = node.directives.find(function (directive) {
18030
18084
  return directive.name === 'relay_test_operation';
@@ -18267,6 +18321,7 @@ function validateRequiredArguments(context) {
18267
18321
 
18268
18322
  function visitDirective(node, _ref) {
18269
18323
  var rootNode = _ref.rootNode;
18324
+ // $FlowFixMe[incompatible-use]
18270
18325
  var context = this.getContext();
18271
18326
  var directiveDef = context.getSchema().getDirective(node.name);
18272
18327
 
@@ -18279,6 +18334,7 @@ function visitDirective(node, _ref) {
18279
18334
 
18280
18335
  function visitInlineFragment(fragment, _ref2) {
18281
18336
  var rootNode = _ref2.rootNode;
18337
+ // $FlowFixMe[incompatible-use]
18282
18338
  this.traverse(fragment, {
18283
18339
  rootNode: rootNode,
18284
18340
  parentType: fragment.typeCondition
@@ -18288,6 +18344,7 @@ function visitInlineFragment(fragment, _ref2) {
18288
18344
  function visitField(node, _ref3) {
18289
18345
  var parentType = _ref3.parentType,
18290
18346
  rootNode = _ref3.rootNode;
18347
+ // $FlowFixMe[incompatible-use]
18291
18348
  var context = this.getContext();
18292
18349
  var schema = context.getSchema();
18293
18350
  var definition = getFieldDefinitionStrict(schema, parentType, node.name);
@@ -18302,7 +18359,8 @@ function visitField(node, _ref3) {
18302
18359
  }
18303
18360
  } else {
18304
18361
  validateRequiredArgumentsOnNode(schema, node, schema.getFieldConfig(definition).args, rootNode);
18305
- }
18362
+ } // $FlowFixMe[incompatible-use]
18363
+
18306
18364
 
18307
18365
  this.traverse(node, {
18308
18366
  rootNode: rootNode,
@@ -357,6 +357,7 @@ function generateModuleImport(node: ModuleImport): NormalizationModuleImport {
357
357
  );
358
358
  }
359
359
  return {
360
+ args: null,
360
361
  documentName: node.key,
361
362
  fragmentName,
362
363
  fragmentPropName,
@@ -447,13 +448,7 @@ function generateStream(schema: Schema, node: Stream): NormalizationStream {
447
448
  : null,
448
449
  kind: 'Stream',
449
450
  label: node.label,
450
- metadata: sortObjectByKey(node.metadata),
451
451
  selections: generateSelections(schema, node.selections),
452
- useCustomizedBatch:
453
- node.useCustomizedBatch != null &&
454
- node.useCustomizedBatch.kind === 'Variable'
455
- ? node.useCustomizedBatch.variableName
456
- : null,
457
452
  };
458
453
  }
459
454
 
@@ -12,10 +12,8 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- function createPrintRequireModuleDependency(
16
- extension: string,
17
- ): string => string {
18
- return moduleName => `require('./${moduleName}.${extension}')`;
15
+ function createPrintRequireModuleDependency(): string => string {
16
+ return moduleName => `require('./${moduleName}')`;
19
17
  }
20
18
 
21
19
  module.exports = createPrintRequireModuleDependency;
@@ -58,7 +58,7 @@ function writeRelayGeneratedFile(
58
58
  extension: string,
59
59
  printModuleDependency: (
60
60
  moduleName: string,
61
- ) => string = createPrintRequireModuleDependency(extension),
61
+ ) => string = createPrintRequireModuleDependency(),
62
62
  shouldRepersist: boolean,
63
63
  writeQueryParameters: (
64
64
  dir: CodegenDirectory,
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v11.0.2
2
+ * Relay v12.0.0
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
5
5
  *
@@ -38,7 +38,7 @@ function transformScalarType(
38
38
  type: TypeID,
39
39
  state: State,
40
40
  objectProps?: BabelNode_DEPRECATED,
41
- ): mixed {
41
+ ): BabelNode_DEPRECATED {
42
42
  if (schema.isNonNull(type)) {
43
43
  return transformNonNullableScalarType(
44
44
  schema,
@@ -108,7 +108,7 @@ function transformGraphQLEnumType(
108
108
  schema: Schema,
109
109
  type: EnumTypeID,
110
110
  state: State,
111
- ) {
111
+ ): BabelNode_DEPRECATED {
112
112
  state.usedEnums[schema.getTypeString(type)] = type;
113
113
  return t.genericTypeAnnotation(t.identifier(schema.getTypeString(type)));
114
114
  }
@@ -117,7 +117,7 @@ function transformInputType(
117
117
  schema: Schema,
118
118
  type: TypeID,
119
119
  state: State,
120
- ): $FlowFixMe {
120
+ ): BabelNode_DEPRECATED {
121
121
  if (schema.isNonNull(type)) {
122
122
  return transformNonNullableInputType(
123
123
  schema,
@@ -286,6 +286,7 @@ function generateModuleImport(node) {
286
286
  }
287
287
 
288
288
  return {
289
+ args: null,
289
290
  documentName: node.key,
290
291
  fragmentName: fragmentName,
291
292
  fragmentPropName: fragmentPropName,
@@ -369,9 +370,7 @@ function generateStream(schema, node) {
369
370
  "if": node["if"] != null && node["if"].kind === 'Variable' ? node["if"].variableName : null,
370
371
  kind: 'Stream',
371
372
  label: node.label,
372
- metadata: sortObjectByKey(node.metadata),
373
- selections: generateSelections(schema, node.selections),
374
- useCustomizedBatch: node.useCustomizedBatch != null && node.useCustomizedBatch.kind === 'Variable' ? node.useCustomizedBatch.variableName : null
373
+ selections: generateSelections(schema, node.selections)
375
374
  };
376
375
  }
377
376
 
@@ -10,9 +10,9 @@
10
10
  // flowlint ambiguous-object-type:error
11
11
  'use strict';
12
12
 
13
- function createPrintRequireModuleDependency(extension) {
13
+ function createPrintRequireModuleDependency() {
14
14
  return function (moduleName) {
15
- return "require('./".concat(moduleName, ".").concat(extension, "')");
15
+ return "require('./".concat(moduleName, "')");
16
16
  };
17
17
  }
18
18
 
@@ -52,7 +52,7 @@ function getConcreteType(node) {
52
52
  }
53
53
 
54
54
  function writeRelayGeneratedFile(schema, codegenDir, definition, _generatedNode, formatModule, typeText, _persistQuery, sourceHash, extension) {
55
- var printModuleDependency = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : createPrintRequireModuleDependency(extension);
55
+ var printModuleDependency = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : createPrintRequireModuleDependency();
56
56
  var shouldRepersist = arguments.length > 10 ? arguments[10] : undefined;
57
57
  var writeQueryParameters = arguments.length > 11 ? arguments[11] : undefined;
58
58
  var languagePlugin = arguments.length > 12 ? arguments[12] : undefined;
@@ -34,6 +34,7 @@ function clientExtensionTransform(context) {
34
34
  }
35
35
 
36
36
  function traverseDefinition(node) {
37
+ // $FlowFixMe[incompatible-use]
37
38
  var compilerContext = this.getContext();
38
39
  var schema = compilerContext.getSchema();
39
40
  var rootType;