relay-compiler 13.2.0 → 14.0.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.
- package/README.md +12 -25
- package/cli.js +3 -1
- package/index.js +5 -0
- package/linux-arm64/relay +0 -0
- package/linux-x64/relay +0 -0
- package/macos-arm64/relay +0 -0
- package/macos-x64/relay +0 -0
- package/package.json +1 -1
- package/relay-extensions.graphql +269 -0
- package/win-x64/relay.exe +0 -0
package/README.md
CHANGED
@@ -34,22 +34,20 @@ Relay Compiler will automatically discover the config if:
|
|
34
34
|
project (i.e. in the same folder as the `package.json` file).
|
35
35
|
- The `package.json` file contains a `"relay"` key.
|
36
36
|
|
37
|
-
|
38
|
-
as follows:
|
37
|
+
Alternatively, the path to a configuration file can be specified as an argument:
|
39
38
|
|
40
39
|
```shell
|
41
|
-
npm run relay
|
40
|
+
npm run relay ./relay.json
|
42
41
|
```
|
43
42
|
|
44
43
|
or with yarn
|
45
44
|
|
46
45
|
```shell
|
47
|
-
yarn relay
|
46
|
+
yarn relay ./relay.json
|
48
47
|
```
|
49
48
|
|
50
|
-
Please note,
|
51
|
-
|
52
|
-
[babel plugin](https://www.npmjs.com/package/babel-plugin-relay).
|
49
|
+
Please note, in this case you'll need to provide a separate configuration for
|
50
|
+
the [babel plugin](https://www.npmjs.com/package/babel-plugin-relay).
|
53
51
|
|
54
52
|
## File Finder
|
55
53
|
|
@@ -64,18 +62,18 @@ file sources, and "listen" to the file changes in the "watch" mode. If
|
|
64
62
|
|
65
63
|
- `src` Root directory of application code. [string] [required]
|
66
64
|
- `schema` Relative path to the file with GraphQL SDL file. [string] [required]
|
67
|
-
- `
|
68
|
-
|
69
|
-
the Node interface. Useful if you can't use the default `id` field name.
|
70
|
-
[string][default: "id"]
|
65
|
+
- `language` The name of the language used for input files and generated
|
66
|
+
artifacts. ["javascript" | "typescript" | "flow"] [required].
|
71
67
|
- `artifactDirectory` A specific directory to output all artifacts to. When
|
72
68
|
enabling this the babel plugin needs `artifactDirectory` to be set as well.
|
73
69
|
[string]
|
74
|
-
- `language` The name of the language used for input files and generated
|
75
|
-
artifacts. ["flow" | "typescript"] [default: "flow"]
|
76
70
|
- `excludes` Directories to ignore under `src`. [array] [default:
|
77
71
|
["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"]]
|
78
72
|
- `schemaExtensions` List of directories with schema extensions. [array]
|
73
|
+
- `schemaConfig`
|
74
|
+
- `nodeInterfaceIdField` Configure the name of the globally unique ID field on
|
75
|
+
the Node interface. Useful if you can't use the default `id` field name.
|
76
|
+
[string][default: "id"]
|
79
77
|
- `noFutureProofEnums` For `flow` only. This option controls whether or not a
|
80
78
|
catch-all entry is added to enum type definitions values that may be added in
|
81
79
|
the future. Enabling this means you will have to update your application
|
@@ -106,20 +104,9 @@ file sources, and "listen" to the file changes in the "watch" mode. If
|
|
106
104
|
[string]
|
107
105
|
- `jsModuleFormat` Formatting style for generated files. `commonjs` or `haste`.
|
108
106
|
Default is `commonjs`. [string]
|
109
|
-
- `typegenPhase` - `Final` or `Compat`. Use `Compat` for exposing old
|
110
|
-
`<module>QueryVariables` and `<module>QueryResponse` types in the generated
|
111
|
-
artifacts. But we do recommend migrating to the `Final` mode, where the naming
|
112
|
-
of the exposed types are unified with `<module>$data` and `<module>$variables`
|
113
|
-
suffixes.
|
114
|
-
|
115
|
-
### CLI configuration
|
116
107
|
|
117
|
-
|
118
|
-
when you need to run the compiler.
|
108
|
+
### CLI Arguments
|
119
109
|
|
120
|
-
- `--src` Relative path to the source code.
|
121
|
-
- `--schema` Relative path to schema file.
|
122
|
-
- `--artifactDirectory` Compiler output directory.
|
123
110
|
- `--repersist` Run the persister even if the query has not changed.
|
124
111
|
- `--watch` Run compiler in `watch` mode. Requires
|
125
112
|
[`watchman`](https://facebook.github.io/watchman/) to be installed.
|
package/cli.js
CHANGED
@@ -19,5 +19,7 @@ var input = process.argv.slice(2);
|
|
19
19
|
if (bin !== null) {
|
20
20
|
spawn(bin, input, {stdio: 'inherit'}).on('exit', process.exit);
|
21
21
|
} else {
|
22
|
-
throw new Error(
|
22
|
+
throw new Error(
|
23
|
+
`Platform "${process.platform} (${process.arch})" not supported.`,
|
24
|
+
);
|
23
25
|
}
|
package/index.js
CHANGED
@@ -12,6 +12,9 @@
|
|
12
12
|
|
13
13
|
const path = require('path');
|
14
14
|
|
15
|
+
// We copy this binary resolution in the VSCode extension
|
16
|
+
// If this changes, please update accordingly in here
|
17
|
+
// https://github.com/facebook/relay/blob/main/vscode-extension/src/utils.ts
|
15
18
|
let binary;
|
16
19
|
if (process.platform === 'darwin' && process.arch === 'x64') {
|
17
20
|
binary = path.join(__dirname, 'macos-x64', 'relay');
|
@@ -19,6 +22,8 @@ if (process.platform === 'darwin' && process.arch === 'x64') {
|
|
19
22
|
binary = path.join(__dirname, 'macos-arm64', 'relay');
|
20
23
|
} else if (process.platform === 'linux' && process.arch === 'x64') {
|
21
24
|
binary = path.join(__dirname, 'linux-x64', 'relay');
|
25
|
+
} else if (process.platform === 'linux' && process.arch === 'arm64') {
|
26
|
+
binary = path.join(__dirname, 'linux-arm64', 'relay');
|
22
27
|
} else if (process.platform === 'win32' && process.arch === 'x64') {
|
23
28
|
binary = path.join(__dirname, 'win-x64', 'relay.exe');
|
24
29
|
} else {
|
Binary file
|
package/linux-x64/relay
CHANGED
Binary file
|
package/macos-arm64/relay
CHANGED
Binary file
|
package/macos-x64/relay
CHANGED
Binary file
|
package/package.json
CHANGED
@@ -0,0 +1,269 @@
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2
|
+
#
|
3
|
+
# This source code is licensed under the MIT license found in the
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
5
|
+
|
6
|
+
directive @relay_test_operation on QUERY | MUTATION | SUBSCRIPTION
|
7
|
+
|
8
|
+
"""
|
9
|
+
(Relay only)
|
10
|
+
|
11
|
+
The hooks APIs that Relay exposes allow you to read data from the store only
|
12
|
+
during the render phase. In order to read data from outside of the render
|
13
|
+
phase (or from outside of React), Relay exposes the `@inline` directive. The
|
14
|
+
data from a fragment annotated with `@inline` can be read using `readInlineData`.
|
15
|
+
|
16
|
+
[Read More](https://relay.dev/docs/api-reference/graphql-and-directives/#inline)
|
17
|
+
"""
|
18
|
+
directive @inline on FRAGMENT_DEFINITION
|
19
|
+
|
20
|
+
directive @no_inline(raw_response_type: Boolean) on FRAGMENT_DEFINITION
|
21
|
+
|
22
|
+
"""
|
23
|
+
(Relay only)
|
24
|
+
|
25
|
+
A directive added to queries which tells Relay to generate types that cover
|
26
|
+
the `optimisticResponse` parameter to `commitMutation`.
|
27
|
+
|
28
|
+
[Read More](https://relay.dev/docs/glossary/#raw_response_type)
|
29
|
+
"""
|
30
|
+
directive @raw_response_type on QUERY | MUTATION | SUBSCRIPTION
|
31
|
+
|
32
|
+
directive @DEPRECATED__relay_ignore_unused_variables_error on QUERY | MUTATION | SUBSCRIPTION
|
33
|
+
|
34
|
+
"""
|
35
|
+
(Relay Only)
|
36
|
+
|
37
|
+
For use with [`useRefetchableFragment`](https://relay.dev/docs/api-reference/use-refetchable-fragment/).
|
38
|
+
|
39
|
+
The @refetchable directive can only be added to fragments that are
|
40
|
+
"refetchable", that is, on fragments that are declared on Viewer or Query
|
41
|
+
types, or on a type that implements `Node` (i.e. a type that has an id).
|
42
|
+
|
43
|
+
[Read More](https://relay.dev/docs/api-reference/use-refetchable-fragment/#arguments)
|
44
|
+
"""
|
45
|
+
directive @refetchable(
|
46
|
+
queryName: String!
|
47
|
+
directives: [String!]
|
48
|
+
) on FRAGMENT_DEFINITION
|
49
|
+
|
50
|
+
"""
|
51
|
+
(Relay Only)
|
52
|
+
|
53
|
+
A directive that modifies queries and which causes Relay to generate
|
54
|
+
`$Parameters.js` files and preloadable concrete requests. Required if the
|
55
|
+
query is going to be used as part of an entry point.
|
56
|
+
|
57
|
+
The `hackPreloader` argument is FB only and generates a Hack preloader file.
|
58
|
+
|
59
|
+
[Read More](https://relay.dev/docs/glossary/#preloadable)
|
60
|
+
"""
|
61
|
+
directive @preloadable(hackPreloader: Boolean = false @static) on QUERY
|
62
|
+
|
63
|
+
"""
|
64
|
+
(Relay Only)
|
65
|
+
|
66
|
+
A directive that allows you to turn off Relay's data masking.
|
67
|
+
|
68
|
+
Read more
|
69
|
+
[here](https://relay.dev/docs/api-reference/graphql-and-directives/#relayplural-boolean)
|
70
|
+
and
|
71
|
+
[here](https://relay.dev/docs/api-reference/graphql-and-directives/#relaymask-boolean).
|
72
|
+
"""
|
73
|
+
directive @relay(
|
74
|
+
mask: Boolean
|
75
|
+
plural: Boolean
|
76
|
+
) on FRAGMENT_DEFINITION | FRAGMENT_SPREAD
|
77
|
+
|
78
|
+
# Handles
|
79
|
+
# prettier-ignore
|
80
|
+
directive @__clientField(
|
81
|
+
filters: [String!]
|
82
|
+
handle: String!
|
83
|
+
key: String
|
84
|
+
) repeatable on FIELD
|
85
|
+
|
86
|
+
# MatchTransform
|
87
|
+
"""
|
88
|
+
(Relay Only)
|
89
|
+
|
90
|
+
A directive that, when used in combination with `@module`, allows users to
|
91
|
+
download specific JS components alongside the rest of the GraphQL payload if
|
92
|
+
the field decorated with [`@match`](https://relay.dev/docs/glossary/#match)
|
93
|
+
has a certain type. See [3D](https://relay.dev/docs/glossary/#3d).
|
94
|
+
|
95
|
+
[Read More](https://relay.dev/docs/glossary/#match)
|
96
|
+
"""
|
97
|
+
directive @match(key: String @static) on FIELD
|
98
|
+
|
99
|
+
"""
|
100
|
+
(Relay Only)
|
101
|
+
|
102
|
+
A directive that, when used in combination with
|
103
|
+
[`@match`](https://relay.dev/docs/glossary/#match), allows users to specify
|
104
|
+
which JS components to download if the field decorated with @match has a
|
105
|
+
certain type. See [3D](https://relay.dev/docs/glossary/#3d).
|
106
|
+
|
107
|
+
[Read More](https://relay.dev/docs/glossary/#module)
|
108
|
+
"""
|
109
|
+
directive @module(name: String!) on FRAGMENT_SPREAD
|
110
|
+
|
111
|
+
# ConnectionTransform
|
112
|
+
"""
|
113
|
+
(Relay Only)
|
114
|
+
|
115
|
+
A directive which declares that a field implements the connection spec.
|
116
|
+
|
117
|
+
[Read More](https://relay.dev/docs/guided-tour/list-data/pagination/)
|
118
|
+
"""
|
119
|
+
directive @connection(
|
120
|
+
key: String!
|
121
|
+
filters: [String]
|
122
|
+
handler: String
|
123
|
+
dynamicKey_UNSTABLE: String
|
124
|
+
) on FIELD
|
125
|
+
|
126
|
+
directive @stream_connection(
|
127
|
+
key: String!
|
128
|
+
filters: [String]
|
129
|
+
handler: String
|
130
|
+
label: String
|
131
|
+
initial_count: Int!
|
132
|
+
if: Boolean = true
|
133
|
+
use_customized_batch: Boolean = false
|
134
|
+
dynamicKey_UNSTABLE: String
|
135
|
+
) on FIELD
|
136
|
+
|
137
|
+
# RequiredTransform
|
138
|
+
enum RequiredFieldAction {
|
139
|
+
NONE
|
140
|
+
LOG
|
141
|
+
THROW
|
142
|
+
}
|
143
|
+
|
144
|
+
"""
|
145
|
+
(Relay Only)
|
146
|
+
|
147
|
+
`@required` is a directive you can add to fields in your Relay queries to
|
148
|
+
declare how null values should be handled at runtime. You can think of it as
|
149
|
+
saying "if this field is ever null, its parent field is invalid and should be
|
150
|
+
null".
|
151
|
+
|
152
|
+
[Read More](https://www.internalfb.com/intern/staticdocs/relay/docs/guides/required-directive/) (FB only)
|
153
|
+
"""
|
154
|
+
directive @required(action: RequiredFieldAction! @static) on FIELD
|
155
|
+
|
156
|
+
# DeclarativeConnection
|
157
|
+
"""
|
158
|
+
(Relay Only)
|
159
|
+
|
160
|
+
For use within mutations. After the mutation request is complete, this field
|
161
|
+
will be removed from the store.
|
162
|
+
|
163
|
+
[Read More](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#updating-data-once-a-request-is-complete)
|
164
|
+
"""
|
165
|
+
directive @deleteRecord on FIELD
|
166
|
+
|
167
|
+
"""
|
168
|
+
(Relay Only)
|
169
|
+
|
170
|
+
For use within mutations. After the mutation request is complete, this edge
|
171
|
+
will be removed from its parent connection.
|
172
|
+
|
173
|
+
[Read More](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#updating-data-once-a-request-is-complete)
|
174
|
+
"""
|
175
|
+
directive @deleteEdge(connections: [ID!]!) on FIELD
|
176
|
+
|
177
|
+
"""
|
178
|
+
(Relay Only)
|
179
|
+
|
180
|
+
For use within mutations. After the mutation request is complete, this edge
|
181
|
+
will be appended to its parent connection.
|
182
|
+
|
183
|
+
[Read More](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#updating-data-once-a-request-is-complete)
|
184
|
+
"""
|
185
|
+
directive @appendEdge(connections: [ID!]!) on FIELD
|
186
|
+
|
187
|
+
"""
|
188
|
+
(Relay Only)
|
189
|
+
|
190
|
+
For use within mutations. After the mutation request is complete, this edge
|
191
|
+
will be prepended to its parent connection.
|
192
|
+
|
193
|
+
[Read More](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#updating-data-once-a-request-is-complete)
|
194
|
+
"""
|
195
|
+
directive @prependEdge(connections: [ID!]!) on FIELD
|
196
|
+
|
197
|
+
"""
|
198
|
+
(Relay Only)
|
199
|
+
|
200
|
+
For use within mutations. After the mutation request is complete, this node
|
201
|
+
will be appended to its parent connection.
|
202
|
+
|
203
|
+
[Read More](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#updating-data-once-a-request-is-complete)
|
204
|
+
"""
|
205
|
+
directive @appendNode(connections: [ID!]!, edgeTypeName: String!) on FIELD
|
206
|
+
|
207
|
+
"""
|
208
|
+
(Relay Only)
|
209
|
+
|
210
|
+
For use within mutations. After the mutation request is complete, this node
|
211
|
+
will be prepended to its parent connection.
|
212
|
+
|
213
|
+
[Read More](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#updating-data-once-a-request-is-complete)
|
214
|
+
"""
|
215
|
+
directive @prependNode(connections: [ID!]!, edgeTypeName: String!) on FIELD
|
216
|
+
|
217
|
+
# RelayClientComponentTransform
|
218
|
+
directive @relay_client_component on FRAGMENT_SPREAD
|
219
|
+
|
220
|
+
# RelayResolver
|
221
|
+
directive @relay_resolver(
|
222
|
+
fragment_name: String!
|
223
|
+
import_path: String!
|
224
|
+
live: Boolean
|
225
|
+
) on FIELD_DEFINITION
|
226
|
+
|
227
|
+
"""
|
228
|
+
(Relay Only)
|
229
|
+
|
230
|
+
Reading this Client Edge field triggers a network roundtrip or "waterfall". The
|
231
|
+
consuming component will suspend until that request has been fulfilled.
|
232
|
+
"""
|
233
|
+
directive @waterfall on FIELD
|
234
|
+
|
235
|
+
"""
|
236
|
+
(Relay Only)
|
237
|
+
|
238
|
+
Marks a given query or fragment as updatable.
|
239
|
+
|
240
|
+
[Read More](https://fb.quip.com/4FZaADvkQPPl)
|
241
|
+
"""
|
242
|
+
directive @updatable on QUERY | FRAGMENT_DEFINITION
|
243
|
+
|
244
|
+
"""
|
245
|
+
(Relay Only)
|
246
|
+
|
247
|
+
Marks a given fragment as assignable.
|
248
|
+
|
249
|
+
[Read More](https://fb.quip.com/4FZaADvkQPPl)
|
250
|
+
"""
|
251
|
+
directive @assignable on FRAGMENT_DEFINITION
|
252
|
+
|
253
|
+
"""
|
254
|
+
(Relay Only)
|
255
|
+
|
256
|
+
Exposes a fragment's data as a new field which can be null checked to ensure it
|
257
|
+
matches the parent selection.
|
258
|
+
"""
|
259
|
+
directive @alias(as: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT
|
260
|
+
|
261
|
+
"""
|
262
|
+
(Relay Only)
|
263
|
+
|
264
|
+
Indicates that a given directive argument is expected to be provided statically.
|
265
|
+
If a non-static value is provided, it will result in a validation error.
|
266
|
+
|
267
|
+
Used for arguments which are expected to be read by the Relay compiler.
|
268
|
+
"""
|
269
|
+
directive @static on ARGUMENT_DEFINITION
|
package/win-x64/relay.exe
CHANGED
Binary file
|