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.
- package/bin/relay-compiler +92 -34
- package/codegen/NormalizationCodeGenerator.js.flow +1 -6
- package/codegen/createPrintRequireModuleDependency.js.flow +2 -4
- package/codegen/writeRelayGeneratedFile.js.flow +1 -1
- package/index.js +1 -1
- package/language/javascript/RelayFlowTypeTransformers.js.flow +3 -3
- package/lib/codegen/NormalizationCodeGenerator.js +2 -3
- package/lib/codegen/createPrintRequireModuleDependency.js +2 -2
- package/lib/codegen/writeRelayGeneratedFile.js +1 -1
- package/lib/transforms/ClientExtensionsTransform.js +1 -0
- package/lib/transforms/ConnectionTransform.js +6 -2
- package/lib/transforms/DeclarativeConnectionMutationTransform.js +5 -2
- package/lib/transforms/DeferStreamTransform.js +2 -1
- package/lib/transforms/DisallowIdAsAlias.js +2 -1
- package/lib/transforms/FieldHandleTransform.js +3 -1
- package/lib/transforms/FlattenTransform.js +3 -1
- package/lib/transforms/GenerateIDFieldTransform.js +3 -1
- package/lib/transforms/GenerateTypeNameTransform.js +9 -3
- package/lib/transforms/InlineDataFragmentTransform.js +6 -2
- package/lib/transforms/InlineFragmentsTransform.js +4 -2
- package/lib/transforms/MaskTransform.js +7 -3
- package/lib/transforms/MatchTransform.js +5 -1
- package/lib/transforms/ReactFlightComponentTransform.js +3 -0
- package/lib/transforms/RelayDirectiveTransform.js +3 -1
- package/lib/transforms/RequiredFieldTransform.js +6 -2
- package/lib/transforms/SkipClientExtensionsTransform.js +3 -0
- package/lib/transforms/SkipHandleFieldTransform.js +1 -0
- package/lib/transforms/SkipRedundantNodesTransform.js +2 -1
- package/lib/transforms/SplitModuleImportTransform.js +4 -1
- package/lib/transforms/TestOperationTransform.js +1 -0
- package/lib/transforms/ValidateRequiredArgumentsTransform.js +5 -1
- package/lib/transforms/ValidateServerOnlyDirectivesTransform.js +4 -1
- package/lib/util/areEqualArgValues.js +2 -1
- package/package.json +7 -7
- package/relay-compiler.js +3 -3
- package/relay-compiler.min.js +3 -3
- package/transforms/ClientExtensionsTransform.js.flow +1 -0
- package/transforms/ConnectionTransform.js.flow +4 -0
- package/transforms/DeclarativeConnectionMutationTransform.js.flow +3 -0
- package/transforms/DeferStreamTransform.js.flow +1 -0
- package/transforms/DisallowIdAsAlias.js.flow +1 -0
- package/transforms/FieldHandleTransform.js.flow +2 -0
- package/transforms/FlattenTransform.js.flow +2 -0
- package/transforms/GenerateIDFieldTransform.js.flow +2 -0
- package/transforms/GenerateTypeNameTransform.js.flow +6 -0
- package/transforms/InlineDataFragmentTransform.js.flow +4 -0
- package/transforms/InlineFragmentsTransform.js.flow +2 -0
- package/transforms/MaskTransform.js.flow +4 -0
- package/transforms/MatchTransform.js.flow +4 -0
- package/transforms/ReactFlightComponentTransform.js.flow +3 -0
- package/transforms/RelayDirectiveTransform.js.flow +2 -0
- package/transforms/RequiredFieldTransform.js.flow +4 -0
- package/transforms/SkipClientExtensionsTransform.js.flow +3 -0
- package/transforms/SkipHandleFieldTransform.js.flow +1 -0
- package/transforms/SkipRedundantNodesTransform.js.flow +1 -0
- package/transforms/SplitModuleImportTransform.js.flow +3 -0
- package/transforms/TestOperationTransform.js.flow +1 -0
- package/transforms/ValidateRequiredArgumentsTransform.js.flow +4 -0
- package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +3 -0
- package/util/areEqualArgValues.js.flow +1 -0
@@ -74,6 +74,7 @@ var SCHEMA_EXTENSION = "\n directive @connection(\n key: String!\n filter
|
|
74
74
|
*/
|
75
75
|
|
76
76
|
function visitFragmentOrRoot(node, options) {
|
77
|
+
// $FlowFixMe[incompatible-use]
|
77
78
|
var transformedNode = this.traverse(node, options);
|
78
79
|
var connectionMetadata = options.connectionMetadata;
|
79
80
|
|
@@ -95,11 +96,13 @@ function visitFragmentOrRoot(node, options) {
|
|
95
96
|
function visitLinkedField(field, options) {
|
96
97
|
var _connectionArguments$;
|
97
98
|
|
99
|
+
// $FlowFixMe[incompatible-use]
|
98
100
|
var context = this.getContext();
|
99
101
|
var schema = context.getSchema();
|
100
102
|
var nullableType = schema.getNullableType(field.type);
|
101
103
|
var isPlural = schema.isList(nullableType);
|
102
|
-
var path = options.path.concat(isPlural ? null : field.alias || field.name);
|
104
|
+
var path = options.path.concat(isPlural ? null : field.alias || field.name); // $FlowFixMe[incompatible-use]
|
105
|
+
|
103
106
|
var transformedField = this.traverse(field, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, options), {}, {
|
104
107
|
path: path
|
105
108
|
}));
|
@@ -129,7 +132,8 @@ function visitLinkedField(field, options) {
|
|
129
132
|
var direction = connectionMetadata.direction;
|
130
133
|
|
131
134
|
if (direction != null) {
|
132
|
-
var selections = transformConnectionSelections(
|
135
|
+
var selections = transformConnectionSelections( // $FlowFixMe[incompatible-use]
|
136
|
+
this.getContext(), transformedField, schema.assertCompositeType(nullableType), direction, connectionArguments, connectionDirective.loc, options.documentName);
|
133
137
|
transformedField = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, transformedField), {}, {
|
134
138
|
selections: selections
|
135
139
|
});
|
@@ -74,7 +74,8 @@ function visitScalarField(field) {
|
|
74
74
|
|
75
75
|
if (targetDirective == null) {
|
76
76
|
return field;
|
77
|
-
}
|
77
|
+
} // $FlowFixMe[incompatible-use]
|
78
|
+
|
78
79
|
|
79
80
|
var schema = this.getContext().getSchema();
|
80
81
|
|
@@ -101,6 +102,7 @@ function visitScalarField(field) {
|
|
101
102
|
}
|
102
103
|
|
103
104
|
function visitLinkedField(field) {
|
105
|
+
// $FlowFixMe[incompatible-use]
|
104
106
|
var transformedField = this.traverse(field);
|
105
107
|
var deleteDirective = transformedField.directives.find(function (directive) {
|
106
108
|
return directive.name === DELETE_RECORD;
|
@@ -132,7 +134,8 @@ function visitLinkedField(field) {
|
|
132
134
|
|
133
135
|
if (connectionsArg == null) {
|
134
136
|
throw createUserError("Expected the 'connections' argument to be defined on @".concat(targetDirective.name, "."), [targetDirective.loc]);
|
135
|
-
}
|
137
|
+
} // $FlowFixMe[incompatible-use]
|
138
|
+
|
136
139
|
|
137
140
|
var schema = this.getContext().getSchema();
|
138
141
|
|
@@ -140,7 +140,8 @@ function visitScalarField(field, state) {
|
|
140
140
|
|
141
141
|
if (streamDirective != null) {
|
142
142
|
throw createUserError("Invalid use of @stream on scalar field '".concat(field.name, "'"), [streamDirective.loc]);
|
143
|
-
}
|
143
|
+
} // $FlowFixMe[incompatible-use]
|
144
|
+
|
144
145
|
|
145
146
|
return this.traverse(field, state);
|
146
147
|
}
|
@@ -18,7 +18,8 @@ var _require = require('../core/CompilerError'),
|
|
18
18
|
function visitField(field) {
|
19
19
|
if (field.alias === 'id' && field.name !== 'id') {
|
20
20
|
throw createUserError('Relay does not allow aliasing fields to `id`. ' + 'This name is reserved for the globally unique `id` field on ' + '`Node`.', [field.loc]);
|
21
|
-
}
|
21
|
+
} // $FlowFixMe[incompatible-use]
|
22
|
+
|
22
23
|
|
23
24
|
return this.traverse(field);
|
24
25
|
}
|
@@ -37,6 +37,7 @@ function fieldHandleTransform(context) {
|
|
37
37
|
|
38
38
|
|
39
39
|
function visitField(field) {
|
40
|
+
// $FlowFixMe[incompatible-use]
|
40
41
|
var nextField = field.kind === 'LinkedField' ? this.traverse(field) : field;
|
41
42
|
var handles = nextField.handles;
|
42
43
|
|
@@ -45,7 +46,8 @@ function visitField(field) {
|
|
45
46
|
} // ensure exactly one handle
|
46
47
|
|
47
48
|
|
48
|
-
!(handles.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'FieldHandleTransform: Expected fields to have at most one ' + '"handle" property, got `%s`.', handles.join(', ')) : invariant(false) : void 0;
|
49
|
+
!(handles.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'FieldHandleTransform: Expected fields to have at most one ' + '"handle" property, got `%s`.', handles.join(', ')) : invariant(false) : void 0; // $FlowFixMe[incompatible-use]
|
50
|
+
|
49
51
|
var context = this.getContext();
|
50
52
|
var schema = context.getSchema();
|
51
53
|
var alias = nextField.alias;
|
@@ -54,6 +54,7 @@ function flattenTransformImpl(context, options) {
|
|
54
54
|
|
55
55
|
function memoizedFlattenSelection(cache) {
|
56
56
|
return function flattenSelectionsFn(node, state) {
|
57
|
+
// $FlowFixMe[incompatible-use]
|
57
58
|
var context = this.getContext();
|
58
59
|
var nodeCache = cache.get(node);
|
59
60
|
|
@@ -84,7 +85,8 @@ function memoizedFlattenSelection(cache) {
|
|
84
85
|
var flattenedNode = hasFlattened ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, node), {}, {
|
85
86
|
selections: Array.from(nextSelections.values())
|
86
87
|
}) : node;
|
87
|
-
state.parentType = type;
|
88
|
+
state.parentType = type; // $FlowFixMe[incompatible-use]
|
89
|
+
|
88
90
|
var deeplyFlattenedNode = this.traverse(flattenedNode, state);
|
89
91
|
state.parentType = parentType;
|
90
92
|
nodeCache.set(parentType, deeplyFlattenedNode);
|
@@ -80,11 +80,13 @@ function generateIDFieldTransform(context) {
|
|
80
80
|
}
|
81
81
|
|
82
82
|
function visitLinkedField(field, state) {
|
83
|
+
// $FlowFixMe[incompatible-use]
|
83
84
|
var transformedNode = this.traverse(field, state); // If the field already has an unaliased `id` field, do nothing
|
84
85
|
|
85
86
|
if (hasUnaliasedSelection(field, ID)) {
|
86
87
|
return transformedNode;
|
87
|
-
}
|
88
|
+
} // $FlowFixMe[incompatible-use]
|
89
|
+
|
88
90
|
|
89
91
|
var context = this.getContext();
|
90
92
|
var schema = context.getSchema();
|
@@ -58,8 +58,10 @@ function generateTypeNameTransform(context) {
|
|
58
58
|
}
|
59
59
|
|
60
60
|
function visitFragment(fragment, state) {
|
61
|
+
// $FlowFixMe[incompatible-use]
|
61
62
|
var schema = this.getContext().getSchema();
|
62
|
-
var rawType = schema.getRawType(fragment.type);
|
63
|
+
var rawType = schema.getRawType(fragment.type); // $FlowFixMe[incompatible-use]
|
64
|
+
|
63
65
|
var transformedNode = this.traverse(fragment, state);
|
64
66
|
var isClientType = !schema.isServerType(rawType);
|
65
67
|
|
@@ -88,6 +90,7 @@ function visitFragment(fragment, state) {
|
|
88
90
|
}
|
89
91
|
|
90
92
|
function visitInlineFragment(fragment, state) {
|
93
|
+
// $FlowFixMe[incompatible-use]
|
91
94
|
var schema = this.getContext().getSchema();
|
92
95
|
var transformedNode = cache.get(fragment);
|
93
96
|
|
@@ -95,7 +98,8 @@ function visitInlineFragment(fragment, state) {
|
|
95
98
|
return transformedNode;
|
96
99
|
}
|
97
100
|
|
98
|
-
var rawType = schema.getRawType(fragment.typeCondition);
|
101
|
+
var rawType = schema.getRawType(fragment.typeCondition); // $FlowFixMe[incompatible-use]
|
102
|
+
|
99
103
|
transformedNode = this.traverse(fragment, state);
|
100
104
|
var isClientType = !schema.isServerType(rawType);
|
101
105
|
|
@@ -125,12 +129,14 @@ function visitInlineFragment(fragment, state) {
|
|
125
129
|
}
|
126
130
|
|
127
131
|
function visitLinkedField(field, state) {
|
132
|
+
// $FlowFixMe[incompatible-use]
|
128
133
|
var schema = this.getContext().getSchema();
|
129
134
|
var transformedNode = cache.get(field);
|
130
135
|
|
131
136
|
if (transformedNode != null && transformedNode.kind === 'LinkedField') {
|
132
137
|
return transformedNode;
|
133
|
-
}
|
138
|
+
} // $FlowFixMe[incompatible-use]
|
139
|
+
|
134
140
|
|
135
141
|
transformedNode = this.traverse(field, state);
|
136
142
|
|
@@ -36,6 +36,7 @@ function inlineDataFragmentTransform(context) {
|
|
36
36
|
}
|
37
37
|
|
38
38
|
function visitFragment(fragment) {
|
39
|
+
// $FlowFixMe[incompatible-use]
|
39
40
|
var transformedFragment = this.traverse(fragment);
|
40
41
|
var inlineDirective = transformedFragment.directives.find(function (directive) {
|
41
42
|
return directive.name === 'inline';
|
@@ -56,7 +57,9 @@ function visitFragment(fragment) {
|
|
56
57
|
}
|
57
58
|
|
58
59
|
function visitFragmentSpread(fragmentSpread) {
|
59
|
-
|
60
|
+
// $FlowFixMe[incompatible-use]
|
61
|
+
var transformedFragmentSpread = this.traverse(fragmentSpread); // $FlowFixMe[incompatible-use]
|
62
|
+
|
60
63
|
var context = this.getContext();
|
61
64
|
var fragment = context.get(transformedFragmentSpread.name);
|
62
65
|
|
@@ -72,7 +75,8 @@ function visitFragmentSpread(fragmentSpread) {
|
|
72
75
|
|
73
76
|
if (transformedFragmentSpread.directives.length > 0) {
|
74
77
|
throw createUserError('Directives on fragment spreads for @inline fragments are not yet ' + 'supported', [transformedFragmentSpread.loc]);
|
75
|
-
}
|
78
|
+
} // $FlowFixMe[incompatible-use]
|
79
|
+
|
76
80
|
|
77
81
|
var transformedFragment = this.visit(fragment);
|
78
82
|
return {
|
@@ -37,7 +37,8 @@ function fragmentSpreadVisitor(cache) {
|
|
37
37
|
return traverseResult;
|
38
38
|
}
|
39
39
|
|
40
|
-
!(fragmentSpread.args.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'InlineFragmentsTransform: Cannot flatten fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : invariant(false) : void 0;
|
40
|
+
!(fragmentSpread.args.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'InlineFragmentsTransform: Cannot flatten fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : invariant(false) : void 0; // $FlowFixMe[incompatible-use]
|
41
|
+
|
41
42
|
var fragment = this.getContext().getFragment(fragmentSpread.name, fragmentSpread.loc);
|
42
43
|
var result = {
|
43
44
|
kind: 'InlineFragment',
|
@@ -49,7 +50,8 @@ function fragmentSpreadVisitor(cache) {
|
|
49
50
|
metadata: fragmentSpread.metadata,
|
50
51
|
selections: fragment.selections,
|
51
52
|
typeCondition: fragment.type
|
52
|
-
};
|
53
|
+
}; // $FlowFixMe[incompatible-use]
|
54
|
+
|
53
55
|
traverseResult = this.traverse(result);
|
54
56
|
cache.set(fragmentSpread, traverseResult);
|
55
57
|
return traverseResult;
|
@@ -41,13 +41,15 @@ function maskTransform(context) {
|
|
41
41
|
}
|
42
42
|
|
43
43
|
function visitFragment(fragment, state) {
|
44
|
+
// $FlowFixMe[incompatible-use]
|
44
45
|
var result = this.traverse(fragment, state);
|
45
46
|
|
46
47
|
if (state.reachableArguments.length === 0) {
|
47
48
|
return result;
|
48
49
|
}
|
49
50
|
|
50
|
-
var joinedArgumentDefinitions = joinArgumentDefinitions(
|
51
|
+
var joinedArgumentDefinitions = joinArgumentDefinitions( // $FlowFixMe[incompatible-use]
|
52
|
+
this.getContext().getSchema(), fragment, state.reachableArguments, '@relay(unmask: true)');
|
51
53
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, result), {}, {
|
52
54
|
argumentDefinitions: joinedArgumentDefinitions
|
53
55
|
});
|
@@ -58,7 +60,8 @@ function visitFragmentSpread(fragmentSpread, state) {
|
|
58
60
|
return fragmentSpread;
|
59
61
|
}
|
60
62
|
|
61
|
-
!(fragmentSpread.args.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MaskTransform: Cannot unmask fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : invariant(false) : void 0;
|
63
|
+
!(fragmentSpread.args.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'MaskTransform: Cannot unmask fragment spread `%s` with ' + 'arguments. Use the `ApplyFragmentArgumentTransform` before flattening', fragmentSpread.name) : invariant(false) : void 0; // $FlowFixMe[incompatible-use]
|
64
|
+
|
62
65
|
var context = this.getContext();
|
63
66
|
var fragment = context.getFragment(fragmentSpread.name);
|
64
67
|
var result = {
|
@@ -94,7 +97,8 @@ function visitFragmentSpread(fragmentSpread, state) {
|
|
94
97
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
95
98
|
var argDef = _step.value;
|
96
99
|
state.reachableArguments.push(argDef);
|
97
|
-
}
|
100
|
+
} // $FlowFixMe[incompatible-use]
|
101
|
+
|
98
102
|
} catch (err) {
|
99
103
|
_iterator.e(err);
|
100
104
|
} finally {
|
@@ -60,12 +60,14 @@ function matchTransform(context) {
|
|
60
60
|
}
|
61
61
|
|
62
62
|
function visitInlineFragment(node, state) {
|
63
|
+
// $FlowFixMe[incompatible-use]
|
63
64
|
return this.traverse(node, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
|
64
65
|
parentType: node.typeCondition
|
65
66
|
}));
|
66
67
|
}
|
67
68
|
|
68
69
|
function visitScalarField(field) {
|
70
|
+
// $FlowFixMe[incompatible-use]
|
69
71
|
var context = this.getContext();
|
70
72
|
var schema = context.getSchema();
|
71
73
|
|
@@ -85,6 +87,7 @@ function visitScalarField(field) {
|
|
85
87
|
}
|
86
88
|
|
87
89
|
function visitLinkedField(node, state) {
|
90
|
+
// $FlowFixMe[incompatible-use]
|
88
91
|
var context = this.getContext();
|
89
92
|
var schema = context.getSchema();
|
90
93
|
var matchDirective = node.directives.find(function (directive) {
|
@@ -106,7 +109,8 @@ function visitLinkedField(node, state) {
|
|
106
109
|
}
|
107
110
|
}
|
108
111
|
|
109
|
-
state.path.push(node);
|
112
|
+
state.path.push(node); // $FlowFixMe[incompatible-use]
|
113
|
+
|
110
114
|
var transformedNode = this.traverse(node, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
|
111
115
|
moduleKey: moduleKey,
|
112
116
|
parentType: node.type
|
@@ -62,6 +62,7 @@ function reactFlightComponentTransform(context) {
|
|
62
62
|
function visitInlineFragment(fragment, state) {
|
63
63
|
var _fragment$typeConditi;
|
64
64
|
|
65
|
+
// $FlowFixMe[incompatible-use]
|
65
66
|
return this.traverse(fragment, {
|
66
67
|
parentType: (_fragment$typeConditi = fragment.typeCondition) !== null && _fragment$typeConditi !== void 0 ? _fragment$typeConditi : state.parentType,
|
67
68
|
types: state.types
|
@@ -69,6 +70,7 @@ function visitInlineFragment(fragment, state) {
|
|
69
70
|
}
|
70
71
|
|
71
72
|
function visitLinkedField(field, state) {
|
73
|
+
// $FlowFixMe[incompatible-use]
|
72
74
|
return this.traverse(field, {
|
73
75
|
parentType: field.type,
|
74
76
|
types: state.types
|
@@ -77,6 +79,7 @@ function visitLinkedField(field, state) {
|
|
77
79
|
|
78
80
|
function visitScalarField(field, state) {
|
79
81
|
// use the return type to quickly determine if this is a flight field
|
82
|
+
// $FlowFixMe[incompatible-use]
|
80
83
|
var schema = this.getContext().getSchema();
|
81
84
|
|
82
85
|
if (schema.getRawType(field.type) !== state.types.componentType) {
|
@@ -42,11 +42,13 @@ function visitRelayMetadata(metadataFn) {
|
|
42
42
|
});
|
43
43
|
|
44
44
|
if (!relayDirective) {
|
45
|
+
// $FlowFixMe[incompatible-use]
|
45
46
|
return this.traverse(node);
|
46
47
|
}
|
47
48
|
|
48
49
|
var argValues = getLiteralArgumentValues(relayDirective.args);
|
49
|
-
var metadata = metadataFn(argValues);
|
50
|
+
var metadata = metadataFn(argValues); // $FlowFixMe[incompatible-use]
|
51
|
+
|
50
52
|
return this.traverse((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, node), {}, {
|
51
53
|
directives: node.directives.filter(function (directive) {
|
52
54
|
return directive !== relayDirective;
|
@@ -58,10 +58,12 @@ function requiredFieldTransform(context) {
|
|
58
58
|
}
|
59
59
|
|
60
60
|
function visitFragment(fragment, state) {
|
61
|
+
// $FlowFixMe[incompatible-use]
|
61
62
|
return addChildrenCanBubbleMetadata(this.traverse(fragment, state), state);
|
62
63
|
}
|
63
64
|
|
64
65
|
function visitRoot(root, state) {
|
66
|
+
// $FlowFixMe[incompatible-use]
|
65
67
|
return addChildrenCanBubbleMetadata(this.traverse(root, state), state);
|
66
68
|
}
|
67
69
|
|
@@ -71,7 +73,8 @@ function visitInlineFragment(fragment, state) {
|
|
71
73
|
// Ideally we could allow @required when the direct parent inline fragment was
|
72
74
|
// on a concrete type, but we would need to solve this bug in our Flow type
|
73
75
|
// generation first: T65695438
|
74
|
-
var parentAbstractInlineFragment = (_state$parentAbstract = state.parentAbstractInlineFragment) !== null && _state$parentAbstract !== void 0 ? _state$parentAbstract : getAbstractInlineFragment(fragment, state.schema);
|
76
|
+
var parentAbstractInlineFragment = (_state$parentAbstract = state.parentAbstractInlineFragment) !== null && _state$parentAbstract !== void 0 ? _state$parentAbstract : getAbstractInlineFragment(fragment, state.schema); // $FlowFixMe[incompatible-use]
|
77
|
+
|
75
78
|
return this.traverse(fragment, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
|
76
79
|
parentAbstractInlineFragment: parentAbstractInlineFragment
|
77
80
|
}));
|
@@ -111,7 +114,8 @@ function visitLinkedField(field, state) {
|
|
111
114
|
currentNodeRequiredChildren: new Map(),
|
112
115
|
path: path,
|
113
116
|
parentAbstractInlineFragment: null
|
114
|
-
});
|
117
|
+
}); // $FlowFixMe[incompatible-use]
|
118
|
+
|
115
119
|
var newField = this.traverse(field, newState);
|
116
120
|
var pathName = path.join('.');
|
117
121
|
assertCompatibleRequiredChildren(field, pathName, newState);
|
@@ -21,9 +21,11 @@ function skipClientExtensionTransform(context) {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
function visitFragment(node) {
|
24
|
+
// $FlowFixMe[incompatible-use]
|
24
25
|
var context = this.getContext();
|
25
26
|
|
26
27
|
if (context.getSchema().isServerType(node.type)) {
|
28
|
+
// $FlowFixMe[incompatible-use]
|
27
29
|
return this.traverse(node);
|
28
30
|
}
|
29
31
|
|
@@ -31,6 +33,7 @@ function visitFragment(node) {
|
|
31
33
|
}
|
32
34
|
|
33
35
|
function vistFragmentSpread(node) {
|
36
|
+
// $FlowFixMe[incompatible-use]
|
34
37
|
var context = this.getContext();
|
35
38
|
var fragment = context.getFragment(node.name, node.loc);
|
36
39
|
var isServer = context.getSchema().isServerType(fragment.type);
|
@@ -128,7 +128,8 @@ function skipRedundantNodesTransform(context) {
|
|
128
128
|
var cache = new Map();
|
129
129
|
|
130
130
|
function visitNode(node) {
|
131
|
-
cache = new Map();
|
131
|
+
cache = new Map(); // $FlowFixMe[incompatible-use]
|
132
|
+
|
132
133
|
var context = this.getContext();
|
133
134
|
return transformNode(context.getSchema(), node, new IMap()).node;
|
134
135
|
}
|
@@ -33,6 +33,7 @@ function splitMatchTransform(context) {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
function visitLinkedField(field, state) {
|
36
|
+
// $FlowFixMe[incompatible-use]
|
36
37
|
return this.traverse(field, {
|
37
38
|
parentType: field.type,
|
38
39
|
splitOperations: state.splitOperations
|
@@ -40,6 +41,7 @@ function visitLinkedField(field, state) {
|
|
40
41
|
}
|
41
42
|
|
42
43
|
function visitInlineFragment(fragment, state) {
|
44
|
+
// $FlowFixMe[incompatible-use]
|
43
45
|
return this.traverse(fragment, {
|
44
46
|
parentType: fragment.typeCondition,
|
45
47
|
splitOperations: state.splitOperations
|
@@ -56,7 +58,8 @@ function visitModuleImport(node, state) {
|
|
56
58
|
if (createdSplitOperation) {
|
57
59
|
createdSplitOperation.parentSources.add(node.sourceDocument);
|
58
60
|
return node;
|
59
|
-
}
|
61
|
+
} // $FlowFixMe[incompatible-use]
|
62
|
+
|
60
63
|
|
61
64
|
var transformedNode = this.traverse(node, state);
|
62
65
|
var splitOperation = {
|
@@ -48,6 +48,7 @@ function getTypeDetails(schema, fieldType) {
|
|
48
48
|
}
|
49
49
|
|
50
50
|
function visitRoot(node) {
|
51
|
+
// $FlowFixMe[incompatible-use]
|
51
52
|
var schema = this.getContext().getSchema();
|
52
53
|
var testDirective = node.directives.find(function (directive) {
|
53
54
|
return directive.name === 'relay_test_operation';
|
@@ -43,6 +43,7 @@ function validateRequiredArguments(context) {
|
|
43
43
|
|
44
44
|
function visitDirective(node, _ref) {
|
45
45
|
var rootNode = _ref.rootNode;
|
46
|
+
// $FlowFixMe[incompatible-use]
|
46
47
|
var context = this.getContext();
|
47
48
|
var directiveDef = context.getSchema().getDirective(node.name);
|
48
49
|
|
@@ -55,6 +56,7 @@ function visitDirective(node, _ref) {
|
|
55
56
|
|
56
57
|
function visitInlineFragment(fragment, _ref2) {
|
57
58
|
var rootNode = _ref2.rootNode;
|
59
|
+
// $FlowFixMe[incompatible-use]
|
58
60
|
this.traverse(fragment, {
|
59
61
|
rootNode: rootNode,
|
60
62
|
parentType: fragment.typeCondition
|
@@ -64,6 +66,7 @@ function visitInlineFragment(fragment, _ref2) {
|
|
64
66
|
function visitField(node, _ref3) {
|
65
67
|
var parentType = _ref3.parentType,
|
66
68
|
rootNode = _ref3.rootNode;
|
69
|
+
// $FlowFixMe[incompatible-use]
|
67
70
|
var context = this.getContext();
|
68
71
|
var schema = context.getSchema();
|
69
72
|
var definition = getFieldDefinitionStrict(schema, parentType, node.name);
|
@@ -78,7 +81,8 @@ function visitField(node, _ref3) {
|
|
78
81
|
}
|
79
82
|
} else {
|
80
83
|
validateRequiredArgumentsOnNode(schema, node, schema.getFieldConfig(definition).args, rootNode);
|
81
|
-
}
|
84
|
+
} // $FlowFixMe[incompatible-use]
|
85
|
+
|
82
86
|
|
83
87
|
this.traverse(node, {
|
84
88
|
rootNode: rootNode,
|
@@ -54,6 +54,7 @@ function visitLinkedField(node, state) {
|
|
54
54
|
try {
|
55
55
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
56
56
|
var selection = _step.value;
|
57
|
+
// $FlowFixMe[incompatible-use]
|
57
58
|
this.visit(selection, state);
|
58
59
|
}
|
59
60
|
} catch (err) {
|
@@ -70,6 +71,7 @@ function visitClientExtension(node, state) {
|
|
70
71
|
try {
|
71
72
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
72
73
|
var selection = _step2.value;
|
74
|
+
// $FlowFixMe[incompatible-use]
|
73
75
|
this.visit(selection, {
|
74
76
|
rootClientSelection: selection
|
75
77
|
});
|
@@ -94,7 +96,8 @@ function visitTransformedDirective(node, state) {
|
|
94
96
|
|
95
97
|
var clientExtension = node.selections[0];
|
96
98
|
throwError("@".concat(NODEKIND_DIRECTIVE_MAP[node.kind]), node.loc, clientExtension && clientExtension.kind === 'ClientExtension' ? (_clientExtension$sele = clientExtension.selections[0]) === null || _clientExtension$sele === void 0 ? void 0 : _clientExtension$sele.loc : null);
|
97
|
-
}
|
99
|
+
} // $FlowFixMe[incompatible-use]
|
100
|
+
|
98
101
|
|
99
102
|
this.traverse(node, state);
|
100
103
|
}
|
@@ -46,7 +46,8 @@ function eq(a, b, aStack, bStack) {
|
|
46
46
|
|
47
47
|
if (typeof a !== 'object' || typeof b !== 'object') {
|
48
48
|
return false;
|
49
|
-
}
|
49
|
+
} // $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
50
|
+
|
50
51
|
|
51
52
|
var objToStr = Object.prototype.toString;
|
52
53
|
var className = objToStr.call(a);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "relay-compiler",
|
3
3
|
"description": "A compiler tool for building GraphQL-driven applications.",
|
4
|
-
"version": "
|
4
|
+
"version": "12.0.0",
|
5
5
|
"keywords": [
|
6
6
|
"graphql",
|
7
7
|
"relay"
|
@@ -15,13 +15,13 @@
|
|
15
15
|
"relay-compiler": "bin/relay-compiler"
|
16
16
|
},
|
17
17
|
"dependencies": {
|
18
|
-
"@babel/core": "^7.
|
19
|
-
"@babel/generator": "^7.
|
20
|
-
"@babel/parser": "^7.
|
18
|
+
"@babel/core": "^7.14.0",
|
19
|
+
"@babel/generator": "^7.14.0",
|
20
|
+
"@babel/parser": "^7.14.0",
|
21
21
|
"@babel/runtime": "^7.0.0",
|
22
|
-
"@babel/traverse": "^7.
|
22
|
+
"@babel/traverse": "^7.14.0",
|
23
23
|
"@babel/types": "^7.0.0",
|
24
|
-
"babel-preset-fbjs": "^3.
|
24
|
+
"babel-preset-fbjs": "^3.4.0",
|
25
25
|
"chalk": "^4.0.0",
|
26
26
|
"fb-watchman": "^2.0.0",
|
27
27
|
"fbjs": "^3.0.0",
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"immutable": "~3.7.6",
|
30
30
|
"invariant": "^2.2.4",
|
31
31
|
"nullthrows": "^1.1.1",
|
32
|
-
"relay-runtime": "
|
32
|
+
"relay-runtime": "12.0.0",
|
33
33
|
"signedsource": "^1.0.0",
|
34
34
|
"yargs": "^15.3.1"
|
35
35
|
},
|