@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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { RequestError } from "./http.js";
|
|
2
|
+
import { fingerprintOf } from "../../../file-store/dist/files.js";
|
|
3
|
+
import { buildFingerprint } from "../build-fingerprint.js";
|
|
4
|
+
import { verifyBuildCode } from "./verify-build.js";
|
|
5
|
+
|
|
6
|
+
//#region ../../internal/playground/dist/server/verification.js
|
|
7
|
+
const VERIFY_OPERATION = "verify";
|
|
8
|
+
const VERDICT_TYPE = "application/json";
|
|
9
|
+
function verdictFingerprint(build, platform) {
|
|
10
|
+
return fingerprintOf(new TextEncoder().encode(JSON.stringify([
|
|
11
|
+
VERIFY_OPERATION,
|
|
12
|
+
build,
|
|
13
|
+
platform
|
|
14
|
+
])));
|
|
15
|
+
}
|
|
16
|
+
function buildVerification(host) {
|
|
17
|
+
const { platform, derived } = host;
|
|
18
|
+
async function keptUnder(build) {
|
|
19
|
+
const file = await derived.kept(await verdictFingerprint(build, platform));
|
|
20
|
+
if (file === null) return null;
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(new TextDecoder().decode(file.bytes));
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
platform,
|
|
29
|
+
operation: {
|
|
30
|
+
name: VERIFY_OPERATION,
|
|
31
|
+
takes: "nothing",
|
|
32
|
+
mark: "Verifying",
|
|
33
|
+
joins: true,
|
|
34
|
+
async run({ job, report }) {
|
|
35
|
+
const view = await host.view(job.template, job.version);
|
|
36
|
+
if (view === null) throw new Error(`The template has no version ${job.version}.`);
|
|
37
|
+
const build = await buildFingerprint(view);
|
|
38
|
+
if (build === null) throw new Error(`Version ${job.version} holds no build to verify.`);
|
|
39
|
+
await report({ log: `Verifying the build ${build.slice(0, 12)} on platform ${platform}.` });
|
|
40
|
+
const problems = await verifyBuildCode(view, host.code);
|
|
41
|
+
const verdict = {
|
|
42
|
+
build,
|
|
43
|
+
platform,
|
|
44
|
+
passed: problems.length === 0,
|
|
45
|
+
problems
|
|
46
|
+
};
|
|
47
|
+
const fingerprint = await verdictFingerprint(build, platform);
|
|
48
|
+
await derived.keep(fingerprint, {
|
|
49
|
+
contentType: VERDICT_TYPE,
|
|
50
|
+
bytes: new TextEncoder().encode(`${JSON.stringify(verdict)}\n`)
|
|
51
|
+
});
|
|
52
|
+
await report({ progress: verdict.passed ? "Passed" : `Failed: ${String(problems.length)} ${problems.length === 1 ? "problem" : "problems"}` });
|
|
53
|
+
return { file: fingerprint };
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
async kept(view) {
|
|
57
|
+
const build = await buildFingerprint(view);
|
|
58
|
+
return build === null ? null : keptUnder(build);
|
|
59
|
+
},
|
|
60
|
+
async ask(jobs, view) {
|
|
61
|
+
const build = await buildFingerprint(view);
|
|
62
|
+
if (build === null) throw new RequestError(404, `Version ${view.version} holds no build to verify.`);
|
|
63
|
+
const verdict = await keptUnder(build);
|
|
64
|
+
if (verdict !== null) return { verdict };
|
|
65
|
+
return jobs.start({
|
|
66
|
+
operation: VERIFY_OPERATION,
|
|
67
|
+
subject: {},
|
|
68
|
+
version: view.version
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { VERIFY_OPERATION, buildVerification, verdictFingerprint };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { MANIFEST_FILE, SECTION_FILES, TEMPLATE_FILES, builtTreePath, sectionPath, templatePath } from "../../../template-artifact/dist/layout.js";
|
|
2
|
+
import { bareName } from "../../../page-render/dist/nav.js";
|
|
3
|
+
import "../../../page-render/dist/index.js";
|
|
4
|
+
import { ArtifactManifest } from "../../../template-artifact/dist/manifest.js";
|
|
5
|
+
import "../../../template-artifact/dist/index.js";
|
|
6
|
+
import { evaluateBundle } from "../../../bundle-evaluation/dist/evaluate.js";
|
|
7
|
+
import "../../../bundle-evaluation/dist/index.js";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { pathToFileURL } from "node:url";
|
|
10
|
+
import { createRequire } from "node:module";
|
|
11
|
+
|
|
12
|
+
//#region ../../internal/playground/dist/server/verify-build.js
|
|
13
|
+
function importsFrom(root) {
|
|
14
|
+
const require = createRequire(join(root, "package.json"));
|
|
15
|
+
return async (specifier) => await import(pathToFileURL(require.resolve(specifier)).href);
|
|
16
|
+
}
|
|
17
|
+
function firstLine(err) {
|
|
18
|
+
const text = err instanceof Error ? err.message : String(err);
|
|
19
|
+
return text.split("\n")[0] ?? text;
|
|
20
|
+
}
|
|
21
|
+
function derivedHandles(schema) {
|
|
22
|
+
const found = /* @__PURE__ */ new Set();
|
|
23
|
+
const visit = (value) => {
|
|
24
|
+
if (Array.isArray(value)) {
|
|
25
|
+
for (const entry of value) visit(entry);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (typeof value !== "object" || value === null) return;
|
|
29
|
+
const record = value;
|
|
30
|
+
if (record.kind === "derived" && typeof record.transform === "string") found.add(record.transform);
|
|
31
|
+
for (const child of Object.values(record)) visit(child);
|
|
32
|
+
};
|
|
33
|
+
visit(schema);
|
|
34
|
+
return [...found].sort();
|
|
35
|
+
}
|
|
36
|
+
async function readBuilt(view, path, problems) {
|
|
37
|
+
const read = await view.readText(builtTreePath(path));
|
|
38
|
+
if (read === null) problems.push({
|
|
39
|
+
path,
|
|
40
|
+
message: "missing"
|
|
41
|
+
});
|
|
42
|
+
return read?.text ?? null;
|
|
43
|
+
}
|
|
44
|
+
function parsed(text, path, problems) {
|
|
45
|
+
if (text === null) return null;
|
|
46
|
+
try {
|
|
47
|
+
return JSON.parse(text);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
problems.push({
|
|
50
|
+
path,
|
|
51
|
+
message: `is not JSON: ${firstLine(err)}`
|
|
52
|
+
});
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function verifyBuildCode(view, platform) {
|
|
57
|
+
const problems = [];
|
|
58
|
+
const manifestValue = parsed(await readBuilt(view, MANIFEST_FILE, problems), MANIFEST_FILE, problems);
|
|
59
|
+
if (manifestValue === null) return problems;
|
|
60
|
+
const manifest = ArtifactManifest.safeParse(manifestValue);
|
|
61
|
+
if (!manifest.success) return [...problems, {
|
|
62
|
+
path: MANIFEST_FILE,
|
|
63
|
+
message: "is not a build's manifest"
|
|
64
|
+
}];
|
|
65
|
+
const compositionPath = templatePath(TEMPLATE_FILES.composition);
|
|
66
|
+
const composition = parsed(await readBuilt(view, compositionPath, problems), compositionPath, problems) ?? {};
|
|
67
|
+
const anchors = {};
|
|
68
|
+
for (const page of composition.pages ?? []) for (const placed of page.sections ?? []) if (typeof placed.section === "string") anchors[bareName(placed.section)] = `#${bareName(placed.section)}`;
|
|
69
|
+
for (const section of manifest.data.sections) {
|
|
70
|
+
const schemaPath = sectionPath(section.key, SECTION_FILES.schema);
|
|
71
|
+
const schema = parsed(await readBuilt(view, schemaPath, problems), schemaPath, problems) ?? {};
|
|
72
|
+
const logicPath = sectionPath(section.key, SECTION_FILES.logic);
|
|
73
|
+
const logicText = await readBuilt(view, logicPath, problems);
|
|
74
|
+
if (logicText !== null) try {
|
|
75
|
+
const computed = (await evaluateBundle(logicText, { name: logicPath })).computed;
|
|
76
|
+
const bound = derivedHandles(schema);
|
|
77
|
+
if (typeof computed !== "object" || computed === null) {
|
|
78
|
+
if (bound.length > 0) problems.push({
|
|
79
|
+
path: logicPath,
|
|
80
|
+
message: `exports no \`computed\` map, and the schema binds ${bound.join(", ")}`
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
const missing = bound.filter((name) => typeof computed[name] !== "function");
|
|
84
|
+
if (missing.length > 0) problems.push({
|
|
85
|
+
path: logicPath,
|
|
86
|
+
message: `\`computed\` has no function for the schema's derived handle${missing.length === 1 ? "" : "s"} ${missing.join(", ")}`
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
} catch (err) {
|
|
90
|
+
problems.push({
|
|
91
|
+
path: logicPath,
|
|
92
|
+
message: `failed to load: ${firstLine(err)}`
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const rendererPath = sectionPath(section.key, SECTION_FILES.renderer);
|
|
96
|
+
const rendererText = await readBuilt(view, rendererPath, problems);
|
|
97
|
+
if (rendererText === null) continue;
|
|
98
|
+
let component;
|
|
99
|
+
try {
|
|
100
|
+
component = (await evaluateBundle(rendererText, {
|
|
101
|
+
name: rendererPath,
|
|
102
|
+
importExternal: platform.importExternal
|
|
103
|
+
})).default;
|
|
104
|
+
} catch (err) {
|
|
105
|
+
problems.push({
|
|
106
|
+
path: rendererPath,
|
|
107
|
+
message: `failed to load: ${firstLine(err)}`
|
|
108
|
+
});
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (typeof component !== "function" && (typeof component !== "object" || component === null)) {
|
|
112
|
+
problems.push({
|
|
113
|
+
path: rendererPath,
|
|
114
|
+
message: "has no default export a renderer can render"
|
|
115
|
+
});
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
platform.react.renderToString(platform.react.createElement(component, {
|
|
120
|
+
slots: {},
|
|
121
|
+
variant: schema.display?.variant?.cases?.[0],
|
|
122
|
+
nav: {
|
|
123
|
+
selfAnchor: bareName(section.key),
|
|
124
|
+
anchors,
|
|
125
|
+
pages: []
|
|
126
|
+
}
|
|
127
|
+
}), { identifierPrefix: section.key });
|
|
128
|
+
} catch (err) {
|
|
129
|
+
problems.push({
|
|
130
|
+
path: rendererPath,
|
|
131
|
+
message: `threw rendering empty slots: ${firstLine(err)}`
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return problems;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { derivedHandles, importsFrom, verifyBuildCode };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region ../../internal/playground/dist/wire.js
|
|
2
|
+
const LADDER_OPERATION = "ladder";
|
|
3
|
+
function query(params) {
|
|
4
|
+
const search = new URLSearchParams();
|
|
5
|
+
for (const [key, value] of Object.entries(params)) if (value !== null && value !== void 0 && value !== "") search.set(key, value);
|
|
6
|
+
const text = search.toString();
|
|
7
|
+
return text === "" ? "" : `?${text}`;
|
|
8
|
+
}
|
|
9
|
+
const OUTPUT_FOLDERS = {
|
|
10
|
+
site: "site",
|
|
11
|
+
download: "download"
|
|
12
|
+
};
|
|
13
|
+
function parseOutputPath(path) {
|
|
14
|
+
const [head, property, kind, fixture, output, ...rest] = path.split("/");
|
|
15
|
+
if (head !== "properties" || kind !== "content" || property === void 0 || property === "" || fixture === void 0 || fixture === "") return null;
|
|
16
|
+
if (output !== OUTPUT_FOLDERS.site && output !== OUTPUT_FOLDERS.download) return null;
|
|
17
|
+
try {
|
|
18
|
+
return {
|
|
19
|
+
property: decodeURIComponent(property),
|
|
20
|
+
fixture: decodeURIComponent(fixture),
|
|
21
|
+
output,
|
|
22
|
+
rest: rest.map(decodeURIComponent)
|
|
23
|
+
};
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const ROUTES = {
|
|
29
|
+
catalog: "api/catalog",
|
|
30
|
+
problems: "api/problems",
|
|
31
|
+
render: "api/render",
|
|
32
|
+
save: "api/save",
|
|
33
|
+
library: "api/library",
|
|
34
|
+
fixtures: "api/fixtures",
|
|
35
|
+
upload: (request) => {
|
|
36
|
+
const { target } = request;
|
|
37
|
+
return `api/upload${query({
|
|
38
|
+
property: "property" in target ? target.property : null,
|
|
39
|
+
fixture: "fixture" in target ? target.fixture : null,
|
|
40
|
+
name: request.name,
|
|
41
|
+
list: "list" in target ? target.list : null,
|
|
42
|
+
owner: "owner" in target ? target.owner : null,
|
|
43
|
+
instance: "instance" in target ? target.instance : null,
|
|
44
|
+
slot: "slot" in target ? target.slot : null
|
|
45
|
+
})}`;
|
|
46
|
+
},
|
|
47
|
+
media: (property) => `api/media${query({ property })}`,
|
|
48
|
+
owned: (fixture) => `api/owned${query({ fixture })}`,
|
|
49
|
+
bootstrap: (fixture, format) => `api/bootstrap${query({
|
|
50
|
+
fixture,
|
|
51
|
+
format
|
|
52
|
+
})}`,
|
|
53
|
+
requirements: (fixture) => `api/requirements${query({ fixture })}`,
|
|
54
|
+
propertyRequirements: (property) => `api/requirements${query({ property })}`,
|
|
55
|
+
facts: (property, home) => `api/facts${query({
|
|
56
|
+
property,
|
|
57
|
+
home
|
|
58
|
+
})}`,
|
|
59
|
+
canvas: (property, fixture, canvas, format) => `properties/${encodeURIComponent(property)}/content/${encodeURIComponent(fixture)}/${canvas === null ? "canvas" : `canvas/${encodeURIComponent(canvas)}`}${query({ format })}`,
|
|
60
|
+
live: (property, fixture, pagePath) => `properties/${encodeURIComponent(property)}/content/${encodeURIComponent(fixture)}/live${pagePath === "/" ? "" : `/${encodeURIComponent(pagePath.slice(1))}`}`,
|
|
61
|
+
leads: "api/leads/ingest",
|
|
62
|
+
output: (property, fixture, output) => `properties/${encodeURIComponent(property)}/content/${encodeURIComponent(fixture)}/${output === "website" ? OUTPUT_FOLDERS.site : OUTPUT_FOLDERS.download}/`,
|
|
63
|
+
download: (property, fixture, options = {}) => `${ROUTES.output(property, fixture, "image").slice(0, -1)}${options.page === void 0 || options.page === null ? "" : `/${encodeURIComponent(options.page)}.png`}${query({ format: options.format })}`,
|
|
64
|
+
site: (property, fixture, pagePath) => `${ROUTES.output(property, fixture, "website")}${pagePath === "/" ? "" : `${pagePath.slice(1)}/`}`,
|
|
65
|
+
build: "build/",
|
|
66
|
+
jobs: "api/jobs",
|
|
67
|
+
job: (id, wait) => `api/jobs/${encodeURIComponent(id)}${query({ wait: wait === void 0 ? null : String(wait) })}`,
|
|
68
|
+
probe: (fixture) => `api/probe${query({ fixture })}`,
|
|
69
|
+
verify: "api/verify",
|
|
70
|
+
changes: "__changes"
|
|
71
|
+
};
|
|
72
|
+
const CHANGE_EVENTS = {
|
|
73
|
+
files: "files",
|
|
74
|
+
job: "job"
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { CHANGE_EVENTS, LADDER_OPERATION, OUTPUT_FOLDERS, ROUTES, parseOutputPath };
|
|
@@ -249,4 +249,4 @@ const RegistryFactsSchema = z.object({
|
|
|
249
249
|
}).strict();
|
|
250
250
|
|
|
251
251
|
//#endregion
|
|
252
|
-
export { HomeMediaValueSchema, MediaFileSchema, MediaReferenceSchema, RegistryFactsSchema };
|
|
252
|
+
export { CropSchema, HomeMediaValueSchema, MediaFileSchema, MediaReferenceSchema, MediaSchema, PlaceRenditionSchema, RegistryFactsSchema, selectSchema };
|
|
@@ -3,8 +3,8 @@ import { readMediaOf } from "../../template-contracts/dist/media-candidates.js";
|
|
|
3
3
|
import { tableOf } from "../../template-contracts/dist/registry-shape.js";
|
|
4
4
|
import { isMediaListKey } from "../../template-contracts/dist/fact-keys.js";
|
|
5
5
|
import "../../template-contracts/dist/table-members.js";
|
|
6
|
-
import { FINDABLE_KINDS, isFindableKind } from "../../template-contracts/dist/findable.js";
|
|
7
6
|
import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
7
|
+
import { FINDABLE_KINDS, isFindableKind } from "../../template-contracts/dist/findable.js";
|
|
8
8
|
import { readFillVerb } from "../../fill-vocabulary/dist/verbs.js";
|
|
9
9
|
import { producedSlot } from "./grammar-scope.js";
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memberSourceOf } from "../../template-contracts/dist/row-sources.js";
|
|
2
|
-
import { fillOf, grammarSlots, sameSectionSlot, slotInScope } from "./grammar-scope.js";
|
|
3
2
|
import { objectFieldOf } from "../../template-contracts/dist/slot-overrides.js";
|
|
3
|
+
import { fillOf, grammarSlots, sameSectionSlot, slotInScope } from "./grammar-scope.js";
|
|
4
4
|
|
|
5
5
|
//#region ../../internal/section-contracts/dist/reads-acyclic-contract.js
|
|
6
6
|
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { plannerForField } from "../../template-contracts/dist/row-planners.js";
|
|
2
1
|
import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
2
|
+
import { plannerForField } from "../../template-contracts/dist/row-planners.js";
|
|
3
3
|
import "../../fill-vocabulary/dist/row-planners.js";
|
|
4
4
|
import { isListFill } from "./fill-spec-view.js";
|
|
5
5
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { mediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../internal/site-files/dist/head.js
|
|
4
|
+
const DESCRIPTION_MAX = 155;
|
|
5
|
+
function extractSiteMetaDescription(contentDoc) {
|
|
6
|
+
const doc = contentDoc && typeof contentDoc === "object" ? contentDoc : {};
|
|
7
|
+
const description = (doc.site_meta && typeof doc.site_meta === "object" ? doc.site_meta : {}).description;
|
|
8
|
+
return typeof description === "string" && description.trim() ? description.trim() : null;
|
|
9
|
+
}
|
|
10
|
+
function extractAddressNarrative(facts) {
|
|
11
|
+
const street = facts?.address.street?.trim() ?? "";
|
|
12
|
+
const display = facts?.address.display?.trim() ?? "";
|
|
13
|
+
const unit = facts?.address.unit?.trim() ?? "";
|
|
14
|
+
const description = facts?.description?.trim() ? facts.description : null;
|
|
15
|
+
const streetAddress = street || display;
|
|
16
|
+
return {
|
|
17
|
+
streetAddress,
|
|
18
|
+
titleAddress: unit && street ? `${street}, ${unit}` : streetAddress,
|
|
19
|
+
displayAddress: display || street,
|
|
20
|
+
description
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function pageDetailsOf(facts, contentDoc) {
|
|
24
|
+
const { streetAddress, titleAddress, displayAddress, description: narrative } = extractAddressNarrative(facts);
|
|
25
|
+
return {
|
|
26
|
+
streetAddress,
|
|
27
|
+
titleAddress,
|
|
28
|
+
displayAddress,
|
|
29
|
+
description: extractSiteMetaDescription(contentDoc) ?? narrative,
|
|
30
|
+
coverMediaId: mediaIdOf(facts?.hero) ?? null
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function truncateAtWord(text, max) {
|
|
34
|
+
const trimmed = text.trim();
|
|
35
|
+
if (trimmed.length <= max) return trimmed;
|
|
36
|
+
const slice = trimmed.slice(0, max - 1);
|
|
37
|
+
const lastSpace = slice.lastIndexOf(" ");
|
|
38
|
+
return `${(lastSpace > 0 ? slice.slice(0, lastSpace) : slice).trimEnd()}…`;
|
|
39
|
+
}
|
|
40
|
+
function siteHead(input) {
|
|
41
|
+
const siteTitle = input.titleAddress || input.streetAddress || input.displayAddress || input.fallbackTitle;
|
|
42
|
+
const raw = input.description && input.description.trim() ? input.description : input.displayAddress || siteTitle;
|
|
43
|
+
return {
|
|
44
|
+
siteTitle,
|
|
45
|
+
orgName: input.orgName,
|
|
46
|
+
description: truncateAtWord(raw, 155),
|
|
47
|
+
siteName: input.orgName ?? "HomePages"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function pageTitle(head, page) {
|
|
51
|
+
return [
|
|
52
|
+
head.siteTitle,
|
|
53
|
+
page.href === "/" ? null : page.label,
|
|
54
|
+
head.orgName
|
|
55
|
+
].filter((part) => !!part).join(" - ");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { extractAddressNarrative, extractSiteMetaDescription, pageDetailsOf, pageTitle, siteHead, truncateAtWord };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { assetContentType } from "../../template-artifact/dist/asset-mime.js";
|
|
2
|
+
import { assetPath, boundFiles } from "../../template-artifact/dist/layout.js";
|
|
3
|
+
import { carriesFixedAddresses, fillBuildFileText } from "../../static-assets-binding/dist/section-asset-url.js";
|
|
4
|
+
import { pageTitle, siteHead } from "./head.js";
|
|
5
|
+
import { renderPage } from "../../page-shell/dist/index.js";
|
|
6
|
+
|
|
7
|
+
//#region ../../internal/site-files/dist/site.js
|
|
8
|
+
const SHARE_IMAGE = {
|
|
9
|
+
width: 1200,
|
|
10
|
+
height: 630,
|
|
11
|
+
contentType: "image/jpeg",
|
|
12
|
+
position: "attention",
|
|
13
|
+
quality: 82
|
|
14
|
+
};
|
|
15
|
+
const STYLESHEET_TYPE = "text/css; charset=utf-8";
|
|
16
|
+
const SCRIPT_TYPE = "application/javascript; charset=utf-8";
|
|
17
|
+
const HTML_TYPE = "text/html; charset=utf-8";
|
|
18
|
+
const ICON_ICO_PX = 32;
|
|
19
|
+
const ICON_APPLE_PX = 180;
|
|
20
|
+
function checkBase(name, base) {
|
|
21
|
+
if (!base.startsWith("/") || !base.endsWith("/")) throw new Error(`A ${name} starts and ends with "/", not "${base}".`);
|
|
22
|
+
return base;
|
|
23
|
+
}
|
|
24
|
+
async function siteFiles(input) {
|
|
25
|
+
const contentBase = checkBase("content base", input.contentBase);
|
|
26
|
+
const buildBase = checkBase("build base", input.buildBase);
|
|
27
|
+
if (!buildBase.startsWith(contentBase)) throw new Error(`The build base "${buildBase}" sits under the content base "${contentBase}".`);
|
|
28
|
+
if (!input.siteUrl.endsWith("/")) throw new Error(`A site's address ends with "/", not "${input.siteUrl}".`);
|
|
29
|
+
const buildDir = buildBase.slice(contentBase.length);
|
|
30
|
+
const head = siteHead(input.head);
|
|
31
|
+
const copy = await buildCopy(input, buildBase, buildDir);
|
|
32
|
+
const share = input.cover === null ? null : await shareImage(input, input.cover);
|
|
33
|
+
const icoBytes = copy.byFilename.get(input.binding.icons.ico.filename);
|
|
34
|
+
if (icoBytes === void 0) throw new Error(`the build's root icon ${input.binding.icons.ico.filename} was not copied`);
|
|
35
|
+
const pages = input.pages.map((page) => ({
|
|
36
|
+
path: `${page.href.replace(/^\//, "")}index.html`,
|
|
37
|
+
contentType: HTML_TYPE,
|
|
38
|
+
immutable: false,
|
|
39
|
+
bytes: new TextEncoder().encode(pageDocument(input, head, page, {
|
|
40
|
+
contentBase,
|
|
41
|
+
buildBase,
|
|
42
|
+
share
|
|
43
|
+
}))
|
|
44
|
+
}));
|
|
45
|
+
const media = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const page of input.pages) for (const file of page.media) media.set(file.r2_path, file);
|
|
47
|
+
return {
|
|
48
|
+
files: [
|
|
49
|
+
...copy.files,
|
|
50
|
+
{
|
|
51
|
+
path: "favicon.ico",
|
|
52
|
+
contentType: "image/x-icon",
|
|
53
|
+
immutable: false,
|
|
54
|
+
bytes: icoBytes
|
|
55
|
+
},
|
|
56
|
+
...share === null ? [] : [share.file],
|
|
57
|
+
...pages
|
|
58
|
+
],
|
|
59
|
+
media: [...media.values()]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function siteBoundEntries(binding, analytics) {
|
|
63
|
+
const script = (ref) => ({
|
|
64
|
+
ref,
|
|
65
|
+
contentType: SCRIPT_TYPE
|
|
66
|
+
});
|
|
67
|
+
const icon = (ref) => ({
|
|
68
|
+
ref,
|
|
69
|
+
contentType: assetContentType(ref.filename)
|
|
70
|
+
});
|
|
71
|
+
const { ico, svg, png, apple_touch } = binding.icons;
|
|
72
|
+
return [
|
|
73
|
+
{
|
|
74
|
+
ref: binding.base_css,
|
|
75
|
+
contentType: STYLESHEET_TYPE
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
ref: binding.template_css,
|
|
79
|
+
contentType: STYLESHEET_TYPE
|
|
80
|
+
},
|
|
81
|
+
...analytics && binding.analytics !== null ? [script(binding.analytics)] : [],
|
|
82
|
+
...Object.values(binding.islands).map(script),
|
|
83
|
+
...binding.island_runtime === null ? [] : [script(binding.island_runtime)],
|
|
84
|
+
...Object.values(binding.react_vendor ?? {}).map(script),
|
|
85
|
+
...binding.react_vendor_core === null ? [] : [script(binding.react_vendor_core)],
|
|
86
|
+
icon(ico),
|
|
87
|
+
...svg === null ? [] : [icon(svg)],
|
|
88
|
+
...Object.values(png).map(icon),
|
|
89
|
+
icon(apple_touch)
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
async function buildCopy(input, buildBase, buildDir) {
|
|
93
|
+
const { binding } = input;
|
|
94
|
+
if (binding.analytics === null) throw new Error("The binding is an image or a document template's (it names no visit beacon): a site is made from a website's build.");
|
|
95
|
+
if (Object.keys(binding.islands).length > 0 && (binding.island_runtime === null || binding.react_vendor === null || binding.react_vendor_core === null)) throw new Error("The binding has islands but names no island runtime, React vendor or vendor core.");
|
|
96
|
+
const pathOf = new Map(boundFiles(binding).map((file) => [file.filename, file.path]));
|
|
97
|
+
const named = new Set(input.pages.flatMap((page) => page.buildFiles));
|
|
98
|
+
const bound = await Promise.all(siteBoundEntries(binding, input.analytics).map(async ({ ref, contentType }) => {
|
|
99
|
+
const raw = await input.readBuildFile(pathOf.get(ref.filename));
|
|
100
|
+
return {
|
|
101
|
+
path: `${buildDir}${ref.filename}`,
|
|
102
|
+
contentType,
|
|
103
|
+
immutable: true,
|
|
104
|
+
bytes: fillBuildBytes(ref.filename, raw, buildBase, named)
|
|
105
|
+
};
|
|
106
|
+
}));
|
|
107
|
+
const copied = new Set(bound.map((file) => file.path.slice(buildDir.length)));
|
|
108
|
+
const authored = await Promise.all([...named].filter((filename) => !copied.has(filename)).map(async (filename) => ({
|
|
109
|
+
path: `${buildDir}${filename}`,
|
|
110
|
+
contentType: assetContentType(filename),
|
|
111
|
+
immutable: true,
|
|
112
|
+
bytes: await input.readBuildFile(assetPath(filename))
|
|
113
|
+
})));
|
|
114
|
+
const files = [...bound, ...authored];
|
|
115
|
+
return {
|
|
116
|
+
files,
|
|
117
|
+
byFilename: new Map(files.map((file) => [file.path.slice(buildDir.length), file.bytes]))
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function fillBuildBytes(filename, raw, buildBase, named) {
|
|
121
|
+
if (!carriesFixedAddresses(filename)) return raw;
|
|
122
|
+
const filled = fillBuildFileText(filename, new TextDecoder().decode(raw), buildBase);
|
|
123
|
+
if (filled.files.length === 0) return raw;
|
|
124
|
+
for (const file of filled.files) named.add(file);
|
|
125
|
+
return new TextEncoder().encode(filled.text);
|
|
126
|
+
}
|
|
127
|
+
async function shareImage(input, cover) {
|
|
128
|
+
const bytes = await input.cutShareImage(await cover.read(), {
|
|
129
|
+
width: SHARE_IMAGE.width,
|
|
130
|
+
height: SHARE_IMAGE.height
|
|
131
|
+
});
|
|
132
|
+
return { file: {
|
|
133
|
+
path: `assets/og/${input.hash(cover.key).slice(0, 16)}.jpg`,
|
|
134
|
+
contentType: SHARE_IMAGE.contentType,
|
|
135
|
+
immutable: true,
|
|
136
|
+
bytes
|
|
137
|
+
} };
|
|
138
|
+
}
|
|
139
|
+
function pageDocument(input, head, page, bases) {
|
|
140
|
+
const { binding } = input;
|
|
141
|
+
const { contentBase, buildBase, share } = bases;
|
|
142
|
+
const pageUrl = `${input.siteUrl}${page.href.replace(/^\//, "")}`;
|
|
143
|
+
const title = pageTitle(head, page);
|
|
144
|
+
return renderPage({
|
|
145
|
+
meta: {
|
|
146
|
+
title,
|
|
147
|
+
description: head.description,
|
|
148
|
+
canonical: pageUrl,
|
|
149
|
+
ogUrl: pageUrl,
|
|
150
|
+
siteName: head.siteName,
|
|
151
|
+
icons: siteIconLinks(binding, contentBase, buildBase),
|
|
152
|
+
...share === null ? {} : {
|
|
153
|
+
ogImage: `${input.siteUrl}${share.file.path}`,
|
|
154
|
+
ogImageWidth: SHARE_IMAGE.width,
|
|
155
|
+
ogImageHeight: SHARE_IMAGE.height,
|
|
156
|
+
ogImageType: SHARE_IMAGE.contentType,
|
|
157
|
+
ogImageAlt: title
|
|
158
|
+
},
|
|
159
|
+
lang: "en"
|
|
160
|
+
},
|
|
161
|
+
bodyHtml: page.sections.join("\n"),
|
|
162
|
+
baseCss: { url: `${buildBase}${binding.base_css.filename}` },
|
|
163
|
+
templateCss: { url: `${buildBase}${binding.template_css.filename}` },
|
|
164
|
+
...input.analytics && binding.analytics !== null ? { analyticsJs: { url: `${buildBase}${binding.analytics.filename}` } } : {},
|
|
165
|
+
islands: islandLoader(binding, buildBase),
|
|
166
|
+
...input.leads ? { siteConfig: input.leads } : {},
|
|
167
|
+
prefetchUrls: input.pages.filter((p) => p.id !== page.id).map((p) => `${contentBase}${p.href.replace(/^\//, "")}`)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function islandLoader(binding, buildBase) {
|
|
171
|
+
const runtime = binding.island_runtime;
|
|
172
|
+
const core = binding.react_vendor_core;
|
|
173
|
+
if (Object.keys(binding.islands).length === 0 || runtime === null || core === null) return { kind: "none" };
|
|
174
|
+
const url = (ref) => `${buildBase}${ref.filename}`;
|
|
175
|
+
const sorted = (refs) => Object.fromEntries(Object.keys(refs).sort().map((key) => [key, url(refs[key])]));
|
|
176
|
+
return {
|
|
177
|
+
kind: "bundles",
|
|
178
|
+
runtime: { url: url(runtime) },
|
|
179
|
+
islandMap: sorted(binding.islands),
|
|
180
|
+
reactVendorMap: sorted(binding.react_vendor ?? {}),
|
|
181
|
+
reactVendorCore: { url: url(core) }
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function siteIconLinks(binding, contentBase, buildBase) {
|
|
185
|
+
const { svg, png, apple_touch } = binding.icons;
|
|
186
|
+
const links = [{
|
|
187
|
+
rel: "icon",
|
|
188
|
+
href: `${contentBase}favicon.ico`,
|
|
189
|
+
sizes: `${ICON_ICO_PX}x${ICON_ICO_PX}`
|
|
190
|
+
}];
|
|
191
|
+
if (svg !== null) links.push({
|
|
192
|
+
rel: "icon",
|
|
193
|
+
href: `${buildBase}${svg.filename}`,
|
|
194
|
+
type: "image/svg+xml"
|
|
195
|
+
});
|
|
196
|
+
for (const size of Object.keys(png).sort((a, b) => Number(a) - Number(b))) links.push({
|
|
197
|
+
rel: "icon",
|
|
198
|
+
href: `${buildBase}${png[size].filename}`,
|
|
199
|
+
sizes: `${size}x${size}`,
|
|
200
|
+
type: "image/png"
|
|
201
|
+
});
|
|
202
|
+
links.push({
|
|
203
|
+
rel: "apple-touch-icon",
|
|
204
|
+
href: `${buildBase}${apple_touch.filename}`,
|
|
205
|
+
sizes: `${ICON_APPLE_PX}x${ICON_APPLE_PX}`
|
|
206
|
+
});
|
|
207
|
+
return links;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
export { SHARE_IMAGE, siteFiles, siteIconLinks };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region ../../internal/static-assets-binding/dist/index.js
|
|
4
|
+
const ISLAND_REACT_EXTERNALS = [
|
|
5
|
+
"react",
|
|
6
|
+
"react-dom",
|
|
7
|
+
"react-dom/client",
|
|
8
|
+
"react/jsx-runtime"
|
|
9
|
+
];
|
|
10
|
+
const StaticAssetRefSchema = z.object({
|
|
11
|
+
filename: z.string().min(1),
|
|
12
|
+
content_hash: z.string().min(1)
|
|
13
|
+
});
|
|
14
|
+
const StaticAssetsBindingSchema = z.object({
|
|
15
|
+
base_css: StaticAssetRefSchema,
|
|
16
|
+
template_css: StaticAssetRefSchema,
|
|
17
|
+
islands: z.record(z.string(), StaticAssetRefSchema),
|
|
18
|
+
island_runtime: StaticAssetRefSchema.nullable(),
|
|
19
|
+
react_vendor: z.record(z.string(), StaticAssetRefSchema).nullable(),
|
|
20
|
+
react_vendor_core: StaticAssetRefSchema.nullable(),
|
|
21
|
+
analytics: StaticAssetRefSchema.nullable(),
|
|
22
|
+
masters: z.record(z.string(), z.string()),
|
|
23
|
+
icons: z.object({
|
|
24
|
+
ico: StaticAssetRefSchema,
|
|
25
|
+
svg: StaticAssetRefSchema.nullable(),
|
|
26
|
+
png: z.record(z.string(), StaticAssetRefSchema),
|
|
27
|
+
apple_touch: StaticAssetRefSchema
|
|
28
|
+
})
|
|
29
|
+
}).strict();
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { ISLAND_REACT_EXTERNALS, StaticAssetRefSchema, StaticAssetsBindingSchema };
|