babel-plugin-relay 2.0.0-rc.2 → 5.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.
@@ -9,22 +9,35 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
+ var compileGraphQLTag = require("./compileGraphQLTag");
13
+
14
+ var getValidGraphQLTag = require("./getValidGraphQLTag");
15
+
16
+ var _require = require("babel-plugin-macros"),
17
+ createMacro = _require.createMacro;
18
+
19
+ var configName = 'relay';
20
+
12
21
  function BabelPluginRelayMacro(_ref) {
13
22
  var references = _ref.references,
14
23
  state = _ref.state,
15
- babel = _ref.babel;
24
+ babel = _ref.babel,
25
+ config = _ref.config;
16
26
  var t = babel.types;
17
27
  Object.keys(references).forEach(function (referenceKey) {
18
28
  references[referenceKey].forEach(function (reference) {
19
29
  var path = reference.parentPath;
20
-
21
- var ast = require("./getValidGraphQLTag")(path);
30
+ var ast = getValidGraphQLTag(path);
22
31
 
23
32
  if (ast) {
24
- require("./compileGraphQLTag")(t, path, state, ast);
33
+ compileGraphQLTag(t, path, Object.assign(state, config ? {
34
+ opts: config
35
+ } : {}), ast);
25
36
  }
26
37
  });
27
38
  });
28
39
  }
29
40
 
30
- module.exports = require("babel-plugin-macros").createMacro(BabelPluginRelayMacro);
41
+ module.exports = createMacro(BabelPluginRelayMacro, {
42
+ configName: configName
43
+ });
@@ -4,17 +4,19 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * strict
7
+ *
8
8
  * @fullSyntaxTransform
9
9
  * @format
10
10
  */
11
11
  'use strict';
12
12
 
13
- // Copy of RelayRelayDirectiveTransform.SCHEMA_EXTENSION due to the build
13
+ var _require = require("graphql"),
14
+ buildSchema = _require.buildSchema; // Copy of RelayRelayDirectiveTransform.SCHEMA_EXTENSION due to the build
14
15
  // systems.
15
- var SCHEMA_EXTENSION = "directive @relay(\n # Marks a connection field as containing nodes without 'id' fields.\n # This is used to silence the warning when diffing connections.\n isConnectionWithoutNodeID: Boolean,\n\n # Marks a fragment as intended for pattern matching (as opposed to fetching).\n # Used in Classic only.\n pattern: Boolean,\n\n # Marks a fragment as being backed by a GraphQLList.\n plural: Boolean,\n\n # Marks a fragment spread which should be unmasked if provided false\n mask: Boolean = true,\n\n # Selectively pass variables down into a fragment. Only used in Classic.\n variables: [String!],\n) on FRAGMENT_DEFINITION | FRAGMENT_SPREAD | INLINE_FRAGMENT | FIELD";
16
16
 
17
- var GraphQLRelayDirective = require("graphql").buildSchema(SCHEMA_EXTENSION + '\ntype Query { x: String }').getDirective('relay');
17
+
18
+ var SCHEMA_EXTENSION = "directive @relay(\n # Marks a connection field as containing nodes without 'id' fields.\n # This is used to silence the warning when diffing connections.\n isConnectionWithoutNodeID: Boolean,\n\n # Marks a fragment as intended for pattern matching (as opposed to fetching).\n # Used in Classic only.\n pattern: Boolean,\n\n # Marks a fragment as being backed by a GraphQLList.\n plural: Boolean,\n\n # Marks a fragment spread which should be unmasked if provided false\n mask: Boolean = true,\n\n # Selectively pass variables down into a fragment. Only used in Classic.\n variables: [String!],\n) on FRAGMENT_DEFINITION | FRAGMENT_SPREAD | INLINE_FRAGMENT | FIELD";
19
+ var GraphQLRelayDirective = buildSchema(SCHEMA_EXTENSION + '\ntype Query { x: String }').getDirective('relay');
18
20
 
