@homepages/concrete 11.0.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +203 -0
- package/README.md +8 -10
- package/codemods/fixtures-are-data.mjs +7 -0
- package/codemods/fixtures-list-properties.mjs +6 -0
- package/codemods/manifest.json +17 -0
- package/codemods/steps/fixtures-list-properties.mjs +16 -0
- package/codemods/steps/fixtures-to-data.mjs +41 -0
- package/dist/artifact/playground/client/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/dist/artifact/playground/client/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/dist/artifact/playground/client/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +1338 -0
- package/dist/artifact/playground/client/assets/index-C01UCAWD.css +1 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
- package/dist/artifact/playground/host.mjs +110 -60
- package/dist/base.css +19 -59
- package/dist/cli/build/icons.js +1 -1
- package/dist/cli/build/index.js +11 -10
- package/dist/cli/build/manifest.js +44 -0
- package/dist/cli/build/record.js +123 -0
- package/dist/cli/build/sections.js +28 -18
- package/dist/cli/build/source.js +1 -1
- package/dist/cli/build/static.js +8 -5
- package/dist/cli/build/template-build.js +614 -0
- package/dist/cli/check/analyze.js +18 -1
- package/dist/cli/check/load-workspace.js +2 -2
- package/dist/cli/check/portable-names.js +1 -1
- package/dist/cli/check/render/corpus.js +119 -0
- package/dist/cli/check/render/invariants.js +1 -0
- package/dist/cli/check/stages/bundles.js +15 -18
- package/dist/cli/check/stages/composition.js +8 -25
- package/dist/cli/check/stages/fixtures.js +14 -10
- package/dist/cli/check/stages/logic.js +7 -23
- package/dist/cli/check/stages/render.js +12 -14
- package/dist/cli/check/stages/sections.js +22 -66
- package/dist/cli/check/stages/stylesheet.js +4 -26
- package/dist/cli/check/stages/workspace.js +27 -22
- package/dist/cli/commands.js +51 -23
- package/dist/cli/currency/preamble.js +1 -1
- package/dist/cli/currency/resolve-latest.js +3 -2
- package/dist/cli/dev/capture-browser.js +26 -0
- package/dist/cli/dev/fixture-schema.js +441 -0
- package/dist/cli/dev/folder-files.js +244 -0
- package/dist/cli/dev/index.js +7 -3
- package/dist/cli/dev/playground-server.js +34 -0
- package/dist/cli/dev/section-ladders.js +76 -0
- package/dist/cli/dev/server.js +120 -304
- package/dist/cli/install/background.js +16 -0
- package/dist/cli/install/index.js +45 -0
- package/dist/cli/install/tools.js +27 -0
- package/dist/cli/media/derive.js +19 -13
- package/dist/cli/media/deriver-plugin.js +14 -3
- package/dist/cli/property/fixture-list.js +46 -0
- package/dist/cli/property/index.js +12 -9
- package/dist/cli/property/library.js +12 -10
- package/dist/cli/publish/artifact.js +90 -0
- package/dist/cli/publish/captures.js +61 -0
- package/dist/cli/publish/fixtures.js +17 -0
- package/dist/cli/publish/index.js +10 -18
- package/dist/cli/{build → publish}/playground.js +3 -3
- package/dist/cli/publish/report.js +15 -33
- package/dist/cli/upgrade/codemod.d.ts +14 -0
- package/dist/cli/upgrade/fixture-conversion.d.ts +11 -0
- package/dist/cli/upgrade/fixture-conversion.js +54 -0
- package/dist/cli/upgrade/fixture-modules.js +125 -0
- package/dist/cli/upgrade/fixtures-to-data.d.ts +40 -0
- package/dist/cli/upgrade/fixtures-to-data.js +498 -0
- package/dist/cli/upgrade/index.js +18 -2
- package/dist/cli/upgrade/legacy-fixtures.d.ts +34 -0
- package/dist/cli/upgrade/legacy-fixtures.js +22 -0
- package/dist/cli/upgrade/stage.js +1 -1
- package/dist/cli/workspace-fixtures.js +80 -0
- package/dist/cli.js +1 -0
- package/dist/css/compile.js +9 -3
- package/dist/fixtures/bundle-rule.js +16 -16
- package/dist/fixtures/media-plugin.js +12 -33
- package/dist/fixtures/synthesize-empties.js +3 -2
- package/dist/index.d.ts +7 -7
- package/dist/{playground-island-runtime.d.ts → island-runtime.d.ts} +1 -2
- package/dist/{playground-island-runtime.js → island-runtime.js} +1 -2
- package/dist/islands/client-module.js +1 -1
- package/dist/{cli/dev → islands}/tsconfig-paths.js +2 -14
- package/dist/islands/wrap.js +40 -0
- package/dist/node_modules/.pnpm/acorn@8.18.0/node_modules/acorn/dist/acorn.js +5119 -0
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/bundle-evaluation/dist/cache.js +36 -0
- package/dist/packages/internal/bundle-evaluation/dist/evaluate.js +174 -0
- package/dist/packages/internal/bundle-evaluation/dist/index.js +5 -0
- package/dist/packages/internal/bundle-evaluation/dist/section-code.js +10 -0
- package/dist/packages/internal/capture-settle/dist/index.js +2 -2
- package/dist/packages/internal/capture-settle/dist/settle.js +88 -13
- package/dist/packages/internal/code-fingerprint/dist/index.js +57 -0
- package/dist/packages/internal/content-doc-ops/dist/index.js +176 -0
- package/dist/packages/internal/content-doc-ops/dist/made-rows.js +15 -0
- package/dist/packages/internal/deliverable-reads/dist/bootstrap.js +81 -0
- package/dist/packages/internal/deliverable-reads/dist/display.js +21 -0
- package/dist/packages/internal/deliverable-reads/dist/format.js +15 -0
- package/dist/packages/internal/deliverable-reads/dist/index.js +7 -0
- package/dist/packages/internal/deliverable-reads/dist/pages.js +29 -0
- package/dist/packages/internal/deliverable-reads/dist/requirements.js +72 -0
- package/dist/{cli/capture → packages/internal/download-files/dist}/bundle.js +8 -4
- package/dist/packages/internal/download-files/dist/capture-origin.js +126 -0
- package/dist/packages/internal/download-files/dist/capture-routes.js +139 -0
- package/dist/packages/internal/download-files/dist/capture-shell.js +38 -0
- package/dist/packages/internal/download-files/dist/capture.js +74 -0
- package/dist/packages/internal/download-files/dist/egress-watch.js +38 -0
- package/dist/packages/internal/download-files/dist/files.js +7 -0
- package/dist/packages/internal/download-files/dist/finish.js +35 -0
- package/dist/packages/internal/download-files/dist/fleet.js +94 -0
- package/dist/packages/internal/download-files/dist/format.js +40 -0
- package/dist/packages/internal/download-files/dist/make.js +105 -0
- package/dist/packages/internal/download-files/dist/master-tally.js +32 -0
- package/dist/packages/internal/download-files/dist/names.js +24 -0
- package/dist/packages/internal/download-files/dist/pdf-boxes.js +33 -0
- package/dist/packages/internal/download-files/dist/pdf-image-placements.js +194 -0
- package/dist/packages/internal/download-files/dist/pdf-images.js +289 -0
- package/dist/packages/internal/file-store/dist/files.js +8 -0
- package/dist/packages/internal/file-store/dist/lru.js +40 -0
- package/dist/packages/internal/file-store/dist/refusal.js +12 -0
- package/dist/packages/internal/file-store/dist/trees.js +151 -0
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +48 -22
- package/dist/packages/internal/fill-bake/dist/held-rows.js +2 -0
- package/dist/packages/internal/fill-bake/dist/index.js +6 -1
- package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -3
- package/dist/packages/internal/fill-bake/dist/resolve-instance.js +9 -0
- package/dist/packages/internal/fill-bake/dist/resolve.js +3 -0
- package/dist/packages/internal/fill-bake/dist/round-trip.js +2 -0
- package/dist/packages/internal/fill-bake/dist/strip.js +6 -0
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +1 -1
- package/dist/packages/internal/format-geometry/dist/capture.js +3 -11
- package/dist/packages/internal/format-geometry/dist/format.d.ts +2 -8
- package/dist/packages/internal/format-geometry/dist/geometry.js +2 -13
- package/dist/packages/internal/island-runtime/dist/index.js +1 -10
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +5 -0
- package/dist/packages/internal/lead-fields/dist/ingest.js +72 -0
- package/dist/packages/internal/media-resolution/dist/video.js +6 -2
- package/dist/packages/internal/page-render/dist/addresses.js +57 -0
- package/dist/packages/internal/page-render/dist/index.js +6 -0
- package/dist/packages/internal/page-render/dist/kept.js +30 -0
- package/dist/packages/internal/page-render/dist/nav.js +42 -0
- package/dist/packages/internal/page-render/dist/render.js +152 -0
- package/dist/packages/internal/page-shell/dist/assemble.js +161 -0
- package/dist/packages/internal/page-shell/dist/escape.js +10 -0
- package/dist/packages/internal/page-shell/dist/frame.js +23 -0
- package/dist/packages/internal/page-shell/dist/index.js +26 -0
- package/dist/packages/internal/playground/dist/build-fingerprint.js +18 -0
- package/dist/packages/internal/playground/dist/fixture-conversions/list-names-properties.js +76 -0
- package/dist/packages/internal/playground/dist/fixture-formats.d.ts +37 -0
- package/dist/packages/internal/playground/dist/fixture-formats.js +20 -0
- package/dist/packages/internal/playground/dist/host/bootstrap.js +108 -0
- package/dist/packages/internal/playground/dist/host/built.js +202 -0
- package/dist/packages/internal/playground/dist/host/catalog-fixture.js +53 -0
- package/dist/packages/internal/playground/dist/host/download.js +34 -0
- package/dist/packages/internal/playground/dist/host/env.js +11 -0
- package/dist/packages/internal/playground/dist/host/everywhere-saves.js +353 -0
- package/dist/packages/internal/playground/dist/host/fixture-addresses.js +52 -0
- package/dist/packages/internal/playground/dist/host/fixture-documents.js +494 -0
- package/dist/packages/internal/playground/dist/host/fixture-operations.js +364 -0
- package/dist/packages/internal/playground/dist/host/fixture-units.js +93 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/image-dimensions.js +1 -1
- package/dist/packages/internal/playground/dist/host/leads.js +41 -0
- package/dist/packages/internal/playground/dist/host/media-saves.js +309 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/media-store.js +79 -26
- package/dist/packages/internal/playground/dist/host/overridable.js +9 -0
- package/dist/packages/internal/playground/dist/host/owned-saves.js +203 -0
- package/dist/{playground → packages/internal/playground/dist}/host/page-state.js +1 -1
- package/dist/packages/internal/playground/dist/host/program.js +54 -0
- package/dist/packages/internal/playground/dist/host/property-derive.js +216 -0
- package/dist/packages/internal/playground/dist/host/property-saves.js +74 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/property.js +88 -229
- package/dist/packages/internal/playground/dist/host/provenance.js +49 -0
- package/dist/packages/internal/playground/dist/host/resolve.js +553 -0
- package/dist/packages/internal/playground/dist/host/row-images.js +41 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/rows.js +1 -1
- package/dist/packages/internal/playground/dist/host/save.js +429 -0
- package/dist/packages/internal/playground/dist/host/serve.js +952 -0
- package/dist/packages/internal/playground/dist/host/site.js +79 -0
- package/dist/packages/internal/playground/dist/host/slots.js +202 -0
- package/dist/packages/internal/playground/dist/host/stated-content.js +93 -0
- package/dist/packages/internal/playground/dist/host/stored-fixtures.js +135 -0
- package/dist/packages/internal/playground/dist/host/violations.js +7 -0
- package/dist/packages/internal/playground/dist/jobs/lanes.js +24 -0
- package/dist/packages/internal/playground/dist/jobs/memory-queue.js +112 -0
- package/dist/packages/internal/playground/dist/jobs/probe.js +37 -0
- package/dist/packages/internal/playground/dist/jobs/queue.js +28 -0
- package/dist/packages/internal/playground/dist/jobs/runner.js +207 -0
- package/dist/packages/internal/playground/dist/layout.js +14 -0
- package/dist/packages/internal/playground/dist/platform.js +33 -0
- package/dist/packages/internal/playground/dist/server/changes.js +57 -0
- package/dist/packages/internal/playground/dist/server/crop.js +47 -0
- package/dist/packages/internal/playground/dist/server/derived-files.js +88 -0
- package/dist/packages/internal/playground/dist/server/download.js +158 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/http.js +4 -12
- package/dist/packages/internal/playground/dist/server/jobs.js +29 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/listen.js +4 -11
- package/dist/packages/internal/playground/dist/server/playground-server.js +424 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/request-error.js +1 -1
- package/dist/packages/internal/playground/dist/server/size-ladders.js +170 -0
- package/dist/packages/internal/playground/dist/server/verification.js +75 -0
- package/dist/packages/internal/playground/dist/server/verify-build.js +139 -0
- package/dist/packages/internal/playground/dist/wire.js +78 -0
- package/dist/packages/internal/property-facts/dist/registry-facts.js +1 -1
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
- package/dist/packages/internal/site-files/dist/head.js +59 -0
- package/dist/packages/internal/site-files/dist/index.js +4 -0
- package/dist/packages/internal/site-files/dist/site.js +211 -0
- package/dist/packages/internal/static-assets-binding/dist/index.js +32 -0
- package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +38 -5
- package/dist/packages/internal/template-artifact/dist/asset-mime.js +8 -1
- package/dist/packages/internal/template-artifact/dist/build.js +148 -0
- package/dist/packages/internal/template-artifact/dist/composition.js +62 -0
- package/dist/packages/internal/template-artifact/dist/index.js +2 -2
- package/dist/packages/internal/template-artifact/dist/layout.js +48 -12
- package/dist/packages/internal/template-artifact/dist/manifest.js +3 -10
- package/dist/packages/internal/template-artifact/dist/verify.js +51 -31
- package/dist/packages/internal/template-contracts/dist/address-value.js +6 -1
- package/dist/packages/internal/template-contracts/dist/content-categories.js +10 -1
- package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +59 -32
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +14 -1
- package/dist/packages/internal/template-contracts/dist/list.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/media-candidates.js +67 -2
- package/dist/packages/internal/template-contracts/dist/media-offer.js +180 -0
- package/dist/packages/internal/template-contracts/dist/object.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +9 -2
- package/dist/packages/internal/template-contracts/dist/read-graph.js +36 -2
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +16 -1
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +9 -10
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +12 -1
- package/dist/packages/internal/template-contracts/dist/registry-graph.js +112 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +15 -2
- package/dist/packages/internal/template-contracts/dist/require-graph.js +300 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/row.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +1 -1
- package/dist/{schema → packages/internal/template-contracts/dist}/section-nav.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +4 -4
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +3 -1
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +24 -1
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +26 -1
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/table-members.js +7 -2
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
- package/dist/packages/internal/upload-formats/dist/heic.js +35 -0
- package/dist/packages/internal/upload-formats/dist/index.js +80 -0
- package/dist/packages/internal/upload-formats/dist/magic-bytes.js +293 -0
- package/dist/platform/paths.js +1 -0
- package/dist/platform/process.js +49 -1
- package/dist/primitives/FrameShell.d.ts +5 -2
- package/dist/primitives/FrameShell.js +2 -1
- package/dist/rules/registry.js +28 -4
- package/dist/schema/fact.d.ts +2 -2
- package/dist/schema/facts-view.d.ts +1 -1
- package/dist/schema/format.d.ts +0 -1
- package/dist/schema/format.js +1 -2
- package/dist/schema/manifest.js +18 -24
- package/dist/schema/section-props.d.ts +1 -1
- package/dist/schema/section-schema.d.ts +1 -1
- package/dist/schema/section-schema.js +1 -0
- package/dist/section/declare.d.ts +1 -1
- package/dist/section/discovery.js +6 -2
- package/dist/section/publish-shape.js +38 -0
- package/dist/section/section.d.ts +1 -1
- package/dist/site-analytics.js +6 -1
- package/dist/site-runtime/window-height.js +19 -0
- package/dist/template/define-template.d.ts +25 -4
- package/dist/template/define-template.js +3 -0
- package/dist/template/logic-shim.d.ts +1 -1
- package/dist/template/materialize.js +3 -1
- package/dist/template/running-copy.js +0 -1
- package/dist/template/section-reads.js +1 -1
- package/guide/reference/cli/INDEX.md +6 -5
- package/guide/reference/cli/build.md +10 -8
- package/guide/reference/cli/check.md +4 -2
- package/guide/reference/cli/dev.md +6 -2
- package/guide/reference/cli/install.md +41 -0
- package/guide/reference/cli/property-add.md +5 -4
- package/guide/reference/cli/property-list.md +2 -2
- package/guide/reference/cli/publish.md +5 -5
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +9 -5
- package/package.json +14 -30
- package/dist/artifact/playground/client/assets/index-ByeGGedv.js +0 -1259
- package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +0 -1
- package/dist/cli/build/artifact.js +0 -220
- package/dist/cli/build/captures.js +0 -48
- package/dist/cli/build/fixtures.js +0 -92
- package/dist/cli/capture/capture-browser.js +0 -37
- package/dist/cli/capture/capture.js +0 -113
- package/dist/cli/check/render/inputs.js +0 -60
- package/dist/cli/check/render/nav.js +0 -31
- package/dist/cli/dev/crop.js +0 -20
- package/dist/cli/dev/fixture-ladders.js +0 -96
- package/dist/cli/dev/hmr.js +0 -26
- package/dist/cli/dev/islands.js +0 -234
- package/dist/cli/dev/load-template.js +0 -52
- package/dist/cli/dev/vite.js +0 -114
- package/dist/cli/dev/workspace-reader.js +0 -248
- package/dist/cli/publish/freshness.js +0 -64
- package/dist/fixtures/brand.d.ts +0 -4
- package/dist/fixtures/brand.js +0 -8
- package/dist/fixtures/load.js +0 -159
- package/dist/fixtures/resolve.js +0 -392
- package/dist/fixtures.d.ts +0 -429
- package/dist/fixtures.js +0 -23
- package/dist/packages/internal/canvas-core/dist/island-host.js +0 -62
- package/dist/packages/internal/canvas-core/dist/island-shields.js +0 -30
- package/dist/playground/canvas-island-host.d.ts +0 -11
- package/dist/playground/canvas-island-host.js +0 -29
- package/dist/playground/canvas-markers.js +0 -14
- package/dist/playground/host/paths.js +0 -8
- package/dist/playground/layout.js +0 -17
- package/dist/playground/wire.js +0 -28
package/dist/fixtures/resolve.js
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import { normalizeAddressValue } from "../packages/internal/template-contracts/dist/address-value.js";
|
|
2
|
-
import { declaredKinds, isEmailValue, isIsoDateValue, isMediaType, isPhoneValue } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
3
|
-
import { getComputed } from "../packages/internal/template-contracts/dist/compute.js";
|
|
4
|
-
import { tableKey } from "../packages/internal/template-contracts/dist/registry-shape.js";
|
|
5
|
-
import { heldRowTableOf, listTableOf, placementOf, rowTablesOf } from "../packages/internal/template-contracts/dist/ref-locate.js";
|
|
6
|
-
import "../packages/internal/template-contracts/dist/table-members.js";
|
|
7
|
-
import { fillSpecFromSchema } from "../schema/extract-fill-spec.js";
|
|
8
|
-
import { elementRowKeys, listSourceOf, memberSourceOf } from "../packages/internal/template-contracts/dist/row-sources.js";
|
|
9
|
-
import { objectFieldSlotId } from "../packages/internal/template-contracts/dist/slot-overrides.js";
|
|
10
|
-
import { tableRowIds } from "../packages/internal/source-resolution/dist/index.js";
|
|
11
|
-
import { bakeDisplayEntries, bakePropertyRefSlots } from "../packages/internal/fill-bake/dist/bake-property-ref.js";
|
|
12
|
-
import { applyComputeReads } from "../packages/internal/fill-bake/dist/compute-reads.js";
|
|
13
|
-
import "../packages/internal/fill-bake/dist/index.js";
|
|
14
|
-
import { canonicalizeProperty, contactImageId } from "./property.js";
|
|
15
|
-
import { blankForField } from "./rows.js";
|
|
16
|
-
|
|
17
|
-
//#region src/fixtures/resolve.ts
|
|
18
|
-
function authoredSettled(fixture) {
|
|
19
|
-
if (fixture.settled === void 0) throw new Error(`Fixture "${fixture.id}" is synthesized: it carries no settled doc, and no playground serves it.`);
|
|
20
|
-
return fixture.settled;
|
|
21
|
-
}
|
|
22
|
-
const VALIDATED_KINDS = {
|
|
23
|
-
date: {
|
|
24
|
-
admits: (value) => value === null || isIsoDateValue(value),
|
|
25
|
-
expected: "a real calendar day written \"YYYY-MM-DD\", or null for none"
|
|
26
|
-
},
|
|
27
|
-
email: {
|
|
28
|
-
admits: (value) => value == null || value === "" || isEmailValue(value),
|
|
29
|
-
expected: "an email address"
|
|
30
|
-
},
|
|
31
|
-
phone: {
|
|
32
|
-
admits: (value) => value == null || value === "" || isPhoneValue(value),
|
|
33
|
-
expected: "a phone number a dialer can call"
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
function emptyValueFor(type) {
|
|
37
|
-
if (type === "list") return [];
|
|
38
|
-
return type === "object" ? {} : null;
|
|
39
|
-
}
|
|
40
|
-
function isEmptyValue(value, type) {
|
|
41
|
-
if (type === "list") return Array.isArray(value) && value.length === 0;
|
|
42
|
-
if (type === "object") return typeof value === "object" && value !== null && Object.keys(value).length === 0;
|
|
43
|
-
return value === null || value === void 0;
|
|
44
|
-
}
|
|
45
|
-
function uniquePlacements(placements) {
|
|
46
|
-
const seen = /* @__PURE__ */ new Set();
|
|
47
|
-
return placements.filter((p) => seen.has(p.instance) ? false : (seen.add(p.instance), true));
|
|
48
|
-
}
|
|
49
|
-
function resolveFixture(loaded, options) {
|
|
50
|
-
const { fixture, module } = loaded;
|
|
51
|
-
const violations = [];
|
|
52
|
-
const property = canonicalizeProperty(fixture.property, module);
|
|
53
|
-
violations.push(...property.violations);
|
|
54
|
-
if (property.facts === null) return {
|
|
55
|
-
resolved: null,
|
|
56
|
-
violations
|
|
57
|
-
};
|
|
58
|
-
const { facts, media } = property;
|
|
59
|
-
const placements = uniquePlacements(options.placements);
|
|
60
|
-
const entriesByInstance = /* @__PURE__ */ new Map();
|
|
61
|
-
for (const entry of fixture.content ?? []) {
|
|
62
|
-
const instance = entry.instance ?? `${entry.section.key}-1`;
|
|
63
|
-
if (placements.find((p) => p.key === entry.section.key && p.instance === instance) === void 0) {
|
|
64
|
-
violations.push({
|
|
65
|
-
rule: "fixtures/instance-not-placed",
|
|
66
|
-
file: module,
|
|
67
|
-
message: `fixture "${loaded.id}" states content for "${entry.section.key}" instance "${instance}", which no page places`
|
|
68
|
-
});
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
if (entriesByInstance.has(instance)) throw new Error(`Fixture "${loaded.id}" (${module}) states content twice for instance "${instance}".`);
|
|
72
|
-
entriesByInstance.set(instance, entry);
|
|
73
|
-
}
|
|
74
|
-
const ctx = {
|
|
75
|
-
facts,
|
|
76
|
-
media,
|
|
77
|
-
module,
|
|
78
|
-
fixtureId: loaded.id,
|
|
79
|
-
log: options.log,
|
|
80
|
-
violations
|
|
81
|
-
};
|
|
82
|
-
const filled = placements.map((placement) => fillInstance(placement, entriesByInstance.get(placement.instance), ctx));
|
|
83
|
-
const pages = [{
|
|
84
|
-
id: "fixture",
|
|
85
|
-
sections: placements.map((p) => ({
|
|
86
|
-
section: p.key,
|
|
87
|
-
instance_id: p.instance
|
|
88
|
-
}))
|
|
89
|
-
}];
|
|
90
|
-
const settled = applyComputeReads({
|
|
91
|
-
contentDoc: { instances: filled.map((f) => f.instance) },
|
|
92
|
-
facts,
|
|
93
|
-
sections: new Map(filled.map((f) => [f.instance.instance_id, f.section])),
|
|
94
|
-
placement: placementOf(pages)
|
|
95
|
-
}).contentDoc;
|
|
96
|
-
const instances = [];
|
|
97
|
-
const provenance = {};
|
|
98
|
-
settled.instances.forEach((instance, index) => {
|
|
99
|
-
const { placement, values } = filled[index];
|
|
100
|
-
const schemaSlots = placement.section.schema.slots;
|
|
101
|
-
const slots = {};
|
|
102
|
-
const provenanceOf = {};
|
|
103
|
-
for (const [id, def] of Object.entries(schemaSlots)) {
|
|
104
|
-
provenanceOf[id] = provenanceFor(def, id, values[id], instance.slots[id], facts);
|
|
105
|
-
const cases = def.variant?.cases;
|
|
106
|
-
if (cases !== void 0 && (instance.variant === void 0 || !cases.includes(instance.variant))) continue;
|
|
107
|
-
slots[id] = instance.slots[id];
|
|
108
|
-
}
|
|
109
|
-
instances.push({
|
|
110
|
-
instance_id: instance.instance_id,
|
|
111
|
-
section_key: placement.section.key,
|
|
112
|
-
enabled: instance.enabled,
|
|
113
|
-
...instance.variant === void 0 ? {} : { variant: instance.variant },
|
|
114
|
-
slots
|
|
115
|
-
});
|
|
116
|
-
provenance[instance.instance_id] = provenanceOf;
|
|
117
|
-
});
|
|
118
|
-
return {
|
|
119
|
-
resolved: {
|
|
120
|
-
id: loaded.id,
|
|
121
|
-
label: loaded.label,
|
|
122
|
-
module,
|
|
123
|
-
synthesized: false,
|
|
124
|
-
facts,
|
|
125
|
-
media,
|
|
126
|
-
contentDoc: { instances },
|
|
127
|
-
settled: settled.instances,
|
|
128
|
-
provenance
|
|
129
|
-
},
|
|
130
|
-
violations
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function computeReadsSectionOf(section, log) {
|
|
134
|
-
const { schema } = section;
|
|
135
|
-
return {
|
|
136
|
-
localKey: section.key,
|
|
137
|
-
schema: {
|
|
138
|
-
slots: schema.slots,
|
|
139
|
-
display: schema.meta.display ?? {}
|
|
140
|
-
},
|
|
141
|
-
bakeContext: {
|
|
142
|
-
computed: getComputed(schema),
|
|
143
|
-
section_key: section.key,
|
|
144
|
-
log
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
function pickDecisions(schema) {
|
|
149
|
-
try {
|
|
150
|
-
return fillSpecFromSchema(schema).decisions;
|
|
151
|
-
} catch {
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function fillInstance(placement, entry, ctx) {
|
|
156
|
-
const section = placement.section;
|
|
157
|
-
const { schema } = section;
|
|
158
|
-
const schemaSlots = schema.slots;
|
|
159
|
-
const bakeContext = {
|
|
160
|
-
computed: getComputed(schema),
|
|
161
|
-
section_key: section.key,
|
|
162
|
-
log: ctx.log
|
|
163
|
-
};
|
|
164
|
-
const decisions = pickDecisions(schema);
|
|
165
|
-
const values = entry?.values ?? {};
|
|
166
|
-
const fill = {
|
|
167
|
-
decisions,
|
|
168
|
-
heldRows: {},
|
|
169
|
-
at: (slot) => ({
|
|
170
|
-
...ctx,
|
|
171
|
-
instance: placement.instance,
|
|
172
|
-
slot
|
|
173
|
-
})
|
|
174
|
-
};
|
|
175
|
-
const stated = {};
|
|
176
|
-
for (const [id, def] of Object.entries(schemaSlots)) {
|
|
177
|
-
const value = statedValue(fill, def, id, values[id], true);
|
|
178
|
-
if (value !== void 0) stated[id] = value;
|
|
179
|
-
reportRows(ctx, placement.instance, def, id, values[id]);
|
|
180
|
-
}
|
|
181
|
-
const bakeScope = {
|
|
182
|
-
decisions,
|
|
183
|
-
heldRows: fill.heldRows,
|
|
184
|
-
stored: stated
|
|
185
|
-
};
|
|
186
|
-
const baked = bakePropertyRefSlots(schema, ctx.facts, bakeContext, bakeScope);
|
|
187
|
-
const slots = {};
|
|
188
|
-
for (const [id, def] of Object.entries(schemaSlots)) slots[id] = slotValue(def, id, Object.hasOwn(baked, id) ? { value: baked[id] } : void 0, stated[id], decisions);
|
|
189
|
-
const display = schema.meta.display ?? {};
|
|
190
|
-
const baked_display = bakeDisplayEntries({
|
|
191
|
-
display,
|
|
192
|
-
slots: schemaSlots
|
|
193
|
-
}, ctx.facts, bakeContext, bakeScope);
|
|
194
|
-
const visibility = baked_display.visibility ?? display.visibility?.cases?.[0];
|
|
195
|
-
const declaredCases = display.variant?.cases;
|
|
196
|
-
if (typeof values.variant === "string" && declaredCases?.includes(values.variant) !== true) throw new Error(`Fixture "${ctx.fixtureId}" (${ctx.module}): content for "${placement.instance}" names variant "${values.variant}", which section "${section.key}" does not declare.`);
|
|
197
|
-
const variant = typeof values.variant === "string" ? values.variant : baked_display.variant ?? declaredCases?.[0];
|
|
198
|
-
const overrides = {
|
|
199
|
-
...typeof values.enabled === "boolean" ? { visibility: true } : {},
|
|
200
|
-
...typeof values.variant === "string" ? { variant: true } : {}
|
|
201
|
-
};
|
|
202
|
-
return {
|
|
203
|
-
placement,
|
|
204
|
-
instance: {
|
|
205
|
-
instance_id: placement.instance,
|
|
206
|
-
enabled: typeof values.enabled === "boolean" ? values.enabled : visibility === void 0 ? true : visibility !== "hidden",
|
|
207
|
-
...variant === void 0 ? {} : { variant },
|
|
208
|
-
slots,
|
|
209
|
-
...Object.keys(overrides).length === 0 ? {} : { display_overrides: overrides }
|
|
210
|
-
},
|
|
211
|
-
section: computeReadsSectionOf(section, ctx.log),
|
|
212
|
-
values
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
function statedValue(fill, def, path, value, holds) {
|
|
216
|
-
if (value === void 0 || value === null) return void 0;
|
|
217
|
-
if (def.type === "row") {
|
|
218
|
-
if (typeof value !== "string") return void 0;
|
|
219
|
-
if (holds) fill.heldRows[path] = value;
|
|
220
|
-
return value;
|
|
221
|
-
}
|
|
222
|
-
if (def.type === "object") {
|
|
223
|
-
if (!isRecord(value)) return void 0;
|
|
224
|
-
return statedFields(fill, def.fields, path, value, holds);
|
|
225
|
-
}
|
|
226
|
-
if (def.type === "list" && def.element?.type === "object") {
|
|
227
|
-
if (!Array.isArray(value)) return void 0;
|
|
228
|
-
const fields = def.element.fields;
|
|
229
|
-
const table = filledListTable(def);
|
|
230
|
-
const elementRows = elementRowKeys(fields);
|
|
231
|
-
return value.map((item, i) => {
|
|
232
|
-
const record = isRecord(item) ? item : {};
|
|
233
|
-
const out = statedFields(fill, fields, path, record, false);
|
|
234
|
-
const held = elementRows.map((key) => record[key]).find((id) => typeof id === "string" && id !== "");
|
|
235
|
-
return {
|
|
236
|
-
id: table === null ? record["id"] ?? `${path}-${String(i + 1)}` : held ?? record["id"],
|
|
237
|
-
...out
|
|
238
|
-
};
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
if (def.type === "list" && def.element?.type === "row") return Array.isArray(value) ? value.filter((id) => typeof id === "string") : void 0;
|
|
242
|
-
return authoredValue(def, value, fill.at(path));
|
|
243
|
-
}
|
|
244
|
-
function statedFields(fill, fields, path, value, holds) {
|
|
245
|
-
const out = {};
|
|
246
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
247
|
-
const stated = statedValue(fill, field, objectFieldSlotId(path, key), value[key], holds);
|
|
248
|
-
if (stated !== void 0) out[key] = stated;
|
|
249
|
-
}
|
|
250
|
-
return out;
|
|
251
|
-
}
|
|
252
|
-
function filledListTable(def) {
|
|
253
|
-
if (listSourceOf(def).kind !== "none" || memberSourceOf(def.source) !== null) return null;
|
|
254
|
-
return listTableOf({ slots: {} }, def);
|
|
255
|
-
}
|
|
256
|
-
function reportRows(ctx, instance, def, path, value) {
|
|
257
|
-
if (def.type !== "list" || !Array.isArray(value)) return;
|
|
258
|
-
if (listSourceOf(def).kind !== "table") return;
|
|
259
|
-
const table = listTableOf({ slots: {} }, def);
|
|
260
|
-
const carried = table === null ? 0 : tableRowIds(table, ctx.facts).length;
|
|
261
|
-
if (value.length <= carried) return;
|
|
262
|
-
ctx.violations.push({
|
|
263
|
-
rule: "fixtures/rows-not-in-property",
|
|
264
|
-
file: ctx.module,
|
|
265
|
-
message: `fixture "${ctx.fixtureId}": "${instance}".${path} states ${String(value.length)} items, but its property carries ${String(carried)} — the rows of a list sourced by a table are the property's`
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
function slotValue(def, path, baked, stated, decisions) {
|
|
269
|
-
if (def.type === "object") {
|
|
270
|
-
const fields = def.fields;
|
|
271
|
-
const bakedFields = isRecord(baked?.value) ? baked.value : {};
|
|
272
|
-
const statedFields = isRecord(stated) ? stated : {};
|
|
273
|
-
const out = {};
|
|
274
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
275
|
-
const fieldPath = objectFieldSlotId(path, key);
|
|
276
|
-
out[key] = Object.hasOwn(bakedFields, key) ? fieldValue(field, fieldPath, { value: bakedFields[key] }, statedFields[key], decisions) : fieldValue(field, fieldPath, void 0, statedFields[key], decisions);
|
|
277
|
-
}
|
|
278
|
-
return out;
|
|
279
|
-
}
|
|
280
|
-
if (def.type === "list" && def.element?.type === "object" && Array.isArray(baked?.value)) return itemsValue(def, path, baked.value, stated, decisions);
|
|
281
|
-
if (baked !== void 0) return baked.value ?? emptyValueFor(def.type);
|
|
282
|
-
if (def.source === void 0 && stated !== void 0) return stated;
|
|
283
|
-
return emptyValueFor(def.type);
|
|
284
|
-
}
|
|
285
|
-
function fieldValue(def, path, baked, stated, decisions) {
|
|
286
|
-
if (def.type === "object" || def.type === "list" && def.element?.type === "object" && Array.isArray(baked?.value)) return slotValue(def, path, baked, stated, decisions);
|
|
287
|
-
if (baked !== void 0) return baked.value;
|
|
288
|
-
if (def.source === void 0 && stated !== void 0) return stated;
|
|
289
|
-
return blankForField(def);
|
|
290
|
-
}
|
|
291
|
-
function itemsValue(def, path, items, stated, decisions) {
|
|
292
|
-
const fields = def.element?.fields ?? {};
|
|
293
|
-
const statedItems = Array.isArray(stated) ? stated.filter(isRecord) : [];
|
|
294
|
-
const byIdentity = listSourceOf(def).kind === "none" && memberSourceOf(def.source) === null;
|
|
295
|
-
return items.map((item, i) => {
|
|
296
|
-
const baked = isRecord(item) ? item : {};
|
|
297
|
-
const statedItem = byIdentity ? statedItems.find((candidate) => candidate["id"] === baked["id"]) : statedItems[i];
|
|
298
|
-
const out = { id: baked["id"] };
|
|
299
|
-
for (const [key, field] of Object.entries(fields)) out[key] = fieldValue(field, `${path}.${key}`, Object.hasOwn(baked, key) ? { value: baked[key] } : void 0, statedItem?.[key], decisions);
|
|
300
|
-
return out;
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
function provenanceFor(def, id, stated, value, facts) {
|
|
304
|
-
const source = def.source;
|
|
305
|
-
if (def.type === "object") return { kind: "authored" };
|
|
306
|
-
if (def.type === "row") {
|
|
307
|
-
if (typeof stated === "string") return { kind: "authored" };
|
|
308
|
-
const table = heldRowTableOf(facts, rowTablesOf(def), typeof value === "string" ? value : null);
|
|
309
|
-
return table !== null ? {
|
|
310
|
-
kind: "fact",
|
|
311
|
-
ref: tableKey(table)
|
|
312
|
-
} : { kind: "empty" };
|
|
313
|
-
}
|
|
314
|
-
if (source?.kind === "home") return {
|
|
315
|
-
kind: "fact",
|
|
316
|
-
ref: String(source.key)
|
|
317
|
-
};
|
|
318
|
-
if (source?.kind === "derived") return {
|
|
319
|
-
kind: "computed",
|
|
320
|
-
ref: String(source.transform)
|
|
321
|
-
};
|
|
322
|
-
if (source?.kind === "section") return {
|
|
323
|
-
kind: "computed",
|
|
324
|
-
ref: id
|
|
325
|
-
};
|
|
326
|
-
const member = memberSourceOf(source);
|
|
327
|
-
if (member !== null) return {
|
|
328
|
-
kind: "fact",
|
|
329
|
-
ref: `${member.slot}.${member.field}`
|
|
330
|
-
};
|
|
331
|
-
if (source?.kind === "element") return {
|
|
332
|
-
kind: "fact",
|
|
333
|
-
ref: "element"
|
|
334
|
-
};
|
|
335
|
-
return isEmptyValue(value, def.type) ? { kind: "empty" } : { kind: "authored" };
|
|
336
|
-
}
|
|
337
|
-
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
338
|
-
function authoredValue(def, value, ctx) {
|
|
339
|
-
if (isMediaType(def.type)) return mediaRef(def, value, ctx);
|
|
340
|
-
if (def.type === "address") return normalizeAddressValue(value);
|
|
341
|
-
const validated = VALIDATED_KINDS[def.type];
|
|
342
|
-
if (validated !== void 0 && !validated.admits(value)) {
|
|
343
|
-
ctx.violations.push({
|
|
344
|
-
rule: "fixtures/value-invalid",
|
|
345
|
-
file: ctx.module,
|
|
346
|
-
message: `fixture "${ctx.fixtureId}": "${ctx.instance}".${ctx.slot} (${def.type}) states ${JSON.stringify(value)}; it takes ${validated.expected}`
|
|
347
|
-
});
|
|
348
|
-
return emptyValueFor(def.type);
|
|
349
|
-
}
|
|
350
|
-
if (def.type === "list" && Array.isArray(value) && def.element !== void 0 && def.element.type !== "object" && def.element.type !== "row") {
|
|
351
|
-
const element = def.element;
|
|
352
|
-
return value.map((item) => authoredValue(element, item, ctx)).filter((item) => item !== null && item !== void 0);
|
|
353
|
-
}
|
|
354
|
-
return value;
|
|
355
|
-
}
|
|
356
|
-
const CONTACT_IMAGE_FIELDS = /* @__PURE__ */ new Set([
|
|
357
|
-
"headshot",
|
|
358
|
-
"logo_dark",
|
|
359
|
-
"logo_light"
|
|
360
|
-
]);
|
|
361
|
-
function contactImage(value) {
|
|
362
|
-
if (typeof value !== "object" || value === null) return null;
|
|
363
|
-
const { contact, field } = value;
|
|
364
|
-
if (typeof field !== "string" || !CONTACT_IMAGE_FIELDS.has(field)) return null;
|
|
365
|
-
const contactId = typeof contact === "object" && contact !== null ? contact.id : void 0;
|
|
366
|
-
if (typeof contactId !== "string") return null;
|
|
367
|
-
return {
|
|
368
|
-
id: contactImageId(contactId, field),
|
|
369
|
-
contact: contactId,
|
|
370
|
-
field
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
function mediaRef(def, value, ctx) {
|
|
374
|
-
const kind = def.type;
|
|
375
|
-
const kinds = declaredKinds(def);
|
|
376
|
-
const stated = kinds.includes("image") ? contactImage(value) : null;
|
|
377
|
-
const id = stated?.id ?? (typeof value === "object" && value !== null ? value.id : void 0);
|
|
378
|
-
const carried = typeof id === "string" ? ctx.media.get(id) : void 0;
|
|
379
|
-
if (carried === void 0 || !kinds.includes(carried.kind)) {
|
|
380
|
-
const what = stated !== null ? `the "${stated.field}" of contact "${stated.contact}", which its property does not carry` : typeof id === "string" ? `${kind} "${id}", which its property does not carry` : `a value that is not a ${kind} entry of its property`;
|
|
381
|
-
ctx.violations.push({
|
|
382
|
-
rule: "fixtures/media-not-in-property",
|
|
383
|
-
file: ctx.module,
|
|
384
|
-
message: `fixture "${ctx.fixtureId}": "${ctx.instance}".${ctx.slot} references ${what}`
|
|
385
|
-
});
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
return { media: carried.id };
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
//#endregion
|
|
392
|
-
export { authoredSettled, computeReadsSectionOf, emptyValueFor, isEmptyValue, resolveFixture, uniquePlacements };
|