@homepages/concrete 12.0.0 → 13.0.1

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 (311) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +8 -10
  3. package/codemods/fixtures-are-data.mjs +7 -0
  4. package/codemods/fixtures-list-properties.mjs +6 -0
  5. package/codemods/manifest.json +15 -0
  6. package/codemods/steps/fixtures-list-properties.mjs +16 -0
  7. package/codemods/steps/fixtures-to-data.mjs +41 -0
  8. package/dist/artifact/playground/client/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  9. package/dist/artifact/playground/client/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  10. package/dist/artifact/playground/client/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  11. package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +1338 -0
  12. package/dist/artifact/playground/client/assets/index-C01UCAWD.css +1 -0
  13. package/dist/artifact/playground/client/index.html +2 -2
  14. package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
  15. package/dist/artifact/playground/host.mjs +110 -59
  16. package/dist/base.css +2 -2
  17. package/dist/cli/build/icons.js +1 -1
  18. package/dist/cli/build/index.js +11 -10
  19. package/dist/cli/build/manifest.js +44 -0
  20. package/dist/cli/build/record.js +123 -0
  21. package/dist/cli/build/sections.js +28 -18
  22. package/dist/cli/build/source.js +1 -1
  23. package/dist/cli/build/static.js +8 -5
  24. package/dist/cli/build/template-build.js +614 -0
  25. package/dist/cli/check/analyze.js +18 -1
  26. package/dist/cli/check/load-workspace.js +2 -2
  27. package/dist/cli/check/portable-names.js +1 -1
  28. package/dist/cli/check/render/corpus.js +119 -0
  29. package/dist/cli/check/render/invariants.js +1 -0
  30. package/dist/cli/check/stages/bundles.js +15 -18
  31. package/dist/cli/check/stages/composition.js +8 -25
  32. package/dist/cli/check/stages/fixtures.js +14 -10
  33. package/dist/cli/check/stages/logic.js +7 -23
  34. package/dist/cli/check/stages/render.js +12 -14
  35. package/dist/cli/check/stages/sections.js +22 -66
  36. package/dist/cli/check/stages/stylesheet.js +4 -26
  37. package/dist/cli/check/stages/workspace.js +27 -22
  38. package/dist/cli/commands.js +51 -23
  39. package/dist/cli/currency/preamble.js +1 -1
  40. package/dist/cli/currency/resolve-latest.js +3 -2
  41. package/dist/cli/dev/capture-browser.js +26 -0
  42. package/dist/cli/dev/fixture-schema.js +441 -0
  43. package/dist/cli/dev/folder-files.js +244 -0
  44. package/dist/cli/dev/index.js +7 -3
  45. package/dist/cli/dev/playground-server.js +34 -0
  46. package/dist/cli/dev/section-ladders.js +76 -0
  47. package/dist/cli/dev/server.js +120 -304
  48. package/dist/cli/install/background.js +16 -0
  49. package/dist/cli/install/index.js +45 -0
  50. package/dist/cli/install/tools.js +27 -0
  51. package/dist/cli/media/derive.js +19 -13
  52. package/dist/cli/media/deriver-plugin.js +14 -3
  53. package/dist/cli/property/fixture-list.js +46 -0
  54. package/dist/cli/property/index.js +12 -9
  55. package/dist/cli/property/library.js +12 -10
  56. package/dist/cli/publish/artifact.js +90 -0
  57. package/dist/cli/publish/captures.js +61 -0
  58. package/dist/cli/publish/fixtures.js +17 -0
  59. package/dist/cli/publish/index.js +10 -18
  60. package/dist/cli/{build → publish}/playground.js +3 -3
  61. package/dist/cli/publish/report.js +15 -33
  62. package/dist/cli/upgrade/codemod.d.ts +14 -0
  63. package/dist/cli/upgrade/fixture-conversion.d.ts +11 -0
  64. package/dist/cli/upgrade/fixture-conversion.js +54 -0
  65. package/dist/cli/upgrade/fixture-modules.js +125 -0
  66. package/dist/cli/upgrade/fixtures-to-data.d.ts +40 -0
  67. package/dist/cli/upgrade/fixtures-to-data.js +498 -0
  68. package/dist/cli/upgrade/index.js +18 -2
  69. package/dist/cli/upgrade/legacy-fixtures.d.ts +34 -0
  70. package/dist/cli/upgrade/legacy-fixtures.js +22 -0
  71. package/dist/cli/upgrade/stage.js +1 -1
  72. package/dist/cli/workspace-fixtures.js +80 -0
  73. package/dist/cli.js +1 -0
  74. package/dist/css/compile.js +9 -3
  75. package/dist/fixtures/bundle-rule.js +16 -16
  76. package/dist/fixtures/media-plugin.js +12 -33
  77. package/dist/fixtures/synthesize-empties.js +3 -2
  78. package/dist/index.d.ts +7 -7
  79. package/dist/{playground-island-runtime.d.ts → island-runtime.d.ts} +1 -2
  80. package/dist/{playground-island-runtime.js → island-runtime.js} +1 -2
  81. package/dist/islands/client-module.js +1 -1
  82. package/dist/{cli/dev → islands}/tsconfig-paths.js +2 -14
  83. package/dist/islands/wrap.js +40 -0
  84. package/dist/node_modules/.pnpm/acorn@8.18.0/node_modules/acorn/dist/acorn.js +5119 -0
  85. package/dist/packages/external/concrete/package.js +1 -1
  86. package/dist/packages/internal/bundle-evaluation/dist/cache.js +36 -0
  87. package/dist/packages/internal/bundle-evaluation/dist/evaluate.js +174 -0
  88. package/dist/packages/internal/bundle-evaluation/dist/index.js +5 -0
  89. package/dist/packages/internal/bundle-evaluation/dist/section-code.js +10 -0
  90. package/dist/packages/internal/capture-settle/dist/index.js +2 -2
  91. package/dist/packages/internal/capture-settle/dist/settle.js +88 -13
  92. package/dist/packages/internal/code-fingerprint/dist/index.js +57 -0
  93. package/dist/packages/internal/content-doc-ops/dist/index.js +176 -0
  94. package/dist/packages/internal/content-doc-ops/dist/made-rows.js +15 -0
  95. package/dist/packages/internal/deliverable-reads/dist/bootstrap.js +81 -0
  96. package/dist/packages/internal/deliverable-reads/dist/display.js +21 -0
  97. package/dist/packages/internal/deliverable-reads/dist/format.js +15 -0
  98. package/dist/packages/internal/deliverable-reads/dist/index.js +7 -0
  99. package/dist/packages/internal/deliverable-reads/dist/pages.js +29 -0
  100. package/dist/packages/internal/deliverable-reads/dist/requirements.js +72 -0
  101. package/dist/{cli/capture → packages/internal/download-files/dist}/bundle.js +8 -4
  102. package/dist/packages/internal/download-files/dist/capture-origin.js +126 -0
  103. package/dist/packages/internal/download-files/dist/capture-routes.js +139 -0
  104. package/dist/packages/internal/download-files/dist/capture-shell.js +38 -0
  105. package/dist/packages/internal/download-files/dist/capture.js +74 -0
  106. package/dist/packages/internal/download-files/dist/egress-watch.js +38 -0
  107. package/dist/packages/internal/download-files/dist/files.js +7 -0
  108. package/dist/packages/internal/download-files/dist/finish.js +35 -0
  109. package/dist/packages/internal/download-files/dist/fleet.js +94 -0
  110. package/dist/packages/internal/download-files/dist/format.js +40 -0
  111. package/dist/packages/internal/download-files/dist/make.js +105 -0
  112. package/dist/packages/internal/download-files/dist/master-tally.js +32 -0
  113. package/dist/packages/internal/download-files/dist/names.js +24 -0
  114. package/dist/packages/internal/download-files/dist/pdf-boxes.js +33 -0
  115. package/dist/packages/internal/download-files/dist/pdf-image-placements.js +194 -0
  116. package/dist/packages/internal/download-files/dist/pdf-images.js +289 -0
  117. package/dist/packages/internal/file-store/dist/files.js +8 -0
  118. package/dist/packages/internal/file-store/dist/lru.js +40 -0
  119. package/dist/packages/internal/file-store/dist/refusal.js +12 -0
  120. package/dist/packages/internal/file-store/dist/trees.js +151 -0
  121. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
  122. package/dist/packages/internal/fill-bake/dist/compute-reads.js +47 -21
  123. package/dist/packages/internal/fill-bake/dist/index.js +5 -1
  124. package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -3
  125. package/dist/packages/internal/fill-bake/dist/resolve-instance.js +9 -0
  126. package/dist/packages/internal/fill-bake/dist/resolve.js +3 -0
  127. package/dist/packages/internal/fill-bake/dist/round-trip.js +2 -0
  128. package/dist/packages/internal/fill-bake/dist/strip.js +6 -0
  129. package/dist/packages/internal/fill-vocabulary/dist/holder.js +1 -1
  130. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
  131. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +1 -1
  132. package/dist/packages/internal/island-runtime/dist/index.js +1 -10
  133. package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +5 -0
  134. package/dist/packages/internal/lead-fields/dist/ingest.js +72 -0
  135. package/dist/packages/internal/media-resolution/dist/video.js +6 -2
  136. package/dist/packages/internal/page-render/dist/addresses.js +57 -0
  137. package/dist/packages/internal/page-render/dist/index.js +6 -0
  138. package/dist/packages/internal/page-render/dist/kept.js +30 -0
  139. package/dist/packages/internal/page-render/dist/nav.js +42 -0
  140. package/dist/packages/internal/page-render/dist/render.js +152 -0
  141. package/dist/packages/internal/page-shell/dist/assemble.js +161 -0
  142. package/dist/packages/internal/page-shell/dist/escape.js +10 -0
  143. package/dist/packages/internal/page-shell/dist/frame.js +23 -0
  144. package/dist/packages/internal/page-shell/dist/index.js +26 -0
  145. package/dist/packages/internal/playground/dist/build-fingerprint.js +18 -0
  146. package/dist/packages/internal/playground/dist/fixture-conversions/list-names-properties.js +76 -0
  147. package/dist/packages/internal/playground/dist/fixture-formats.d.ts +37 -0
  148. package/dist/packages/internal/playground/dist/fixture-formats.js +20 -0
  149. package/dist/packages/internal/playground/dist/host/bootstrap.js +108 -0
  150. package/dist/packages/internal/playground/dist/host/built.js +202 -0
  151. package/dist/packages/internal/playground/dist/host/catalog-fixture.js +53 -0
  152. package/dist/packages/internal/playground/dist/host/download.js +34 -0
  153. package/dist/packages/internal/playground/dist/host/env.js +11 -0
  154. package/dist/packages/internal/playground/dist/host/everywhere-saves.js +353 -0
  155. package/dist/packages/internal/playground/dist/host/fixture-addresses.js +52 -0
  156. package/dist/packages/internal/playground/dist/host/fixture-documents.js +494 -0
  157. package/dist/packages/internal/playground/dist/host/fixture-operations.js +364 -0
  158. package/dist/packages/internal/playground/dist/host/fixture-units.js +93 -0
  159. package/dist/{fixtures → packages/internal/playground/dist/host}/image-dimensions.js +1 -1
  160. package/dist/packages/internal/playground/dist/host/leads.js +41 -0
  161. package/dist/packages/internal/playground/dist/host/media-saves.js +309 -0
  162. package/dist/{fixtures → packages/internal/playground/dist/host}/media-store.js +79 -26
  163. package/dist/packages/internal/playground/dist/host/overridable.js +9 -0
  164. package/dist/packages/internal/playground/dist/host/owned-saves.js +203 -0
  165. package/dist/{playground → packages/internal/playground/dist}/host/page-state.js +1 -1
  166. package/dist/packages/internal/playground/dist/host/program.js +54 -0
  167. package/dist/packages/internal/playground/dist/host/property-derive.js +216 -0
  168. package/dist/packages/internal/playground/dist/host/property-saves.js +74 -0
  169. package/dist/{fixtures → packages/internal/playground/dist/host}/property.js +88 -229
  170. package/dist/packages/internal/playground/dist/host/provenance.js +49 -0
  171. package/dist/packages/internal/playground/dist/host/resolve.js +553 -0
  172. package/dist/packages/internal/playground/dist/host/row-images.js +41 -0
  173. package/dist/{fixtures → packages/internal/playground/dist/host}/rows.js +1 -1
  174. package/dist/packages/internal/playground/dist/host/save.js +429 -0
  175. package/dist/packages/internal/playground/dist/host/serve.js +952 -0
  176. package/dist/packages/internal/playground/dist/host/site.js +79 -0
  177. package/dist/packages/internal/playground/dist/host/slots.js +202 -0
  178. package/dist/packages/internal/playground/dist/host/stated-content.js +93 -0
  179. package/dist/packages/internal/playground/dist/host/stored-fixtures.js +135 -0
  180. package/dist/packages/internal/playground/dist/host/violations.js +7 -0
  181. package/dist/packages/internal/playground/dist/jobs/lanes.js +24 -0
  182. package/dist/packages/internal/playground/dist/jobs/memory-queue.js +112 -0
  183. package/dist/packages/internal/playground/dist/jobs/probe.js +37 -0
  184. package/dist/packages/internal/playground/dist/jobs/queue.js +28 -0
  185. package/dist/packages/internal/playground/dist/jobs/runner.js +207 -0
  186. package/dist/packages/internal/playground/dist/layout.js +14 -0
  187. package/dist/packages/internal/playground/dist/platform.js +33 -0
  188. package/dist/packages/internal/playground/dist/server/changes.js +57 -0
  189. package/dist/packages/internal/playground/dist/server/crop.js +47 -0
  190. package/dist/packages/internal/playground/dist/server/derived-files.js +88 -0
  191. package/dist/packages/internal/playground/dist/server/download.js +158 -0
  192. package/dist/{cli/dev → packages/internal/playground/dist/server}/http.js +4 -12
  193. package/dist/packages/internal/playground/dist/server/jobs.js +29 -0
  194. package/dist/{cli/dev → packages/internal/playground/dist/server}/listen.js +4 -11
  195. package/dist/packages/internal/playground/dist/server/playground-server.js +424 -0
  196. package/dist/{cli/dev → packages/internal/playground/dist/server}/request-error.js +1 -1
  197. package/dist/packages/internal/playground/dist/server/size-ladders.js +170 -0
  198. package/dist/packages/internal/playground/dist/server/verification.js +75 -0
  199. package/dist/packages/internal/playground/dist/server/verify-build.js +139 -0
  200. package/dist/packages/internal/playground/dist/wire.js +78 -0
  201. package/dist/packages/internal/property-facts/dist/registry-facts.js +1 -1
  202. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -1
  203. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +1 -1
  204. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
  205. package/dist/packages/internal/site-files/dist/head.js +59 -0
  206. package/dist/packages/internal/site-files/dist/index.js +4 -0
  207. package/dist/packages/internal/site-files/dist/site.js +211 -0
  208. package/dist/packages/internal/static-assets-binding/dist/index.js +32 -0
  209. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +38 -5
  210. package/dist/packages/internal/template-artifact/dist/asset-mime.js +8 -1
  211. package/dist/packages/internal/template-artifact/dist/build.js +148 -0
  212. package/dist/packages/internal/template-artifact/dist/composition.js +62 -0
  213. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  214. package/dist/packages/internal/template-artifact/dist/layout.js +48 -12
  215. package/dist/packages/internal/template-artifact/dist/manifest.js +3 -10
  216. package/dist/packages/internal/template-artifact/dist/verify.js +51 -31
  217. package/dist/packages/internal/template-contracts/dist/address-value.js +6 -1
  218. package/dist/packages/internal/template-contracts/dist/content-categories.js +10 -1
  219. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +1 -1
  220. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +1 -1
  221. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +3 -3
  222. package/dist/packages/internal/template-contracts/dist/fact-registry.js +59 -32
  223. package/dist/packages/internal/template-contracts/dist/fill-spec.js +14 -1
  224. package/dist/packages/internal/template-contracts/dist/list.d.ts +3 -3
  225. package/dist/packages/internal/template-contracts/dist/media-candidates.js +67 -2
  226. package/dist/packages/internal/template-contracts/dist/media-offer.js +180 -0
  227. package/dist/packages/internal/template-contracts/dist/object.d.ts +2 -2
  228. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +9 -2
  229. package/dist/packages/internal/template-contracts/dist/read-graph.js +36 -2
  230. package/dist/packages/internal/template-contracts/dist/ref-locate.js +16 -1
  231. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +9 -10
  232. package/dist/packages/internal/template-contracts/dist/registry-facts.js +12 -1
  233. package/dist/packages/internal/template-contracts/dist/registry-graph.js +112 -0
  234. package/dist/packages/internal/template-contracts/dist/registry-shape.js +15 -2
  235. package/dist/packages/internal/template-contracts/dist/require-graph.js +300 -0
  236. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +3 -3
  237. package/dist/packages/internal/template-contracts/dist/row.d.ts +3 -3
  238. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +1 -1
  239. package/dist/{schema → packages/internal/template-contracts/dist}/section-nav.d.ts +1 -1
  240. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +4 -4
  241. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +3 -1
  242. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +24 -1
  243. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +26 -1
  244. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +1 -1
  245. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -1
  246. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +1 -1
  247. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -2
  248. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
  249. package/dist/packages/internal/upload-formats/dist/heic.js +35 -0
  250. package/dist/packages/internal/upload-formats/dist/index.js +80 -0
  251. package/dist/packages/internal/upload-formats/dist/magic-bytes.js +293 -0
  252. package/dist/platform/paths.js +1 -0
  253. package/dist/platform/process.js +49 -1
  254. package/dist/rules/registry.js +27 -3
  255. package/dist/schema/fact.d.ts +2 -2
  256. package/dist/schema/facts-view.d.ts +1 -1
  257. package/dist/schema/section-props.d.ts +1 -1
  258. package/dist/schema/section-schema.d.ts +1 -1
  259. package/dist/schema/section-schema.js +1 -0
  260. package/dist/section/declare.d.ts +1 -1
  261. package/dist/section/discovery.js +6 -2
  262. package/dist/section/publish-shape.js +38 -0
  263. package/dist/section/section.d.ts +1 -1
  264. package/dist/template/define-template.d.ts +14 -4
  265. package/dist/template/define-template.js +2 -0
  266. package/dist/template/logic-shim.d.ts +1 -1
  267. package/dist/template/materialize.js +1 -1
  268. package/dist/template/running-copy.js +0 -1
  269. package/dist/template/section-reads.js +1 -1
  270. package/guide/reference/cli/INDEX.md +6 -5
  271. package/guide/reference/cli/build.md +10 -8
  272. package/guide/reference/cli/check.md +4 -2
  273. package/guide/reference/cli/dev.md +6 -2
  274. package/guide/reference/cli/install.md +41 -0
  275. package/guide/reference/cli/property-add.md +5 -4
  276. package/guide/reference/cli/property-list.md +2 -2
  277. package/guide/reference/cli/publish.md +5 -5
  278. package/guide/reference/cli/upgrade.md +1 -1
  279. package/guide/reference/rules/INDEX.md +8 -4
  280. package/package.json +14 -30
  281. package/dist/artifact/playground/client/assets/index-BcLGpWLR.js +0 -1266
  282. package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +0 -1
  283. package/dist/cli/build/artifact.js +0 -220
  284. package/dist/cli/build/captures.js +0 -48
  285. package/dist/cli/build/fixtures.js +0 -92
  286. package/dist/cli/capture/capture-browser.js +0 -37
  287. package/dist/cli/capture/capture.js +0 -115
  288. package/dist/cli/check/render/inputs.js +0 -60
  289. package/dist/cli/check/render/nav.js +0 -31
  290. package/dist/cli/dev/crop.js +0 -20
  291. package/dist/cli/dev/fixture-ladders.js +0 -96
  292. package/dist/cli/dev/hmr.js +0 -26
  293. package/dist/cli/dev/islands.js +0 -234
  294. package/dist/cli/dev/load-template.js +0 -52
  295. package/dist/cli/dev/vite.js +0 -114
  296. package/dist/cli/dev/workspace-reader.js +0 -249
  297. package/dist/cli/publish/freshness.js +0 -64
  298. package/dist/fixtures/brand.d.ts +0 -4
  299. package/dist/fixtures/brand.js +0 -8
  300. package/dist/fixtures/load.js +0 -159
  301. package/dist/fixtures/resolve.js +0 -392
  302. package/dist/fixtures.d.ts +0 -429
  303. package/dist/fixtures.js +0 -23
  304. package/dist/packages/internal/canvas-core/dist/island-host.js +0 -62
  305. package/dist/packages/internal/canvas-core/dist/island-shields.js +0 -30
  306. package/dist/playground/canvas-island-host.d.ts +0 -11
  307. package/dist/playground/canvas-island-host.js +0 -29
  308. package/dist/playground/canvas-markers.js +0 -14
  309. package/dist/playground/host/paths.js +0 -8
  310. package/dist/playground/layout.js +0 -17
  311. package/dist/playground/wire.js +0 -28
