relay-compiler 0.0.0-main-4d287de9 → 0.0.0-main-9a79039d
Sign up to get free protection for your applications and to get access to all the features.
- package/cli.js +23 -0
- package/index.js +19 -3
- package/linux-x64/relay +0 -0
- package/macos-x64/relay +0 -0
- package/package.json +2 -26
- package/win-x64/relay.exe +0 -0
- package/bin/RelayCompilerBin.js.flow +0 -168
- package/bin/RelayCompilerMain.js.flow +0 -513
- package/bin/__fixtures__/plugin-module.js.flow +0 -17
- package/bin/relay-compiler +0 -19066
- package/codegen/CodegenDirectory.js.flow +0 -372
- package/codegen/CodegenRunner.js.flow +0 -424
- package/codegen/CodegenTypes.js.flow +0 -28
- package/codegen/CodegenWatcher.js.flow +0 -250
- package/codegen/NormalizationCodeGenerator.js.flow +0 -565
- package/codegen/ReaderCodeGenerator.js.flow +0 -510
- package/codegen/RelayCodeGenerator.js.flow +0 -85
- package/codegen/RelayFileWriter.js.flow +0 -365
- package/codegen/SourceControl.js.flow +0 -58
- package/codegen/compileRelayArtifacts.js.flow +0 -181
- package/codegen/createPrintRequireModuleDependency.js.flow +0 -19
- package/codegen/sortObjectByKey.js.flow +0 -25
- package/codegen/writeRelayGeneratedFile.js.flow +0 -235
- package/core/ASTCache.js.flow +0 -73
- package/core/ASTConvert.js.flow +0 -230
- package/core/CompilerContext.js.flow +0 -189
- package/core/CompilerError.js.flow +0 -255
- package/core/DotGraphQLParser.js.flow +0 -37
- package/core/GraphQLCompilerProfiler.js.flow +0 -341
- package/core/GraphQLDerivedFromMetadata.js.flow +0 -36
- package/core/GraphQLWatchmanClient.js.flow +0 -109
- package/core/IR.js.flow +0 -326
- package/core/IRPrinter.js.flow +0 -472
- package/core/IRTransformer.js.flow +0 -376
- package/core/IRValidator.js.flow +0 -259
- package/core/IRVisitor.js.flow +0 -150
- package/core/JSModuleParser.js.flow +0 -24
- package/core/RelayCompilerScope.js.flow +0 -199
- package/core/RelayFindGraphQLTags.js.flow +0 -118
- package/core/RelayGraphQLEnumsGenerator.js.flow +0 -55
- package/core/RelayIRTransforms.js.flow +0 -138
- package/core/RelayParser.js.flow +0 -1731
- package/core/RelaySourceModuleParser.js.flow +0 -133
- package/core/Schema.js.flow +0 -2035
- package/core/SchemaUtils.js.flow +0 -120
- package/core/filterContextForNode.js.flow +0 -49
- package/core/getFieldDefinition.js.flow +0 -156
- package/core/getIdentifierForArgumentValue.js.flow +0 -49
- package/core/getIdentifierForSelection.js.flow +0 -68
- package/core/getLiteralArgumentValues.js.flow +0 -32
- package/core/getNormalizationOperationName.js.flow +0 -19
- package/core/inferRootArgumentDefinitions.js.flow +0 -322
- package/index.js.flow +0 -198
- package/language/RelayLanguagePluginInterface.js.flow +0 -283
- package/language/javascript/FindGraphQLTags.js.flow +0 -136
- package/language/javascript/RelayFlowBabelFactories.js.flow +0 -176
- package/language/javascript/RelayFlowGenerator.js.flow +0 -1096
- package/language/javascript/RelayFlowTypeTransformers.js.flow +0 -181
- package/language/javascript/RelayLanguagePluginJavaScript.js.flow +0 -33
- package/language/javascript/formatGeneratedModule.js.flow +0 -65
- package/lib/bin/RelayCompilerBin.js +0 -143
- package/lib/bin/RelayCompilerMain.js +0 -486
- package/lib/bin/__fixtures__/plugin-module.js +0 -16
- package/lib/codegen/CodegenDirectory.js +0 -335
- package/lib/codegen/CodegenRunner.js +0 -433
- package/lib/codegen/CodegenTypes.js +0 -11
- package/lib/codegen/CodegenWatcher.js +0 -271
- package/lib/codegen/NormalizationCodeGenerator.js +0 -487
- package/lib/codegen/ReaderCodeGenerator.js +0 -473
- package/lib/codegen/RelayCodeGenerator.js +0 -75
- package/lib/codegen/RelayFileWriter.js +0 -270
- package/lib/codegen/SourceControl.js +0 -60
- package/lib/codegen/compileRelayArtifacts.js +0 -157
- package/lib/codegen/createPrintRequireModuleDependency.js +0 -19
- package/lib/codegen/sortObjectByKey.js +0 -41
- package/lib/codegen/writeRelayGeneratedFile.js +0 -206
- package/lib/core/ASTCache.js +0 -70
- package/lib/core/ASTConvert.js +0 -198
- package/lib/core/CompilerContext.js +0 -165
- package/lib/core/CompilerError.js +0 -252
- package/lib/core/DotGraphQLParser.js +0 -40
- package/lib/core/GraphQLCompilerProfiler.js +0 -299
- package/lib/core/GraphQLDerivedFromMetadata.js +0 -31
- package/lib/core/GraphQLWatchmanClient.js +0 -150
- package/lib/core/IR.js +0 -11
- package/lib/core/IRPrinter.js +0 -388
- package/lib/core/IRTransformer.js +0 -345
- package/lib/core/IRValidator.js +0 -226
- package/lib/core/IRVisitor.js +0 -45
- package/lib/core/JSModuleParser.js +0 -18
- package/lib/core/RelayCompilerScope.js +0 -183
- package/lib/core/RelayFindGraphQLTags.js +0 -79
- package/lib/core/RelayGraphQLEnumsGenerator.js +0 -50
- package/lib/core/RelayIRTransforms.js +0 -109
- package/lib/core/RelayParser.js +0 -1381
- package/lib/core/RelaySourceModuleParser.js +0 -104
- package/lib/core/Schema.js +0 -1877
- package/lib/core/SchemaUtils.js +0 -98
- package/lib/core/filterContextForNode.js +0 -50
- package/lib/core/getFieldDefinition.js +0 -145
- package/lib/core/getIdentifierForArgumentValue.js +0 -54
- package/lib/core/getIdentifierForSelection.js +0 -49
- package/lib/core/getLiteralArgumentValues.js +0 -26
- package/lib/core/getNormalizationOperationName.js +0 -17
- package/lib/core/inferRootArgumentDefinitions.js +0 -351
- package/lib/index.js +0 -178
- package/lib/language/RelayLanguagePluginInterface.js +0 -26
- package/lib/language/javascript/FindGraphQLTags.js +0 -126
- package/lib/language/javascript/RelayFlowBabelFactories.js +0 -160
- package/lib/language/javascript/RelayFlowGenerator.js +0 -856
- package/lib/language/javascript/RelayFlowTypeTransformers.js +0 -119
- package/lib/language/javascript/RelayLanguagePluginJavaScript.js +0 -30
- package/lib/language/javascript/formatGeneratedModule.js +0 -36
- package/lib/reporters/ConsoleReporter.js +0 -61
- package/lib/reporters/MultiReporter.js +0 -45
- package/lib/reporters/Reporter.js +0 -11
- package/lib/runner/Artifacts.js +0 -323
- package/lib/runner/BufferedFilesystem.js +0 -262
- package/lib/runner/GraphQLASTNodeGroup.js +0 -256
- package/lib/runner/GraphQLASTUtils.js +0 -23
- package/lib/runner/GraphQLNodeMap.js +0 -81
- package/lib/runner/Sources.js +0 -271
- package/lib/runner/StrictMap.js +0 -134
- package/lib/runner/compileArtifacts.js +0 -39
- package/lib/runner/extractAST.js +0 -77
- package/lib/runner/getChangedNodeNames.js +0 -82
- package/lib/runner/getSchemaInstance.js +0 -30
- package/lib/runner/types.js +0 -12
- package/lib/transforms/ApplyFragmentArgumentTransform.js +0 -393
- package/lib/transforms/ClientExtensionsTransform.js +0 -221
- package/lib/transforms/ConnectionTransform.js +0 -639
- package/lib/transforms/DeclarativeConnectionMutationTransform.js +0 -218
- package/lib/transforms/DeferStreamTransform.js +0 -246
- package/lib/transforms/DisallowIdAsAlias.js +0 -40
- package/lib/transforms/DisallowTypenameOnRoot.js +0 -53
- package/lib/transforms/FieldHandleTransform.js +0 -79
- package/lib/transforms/FilterCompilerDirectivesTransform.js +0 -29
- package/lib/transforms/FilterDirectivesTransform.js +0 -42
- package/lib/transforms/FlattenTransform.js +0 -306
- package/lib/transforms/GenerateIDFieldTransform.js +0 -135
- package/lib/transforms/GenerateTypeNameTransform.js +0 -149
- package/lib/transforms/InlineDataFragmentTransform.js +0 -100
- package/lib/transforms/InlineFragmentsTransform.js +0 -61
- package/lib/transforms/MaskTransform.js +0 -117
- package/lib/transforms/MatchTransform.js +0 -434
- package/lib/transforms/ReactFlightComponentTransform.js +0 -158
- package/lib/transforms/RefetchableFragmentTransform.js +0 -249
- package/lib/transforms/RelayDirectiveTransform.js +0 -83
- package/lib/transforms/RequiredFieldTransform.js +0 -369
- package/lib/transforms/SkipClientExtensionsTransform.js +0 -46
- package/lib/transforms/SkipHandleFieldTransform.js +0 -45
- package/lib/transforms/SkipRedundantNodesTransform.js +0 -261
- package/lib/transforms/SkipSplitOperationTransform.js +0 -32
- package/lib/transforms/SkipUnreachableNodeTransform.js +0 -158
- package/lib/transforms/SkipUnusedVariablesTransform.js +0 -75
- package/lib/transforms/SplitModuleImportTransform.js +0 -82
- package/lib/transforms/TestOperationTransform.js +0 -144
- package/lib/transforms/TransformUtils.js +0 -21
- package/lib/transforms/ValidateGlobalVariablesTransform.js +0 -92
- package/lib/transforms/ValidateRequiredArgumentsTransform.js +0 -114
- package/lib/transforms/ValidateServerOnlyDirectivesTransform.js +0 -108
- package/lib/transforms/ValidateUnusedVariablesTransform.js +0 -96
- package/lib/transforms/query-generators/FetchableQueryGenerator.js +0 -157
- package/lib/transforms/query-generators/NodeQueryGenerator.js +0 -166
- package/lib/transforms/query-generators/QueryQueryGenerator.js +0 -48
- package/lib/transforms/query-generators/ViewerQueryGenerator.js +0 -77
- package/lib/transforms/query-generators/index.js +0 -60
- package/lib/transforms/query-generators/utils.js +0 -92
- package/lib/util/CodeMarker.js +0 -80
- package/lib/util/DefaultHandleKey.js +0 -15
- package/lib/util/RelayCompilerCache.js +0 -97
- package/lib/util/Rollout.js +0 -40
- package/lib/util/TimeReporter.js +0 -83
- package/lib/util/areEqualArgValues.js +0 -135
- package/lib/util/argumentContainsVariables.js +0 -37
- package/lib/util/dedupeJSONStringify.js +0 -160
- package/lib/util/generateAbstractTypeRefinementKey.js +0 -24
- package/lib/util/getDefinitionNodeHash.js +0 -22
- package/lib/util/getModuleName.js +0 -32
- package/lib/util/joinArgumentDefinitions.js +0 -67
- package/lib/util/md5.js +0 -17
- package/lib/util/murmurHash.js +0 -86
- package/lib/util/nullthrowsOSS.js +0 -23
- package/lib/util/orList.js +0 -36
- package/lib/util/partitionArray.js +0 -35
- package/relay-compiler.js +0 -17
- package/relay-compiler.min.js +0 -22
- package/reporters/ConsoleReporter.js.flow +0 -81
- package/reporters/MultiReporter.js.flow +0 -43
- package/reporters/Reporter.js.flow +0 -19
- package/runner/Artifacts.js.flow +0 -215
- package/runner/BufferedFilesystem.js.flow +0 -194
- package/runner/GraphQLASTNodeGroup.js.flow +0 -174
- package/runner/GraphQLASTUtils.js.flow +0 -26
- package/runner/GraphQLNodeMap.js.flow +0 -55
- package/runner/Sources.js.flow +0 -227
- package/runner/StrictMap.js.flow +0 -96
- package/runner/compileArtifacts.js.flow +0 -75
- package/runner/extractAST.js.flow +0 -98
- package/runner/getChangedNodeNames.js.flow +0 -48
- package/runner/getSchemaInstance.js.flow +0 -36
- package/runner/types.js.flow +0 -37
- package/transforms/ApplyFragmentArgumentTransform.js.flow +0 -524
- package/transforms/ClientExtensionsTransform.js.flow +0 -224
- package/transforms/ConnectionTransform.js.flow +0 -850
- package/transforms/DeclarativeConnectionMutationTransform.js.flow +0 -245
- package/transforms/DeferStreamTransform.js.flow +0 -263
- package/transforms/DisallowIdAsAlias.js.flow +0 -46
- package/transforms/DisallowTypenameOnRoot.js.flow +0 -44
- package/transforms/FieldHandleTransform.js.flow +0 -77
- package/transforms/FilterCompilerDirectivesTransform.js.flow +0 -33
- package/transforms/FilterDirectivesTransform.js.flow +0 -45
- package/transforms/FlattenTransform.js.flow +0 -458
- package/transforms/GenerateIDFieldTransform.js.flow +0 -151
- package/transforms/GenerateTypeNameTransform.js.flow +0 -159
- package/transforms/InlineDataFragmentTransform.js.flow +0 -123
- package/transforms/InlineFragmentsTransform.js.flow +0 -70
- package/transforms/MaskTransform.js.flow +0 -124
- package/transforms/MatchTransform.js.flow +0 -587
- package/transforms/ReactFlightComponentTransform.js.flow +0 -194
- package/transforms/RefetchableFragmentTransform.js.flow +0 -266
- package/transforms/RelayDirectiveTransform.js.flow +0 -96
- package/transforms/RequiredFieldTransform.js.flow +0 -413
- package/transforms/SkipClientExtensionsTransform.js.flow +0 -54
- package/transforms/SkipHandleFieldTransform.js.flow +0 -44
- package/transforms/SkipRedundantNodesTransform.js.flow +0 -255
- package/transforms/SkipSplitOperationTransform.js.flow +0 -37
- package/transforms/SkipUnreachableNodeTransform.js.flow +0 -148
- package/transforms/SkipUnusedVariablesTransform.js.flow +0 -59
- package/transforms/SplitModuleImportTransform.js.flow +0 -97
- package/transforms/TestOperationTransform.js.flow +0 -142
- package/transforms/TransformUtils.js.flow +0 -26
- package/transforms/ValidateGlobalVariablesTransform.js.flow +0 -80
- package/transforms/ValidateRequiredArgumentsTransform.js.flow +0 -126
- package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +0 -111
- package/transforms/ValidateUnusedVariablesTransform.js.flow +0 -88
- package/transforms/query-generators/FetchableQueryGenerator.js.flow +0 -188
- package/transforms/query-generators/NodeQueryGenerator.js.flow +0 -217
- package/transforms/query-generators/QueryQueryGenerator.js.flow +0 -57
- package/transforms/query-generators/ViewerQueryGenerator.js.flow +0 -97
- package/transforms/query-generators/index.js.flow +0 -89
- package/transforms/query-generators/utils.js.flow +0 -76
- package/util/CodeMarker.js.flow +0 -79
- package/util/DefaultHandleKey.js.flow +0 -17
- package/util/RelayCompilerCache.js.flow +0 -86
- package/util/Rollout.js.flow +0 -39
- package/util/TimeReporter.js.flow +0 -79
- package/util/areEqualArgValues.js.flow +0 -126
- package/util/argumentContainsVariables.js.flow +0 -38
- package/util/dedupeJSONStringify.js.flow +0 -152
- package/util/generateAbstractTypeRefinementKey.js.flow +0 -29
- package/util/getDefinitionNodeHash.js.flow +0 -24
- package/util/getModuleName.js.flow +0 -39
- package/util/joinArgumentDefinitions.js.flow +0 -105
- package/util/md5.js.flow +0 -19
- package/util/murmurHash.js.flow +0 -94
- package/util/nullthrowsOSS.js.flow +0 -25
- package/util/orList.js.flow +0 -37
- package/util/partitionArray.js.flow +0 -37
@@ -1,351 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
// flowlint ambiguous-object-type:error
|
11
|
-
'use strict';
|
12
|
-
|
13
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
14
|
-
|
15
|
-
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
16
|
-
|
17
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
18
|
-
|
19
|
-
var CompilerContext = require('./CompilerContext');
|
20
|
-
|
21
|
-
var _require = require('./CompilerError'),
|
22
|
-
createCompilerError = _require.createCompilerError;
|
23
|
-
|
24
|
-
var IRVisitor = require('./IRVisitor');
|
25
|
-
|
26
|
-
var SchemaUtils = require('./SchemaUtils');
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Returns a transformed version of the input context where each document's
|
30
|
-
* argument definitions are updated to accurately describe the root variables
|
31
|
-
* used (or reachable) from that document:
|
32
|
-
* - Fragment argument definitions are updated to include local argument
|
33
|
-
* definitions and any root variables that are referenced
|
34
|
-
* by the fragment (or any fragments it transitively spreads).
|
35
|
-
* - Root argument definitions are updated to reflect the variables
|
36
|
-
* referenced locally and all root variables referenced by any
|
37
|
-
* fragments it (transitively) spreads.
|
38
|
-
*/
|
39
|
-
function inferRootArgumentDefinitions(context) {
|
40
|
-
// This transform does two main tasks:
|
41
|
-
// - Determine the set of root variables referenced locally in each
|
42
|
-
// fragment. Note that RootArgumentDefinitions in the fragment's
|
43
|
-
// argumentDefinitions can contain spurious entries for legacy
|
44
|
-
// reasons. Instead of using those the fragment is traversed
|
45
|
-
// to reanalyze variable usage.
|
46
|
-
// - Determine the set of root variables that are transitively referenced
|
47
|
-
// by each fragment, ie the union of all root variables used in the
|
48
|
-
// fragment and any fragments it transitively spreads.
|
49
|
-
// Cache fragments as they are transformed to avoid duplicate processing.
|
50
|
-
// Because @argument values don't matter (only variable names/types),
|
51
|
-
// each reachable fragment only has to be checked once.
|
52
|
-
var transformed = new Map();
|
53
|
-
var nextContext = new CompilerContext(context.getSchema());
|
54
|
-
return nextContext.addAll(Array.from(context.documents(), function (node) {
|
55
|
-
switch (node.kind) {
|
56
|
-
case 'Fragment':
|
57
|
-
{
|
58
|
-
var argumentDefinitions = transformFragmentArguments(context, transformed, node);
|
59
|
-
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, node), {}, {
|
60
|
-
argumentDefinitions: Array.from(argumentDefinitions.values())
|
61
|
-
});
|
62
|
-
}
|
63
|
-
|
64
|
-
case 'Root':
|
65
|
-
{
|
66
|
-
return transformRoot(context, transformed, node);
|
67
|
-
}
|
68
|
-
|
69
|
-
case 'SplitOperation':
|
70
|
-
{
|
71
|
-
return node;
|
72
|
-
}
|
73
|
-
|
74
|
-
default:
|
75
|
-
{
|
76
|
-
node;
|
77
|
-
throw createCompilerError("inferRootArgumentDefinitions: Unsupported kind '".concat(node.kind, "'."));
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}));
|
81
|
-
}
|
82
|
-
|
83
|
-
function transformRoot(context, transformed, root) {
|
84
|
-
// Ignore argument definitions, determine what root variables are
|
85
|
-
// transitively referenced
|
86
|
-
var argumentDefinitions = new Map();
|
87
|
-
var localArgumentDefinitions = new Map();
|
88
|
-
|
89
|
-
var _iterator = (0, _createForOfIteratorHelper2["default"])(root.argumentDefinitions.entries()),
|
90
|
-
_step;
|
91
|
-
|
92
|
-
try {
|
93
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
94
|
-
var _step$value = _step.value,
|
95
|
-
name = _step$value[0],
|
96
|
-
argDef = _step$value[1];
|
97
|
-
|
98
|
-
if (argDef.kind === 'LocalArgumentDefinition') {
|
99
|
-
localArgumentDefinitions.set(name, argDef);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
} catch (err) {
|
103
|
-
_iterator.e(err);
|
104
|
-
} finally {
|
105
|
-
_iterator.f();
|
106
|
-
}
|
107
|
-
|
108
|
-
visit(context, transformed, argumentDefinitions, root);
|
109
|
-
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, root), {}, {
|
110
|
-
argumentDefinitions: Array.from(argumentDefinitions.values(), function (argDef) {
|
111
|
-
var _localDefinition$type, _localDefinition$defa;
|
112
|
-
|
113
|
-
if (argDef.kind !== 'RootArgumentDefinition') {
|
114
|
-
throw createCompilerError("inferRootArgumentDefinitions: Expected inferred variable '$".concat(argDef.name, "' to be a root variables."), [argDef.loc]);
|
115
|
-
}
|
116
|
-
|
117
|
-
var localDefinition = localArgumentDefinitions.get(argDef.name);
|
118
|
-
var type = (_localDefinition$type = localDefinition === null || localDefinition === void 0 ? void 0 : localDefinition.type) !== null && _localDefinition$type !== void 0 ? _localDefinition$type : argDef.type;
|
119
|
-
return {
|
120
|
-
defaultValue: (_localDefinition$defa = localDefinition === null || localDefinition === void 0 ? void 0 : localDefinition.defaultValue) !== null && _localDefinition$defa !== void 0 ? _localDefinition$defa : null,
|
121
|
-
kind: 'LocalArgumentDefinition',
|
122
|
-
loc: argDef.loc,
|
123
|
-
name: argDef.name,
|
124
|
-
type: type
|
125
|
-
};
|
126
|
-
})
|
127
|
-
});
|
128
|
-
}
|
129
|
-
|
130
|
-
function transformFragmentArguments(context, transformed, fragment) {
|
131
|
-
var name = fragment.name;
|
132
|
-
var transformedArguments = transformed.get(name);
|
133
|
-
|
134
|
-
if (transformedArguments != null) {
|
135
|
-
return transformedArguments;
|
136
|
-
} // Start with only the explicitly defined local arguments, recover the
|
137
|
-
// correct set of root variables excluding invalid @arguments values.
|
138
|
-
|
139
|
-
|
140
|
-
var argumentDefinitions = new Map();
|
141
|
-
fragment.argumentDefinitions.forEach(function (argDef) {
|
142
|
-
if (argDef.kind === 'LocalArgumentDefinition') {
|
143
|
-
argumentDefinitions.set(argDef.name, argDef);
|
144
|
-
}
|
145
|
-
}); // Break cycles by initially caching a version that only has local
|
146
|
-
// arguments. If the current fragment is reached again, it won't have
|
147
|
-
// any root variables to add to its parents. The traversal below will
|
148
|
-
// find any root variables and update the cached version of the
|
149
|
-
// fragment.
|
150
|
-
|
151
|
-
transformed.set(name, argumentDefinitions);
|
152
|
-
visit(context, transformed, argumentDefinitions, fragment);
|
153
|
-
transformed.set(name, argumentDefinitions);
|
154
|
-
return argumentDefinitions;
|
155
|
-
}
|
156
|
-
|
157
|
-
function visit(context, transformed, argumentDefinitions, node) {
|
158
|
-
IRVisitor.visit(node, {
|
159
|
-
FragmentSpread: function FragmentSpread(fragmentSpread) {
|
160
|
-
var fragment = context.getFragment(fragmentSpread.name, fragmentSpread.loc);
|
161
|
-
var referencedFragmentArguments = transformFragmentArguments(context, transformed, fragment); // Detect root variables being passed as the value of @arguments;
|
162
|
-
// recover the expected type from the corresponding argument definitions.
|
163
|
-
|
164
|
-
fragmentSpread.args.forEach(function (arg) {
|
165
|
-
var argDef = referencedFragmentArguments.get(arg.name);
|
166
|
-
|
167
|
-
if (argDef != null && arg.value.kind === 'Variable' && !argumentDefinitions.has(arg.value.variableName)) {
|
168
|
-
argumentDefinitions.set(arg.value.variableName, {
|
169
|
-
kind: 'RootArgumentDefinition',
|
170
|
-
loc: {
|
171
|
-
kind: 'Derived',
|
172
|
-
source: arg.loc
|
173
|
-
},
|
174
|
-
name: arg.value.variableName,
|
175
|
-
type: argDef.type
|
176
|
-
});
|
177
|
-
}
|
178
|
-
}); // Merge any root variables referenced by the spread fragment
|
179
|
-
// into this (parent) fragment's arguments.
|
180
|
-
|
181
|
-
var _iterator2 = (0, _createForOfIteratorHelper2["default"])(referencedFragmentArguments.values()),
|
182
|
-
_step2;
|
183
|
-
|
184
|
-
try {
|
185
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
186
|
-
var argDef = _step2.value;
|
187
|
-
|
188
|
-
if (argDef.kind === 'RootArgumentDefinition') {
|
189
|
-
argumentDefinitions.set(argDef.name, argDef);
|
190
|
-
}
|
191
|
-
}
|
192
|
-
} catch (err) {
|
193
|
-
_iterator2.e(err);
|
194
|
-
} finally {
|
195
|
-
_iterator2.f();
|
196
|
-
}
|
197
|
-
},
|
198
|
-
Argument: function Argument(argument) {
|
199
|
-
if (argument.value.kind === 'Literal') {
|
200
|
-
return false;
|
201
|
-
}
|
202
|
-
|
203
|
-
var values = [argument.value];
|
204
|
-
|
205
|
-
while (values.length > 0) {
|
206
|
-
var currentValue = values.pop();
|
207
|
-
|
208
|
-
if (currentValue.kind === 'Variable') {
|
209
|
-
var _currentValue$type;
|
210
|
-
|
211
|
-
var type = (_currentValue$type = currentValue.type) !== null && _currentValue$type !== void 0 ? _currentValue$type : argument.type;
|
212
|
-
|
213
|
-
if (type == null) {
|
214
|
-
continue;
|
215
|
-
}
|
216
|
-
|
217
|
-
if (!argumentDefinitions.has(currentValue.variableName)) {
|
218
|
-
// root variable
|
219
|
-
argumentDefinitions.set(currentValue.variableName, {
|
220
|
-
kind: 'RootArgumentDefinition',
|
221
|
-
loc: {
|
222
|
-
kind: 'Derived',
|
223
|
-
source: argument.loc
|
224
|
-
},
|
225
|
-
name: currentValue.variableName,
|
226
|
-
type: type
|
227
|
-
});
|
228
|
-
}
|
229
|
-
} else if (currentValue.kind === 'ObjectValue') {
|
230
|
-
currentValue.fields.forEach(function (fieldValue) {
|
231
|
-
if (fieldValue.value.kind !== 'Literal') {
|
232
|
-
values.push(fieldValue.value);
|
233
|
-
}
|
234
|
-
});
|
235
|
-
} else if (currentValue.kind === 'ListValue') {
|
236
|
-
currentValue.items.forEach(function (listValue) {
|
237
|
-
if (listValue.kind !== 'Literal') {
|
238
|
-
values.push(listValue);
|
239
|
-
}
|
240
|
-
});
|
241
|
-
}
|
242
|
-
}
|
243
|
-
|
244
|
-
return false;
|
245
|
-
},
|
246
|
-
Condition: function Condition(condition) {
|
247
|
-
var _variable$type;
|
248
|
-
|
249
|
-
var variable = condition.condition;
|
250
|
-
|
251
|
-
if (variable.kind !== 'Variable') {
|
252
|
-
return;
|
253
|
-
}
|
254
|
-
|
255
|
-
var type = (_variable$type = variable.type) !== null && _variable$type !== void 0 ? _variable$type : SchemaUtils.getNonNullBooleanInput(context.getSchema());
|
256
|
-
|
257
|
-
if (!argumentDefinitions.has(variable.variableName)) {
|
258
|
-
// root variable
|
259
|
-
argumentDefinitions.set(variable.variableName, {
|
260
|
-
kind: 'RootArgumentDefinition',
|
261
|
-
loc: {
|
262
|
-
kind: 'Derived',
|
263
|
-
source: variable.loc
|
264
|
-
},
|
265
|
-
name: variable.variableName,
|
266
|
-
type: type
|
267
|
-
});
|
268
|
-
}
|
269
|
-
},
|
270
|
-
Defer: function Defer(defer) {
|
271
|
-
var _variable$type2;
|
272
|
-
|
273
|
-
var variable = defer["if"];
|
274
|
-
|
275
|
-
if (variable == null || variable.kind !== 'Variable') {
|
276
|
-
return;
|
277
|
-
}
|
278
|
-
|
279
|
-
var type = (_variable$type2 = variable.type) !== null && _variable$type2 !== void 0 ? _variable$type2 : SchemaUtils.getNonNullBooleanInput(context.getSchema());
|
280
|
-
|
281
|
-
if (!argumentDefinitions.has(variable.variableName)) {
|
282
|
-
// root variable
|
283
|
-
argumentDefinitions.set(variable.variableName, {
|
284
|
-
kind: 'RootArgumentDefinition',
|
285
|
-
loc: {
|
286
|
-
kind: 'Derived',
|
287
|
-
source: variable.loc
|
288
|
-
},
|
289
|
-
name: variable.variableName,
|
290
|
-
type: type
|
291
|
-
});
|
292
|
-
}
|
293
|
-
},
|
294
|
-
Stream: function Stream(stream) {
|
295
|
-
[stream["if"], stream.initialCount].forEach(function (variable) {
|
296
|
-
var _variable$type3;
|
297
|
-
|
298
|
-
if (variable == null || variable.kind !== 'Variable') {
|
299
|
-
return;
|
300
|
-
}
|
301
|
-
|
302
|
-
var type = (_variable$type3 = variable.type) !== null && _variable$type3 !== void 0 ? _variable$type3 : SchemaUtils.getNonNullBooleanInput(context.getSchema());
|
303
|
-
|
304
|
-
if (!argumentDefinitions.has(variable.variableName)) {
|
305
|
-
// root variable
|
306
|
-
argumentDefinitions.set(variable.variableName, {
|
307
|
-
kind: 'RootArgumentDefinition',
|
308
|
-
loc: {
|
309
|
-
kind: 'Derived',
|
310
|
-
source: variable.loc
|
311
|
-
},
|
312
|
-
name: variable.variableName,
|
313
|
-
type: type
|
314
|
-
});
|
315
|
-
}
|
316
|
-
});
|
317
|
-
},
|
318
|
-
LinkedField: function LinkedField(field) {
|
319
|
-
if (!field.handles) {
|
320
|
-
return;
|
321
|
-
}
|
322
|
-
|
323
|
-
field.handles.forEach(function (handle) {
|
324
|
-
var _variable$type4;
|
325
|
-
|
326
|
-
var variable = handle.dynamicKey;
|
327
|
-
|
328
|
-
if (variable == null) {
|
329
|
-
return;
|
330
|
-
}
|
331
|
-
|
332
|
-
var type = (_variable$type4 = variable.type) !== null && _variable$type4 !== void 0 ? _variable$type4 : SchemaUtils.getNullableStringInput(context.getSchema());
|
333
|
-
|
334
|
-
if (!argumentDefinitions.has(variable.variableName)) {
|
335
|
-
// root variable
|
336
|
-
argumentDefinitions.set(variable.variableName, {
|
337
|
-
kind: 'RootArgumentDefinition',
|
338
|
-
loc: {
|
339
|
-
kind: 'Derived',
|
340
|
-
source: variable.loc
|
341
|
-
},
|
342
|
-
name: variable.variableName,
|
343
|
-
type: type
|
344
|
-
});
|
345
|
-
}
|
346
|
-
});
|
347
|
-
}
|
348
|
-
});
|
349
|
-
}
|
350
|
-
|
351
|
-
module.exports = inferRootArgumentDefinitions;
|
package/lib/index.js
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
// flowlint ambiguous-object-type:error
|
11
|
-
'use strict';
|
12
|
-
|
13
|
-
var _require = require('./bin/RelayCompilerMain'),
|
14
|
-
main = _require.main;
|
15
|
-
|
16
|
-
var CodegenDirectory = require('./codegen/CodegenDirectory');
|
17
|
-
|
18
|
-
var CodegenRunner = require('./codegen/CodegenRunner');
|
19
|
-
|
20
|
-
var CodegenWatcher = require('./codegen/CodegenWatcher');
|
21
|
-
|
22
|
-
var compileRelayArtifacts = require('./codegen/compileRelayArtifacts');
|
23
|
-
|
24
|
-
var RelayCodeGenerator = require('./codegen/RelayCodeGenerator');
|
25
|
-
|
26
|
-
var RelayFileWriter = require('./codegen/RelayFileWriter');
|
27
|
-
|
28
|
-
var _require2 = require('./codegen/SourceControl'),
|
29
|
-
SourceControlMercurial = _require2.SourceControlMercurial;
|
30
|
-
|
31
|
-
var writeRelayGeneratedFile = require('./codegen/writeRelayGeneratedFile');
|
32
|
-
|
33
|
-
var ASTCache = require('./core/ASTCache');
|
34
|
-
|
35
|
-
var ASTConvert = require('./core/ASTConvert');
|
36
|
-
|
37
|
-
var CompilerContext = require('./core/CompilerContext');
|
38
|
-
|
39
|
-
var CompilerError = require('./core/CompilerError');
|
40
|
-
|
41
|
-
var DotGraphQLParser = require('./core/DotGraphQLParser');
|
42
|
-
|
43
|
-
var filterContextForNode = require('./core/filterContextForNode');
|
44
|
-
|
45
|
-
var getIdentifierForArgumentValue = require('./core/getIdentifierForArgumentValue');
|
46
|
-
|
47
|
-
var getLiteralArgumentValues = require('./core/getLiteralArgumentValues');
|
48
|
-
|
49
|
-
var getNormalizationOperationName = require('./core/getNormalizationOperationName');
|
50
|
-
|
51
|
-
var GraphQLCompilerProfiler = require('./core/GraphQLCompilerProfiler');
|
52
|
-
|
53
|
-
var _require3 = require('./core/GraphQLDerivedFromMetadata'),
|
54
|
-
getReaderSourceDefinitionName = _require3.getReaderSourceDefinitionName;
|
55
|
-
|
56
|
-
var GraphQLWatchmanClient = require('./core/GraphQLWatchmanClient');
|
57
|
-
|
58
|
-
var IRPrinter = require('./core/IRPrinter');
|
59
|
-
|
60
|
-
var IRTransformer = require('./core/IRTransformer');
|
61
|
-
|
62
|
-
var IRVisitor = require('./core/IRVisitor');
|
63
|
-
|
64
|
-
var JSModuleParser = require('./core/JSModuleParser');
|
65
|
-
|
66
|
-
var RelayFindGraphQLTags = require('./core/RelayFindGraphQLTags');
|
67
|
-
|
68
|
-
var RelayIRTransforms = require('./core/RelayIRTransforms');
|
69
|
-
|
70
|
-
var RelayParser = require('./core/RelayParser');
|
71
|
-
|
72
|
-
var RelaySchema = require('./core/Schema');
|
73
|
-
|
74
|
-
var SchemaUtils = require('./core/SchemaUtils');
|
75
|
-
|
76
|
-
var FindGraphQLTags = require('./language/javascript/FindGraphQLTags');
|
77
|
-
|
78
|
-
var _require4 = require('./language/javascript/formatGeneratedModule'),
|
79
|
-
formatGeneratedModule = _require4.formatGeneratedCommonjsModule;
|
80
|
-
|
81
|
-
var RelayFlowGenerator = require('./language/javascript/RelayFlowGenerator');
|
82
|
-
|
83
|
-
var ConsoleReporter = require('./reporters/ConsoleReporter');
|
84
|
-
|
85
|
-
var MultiReporter = require('./reporters/MultiReporter');
|
86
|
-
|
87
|
-
var Artifacts = require('./runner/Artifacts');
|
88
|
-
|
89
|
-
var BufferedFilesystem = require('./runner/BufferedFilesystem');
|
90
|
-
|
91
|
-
var compileArtifacts = require('./runner/compileArtifacts');
|
92
|
-
|
93
|
-
var extractAST = require('./runner/extractAST');
|
94
|
-
|
95
|
-
var getChangedNodeNames = require('./runner/getChangedNodeNames');
|
96
|
-
|
97
|
-
var getSchemaInstance = require('./runner/getSchemaInstance');
|
98
|
-
|
99
|
-
var GraphQLASTNodeGroup = require('./runner/GraphQLASTNodeGroup');
|
100
|
-
|
101
|
-
var GraphQLASTUtils = require('./runner/GraphQLASTUtils');
|
102
|
-
|
103
|
-
var GraphQLNodeMap = require('./runner/GraphQLNodeMap');
|
104
|
-
|
105
|
-
var Sources = require('./runner/Sources');
|
106
|
-
|
107
|
-
var StrictMap = require('./runner/StrictMap');
|
108
|
-
|
109
|
-
var CodeMarker = require('./util/CodeMarker');
|
110
|
-
|
111
|
-
var getDefinitionNodeHash = require('./util/getDefinitionNodeHash');
|
112
|
-
|
113
|
-
var md5 = require('./util/md5');
|
114
|
-
|
115
|
-
var Rollout = require('./util/Rollout');
|
116
|
-
|
117
|
-
var TimeReporter = require('./util/TimeReporter');
|
118
|
-
|
119
|
-
module.exports = {
|
120
|
-
relayCompiler: main,
|
121
|
-
ASTConvert: ASTConvert,
|
122
|
-
CodegenDirectory: CodegenDirectory,
|
123
|
-
CodegenRunner: CodegenRunner,
|
124
|
-
CodegenWatcher: CodegenWatcher,
|
125
|
-
CodeMarker: CodeMarker,
|
126
|
-
CompilerContext: CompilerContext,
|
127
|
-
CompilerError: CompilerError,
|
128
|
-
ConsoleReporter: ConsoleReporter,
|
129
|
-
DotGraphQLParser: DotGraphQLParser,
|
130
|
-
ASTCache: ASTCache,
|
131
|
-
IRTransformer: IRTransformer,
|
132
|
-
IRVisitor: IRVisitor,
|
133
|
-
Printer: IRPrinter,
|
134
|
-
Profiler: GraphQLCompilerProfiler,
|
135
|
-
Rollout: Rollout,
|
136
|
-
SchemaUtils: SchemaUtils,
|
137
|
-
SourceControlMercurial: SourceControlMercurial,
|
138
|
-
WatchmanClient: GraphQLWatchmanClient,
|
139
|
-
filterContextForNode: filterContextForNode,
|
140
|
-
getIdentifierForArgumentValue: getIdentifierForArgumentValue,
|
141
|
-
getNormalizationOperationName: getNormalizationOperationName,
|
142
|
-
getLiteralArgumentValues: getLiteralArgumentValues,
|
143
|
-
Parser: RelayParser,
|
144
|
-
Schema: RelaySchema,
|
145
|
-
CodeGenerator: RelayCodeGenerator,
|
146
|
-
FlowGenerator: RelayFlowGenerator,
|
147
|
-
FileWriter: RelayFileWriter,
|
148
|
-
IRTransforms: RelayIRTransforms,
|
149
|
-
JSModuleParser: JSModuleParser,
|
150
|
-
MultiReporter: MultiReporter,
|
151
|
-
Runner: CodegenRunner,
|
152
|
-
TimeReporter: TimeReporter,
|
153
|
-
compileRelayArtifacts: compileRelayArtifacts,
|
154
|
-
formatGeneratedModule: formatGeneratedModule,
|
155
|
-
convertASTDocuments: ASTConvert.convertASTDocuments,
|
156
|
-
transformASTSchema: ASTConvert.transformASTSchema,
|
157
|
-
getReaderSourceDefinitionName: getReaderSourceDefinitionName,
|
158
|
-
writeRelayGeneratedFile: writeRelayGeneratedFile,
|
159
|
-
Sources: Sources,
|
160
|
-
__internal: {
|
161
|
-
Artifacts: Artifacts,
|
162
|
-
BufferedFilesystem: BufferedFilesystem,
|
163
|
-
GraphQLASTNodeGroup: GraphQLASTNodeGroup,
|
164
|
-
GraphQLASTUtils: GraphQLASTUtils,
|
165
|
-
GraphQLNodeMap: GraphQLNodeMap,
|
166
|
-
FindGraphQLTags: FindGraphQLTags,
|
167
|
-
StrictMap: StrictMap,
|
168
|
-
RelayFindGraphQLTags: RelayFindGraphQLTags,
|
169
|
-
compileArtifacts: compileArtifacts,
|
170
|
-
extractFromJS: extractAST.extractFromJS,
|
171
|
-
getChangedNodeNames: getChangedNodeNames,
|
172
|
-
getDefinitionNodeHash: getDefinitionNodeHash,
|
173
|
-
getSchemaInstance: getSchemaInstance,
|
174
|
-
md5: md5,
|
175
|
-
parseExecutableNode: extractAST.parseExecutableNode,
|
176
|
-
toASTRecord: extractAST.toASTRecord
|
177
|
-
}
|
178
|
-
};
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
// flowlint ambiguous-object-type:error
|
11
|
-
'use strict';
|
12
|
-
|
13
|
-
var _require = require('relay-runtime'),
|
14
|
-
RelayConcreteNode = _require.RelayConcreteNode;
|
15
|
-
/**
|
16
|
-
* A language plugin allows relay-compiler to both read and write files for any
|
17
|
-
* language.
|
18
|
-
*
|
19
|
-
* When reading, the plugin is expected to parse and return GraphQL tags; and
|
20
|
-
* when writing the plugin is responsible for generating type information about
|
21
|
-
* the GraphQL selections made as well as generating the contents of the
|
22
|
-
* artifact file.
|
23
|
-
*
|
24
|
-
* This interface describes the details relay-compiler requires to be able to
|
25
|
-
* use the plugin and is expected to be returned by a {PluginInitializer}.
|
26
|
-
*/
|
@@ -1,126 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
*
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
// flowlint ambiguous-object-type:error
|
11
|
-
'use strict';
|
12
|
-
|
13
|
-
var Profiler = require('../../core/GraphQLCompilerProfiler');
|
14
|
-
|
15
|
-
var babylon = require('@babel/parser');
|
16
|
-
|
17
|
-
var util = require('util'); // Attempt to be as inclusive as possible of source text.
|
18
|
-
|
19
|
-
|
20
|
-
var BABYLON_OPTIONS = {
|
21
|
-
allowImportExportEverywhere: true,
|
22
|
-
allowReturnOutsideFunction: true,
|
23
|
-
allowSuperOutsideMethod: true,
|
24
|
-
sourceType: 'module',
|
25
|
-
plugins: ['asyncGenerators', 'classProperties', ['decorators', {
|
26
|
-
decoratorsBeforeExport: true
|
27
|
-
}], 'doExpressions', 'dynamicImport', 'exportExtensions', ['flow', {
|
28
|
-
enums: true
|
29
|
-
}], 'functionBind', 'functionSent', 'jsx', 'nullishCoalescingOperator', 'objectRestSpread', 'optionalChaining', 'optionalCatchBinding'],
|
30
|
-
strictMode: false
|
31
|
-
};
|
32
|
-
|
33
|
-
function find(text) {
|
34
|
-
var result = []; // $FlowFixMe Discovered when typing babel/parser
|
35
|
-
|
36
|
-
var ast = babylon.parse(text, BABYLON_OPTIONS);
|
37
|
-
var visitors = {
|
38
|
-
TaggedTemplateExpression: function TaggedTemplateExpression(node) {
|
39
|
-
if (isGraphQLTag(node.tag)) {
|
40
|
-
result.push({
|
41
|
-
keyName: null,
|
42
|
-
template: node.quasi.quasis[0].value.raw,
|
43
|
-
sourceLocationOffset: getSourceLocationOffset(node.quasi)
|
44
|
-
});
|
45
|
-
}
|
46
|
-
}
|
47
|
-
};
|
48
|
-
visit(ast, visitors);
|
49
|
-
return result;
|
50
|
-
}
|
51
|
-
|
52
|
-
var IGNORED_KEYS = {
|
53
|
-
comments: true,
|
54
|
-
end: true,
|
55
|
-
leadingComments: true,
|
56
|
-
loc: true,
|
57
|
-
name: true,
|
58
|
-
start: true,
|
59
|
-
trailingComments: true,
|
60
|
-
type: true
|
61
|
-
};
|
62
|
-
|
63
|
-
function isGraphQLTag(tag) {
|
64
|
-
return tag.type === 'Identifier' && tag.name === 'graphql';
|
65
|
-
}
|
66
|
-
|
67
|
-
function getTemplateNode(quasi) {
|
68
|
-
var quasis = quasi.quasis;
|
69
|
-
!(quasis && quasis.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'FindGraphQLTags: Substitutions are not allowed in graphql tags.') : invariant(false) : void 0;
|
70
|
-
return quasis[0];
|
71
|
-
}
|
72
|
-
|
73
|
-
function getSourceLocationOffset(quasi) {
|
74
|
-
var loc = getTemplateNode(quasi).loc.start;
|
75
|
-
return {
|
76
|
-
line: loc.line,
|
77
|
-
column: loc.column + 1 // babylon is 0-indexed, graphql expects 1-indexed
|
78
|
-
|
79
|
-
};
|
80
|
-
}
|
81
|
-
|
82
|
-
function invariant(condition, msg) {
|
83
|
-
if (!condition) {
|
84
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
85
|
-
args[_key - 2] = arguments[_key];
|
86
|
-
}
|
87
|
-
|
88
|
-
throw new Error(util.format.apply(util, [msg].concat(args)));
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
function visit(node, visitors) {
|
93
|
-
// $FlowFixMe Discovered when typing babel
|
94
|
-
var fn = visitors[node.type];
|
95
|
-
|
96
|
-
if (fn != null) {
|
97
|
-
fn(node);
|
98
|
-
return;
|
99
|
-
}
|
100
|
-
|
101
|
-
traverse(node, visitors);
|
102
|
-
}
|
103
|
-
|
104
|
-
function traverse(node, visitors) {
|
105
|
-
for (var key in node) {
|
106
|
-
if (IGNORED_KEYS[key]) {
|
107
|
-
continue;
|
108
|
-
}
|
109
|
-
|
110
|
-
var prop = node[key];
|
111
|
-
|
112
|
-
if (prop && typeof prop === 'object' && typeof prop.type === 'string') {
|
113
|
-
visit(prop, visitors);
|
114
|
-
} else if (Array.isArray(prop)) {
|
115
|
-
prop.forEach(function (item) {
|
116
|
-
if (item && typeof item === 'object' && typeof item.type === 'string') {
|
117
|
-
visit(item, visitors);
|
118
|
-
}
|
119
|
-
});
|
120
|
-
}
|
121
|
-
}
|
122
|
-
}
|
123
|
-
|
124
|
-
module.exports = {
|
125
|
-
find: Profiler.instrument(find, 'FindGraphQLTags.find')
|
126
|
-
};
|