@ardatan/relay-compiler 12.1.2 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/relay-compiler +31 -7
- package/codegen/CodegenRunner.js.flow +6 -3
- package/codegen/RelayFileWriter.js.flow +3 -2
- package/core/ASTCache.js.flow +5 -4
- package/core/CompilerContext.js.flow +7 -5
- package/lib/codegen/CodegenRunner.js +5 -1
- package/lib/codegen/RelayFileWriter.js +3 -0
- package/lib/core/ASTCache.js +5 -2
- package/lib/core/CompilerContext.js +7 -3
- package/lib/transforms/SkipRedundantNodesTransform.js +4 -2
- package/package.json +2 -1
- package/relay-compiler.js +1 -1
- package/relay-compiler.min.js +1 -1
- package/transforms/SkipRedundantNodesTransform.js.flow +4 -3
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
const IRTransformer = require('../core/IRTransformer');
|
|
16
16
|
|
|
17
17
|
import type CompilerContext from '../core/CompilerContext';
|
|
18
|
+
const IMap = require('immutable').Map;
|
|
18
19
|
const partitionArray = require('../util/partitionArray');
|
|
19
20
|
const getIdentifierForSelection = require('../core/getIdentifierForSelection');
|
|
20
21
|
const invariant = require('invariant');
|
|
@@ -30,7 +31,7 @@ import type {Fragment, Node, Root, SplitOperation, Selection} from '../core/IR';
|
|
|
30
31
|
* etc).
|
|
31
32
|
*/
|
|
32
33
|
// $FlowFixMe[value-as-type]
|
|
33
|
-
type SelectionMap =
|
|
34
|
+
type SelectionMap = IMap<string, ?SelectionMap>;
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* A transform that removes redundant fields and fragment spreads. Redundancy is
|
|
@@ -138,7 +139,7 @@ function visitNode<T: Fragment | Root | SplitOperation>(node: T): ?T {
|
|
|
138
139
|
cache = new Map();
|
|
139
140
|
// $FlowFixMe[incompatible-use]
|
|
140
141
|
const context: CompilerContext = this.getContext();
|
|
141
|
-
return transformNode(context.getSchema(), node, new
|
|
142
|
+
return transformNode(context.getSchema(), node, new IMap()).node;
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
/**
|
|
@@ -196,7 +197,7 @@ function transformNode<T: Node>(
|
|
|
196
197
|
const transformed = transformNode(
|
|
197
198
|
schema,
|
|
198
199
|
selection,
|
|
199
|
-
selectionMap.get(identifier) || new
|
|
200
|
+
selectionMap.get(identifier) || new IMap(),
|
|
200
201
|
);
|
|
201
202
|
if (transformed.node) {
|
|
202
203
|
selections.push(transformed.node);
|