@jxsuite/schema 0.35.0 → 1.0.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/defs/extension-manifest.schema.ts +47 -0
- package/defs/field-schema.schema.ts +58 -0
- package/defs/index.ts +5 -2
- package/defs/project-config.schema.ts +18 -10
- package/extension-manifest.schema.json +54 -0
- package/package.json +12 -4
- package/project-schema.json +17 -53
- package/schema.json +0 -44
- package/schemas/document.paths.schema.json +6 -0
- package/schemas/project.core.schema.json +441 -0
- package/schemas/project.fields.schema.json +14 -0
- package/src/extension-registry.ts +270 -0
- package/src/format-registry.ts +83 -13
- package/src/project-schemas.ts +262 -0
- package/src/schema.ts +107 -7
- package/src/validate-project.ts +144 -0
- package/types.ts +41 -8
- package/defs/content-type-def.schema.ts +0 -37
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$defs": {
|
|
3
|
+
"ImageConfig": {
|
|
4
|
+
"description": "Image optimization configuration for the project.",
|
|
5
|
+
"properties": {
|
|
6
|
+
"formats": {
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"type": "array"
|
|
11
|
+
},
|
|
12
|
+
"lazyLoad": {
|
|
13
|
+
"type": "boolean"
|
|
14
|
+
},
|
|
15
|
+
"optimize": {
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
},
|
|
18
|
+
"quality": {
|
|
19
|
+
"properties": {
|
|
20
|
+
"avif": {
|
|
21
|
+
"type": "number"
|
|
22
|
+
},
|
|
23
|
+
"jpeg": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
},
|
|
26
|
+
"png": {
|
|
27
|
+
"type": "number"
|
|
28
|
+
},
|
|
29
|
+
"webp": {
|
|
30
|
+
"type": "number"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"type": "object"
|
|
34
|
+
},
|
|
35
|
+
"remoteDomains": {
|
|
36
|
+
"description": "Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. [\"drive.usercontent.google.com\"]. Remote sources from other hosts are left untouched.",
|
|
37
|
+
"items": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"type": "array"
|
|
41
|
+
},
|
|
42
|
+
"service": {
|
|
43
|
+
"description": "How images are optimized: \"build\" runs Sharp at build time; \"cloudflare\" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).",
|
|
44
|
+
"enum": [
|
|
45
|
+
"build",
|
|
46
|
+
"cloudflare"
|
|
47
|
+
],
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"sizes": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"widths": {
|
|
54
|
+
"items": {
|
|
55
|
+
"type": "number"
|
|
56
|
+
},
|
|
57
|
+
"type": "array"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"type": "object"
|
|
61
|
+
},
|
|
62
|
+
"JxFieldSchema": {
|
|
63
|
+
"description": "A single field definition inside a section entry schema — a small, recursive subset of JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",
|
|
64
|
+
"properties": {
|
|
65
|
+
"default": {},
|
|
66
|
+
"description": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
"enum": {
|
|
70
|
+
"type": "array"
|
|
71
|
+
},
|
|
72
|
+
"format": {
|
|
73
|
+
"type": "string"
|
|
74
|
+
},
|
|
75
|
+
"items": {
|
|
76
|
+
"$ref": "https://jxsuite.com/schema/project/fields/v2"
|
|
77
|
+
},
|
|
78
|
+
"properties": {
|
|
79
|
+
"additionalProperties": {
|
|
80
|
+
"$ref": "https://jxsuite.com/schema/project/fields/v2"
|
|
81
|
+
},
|
|
82
|
+
"type": "object"
|
|
83
|
+
},
|
|
84
|
+
"required": {
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "string"
|
|
87
|
+
},
|
|
88
|
+
"type": "array"
|
|
89
|
+
},
|
|
90
|
+
"type": {
|
|
91
|
+
"enum": [
|
|
92
|
+
"string",
|
|
93
|
+
"number",
|
|
94
|
+
"integer",
|
|
95
|
+
"boolean",
|
|
96
|
+
"array",
|
|
97
|
+
"object"
|
|
98
|
+
],
|
|
99
|
+
"type": "string"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": [
|
|
103
|
+
"type"
|
|
104
|
+
],
|
|
105
|
+
"type": "object"
|
|
106
|
+
},
|
|
107
|
+
"RelationshipRef": {
|
|
108
|
+
"description": "Relationship reference field: points at a named entry of a referenceable section via \"#/<sectionKey>/<name>\" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.",
|
|
109
|
+
"properties": {
|
|
110
|
+
"$ref": {
|
|
111
|
+
"pattern": "^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",
|
|
112
|
+
"type": "string"
|
|
113
|
+
},
|
|
114
|
+
"description": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"required": [
|
|
119
|
+
"$ref"
|
|
120
|
+
],
|
|
121
|
+
"type": "object"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"$id": "https://jxsuite.com/schema/project/core/v2",
|
|
125
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
126
|
+
"description": "Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document (project.schema.json) closes the composition. See specs/extensions.md §5.",
|
|
127
|
+
"properties": {
|
|
128
|
+
"$defs": {
|
|
129
|
+
"description": "Global type definitions available to all pages.",
|
|
130
|
+
"type": "object"
|
|
131
|
+
},
|
|
132
|
+
"$elements": {
|
|
133
|
+
"description": "Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",
|
|
134
|
+
"items": {
|
|
135
|
+
"oneOf": [
|
|
136
|
+
{
|
|
137
|
+
"additionalProperties": false,
|
|
138
|
+
"properties": {
|
|
139
|
+
"$ref": {
|
|
140
|
+
"type": "string"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"required": [
|
|
144
|
+
"$ref"
|
|
145
|
+
],
|
|
146
|
+
"type": "object"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"type": "string"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
"type": "array"
|
|
154
|
+
},
|
|
155
|
+
"$head": {
|
|
156
|
+
"description": "Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",
|
|
157
|
+
"examples": [
|
|
158
|
+
[
|
|
159
|
+
{
|
|
160
|
+
"attributes": {
|
|
161
|
+
"href": "/favicon.svg",
|
|
162
|
+
"rel": "icon"
|
|
163
|
+
},
|
|
164
|
+
"tagName": "link"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"attributes": {
|
|
168
|
+
"content": "Jx",
|
|
169
|
+
"name": "generator"
|
|
170
|
+
},
|
|
171
|
+
"tagName": "meta"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
],
|
|
175
|
+
"items": {
|
|
176
|
+
"properties": {
|
|
177
|
+
"attributes": {
|
|
178
|
+
"additionalProperties": {
|
|
179
|
+
"type": "string"
|
|
180
|
+
},
|
|
181
|
+
"type": "object"
|
|
182
|
+
},
|
|
183
|
+
"tagName": {
|
|
184
|
+
"type": "string"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"type": "object"
|
|
188
|
+
},
|
|
189
|
+
"type": "array"
|
|
190
|
+
},
|
|
191
|
+
"$media": {
|
|
192
|
+
"additionalProperties": {
|
|
193
|
+
"type": "string"
|
|
194
|
+
},
|
|
195
|
+
"description": "Named media breakpoints following CSS @custom-media convention. Available in all component style objects.",
|
|
196
|
+
"examples": [
|
|
197
|
+
{
|
|
198
|
+
"--lg": "(min-width: 1024px)",
|
|
199
|
+
"--md": "(min-width: 768px)",
|
|
200
|
+
"--sm": "(min-width: 640px)"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"type": "object"
|
|
204
|
+
},
|
|
205
|
+
"$schema": {
|
|
206
|
+
"description": "Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",
|
|
207
|
+
"type": "string"
|
|
208
|
+
},
|
|
209
|
+
"build": {
|
|
210
|
+
"description": "Build configuration.",
|
|
211
|
+
"properties": {
|
|
212
|
+
"adapter": {
|
|
213
|
+
"description": "Platform adapter for deployment-specific output.",
|
|
214
|
+
"enum": [
|
|
215
|
+
"static",
|
|
216
|
+
"cloudflare-pages",
|
|
217
|
+
"cloudflare-workers",
|
|
218
|
+
"node",
|
|
219
|
+
"bun"
|
|
220
|
+
],
|
|
221
|
+
"type": "string"
|
|
222
|
+
},
|
|
223
|
+
"deploy": {
|
|
224
|
+
"additionalProperties": false,
|
|
225
|
+
"description": "Deployment tracking: the hosting project this repo publishes to. Identifiers only (no secrets) — safe to commit; Studio uses it to tell whether the publish workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",
|
|
226
|
+
"properties": {
|
|
227
|
+
"accountId": {
|
|
228
|
+
"description": "Hosting account id (e.g. the Cloudflare account id).",
|
|
229
|
+
"type": "string"
|
|
230
|
+
},
|
|
231
|
+
"productionUrl": {
|
|
232
|
+
"description": "Production URL of the connected hosting project.",
|
|
233
|
+
"type": "string"
|
|
234
|
+
},
|
|
235
|
+
"projectName": {
|
|
236
|
+
"description": "Hosting project name (e.g. the Cloudflare Pages project).",
|
|
237
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$",
|
|
238
|
+
"type": "string"
|
|
239
|
+
},
|
|
240
|
+
"provider": {
|
|
241
|
+
"description": "Hosting provider the project is connected to.",
|
|
242
|
+
"enum": [
|
|
243
|
+
"cloudflare-pages"
|
|
244
|
+
],
|
|
245
|
+
"type": "string"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"required": [
|
|
249
|
+
"provider",
|
|
250
|
+
"accountId",
|
|
251
|
+
"projectName"
|
|
252
|
+
],
|
|
253
|
+
"type": "object"
|
|
254
|
+
},
|
|
255
|
+
"format": {
|
|
256
|
+
"default": "directory",
|
|
257
|
+
"description": "Output format.",
|
|
258
|
+
"enum": [
|
|
259
|
+
"directory",
|
|
260
|
+
"single"
|
|
261
|
+
],
|
|
262
|
+
"type": "string"
|
|
263
|
+
},
|
|
264
|
+
"outDir": {
|
|
265
|
+
"default": "./dist",
|
|
266
|
+
"description": "Output directory for compiled site.",
|
|
267
|
+
"type": "string"
|
|
268
|
+
},
|
|
269
|
+
"sitemap": {
|
|
270
|
+
"default": true,
|
|
271
|
+
"description": "Generate sitemap.xml from the route table (requires `url`). Set false to disable.",
|
|
272
|
+
"type": "boolean"
|
|
273
|
+
},
|
|
274
|
+
"trailingSlash": {
|
|
275
|
+
"default": "always",
|
|
276
|
+
"description": "Trailing slash behavior for generated URLs.",
|
|
277
|
+
"enum": [
|
|
278
|
+
"always",
|
|
279
|
+
"never",
|
|
280
|
+
"ignore"
|
|
281
|
+
],
|
|
282
|
+
"type": "string"
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"type": "object"
|
|
286
|
+
},
|
|
287
|
+
"copy": {
|
|
288
|
+
"additionalProperties": {
|
|
289
|
+
"type": "string"
|
|
290
|
+
},
|
|
291
|
+
"description": "Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",
|
|
292
|
+
"type": "object"
|
|
293
|
+
},
|
|
294
|
+
"defaults": {
|
|
295
|
+
"description": "Default settings applied to all pages unless overridden.",
|
|
296
|
+
"properties": {
|
|
297
|
+
"charset": {
|
|
298
|
+
"default": "utf8",
|
|
299
|
+
"description": "Default charset for the page.",
|
|
300
|
+
"type": "string"
|
|
301
|
+
},
|
|
302
|
+
"lang": {
|
|
303
|
+
"default": "en",
|
|
304
|
+
"description": "Default lang attribute for the <html> element.",
|
|
305
|
+
"type": "string"
|
|
306
|
+
},
|
|
307
|
+
"layout": {
|
|
308
|
+
"default": null,
|
|
309
|
+
"description": "Default layout file path applied to all pages. Set to null to render pages without a layout.",
|
|
310
|
+
"examples": [
|
|
311
|
+
"./layouts/base.json"
|
|
312
|
+
],
|
|
313
|
+
"oneOf": [
|
|
314
|
+
{
|
|
315
|
+
"type": "string"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"type": "null"
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
"type": "object"
|
|
324
|
+
},
|
|
325
|
+
"extensions": {
|
|
326
|
+
"description": "Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",
|
|
327
|
+
"examples": [
|
|
328
|
+
[
|
|
329
|
+
"@jxsuite/parser"
|
|
330
|
+
]
|
|
331
|
+
],
|
|
332
|
+
"items": {
|
|
333
|
+
"type": "string"
|
|
334
|
+
},
|
|
335
|
+
"type": "array"
|
|
336
|
+
},
|
|
337
|
+
"i18n": {
|
|
338
|
+
"description": "Internationalization configuration.",
|
|
339
|
+
"properties": {
|
|
340
|
+
"defaultLocale": {
|
|
341
|
+
"description": "Default locale code.",
|
|
342
|
+
"examples": [
|
|
343
|
+
"en"
|
|
344
|
+
],
|
|
345
|
+
"type": "string"
|
|
346
|
+
},
|
|
347
|
+
"locales": {
|
|
348
|
+
"description": "Available locale codes.",
|
|
349
|
+
"examples": [
|
|
350
|
+
[
|
|
351
|
+
"en",
|
|
352
|
+
"fr",
|
|
353
|
+
"de"
|
|
354
|
+
]
|
|
355
|
+
],
|
|
356
|
+
"items": {
|
|
357
|
+
"type": "string"
|
|
358
|
+
},
|
|
359
|
+
"type": "array"
|
|
360
|
+
},
|
|
361
|
+
"routing": {
|
|
362
|
+
"description": "Locale routing strategy.",
|
|
363
|
+
"enum": [
|
|
364
|
+
"prefix-except-default",
|
|
365
|
+
"prefix-always"
|
|
366
|
+
],
|
|
367
|
+
"type": "string"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
"type": "object"
|
|
371
|
+
},
|
|
372
|
+
"images": {
|
|
373
|
+
"$ref": "#/$defs/ImageConfig"
|
|
374
|
+
},
|
|
375
|
+
"imports": {
|
|
376
|
+
"additionalProperties": {
|
|
377
|
+
"type": "string"
|
|
378
|
+
},
|
|
379
|
+
"description": "Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",
|
|
380
|
+
"examples": [
|
|
381
|
+
{
|
|
382
|
+
"Markdown": "@jxsuite/parser/Markdown.class.json",
|
|
383
|
+
"MarkdownCollection": "@jxsuite/parser/MarkdownCollection.class.json"
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
"type": "object"
|
|
387
|
+
},
|
|
388
|
+
"name": {
|
|
389
|
+
"default": "Jx Site",
|
|
390
|
+
"description": "Human-readable project name.",
|
|
391
|
+
"examples": [
|
|
392
|
+
"My Portfolio",
|
|
393
|
+
"Jx Example Site"
|
|
394
|
+
],
|
|
395
|
+
"type": "string"
|
|
396
|
+
},
|
|
397
|
+
"redirects": {
|
|
398
|
+
"additionalProperties": {
|
|
399
|
+
"type": "string"
|
|
400
|
+
},
|
|
401
|
+
"description": "Static redirect rules. Maps source paths to destination paths.",
|
|
402
|
+
"examples": [
|
|
403
|
+
{
|
|
404
|
+
"/old-about": "/about"
|
|
405
|
+
}
|
|
406
|
+
],
|
|
407
|
+
"type": "object"
|
|
408
|
+
},
|
|
409
|
+
"state": {
|
|
410
|
+
"description": "Site-wide reactive state available to all pages.",
|
|
411
|
+
"type": "object"
|
|
412
|
+
},
|
|
413
|
+
"style": {
|
|
414
|
+
"additionalProperties": {
|
|
415
|
+
"oneOf": [
|
|
416
|
+
{
|
|
417
|
+
"type": "string"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"type": "number"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"type": "object"
|
|
424
|
+
}
|
|
425
|
+
]
|
|
426
|
+
},
|
|
427
|
+
"description": "Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention as component styles.",
|
|
428
|
+
"type": "object"
|
|
429
|
+
},
|
|
430
|
+
"url": {
|
|
431
|
+
"description": "Production URL of the deployed site.",
|
|
432
|
+
"examples": [
|
|
433
|
+
"https://example.com",
|
|
434
|
+
"https://jxsuite.com"
|
|
435
|
+
],
|
|
436
|
+
"type": "string"
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"title": "Jx Project Core",
|
|
440
|
+
"type": "object"
|
|
441
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://jxsuite.com/schema/project/fields/v2",
|
|
3
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
"anyOf": [
|
|
5
|
+
{
|
|
6
|
+
"$ref": "https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"$ref": "https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"description": "Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the effective union. See specs/extensions.md §5.3.",
|
|
13
|
+
"title": "Jx Project Field Union"
|
|
14
|
+
}
|