relay-compiler 19.0.0 → 20.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 +1 -125
- 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-compiler-config-schema.json +64 -14
- package/relay-extensions.graphql +1 -1
- package/win-x64/relay.exe +0 -0
package/README.md
CHANGED
@@ -1,127 +1,3 @@
|
|
1
1
|
# Relay Compiler
|
2
2
|
|
3
|
-
|
4
|
-
functionalities of GraphQL code-gen, including file parsing, validation, syntax
|
5
|
-
tree parsing and transformation.
|
6
|
-
|
7
|
-
## Configuration in package.json
|
8
|
-
|
9
|
-
The simplest way to configure relay is to add a new `relay` section to your
|
10
|
-
`package.json` that contains the relay config.
|
11
|
-
|
12
|
-
At minimum, the relay config must specify where to find source files (i.e. files
|
13
|
-
containing `graphql` literals) and the GraphQL schema for the project.
|
14
|
-
|
15
|
-
```
|
16
|
-
// adding new section to package json
|
17
|
-
{
|
18
|
-
...
|
19
|
-
"scripts": {
|
20
|
-
"relay": "relay-compiler"
|
21
|
-
},
|
22
|
-
...
|
23
|
-
// relay configuration
|
24
|
-
"relay": {
|
25
|
-
"src": "./src",
|
26
|
-
"schema": "./src/schema/app_schema.graphql"
|
27
|
-
}
|
28
|
-
}
|
29
|
-
```
|
30
|
-
|
31
|
-
Relay Compiler will automatically discover the config if:
|
32
|
-
|
33
|
-
- There is a `relay.config.json`, `relay.config.js` file at the root of the
|
34
|
-
project (i.e. in the same folder as the `package.json` file).
|
35
|
-
- The `package.json` file contains a `"relay"` key.
|
36
|
-
|
37
|
-
Alternatively, the path to a configuration file can be specified as an argument:
|
38
|
-
|
39
|
-
```shell
|
40
|
-
npm run relay ./relay.json
|
41
|
-
```
|
42
|
-
|
43
|
-
or with yarn
|
44
|
-
|
45
|
-
```shell
|
46
|
-
yarn relay ./relay.json
|
47
|
-
```
|
48
|
-
|
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).
|
51
|
-
|
52
|
-
## File Finder
|
53
|
-
|
54
|
-
Relay compiler uses [`watchman`](https://facebook.github.io/watchman/) to find
|
55
|
-
file sources, and "listen" to the file changes in the "watch" mode. If
|
56
|
-
`watchman` is not available, the compiler will use
|
57
|
-
[glob](https://docs.rs/glob/latest/glob/) to query the filesystem for files.
|
58
|
-
|
59
|
-
## Configuration
|
60
|
-
|
61
|
-
### Supported compiler configuration options
|
62
|
-
|
63
|
-
- `src` Root directory of application code. [string] [required]
|
64
|
-
- `schema` Relative path to the file with GraphQL SDL file. [string] [required]
|
65
|
-
- `language` The name of the language used for input files and generated
|
66
|
-
artifacts. ["javascript" | "typescript" | "flow"] [required].
|
67
|
-
- `artifactDirectory` A specific directory to output all artifacts to. When
|
68
|
-
enabling this the babel plugin needs `artifactDirectory` to be set as well.
|
69
|
-
[string]
|
70
|
-
- `excludes` Directories to ignore under `src`. [array] [default:
|
71
|
-
["\*\*/node_modules/\*\*", "\*\*/__mocks__/\*\*", "\*\*/__generated__/\*\*"]]
|
72
|
-
- `schemaExtensions` List of files or 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
|
-
- `nodeInterfaceIdVariableName` Specifies the name of the variable expected by the `node` query to pass the Node id.
|
77
|
-
[string][default: "id"]
|
78
|
-
- `nonNodeIdFields` Restricts the type of all fields named `id` to `ID`.
|
79
|
-
- `allowedIdTypes` Mappings from types in your schema to allowed types
|
80
|
-
for their fields named `id` (e.g. "ObjectType": "CustomIdType"). [object]
|
81
|
-
- `noFutureProofEnums` This option controls whether or not a
|
82
|
-
catch-all entry is added to enum type definitions values that may be added in
|
83
|
-
the future. Enabling this means you will have to update your application
|
84
|
-
whenever the GraphQL server schema adds new enum values to prevent it from
|
85
|
-
breaking. [boolean][default: false]
|
86
|
-
- `customScalarTypes` Mappings from custom scalars in your schema to built-in
|
87
|
-
GraphQL types, for type emission purposes (eg. {"GqlScalar": "TStype"}). [object]
|
88
|
-
- `eagerEsModules` This option enables emitting ES modules artifacts.
|
89
|
-
[boolean][default: false]
|
90
|
-
- `persistConfig` Relay supports two versions of the config:
|
91
|
-
- - **Remote Persisting:**
|
92
|
-
|
93
|
-
- `url` String, URL to send a POST request to to persist. This field is
|
94
|
-
required in `persistConfig` [string]
|
95
|
-
- `params` The document will be in a `POST` parameter `text`. This map can
|
96
|
-
contain additional parameters to send. [object]
|
97
|
-
- `concurrency` The maximum number concurrent requests that will be made to
|
98
|
-
`url`. Use a value greater than 0. [number]
|
99
|
-
- `include_query_text` Boolean, whether to include the query text in the
|
100
|
-
generated files. [boolean] [default: false]
|
101
|
-
- - **Local Persisting:**
|
102
|
-
- `file` Path for the JSON file that will contain operations map. Compiler
|
103
|
-
will write queries in the format: { "md5(queryText) => "queryText", ...}.
|
104
|
-
[string]
|
105
|
-
- `include_query_text` Boolean, whether to include the query text in the
|
106
|
-
generated files. [boolean] [default: false]
|
107
|
-
|
108
|
-
- `codegenCommand` Command name that for relay compiler. [string]
|
109
|
-
|
110
|
-
- `isDevVariableName` Name of the global variable for dev mode (`__DEV__`).
|
111
|
-
[string]
|
112
|
-
- `jsModuleFormat` Formatting style for generated files. `commonjs` or `haste`.
|
113
|
-
Default is `commonjs`. [string]
|
114
|
-
- `diagnosticReportConfig` Options for configuring the output of compiler
|
115
|
-
diagnostics. [object]
|
116
|
-
- `criticalLevel` The severity level of diagnostics that will cause the
|
117
|
-
compiler to error out on. ["error" | "warning" | "info"]
|
118
|
-
|
119
|
-
### CLI Arguments
|
120
|
-
|
121
|
-
- `--repersist` Run the persister even if the query has not changed.
|
122
|
-
- `--watch` Run compiler in `watch` mode. Requires
|
123
|
-
[`watchman`](https://facebook.github.io/watchman/) to be installed.
|
124
|
-
- `--output` Output format of the compiler. Supported options: `debug` |
|
125
|
-
`verbose` | `quiet` | `quietWithErrors`. The default value is `verbose`.
|
126
|
-
- `--validate` Looks for pending changes and exits with non-zero code instead of
|
127
|
-
writing to disk.
|
3
|
+
See https://relay.dev/docs/next/guides/compiler/
|
package/linux-arm64/relay
CHANGED
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
@@ -1,6 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
3
3
|
"title": "ConfigFile",
|
4
|
+
"description": "Relay's configuration file. Supports a single project config for simple use cases and a multi-project config for cases where multiple projects live in the same repository.\n\nIn general, start with the SingleProjectConfigFile.",
|
4
5
|
"anyOf": [
|
5
6
|
{
|
6
7
|
"description": "Base case configuration (mostly of OSS) where the project have single schema, and single source directory",
|
@@ -42,6 +43,7 @@
|
|
42
43
|
]
|
43
44
|
},
|
44
45
|
"codegenCommand": {
|
46
|
+
"description": "Name of the command that runs the relay compiler. This will be added at the top of generated code to let readers know how to regenerate the file.",
|
45
47
|
"default": null,
|
46
48
|
"type": [
|
47
49
|
"string",
|
@@ -68,6 +70,7 @@
|
|
68
70
|
}
|
69
71
|
},
|
70
72
|
"diagnosticReportConfig": {
|
73
|
+
"description": "Threshold for diagnostics to be critical to the compiler's execution. All diagnostic with severities at and below this level will cause the compiler to fatally exit.",
|
71
74
|
"default": {
|
72
75
|
"criticalLevel": "error"
|
73
76
|
},
|
@@ -112,6 +115,7 @@
|
|
112
115
|
]
|
113
116
|
},
|
114
117
|
"featureFlags": {
|
118
|
+
"description": "Enable and disable experimental or legacy behaviors. WARNING! These are not stable and may change at any time.",
|
115
119
|
"default": null,
|
116
120
|
"anyOf": [
|
117
121
|
{
|
@@ -123,6 +127,7 @@
|
|
123
127
|
]
|
124
128
|
},
|
125
129
|
"jsModuleFormat": {
|
130
|
+
"description": "Import/export style to use in generated JavaScript modules.",
|
126
131
|
"default": "commonjs",
|
127
132
|
"allOf": [
|
128
133
|
{
|
@@ -139,6 +144,7 @@
|
|
139
144
|
]
|
140
145
|
},
|
141
146
|
"moduleImportConfig": {
|
147
|
+
"description": "Configuration for the @module GraphQL directive.",
|
142
148
|
"default": {
|
143
149
|
"dynamicModuleProvider": null,
|
144
150
|
"operationModuleProvider": null,
|
@@ -184,6 +190,7 @@
|
|
184
190
|
]
|
185
191
|
},
|
186
192
|
"relativizeJsModulePaths": {
|
193
|
+
"description": "Whether to treat all JS module names as relative to './' (true) or not. default: true",
|
187
194
|
"default": true,
|
188
195
|
"type": "boolean"
|
189
196
|
},
|
@@ -193,7 +200,7 @@
|
|
193
200
|
"type": "boolean"
|
194
201
|
},
|
195
202
|
"resolverContextType": {
|
196
|
-
"description": "Indicates the type to import and use as the context for
|
203
|
+
"description": "Indicates the type to import and use as the context for Relay Resolvers.",
|
197
204
|
"default": null,
|
198
205
|
"anyOf": [
|
199
206
|
{
|
@@ -232,6 +239,7 @@
|
|
232
239
|
]
|
233
240
|
},
|
234
241
|
"schemaConfig": {
|
242
|
+
"description": "Extra configuration for the GraphQL schema itself.",
|
235
243
|
"default": {
|
236
244
|
"connectionInterface": {
|
237
245
|
"cursor": "cursor",
|
@@ -371,16 +379,28 @@
|
|
371
379
|
"additionalProperties": false
|
372
380
|
},
|
373
381
|
"CustomType": {
|
382
|
+
"description": "Defines a custom GraphQL descrbing a custom scalar.",
|
374
383
|
"anyOf": [
|
375
384
|
{
|
376
|
-
"
|
385
|
+
"description": "A string representing the name of a custom type. e.g. \"string\" or \"number\"",
|
386
|
+
"allOf": [
|
387
|
+
{
|
388
|
+
"$ref": "#/definitions/StringKey"
|
389
|
+
}
|
390
|
+
]
|
377
391
|
},
|
378
392
|
{
|
379
|
-
"
|
393
|
+
"description": "A module which defines the custom type. e.g. { \"name\": \"MyCustomType\", \"path\": \"./Types.ts\" }",
|
394
|
+
"allOf": [
|
395
|
+
{
|
396
|
+
"$ref": "#/definitions/CustomTypeImport"
|
397
|
+
}
|
398
|
+
]
|
380
399
|
}
|
381
400
|
]
|
382
401
|
},
|
383
402
|
"CustomTypeImport": {
|
403
|
+
"description": "Defines a module path and export name of the Flow or TypeScript type descrbing a GraphQL custom scalar.",
|
384
404
|
"type": "object",
|
385
405
|
"required": [
|
386
406
|
"name",
|
@@ -388,9 +408,15 @@
|
|
388
408
|
],
|
389
409
|
"properties": {
|
390
410
|
"name": {
|
391
|
-
"
|
411
|
+
"description": "The name under which the type is exported from the module",
|
412
|
+
"allOf": [
|
413
|
+
{
|
414
|
+
"$ref": "#/definitions/StringKey"
|
415
|
+
}
|
416
|
+
]
|
392
417
|
},
|
393
418
|
"path": {
|
419
|
+
"description": "The path to the module relative to the project root",
|
394
420
|
"type": "string"
|
395
421
|
}
|
396
422
|
}
|
@@ -607,6 +633,17 @@
|
|
607
633
|
}
|
608
634
|
]
|
609
635
|
},
|
636
|
+
"allow_output_type_resolvers": {
|
637
|
+
"description": "@outputType resolvers are a discontinued experimental feature. This flag allows users to allowlist old uses of this feature while they work to remove them. Weak types (types without an `id` field) returned by a Relay Resolver should be limited to types defined using `@RelayResolver` with `@weak`.\n\nIf using the \"limited\" feature flag variant, users can allowlist a specific list of field names.\n\nhttps://relay.dev/docs/next/guides/relay-resolvers/defining-types/#defining-a-weak-type",
|
638
|
+
"default": {
|
639
|
+
"kind": "disabled"
|
640
|
+
},
|
641
|
+
"allOf": [
|
642
|
+
{
|
643
|
+
"$ref": "#/definitions/FeatureFlag"
|
644
|
+
}
|
645
|
+
]
|
646
|
+
},
|
610
647
|
"allow_required_in_mutation_response": {
|
611
648
|
"description": "@required with an action of THROW is read-time feature that is not compatible with our mutation APIs. We are in the process of removing any existing examples, but this flag is part of a process of removing any existing examples.",
|
612
649
|
"default": {
|
@@ -773,6 +810,7 @@
|
|
773
810
|
"type": "boolean"
|
774
811
|
},
|
775
812
|
"relay_resolver_enable_interface_output_type": {
|
813
|
+
"description": "Enable returning interfaces from Relay Resolvers without @outputType",
|
776
814
|
"default": {
|
777
815
|
"kind": "disabled"
|
778
816
|
},
|
@@ -985,10 +1023,14 @@
|
|
985
1023
|
}
|
986
1024
|
},
|
987
1025
|
"featureFlags": {
|
1026
|
+
"description": "Enable and disable experimental or legacy behaviors. WARNING! These are not stable and may change at any time.",
|
988
1027
|
"default": {
|
989
1028
|
"actor_change_support": {
|
990
1029
|
"kind": "disabled"
|
991
1030
|
},
|
1031
|
+
"allow_output_type_resolvers": {
|
1032
|
+
"kind": "disabled"
|
1033
|
+
},
|
992
1034
|
"allow_required_in_mutation_response": {
|
993
1035
|
"kind": "disabled"
|
994
1036
|
},
|
@@ -1229,12 +1271,23 @@
|
|
1229
1271
|
"additionalProperties": false
|
1230
1272
|
},
|
1231
1273
|
"ResolverContextTypeInput": {
|
1274
|
+
"description": "Describes the type to import and use as the context for Relay Resolvers.",
|
1232
1275
|
"anyOf": [
|
1233
1276
|
{
|
1234
|
-
"
|
1277
|
+
"description": "The type imported using a relative path",
|
1278
|
+
"allOf": [
|
1279
|
+
{
|
1280
|
+
"$ref": "#/definitions/ResolverContextTypeInputPath"
|
1281
|
+
}
|
1282
|
+
]
|
1235
1283
|
},
|
1236
1284
|
{
|
1237
|
-
"
|
1285
|
+
"description": "The type imported using a named package",
|
1286
|
+
"allOf": [
|
1287
|
+
{
|
1288
|
+
"$ref": "#/definitions/ResolverContextTypeInputPackage"
|
1289
|
+
}
|
1290
|
+
]
|
1238
1291
|
}
|
1239
1292
|
]
|
1240
1293
|
},
|
@@ -1480,7 +1533,7 @@
|
|
1480
1533
|
]
|
1481
1534
|
},
|
1482
1535
|
"codegenCommand": {
|
1483
|
-
"description": "Name of the command that runs the relay compiler",
|
1536
|
+
"description": "Name of the command that runs the relay compiler. This will be added at the top of generated code to let readers know how to regenerate the file.",
|
1484
1537
|
"default": null,
|
1485
1538
|
"type": [
|
1486
1539
|
"string",
|
@@ -1532,6 +1585,7 @@
|
|
1532
1585
|
}
|
1533
1586
|
},
|
1534
1587
|
"featureFlags": {
|
1588
|
+
"description": "Enable and disable experimental or legacy behaviors. WARNING! These are not stable and may change at any time.",
|
1535
1589
|
"default": null,
|
1536
1590
|
"anyOf": [
|
1537
1591
|
{
|
@@ -1551,7 +1605,7 @@
|
|
1551
1605
|
]
|
1552
1606
|
},
|
1553
1607
|
"jsModuleFormat": {
|
1554
|
-
"description": "
|
1608
|
+
"description": "Import/export style to use in generated JavaScript modules.",
|
1555
1609
|
"default": "commonjs",
|
1556
1610
|
"allOf": [
|
1557
1611
|
{
|
@@ -1625,7 +1679,7 @@
|
|
1625
1679
|
"type": "boolean"
|
1626
1680
|
},
|
1627
1681
|
"resolverContextType": {
|
1628
|
-
"description": "Indicates the type to import and use as the context for
|
1682
|
+
"description": "Indicates the type to import and use as the context for Relay Resolvers.",
|
1629
1683
|
"default": null,
|
1630
1684
|
"anyOf": [
|
1631
1685
|
{
|
@@ -1653,7 +1707,7 @@
|
|
1653
1707
|
"type": "string"
|
1654
1708
|
},
|
1655
1709
|
"schemaConfig": {
|
1656
|
-
"description": "Extra configuration for the schema itself.",
|
1710
|
+
"description": "Extra configuration for the GraphQL schema itself.",
|
1657
1711
|
"default": {
|
1658
1712
|
"connectionInterface": {
|
1659
1713
|
"cursor": "cursor",
|
@@ -1698,10 +1752,6 @@
|
|
1698
1752
|
"default": "",
|
1699
1753
|
"type": "string"
|
1700
1754
|
},
|
1701
|
-
"typegenPhase": {
|
1702
|
-
"description": "Added in 13.1.1 to customize Final/Compat mode in the single project config file Removed in 14.0.0",
|
1703
|
-
"default": null
|
1704
|
-
},
|
1705
1755
|
"typescriptExcludeUndefinedFromNullableUnion": {
|
1706
1756
|
"description": "Keep the previous compiler behavior by outputting an union of the raw type and null, and not the **correct** behavior of an union with the raw type, null and undefined.",
|
1707
1757
|
"default": false,
|
package/relay-extensions.graphql
CHANGED
@@ -26,7 +26,7 @@ directive @no_inline(raw_response_type: Boolean) on FRAGMENT_DEFINITION
|
|
26
26
|
|
27
27
|
A directive added to queries and fragments which causes the Relay client to throw
|
28
28
|
if reading a field that has an error. Relay will also honor the @semanticNonNull
|
29
|
-
|
29
|
+
directive on fields read from that query or fragment. Emitted types for such
|
30
30
|
fields will be non-null. Requires the `experimental_emit_semantic_nullability_types`
|
31
31
|
typegen configuration to be enabled.
|
32
32
|
|
package/win-x64/relay.exe
CHANGED
Binary file
|