@pmeweb/content
v1.1.0
Published
PmeWeb content contract: content.schema.json types, zodFrom, field checks, scheduling. Read by every site's build and by the client portal.
Readme
@pmeweb/content
The content contract every PmeWeb site and the client portal share. A site declares its
collections in src/content.schema.json; this package is what reads that declaration.
| Entry point | What | Who imports it |
|---|---|---|
| @pmeweb/content/types | CollectionDecl, Field, ScheduleDecl, ContentSchema | sites, portal |
| @pmeweb/content/zodFrom | declaration -> Astro zod schema (needs astro) | sites |
| @pmeweb/content/fields | isDate, isDateTime, isTime, isDayDate, TIME_RE | portal tier 1, zodFrom |
| @pmeweb/content/schedule | scheduleState, visibleOnSite, portalPreview, scheduleErrors, jourQuebec, quebecDay | sites, portal |
Dated kinds
date:2026-10-14, a calendar day and nothing else.datetime:2026-10-14T13:00:00.000Z, an instant with its zone. The portal edits it in Quebec time.time:09:05, a time of day on 24 hours.
Scheduling
"evenements": { "schedule": { "publishAt": "publierLe", "removeAt": ["fin", "debut"] } }publishAt: onedate/datetimefield. Adatepublishes at the start of its Quebec day, adatetimeat its instant.removeAt: one path or several; the first that yields a value wins.dates[].debuttakes the latest value in the array. Always read as a Quebec day: the entry stays through that whole day and comes off at the next day's rebuild. A site that declares a schedule needs a daily rebuild.
The portal preview
The builder sets PMEWEB_PORTAL_PREVIEW=1 on the portal's preview builds, and
PMEWEB_PORTAL_PREVIEW_PAST=1 too when the client ticked « Afficher les entrées passées ». A site
reads both once, const APERCU = portalPreview(process.env), and filters with
visibleOnSite(scheduleState(data, decl.<collection>, now), APERCU): live entries always,
scheduled ones in the preview, removed ones only in a preview that asked for them. Only the exact
string '1' counts, and the past flag means nothing without the preview flag.
Versioning
Sites and the portal pin an EXACT version. What scheduleState returns and what the field checks
accept is a frozen contract: changing either is a major version. The portal must never accept a
value a site's zodFrom refuses.
Develop
npm install # .npmrc sets legacy-peer-deps (npm 10.9 arborist crash)
npm test
npm run build # dist/ (JS + .d.ts)