relay-compiler 0.0.0-main-8ff54d69 → 0.0.0-main-38f1c96e
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 -24
- package/win-x64/relay.exe +0 -0
- package/bin/RelayCompilerBin.js.flow +0 -168
- package/bin/RelayCompilerMain.js.flow +0 -515
- package/bin/__fixtures__/plugin-module.js.flow +0 -17
- package/bin/relay-compiler +0 -19068
- 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 -566
- 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 -1741
- 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 -488
- 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/test-utils/TestSchema.js +0 -27
- package/lib/test-utils/parseGraphQLText.js +0 -30
- 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/test-utils/TestSchema.js.flow +0 -30
- package/test-utils/parseGraphQLText.js.flow +0 -41
- 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 -207
- 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 -277
- 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 -130
- package/transforms/ValidateServerOnlyDirectivesTransform.js.flow +0 -128
- 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 -156
- 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,245 +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
|
-
* @flow strict-local
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
import type CompilerContext from '../core/CompilerContext';
|
16
|
-
import type {Handle, LinkedField, Root, ScalarField} from '../core/IR';
|
17
|
-
|
18
|
-
const {createUserError} = require('../core/CompilerError');
|
19
|
-
const IRTransformer = require('../core/IRTransformer');
|
20
|
-
const {ConnectionInterface} = require('relay-runtime');
|
21
|
-
|
22
|
-
const DELETE_RECORD = 'deleteRecord';
|
23
|
-
const DELETE_EDGE = 'deleteEdge';
|
24
|
-
const APPEND_EDGE = 'appendEdge';
|
25
|
-
const PREPEND_EDGE = 'prependEdge';
|
26
|
-
const APPEND_NODE = 'appendNode';
|
27
|
-
const PREPEND_NODE = 'prependNode';
|
28
|
-
const EDGE_LINKED_FIELD_DIRECTIVES = [APPEND_EDGE, PREPEND_EDGE];
|
29
|
-
const NODE_LINKED_FIELD_DIRECTIVES = [APPEND_NODE, PREPEND_NODE];
|
30
|
-
const LINKED_FIELD_DIRECTIVES = [
|
31
|
-
...EDGE_LINKED_FIELD_DIRECTIVES,
|
32
|
-
...NODE_LINKED_FIELD_DIRECTIVES,
|
33
|
-
];
|
34
|
-
const SCHEMA_EXTENSION = `
|
35
|
-
directive @${DELETE_RECORD} on FIELD
|
36
|
-
directive @${DELETE_EDGE}(
|
37
|
-
connections: [ID!]!
|
38
|
-
) on FIELD
|
39
|
-
directive @${APPEND_EDGE}(
|
40
|
-
connections: [ID!]!
|
41
|
-
) on FIELD
|
42
|
-
directive @${PREPEND_EDGE}(
|
43
|
-
connections: [ID!]!
|
44
|
-
) on FIELD
|
45
|
-
directive @${APPEND_NODE}(
|
46
|
-
connections: [ID!]!
|
47
|
-
edgeTypeName: String!
|
48
|
-
) on FIELD
|
49
|
-
directive @${PREPEND_NODE}(
|
50
|
-
connections: [ID!]!
|
51
|
-
edgeTypeName: String!
|
52
|
-
) on FIELD
|
53
|
-
`;
|
54
|
-
|
55
|
-
function transform(context: CompilerContext): CompilerContext {
|
56
|
-
return IRTransformer.transform(context, {
|
57
|
-
ScalarField: visitScalarField,
|
58
|
-
LinkedField: visitLinkedField,
|
59
|
-
SplitOperation: skip,
|
60
|
-
Fragment: skip,
|
61
|
-
});
|
62
|
-
}
|
63
|
-
|
64
|
-
function skip<T>(node: T): T {
|
65
|
-
return node;
|
66
|
-
}
|
67
|
-
|
68
|
-
function visitScalarField(field: ScalarField): ScalarField {
|
69
|
-
const linkedFieldDirective = field.directives.find(
|
70
|
-
directive => LINKED_FIELD_DIRECTIVES.indexOf(directive.name) > -1,
|
71
|
-
);
|
72
|
-
if (linkedFieldDirective != null) {
|
73
|
-
throw createUserError(
|
74
|
-
`Invalid use of @${linkedFieldDirective.name} on scalar field '${field.name}'`,
|
75
|
-
[linkedFieldDirective.loc],
|
76
|
-
);
|
77
|
-
}
|
78
|
-
const deleteNodeDirective = field.directives.find(
|
79
|
-
directive => directive.name === DELETE_RECORD,
|
80
|
-
);
|
81
|
-
const deleteEdgeDirective = field.directives.find(
|
82
|
-
directive => directive.name === DELETE_EDGE,
|
83
|
-
);
|
84
|
-
if (deleteNodeDirective != null && deleteEdgeDirective != null) {
|
85
|
-
throw createUserError(
|
86
|
-
`Both @deleteNode and @deleteEdge are used on field '${field.name}'. Only one directive is supported for now.`,
|
87
|
-
[deleteNodeDirective.loc, deleteEdgeDirective.loc],
|
88
|
-
);
|
89
|
-
}
|
90
|
-
const targetDirective = deleteNodeDirective ?? deleteEdgeDirective;
|
91
|
-
if (targetDirective == null) {
|
92
|
-
return field;
|
93
|
-
}
|
94
|
-
|
95
|
-
const schema = this.getContext().getSchema();
|
96
|
-
|
97
|
-
if (!schema.isId(schema.getRawType(field.type))) {
|
98
|
-
throw createUserError(
|
99
|
-
`Invalid use of @${targetDirective.name} on field '${
|
100
|
-
field.name
|
101
|
-
}'. Expected field to return an ID or list of ID values, got ${schema.getTypeString(
|
102
|
-
field.type,
|
103
|
-
)}.`,
|
104
|
-
[targetDirective.loc],
|
105
|
-
);
|
106
|
-
}
|
107
|
-
const connectionsArg = targetDirective.args.find(
|
108
|
-
arg => arg.name === 'connections',
|
109
|
-
);
|
110
|
-
const handle: Handle = {
|
111
|
-
name: targetDirective.name,
|
112
|
-
key: '',
|
113
|
-
dynamicKey: null,
|
114
|
-
filters: null,
|
115
|
-
handleArgs: connectionsArg ? [connectionsArg] : undefined,
|
116
|
-
};
|
117
|
-
return {
|
118
|
-
...field,
|
119
|
-
directives: field.directives.filter(
|
120
|
-
directive => directive !== targetDirective,
|
121
|
-
),
|
122
|
-
handles: field.handles ? [...field.handles, handle] : [handle],
|
123
|
-
};
|
124
|
-
}
|
125
|
-
|
126
|
-
function visitLinkedField(field: LinkedField): LinkedField {
|
127
|
-
const transformedField = this.traverse(field);
|
128
|
-
const deleteDirective = transformedField.directives.find(
|
129
|
-
directive => directive.name === DELETE_RECORD,
|
130
|
-
);
|
131
|
-
if (deleteDirective != null) {
|
132
|
-
throw createUserError(
|
133
|
-
`Invalid use of @${deleteDirective.name} on scalar field '${transformedField.name}'.`,
|
134
|
-
[deleteDirective.loc],
|
135
|
-
);
|
136
|
-
}
|
137
|
-
const edgeDirective = transformedField.directives.find(
|
138
|
-
directive => EDGE_LINKED_FIELD_DIRECTIVES.indexOf(directive.name) > -1,
|
139
|
-
);
|
140
|
-
const nodeDirective = transformedField.directives.find(
|
141
|
-
directive => NODE_LINKED_FIELD_DIRECTIVES.indexOf(directive.name) > -1,
|
142
|
-
);
|
143
|
-
|
144
|
-
if (edgeDirective == null && nodeDirective == null) {
|
145
|
-
return transformedField;
|
146
|
-
}
|
147
|
-
if (edgeDirective != null && nodeDirective != null) {
|
148
|
-
throw createUserError(
|
149
|
-
`Invalid use of @${edgeDirective.name} and @${nodeDirective.name} on field '${transformedField.name}' - these directives cannot be used together.`,
|
150
|
-
[edgeDirective.loc],
|
151
|
-
);
|
152
|
-
}
|
153
|
-
const targetDirective = edgeDirective ?? nodeDirective;
|
154
|
-
const connectionsArg = targetDirective.args.find(
|
155
|
-
arg => arg.name === 'connections',
|
156
|
-
);
|
157
|
-
if (connectionsArg == null) {
|
158
|
-
throw createUserError(
|
159
|
-
`Expected the 'connections' argument to be defined on @${targetDirective.name}.`,
|
160
|
-
[targetDirective.loc],
|
161
|
-
);
|
162
|
-
}
|
163
|
-
const schema = this.getContext().getSchema();
|
164
|
-
if (edgeDirective) {
|
165
|
-
const fieldType = schema.getRawType(transformedField.type);
|
166
|
-
const fields = schema.getFields(fieldType);
|
167
|
-
let cursorFieldID;
|
168
|
-
let nodeFieldID;
|
169
|
-
for (const fieldID of fields) {
|
170
|
-
const fieldName = schema.getFieldName(fieldID);
|
171
|
-
if (fieldName === ConnectionInterface.get().CURSOR) {
|
172
|
-
cursorFieldID = fieldID;
|
173
|
-
} else if (fieldName === ConnectionInterface.get().NODE) {
|
174
|
-
nodeFieldID = fieldID;
|
175
|
-
}
|
176
|
-
}
|
177
|
-
|
178
|
-
// Edge
|
179
|
-
if (cursorFieldID != null && nodeFieldID != null) {
|
180
|
-
const handle: Handle = {
|
181
|
-
name: edgeDirective.name,
|
182
|
-
key: '',
|
183
|
-
dynamicKey: null,
|
184
|
-
filters: null,
|
185
|
-
handleArgs: [connectionsArg],
|
186
|
-
};
|
187
|
-
return {
|
188
|
-
...transformedField,
|
189
|
-
directives: transformedField.directives.filter(
|
190
|
-
directive => directive !== edgeDirective,
|
191
|
-
),
|
192
|
-
handles: transformedField.handles
|
193
|
-
? [...transformedField.handles, handle]
|
194
|
-
: [handle],
|
195
|
-
};
|
196
|
-
}
|
197
|
-
throw createUserError(
|
198
|
-
`Unsupported use of @${edgeDirective.name} on field '${transformedField.name}', expected an edge field (a field with 'cursor' and 'node' selection).`,
|
199
|
-
[targetDirective.loc],
|
200
|
-
);
|
201
|
-
} else {
|
202
|
-
// Node
|
203
|
-
const edgeTypeNameArg = nodeDirective.args.find(
|
204
|
-
arg => arg.name === 'edgeTypeName',
|
205
|
-
);
|
206
|
-
if (!edgeTypeNameArg) {
|
207
|
-
throw createUserError(
|
208
|
-
`Unsupported use of @${nodeDirective.name} on field '${transformedField.name}', 'edgeTypeName' argument must be provided.`,
|
209
|
-
[targetDirective.loc],
|
210
|
-
);
|
211
|
-
}
|
212
|
-
const rawType = schema.getRawType(transformedField.type);
|
213
|
-
if (schema.canHaveSelections(rawType)) {
|
214
|
-
const handle: Handle = {
|
215
|
-
name: nodeDirective.name,
|
216
|
-
key: '',
|
217
|
-
dynamicKey: null,
|
218
|
-
filters: null,
|
219
|
-
handleArgs: [connectionsArg, edgeTypeNameArg],
|
220
|
-
};
|
221
|
-
return {
|
222
|
-
...transformedField,
|
223
|
-
directives: transformedField.directives.filter(
|
224
|
-
directive => directive !== nodeDirective,
|
225
|
-
),
|
226
|
-
handles: transformedField.handles
|
227
|
-
? [...transformedField.handles, handle]
|
228
|
-
: [handle],
|
229
|
-
};
|
230
|
-
}
|
231
|
-
throw createUserError(
|
232
|
-
`Unsupported use of @${nodeDirective.name} on field '${
|
233
|
-
transformedField.name
|
234
|
-
}'. Expected an object, union or interface, but got '${schema.getTypeString(
|
235
|
-
transformedField.type,
|
236
|
-
)}'.`,
|
237
|
-
[nodeDirective.loc],
|
238
|
-
);
|
239
|
-
}
|
240
|
-
}
|
241
|
-
|
242
|
-
module.exports = {
|
243
|
-
SCHEMA_EXTENSION,
|
244
|
-
transform,
|
245
|
-
};
|
@@ -1,263 +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
|
-
* @flow strict-local
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
import type CompilerContext from '../core/CompilerContext';
|
16
|
-
import type {
|
17
|
-
Argument,
|
18
|
-
Defer,
|
19
|
-
Directive,
|
20
|
-
FragmentSpread,
|
21
|
-
InlineFragment,
|
22
|
-
LinkedField,
|
23
|
-
ScalarField,
|
24
|
-
Stream,
|
25
|
-
} from '../core/IR';
|
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
|
-
|
32
|
-
type State = {|
|
33
|
-
+documentName: string,
|
34
|
-
+recordLabel: (label: string, directive: Directive) => void,
|
35
|
-
|};
|
36
|
-
|
37
|
-
/**
|
38
|
-
* This transform finds usages of @defer and @stream, validates them, and
|
39
|
-
* converts the using node to specialized IR nodes (Defer/Stream).
|
40
|
-
*/
|
41
|
-
function deferStreamTransform(context: CompilerContext): CompilerContext {
|
42
|
-
return IRTransformer.transform(
|
43
|
-
context,
|
44
|
-
{
|
45
|
-
// TODO: type IRTransformer to allow changing result type
|
46
|
-
FragmentSpread: (visitFragmentSpread: $FlowFixMe),
|
47
|
-
// TODO: type IRTransformer to allow changing result type
|
48
|
-
InlineFragment: (visitInlineFragment: $FlowFixMe),
|
49
|
-
// TODO: type IRTransformer to allow changing result type
|
50
|
-
LinkedField: (visitLinkedField: $FlowFixMe),
|
51
|
-
ScalarField: visitScalarField,
|
52
|
-
},
|
53
|
-
sourceNode => {
|
54
|
-
const labels = new Map();
|
55
|
-
return {
|
56
|
-
documentName: sourceNode.name,
|
57
|
-
recordLabel: (label, directive) => {
|
58
|
-
const prevDirective = labels.get(label);
|
59
|
-
if (prevDirective) {
|
60
|
-
const labelArg = directive.args.find(({name}) => name === 'label');
|
61
|
-
const prevLabelArg = prevDirective.args.find(
|
62
|
-
({name}) => name === 'label',
|
63
|
-
);
|
64
|
-
const previousLocation = prevLabelArg?.loc ?? prevDirective.loc;
|
65
|
-
if (labelArg) {
|
66
|
-
throw createUserError(
|
67
|
-
`Invalid use of @${directive.name}, the provided label is ` +
|
68
|
-
"not unique. Specify a unique 'label' as a literal string.",
|
69
|
-
[labelArg?.loc, previousLocation],
|
70
|
-
);
|
71
|
-
} else {
|
72
|
-
throw createUserError(
|
73
|
-
`Invalid use of @${directive.name}, could not generate a ` +
|
74
|
-
"default label that is unique. Specify a unique 'label' " +
|
75
|
-
'as a literal string.',
|
76
|
-
[directive.loc, previousLocation],
|
77
|
-
);
|
78
|
-
}
|
79
|
-
}
|
80
|
-
labels.set(label, directive);
|
81
|
-
},
|
82
|
-
};
|
83
|
-
},
|
84
|
-
);
|
85
|
-
}
|
86
|
-
|
87
|
-
function visitLinkedField(
|
88
|
-
field: LinkedField,
|
89
|
-
state: State,
|
90
|
-
): LinkedField | Stream {
|
91
|
-
const context: CompilerContext = this.getContext();
|
92
|
-
const schema = context.getSchema();
|
93
|
-
|
94
|
-
let transformedField: LinkedField = this.traverse(field, state);
|
95
|
-
const streamDirective = transformedField.directives.find(
|
96
|
-
directive => directive.name === 'stream',
|
97
|
-
);
|
98
|
-
if (streamDirective == null) {
|
99
|
-
return transformedField;
|
100
|
-
}
|
101
|
-
const type = schema.getNullableType(field.type);
|
102
|
-
if (!schema.isList(type)) {
|
103
|
-
throw createUserError(
|
104
|
-
`Invalid use of @stream on non-plural field '${field.name}'`,
|
105
|
-
[streamDirective.loc],
|
106
|
-
);
|
107
|
-
}
|
108
|
-
transformedField = {
|
109
|
-
...transformedField,
|
110
|
-
directives: transformedField.directives.filter(
|
111
|
-
directive => directive.name !== 'stream',
|
112
|
-
),
|
113
|
-
};
|
114
|
-
const ifArg = streamDirective.args.find(arg => arg.name === 'if');
|
115
|
-
if (isLiteralFalse(ifArg)) {
|
116
|
-
return transformedField;
|
117
|
-
}
|
118
|
-
const initialCount = streamDirective.args.find(
|
119
|
-
arg => arg.name === 'initial_count',
|
120
|
-
);
|
121
|
-
if (initialCount == null) {
|
122
|
-
throw createUserError(
|
123
|
-
"Invalid use of @stream, the 'initial_count' argument is required.",
|
124
|
-
[streamDirective.loc],
|
125
|
-
);
|
126
|
-
}
|
127
|
-
const useCustomizedBatch = streamDirective.args.find(
|
128
|
-
arg => arg.name === 'use_customized_batch',
|
129
|
-
);
|
130
|
-
|
131
|
-
const label =
|
132
|
-
getLiteralStringArgument(streamDirective, 'label') ?? field.alias;
|
133
|
-
const transformedLabel = transformLabel(state.documentName, 'stream', label);
|
134
|
-
state.recordLabel(transformedLabel, streamDirective);
|
135
|
-
return {
|
136
|
-
if: ifArg?.value ?? null,
|
137
|
-
initialCount: initialCount.value,
|
138
|
-
useCustomizedBatch: useCustomizedBatch?.value ?? null,
|
139
|
-
kind: 'Stream',
|
140
|
-
label: transformedLabel,
|
141
|
-
loc: {kind: 'Derived', source: streamDirective.loc},
|
142
|
-
metadata: null,
|
143
|
-
selections: [transformedField],
|
144
|
-
};
|
145
|
-
}
|
146
|
-
|
147
|
-
function visitScalarField(field: ScalarField, state: State): ScalarField {
|
148
|
-
const streamDirective = field.directives.find(
|
149
|
-
directive => directive.name === 'stream',
|
150
|
-
);
|
151
|
-
if (streamDirective != null) {
|
152
|
-
throw createUserError(
|
153
|
-
`Invalid use of @stream on scalar field '${field.name}'`,
|
154
|
-
[streamDirective.loc],
|
155
|
-
);
|
156
|
-
}
|
157
|
-
return this.traverse(field, state);
|
158
|
-
}
|
159
|
-
|
160
|
-
function visitInlineFragment(
|
161
|
-
fragment: InlineFragment,
|
162
|
-
state: State,
|
163
|
-
): InlineFragment | Defer {
|
164
|
-
const deferDirective = fragment.directives.find(
|
165
|
-
directive => directive.name === 'defer',
|
166
|
-
);
|
167
|
-
if (deferDirective != null) {
|
168
|
-
throw createUserError(
|
169
|
-
'Invalid use of @defer on an inline fragment, @defer is only supported on fragment spreads.',
|
170
|
-
[fragment.loc],
|
171
|
-
);
|
172
|
-
}
|
173
|
-
return this.traverse(fragment, state);
|
174
|
-
}
|
175
|
-
|
176
|
-
function visitFragmentSpread(
|
177
|
-
spread: FragmentSpread,
|
178
|
-
state: State,
|
179
|
-
): FragmentSpread | Defer {
|
180
|
-
let transformedSpread: FragmentSpread = this.traverse(spread, state);
|
181
|
-
const deferDirective = transformedSpread.directives.find(
|
182
|
-
directive => directive.name === 'defer',
|
183
|
-
);
|
184
|
-
if (deferDirective == null) {
|
185
|
-
return transformedSpread;
|
186
|
-
}
|
187
|
-
transformedSpread = {
|
188
|
-
...transformedSpread,
|
189
|
-
directives: transformedSpread.directives.filter(
|
190
|
-
directive => directive.name !== 'defer',
|
191
|
-
),
|
192
|
-
};
|
193
|
-
const ifArg = deferDirective.args.find(arg => arg.name === 'if');
|
194
|
-
if (isLiteralFalse(ifArg)) {
|
195
|
-
return transformedSpread;
|
196
|
-
}
|
197
|
-
const label =
|
198
|
-
getLiteralStringArgument(deferDirective, 'label') ??
|
199
|
-
getFragmentSpreadName(spread);
|
200
|
-
const transformedLabel = transformLabel(state.documentName, 'defer', label);
|
201
|
-
state.recordLabel(transformedLabel, deferDirective);
|
202
|
-
return {
|
203
|
-
if: ifArg?.value ?? null,
|
204
|
-
kind: 'Defer',
|
205
|
-
label: transformedLabel,
|
206
|
-
loc: {kind: 'Derived', source: deferDirective.loc},
|
207
|
-
selections: [transformedSpread],
|
208
|
-
};
|
209
|
-
}
|
210
|
-
|
211
|
-
function getLiteralStringArgument(
|
212
|
-
directive: Directive,
|
213
|
-
argName: string,
|
214
|
-
): ?string {
|
215
|
-
const arg = directive.args.find(({name}) => name === argName);
|
216
|
-
if (arg == null) {
|
217
|
-
return null;
|
218
|
-
}
|
219
|
-
const value = arg.value.kind === 'Literal' ? arg.value.value : null;
|
220
|
-
if (value == null || typeof value !== 'string') {
|
221
|
-
throw createUserError(
|
222
|
-
`Expected the '${argName}' value to @${directive.name} to be a string literal if provided.`,
|
223
|
-
[arg.value.loc],
|
224
|
-
);
|
225
|
-
}
|
226
|
-
return value;
|
227
|
-
}
|
228
|
-
|
229
|
-
function transformLabel(
|
230
|
-
parentName: string,
|
231
|
-
directive: string,
|
232
|
-
label: string,
|
233
|
-
): string {
|
234
|
-
return `${parentName}$${directive}$${label}`;
|
235
|
-
}
|
236
|
-
|
237
|
-
function isLiteralFalse(arg: ?Argument): boolean {
|
238
|
-
return (
|
239
|
-
arg != null && arg.value.kind === 'Literal' && arg.value.value === false
|
240
|
-
);
|
241
|
-
}
|
242
|
-
|
243
|
-
function getFragmentSpreadName(fragmentSpread: FragmentSpread): string {
|
244
|
-
if (fragmentSpread.args.length === 0) {
|
245
|
-
return fragmentSpread.name;
|
246
|
-
}
|
247
|
-
const sortedArgs = [...fragmentSpread.args]
|
248
|
-
.sort((a, b) => {
|
249
|
-
return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
|
250
|
-
})
|
251
|
-
.map(argument => {
|
252
|
-
return {
|
253
|
-
name: argument.name,
|
254
|
-
value: getIdentifierForArgumentValue(argument.value),
|
255
|
-
};
|
256
|
-
});
|
257
|
-
const hash = murmurHash(JSON.stringify(sortedArgs));
|
258
|
-
return `${fragmentSpread.name}_${hash}`;
|
259
|
-
}
|
260
|
-
|
261
|
-
module.exports = {
|
262
|
-
transform: deferStreamTransform,
|
263
|
-
};
|
@@ -1,46 +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
|
-
* @flow strict-local
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
import type CompilerContext from '../core/CompilerContext';
|
16
|
-
import type {LinkedField, ScalarField} from '../core/IR';
|
17
|
-
|
18
|
-
const {createUserError} = require('../core/CompilerError');
|
19
|
-
const IRTransformer = require('../core/IRTransformer');
|
20
|
-
|
21
|
-
function visitField<T: ScalarField | LinkedField>(field: T): T {
|
22
|
-
if (field.alias === 'id' && field.name !== 'id') {
|
23
|
-
throw createUserError(
|
24
|
-
'Relay does not allow aliasing fields to `id`. ' +
|
25
|
-
'This name is reserved for the globally unique `id` field on ' +
|
26
|
-
'`Node`.',
|
27
|
-
[field.loc],
|
28
|
-
);
|
29
|
-
}
|
30
|
-
return this.traverse(field);
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* This is not an actual transform (but more a validation)
|
35
|
-
* Relay does not allow aliasing fields to `id`.
|
36
|
-
*/
|
37
|
-
function disallowIdAsAlias(context: CompilerContext): CompilerContext {
|
38
|
-
return IRTransformer.transform(context, {
|
39
|
-
ScalarField: visitField,
|
40
|
-
LinkedField: visitField,
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
module.exports = {
|
45
|
-
transform: disallowIdAsAlias,
|
46
|
-
};
|
@@ -1,44 +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
|
-
* @flow strict-local
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
import type CompilerContext from '../core/CompilerContext';
|
16
|
-
import type {Root} from '../core/IR';
|
17
|
-
|
18
|
-
const {createUserError} = require('../core/CompilerError');
|
19
|
-
const IRValidator = require('../core/IRValidator');
|
20
|
-
|
21
|
-
function visitRoot(node: Root) {
|
22
|
-
for (const selection of node.selections) {
|
23
|
-
if (selection.kind === 'ScalarField' && selection.name === '__typename') {
|
24
|
-
throw createUserError(
|
25
|
-
'Relay does not allow `__typename` field on Query, Mutation or Subscription',
|
26
|
-
[selection.loc],
|
27
|
-
);
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
function stopVisit() {}
|
33
|
-
|
34
|
-
function disallowTypenameOnRoot(context: CompilerContext): CompilerContext {
|
35
|
-
IRValidator.validate(context, {
|
36
|
-
Root: visitRoot,
|
37
|
-
Fragment: stopVisit,
|
38
|
-
});
|
39
|
-
return context;
|
40
|
-
}
|
41
|
-
|
42
|
-
module.exports = {
|
43
|
-
transform: disallowTypenameOnRoot,
|
44
|
-
};
|
@@ -1,77 +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
|
-
* @flow strict-local
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
import type CompilerContext from '../core/CompilerContext';
|
16
|
-
import type {LinkedField, ScalarField} from '../core/IR';
|
17
|
-
|
18
|
-
const IRTransformer = require('../core/IRTransformer');
|
19
|
-
const SchemaUtils = require('../core/SchemaUtils');
|
20
|
-
const invariant = require('invariant');
|
21
|
-
const nullthrows = require('nullthrows');
|
22
|
-
const {getRelayHandleKey} = require('relay-runtime');
|
23
|
-
|
24
|
-
function fieldHandleTransform(context: CompilerContext): CompilerContext {
|
25
|
-
return IRTransformer.transform(context, {
|
26
|
-
LinkedField: visitField,
|
27
|
-
ScalarField: visitField,
|
28
|
-
});
|
29
|
-
}
|
30
|
-
|
31
|
-
/**
|
32
|
-
* @internal
|
33
|
-
*/
|
34
|
-
function visitField<F: LinkedField | ScalarField>(field: F): F {
|
35
|
-
const nextField = field.kind === 'LinkedField' ? this.traverse(field) : field;
|
36
|
-
const handles = nextField.handles;
|
37
|
-
if (!handles || !handles.length) {
|
38
|
-
return nextField;
|
39
|
-
}
|
40
|
-
// ensure exactly one handle
|
41
|
-
invariant(
|
42
|
-
handles.length === 1,
|
43
|
-
'FieldHandleTransform: Expected fields to have at most one ' +
|
44
|
-
'"handle" property, got `%s`.',
|
45
|
-
handles.join(', '),
|
46
|
-
);
|
47
|
-
const context: CompilerContext = this.getContext();
|
48
|
-
const schema = context.getSchema();
|
49
|
-
const alias = nextField.alias;
|
50
|
-
const handle = handles[0];
|
51
|
-
const name = getRelayHandleKey(handle.name, handle.key, nextField.name);
|
52
|
-
const filters = handle.filters;
|
53
|
-
const args = filters
|
54
|
-
? nextField.args.filter(arg => filters.indexOf(arg.name) !== -1)
|
55
|
-
: [];
|
56
|
-
if (handle.dynamicKey != null) {
|
57
|
-
args.push({
|
58
|
-
kind: 'Argument',
|
59
|
-
loc: handle.dynamicKey.loc,
|
60
|
-
name: '__dynamicKey',
|
61
|
-
type: SchemaUtils.getNullableStringInput(schema),
|
62
|
-
value: nullthrows(handle.dynamicKey),
|
63
|
-
});
|
64
|
-
}
|
65
|
-
|
66
|
-
return ({
|
67
|
-
...nextField,
|
68
|
-
args,
|
69
|
-
alias,
|
70
|
-
name,
|
71
|
-
handles: null,
|
72
|
-
}: $FlowIssue);
|
73
|
-
}
|
74
|
-
|
75
|
-
module.exports = {
|
76
|
-
transform: fieldHandleTransform,
|
77
|
-
};
|
@@ -1,33 +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
|
-
* @flow strict-local
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
|
11
|
-
'use strict';
|
12
|
-
|
13
|
-
import type CompilerContext from '../core/CompilerContext';
|
14
|
-
import type {Directive} from '../core/IR';
|
15
|
-
|
16
|
-
const IRTransformer = require('../core/IRTransformer');
|
17
|
-
|
18
|
-
const COMPILE_TIME_DIRECTIVES = new Set(['required']);
|
19
|
-
|
20
|
-
/**
|
21
|
-
* A transform that removes any directives that are only interpreted by the Relay compiler.
|
22
|
-
*/
|
23
|
-
function filterDirectivesTransform(context: CompilerContext): CompilerContext {
|
24
|
-
return IRTransformer.transform(context, {
|
25
|
-
Directive: (directive: Directive): ?Directive => {
|
26
|
-
return COMPILE_TIME_DIRECTIVES.has(directive.name) ? null : directive;
|
27
|
-
},
|
28
|
-
});
|
29
|
-
}
|
30
|
-
|
31
|
-
module.exports = {
|
32
|
-
transform: filterDirectivesTransform,
|
33
|
-
};
|