relay-compiler 0.0.0-main-e0f88a3b → 0.0.0-main-2087b512
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/RelayCompilerBin.js.flow +2 -3
- package/bin/RelayCompilerMain.js.flow +12 -14
- package/bin/relay-compiler +5613 -5548
- package/codegen/CodegenDirectory.js.flow +4 -5
- package/codegen/CodegenRunner.js.flow +11 -13
- package/codegen/CodegenWatcher.js.flow +3 -4
- package/codegen/NormalizationCodeGenerator.js.flow +13 -14
- package/codegen/ReaderCodeGenerator.js.flow +14 -16
- package/codegen/RelayCodeGenerator.js.flow +7 -7
- package/codegen/RelayFileWriter.js.flow +20 -22
- package/codegen/compileRelayArtifacts.js.flow +5 -6
- package/codegen/writeRelayGeneratedFile.js.flow +7 -9
- package/core/ASTCache.js.flow +3 -4
- package/core/ASTConvert.js.flow +7 -8
- package/core/CompilerContext.js.flow +5 -7
- package/core/CompilerError.js.flow +2 -2
- package/core/DotGraphQLParser.js.flow +4 -6
- package/core/IR.js.flow +2 -2
- package/core/IRPrinter.js.flow +3 -4
- package/core/IRTransformer.js.flow +4 -5
- package/core/IRValidator.js.flow +3 -4
- package/core/IRVisitor.js.flow +2 -2
- package/core/JSModuleParser.js.flow +2 -2
- package/core/RelayCompilerScope.js.flow +2 -2
- package/core/RelayFindGraphQLTags.js.flow +6 -7
- package/core/RelayGraphQLEnumsGenerator.js.flow +2 -2
- package/core/RelayIRTransforms.js.flow +3 -3
- package/core/RelayParser.js.flow +16 -18
- package/core/RelaySourceModuleParser.js.flow +7 -9
- package/core/Schema.js.flow +24 -24
- package/core/SchemaUtils.js.flow +3 -3
- package/core/filterContextForNode.js.flow +2 -3
- package/core/getFieldDefinition.js.flow +3 -3
- package/core/getIdentifierForArgumentValue.js.flow +2 -2
- package/core/getIdentifierForSelection.js.flow +3 -4
- package/core/inferRootArgumentDefinitions.js.flow +5 -6
- package/index.js +1 -1
- package/index.js.flow +33 -35
- package/language/RelayLanguagePluginInterface.js.flow +3 -3
- package/language/javascript/FindGraphQLTags.js.flow +2 -3
- package/language/javascript/RelayFlowBabelFactories.js.flow +1 -1
- package/language/javascript/RelayFlowGenerator.js.flow +16 -19
- package/language/javascript/RelayFlowTypeTransformers.js.flow +3 -5
- package/language/javascript/RelayLanguagePluginJavaScript.js.flow +2 -3
- package/lib/bin/RelayCompilerBin.js +2 -2
- package/lib/bin/RelayCompilerMain.js +10 -10
- package/lib/codegen/CodegenDirectory.js +2 -3
- package/lib/codegen/CodegenRunner.js +9 -9
- package/lib/codegen/CodegenWatcher.js +2 -2
- package/lib/codegen/NormalizationCodeGenerator.js +11 -4
- package/lib/codegen/ReaderCodeGenerator.js +7 -6
- package/lib/codegen/RelayCodeGenerator.js +11 -4
- package/lib/codegen/RelayFileWriter.js +14 -14
- package/lib/codegen/compileRelayArtifacts.js +3 -3
- package/lib/codegen/writeRelayGeneratedFile.js +4 -4
- package/lib/core/CompilerContext.js +5 -5
- package/lib/core/CompilerError.js +2 -1
- package/lib/core/DotGraphQLParser.js +4 -4
- package/lib/core/IRPrinter.js +2 -2
- package/lib/core/IRTransformer.js +2 -2
- package/lib/core/IRValidator.js +2 -2
- package/lib/core/RelayCompilerScope.js +34 -0
- package/lib/core/RelayFindGraphQLTags.js +2 -2
- package/lib/core/RelayIRTransforms.js +4 -4
- package/lib/core/RelayParser.js +10 -10
- package/lib/core/RelaySourceModuleParser.js +5 -5
- package/lib/core/Schema.js +2 -2
- package/lib/core/filterContextForNode.js +2 -1
- package/lib/core/getIdentifierForArgumentValue.js +2 -1
- package/lib/core/getIdentifierForSelection.js +3 -2
- package/lib/core/inferRootArgumentDefinitions.js +3 -3
- package/lib/index.js +46 -46
- package/lib/language/RelayLanguagePluginInterface.js +13 -1
- package/lib/language/javascript/FindGraphQLTags.js +2 -2
- package/lib/language/javascript/RelayFlowBabelFactories.js +2 -2
- package/lib/language/javascript/RelayFlowGenerator.js +3 -3
- package/lib/language/javascript/RelayFlowTypeTransformers.js +2 -2
- package/lib/language/javascript/RelayLanguagePluginJavaScript.js +2 -2
- package/lib/runner/Artifacts.js +3 -3
- package/lib/runner/BufferedFilesystem.js +2 -1
- package/lib/runner/GraphQLASTNodeGroup.js +2 -2
- package/lib/runner/GraphQLNodeMap.js +2 -2
- package/lib/runner/Sources.js +2 -2
- package/lib/runner/compileArtifacts.js +2 -2
- package/lib/runner/extractAST.js +2 -2
- package/lib/transforms/ApplyFragmentArgumentTransform.js +6 -6
- package/lib/transforms/ClientExtensionsTransform.js +2 -2
- package/lib/transforms/ConnectionTransform.js +6 -6
- package/lib/transforms/DeclarativeConnectionMutationTransform.js +2 -2
- package/lib/transforms/DeferStreamTransform.js +4 -4
- package/lib/transforms/DisallowIdAsAlias.js +2 -2
- package/lib/transforms/DisallowTypenameOnRoot.js +2 -2
- package/lib/transforms/FilterDirectivesTransform.js +2 -1
- package/lib/transforms/FlattenTransform.js +6 -6
- package/lib/transforms/InlineDataFragmentTransform.js +2 -2
- package/lib/transforms/MaskTransform.js +4 -4
- package/lib/transforms/MatchTransform.js +4 -4
- package/lib/transforms/ReactFlightComponentTransform.js +4 -4
- package/lib/transforms/RefetchableFragmentTransform.js +4 -4
- package/lib/transforms/RelayDirectiveTransform.js +2 -2
- package/lib/transforms/RequiredFieldTransform.js +4 -4
- package/lib/transforms/SkipHandleFieldTransform.js +2 -1
- package/lib/transforms/SkipRedundantNodesTransform.js +11 -3
- package/lib/transforms/SkipUnusedVariablesTransform.js +2 -1
- package/lib/transforms/SplitModuleImportTransform.js +2 -2
- package/lib/transforms/TestOperationTransform.js +3 -3
- package/lib/transforms/ValidateGlobalVariablesTransform.js +3 -2
- package/lib/transforms/ValidateRequiredArgumentsTransform.js +2 -2
- package/lib/transforms/ValidateServerOnlyDirectivesTransform.js +2 -2
- package/lib/transforms/ValidateUnusedVariablesTransform.js +2 -2
- package/lib/transforms/query-generators/FetchableQueryGenerator.js +2 -2
- package/lib/transforms/query-generators/NodeQueryGenerator.js +4 -4
- package/lib/transforms/query-generators/index.js +3 -3
- package/lib/util/joinArgumentDefinitions.js +2 -1
- package/package.json +2 -2
- package/relay-compiler.js +4 -4
- package/relay-compiler.min.js +4 -4
- package/reporters/ConsoleReporter.js.flow +2 -2
- package/runner/Artifacts.js.flow +4 -5
- package/runner/BufferedFilesystem.js.flow +3 -3
- package/runner/GraphQLASTNodeGroup.js.flow +2 -3
- package/runner/GraphQLNodeMap.js.flow +3 -3
- package/runner/Sources.js.flow +5 -6
- package/runner/compileArtifacts.js.flow +5 -6
- package/runner/extractAST.js.flow +4 -6
- package/runner/getChangedNodeNames.js.flow +2 -2
- package/runner/getSchemaInstance.js.flow +3 -3
- package/transforms/ApplyFragmentArgumentTransform.js.flow +9 -11
- package/transforms/ClientExtensionsTransform.js.flow +3 -4
- package/transforms/ConnectionTransform.js.flow +11 -13
- package/transforms/DeclarativeConnectionMutationTransform.js.flow +3 -5
- package/transforms/DeferStreamTransform.js.flow +5 -7
- package/transforms/DisallowIdAsAlias.js.flow +3 -4
- package/transforms/DisallowTypenameOnRoot.js.flow +3 -4
- package/transforms/FieldHandleTransform.js.flow +3 -5
- package/transforms/FilterCompilerDirectivesTransform.js.flow +2 -2
- package/transforms/FilterDirectivesTransform.js.flow +2 -2
- package/transforms/FlattenTransform.js.flow +5 -7
- package/transforms/GenerateIDFieldTransform.js.flow +4 -5
- package/transforms/GenerateTypeNameTransform.js.flow +4 -6
- package/transforms/InlineDataFragmentTransform.js.flow +3 -4
- package/transforms/InlineFragmentsTransform.js.flow +3 -4
- package/transforms/MaskTransform.js.flow +6 -8
- package/transforms/MatchTransform.js.flow +7 -9
- package/transforms/ReactFlightComponentTransform.js.flow +5 -6
- package/transforms/RefetchableFragmentTransform.js.flow +7 -9
- package/transforms/RelayDirectiveTransform.js.flow +3 -4
- package/transforms/RequiredFieldTransform.js.flow +10 -12
- package/transforms/SkipClientExtensionsTransform.js.flow +2 -2
- package/transforms/SkipHandleFieldTransform.js.flow +2 -2
- package/transforms/SkipRedundantNodesTransform.js.flow +6 -8
- package/transforms/SkipSplitOperationTransform.js.flow +2 -2
- package/transforms/SkipUnreachableNodeTransform.js.flow +3 -4
- package/transforms/SkipUnusedVariablesTransform.js.flow +2 -2
- package/transforms/SplitModuleImportTransform.js.flow +4 -5
- package/transforms/TestOperationTransform.js.flow +2 -2
- package/transforms/ValidateGlobalVariablesTransform.js.flow +3 -4
- package/transforms/ValidateRequiredArgumentsTransform.js.flow +5 -6
- package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +3 -4
- package/transforms/ValidateUnusedVariablesTransform.js.flow +3 -4
- package/transforms/query-generators/FetchableQueryGenerator.js.flow +4 -5
- package/transforms/query-generators/NodeQueryGenerator.js.flow +5 -7
- package/transforms/query-generators/QueryQueryGenerator.js.flow +4 -4
- package/transforms/query-generators/ViewerQueryGenerator.js.flow +4 -4
- package/transforms/query-generators/index.js.flow +4 -5
- package/util/RelayCompilerCache.js.flow +0 -1
- package/util/TimeReporter.js.flow +2 -2
- package/util/argumentContainsVariables.js.flow +1 -1
- package/util/generateAbstractTypeRefinementKey.js.flow +2 -2
- package/util/getDefinitionNodeHash.js.flow +2 -3
- package/util/joinArgumentDefinitions.js.flow +2 -2
@@ -12,10 +12,10 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const chalk = require('chalk');
|
16
|
-
|
17
15
|
import type {Reporter} from './Reporter';
|
18
16
|
|
17
|
+
const chalk = require('chalk');
|
18
|
+
|
19
19
|
function getMemoryUsageString() {
|
20
20
|
return chalk.blue(
|
21
21
|
Math.round(process.memoryUsage().heapUsed / 1024 / 1024) + 'Mb',
|
package/runner/Artifacts.js.flow
CHANGED
@@ -12,15 +12,14 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const crypto = require('crypto');
|
16
|
-
const nullthrows = require('nullthrows');
|
17
|
-
|
18
|
-
const {getName} = require('./GraphQLASTUtils');
|
19
|
-
|
20
15
|
import type CodegenDirectory, {Filesystem} from '../codegen/CodegenDirectory';
|
21
16
|
import type {SourceChanges} from './Sources';
|
22
17
|
import type {ExecutableDefinitionNode} from 'graphql';
|
23
18
|
|
19
|
+
const {getName} = require('./GraphQLASTUtils');
|
20
|
+
const crypto = require('crypto');
|
21
|
+
const nullthrows = require('nullthrows');
|
22
|
+
|
24
23
|
type Filename = string;
|
25
24
|
|
26
25
|
type NodeName = string;
|
@@ -13,12 +13,12 @@
|
|
13
13
|
|
14
14
|
'use strict';
|
15
15
|
|
16
|
-
const fs = require('fs');
|
17
|
-
const invariant = require('invariant');
|
18
|
-
|
19
16
|
import type {Filesystem} from '../codegen/CodegenDirectory';
|
20
17
|
import type {SourceControl} from '../codegen/SourceControl';
|
21
18
|
|
19
|
+
const fs = require('fs');
|
20
|
+
const invariant = require('invariant');
|
21
|
+
|
22
22
|
/**
|
23
23
|
* A filesystem wrapper that buffers file reads and writes until `commit()` is
|
24
24
|
* called.
|
@@ -12,13 +12,12 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
import type {ExecutableDefinitionNode} from 'graphql';
|
16
16
|
|
17
17
|
const {getName} = require('./GraphQLASTUtils');
|
18
|
+
const GraphQLNodeMap = require('./GraphQLNodeMap');
|
18
19
|
const {visit} = require('graphql');
|
19
20
|
|
20
|
-
import type {ExecutableDefinitionNode} from 'graphql';
|
21
|
-
|
22
21
|
type DependencyMap = Map<string, Array<string>>;
|
23
22
|
|
24
23
|
export type NodeGroup = {|
|
@@ -12,12 +12,12 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const {createUserError, createCompilerError} = require('../core/CompilerError');
|
16
|
-
const {getName} = require('./GraphQLASTUtils');
|
17
|
-
|
18
15
|
import type {ExecutableDefinitionNode} from 'graphql';
|
19
16
|
import type {Sources} from 'relay-compiler';
|
20
17
|
|
18
|
+
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
19
|
+
const {getName} = require('./GraphQLASTUtils');
|
20
|
+
|
21
21
|
class GraphQLNodeMap extends Map<string, ExecutableDefinitionNode> {
|
22
22
|
static from(nodes: Iterable<ExecutableDefinitionNode>): GraphQLNodeMap {
|
23
23
|
const result = new GraphQLNodeMap();
|
package/runner/Sources.js.flow
CHANGED
@@ -13,16 +13,15 @@
|
|
13
13
|
|
14
14
|
'use strict';
|
15
15
|
|
16
|
-
const invariant = require('invariant');
|
17
|
-
const md5 = require('../util/md5');
|
18
|
-
|
19
|
-
const {toASTRecord} = require('./extractAST');
|
20
|
-
const {Source, parse} = require('graphql');
|
21
|
-
|
22
16
|
import type {ASTRecord} from './extractAST';
|
23
17
|
import type {SavedStateCollection, WatchmanFile} from './types';
|
24
18
|
import type {ASTNode} from 'graphql';
|
25
19
|
|
20
|
+
const md5 = require('../util/md5');
|
21
|
+
const {toASTRecord} = require('./extractAST');
|
22
|
+
const {Source, parse} = require('graphql');
|
23
|
+
const invariant = require('invariant');
|
24
|
+
|
26
25
|
export type GraphQLExtractor<T: ASTNode> = (
|
27
26
|
baseDir: string,
|
28
27
|
file: WatchmanFile,
|
@@ -12,12 +12,6 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const ASTConvert = require('../core/ASTConvert');
|
16
|
-
const CompilerContext = require('../core/CompilerContext');
|
17
|
-
const RelayParser = require('../core/RelayParser');
|
18
|
-
|
19
|
-
const compileRelayArtifacts = require('../codegen/compileRelayArtifacts');
|
20
|
-
|
21
15
|
import type {ExecutableDefinitionNode, ValidationContext} from 'graphql';
|
22
16
|
import type {
|
23
17
|
GeneratedDefinition,
|
@@ -28,6 +22,11 @@ import type {
|
|
28
22
|
} from 'relay-compiler';
|
29
23
|
import type {GeneratedNode} from 'relay-runtime';
|
30
24
|
|
25
|
+
const compileRelayArtifacts = require('../codegen/compileRelayArtifacts');
|
26
|
+
const ASTConvert = require('../core/ASTConvert');
|
27
|
+
const CompilerContext = require('../core/CompilerContext');
|
28
|
+
const RelayParser = require('../core/RelayParser');
|
29
|
+
|
31
30
|
export type ValidationRule = (context: ValidationContext) => $FlowFixMe;
|
32
31
|
|
33
32
|
function compileArtifacts({
|
@@ -12,15 +12,13 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const JSModuleParser = require('../core/JSModuleParser');
|
16
|
-
|
17
|
-
const invariant = require('invariant');
|
18
|
-
|
19
|
-
const {parse, print} = require('graphql');
|
20
|
-
|
21
15
|
import type {WatchmanFile} from './types';
|
22
16
|
import type {ASTNode, ExecutableDefinitionNode} from 'graphql';
|
23
17
|
|
18
|
+
const JSModuleParser = require('../core/JSModuleParser');
|
19
|
+
const {parse, print} = require('graphql');
|
20
|
+
const invariant = require('invariant');
|
21
|
+
|
24
22
|
export type ASTRecord<T: ASTNode> = {|
|
25
23
|
+ast: T,
|
26
24
|
+text: string,
|
@@ -12,12 +12,12 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const {getName} = require('./GraphQLASTUtils');
|
16
|
-
|
17
15
|
import type {SourceChanges} from './Sources';
|
18
16
|
import type {StrictMap} from './StrictMap';
|
19
17
|
import type {ExecutableDefinitionNode} from 'graphql';
|
20
18
|
|
19
|
+
const {getName} = require('./GraphQLASTUtils');
|
20
|
+
|
21
21
|
function getChangedNodeNames<
|
22
22
|
TProjectState: {
|
23
23
|
+initialDirty: Set<string>,
|
@@ -12,10 +12,10 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const {create} = require('../core/Schema');
|
16
|
-
|
17
15
|
import type {Schema} from '../core/Schema';
|
18
|
-
import type {
|
16
|
+
import type {DocumentNode, Source} from 'graphql';
|
17
|
+
|
18
|
+
const {create} = require('../core/Schema');
|
19
19
|
|
20
20
|
const schemaCache: Map<Source, Schema> = new Map();
|
21
21
|
|
@@ -12,17 +12,6 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
const RelayCompilerScope = require('../core/RelayCompilerScope');
|
17
|
-
|
18
|
-
const getIdentifierForArgumentValue = require('../core/getIdentifierForArgumentValue');
|
19
|
-
const murmurHash = require('../util/murmurHash');
|
20
|
-
|
21
|
-
const {
|
22
|
-
createCompilerError,
|
23
|
-
createNonRecoverableUserError,
|
24
|
-
} = require('../core/CompilerError');
|
25
|
-
|
26
15
|
import type CompilerContext from '../core/CompilerContext';
|
27
16
|
import type {
|
28
17
|
Argument,
|
@@ -40,6 +29,15 @@ import type {
|
|
40
29
|
} from '../core/IR';
|
41
30
|
import type {Scope} from '../core/RelayCompilerScope';
|
42
31
|
|
32
|
+
const {
|
33
|
+
createCompilerError,
|
34
|
+
createNonRecoverableUserError,
|
35
|
+
} = require('../core/CompilerError');
|
36
|
+
const getIdentifierForArgumentValue = require('../core/getIdentifierForArgumentValue');
|
37
|
+
const IRTransformer = require('../core/IRTransformer');
|
38
|
+
const RelayCompilerScope = require('../core/RelayCompilerScope');
|
39
|
+
const murmurHash = require('../util/murmurHash');
|
40
|
+
|
43
41
|
const {getFragmentScope, getRootScope} = RelayCompilerScope;
|
44
42
|
|
45
43
|
type PendingFragment =
|
@@ -12,14 +12,13 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
18
|
-
|
19
15
|
import type CompilerContext from '../core/CompilerContext';
|
20
16
|
import type {Definition, Node, Selection} from '../core/IR';
|
21
17
|
import type {TypeID} from '../core/Schema';
|
22
18
|
|
19
|
+
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
20
|
+
const IRTransformer = require('../core/IRTransformer');
|
21
|
+
|
23
22
|
let cachesByNode = new Map();
|
24
23
|
function clientExtensionTransform(context: CompilerContext): CompilerContext {
|
25
24
|
cachesByNode = new Map();
|
@@ -12,33 +12,31 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
const RelayParser = require('../core/RelayParser');
|
17
|
-
const SchemaUtils = require('../core/SchemaUtils');
|
18
|
-
|
19
|
-
const getLiteralArgumentValues = require('../core/getLiteralArgumentValues');
|
20
|
-
|
21
|
-
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
22
|
-
const {parse} = require('graphql');
|
23
|
-
const {ConnectionInterface, RelayFeatureFlags} = require('relay-runtime');
|
24
|
-
|
25
15
|
import type CompilerContext from '../core/CompilerContext';
|
26
16
|
import type {
|
27
17
|
Argument,
|
18
|
+
Defer,
|
28
19
|
Directive,
|
29
20
|
Fragment,
|
30
21
|
Handle,
|
31
22
|
InlineFragment,
|
32
23
|
LinkedField,
|
24
|
+
Location,
|
33
25
|
Root,
|
34
26
|
Selection,
|
35
27
|
Variable,
|
36
|
-
Location,
|
37
|
-
Defer,
|
38
28
|
} from '../core/IR';
|
39
|
-
import type {
|
29
|
+
import type {CompositeTypeID, Schema} from '../core/Schema';
|
40
30
|
import type {ConnectionMetadata} from 'relay-runtime';
|
41
31
|
|
32
|
+
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
33
|
+
const getLiteralArgumentValues = require('../core/getLiteralArgumentValues');
|
34
|
+
const IRTransformer = require('../core/IRTransformer');
|
35
|
+
const RelayParser = require('../core/RelayParser');
|
36
|
+
const SchemaUtils = require('../core/SchemaUtils');
|
37
|
+
const {parse} = require('graphql');
|
38
|
+
const {ConnectionInterface, RelayFeatureFlags} = require('relay-runtime');
|
39
|
+
|
42
40
|
type Options = {
|
43
41
|
documentName: string,
|
44
42
|
// The current path
|
@@ -12,9 +12,11 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
import type CompilerContext from '../core/CompilerContext';
|
16
|
+
import type {Handle, LinkedField, Root, ScalarField} from '../core/IR';
|
16
17
|
|
17
18
|
const {createUserError} = require('../core/CompilerError');
|
19
|
+
const IRTransformer = require('../core/IRTransformer');
|
18
20
|
const {ConnectionInterface} = require('relay-runtime');
|
19
21
|
|
20
22
|
const DELETE_RECORD = 'deleteRecord';
|
@@ -29,7 +31,6 @@ const LINKED_FIELD_DIRECTIVES = [
|
|
29
31
|
...EDGE_LINKED_FIELD_DIRECTIVES,
|
30
32
|
...NODE_LINKED_FIELD_DIRECTIVES,
|
31
33
|
];
|
32
|
-
|
33
34
|
const SCHEMA_EXTENSION = `
|
34
35
|
directive @${DELETE_RECORD} on FIELD
|
35
36
|
directive @${DELETE_EDGE}(
|
@@ -51,9 +52,6 @@ const SCHEMA_EXTENSION = `
|
|
51
52
|
) on FIELD
|
52
53
|
`;
|
53
54
|
|
54
|
-
import type CompilerContext from '../core/CompilerContext';
|
55
|
-
import type {ScalarField, LinkedField, Root, Handle} from '../core/IR';
|
56
|
-
|
57
55
|
function transform(context: CompilerContext): CompilerContext {
|
58
56
|
return IRTransformer.transform(context, {
|
59
57
|
ScalarField: visitScalarField,
|
@@ -12,13 +12,6 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const getIdentifierForArgumentValue = require('../core/getIdentifierForArgumentValue');
|
18
|
-
const murmurHash = require('../util/murmurHash');
|
19
|
-
|
20
|
-
const {createUserError} = require('../core/CompilerError');
|
21
|
-
|
22
15
|
import type CompilerContext from '../core/CompilerContext';
|
23
16
|
import type {
|
24
17
|
Argument,
|
@@ -31,6 +24,11 @@ import type {
|
|
31
24
|
Stream,
|
32
25
|
} from '../core/IR';
|
33
26
|
|
27
|
+
const {createUserError} = require('../core/CompilerError');
|
28
|
+
const getIdentifierForArgumentValue = require('../core/getIdentifierForArgumentValue');
|
29
|
+
const IRTransformer = require('../core/IRTransformer');
|
30
|
+
const murmurHash = require('../util/murmurHash');
|
31
|
+
|
34
32
|
type State = {|
|
35
33
|
+documentName: string,
|
36
34
|
+recordLabel: (label: string, directive: Directive) => void,
|
@@ -12,12 +12,11 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
import type CompilerContext from '../core/CompilerContext';
|
16
|
+
import type {LinkedField, ScalarField} from '../core/IR';
|
16
17
|
|
17
18
|
const {createUserError} = require('../core/CompilerError');
|
18
|
-
|
19
|
-
import type CompilerContext from '../core/CompilerContext';
|
20
|
-
import type {ScalarField, LinkedField} from '../core/IR';
|
19
|
+
const IRTransformer = require('../core/IRTransformer');
|
21
20
|
|
22
21
|
function visitField<T: ScalarField | LinkedField>(field: T): T {
|
23
22
|
if (field.alias === 'id' && field.name !== 'id') {
|
@@ -12,13 +12,12 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRValidator = require('../core/IRValidator');
|
16
|
-
|
17
|
-
const {createUserError} = require('../core/CompilerError');
|
18
|
-
|
19
15
|
import type CompilerContext from '../core/CompilerContext';
|
20
16
|
import type {Root} from '../core/IR';
|
21
17
|
|
18
|
+
const {createUserError} = require('../core/CompilerError');
|
19
|
+
const IRValidator = require('../core/IRValidator');
|
20
|
+
|
22
21
|
function visitRoot(node: Root) {
|
23
22
|
for (const selection of node.selections) {
|
24
23
|
if (selection.kind === 'ScalarField' && selection.name === '__typename') {
|
@@ -12,17 +12,15 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
+
import type CompilerContext from '../core/CompilerContext';
|
16
|
+
import type {LinkedField, ScalarField} from '../core/IR';
|
17
|
+
|
15
18
|
const IRTransformer = require('../core/IRTransformer');
|
16
19
|
const SchemaUtils = require('../core/SchemaUtils');
|
17
|
-
|
18
20
|
const invariant = require('invariant');
|
19
21
|
const nullthrows = require('nullthrows');
|
20
|
-
|
21
22
|
const {getRelayHandleKey} = require('relay-runtime');
|
22
23
|
|
23
|
-
import type CompilerContext from '../core/CompilerContext';
|
24
|
-
import type {LinkedField, ScalarField} from '../core/IR';
|
25
|
-
|
26
24
|
function fieldHandleTransform(context: CompilerContext): CompilerContext {
|
27
25
|
return IRTransformer.transform(context, {
|
28
26
|
LinkedField: visitField,
|
@@ -10,11 +10,11 @@
|
|
10
10
|
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
const IRTransformer = require('../core/IRTransformer');
|
14
|
-
|
15
13
|
import type CompilerContext from '../core/CompilerContext';
|
16
14
|
import type {Directive} from '../core/IR';
|
17
15
|
|
16
|
+
const IRTransformer = require('../core/IRTransformer');
|
17
|
+
|
18
18
|
const COMPILE_TIME_DIRECTIVES = new Set(['required']);
|
19
19
|
|
20
20
|
/**
|
@@ -12,11 +12,11 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
15
|
import type CompilerContext from '../core/CompilerContext';
|
18
16
|
import type {Directive} from '../core/IR';
|
19
17
|
|
18
|
+
const IRTransformer = require('../core/IRTransformer');
|
19
|
+
|
20
20
|
/**
|
21
21
|
* A transform that removes any directives that were not present in the
|
22
22
|
* server schema.
|
@@ -12,13 +12,6 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const areEqualArgValues = require('../util/areEqualArgValues');
|
18
|
-
const getIdentifierForSelection = require('../core/getIdentifierForSelection');
|
19
|
-
|
20
|
-
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
21
|
-
|
22
15
|
import type CompilerContext from '../core/CompilerContext';
|
23
16
|
import type {
|
24
17
|
Argument,
|
@@ -32,6 +25,11 @@ import type {
|
|
32
25
|
} from '../core/IR';
|
33
26
|
import type {Schema, TypeID} from '../core/Schema';
|
34
27
|
|
28
|
+
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
29
|
+
const getIdentifierForSelection = require('../core/getIdentifierForSelection');
|
30
|
+
const IRTransformer = require('../core/IRTransformer');
|
31
|
+
const areEqualArgValues = require('../util/areEqualArgValues');
|
32
|
+
|
35
33
|
export type FlattenOptions = {|+isForCodegen?: boolean|};
|
36
34
|
|
37
35
|
type State = {|
|
@@ -12,15 +12,14 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const {generateIDField} = require('../core/SchemaUtils');
|
18
|
-
const {hasUnaliasedSelection} = require('./TransformUtils');
|
19
|
-
|
20
15
|
import type CompilerContext from '../core/CompilerContext';
|
21
16
|
import type {InlineFragment, LinkedField, ScalarField} from '../core/IR';
|
22
17
|
import type {CompositeTypeID} from '../core/Schema';
|
23
18
|
|
19
|
+
const IRTransformer = require('../core/IRTransformer');
|
20
|
+
const {generateIDField} = require('../core/SchemaUtils');
|
21
|
+
const {hasUnaliasedSelection} = require('./TransformUtils');
|
22
|
+
|
24
23
|
const ID = 'id';
|
25
24
|
const NODE_TYPE = 'Node';
|
26
25
|
|
@@ -12,12 +12,6 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const generateAbstractTypeRefinementKey = require('../util/generateAbstractTypeRefinementKey');
|
18
|
-
|
19
|
-
const {hasUnaliasedSelection} = require('./TransformUtils');
|
20
|
-
|
21
15
|
import type CompilerContext from '../core/CompilerContext';
|
22
16
|
import type {
|
23
17
|
Fragment,
|
@@ -27,6 +21,10 @@ import type {
|
|
27
21
|
} from '../core/IR';
|
28
22
|
import type {Schema} from '../core/Schema';
|
29
23
|
|
24
|
+
const IRTransformer = require('../core/IRTransformer');
|
25
|
+
const generateAbstractTypeRefinementKey = require('../util/generateAbstractTypeRefinementKey');
|
26
|
+
const {hasUnaliasedSelection} = require('./TransformUtils');
|
27
|
+
|
30
28
|
const TYPENAME_KEY = '__typename';
|
31
29
|
|
32
30
|
type State = {|
|
@@ -12,10 +12,6 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const {createUserError} = require('../core/CompilerError');
|
18
|
-
|
19
15
|
import type CompilerContext from '../core/CompilerContext';
|
20
16
|
import type {
|
21
17
|
Fragment,
|
@@ -23,6 +19,9 @@ import type {
|
|
23
19
|
InlineDataFragmentSpread,
|
24
20
|
} from '../core/IR';
|
25
21
|
|
22
|
+
const {createUserError} = require('../core/CompilerError');
|
23
|
+
const IRTransformer = require('../core/IRTransformer');
|
24
|
+
|
26
25
|
const SCHEMA_EXTENSION = `
|
27
26
|
directive @inline on FRAGMENT_DEFINITION
|
28
27
|
`;
|
@@ -12,13 +12,12 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
import type CompilerContext from '../core/CompilerContext';
|
16
|
+
import type {Fragment, FragmentSpread, InlineFragment} from '../core/IR';
|
16
17
|
|
18
|
+
const IRTransformer = require('../core/IRTransformer');
|
17
19
|
const invariant = require('invariant');
|
18
20
|
|
19
|
-
import type CompilerContext from '../core/CompilerContext';
|
20
|
-
import type {InlineFragment, Fragment, FragmentSpread} from '../core/IR';
|
21
|
-
|
22
21
|
type FragmentVisitorCache = Map<FragmentSpread, FragmentSpread>;
|
23
22
|
type FragmentVisitor = (fragmentSpread: FragmentSpread) => ?FragmentSpread;
|
24
23
|
/**
|
@@ -12,21 +12,19 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const invariant = require('invariant');
|
18
|
-
const joinArgumentDefinitions = require('../util/joinArgumentDefinitions');
|
19
|
-
|
20
|
-
const {createUserError} = require('../core/CompilerError');
|
21
|
-
|
22
15
|
import type CompilerContext from '../core/CompilerContext';
|
23
16
|
import type {
|
17
|
+
ArgumentDefinition,
|
24
18
|
Fragment,
|
25
19
|
FragmentSpread,
|
26
20
|
InlineFragment,
|
27
|
-
ArgumentDefinition,
|
28
21
|
} from '../core/IR';
|
29
22
|
|
23
|
+
const {createUserError} = require('../core/CompilerError');
|
24
|
+
const IRTransformer = require('../core/IRTransformer');
|
25
|
+
const joinArgumentDefinitions = require('../util/joinArgumentDefinitions');
|
26
|
+
const invariant = require('invariant');
|
27
|
+
|
30
28
|
type State = {reachableArguments: Array<ArgumentDefinition>, ...};
|
31
29
|
|
32
30
|
/**
|
@@ -12,24 +12,22 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const IRTransformer = require('../core/IRTransformer');
|
16
|
-
|
17
|
-
const getLiteralArgumentValues = require('../core/getLiteralArgumentValues');
|
18
|
-
const getNormalizationOperationName = require('../core/getNormalizationOperationName');
|
19
|
-
|
20
|
-
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
21
|
-
const {getModuleComponentKey, getModuleOperationKey} = require('relay-runtime');
|
22
|
-
|
23
15
|
import type CompilerContext from '../core/CompilerContext';
|
24
16
|
import type {
|
25
|
-
InlineFragment,
|
26
17
|
FragmentSpread,
|
18
|
+
InlineFragment,
|
27
19
|
LinkedField,
|
28
20
|
Location,
|
29
21
|
ScalarField,
|
30
22
|
} from '../core/IR';
|
31
23
|
import type {TypeID} from '../core/Schema';
|
32
24
|
|
25
|
+
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
26
|
+
const getLiteralArgumentValues = require('../core/getLiteralArgumentValues');
|
27
|
+
const getNormalizationOperationName = require('../core/getNormalizationOperationName');
|
28
|
+
const IRTransformer = require('../core/IRTransformer');
|
29
|
+
const {getModuleComponentKey, getModuleOperationKey} = require('relay-runtime');
|
30
|
+
|
33
31
|
const SUPPORTED_ARGUMENT_NAME = 'supported';
|
34
32
|
|
35
33
|
const JS_FIELD_TYPE = 'JSDependency';
|
@@ -11,14 +11,13 @@
|
|
11
11
|
|
12
12
|
'use strict';
|
13
13
|
|
14
|
-
const IRTransformer = require('../core/IRTransformer');
|
15
|
-
|
16
|
-
const {createUserError, createCompilerError} = require('../core/CompilerError');
|
17
|
-
const {RelayFeatureFlags} = require('relay-runtime');
|
18
|
-
|
19
14
|
import type CompilerContext from '../core/CompilerContext';
|
20
15
|
import type {ScalarField} from '../core/IR';
|
21
|
-
import type {
|
16
|
+
import type {InputTypeID, ScalarFieldTypeID, TypeID} from '../core/Schema';
|
17
|
+
|
18
|
+
const {createCompilerError, createUserError} = require('../core/CompilerError');
|
19
|
+
const IRTransformer = require('../core/IRTransformer');
|
20
|
+
const {RelayFeatureFlags} = require('relay-runtime');
|
22
21
|
|
23
22
|
const FLIGHT_FIELD_COMPONENT_ARGUMENT_TYPE = 'String';
|
24
23
|
const FLIGHT_FIELD_COMPONENT_ARGUMENT_NAME = 'component';
|
@@ -12,22 +12,20 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
import type CompilerContext from '../core/CompilerContext';
|
16
|
+
import type {Argument, Field, Fragment} from '../core/IR';
|
17
|
+
import type {Schema} from '../core/Schema';
|
18
|
+
import type {ReaderPaginationMetadata} from 'relay-runtime';
|
19
19
|
|
20
20
|
const {
|
21
21
|
createUserError,
|
22
22
|
eachWithCombinedError,
|
23
23
|
} = require('../core/CompilerError');
|
24
|
+
const getLiteralArgumentValues = require('../core/getLiteralArgumentValues');
|
25
|
+
const inferRootArgumentDefinitions = require('../core/inferRootArgumentDefinitions');
|
26
|
+
const IRVisitor = require('../core/IRVisitor');
|
24
27
|
const {buildRefetchOperation} = require('./query-generators');
|
25
28
|
|
26
|
-
import type CompilerContext from '../core/CompilerContext';
|
27
|
-
import type {Argument, Field, Fragment} from '../core/IR';
|
28
|
-
import type {Schema} from '../core/Schema';
|
29
|
-
import type {ReaderPaginationMetadata} from 'relay-runtime';
|
30
|
-
|
31
29
|
const SCHEMA_EXTENSION = `
|
32
30
|
directive @refetchable(
|
33
31
|
queryName: String!
|