@@ -15,7 +15,7 @@ const DECLARED_COMMANDS = [
15
15
  type: "string",
16
16
  valueLabel: "<n>",
17
17
  default: 5180,
18
- summary: "Port to serve on. A non-integer or non-positive value falls back to the default. The editor also opens its module-reload socket at this port + 100, so at most 65435"
18
+ summary: "Port to serve on. A non-integer or non-positive value falls back to the default"
19
19
  }],
20
20
  exits: [{
21
21
  code: 0,
@@ -24,7 +24,14 @@ const DECLARED_COMMANDS = [
24
24
  code: 1,
25
25
  when: "the server cannot start"
26
26
  }],
27
- constraints: ["Runs until interrupted — it is a server, not a one-shot command.", "Serves this one workspace: its template over its fixtures, in the platform's own editor."]
27
+ constraints: [
28
+ "Runs until interrupted — it is a server, not a one-shot command.",
29
+ "Serves this one workspace: its template over its fixtures, in the platform's own editor.",
30
+ "Builds the template as `concrete build` does, into `.concrete/dev`, and again on every change to a source file, building only the sections the change reaches; every open editor then shows the new build. An image whose responsive ladder is not derived yet serves as its own file meanwhile, and the sections that import it build again once it lands.",
31
+ "The fixtures are the content fixtures the fixture list in `template.ts` names, each on a property document; an edit to one of those files reloads every open editor.",
32
+ "An edit made in the editor saves into the fixture's documents after a short pause, as stable JSON: a content edit into the content fixture, a fact edit into the property document every fixture on that property reads. An upload into a media list, a pasted link and a library removal save into the property document, an uploaded file into the property's own folder.",
33
+ "`api/catalog` is the list of every address it answers: under each content fixture, each view (the canvas per canvas and format, and a website's live view per page) and each output (a website's site per page, or an image's or a document's download per format with its page images), every address relative to the server's root. A page the fixture switches off is in none of them."
34
+ ]
28
35
  },
