rescript-relay 3.0.0-rc.3 → 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 +17 -0
- package/package.json +5 -5
- package/postinstall.js +30 -27
- package/ppx-linux +0 -0
- package/ppx-macos-arm64 +0 -0
- package/ppx-macos-latest +0 -0
- package/ppx-windows-latest +0 -0
- package/relay-compiler-linux-musl/relay +0 -0
- package/relay-compiler-linux-x64/relay +0 -0
- package/relay-compiler-macos-arm64/relay +0 -0
- package/relay-compiler-macos-x64/relay +0 -0
- package/relay-compiler-win-x64/relay.exe +0 -0
- package/{bsconfig.json → rescript.json} +1 -5
- package/src/RescriptRelay.res +1 -0
- package/src/RescriptRelay.resi +3 -0
- package/src/utils.js +6 -0
- package/src/utils.mjs +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@
|
|
|
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
|
+
|
|
15
|
+
# 3.0.0-rc.4
|
|
16
|
+
|
|
17
|
+
- Set explicit peer dependencies: `@rescript/react >= 0.12.1`, `react-relay@16.0.0`, `relay-runtime@16.0.0`.
|
|
18
|
+
- Clean up connection handler generators now that v3 let us use a better representation.
|
|
19
|
+
- Fix issue with default args in connection id makers. https://github.com/zth/rescript-relay/pull/488
|
|
20
|
+
- Fix issue with PPX not actually converting all functions to uncurried.
|
|
21
|
+
- Rename `bsconfig.json` -> `rescript.json`.
|
|
22
|
+
- Fix an error in postinstall.js when reinstalling rescript-relay dependency (https://github.com/zth/rescript-relay/pull/487)
|
|
23
|
+
|
|
7
24
|
# 3.0.0-rc.3
|
|
8
25
|
|
|
9
26
|
- Fix issue with custom scalars in arrays not being autoconverted properly.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rescript-relay",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.5",
|
|
4
4
|
"main": "src/RescriptRelay.res",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gabriel Nordeborn",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"rescript-relay-cli": "cli/cli.js"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "rescript
|
|
35
|
+
"build": "rescript",
|
|
36
36
|
"build:test": "./build-compiler-dev.sh && ./rescript-relay-compiler",
|
|
37
37
|
"postinstall": "node postinstall.js",
|
|
38
38
|
"test": "jest",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@glennsl/rescript-fetch": "^0.2.0",
|
|
43
|
-
"@rescript/react": "0.12.
|
|
43
|
+
"@rescript/react": "0.12.1",
|
|
44
44
|
"@testing-library/jest-dom": "^5.16.3",
|
|
45
45
|
"@testing-library/react": "^13.0.0-alpha.6",
|
|
46
46
|
"graphql-query-test-mock": "^0.12.1",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"rescript": "^11.0.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@rescript/react": "^0.12.
|
|
58
|
-
"react-relay": "
|
|
57
|
+
"@rescript/react": "^0.12.1",
|
|
58
|
+
"react-relay": "16.0.0",
|
|
59
59
|
"relay-runtime": "*",
|
|
60
60
|
"rescript": "^11.0.0"
|
|
61
61
|
},
|
package/postinstall.js
CHANGED
|
@@ -36,9 +36,6 @@ function getRelayCompilerPlatformSuffix() {
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
function ppxArch() {
|
|
39
|
-
/**
|
|
40
|
-
* Use Rosetta for ARM on macOS
|
|
41
|
-
*/
|
|
42
39
|
if (platform === "darwin" && process.arch === "arm64") {
|
|
43
40
|
return "arm64";
|
|
44
41
|
}
|
|
@@ -99,20 +96,13 @@ function copyPlatformBinaries(platform) {
|
|
|
99
96
|
/**
|
|
100
97
|
* Copy the PPX
|
|
101
98
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
path.join(__dirname, "ppx")
|
|
105
|
-
);
|
|
106
|
-
fs.chmodSync(path.join(__dirname, "ppx"), 0777);
|
|
99
|
+
const ppxFinalFilename = platform === "windows-latest" ? "ppx.exe" : "ppx";
|
|
100
|
+
const ppxFinalPath = path.join(__dirname, ppxFinalFilename);
|
|
107
101
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
fs.copyFileSync(
|
|
111
|
-
path.join(__dirname, "ppx-" + platform),
|
|
112
|
-
path.join(__dirname, "ppx.exe")
|
|
113
|
-
);
|
|
114
|
-
fs.chmodSync(path.join(__dirname, "ppx.exe"), 0777);
|
|
102
|
+
if (!fs.existsSync(ppxFinalPath)) {
|
|
103
|
+
fs.copyFileSync(path.join(__dirname, "ppx-" + platform), ppxFinalPath);
|
|
115
104
|
}
|
|
105
|
+
fs.chmodSync(ppxFinalPath, 0o777);
|
|
116
106
|
|
|
117
107
|
/**
|
|
118
108
|
* Copy the Relay compiler
|
|
@@ -120,22 +110,35 @@ function copyPlatformBinaries(platform) {
|
|
|
120
110
|
|
|
121
111
|
var platformSuffix = getRelayCompilerPlatformSuffix();
|
|
122
112
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"relay-compiler-" + platformSuffix,
|
|
127
|
-
platformSuffix === "win-x64" ? "relay.exe" : "relay"
|
|
128
|
-
),
|
|
129
|
-
path.join(__dirname, "rescript-relay-compiler.exe")
|
|
113
|
+
const rescriptRelayCompilerFinalPath = path.join(
|
|
114
|
+
__dirname,
|
|
115
|
+
"rescript-relay-compiler.exe"
|
|
130
116
|
);
|
|
131
|
-
|
|
117
|
+
|
|
118
|
+
if (!fs.existsSync(rescriptRelayCompilerFinalPath)) {
|
|
119
|
+
fs.copyFileSync(
|
|
120
|
+
path.join(
|
|
121
|
+
__dirname,
|
|
122
|
+
"relay-compiler-" + platformSuffix,
|
|
123
|
+
platformSuffix === "win-x64" ? "relay.exe" : "relay"
|
|
124
|
+
),
|
|
125
|
+
rescriptRelayCompilerFinalPath
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
fs.chmodSync(rescriptRelayCompilerFinalPath, 0o777);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function unlinkIfNotExistsSync(path) {
|
|
132
|
+
if (fs.existsSync(path)) {
|
|
133
|
+
fs.unlinkSync(path);
|
|
134
|
+
}
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
function removeInitialBinaries() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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"));
|
|
139
142
|
fs.rmSync(path.join(__dirname, "relay-compiler-linux-x64"), {
|
|
140
143
|
recursive: true,
|
|
141
144
|
force: true,
|
package/ppx-linux
CHANGED
|
Binary file
|
package/ppx-macos-arm64
CHANGED
|
Binary file
|
package/ppx-macos-latest
CHANGED
|
Binary file
|
package/ppx-windows-latest
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
}
|
package/src/RescriptRelay.res
CHANGED
package/src/RescriptRelay.resi
CHANGED
|
@@ -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
|
}
|