@homepages/concrete 12.0.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +184 -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 +11 -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 -59
- package/dist/base.css +2 -2
- 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 +47 -21
- package/dist/packages/internal/fill-bake/dist/index.js +5 -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/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/rules/registry.js +27 -3
- package/dist/schema/fact.d.ts +2 -2
- package/dist/schema/facts-view.d.ts +1 -1
- 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/template/define-template.d.ts +14 -4
- package/dist/template/define-template.js +2 -0
- package/dist/template/logic-shim.d.ts +1 -1
- package/dist/template/materialize.js +1 -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 +8 -4
- package/package.json +14 -30
- package/dist/artifact/playground/client/assets/index-BcLGpWLR.js +0 -1266
- 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 -115
- 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 -249
- 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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { pagePlan, renderPageSection } from "../../../packages/internal/page-render/dist/render.js";
|
|
2
|
+
import "../../../packages/internal/page-render/dist/index.js";
|
|
3
|
+
import { fixtureMediaRecords, fixtureMediaStore } from "../../../packages/internal/playground/dist/host/media-store.js";
|
|
4
|
+
import { createElement } from "react";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
import { renderToString } from "react-dom/server";
|
|
7
|
+
|
|
8
|
+
//#region src/cli/check/render/corpus.ts
|
|
9
|
+
const CONTENT_BASE = "/";
|
|
10
|
+
const REACT = {
|
|
11
|
+
createElement: (type, props) => createElement(type, props),
|
|
12
|
+
renderToString: (element, options) => renderToString(element, options)
|
|
13
|
+
};
|
|
14
|
+
const sha256 = (text) => createHash("sha256").update(text).digest("hex");
|
|
15
|
+
function renderSchemaOf(entry) {
|
|
16
|
+
return entry.schema;
|
|
17
|
+
}
|
|
18
|
+
function* corpusSections(composition, sections, corpus, assets) {
|
|
19
|
+
const byKey = new Map(sections.map((entry) => [entry.key, entry]));
|
|
20
|
+
const { manifest } = composition;
|
|
21
|
+
const pages = manifest.pages.map((page) => ({
|
|
22
|
+
id: page.id,
|
|
23
|
+
label: page.label,
|
|
24
|
+
path: page.path,
|
|
25
|
+
sections: page.sections.map((placed) => ({
|
|
26
|
+
instanceId: placed.instance_id,
|
|
27
|
+
section: placed.section
|
|
28
|
+
}))
|
|
29
|
+
}));
|
|
30
|
+
for (const entry of corpus) {
|
|
31
|
+
const { fixture } = entry;
|
|
32
|
+
const records = fixtureMediaRecords(fixture.facts, fixture.media, (path) => assets?.get(path)?.bytes, fixture.owned);
|
|
33
|
+
let named = /* @__PURE__ */ new Set();
|
|
34
|
+
const media = () => {
|
|
35
|
+
const into = named;
|
|
36
|
+
const listed = /* @__PURE__ */ new Set();
|
|
37
|
+
const served = /* @__PURE__ */ new Set();
|
|
38
|
+
const store = fixtureMediaStore(fixture.media, {
|
|
39
|
+
url: (path) => {
|
|
40
|
+
served.add(path);
|
|
41
|
+
return path;
|
|
42
|
+
},
|
|
43
|
+
content: {
|
|
44
|
+
contentBase: CONTENT_BASE,
|
|
45
|
+
hash: sha256,
|
|
46
|
+
listed: (address, file) => {
|
|
47
|
+
into.add(address);
|
|
48
|
+
listed.add(file.url);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const servedUrl = store.servedUrl.bind(store);
|
|
53
|
+
const fileUrl = store.fileUrl.bind(store);
|
|
54
|
+
const keep = async (url) => {
|
|
55
|
+
const out = await url;
|
|
56
|
+
if (served.has(out) && !listed.has(out)) into.add(out);
|
|
57
|
+
return out;
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
store: {
|
|
61
|
+
...store,
|
|
62
|
+
servedUrl: (key) => keep(servedUrl(key)),
|
|
63
|
+
fileUrl: (key) => keep(fileUrl(key))
|
|
64
|
+
},
|
|
65
|
+
records,
|
|
66
|
+
resolvePoi: (value) => value
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const snapshot = {
|
|
70
|
+
output: manifest.output,
|
|
71
|
+
pages,
|
|
72
|
+
instances: fixture.contentDoc.instances.map((i) => ({
|
|
73
|
+
instanceId: i.instance_id,
|
|
74
|
+
values: i.slots,
|
|
75
|
+
variant: i.variant,
|
|
76
|
+
enabled: i.enabled
|
|
77
|
+
})),
|
|
78
|
+
pageEnabled: (pageId) => fixture.pages?.[pageId]?.enabled !== false,
|
|
79
|
+
section: (key) => {
|
|
80
|
+
const placed = byKey.get(key);
|
|
81
|
+
return Promise.resolve({
|
|
82
|
+
schema: placed === void 0 ? { slots: {} } : renderSchemaOf(placed),
|
|
83
|
+
component: placed?.section ?? null
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
media
|
|
87
|
+
};
|
|
88
|
+
for (const page of manifest.pages) {
|
|
89
|
+
const keyOf = new Map(page.sections.map((placed) => [placed.instance_id, placed.section]));
|
|
90
|
+
for (const instance of pagePlan(snapshot, page.id)) {
|
|
91
|
+
const section = byKey.get(keyOf.get(instance.instanceId));
|
|
92
|
+
if (section === void 0) continue;
|
|
93
|
+
yield {
|
|
94
|
+
corpus: entry,
|
|
95
|
+
pageId: page.id,
|
|
96
|
+
instanceId: instance.instanceId,
|
|
97
|
+
entry: section,
|
|
98
|
+
where: `fixture "${fixture.id}", page "${page.id}", instance "${instance.instanceId}"`,
|
|
99
|
+
render: async () => {
|
|
100
|
+
const into = /* @__PURE__ */ new Set();
|
|
101
|
+
named = into;
|
|
102
|
+
return {
|
|
103
|
+
section: await renderPageSection({
|
|
104
|
+
react: REACT,
|
|
105
|
+
snapshot,
|
|
106
|
+
pageId: page.id,
|
|
107
|
+
contentBase: CONTENT_BASE
|
|
108
|
+
}, instance.instanceId),
|
|
109
|
+
named: into
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
export { corpusSections };
|
|
@@ -20,6 +20,7 @@ function fixtureMediaPathOf(url) {
|
|
|
20
20
|
}
|
|
21
21
|
function checkRenderInvariants(html, carriesMedia) {
|
|
22
22
|
const violations = [];
|
|
23
|
+
html = html.replace(/<!--[\s\S]*?-->/g, "");
|
|
23
24
|
const graded = /* @__PURE__ */ new Set();
|
|
24
25
|
for (const raw of mediaUrlsIn(html)) {
|
|
25
26
|
const url = fixtureMediaPathOf(decodeAttr(raw));
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { workspacePath } from "../../../platform/paths.js";
|
|
2
2
|
import { publishedSectionKey } from "../../../packages/internal/template-artifact/dist/layout.js";
|
|
3
3
|
import "../../../packages/internal/template-artifact/dist/index.js";
|
|
4
|
-
import { frameRungFloor } from "../../media/frame-rung-floor.js";
|
|
5
4
|
import { exportSite } from "../../../section/discovery.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { frameRungFloor } from "../../media/frame-rung-floor.js";
|
|
6
|
+
import { buildFramedRenderer, framedRendererPath } from "../../build/sections.js";
|
|
7
|
+
import { corpusSections } from "../render/corpus.js";
|
|
9
8
|
import { carriesContent, islandMarkers } from "../render/island-frames.js";
|
|
10
9
|
import { createElement } from "react";
|
|
11
10
|
import { dirname, join } from "node:path";
|
|
12
11
|
import { pathToFileURL } from "node:url";
|
|
13
12
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
14
|
-
import { gzipSync } from "node:zlib";
|
|
15
13
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
14
|
+
import { gzipSync } from "node:zlib";
|
|
16
15
|
|
|
17
16
|
//#region src/cli/check/stages/bundles.ts
|
|
18
17
|
const RENDERER_GZIP_CEILING = 300 * 1024;
|
|
@@ -30,6 +29,7 @@ async function bundlesStage(ctx) {
|
|
|
30
29
|
const violations = [];
|
|
31
30
|
const weights = [];
|
|
32
31
|
const built = /* @__PURE__ */ new Map();
|
|
32
|
+
const bundlesOf = new Map(ctx.build.sections.map((section) => [section.local, section.bundles]));
|
|
33
33
|
for (const entry of [...sections].sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0)) {
|
|
34
34
|
const site = exportSite(discovered, entry.section);
|
|
35
35
|
if (site === void 0) continue;
|
|
@@ -40,15 +40,10 @@ async function bundlesStage(ctx) {
|
|
|
40
40
|
exportName: site.exportName,
|
|
41
41
|
minRungWidth: frameRungFloor(template)
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
violations.push({
|
|
48
|
-
rule: "bundles/build-failed",
|
|
49
|
-
file: entry.file,
|
|
50
|
-
message: `Section "${entry.key}" does not bundle the way \`concrete build\` bundles it, so it could not be weighed and would not build: ${describeError(cause)}`
|
|
51
|
-
});
|
|
43
|
+
const produced = bundlesOf.get(entry.key);
|
|
44
|
+
if (produced === void 0) throw new Error(`check: the build made no bundles for exported section "${entry.key}".`);
|
|
45
|
+
if (!produced.ok) {
|
|
46
|
+
violations.push(produced.violation);
|
|
52
47
|
weights.push({
|
|
53
48
|
section: entry.key,
|
|
54
49
|
file: entry.file,
|
|
@@ -59,6 +54,7 @@ async function bundlesStage(ctx) {
|
|
|
59
54
|
});
|
|
60
55
|
continue;
|
|
61
56
|
}
|
|
57
|
+
const section = produced.value;
|
|
62
58
|
built.set(entry.key, section);
|
|
63
59
|
const rendererGzip = gzipBytes(section.renderer);
|
|
64
60
|
const islands = section.islands.map((island) => ({
|
|
@@ -100,15 +96,16 @@ async function gradeServerFrames(ctx, input, entry, section, composition, sectio
|
|
|
100
96
|
await writeFile(path, bytes);
|
|
101
97
|
const Component = (await import(pathToFileURL(path).href)).default;
|
|
102
98
|
const proven = /* @__PURE__ */ new Map();
|
|
103
|
-
for
|
|
104
|
-
if (
|
|
99
|
+
for (const placed of corpusSections(composition, sections, corpus, ctx.assets)) {
|
|
100
|
+
if (placed.entry.key !== entry.key) continue;
|
|
105
101
|
let html;
|
|
106
102
|
try {
|
|
107
|
-
|
|
103
|
+
const { inputs } = (await placed.render()).section;
|
|
104
|
+
html = renderToStaticMarkup(createElement(Component, inputs));
|
|
108
105
|
} catch {
|
|
109
106
|
continue;
|
|
110
107
|
}
|
|
111
|
-
for (const marker of islandMarkers(html)) if (frameless.has(marker.islandKey) && !proven.has(marker.islandKey) && carriesContent(marker.inner)) proven.set(marker.islandKey,
|
|
108
|
+
for (const marker of islandMarkers(html)) if (frameless.has(marker.islandKey) && !proven.has(marker.islandKey) && carriesContent(marker.inner)) proven.set(marker.islandKey, placed.where);
|
|
112
109
|
}
|
|
113
110
|
return [...proven].map(([islandKey, where]) => {
|
|
114
111
|
const file = workspacePath(ctx.root, frameless.get(islandKey).file);
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { declaringModule } from "../../../section/section.js";
|
|
2
|
-
import { isInsideRoot, workspacePath } from "../../../platform/paths.js";
|
|
3
|
-
import { describeError } from "../messages.js";
|
|
4
1
|
import { recordPlacements } from "../../../section/placements.js";
|
|
5
|
-
import { materializeTemplate } from "../../../template/materialize.js";
|
|
6
2
|
import { TEMPLATE_FILE } from "../load-workspace.js";
|
|
3
|
+
import { describeError } from "../messages.js";
|
|
4
|
+
import { pageLocator, sectionNotExported } from "../../build/template-build.js";
|
|
7
5
|
import { createElement } from "react";
|
|
8
|
-
import { isAbsolute } from "node:path";
|
|
9
6
|
|
|
10
7
|
//#region src/cli/check/stages/composition.ts
|
|
11
8
|
function compositionStage(ctx) {
|
|
12
9
|
const { workspace, discovered } = ctx;
|
|
13
10
|
if (workspace?.template === null || workspace === void 0 || discovered === void 0) return Promise.resolve({ skipped: "the workspace stage could not load template.ts and its sections" });
|
|
14
11
|
const { root, template } = workspace;
|
|
15
|
-
const
|
|
16
|
-
for (const [file, exports] of workspace.modules) for (const value of Object.values(exports)) if (!moduleOf.has(value)) moduleOf.set(value, workspacePath(root, file));
|
|
17
|
-
const locate = (page) => moduleOf.get(page);
|
|
12
|
+
const locate = pageLocator(workspace);
|
|
18
13
|
const violations = [];
|
|
19
14
|
for (const page of template.pages) {
|
|
20
15
|
let markup;
|
|
@@ -37,29 +32,17 @@ function compositionStage(ctx) {
|
|
|
37
32
|
});
|
|
38
33
|
}
|
|
39
34
|
if (violations.length > 0) return Promise.resolve({ violations });
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return Promise.resolve({ violations: [{
|
|
45
|
-
rule: "pages/composition-invalid",
|
|
46
|
-
file: TEMPLATE_FILE,
|
|
47
|
-
message: describeError(cause)
|
|
48
|
-
}] });
|
|
49
|
-
}
|
|
35
|
+
const built = ctx.build.composition;
|
|
36
|
+
if (built === void 0) return Promise.resolve({ skipped: "the workspace stage could not load template.ts and its sections" });
|
|
37
|
+
if (!built.ok) return Promise.resolve({ violations: [built.violation] });
|
|
38
|
+
const composition = built.value;
|
|
50
39
|
ctx.composition = composition;
|
|
51
40
|
const exported = new Set(discovered.map((entry) => entry.section));
|
|
52
41
|
const reported = /* @__PURE__ */ new Set();
|
|
53
42
|
for (const placement of composition.placements) {
|
|
54
43
|
if (exported.has(placement.section) || reported.has(placement.section)) continue;
|
|
55
44
|
reported.add(placement.section);
|
|
56
|
-
|
|
57
|
-
const file = at !== void 0 && isAbsolute(at) && isInsideRoot(root, at) ? workspacePath(root, at) : TEMPLATE_FILE;
|
|
58
|
-
violations.push({
|
|
59
|
-
rule: "pages/section-not-exported",
|
|
60
|
-
file,
|
|
61
|
-
message: `Section "${placement.key}" is placed but exported by no module. Export it from ${file} so the build can bundle it alone.`
|
|
62
|
-
});
|
|
45
|
+
violations.push(sectionNotExported(root, placement.key, placement.section));
|
|
63
46
|
}
|
|
64
47
|
return Promise.resolve({ violations });
|
|
65
48
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { uniquePlacements } from "../../../packages/internal/playground/dist/host/resolve.js";
|
|
1
2
|
import { TEMPLATE_FILE } from "../load-workspace.js";
|
|
2
|
-
import { loadFixtures } from "../../../fixtures/load.js";
|
|
3
3
|
import { findFixturesReachableFromBundle } from "../../../fixtures/bundle-rule.js";
|
|
4
|
-
import { resolveFixture, uniquePlacements } from "../../../fixtures/resolve.js";
|
|
5
4
|
import { synthesizeEmptyFixtures } from "../../../fixtures/synthesize-empties.js";
|
|
5
|
+
import { loadWorkspaceFixtures } from "../../workspace-fixtures.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
|
|
8
8
|
//#region src/cli/check/stages/fixtures.ts
|
|
@@ -24,21 +24,25 @@ function emptiesOf(first, composition) {
|
|
|
24
24
|
async function fixturesStage(ctx) {
|
|
25
25
|
const { workspace, composition } = ctx;
|
|
26
26
|
if (workspace?.template === null || workspace === void 0 || composition === void 0) return { skipped: "the composition stage could not derive the placed instances fixtures resolve over" };
|
|
27
|
-
const loaded =
|
|
27
|
+
const loaded = await loadWorkspaceFixtures({
|
|
28
|
+
root: ctx.root,
|
|
29
|
+
template: workspace.template,
|
|
30
|
+
placements: composition.placements
|
|
31
|
+
});
|
|
28
32
|
const violations = [...loaded.violations];
|
|
29
|
-
const resolved =
|
|
30
|
-
for (const fixture of loaded.fixtures) {
|
|
31
|
-
const result = resolveFixture(fixture, { placements: composition.placements });
|
|
32
|
-
violations.push(...result.violations);
|
|
33
|
-
if (result.resolved !== null) resolved.push(result.resolved);
|
|
34
|
-
}
|
|
33
|
+
const resolved = loaded.resolved;
|
|
35
34
|
violations.push(...await findFixturesReachableFromBundle({
|
|
36
35
|
root: ctx.root,
|
|
37
|
-
entries: [join(ctx.root, TEMPLATE_FILE)]
|
|
36
|
+
entries: [join(ctx.root, TEMPLATE_FILE)],
|
|
37
|
+
fixtureFiles: loaded.files
|
|
38
38
|
}));
|
|
39
39
|
const first = resolved[0];
|
|
40
40
|
ctx.corpus = [...resolved.map((fixture) => ({ fixture })), ...first === void 0 ? [] : emptiesOf(first, composition)];
|
|
41
41
|
ctx.assets = loaded.assets;
|
|
42
|
+
if (loaded.list !== null) ctx.fixtureFiles = {
|
|
43
|
+
list: loaded.list,
|
|
44
|
+
files: loaded.files
|
|
45
|
+
};
|
|
42
46
|
return { violations };
|
|
43
47
|
}
|
|
44
48
|
|
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
import { exportSite } from "../../../section/discovery.js";
|
|
2
|
-
import { describeError } from "../messages.js";
|
|
3
|
-
import { buildSectionLogic } from "../../../template/logic-build.js";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
|
|
6
1
|
//#region src/cli/check/stages/logic.ts
|
|
7
|
-
|
|
2
|
+
function logicStage(ctx) {
|
|
8
3
|
const { workspace, discovered, composition } = ctx;
|
|
9
|
-
if ((workspace?.template ?? null) === null || discovered === void 0 || composition === void 0) return { skipped: "the composition stage could not derive the placed sections" };
|
|
4
|
+
if ((workspace?.template ?? null) === null || discovered === void 0 || composition === void 0) return Promise.resolve({ skipped: "the composition stage could not derive the placed sections" });
|
|
10
5
|
const violations = [];
|
|
11
6
|
const sections = /* @__PURE__ */ new Map();
|
|
12
|
-
for (const
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
sections.set(key, await buildSectionLogic({
|
|
17
|
-
module: join(ctx.root, site.module),
|
|
18
|
-
exportName: site.exportName
|
|
19
|
-
}));
|
|
20
|
-
} catch (cause) {
|
|
21
|
-
violations.push({
|
|
22
|
-
rule: "logic/section-build-failed",
|
|
23
|
-
file: site.module,
|
|
24
|
-
message: `Section "${key}"'s logic bundle does not build: ${describeError(cause)}`
|
|
25
|
-
});
|
|
26
|
-
}
|
|
7
|
+
for (const section of ctx.build.sections) {
|
|
8
|
+
if (section.logic === void 0) continue;
|
|
9
|
+
if (section.logic.ok) sections.set(section.local, section.logic.value);
|
|
10
|
+
else violations.push(section.logic.violation);
|
|
27
11
|
}
|
|
28
12
|
if (violations.length === 0) ctx.logic = { sections };
|
|
29
|
-
return { violations };
|
|
13
|
+
return Promise.resolve({ violations });
|
|
30
14
|
}
|
|
31
15
|
|
|
32
16
|
//#endregion
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { isListSlotType } from "../../../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
2
|
import { describeError } from "../messages.js";
|
|
3
|
-
import {
|
|
3
|
+
import { corpusSections } from "../render/corpus.js";
|
|
4
4
|
import { listEditing } from "../../../packages/internal/template-contracts/dist/list-editing.js";
|
|
5
5
|
import { checkClassConflicts } from "../render/class-conflicts.js";
|
|
6
6
|
import { parseHtml } from "../render/html.js";
|
|
7
7
|
import { checkRenderInvariants } from "../render/invariants.js";
|
|
8
8
|
import { checkItemIndices, collectMarkerCoverage } from "../render/marker-coverage.js";
|
|
9
|
-
import { createElement } from "react";
|
|
10
|
-
import { renderToStaticMarkup } from "react-dom/server";
|
|
11
9
|
|
|
12
10
|
//#region src/cli/check/stages/render.ts
|
|
13
11
|
function editingViewOf(spec) {
|
|
@@ -70,27 +68,27 @@ async function renderStage(ctx) {
|
|
|
70
68
|
const { composition, sections, corpus } = ctx;
|
|
71
69
|
if (composition === void 0 || sections === void 0) return { skipped: "the sections stage could not materialize the placed sections" };
|
|
72
70
|
if (corpus === void 0 || corpus.length === 0) return { skipped: "no fixture resolved, so the render corpus is empty" };
|
|
73
|
-
const assets = ctx.assets ?? /* @__PURE__ */ new Map();
|
|
74
71
|
const imported = ctx.workspace?.assets ?? /* @__PURE__ */ new Map();
|
|
75
|
-
const carriesMedia = (url) => {
|
|
76
|
-
const path = new URL(url, "http://workspace.invalid").pathname;
|
|
77
|
-
return assets.has(path) || imported.has(path);
|
|
78
|
-
};
|
|
79
72
|
const evidence = new Map(sections.map((entry) => [entry.key, new SectionEvidence(entry)]));
|
|
80
|
-
for
|
|
73
|
+
for (const { corpus: { emptied }, instanceId, entry, render, where } of corpusSections(composition, sections, corpus, ctx.assets)) {
|
|
81
74
|
const proof = evidence.get(entry.key);
|
|
82
75
|
if (proof === void 0) continue;
|
|
83
|
-
const {
|
|
84
|
-
|
|
85
|
-
let first;
|
|
76
|
+
const { schema } = proof.entry;
|
|
77
|
+
let rendered;
|
|
86
78
|
let second;
|
|
87
79
|
try {
|
|
88
|
-
|
|
89
|
-
second =
|
|
80
|
+
rendered = await render();
|
|
81
|
+
second = (await render()).section.html;
|
|
90
82
|
} catch (cause) {
|
|
91
83
|
proof.report("render/unrenderable", `${where}: the section throws when it renders: ${describeError(cause)}`);
|
|
92
84
|
continue;
|
|
93
85
|
}
|
|
86
|
+
const first = rendered.section.html;
|
|
87
|
+
const props = rendered.section.inputs;
|
|
88
|
+
const carriesMedia = (url) => {
|
|
89
|
+
const path = new URL(url, "http://workspace.invalid").pathname;
|
|
90
|
+
return rendered.named.has(path) || imported.has(path);
|
|
91
|
+
};
|
|
94
92
|
const coverage = collectMarkerCoverage(parseHtml(first));
|
|
95
93
|
for (const id of coverage.slotIds) proof.marked.add(id);
|
|
96
94
|
for (const id of coverage.selectableSlotIds) proof.selectable.add(id);
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import { tableColumnOfKey, tableKey, tableOf } from "../../../packages/internal/template-contracts/dist/registry-shape.js";
|
|
2
|
-
import { declaringModule } from "../../../section/section.js";
|
|
3
2
|
import "../../../packages/internal/template-contracts/dist/table-members.js";
|
|
4
|
-
import { isInsideRoot, workspacePath } from "../../../platform/paths.js";
|
|
5
|
-
import { exportSite } from "../../../section/discovery.js";
|
|
6
|
-
import { describeError } from "../messages.js";
|
|
7
|
-
import { fillSpecFromSchema } from "../../../schema/extract-fill-spec.js";
|
|
8
|
-
import { TEMPLATE_FILE } from "../load-workspace.js";
|
|
9
|
-
import { FillSpec } from "../../../packages/internal/template-contracts/dist/fill-spec-schema.js";
|
|
10
|
-
import { SectionSchema } from "../../../schema/section-schema.js";
|
|
11
|
-
import { materializeSection } from "../../../section/materialize.js";
|
|
12
|
-
import { isAbsolute } from "node:path";
|
|
13
3
|
|
|
14
4
|
//#region src/cli/check/stages/sections.ts
|
|
15
|
-
function flatten(parsed, key) {
|
|
16
|
-
const { meta, ...rest } = parsed;
|
|
17
|
-
return {
|
|
18
|
-
...rest,
|
|
19
|
-
slot_order: Object.keys(rest.slots),
|
|
20
|
-
anchor: meta.anchor ?? key,
|
|
21
|
-
...meta.display ? { display: meta.display } : {}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function stampItemOrder(object) {
|
|
25
|
-
object.item_order = Object.keys(object.fields);
|
|
26
|
-
for (const field of Object.values(object.fields)) {
|
|
27
|
-
const element = field.element;
|
|
28
|
-
if (field.type === "list" && element?.type === "object") stampItemOrder(element);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
5
|
function heldTables(slot) {
|
|
32
6
|
const rowTables = (row) => row?.type === "row" ? [row.from].flat().flatMap((key) => tableOf(key) ?? []) : [];
|
|
33
7
|
if (slot.type === "row") return new Set(rowTables(slot));
|
|
@@ -79,50 +53,32 @@ function rowProjectionLists(schema) {
|
|
|
79
53
|
function sectionsStage(ctx) {
|
|
80
54
|
const { workspace, discovered, composition } = ctx;
|
|
81
55
|
if (workspace === void 0 || discovered === void 0 || composition === void 0) return Promise.resolve({ skipped: "the composition stage could not derive the placed sections" });
|
|
82
|
-
const fileOf = (section) => {
|
|
83
|
-
const exported = exportSite(discovered, section);
|
|
84
|
-
if (exported !== void 0) return exported.module;
|
|
85
|
-
const at = declaringModule(section);
|
|
86
|
-
return at !== void 0 && isAbsolute(at) && isInsideRoot(workspace.root, at) ? workspacePath(workspace.root, at) : TEMPLATE_FILE;
|
|
87
|
-
};
|
|
88
56
|
const violations = [];
|
|
89
57
|
const hints = [];
|
|
90
58
|
const sections = [];
|
|
91
|
-
for (const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const parsed = SectionSchema.parse(materialized);
|
|
96
|
-
for (const slot of Object.values(parsed.slots)) {
|
|
97
|
-
if (slot.type === "object") stampItemOrder(slot);
|
|
98
|
-
if (slot.type === "list" && slot.element?.type === "object") stampItemOrder(slot.element);
|
|
99
|
-
}
|
|
100
|
-
const fillSpec = FillSpec.parse(fillSpecFromSchema(materialized));
|
|
101
|
-
const schema = flatten(parsed, key);
|
|
102
|
-
sections.push({
|
|
103
|
-
key,
|
|
104
|
-
section,
|
|
105
|
-
file,
|
|
106
|
-
schema,
|
|
107
|
-
fillSpec
|
|
108
|
-
});
|
|
109
|
-
for (const [path, table, registryKey] of wholeTableReads(schema)) hints.push({
|
|
110
|
-
rule: "sections/whole-table-read",
|
|
111
|
-
file,
|
|
112
|
-
message: `Section "${key}": \`${path}\` computes from the whole table "${table}", so every member of it counts as used. If the value needs only some members, read those columns instead (\`fact.${registryKey}.<member>\`).`
|
|
113
|
-
});
|
|
114
|
-
for (const [path, registryKey] of rowProjectionLists(schema)) violations.push({
|
|
115
|
-
rule: "sections/row-projection-list",
|
|
116
|
-
file,
|
|
117
|
-
message: `Section "${key}": \`${path}\` computes its items from the columns of "${registryKey}", so an item loses its row: the user cannot tell which row it stands for, choose another, or edit the member where it lives. Hold the rows instead: an item holding a row \`from: fact.${registryKey}\`, its other fields reading members off that row, and a \`compute({ reads: [fact.${registryKey}] }, (rows) => …)\` returning the rows the list starts with as its source. Or, where the list is vocabulary nobody arranges, declare it \`locked: true\`.`
|
|
118
|
-
});
|
|
119
|
-
} catch (cause) {
|
|
120
|
-
violations.push({
|
|
121
|
-
rule: "sections/schema-invalid",
|
|
122
|
-
file,
|
|
123
|
-
message: `Section "${key}": ${describeError(cause)}`
|
|
124
|
-
});
|
|
59
|
+
for (const { local: key, section, file, shape } of ctx.build.sections) {
|
|
60
|
+
if (!shape.ok) {
|
|
61
|
+
violations.push(shape.violation);
|
|
62
|
+
continue;
|
|
125
63
|
}
|
|
64
|
+
const { schema, fillSpec } = shape.value;
|
|
65
|
+
sections.push({
|
|
66
|
+
key,
|
|
67
|
+
section,
|
|
68
|
+
file,
|
|
69
|
+
schema,
|
|
70
|
+
fillSpec
|
|
71
|
+
});
|
|
72
|
+
for (const [path, table, registryKey] of wholeTableReads(schema)) hints.push({
|
|
73
|
+
rule: "sections/whole-table-read",
|
|
74
|
+
file,
|
|
75
|
+
message: `Section "${key}": \`${path}\` computes from the whole table "${table}", so every member of it counts as used. If the value needs only some members, read those columns instead (\`fact.${registryKey}.<member>\`).`
|
|
76
|
+
});
|
|
77
|
+
for (const [path, registryKey] of rowProjectionLists(schema)) violations.push({
|
|
78
|
+
rule: "sections/row-projection-list",
|
|
79
|
+
file,
|
|
80
|
+
message: `Section "${key}": \`${path}\` computes its items from the columns of "${registryKey}", so an item loses its row: the user cannot tell which row it stands for, choose another, or edit the member where it lives. Hold the rows instead: an item holding a row \`from: fact.${registryKey}\`, its other fields reading members off that row, and a \`compute({ reads: [fact.${registryKey}] }, (rows) => …)\` returning the rows the list starts with as its source. Or, where the list is vocabulary nobody arranges, declare it \`locked: true\`.`
|
|
81
|
+
});
|
|
126
82
|
}
|
|
127
83
|
ctx.sections = sections;
|
|
128
84
|
return Promise.resolve({
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
import { compileTemplateCss } from "../../../css/compile.js";
|
|
2
|
-
import { describeError } from "../messages.js";
|
|
3
|
-
import { TEMPLATE_FILE } from "../load-workspace.js";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
|
|
6
1
|
//#region src/cli/check/stages/stylesheet.ts
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
if (template ===
|
|
10
|
-
|
|
11
|
-
const { violations } = await compileTemplateCss({
|
|
12
|
-
root: ctx.root,
|
|
13
|
-
templateFile: join(ctx.root, TEMPLATE_FILE),
|
|
14
|
-
template: {
|
|
15
|
-
key: template.key,
|
|
16
|
-
output: template.output,
|
|
17
|
-
formats: template.formats
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
return { violations };
|
|
21
|
-
} catch (cause) {
|
|
22
|
-
return { violations: [{
|
|
23
|
-
rule: "css/compile-failed",
|
|
24
|
-
file: TEMPLATE_FILE,
|
|
25
|
-
message: `The stylesheet reachable from ${TEMPLATE_FILE} could not be resolved or compiled: ${describeError(cause)}`
|
|
26
|
-
}] };
|
|
27
|
-
}
|
|
2
|
+
function stylesheetStage(ctx) {
|
|
3
|
+
const { stylesheet } = ctx.build;
|
|
4
|
+
if (ctx.workspace?.template == null || stylesheet === void 0) return Promise.resolve({ skipped: "the workspace stage could not load template.ts" });
|
|
5
|
+
return Promise.resolve({ violations: stylesheet.ok ? stylesheet.value.violations : [stylesheet.violation] });
|
|
28
6
|
}
|
|
29
7
|
|
|
30
8
|
//#endregion
|
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TEMPLATE_FILE
|
|
3
|
-
import { loadFixtures } from "../../../fixtures/load.js";
|
|
1
|
+
import { dataFixtureId, resolveReference } from "../../../packages/internal/playground/dist/host/fixture-documents.js";
|
|
2
|
+
import { TEMPLATE_FILE } from "../load-workspace.js";
|
|
4
3
|
import { listSourcePaths } from "../../build/source.js";
|
|
5
4
|
import { crlfTextViolations } from "../line-endings.js";
|
|
6
5
|
import { unportableNameViolations } from "../portable-names.js";
|
|
7
6
|
import { templateKeyViolations } from "../template-key.js";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { readFile } from "node:fs/promises";
|
|
8
9
|
|
|
9
10
|
//#region src/cli/check/stages/workspace.ts
|
|
10
11
|
async function workspaceStage(ctx) {
|
|
11
|
-
const workspace =
|
|
12
|
+
const { workspace, discovered, duplicateKey } = ctx.build;
|
|
12
13
|
ctx.workspace = workspace;
|
|
13
14
|
const violations = [...workspace.violations, ...await crlfTextViolations(ctx.root)];
|
|
14
15
|
if (workspace.template !== null) {
|
|
15
16
|
violations.push(...templateKeyViolations(workspace.template, TEMPLATE_FILE));
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
root: ctx.root,
|
|
19
|
-
importModule: (file) => Promise.resolve(workspace.modules.get(file) ?? {})
|
|
20
|
-
});
|
|
21
|
-
} catch (cause) {
|
|
22
|
-
if (!(cause instanceof DuplicateSectionKeyError)) throw cause;
|
|
23
|
-
violations.push({
|
|
24
|
-
rule: "workspace/duplicate-section-key",
|
|
25
|
-
file: cause.second.module,
|
|
26
|
-
message: cause.message
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
ctx.fixtures = await loadFixtures({ root: ctx.root });
|
|
17
|
+
if (discovered !== void 0) ctx.discovered = discovered;
|
|
18
|
+
if (duplicateKey !== void 0) violations.push(duplicateKey);
|
|
30
19
|
}
|
|
31
20
|
violations.push(...unportableNameViolations({
|
|
32
21
|
sourcePaths: await listSourcePaths(ctx.root, []),
|
|
@@ -38,13 +27,29 @@ async function workspaceStage(ctx) {
|
|
|
38
27
|
name: site.section.key,
|
|
39
28
|
module: site.module
|
|
40
29
|
})),
|
|
41
|
-
fixtures:
|
|
42
|
-
name: fixture.id,
|
|
43
|
-
module: fixture.module
|
|
44
|
-
}))
|
|
30
|
+
fixtures: workspace.template === null ? [] : await listedFixtures(ctx.root, workspace.template.fixtures)
|
|
45
31
|
}));
|
|
46
32
|
return { violations };
|
|
47
33
|
}
|
|
34
|
+
async function listedFixtures(root, list) {
|
|
35
|
+
if (list === void 0) return [];
|
|
36
|
+
const listRef = resolveReference(TEMPLATE_FILE, list);
|
|
37
|
+
if ("problem" in listRef) return [];
|
|
38
|
+
let named;
|
|
39
|
+
try {
|
|
40
|
+
named = JSON.parse(await readFile(join(root, ...listRef.path.split("/")), "utf8")).fixtures;
|
|
41
|
+
} catch {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
if (!Array.isArray(named)) return [];
|
|
45
|
+
return named.flatMap((reference) => {
|
|
46
|
+
const ref = resolveReference(listRef.path, reference);
|
|
47
|
+
return "path" in ref ? [{
|
|
48
|
+
name: dataFixtureId(ref.path),
|
|
49
|
+
module: ref.path
|
|
50
|
+
}] : [];
|
|
51
|
+
});
|
|
52
|
+
}
|
|
48
53
|
|
|
49
54
|
//#endregion
|
|
50
55
|
export { workspaceStage };
|