@homepages/concrete 5.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +342 -0
- package/README.md +28 -17
- package/codemods/fill-is-a-source.mjs +533 -0
- package/codemods/manifest.json +16 -0
- package/codemods/reads-replace-reconcile.mjs +285 -0
- package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +23 -23
- package/dist/base.css +3 -8
- package/dist/browser/site-config.js +1 -16
- package/dist/browser/submit-lead.js +0 -31
- package/dist/cli/build/artifact.js +16 -23
- package/dist/cli/build/captures.js +0 -6
- package/dist/cli/build/esbuild.js +0 -17
- package/dist/cli/build/fixtures.js +15 -30
- package/dist/cli/build/icons.js +0 -3
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/build/playground.js +4 -8
- package/dist/cli/build/sections.js +9 -30
- package/dist/cli/build/source.js +52 -27
- package/dist/cli/build/static.js +4 -25
- package/dist/cli/capture/bundle.js +0 -9
- package/dist/cli/capture/capture-browser.js +0 -14
- package/dist/cli/capture/capture.js +1 -8
- package/dist/cli/check/analyze.js +2 -5
- package/dist/cli/check/index.js +1 -1
- package/dist/cli/check/line-endings.js +52 -0
- package/dist/cli/check/load-workspace.js +3 -8
- package/dist/cli/check/portable-names.js +48 -0
- package/dist/cli/check/render/class-conflicts.js +0 -5
- package/dist/cli/check/render/html.js +0 -1
- package/dist/cli/check/render/invariants.js +0 -5
- package/dist/cli/check/render/island-frames.js +0 -25
- package/dist/cli/check/render/marker-coverage.js +0 -20
- package/dist/cli/check/render/nav.js +0 -33
- package/dist/cli/check/report.js +0 -3
- package/dist/cli/check/stages/bundles.js +1 -9
- package/dist/cli/check/stages/composition.js +3 -2
- package/dist/cli/check/stages/dependencies.js +7 -38
- package/dist/cli/check/stages/fixtures.js +3 -31
- package/dist/cli/check/stages/lint.js +2 -2
- package/dist/cli/check/stages/logic.js +3 -34
- package/dist/cli/check/stages/relations.js +46 -0
- package/dist/cli/check/stages/render.js +0 -1
- package/dist/cli/check/stages/sections.js +3 -3
- package/dist/cli/check/stages/stylesheet.js +1 -1
- package/dist/cli/check/stages/typecheck.js +5 -11
- package/dist/cli/check/stages/workspace.js +36 -14
- package/dist/cli/commands.js +9 -56
- package/dist/cli/currency/cache.js +4 -17
- package/dist/cli/currency/decide.js +0 -14
- package/dist/cli/currency/opt-out.js +0 -7
- package/dist/cli/currency/preamble.js +3 -24
- package/dist/cli/currency/prompt.js +0 -1
- package/dist/cli/currency/refresh.js +5 -12
- package/dist/cli/currency/resolve-latest.js +3 -64
- package/dist/cli/currency/version-order.js +0 -12
- package/dist/cli/dev/crop.js +0 -2
- package/dist/cli/dev/http.js +0 -13
- package/dist/cli/dev/index.js +3 -4
- package/dist/cli/dev/islands.js +25 -70
- package/dist/cli/dev/listen.js +26 -0
- package/dist/cli/dev/load-template.js +0 -1
- package/dist/cli/dev/request-error.js +0 -4
- package/dist/cli/dev/server.js +46 -52
- package/dist/cli/dev/tsconfig-paths.js +0 -13
- package/dist/cli/dev/vite.js +9 -38
- package/dist/cli/dev/workspace-reader.js +4 -34
- package/dist/cli/media/cache.js +4 -51
- package/dist/cli/media/derive.js +2 -94
- package/dist/cli/media/deriver-plugin.js +0 -2
- package/dist/cli/media/frame-rung-floor.js +0 -6
- package/dist/cli/property/index.js +0 -4
- package/dist/cli/property/library.js +6 -24
- package/dist/cli/publish/client.js +0 -1
- package/dist/cli/publish/freshness.js +0 -2
- package/dist/cli/publish/git.js +2 -8
- package/dist/cli/publish/index.js +8 -15
- package/dist/cli/publish/pack.js +5 -6
- package/dist/cli/publish/report.js +0 -6
- package/dist/cli/publish/target.js +16 -13
- package/dist/cli/publish/wire.js +0 -6
- package/dist/cli/tar.js +2 -9
- package/dist/cli/upgrade/codemod.js +0 -8
- package/dist/cli/upgrade/index.js +0 -24
- package/dist/cli/upgrade/manifest.js +0 -12
- package/dist/cli/upgrade/plan.js +0 -17
- package/dist/cli/upgrade/stage.js +12 -15
- package/dist/cli/version.js +0 -8
- package/dist/cli/workspace.js +2 -34
- package/dist/cli.js +4 -21
- package/dist/css/compile.js +25 -28
- package/dist/css/graph.js +3 -10
- package/dist/css/inline.js +3 -16
- package/dist/css/rules.js +6 -43
- package/dist/design-system/format-variants.js +0 -22
- package/dist/eslint/authoring.js +0 -2
- package/dist/eslint/correctness.js +0 -7
- package/dist/eslint/rules/editor-reason.js +0 -11
- package/dist/eslint/rules/island-ids.js +0 -1
- package/dist/eslint/rules/jsx-visitor.js +0 -13
- package/dist/eslint/rules/no-editor-globals.js +0 -2
- package/dist/eslint/rules/no-raw-values.js +0 -1
- package/dist/fixtures/brand.js +0 -1
- package/dist/fixtures/bundle-rule.js +4 -9
- package/dist/fixtures/canonical.d.ts +20 -0
- package/dist/fixtures/image-dimensions.js +0 -1
- package/dist/fixtures/load.js +8 -17
- package/dist/fixtures/media-plugin.js +4 -31
- package/dist/fixtures/media.js +0 -21
- package/dist/fixtures/package-stylesheets.js +0 -6
- package/dist/fixtures/property.js +16 -15
- package/dist/fixtures/resolve.js +102 -29
- package/dist/fixtures/rows.js +12 -11
- package/dist/fixtures/synthesize-empties.js +0 -4
- package/dist/fixtures.d.ts +19 -4
- package/dist/fixtures.js +0 -18
- package/dist/index.d.ts +8 -9
- package/dist/index.js +2 -11
- package/dist/islands/client-module.js +0 -11
- package/dist/islands/marker.js +0 -33
- package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +21 -35
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
- package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
- package/dist/packages/internal/fill-bake/dist/display.js +0 -1
- package/dist/packages/internal/fill-bake/dist/index.js +4 -4
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
- package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
- package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
- package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
- package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
- package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
- package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/index.js +0 -34
- package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
- package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
- package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
- package/dist/packages/internal/property-facts/dist/index.js +1 -1
- package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
- package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
- package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
- package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
- package/dist/packages/internal/section-contracts/dist/index.js +2 -1
- package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
- package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
- package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
- package/dist/packages/internal/source-resolution/dist/index.js +1 -9
- package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
- package/dist/packages/internal/template-artifact/dist/index.js +1 -1
- package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
- package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
- package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
- package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
- package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
- package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
- package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
- package/dist/platform/file-url.js +8 -0
- package/dist/platform/fs.js +73 -0
- package/dist/platform/names.js +63 -0
- package/dist/platform/order.js +7 -0
- package/dist/platform/paths.js +66 -0
- package/dist/platform/process.js +97 -0
- package/dist/playground/host/page-state.js +0 -2
- package/dist/playground/host/paths.js +0 -1
- package/dist/playground/layout.js +0 -7
- package/dist/playground/wire.js +0 -8
- package/dist/primitives/FrameShell.js +0 -18
- package/dist/primitives/Image.d.ts +5 -1
- package/dist/primitives/Image.js +2 -68
- package/dist/primitives/Section.js +0 -13
- package/dist/primitives/Tour.js +0 -26
- package/dist/primitives/Video.js +0 -32
- package/dist/primitives/embed-playback.js +0 -1
- package/dist/primitives/marker-attrs.js +0 -17
- package/dist/primitives/picture-sources.js +6 -1
- package/dist/primitives/probe-context.js +0 -7
- package/dist/primitives/slot-bindings.js +0 -46
- package/dist/primitives/slot-document.js +0 -11
- package/dist/primitives/slot-group.js +0 -9
- package/dist/primitives/slot-media.js +0 -27
- package/dist/primitives/slot-scalar.js +0 -4
- package/dist/primitives/slot.js +0 -6
- package/dist/rules/registry.js +42 -24
- package/dist/schema/compute.d.ts +46 -8
- package/dist/schema/compute.js +21 -15
- package/dist/schema/define-schema.d.ts +1 -1
- package/dist/schema/define-schema.js +37 -17
- package/dist/schema/extract-fill-spec.js +93 -180
- package/dist/schema/extract-used-facts.js +16 -158
- package/dist/schema/fact.d.ts +25 -12
- package/dist/schema/fact.js +7 -11
- package/dist/schema/fill-builders.d.ts +91 -366
- package/dist/schema/fill-builders.js +21 -259
- package/dist/schema/fill-declaration.d.ts +7 -69
- package/dist/schema/fill-declaration.js +5 -34
- package/dist/schema/fill-spec.js +59 -148
- package/dist/schema/format-presets.js +0 -12
- package/dist/schema/format.js +0 -7
- package/dist/schema/layout.js +0 -10
- package/dist/schema/manifest.js +0 -39
- package/dist/schema/property-facts.d.ts +20 -0
- package/dist/schema/section-nav.js +0 -15
- package/dist/schema/section-schema.d.ts +0 -1
- package/dist/schema/section-schema.js +4 -20
- package/dist/schema/slot-builders.d.ts +128 -117
- package/dist/schema/slot-builders.js +18 -201
- package/dist/schema/slot-ref.d.ts +63 -0
- package/dist/schema/slot-ref.js +33 -0
- package/dist/schema/slot-types.d.ts +3 -2
- package/dist/schema/slot-types.js +11 -20
- package/dist/section/declare.d.ts +14 -10
- package/dist/section/declare.js +13 -2
- package/dist/section/discovery.js +6 -21
- package/dist/section/groups.js +0 -6
- package/dist/section/materialize.js +0 -5
- package/dist/section/placements.js +0 -4
- package/dist/section/section.d.ts +8 -5
- package/dist/section/section.js +7 -29
- package/dist/styles.css +5 -0
- package/dist/template/define-template.d.ts +0 -4
- package/dist/template/define-template.js +1 -15
- package/dist/template/logic-build.js +8 -35
- package/dist/template/logic-shim.d.ts +4 -5
- package/dist/template/logic-shim.js +2 -6
- package/dist/template/logic-transform.js +0 -6
- package/dist/template/materialize.js +52 -43
- package/dist/template/mirror-types.js +43 -0
- package/dist/template/running-copy.js +5 -20
- package/dist/template/section-reads.js +83 -0
- package/guide/reference/cli/INDEX.md +12 -6
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +3 -3
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +4 -2
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +26 -13
- package/package.json +4 -2
- package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
- package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
- package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
- package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
- package/dist/schema/fill-spec.d.ts +0 -18
- package/dist/template/reconcile.d.ts +0 -67
- package/dist/template/reconcile.js +0 -25
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { DISPLAY_REF_PREFIX, serializedSlotRefs } from "../schema/slot-ref.js";
|
|
2
|
+
import { fillSpecFromSchema } from "../schema/extract-fill-spec.js";
|
|
3
|
+
|
|
4
|
+
//#region src/template/section-reads.ts
|
|
5
|
+
function isSourcedTarget(schema, slot) {
|
|
6
|
+
if (slot.startsWith("display.")) {
|
|
7
|
+
const entry = slot.slice(DISPLAY_REF_PREFIX.length);
|
|
8
|
+
return schema.meta.display?.[entry]?.source !== void 0;
|
|
9
|
+
}
|
|
10
|
+
return schema.slots[slot]?.source !== void 0;
|
|
11
|
+
}
|
|
12
|
+
function computeReadsOf(schema) {
|
|
13
|
+
const out = [];
|
|
14
|
+
for (const [slot, def] of Object.entries(schema.slots)) for (const ref of serializedSlotRefs(def.source?.reads ?? [])) out.push({
|
|
15
|
+
at: slot,
|
|
16
|
+
ref
|
|
17
|
+
});
|
|
18
|
+
const display = schema.meta.display;
|
|
19
|
+
for (const entry of ["visibility", "variant"]) for (const ref of serializedSlotRefs(display?.[entry]?.source?.reads ?? [])) out.push({
|
|
20
|
+
at: `${DISPLAY_REF_PREFIX}${entry}`,
|
|
21
|
+
ref
|
|
22
|
+
});
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function fillReadsOf(schema) {
|
|
26
|
+
try {
|
|
27
|
+
return fillSpecFromSchema(schema).slot_reads;
|
|
28
|
+
} catch {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function buildReadGraph(sections) {
|
|
33
|
+
const edges = [];
|
|
34
|
+
for (const [key, section] of sections) {
|
|
35
|
+
for (const { at, ref } of computeReadsOf(section.schema)) edges.push({
|
|
36
|
+
from: key,
|
|
37
|
+
to: ref,
|
|
38
|
+
kind: "compute",
|
|
39
|
+
at
|
|
40
|
+
});
|
|
41
|
+
for (const ref of fillReadsOf(section.schema)) edges.push({
|
|
42
|
+
from: key,
|
|
43
|
+
to: ref,
|
|
44
|
+
kind: "fill",
|
|
45
|
+
at: "fill"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const keys = [...sections.keys()];
|
|
49
|
+
const upstream = new Map(keys.map((key) => [key, /* @__PURE__ */ new Set()]));
|
|
50
|
+
for (const edge of edges) {
|
|
51
|
+
if (edge.from === edge.to.section) continue;
|
|
52
|
+
if (!upstream.has(edge.from) || !upstream.has(edge.to.section)) continue;
|
|
53
|
+
upstream.get(edge.from)?.add(edge.to.section);
|
|
54
|
+
}
|
|
55
|
+
const order = [];
|
|
56
|
+
const done = /* @__PURE__ */ new Set();
|
|
57
|
+
const path = [];
|
|
58
|
+
const grey = /* @__PURE__ */ new Set();
|
|
59
|
+
let cycle = [];
|
|
60
|
+
const visit = (key) => {
|
|
61
|
+
if (done.has(key)) return;
|
|
62
|
+
if (grey.has(key)) {
|
|
63
|
+
if (cycle.length === 0) cycle = [...path.slice(path.indexOf(key)), key];
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
grey.add(key);
|
|
67
|
+
path.push(key);
|
|
68
|
+
for (const up of [...upstream.get(key) ?? []].sort()) visit(up);
|
|
69
|
+
path.pop();
|
|
70
|
+
grey.delete(key);
|
|
71
|
+
done.add(key);
|
|
72
|
+
order.push(key);
|
|
73
|
+
};
|
|
74
|
+
for (const key of keys) visit(key);
|
|
75
|
+
return {
|
|
76
|
+
edges,
|
|
77
|
+
order: cycle.length === 0 ? order : keys,
|
|
78
|
+
cycle
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
export { buildReadGraph, computeReadsOf, fillReadsOf, isSourcedTarget };
|
|
@@ -3,7 +3,7 @@ purpose: Every `concrete` command, with its full flag surface, exit codes and co
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# Command reference
|
|
@@ -22,7 +22,7 @@ page. Run `concrete --help` for the same list at the terminal.
|
|
|
22
22
|
| [`upgrade`](upgrade.md) | Move the workspace to a newer @homepages/concrete and run its codemods | `concrete upgrade [--dry-run] [--to <version>]` |
|
|
23
23
|
| [`property list`](property-list.md) | List the sample properties a workspace can copy in | `concrete property list [--no-auto-update]` |
|
|
24
24
|
| [`property add`](property-add.md) | Copy a sample property into this workspace's fixtures/properties/ | `concrete property add <slug> [--no-auto-update]` |
|
|
25
|
-
| [`publish`](publish.md) | Publish the template to HomePages | `concrete publish [--rebuild] [--dry-run] [--json] [--no-auto-update]` |
|
|
25
|
+
| [`publish`](publish.md) | Publish the template to HomePages | `concrete publish [--rebuild] [--dry-run] [--json] [--env-file <path>] [--no-auto-update]` |
|
|
26
26
|
|
|
27
27
|
## Global options
|
|
28
28
|
|
|
@@ -60,20 +60,26 @@ The registry is read at most once per 1 hour per user (the answer is cached unde
|
|
|
60
60
|
that installs the package from somewhere other than the registry — `workspace:*`,
|
|
61
61
|
`file:`, `link:` — is never checked at all.
|
|
62
62
|
|
|
63
|
-
Two switches turn the whole thing off:
|
|
63
|
+
Two switches turn the whole thing off. For one command, the flag:
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
|
|
67
|
-
concrete check --no-auto-update # this one command
|
|
66
|
+
concrete check --no-auto-update
|
|
68
67
|
```
|
|
69
68
|
|
|
69
|
+
For every command in this shell, the environment variable, which each shell spells
|
|
70
|
+
its own way:
|
|
71
|
+
|
|
72
|
+
- bash or zsh: `export HOMEPAGES_NO_AUTO_UPDATE=1`
|
|
73
|
+
- PowerShell: `$env:HOMEPAGES_NO_AUTO_UPDATE = "1"`
|
|
74
|
+
- cmd: `set HOMEPAGES_NO_AUTO_UPDATE=1`
|
|
75
|
+
|
|
70
76
|
Any value except `0` counts as on. `upgrade` is the one command that moves the version
|
|
71
77
|
itself, so nothing runs in front of it — which is also why `--no-auto-update` is not one
|
|
72
78
|
of its flags.
|
|
73
79
|
|
|
74
80
|
## Versions
|
|
75
81
|
|
|
76
|
-
These pages describe `@homepages/concrete` **>=
|
|
82
|
+
These pages describe `@homepages/concrete` **>=6.0.0 <7.0.0**. The range, rather than
|
|
77
83
|
the exact version they were generated from: this reference is committed build output,
|
|
78
84
|
so a page stamped with a patch version would be stale the day it shipped.
|
|
79
85
|
`concrete --version` prints the installed one.
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete build` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete build
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete check` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete check
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete dev` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete dev
|
|
@@ -20,14 +20,14 @@ concrete dev [--port <n>] [--no-auto-update]
|
|
|
20
20
|
|
|
21
21
|
| Flag | Type | Default | What it does |
|
|
22
22
|
|---|---|---|---|
|
|
23
|
-
| `--port <n>` | string | `5180` | Port to serve on. A non-integer or non-positive value falls back to the default |
|
|
23
|
+
| `--port <n>` | string | `5180` | Port to serve on. A non-integer or non-positive value falls back to the default. The editor also opens its module-reload socket at this port + 100, so at most 65435 |
|
|
24
24
|
| `--no-auto-update` | boolean | `false` | Skip the package refresh this command runs first when the workspace is behind the published release |
|
|
25
25
|
|
|
26
26
|
## Exit codes
|
|
27
27
|
|
|
28
28
|
| Code | When |
|
|
29
29
|
|---|---|
|
|
30
|
-
| `0` | the server is interrupted (Ctrl-C, SIGTERM) and shuts down cleanly |
|
|
30
|
+
| `0` | the server is interrupted (Ctrl-C, Ctrl+Break, closing its terminal, SIGTERM) and shuts down cleanly |
|
|
31
31
|
| `1` | the server cannot start |
|
|
32
32
|
|
|
33
33
|
## Constraints
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete property add` command — its flags, exit codes and const
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete property add
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete property list` command — its flags, exit codes and cons
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete property list
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete publish` command — its flags, exit codes and constraint
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete publish
|
|
@@ -13,7 +13,7 @@ Publish the template to HomePages.
|
|
|
13
13
|
## Synopsis
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
concrete publish [--rebuild] [--dry-run] [--json] [--no-auto-update]
|
|
16
|
+
concrete publish [--rebuild] [--dry-run] [--json] [--env-file <path>] [--no-auto-update]
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Flags
|
|
@@ -23,6 +23,7 @@ concrete publish [--rebuild] [--dry-run] [--json] [--no-auto-update]
|
|
|
23
23
|
| `--rebuild` | boolean | `false` | Build the artifact again even when the tree still matches the one on disk |
|
|
24
24
|
| `--dry-run` | boolean | `false` | Upload and verify the artifact, report what publishing would change, and write nothing |
|
|
25
25
|
| `--json` | boolean | `false` | Print the settled publication record on stdout instead of the summary |
|
|
26
|
+
| `--env-file <path>` | string | — | Read `CONCRETE_TOKEN` and `CONCRETE_API_URL` from this dotenv file instead of the workspace's `.env` |
|
|
26
27
|
| `--no-auto-update` | boolean | `false` | Skip the package refresh this command runs first when the workspace is behind the published release |
|
|
27
28
|
|
|
28
29
|
## Exit codes
|
|
@@ -37,6 +38,7 @@ concrete publish [--rebuild] [--dry-run] [--json] [--no-auto-update]
|
|
|
37
38
|
|
|
38
39
|
- The key is the environment: `CONCRETE_TOKEN` names production, staging or dev in its prefix (`cpt_prod_…`), and publish goes where it points. There is no environment flag.
|
|
39
40
|
- Reads `CONCRETE_TOKEN` from the environment, then from the workspace's `.env`. `CONCRETE_API_URL` replaces the endpoint the key's prefix names.
|
|
41
|
+
- `--env-file <path>` names the key file instead, relative to the current directory: its values win over the environment and the workspace's `.env` is not read. It is how a library holding one key file per environment picks one, in any shell.
|
|
40
42
|
- Builds first when it matters: the artifact in `.concrete/build/` is reused while the workspace's files match the ones it was built from, and rebuilt — check included — when they do not.
|
|
41
43
|
- Prints one line per stage on stderr as it settles: target, build, upload, verify, write, adopt.
|
|
42
44
|
- Publishing a tree the environment already holds as current changes nothing, says so, and exits 0. Rolling back is publishing the older tree.
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete upgrade` command — its flags, exit codes and constraint
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete upgrade
|
|
@@ -3,7 +3,7 @@ purpose: Every rule `concrete check` grades, by the stage that grades it, in the
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete rule registry
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=6.0.0 <7.0.0"
|
|
7
7
|
related: [reference/cli/check.md]
|
|
8
8
|
---
|
|
9
9
|
# Rule reference
|
|
@@ -30,6 +30,8 @@ The workspace loads: `template.ts` default-exports a `defineTemplate` value and
|
|
|
30
30
|
| `concrete/workspace/template-invalid` | tree | `template.ts` does not default-export a `defineTemplate` value. |
|
|
31
31
|
| `concrete/workspace/module-invalid` | tree | A workspace module fails to build or throws when it is evaluated. |
|
|
32
32
|
| `concrete/workspace/duplicate-section-key` | tree | Two different exported sections declare the same key. |
|
|
33
|
+
| `concrete/workspace/crlf-text` | tree | A text file in the workspace has CRLF line endings, so the same commit would build a different version than an LF checkout. |
|
|
34
|
+
| `concrete/workspace/unportable-name` | tree | A source file name, the template key, a section key or a fixture id would not name the same file on Windows and macOS: two differ only by case or Unicode form, or one is a reserved device name (`con`, `nul`, `com1`…), ends in a dot or a space, or carries a character Windows refuses in a file name (`:`, `\`, `?`, `*`, a control character…). A key or id must also be NFC. |
|
|
33
35
|
|
|
34
36
|
## typecheck
|
|
35
37
|
|
|
@@ -75,7 +77,18 @@ Each page is rendered once under the page probe, and the composition it places p
|
|
|
75
77
|
|---|---|---|
|
|
76
78
|
| `concrete/pages/non-section-markup` | probe | A page emits markup that is not a section; a page may contain only sections. |
|
|
77
79
|
| `concrete/pages/section-not-exported` | probe | A page places a section no module exports, so the build cannot bundle it alone. |
|
|
78
|
-
| `concrete/pages/composition-invalid` | probe | The composition the pages place breaks a page, canvas
|
|
80
|
+
| `concrete/pages/composition-invalid` | probe | The composition the pages place breaks a page, canvas or instance rule. |
|
|
81
|
+
|
|
82
|
+
## relations
|
|
83
|
+
|
|
84
|
+
What one placed section's declarations read off another: the sections are placed, the graph is a DAG, and no fill reads a computed value.
|
|
85
|
+
|
|
86
|
+
| Rule | Venue | What it requires |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `concrete/relations/section-cycle` | probe | The placed sections read each other in a loop; a template's sections form a DAG. |
|
|
89
|
+
| `concrete/relations/unplaced-read` | probe | A declaration reads a section no page places, so the read resolves to no instance. |
|
|
90
|
+
| `concrete/relations/fill-reads-computed` | probe | A fill decision reads a sourced slot (a fact, a `compute()` or a mirror), which settles only after every fill has run. |
|
|
91
|
+
| `concrete/relations/mirror-type` | probe | A slot mirroring another slot holds a different kind of value than its upstream. |
|
|
79
92
|
|
|
80
93
|
## stylesheet
|
|
81
94
|
|
|
@@ -90,13 +103,11 @@ The CSS import graph of `template.ts` compiles into the template stylesheet exac
|
|
|
90
103
|
|
|
91
104
|
## logic
|
|
92
105
|
|
|
93
|
-
Every placed section's logic bundle
|
|
106
|
+
Every placed section's logic bundle builds exactly as `build` builds it.
|
|
94
107
|
|
|
95
108
|
| Rule | Venue | What it requires |
|
|
96
109
|
|---|---|---|
|
|
97
110
|
| `concrete/logic/section-build-failed` | tree | A placed section's logic bundle fails to build, as when React reaches it through a compute closure. |
|
|
98
|
-
| `concrete/logic/template-build-failed` | tree | The template's logic bundle fails to build or to evaluate. |
|
|
99
|
-
| `concrete/logic/reconcile-not-exported` | tree | `defineTemplate` is handed reconcile rules `template.ts` does not export as `reconcile`, so the logic bundle drops them. |
|
|
100
111
|
|
|
101
112
|
## fixtures
|
|
102
113
|
|
|
@@ -129,18 +140,20 @@ Every placed section's schema and fill spec satisfy the contract assertions publ
|
|
|
129
140
|
|
|
130
141
|
| Rule | Venue | What it requires |
|
|
131
142
|
|---|---|---|
|
|
132
|
-
| `concrete/contract/reads-readable` | contract | Every fact
|
|
143
|
+
| `concrete/contract/reads-readable` | contract | Every fact a section reads is one the fact registry declares. |
|
|
144
|
+
| `concrete/contract/decision-kind` | contract | Every fill decision names a kind the platform runs: text, pick, list or display. |
|
|
133
145
|
| `concrete/contract/produces-known-slot` | contract | Every fill decision produces only slots the section declares. |
|
|
134
146
|
| `concrete/contract/poi-curation` | contract | A points-of-interest curation decision produces exactly one slot, a list of points of interest. |
|
|
135
|
-
| `concrete/contract/list-fill` | contract | A list fill declares what
|
|
136
|
-
| `concrete/contract/choose-select` | contract | A
|
|
137
|
-
| `concrete/contract/name-title` | contract | A
|
|
138
|
-
| `concrete/contract/pooling-field` | contract | A list fill's item declares at most one unbound pooled asset field
|
|
139
|
-
| `concrete/contract/row-fill` | contract | A list fill plans only unbound fields its record item declares, each
|
|
147
|
+
| `concrete/contract/list-fill` | contract | A list fill declares what the slot's own origination needs: a brief where the model originates rows, a bound where it writes them, nothing on a fact-bound list. |
|
|
148
|
+
| `concrete/contract/choose-select` | contract | A record list the model originates is keyed by its title field, else by exactly one select field with declared values. |
|
|
149
|
+
| `concrete/contract/name-title` | contract | A list keyed by a written name needs that field to be capped text that carries no fill of its own. |
|
|
150
|
+
| `concrete/contract/pooling-field` | contract | A list fill's record item declares at most one unbound pooled asset field. |
|
|
151
|
+
| `concrete/contract/row-fill` | contract | A list fill plans only unbound fields its record item declares, each of a type a row can be filled with. |
|
|
140
152
|
| `concrete/contract/count-bounds` | contract | Every item count a decision requests fits the bounds of the slot or row field that holds the items. |
|
|
141
153
|
| `concrete/contract/cap` | contract | Every generated text value has one character budget, declared on its slot, and a fill cap may only be lower. |
|
|
154
|
+
| `concrete/contract/writer-reads-fact` | contract | A fill that writes text, its row fields included, reads at least one fact to ground what it writes. |
|
|
142
155
|
| `concrete/contract/display` | contract | Display entries declare one origin and legal cases, and every slot variant gate names a declared case. |
|
|
143
|
-
| `concrete/contract/display-evidence` | contract | A filled display entry
|
|
156
|
+
| `concrete/contract/display-evidence` | contract | A filled display entry has a declared fact read to judge its case from. |
|
|
144
157
|
| `concrete/contract/source` | contract | Every slot and row field source names a known fact or its own compute binding, with a legal writeback. |
|
|
145
158
|
| `concrete/contract/record-collection` | contract | A fact-bound record list binds a registry collection and may only narrow its membership bounds. |
|
|
146
159
|
| `concrete/contract/nested-slot-types` | contract | Every field of a record item carries a known slot type. |
|
|
@@ -150,7 +163,7 @@ Every placed section's schema and fill spec satisfy the contract assertions publ
|
|
|
150
163
|
| `concrete/contract/url` | contract | A url slot's accepts names a link kind or provider that a registered provider implements. |
|
|
151
164
|
| `concrete/contract/source-filter` | contract | A media slot's source filter names a filter the platform supports. |
|
|
152
165
|
| `concrete/contract/sources` | contract | Only a video slot declares sources, as a non-empty list of distinct known video sources. |
|
|
153
|
-
| `concrete/contract/interpolation` | contract |
|
|
166
|
+
| `concrete/contract/interpolation` | contract | A fill brief refers to its facts through reads and never interpolates one. |
|
|
154
167
|
| `concrete/contract/group` | contract | Group ids are unique, every group names real slots, and no slot sits in two groups. |
|
|
155
168
|
| `concrete/contract/row` | contract | Every two-up row pairs adjacent short slots, and a record item's layout lists each field exactly once. |
|
|
156
169
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homepages/concrete",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Concrete, the HomePages template framework: the authoring API, the contract primitives, the styles, the lint preset and the `concrete` command in one package that owns its whole toolchain.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"optionalDependencies": {
|
|
88
88
|
"sharp": "^0.35.3"
|
|
89
89
|
},
|
|
90
|
-
"$comment:devDependencies": "Every `@homepages/*` entry is a private workspace package compiled INTO dist by tsdown, which externalizes only dependencies, peerDependencies and optionalDependencies: nothing about them survives into a consumer's dependency graph, and the packed tarball declares no `workspace:*` edge in any block a consumer installs (src/package-boundary.test.ts). The set is every internal package the old kit and CLI inline, declared here once so the command, check, dev and build modules that follow reach them without a manifest change; a module the shipped entries do not reach today is simply not in dist yet.",
|
|
90
|
+
"$comment:devDependencies": "Every `@homepages/*` entry is a private workspace package compiled INTO dist by tsdown, which externalizes only dependencies, peerDependencies and optionalDependencies: nothing about them survives into a consumer's dependency graph, and the packed tarball declares no `workspace:*` edge in any block a consumer installs (src/package-boundary.test.ts). The set is every internal package the old kit and CLI inline, declared here once so the command, check, dev and build modules that follow reach them without a manifest change; a module the shipped entries do not reach today is simply not in dist yet. One entry is never inlined: `@homepages/portability-lint` is imported by eslint.config.mjs alone, the lint rules that grade this package's own source.",
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
93
93
|
"@eslint/js": "^10.0.1",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"@homepages/image-descriptor": "workspace:*",
|
|
104
104
|
"@homepages/image-ladder": "workspace:*",
|
|
105
105
|
"@homepages/internal-refs": "workspace:*",
|
|
106
|
+
"@homepages/portability-lint": "workspace:*",
|
|
106
107
|
"@homepages/island-runtime": "workspace:*",
|
|
107
108
|
"@homepages/media-library": "workspace:*",
|
|
108
109
|
"@homepages/modal": "workspace:*",
|
|
@@ -130,6 +131,7 @@
|
|
|
130
131
|
"tsdown": "0.22.7",
|
|
131
132
|
"tsx": "^4.19.2",
|
|
132
133
|
"typescript-eslint": "^8.60.1",
|
|
134
|
+
"yaml": "^2.9.0",
|
|
133
135
|
"zustand": "^5.0.14"
|
|
134
136
|
}
|
|
135
137
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region ../../internal/fact-interpolation/dist/index.js
|
|
2
|
-
/**
|
|
3
|
-
* The one namespace root a reference may name — the section's relevance slice.
|
|
4
|
-
* Any other root is a miss (see `resolvePath`), so a validator over
|
|
5
|
-
* `extractPaths` reads this rather than restating the literal.
|
|
6
|
-
*/
|
|
7
|
-
const NAMESPACE = "facts";
|
|
8
|
-
const PATTERN = /\$\{([a-zA-Z_][\w.]*)\}/g;
|
|
9
|
-
/**
|
|
10
|
-
* Every `${namespace.path}` reference in `template`, in source order, with its
|
|
11
|
-
* namespace prefix intact and duplicates preserved. Shares `interpolate`'s own
|
|
12
|
-
* pattern, which is the point: a validator built on this sees exactly the
|
|
13
|
-
* references `interpolate` would go on to resolve, so neither can see one the
|
|
14
|
-
* other misses. Text carrying no reference (or no text) yields `[]`.
|
|
15
|
-
*/
|
|
16
|
-
function extractPaths(template) {
|
|
17
|
-
if (!template) return [];
|
|
18
|
-
return [...template.matchAll(PATTERN)].map((m) => m[1]);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { NAMESPACE, extractPaths };
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { buildDeriveFactsView } from "../../property-facts/dist/derive-facts-view.js";
|
|
2
|
-
import { isSlotOverridden } from "../../template-contracts/dist/slot-overrides.js";
|
|
3
|
-
|
|
4
|
-
//#region ../../internal/fill-bake/dist/reconcile-cross-section.js
|
|
5
|
-
function buildSite(doc, instances) {
|
|
6
|
-
const byInstanceId = new Map(doc.instances.map((inst) => [inst.instance_id, inst]));
|
|
7
|
-
const site = {};
|
|
8
|
-
for (const { key, instanceId } of instances) site[key] = { ...byInstanceId.get(instanceId)?.slots };
|
|
9
|
-
return site;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Wraps each section's slot bag in a read-tracing Proxy, warning once per slot when
|
|
13
|
-
* a rule reads something it did not declare in `reads`. The declaration drives the
|
|
14
|
-
* editor's propagate trigger, so a drifted one silently stops a user edit from
|
|
15
|
-
* re-running this rule, and this is what keeps that observable rather than silent.
|
|
16
|
-
*
|
|
17
|
-
* Warn-only: it never throws and never alters an edit, matching how this interpreter
|
|
18
|
-
* already treats a rule that throws or returns malformed data. Reading a whole
|
|
19
|
-
* section (`{...site.slider}`, `Object.values(site.slider)`) trips the trap for every
|
|
20
|
-
* key, so a spread-style rule over-reports — acceptable, and it pushes authors toward
|
|
21
|
-
* over-declaring, which costs one extra propagate job rather than a stale page.
|
|
22
|
-
*/
|
|
23
|
-
function traceReads(site, instances, rule, log) {
|
|
24
|
-
if (!rule.reads) return site;
|
|
25
|
-
const instanceIdByKey = new Map(instances.map((i) => [i.key, i.instanceId]));
|
|
26
|
-
const declared = new Set(rule.reads.map((r) => `${r.instanceId} ${r.slot}`));
|
|
27
|
-
const warned = /* @__PURE__ */ new Set();
|
|
28
|
-
const traced = {};
|
|
29
|
-
for (const [key, slots] of Object.entries(site)) {
|
|
30
|
-
const instanceId = instanceIdByKey.get(key);
|
|
31
|
-
traced[key] = new Proxy(slots, { get(target, prop, receiver) {
|
|
32
|
-
if (typeof prop === "string" && instanceId !== void 0) {
|
|
33
|
-
const id = `${instanceId} ${prop}`;
|
|
34
|
-
if (!declared.has(id) && !warned.has(id)) {
|
|
35
|
-
warned.add(id);
|
|
36
|
-
log?.warn({
|
|
37
|
-
event: "reconcile_undeclared_read",
|
|
38
|
-
rule: rule.description,
|
|
39
|
-
instance_id: instanceId,
|
|
40
|
-
slot: prop
|
|
41
|
-
}, "reconcile: rule read a slot absent from its `reads` declaration; an editor edit to that slot will not re-run this rule");
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return Reflect.get(target, prop, receiver);
|
|
45
|
-
} });
|
|
46
|
-
}
|
|
47
|
-
return traced;
|
|
48
|
-
}
|
|
49
|
-
function isEdit(candidate) {
|
|
50
|
-
if (candidate === null || typeof candidate !== "object") return false;
|
|
51
|
-
const edit = candidate;
|
|
52
|
-
if (typeof edit.instanceId !== "string" || edit.instanceId === "") return false;
|
|
53
|
-
if (edit.op === "hide") return true;
|
|
54
|
-
return edit.op === "set" && typeof edit.slot === "string" && edit.slot !== "";
|
|
55
|
-
}
|
|
56
|
-
function applyEdits(doc, edits, rule, log) {
|
|
57
|
-
const known = new Set(doc.instances.map((inst) => inst.instance_id));
|
|
58
|
-
const setInstanceIds = [];
|
|
59
|
-
let instances = doc.instances;
|
|
60
|
-
let changed = false;
|
|
61
|
-
for (const edit of edits) {
|
|
62
|
-
if (!known.has(edit.instanceId)) {
|
|
63
|
-
log?.warn({
|
|
64
|
-
event: "reconcile_unknown_instance",
|
|
65
|
-
rule: rule.description,
|
|
66
|
-
instance_id: edit.instanceId
|
|
67
|
-
}, "reconcile: edit names an instance absent from the content_doc; skipped");
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
instances = instances.map((inst) => {
|
|
71
|
-
if (inst.instance_id !== edit.instanceId) return inst;
|
|
72
|
-
if (edit.op === "hide") {
|
|
73
|
-
if (!inst.enabled) return inst;
|
|
74
|
-
changed = true;
|
|
75
|
-
return {
|
|
76
|
-
...inst,
|
|
77
|
-
enabled: false
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (isSlotOverridden(inst.slot_overrides, edit.slot)) {
|
|
81
|
-
log?.debug({
|
|
82
|
-
event: "reconcile_skipped_overridden_slot",
|
|
83
|
-
rule: rule.description,
|
|
84
|
-
instance_id: edit.instanceId,
|
|
85
|
-
slot: edit.slot
|
|
86
|
-
}, "reconcile: target slot carries a user override marker; edit skipped");
|
|
87
|
-
return inst;
|
|
88
|
-
}
|
|
89
|
-
changed = true;
|
|
90
|
-
setInstanceIds.push(inst.instance_id);
|
|
91
|
-
return {
|
|
92
|
-
...inst,
|
|
93
|
-
slots: {
|
|
94
|
-
...inst.slots,
|
|
95
|
-
[edit.slot]: edit.value
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return changed ? {
|
|
101
|
-
contentDoc: {
|
|
102
|
-
...doc,
|
|
103
|
-
instances
|
|
104
|
-
},
|
|
105
|
-
changed,
|
|
106
|
-
setInstanceIds
|
|
107
|
-
} : {
|
|
108
|
-
contentDoc: doc,
|
|
109
|
-
changed: false,
|
|
110
|
-
setInstanceIds: []
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Runs a template's reconcile rules over the merged content_doc, in order, each
|
|
115
|
-
* against the previous rule's output. Pure: returns a new document (or the same
|
|
116
|
-
* reference when nothing changed) and never mutates its input.
|
|
117
|
-
*
|
|
118
|
-
* A rule that throws is skipped with a warning rather than failing the job —
|
|
119
|
-
* reconciliation is fill-time repair, not an invariant, and losing one repair is
|
|
120
|
-
* strictly better than losing the whole generated website.
|
|
121
|
-
*/
|
|
122
|
-
function applyReconcile(doc, facts, logicModule, log) {
|
|
123
|
-
let cur = doc;
|
|
124
|
-
let changed = false;
|
|
125
|
-
const setInstanceIds = /* @__PURE__ */ new Set();
|
|
126
|
-
for (const rule of logicModule.reconcile) {
|
|
127
|
-
let produced;
|
|
128
|
-
try {
|
|
129
|
-
const site = traceReads(buildSite(cur, logicModule.instances), logicModule.instances, rule, log);
|
|
130
|
-
produced = rule.fn({
|
|
131
|
-
site,
|
|
132
|
-
page: site,
|
|
133
|
-
facts
|
|
134
|
-
});
|
|
135
|
-
} catch (err) {
|
|
136
|
-
log?.warn({
|
|
137
|
-
event: "reconcile_rule_threw",
|
|
138
|
-
rule: rule.description,
|
|
139
|
-
err
|
|
140
|
-
}, "reconcile: authored rule threw; skipped");
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (!Array.isArray(produced)) {
|
|
144
|
-
log?.warn({
|
|
145
|
-
event: "reconcile_rule_bad_return",
|
|
146
|
-
rule: rule.description
|
|
147
|
-
}, "reconcile: authored rule did not return an array of edits; skipped");
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
const edits = produced.filter(isEdit);
|
|
151
|
-
if (edits.length !== produced.length) log?.warn({
|
|
152
|
-
event: "reconcile_malformed_edit",
|
|
153
|
-
rule: rule.description
|
|
154
|
-
}, "reconcile: authored rule returned a malformed edit; dropped");
|
|
155
|
-
const applied = applyEdits(cur, edits, rule, log);
|
|
156
|
-
if (applied.changed) {
|
|
157
|
-
cur = applied.contentDoc;
|
|
158
|
-
changed = true;
|
|
159
|
-
for (const id of applied.setInstanceIds) setInstanceIds.add(id);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
contentDoc: cur,
|
|
164
|
-
changed,
|
|
165
|
-
setInstanceIds: [...setInstanceIds]
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
//#endregion
|
|
170
|
-
export { applyReconcile };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//#region ../../internal/fill-vocabulary/dist/facts.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Canonical top-level ARRAY fields a fill-spec decision may `iterate:` over.
|
|
4
|
-
*
|
|
5
|
-
* `videos` is the hosted-video candidate pool and is iterable — a
|
|
6
|
-
* video_collection section renders N videos, exactly the shape `iterate:`
|
|
7
|
-
* exists for. It is deliberately absent from `FACTS_READABLE`: nothing grounds
|
|
8
|
-
* prose on the pool yet, and `reads: videos` is additive to legalize later.
|
|
9
|
-
*/
|
|
10
|
-
declare const FACTS_ARRAY_FIELDS: readonly ["units", "photos", "videos", "floor_plans", "contacts", "tours", "comparables"];
|
|
11
|
-
/** An iterable property-facts array — one of `FACTS_ARRAY_FIELDS`. */
|
|
12
|
-
type IterableFactsField = (typeof FACTS_ARRAY_FIELDS)[number];
|
|
13
|
-
/**
|
|
14
|
-
* The facts keys an author may name in a fill-spec's `reads`, and therefore
|
|
15
|
-
* the keys the fill executor's relevance slice carries on demand. The two are
|
|
16
|
-
* one set on purpose: a key legal to declare but absent from the slice
|
|
17
|
-
* validates and then grounds nothing.
|
|
18
|
-
*
|
|
19
|
-
* `tours` is BOTH readable and iterable — a section may ground prose on it and
|
|
20
|
-
* may `iterate:` it to render one row per 3D tour on the property.
|
|
21
|
-
*
|
|
22
|
-
* `comparables` is both as well: a pricing-strategy narrative grounds its prose
|
|
23
|
-
* on the rows (`reads: ["comparables"]`), and a comps table renders one row per
|
|
24
|
-
* comparable. The numbers on such a slide are never written by fill — they are
|
|
25
|
-
* a `compute()` over the same rows — which is exactly why the rows themselves
|
|
26
|
-
* must be readable.
|
|
27
|
-
*/
|
|
28
|
-
declare const FACTS_READABLE: readonly ["tours", "floor_plans", "photos", "comparables"];
|
|
29
|
-
/** A facts key an author may declare in `reads` — one of `FACTS_READABLE`. */
|
|
30
|
-
type ReadableFactsKey = (typeof FACTS_READABLE)[number];
|
|
31
|
-
//#endregion
|
|
32
|
-
export { FACTS_ARRAY_FIELDS, FACTS_READABLE, IterableFactsField, ReadableFactsKey };
|