29
36
  {
30
37
  name: "check",
@@ -46,31 +53,35 @@ const DECLARED_COMMANDS = [
46
53
  "Under `--json` the report is the only thing written to stdout; every notice goes to stderr.",
47
54
  "Grades with the toolchain this package ships — TypeScript, ESLint, esbuild — never with a version the workspace declares.",
48
55
  "Every threshold is a platform acceptance criterion, not a preference. No flag or config file raises one.",
56
+ "Runs `build` first and grades the files it wrote; a step that could not build is a finding of the stage it belongs to.",
49
57
  "Every run reports what each placed section's built bundles weigh: the renderer, each island chunk and each asset, in the human output and as `weights` under `--json`.",
50
- "`build` runs this first and refuses on red: an artifact exists only because check passed."
58
+ "`publish` runs this on every publish and refuses on red: an artifact exists only because check passed.",
59
+ "`template.ts` is the only file it finds by name. Pages, sections, the stylesheet and the icon are reached from it by import, and the fixtures by the fixture list it names (`fixtures: \"./fixtures/index.json\"`): a JSON list of the property documents and the content fixtures, each content fixture a JSON document naming its property document, every path relative to the file that states it."
51
60
  ]
52
61
  },
53
62
  {
54
63
  name: "build",
55
- summary: "Run check, then write the template's artifact",
64
+ summary: "Write the template's built files, building only what changed",
56
65
  flags: [{
57
66
  name: "out",
58
67
  type: "string",
59
68
  valueLabel: "<dir>",
60
69
  default: DEFAULT_BUILD_DIR,
61
- summary: "Directory to write the artifact into, relative to the workspace root"
70
+ summary: "Directory to write the built files into, relative to the workspace root"
62
71
  }],
63
72
  exits: [{
64
73
  code: 0,
65
- when: "the artifact was written"
74
+ when: "the built files were written"
66
75
  }, {
67
76
  code: 1,
68
- when: "`check` is not green, a capture failed, or the artifact cannot be written"
77
+ when: "a step could not build — a module that does not load, a section that does not bundle, a stylesheet that does not compile — or the files cannot be written"
69
78
  }],
70
79
  constraints: [
71
- "The only producer of an artifact. Nothing else — no bare bundler — writes one.",
72
- "Deterministic: the same tree builds to the same artifact hash.",
73
- "An image or document template also carries `captures/`: every authored fixture at every declared format, taken exactly as `dev`'s *Download* takes it — the enabled pages and their zip, or the PDF. Captures sit outside the artifact hash, and need Playwright: without it, build refuses with the install line.",
80
+ "Builds and grades nothing: `check` grades what it writes, and `publish` builds, checks and publishes. It writes no artifact.",
81
+ "Writes the template's manifest, each section's schema, fill spec, logic, renderer and island chunks, the template's composition and stylesheet, and the assets and shared bundles they name. Beside the directory, never in it, it writes the build's record, `<dir>.json` (`.concrete/build.json` by default): every file's hash, the template's and each section's content hash, and which sections this run built.",
82
+ "Incremental: a section is built again only when a file its bundles were made from changed since the last build in the same directory. The workspace, the schemas and the stylesheet are read on every run.",
83
+ "Deterministic: the same tree builds to the same content hashes.",
84
+ "A failure writes nothing, so the previous build stays whole.",
74
85
  `The default output directory, \`${DEFAULT_BUILD_DIR}/\`, is gitignored by the scaffold.`
75
86
  ]
76
87
  },
