rescript-relay 0.0.0-test-rust-compiler-66f73645 → 0.0.0-test-rust-compiler-145baf5d

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,36 @@
1
1
  # master
2
2
 
3
+ # 1.0.0-beta.2
4
+
5
+ _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/5831c2f1f0f13eedc1cb60468c32fd32b2dc01d3)_
6
+
7
+ 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).
8
+
9
+ ## Remove Packages
10
+
11
+ You can go ahead and remove these packages, that are no longer needed, as the compiler is now shipped in the main package:
12
+
13
+ - `relay-config`
14
+ - `relay-compiler`
15
+ - `graphql` (if you don't use it for anything else)
16
+
17
+ ## Breaking Changes
18
+
19
+ - 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.
20
+
21
+ ## Improvements
22
+
23
+ - The compiler itself should be _much_ faster than the old one. An order of magnitude faster. Especially for incremental compilation in watch mode.
24
+ - 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.
25
+ - 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.
26
+ - The errors reported by the compiler is now quite a lot better.
27
+
28
+ ## Beta fix changelog
29
+
30
+ ### beta.2
31
+
32
+ - Fix issue with recursive input objects not being converted correctly.
33
+
3
34
  # 0.23.0
4
35
 
5
36
  _[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-66f73645",
3
+ "version": "0.0.0-test-rust-compiler-145baf5d",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
Binary file
Binary file
Binary file
@@ -39,6 +39,8 @@ type featureFlags = {
39
39
  mutable enableRelayContainersSuspense: bool,
40
40
  @as("ENABLE_PRECISE_TYPE_REFINEMENT")
41
41
  mutable enablePrecisTypeRefinement: bool,
42
+ @as("ENABLE_REQUIRED_DIRECTIVES")
43
+ mutable enableRequiredDirective: bool,
42
44
  }
43
45
 
44
46
  @module("relay-runtime")
@@ -98,6 +98,8 @@ type featureFlags = {
98
98
  mutable enableRelayContainersSuspense: bool,
99
99
  @as("ENABLE_PRECISE_TYPE_REFINEMENT")
100
100
  mutable enablePrecisTypeRefinement: bool,
101
+ @as("ENABLE_REQUIRED_DIRECTIVES")
102
+ mutable enableRequiredDirective: bool,
101
103
  }
102
104
 
103
105
  @ocaml.doc(
@@ -315,6 +315,7 @@ function RescriptRelayRouter$Link(Props) {
315
315
  var className = Props.className;
316
316
  var classNameDynamic = Props.classNameDynamic;
317
317
  var browserTarget = Props.target;
318
+ var tabIndex = Props.tabIndex;
318
319
  var mode = Props.mode;
319
320
  var render = Props.render;
320
321
  var preloadOnHover = Props.preloadOnHover;
@@ -393,6 +394,9 @@ function RescriptRelayRouter$Link(Props) {
393
394
  if (id !== undefined) {
394
395
  tmp.id = Caml_option.valFromOption(id);
395
396
  }
397
+ if (tabIndex !== undefined) {
398
+ tmp.tabIndex = Caml_option.valFromOption(tabIndex);
399
+ }
396
400
  if (title !== undefined) {
397
401
  tmp.title = Caml_option.valFromOption(title);
398
402
  }
@@ -306,6 +306,7 @@ module Link = {
306
306
  ~className=?,
307
307
  ~classNameDynamic=?,
308
308
  ~target as browserTarget=?,
309
+ ~tabIndex=?,
309
310
  ~mode=?,
310
311
  ~render=?,
311
312
  ~preloadOnHover=?,
@@ -351,6 +352,7 @@ module Link = {
351
352
  }}
352
353
  ?title
353
354
  ?id
355
+ ?tabIndex
354
356
  className={className->Belt.Option.getWithDefault("") ++
355
357
  switch classNameDynamic {
356
358
  | Some(f) => " " ++ f(url, to_->Url.make)
@@ -56,6 +56,7 @@ module Link: {
56
56
  ~className: string=?,
57
57
  ~classNameDynamic: (RescriptReactRouter.url, RescriptReactRouter.url) => string=?,
58
58
  ~target: [#self | #blank]=?,
59
+ ~tabIndex: int=?,
59
60
  ~mode: [#push | #replace]=?,
60
61
  ~render: (
61
62
  ~preload: unit => unit,
package/src/utils.js CHANGED
@@ -270,7 +270,7 @@ function traverse(
270
270
  */
271
271
  function traverser(
272
272
  root,
273
- _instructionMaps,
273
+ instructionMaps_,
274
274
  theConverters,
275
275
  nullableValue,
276
276
  rootObjectKey
@@ -279,7 +279,7 @@ function traverser(
279
279
  return nullableValue;
280
280
  }
281
281
 
282
- var instructionMaps = _instructionMaps || {};
282
+ var instructionMaps = instructionMaps_ || {};
283
283
  var instructionMap = instructionMaps[rootObjectKey || "__root"];
284
284
 
285
285
  // No instructions
@@ -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,