@homepages/concrete 4.0.0 → 6.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 (272) hide show
  1. package/CHANGELOG.md +359 -0
  2. package/README.md +28 -17
  3. package/codemods/fill-is-a-source.mjs +533 -0
  4. package/codemods/manifest.json +18 -0
  5. package/codemods/reads-replace-reconcile.mjs +285 -0
  6. package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
  7. package/dist/artifact/playground/client/index.html +1 -1
  8. package/dist/artifact/playground/host.mjs +23 -23
  9. package/dist/base.css +3 -8
  10. package/dist/browser/site-config.js +1 -16
  11. package/dist/browser/submit-lead.js +0 -31
  12. package/dist/cli/build/artifact.js +16 -23
  13. package/dist/cli/build/captures.js +0 -6
  14. package/dist/cli/build/esbuild.js +0 -17
  15. package/dist/cli/build/fixtures.js +15 -30
  16. package/dist/cli/build/icons.js +0 -3
  17. package/dist/cli/build/index.js +1 -1
  18. package/dist/cli/build/playground.js +4 -8
  19. package/dist/cli/build/sections.js +9 -30
  20. package/dist/cli/build/source.js +52 -27
  21. package/dist/cli/build/static.js +4 -25
  22. package/dist/cli/capture/bundle.js +0 -9
  23. package/dist/cli/capture/capture-browser.js +0 -14
  24. package/dist/cli/capture/capture.js +1 -8
  25. package/dist/cli/check/analyze.js +2 -5
  26. package/dist/cli/check/index.js +1 -1
  27. package/dist/cli/check/line-endings.js +52 -0
  28. package/dist/cli/check/load-workspace.js +3 -8
  29. package/dist/cli/check/portable-names.js +48 -0
  30. package/dist/cli/check/render/class-conflicts.js +0 -5
  31. package/dist/cli/check/render/html.js +0 -1
  32. package/dist/cli/check/render/invariants.js +0 -5
  33. package/dist/cli/check/render/island-frames.js +0 -25
  34. package/dist/cli/check/render/marker-coverage.js +0 -20
  35. package/dist/cli/check/render/nav.js +0 -33
  36. package/dist/cli/check/report.js +0 -3
  37. package/dist/cli/check/stages/bundles.js +1 -9
  38. package/dist/cli/check/stages/composition.js +3 -2
  39. package/dist/cli/check/stages/dependencies.js +7 -38
  40. package/dist/cli/check/stages/fixtures.js +3 -31
  41. package/dist/cli/check/stages/lint.js +2 -2
  42. package/dist/cli/check/stages/logic.js +3 -34
  43. package/dist/cli/check/stages/relations.js +46 -0
  44. package/dist/cli/check/stages/render.js +0 -1
  45. package/dist/cli/check/stages/sections.js +3 -3
  46. package/dist/cli/check/stages/stylesheet.js +1 -1
  47. package/dist/cli/check/stages/typecheck.js +5 -11
  48. package/dist/cli/check/stages/workspace.js +36 -14
  49. package/dist/cli/commands.js +9 -56
  50. package/dist/cli/currency/cache.js +4 -17
  51. package/dist/cli/currency/decide.js +0 -14
  52. package/dist/cli/currency/opt-out.js +0 -7
  53. package/dist/cli/currency/preamble.js +3 -24
  54. package/dist/cli/currency/prompt.js +0 -1
  55. package/dist/cli/currency/refresh.js +5 -12
  56. package/dist/cli/currency/resolve-latest.js +3 -64
  57. package/dist/cli/currency/version-order.js +0 -12
  58. package/dist/cli/dev/crop.js +0 -2
  59. package/dist/cli/dev/http.js +0 -13
  60. package/dist/cli/dev/index.js +3 -4
  61. package/dist/cli/dev/islands.js +25 -70
  62. package/dist/cli/dev/listen.js +26 -0
  63. package/dist/cli/dev/load-template.js +0 -1
  64. package/dist/cli/dev/request-error.js +0 -4
  65. package/dist/cli/dev/server.js +46 -52
  66. package/dist/cli/dev/tsconfig-paths.js +0 -13
  67. package/dist/cli/dev/vite.js +9 -38
  68. package/dist/cli/dev/workspace-reader.js +4 -34
  69. package/dist/cli/media/cache.js +4 -51
  70. package/dist/cli/media/derive.js +2 -94
  71. package/dist/cli/media/deriver-plugin.js +0 -2
  72. package/dist/cli/media/frame-rung-floor.js +0 -6
  73. package/dist/cli/property/index.js +0 -4
  74. package/dist/cli/property/library.js +6 -24
  75. package/dist/cli/publish/client.js +0 -1
  76. package/dist/cli/publish/freshness.js +0 -2
  77. package/dist/cli/publish/git.js +2 -8
  78. package/dist/cli/publish/index.js +8 -15
  79. package/dist/cli/publish/pack.js +5 -6
  80. package/dist/cli/publish/report.js +0 -6
  81. package/dist/cli/publish/target.js +16 -13
  82. package/dist/cli/publish/wire.js +0 -6
  83. package/dist/cli/tar.js +2 -9
  84. package/dist/cli/upgrade/codemod.js +0 -8
  85. package/dist/cli/upgrade/index.js +0 -24
  86. package/dist/cli/upgrade/manifest.js +0 -12
  87. package/dist/cli/upgrade/plan.js +0 -17
  88. package/dist/cli/upgrade/stage.js +12 -15
  89. package/dist/cli/version.js +0 -8
  90. package/dist/cli/workspace.js +2 -34
  91. package/dist/cli.js +4 -21
  92. package/dist/css/compile.js +25 -28
  93. package/dist/css/graph.js +3 -10
  94. package/dist/css/inline.js +3 -13
  95. package/dist/css/rules.js +6 -43
  96. package/dist/design-system/format-variants.js +0 -22
  97. package/dist/eslint/authoring.js +0 -2
  98. package/dist/eslint/correctness.js +0 -7
  99. package/dist/eslint/rules/editor-reason.js +0 -11
  100. package/dist/eslint/rules/island-ids.js +0 -1
  101. package/dist/eslint/rules/jsx-visitor.js +0 -13
  102. package/dist/eslint/rules/no-editor-globals.js +0 -2
  103. package/dist/eslint/rules/no-raw-values.js +0 -1
  104. package/dist/fixtures/brand.js +0 -1
  105. package/dist/fixtures/bundle-rule.js +4 -9
  106. package/dist/fixtures/canonical.d.ts +20 -0
  107. package/dist/fixtures/image-dimensions.js +0 -1
  108. package/dist/fixtures/load.js +8 -17
  109. package/dist/fixtures/media-plugin.js +4 -31
  110. package/dist/fixtures/media.js +0 -21
  111. package/dist/fixtures/package-stylesheets.js +0 -6
  112. package/dist/fixtures/property.js +16 -15
  113. package/dist/fixtures/resolve.js +102 -29
  114. package/dist/fixtures/rows.js +12 -11
  115. package/dist/fixtures/synthesize-empties.js +0 -4
  116. package/dist/fixtures.d.ts +19 -4
  117. package/dist/fixtures.js +0 -18
  118. package/dist/index.d.ts +8 -9
  119. package/dist/index.js +2 -11
  120. package/dist/islands/client-module.js +0 -11
  121. package/dist/islands/marker.js +0 -33
  122. package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
  123. package/dist/packages/external/concrete/package.js +1 -1
  124. package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +22 -36
  125. package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
  126. package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
  127. package/dist/packages/internal/fill-bake/dist/display.js +0 -1
  128. package/dist/packages/internal/fill-bake/dist/index.js +4 -4
  129. package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
  130. package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
  131. package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
  132. package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
  133. package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
  134. package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
  135. package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
  136. package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
  137. package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
  138. package/dist/packages/internal/island-runtime/dist/index.js +0 -34
  139. package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
  140. package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
  141. package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
  142. package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
  143. package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
  144. package/dist/packages/internal/property-facts/dist/index.js +1 -1
  145. package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
  146. package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
  147. package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
  148. package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
  149. package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
  150. package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
  151. package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
  152. package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
  153. package/dist/packages/internal/section-contracts/dist/index.js +2 -1
  154. package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
  155. package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
  156. package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
  157. package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
  158. package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
  159. package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
  160. package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
  161. package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
  162. package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
  163. package/dist/packages/internal/source-resolution/dist/index.js +5 -30
  164. package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
  165. package/dist/packages/internal/template-artifact/dist/index.js +1 -1
  166. package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
  167. package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
  168. package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
  169. package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
  170. package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
  171. package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
  172. package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
  173. package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
  174. package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
  175. package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
  176. package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
  177. package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
  178. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
  179. package/dist/platform/file-url.js +8 -0
  180. package/dist/platform/fs.js +73 -0
  181. package/dist/platform/names.js +63 -0
  182. package/dist/platform/order.js +7 -0
  183. package/dist/platform/paths.js +62 -0
  184. package/dist/platform/process.js +97 -0
  185. package/dist/playground/host/page-state.js +0 -2
  186. package/dist/playground/host/paths.js +0 -1
  187. package/dist/playground/layout.js +0 -7
  188. package/dist/playground/wire.js +0 -8
  189. package/dist/primitives/FrameShell.js +0 -18
  190. package/dist/primitives/Image.d.ts +5 -1
  191. package/dist/primitives/Image.js +2 -68
  192. package/dist/primitives/Section.js +0 -13
  193. package/dist/primitives/Tour.js +0 -26
  194. package/dist/primitives/Video.js +0 -32
  195. package/dist/primitives/embed-playback.js +0 -1
  196. package/dist/primitives/marker-attrs.js +0 -17
  197. package/dist/primitives/picture-sources.js +6 -1
  198. package/dist/primitives/probe-context.js +0 -7
  199. package/dist/primitives/slot-bindings.d.ts +3 -2
  200. package/dist/primitives/slot-bindings.js +0 -46
  201. package/dist/primitives/slot-document.js +0 -11
  202. package/dist/primitives/slot-group.js +0 -9
  203. package/dist/primitives/slot-media.js +0 -27
  204. package/dist/primitives/slot-scalar.js +0 -4
  205. package/dist/primitives/slot.js +0 -6
  206. package/dist/rules/registry.js +42 -24
  207. package/dist/schema/compute.d.ts +46 -8
  208. package/dist/schema/compute.js +21 -15
  209. package/dist/schema/define-schema.d.ts +1 -1
  210. package/dist/schema/define-schema.js +37 -17
  211. package/dist/schema/extract-fill-spec.js +93 -180
  212. package/dist/schema/extract-used-facts.js +16 -158
  213. package/dist/schema/fact.d.ts +33 -18
  214. package/dist/schema/fact.js +7 -11
  215. package/dist/schema/fill-builders.d.ts +91 -366
  216. package/dist/schema/fill-builders.js +21 -259
  217. package/dist/schema/fill-declaration.d.ts +7 -69
  218. package/dist/schema/fill-declaration.js +5 -34
  219. package/dist/schema/fill-spec.js +59 -148
  220. package/dist/schema/format-presets.js +0 -12
  221. package/dist/schema/format.js +0 -7
  222. package/dist/schema/layout.js +0 -10
  223. package/dist/schema/manifest.js +0 -39
  224. package/dist/schema/property-facts.d.ts +20 -0
  225. package/dist/schema/runtime-values.d.ts +6 -18
  226. package/dist/schema/section-nav.js +0 -15
  227. package/dist/schema/section-props.d.ts +7 -9
  228. package/dist/schema/section-schema.d.ts +0 -1
  229. package/dist/schema/section-schema.js +4 -20
  230. package/dist/schema/slot-builders.d.ts +128 -117
  231. package/dist/schema/slot-builders.js +18 -201
  232. package/dist/schema/slot-ref.d.ts +63 -0
  233. package/dist/schema/slot-ref.js +33 -0
  234. package/dist/schema/slot-types.d.ts +3 -2
  235. package/dist/schema/slot-types.js +11 -20
  236. package/dist/section/declare.d.ts +14 -10
  237. package/dist/section/declare.js +13 -2
  238. package/dist/section/discovery.js +6 -21
  239. package/dist/section/groups.js +0 -6
  240. package/dist/section/materialize.js +0 -5
  241. package/dist/section/placements.js +0 -4
  242. package/dist/section/section.d.ts +8 -5
  243. package/dist/section/section.js +7 -29
  244. package/dist/styles.css +5 -0
  245. package/dist/template/define-template.d.ts +0 -4
  246. package/dist/template/define-template.js +1 -15
  247. package/dist/template/logic-build.js +8 -35
  248. package/dist/template/logic-shim.d.ts +4 -5
  249. package/dist/template/logic-shim.js +2 -6
  250. package/dist/template/logic-transform.js +0 -6
  251. package/dist/template/materialize.js +52 -43
  252. package/dist/template/mirror-types.js +43 -0
  253. package/dist/template/running-copy.js +5 -20
  254. package/dist/template/section-reads.js +83 -0
  255. package/guide/reference/cli/INDEX.md +12 -6
  256. package/guide/reference/cli/build.md +1 -1
  257. package/guide/reference/cli/check.md +1 -1
  258. package/guide/reference/cli/dev.md +3 -3
  259. package/guide/reference/cli/property-add.md +1 -1
  260. package/guide/reference/cli/property-list.md +1 -1
  261. package/guide/reference/cli/publish.md +4 -2
  262. package/guide/reference/cli/upgrade.md +1 -1
  263. package/guide/reference/rules/INDEX.md +26 -13
  264. package/package.json +4 -2
  265. package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
  266. package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
  267. package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
  268. package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
  269. package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
  270. package/dist/schema/fill-spec.d.ts +0 -18
  271. package/dist/template/reconcile.d.ts +0 -67
  272. package/dist/template/reconcile.js +0 -25
