rescript-relay 1.1.0 → 1.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/package.json +5 -5
  3. package/postinstall.js +4 -0
  4. package/ppx-linux +0 -0
  5. package/ppx-macos-arm64 +0 -0
  6. package/ppx-macos-latest +0 -0
  7. package/ppx-windows-latest +0 -0
  8. package/relay-compiler-linux-musl/relay +0 -0
  9. package/relay-compiler-linux-x64/relay +0 -0
  10. package/relay-compiler-macos-arm64/relay +0 -0
  11. package/relay-compiler-macos-x64/relay +0 -0
  12. package/relay-compiler-win-x64/relay.exe +0 -0
  13. package/src/ReactExperimental.bs.js +4 -2
  14. package/src/ReactExperimental.res +1 -1
  15. package/src/ReactExperimental.resi +1 -1
  16. package/src/RescriptRelay.bs.js +13 -13
  17. package/src/RescriptRelay.res +4 -2
  18. package/src/RescriptRelay.resi +194 -267
  19. package/src/RescriptRelayUtils.bs.js +3 -3
  20. package/src/RescriptRelayUtils.resi +3 -5
  21. package/src/RescriptRelay_Fragment.bs.js +116 -0
  22. package/src/RescriptRelay_Fragment.res +239 -0
  23. package/src/RescriptRelay_Fragment.resi +86 -0
  24. package/src/RescriptRelay_Internal.bs.js +1 -1
  25. package/src/RescriptRelay_Mutation.bs.js +54 -0
  26. package/src/RescriptRelay_Mutation.res +146 -0
  27. package/src/RescriptRelay_Mutation.resi +54 -0
  28. package/src/RescriptRelay_Query.bs.js +87 -0
  29. package/src/RescriptRelay_Query.res +188 -0
  30. package/src/RescriptRelay_Query.resi +70 -0
  31. package/src/RescriptRelay_RelayResolvers.bs.js +14 -0
  32. package/src/RescriptRelay_RelayResolvers.res +21 -0
  33. package/src/RescriptRelay_RelayResolvers.resi +10 -0
  34. package/src/RescriptRelay_Subscriptions.bs.js +23 -0
  35. package/src/RescriptRelay_Subscriptions.res +51 -0
  36. package/src/RescriptRelay_Subscriptions.resi +15 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # master
2
2
 
3
+ # 1.2.0
4
+
5
+ This release mainly makes preparations under the hood for the upcoming `2.0` (ReScript v11 + uncurried mode support) and `3.0` (lots of changes, full uncurried mode only).
6
+
7
+ ## Breaking changes
8
+
9
+ - A trailing unit `()` arg is no longer needed in `Query.usePreloaded()`. What was previously `Query.usePreloaded(~queryRef, ())` is now just `Query.usePreloaded(~queryRef)`.
10
+
11
+ ## Improvements
12
+
13
+ - Add `@live` annotations to generated JSXv4 dynamic import compat modules, so they don't show up in dead code analysis (which they shouldn't).
14
+ - Preparations under the hood for ReScript v11 + uncurried mode.
15
+
16
+ # 1.1.1
17
+
18
+ - Fix M1 binary to include new JSXv4 dynamic import compat changes.
19
+
3
20
  # 1.1.0
4
21
 
5
22
  Notable changes:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
@@ -39,11 +39,10 @@
39
39
  "test:ci": "jest --ci --runInBand"
40
40
  },
41
41
  "devDependencies": {
42
- "rescript": "^10.1.3",
43
- "@rescript/react": "0.11.0",
42
+ "@glennsl/rescript-fetch": "^0.2.0",
43
+ "@rescript/react": "0.12.0-alpha.2",
44
44
  "@testing-library/jest-dom": "^5.16.3",
45
45
  "@testing-library/react": "^13.0.0-alpha.6",
46
- "bs-fetch": "^0.5.0",
47
46
  "graphql-query-test-mock": "^0.12.1",
48
47
  "jest": "^27.2.4",
49
48
  "nock": "^11.7.0",
@@ -51,7 +50,8 @@
51
50
  "react": "18.2.0",
52
51
  "react-dom": "18.2.0",
53
52
  "react-relay": "15.0.0",
54
- "relay-runtime": "15.0.0"
53
+ "relay-runtime": "15.0.0",
54
+ "rescript": "^11.0.0-beta.1"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@rescript/react": "*",
package/postinstall.js CHANGED
@@ -152,6 +152,10 @@ function removeInitialBinaries() {
152
152
  recursive: true,
153
153
  force: true,
154
154
  });
155
+ fs.rmSync(path.join(__dirname, "relay-compiler-win-x64"), {
156
+ recursive: true,
157
+ force: true,
158
+ });
155
159
  }
156
160
 
