rescript-relay 1.0.5 → 1.1.1

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,33 @@
1
1
  # master
2
2
 
3
+ # 1.1.0
4
+
5
+ Notable changes:
6
+
7
+ - _JSX v4 is now required_
8
+ - Relay and @rescript/react upgraded
9
+ - M1 support for the PPX (should speed up builds for anyone on an M1)
10
+
11
+ ## Upgrade versions
12
+
13
+ - `react-relay` and `relay-runtime` to `>=15.0.0`
14
+ - `@rescript/react` to `>=0.11.0`
15
+
16
+ ## Breaking changes
17
+
18
+ - The signature for missing field handlers has changed. Previously you got an open type `{..}` as record, now instead you get a proper `RecordProxy.t` from the store. Check out [the changelog for Relay 15](https://github.com/facebook/relay/releases/tag/v15.0.0).
19
+ - ReScript `>=10.1` and JSX v4 is now required.
20
+ - Work around issue with JSX v4 and `%relay.deferredComponent`. You now need to annotate any component you want to use with `%relay.deferredComponent` with `@relay.deferredComponent`. https://github.com/zth/rescript-relay/pull/439
21
+
22
+ ## Improvements
23
+
24
+ - Experimental support for allowing `null` in operation variables. Add `@rescriptRelayNullableVariables` to your operation (query, mutation, subscription) and you'll be allowed to pass `Js.null` (via the `Js.Null` module) to your server. https://github.com/zth/rescript-relay/pull/426
25
+ - :tada: M1 support for the PPX! This should speed up builds some. https://github.com/zth/rescript-relay/pull/435
26
+
27
+ ## Bug Fixes
28
+
29
+ - Fix issue with conversion of custom scalars, where custom scalars represented as arrays would get converted "internally" although they should've really just been left alone. https://github.com/zth/rescript-relay/pull/433
30
+
3
31
  # 1.0.5
4
32
 
5
33
  ## Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "1.0.5",
3
+ "version": "1.1.1",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
@@ -39,8 +39,8 @@
39
39
  "test:ci": "jest --ci --runInBand"
40
40
  },
41
41
  "devDependencies": {
42
- "rescript": "^10.0.0",
43
- "@rescript/react": "0.10.3",
42
+ "rescript": "^10.1.3",
43
+ "@rescript/react": "0.11.0",
44
44
  "@testing-library/jest-dom": "^5.16.3",
45
45
  "@testing-library/react": "^13.0.0-alpha.6",
46
46
  "bs-fetch": "^0.5.0",
@@ -48,22 +48,22 @@
48
48
  "jest": "^27.2.4",
49
49
  "nock": "^11.7.0",
50
50
  "node-fetch": "^2.6.0",
51
- "react": "18.0.0",
52
- "react-dom": "18.0.0",
53
- "react-relay": "14.1.0",
54
- "relay-runtime": "14.1.0"
51
+ "react": "18.2.0",
52
+ "react-dom": "18.2.0",
53
+ "react-relay": "15.0.0",
54
+ "relay-runtime": "15.0.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@rescript/react": "*",
58
- "react-relay": ">=11.0.0",
58
+ "react-relay": ">=15.0.0",
59
59
  "relay-runtime": "*",
60
- "rescript": ">=9.1.2"
60
+ "rescript": ">=10.1.0"
61
61
  },
62
62
  "dependencies": {
63
63
  "detect-libc": "^2.0.1"
64
64
  },
65
65
  "resolutions": {
66
- "react": "18.0.0",
67
- "react-dom": "18.0.0"
66
+ "react": "18.2.0",
67
+ "react-dom": "18.2.0"
68
68
  }
69
69
  }
package/postinstall.js CHANGED
@@ -40,7 +40,7 @@ function ppxArch() {
40
40
  * Use Rosetta for ARM on macOS
41
41
  */
42
42
  if (platform === "darwin" && process.arch === "arm64") {
43
- return "x64";
43
+ return "arm64";
44
44
  }
45
45
 
46
46
  /**
@@ -132,6 +132,7 @@ function copyPlatformBinaries(platform) {
132
132
  }
133
133
 
134
134
  function removeInitialBinaries() {
135
+ fs.unlinkSync(path.join(__dirname, "ppx-macos-arm64"));
135
136
  fs.unlinkSync(path.join(__dirname, "ppx-macos-latest"));
136
137
  fs.unlinkSync(path.join(__dirname, "ppx-windows-latest"));
137
138
  fs.unlinkSync(path.join(__dirname, "ppx-linux"));
@@ -165,9 +166,14 @@ switch (platform) {
165
166
  case "linux":
166
167
  copyPlatformBinaries(platform);
167
168
  break;
168
- case "darwin":
169
- copyPlatformBinaries("macos-latest");
169
+ case "darwin": {
170
+ if (ppxArch() === "arm64") {
171
+ copyPlatformBinaries("macos-arm64");
172
+ } else {
173
+ copyPlatformBinaries("macos-latest");
174
+ }
170
175
  break;
176
+ }
171
177
  default:
172
178
  console.warn("error: no release built for the " + platform + " platform");
173
179
  process.exit(1);
package/ppx-linux CHANGED
Binary file
Binary file
package/ppx-macos-latest CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,7 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
  'use strict';
3
3
 
4
+ var ReactDOM = require("@rescript/react/src/ReactDOM.bs.js");
4
5
  var Client = require("react-dom/client");
5
6
 
6
7
  function renderConcurrentRootAtElementWithId(content, id) {
@@ -15,5 +16,8 @@ function renderConcurrentRootAtElementWithId(content, id) {
15
16
  Client.createRoot(element).render(content);
16
17
  }
17
18
 
19
+ var Root = ReactDOM.Client.Root;
20
+
21
+ exports.Root = Root;
18
22
  exports.renderConcurrentRootAtElementWithId = renderConcurrentRootAtElementWithId;
19
23
  /* react-dom/client Not a pure module */
@@ -1,7 +1,4 @@
1
- include ReactDOM.Experimental
2
-
3
- @module("react-dom/client")
4
- external createRoot: Dom.element => root = "createRoot"
1
+ include ReactDOM.Client
5
2
 
6
3
  @val @return(nullable)
7
4
  external getElementById: string => option<Dom.element> = "document.getElementById"
@@ -15,5 +12,5 @@ let renderConcurrentRootAtElementWithId: (React.element, string) => unit = (cont
15
12
  id ++ " found in the HTML.",
16
13
  ),
17
14
  )