@@ -109,6 +120,27 @@ const DECLARED_COMMANDS = [
109
120
  ],
110
121
  ownsPackageVersion: true
111
122
  },
123
+ {
124
+ name: "install",
125
+ summary: "Install the tools the playground runs, at the builds this release pins",
126
+ flags: [],
127
+ exits: [{
128
+ code: 0,
129
+ when: "every tool is installed, whether this run downloaded it or it was already there"
130
+ }, {
131
+ code: 1,
132
+ when: "a tool could not be installed"
133
+ }],
134
+ constraints: [
135
+ "Installs the Chromium build the platform renders with, through Playwright's own installer, into Playwright's per-user cache: every workspace on the machine shares it.",
136
+ "A tool already installed downloads nothing, so running it again costs nothing.",
137
+ "`npm create @homepages/concrete` runs it after its install, and `upgrade` after it moves the package's version; a failed download there is a notice, never a failed command.",
138
+ "`dev` starts the install of a missing tool in the background and says so in one line; a capture asked for meanwhile waits for it.",
139
+ "On Linux, a browser that installs but cannot start names the system libraries it lacks in Playwright's own words.",
140
+ "Never refreshes the package first: it installs what the version already installed pins."
141
+ ],
142
+ actsOnInstalledPins: true
143
+ },
112
144
  {
113
145
  name: "property list",
114
146
  summary: "List the sample properties a workspace can copy in",
@@ -122,13 +154,13 @@ const DECLARED_COMMANDS = [
122
154
  }],
