@homepages/concrete 11.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 (322) hide show
  1. package/CHANGELOG.md +203 -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 +17 -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 -60
  16. package/dist/base.css +19 -59
  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 +48 -22
  123. package/dist/packages/internal/fill-bake/dist/held-rows.js +2 -0
  124. package/dist/packages/internal/fill-bake/dist/index.js +6 -1
  125. package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -3
  126. package/dist/packages/internal/fill-bake/dist/resolve-instance.js +9 -0
  127. package/dist/packages/internal/fill-bake/dist/resolve.js +3 -0
  128. package/dist/packages/internal/fill-bake/dist/round-trip.js +2 -0
  129. package/dist/packages/internal/fill-bake/dist/strip.js +6 -0
  130. package/dist/packages/internal/fill-vocabulary/dist/holder.js +1 -1
  131. package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
  132. package/dist/packages/internal/fill-vocabulary/dist/verbs.js +1 -1
  133. package/dist/packages/internal/format-geometry/dist/capture.js +3 -11
  134. package/dist/packages/internal/format-geometry/dist/format.d.ts +2 -8
  135. package/dist/packages/internal/format-geometry/dist/geometry.js +2 -13
  136. package/dist/packages/internal/island-runtime/dist/index.js +1 -10
  137. package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +5 -0
  138. package/dist/packages/internal/lead-fields/dist/ingest.js +72 -0
  139. package/dist/packages/internal/media-resolution/dist/video.js +6 -2
  140. package/dist/packages/internal/page-render/dist/addresses.js +57 -0
  141. package/dist/packages/internal/page-render/dist/index.js +6 -0
  142. package/dist/packages/internal/page-render/dist/kept.js +30 -0
  143. package/dist/packages/internal/page-render/dist/nav.js +42 -0
  144. package/dist/packages/internal/page-render/dist/render.js +152 -0
  145. package/dist/packages/internal/page-shell/dist/assemble.js +161 -0
  146. package/dist/packages/internal/page-shell/dist/escape.js +10 -0
  147. package/dist/packages/internal/page-shell/dist/frame.js +23 -0
  148. package/dist/packages/internal/page-shell/dist/index.js +26 -0
  149. package/dist/packages/internal/playground/dist/build-fingerprint.js +18 -0
  150. package/dist/packages/internal/playground/dist/fixture-conversions/list-names-properties.js +76 -0
  151. package/dist/packages/internal/playground/dist/fixture-formats.d.ts +37 -0
  152. package/dist/packages/internal/playground/dist/fixture-formats.js +20 -0
  153. package/dist/packages/internal/playground/dist/host/bootstrap.js +108 -0
  154. package/dist/packages/internal/playground/dist/host/built.js +202 -0
  155. package/dist/packages/internal/playground/dist/host/catalog-fixture.js +53 -0
  156. package/dist/packages/internal/playground/dist/host/download.js +34 -0
  157. package/dist/packages/internal/playground/dist/host/env.js +11 -0
  158. package/dist/packages/internal/playground/dist/host/everywhere-saves.js +353 -0
  159. package/dist/packages/internal/playground/dist/host/fixture-addresses.js +52 -0
  160. package/dist/packages/internal/playground/dist/host/fixture-documents.js +494 -0
  161. package/dist/packages/internal/playground/dist/host/fixture-operations.js +364 -0
  162. package/dist/packages/internal/playground/dist/host/fixture-units.js +93 -0
  163. package/dist/{fixtures → packages/internal/playground/dist/host}/image-dimensions.js +1 -1
  164. package/dist/packages/internal/playground/dist/host/leads.js +41 -0
  165. package/dist/packages/internal/playground/dist/host/media-saves.js +309 -0
  166. package/dist/{fixtures → packages/internal/playground/dist/host}/media-store.js +79 -26
  167. package/dist/packages/internal/playground/dist/host/overridable.js +9 -0
  168. package/dist/packages/internal/playground/dist/host/owned-saves.js +203 -0
  169. package/dist/{playground → packages/internal/playground/dist}/host/page-state.js +1 -1
  170. package/dist/packages/internal/playground/dist/host/program.js +54 -0
  171. package/dist/packages/internal/playground/dist/host/property-derive.js +216 -0
  172. package/dist/packages/internal/playground/dist/host/property-saves.js +74 -0
  173. package/dist/{fixtures → packages/internal/playground/dist/host}/property.js +88 -229
  174. package/dist/packages/internal/playground/dist/host/provenance.js +49 -0
  175. package/dist/packages/internal/playground/dist/host/resolve.js +553 -0
  176. package/dist/packages/internal/playground/dist/host/row-images.js +41 -0
  177. package/dist/{fixtures → packages/internal/playground/dist/host}/rows.js +1 -1
  178. package/dist/packages/internal/playground/dist/host/save.js +429 -0
  179. package/dist/packages/internal/playground/dist/host/serve.js +952 -0
  180. package/dist/packages/internal/playground/dist/host/site.js +79 -0
  181. package/dist/packages/internal/playground/dist/host/slots.js +202 -0
  182. package/dist/packages/internal/playground/dist/host/stated-content.js +93 -0
  183. package/dist/packages/internal/playground/dist/host/stored-fixtures.js +135 -0
  184. package/dist/packages/internal/playground/dist/host/violations.js +7 -0
  185. package/dist/packages/internal/playground/dist/jobs/lanes.js +24 -0
  186. package/dist/packages/internal/playground/dist/jobs/memory-queue.js +112 -0
  187. package/dist/packages/internal/playground/dist/jobs/probe.js +37 -0
  188. package/dist/packages/internal/playground/dist/jobs/queue.js +28 -0
  189. package/dist/packages/internal/playground/dist/jobs/runner.js +207 -0
  190. package/dist/packages/internal/playground/dist/layout.js +14 -0
  191. package/dist/packages/internal/playground/dist/platform.js +33 -0
  192. package/dist/packages/internal/playground/dist/server/changes.js +57 -0
  193. package/dist/packages/internal/playground/dist/server/crop.js +47 -0
  194. package/dist/packages/internal/playground/dist/server/derived-files.js +88 -0
  195. package/dist/packages/internal/playground/dist/server/download.js +158 -0
  196. package/dist/{cli/dev → packages/internal/playground/dist/server}/http.js +4 -12
  197. package/dist/packages/internal/playground/dist/server/jobs.js +29 -0
  198. package/dist/{cli/dev → packages/internal/playground/dist/server}/listen.js +4 -11
  199. package/dist/packages/internal/playground/dist/server/playground-server.js +424 -0
  200. package/dist/{cli/dev → packages/internal/playground/dist/server}/request-error.js +1 -1
  201. package/dist/packages/internal/playground/dist/server/size-ladders.js +170 -0
  202. package/dist/packages/internal/playground/dist/server/verification.js +75 -0
  203. package/dist/packages/internal/playground/dist/server/verify-build.js +139 -0
  204. package/dist/packages/internal/playground/dist/wire.js +78 -0
  205. package/dist/packages/internal/property-facts/dist/registry-facts.js +1 -1
  206. package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -1
  207. package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +1 -1
  208. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
  209. package/dist/packages/internal/site-files/dist/head.js +59 -0
  210. package/dist/packages/internal/site-files/dist/index.js +4 -0
  211. package/dist/packages/internal/site-files/dist/site.js +211 -0
  212. package/dist/packages/internal/static-assets-binding/dist/index.js +32 -0
  213. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +38 -5
  214. package/dist/packages/internal/template-artifact/dist/asset-mime.js +8 -1
  215. package/dist/packages/internal/template-artifact/dist/build.js +148 -0
  216. package/dist/packages/internal/template-artifact/dist/composition.js +62 -0
  217. package/dist/packages/internal/template-artifact/dist/index.js +2 -2
  218. package/dist/packages/internal/template-artifact/dist/layout.js +48 -12
  219. package/dist/packages/internal/template-artifact/dist/manifest.js +3 -10
  220. package/dist/packages/internal/template-artifact/dist/verify.js +51 -31
  221. package/dist/packages/internal/template-contracts/dist/address-value.js +6 -1
  222. package/dist/packages/internal/template-contracts/dist/content-categories.js +10 -1
  223. package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +1 -1
  224. package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +1 -1
  225. package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +3 -3
  226. package/dist/packages/internal/template-contracts/dist/fact-registry.js +59 -32
  227. package/dist/packages/internal/template-contracts/dist/fill-spec.js +14 -1
  228. package/dist/packages/internal/template-contracts/dist/list.d.ts +3 -3
  229. package/dist/packages/internal/template-contracts/dist/media-candidates.js +67 -2
  230. package/dist/packages/internal/template-contracts/dist/media-offer.js +180 -0
  231. package/dist/packages/internal/template-contracts/dist/object.d.ts +2 -2
  232. package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +9 -2
  233. package/dist/packages/internal/template-contracts/dist/read-graph.js +36 -2
  234. package/dist/packages/internal/template-contracts/dist/ref-locate.js +16 -1
  235. package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +9 -10
  236. package/dist/packages/internal/template-contracts/dist/registry-facts.js +12 -1
  237. package/dist/packages/internal/template-contracts/dist/registry-graph.js +112 -0
  238. package/dist/packages/internal/template-contracts/dist/registry-shape.js +15 -2
  239. package/dist/packages/internal/template-contracts/dist/require-graph.js +300 -0
  240. package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +3 -3
  241. package/dist/packages/internal/template-contracts/dist/row.d.ts +3 -3
  242. package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +1 -1
  243. package/dist/{schema → packages/internal/template-contracts/dist}/section-nav.d.ts +1 -1
  244. package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +4 -4
  245. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +3 -1
  246. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +24 -1
  247. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +26 -1
  248. package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +1 -1
  249. package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -1
  250. package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +1 -1
  251. package/dist/packages/internal/template-contracts/dist/table-members.js +7 -2
  252. package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
  253. package/dist/packages/internal/upload-formats/dist/heic.js +35 -0
  254. package/dist/packages/internal/upload-formats/dist/index.js +80 -0
  255. package/dist/packages/internal/upload-formats/dist/magic-bytes.js +293 -0
  256. package/dist/platform/paths.js +1 -0
  257. package/dist/platform/process.js +49 -1
  258. package/dist/primitives/FrameShell.d.ts +5 -2
  259. package/dist/primitives/FrameShell.js +2 -1
  260. package/dist/rules/registry.js +28 -4
  261. package/dist/schema/fact.d.ts +2 -2
  262. package/dist/schema/facts-view.d.ts +1 -1
  263. package/dist/schema/format.d.ts +0 -1
  264. package/dist/schema/format.js +1 -2
  265. package/dist/schema/manifest.js +18 -24
  266. package/dist/schema/section-props.d.ts +1 -1
  267. package/dist/schema/section-schema.d.ts +1 -1
  268. package/dist/schema/section-schema.js +1 -0
  269. package/dist/section/declare.d.ts +1 -1
  270. package/dist/section/discovery.js +6 -2
  271. package/dist/section/publish-shape.js +38 -0
  272. package/dist/section/section.d.ts +1 -1
  273. package/dist/site-analytics.js +6 -1
  274. package/dist/site-runtime/window-height.js +19 -0
  275. package/dist/template/define-template.d.ts +25 -4
  276. package/dist/template/define-template.js +3 -0
  277. package/dist/template/logic-shim.d.ts +1 -1
  278. package/dist/template/materialize.js +3 -1
  279. package/dist/template/running-copy.js +0 -1
  280. package/dist/template/section-reads.js +1 -1
  281. package/guide/reference/cli/INDEX.md +6 -5
  282. package/guide/reference/cli/build.md +10 -8
  283. package/guide/reference/cli/check.md +4 -2
  284. package/guide/reference/cli/dev.md +6 -2
  285. package/guide/reference/cli/install.md +41 -0
  286. package/guide/reference/cli/property-add.md +5 -4
  287. package/guide/reference/cli/property-list.md +2 -2
  288. package/guide/reference/cli/publish.md +5 -5
  289. package/guide/reference/cli/upgrade.md +1 -1
  290. package/guide/reference/rules/INDEX.md +9 -5
  291. package/package.json +14 -30
  292. package/dist/artifact/playground/client/assets/index-ByeGGedv.js +0 -1259
  293. package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +0 -1
  294. package/dist/cli/build/artifact.js +0 -220
  295. package/dist/cli/build/captures.js +0 -48
  296. package/dist/cli/build/fixtures.js +0 -92
  297. package/dist/cli/capture/capture-browser.js +0 -37
  298. package/dist/cli/capture/capture.js +0 -113
  299. package/dist/cli/check/render/inputs.js +0 -60
  300. package/dist/cli/check/render/nav.js +0 -31
  301. package/dist/cli/dev/crop.js +0 -20
  302. package/dist/cli/dev/fixture-ladders.js +0 -96
  303. package/dist/cli/dev/hmr.js +0 -26
  304. package/dist/cli/dev/islands.js +0 -234
  305. package/dist/cli/dev/load-template.js +0 -52
  306. package/dist/cli/dev/vite.js +0 -114
  307. package/dist/cli/dev/workspace-reader.js +0 -248
  308. package/dist/cli/publish/freshness.js +0 -64
  309. package/dist/fixtures/brand.d.ts +0 -4
  310. package/dist/fixtures/brand.js +0 -8
  311. package/dist/fixtures/load.js +0 -159
  312. package/dist/fixtures/resolve.js +0 -392
  313. package/dist/fixtures.d.ts +0 -429
  314. package/dist/fixtures.js +0 -23
  315. package/dist/packages/internal/canvas-core/dist/island-host.js +0 -62
  316. package/dist/packages/internal/canvas-core/dist/island-shields.js +0 -30
  317. package/dist/playground/canvas-island-host.d.ts +0 -11
  318. package/dist/playground/canvas-island-host.js +0 -29
  319. package/dist/playground/canvas-markers.js +0 -14
  320. package/dist/playground/host/paths.js +0 -8
  321. package/dist/playground/layout.js +0 -17
  322. package/dist/playground/wire.js +0 -28
