rescript-relay 0.0.0-test-rust-compiler-a04acb38 → 0.0.0-test-rust-compiler-a2f32b9e

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/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # master
2
2
 
3
+ # 1.0.0-beta.1
4
+
5
+ The time has finally come - RescriptRelay `1.0.0` is in beta! The one, big major thing this release brings is that the ReScript type generation for the Relay compiler has been completely rewritten, and fully integrated into the new Relay Rust compiler. The RescriptRelay fork of the compiler is available and maintained [here])(https://github.com/zth/relay/tree/rescript-relay).
6
+
7
+ ## Remove Packages
8
+
9
+ You can go ahead and remove these packages, that are no longer needed, as the compiler is now shipped in the main package:
10
+
11
+ - `relay-config`
12
+ - `relay-compiler`
13
+ - `graphql` (if you don't use it for anything else)
14
+
15
+ ## Breaking Changes
16
+
17
+ - The compiler expects the `__generated__` folder to always exist, so if you're not committing your artifacts to source control, make sure you add a `.gitkeep` to the generated folder so git keeps it around.
18
+
19
+ ## Improvements
20
+
21
+ - The compiler itself should be _much_ faster than the old one. An order of magnitude faster. Especially for incremental compilation in watch mode.
22
+ - There's no longer any need to manually select `__typename` on interfaces and unions for RescriptRelay's sake, unless you actually want to use it yourself.
23
+ - We now support the `@required` directive from Relay, which is a new directive that lets you force non-nullability for nullable fields on the client side. You can then choose to throw an error if null values are encountered, or let the null value bubble up. Docs are coming soon, and you'll need to do `RescriptRelay.relayFeatureFlags.enableRequiredDirective = true` somewhere in your code to enable it for now.
24
+ - The errors reported by the compiler is now quite a lot better.
25
+
3
26
  # 0.23.0
4
27
 
5
28
  _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/6e96dfafaec918b1d4e9519d3fcbf5e5c46be6c0)_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "0.0.0-test-rust-compiler-a04acb38",
3
+ "version": "0.0.0-test-rust-compiler-a2f32b9e",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
Binary file
Binary file
Binary file
package/src/utils.js CHANGED
@@ -305,7 +305,15 @@ function traverser(
305
305
  return nullableValue;
306
306
  }
307
307
 
308
- var n = unionRootConverter != null ? [v.__typename] : [];
308
+ var n = [];
309
+
310
+ // Since a root level union is treated as a "new root level", we'll need
311
+ // to do a separate check here of whether there's a fragment on the root
312
+ // we need to account for, or not.
313
+ if (unionRootConverter != null) {
314
+ n = [v.__typename];
315
+ fragmentsOnRoot = (instructionMap[v.__typename] || {}).f === "";
316
+ }
309
317
 
310
318
  var traversedObj = traverse(
311
319
  instructionMaps,
@@ -326,7 +334,14 @@ function traverser(
326
334
 
327
335
  var newObj = Object.assign({}, root);
328
336
 
329
- var n = unionRootConverter != null ? [newObj.__typename] : [];
337
+ var n = [];
338
+
339
+ // Same as in the union array check above - if there's a fragment in the new
340
+ // root created by the union, we need to account for that separately here.
341
+ if (unionRootConverter != null) {
342
+ n = [newObj.__typename];
343
+ fragmentsOnRoot = (instructionMap[newObj.__typename] || {}).f === "";
344
+ }
330
345
 
331
346
  var v = traverse(
332
347
  instructionMaps,