@sdboyer/thema-ui 0.0.0-bootstrap.0 → 0.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.
Files changed (225) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -1
  3. package/dist/Diagnostics.d.ts +8 -0
  4. package/dist/Diagnostics.js +14 -0
  5. package/dist/Editor.d.ts +12 -0
  6. package/dist/Editor.js +95 -0
  7. package/dist/OpBar.d.ts +14 -0
  8. package/dist/OpBar.js +15 -0
  9. package/dist/Output.d.ts +20 -0
  10. package/dist/Output.js +56 -0
  11. package/dist/Tabs.d.ts +15 -0
  12. package/dist/Tabs.js +23 -0
  13. package/dist/cue-lang.d.ts +8 -0
  14. package/dist/cue-lang.js +82 -0
  15. package/dist/docs.d.ts +64 -0
  16. package/dist/docs.js +42 -0
  17. package/dist/index.d.ts +12 -0
  18. package/dist/index.js +18 -0
  19. package/dist/markers.d.ts +11 -0
  20. package/dist/markers.js +45 -0
  21. package/dist/ops.d.ts +13 -0
  22. package/dist/ops.js +22 -0
  23. package/dist/positions.d.ts +7 -0
  24. package/dist/positions.js +40 -0
  25. package/dist/theme.d.ts +16 -0
  26. package/dist/theme.js +55 -0
  27. package/dist/types.d.ts +580 -0
  28. package/dist/types.js +85 -0
  29. package/errors/E0101.md +43 -0
  30. package/errors/E0102.md +34 -0
  31. package/errors/E0103.md +41 -0
  32. package/errors/E0104.md +5 -0
  33. package/errors/E0105.md +62 -0
  34. package/errors/E0106.md +46 -0
  35. package/errors/E0107.md +48 -0
  36. package/errors/E0108.md +45 -0
  37. package/errors/E0109.md +37 -0
  38. package/errors/E0110.md +17 -0
  39. package/errors/E0111.md +55 -0
  40. package/errors/E0112.md +40 -0
  41. package/errors/E0120.md +34 -0
  42. package/errors/E0121.md +34 -0
  43. package/errors/E0122.md +26 -0
  44. package/errors/E0123.md +37 -0
  45. package/errors/E0124.md +36 -0
  46. package/errors/E0125.md +43 -0
  47. package/errors/E0126.md +38 -0
  48. package/errors/E0128.md +34 -0
  49. package/errors/E0129.md +42 -0
  50. package/errors/E0130.md +43 -0
  51. package/errors/E0131.md +42 -0
  52. package/errors/E0132.md +40 -0
  53. package/errors/E0133.md +46 -0
  54. package/errors/E0134.md +36 -0
  55. package/errors/E0135.md +109 -0
  56. package/errors/E0137.md +37 -0
  57. package/errors/E0140.md +46 -0
  58. package/errors/E0141.md +35 -0
  59. package/errors/E0142.md +38 -0
  60. package/errors/E0143.md +62 -0
  61. package/errors/E0144.md +49 -0
  62. package/errors/E0145.md +48 -0
  63. package/errors/E0146.md +38 -0
  64. package/errors/E0147.md +57 -0
  65. package/errors/E0148.md +42 -0
  66. package/errors/E0149.md +27 -0
  67. package/errors/E0150.md +77 -0
  68. package/errors/E0151.md +47 -0
  69. package/errors/E0152.md +35 -0
  70. package/errors/E0201.md +35 -0
  71. package/errors/E0202.md +42 -0
  72. package/errors/E0203.md +37 -0
  73. package/errors/E0204.md +46 -0
  74. package/errors/E0205.md +47 -0
  75. package/errors/E0206.md +47 -0
  76. package/errors/E0208.md +59 -0
  77. package/errors/E0210.md +44 -0
  78. package/errors/E0211.md +43 -0
  79. package/errors/E0212.md +41 -0
  80. package/errors/E0213.md +42 -0
  81. package/errors/E0214.md +42 -0
  82. package/errors/E0215.md +44 -0
  83. package/errors/E0216.md +41 -0
  84. package/errors/E0217.md +43 -0
  85. package/errors/E0218.md +44 -0
  86. package/errors/E0230.md +46 -0
  87. package/errors/E0232.md +42 -0
  88. package/errors/E0233.md +42 -0
  89. package/errors/E0234.md +43 -0
  90. package/errors/E0240.md +31 -0
  91. package/errors/E0242.md +5 -0
  92. package/errors/E0243.md +5 -0
  93. package/errors/E0250.md +39 -0
  94. package/errors/E0251.md +83 -0
  95. package/errors/E0252.md +42 -0
  96. package/errors/E0253.md +142 -0
  97. package/errors/E0254.md +38 -0
  98. package/errors/E0301.md +43 -0
  99. package/errors/E0302.md +58 -0
  100. package/errors/E0303.md +57 -0
  101. package/errors/E0304.md +9 -0
  102. package/errors/E0305.md +55 -0
  103. package/errors/E0307.md +9 -0
  104. package/errors/E0308.md +9 -0
  105. package/errors/E0310.md +46 -0
  106. package/errors/E0311.md +46 -0
  107. package/errors/E0330.md +67 -0
  108. package/errors/E0331.md +64 -0
  109. package/errors/E0332.md +52 -0
  110. package/errors/E0333.md +61 -0
  111. package/errors/E0334.md +61 -0
  112. package/errors/E0335.md +57 -0
  113. package/errors/E0336.md +50 -0
  114. package/errors/E0337.md +54 -0
  115. package/errors/E0338.md +62 -0
  116. package/errors/E0340.md +57 -0
  117. package/errors/E0341.md +51 -0
  118. package/errors/E0342.md +53 -0
  119. package/errors/E0343.md +56 -0
  120. package/errors/E0344.md +58 -0
  121. package/errors/E0345.md +51 -0
  122. package/errors/E0346.md +45 -0
  123. package/errors/E0347.md +53 -0
  124. package/errors/E0348.md +50 -0
  125. package/errors/E0349.md +52 -0
  126. package/errors/E0350.md +54 -0
  127. package/errors/E0351.md +54 -0
  128. package/errors/E0352.md +60 -0
  129. package/errors/E0353.md +53 -0
  130. package/errors/E0354.md +43 -0
  131. package/errors/E0355.md +55 -0
  132. package/errors/E0356.md +65 -0
  133. package/errors/E0357.md +68 -0
  134. package/errors/E0358.md +50 -0
  135. package/errors/E0359.md +53 -0
  136. package/errors/E0360.md +59 -0
  137. package/errors/E0361.md +59 -0
  138. package/errors/E0362.md +56 -0
  139. package/errors/E0364.md +58 -0
  140. package/errors/E0365.md +58 -0
  141. package/errors/E0366.md +56 -0
  142. package/errors/E0367.md +57 -0
  143. package/errors/E0368.md +58 -0
  144. package/errors/E0369.md +60 -0
  145. package/errors/E0370.md +59 -0
  146. package/errors/E0371.md +59 -0
  147. package/errors/E0372.md +57 -0
  148. package/errors/E0380.md +71 -0
  149. package/errors/E0381.md +61 -0
  150. package/errors/E0382.md +64 -0
  151. package/errors/E0383.md +61 -0
  152. package/errors/E0384.md +63 -0
  153. package/errors/E0385.md +61 -0
  154. package/errors/E0386.md +59 -0
  155. package/errors/E0387.md +59 -0
  156. package/errors/E0388.md +60 -0
  157. package/errors/E0389.md +59 -0
  158. package/errors/E0390.md +59 -0
  159. package/errors/E0401.md +56 -0
  160. package/errors/E0402.md +51 -0
  161. package/errors/E0403.md +51 -0
  162. package/errors/E0404.md +57 -0
  163. package/errors/E0405.md +56 -0
  164. package/errors/E0406.md +53 -0
  165. package/errors/E0407.md +54 -0
  166. package/errors/E0410.md +56 -0
  167. package/errors/E0411.md +59 -0
  168. package/errors/E0412.md +59 -0
  169. package/errors/E0413.md +74 -0
  170. package/errors/E0414.md +53 -0
  171. package/errors/E0415.md +72 -0
  172. package/errors/E0416.md +67 -0
  173. package/errors/E0418.md +59 -0
  174. package/errors/E0420.md +71 -0
  175. package/errors/E0421.md +82 -0
  176. package/errors/E0422.md +82 -0
  177. package/errors/E0423.md +83 -0
  178. package/errors/E0501.md +51 -0
  179. package/errors/E0502.md +50 -0
  180. package/errors/E0503.md +52 -0
  181. package/errors/E0504.md +64 -0
  182. package/errors/E0505.md +51 -0
  183. package/errors/E0506.md +48 -0
  184. package/errors/E0507.md +41 -0
  185. package/errors/E0508.md +39 -0
  186. package/errors/E0601.md +22 -0
  187. package/errors/E0602.md +28 -0
  188. package/errors/E0603.md +65 -0
  189. package/errors/E0604.md +37 -0
  190. package/errors/E0605.md +36 -0
  191. package/errors/E0606.md +44 -0
  192. package/errors/E0607.md +57 -0
  193. package/errors/E0608.md +37 -0
  194. package/errors/E0609.md +33 -0
  195. package/errors/E0611.md +37 -0
  196. package/errors/E0612.md +34 -0
  197. package/errors/E0613.md +30 -0
  198. package/errors/E0614.md +36 -0
  199. package/errors/E0616.md +33 -0
  200. package/errors/E0617.md +15 -0
  201. package/errors/E0618.md +16 -0
  202. package/errors/E0620.md +37 -0
  203. package/errors/E0621.md +45 -0
  204. package/errors/E0622.md +34 -0
  205. package/errors/E0623.md +33 -0
  206. package/errors/E0624.md +34 -0
  207. package/errors/E0625.md +28 -0
  208. package/errors/E0626.md +54 -0
  209. package/errors/E0627.md +27 -0
  210. package/errors/E0628.md +63 -0
  211. package/errors/E0701.md +25 -0
  212. package/errors/E0801.md +23 -0
  213. package/errors/E0802.md +22 -0
  214. package/errors/E0803.md +22 -0
  215. package/errors/E0804.md +25 -0
  216. package/errors/E0805.md +26 -0
  217. package/errors/E0901.md +27 -0
  218. package/errors/E0902.md +40 -0
  219. package/errors/E0903.md +23 -0
  220. package/errors/E1001.md +53 -0
  221. package/errors/E1002.md +43 -0
  222. package/errors/E1003.md +40 -0
  223. package/errors/E1004.md +44 -0
  224. package/errors/README.md +215 -0
  225. package/package.json +29 -3
