-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathppx_config.re
More file actions
55 lines (42 loc) · 1.74 KB
/
ppx_config.re
File metadata and controls
55 lines (42 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
type output_mode =
| String
| Apollo_AST;
type config = {
verbose_logging: bool,
output_mode,
verbose_error_handling: bool,
apollo_mode: bool,
root_directory: string,
schema_file: string,
raise_error_with_loc: 'a. (Source_pos.ast_location, string) => 'a,
records: bool,
legacy: bool,
definition: bool,
template_tag: option(string),
template_tag_location: option(string),
template_tag_import: option(string),
relay: bool,
};
let config_ref = ref(None);
let set_config = config => config_ref := Some(config);
let update_config = update => config_ref := config_ref^ |> Option.map(update);
let verbose_logging = () =>
(config_ref^ |> Option.unsafe_unwrap).verbose_logging;
let output_mode = () => (config_ref^ |> Option.unsafe_unwrap).output_mode;
let apollo_mode = () => (config_ref^ |> Option.unsafe_unwrap).apollo_mode;
let records = () => (config_ref^ |> Option.unsafe_unwrap).records;
let legacy = () => (config_ref^ |> Option.unsafe_unwrap).legacy;
let definition = () => (config_ref^ |> Option.unsafe_unwrap).definition;
let relay = () => (config_ref^ |> Option.unsafe_unwrap).relay;
let template_tag = () => (config_ref^ |> Option.unsafe_unwrap).template_tag;
let template_tag_import = () =>
(config_ref^ |> Option.unsafe_unwrap).template_tag_import;
let template_tag_location = () =>
(config_ref^ |> Option.unsafe_unwrap).template_tag_location;
let verbose_error_handling = () =>
(config_ref^ |> Option.unsafe_unwrap).verbose_error_handling;
let root_directory = () =>
(config_ref^ |> Option.unsafe_unwrap).root_directory;
let schema_file = () => (config_ref^ |> Option.unsafe_unwrap).schema_file;
let raise_error_with_loc = (loc, message) =>
(config_ref^ |> Option.unsafe_unwrap).raise_error_with_loc(loc, message);