@homepages/concrete 12.0.0 → 13.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.
Files changed (311) hide show
  1. package/CHANGELOG.md +184 -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 +11 -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
@@ -2,15 +2,48 @@
2
2
  const SECTION_ASSET_PREFIX = "/section-assets/";
3
3
  const FILENAME = "[A-Za-z0-9._-]+\\.[A-Za-z0-9]+";
4
4
  const FILENAME_RE = new RegExp(`^${FILENAME}$`);
5
- const CANONICAL_REF_RE = new RegExp(`${SECTION_ASSET_PREFIX.replace(/\//g, "\\/")}(${FILENAME})`, "g");
5
+ const FIXED_ADDRESS_RE = new RegExp(`${SECTION_ASSET_PREFIX.replace(/\//g, "\\/")}(${FILENAME})`, "g");
6
+ function checkBuildBase(buildBase) {
7
+ if (!buildBase.startsWith("/") || !buildBase.endsWith("/")) throw new Error(`A build base starts and ends with "/", not "${buildBase}".`);
8
+ return buildBase;
9
+ }
6
10
  function sectionAssetPrefix(profile) {
7
11
  switch (profile.kind) {
8
12
  case "canonical": return SECTION_ASSET_PREFIX;
9
- case "publishedDocument": return "/assets/";
10
- case "publishedStylesheet": return "";
11
- case "canvas": return `${profile.basePath}runtime/section-asset/`;
13
+ case "underBuildBase": return checkBuildBase(profile.buildBase);
14
+ case "stylesheet": return "";
12
15
  }
13
16
  }
17
+ function fillSectionAssetRefs(text, profile) {
18
+ const prefix = sectionAssetPrefix(profile);
19
+ const files = /* @__PURE__ */ new Set();
20
+ return {
21
+ text: text.replace(FIXED_ADDRESS_RE, (ref, filename) => {
22
+ files.add(filename);
23
+ return profile.kind === "canonical" ? ref : `${prefix}${filename}`;
24
+ }),
25
+ files: [...files]
26
+ };
27
+ }
28
+ const STYLESHEET_RE = /\.css$/i;
29
+ const SCRIPT_RE = /\.(mjs|js)$/i;
30
+ function carriesFixedAddresses(filename) {
31
+ return STYLESHEET_RE.test(filename) || SCRIPT_RE.test(filename);
32
+ }
33
+ function fillBuildFile(filename, text, buildBase) {
34
+ return fillBuildFileText(filename, text, buildBase).text;
35
+ }
36
+ function fillBuildFileText(filename, text, buildBase) {
37
+ if (STYLESHEET_RE.test(filename)) return fillSectionAssetRefs(text, { kind: "stylesheet" });
38
+ if (SCRIPT_RE.test(filename)) return fillSectionAssetRefs(text, {
39
+ kind: "underBuildBase",
40
+ buildBase
41
+ });
42
+ return {
43
+ text,
44
+ files: []
45
+ };
46
+ }
14
47
 
15
48
  //#endregion
16
- export { SECTION_ASSET_PREFIX, sectionAssetPrefix };
49
+ export { SECTION_ASSET_PREFIX, carriesFixedAddresses, fillBuildFile, fillBuildFileText, fillSectionAssetRefs, sectionAssetPrefix };
@@ -25,6 +25,13 @@ function assetContentType(filename) {
25
25
  const ext = filename.slice(filename.lastIndexOf(".")).toLowerCase();
26
26
  return ASSET_MIME[ext] ?? "application/octet-stream";
27
27
  }
28
+ const SIZED_IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
29
+ ".png",
30
+ ".jpg",
31
+ ".jpeg",
32
+ ".webp",
33
+ ".avif"
34
+ ]);
28
35
 
29
36
  //#endregion