123
155
  constraints: [
124
156
  "Prints one line per property on stdout: its slug, its description, then its listing intent and non-zero counts.",
125
- "Reads the latest @homepages/sample-properties from the registry the workspace installs from, and caches each version per user under `XDG_CACHE_HOME`, else `~/.cache`.",
157
+ "Reads the @homepages/sample-properties version its `documents` dist-tag names, from the registry the workspace installs from, and caches each version per user under `XDG_CACHE_HOME`, else `~/.cache`.",
126
158
  "When the registry cannot be read, lists the newest cached version and says so on stderr."
127
159
  ]
128
160
  },
129
161
  {
130
162
  name: "property add",
131
- summary: "Copy a sample property into this workspace's fixtures/properties/",
163
+ summary: "Copy a sample property beside this workspace's fixture list",
132
164
  args: [{
133
165
  name: "slug",
134
166
  summary: "The property to copy, as `concrete property list` names it"
@@ -142,8 +174,9 @@ const DECLARED_COMMANDS = [
142
174
  when: "the folder already exists, the library has no property by that slug, the library cannot be read, or it runs outside a workspace"
143
175
  }],
144
176
  constraints: [
145
- "Copies the whole folder — property.ts, media/, README.md, sources.json — to `fixtures/properties/<slug>/`. From then on it is the workspace's to edit.",
146
- "Never overwrites: an existing `fixtures/properties/<slug>/` is refused and named, and nothing is copied.",
177
+ "Copies the whole folder — property.json, media/, README.md, sources.json — to `properties/<slug>/` beside the fixture list `template.ts` names: `fixtures/properties/<slug>/` for `./fixtures/index.json`. From then on it is the workspace's to edit.",
178
+ "Prints the content fixture to make on it; listing that fixture in the fixture list is yours to do.",
179
+ "Never overwrites: an existing `properties/<slug>/` there is refused and named, and nothing is copied.",
147
180
  "The workspace never depends on the library: nothing is added to package.json, so no later release of it can change a copied property.",
148
181
  "Reads the library the way `property list` does, through the same per-user cache."
149
182
  ]
@@ -152,12 +185,6 @@ const DECLARED_COMMANDS = [
152
185
  name: "publish",
153
186
  summary: "Publish the template to HomePages",
154
187
  flags: [
155
- {
156
- name: "rebuild",
157
- type: "boolean",
158
- default: false,
159
- summary: "Build the artifact again even when the tree still matches the one on disk"
160
- },
161
188
  {
162
189
  name: "dry-run",
163
190
  type: "boolean",
@@ -184,7 +211,7 @@ const DECLARED_COMMANDS = [
184
211
  },
185
212
  {
186
213
  code: 1,
187
- when: "`check` is not green, or the platform refuses the publication, fails its verification or cannot finish it"
214
+ when: "`check` is not green, a capture failed, or the platform refuses the publication, fails its verification or cannot finish it"
188
215
  },
189
216
  {
190
217
  code: 2,
@@ -195,7 +222,8 @@ const DECLARED_COMMANDS = [
195
222
  "The key is the environment: `CONCRETE_TOKEN` names production, staging or dev in its prefix (`cpt_prod_…`), and publish goes where it points. There is no environment flag.",
196
223
  "Reads `CONCRETE_TOKEN` from the environment, then from the workspace's `.env`. `CONCRETE_API_URL` replaces the endpoint the key's prefix names.",
197
224
  "`--env-file <path>` names the key file instead, relative to the current directory: its values win over the environment and the workspace's `.env` is not read. It is how a library holding one key file per environment picks one, in any shell.",
198
- `Builds first when it matters: the artifact in \`${DEFAULT_BUILD_DIR}/\` is reused while the workspace's files match the ones it was built from, and rebuilt — check included — when they do not.`,
225
+ "Builds and checks on every run, then assembles the artifact — the built files, the authored fixtures, the playground and, for an image or document template, the captures — and uploads it. An artifact is never reused.",
226
+ "An image or document template's captures are every authored fixture at every declared format, taken exactly as `dev`'s *Download* takes it — the enabled pages and their zip, or the PDF. They sit outside the artifact hash, and are taken with the Chromium build the platform renders with: on a machine without it, publish refuses with the one command that installs it.",
199
227
  "Prints one line per stage on stderr as it settles: target, build, upload, verify, write, adopt.",
200
228
  "Publishing a tree the environment already holds as current changes nothing, says so, and exits 0. Rolling back is publishing the older tree.",
201
229
  "Under `--json` the publication record is the only thing written to stdout; every stage line goes to stderr.",
@@ -203,7 +231,7 @@ const DECLARED_COMMANDS = [
203
231
  ]
204
232
  }
205
233
  ];
206
- const precededByPreamble = (command) => command.ownsPackageVersion !== true && command.reserved === void 0;
234
+ const precededByPreamble = (command) => command.ownsPackageVersion !== true && command.actsOnInstalledPins !== true && command.reserved === void 0;
207
235
  const COMMANDS = DECLARED_COMMANDS.map((command) => precededByPreamble(command) ? {
208
236
  ...command,
209
237
  flags: [...command.flags, NO_AUTO_UPDATE]
@@ -1,6 +1,6 @@
1
1
  import { findCommand, flagName, hasNoAutoUpdateFlag } from "../commands.js";
2
- import { findWorkspaceRoot, isRegistryRange, readDeclaredRange, resolveInstalledVersion } from "../workspace.js";
3
2
  import { cacheRoot } from "../../platform/fs.js";
3
+ import { findWorkspaceRoot, isRegistryRange, readDeclaredRange, resolveInstalledVersion } from "../workspace.js";
4
4
  import { openCurrencyCache } from "./cache.js";
5
5
  import { decideCurrency, registryNeeded } from "./decide.js";
6
6
  import { optedOut } from "./opt-out.js";
@@ -12,7 +12,7 @@ const VERSION_DIST_SCHEMA = z.object({ dist: z.object({
12
12
  integrity: z.string().optional(),
13
13
  shasum: z.string().optional()
14
14
  }) });
15
- const DIST_TAGS_SCHEMA = z.object({ latest: z.string().optional() });
15
+ const DIST_TAGS_SCHEMA = z.record(z.string(), z.unknown());
16
16
  function npmConfigReader(cwd, env, timeoutMs) {
17
17
  return async (keys) => {
18
18
  const { stdout } = await execNpm([
@@ -90,7 +90,8 @@ async function resolveLatest(options = {}) {
90
90
  if (response === null || !response.ok) return null;
91
91
  try {
92
92
  const body = await response.json();
93
- return DIST_TAGS_SCHEMA.parse(body).latest ?? null;
93
+ const version = DIST_TAGS_SCHEMA.parse(body)[options.distTag ?? "latest"];
94
+ return typeof version === "string" ? version : null;
94
95
  } catch {
95
96
  return null;
96
97
  }
@@ -0,0 +1,26 @@
1
+ import { TOOLS_INSTALL_COMMAND } from "../install/tools.js";
2
+ import { createBrowserFleet } from "../../packages/internal/download-files/dist/fleet.js";
3
+ import { existsSync } from "node:fs";
4
+
5
+ //#region src/cli/dev/capture-browser.ts
6
+ const DOWNLOADS_PER_BROWSER = 200;
7
+ function chromiumInstallLine() {
8
+ return `downloads need the Chromium build the platform renders with. Install it with:\n ${TOOLS_INSTALL_COMMAND}`;
9
+ }
10
+ async function launchPinnedChromium() {
11
+ const { chromium } = await import("playwright-core");
12
+ if (!existsSync(chromium.executablePath())) throw new Error(chromiumInstallLine());
13
+ return chromium.launch();
14
+ }
15
+ function frameworkBrowser(ready) {
16
+ return createBrowserFleet({
17
+ launch: ready === void 0 ? launchPinnedChromium : async () => {
18
+ await ready;
19
+ return launchPinnedChromium();
20
+ },
21
+ maxJobsPerBrowser: DOWNLOADS_PER_BROWSER
22
+ });
23
+ }
24
+
25
+ //#endregion
26
+ export { chromiumInstallLine, frameworkBrowser };
@@ -0,0 +1,441 @@
1
+ import { ADDRESS_SOURCES } from "../../packages/internal/template-contracts/dist/address-value.js";
2
+ import { isFactCompute } from "../../packages/internal/template-contracts/dist/fact-compute.js";
3
+ import { libraryFacts, listKeyOf, pickedMediaField, propertyFacts } from "../../packages/internal/template-contracts/dist/fact-registry.js";
4
+ import { isOverridable } from "../../packages/internal/playground/dist/host/overridable.js";
5
+ import { ADDRESS_PARTS, AUTHORED_LISTS, UNSTATED_PROPERTY_MEMBERS, UNSTATED_ROW_MEMBERS } from "../../packages/internal/playground/dist/host/property.js";
6
+ import { join } from "node:path";
7
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
8
+
9
+ //#region src/cli/dev/fixture-schema.ts
10
+ const FIXTURE_SCHEMA_DIR = ".concrete/schema";
11
+ const CONTENT_FIXTURE_SCHEMA = "content-fixture.schema.json";
12
+ const FIXTURE_LIST_SCHEMA = "fixture-list.schema.json";
13
+ const PROPERTY_SCHEMA = "property.schema.json";
14
+ const DRAFT = "https://json-schema.org/draft/2020-12/schema";
15
+ const DATE_PATTERN = "^\\d{4}-\\d{2}-\\d{2}$";
16
+ const nullable = (schema) => ({ anyOf: [schema, { type: "null" }] });
17
+ const ANNOTATIONS = {
18
+ $schema: {
19
+ type: "string",
20
+ description: "The schema an editor completes this document from."
21
+ },
22
+ notes: {
23
+ type: "string",
24
+ description: "Free-text notes. Nothing reads them."
25
+ }
26
+ };
27
+ const CROP = {
28
+ type: "object",
29
+ description: "A region of the image, each member a share (0..1) of its frame.",
30
+ properties: {
31
+ x: { type: "number" },
32
+ y: { type: "number" },
33
+ width: { type: "number" },
34
+ height: { type: "number" }
35
+ },
36
+ required: [
37
+ "x",
38
+ "y",
39
+ "width",
40
+ "height"
41
+ ],
42
+ additionalProperties: false
43
+ };
44
+ function slotValueSchema(def) {
45
+ const described = (schema) => typeof def.label === "string" ? {
46
+ ...schema,
47
+ description: def.label
48
+ } : schema;
49
+ switch (def.type) {
50
+ case "text":
51
+ case "url":
52
+ case "email":
53
+ case "phone":
54
+ case "select": return described(nullable({ type: "string" }));
55
+ case "date": return described(nullable({
56
+ type: "string",
57
+ pattern: DATE_PATTERN
58
+ }));
59
+ case "number": return described(nullable({ type: "number" }));
60
+ case "row": return described(nullable({
61
+ type: "string",
62
+ description: "The id of a row its property holds."
63
+ }));
64
+ case "image": return described(nullable({
65
+ type: "object",
66
+ properties: {
67
+ media: {
68
+ type: "string",
69
+ description: "The id of an upload of the property."
70
+ },
71
+ crop: CROP,
72
+ mobile: {
73
+ type: "object",
74
+ properties: { crop: CROP },
75
+ required: ["crop"],
76
+ additionalProperties: false
77
+ }
78
+ },
79
+ required: ["media"],
80
+ additionalProperties: false
81
+ }));
82
+ case "video":
83
+ case "tour":
84
+ case "document":
85
+ case "media": return described(nullable({
86
+ type: "object",
87
+ properties: { media: {
88
+ type: "string",
89
+ description: "The id of an upload of the property."
90
+ } },
91
+ required: ["media"],
92
+ additionalProperties: false
93
+ }));
94
+ case "address":
95
+ case "poi": return described(nullable({ type: "object" }));
96
+ case "object": return described(fieldsSchema(def.fields, []));
97
+ case "list": {
98
+ const element = def.element;
99
+ if (element === void 0) return described({ type: "array" });
100
+ return described({
101
+ type: "array",
102
+ items: element.type === "object" ? fieldsSchema(element.fields, ["id"]) : slotValueSchema(element)
103
+ });
104
+ }
105
+ default: return described({});
106
+ }
107
+ }
108
+ function fieldsSchema(fields, own) {
109
+ const properties = {};
110
+ for (const key of own) properties[key] = { type: "string" };
111
+ for (const [key, field] of Object.entries(fields)) properties[key] = slotValueSchema(field);
112
+ return {
113
+ type: "object",
114
+ properties,
115
+ additionalProperties: false
116
+ };
117
+ }
118
+ function overridableIds(slots) {
119
+ const ids = [];
120
+ for (const [id, def] of Object.entries(slots)) if (def.type === "object") {
121
+ for (const [field, fieldDef] of Object.entries(def.fields)) if (isOverridable(fieldDef)) ids.push(`${id}.${field}`);
122
+ } else if (isOverridable(def)) ids.push(id);
123
+ return ids;
124
+ }
125
+ function contentFixtureSchema(template) {
126
+ const pageIds = template.manifest.pages.filter((page) => page.optional === true).map((page) => page.id);
127
+ const instances = {};
128
+ for (const { key, instanceId } of template.instances) {
129
+ if (instanceId in instances) continue;
130
+ const section = template.sections.get(key);
131
+ if (section === void 0) continue;
132
+ const slots = section.schema.slots;
133
+ const marked = overridableIds(slots);
134
+ const cases = section.schema.meta.display?.variant?.cases;
135
+ const slotProperties = {};
136
+ for (const [id, def] of Object.entries(slots)) {
137
+ const schema = slotValueSchema(def);
138
+ const named = typeof schema["description"] === "string" ? schema["description"] : id;
139
+ slotProperties[id] = isOverridable(def) ? {
140
+ ...schema,
141
+ description: `${named} — sourced: stated only as the user's override, marked in slot_overrides.scalar.`
142
+ } : schema;
143
+ }
144
+ const flag = {
145
+ type: "object",
146
+ additionalProperties: { const: true }
147
+ };
148
+ instances[instanceId] = {
149
+ type: "object",
150
+ description: `What instance "${instanceId}" of section "${key}" states.`,
151
+ properties: {
152
+ slots: {
153
+ type: "object",
154
+ properties: slotProperties,
155
+ additionalProperties: false
156
+ },
157
+ slot_overrides: {
158
+ type: "object",
159
+ properties: {
160
+ scalar: {
161
+ type: "object",
162
+ propertyNames: marked.length === 0 ? { not: {} } : { enum: marked },
163
+ additionalProperties: { const: true }
164
+ },
165
+ items: {
166
+ type: "object",
167
+ additionalProperties: {
168
+ type: "object",
169
+ additionalProperties: flag
170
+ }
171
+ },
172
+ items_removed: {
173
+ type: "object",
174
+ additionalProperties: flag
175
+ },
176
+ order: flag
177
+ },
178
+ additionalProperties: false
179
+ },
180
+ enabled: {
181
+ type: "boolean",
182
+ description: "The user's decision to show or hide the instance."
183
+ },
184
+ variant: cases === void 0 ? {
185
+ not: {},
186
+ description: "The section declares no variant."
187
+ } : { enum: [...cases] }
188
+ },
189
+ additionalProperties: false
190
+ };
191
+ }
192
+ return {
193
+ $schema: DRAFT,
194
+ title: "A content fixture",
195
+ type: "object",
196
+ properties: {
197
+ ...ANNOTATIONS,
198
+ property: {
199
+ type: "string",
200
+ description: "Its property document, relative to this file. The fixture's name is its file name."
201
+ },
202
+ content: {
203
+ type: "object",
204
+ description: "What each placed instance states, by instance id.",
205
+ properties: instances,
206
+ additionalProperties: false
207
+ },
208
+ page_state: {
209
+ type: "array",
210
+ description: "The pages the user toggled; a page absent from it is enabled.",
211
+ items: {
212
+ type: "object",
213
+ properties: {
214
+ page_id: { enum: pageIds },
215
+ enabled: { type: "boolean" }
216
+ },
217
+ required: ["page_id", "enabled"],
218
+ additionalProperties: false
219
+ }
220
+ }
221
+ },
222
+ required: ["property"],
223
+ additionalProperties: false
224
+ };
225
+ }
226
+ function fixtureListSchema() {
227
+ return {
228
+ $schema: DRAFT,
229
+ title: "A template's fixture list",
230
+ type: "object",
231
+ properties: {
232
+ ...ANNOTATIONS,
233
+ properties: {
234
+ type: "array",
235
+ description: "Every property's document, relative to this file, in the order the playground lists them; each in a folder of its own, whose name is the property's.",
236
+ items: { type: "string" }
237
+ },
238
+ fixtures: {
239
+ type: "array",
240
+ description: "The content fixtures, relative to this file, in the order the playground lists them; each on a listed property.",
241
+ items: { type: "string" }
242
+ }
243
+ },
244
+ required: ["properties", "fixtures"],
245
+ additionalProperties: false
246
+ };
247
+ }
248
+ const MEDIA_TYPES = /* @__PURE__ */ new Set([
249
+ "image",
250
+ "video",
251
+ "tour",
252
+ "document",
253
+ "media"
254
+ ]);
255
+ const holdsMedia = (declaration) => MEDIA_TYPES.has(declaration.type) || declaration.type === "list" && holdsMedia(declaration.element) || declaration.type === "object" && Object.values(declaration.fields).some(holdsMedia);
256
+ const FILE_PATH = {
257
+ type: "string",
258
+ pattern: "^(?![A-Za-z][A-Za-z0-9+.-]*:)(?!/)[^\\\\]+$",
259
+ description: "A file, by its path relative to this document, reaching no further than the document's own folder."
260
+ };
261
+ const PICK = {
262
+ type: "object",
263
+ description: "An upload of the property, by its id.",
264
+ properties: { media: {
265
+ type: "string",
266
+ description: "The id of an upload of the property."
267
+ } },
268
+ required: ["media"],
269
+ additionalProperties: false
270
+ };
271
+ const ID = {
272
+ type: "string",
273
+ minLength: 1,
274
+ description: "Its id, unique within its list."
275
+ };
276
+ const TEXT = { type: ["string", "null"] };
277
+ const COUNT = { type: ["integer", "null"] };
278
+ const ADDRESS = {
279
+ type: "object",
280
+ description: "Its parts and its pin. What the platform derives from them is never stated.",
281
+ properties: Object.fromEntries([...ADDRESS_PARTS].map((part) => [part, part === "latitude" || part === "longitude" ? { type: ["number", "null"] } : part === "source" ? {
282
+ ...TEXT,
283
+ examples: [...ADDRESS_SOURCES]
284
+ } : TEXT])),
285
+ additionalProperties: false
286
+ };
287
+ function uploadEntry(kind, members, required) {
288
+ return {
289
+ type: "object",
290
+ properties: {
291
+ id: ID,
292
+ kind: { const: kind },
293
+ account: {
294
+ ...TEXT,
295
+ description: "What the platform learned of the upload, written for a reader who cannot see it. Absent or null, nothing."
296
+ },
297
+ ...members
298
+ },
299
+ required: [
300
+ "id",
301
+ "kind",
302
+ ...required
303
+ ],
304
+ additionalProperties: false
305
+ };
306
+ }
307
+ const THUMBNAIL = {
308
+ type: "string",
309
+ minLength: 1,
310
+ description: "The provider thumbnail, served as its poster."
311
+ };
312
+ const UPLOAD_ENTRY = { anyOf: [
313
+ uploadEntry("image", { file: FILE_PATH }, ["file"]),
314
+ uploadEntry("video", {
315
+ source: { const: "upload" },
316
+ file: FILE_PATH,
317
+ poster: FILE_PATH,
318
+ duration_ms: COUNT
319
+ }, ["source", "file"]),
320
+ uploadEntry("video", {
321
+ source: { const: "link" },
322
+ url: TEXT,
323
+ provider: TEXT,
324
+ duration_ms: COUNT,
325
+ thumbnail_source_url: THUMBNAIL
326
+ }, ["source"]),
327
+ uploadEntry("tour", {
328
+ url: { type: "string" },
329
+ provider: { type: "string" },
330
+ thumbnail_source_url: THUMBNAIL
331
+ }, ["url", "provider"]),
332
+ uploadEntry("document", {
333
+ file: FILE_PATH,
334
+ preview: FILE_PATH
335
+ }, ["file"])
336
+ ] };
337
+ const labelOf = (declaration) => "label" in declaration && typeof declaration.label === "string" ? declaration.label : void 0;
338
+ function factSchema(declaration, row = null) {
339
+ const label = labelOf(declaration);
340
+ const schema = factValueSchema(declaration, row);
341
+ return label === void 0 ? schema : {
342
+ ...schema,
343
+ description: label
344
+ };
345
+ }
346
+ function factValueSchema(declaration, row) {
347
+ switch (declaration.type) {
348
+ case "list": return {
349
+ type: "array",
350
+ items: itemSchema(declaration.element, row)
351
+ };
352
+ case "object": return objectSchema(declaration.fields, {}, null);
353
+ case "row": return itemSchema(rowElement(declaration.from), row);
354
+ case "address": return nullable(ADDRESS);
355
+ case "image":
356
+ case "video":
357
+ case "tour":
358
+ case "document":
359
+ case "media": return nullable(declaration.from === void 0 ? FILE_PATH : PICK);
360
+ case "number": return nullable({ type: declaration.decimals === true ? "number" : "integer" });
361
+ case "select": {
362
+ const keys = (declaration.values ?? []).map((option) => typeof option === "string" ? option : option.value);
363
+ return declaration.creatable === true || keys.length === 0 ? TEXT : nullable({ enum: keys });
364
+ }
365
+ case "date": return nullable({
366
+ type: "string",
367
+ pattern: DATE_PATTERN
368
+ });
369
+ case "text":
370
+ case "url":
371
+ case "email":
372
+ case "phone": return TEXT;
373
+ }
374
+ }
375
+ function rowElement(from) {
376
+ const list = listKeyOf(from);
377
+ const listed = (list.home === "library" ? libraryFacts.pages : propertyFacts.pages)[list.key]?.declaration;
378
+ if (listed?.type !== "list") throw new Error(`property schema: ${from} is not a list fact`);
379
+ return listed.element;
380
+ }
381
+ function itemSchema(element, row) {
382
+ if (element.type === "object") {
383
+ const picked = pickedMediaField(element);
384
+ return objectSchema(element.fields, picked === null ? { id: ID } : { [picked]: {
385
+ ...PICK,
386
+ description: labelOf(element.fields[picked]) ?? PICK["description"]
387
+ } }, row);
388
+ }
389
+ if (element.type === "row") return itemSchema(rowElement(element.from), row);
390
+ if (MEDIA_TYPES.has(element.type) && element.from === void 0) return UPLOAD_ENTRY;
391
+ const schema = factValueSchema(element, null);
392
+ const options = schema["anyOf"];
393
+ return Array.isArray(options) ? options[0] : schema;
394
+ }
395
+ function objectSchema(fields, own, row) {
396
+ const properties = { ...own };
397
+ const required = Object.keys(own);
398
+ for (const [key, field] of Object.entries(fields)) {
399
+ if (key in own || isFactCompute(field.source)) continue;
400
+ properties[key] = factSchema(field);
401
+ if (!(row !== null && (row.unstated.has(key) || holdsMedia(field) || field.type === "address"))) required.push(key);
402
+ }
403
+ return {
404
+ type: "object",
405
+ properties,
406
+ required,
407
+ additionalProperties: false
408
+ };
409
+ }
410
+ function propertyDocumentSchema() {
411
+ const properties = { ...ANNOTATIONS };
412
+ const required = [];
413
+ for (const [key, { declaration }] of Object.entries(propertyFacts.pages)) {
414
+ const unstated = Object.keys(UNSTATED_ROW_MEMBERS[key] ?? {});
415
+ properties[key] = factSchema(declaration, declaration.type === "list" ? { unstated: new Set(unstated) } : null);
416
+ if (!AUTHORED_LISTS.has(key) && !Object.hasOwn(UNSTATED_PROPERTY_MEMBERS, key)) required.push(key);
417
+ }
418
+ return {
419
+ $schema: DRAFT,
420
+ title: "A property document",
421
+ description: "The facts as the platform stores them, each file named by path and each pick by its upload's id.",
422
+ type: "object",
423
+ properties,
424
+ required,
425
+ additionalProperties: false
426
+ };
427
+ }
428
+ async function writeIfChanged(path, text) {
429
+ if (await readFile(path, "utf8").catch(() => null) !== text) await writeFile(path, text);
430
+ }
431
+ async function writeFixtureSchemas(root, template) {
432
+ const dir = join(root, ...FIXTURE_SCHEMA_DIR.split("/"));
433
+ await mkdir(dir, { recursive: true });
434
+ const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
435
+ await writeIfChanged(join(dir, CONTENT_FIXTURE_SCHEMA), json(contentFixtureSchema(template)));
436
+ await writeIfChanged(join(dir, FIXTURE_LIST_SCHEMA), json(fixtureListSchema()));
437
+ await writeIfChanged(join(dir, PROPERTY_SCHEMA), json(propertyDocumentSchema()));
438
+ }
439
+
440
+ //#endregion
441
+ export { CONTENT_FIXTURE_SCHEMA, FIXTURE_LIST_SCHEMA, FIXTURE_SCHEMA_DIR, PROPERTY_SCHEMA, contentFixtureSchema, fixtureListSchema, propertyDocumentSchema, slotValueSchema, writeFixtureSchemas };