@@ -1,8 +1,8 @@
1
+ import { externalSpecifier } from "../platform/paths.js";
1
2
  import { basename, extname, isAbsolute, join } from "node:path";
2
3
  import { build } from "esbuild";
3
4
 
4
5
  //#region src/css/inline.ts
5
- /** Where a hashed asset is served from; the editor, the publisher and the renderer all resolve this path. */
6
6
  const ASSET_PUBLIC_PATH = "/section-assets";
7
7
  const ASSET_NAMES = "[name]-[hash]";
8
8
  const ASSET_MIME = {
@@ -34,15 +34,9 @@ function importRulePlugin() {
34
34
  setup(api) {
35
35
  api.onResolve({ filter: /.*/ }, (args) => {
36
36
  if (args.kind !== "import-rule") return void 0;
37
- if (REMOTE_RE.test(args.path)) return {
38
- path: args.path,
39
- external: true
40
- };
37
+ if (REMOTE_RE.test(args.path)) return externalSpecifier(args.path);
41
38
  if (args.path.startsWith(".") || isAbsolute(args.path)) return void 0;
42
- return {
43
- path: args.path,
44
- external: true
45
- };
39
+ return externalSpecifier(args.path);
46
40
  });
47
41
  }
48
42
  };
@@ -78,10 +72,6 @@ function hoistRemoteImports(css) {
78
72
  ...lines.slice(end)
79
73
  ].join("\n");
80
74
  }
