@ardatan/relay-compiler 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/LICENSE +21 -0
- package/bin/RelayCompilerBin.js.flow +169 -0
- package/bin/RelayCompilerMain.js.flow +515 -0
- package/bin/__fixtures__/plugin-module.js.flow +17 -0
- package/bin/relay-compiler +19066 -0
- package/codegen/CodegenDirectory.js.flow +375 -0
- package/codegen/CodegenRunner.js.flow +432 -0
- package/codegen/CodegenTypes.js.flow +28 -0
- package/codegen/CodegenWatcher.js.flow +254 -0
- package/codegen/NormalizationCodeGenerator.js.flow +566 -0
- package/codegen/ReaderCodeGenerator.js.flow +512 -0
- package/codegen/RelayCodeGenerator.js.flow +85 -0
- package/codegen/RelayFileWriter.js.flow +367 -0
- package/codegen/SourceControl.js.flow +58 -0
- package/codegen/compileRelayArtifacts.js.flow +182 -0
- package/codegen/createPrintRequireModuleDependency.js.flow +19 -0
- package/codegen/sortObjectByKey.js.flow +25 -0
- package/codegen/writeRelayGeneratedFile.js.flow +239 -0
- package/core/ASTCache.js.flow +74 -0
- package/core/ASTConvert.js.flow +233 -0
- package/core/CompilerContext.js.flow +191 -0
- package/core/CompilerError.js.flow +255 -0
- package/core/DotGraphQLParser.js.flow +39 -0
- package/core/GraphQLCompilerProfiler.js.flow +341 -0
- package/core/GraphQLDerivedFromMetadata.js.flow +36 -0
- package/core/GraphQLWatchmanClient.js.flow +111 -0
- package/core/IR.js.flow +326 -0
- package/core/IRPrinter.js.flow +478 -0
- package/core/IRTransformer.js.flow +377 -0
- package/core/IRValidator.js.flow +260 -0
- package/core/IRVisitor.js.flow +150 -0
- package/core/JSModuleParser.js.flow +24 -0
- package/core/RelayCompilerScope.js.flow +199 -0
- package/core/RelayFindGraphQLTags.js.flow +119 -0
- package/core/RelayGraphQLEnumsGenerator.js.flow +55 -0
- package/core/RelayIRTransforms.js.flow +138 -0
- package/core/RelayParser.js.flow +1734 -0
- package/core/RelaySourceModuleParser.js.flow +135 -0
- package/core/Schema.js.flow +2037 -0
- package/core/SchemaUtils.js.flow +120 -0
- package/core/filterContextForNode.js.flow +50 -0
- package/core/getFieldDefinition.js.flow +156 -0
- package/core/getIdentifierForArgumentValue.js.flow +49 -0
- package/core/getIdentifierForSelection.js.flow +69 -0
- package/core/getLiteralArgumentValues.js.flow +32 -0
- package/core/getNormalizationOperationName.js.flow +19 -0
- package/core/inferRootArgumentDefinitions.js.flow +323 -0
- package/index.js +10 -0
- package/index.js.flow +200 -0
- package/language/RelayLanguagePluginInterface.js.flow +283 -0
- package/language/javascript/FindGraphQLTags.js.flow +137 -0
- package/language/javascript/RelayFlowBabelFactories.js.flow +176 -0
- package/language/javascript/RelayFlowGenerator.js.flow +1100 -0
- package/language/javascript/RelayFlowTypeTransformers.js.flow +184 -0
- package/language/javascript/RelayLanguagePluginJavaScript.js.flow +34 -0
- package/language/javascript/formatGeneratedModule.js.flow +65 -0
- package/lib/bin/RelayCompilerBin.js +143 -0
- package/lib/bin/RelayCompilerMain.js +486 -0
- package/lib/bin/__fixtures__/plugin-module.js +16 -0
- package/lib/codegen/CodegenDirectory.js +336 -0
- package/lib/codegen/CodegenRunner.js +433 -0
- package/lib/codegen/CodegenTypes.js +11 -0
- package/lib/codegen/CodegenWatcher.js +271 -0
- package/lib/codegen/NormalizationCodeGenerator.js +480 -0
- package/lib/codegen/ReaderCodeGenerator.js +472 -0
- package/lib/codegen/RelayCodeGenerator.js +68 -0
- package/lib/codegen/RelayFileWriter.js +270 -0
- package/lib/codegen/SourceControl.js +60 -0
- package/lib/codegen/compileRelayArtifacts.js +157 -0
- package/lib/codegen/createPrintRequireModuleDependency.js +19 -0
- package/lib/codegen/sortObjectByKey.js +41 -0
- package/lib/codegen/writeRelayGeneratedFile.js +208 -0
- package/lib/core/ASTCache.js +70 -0
- package/lib/core/ASTConvert.js +198 -0
- package/lib/core/CompilerContext.js +165 -0
- package/lib/core/CompilerError.js +251 -0
- package/lib/core/DotGraphQLParser.js +40 -0
- package/lib/core/GraphQLCompilerProfiler.js +299 -0
- package/lib/core/GraphQLDerivedFromMetadata.js +31 -0
- package/lib/core/GraphQLWatchmanClient.js +150 -0
- package/lib/core/IR.js +11 -0
- package/lib/core/IRPrinter.js +389 -0
- package/lib/core/IRTransformer.js +345 -0
- package/lib/core/IRValidator.js +226 -0
- package/lib/core/IRVisitor.js +45 -0
- package/lib/core/JSModuleParser.js +18 -0
- package/lib/core/RelayCompilerScope.js +149 -0
- package/lib/core/RelayFindGraphQLTags.js +79 -0
- package/lib/core/RelayGraphQLEnumsGenerator.js +50 -0
- package/lib/core/RelayIRTransforms.js +109 -0
- package/lib/core/RelayParser.js +1382 -0
- package/lib/core/RelaySourceModuleParser.js +104 -0
- package/lib/core/Schema.js +1877 -0
- package/lib/core/SchemaUtils.js +98 -0
- package/lib/core/filterContextForNode.js +49 -0
- package/lib/core/getFieldDefinition.js +145 -0
- package/lib/core/getIdentifierForArgumentValue.js +53 -0
- package/lib/core/getIdentifierForSelection.js +48 -0
- package/lib/core/getLiteralArgumentValues.js +26 -0
- package/lib/core/getNormalizationOperationName.js +17 -0
- package/lib/core/inferRootArgumentDefinitions.js +351 -0
- package/lib/index.js +178 -0
- package/lib/language/RelayLanguagePluginInterface.js +14 -0
- package/lib/language/javascript/FindGraphQLTags.js +126 -0
- package/lib/language/javascript/RelayFlowBabelFactories.js +160 -0
- package/lib/language/javascript/RelayFlowGenerator.js +857 -0
- package/lib/language/javascript/RelayFlowTypeTransformers.js +119 -0
- package/lib/language/javascript/RelayLanguagePluginJavaScript.js +30 -0
- package/lib/language/javascript/formatGeneratedModule.js +36 -0
- package/lib/reporters/ConsoleReporter.js +61 -0
- package/lib/reporters/MultiReporter.js +45 -0
- package/lib/reporters/Reporter.js +11 -0
- package/lib/runner/Artifacts.js +323 -0
- package/lib/runner/BufferedFilesystem.js +261 -0
- package/lib/runner/GraphQLASTNodeGroup.js +256 -0
- package/lib/runner/GraphQLASTUtils.js +23 -0
- package/lib/runner/GraphQLNodeMap.js +81 -0
- package/lib/runner/Sources.js +271 -0
- package/lib/runner/StrictMap.js +134 -0
- package/lib/runner/compileArtifacts.js +39 -0
- package/lib/runner/extractAST.js +77 -0
- package/lib/runner/getChangedNodeNames.js +82 -0
- package/lib/runner/getSchemaInstance.js +30 -0
- package/lib/runner/types.js +12 -0
- package/lib/transforms/ApplyFragmentArgumentTransform.js +393 -0
- package/lib/transforms/ClientExtensionsTransform.js +222 -0
- package/lib/transforms/ConnectionTransform.js +643 -0
- package/lib/transforms/DeclarativeConnectionMutationTransform.js +221 -0
- package/lib/transforms/DeferStreamTransform.js +247 -0
- package/lib/transforms/DisallowIdAsAlias.js +41 -0
- package/lib/transforms/DisallowTypenameOnRoot.js +53 -0
- package/lib/transforms/FieldHandleTransform.js +81 -0
- package/lib/transforms/FilterCompilerDirectivesTransform.js +29 -0
- package/lib/transforms/FilterDirectivesTransform.js +41 -0
- package/lib/transforms/FlattenTransform.js +308 -0
- package/lib/transforms/GenerateIDFieldTransform.js +137 -0
- package/lib/transforms/GenerateTypeNameTransform.js +155 -0
- package/lib/transforms/InlineDataFragmentTransform.js +104 -0
- package/lib/transforms/InlineFragmentsTransform.js +63 -0
- package/lib/transforms/MaskTransform.js +121 -0
- package/lib/transforms/MatchTransform.js +438 -0
- package/lib/transforms/ReactFlightComponentTransform.js +161 -0
- package/lib/transforms/RefetchableFragmentTransform.js +249 -0
- package/lib/transforms/RelayDirectiveTransform.js +85 -0
- package/lib/transforms/RequiredFieldTransform.js +373 -0
- package/lib/transforms/SkipClientExtensionsTransform.js +49 -0
- package/lib/transforms/SkipHandleFieldTransform.js +45 -0
- package/lib/transforms/SkipRedundantNodesTransform.js +255 -0
- package/lib/transforms/SkipSplitOperationTransform.js +32 -0
- package/lib/transforms/SkipUnreachableNodeTransform.js +158 -0
- package/lib/transforms/SkipUnusedVariablesTransform.js +74 -0
- package/lib/transforms/SplitModuleImportTransform.js +85 -0
- package/lib/transforms/TestOperationTransform.js +145 -0
- package/lib/transforms/TransformUtils.js +21 -0
- package/lib/transforms/ValidateGlobalVariablesTransform.js +91 -0
- package/lib/transforms/ValidateRequiredArgumentsTransform.js +118 -0
- package/lib/transforms/ValidateServerOnlyDirectivesTransform.js +111 -0
- package/lib/transforms/ValidateUnusedVariablesTransform.js +96 -0
- package/lib/transforms/query-generators/FetchableQueryGenerator.js +157 -0
- package/lib/transforms/query-generators/NodeQueryGenerator.js +166 -0
- package/lib/transforms/query-generators/QueryQueryGenerator.js +48 -0
- package/lib/transforms/query-generators/ViewerQueryGenerator.js +77 -0
- package/lib/transforms/query-generators/index.js +60 -0
- package/lib/transforms/query-generators/utils.js +92 -0
- package/lib/util/CodeMarker.js +80 -0
- package/lib/util/DefaultHandleKey.js +15 -0
- package/lib/util/RelayCompilerCache.js +98 -0
- package/lib/util/Rollout.js +40 -0
- package/lib/util/TimeReporter.js +83 -0
- package/lib/util/areEqualArgValues.js +135 -0
- package/lib/util/argumentContainsVariables.js +37 -0
- package/lib/util/dedupeJSONStringify.js +160 -0
- package/lib/util/generateAbstractTypeRefinementKey.js +24 -0
- package/lib/util/getDefinitionNodeHash.js +22 -0
- package/lib/util/getModuleName.js +32 -0
- package/lib/util/joinArgumentDefinitions.js +66 -0
- package/lib/util/md5.js +17 -0
- package/lib/util/murmurHash.js +86 -0
- package/lib/util/nullthrowsOSS.js +23 -0
- package/lib/util/orList.js +36 -0
- package/lib/util/partitionArray.js +35 -0
- package/package.json +42 -0
- package/relay-compiler.js +17 -0
- package/relay-compiler.min.js +22 -0
- package/reporters/ConsoleReporter.js.flow +81 -0
- package/reporters/MultiReporter.js.flow +43 -0
- package/reporters/Reporter.js.flow +19 -0
- package/runner/Artifacts.js.flow +219 -0
- package/runner/BufferedFilesystem.js.flow +194 -0
- package/runner/GraphQLASTNodeGroup.js.flow +176 -0
- package/runner/GraphQLASTUtils.js.flow +26 -0
- package/runner/GraphQLNodeMap.js.flow +55 -0
- package/runner/Sources.js.flow +228 -0
- package/runner/StrictMap.js.flow +96 -0
- package/runner/compileArtifacts.js.flow +76 -0
- package/runner/extractAST.js.flow +100 -0
- package/runner/getChangedNodeNames.js.flow +48 -0
- package/runner/getSchemaInstance.js.flow +36 -0
- package/runner/types.js.flow +37 -0
- package/transforms/ApplyFragmentArgumentTransform.js.flow +526 -0
- package/transforms/ClientExtensionsTransform.js.flow +226 -0
- package/transforms/ConnectionTransform.js.flow +859 -0
- package/transforms/DeclarativeConnectionMutationTransform.js.flow +250 -0
- package/transforms/DeferStreamTransform.js.flow +266 -0
- package/transforms/DisallowIdAsAlias.js.flow +48 -0
- package/transforms/DisallowTypenameOnRoot.js.flow +45 -0
- package/transforms/FieldHandleTransform.js.flow +81 -0
- package/transforms/FilterCompilerDirectivesTransform.js.flow +33 -0
- package/transforms/FilterDirectivesTransform.js.flow +45 -0
- package/transforms/FlattenTransform.js.flow +462 -0
- package/transforms/GenerateIDFieldTransform.js.flow +154 -0
- package/transforms/GenerateTypeNameTransform.js.flow +167 -0
- package/transforms/InlineDataFragmentTransform.js.flow +129 -0
- package/transforms/InlineFragmentsTransform.js.flow +73 -0
- package/transforms/MaskTransform.js.flow +130 -0
- package/transforms/MatchTransform.js.flow +593 -0
- package/transforms/ReactFlightComponentTransform.js.flow +198 -0
- package/transforms/RefetchableFragmentTransform.js.flow +272 -0
- package/transforms/RelayDirectiveTransform.js.flow +99 -0
- package/transforms/RequiredFieldTransform.js.flow +419 -0
- package/transforms/SkipClientExtensionsTransform.js.flow +57 -0
- package/transforms/SkipHandleFieldTransform.js.flow +45 -0
- package/transforms/SkipRedundantNodesTransform.js.flow +259 -0
- package/transforms/SkipSplitOperationTransform.js.flow +37 -0
- package/transforms/SkipUnreachableNodeTransform.js.flow +149 -0
- package/transforms/SkipUnusedVariablesTransform.js.flow +59 -0
- package/transforms/SplitModuleImportTransform.js.flow +101 -0
- package/transforms/TestOperationTransform.js.flow +143 -0
- package/transforms/TransformUtils.js.flow +26 -0
- package/transforms/ValidateGlobalVariablesTransform.js.flow +81 -0
- package/transforms/ValidateRequiredArgumentsTransform.js.flow +131 -0
- package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +115 -0
- package/transforms/ValidateUnusedVariablesTransform.js.flow +89 -0
- package/transforms/query-generators/FetchableQueryGenerator.js.flow +189 -0
- package/transforms/query-generators/NodeQueryGenerator.js.flow +219 -0
- package/transforms/query-generators/QueryQueryGenerator.js.flow +57 -0
- package/transforms/query-generators/ViewerQueryGenerator.js.flow +97 -0
- package/transforms/query-generators/index.js.flow +90 -0
- package/transforms/query-generators/utils.js.flow +76 -0
- package/util/CodeMarker.js.flow +79 -0
- package/util/DefaultHandleKey.js.flow +17 -0
- package/util/RelayCompilerCache.js.flow +88 -0
- package/util/Rollout.js.flow +39 -0
- package/util/TimeReporter.js.flow +79 -0
- package/util/areEqualArgValues.js.flow +126 -0
- package/util/argumentContainsVariables.js.flow +38 -0
- package/util/dedupeJSONStringify.js.flow +152 -0
- package/util/generateAbstractTypeRefinementKey.js.flow +29 -0
- package/util/getDefinitionNodeHash.js.flow +25 -0
- package/util/getModuleName.js.flow +39 -0
- package/util/joinArgumentDefinitions.js.flow +105 -0
- package/util/md5.js.flow +22 -0
- package/util/murmurHash.js.flow +94 -0
- package/util/nullthrowsOSS.js.flow +25 -0
- package/util/orList.js.flow +37 -0
- package/util/partitionArray.js.flow +37 -0
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
* @flow strict-local
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// flowlint ambiguous-object-type:error
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
const JSModuleParser = require('../core/JSModuleParser');
|
|
16
|
+
|
|
17
|
+
const invariant = require('invariant');
|
|
18
|
+
|
|
19
|
+
const {parse, print} = require('graphql');
|
|
20
|
+
|
|
21
|
+
import type {WatchmanFile} from './types';
|
|
22
|
+
import type {ASTNode, ExecutableDefinitionNode} from 'graphql';
|
|
23
|
+
|
|
24
|
+
export type ASTRecord<T: ASTNode> = {|
|
|
25
|
+
+ast: T,
|
|
26
|
+
+text: string,
|
|
27
|
+
|};
|
|
28
|
+
|
|
29
|
+
export type ExtractFn<T> = (
|
|
30
|
+
baseDir: string,
|
|
31
|
+
file: WatchmanFile,
|
|
32
|
+
) => ?{|
|
|
33
|
+
+nodes: $ReadOnlyArray<ASTRecord<T>>,
|
|
34
|
+
+sources: $ReadOnlyArray<string>,
|
|
35
|
+
|};
|
|
36
|
+
|
|
37
|
+
function extractFromJS(
|
|
38
|
+
baseDir: string,
|
|
39
|
+
file: WatchmanFile,
|
|
40
|
+
): ?{|
|
|
41
|
+
+nodes: $ReadOnlyArray<ASTRecord<ExecutableDefinitionNode>>,
|
|
42
|
+
+sources: $ReadOnlyArray<string>,
|
|
43
|
+
|} {
|
|
44
|
+
if (!file.exists) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const f = {
|
|
48
|
+
relPath: file.name,
|
|
49
|
+
exists: true,
|
|
50
|
+
hash: file['content.sha1hex'],
|
|
51
|
+
};
|
|
52
|
+
const fileFilter = JSModuleParser.getFileFilter(baseDir);
|
|
53
|
+
if (!fileFilter(f)) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const result = JSModuleParser.parseFileWithSources(baseDir, f);
|
|
57
|
+
if (result == null || result.document.definitions.length === 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const {document: doc, sources} = result;
|
|
62
|
+
|
|
63
|
+
const nodes = doc.definitions.map(def => {
|
|
64
|
+
if (
|
|
65
|
+
def.kind === 'FragmentDefinition' ||
|
|
66
|
+
def.kind === 'OperationDefinition'
|
|
67
|
+
) {
|
|
68
|
+
return toASTRecord(def);
|
|
69
|
+
}
|
|
70
|
+
throw new Error(`Unexpected definition kind: ${def.kind}`);
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
nodes,
|
|
74
|
+
sources,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function toASTRecord<T: ASTNode>(node: T): ASTRecord<T> {
|
|
79
|
+
return {
|
|
80
|
+
ast: node,
|
|
81
|
+
text: print(node),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function parseExecutableNode(text: string): ExecutableDefinitionNode {
|
|
86
|
+
const nodes = parse(text).definitions;
|
|
87
|
+
invariant(nodes.length === 1, 'expected exactly 1 definition');
|
|
88
|
+
const node = nodes[0];
|
|
89
|
+
invariant(
|
|
90
|
+
node.kind === 'OperationDefinition' || node.kind === 'FragmentDefinition',
|
|
91
|
+
'expected an ExecutableDefinitionNode',
|
|
92
|
+
);
|
|
93
|
+
return node;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = {
|
|
97
|
+
parseExecutableNode,
|
|
98
|
+
toASTRecord,
|
|
99
|
+
extractFromJS,
|
|
100
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
* @flow strict-local
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// flowlint ambiguous-object-type:error
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
const {getName} = require('./GraphQLASTUtils');
|
|
16
|
+
|
|
17
|
+
import type {SourceChanges} from './Sources';
|
|
18
|
+
import type {StrictMap} from './StrictMap';
|
|
19
|
+
import type {ExecutableDefinitionNode} from 'graphql';
|
|
20
|
+
|
|
21
|
+
function getChangedNodeNames<
|
|
22
|
+
TProjectState: {
|
|
23
|
+
+initialDirty: Set<string>,
|
|
24
|
+
+changes: SourceChanges<ExecutableDefinitionNode>,
|
|
25
|
+
...
|
|
26
|
+
},
|
|
27
|
+
>(
|
|
28
|
+
projectStates: StrictMap<string, TProjectState>,
|
|
29
|
+
projects: $ReadOnlyArray<string>,
|
|
30
|
+
): Set<string> {
|
|
31
|
+
const changedNames = new Set();
|
|
32
|
+
for (const projectType of projects) {
|
|
33
|
+
const subConfig = projectStates.get(projectType);
|
|
34
|
+
for (const name of subConfig.initialDirty) {
|
|
35
|
+
changedNames.add(name);
|
|
36
|
+
}
|
|
37
|
+
for (const {ast} of subConfig.changes.added) {
|
|
38
|
+
changedNames.add(getName(ast));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (const {ast} of subConfig.changes.removed) {
|
|
42
|
+
changedNames.add(getName(ast));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return changedNames;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = getChangedNodeNames;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// flowlint ambiguous-object-type:error
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
const {create} = require('../core/Schema');
|
|
16
|
+
|
|
17
|
+
import type {Schema} from '../core/Schema';
|
|
18
|
+
import type {Source, DocumentNode} from 'graphql';
|
|
19
|
+
|
|
20
|
+
const schemaCache: Map<Source, Schema> = new Map();
|
|
21
|
+
|
|
22
|
+
function getSchemaInstance(
|
|
23
|
+
getSchemaSource: () => Source,
|
|
24
|
+
getSchemaExtensions: () => $ReadOnlyArray<DocumentNode>,
|
|
25
|
+
schemaExtensions: $ReadOnlyArray<string>,
|
|
26
|
+
): Schema {
|
|
27
|
+
const source = getSchemaSource();
|
|
28
|
+
let schema = schemaCache.get(source);
|
|
29
|
+
if (schema == null) {
|
|
30
|
+
schema = create(source, getSchemaExtensions(), schemaExtensions);
|
|
31
|
+
schemaCache.set(source, schema);
|
|
32
|
+
}
|
|
33
|
+
return schema;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = getSchemaInstance;
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
* @flow strict
|
|
8
|
+
* @format
|
|
9
|
+
* @emails oncall+relay
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// flowlint ambiguous-object-type:error
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
export type WatchmanFile =
|
|
17
|
+
| {
|
|
18
|
+
+exists: true,
|
|
19
|
+
+name: string,
|
|
20
|
+
+'content.sha1hex': string,
|
|
21
|
+
...
|
|
22
|
+
}
|
|
23
|
+
| {
|
|
24
|
+
+exists: false,
|
|
25
|
+
+name: string,
|
|
26
|
+
...
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type SavedStateCollection = $ReadOnlyArray<{|
|
|
30
|
+
+file: string,
|
|
31
|
+
+sources: $ReadOnlyArray<string>,
|
|
32
|
+
|}>;
|
|
33
|
+
|
|
34
|
+
export type SavedState<TSubProjectsType> = {
|
|
35
|
+
[TSubProjectsType]: SavedStateCollection,
|
|
36
|
+
...,
|
|
37
|
+
};
|