@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
@@ -1,114 +0,0 @@
1
- import { createTsconfigPathsPlugin } from "./tsconfig-paths.js";
2
- import { isInsideRoot, toPosix } from "../../platform/paths.js";
3
- import { islandTransformPlugin } from "./islands.js";
4
- import { imageDimensions } from "../../fixtures/image-dimensions.js";
5
- import { MEDIA_EXTENSIONS, fixtureMediaModule } from "../../fixtures/media-plugin.js";
6
- import { extname } from "node:path";
7
- import { readFile } from "node:fs/promises";
8
- import react from "@vitejs/plugin-react";
9
- import { createServer } from "vite";
10
-
11
- //#region src/cli/dev/vite.ts
12
- const RASTER_EXTENSIONS = /* @__PURE__ */ new Set([
13
- ".png",
14
- ".jpg",
15
- ".jpeg",
16
- ".webp",
17
- ".avif"
18
- ]);
19
- function fixtureMediaVitePlugin(root, assets, ladders) {
20
- return {
21
- name: "concrete-dev:fixture-media",
22
- enforce: "pre",
23
- async load(id) {
24
- if (id.includes("?")) return null;
25
- const ext = extname(id).toLowerCase();
26
- if (!isInsideRoot(root, id)) return rasterFromPackage(id, ext, ladders);
27
- if (!MEDIA_EXTENSIONS.has(ext)) return null;
28
- const { asset, value } = await fixtureMediaModule(id, await readFile(id), ladders);
29
- assets.set(asset.url, asset);
30
- return `export default ${JSON.stringify(value)};`;
31
- }
32
- };
33
- }
34
- async function rasterFromPackage(id, ext, ladders) {
35
- if (!RASTER_EXTENSIONS.has(ext)) return null;
36
- const bytes = await readFile(id);
37
- const size = imageDimensions(bytes) ?? {
38
- width: 0,
39
- height: 0
40
- };
41
- const url = `/@fs/${toPosix(id).replace(/^\/+/, "")}`;
42
- const responsive = ladders === void 0 ? null : await ladders.responsiveFor(id, bytes);
43
- return `export default ${JSON.stringify({
44
- url,
45
- responsive,
46
- width: size.width,
47
- height: size.height
48
- })};`;
49
- }
50
- async function createDevVite(options) {
51
- const { root, packageRoot } = options;
52
- const pathsPlugin = await createTsconfigPathsPlugin(root);
53
- return createServer({
54
- root,
55
- appType: "custom",
56
- configFile: false,
57
- logLevel: "warn",
58
- plugins: [
59
- islandTransformPlugin({
60
- root,
61
- markerSpecifier: options.markerSpecifier
62
- }),
63
- react(),
64
- fixtureMediaVitePlugin(root, options.assets, options.ladders),
65
- ...pathsPlugin === null ? [] : [pathsPlugin]
66
- ],
67
- server: {
68
- middlewareMode: true,
69
- fs: { allow: [root, packageRoot] },
70
- watch: { ignored: ["**/.concrete/**", "**/node_modules/**"] },
71
- hmr: {
72
- server: options.hmrServer,
73
- port: options.hmrPort
74
- }
75
- },
76
- resolve: { dedupe: ["react", "react-dom"] },
77
- optimizeDeps: {
78
- include: [
79
- "react",
80
- "react-dom",
81
- "react-dom/client"
82
- ],
83
- entries: [...options.islandEntries]
84
- }
85
- });
86
- }
87
- async function settleBrowserDependencies(vite, entryUrls) {
88
- const client = vite.environments.client;
89
- const optimizer = client.depsOptimizer;
90
- const seen = /* @__PURE__ */ new Set();
91
- const crawl = async (url) => {
92
- if (seen.has(url) || optimizer?.isOptimizedDepUrl(url) === true) return;
93
- seen.add(url);
94
- try {
95
- await client.transformRequest(url);
96
- } catch {
97
- return;
98
- }
99
- const node = await client.moduleGraph.getModuleByUrl(url);
100
- await Promise.all([...node?.importedModules ?? []].map((imported) => crawl(imported.url)));
101
- };
102
- await Promise.all(entryUrls.map(crawl));
103
- if (optimizer === void 0) return;
104
- for (;;) {
105
- await optimizer.scanProcessing;
106
- const pending = Object.values(optimizer.metadata.discovered).flatMap((dep) => dep.processing === void 0 ? [] : [dep.processing]);
107
- if (pending.length === 0) break;
108
- await Promise.all(pending);
109
- }
110
- await new Promise((resolveTurn) => setImmediate(resolveTurn));
111
- }
112
-
113
- //#endregion
114
- export { createDevVite, fixtureMediaVitePlugin, settleBrowserDependencies };
@@ -1,249 +0,0 @@
1
- import { stampTableBounds } from "../../packages/internal/template-contracts/dist/registry-shape.js";
2
- import { isTemplate } from "../../template/define-template.js";
3
- import "../../packages/internal/template-contracts/dist/table-members.js";
4
- import { compileTemplateCss } from "../../css/compile.js";
5
- import { materializeTemplate } from "../../template/materialize.js";
6
- import { loadFixtures } from "../../fixtures/load.js";
7
- import { authoredSettled, computeReadsSectionOf, resolveFixture } from "../../fixtures/resolve.js";
8
- import { materializeSection } from "../../section/materialize.js";
9
- import { loadTemplateModule } from "./load-template.js";
10
- import { createElement } from "react";
11
- import { existsSync } from "node:fs";
12
- import { join } from "node:path";
13
- import { renderToString } from "react-dom/server";
14
-
15
- //#region src/cli/dev/workspace-reader.ts
16
- const TEMPLATE_FILE = "template.ts";
17
- function violationText(violations) {
18
- return violations.map((v) => ` ${v.file}: ${v.message} (${v.rule})`).join("\n");
19
- }
20
- function schemaWire(section) {
21
- const materialized = materializeSection(section);
22
- const slots = materialized.slots;
23
- stampTableBounds(slots);
24
- return {
25
- slots,
26
- slot_order: materialized.slot_order
27
- };
28
- }
29
- function displayOf(section) {
30
- const variant = section.schema.meta.display?.variant;
31
- return {
32
- required: section.required,
33
- variant: variant === void 0 ? null : {
34
- cases: [...variant.cases],
35
- locked: variant.locked === true
36
- }
37
- };
38
- }
39
- function hostFixture(fixture, sizeOf) {
40
- const media = {};
41
- for (const [id, entry] of fixture.media) {
42
- const url = entry.file === null ? void 0 : typeof entry.file === "string" ? entry.file : entry.file.url;
43
- const size = url === void 0 ? void 0 : sizeOf(url);
44
- media[id] = size === void 0 ? entry : {
45
- ...entry,
46
- sizeBytes: size
47
- };
48
- }
49
- return {
50
- id: fixture.id,
51
- label: fixture.label,
52
- facts: fixture.facts,
53
- media,
54
- instances: fixture.contentDoc.instances,
55
- settled: authoredSettled(fixture),
56
- provenance: fixture.provenance
57
- };
58
- }
59
- var DevWorkspace = class {
60
- options;
61
- live = true;
62
- capture;
63
- composition = null;
64
- fixtureSet = null;
65
- stylesheet = null;
66
- sectionAssets = /* @__PURE__ */ new Map();
67
- constructor(options) {
68
- this.options = options;
69
- if (options.capture !== void 0) this.capture = options.capture;
70
- }
71
- get root() {
72
- return this.options.root;
73
- }
74
- invalidateSource() {
75
- this.composition = null;
76
- this.fixtureSet = null;
77
- this.stylesheet = null;
78
- }
79
- invalidateMedia() {
80
- this.composition = null;
81
- this.fixtureSet = null;
82
- }
83
- invalidateFixtures() {
84
- this.fixtureSet = null;
85
- }
86
- invalidateStylesheet() {
87
- this.stylesheet = null;
88
- }
89
- loadComposition() {
90
- this.composition ??= (async () => {
91
- const file = join(this.root, TEMPLATE_FILE);
92
- if (!existsSync(file)) throw new Error(`There is no ${TEMPLATE_FILE} at ${this.root}. The workspace's template is declared there.`);
93
- const loaded = await loadTemplateModule({
94
- root: this.root,
95
- templateFile: file,
96
- markerSpecifier: this.options.markerSpecifier,
97
- ladders: this.options.ladders
98
- });
99
- if (!isTemplate(loaded.template)) throw new Error(`${TEMPLATE_FILE} must default-export the value defineTemplate() returns.`);
100
- return {
101
- template: loaded.template,
102
- materialized: materializeTemplate(loaded.template),
103
- assets: loaded.assets
104
- };
105
- })();
106
- this.composition.catch(() => {
107
- this.composition = null;
108
- });
109
- return this.composition;
110
- }
111
- loadFixtureSet() {
112
- this.fixtureSet ??= (async () => {
113
- const { materialized } = await this.loadComposition();
114
- const loaded = await loadFixtures({
115
- root: this.root,
116
- ladders: this.options.ladders
117
- });
118
- const resolved = /* @__PURE__ */ new Map();
119
- const violations = [...loaded.violations];
120
- for (const fixture of loaded.fixtures) {
121
- const result = resolveFixture(fixture, { placements: materialized.placements });
122
- violations.push(...result.violations);
123
- if (result.resolved !== null) resolved.set(fixture.id, result.resolved);
124
- }
125
- const authored = loaded.fixtures.flatMap((f) => resolved.get(f.id) ?? []);
126
- const sizeOf = (url) => loaded.assets.get(url)?.bytes;
127
- return {
128
- loaded,
129
- resolved,
130
- hosted: authored.map((fixture) => hostFixture(fixture, sizeOf)),
131
- violations
132
- };
133
- })();
134
- this.fixtureSet.catch(() => {
135
- this.fixtureSet = null;
136
- });
137
- return this.fixtureSet;
138
- }
139
- async template() {
140
- const { template, materialized } = await this.loadComposition();
141
- const { manifest } = materialized;
142
- const instances = materialized.instances.map(({ key, instanceId }) => {
143
- const section = materialized.sections.get(key);
144
- return {
145
- instanceId,
146
- section: key,
147
- label: section.label,
148
- sectionSchema: schemaWire(section),
149
- display: displayOf(section)
150
- };
151
- });
152
- return {
153
- key: template.key,
154
- name: template.name,
155
- output: template.output,
156
- formats: template.output === "website" ? [] : template.formats,
157
- pages: manifest.pages.map((page) => ({
158
- id: page.id,
159
- label: page.label,
160
- ..."path" in page && typeof page.path === "string" ? { path: page.path } : {},
161
- ..."direction" in page ? { direction: page.direction } : {},
162
- sections: page.sections.map((s) => ({
163
- instanceId: s.instance_id,
164
- section: s.section
165
- }))
166
- })),
167
- canvases: manifest.canvases.map((canvas) => ({
168
- id: canvas.id,
169
- label: canvas.label,
170
- pages: [...canvas.pages]
171
- })),
172
- instances
173
- };
174
- }
175
- async fixtures() {
176
- const set = await this.loadFixtureSet();
177
- return {
178
- fixtures: set.hosted,
179
- ...set.violations.length === 0 ? {} : { problems: violationText(set.violations) }
180
- };
181
- }
182
- islands() {
183
- const islands = this.options.islands();
184
- return Promise.resolve({
185
- map: islands.map,
186
- canvasHost: islands.canvasHost,
187
- importMap: {},
188
- documentLoader: islands.previewHost === null || Object.keys(islands.map).length === 0 ? { kind: "none" } : {
189
- kind: "viteModules",
190
- islandMap: islands.map,
191
- bootstrapUrl: islands.previewHost
192
- }
193
- });
194
- }
195
- async computes(key) {
196
- const section = (await this.loadComposition()).materialized.sections.get(key);
197
- if (section === void 0) throw new Error(`The composition places no section "${key}".`);
198
- return computeReadsSectionOf(section);
199
- }
200
- renderer() {
201
- return {
202
- section: async (key) => {
203
- const section = (await this.loadComposition()).materialized.sections.get(key);
204
- if (section === void 0) throw new Error(`The composition places no section "${key}".`);
205
- return section;
206
- },
207
- createElement: (type, props) => createElement(type, props),
208
- renderToString: (element, options) => renderToString(element, options)
209
- };
210
- }
211
- async fixtureAsset(url) {
212
- return (await this.loadComposition()).assets.get(url) ?? (await this.loadFixtureSet()).loaded.assets.get(url);
213
- }
214
- async templateCss() {
215
- this.stylesheet ??= (async () => {
216
- const { template } = await this.loadComposition();
217
- return compileTemplateCss({
218
- root: this.root,
219
- templateFile: join(this.root, TEMPLATE_FILE),
220
- template: {
221
- key: template.key,
222
- output: template.output,
223
- formats: template.formats
224
- }
225
- });
226
- })();
227
- this.stylesheet.catch(() => {
228
- this.stylesheet = null;
229
- });
230
- const result = await this.stylesheet;
231
- if (result.bundle !== null) {
232
- for (const asset of result.bundle.assets) this.sectionAssets.set(asset.filename, asset);
233
- return {
234
- css: new TextDecoder().decode(result.bundle.bytes),
235
- violations: result.violations
236
- };
237
- }
238
- return {
239
- css: `/* the template stylesheet did not compile:\n${violationText(result.violations)}\n*/`,
240
- violations: result.violations
241
- };
242
- }
243
- sectionAsset(filename) {
244
- return this.sectionAssets.get(filename);
245
- }
246
- };
247
-
248
- //#endregion
249
- export { DevWorkspace, TEMPLATE_FILE };
@@ -1,64 +0,0 @@
1
- import { CONCRETE_CLI_VERSION } from "../version.js";
2
- import { MANIFEST_FILE } from "../../packages/internal/template-artifact/dist/layout.js";
3
- import { sourceDigest } from "../../packages/internal/template-artifact/dist/hash.js";
4
- import { ArtifactManifest } from "../../packages/internal/template-artifact/dist/manifest.js";
5
- import "../../packages/internal/template-artifact/dist/index.js";
6
- import { collectSourceFiles } from "../build/source.js";
7
- import { join } from "node:path";
8
- import { readFile, stat } from "node:fs/promises";
9
-
10
- //#region src/cli/publish/freshness.ts
11
- async function readManifest(out) {
12
- let text;
13
- let builtAt;
14
- try {
15
- const path = join(out, MANIFEST_FILE);
16
- text = await readFile(path, "utf8");
17
- builtAt = (await stat(path)).mtime;
18
- } catch (cause) {
19
- if (cause.code === "ENOENT") return "missing";
20
- throw cause;
21
- }
22
- let value;
23
- try {
24
- value = JSON.parse(text);
25
- } catch {
26
- return "unreadable";
27
- }
28
- const parsed = ArtifactManifest.safeParse(value);
29
- return parsed.success ? {
30
- manifest: parsed.data,
31
- builtAt
32
- } : "unreadable";
33
- }
34
- async function assessFreshness(options) {
35
- const read = await readManifest(options.out);
36
- const previous = typeof read === "string" ? null : read.manifest;
37
- if (options.rebuild) return {
38
- kind: "rebuild",
39
- reason: "forced",
40
- previous
41
- };
42
- if (typeof read === "string") return {
43
- kind: "rebuild",
44
- reason: read,
45
- previous: null
46
- };
47
- if (read.manifest.framework_version !== CONCRETE_CLI_VERSION) return {
48
- kind: "rebuild",
49
- reason: "framework",
50
- previous
51
- };
52
- return sourceDigest(await collectSourceFiles(options.root, [options.out])) === read.manifest.source_digest ? {
53
- kind: "reuse",
54
- manifest: read.manifest,
55
- builtAt: read.builtAt
56
- } : {
57
- kind: "rebuild",
58
- reason: "changed",
59
- previous
60
- };
61
- }
62
-
63
- //#endregion
64
- export { assessFreshness, readManifest };
@@ -1,4 +0,0 @@
1
- //#region src/fixtures/brand.d.ts
2
- declare const FIXTURE: unique symbol;
3
- //#endregion
4
- export { FIXTURE };
@@ -1,8 +0,0 @@
1
- //#region src/fixtures/brand.ts
2
- const FIXTURE = Symbol("@homepages/concrete/fixture");
3
- function isFixture(value) {
4
- return typeof value === "object" && value !== null && value[FIXTURE] === true;
5
- }
6
-
7
- //#endregion
8
- export { FIXTURE, isFixture };
@@ -1,159 +0,0 @@
1
- import { isFixture } from "./brand.js";
2
- import { workspacePath } from "../platform/paths.js";
3
- import { listDirSync, removeTree } from "../platform/fs.js";
4
- import { MEDIA_LOADERS, createFixtureMediaPlugin, externalOutsideWorkspace } from "./media-plugin.js";
5
- import { runningCopyPlugin } from "../template/running-copy.js";
6
- import { createPackageStylesheetsPlugin } from "./package-stylesheets.js";
7
- import { join } from "node:path";
8
- import { pathToFileURL } from "node:url";
9
- import { mkdir, mkdtemp } from "node:fs/promises";
10
- import { build } from "esbuild";
11
-
12
- //#region src/fixtures/load.ts
13
- const FIXTURES_DIR = "fixtures";
14
- const MODULE_FILE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
15
- const SKIPPED_FILE = /\.test\.[^/]+$|\.d\.[cm]?ts$/;
16
- const SKIPPED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".concrete"]);
17
- function listFixtureModules(root) {
18
- const out = [];
19
- const walk = (dir) => {
20
- let entries;
21
- try {
22
- entries = listDirSync(dir);
23
- } catch {
24
- return;
25
- }
26
- for (const entry of entries) {
27
- if (entry.name.startsWith(".")) continue;
28
- const path = entry.path;
29
- if (entry.isDirectory()) {
30
- if (!SKIPPED_DIRS.has(entry.name)) walk(path);
31
- } else if (entry.isFile() && MODULE_FILE.test(entry.name) && !SKIPPED_FILE.test(entry.name)) out.push(path);
32
- }
33
- };
34
- walk(join(root, FIXTURES_DIR));
35
- return out;
36
- }
37
- function buildMessages(err) {
38
- const messages = err.errors;
39
- return Array.isArray(messages) ? messages : null;
40
- }
41
- let importSerial = 0;
42
- async function bundleAndImportFixtureModules(root, files, ladders) {
43
- const cache = join(root, ".concrete", "cache", "fixtures");
44
- await mkdir(cache, { recursive: true });
45
- const outdir = await mkdtemp(join(cache, `${importSerial++}-`));
46
- try {
47
- return await bundleAndImportInto(outdir, root, files, ladders);
48
- } finally {
49
- await removeTree(outdir);
50
- }
51
- }
52
- async function bundleAndImportInto(outdir, root, files, ladders) {
53
- const media = createFixtureMediaPlugin(root, ladders);
54
- const stylesheets = await createPackageStylesheetsPlugin(root);
55
- let result;
56
- try {
57
- result = await build({
58
- entryPoints: [...files],
59
- bundle: true,
60
- splitting: true,
61
- format: "esm",
62
- platform: "node",
63
- target: "node22",
64
- outdir,
65
- outbase: root,
66
- absWorkingDir: root,
67
- packages: "external",
68
- jsx: "automatic",
69
- loader: {
70
- ".css": "empty",
71
- ...MEDIA_LOADERS
72
- },
73
- plugins: [
74
- runningCopyPlugin(),
75
- externalOutsideWorkspace(root),
76
- media.plugin,
77
- stylesheets.plugin
78
- ],
79
- metafile: true,
80
- write: true,
81
- logLevel: "silent"
82
- });
83
- } catch (err) {
84
- const messages = buildMessages(err);
85
- if (messages === null) throw err;
86
- return {
87
- modules: /* @__PURE__ */ new Map(),
88
- assets: media.assets,
89
- violations: messages.map((m) => ({
90
- rule: "fixtures/property-invalid",
91
- file: m.location?.file ?? `${"fixtures"}/`,
92
- message: m.location === null || m.location === void 0 ? m.text : `${m.text} (${m.location.file}:${m.location.line})`
93
- }))
94
- };
95
- } finally {
96
- await stylesheets.dispose();
97
- }
98
- const outputByInput = /* @__PURE__ */ new Map();
99
- for (const [out, meta] of Object.entries(result.metafile.outputs)) if (meta.entryPoint !== void 0) outputByInput.set(join(root, meta.entryPoint), join(root, out));
100
- const modules = /* @__PURE__ */ new Map();
101
- for (const file of files) {
102
- const out = outputByInput.get(file);
103
- if (out === void 0) throw new Error(`fixtures: esbuild produced no output for ${workspacePath(root, file)}.`);
104
- modules.set(file, await import(pathToFileURL(out).href));
105
- }
106
- return {
107
- modules,
108
- assets: media.assets,
109
- violations: []
110
- };
111
- }
112
- async function loadFixtures(options) {
113
- const { root } = options;
114
- const files = listFixtureModules(root);
115
- const importModules = options.importModules ?? ((list) => bundleAndImportFixtureModules(root, list, options.ladders));
116
- const imported = files.length === 0 ? {
117
- modules: /* @__PURE__ */ new Map(),
118
- assets: /* @__PURE__ */ new Map(),
119
- violations: []
120
- } : await importModules(files);
121
- const violations = [...imported.violations];
122
- const fixtures = [];
123
- const byId = /* @__PURE__ */ new Map();
124
- for (const file of files) {
125
- const exports = imported.modules.get(file);
126
- if (exports === void 0) continue;
127
- const module = workspacePath(root, file);
128
- for (const [exportName, value] of Object.entries(exports)) {
129
- if (!isFixture(value)) continue;
130
- const fixture = value;
131
- const entry = {
132
- id: exportName,
133
- label: fixture.label ?? exportName,
134
- module,
135
- exportName,
136
- fixture
137
- };
138
- const prior = byId.get(exportName);
139
- if (prior !== void 0 && prior.fixture !== fixture) throw new Error(`Two fixtures are exported as "${exportName}": ${prior.module} and ${module}. The export name is the fixture id.`);
140
- if (prior === void 0) {
141
- byId.set(exportName, entry);
142
- fixtures.push(entry);
143
- }
144
- }
145
- }
146
- if (fixtures.length === 0 && violations.length === 0) violations.push({
147
- rule: "fixtures/none",
148
- file: `${FIXTURES_DIR}/`,
149
- message: files.length === 0 ? `the workspace has no modules under ${FIXTURES_DIR}/ — export a defineFixture() value from one` : `no module under ${FIXTURES_DIR}/ exports a defineFixture() value`
150
- });
151
- return {
152
- fixtures,
153
- assets: imported.assets,
154
- violations
155
- };
156
- }
157
-
158
- //#endregion
159
- export { FIXTURES_DIR, bundleAndImportFixtureModules, listFixtureModules, loadFixtures };