@valbuild/core 0.87.5 → 0.88.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 ADDED
@@ -0,0 +1,5 @@
1
+ # @valbuild/core
2
+
3
+ Core library for Val, providing schema definitions and content validation for type-safe, hard-coded content management.
4
+
5
+ See the [documentation](https://val.build/docs) for more information.
@@ -12,12 +12,83 @@ import { record } from "./schema/record.js";
12
12
  import { file } from "./schema/file.js";
13
13
  import { date } from "./schema/date.js";
14
14
  export type InitSchema = {
15
+ /**
16
+ * Define a string.
17
+ *
18
+ * @example
19
+ * const schema = s.string();
20
+ * export default c.define("/example.val.ts", schema, "test");
21
+ *
22
+ */
15
23
  readonly string: typeof string;
24
+ /**
25
+ * Define a boolean.
26
+ *
27
+ * @example
28
+ * const schema = s.boolean();
29
+ * export default c.define("/example.val.ts", schema, true);
30
+ *
31
+ */
16
32
  readonly boolean: typeof boolean;
33
+ /**
34
+ * Define an array.
35
+ *
36
+ * @example
37
+ * const schema = s.array(s.string());
38
+ * export default c.define("/example.val.ts", schema, ["test", "test2"]);
39
+ *
40
+ */
17
41
  readonly array: typeof array;
42
+ /**
43
+ * Define an object.
44
+ *
45
+ * @example
46
+ * const schema = s.object({
47
+ * text: s.string(),
48
+ * });
49
+ * export default c.define("/example.val.ts", schema, { text: "test" });
50
+ */
18
51
  readonly object: typeof object;
52
+ /**
53
+ * Define a number.
54
+ *
55
+ * @example
56
+ * const schema = s.number();
57
+ * export default c.define("/example.val.ts", schema, 1);
58
+ *
59
+ */
19
60
  readonly number: typeof number;
61
+ /**
62
+ * Define a union.
63
+ *
64
+ * @example // union of string literals
65
+ * const schema = s.union(s.literal("test"), s.literal("test2"));
66
+ * export default c.define("/example.val.ts", schema, "test");
67
+ *
68
+ * @example // union of string literals
69
+ * const schema = s.union("type", s.object({
70
+ * type: s.literal("test"),
71
+ * value: s.string()
72
+ * }), s.object({
73
+ * type: s.literal("test2"),
74
+ * value: s.string()
75
+ * }));
76
+ * export default c.define("/example.val.ts", schema, {
77
+ * type: "test",
78
+ * value: "test"
79
+ * });
80
+ *
81
+ */
20
82
  readonly union: typeof union;
83
+ /**
84
+ * Define a rich text.
85
+ *
86
+ * @example
87
+ * const schema = s.richtext();
88
+ * export default c.define("/example.val.ts", schema, [
89
+ * { tag: "h1", children: ["Title 1"] },
90
+ * ]);
91
+ */
21
92
  readonly richtext: typeof richtext;
22
93
  /**
23
94
  * Define an image.
@@ -38,10 +109,52 @@ export type InitSchema = {
38
109
  *
39
110
  */
40
111
  readonly image: typeof image;
112
+ /**
113
+ * Define a literal.
114
+ *
115
+ * @example
116
+ * const schema = s.literal("test");
117
+ * export default c.define("/example.val.ts", schema, "test");
118
+ *
119
+ */
41
120
  readonly literal: typeof literal;
121
+ /**
122
+ * Define a key of.
123
+ *
124
+ * @example
125
+ * const schema = s.keyOf(s.string());
126
+ * export default c.define("/example.val.ts", schema, "test");
127
+ *
128
+ */
42
129
  readonly keyOf: typeof keyOf;
130
+ /**
131
+ * Define a record.
132
+ *
133
+ * @example
134
+ * const schema = s.record(s.string());
135
+ * export default c.define("/example.val.ts", schema, { "test": "test" });
136
+ *
137
+ */
43
138
  readonly record: typeof record;
139
+ /**
140
+ * Define a file.
141
+ *
142
+ * Use `c.file` to create a file source.
143
+ *
144
+ * @example
145
+ * const schema = s.file();
146
+ * export default c.define("/example.val.ts", schema, c.file("/public/val/example.png"));
147
+ *
148
+ */
44
149
  readonly file: typeof file;
150
+ /**
151
+ * Define a date.
152
+ *
153
+ * @example
154
+ * const schema = s.date();
155
+ * export default c.define("/example.val.ts", schema, "2025-01-01");
156
+ *
157
+ */
45
158
  readonly date: typeof date;
46
159
  };
47
160
  export declare function initSchema(): {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@valbuild/core",
3
- "version": "0.87.5",
3
+ "version": "0.88.0",
4
4
  "private": false,
5
5
  "description": "Val - supercharged hard-coded content",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/valbuild/val.git"
8
+ "url": "git+https://github.com/valbuild/val.git"
9
9
  },
10
10
  "scripts": {
11
11
  "typecheck": "tsc --noEmit",