157
161
  switch (platform) {
package/ppx-linux CHANGED
Binary file
package/ppx-macos-arm64 CHANGED
Binary file
package/ppx-macos-latest CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -8,8 +8,10 @@ function useTransition(param) {
8
8
  var startTransition = match[1];
9
9
  return [
10
10
  match[0],
11
- React.useCallback((function (cb) {
12
- startTransition(cb, undefined);
11
+ React.useMemo((function (param) {
12
+ return function (cb) {
13
+ return startTransition(cb, undefined);
14
+ };
13
15
  }), [startTransition])
14
16
  ];
15
17
  }
@@ -9,7 +9,7 @@ external useTransitionWithOptions: unit => (
9
9
 
10
10
  let useTransition = () => {
11
11
  let (isPending, startTransition) = useTransitionWithOptions()
12
- (isPending, React.useCallback1(cb => startTransition(. cb, None), [startTransition]))
12
+ (isPending, React.useMemo1(() => cb => startTransition(. cb, None), [startTransition]))
13
13
  }
14
14
 
15
15
  module SuspenseList = {
@@ -7,7 +7,7 @@ external useTransitionWithOptions: unit => (
7
7
  (. unit => unit, option<{"name": option<string>}>) => unit,
8
8
  ) = "useTransition"
9
9
 
10
- let useTransition: unit => (bool, React.callback<unit => unit, unit>)
10
+ let useTransition: unit => (bool, (unit => unit) => unit)
11
11
 
12
12
  module SuspenseList: {
13
13
  @module("react") @react.component
@@ -50,22 +50,22 @@ function unwrapNormalizationArgument(wrapped) {
50
50
  var match = wrapped.kind;
51
51
  if (match === "Literal") {
52
52
  return {
53
- TAG: /* Literal */1,
53
+ TAG: "Literal",
54
54
  _0: wrapped
55
55
  };
56
56
  } else if (match === "ListValue") {
57
57
  return {
58
- TAG: /* ListValue */0,
58
+ TAG: "ListValue",
59
59
  _0: wrapped
60
60
  };
61
61
  } else if (match === "ObjectValue") {
62
62
  return {
63
- TAG: /* ObjectValue */2,
63
+ TAG: "ObjectValue",
64
64
  _0: wrapped
65
65
  };
66
66
  } else {
67
67
  return {
68
- TAG: /* Variable */3,
68
+ TAG: "Variable",
69
69
  _0: wrapped
70
70
  };
71
71
  }
@@ -196,13 +196,13 @@ function mapFetchPolicy(x) {
196
196
  return ;
197
197
  }
198
198
  switch (x) {
199
- case /* StoreOnly */0 :
199
+ case "StoreOnly" :
200
200
  return "store-only";
201
- case /* StoreOrNetwork */1 :
201
+ case "StoreOrNetwork" :
202
202
  return "store-or-network";
203
- case /* StoreAndNetwork */2 :
203
+ case "StoreAndNetwork" :
204
204
  return "store-and-network";
205
- case /* NetworkOnly */3 :
205
+ case "NetworkOnly" :
206
206
  return "network-only";
207
207
 
208
208
  }
@@ -210,10 +210,10 @@ function mapFetchPolicy(x) {
210
210
 
211
211
  function mapFetchQueryFetchPolicy(x) {
212
212
  if (x !== undefined) {
213
- if (x) {
214
- return "store-or-network";
215
- } else {
213
+ if (x === "NetworkOnly") {
216
214
  return "network-only";
215
+ } else {
216
+ return "store-or-network";
217
217
  }
218
218
  }
219
219
 
@@ -237,7 +237,7 @@ function MakeLoadQuery(C) {
237
237
  Caml_option.valFromOption(o).subscribe({
238
238
  complete: (function (param) {
239
239
  resolve({
240
- TAG: /* Ok */0,
240
+ TAG: "Ok",
241
241
  _0: undefined
242
242
  });
243
243
  })
@@ -245,7 +245,7 @@ function MakeLoadQuery(C) {
245
245
  return ;
246
246
  } else {
247
247
  return resolve({
248
- TAG: /* Error */1,
248
+ TAG: "Error",
249
249
  _0: undefined
250
250
  });
251
251
  }
@@ -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]}
@@ -507,6 +507,8 @@ module Observable = {
507
507
  external subscribe: (t<'response>, observer<'response>) => subscription = "subscribe"
508
508
 
509
509
  @send external toPromise: t<'t> => Js.Promise.t<'t> = "toPromise"
510
+
511
+ external ignoreSubscription: subscription => unit = "%ignore"
510
512
  }
511
513
 
512
514
  module Network = {
@@ -593,7 +595,7 @@ module RequiredFieldLogger = {
593
595
 
594
596
  type t = (~kind: kind, ~owner: string, ~fieldPath: string) => unit
595
597
 
596
- let toJs: t => js = (f, arg) =>
598
+ let toJs: t => js = f => arg =>
597
599
  f(~kind=arg["kind"], ~owner=arg["owner"], ~fieldPath=arg["fieldPath"])
598
600
  }
599
601