@@ -0,0 +1,34 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0128: there is no value at the path given for the lineage
4
+
5
+ The caller named a path for the lineage, and there is no value there. The CLI's
6
+ `-p` flag and the Go API's cue.Value both lead here; check the path against the
7
+ file.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ lineage: {
15
+ name: "ship"
16
+ schemas: {
17
+ "0": {
18
+ "0": {
19
+ schema: {
20
+ a: string
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ thema reports:
29
+
30
+ ```
31
+ error[E0128]: there is no value at lineages.ship to bind as a lineage
32
+ |
33
+ = detail: field not found: lineages
34
+ ```
@@ -0,0 +1,42 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0129: a schema is not a struct
4
+
5
+ Every schema is a struct: an instance is an object with fields, never a bare
6
+ scalar or list. Here both the joinSchema (E0130) and the schema are strings.
7
+
8
+ ## Example
9
+
10
+ `lineage.cue`:
11
+
12
+ ```cue
13
+ name: "ship"
14
+ joinSchema: string
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: string
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ thema reports:
25
+
26
+ ```
27
+ error[E0130]: joinSchema is string, not a struct
28
+ --> lineage.cue:2:1
29
+ |
30
+ 2 | joinSchema: string
31
+ | ^^^^^^^^^^
32
+ |
33
+ = help: a joinSchema is a struct every schema in the lineage is an instance of, or _ to join nothing
34
+
35
+ error[E0129]: schema 0.0 is string, not a struct
36
+ --> lineage.cue:6:4
37
+ |
38
+ 6 | schema: string
39
+ | ^^^^^^
40
+ |
41
+ = help: every schema is a struct
42
+ ```
@@ -0,0 +1,43 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0130: the joinSchema is not a struct
4
+
5
+ A lineage's joinSchema is a struct every schema in the lineage is an instance
6
+ of, or `_` to join nothing. Here it is a string, so the schema that must be an
7
+ instance of it cannot be a struct either (E0129).
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ joinSchema: string
16
+ schemas: {
17
+ "0": {
18
+ "0": {
19
+ schema: string
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ thema reports:
26
+
27
+ ```
28
+ error[E0130]: joinSchema is string, not a struct
29
+ --> lineage.cue:2:1
30
+ |
31
+ 2 | joinSchema: string
32
+ | ^^^^^^^^^^
33
+ |
34
+ = help: a joinSchema is a struct every schema in the lineage is an instance of, or _ to join nothing
35
+
36
+ error[E0129]: schema 0.0 is string, not a struct
37
+ --> lineage.cue:6:4
38
+ |
39
+ 6 | schema: string
40
+ | ^^^^^^
41
+ |
42
+ = help: every schema is a struct
43
+ ```
@@ -0,0 +1,42 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0131: an example is not an instance of its schema
4
+
5
+ A schema's examples are instances of it, checked when the lineage binds. This
6
+ example lacks the field the schema requires; CUE's reasons are in the detail
7
+ and its positions are the notes.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ count: int
20
+ }
21
+ examples: {
22
+ empty: {}
23
+ }
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ thema reports:
30
+
31
+ ```
32
+ error[E0131]: example empty of schema 0.0 is not an instance of it
33
+ --> lineage.cue:9:5
34
+ |
35
+ 6 | count: int
36
+ | --- here
37
+ ...
38
+ 9 | empty: {}
39
+ | ^^^^^
40
+ |
41
+ = detail: count: incomplete value int
42
+ ```
@@ -0,0 +1,40 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0132: a schema uses a comprehension
4
+
5
+ A schema's fields are known without evaluating any data. A comprehension makes
6
+ them depend on evaluation, and then no check can describe the schema: not
7
+ compatibility between versions, not whether a lens produces every field.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ a: int
20
+ if true {
21
+ b: int
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ thema reports:
30
+
31
+ ```
32
+ error[E0132]: schema 0.0 uses a comprehension
33
+ --> lineage.cue:7:5
34
+ |
35
+ 7 | if true {
36
+ | ^^
37
+ |
38
+ = note: a schema's fields must be known without evaluating data: no check can describe a schema whose fields depend on evaluation
39
+ = help: write the fields the comprehension would produce
40
+ ```
@@ -0,0 +1,46 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0133: a schema's references form a cycle
4
+
5
+ References within a schema may not form a cycle: a cycle makes the schema's
6
+ paths unbounded, and no check can describe it. Each cycle is reported once, at
7
+ the reference that closes it.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ #A: {b?: #B}
20
+ #B: {a?: #A}
21
+ root: #A
22
+ }
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ thema reports:
29
+
30
+ ```
31
+ error[E0133]: schema 0.0 has a reference cycle: #B -> #A -> #B
32
+ --> lineage.cue:6:10
33
+ |
34
+ 6 | #A: {b?: #B}
35
+ | ^
36
+ |
37
+ = note: a schema's references may not form a cycle: no check can describe a schema whose paths are unbounded
38
+
39
+ error[E0133]: schema 0.0 has a reference cycle: #A -> #B -> #A
40
+ --> lineage.cue:7:10
41
+ |
42
+ 7 | #B: {a?: #A}
43
+ | ^
44
+ |
45
+ = note: a schema's references may not form a cycle: no check can describe a schema whose paths are unbounded
46
+ ```
@@ -0,0 +1,36 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0134: a schema refers to a value that contains it
4
+
5
+ A schema may not refer to a value that contains it, such as the lineage's own
6
+ schemas: that is a cycle through the lineage, and the schema's shape would
7
+ depend on the lineage it is part of.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ n: <=len(schemas)
20
+ }
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ thema reports:
27
+
28
+ ```
29
+ error[E0134]: schema 0.0 refers to schemas, which contains it
30
+ --> lineage.cue:6:14
31
+ |
32
+ 6 | n: <=len(schemas)
33
+ | ^^^^^^^
34
+ |
35
+ = note: a schema's references may not form a cycle: no check can describe a schema whose paths are unbounded
36
+ ```
@@ -0,0 +1,109 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0135: a schema's chain of references is too deep to follow
4
+
5
+ thema follows a schema's references to check them for cycles, to a depth of 64.
6
+ A chain of references longer than that is reported rather than followed: a
7
+ schema's references form a finite tree, and a chain this long is not one an
8
+ author writes by hand.
9
+
10
+ ## Example
11
+
12
+ `lineage.cue`:
13
+
14
+ ```cue
15
+ name: "ship"
16
+ schemas: {
17
+ "0": {
18
+ "0": {
19
+ schema: {
20
+ a0: a1
21
+ a1: a2
22
+ a2: a3
23
+ a3: a4
24
+ a4: a5
25
+ a5: a6
26
+ a6: a7
27
+ a7: a8
28
+ a8: a9
29
+ a9: a10
30
+ a10: a11
31
+ a11: a12
32
+ a12: a13
33
+ a13: a14
34
+ a14: a15
35
+ a15: a16
36
+ a16: a17
37
+ a17: a18
38
+ a18: a19
39
+ a19: a20
40
+ a20: a21
41
+ a21: a22
42
+ a22: a23
43
+ a23: a24
44
+ a24: a25
45
+ a25: a26
46
+ a26: a27
47
+ a27: a28
48
+ a28: a29
49
+ a29: a30
50
+ a30: a31
51
+ a31: a32
52
+ a32: a33
53
+ a33: a34
54
+ a34: a35
55
+ a35: a36
56
+ a36: a37
57
+ a37: a38
58
+ a38: a39
59
+ a39: a40
60
+ a40: a41
61
+ a41: a42
62
+ a42: a43
63
+ a43: a44
64
+ a44: a45
65
+ a45: a46
66
+ a46: a47
67
+ a47: a48
68
+ a48: a49
69
+ a49: a50
70
+ a50: a51
71
+ a51: a52
72
+ a52: a53
73
+ a53: a54
74
+ a54: a55
75
+ a55: a56
76
+ a56: a57
77
+ a57: a58
78
+ a58: a59
79
+ a59: a60
80
+ a60: a61
81
+ a61: a62
82
+ a62: a63
83
+ a63: a64
84
+ a64: a65
85
+ a65: a66
86
+ a66: int
87
+ }
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ thema reports:
94
+
95
+ ```
96
+ error[E0135]: schema 0.0 has a chain of references deeper than 64 at a65
97
+ --> lineage.cue:70:5
98
+ |
99
+ 70 | a64: a65
100
+ | ^^^
101
+ |
102
+
103
+ error[E0135]: schema 0.0 has a chain of references deeper than 64 at a66
104
+ --> lineage.cue:71:5
105
+ |
106
+ 71 | a65: a66
107
+ | ^^^
108
+ |
109
+ ```
@@ -0,0 +1,37 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0137: the lineage's name is not an identifier
4
+
5
+ A lineage's name is an identifier: a letter followed by letters and digits. It
6
+ names the thing the schemas describe in generated code and in error messages,
7
+ so it must be usable as a name everywhere thema emits it.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship-v2"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ a: string
20
+ }
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ thema reports:
27
+
28
+ ```
29
+ error[E0137]: the lineage's name is "ship-v2", which is not an identifier
30
+ --> lineage.cue:1:7
31
+ |
32
+ 1 | name: "ship-v2"
33
+ | ^^^^^^^^^
34
+ |
35
+ = detail: name: invalid value "ship-v2" (out of bound =~"^[A-Za-z][A-Za-z0-9_]*$")
36
+ = help: a name starts with a letter and continues with letters and digits
37
+ ```
@@ -0,0 +1,46 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0140: a schema refers to another schema of the lineage
4
+
5
+ A schema reads a field of another schema through the lineage. A schema may
6
+ refer only to its own body and CUE's builtin packages: one reached through the
7
+ lineage's schemas is another schema, and this schema's meaning would then live
8
+ in that one (reference rule ref-sibling-schema). Each schema declares its own
9
+ fields.
10
+
11
+ ## Example
12
+
13
+ `lineage.cue`:
14
+
15
+ ```cue
16
+ lin: {
17
+ name: "ship"
18
+ schemas: {
19
+ "0": "0": {
20
+ schema: {a: int}
21
+ }
22
+ "0": "1": {
23
+ schema: {a: lin.schemas["0"]["0"].schema.a, b?: int}
24
+ }
25
+ }
26
+ lenses: {
27
+ "0.1->0.0": {
28
+ v0_1: _
29
+ v0_0: {a: v0_1.a}
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ thema reports:
36
+
37
+ ```
38
+ error[E0140]: a in schema 0.1 refers to schemas["0"]["0"].schema.a, a schema in the lineage
39
+ --> lineage.cue:8:16
40
+ |
41
+ 8 | schema: {a: lin.schemas["0"]["0"].schema.a, b?: int}
42
+ | ^^^
43
+ |
44
+ = note: reference rule ref-sibling-schema
45
+ = help: a schema may refer only to its own body and CUE's builtin packages
46
+ ```
@@ -0,0 +1,35 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0141: a schema or lens refers to something the lineage declares outside it
4
+
5
+ A schema reads something the lineage declares outside the schema: its name,
6
+ #LatestVersion, the joinSchema, the lenses or a helper field (reference rule
7
+ ref-lineage-meta). The schema writes the literal it wants.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ lin: {
15
+ name: "ship"
16
+ schemas: {
17
+ "0": "0": {
18
+ schema: {a: string, n: lin.name}
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ thema reports:
25
+
26
+ ```
27
+ error[E0141]: n in schema 0.0 refers to name, which is declared in the lineage outside the schema
28
+ --> lineage.cue:5:27
29
+ |
30
+ 5 | schema: {a: string, n: lin.name}
31
+ | ^^^
32
+ |
33
+ = note: reference rule ref-lineage-meta
34
+ = help: a schema may refer only to its own body and CUE's builtin packages
35
+ ```
@@ -0,0 +1,38 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0142: a schema or lens refers to something declared outside the lineage
4
+
5
+ A schema refers to a definition declared outside the lineage, at the top of
6
+ the file. Editing the definition would edit every version that refers to it,
7
+ published ones included (reference rule ref-outside-lineage). Each schema
8
+ declares the definition it uses.
9
+
10
+ ## Example
11
+
12
+ `lineage.cue`:
13
+
14
+ ```cue
15
+ #Color: "red" | "blue"
16
+
17
+ lin: {
18
+ name: "ship"
19
+ schemas: {
20
+ "0": "0": {
21
+ schema: {c: #Color}
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ thema reports:
28
+
29
+ ```
30
+ error[E0142]: c in schema 0.0 refers to #Color, which is declared outside the lineage
31
+ --> lineage.cue:7:16
32
+ |
33
+ 7 | schema: {c: #Color}
34
+ | ^^^^^^
35
+ |
36
+ = note: reference rule ref-outside-lineage
37
+ = help: a schema may refer only to its own body and CUE's builtin packages
38
+ ```
@@ -0,0 +1,62 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0143: a schema or lens refers to a package that is not one of CUE's builtins
4
+
5
+ A schema refers to a definition in another package of the author's module.
6
+ Only CUE's builtin packages may be referred to (reference rule ref-import):
7
+ the other package can change without the lineage's file changing, so a
8
+ published version's meaning would not be fixed by the lineage. The schema
9
+ declares the definition itself.
10
+
11
+ ## Example
12
+
13
+ `cue.mod/module.cue`:
14
+
15
+ ```cue
16
+ module: "example.com/m"
17
+ language: version: "v0.9.0"
18
+ ```
19
+
20
+ `lineage.cue`:
21
+
22
+ ```cue
23
+ package m
24
+
25
+ import "example.com/m/common"
26
+
27
+ lin: {
28
+ name: "ship"
29
+ schemas: {
30
+ "0": "0": {
31
+ schema: {c: common.#Color}
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ `common/common.cue`:
38
+
39
+ ```cue
40
+ package common
41
+
42
+ #Color: "red" | "blue"
43
+ ```
44
+
45
+ `data.json`:
46
+
47
+ ```json
48
+ {"c": "red"}
49
+ ```
50
+
51
+ thema reports:
52
+
53
+ ```
54
+ error[E0143]: c in schema 0.0 refers to #Color, in package "example.com/m/common", which is not one of CUE's builtin packages
55
+ --> lineage.cue:9:16
56
+ |
57
+ 9 | schema: {c: common.#Color}
58
+ | ^^^^^^
59
+ |
60
+ = note: reference rule ref-import
61
+ = help: a schema may refer only to its own body and CUE's builtin packages
62
+ ```
@@ -0,0 +1,49 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0144: a lens refers to a schema of the lineage
4
+
5
+ A lens returns a field of a schema, read through the lineage. A lens may
6
+ refer only to the instance it takes, its own body and CUE's builtin packages
7
+ (reference rule ref-lens-to-schema); it builds what it returns from the
8
+ instance it takes.
9
+
10
+ ## Example
11
+
12
+ `lineage.cue`:
13
+
14
+ ```cue
15
+ lin: {
16
+ name: "ship"
17
+ schemas: {
18
+ "0": "0": {
19
+ schema: {a: string}
20
+ }
21
+ "1": "0": {
22
+ schema: {b: string}
23
+ }
24
+ }
25
+ lenses: {
26
+ "1.0->0.0": {
27
+ v1_0: _
28
+ v0_0: {a: v1_0.b}
29
+ }
30
+ "0.0->1.0": {
31
+ v0_0: _
32
+ v1_0: {b: lin.schemas["0"]["0"].schema.a}
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ thema reports:
39
+
40
+ ```
41
+ error[E0144]: v1_0.b in lens 0.0->1.0 refers to schemas["0"]["0"].schema.a, a schema
42
+ --> lineage.cue:18:14
43
+ |
44
+ 18 | v1_0: {b: lin.schemas["0"]["0"].schema.a}
45
+ | ^^^
46
+ |
47
+ = note: reference rule ref-lens-to-schema
48
+ = help: a lens may refer only to v0_0, the instance it takes, its own body and CUE's builtin packages
49
+ ```