19
21
  if (!GraphQLRelayDirective) {
20
22
  throw new Error('Failed to create GraphQLRelayDirective.');
package/lib/RelayQLAST.js CHANGED
@@ -10,9 +10,44 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- var _objectSpread2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/objectSpread"));
13
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
14
14
 
15
- var _inheritsLoose2 = require("@babel/runtime/helpers/interopRequireDefault")(require("@babel/runtime/helpers/inheritsLoose"));
15
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
16
+
17
+ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
18
+
19
+ var RelayTransformError = require("./RelayTransformError");
20
+
21
+ var find = require("./find");
22
+
23
+ var invariant = require("./invariant");
24
+
25
+ var util = require("util");
26
+
27
+ var _require = require("./GraphQLRelayDirective"),
28
+ GraphQLRelayDirective = _require.GraphQLRelayDirective;
29
+
30
+ var _require2 = require("./RelayQLNodeInterface"),
31
+ ID = _require2.ID;
32
+
33
+ var _require3 = require("graphql"),
34
+ GraphQLBoolean = _require3.GraphQLBoolean,
35
+ GraphQLEnumType = _require3.GraphQLEnumType,
36
+ GraphQLFloat = _require3.GraphQLFloat,
37
+ GraphQLID = _require3.GraphQLID,
38
+ GraphQLInputObjectType = _require3.GraphQLInputObjectType,
39
+ GraphQLInt = _require3.GraphQLInt,
40
+ GraphQLInterfaceType = _require3.GraphQLInterfaceType,
41
+ GraphQLList = _require3.GraphQLList,
42
+ GraphQLNonNull = _require3.GraphQLNonNull,
43
+ GraphQLObjectType = _require3.GraphQLObjectType,
44
+ GraphQLScalarType = _require3.GraphQLScalarType,
45
+ GraphQLString = _require3.GraphQLString,
46
+ GraphQLUnionType = _require3.GraphQLUnionType,
47
+ isAbstractType = _require3.isAbstractType,
48
+ SchemaMetaFieldDef = _require3.SchemaMetaFieldDef,
49
+ TypeMetaFieldDef = _require3.TypeMetaFieldDef,
50
+ TypeNameMetaFieldDef = _require3.TypeNameMetaFieldDef;
16
51
 
17
52
  var RelayQLNode =
18
53
  /*#__PURE__*/
@@ -29,11 +64,11 @@ function () {
29
64
  };
30
65
 
31
66
  _proto.getType = function getType() {
32
- !false ? process.env.NODE_ENV !== "production" ? require("./invariant")(false, 'Missing Implementation') : require("./invariant")(false) : void 0;
67
+ !false ? process.env.NODE_ENV !== "production" ? invariant(false, 'Missing Implementation') : invariant(false) : void 0;
33
68
  };
34
69
 
35
70
  _proto.getField = function getField(fieldName) {
36
- return require("./find")(this.getFields(), function (field) {
71
+ return find(this.getFields(), function (field) {
37
72
  return field.getName() === fieldName;
38
73
  });
39
74
  };
@@ -67,7 +102,7 @@ function () {
67
102
  } else if (selection.kind === 'InlineFragment') {
68
103
  return new RelayQLInlineFragment(_this.context, selection, _this.getType());
69
104
  } else {
70
- throw new (require("./RelayTransformError"))(require("util").format('Unexpected selection kind: %s', selection.kind), _this.getLocation());
105
+ throw new RelayTransformError(util.format('Unexpected selection kind: %s', selection.kind), _this.getLocation());
71
106
  }
72
107
  });
73
108
  };