81
- /**
82
- * Inline the graph's stylesheets (absolute paths, graph order) into one. Throws with
83
- * esbuild's message when a local `@import` or `url()` does not resolve.
84
- */
85
75
  async function inlineCssGraph(root, files) {
86
76
  if (files.length === 0) return {
87
77
  css: "",
package/dist/css/rules.js CHANGED
@@ -1,38 +1,21 @@
1
- import { relative } from "node:path";
1
+ import { workspacePath } from "../platform/paths.js";
2
2
  import { readFile } from "node:fs/promises";
3
3
 
4
4
  //#region src/css/rules.ts
5
- /** Workspace-relative, `/` separators — the form every violation names a file in. */
6
- function workspaceRelative(root, file) {
7
- return relative(root, file).split("\\").join("/");
8
- }
9
- /**
10
- * `css/tailwind-import`: none, named at `template.ts` (where the entry stylesheet is
11
- * imported), or a second one, named at the file carrying it. Two double-emit
12
- * Tailwind's preflight and theme; none leaves every utility uncompiled.
13
- */
14
5
  function tailwindImportViolations(input) {
15
6
  if (input.importers.length === 0) return [{
16
7
  rule: "css/tailwind-import",
17
- file: workspaceRelative(input.root, input.templateFile),
8
+ file: workspacePath(input.root, input.templateFile),
18
9
  message: "no stylesheet reachable from template.ts imports \"tailwindcss\". Import it once, at the top of the first stylesheet template.ts imports: @import \"tailwindcss\";"
19
10
  }];
20
- const [first, ...rest] = input.importers.map((file) => workspaceRelative(input.root, file));
11
+ const [first, ...rest] = input.importers.map((file) => workspacePath(input.root, file));
21
12
  return rest.map((file) => ({
22
13
  rule: "css/tailwind-import",
23
14
  file,
24
15
  message: `a second @import "tailwindcss" (the first is in ${first}). The import graph owns exactly one; remove this one.`
25
16
  }));
26
17
  }
27
- /** The layer names the old kit's build owned. Author CSS may not declare them. */
28
18
  const RETIRED_LAYERS = /* @__PURE__ */ new Set(["sections", "template"]);
29
- /**
30
- * `css` with comments and string literals blanked to spaces, newlines kept.
31
- *
32
- * Both halves are load-bearing. Every ported stylesheet explains the layer it used to
33
- * sit in, so reading a comment as a declaration would fail the templates this rule
34
- * exists to keep clean; and `content: "@layer template"` is a string, not a layer.
35
- */
36
19
  function maskNonCode(css) {
37
20
  const out = [...css];
38
21
  const blank = (from, to) => {
@@ -54,7 +37,6 @@ function maskNonCode(css) {
54
37
  }
55
38
  const AT_LAYER_RE = /@layer\s+([^;{]+)[;{]/gi;
56
39
  const LAYER_FN_RE = /\blayer\(\s*([^)]*?)\s*\)/gi;
57
- /** Every cascade layer a stylesheet names, root segment only (`sections.hero` → `sections`). */
58
40
  function declaredLayerRoots(css) {
59
41
  const source = maskNonCode(css);
60
42
  const roots = [];
@@ -67,18 +49,6 @@ function declaredLayerRoots(css) {
67
49
  }
68
50
  return roots;
69
51
  }
70
- /**
71
- * `css/retired-layer`: author CSS declares `sections` or `template`, the layers the old
72
- * kit's build folded hand-CSS into.
73
- *
74
- * Those layers ranked below `utilities`, so a declaration in one lost to any utility
75
- * setting the same property on the same element — whatever its specificity, and
76
- * invisibly, since the dev server served the same CSS unlayered. `base.css` no longer
77
- * declares them, which means a stylesheet naming one now creates an IMPLICIT layer
78
- * sorted after every declared one: the same rule would silently start winning instead.
79
- * Either ordering is a trap, so the names are refused outright and author CSS stays
80
- * unlayered, where what you wrote is what applies.
81
- */
82
52
  async function retiredLayerViolations(input) {
83
53
  const violations = [];
84
54
  for (const file of input.sources) {
@@ -88,7 +58,7 @@ async function retiredLayerViolations(input) {
88
58
  seen.add(layer);
89
59
  violations.push({
90
60
  rule: "css/retired-layer",
91
- file: workspaceRelative(input.root, file),
61
+ file: workspacePath(input.root, file),
92
62
  message: `declares @layer ${layer}, which @homepages/concrete retired. Your CSS is not layered: delete the wrapper and a plain rule outranks every utility setting the same property. To demote someone else's stylesheet instead, import it into a layer of your own naming — @import "pkg/x.css" layer(components).`
93
63
  });
94
64
  }
@@ -99,7 +69,6 @@ const EXTERNAL_RE = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
99
69
  const INLINE_RE = /^data:/i;
100
70
  const URL_FUNCTION_RE = /url\(\s*(['"]?)([^'")\s]+)\1\s*\)/gi;
101
71
  const IMPORT_STRING_RE = /@import\s+(['"])([^'"]+)\1/gi;
102
- /** The external URLs a stylesheet references, each once, in order of appearance. */
103
72
  function findExternalUrls(css) {
104
73
  const found = /* @__PURE__ */ new Set();
105
74
  const matches = [...css.matchAll(URL_FUNCTION_RE), ...css.matchAll(IMPORT_STRING_RE)].sort((a, b) => a.index - b.index);
@@ -109,12 +78,6 @@ function findExternalUrls(css) {
109
78
  }
110
79
  return [...found];
111
80
  }
112
- /**
113
- * `css/external-url`, for a rendered template only: the render worker's page reaches
114
- * nothing but its own bundle, so a font or image fetched from another host renders as
115
- * a fallback in the captured artifact. Graded on the compiled stylesheet; each URL is
116
- * named at the first graph file whose text carries it, else at `template.ts`.
117
- */
118
81
  async function externalUrlViolations(input) {
119
82
  const urls = findExternalUrls(input.css);
120
83
  if (urls.length === 0) return [];
@@ -126,11 +89,11 @@ async function externalUrlViolations(input) {
126
89
  const source = texts.find(({ text }) => text.includes(url));
127
90
  return {
128
91
  rule: "css/external-url",
129
- file: workspaceRelative(input.root, source?.file ?? input.templateFile),
92
+ file: workspacePath(input.root, source?.file ?? input.templateFile),
130
93
  message: `a rendered template's stylesheet references ${url}, which the renderer cannot reach. Put the file in the workspace and reference it by a relative url(); it ships content-hashed with the stylesheet.`
131
94
  };
132
95
  });
133
96
  }
134
97
 
135
98
  //#endregion
136
- export { declaredLayerRoots, externalUrlViolations, findExternalUrls, retiredLayerViolations, tailwindImportViolations, workspaceRelative };
99
+ export { declaredLayerRoots, externalUrlViolations, findExternalUrls, retiredLayerViolations, tailwindImportViolations };
@@ -1,13 +1,5 @@
1
1
  //#region src/design-system/format-variants.ts
2
2
  const VARIANT_NAME_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
3
- /**
4
- * Variant names a format id may not shadow: Tailwind's built-ins — its default
5
- * breakpoints (which the kit leaves untouched), its static variants, and the
6
- * roots of its functional variants (`group-*`, `data-*`, …). Shadowing one
7
- * would silently rebind every existing use of that prefix in the section
8
- * corpus. A template's own `breakpoints` theme tokens are its own namespace;
9
- * a collision there is the template's to avoid, not parse-refusable here.
10
- */
11
3
  const RESERVED_FORMAT_VARIANT_NAMES = /* @__PURE__ */ new Set([
12
4
  "sm",
13
5
  "md",
@@ -95,25 +87,11 @@ const RESERVED_FORMAT_VARIANT_NAMES = /* @__PURE__ */ new Set([
95
87
  "max",
96
88
  "container"
97
89
  ]);
98
- /**
99
- * Why `id` cannot be a format-variant name, or `null` when it can. One
100
- * judgment shared by the manifest parse (which refuses the template) and
101
- * {@link compileFormatVariantsToCss} (which refuses to emit).
102
- */
103
90
  function formatVariantNameError(id) {
104
91
  if (!VARIANT_NAME_RE.test(id)) return `Format id "${id}" cannot become a Tailwind variant: ids are kebab-case — [a-z0-9] groups separated by single hyphens.`;
105
92
  if (RESERVED_FORMAT_VARIANT_NAMES.has(id)) return `Format id "${id}" shadows a reserved Tailwind variant name; pick an id that is not a kit breakpoint or Tailwind built-in.`;
106
93
  return null;
107
94
  }
108
- /**
109
- * One `@custom-variant` per declared format id, each scoped to the frame
110
- * shell's `data-format` stamp (the frame root itself, or anything inside it).
111
- * Prepend the returned block to the template's Tailwind entry.
112
- *
113
- * @throws when a format id fails {@link formatVariantNameError} — the manifest
114
- * parse enforces the same rule earlier, so a throw here means the caller
115
- * compiled formats no `defineTemplate` produced.
116
- */
117
95
  function compileFormatVariantsToCss(formats) {
118
96
  return `/* Derived per-format variants — one per declared format id. */\n${formats.map((format) => {
119
97
  const error = formatVariantNameError(format.id);
@@ -39,9 +39,7 @@ const registered = CONCRETE_RULES.flatMap((rule) => {
39
39
  severity
40
40
  }];
41
41
  });
42
- /** The plugin's rules map, keyed by the name under the `concrete` namespace: every authoring rule the registry lists. */
43
42
  const AUTHORING_PLUGIN_RULES = Object.fromEntries(registered.map(({ engineId, module }) => [engineId.slice(9), module]));
44
- /** The enabled tier: every authoring rule the registry lists, at the severity it lists. */
45
43
  const AUTHORING_RULES = Object.fromEntries(registered.map(({ engineId, severity }) => [engineId, severity]));
46
44
 
47
45
  //#endregion
@@ -16,19 +16,12 @@ const CORRECTNESS_SETTINGS = {
16
16
  "@typescript-eslint/no-for-in-array": "error",
17
17
  "@typescript-eslint/no-implied-eval": "error"
18
18
  };
19
- /** The enabled tier: every `@typescript-eslint/` rule the registry lists, with its setting. */
20
19
  const CORRECTNESS_RULES = Object.fromEntries(CONCRETE_RULES.flatMap((rule) => {
21
20
  if (rule.venue !== "eslint" || rule.engineId?.startsWith("@typescript-eslint/") !== true) return [];
22
21
  const setting = CORRECTNESS_SETTINGS[rule.engineId];
23
22
  if (setting === void 0) throw new Error(`The rule registry lists ${rule.engineId}, but the correctness tier has no setting for it.`);
24
23
  return [[rule.engineId, setting]];
25
24
  }));
26
- /**
27
- * The correctness tier as a flat-config entry. Composed into the preset's default
28
- * export, so a workspace's whole `eslint.config.mjs` stays one re-export and these
29
- * rules apply with no manifest change: the checks a template is judged by when it is
30
- * published are checks its author could already run.
31
- */
32
25
  const correctnessConfig = [{
33
26
  name: "concrete/correctness",
34
27
  files: ["**/*.ts", "**/*.tsx"],
@@ -1,15 +1,12 @@
1
1
  //#region src/eslint/rules/editor-reason.ts
2
- /** Opens the comment block above the fork, and must actually say something. */
3
2
  const REASON = /^\s*editor-reason:\s*\S/;
4
3
  function isCallTo(node, name) {
5
4
  return node?.type === "CallExpression" && node.callee?.type === "Identifier" && node.callee.name === name;
6
5
  }
7
- /** The property name a member expression resolves to, or null when it is computed at runtime. */
8
6
  function memberName(node) {
9
7
  if (node.computed === true) return node.property?.type === "Literal" && typeof node.property.value === "string" ? node.property.value : null;
10
8
  return node.property?.type === "Identifier" ? node.property.name ?? null : null;
11
9
  }
12
- /** The key an object pattern's property declares, or null when computed. */
13
10
  function propertyKey(node) {
14
11
  if (node.computed === true) return null;
15
12
  if (node.key?.type === "Identifier") return node.key.name ?? null;
@@ -30,7 +27,6 @@ const editorReason = {
30
27
  const sourceCode = context.sourceCode;
31
28
  const canvasReads = [];
32
29
  const refDeclarations = [];
33
- /** `const inCanvasRef = useRef(inCanvas)` makes every `inCanvasRef.current` a canvas read. One level, through `useRef` only. */
34
30
  function followRefMirrors() {
35
31
  const seeded = new Set(canvasReads);
36
32
  for (const ref of refDeclarations) {
@@ -42,7 +38,6 @@ const editorReason = {
42
38
  }
43
39
  }
44
40
  }
45
- /** The three shapes that move the value rather than decide with it. */
46
41
  function isCarrier(read) {
47
42
  const parent = read.parent;
48
43
  if (parent === void 0) return false;
@@ -53,11 +48,6 @@ const editorReason = {
53
48
  }
54
49
  return parent.type === "ArrayExpression" && parent.parent?.type === "CallExpression" && (parent.parent.arguments ?? []).includes(parent);
55
50
  }
56
- /**
57
- * Own-line comments, keyed by the line each ENDS on. Both `//` and the block form
58
- * count, and the `{`/`}` of a JSX expression container is ignored: JSX children accept
59
- * only the braced block form, so a line-comment-only rule would be unsatisfiable there.
60
- */
61
51
  function ownLineComments() {
62
52
  const byEndLine = /* @__PURE__ */ new Map();
63
53
  for (const comment of sourceCode.getAllComments()) {
@@ -73,7 +63,6 @@ const editorReason = {
73
63
  }
74
64
  return byEndLine;
75
65
  }
76
- /** A comment block immediately above `line` whose FIRST comment opens with the marker. */
77
66
  function hasReasonAbove(line, comments) {
78
67
  let comment = comments.get(line - 1);
79
68
  if (comment === void 0) return false;
@@ -1,7 +1,6 @@
1
1
  import { hasClientDirective } from "../../islands/client-module.js";
2
2
 
3
3
  //#region src/eslint/rules/island-ids.ts
4
- /** The call this node makes, by the name being called — `React.useId()` counts as `useId`. */
5
4
  function calledName(callee) {
6
5
  if (callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier") return callee.property.name;
7
6
  return callee.type === "Identifier" ? callee.name : null;
@@ -1,17 +1,4 @@
1
1
  //#region src/eslint/rules/jsx-visitor.ts
2
- /**
3
- * Types a JSX visitor for `Rule.RuleListener`.
4
- *
5
- * ESLint's `Rule.Node` union is ESTree-only — JSX lives in the parser's AST, never in
6
- * `@types/estree` — so no JSX visitor can be declared with an honest parameter type, and
7
- * ESLint 10's listener is a mapped type over that union, so a handler narrowed to a JSX
8
- * shape does not assign. The cast is what the types cannot express, not a claim about
9
- * runtime: the parser really does hand these visitors JSX nodes. Applied per visitor, not
10
- * to the listener object, so every sibling handler stays contextually typed.
11
- *
12
- * `TNode` is each rule's own structural type for the fields it reads, never
13
- * `TSESTree.JSXAttribute`: `@typescript-eslint/types` is not a dependency of this package.
14
- */
15
2
  function jsxVisitor(visit) {
16
3
  return visit;
17
4
  }
@@ -5,12 +5,10 @@ const GLOBAL_OBJECTS = /* @__PURE__ */ new Set([
5
5
  "globalThis",
6
6
  "self"
7
7
  ]);
8
- /** The global object's name when this node is one, else null. */
9
8
  function globalObjectName(node) {
10
9
  if (node?.type !== "Identifier" || node.name === void 0) return null;
11
10
  return GLOBAL_OBJECTS.has(node.name) ? node.name : null;
12
11
  }
13
- /** The property name a member access or pattern key resolves to, or null when computed at runtime. */
14
12
  function staticKey(key, computed) {
15
13
  if (!computed && key.type === "Identifier") return key.name ?? null;
16
14
  if (key.type === "Literal" && typeof key.value === "string") return key.value;
@@ -3,7 +3,6 @@ const SLOTS = "slots";
3
3
  function isIdentifier(node, name) {
4
4
  return node?.type === "Identifier" && node.name === name;
5
5
  }
6
- /** `props.slots`: the base must be the identifier `props` itself. */
7
6
  function isPropsSlots(node) {
8
7
  return node?.type === "MemberExpression" && isIdentifier(node.property, SLOTS) && isIdentifier(node.object, "props");
9
8
  }
@@ -1,6 +1,5 @@
1
1
  //#region src/fixtures/brand.ts
2
2
  const FIXTURE = Symbol("@homepages/concrete/fixture");
3
- /** Is this export a fixture value? What the loader asks of every export of every fixture module. */
4
3
  function isFixture(value) {
5
4
  return typeof value === "object" && value !== null && value[FIXTURE] === true;
6
5
  }
@@ -1,18 +1,13 @@
1
+ import { toPosix } from "../platform/paths.js";
1
2
  import { MEDIA_LOADERS, createFixtureMediaPlugin, externalOutsideWorkspace } from "./media-plugin.js";
2
3
  import { FIXTURES_DIR } from "./load.js";
3
- import { join, sep } from "node:path";
4
+ import { join } from "node:path";
4
5
  import { build } from "esbuild";
5
6
 
6
7
  //#region src/fixtures/bundle-rule.ts
7
- /** The fixtures subpath, which a shipped module may reach only as a type. */
8
8
  const FIXTURES_SUBPATH = "@homepages/concrete/fixtures";
9
- /** The sample library: copied into a workspace, never depended on. */
10
9
  const SAMPLE_LIBRARY = "@homepages/sample-properties";
11
10
  const RULE = "fixtures/reachable-from-bundle";
12
- /**
13
- * Every module reachable from `entries` that crosses into dev data, one violation per
14
- * offending import, naming the importing file.
15
- */
16
11
  async function findFixturesReachableFromBundle(options) {
17
12
  const { root } = options;
18
13
  const media = createFixtureMediaPlugin(root);
@@ -38,10 +33,10 @@ async function findFixturesReachableFromBundle(options) {
38
33
  const violations = [];
39
34
  const fixturesPrefix = `${FIXTURES_DIR}/`;
40
35
  for (const [input, meta] of Object.entries(result.metafile.inputs)) {
41
- const file = input.split(sep).join("/");
36
+ const file = toPosix(input);
42
37
  if (file.startsWith(fixturesPrefix) || file.includes(":")) continue;
43
38
  for (const imp of meta.imports) {
44
- const target = imp.path.split(sep).join("/");
39
+ const target = toPosix(imp.path);
45
40
  if (imp.external === true) {
46
41
  if (target === "@homepages/concrete/fixtures") violations.push({
47
42
  rule: RULE,
@@ -122,6 +122,26 @@ interface CanonicalComparable {
122
122
  photo_url: string | null;
123
123
  source_url: string | null;
124
124
  source_name: string | null;
125
+ /** The year the comparable was built. */
126
+ year_built: number | null;
127
+ /** Lot size in square feet. */
128
+ lot_sqft: number | null;
129
+ stories: number | null;
130
+ /** Units in the comparable's building — a multifamily figure, unrelated to the subject's units. */
131
+ units: number | null;
132
+ /** Monthly HOA dues in dollars. */
133
+ hoa_monthly: number | null;
134
+ /** Live listings only; null on a closed sale. */
135
+ days_on_market: number | null;
136
+ /** The asking price in dollars, beside `price`. */
137
+ list_price: number | null;
138
+ /** ISO `YYYY-MM-DD` — when the listing went live, not when it closed. */
139
+ listed_date: string | null;
140
+ mls_number: string | null;
141
+ /** The listing remarks, verbatim from the source. */
142
+ description: string | null;
143
+ /** The comparable's type in the platform's own vocabulary; null when the source states none. */
144
+ property_type: CanonicalPropertyType | null;
125
145
  }
126
146
  interface CanonicalDocumentNote {
127
147
  upload_id: string;
@@ -50,7 +50,6 @@ function webp(bytes) {
50
50
  }
51
51
  return null;
52
52
  }
53
- /** The size of a PNG, JPEG or WebP master, or `null` when the header is not one of those. */
54
53
  function imageDimensions(bytes) {
55
54
  return png(bytes) ?? jpeg(bytes) ?? webp(bytes);
56
55
  }
@@ -1,31 +1,30 @@
1
1
  import { isFixture } from "./brand.js";
2
+ import { workspacePath } from "../platform/paths.js";
3
+ import { listDirSync } from "../platform/fs.js";
2
4
  import { MEDIA_LOADERS, createFixtureMediaPlugin, externalOutsideWorkspace } from "./media-plugin.js";
3
5
  import { runningCopyPlugin } from "../template/running-copy.js";
4
6
  import { createPackageStylesheetsPlugin } from "./package-stylesheets.js";
5
- import { readdirSync } from "node:fs";
6
- import { join, relative, sep } from "node:path";
7
+ import { join } from "node:path";
7
8
  import { pathToFileURL } from "node:url";
8
9
  import { build } from "esbuild";
9
10
 
10
11
  //#region src/fixtures/load.ts
11
- /** The one reserved directory: everything fixture-side lives under it. */
12
12
  const FIXTURES_DIR = "fixtures";
13
13
  const MODULE_FILE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
14
14
  const SKIPPED_FILE = /\.test\.[^/]+$|\.d\.[cm]?ts$/;
15
15
  const SKIPPED_DIRS = /* @__PURE__ */ new Set(["node_modules", ".concrete"]);
16
- /** Every module under `<root>/fixtures/`, tests excluded, in a stable order. `[]` when the directory is absent. */
17
16
  function listFixtureModules(root) {
18
17
  const out = [];
19
18
  const walk = (dir) => {
20
19
  let entries;
21
20
  try {
22
- entries = readdirSync(dir, { withFileTypes: true });
21
+ entries = listDirSync(dir);
23
22
  } catch {
24
23
  return;
25
24
  }
26
- for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
25
+ for (const entry of entries) {
27
26
  if (entry.name.startsWith(".")) continue;
28
- const path = join(dir, entry.name);
27
+ const path = entry.path;
29
28
  if (entry.isDirectory()) {
30
29
  if (!SKIPPED_DIRS.has(entry.name)) walk(path);
31
30
  } else if (entry.isFile() && MODULE_FILE.test(entry.name) && !SKIPPED_FILE.test(entry.name)) out.push(path);
@@ -39,7 +38,6 @@ function buildMessages(err) {
39
38
  return Array.isArray(messages) ? messages : null;
40
39
  }
41
40
  let importSerial = 0;
42
- /** The default loader: one esbuild pass over every fixture module, then a dynamic import of each output. */
43
41
  async function bundleAndImportFixtureModules(root, files) {
44
42
  const media = createFixtureMediaPlugin(root);
45
43
  const stylesheets = await createPackageStylesheetsPlugin(root);
@@ -92,7 +90,7 @@ async function bundleAndImportFixtureModules(root, files) {
92
90
  const modules = /* @__PURE__ */ new Map();
93
91
  for (const file of files) {
94
92
  const out = outputByInput.get(file);
95
- if (out === void 0) throw new Error(`fixtures: esbuild produced no output for ${relative(root, file)}.`);
93
+ if (out === void 0) throw new Error(`fixtures: esbuild produced no output for ${workspacePath(root, file)}.`);
96
94
  const url = `${pathToFileURL(out).href}?load=${Date.now()}-${importSerial++}`;
97
95
  modules.set(file, await import(url));
98
96
  }
@@ -102,13 +100,6 @@ async function bundleAndImportFixtureModules(root, files) {
102
100
  violations: []
103
101
  };
104
102
  }
105
- /**
106
- * Load the workspace's fixtures, in discovery order: modules by path, and within a
107
- * module the namespace's own (alphabetical) export order. Two distinct fixtures under
108
- * one export name is an error — the name is the id, and two values cannot share it. No
109
- * fixture at all is the `fixtures/none` violation, not an error: `check` reports it
110
- * beside the rest.
111
- */
112
103
  async function loadFixtures(options) {
113
104
  const { root } = options;
114
105
  const files = listFixtureModules(root);
@@ -124,7 +115,7 @@ async function loadFixtures(options) {
124
115
  for (const file of files) {
125
116
  const exports = imported.modules.get(file);
126
117
  if (exports === void 0) continue;
127
- const module = relative(root, file).split(sep).join("/");
118
+ const module = workspacePath(root, file);
128
119
  for (const [exportName, value] of Object.entries(exports)) {
129
120
  if (!isFixture(value)) continue;
130
121
  const fixture = value;
@@ -1,12 +1,12 @@
1
+ import { externalFile, isInsideRoot } from "../platform/paths.js";
1
2
  import { imageDimensions } from "./image-dimensions.js";
2
- import { basename, extname, sep } from "node:path";
3
+ import { basename, extname } from "node:path";
3
4
  import { readFile } from "node:fs/promises";
4
5
  import { createHash } from "node:crypto";
5
6
 
6
7
  //#region src/fixtures/media-plugin.ts
7
8
  const NAMESPACE = "concrete-fixture-media";
8
9
  const RESOLVING = Symbol("concrete-fixture-media:resolving");
9
- /** The public path fixture media serves under in `dev`. */
10
10
  const FIXTURE_MEDIA_PATH = "/fixture-media";
11
11
  const MEDIA_FILTER = /\.(?:[pP][nN][gG]|[jJ][pP][eE]?[gG]|[wW][eE][bB][pP]|[aA][vV][iI][fF]|[sS][vV][gG]|[gG][iI][fF]|[iI][cC][oO]|[wW][oO][fF][fF]2?|[tT][tT][fF]|[oO][tT][fF]|[eE][oO][tT]|[mM][pP]4|[wW][eE][bB][mM]|[mM][oO][vV]|[mM][pP]3|[wW][aA][vV]|[pP][dD][fF]|[zZ][iI][pP])$/;
12
12
  const DERIVED_EXTENSIONS = /* @__PURE__ */ new Set([
@@ -16,11 +16,6 @@ const DERIVED_EXTENSIONS = /* @__PURE__ */ new Set([
16
16
  ".webp",
17
17
  ".avif"
18
18
  ]);
19
- /**
20
- * esbuild's `file` loader for every media extension the ambient shim types — the
21
- * fallback for a media import the plugin does not claim (one resolving outside the
22
- * workspace), so a pass never fails on "no loader is configured".
23
- */
24
19
  const MEDIA_LOADERS = Object.fromEntries([
25
20
  ".png",
26
21
  ".jpg",
@@ -43,15 +38,7 @@ const MEDIA_LOADERS = Object.fromEntries([
43
38
  ".pdf",
44
39
  ".zip"
45
40
  ].map((ext) => [ext, "file"]));
46
- /**
47
- * Keep a relative import that resolves OUTSIDE the workspace external, so the loaded
48
- * module shares the running process's copy of it rather than a bundled second copy.
49
- * A real workspace never imports past its own root, so in production this claims
50
- * nothing; the package's own test workspaces reach their framework by relative path,
51
- * and a bundled copy would carry its own brand symbols and probe contexts.
52
- */
53
41
  function externalOutsideWorkspace(root) {
54
- const inside = root.endsWith(sep) ? root : root + sep;
55
42
  return {
56
43
  name: "concrete-external-outside-workspace",
57
44
  setup(build) {
@@ -65,29 +52,17 @@ function externalOutsideWorkspace(root) {
65
52
  pluginData: RESOLVING
66
53
  });
67
54
  if (resolved.errors.length > 0 || resolved.path === "") return null;
68
- return resolved.path.startsWith(inside) ? null : {
69
- path: resolved.path,
70
- external: true
71
- };
55
+ return isInsideRoot(root, resolved.path) ? null : externalFile(resolved.path);
72
56
  });
73
57
  }
74
58
  };
75
59
  }
76
- /** The served URL of a master: `<stem>-<hash8><ext>` under the fixture media path. */
77
60
  function fixtureMediaUrl(path, bytes) {
78
61
  const ext = extname(path);
79
62
  const hash = createHash("sha256").update(bytes).digest("hex").slice(0, 8);
80
63
  return `${FIXTURE_MEDIA_PATH}/${basename(path, ext)}-${hash}${ext.toLowerCase()}`;
81
64
  }
82
- /** Every extension a media import can name — the ambient shim's list, spelled once in MEDIA_LOADERS. */
83
65
  const MEDIA_EXTENSIONS = new Set(Object.keys(MEDIA_LOADERS));
84
- /**
85
- * What a media import evaluates to, and the asset it stands for. THE one spelling of the
86
- * two lanes: `concrete dev` runs a workspace through two module graphs — esbuild for the
87
- * server, Vite for the islands — and an island is in BOTH, so an import that evaluates
88
- * differently in each hydrates into an attribute mismatch on the element carrying it.
89
- * Both graphs' plugins resolve through here so there is nothing for them to disagree on.
90
- */
91
66
  function fixtureMediaModule(path, bytes) {
92
67
  const url = fixtureMediaUrl(path, bytes);
93
68
  const derived = DERIVED_EXTENSIONS.has(extname(path).toLowerCase());
@@ -108,10 +83,8 @@ function fixtureMediaModule(path, bytes) {
108
83
  } : url
109
84
  };
110
85
  }
111
- /** A fresh plugin per pass; `assets` is what the pass recorded. */
112
86
  function createFixtureMediaPlugin(root) {
113
87
  const assets = /* @__PURE__ */ new Map();
114
- const inside = root.endsWith(sep) ? root : root + sep;
115
88
  return {
116
89
  plugin: {
117
90
  name: NAMESPACE,
@@ -127,7 +100,7 @@ function createFixtureMediaPlugin(root) {
127
100
  pluginData: RESOLVING
128
101
  });
129
102
  if (resolved.errors.length > 0 || resolved.path === "") return null;
130
- if (!resolved.path.startsWith(inside)) return null;
103
+ if (!isInsideRoot(root, resolved.path)) return null;
131
104
  return {
132
105
  path: resolved.path,
133
106
  namespace: NAMESPACE
@@ -2,10 +2,6 @@ import { tourEmbedUrl, videoEmbedUrl } from "../packages/internal/template-contr
2
2
 
3
3
  //#region src/fixtures/media.ts
4
4
  const clamp01 = (n) => n < 0 ? 0 : n > 1 ? 1 : n;
5
- /**
6
- * A crop rect read off an untrusted value, clamped into the frame, or null when it names
7
- * none: not an object, a non-finite field, a zero-size region, or the whole image.
8
- */
9
5
  function cropRectOf(value) {
10
6
  if (typeof value !== "object" || value === null) return null;
11
7
  const { nx = 0, ny = 0, nw = 1, nh = 1 } = value;
@@ -26,7 +22,6 @@ function cropRectOf(value) {
26
22
  if (rect.nw <= 0 || rect.nh <= 0) return null;
27
23
  return rect.nx === 0 && rect.ny === 0 && rect.nw === 1 && rect.nh === 1 ? null : rect;
28
24
  }
29
- /** The `dev` answer: the URL the loader minted, and whatever ladder the import carried. */
30
25
  const servedMedia = { file(file) {
31
26
  return typeof file === "string" ? {
32
27
  url: file,
@@ -41,12 +36,6 @@ function assetId(value) {
41
36
  const id = value.asset_id;
42
37
  return typeof id === "string" && id !== "" ? id : null;
43
38
  }
44
- /**
45
- * An image reference's value. A reference carrying a `rect` (and a `mobile_rect`) serves
46
- * that region through the resolver's `crop`, as one source with no ladder: the crop is cut
47
- * on the way out, so there are no rungs of it to list. The rect rides along as the
48
- * cropper's re-edit state, as the platform's value carries it.
49
- */
50
39
  function imageValue(entry, ref, resolver) {
51
40
  if (entry.file === null) return null;
52
41
  const rect = resolver.crop === void 0 ? null : cropRectOf(ref.rect);
@@ -117,11 +106,6 @@ function documentValue(entry, resolver) {
117
106
  size_bytes: 0
118
107
  };
119
108
  }
120
- /**
121
- * One media reference → its rendered value, by the slot kind that holds it. A
122
- * reference the catalog does not carry resolves to `null`, the renderer's marked-empty
123
- * branch — the resolver already reported it.
124
- */
125
109
  function renderMediaRef(kind, value, media, resolver) {
126
110
  const id = assetId(value);
127
111
  const entry = id === null ? void 0 : media.get(id);
@@ -180,11 +164,6 @@ function renderValue(def, value, media, resolver) {
180
164
  }
181
165
  return items;
182
166
  }
183
- /**
184
- * The slot values a renderer receives for one resolved instance: every media reference
185
- * resolved through `resolver`, every other value unchanged. The section's declarations
186
- * decide which values hold media.
187
- */
188
167
  function renderInstanceSlots(instance, section, media, resolver = servedMedia) {
189
168
  const out = {};
190
169
  for (const [id, value] of Object.entries(instance.slots)) {
@@ -2,12 +2,6 @@ import { context } from "esbuild";
2
2
 
3
3
  //#region src/fixtures/package-stylesheets.ts
4
4
  const NAMESPACE = "concrete-package-stylesheet";
5
- /**
6
- * Whether a bare specifier names a stylesheet is only known once it resolves, and a
7
- * pass's own `build.resolve` honours `packages: "external"` and never does. So the plugin
8
- * asks a resolver context of its own, without that option, and claims only what
9
- * resolves to `.css`; everything else falls through to the pass unchanged.
10
- */
11
5
  async function createPackageStylesheetsPlugin(root) {
12
6
  let resolve;
13
7
  const resolver = await context({