Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,35 @@ jobs:
working-directory: packages/rescript-relay-cli
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions/setup-node@v4
with:
node-version: 23
env:
CI: true
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "4.14"
dune-cache: true
cache-prefix: "v1"
- name: Install PPX dependencies
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam install . --deps-only
- name: Build PPX
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam exec -- dune build bin/RescriptRelayPpxApp.exe
- name: Install
run: |
yarn --frozen-lockfile
- name: Build
run: |
yarn build
- name: Build local Relay compiler
working-directory: packages/rescript-relay
run: |
./build-compiler-dev.sh
- name: Test
run: |
yarn test
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# master

- fix remove-unused-fields command. https://github.com/zth/rescript-relay/pull/636

# 4.5.1

- Fix `traverse` exiting after a custom-scalar field (single array-backed `c`, or `ca`), leaving subsequent fields on the same parent uncoerced. Surfaced as raw `null` for nullable response fields, raw ReScript values for unserialized variables, and (in nested input objects) silently skipped converters. Closes #582; extends #434's #407 fix so trailing fields are preserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.cli-dist/
.yarn/
.pnp.*
lib/
node_modules/
packages/*/lib/
packages/*/node_modules/
packages/web/src/__relay__/*
!.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "remove-unused-fields-monorepo",
"version": "1.0.0",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"relay": "yarn --cwd packages/web relay",
"rescript:build": "rescript build",
"reanalyze": "rescript-tools reanalyze -dce"
},
"dependencies": {
"fixture-web": "1.0.0"
},
"devDependencies": {
"@rescript/react": "0.14.0",
"graphql": "15.8.0",
"react": "18.2.0",
"react-relay": "20.1.1",
"relay-runtime": "20.1.1",
"rescript": "12.3.0",
"rescript-relay": "file:../../../../rescript-relay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "fixture-web",
"version": "1.0.0",
"private": true,
"scripts": {
"relay": "rescript-relay-compiler"
},
"dependencies": {
"@rescript/react": "0.14.0",
"react": "18.2.0",
"react-relay": "20.1.1",
"relay-runtime": "20.1.1",
"rescript": "12.3.0",
"rescript-relay": "file:../../../../../../rescript-relay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
src: "./src",
schema: "./schema.graphql",
artifactDirectory: "./src/__relay__",
language: "rescript",
excludes: ["**/lib/**"],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "fixture-web",
"sources": [
{
"dir": "compiled",
"subdirs": true
},
{
"dir": "src/__relay__",
"subdirs": true
}
],
"dependencies": [
"rescript-relay"
],
"package-specs": {
"module": "commonjs",
"in-source": false
},
"suffix": ".js",
"namespace": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
schema {
query: Query
}

interface Node {
id: ID!
}

type Query {
organization(id: ID!): Organization
currentOrg: Organization!
}

type Organization implements Node {
id: ID!
name: String!
currentUserIsAdmin: Boolean!
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Query = %relay(`
query IndexQuery {
currentOrg {
...OrganizationCard
}
}
`)

@react.component
let make = () => {
let {currentOrg: {fragmentRefs}} = Query.use()

<OrganizationCard fragmentRefs />
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Fragment = %relay(`
fragment OrganizationCard on Organization {
id
name
currentUserIsAdmin
}
`)

@react.component
let make = (~fragmentRefs) => {
let {name} = Fragment.use(fragmentRefs)

React.string(name)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "remove-unused-fields-monorepo",
"sources": [],
"dependencies": [
"fixture-web"
],
"package-specs": {
"module": "commonjs",
"in-source": false
},
"suffix": ".js",
"namespace": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@babel/runtime@^7.25.0":
version "7.29.7"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.29.7.tgz#12022450c45a4da6d8d8287b18a4ff2ddb23f768"
integrity sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==

"@rescript/darwin-arm64@12.3.0":
version "12.3.0"
resolved "https://registry.yarnpkg.com/@rescript/darwin-arm64/-/darwin-arm64-12.3.0.tgz#425376916d2764eeeec930d8f19802ea4680a697"
integrity sha512-tw0E+XcpPoFj3KizsT5qS/5O/dILi0NBZAz5I8ONK+F43qcqDJDDO+Ise45rGoNWhjwt9WOerYnOd0eUe3U9GA==

"@rescript/darwin-x64@12.3.0":
version "12.3.0"
resolved "https://registry.yarnpkg.com/@rescript/darwin-x64/-/darwin-x64-12.3.0.tgz#7e68a5ae8c364a6933882d833f21917dbcfe0de2"
integrity sha512-dW2R31PpBvPjSy50mSd9zKOT3dFw/gKtsUZoML81fPuXPJh0h5rwu9z3S40UUUzOa68uKNxXcVLrG1RAgs20Bw==

"@rescript/linux-arm64@12.3.0":
version "12.3.0"
resolved "https://registry.yarnpkg.com/@rescript/linux-arm64/-/linux-arm64-12.3.0.tgz#db28b15c6a334699f2b7038a4449450dac78033a"
integrity sha512-4GImq346kefHtaMhruFxVwWmr2shWEGQzAGdgZzn5zNWFN32hOXnztHjSFUmj5gmK9fFbidx/oB3BwdbRp5QFQ==

"@rescript/linux-x64@12.3.0":
version "12.3.0"
resolved "https://registry.yarnpkg.com/@rescript/linux-x64/-/linux-x64-12.3.0.tgz#b3680558c39bb317224475397bf9a6868ab975e6"
integrity sha512-0bPcKI0M38EpoFbhLz2w8ZAY3oZ0GWChwcDn43AN2EAWGLiCORhLP6biqRDg37jK/Bh8Y0MhYzjNWIeHoEDINQ==

"@rescript/react@0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@rescript/react/-/react-0.14.0.tgz#f5733c2db6b103913a99f0f7c1a1db9d8e85509b"
integrity sha512-ncOHWK7ujQmff+QMYKRmtwETvJVolzkwRpDa0MFenEXdUz9ZYywNbq+xH9F9RDQeSwC3/4s9JeUQVyTu4fMpHw==

"@rescript/runtime@12.3.0":
version "12.3.0"
resolved "https://registry.yarnpkg.com/@rescript/runtime/-/runtime-12.3.0.tgz#9f878a5ebc1e1791a00f6336e6d625ae3e4f353b"
integrity sha512-8SRM2f6+LaWach8NJjYQVCCmu6KYmJCb+437L7YpaUpJBDyUOC1x0FF75shZ/Gid9guKPF3zMHrTNHLuyQkkiQ==

"@rescript/win32-x64@12.3.0":
version "12.3.0"
resolved "https://registry.yarnpkg.com/@rescript/win32-x64/-/win32-x64-12.3.0.tgz#6fce57c2728f7f6259bf4171efb41688838e5c15"
integrity sha512-TM1aLfn8IJFi0/ztVwHqQOcmJg4jWFCmXjrIS9Tif+6Gx8NdX8ttommUscUghe+Dn2pI382FvqPPNWRUR3AI8g==

asap@~2.0.3:
version "2.0.6"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==

cross-fetch@^3.1.5:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.2.0.tgz#34e9192f53bc757d6614304d9e5e6fb4edb782e3"
integrity sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==
dependencies:
node-fetch "^2.7.0"

detect-libc@^2.0.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad"
integrity sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==

fbjs-css-vars@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8"
integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ==

fbjs@^3.0.2:
version "3.0.5"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-3.0.5.tgz#aa0edb7d5caa6340011790bd9249dbef8a81128d"
integrity sha512-ztsSx77JBtkuMrEypfhgc3cI0+0h+svqeie7xHbh1k/IKdcydnvadp/mUaGgjAOXQmQSxsqgaRhS3q9fy+1kxg==
dependencies:
cross-fetch "^3.1.5"
fbjs-css-vars "^1.0.0"
loose-envify "^1.0.0"
object-assign "^4.1.0"
promise "^7.1.1"
setimmediate "^1.0.5"
ua-parser-js "^1.0.35"

graphql@15.8.0:
version "15.8.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.8.0.tgz#33410e96b012fa3bdb1091cc99a94769db212b38"
integrity sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==

invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
dependencies:
loose-envify "^1.0.0"

"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==

loose-envify@^1.0.0, loose-envify@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

node-fetch@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
dependencies:
whatwg-url "^5.0.0"

nullthrows@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1"
integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==

object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==

promise@^7.1.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"
integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==
dependencies:
asap "~2.0.3"

react-relay@20.1.1:
version "20.1.1"
resolved "https://registry.yarnpkg.com/react-relay/-/react-relay-20.1.1.tgz#b46ad03a8f67f203cc0134726af090e800b7b350"
integrity sha512-pwl7wHHXCOx32dOg4TVNkhVojgGVvOBMo9pcMGeM1BIFYvmwGauKTtBB+qr5buXHGooCL8TXjMVg+ZLizIsbeQ==
dependencies:
"@babel/runtime" "^7.25.0"
fbjs "^3.0.2"
invariant "^2.2.4"
nullthrows "^1.1.1"
relay-runtime "20.1.1"

react@18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
dependencies:
loose-envify "^1.1.0"

relay-runtime@20.1.1:
version "20.1.1"
resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-20.1.1.tgz#e1217a56af7739c8ae8d67db811ed471fd9af895"
integrity sha512-N98ZkkyuIHdXmHaPuljihM1QbFYXATF0gxA0CESFphszsQzXs9A/zZloVfzdOI/xg3B3CfM/5nozvIoeTDIcfw==
dependencies:
"@babel/runtime" "^7.25.0"
fbjs "^3.0.2"
invariant "^2.2.4"

"rescript-relay@file:../../../../rescript-relay":
version "4.5.1"
dependencies:
detect-libc "^2.0.1"

rescript@12.3.0:
version "12.3.0"
resolved "https://registry.yarnpkg.com/rescript/-/rescript-12.3.0.tgz#91aebdd4f5b786d0ba38d3b5754f9dadb3f05329"
integrity sha512-xdnpEoDNoeYjZ8HHATwKJEfWti1Nqwx266edfUC8378a5AO1VvZElj2ZZ/SIJNFgUnohH9yDThB+CHEQfijxKw==
dependencies:
"@rescript/runtime" "12.3.0"
optionalDependencies:
"@rescript/darwin-arm64" "12.3.0"
"@rescript/darwin-x64" "12.3.0"
"@rescript/linux-arm64" "12.3.0"
"@rescript/linux-x64" "12.3.0"
"@rescript/win32-x64" "12.3.0"

setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==

ua-parser-js@^1.0.35:
version "1.0.41"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.41.tgz#bd04dc9ec830fcf9e4fad35cf22dcedd2e3b4e9c"
integrity sha512-LbBDqdIC5s8iROCUjMbW1f5dJQTEFB1+KO9ogbvlb3nm9n4YHa5p4KTvFPWvh2Hs8gZMBuiB1/8+pdfe/tDPug==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"
Loading
Loading