@@ -130,8 +165,7 @@ function (_RelayQLDefinition) {
130
165
  var _this3;
131
166
 
132
167
  var relayDirectiveArgs = {};
133
-
134
- var relayDirective = require("./find")(ast.directives || [], function (directive) {
168
+ var relayDirective = find(ast.directives || [], function (directive) {
135
169
  return directive.name.value === 'relay';
136
170
  });
137
171
 
@@ -165,12 +199,12 @@ function (_RelayQLDefinition) {
165
199
  } else if (this.ast.kind === 'InlineFragment') {
166
200
  // Inline fragments without type conditions fall back to parent type.
167
201
  if (!this.parentType) {
168
- throw new (require("./RelayTransformError"))('Cannot get type of typeless inline fragment without parent type.', this.getLocation());
202
+ throw new RelayTransformError('Cannot get type of typeless inline fragment without parent type.', this.getLocation());
169
203
  }
170
204
 
171
205
  return this.parentType;
172
206
  } else {
173
- throw new (require("./RelayTransformError"))(require("util").format('Unexpected fragment kind: %s', this.ast.kind), this.getLocation());
207
+ throw new RelayTransformError(util.format('Unexpected fragment kind: %s', this.ast.kind), this.getLocation());
174
208
  }
175
209
  };
176
210
 
@@ -248,7 +282,7 @@ function (_RelayQLNode2) {
248
282
  var fieldDef = parentType.getFieldDefinition(fieldName, ast);
249
283
 
250
284
  if (!fieldDef) {
251
- throw new (require("./RelayTransformError"))(require("util").format('You supplied a field named `%s` on type `%s`, but no such field ' + 'exists on that type.', fieldName, parentType.getName({
285
+ throw new RelayTransformError(util.format('You supplied a field named `%s` on type `%s`, but no such field ' + 'exists on that type.', fieldName, parentType.getName({
252
286
  modifiers: false
253
287
  })), _this4.getLocation());
254
288
  }
@@ -278,7 +312,7 @@ function (_RelayQLNode2) {
278
312
  };
279
313
 
280
314
  _proto7.findArgument = function findArgument(argName) {
281
- return require("./find")(this.getArguments(), function (arg) {
315
+ return find(this.getArguments(), function (arg) {
282
316
  return arg.getName() === argName;
283
317
  });
284
318
  };
@@ -292,7 +326,7 @@ function (_RelayQLNode2) {
292
326
  var argType = argTypes[argName];
293
327
 
294
328
  if (!argType) {
295
- throw new (require("./RelayTransformError"))(require("util").format('You supplied an argument named `%s` on field `%s`, but no such ' + 'argument exists on that field.', argName, _this5.getName()), _this5.getLocation());
329
+ throw new RelayTransformError(util.format('You supplied an argument named `%s` on field `%s`, but no such ' + 'argument exists on that field.', argName, _this5.getName()), _this5.getLocation());
296
330
  }
297
331
 
298
332
  return new RelayQLArgument(_this5.context, arg, argType);
@@ -331,7 +365,7 @@ function (_RelayQLNode3) {
331
365
  };
332
366
 
333
367
  _proto8.getSelections = function getSelections() {
334
- throw new (require("./RelayTransformError"))('Cannot get selection of a fragment spread.', this.getLocation());
368
+ throw new RelayTransformError('Cannot get selection of a fragment spread.', this.getLocation());
335
369
  };
336
370
 
337
371
  return RelayQLFragmentSpread;
@@ -370,10 +404,10 @@ function () {
370
404
  this.context = context;
371
405
  this.argTypes = {};
372
406
  var directiveName = ast.name.value;
373
- var schemaDirective = directiveName === require("./GraphQLRelayDirective").GraphQLRelayDirective.name ? require("./GraphQLRelayDirective").GraphQLRelayDirective : context.schema.getDirective(directiveName);
407
+ var schemaDirective = directiveName === GraphQLRelayDirective.name ? GraphQLRelayDirective : context.schema.getDirective(directiveName);
374
408
 
375
409
  if (!schemaDirective) {
376
- throw new (require("./RelayTransformError"))(require("util").format('You supplied a directive named `%s`, but no such directive exists.', directiveName), this.getLocation());
410
+ throw new RelayTransformError(util.format('You supplied a directive named `%s`, but no such directive exists.', directiveName), this.getLocation());
377
411
  }
378
412
 
379
413
  schemaDirective.args.forEach(function (schemaArg) {
@@ -399,7 +433,7 @@ function () {
399
433
  var argType = _this8.argTypes[argName];
400
434
 
401
435
  if (!argType) {
402
- throw new (require("./RelayTransformError"))(require("util").format('You supplied an argument named `%s` on directive `%s`, but no ' + 'such argument exists on that directive.', argName, _this8.getName()), _this8.getLocation());
436
+ throw new RelayTransformError(util.format('You supplied an argument named `%s` on directive `%s`, but no ' + 'such argument exists on that directive.', argName, _this8.getName()), _this8.getLocation());
403
437
  }
404
438
 
405
439
  return new RelayQLArgument(_this8.context, arg, argType);
@@ -438,7 +472,7 @@ function () {
438
472
 
439
473
  _proto11.getVariableName = function getVariableName() {
440
474
  if (this.ast.value.kind !== 'Variable') {
441
- throw new (require("./RelayTransformError"))('Cannot get variable name of an argument value.', this.getLocation());
475
+ throw new RelayTransformError('Cannot get variable name of an argument value.', this.getLocation());
442
476
  }
443
477
 
444
478
  return this.ast.value.name.value;
@@ -448,7 +482,7 @@ function () {
448
482
  var _this9 = this;
449
483
 
450
484
  if (this.isVariable()) {
451
- throw new (require("./RelayTransformError"))('Cannot get value of an argument variable.', this.getLocation());
485
+ throw new RelayTransformError('Cannot get value of an argument variable.', this.getLocation());
452
486
  }
453
487
 
454
488
  var value = this.ast.value;
@@ -487,7 +521,7 @@ function () {
487
521
  var _proto12 = RelayQLType.prototype;
488
522
 
489
523
  _proto12.canHaveSubselections = function canHaveSubselections() {
490
- return !(this.schemaUnmodifiedType instanceof require("graphql").GraphQLScalarType || this.schemaUnmodifiedType instanceof require("graphql").GraphQLEnumType);
524
+ return !(this.schemaUnmodifiedType instanceof GraphQLScalarType || this.schemaUnmodifiedType instanceof GraphQLEnumType);
491
525
  };
492
526
 
493
527
  _proto12.getName = function getName(_ref) {
@@ -502,25 +536,22 @@ function () {
502
536
  _proto12.getFieldDefinition = function getFieldDefinition(fieldName, fieldAST) {
503
537
  var type = this.schemaUnmodifiedType;
504
538
  var isQueryType = type === this.context.schema.getQueryType();
505
-
506
- var hasTypeName = type instanceof require("graphql").GraphQLObjectType || type instanceof require("graphql").GraphQLInterfaceType || type instanceof require("graphql").GraphQLUnionType;
507
-
508
- var hasFields = type instanceof require("graphql").GraphQLObjectType || type instanceof require("graphql").GraphQLInterfaceType;
509
-
539
+ var hasTypeName = type instanceof GraphQLObjectType || type instanceof GraphQLInterfaceType || type instanceof GraphQLUnionType;
540
+ var hasFields = type instanceof GraphQLObjectType || type instanceof GraphQLInterfaceType;
510
541
  var schemaFieldDef;
511
542
 
512
- if (isQueryType && fieldName === require("graphql").SchemaMetaFieldDef.name) {
513
- schemaFieldDef = require("graphql").SchemaMetaFieldDef;
514
- } else if (isQueryType && fieldName === require("graphql").TypeMetaFieldDef.name) {
515
- schemaFieldDef = require("graphql").TypeMetaFieldDef;
516
- } else if (hasTypeName && fieldName === require("graphql").TypeNameMetaFieldDef.name) {
517
- schemaFieldDef = require("graphql").TypeNameMetaFieldDef;
543
+ if (isQueryType && fieldName === SchemaMetaFieldDef.name) {
544
+ schemaFieldDef = SchemaMetaFieldDef;
545
+ } else if (isQueryType && fieldName === TypeMetaFieldDef.name) {
546
+ schemaFieldDef = TypeMetaFieldDef;
547
+ } else if (hasTypeName && fieldName === TypeNameMetaFieldDef.name) {
548
+ schemaFieldDef = TypeNameMetaFieldDef;
518
549
  } else if (hasFields) {
519
550
  schemaFieldDef = type.getFields()[fieldName];
520
551
  } // Temporary workaround to support fixme_fat_interface
521
552
 
522
553
 
523
- if (!schemaFieldDef && require("graphql").isAbstractType(type) && fieldAST && fieldAST.directives && fieldAST.directives.some(function (directive) {
554
+ if (!schemaFieldDef && isAbstractType(type) && fieldAST && fieldAST.directives && fieldAST.directives.some(function (directive) {
524
555
  return directive.name.value === 'fixme_fat_interface';
525
556
  })) {
526
557
  var possibleTypes = this.context.schema.getPossibleTypes(type);
@@ -536,7 +567,7 @@ function () {
536
567
 
537
568
  if (fieldAST && fieldAST.arguments) {
538
569
  var argumentsAllExist = fieldAST.arguments.every(function (argument) {
539
- return require("./find")(possibleField.args, function (argDef) {
570
+ return find(possibleField.args, function (argDef) {
540
571
  return argDef.name === argument.name.value;
541
572
  });
542
573
  });
@@ -561,7 +592,7 @@ function () {
561
592
  _proto12.getInterfaces = function getInterfaces() {
562
593
  var _this10 = this;
563
594
 
564
- if (this.schemaUnmodifiedType instanceof require("graphql").GraphQLObjectType) {
595
+ if (this.schemaUnmodifiedType instanceof GraphQLObjectType) {
565
596
  return this.schemaUnmodifiedType.getInterfaces().map(function (schemaInterface) {
566
597
  return new RelayQLType(_this10.context, schemaInterface);
567
598
  });
@@ -573,7 +604,7 @@ function () {
573
604
  _proto12.getConcreteTypes = function getConcreteTypes() {
574
605
  var _this11 = this;
575
606
 
576
- !this.isAbstract() ? process.env.NODE_ENV !== "production" ? require("./invariant")(false, 'Cannot get concrete types of a concrete type.') : require("./invariant")(false) : void 0;
607
+ !this.isAbstract() ? process.env.NODE_ENV !== "production" ? invariant(false, 'Cannot get concrete types of a concrete type.') : invariant(false) : void 0;
577
608
  return this.context.schema.getPossibleTypes(this.schemaUnmodifiedType).map(function (concreteType) {
578
609
  return new RelayQLType(_this11.context, concreteType);
579
610
  });
@@ -581,14 +612,14 @@ function () {
581
612
 
582
613
  _proto12.getIdentifyingFieldDefinition = function getIdentifyingFieldDefinition() {
583
614
  if (this.alwaysImplements('Node')) {
584
- return this.getFieldDefinition(require("./RelayQLNodeInterface").ID);
615
+ return this.getFieldDefinition(ID);
585
616
  }
586
617
 
587
618
  return null;
588
619
  };
589
620
 
590
621
  _proto12.isAbstract = function isAbstract() {
591
- return require("graphql").isAbstractType(this.schemaUnmodifiedType);
622
+ return isAbstractType(this.schemaUnmodifiedType);
592
623
  };
593
624
 
594
625
  _proto12.isList = function isList() {
@@ -724,11 +755,10 @@ function () {
724
755
  };
725
756
 
726
757
  _proto13.getArgument = function getArgument(argName) {
727
- var schemaArg = require("./find")(this.schemaFieldDef.args, function (arg) {
758
+ var schemaArg = find(this.schemaFieldDef.args, function (arg) {
728
759
  return arg.name === argName;
729
760
  });
730
-
731
- !schemaArg ? process.env.NODE_ENV !== "production" ? require("./invariant")(false, 'You tried to get an argument named `%s` on field `%s`, but no such ' + 'argument exists on that field.', argName, this.getName()) : require("./invariant")(false) : void 0;
761
+ !schemaArg ? process.env.NODE_ENV !== "production" ? invariant(false, 'You tried to get an argument named `%s` on field `%s`, but no such ' + 'argument exists on that field.', argName, this.getName()) : invariant(false) : void 0;
732
762
  return new RelayQLArgumentType(schemaArg.type);
733
763
  };
734
764
 
@@ -766,24 +796,24 @@ function () {
766
796
  };
767
797
 
768
798
  _proto14.ofType = function ofType() {
769
- !(this.isList() || this.isNonNull()) ? process.env.NODE_ENV !== "production" ? require("./invariant")(false, 'Can only get type of list or non-null type.') : require("./invariant")(false) : void 0;
799
+ !(this.isList() || this.isNonNull()) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Can only get type of list or non-null type.') : invariant(false) : void 0;
770
800
  return new RelayQLArgumentType(this.schemaUnmodifiedArgType);
771
801
  };
772
802
 
773
803
  _proto14.isCustomScalar = function isCustomScalar() {
774
- return this.isScalar() && !(this.schemaUnmodifiedArgType === require("graphql").GraphQLBoolean || this.schemaUnmodifiedArgType === require("graphql").GraphQLFloat || this.schemaUnmodifiedArgType === require("graphql").GraphQLID || this.schemaUnmodifiedArgType === require("graphql").GraphQLInt || this.schemaUnmodifiedArgType === require("graphql").GraphQLString);
804
+ return this.isScalar() && !(this.schemaUnmodifiedArgType === GraphQLBoolean || this.schemaUnmodifiedArgType === GraphQLFloat || this.schemaUnmodifiedArgType === GraphQLID || this.schemaUnmodifiedArgType === GraphQLInt || this.schemaUnmodifiedArgType === GraphQLString);
775
805
  };
776
806
 
777
807
  _proto14.isBoolean = function isBoolean() {
778
- return this.schemaUnmodifiedArgType === require("graphql").GraphQLBoolean;
808
+ return this.schemaUnmodifiedArgType === GraphQLBoolean;
779
809
  };
780
810
 
781
811
  _proto14.isEnum = function isEnum() {
782
- return this.schemaUnmodifiedArgType instanceof require("graphql").GraphQLEnumType;
812
+ return this.schemaUnmodifiedArgType instanceof GraphQLEnumType;
783
813
  };
784
814
 
785
815
  _proto14.isID = function isID() {
786
- return this.schemaUnmodifiedArgType === require("graphql").GraphQLID;
816
+ return this.schemaUnmodifiedArgType === GraphQLID;
787
817
  };
788
818
 
789
819
  _proto14.isList = function isList() {
@@ -795,19 +825,19 @@ function () {
795
825
  };
796
826
 
797
827
  _proto14.isNumber = function isNumber() {
798
- return this.schemaUnmodifiedArgType === require("graphql").GraphQLFloat || this.schemaUnmodifiedArgType === require("graphql").GraphQLInt;
828
+ return this.schemaUnmodifiedArgType === GraphQLFloat || this.schemaUnmodifiedArgType === GraphQLInt;
799
829
  };
800
830
 
801
831
  _proto14.isObject = function isObject() {
802
- return this.schemaUnmodifiedArgType instanceof require("graphql").GraphQLInputObjectType;
832
+ return this.schemaUnmodifiedArgType instanceof GraphQLInputObjectType;
803
833
  };
804
834
 
805
835
  _proto14.isScalar = function isScalar() {
806
- return this.schemaUnmodifiedArgType instanceof require("graphql").GraphQLScalarType;
836
+ return this.schemaUnmodifiedArgType instanceof GraphQLScalarType;
807
837
  };
808
838
 
809
839
  _proto14.isString = function isString() {
810
- return this.schemaUnmodifiedArgType === require("graphql").GraphQLString;
840
+ return this.schemaUnmodifiedArgType === GraphQLString;
811
841
  };
812
842
 
813
843
  return RelayQLArgumentType;
@@ -819,9 +849,9 @@ function stripMarkerTypes(schemaModifiedType) {
819
849
  var schemaUnmodifiedType = schemaModifiedType;
820
850
 
821
851
  while (true) {
822
- if (schemaUnmodifiedType instanceof require("graphql").GraphQLList) {
852
+ if (schemaUnmodifiedType instanceof GraphQLList) {
823
853
  isListType = true;
824
- } else if (schemaUnmodifiedType instanceof require("graphql").GraphQLNonNull) {
854
+ } else if (schemaUnmodifiedType instanceof GraphQLNonNull) {
825
855
  isNonNullType = true;
826
856
  } else {
827
857
  break;
@@ -864,10 +894,10 @@ function getLiteralValue(value) {
864
894
  return object;
865
895
 
866
896
  case 'Variable':
867
- throw new (require("./RelayTransformError"))(require("util").format('Unexpected nested variable `%s`; variables are supported as top-' + 'level arguments - `node(id: $id)` - or directly within lists - ' + '`nodes(ids: [$id])`.', value.name.value), value.loc);
897
+ throw new RelayTransformError(util.format('Unexpected nested variable `%s`; variables are supported as top-' + 'level arguments - `node(id: $id)` - or directly within lists - ' + '`nodes(ids: [$id])`.', value.name.value), value.loc);
868
898
 
869
899
  default:
870
- throw new (require("./RelayTransformError"))(require("util").format('Unexpected value kind: %s', value.kind), value.loc);
900
+ throw new RelayTransformError(util.format('Unexpected value kind: %s', value.kind), value.loc);
871
901
  }
872
902
  }
873
903
 
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * strict
7
+ *
8
8
  * @format
9
9
  */
10
10
  'use strict';