18
- | Some(element) => createRoot(element)->render(content)
15
+ | Some(element) => createRoot(element)->Root.render(content)
19
16
  }
@@ -102,7 +102,7 @@ var MissingFieldHandler = {
102
102
  var nodeInterfaceMissingFieldHandler = makeLinkedMissingFieldHandler(function (field, record, args, _store) {
103
103
  var match = field.name;
104
104
  var match$1 = args.id;
105
- if ((record == null) || !(match === "node" && record.__typename === RelayRuntime.ROOT_TYPE && !(match$1 == null))) {
105
+ if ((record == null) || !(match === "node" && record.getType() === RelayRuntime.ROOT_TYPE && !(match$1 == null))) {
106
106
  return ;
107
107
  } else {
108
108
  return Caml_option.some(match$1);
@@ -160,15 +160,13 @@ var Environment = {
160
160
  make: make$1
161
161
  };
162
162
 
163
- function RescriptRelay$Context$Provider(Props) {
164
- var environment = Props.environment;
165
- var children = Props.children;
163
+ function RescriptRelay$Context$Provider(props) {
166
164
  var provider = ReactRelay.ReactRelayContext.Provider;
167
165
  return React.createElement(provider, {
168
166
  value: {
169
- environment: environment
167
+ environment: props.environment
170
168
  },
171
- children: children
169
+ children: props.children
172
170
  });
173
171
  }
174
172
 
@@ -330,7 +330,7 @@ module ReadOnlyRecordSourceProxy = {
330
330
  }
331
331
 
332
332
  module MissingFieldHandler = {
333
- @@ocaml.warning("-30")
333
+ @@warning("-30")
334
334
  type t
335
335
 
336
336
  type normalizationArgumentWrapped = {kind: [#ListValue | #Literal | #ObjectValue | #Variable]}
@@ -412,7 +412,7 @@ let nodeInterfaceMissingFieldHandler = MissingFieldHandler.makeLinkedMissingFiel
412
412
  _store,
413
413
  ) =>
414
414
  switch (Js.Nullable.toOption(record), field["name"], Js.Nullable.toOption(args["id"])) {
415
- | (Some(record), "node", argsId) if record["__typename"] == storeRootType => argsId
415
+ | (Some(record), "node", argsId) if record->RecordProxy.getType == storeRootType => argsId
416
416
  | _ => None
417
417
  }
418
418
  )
@@ -574,8 +574,8 @@ module Store = {
574
574
  make(
575
575
  source,
576
576
  {
577
- gcReleaseBufferSize: gcReleaseBufferSize,
578
- queryCacheExpirationTime: queryCacheExpirationTime,
577
+ gcReleaseBufferSize,
578
+ queryCacheExpirationTime,
579
579
  },
580
580
  )
581
581
 
@@ -662,10 +662,7 @@ module Context = {
662
662
  @react.component
663
663
  let make = (~environment: Environment.t, ~children) => {
664
664
  let provider = React.Context.provider(context)
665
- React.createElement(
666
- provider,
667
- {"value": Some({"environment": environment}), "children": children},
668
- )
665
+ React.createElement(provider, {value: Some({"environment": environment}), children})
669
666
  }
670
667
  }
671
668
  }
@@ -752,9 +749,9 @@ module MakeLoadQuery = (C: MakeLoadQueryConfig) => {
752
749
  C.query,
753
750
  variables->C.convertVariables,
754
751
  {
755
- fetchKey: fetchKey,
752
+ fetchKey,
756
753
  fetchPolicy: fetchPolicy->mapFetchPolicy,
757
- networkCacheConfig: networkCacheConfig,
754
+ networkCacheConfig,
758
755
  },
759
756
  )
760
757