rescript-relay 3.0.0-rc.4 → 3.0.0-rc.5

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
@@ -4,6 +4,14 @@
4
4
 
5
5
  # **Version 3**
6
6
 
7
+ # Unreleased
8
+
9
+ # 3.0.0-rc.5
10
+
11
+ - Support for Relay `@updatable` queries and fragments (https://relay.dev/docs/guided-tour/updating-data/imperatively-modifying-store-data/#optimistic-updaters-vs-updaters). https://github.com/zth/rescript-relay/pull/501
12
+ - Attempt 2: Fix an error in postinstall.js when reinstalling rescript-relay dependency (https://github.com/zth/rescript-relay/pull/493)
13
+ - Suppress more false positives for unused things in generated Relay files.
14
+
7
15
  # 3.0.0-rc.4
8
16
 
9
17
  - Set explicit peer dependencies: `@rescript/react >= 0.12.1`, `react-relay@16.0.0`, `relay-runtime@16.0.0`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rescript-relay",
3
- "version": "3.0.0-rc.4",
3
+ "version": "3.0.0-rc.5",
4
4
  "main": "src/RescriptRelay.res",
5
5
  "license": "MIT",
6
6
  "author": "Gabriel Nordeborn",
package/postinstall.js CHANGED
@@ -102,7 +102,7 @@ function copyPlatformBinaries(platform) {
102
102
  if (!fs.existsSync(ppxFinalPath)) {
103
103
  fs.copyFileSync(path.join(__dirname, "ppx-" + platform), ppxFinalPath);
104
104
  }
105
- fs.chmodSync(ppxFinalPath, 0777);
105
+ fs.chmodSync(ppxFinalPath, 0o777);
106
106
 
107
107
  /**
108
108
  * Copy the Relay compiler
@@ -125,14 +125,20 @@ function copyPlatformBinaries(platform) {
125
125
  rescriptRelayCompilerFinalPath
126
126
  );
127
127
  }
128
- fs.chmodSync(rescriptRelayCompilerFinalPath, 0777);
128
+ fs.chmodSync(rescriptRelayCompilerFinalPath, 0o777);
129
+ }
130
+
131
+ function unlinkIfNotExistsSync(path) {
132
+ if (fs.existsSync(path)) {
133
+ fs.unlinkSync(path);
134
+ }
129
135
  }
130
136
 
131
137
  function removeInitialBinaries() {
132
- fs.unlinkSync(path.join(__dirname, "ppx-macos-arm64"));
133
- fs.unlinkSync(path.join(__dirname, "ppx-macos-latest"));
134
- fs.unlinkSync(path.join(__dirname, "ppx-windows-latest"));
135
- fs.unlinkSync(path.join(__dirname, "ppx-linux"));
138
+ unlinkIfNotExistsSync(path.join(__dirname, "ppx-macos-arm64"));
139
+ unlinkIfNotExistsSync(path.join(__dirname, "ppx-macos-latest"));
140
+ unlinkIfNotExistsSync(path.join(__dirname, "ppx-windows-latest"));
141
+ unlinkIfNotExistsSync(path.join(__dirname, "ppx-linux"));
136
142
  fs.rmSync(path.join(__dirname, "relay-compiler-linux-x64"), {
137
143
  recursive: true,
138
144
  force: true,
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
package/rescript.json CHANGED
@@ -2,9 +2,6 @@
2
2
  "name": "rescript-relay",
3
3
  "version": "0.1.0",
4
4
  "namespace": false,
5
- "reason": {
6
- "react-jsx": 3
7
- },
8
5
  "sources": [
9
6
  {
10
7
  "dir": "src"
@@ -18,6 +15,5 @@
18
15
  "suffix": ".bs.js",
19
16
  "warnings": {
20
17
  "error": "+101"
21
- },
22
- "refmt": 3
18
+ }
23
19
  }
@@ -9,6 +9,7 @@ type mutationNode<'node>
9
9
  type subscriptionNode<'node>
10
10
 
11
11
  type fragmentRefs<'fragments>
12
+ type updatableFragmentRefs<'fragments>
12
13
 
13
14
  type dataId
14
15
  type recordSourceRecords = Js.Json.t
@@ -30,6 +30,9 @@ type subscriptionNode<'node>
30
30
  /**This type shows all of the fragments that has been spread on this particular object.*/
31
31
  type fragmentRefs<'fragments>
32
32
 
33
+ /**This type shows all of the updatable fragments that has been spread on this particular object.*/
34
+ type updatableFragmentRefs<'fragments>
35
+
33
36
  /**The type of the id Relay uses to identify records in its store.*/
34
37
  type dataId
35
38
 
package/src/utils.js CHANGED
@@ -49,6 +49,7 @@ function traverse(
49
49
  if (addFragmentOnRoot) {
50
50
  newObj = getNewObj(newObj, currentObj);
51
51
  newObj.fragmentRefs = Object.assign({}, newObj);
52
+ newObj.updatableFragmentRefs = newObj.fragmentRefs;
52
53
  }
53
54
 
54
55
  for (var key in currentObj) {
@@ -194,6 +195,8 @@ function traverse(
194
195
  if (shouldAddFragmentFn && typeof v === "object" && !Array.isArray(v)) {
195
196
  var objWithFragmentFn = Object.assign({}, v);
196
197
  objWithFragmentFn.fragmentRefs = Object.assign({}, objWithFragmentFn);
198
+ objWithFragmentFn.updatableFragmentRefs =
199
+ objWithFragmentFn.fragmentRefs;
197
200
  return objWithFragmentFn;
198
201
  }
199
202
 
@@ -273,6 +276,9 @@ function traverse(
273
276
  newObj = getNewObj(newObj, currentObj);
274
277
  var objWithFragmentFn = Object.assign({}, v);
275
278
  objWithFragmentFn.fragmentRefs = Object.assign({}, objWithFragmentFn);
279
+ objWithFragmentFn.updatableFragmentRefs =
280
+ objWithFragmentFn.fragmentRefs;
281
+
276
282
  newObj[key] = objWithFragmentFn;
277
283
  }
278
284
  }
package/src/utils.mjs CHANGED
@@ -49,6 +49,7 @@ function traverse(
49
49
  if (addFragmentOnRoot) {
50
50
  newObj = getNewObj(newObj, currentObj);
51
51
  newObj.fragmentRefs = Object.assign({}, newObj);
52
+ newObj.updatableFragmentRefs = newObj.fragmentRefs;
52
53
  }
53
54
 
54
55
  for (var key in currentObj) {
@@ -194,6 +195,8 @@ function traverse(
194
195
  if (shouldAddFragmentFn && typeof v === "object" && !Array.isArray(v)) {
195
196
  var objWithFragmentFn = Object.assign({}, v);
196
197
  objWithFragmentFn.fragmentRefs = Object.assign({}, objWithFragmentFn);
198
+ objWithFragmentFn.updatableFragmentRefs =
199
+ objWithFragmentFn.fragmentRefs;
197
200
  return objWithFragmentFn;
198
201
  }
199
202
 
@@ -273,6 +276,9 @@ function traverse(
273
276
  newObj = getNewObj(newObj, currentObj);
274
277
  var objWithFragmentFn = Object.assign({}, v);
275
278
  objWithFragmentFn.fragmentRefs = Object.assign({}, objWithFragmentFn);
279
+ objWithFragmentFn.updatableFragmentRefs =
280
+ objWithFragmentFn.fragmentRefs;
281
+
276
282
  newObj[key] = objWithFragmentFn;
277
283
  }
278
284
  }