rescript-relay 1.0.0-beta.12 → 1.0.0-beta.13

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,6 +1,6 @@
1
1
  # master
2
2
 
3
- # 1.0.0-beta.12
3
+ # 1.0.0-beta.13
4
4
 
5
5
  _[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/5831c2f1f0f13eedc1cb60468c32fd32b2dc01d3)_
6
6
 
@@ -29,10 +29,20 @@ You can go ahead and remove these packages, that are no longer needed, as the co
29
29
  - Improved utils for [dealing with enums](https://rescript-relay-documentation.vercel.app/docs/enums).
30
30
  - `recordSourceRecords` is now typed as `Js.Json.t` rather than being abstract.
31
31
 
32
+ ## Breaking changes
33
+
34
+ - `refetchVariables` now works as intended with regards to supplying only the variables you want _changed_ when refetching, as [detailed under `variables` here](https://relay.dev/docs/next/api-reference/use-refetchable-fragment/#return-value). This means that what was previously `makeRefetchVariables(~someValue=123, ())` should now be `makeRefetchVariables(~someValue=Some(123), ())`. More details on this in the docs before a `1.0.0` release. Thanks to [@tsnobip](https://github.com/tsnobip) for fixing this!
35
+
32
36
  ## Beta fix changelog
33
37
 
34
38
  ### unreleased
35
39
 
40
+ ### beta.13
41
+
42
+ - `refetchVariables` now works as intended with regards to supplying only the variables you want _changed_ when refetching, as [detailed under `variables` here](https://relay.dev/docs/next/api-reference/use-refetchable-fragment/#return-value).
43
+ - Make all object makers inlined. This should improve bundle size some.
44
+ - Support more Linux versions in CI (like the images Vercel uses).
45
+
36
46
  ### beta.12
37
47
 
38
48
  - Make CLI work with `relay.config.cjs`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.13",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
@@ -59,6 +59,7 @@
59
59
  "rescript": "^9.1.2"
60
60
  },
61
61
  "dependencies": {
62
+ "detect-libc": "^2.0.1",
62
63
  "rescript": "^9.1.2"
63
64
  },
64
65
  "resolutions": {
package/postinstall.js CHANGED
@@ -10,6 +10,7 @@
10
10
  var path = require("path");
11
11
  var cp = require("child_process");
12
12
  var fs = require("fs");
13
+ var { isNonGlibcLinux } = require("detect-libc");
13
14
  var platform = process.platform;
14
15
 
15
16
  function getRelayCompilerPlatformSuffix() {
@@ -17,6 +18,8 @@ function getRelayCompilerPlatformSuffix() {
17
18
  return "macos-x64";
18
19
  } else if (process.platform === "darwin" && process.arch === "arm64") {
19
20
  return "macos-arm64";
21
+ } else if (process.platform === "linux" && isNonGlibcLinux) {
22
+ return "linux-musl";
20
23
  } else if (process.platform === "linux" && process.arch === "x64") {
21
24
  return "linux-x64";
22
25
  }
package/ppx-darwin CHANGED
Binary file
package/ppx-linux CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -3,23 +3,51 @@
3
3
 
4
4
  var Curry = require("rescript/lib/js/curry.js");
5
5
  var React = require("react");
6
+ var Js_dict = require("rescript/lib/js/js_dict.js");
7
+ var Caml_obj = require("rescript/lib/js/caml_obj.js");
8
+ var Belt_Array = require("rescript/lib/js/belt_Array.js");
9
+ var Belt_Option = require("rescript/lib/js/belt_Option.js");
6
10
  var Caml_option = require("rescript/lib/js/caml_option.js");
7
11
 
8
- var internal_cleanObjectFromUndefinedRaw = (function (obj) {
9
- if (!obj) {
10
- return obj;
11
- }
12
-
13
- var newObj = {};
12
+ function internal_keepMapFieldsRaw(record, f) {
13
+ return Belt_Option.map(record, (function (obj) {
14
+ return Js_dict.fromArray(Belt_Array.keepMap(Js_dict.entries(obj), f));
15
+ }));
16
+ }
14
17
 
15
- Object.keys(obj).forEach(function(key) {
16
- if (typeof obj[key] !== 'undefined') {
17
- newObj[key] = obj[key];
18
- }
19
- });
18
+ function internal_cleanObjectFromUndefinedRaw(record) {
19
+ return internal_keepMapFieldsRaw(record, (function (param) {
20
+ var value = param[1];
21
+ if (value !== undefined) {
22
+ return [
23
+ param[0],
24
+ Caml_option.valFromOption(value)
25
+ ];
26
+ }
27
+
28
+ }));
29
+ }
20
30
 
21
- return newObj;
22
- });
31
+ function internal_removeUndefinedAndConvertNullsRaw(record) {
32
+ return internal_keepMapFieldsRaw(record, (function (param) {
33
+ var value = param[1];
34
+ var key = param[0];
35
+ var match = Caml_obj.caml_equal(value, Caml_option.some(undefined));
36
+ if (value !== undefined) {
37
+ return [
38
+ key,
39
+ Caml_option.valFromOption(value)
40
+ ];
41
+ } else if (match) {
42
+ return [
43
+ key,
44
+ null
45
+ ];
46
+ } else {
47
+ return ;
48
+ }
49
+ }));
50
+ }
23
51
 
24
52
  function internal_useConvertedValue(convert, v) {
25
53
  return React.useMemo((function () {
@@ -38,5 +66,6 @@ function internal_nullableToOptionalExnHandler(x) {
38
66
 
39
67
  exports.internal_useConvertedValue = internal_useConvertedValue;
40
68
  exports.internal_cleanObjectFromUndefinedRaw = internal_cleanObjectFromUndefinedRaw;
69
+ exports.internal_removeUndefinedAndConvertNullsRaw = internal_removeUndefinedAndConvertNullsRaw;
41
70
  exports.internal_nullableToOptionalExnHandler = internal_nullableToOptionalExnHandler;
42
71
  /* react Not a pure module */
@@ -1,23 +1,27 @@
1
- // We occasionally have to remove undefined keys from objects, something I haven't figured out how to do with pure BuckleScript
2
- let internal_cleanObjectFromUndefinedRaw = %raw(
3
- `
4
- function (obj) {
5
- if (!obj) {
6
- return obj;
7
- }
8
-
9
- var newObj = {};
1
+ let internal_keepMapFieldsRaw = (record, f) =>
2
+ record
3
+ ->Obj.magic
4
+ ->Belt.Option.map(obj => obj->Js.Dict.entries->Belt.Array.keepMap(f)->Js.Dict.fromArray)
5
+ ->Obj.magic
10
6
 
11
- Object.keys(obj).forEach(function(key) {
12
- if (typeof obj[key] !== 'undefined') {
13
- newObj[key] = obj[key];
14
- }
15
- });
7
+ // we need to do this until we can use @obj on record types
8
+ // see https://github.com/rescript-lang/rescript-compiler/pull/5253
9
+ let internal_cleanObjectFromUndefinedRaw = record =>
10
+ internal_keepMapFieldsRaw(record, ((key, value)) => {
11
+ switch value {
12
+ | Some(value) => Some((key, value))
13
+ | None => None
14
+ }
15
+ })
16
16
 
17
- return newObj;
18
- }
19
- `
20
- )
17
+ let internal_removeUndefinedAndConvertNullsRaw = record =>
18
+ internal_keepMapFieldsRaw(record, ((key, value)) => {
19
+ switch (value, value == Some(None)) {
20
+ | (Some(value), _) => Some((key, Js.Nullable.return(value)))
21
+ | (_, true) => Some((key, Js.Nullable.null))
22
+ | (None, _) => None
23
+ }
24
+ })
21
25
 
22
26
  let internal_useConvertedValue = (convert, v) => React.useMemo1(() => convert(v), [v])
23
27
 
@@ -1,5 +1,6 @@
1
1
  let internal_useConvertedValue: ('a => 'a, 'a) => 'a
2
2
  let internal_cleanObjectFromUndefinedRaw: 't => 't
3
+ let internal_removeUndefinedAndConvertNullsRaw: 't => 't
3
4
  let internal_nullableToOptionalExnHandler: option<option<'b> => 'a> => option<
4
5
  Js.Nullable.t<'b> => 'a,
5
6
  >