relay-compiler 13.0.0-rc.1 → 13.0.0-rc.2

Sign up to get free protection for your applications and to get access to all the features.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # Relay Compiler
2
+
3
+ Relay-Compiler is a code-generation toolkit for GraphQL. It contains the core
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
+ Relay Compiler will automatically discover the config if:
31
+
32
+ - There is a `relay.config.json`, `relay.config.js` file at the root of the
33
+ project (i.e. in the same folder as the `package.json` file).
34
+ - The `package.json` file contains a `"relay"` key.
35
+
36
+ Additionally, this config file can be specified with the CLI argument `--config`
37
+ as follows:
38
+
39
+ ```shell
40
+ npm run relay --config ./relay.json
41
+ ```
42
+
43
+ or with yarn
44
+
45
+ ```shell
46
+ yarn relay --config ./relay.json
47
+ ```
48
+
49
+ Please note, that if you pass configuration options via --cli arguments, you'll
50
+ need to provide a separate configuration for the [babel plugin](https://www.npmjs.com/package/babel-plugin-relay).
51
+
52
+ ## File Finder
53
+ Relay compiler uses [`watchman`](https://facebook.github.io/watchman/) to find
54
+ file sources, and "listen" to the file changes in the "watch" mode.
55
+ If `watchman` is not available, the compiler will
56
+ use [glob](https://docs.rs/glob/latest/glob/) to query the filesystem for files.
57
+
58
+ ## Configuration
59
+
60
+ ### Supported compiler configuration options
61
+
62
+ - `src` Root directory of application code. [string] [required]
63
+ - `schema` Relative path to the file with GraphQL SDL file.
64
+ [string] [required]
65
+ - `artifactDirectory` A specific directory to output all artifacts to. When
66
+ enabling this the babel plugin needs `artifactDirectory`
67
+ to be set as well. [string]
68
+ - `language` The name of the language used for input files and
69
+ generated artifacts.
70
+ ["flow" | "typescript"] [default: "flow"]
71
+ - `excludes` Directories to ignore under `src`. [array] [default:
72
+ ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"]]
73
+ - `schemaExtensions` List of directories with schema extensions. [array]
74
+ - `noFutureProofEnums` For `flow` only. This option controls whether or not
75
+ a catch-all entry is added to enum type definitions
76
+ values that may be added in the future. Enabling this
77
+ means you will have to update your application whenever
78
+ the GraphQL server schema adds new enum values to
79
+ prevent it from breaking. [boolean][default: false]
80
+ - `customScalars` Mappings from custom scalars in your schema to built-in
81
+ GraphQL types, for type emission purposes. [object]
82
+ - `eagerEsModules` This option enables emitting ES modules artifacts.
83
+ [boolean][default: false]
84
+ - `persistConfig`
85
+ - `url` String, URL to send a POST request to to persist.
86
+ [string]
87
+ - `params` The document will be in a `POST`
88
+ parameter `text`. This map can contain additional
89
+ parameters to send. [object]
90
+ - `codegenCommand` Command name that for relay compiler. [string]
91
+
92
+ - `isDevVariableName` Name of the global variable for dev mode (`__DEV__`).
93
+ [string]
94
+ - `jsModuleFormat` Formatting style for generated files. `commonjs`
95
+ or `haste`. Default is `commonjs`.
96
+ [string]
97
+
98
+
99
+ ### CLI configuration
100
+
101
+ We also support a limited set of CLI arguments that should cover the most cases
102
+ when you need to run the compiler.
103
+
104
+ - `--src` Relative path to the source code.
105
+ - `--schema` Relative path to schema file.
106
+ - `--artifactDirectory` Compiler output directory.
107
+ - `--watch` Run compiler in `watch` mode
108
+ (requires [`watchman`](https://facebook.github.io/watchman/) to be installed).
package/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Copyright (c) Facebook, Inc. and its affiliates.
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
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,7 +1,7 @@
1
1
  {
2
2
  "name": "relay-compiler",
3
3
  "description": "A compiler tool for building GraphQL-driven applications.",
4
- "version": "13.0.0-rc.1",
4
+ "version": "13.0.0-rc.2",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay"
package/win-x64/relay.exe CHANGED
Binary file