aboutsummaryrefslogtreecommitdiff
path: root/src/api/schema.peechy
blob: 2f457920135c59bb86ba69382891ea9e6c1b1cbb (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package Api;

smol Loader {
    jsx = 1;
    js = 2;
    ts = 3;
    tsx = 4;
    css = 5;
    file = 6;
    json = 7;
}


smol JSXRuntime {
  automatic = 1;
  classic = 2;
}

struct JSX {
  string factory;
  JSXRuntime runtime;
  string fragment;
  bool production;

  // Probably react
  string import_source;

  bool react_fast_refresh;

  string[] loader_keys;
  Loader[] loader_values;
}


struct TransformOptions {
  JSX jsx;
  bool ts;

  string base_path;
  string[] define_keys;
  string[] define_values;
}

struct FileHandle {
  string path;
  uint size;
  uint fd; 
}

message Transform {
  FileHandle handle = 1;
  string path = 2;
  string contents = 3;

  Loader loader = 4;
  TransformOptions options = 5;
}

enum TransformResponseStatus {
  success = 1;
  fail = 2;
}

struct OutputFile {
  byte[] data;
  string path;
}

struct TransformResponse {
  TransformResponseStatus status;
  OutputFile[] files;
  Message[] errors;
}

enum MessageKind {
  err = 1;
  warn  =2;
  note = 3;
  debug = 4;
}

struct Location {
  string file;
  string namespace;
  int32 line;
  int32 column;
  string line_text;
  string suggestion;
  uint offset;
}

message MessageData {
  string text = 1;
   Location location = 2;
}

struct Message {
  MessageKind kind;
  MessageData data;
  MessageData[] notes;
}

struct Log {
  uint32 warnings;
  uint32 errors;
  Message[] msgs;
}