@@ -0,0 +1,244 @@
1
+ import { isInsideRoot } from "../../platform/paths.js";
2
+ import { fixtureMediaModule } from "../../fixtures/media-plugin.js";
3
+ import { byCodeUnit } from "../../platform/order.js";
4
+ import { listDir, removeTree, renameSettled } from "../../platform/fs.js";
5
+ import { builtPathOf, builtTreePath, isBuiltTreePath } from "../../packages/internal/template-artifact/dist/layout.js";
6
+ import { FIXTURE_FILE_EXTENSIONS } from "../../packages/internal/playground/dist/host/media-saves.js";
7
+ import { dirname, extname, join } from "node:path";
8
+ import { pathToFileURL } from "node:url";
9
+ import { access, mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
10
+ import { createHash } from "node:crypto";
11
+
12
+ //#region src/cli/dev/folder-files.ts
13
+ const FIXTURE_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([".json", ".md"]);
14
+ const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
15
+ function isMissing(cause) {
16
+ const code = cause.code;
17
+ return code === "ENOENT" || code === "ENOTDIR" || code === "EISDIR";
18
+ }
19
+ function isWorkspaceFile(path) {
20
+ return path.split("/").every((segment) => segment !== "node_modules" && !segment.startsWith("."));
21
+ }
22
+ function folderFiles(options) {
23
+ const { root } = options;
24
+ let build = options.build;
25
+ let version = 0;
26
+ const reached = /* @__PURE__ */ new Set();
27
+ const fingerprints = /* @__PURE__ */ new Map();
28
+ const fileOf = (path) => {
29
+ const file = join(root, ...path.split("/"));
30
+ return isInsideRoot(root, file) ? file : null;
31
+ };
32
+ const built = () => {
33
+ if ("failure" in build) throw new Error(build.failure);
34
+ return build;
35
+ };
36
+ const builtBytes = async (path) => {
37
+ const { output } = built();
38
+ const fingerprint = output.record.files[path];
39
+ if (fingerprint === void 0) return null;
40
+ return {
41
+ bytes: new Uint8Array(await readFile(join(output.out, ...path.split("/")))),
42
+ fingerprint
43
+ };
44
+ };
45
+ const workspaceBytes = async (path) => {
46
+ const file = isWorkspaceFile(path) ? fileOf(path) : null;
47
+ if (file === null) return null;
48
+ try {
49
+ const [bytes, stats] = await Promise.all([readFile(file), stat(file)]);
50
+ reached.add(path);
51
+ const fingerprint = sha256(bytes);
52
+ fingerprints.set(file, {
53
+ stamp: `${String(stats.mtimeMs)}:${String(stats.ctimeMs)}:${String(stats.size)}:${String(stats.ino)}`,
54
+ fingerprint
55
+ });
56
+ return {
57
+ bytes: new Uint8Array(bytes),
58
+ fingerprint
59
+ };
60
+ } catch (cause) {
61
+ if (isMissing(cause)) return null;
62
+ throw cause;
63
+ }
64
+ };
65
+ const readBytes = (path) => {
66
+ const at = builtPathOf(path);
67
+ return at !== null ? builtBytes(at) : isBuiltTreePath(path) ? Promise.resolve(null) : workspaceBytes(path);
68
+ };
69
+ const workspaceEntry = async (path) => {
70
+ const file = fileOf(path);
71
+ if (file === null) return null;
72
+ const stats = await stat(file).catch((cause) => {
73
+ if (isMissing(cause)) return null;
74
+ throw cause;
75
+ });
76
+ if (stats === null || !stats.isFile()) return null;
77
+ const stamp = `${String(stats.mtimeMs)}:${String(stats.ctimeMs)}:${String(stats.size)}:${String(stats.ino)}`;
78
+ const known = fingerprints.get(file);
79
+ const fingerprint = known?.stamp === stamp ? known.fingerprint : (await workspaceBytes(path))?.fingerprint;
80
+ return fingerprint === void 0 ? null : {
81
+ path,
82
+ fingerprint,
83
+ size: stats.size
84
+ };
85
+ };
86
+ const workspaceEntries = async (path) => {
87
+ if (path !== "" && !isWorkspaceFile(path)) return [];
88
+ const single = path === "" ? null : await workspaceEntry(path);
89
+ if (single !== null) return [single];
90
+ const dir = path === "" ? root : fileOf(path);
91
+ if (dir === null) return [];
92
+ const names = await readdir(dir, { withFileTypes: true }).catch((cause) => {
93
+ if (isMissing(cause)) return [];
94
+ throw cause;
95
+ });
96
+ return (await Promise.all(names.filter((entry) => isWorkspaceFile(entry.name)).map((entry) => workspaceEntries(path === "" ? entry.name : `${path}/${entry.name}`)))).flat();
97
+ };
98
+ const builtEntries = async (path) => {
99
+ if ("failure" in build) return [];
100
+ const { output } = build;
101
+ const entries = Object.entries(output.record.files).map(([at, fingerprint]) => ({
102
+ at,
103
+ path: builtTreePath(at),
104
+ fingerprint
105
+ })).filter((entry) => path === "" || entry.path === path || entry.path.startsWith(`${path}/`)).map(async ({ at, path: treePath, fingerprint }) => ({
106
+ path: treePath,
107
+ fingerprint,
108
+ size: (await stat(join(output.out, ...at.split("/")))).size
109
+ }));
110
+ return Promise.all(entries);
111
+ };
112
+ const list = async (path) => {
113
+ const [builds, workspace] = await Promise.all([builtEntries(path), isBuiltTreePath(path) ? [] : workspaceEntries(path)]);
114
+ return [...builds, ...workspace].sort((a, b) => byCodeUnit(a.path, b.path));
115
+ };
116
+ const view = (at) => ({
117
+ version: at,
118
+ async readText(path) {
119
+ const read = await readBytes(path);
120
+ return read === null ? null : {
121
+ text: new TextDecoder().decode(read.bytes),
122
+ fingerprint: read.fingerprint
123
+ };
124
+ },
125
+ readBytes,
126
+ list
127
+ });
128
+ const assets = /* @__PURE__ */ new Map();
129
+ const served = /* @__PURE__ */ new Map();
130
+ return {
131
+ current: () => Promise.resolve(view(String(version))),
132
+ async change(_base, changes) {
133
+ await land(root, changes, reached);
134
+ for (const c of changes) fingerprints.delete(join(root, ...c.path.split("/")));
135
+ version += 1;
136
+ options.onWritten?.();
137
+ return { version: String(version) };
138
+ },
139
+ serve(next) {
140
+ build = next;
141
+ version += 1;
142
+ },
143
+ changed() {
144
+ version += 1;
145
+ },
146
+ reaches: (path) => reached.has(path),
147
+ media: {
148
+ async file(at, path) {
149
+ const known = served.get(path);
150
+ if (known !== void 0) {
151
+ const [entry] = await at.list(path);
152
+ if (entry?.path === path && entry.fingerprint === known.fingerprint) return {
153
+ file: known.file,
154
+ size: known.size
155
+ };
156
+ }
157
+ const file = isBuiltTreePath(path) || !isWorkspaceFile(path) ? null : fileOf(path);
158
+ const read = file === null ? null : await at.readBytes(path);
159
+ if (file === null || read === null) return null;
160
+ const { asset, value } = await fixtureMediaModule(file, read.bytes);
161
+ assets.set(asset.url, {
162
+ path,
163
+ derived: asset.derived
164
+ });
165
+ const answer = {
166
+ file: value,
167
+ size: read.bytes.byteLength
168
+ };
169
+ served.set(path, {
170
+ fingerprint: read.fingerprint,
171
+ ...answer
172
+ });
173
+ return answer;
174
+ },
175
+ asset: (url) => assets.get(url)
176
+ },
177
+ async loadModule(path) {
178
+ const { output } = built();
179
+ const fingerprint = output.record.files[path];
180
+ if (fingerprint === void 0) throw new Error(`The build has no ${path}.`);
181
+ return await import(`${pathToFileURL(join(output.out, ...path.split("/"))).href}?v=${fingerprint}`);
182
+ }
183
+ };
184
+ }
185
+ async function land(root, changes, reached) {
186
+ const fileOf = (path, kind) => {
187
+ const file = join(root, ...path.split("/"));
188
+ const named = kind === "document" ? path.endsWith(".json") : FIXTURE_FILE_EXTENSIONS.has(extname(path).toLowerCase()) || FIXTURE_DOCUMENT_EXTENSIONS.has(extname(path).toLowerCase());
189
+ if (isBuiltTreePath(path) || !isWorkspaceFile(path) || !isInsideRoot(root, file) || !named) throw Object.assign(/* @__PURE__ */ new Error(`A save writes no file at "${path}".`), { status: 400 });
190
+ return file;
191
+ };
192
+ const staged = [];
193
+ const moved = [];
194
+ const removed = [];
195
+ for (const c of changes) if ("remove" in c) {
196
+ removed.push(fileOf(c.path, "file"));
197
+ reached.add(c.path);
198
+ } else if ("from" in c) {
199
+ moved.push({
200
+ source: c.from,
201
+ from: fileOf(c.from, "file"),
202
+ file: fileOf(c.path, "file")
203
+ });
204
+ reached.add(c.path).add(c.from);
205
+ } else {
206
+ const file = "text" in c ? fileOf(c.path, "document") : fileOf(c.path, "file");
207
+ const temporary = `${file}.${String(process.pid)}.saving.json`;
208
+ staged.push({
209
+ file,
210
+ temporary,
211
+ content: "text" in c ? c.text : c.bytes
212
+ });
213
+ reached.add(c.path).add(`${c.path}.${String(process.pid)}.saving.json`);
214
+ }
215
+ for (const m of moved) await access(m.from).catch(() => {
216
+ throw Object.assign(/* @__PURE__ */ new Error(`A save moves "${m.source}", which is gone; reload the playground.`), { status: 409 });
217
+ });
218
+ try {
219
+ for (const s of staged) {
220
+ await mkdir(dirname(s.file), { recursive: true });
221
+ await writeFile(s.temporary, s.content);
222
+ }
223
+ } catch (cause) {
224
+ await Promise.all(staged.map((s) => removeTree(s.temporary).catch(() => void 0)));
225
+ throw cause;
226
+ }
227
+ for (const s of staged) await renameSettled(s.temporary, s.file);
228
+ for (const m of moved) {
229
+ await mkdir(dirname(m.file), { recursive: true });
230
+ await renameSettled(m.from, m.file);
231
+ }
232
+ for (const file of removed) await removeTree(file);
233
+ for (const file of [...moved.map((m) => m.from), ...removed]) await removeEmptyFolders(root, dirname(file));
234
+ }
235
+ async function removeEmptyFolders(root, folder) {
236
+ for (let at = folder; at !== root && isInsideRoot(root, at); at = dirname(at)) {
237
+ const held = await listDir(at).catch(() => null);
238
+ if (held === null || held.length > 0) return;
239
+ await removeTree(at);
240
+ }
241
+ }
242
+
243
+ //#endregion
244
+ export { folderFiles };
@@ -1,7 +1,8 @@
1
1
  import { onShutdown } from "../../platform/process.js";
2
2
  import { findCommand, flagDefault, parseSpec, stringFlag } from "../commands.js";
3
3
  import { findWorkspaceRoot } from "../workspace.js";
4
- import { TEMPLATE_FILE } from "./workspace-reader.js";
4
+ import { TEMPLATE_FILE } from "../check/load-workspace.js";
5
+ import { installMissingTools } from "../install/background.js";
5
6
  import { startDevServer } from "./server.js";
6
7
  import { existsSync } from "node:fs";
7
8
  import { join } from "node:path";
@@ -43,12 +44,14 @@ function createDevRunner(deps) {
43
44
  io.stderr.write(`concrete dev: there is no ${TEMPLATE_FILE} at ${root} — a workspace declares its template there.\n`);
44
45
  return 1;
45
46
  }
47
+ const tools = await deps.installTools(io.stderr);
46
48
  let server;
47
49
  try {
48
50
  server = await deps.start({
49
51
  root,
50
52
  port,
51
- log: io.stderr
53
+ log: io.stderr,
54
+ toolsReady: tools.ready
52
55
  });
53
56
  } catch (err) {
54
57
  io.stderr.write(`concrete dev: ${err instanceof Error ? err.message : String(err)}\n`);
@@ -62,7 +65,8 @@ function createDevRunner(deps) {
62
65
  }
63
66
  const runDev = createDevRunner({
64
67
  start: startDevServer,
65
- untilStopped: processSignals
68
+ untilStopped: processSignals,
69
+ installTools: installMissingTools
66
70
  });
67
71
 
68
72
  //#endregion
@@ -0,0 +1,34 @@
1
+ import { packageRoot } from "../../platform/paths.js";
2
+ import { CONCRETE_CLI_VERSION } from "../version.js";
3
+ import { FIXTURE_MEDIA_PATH } from "../../fixtures/media-plugin.js";
4
+ import { codeFingerprintAt } from "../../packages/internal/code-fingerprint/dist/index.js";
5
+ import { playgroundDistDir } from "../../packages/internal/playground/dist/layout.js";
6
+ import { derivedFolder } from "../../packages/internal/playground/dist/server/derived-files.js";
7
+ import { startPlaygroundServer as startPlaygroundServer$1 } from "../../packages/internal/playground/dist/server/playground-server.js";
8
+ import { frameworkBrowser } from "./capture-browser.js";
9
+ import { join } from "node:path";
10
+
11
+ //#region src/cli/dev/playground-server.ts
12
+ function derivedCacheDir(workspaceRoot) {
13
+ return join(workspaceRoot, ".concrete", "cache", "derived");
14
+ }
15
+ async function startPlaygroundServer(options) {
16
+ const { browser, files, toolsReady, ...served } = options;
17
+ const packageRoot$1 = packageRoot();
18
+ return startPlaygroundServer$1({
19
+ ...served,
20
+ files,
21
+ media: files.media,
22
+ loadModule: files.loadModule,
23
+ name: "concrete dev",
24
+ playgroundDir: playgroundDistDir(packageRoot$1),
25
+ fixtureMediaPath: FIXTURE_MEDIA_PATH,
26
+ derived: derivedFolder(derivedCacheDir(options.root)),
27
+ downloadCode: codeFingerprintAt(packageRoot$1),
28
+ browser: browser ?? frameworkBrowser(toolsReady),
29
+ platform: `@homepages/concrete ${CONCRETE_CLI_VERSION}`
30
+ });
31
+ }
32
+
33
+ //#endregion
34
+ export { derivedCacheDir, startPlaygroundServer };
@@ -0,0 +1,76 @@
1
+ import { deriveAuthorImage, masterHash } from "../media/derive.js";
2
+
3
+ //#region src/cli/dev/section-ladders.ts
4
+ const NOTICE_WINDOW_MS = 1e4;
5
+ const errorText = (err) => err instanceof Error ? err.message : String(err);
6
+ function createSectionLadders(options) {
7
+ const { cacheDir, log } = options;
8
+ let queue = Promise.resolve();
9
+ let queued = 0;
10
+ let unannounced = false;
11
+ let noticeTimer = null;
12
+ let reportedNoSharp = false;
13
+ let closed = false;
14
+ const asked = /* @__PURE__ */ new Set();
15
+ const announce = () => {
16
+ if (noticeTimer !== null) clearTimeout(noticeTimer);
17
+ noticeTimer = null;
18
+ if (!unannounced || closed) return;
19
+ unannounced = false;
20
+ try {
21
+ options.onReady();
22
+ } catch (err) {
23
+ log.write(`concrete dev: landed ladders could not be announced: ${errorText(err)}\n`);
24
+ }
25
+ };
26
+ const landed = () => {
27
+ unannounced = true;
28
+ noticeTimer ??= setTimeout(announce, options.noticeWindowMs ?? 1e4);
29
+ };
30
+ const derive = async (path, bytes, minRungWidth) => {
31
+ try {
32
+ if (closed) return;
33
+ const derivation = await deriveAuthorImage(path, bytes, {
34
+ cacheDir,
35
+ ...minRungWidth === void 0 ? {} : { minRungWidth },
36
+ ...options.loadSharp === void 0 ? {} : { loadSharp: options.loadSharp }
37
+ });
38
+ if (closed) return;
39
+ if (derivation.passthrough) {
40
+ if (!reportedNoSharp) log.write("concrete dev: sharp did not load, so images serve as their masters, without a responsive ladder.\n");
41
+ reportedNoSharp = true;
42
+ return;
43
+ }
44
+ landed();
45
+ } catch (err) {
46
+ log.write(`concrete dev: no responsive ladder for ${path}: ${errorText(err)}\n`);
47
+ } finally {
48
+ queued -= 1;
49
+ if (queued === 0) announce();
50
+ }
51
+ };
52
+ const idle = async () => {
53
+ for (let seen = queue;; seen = queue) {
54
+ await seen;
55
+ if (seen === queue) return;
56
+ }
57
+ };
58
+ return {
59
+ derive(path, bytes, minRungWidth) {
60
+ const key = `${path}|${masterHash(bytes)}|${String(minRungWidth ?? "")}`;
61
+ if (closed || asked.has(key)) return;
62
+ asked.add(key);
63
+ queued += 1;
64
+ queue = queue.then(() => derive(path, bytes, minRungWidth));
65
+ },
66
+ idle,
67
+ close() {
68
+ closed = true;
69
+ announce();
70
+ return idle();
71
+ }
72
+ };
73
+ }
74
+
75
+ //#endregion
76
+ export { NOTICE_WINDOW_MS, createSectionLadders };