30
- export { ASSET_MIME, assetContentType };
37
+ export { ASSET_MIME, SIZED_IMAGE_EXTENSIONS, assetContentType };
@@ -0,0 +1,148 @@
1
+ import { MANIFEST_FILE, SECTION_FILES, TEMPLATE_FILES, sectionPath, templatePath } from "./layout.js";
2
+ import { ArtifactManifest, ArtifactSection } from "./manifest.js";
3
+ import { templateGraphOf } from "../../template-contracts/dist/read-graph.js";
4
+ import { StaticAssetsBindingSchema } from "../../static-assets-binding/dist/index.js";
5
+ import { readComposition } from "./composition.js";
6
+ import { z } from "zod";
7
+
8
+ //#region ../../internal/template-artifact/dist/build.js
9
+ var BuildReadError = class extends Error {
10
+ path;
11
+ name = "BuildReadError";
12
+ constructor(path, reason) {
13
+ super(`${path}: ${reason}`);
14
+ this.path = path;
15
+ }
16
+ };
17
+ const manifestFields = ArtifactManifest.shape;
18
+ const sectionFields = ArtifactSection.shape;
19
+ const ManifestIdentity = z.object({
20
+ key: manifestFields.key,
21
+ display_name: manifestFields.display_name,
22
+ deliverable_type: manifestFields.deliverable_type,
23
+ template: z.object({ content_hash: manifestFields.template.shape.content_hash }),
24
+ fixture_list: manifestFields.fixture_list.optional(),
25
+ sections: z.array(z.object({
26
+ key: sectionFields.key,
27
+ display_name: sectionFields.display_name,
28
+ content_hash: sectionFields.content_hash
29
+ }))
30
+ }).superRefine((manifest, ctx) => {
31
+ const seen = /* @__PURE__ */ new Set();
32
+ manifest.sections.forEach((section, index) => {
33
+ if (!section.key.startsWith(`${manifest.key}/`)) ctx.addIssue({
34
+ code: "custom",
35
+ path: [
36
+ "sections",
37
+ index,
38
+ "key"
39
+ ],
40
+ message: `section "${section.key}" is not namespaced under "${manifest.key}/"`
41
+ });
42
+ if (seen.has(section.key)) ctx.addIssue({
43
+ code: "custom",
44
+ path: [
45
+ "sections",
46
+ index,
47
+ "key"
48
+ ],
49
+ message: `section "${section.key}" is listed twice`
50
+ });
51
+ seen.add(section.key);
52
+ });
53
+ });
54
+ function present(path, file) {
55
+ if (file === null) throw new BuildReadError(path, "the build has no such file");
56
+ return file;
57
+ }
58
+ function parsed(path, file) {
59
+ try {
60
+ return JSON.parse(file.text);
61
+ } catch (cause) {
62
+ throw new BuildReadError(path, `is not JSON (${cause instanceof Error ? cause.message : String(cause)})`);
63
+ }
64
+ }
65
+ function documentOf(path, file) {
66
+ const value = parsed(path, present(path, file));
67
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new BuildReadError(path, "is not a JSON object");
68
+ return value;
69
+ }
70
+ function issues(error) {
71
+ return error.issues.map((issue) => `${issue.path.length === 0 ? "" : `${issue.path.join(".")}: `}${issue.message}`).join("; ");
72
+ }
73
+ async function readBuild(files) {
74
+ const compositionPath = templatePath(TEMPLATE_FILES.composition);
75
+ const bindingPath = templatePath(TEMPLATE_FILES.staticAssets);
76
+ const previewPath = templatePath(TEMPLATE_FILES.preview);
77
+ const [manifestFile, compositionFile, bindingFile, previewFile] = await Promise.all([
78
+ files.readText(MANIFEST_FILE),
79
+ files.readText(compositionPath),
80
+ files.readText(bindingPath),
81
+ files.readText(previewPath)
82
+ ]);
83
+ const manifestText = present(MANIFEST_FILE, manifestFile);
84
+ const identity = ManifestIdentity.safeParse(parsed(MANIFEST_FILE, manifestText));
85
+ if (!identity.success) throw new BuildReadError(MANIFEST_FILE, `does not carry the build's identity: ${issues(identity.error)}`);
86
+ const manifest = identity.data;
87
+ const composition = readComposition(parsed(compositionPath, present(compositionPath, compositionFile)));
88
+ if (composition === null) throw new BuildReadError(compositionPath, "is not a valid union composition");
89
+ const binding = StaticAssetsBindingSchema.safeParse(parsed(bindingPath, present(bindingPath, bindingFile)));
90
+ if (!binding.success) throw new BuildReadError(bindingPath, `is not a static-assets binding: ${issues(binding.error)}`);
91
+ const preview = parsed(previewPath, present(previewPath, previewFile));
92
+ const sectionReads = await Promise.all(manifest.sections.map(async (section) => {
93
+ const at = (file) => sectionPath(section.key, file);
94
+ const [schemaFile, fillSpecFile, readGraphFile] = await Promise.all([
95
+ files.readText(at(SECTION_FILES.schema)),
96
+ files.readText(at(SECTION_FILES.fillSpec)),
97
+ files.readText(at(SECTION_FILES.readGraph))
98
+ ]);
99
+ return {
100
+ section,
101
+ at,
102
+ schemaFile,
103
+ fillSpecFile,
104
+ readGraphFile
105
+ };
106
+ }));
107
+ const sections = /* @__PURE__ */ new Map();
108
+ for (const { section, at, schemaFile, fillSpecFile, readGraphFile } of sectionReads) {
109
+ const schema = documentOf(at(SECTION_FILES.schema), schemaFile);
110
+ const fillSpec = documentOf(at(SECTION_FILES.fillSpec), fillSpecFile);
111
+ const readGraph = documentOf(at(SECTION_FILES.readGraph), readGraphFile);
112
+ if (!Array.isArray(readGraph.slots)) throw new BuildReadError(at(SECTION_FILES.readGraph), "is not a read graph: it has no slots");
113
+ const code = (file) => async () => {
114
+ const { text, fingerprint } = present(at(file), await files.readText(at(file)));
115
+ return {
116
+ text,
117
+ fingerprint
118
+ };
119
+ };
120
+ sections.set(section.key, {
121
+ key: section.key,
122
+ displayName: section.display_name,
123
+ contentHash: section.content_hash,
124
+ schema,
125
+ fillSpec,
126
+ readGraph,
127
+ logic: code(SECTION_FILES.logic),
128
+ renderer: code(SECTION_FILES.renderer)
129
+ });
130
+ }
131
+ for (const page of composition.pages) for (const entry of page.sections) if (!sections.has(entry.section)) throw new BuildReadError(compositionPath, `places section "${entry.section}", which the manifest does not list`);
132
+ return {
133
+ key: manifest.key,
134
+ displayName: manifest.display_name,
135
+ deliverableType: manifest.deliverable_type,
136
+ contentHash: manifest.template.content_hash,
137
+ fixtureList: manifest.fixture_list ?? null,
138
+ manifestFingerprint: manifestText.fingerprint,
139
+ composition,
140
+ staticAssets: binding.data,
141
+ preview,
142
+ sections,
143
+ readGraph: templateGraphOf(composition.pages, new Map([...sections].map(([key, section]) => [key, section.readGraph])))
144
+ };
145
+ }
146
+
147
+ //#endregion
148
+ export { BuildReadError, readBuild };
@@ -0,0 +1,62 @@
1
+ import { CONTENT_CATEGORIES } from "../../template-contracts/dist/content-categories.js";
2
+ import { z } from "zod";
3
+
4
+ //#region ../../internal/template-artifact/dist/composition.js
5
+ const CompositionSectionSchema = z.object({
6
+ section: z.string(),
7
+ instance_id: z.string(),
8
+ required: z.boolean().optional()
9
+ });
10
+ const ReadIndexRefSchema = z.object({
11
+ instance_id: z.string(),
12
+ slot: z.string()
13
+ });
14
+ const WebsitePageSchema = z.object({
15
+ id: z.string(),
16
+ label: z.string(),
17
+ path: z.string(),
18
+ optional: z.boolean().optional(),
19
+ sections: z.array(CompositionSectionSchema)
20
+ });
21
+ const RenderedPageSchema = z.object({
22
+ id: z.string(),
23
+ label: z.string(),
24
+ optional: z.boolean().optional(),
25
+ direction: z.enum(["column", "row"]).optional(),
26
+ sections: z.array(CompositionSectionSchema)
27
+ });
28
+ const CompositionFormatSchema = z.object({
29
+ id: z.string(),
30
+ label: z.string(),
31
+ category: z.enum(CONTENT_CATEGORIES),
32
+ preset: z.string().optional(),
33
+ width: z.union([z.number(), z.string()]).optional(),
34
+ height: z.union([z.number(), z.string()]).optional(),
35
+ dpi: z.number().optional(),
36
+ bleed: z.string().optional()
37
+ });
38
+ const CompositionCanvasSchema = z.object({
39
+ id: z.string(),
40
+ label: z.string(),
41
+ pages: z.array(z.string()).min(1)
42
+ });
43
+ const CompositionSchema = z.discriminatedUnion("output", [z.object({
44
+ output: z.literal("website"),
45
+ formats: z.array(CompositionFormatSchema).min(1),
46
+ pages: z.array(WebsitePageSchema).min(1),
47
+ canvases: z.array(CompositionCanvasSchema).min(1),
48
+ read_index: z.array(ReadIndexRefSchema)
49
+ }), z.object({
50
+ output: z.enum(["image", "document"]),
51
+ formats: z.array(CompositionFormatSchema).min(1),
52
+ pages: z.array(RenderedPageSchema).min(1),
53
+ canvases: z.array(CompositionCanvasSchema).min(1),
54
+ read_index: z.array(ReadIndexRefSchema)
55
+ })]);
56
+ function readComposition(raw) {
57
+ const parsed = CompositionSchema.safeParse(raw);
58
+ return parsed.success ? parsed.data : null;
59
+ }
60
+
61
+ //#endregion
62
+ export { readComposition };
@@ -1,7 +1,7 @@
1
- import { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CANVAS_ISLAND_HOST, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
1
+ import { ASSETS_DIR, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_DOCUMENT_EXTENSION, MANIFEST_FILE, PLAYGROUND_CANVAS_ISLAND_HOST, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, browserFileClashes, capturePath, fixturePath, isFixtureDocument, isFixtureFilePath, isSectionKey, isStoredPath, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
2
2
  import { sha256Hex } from "./sha256.js";
3
3
  import { listingDigest, sectionContentHash, sourceDigest, templateContentHash } from "./hash.js";
4
4
  import { ArtifactManifest, ArtifactScope, ArtifactSection, readArtifactSchema } from "./manifest.js";
5
5
  import { verifyArtifact } from "./verify.js";
6
6
 
7
- export { ASSET_URL_PREFIX, ArtifactManifest, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_FILES, assetPath, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionContentHash, sectionDir, sectionPath, sourceDigest, staticPath, templateContentHash, templatePath, verifyArtifact };
7
+ export { ArtifactManifest, CAPTURE_FILES, FIXTURES_DIR, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTION_FILES, TEMPLATE_DIR, TEMPLATE_FILES, assetPath, browserFileClashes, capturePath, fixturePath, isFixtureFilePath, isSectionKey, isTemplateKey, islandPath, listingDigest, playgroundPath, publishedSectionKey, sectionDir, sectionPath, sourceDigest, staticPath, templatePath, verifyArtifact };
@@ -9,23 +9,36 @@ const PLAYGROUND_DIR = "playground";
9
9
  const PLAYGROUND_CLIENT_DIR = "client";
10
10
  const FIXTURES_DIR = "fixtures";
11
11
  const CAPTURES_DIR = "captures";
12
+ const BUILD_DIR = ".concrete/build";
13
+ function builtTreePath(path) {
14
+ return `${BUILD_DIR}/${path}`;
15
+ }
16
+ function isBuiltTreePath(treePath) {
17
+ return treePath === ".concrete/build" || treePath.startsWith(`${".concrete/build"}/`);
18
+ }
19
+ function builtPathOf(treePath) {
20
+ return treePath.startsWith(`${".concrete/build"}/`) ? treePath.slice(16) : null;
21
+ }
12
22
  const UNHASHED_DIRS = [
13
23
  FIXTURES_DIR,
14
24
  PLAYGROUND_DIR,
15
25
  CAPTURES_DIR
16
26
  ];
17
27
  const STORED_DIRS = [ASSETS_DIR, CAPTURES_DIR];
18
- const FIXTURE_FILES = {
19
- contentDoc: "content-doc.json",
20
- settledDoc: "settled-doc.json",
21
- property: "property.json",
22
- meta: "meta.json"
23
- };
28
+ const FIXTURE_DOCUMENT_EXTENSION = ".json";
29
+ function isFixtureDocument(path) {
30
+ return path.endsWith(FIXTURE_DOCUMENT_EXTENSION);
31
+ }
32
+ function isStoredPath(path) {
33
+ const slash = path.indexOf("/");
34
+ const top = slash < 0 ? path : path.slice(0, slash);
35
+ if (STORED_DIRS.includes(top)) return true;
36
+ return top === "fixtures" && !isFixtureDocument(path);
37
+ }
24
38
  const CAPTURE_FILES = {
25
39
  bundle: "bundle.zip",
26
40
  document: "document.pdf"
27
41
  };
28
- const ASSET_URL_PREFIX = "/section-assets/";
29
42
  const PLAYGROUND_CANVAS_ISLAND_HOST = "island-canvas-host.mjs";
30
43
  const PLAYGROUND_FILES = {
31
44
  host: "host.mjs",
@@ -67,11 +80,12 @@ function capturePath(fixture, format, file) {
67
80
  ]) if (!SEGMENT.test(segment)) throw new Error(`"${segment}" cannot name a capture path: one path segment of letters, digits, ".", "_" and "-".`);
68
81
  return `${CAPTURES_DIR}/${fixture}/${format}/${file}`;
69
82
  }
70
- function isFixtureId(id) {
71
- return SEGMENT.test(id);
83
+ function isFixtureFilePath(path) {
84
+ return path !== "" && path.split("/").every((segment) => SEGMENT.test(segment));
72
85
  }
73
- function fixturePath(id, file) {
74
- return `${FIXTURES_DIR}/${id}/${file}`;
86
+ function fixturePath(path) {
87
+ if (!isFixtureFilePath(path)) throw new Error(`"${path}" cannot name a fixture file: a relative path of segments of letters, digits, ".", "_" and "-".`);
88
+ return `${FIXTURES_DIR}/${path}`;
75
89
  }
76
90
  function sectionDir(key) {
77
91
  return `${SECTIONS_DIR}/${key}`;
@@ -122,6 +136,28 @@ function boundFiles(binding) {
122
136
  ref(assetPath(apple_touch.filename), apple_touch);
123
137
  return out;
124
138
  }
139
+ const BROWSER_FILENAME = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
140
+ function browserFiles(binding) {
141
+ const bound = new Map(boundFiles(binding).map((file) => [file.filename, file.path]));
142
+ return { pathOf(filename) {
143
+ if (!BROWSER_FILENAME.test(filename)) return null;
144
+ return bound.get(filename) ?? assetPath(filename);
145
+ } };
146
+ }
147
+ function browserFileClashes(binding, paths) {
148
+ const byName = /* @__PURE__ */ new Map();
149
+ const add = (filename, path) => {
150
+ const held = byName.get(filename) ?? /* @__PURE__ */ new Set();
151
+ held.add(path);
152
+ byName.set(filename, held);
153
+ };
154
+ for (const file of boundFiles(binding)) add(file.filename, file.path);
155
+ for (const path of paths) if (path.startsWith(`${"assets"}/`)) add(path.slice(path.lastIndexOf("/") + 1), path);
156
+ return [...byName].filter(([, held]) => held.size > 1).map(([filename, held]) => ({
157
+ filename,
158
+ paths: [...held].sort()
159
+ })).sort((a, b) => a.filename.localeCompare(b.filename));
160
+ }
125
161
 
126
162
  //#endregion
127
- export { ASSETS_DIR, ASSET_URL_PREFIX, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CANVAS_ISLAND_HOST, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, capturePath, fixturePath, isFixtureId, isSectionKey, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
163
+ export { ASSETS_DIR, BUILD_DIR, CAPTURES_DIR, CAPTURE_FILES, FIXTURES_DIR, FIXTURE_DOCUMENT_EXTENSION, MANIFEST_FILE, PLAYGROUND_CANVAS_ISLAND_HOST, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, assetPath, boundFiles, browserFileClashes, browserFiles, builtPathOf, builtTreePath, capturePath, fixturePath, isBuiltTreePath, isFixtureDocument, isFixtureFilePath, isSectionKey, isStoredPath, isTemplateKey, islandPath, playgroundPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
@@ -1,4 +1,4 @@
1
- import { isFixtureId, isSectionKey, isTemplateKey } from "./layout.js";
1
+ import { isFixtureDocument, isFixtureFilePath, isSectionKey, isTemplateKey } from "./layout.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region ../../internal/template-artifact/dist/manifest.js
@@ -11,7 +11,7 @@ const ArtifactSection = z.object({
11
11
  content_hash: Sha256
12
12
  }).strict();
13
13
  const ArtifactManifest = z.object({
14
- artifact_schema: z.literal(4),
14
+ artifact_schema: z.literal(5),
15
15
  framework_version: z.string().min(1),
16
16
  key: z.string().refine(isTemplateKey, "a template key: one path segment"),
17
17
  display_name: z.string().min(1),
@@ -24,15 +24,8 @@ const ArtifactManifest = z.object({
24
24
  source_digest: Sha256,
25
25
  template: z.object({ content_hash: Sha256 }).strict(),
26
26
  sections: z.array(ArtifactSection),
27
- fixtures: z.array(z.string().refine(isFixtureId, "a fixture id: one path segment"))
27
+ fixture_list: z.string().refine((path) => isFixtureFilePath(path) && isFixtureDocument(path), "a fixture list path: relative, safe segments, a `.json` document")
28
28
  }).strict().superRefine((manifest, ctx) => {
29
- manifest.fixtures.forEach((id, index) => {
30
- if (manifest.fixtures.indexOf(id) !== index) ctx.addIssue({
31
- code: "custom",
32
- path: ["fixtures", index],
33
- message: `fixture "${id}" is listed twice`
34
- });
35
- });
36
29
  manifest.sections.forEach((section, index) => {
37
30
  if (!section.key.startsWith(`${manifest.key}/`)) ctx.addIssue({
38
31
  code: "custom",
@@ -1,4 +1,4 @@
1
- import { ASSETS_DIR, ASSET_URL_PREFIX, FIXTURES_DIR, FIXTURE_FILES, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, STORED_DIRS, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, boundFiles, fixturePath, playgroundPath, sectionPath, templatePath } from "./layout.js";
1
+ import { ASSETS_DIR, CAPTURES_DIR, FIXTURES_DIR, MANIFEST_FILE, PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR, PLAYGROUND_FILES, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, UNHASHED_DIRS, boundFiles, browserFileClashes, fixturePath, isFixtureDocument, isFixtureFilePath, isStoredPath, playgroundPath, sectionPath, templatePath } from "./layout.js";
2
2
  import { sha256Hex } from "./sha256.js";
3
3
  import { sectionContentHash, templateContentHash } from "./hash.js";
4
4
  import { ArtifactManifest, readArtifactSchema } from "./manifest.js";
@@ -10,8 +10,6 @@ const TEMPLATE_FILE_NAMES = new Set(Object.values(TEMPLATE_FILES));
10
10
  const ISLAND_CHUNK = new RegExp(`^${SECTION_ISLANDS_DIR}/[A-Za-z0-9._-]+\\.mjs$`);
11
11
  const FLAT_FILE = /^[A-Za-z0-9._-]+$/;
12
12
  const CLIENT_SEGMENT = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
13
- const FIXTURE_FILE_NAMES = new Set(Object.values(FIXTURE_FILES));
14
- const ASSET_URL = new RegExp(`${ASSET_URL_PREFIX.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")}([A-Za-z0-9._-]+)`, "g");
15
13
  function readJson(files, path, problems) {
16
14
  const bytes = files.get(path);
17
15
  if (bytes === void 0) {
@@ -47,15 +45,30 @@ function composedSections(composition) {
47
45
  return keys;
48
46
  }
49
47
  function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
48
+ return verify(files, stored, true);
49
+ }
50
+ const BESIDE_DIRS = /* @__PURE__ */ new Set([
51
+ PLAYGROUND_DIR,
52
+ FIXTURES_DIR,
53
+ CAPTURES_DIR
54
+ ]);
55
+ function topOf(path) {
56
+ const slash = path.indexOf("/");
57
+ return slash < 0 ? path : path.slice(0, slash);
58
+ }
59
+ function verify(files, stored, beside) {
50
60
  const problems = [];
51
- const present = (path) => files.has(path) || stored.has(path);
52
61
  for (const path of stored.keys()) if (files.has(path)) problems.push({
53
62
  path,
54
63
  message: "is carried both as bytes and as a stored file"
55
64
  });
56
- else if (!STORED_DIRS.includes(path.split("/")[0])) problems.push({
65
+ else if (!beside && topOf(path) !== "assets") problems.push({
57
66
  path,
58
- message: `is held as a stored file, which only ${STORED_DIRS.map((dir) => `${dir}/`).join(" and ")} may be`
67
+ message: "is held as a stored file, which only a build's author assets (assets/) may be"
68
+ });
69
+ else if (!isStoredPath(path)) problems.push({
70
+ path,
71
+ message: "is held as a stored file, which only media (assets/, captures/, a fixture's media file) may be"
59
72
  });
60
73
  const raw = readJson(files, MANIFEST_FILE, problems);
61
74
  if (raw === null) return {
@@ -63,10 +76,10 @@ function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
63
76
  problems
64
77
  };
65
78
  const schema = readArtifactSchema(raw.value);
66
- if (schema !== 4) {
79
+ if (schema !== 5) {
67
80
  problems.push({
68
81
  path: MANIFEST_FILE,
69
- message: schema === null ? `carries no integer artifact_schema; this reader knows ${String(4)}` : `artifact_schema ${String(schema)} is not one this reader knows (it knows ${String(4)})`
82
+ message: schema === null ? `carries no integer artifact_schema; this reader knows ${String(5)}` : `artifact_schema ${String(schema)} is not one this reader knows (it knows ${String(5)})`
70
83
  });
71
84
  return {
72
85
  manifest: null,
@@ -91,6 +104,13 @@ function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
91
104
  const slash = path.indexOf("/");
92
105
  const top = slash < 0 ? path : path.slice(0, slash);
93
106
  const rest = slash < 0 ? "" : path.slice(slash + 1);
107
+ if (!beside && BESIDE_DIRS.has(top)) {
108
+ problems.push({
109
+ path,
110
+ message: `is not a file of a build folder: ${top}/ rides beside a build, never in it`
111
+ });
112
+ continue;
113
+ }
94
114
  if (top === "playground") {
95
115
  const [head, ...inner] = rest.split("/");
96
116
  if (!(rest === PLAYGROUND_FILES.host || head === "client" && inner.length > 0 && inner.every((part) => CLIENT_SEGMENT.test(part)))) problems.push({
@@ -100,15 +120,11 @@ function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
100
120
  continue;
101
121
  }
102
122
  if (top === "fixtures") {
103
- const [id, file, ...inner] = rest.split("/");
104
- if (id === void 0 || !manifest.fixtures.includes(id)) problems.push({
123
+ if (!isFixtureFilePath(rest)) problems.push({
105
124
  path,
106
- message: "belongs to no fixture the manifest lists"
107
- });
108
- else if (inner.length > 0 || file === void 0 || !FIXTURE_FILE_NAMES.has(file)) problems.push({
109
- path,
110
- message: "is not a file a fixture directory carries"
125
+ message: "is not a fixture file's workspace path: relative, of safe segments"
111
126
  });
127
+ else if (isFixtureDocument(rest) && files.has(path)) readJson(files, path, problems);
112
128
  continue;
113
129
  }
114
130
  if (UNHASHED_DIRS.includes(top)) continue;
@@ -139,16 +155,14 @@ function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
139
155
  message: "is outside the artifact layout"
140
156
  });
141
157
  }
142
- for (const file of Object.values(PLAYGROUND_FILES)) if (!files.has(playgroundPath(file))) problems.push({
143
- path: playgroundPath(file),
144
- message: "missing"
145
- });
146
- for (const id of manifest.fixtures) for (const file of Object.values(FIXTURE_FILES)) {
147
- const path = fixturePath(id, file);
148
- if (readJson(files, path, problems) === null) continue;
149
- for (const match of decoder.decode(files.get(path)).matchAll(ASSET_URL)) if (!present(`${"assets"}/${match[1]}`)) problems.push({
150
- path,
151
- message: `names ${match[0]}, which ${ASSETS_DIR}/ does not carry`
158
+ if (beside) {
159
+ for (const file of Object.values(PLAYGROUND_FILES)) if (!files.has(playgroundPath(file))) problems.push({
160
+ path: playgroundPath(file),
161
+ message: "missing"
162
+ });
163
+ if (!files.has(fixturePath(manifest.fixture_list))) problems.push({
164
+ path: fixturePath(manifest.fixture_list),
165
+ message: "the manifest's fixture_list, missing"
152
166
  });
153
167
  }
154
168
  const sectionHashes = /* @__PURE__ */ new Map();
@@ -240,13 +254,19 @@ function verifyArtifact(files, stored = /* @__PURE__ */ new Map()) {
240
254
  });
241
255
  }
242
256
  }
243
- if (bound !== void 0) for (const path of files.keys()) {
244
- const parts = path.split("/");
245
- const isChunk = parts.length === 5 && parts[0] === "sections" && parts[3] === "islands";
246
- if ((path.startsWith(`${"static"}/`) || isChunk) && !boundPaths.has(path)) problems.push({
247
- path,
248
- message: "is a static bundle the binding does not name"
257
+ if (bound !== void 0) {
258
+ for (const clash of browserFileClashes(binding.value, [...files.keys(), ...stored.keys()])) problems.push({
259
+ path: clash.paths[1],
260
+ message: `is a browser file named ${clash.filename}, as ${clash.paths.filter((p) => p !== clash.paths[1]).join(" and ")} is: a build's browser files have one name each`
249
261
  });
262
+ for (const path of files.keys()) {
263
+ const parts = path.split("/");
264
+ const isChunk = parts.length === 5 && parts[0] === "sections" && parts[3] === "islands";
265
+ if ((path.startsWith(`${"static"}/`) || isChunk) && !boundPaths.has(path)) problems.push({
266
+ path,
267
+ message: "is a static bundle the binding does not name"
268
+ });
269
+ }
250
270
  }
251
271
  }
252
272
  }
@@ -48,6 +48,11 @@ function normalizeAddressValue(value) {
48
48
  };
49
49
  return pinned || TEXT_PARTS.some((part) => out[part] !== null) ? out : null;
50
50
  }
51
+ function addressComplete(value) {
52
+ const place = normalizeAddressValue(value);
53
+ if (place === null || place.latitude === null) return false;
54
+ return place.street !== null && place.city !== null && place.state !== null && place.postal !== null;
55
+ }
51
56
  function postalDisplay(postal) {
52
57
  return /^\s*(\d{5})-?\d{4}\s*$/.exec(postal)?.[1] ?? postal;
53
58
  }
@@ -87,4 +92,4 @@ function addressMember(value, member) {
87
92
  }
88
93
 
89
94
  //#endregion
90
- export { ADDRESS_MEMBERS, ADDRESS_SOURCES, addressDisplay, addressMember, addressView, isAddressMember, normalizeAddressValue, postalDisplay, storedAddressView };
95
+ export { ADDRESS_MEMBERS, ADDRESS_SOURCES, addressComplete, addressDisplay, addressMember, addressView, isAddressMember, normalizeAddressValue, postalDisplay, storedAddressView };
@@ -8,6 +8,15 @@ const CONTENT_CATEGORIES = [
8
8
  "postcard",
9
9
  "presentation"
10
10
  ];
11
+ const CONTENT_CATEGORY_LABELS = {
12
+ website: "Website",
13
+ "social-post": "Social Post",
14
+ story: "Story",
15
+ brochure: "Brochure",
16
+ flyer: "Flyer",
17
+ postcard: "Postcard",
18
+ presentation: "Presentation"
19
+ };
11
20
 
12
21
  //#endregion
13
- export { CONTENT_CATEGORIES };
22
+ export { CONTENT_CATEGORIES, CONTENT_CATEGORY_LABELS };
@@ -1,5 +1,5 @@
1
- import { ComputeFn } from "./compute.js";
2
1
  import { ComputeRead, SerializedHomeRef, SerializedItemRef } from "./slot-ref.js";
2
+ import { ComputeFn } from "./compute.js";
3
3
  //#region ../../internal/template-contracts/dist/fact-compute.d.ts
4
4
  /**
5
5
  * What a registry's compute reads, as `defineFacts` stores it: a top-level fact of the
@@ -1,5 +1,5 @@
1
- import { AddressMember, AddressValue } from "./address-value.js";
2
1
  import { MediaKind } from "./slot-catalog.js";
2
+ import { AddressMember, AddressValue } from "./address-value.js";
3
3
  import { PropertyFactRegistry } from "./fact-registry.js";
4
4
  import { MediaReference } from "./registry-facts.js";
5
5
  import "./section-schema-types.js";
@@ -1,13 +1,13 @@
1
- import { ComputeBinding } from "./compute.js";
2
- import { AddressMembers } from "./row-ref.js";
3
- import { SlotValue } from "./slot-value.js";
4
1
  import { FactRef, SerializedItemRef, SerializedRowRef } from "./slot-ref.js";
5
2
  import { FillMark } from "./fill-declaration.js";
3
+ import { ComputeBinding } from "./compute.js";
6
4
  import { AddressSlotDef, DateSlotDef, DocumentSlotDef, EmailSlotDef, ImageSlotDef, MediaSlotDef, NumberSlotDef, PhoneSlotDef, SelectSlotDef, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef } from "./slot-builders.js";
7
5
  import { ObjectLabelPointer, ObjectSlotDef } from "./object.js";
8
6
  import { RowOf } from "./row.js";
9
7
  import { ListSlotDef } from "./list.js";
10
8
  import { FactCompute } from "./fact-compute.js";
9
+ import { AddressMembers } from "./row-ref.js";
10
+ import { SlotValue } from "./slot-value.js";
11
11
  //#region ../../internal/template-contracts/dist/fact-registry.d.ts
12
12
  /** Where a fact is stored: about one property, or about the org (its library). There is no third. */
13
13
  declare const FACT_HOMES: readonly ["property", "library"];