@sarimarcus/content-sites-core
v0.29.2
Published
Non-visual utilities, Astro config builders and SEO schema assembly shared by the content sites.
Readme
@sarimarcus/content-sites-core
Non-visual code shared by the content sites: generic utilities, Astro config builders, SEO schema assembly,
and the type contracts ui and tourism build on (for example the card item and tag-link shapes that
today's ui components import from tourism code).
Named entry points: url, affiliate, dates, geo, dom, text, config, types, schema, interludes, images and articles (src/internal is never exported). No .astro
files. Lowest layer: imports nothing from the other packages; its one runtime dependency is marked (readingTime). Ownership per path is in
.planning/platform/catalogue.json (owner core).
Code Node loads directly (config builders imported by astro.config.mjs) ships compiled to dist/ with
type declarations. Node will not strip types from files under node_modules. So every entry point resolves to
dist/: npm run build -w packages/core compiles it (tsconfig.build.json), and release-check.mjs refuses a
missing or stale dist/.
Core code never imports astro:content, never reads import.meta.env or import.meta.glob (values and glob
results come in as parameters), and never names a site or vertical. validate-packages.mjs enforces all three.
schema assembles a page's JSON-LD graph: createSchemaContext (site URL, base path, page path, and the site's
author lookup, public-file check, markdown stripper, publisher policy and route map), assembleGraph (base nodes,
breadcrumb, then each entry's builder in call order, with hooks before and after the entries) and finalizeGraph.
Builders are factories whose options carry each site's differences, so a site reproduces its current output byte
for byte, key order included. It also holds the opening-hours model (generateOpeningHours, parseHoursString,
assertedOpenDays, hoursStringOpenDays) that scripts/validate-opening-hours.mjs imports. The factory scripts
load dist/; scripts/lib/core-dist.mjs rebuilds it when it is missing or older than src/.
images holds the one responsive width ladder (IMAGE_LADDER: 160, 240, 320, 480, 640, 960, 1280; WebP only) and the image
service defineSiteConfig installs. The service never encodes: it serves committed variants from the site's
image-variants/ (keyed by the source's content hash, listed in manifest.json) and the source bytes for the native
width, and caps each srcset at the source width. A call site asks for a responsive image with
widths={IMAGE_LADDER} plus sizes, which ui's ResponsiveImage / ResponsivePicture pass for it; images without variants (galleries) get a single src and no srcset.
content-sites-image-variants (bin, npm run images:variants in a site) writes missing variants with sharp, an
optional peer, and prunes unused ones; --check is the local form of the push gate scripts/validate-image-variants.mjs.
