relay-compiler 19.0.0 → 20.1.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 +483 -640
- package/relay-extensions.graphql +2 -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
|