@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
@@ -0,0 +1,79 @@
1
+ import { PLAYGROUND_SITE } from "./leads.js";
2
+ import { pageDetailsOf } from "../../../site-files/dist/head.js";
3
+ import { siteFiles } from "../../../site-files/dist/site.js";
4
+ import "../../../site-files/dist/index.js";
5
+
6
+ //#region ../../internal/playground/dist/host/site.js
7
+ const KEPT_SITES = 16;
8
+ function playgroundSites(source) {
9
+ const kept = /* @__PURE__ */ new Map();
10
+ return async (ask) => {
11
+ const binding = await source.binding();
12
+ const details = pageDetailsOf(ask.facts, null);
13
+ const coverUrl = source.shareImage === void 0 || details.coverMediaId === null ? null : ask.coverUrl(details.coverMediaId);
14
+ const head = {
15
+ titleAddress: details.titleAddress,
16
+ streetAddress: details.streetAddress,
17
+ displayAddress: details.displayAddress,
18
+ description: details.description,
19
+ orgName: null,
20
+ fallbackTitle: ask.templateName
21
+ };
22
+ const fingerprint = ask.hash(JSON.stringify([
23
+ ask.pages,
24
+ ask.contentBase,
25
+ ask.buildBase,
26
+ ask.siteUrl,
27
+ ask.ingestBase,
28
+ head,
29
+ coverUrl,
30
+ binding
31
+ ]));
32
+ const held = kept.get(fingerprint);
33
+ if (held !== void 0) {
34
+ kept.delete(fingerprint);
35
+ kept.set(fingerprint, held);
36
+ return held;
37
+ }
38
+ const cutter = source.shareImage;
39
+ const making = siteFiles({
40
+ pages: ask.pages,
41
+ contentBase: ask.contentBase,
42
+ buildBase: ask.buildBase,
43
+ siteUrl: ask.siteUrl,
44
+ head,
45
+ binding,
46
+ readBuildFile: (path) => source.buildFile(path),
47
+ cover: coverUrl === null || cutter === void 0 ? null : {
48
+ key: coverUrl,
49
+ async read() {
50
+ const bytes = await cutter.read(coverUrl);
51
+ if (bytes === null) throw new Error(`The cover photo at ${coverUrl} could not be read.`);
52
+ return bytes;
53
+ }
54
+ },
55
+ cutShareImage: (bytes, size) => cutter === void 0 ? Promise.reject(/* @__PURE__ */ new Error("This playground cuts no share image.")) : cutter.cut(bytes, size),
56
+ hash: ask.hash,
57
+ leads: {
58
+ ...PLAYGROUND_SITE,
59
+ ingestBase: ask.ingestBase
60
+ },
61
+ analytics: false
62
+ });
63
+ kept.set(fingerprint, making);
64
+ making.catch(() => {
65
+ if (kept.get(fingerprint) === making) kept.delete(fingerprint);
66
+ });
67
+ if (kept.size > KEPT_SITES) kept.delete(kept.keys().next().value);
68
+ return making;
69
+ };
70
+ }
71
+ function siteFileResponse(file) {
72
+ return new Response(new Uint8Array(file.bytes), { headers: {
73
+ "content-type": file.contentType,
74
+ "cache-control": file.immutable ? "public, max-age=31536000, immutable" : "no-cache"
75
+ } });
76
+ }
77
+
78
+ //#endregion
79
+ export { playgroundSites, siteFileResponse };
@@ -0,0 +1,202 @@
1
+ import { declaredKinds } from "../../../template-contracts/dist/slot-catalog.js";
2
+ import { mediaIdOf } from "../../../template-contracts/dist/registry-facts.js";
3
+ import { UPLOADS_LIST, candidateSet, mediaListItems } from "../../../template-contracts/dist/media-candidates.js";
4
+ import { propertyFacts } from "../../../template-contracts/dist/fact-registry.js";
5
+ import { objectFieldSlotId, slotValueOf } from "../../../template-contracts/dist/slot-overrides.js";
6
+ import "../../../page-render/dist/index.js";
7
+ import { cropRectOfStored, croppedImageCopy, fixtureMediaRecords, fixtureMediaStore } from "./media-store.js";
8
+
9
+ //#region ../../internal/playground/dist/host/slots.js
10
+ function fileUrl(file) {
11
+ return typeof file === "string" ? file : file.url;
12
+ }
13
+ function propertyMediaItems(property, assetUrl) {
14
+ const { facts } = property;
15
+ const media = (id) => property.media[id];
16
+ const urlOf = (entry) => entry?.file === null || entry?.file === void 0 ? "" : assetUrl(fileUrl(entry.file));
17
+ const posterOf = (entry) => entry?.posterFile !== void 0 ? assetUrl(fileUrl(entry.posterFile)) : entry?.posterUrl ?? "";
18
+ const items = [];
19
+ for (const image of candidateSet(facts, {
20
+ kinds: ["image"],
21
+ from: ["property.property_media", "property.floor_plans"]
22
+ })) {
23
+ const entry = media(image.id);
24
+ items.push({
25
+ id: image.id,
26
+ kind: "photo",
27
+ name: entry?.filename || image.id,
28
+ size: "",
29
+ src: urlOf(entry)
30
+ });
31
+ }
32
+ for (const video of candidateSet(facts, {
33
+ kinds: ["video"],
34
+ from: [UPLOADS_LIST]
35
+ })) {
36
+ const provider = video.provider ?? void 0;
37
+ items.push({
38
+ id: video.id,
39
+ kind: "video",
40
+ name: media(video.id)?.filename || video.name || video.id,
41
+ size: "",
42
+ src: posterOf(media(video.id)),
43
+ ready: true,
44
+ durationMs: video.duration_ms ?? null,
45
+ ...provider === void 0 ? {} : { provider }
46
+ });
47
+ }
48
+ for (const tour of candidateSet(facts, {
49
+ kinds: ["tour"],
50
+ from: [UPLOADS_LIST]
51
+ })) items.push({
52
+ id: tour.id,
53
+ kind: "tour",
54
+ name: `${tour.provider ?? "Tour"} ${tour.id}`,
55
+ size: "",
56
+ src: posterOf(media(tour.id)),
57
+ url: tour.url ?? "",
58
+ provider: tour.provider ?? ""
59
+ });
60
+ for (const doc of candidateSet(facts, {
61
+ kinds: ["document"],
62
+ from: [UPLOADS_LIST]
63
+ })) {
64
+ const bytes = media(doc.id)?.sizeBytes;
65
+ items.push({
66
+ id: doc.id,
67
+ kind: "document",
68
+ name: doc.name === "" ? doc.id : doc.name,
69
+ size: "",
70
+ src: "",
71
+ mime: doc.mime ?? "",
72
+ ...bytes === void 0 ? {} : { sizeBytes: bytes }
73
+ });
74
+ }
75
+ return items;
76
+ }
77
+ function propertyMediaLists(property) {
78
+ const lists = {};
79
+ for (const [key, page] of Object.entries(propertyFacts.pages)) {
80
+ const declaration = page.declaration;
81
+ if (declaration.type !== "list" || declaredKinds(declaration.element).length === 0) continue;
82
+ const from = `property.${key}`;
83
+ lists[from] = mediaListItems(property.facts, from) ?? [];
84
+ }
85
+ return lists;
86
+ }
87
+ function fixtureOwnedMedia(fixture, assetUrl) {
88
+ const served = {};
89
+ for (const id of Object.keys(fixture.owned ?? {})) {
90
+ const entry = fixture.media[id];
91
+ if (entry === void 0) continue;
92
+ served[id] = entry.file === null ? entry.url ?? "" : assetUrl(fileUrl(entry.file));
93
+ }
94
+ return served;
95
+ }
96
+ const CONTACT_IMAGE_FIELDS = [
97
+ "headshot",
98
+ "logo_dark",
99
+ "logo_light"
100
+ ];
101
+ function propertyContacts(property, assetUrl) {
102
+ return property.facts.contacts.map((contact) => {
103
+ const images = {};
104
+ for (const field of CONTACT_IMAGE_FIELDS) {
105
+ const id = mediaIdOf(contact[field]);
106
+ const file = id === void 0 ? void 0 : property.media[id]?.file;
107
+ if (id !== void 0 && file !== null && file !== void 0) images[id] = assetUrl(fileUrl(file));
108
+ }
109
+ return {
110
+ id: contact.id,
111
+ images
112
+ };
113
+ });
114
+ }
115
+ const MEDIA_TYPES = /* @__PURE__ */ new Set([
116
+ "image",
117
+ "video",
118
+ "tour",
119
+ "document",
120
+ "media"
121
+ ]);
122
+ const MEDIA_ID_FIELDS = [
123
+ "file",
124
+ "media",
125
+ "id"
126
+ ];
127
+ function editorValueToDoc(def, value) {
128
+ if (value === null || value === void 0) return value;
129
+ if (MEDIA_TYPES.has(def.type)) {
130
+ if (typeof value !== "object") return null;
131
+ const record = value;
132
+ const id = MEDIA_ID_FIELDS.map((field) => record[field]).find((candidate) => typeof candidate === "string" && candidate !== "");
133
+ if (typeof id !== "string") return null;
134
+ if (def.type !== "image") return { file: id };
135
+ const rect = cropRectOfStored(record.crop);
136
+ const mobile = typeof record.mobile === "object" && record.mobile !== null ? cropRectOfStored(record.mobile.crop) : null;
137
+ const floor = "floor" in record ? { floor: typeof record.floor === "string" ? record.floor : null } : {};
138
+ return {
139
+ ...croppedImageCopy(id, rect, mobile),
140
+ ...floor
141
+ };
142
+ }
143
+ if (def.type === "object") return fieldsToDoc(def.fields ?? {}, value);
144
+ if (def.type !== "list" || !Array.isArray(value)) return value;
145
+ const items = value;
146
+ const element = def.element;
147
+ if (element === void 0) return items;
148
+ if (element.type === "object") return items.map((item) => fieldsToDoc(element.fields ?? {}, item));
149
+ return items.map((item) => editorValueToDoc(element, item));
150
+ }
151
+ function fieldsToDoc(fields, value) {
152
+ if (typeof value !== "object" || value === null) return value;
153
+ const out = { ...value };
154
+ for (const [field, fieldDef] of Object.entries(fields)) {
155
+ if (!(field in out)) continue;
156
+ out[field] = editorValueToDoc(fieldDef, out[field]);
157
+ }
158
+ return out;
159
+ }
160
+ function laidValues(held, declared, values) {
161
+ const merged = { ...held };
162
+ for (const [id, value] of Object.entries(values ?? {})) {
163
+ const def = declared[id];
164
+ if (def === void 0) continue;
165
+ merged[id] = editorValueToDoc(def, value);
166
+ }
167
+ return merged;
168
+ }
169
+ function fixtureMedia(fixture, assetUrl, content) {
170
+ const media = new Map(Object.entries(fixture.media));
171
+ return {
172
+ store: fixtureMediaStore(media, {
173
+ url: (path) => assetUrl(path),
174
+ crop: (path, rect) => assetUrl(path, { crop: rect }),
175
+ ...content === void 0 ? {} : { content }
176
+ }),
177
+ records: fixtureMediaRecords(fixture.facts, media, void 0, fixture.owned),
178
+ resolvePoi: (value) => value
179
+ };
180
+ }
181
+ function slotProvenance(fixture, instanceId, slots) {
182
+ const resolved = fixture.provenance[instanceId] ?? {};
183
+ return Object.fromEntries(Object.keys(slots).map((id) => [id, resolved[id] ?? { kind: "empty" }]));
184
+ }
185
+ function settledComputed(slots, resolved) {
186
+ const out = {};
187
+ const isComputed = (def) => def.source?.kind === "derived";
188
+ for (const [id, def] of Object.entries(slots)) {
189
+ if (def.type === "object") {
190
+ for (const [field, fieldDef] of Object.entries(def.fields ?? {})) {
191
+ const dotted = objectFieldSlotId(id, field);
192
+ if (isComputed(fieldDef)) out[dotted] = slotValueOf(resolved, dotted);
193
+ }
194
+ continue;
195
+ }
196
+ if (isComputed(def)) out[id] = resolved[id];
197
+ }
198
+ return out;
199
+ }
200
+
201
+ //#endregion
202
+ export { editorValueToDoc, fixtureMedia, fixtureOwnedMedia, laidValues, propertyContacts, propertyMediaItems, propertyMediaLists, settledComputed, slotProvenance };
@@ -0,0 +1,93 @@
1
+ import { isOverridable } from "./overridable.js";
2
+ import { editorValueToDoc } from "./slots.js";
3
+
4
+ //#region ../../internal/playground/dist/host/stated-content.js
5
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
6
+ const MEDIA_TYPES = /* @__PURE__ */ new Set([
7
+ "image",
8
+ "video",
9
+ "tour",
10
+ "document",
11
+ "media"
12
+ ]);
13
+ function editorValueToDocument(def, value) {
14
+ return documentSpelling(def, editorValueToDoc(def, value));
15
+ }
16
+ function documentSpelling(def, value) {
17
+ if (value === null || value === void 0) return value;
18
+ if (MEDIA_TYPES.has(def.type)) {
19
+ if (!isRecord(value) || typeof value["file"] !== "string") return value;
20
+ const mobile = isRecord(value["mobile"]) ? value["mobile"]["crop"] : void 0;
21
+ return {
22
+ media: value["file"],
23
+ ...value["crop"] === void 0 ? {} : { crop: value["crop"] },
24
+ ...mobile === void 0 ? {} : { mobile: { crop: mobile } }
25
+ };
26
+ }
27
+ if (def.type === "object" && isRecord(value)) return fieldsSpelling(def.fields ?? {}, value);
28
+ if (def.type === "list" && Array.isArray(value) && def.element !== void 0) {
29
+ const element = def.element;
30
+ if (element.type === "object") return value.map((item) => isRecord(item) ? fieldsSpelling(element.fields ?? {}, item) : item);
31
+ return value.map((item) => documentSpelling(element, item));
32
+ }
33
+ return value;
34
+ }
35
+ function fieldsSpelling(fields, value) {
36
+ const out = { ...value };
37
+ for (const [field, def] of Object.entries(fields)) if (field in out) out[field] = documentSpelling(def, out[field]);
38
+ return out;
39
+ }
40
+ const isDerived = (def) => def.source !== void 0 && def.source.kind !== "authored";
41
+ function statedOnly(declared, slots, marks) {
42
+ const scalar = marks?.scalar ?? {};
43
+ const out = {};
44
+ for (const [id, value] of Object.entries(slots)) {
45
+ const def = declared[id];
46
+ if (def === void 0) {
47
+ out[id] = value;
48
+ continue;
49
+ }
50
+ if (def.type === "object") {
51
+ if (!isRecord(value)) {
52
+ out[id] = value;
53
+ continue;
54
+ }
55
+ const fields = {};
56
+ for (const [field, fieldValue] of Object.entries(value)) {
57
+ const fieldDef = def.fields?.[field];
58
+ if (fieldDef !== void 0 && isOverridable(fieldDef) && scalar[`${id}.${field}`] !== true) continue;
59
+ fields[field] = fieldValue;
60
+ }
61
+ if (Object.keys(fields).length > 0) out[id] = fields;
62
+ continue;
63
+ }
64
+ if (isOverridable(def)) {
65
+ if (scalar[id] === true) out[id] = value;
66
+ continue;
67
+ }
68
+ const element = def.type === "list" ? def.element : void 0;
69
+ if (element?.type === "object" && Array.isArray(value) && isDerived(def)) {
70
+ const itemMarks = marks?.items?.[id] ?? {};
71
+ out[id] = value.map((item) => {
72
+ if (!isRecord(item)) return item;
73
+ const own = typeof item["id"] === "string" ? itemMarks[item["id"]] : void 0;
74
+ const kept = {};
75
+ for (const [field, fieldValue] of Object.entries(item)) {
76
+ const fieldDef = element.fields?.[field];
77
+ if (fieldDef !== void 0 && isDerived(fieldDef) && own?.[field] !== true) continue;
78
+ kept[field] = fieldValue;
79
+ }
80
+ return kept;
81
+ });
82
+ continue;
83
+ }
84
+ out[id] = value;
85
+ }
86
+ return marks !== void 0 && Object.values(marks).some((group) => isRecord(group) && Object.keys(group).length > 0) ? {
87
+ slots: out,
88
+ slot_overrides: marks
89
+ } : { slots: out };
90
+ }
91
+
92
+ //#endregion
93
+ export { editorValueToDocument, statedOnly };
@@ -0,0 +1,135 @@
1
+ import { assertAuthored } from "./resolve.js";
2
+ import { loadDataFixtures, resolveReference } from "./fixture-documents.js";
3
+
4
+ //#region ../../internal/playground/dist/host/stored-fixtures.js
5
+ const LISTED_IN = "manifest.json";
6
+ function fixtureListPath(fixtureList) {
7
+ if (fixtureList === null) return null;
8
+ const ref = resolveReference(LISTED_IN, fixtureList);
9
+ return "path" in ref ? ref.path : null;
10
+ }
11
+ function hostMediaOf(catalog, sizeOf) {
12
+ const media = {};
13
+ for (const [id, entry] of catalog) {
14
+ const url = entry.file === null ? void 0 : typeof entry.file === "string" ? entry.file : entry.file.url;
15
+ const size = url === void 0 ? void 0 : sizeOf(url);
16
+ media[id] = size === void 0 ? entry : {
17
+ ...entry,
18
+ sizeBytes: size
19
+ };
20
+ }
21
+ return media;
22
+ }
23
+ function hostPropertyOf(property, sizeOf) {
24
+ return {
25
+ name: property.name,
26
+ file: property.file,
27
+ facts: property.facts,
28
+ media: hostMediaOf(property.media, sizeOf)
29
+ };
30
+ }
31
+ function hostFixtureOf(fixture, sizeOf) {
32
+ assertAuthored(fixture);
33
+ const media = hostMediaOf(fixture.media, sizeOf);
34
+ return {
35
+ id: fixture.id,
36
+ facts: fixture.facts,
37
+ media,
38
+ instances: fixture.contentDoc.instances,
39
+ provenance: fixture.provenance,
40
+ file: fixture.module,
41
+ property: fixture.property,
42
+ ...fixture.pages === void 0 ? {} : { pages: fixture.pages },
43
+ ...fixture.owned === void 0 ? {} : { owned: fixture.owned }
44
+ };
45
+ }
46
+ async function publishedPlacements(build, built) {
47
+ const { template } = build;
48
+ const computed = /* @__PURE__ */ new Map();
49
+ const placements = [];
50
+ for (const page of template.pages) for (const placed of page.sections) {
51
+ const instance = template.instances.find((i) => i.instanceId === placed.instanceId);
52
+ if (instance?.version === void 0) throw new Error(`The composition places "${placed.instanceId}" (${placed.section}), whose section version the reader does not serve.`);
53
+ let handles = computed.get(instance.section);
54
+ if (handles === void 0) {
55
+ handles = built.computesAt(build, instance.section);
56
+ computed.set(instance.section, handles);
57
+ }
58
+ const schema = instance.version.schema;
59
+ const decisions = instance.version.fillSpec.decisions ?? [];
60
+ placements.push({
61
+ key: instance.section,
62
+ instance: instance.instanceId,
63
+ section: {
64
+ key: instance.section,
65
+ slots: schema.slots ?? {},
66
+ display: schema.display ?? {},
67
+ computed: (await handles).bakeContext.computed ?? {},
68
+ decisions
69
+ }
70
+ });
71
+ }
72
+ return placements;
73
+ }
74
+ function fixtureReads(env, view, sizes) {
75
+ return {
76
+ readText: async (path) => (await view.readText(path))?.text ?? null,
77
+ async mediaFile(path) {
78
+ const served = await env.media(view, path);
79
+ if (served === null) return null;
80
+ if (sizes !== void 0 && served.size !== void 0) sizes.set(typeof served.file === "string" ? served.file : served.file.url, served.size);
81
+ return served.file;
82
+ }
83
+ };
84
+ }
85
+ function storedFixtures(input) {
86
+ const { env, built, reader } = input;
87
+ let cached = null;
88
+ const load = async (view) => {
89
+ const build = await built.readAt(view);
90
+ if (build.fixtureList === null) return {
91
+ properties: [],
92
+ fixtures: [],
93
+ violations: []
94
+ };
95
+ const list = build.fixtureList;
96
+ const placements = await publishedPlacements(build, built);
97
+ const sizes = /* @__PURE__ */ new Map();
98
+ const loaded = await loadDataFixtures({
99
+ store: fixtureReads(env, view, sizes),
100
+ list,
101
+ listedIn: LISTED_IN,
102
+ placements
103
+ });
104
+ const captured = await reader.captured?.();
105
+ const fixtures = loaded.fixtures.map((fixture) => {
106
+ const hosted = hostFixtureOf(fixture, (url) => sizes.get(url));
107
+ return captured === void 0 ? hosted : {
108
+ ...hosted,
109
+ capturable: captured.has(fixture.id)
110
+ };
111
+ });
112
+ return {
113
+ properties: loaded.properties.map((property) => hostPropertyOf(property, (url) => sizes.get(url))),
114
+ fixtures,
115
+ violations: loaded.violations
116
+ };
117
+ };
118
+ return (view) => {
119
+ const version = `${view.version} ${String(env.mediaVersion?.() ?? 0)}`;
120
+ if (cached?.version !== version) {
121
+ const fixtures = load(view);
122
+ cached = {
123
+ version,
124
+ fixtures
125
+ };
126
+ fixtures.catch(() => {
127
+ if (cached?.fixtures === fixtures) cached = null;
128
+ });
129
+ }
130
+ return cached.fixtures;
131
+ };
132
+ }
133
+
134
+ //#endregion
135
+ export { fixtureListPath, fixtureReads, hostFixtureOf, hostPropertyOf, storedFixtures };
@@ -0,0 +1,7 @@
1
+ //#region ../../internal/playground/dist/host/violations.js
2
+ function violationText(violations) {
3
+ return violations.map((v) => ` ${v.file}: ${v.message} (${v.rule})`).join("\n");
4
+ }
5
+
6
+ //#endregion
7
+ export { violationText };
@@ -0,0 +1,24 @@
1
+ //#region ../../internal/playground/dist/jobs/lanes.js
2
+ const GIB = 1024 * 1024 * 1024;
3
+ function laneWidths(machine) {
4
+ const { cores } = machine;
5
+ const gib = Math.floor(machine.memoryBytes / GIB);
6
+ const half = Math.max(1, Math.floor(cores / 2));
7
+ return {
8
+ browser: {
9
+ value: Math.min(half, Math.max(1, gib)),
10
+ from: `min(max(1, floor(${String(cores)} cores / 2)), max(1, ${String(gib)} GiB))`
11
+ },
12
+ "image-cutter": {
13
+ value: half,
14
+ from: `max(1, floor(${String(cores)} cores / 2))`
15
+ },
16
+ nothing: {
17
+ value: Number.POSITIVE_INFINITY,
18
+ from: "unbounded: it holds nothing scarce"
19
+ }
20
+ };
21
+ }
22
+
23
+ //#endregion
24
+ export { laneWidths };
@@ -0,0 +1,112 @@
1
+ import { hasEnded } from "./queue.js";
2
+
3
+ //#region ../../internal/playground/dist/jobs/memory-queue.js
4
+ const HOUR_MS = 3600 * 1e3;
5
+ function sameSubject(a, b) {
6
+ return a.property === b.property && a.fixture === b.fixture && a.format === b.format;
7
+ }
8
+ function memoryJobQueue(options = {}) {
9
+ const keepEndedMs = options.keepEndedMs ?? HOUR_MS;
10
+ const keepPerTemplate = options.keepEndedPerTemplate ?? 50;
11
+ const now = options.now ?? Date.now;
12
+ const jobs = /* @__PURE__ */ new Map();
13
+ let made = 0;
14
+ const stamp = () => new Date(now()).toISOString();
15
+ const copy = (job) => ({
16
+ ...job,
17
+ subject: { ...job.subject },
18
+ log: [...job.log]
19
+ });
20
+ function forget() {
21
+ const cutoff = now() - keepEndedMs;
22
+ const kept = /* @__PURE__ */ new Map();
23
+ for (const job of [...jobs.values()].reverse()) {
24
+ if (!hasEnded(job)) continue;
25
+ const count = (kept.get(job.template) ?? 0) + 1;
26
+ kept.set(job.template, count);
27
+ if (count > keepPerTemplate || Date.parse(job.finishedAt) < cutoff) jobs.delete(job.id);
28
+ }
29
+ }
30
+ function end(job, state) {
31
+ job.state = state;
32
+ job.finishedAt = stamp();
33
+ }
34
+ return {
35
+ start(start) {
36
+ forget();
37
+ const open = [...jobs.values()].filter((job) => job.template === start.template && !hasEnded(job));
38
+ const joined = start.fingerprint === null ? void 0 : open.find((job) => job.fingerprint === start.fingerprint);
39
+ if (joined !== void 0) return Promise.resolve({
40
+ job: copy(joined),
41
+ joined: true
42
+ });
43
+ if (start.replaces) {
44
+ for (const job of open) if (job.state === "waiting" && job.operation === start.operation && sameSubject(job.subject, start.subject)) end(job, "cancelled");
45
+ }
46
+ made += 1;
47
+ const job = {
48
+ id: `${now().toString(36)}-${made.toString(36)}`,
49
+ template: start.template,
50
+ operation: start.operation,
51
+ lane: start.lane,
52
+ subject: { ...start.subject },
53
+ version: start.version,
54
+ fingerprint: start.fingerprint,
55
+ state: "waiting",
56
+ progress: null,
57
+ log: [],
58
+ result: null,
59
+ error: null,
60
+ startedAt: stamp(),
61
+ runningAt: null,
62
+ finishedAt: null
63
+ };
64
+ jobs.set(job.id, job);
65
+ return Promise.resolve({
66
+ job: copy(job),
67
+ joined: false
68
+ });
69
+ },
70
+ claim(lane) {
71
+ const job = [...jobs.values()].find((held) => held.lane === lane && held.state === "waiting");
72
+ if (job === void 0) return Promise.resolve(null);
73
+ job.state = "running";
74
+ job.runningAt = stamp();
75
+ return Promise.resolve(copy(job));
76
+ },
77
+ report(id, report) {
78
+ const job = jobs.get(id);
79
+ if (job === void 0) return Promise.resolve(null);
80
+ if (job.state === "running") {
81
+ if (report.progress !== void 0) job.progress = report.progress;
82
+ if (report.log !== void 0) job.log = [...job.log, report.log].slice(-50);
83
+ }
84
+ return Promise.resolve(copy(job));
85
+ },
86
+ finish(id, outcome) {
87
+ const job = jobs.get(id);
88
+ if (job === void 0) return Promise.resolve(null);
89
+ if (job.state === "running") {
90
+ if (outcome.state === "done") job.result = outcome.result;
91
+ else job.error = outcome.error;
92
+ end(job, outcome.state);
93
+ forget();
94
+ }
95
+ return Promise.resolve(copy(job));
96
+ },
97
+ read(read) {
98
+ forget();
99
+ const held = read.id === void 0 ? [...jobs.values()] : [jobs.get(read.id)].filter((job) => job !== void 0);
100
+ return Promise.resolve(held.filter((job) => job.template === read.template).reverse().map(copy));
101
+ },
102
+ cancel(id) {
103
+ const job = jobs.get(id);
104
+ if (job === void 0) return Promise.resolve(null);
105
+ if (!hasEnded(job)) end(job, "cancelled");
106
+ return Promise.resolve(copy(job));
107
+ }
108
+ };
109
+ }
110
+
111
+ //#endregion
112
+ export { memoryJobQueue };
@@ -0,0 +1,37 @@
1
+ //#region ../../internal/playground/dist/jobs/probe.js
2
+ const PROBE_OPERATION = "probe";
3
+ function pause(ms, signal) {
4
+ return new Promise((resolve, reject) => {
5
+ if (signal.aborted) return reject(/* @__PURE__ */ new Error("aborted"));
6
+ const timer = setTimeout(() => {
7
+ signal.removeEventListener("abort", stop);
8
+ resolve();
9
+ }, ms);
10
+ const stop = () => {
11
+ clearTimeout(timer);
12
+ reject(/* @__PURE__ */ new Error("aborted"));
13
+ };
14
+ signal.addEventListener("abort", stop, { once: true });
15
+ });
16
+ }
17
+ function probeOperation(options = {}) {
18
+ const steps = options.steps ?? 10;
19
+ const stepMs = options.stepMs ?? 1e3;
20
+ return {
21
+ name: PROBE_OPERATION,
22
+ takes: "nothing",
23
+ mark: "Probing",
24
+ joins: true,
25
+ async run({ job, signal, report }) {
26
+ await report({ log: `Probing ${job.subject.fixture ?? "the template"} at version ${job.version}.` });
27
+ for (let step = 1; step <= steps; step++) {
28
+ await pause(stepMs, signal);
29
+ await report({ progress: `Step ${String(step)} of ${String(steps)}` });
30
+ }
31
+ return null;
32
+ }
33
+ };
34
+ }
35
+
36
+ //#endregion
37
+ export { PROBE_OPERATION, probeOperation };